genesys-cloud-streaming-client 17.2.2-develop.104 → 17.2.2-develop.105

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.
@@ -19,7 +19,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
19
19
  See the Apache Version 2.0 License for specific language governing permissions
20
20
  and limitations under the License.
21
21
  ***************************************************************************** */
22
- var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function c(e,t){return function(n,i){t(n,i,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function d(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function p(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function h(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof y?Promise.resolve(n.value.v).then(c,u):l(s[0][2],n)}catch(e){l(s[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function _(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:y(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function v(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function T(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var i=n(25),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=d;var s=Object.create(n(20)),o=n(57),a=n(59);s.inherits(d,o);for(var c=r(a.prototype),u=0;u<c.length;u++){var l=c[u];d.prototype[l]||(d.prototype[l]=a.prototype[l])}function d(e){if(!(this instanceof d))return new d(e);o.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||i.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),d.prototype._destroy=function(e,t){this.push(null),this.end(),i.nextTick(t,e)}},function(e,t,n){"use strict";n.r(t);var i=n(32),r=n(12);let s,o,a=0,c=0;var u=function(e,t,n){let u=t&&n||0;const l=t||new Array(16);let d=(e=e||{}).node||s,p=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==p){const t=e.random||(e.rng||i.a)();null==d&&(d=s=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==p&&(p=o=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),f=void 0!==e.nsecs?e.nsecs:c+1;const m=h-a+(f-c)/1e4;if(m<0&&void 0===e.clockseq&&(p=p+1&16383),(m<0||h>a)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,c=f,o=p,h+=122192928e5;const g=(1e4*(268435455&h)+f)%4294967296;l[u++]=g>>>24&255,l[u++]=g>>>16&255,l[u++]=g>>>8&255,l[u++]=255&g;const y=h/4294967296*1e4&268435455;l[u++]=y>>>8&255,l[u++]=255&y,l[u++]=y>>>24&15|16,l[u++]=y>>>16&255,l[u++]=p>>>8|128,l[u++]=255&p;for(let e=0;e<6;++e)l[u+e]=d[e];return t||Object(r.b)(l)},l=n(13);var d=function(e){if(!Object(l.a)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function p(e,t,n){function i(e,i,s,o){var a;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof i&&(i=d(i)),16!==(null===(a=i)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+e.length);if(c.set(i),c.set(e,i.length),c=n(c),c[6]=15&c[6]|t,c[8]=63&c[8]|128,s){o=o||0;for(let e=0;e<16;++e)s[o+e]=c[e];return s}return Object(r.b)(c)}try{i.name=e}catch(e){}return i.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",i.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",i}function h(e){return 14+(e+64>>>9<<4)+1}function f(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t,n,i,r,s){return f((o=f(f(t,e),f(i,s)))<<(a=r)|o>>>32-a,n);var o,a}function g(e,t,n,i,r,s,o){return m(t&n|~t&i,e,t,r,s,o)}function y(e,t,n,i,r,s,o){return m(t&i|n&~i,e,t,r,s,o)}function b(e,t,n,i,r,s,o){return m(t^n^i,e,t,r,s,o)}function _(e,t,n,i,r,s,o){return m(n^(t|~i),e,t,r,s,o)}var v=p("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let i=0;i<n;i+=8){const n=e[i>>5]>>>i%32&255,r=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(r)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[h(t)-1]=t;let n=1732584193,i=-271733879,r=-1732584194,s=271733878;for(let t=0;t<e.length;t+=16){const o=n,a=i,c=r,u=s;n=g(n,i,r,s,e[t],7,-680876936),s=g(s,n,i,r,e[t+1],12,-389564586),r=g(r,s,n,i,e[t+2],17,606105819),i=g(i,r,s,n,e[t+3],22,-1044525330),n=g(n,i,r,s,e[t+4],7,-176418897),s=g(s,n,i,r,e[t+5],12,1200080426),r=g(r,s,n,i,e[t+6],17,-1473231341),i=g(i,r,s,n,e[t+7],22,-45705983),n=g(n,i,r,s,e[t+8],7,1770035416),s=g(s,n,i,r,e[t+9],12,-1958414417),r=g(r,s,n,i,e[t+10],17,-42063),i=g(i,r,s,n,e[t+11],22,-1990404162),n=g(n,i,r,s,e[t+12],7,1804603682),s=g(s,n,i,r,e[t+13],12,-40341101),r=g(r,s,n,i,e[t+14],17,-1502002290),i=g(i,r,s,n,e[t+15],22,1236535329),n=y(n,i,r,s,e[t+1],5,-165796510),s=y(s,n,i,r,e[t+6],9,-1069501632),r=y(r,s,n,i,e[t+11],14,643717713),i=y(i,r,s,n,e[t],20,-373897302),n=y(n,i,r,s,e[t+5],5,-701558691),s=y(s,n,i,r,e[t+10],9,38016083),r=y(r,s,n,i,e[t+15],14,-660478335),i=y(i,r,s,n,e[t+4],20,-405537848),n=y(n,i,r,s,e[t+9],5,568446438),s=y(s,n,i,r,e[t+14],9,-1019803690),r=y(r,s,n,i,e[t+3],14,-187363961),i=y(i,r,s,n,e[t+8],20,1163531501),n=y(n,i,r,s,e[t+13],5,-1444681467),s=y(s,n,i,r,e[t+2],9,-51403784),r=y(r,s,n,i,e[t+7],14,1735328473),i=y(i,r,s,n,e[t+12],20,-1926607734),n=b(n,i,r,s,e[t+5],4,-378558),s=b(s,n,i,r,e[t+8],11,-2022574463),r=b(r,s,n,i,e[t+11],16,1839030562),i=b(i,r,s,n,e[t+14],23,-35309556),n=b(n,i,r,s,e[t+1],4,-1530992060),s=b(s,n,i,r,e[t+4],11,1272893353),r=b(r,s,n,i,e[t+7],16,-155497632),i=b(i,r,s,n,e[t+10],23,-1094730640),n=b(n,i,r,s,e[t+13],4,681279174),s=b(s,n,i,r,e[t],11,-358537222),r=b(r,s,n,i,e[t+3],16,-722521979),i=b(i,r,s,n,e[t+6],23,76029189),n=b(n,i,r,s,e[t+9],4,-640364487),s=b(s,n,i,r,e[t+12],11,-421815835),r=b(r,s,n,i,e[t+15],16,530742520),i=b(i,r,s,n,e[t+2],23,-995338651),n=_(n,i,r,s,e[t],6,-198630844),s=_(s,n,i,r,e[t+7],10,1126891415),r=_(r,s,n,i,e[t+14],15,-1416354905),i=_(i,r,s,n,e[t+5],21,-57434055),n=_(n,i,r,s,e[t+12],6,1700485571),s=_(s,n,i,r,e[t+3],10,-1894986606),r=_(r,s,n,i,e[t+10],15,-1051523),i=_(i,r,s,n,e[t+1],21,-2054922799),n=_(n,i,r,s,e[t+8],6,1873313359),s=_(s,n,i,r,e[t+15],10,-30611744),r=_(r,s,n,i,e[t+6],15,-1560198380),i=_(i,r,s,n,e[t+13],21,1309151649),n=_(n,i,r,s,e[t+4],6,-145523070),s=_(s,n,i,r,e[t+11],10,-1120210379),r=_(r,s,n,i,e[t+2],15,718787259),i=_(i,r,s,n,e[t+9],21,-343485551),n=f(n,o),i=f(i,a),r=f(r,c),s=f(s,u)}return[n,i,r,s]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(h(t));for(let i=0;i<t;i+=8)n[i>>5]|=(255&e[i/8])<<i%32;return n}(e),8*e.length))})),S=n(171);function w(e,t,n,i){switch(e){case 0:return t&n^~t&i;case 1:return t^n^i;case 2:return t&n^t&i^n&i;case 3:return t^n^i}}function T(e,t){return e<<t|e>>>32-t}var I=p("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const i=e.length/4+2,r=Math.ceil(i/16),s=new Array(r);for(let t=0;t<r;++t){const n=new Uint32Array(16);for(let i=0;i<16;++i)n[i]=e[64*t+4*i]<<24|e[64*t+4*i+1]<<16|e[64*t+4*i+2]<<8|e[64*t+4*i+3];s[t]=n}s[r-1][14]=8*(e.length-1)/Math.pow(2,32),s[r-1][14]=Math.floor(s[r-1][14]),s[r-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<r;++e){const i=new Uint32Array(80);for(let t=0;t<16;++t)i[t]=s[e][t];for(let e=16;e<80;++e)i[e]=T(i[e-3]^i[e-8]^i[e-14]^i[e-16],1);let r=n[0],o=n[1],a=n[2],c=n[3],u=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=T(r,5)+w(n,o,a,c)+u+t[n]+i[e]>>>0;u=c,c=a,a=T(o,30)>>>0,o=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+u>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var N=function(e){if(!Object(l.a)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)};n.d(t,"v1",(function(){return u})),n.d(t,"v3",(function(){return v})),n.d(t,"v4",(function(){return S.a})),n.d(t,"v5",(function(){return I})),n.d(t,"NIL",(function(){return"00000000-0000-0000-0000-000000000000"})),n.d(t,"version",(function(){return N})),n.d(t,"validate",(function(){return l.a})),n.d(t,"stringify",(function(){return r.a})),n.d(t,"parse",(function(){return d}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9),r=n(36);class s extends r.Transform{constructor(e,t,n="be"){super(),this._block=i.Buffer.alloc(e),this._finalSize=t,this._blockSize=e,this._bigEndian="be"===n,this._len=0}_transform(e,t,n){let i=null;try{this.update(e,t)}catch(e){i=e}n(i)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){"string"==typeof e&&(t=t||"utf8",e=i.Buffer.from(e,t));const n=this._block,r=this._blockSize,s=e.length;let o=this._len;for(let t=0;t<s;){const i=o%r,a=Math.min(s-t,r-i);for(let r=0;r<a;r++)n[i+r]=e[t+r];o+=a,t+=a,o%r==0&&this._update(n)}return this._len+=s,this}digest(e){const t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));const n=8*this._len;if(n<=4294967295)this._bigEndian?(this._block.writeUInt32BE(0,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)):(this._block.writeUInt32LE(n,this._blockSize-8),this._block.writeUInt32LE(0,this._blockSize-4));else{const e=(4294967295&n)>>>0,t=(n-e)/4294967296;this._bigEndian?(this._block.writeUInt32BE(t,this._blockSize-8),this._block.writeUInt32BE(e,this._blockSize-4)):(this._block.writeUInt32LE(e,this._blockSize-8),this._block.writeUInt32LE(t,this._blockSize-4))}this._update(this._block);const i=this._hash();return e?i.toString(e):i}_update(e){throw new Error("_update must be implemented by subclass")}_hash(){throw new Error("_update must be implemented by subclass")}}t.default=s},function(e,t,n){"use strict";t.inherits=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionTypes=void 0,function(e){e.softphone="softphone",e.collaborateVideo="collaborateVideo",e.acdScreenShare="screenShare",e.screenRecording="screenRecording",e.unknown="unknown"}(t.SessionTypes||(t.SessionTypes={}))},function(e,t){const n=e.exports={};function i(){}n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=i,n.addListener=i,n.once=i,n.off=i,n.removeListener=i,n.removeAllListeners=i,n.emit=i,n.prependListener=i,n.prependOnceListener=i,n.nextTick=(e,...t)=>window.queueMicrotask(()=>e(...t)),n.listeners=e=>[],n.cwd=()=>"/",n.umask=()=>0,n.binding=e=>{throw new Error("process.binding is not supported")},n.chdir=e=>{throw new Error("process.chdir is not supported")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(24);class r{constructor(e,t={},n=[]){this.name=e,this.attributes=t,this.children=[],this.optionalNamespaces={};for(const e of n)if("string"!=typeof e){const t=new r(e.name,e.attributes,e.children);t.parent=this,this.children.push(t)}else this.children.push(e)}getName(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name}getNamespace(){if(this.name.indexOf(":")>=0){const e=this.name.substr(0,this.name.indexOf(":"));return this.findNamespaceForPrefix(e)}return this.findNamespaceForPrefix()}getNamespaceContext(){let e={};this.parent&&(e=this.parent.getNamespaceContext());for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")){const i=t.substr(6);e[n]=i}return e}getDefaultNamespace(){return this.attributes.xmlns?this.attributes.xmlns:this.parent?this.parent.getDefaultNamespace():""}getNamespaceRoot(e){if(this.parent){const t=this.parent.getNamespaceRoot(e);if(t)return t}for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")&&n===e)return this;if(this.optionalNamespaces[e])return this}getAttribute(e,t){if(!t)return this.attributes[e];const n=this.getNamespaceContext();return n[t]?this.attributes[[n[t],e].join(":")]:void 0}getChild(e,t){return this.getChildren(e,t)[0]}getChildren(e,t){const n=[];for(const i of this.children)"string"==typeof i||i.getName()!==e||t&&i.getNamespace()!==t||n.push(i);return n}getText(){let e="";for(const t of this.children)"string"==typeof t&&(e+=t);return e}appendChild(e){return this.children.push(e),"string"!=typeof e&&(e.parent=this),e}setAttribute(e,t,n=!1){this.attributes[e]=t||void 0,""===t&&n&&(this.attributes[e]=t)}addOptionalNamespace(e,t){this.optionalNamespaces[t]=e}useNamespace(e,t){return this.optionalNamespaces[t]&&(e=this.optionalNamespaces[t]),this.setAttribute("xmlns:"+e,t),e}toJSON(){const e=this.children.map(e=>"string"==typeof e?e:e?e.toJSON():void 0).filter(e=>!!e),t={};for(const[e,n]of Object.entries(this.attributes))null!=n&&(t[e]=n);return{attributes:t,children:e,name:this.name}}toString(){let e=this.openTag(!0);if(this.children.length){for(const t of this.children)"string"==typeof t?e+=(0,i.escapeXMLText)(t):t&&(e+=t.toString());e+=this.closeTag()}return e}openTag(e=!1){let t="";t+="<"+this.name;for(const[e,n]of Object.entries(this.attributes))void 0!==n&&(t+=` ${e}="${(0,i.escapeXML)(n.toString())}"`);return e&&0===this.children.length?t+="/>":t+=">",t}closeTag(){return`</${this.name}>`}findNamespaceForPrefix(e){if(e){const t="xmlns:"+e;if(this.attributes[t])return this.attributes[t];if(this.parent)return this.parent.findNamespaceForPrefix(e)}else{if(this.attributes.xmlns)return this.attributes.xmlns;if(this.parent)return this.parent.findNamespaceForPrefix()}return""}}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.basicLanguageResolver=t.escapeXMLText=t.unescapeXML=t.escapeXML=void 0;const i=(0,n(3).__importDefault)(n(34)),r={'"':"&quot;","&":"&amp;","'":"&apos;","<":"&lt;",">":"&gt;"},s={"&amp;":"&","&apos;":"'","&gt;":">","&lt;":"<","&quot;":'"'},o=/&([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);/g,a=/&|<|>|"|'/g,c=/&|<|>/g;function u(e){return r[e]}t.escapeXML=function(e){return e.replace(a,u)},t.unescapeXML=function(e){return e.replace(o,e=>function(e){if(s[e])return s[e];const t=e.startsWith("&#x"),n=parseInt(e.substring(t?3:2,e.length-1),t?16:10);if(9===n||10===n||13===n||32<=n&&n<=55295||57344<=n&&n<=65533||65536<=n&&n<=1114111)return String.fromCodePoint(n);throw i.default.restrictedXML("Prohibited entity: "+e)}(e))},t.escapeXMLText=function(e){return e.replace(c,u)},t.basicLanguageResolver=function(e,t=[],n=""){const i=new Set(e.map(e=>e.toLowerCase()));for(let e of t.map(e=>e.toLowerCase()))if("*"!==e)for(;e.length>0;){if(i.has(e))return e;e=e.substring(0,e.lastIndexOf("-")).toLowerCase(),e.lastIndexOf("-")===e.length-2&&(e=e.substring(0,e.lastIndexOf("-")))}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nextTick=void 0,t.nextTick=function(e,...t){queueMicrotask(()=>e(...t))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exportToSDP=t.importFromSDP=void 0;const i=(0,n(3).__importStar)(n(63));t.importFromSDP=function(e){const t=i.getMediaSections(e),n=i.getDescription(e),r={groups:[],media:[]};i.matchPrefix(n,"a=ice-lite").length>0&&(r.iceLite=!0);for(const e of i.matchPrefix(n,"a=group:")){const t=e.split(" "),n=t.shift().substr(8);r.groups.push({mids:t,semantics:n})}for(const e of t){const t=i.getKind(e),s=i.isRejected(e),o=i.parseMLine(e),a={direction:i.getDirection(e,n),kind:t,mid:i.getMid(e),protocol:o.protocol};if(s||(a.iceParameters=i.getIceParameters(e,n),a.dtlsParameters=i.getDtlsParameters(e,n),a.setup=i.matchPrefix(e,"a=setup:")[0].substr(8),r.iceLite&&(a.iceParameters.iceLite=!0)),"audio"===t||"video"===t){a.rtpParameters=i.parseRtpParameters(e),a.rtpEncodingParameters=i.parseRtpEncodingParameters(e),a.rtcpParameters=i.parseRtcpParameters(e);const t=i.parseMsid(e);a.streams=t?[t]:[]}else"application"===t&&(a.sctp=i.parseSctpDescription(e));a.candidates=i.matchPrefix(e,"a=candidate:").map(i.parseCandidate),r.media.push(a)}return r},t.exportToSDP=function(e){const t=[];t.push(i.writeSessionBoilerplate(e.sessionId,e.sessionVersion),"a=msid-semantic:WMS *\r\n"),(e.iceLite||e.media.filter(e=>e.iceParameters&&e.iceParameters.iceLite).length>0)&&t.push("a=ice-lite\r\n");for(const n of e.groups||[])t.push(`a=group:${n.semantics} ${n.mids.join(" ")}\r\n`);for(const n of e.media||[]){const e=!(n.iceParameters&&n.dtlsParameters);if("application"===n.kind&&n.sctp)t.push(i.writeSctpDescription(n,n.sctp));else if(n.rtpParameters){let r=i.writeRtpDescription(n.kind,n.rtpParameters);e&&(r=r.replace(`m=${n.kind} 9 `,`m=${n.kind} 0 `)),t.push(r),t.push(`a=${n.direction||"sendrecv"}\r\n`);for(const e of n.streams||[])t.push(`a=msid:${e.stream} ${e.track}\r\n`);if(n.rtcpParameters&&(t.push(i.writeRtcpParameters(n.rtcpParameters)),n.rtcpParameters.cname&&n.rtpEncodingParameters&&n.rtpEncodingParameters[0].rtx)){const e=n.rtpEncodingParameters[0];t.push(`a=ssrc-group:FID ${e.ssrc} ${e.rtx.ssrc}\r\n`),t.push(`a=ssrc:${e.rtx.ssrc} cname:${n.rtcpParameters.cname}\r\n`)}}if(void 0!==n.mid&&t.push(`a=mid:${n.mid}\r\n`),n.iceParameters&&t.push(i.writeIceParameters({usernameFragment:n.iceParameters.usernameFragment,password:n.iceParameters.password})),n.dtlsParameters&&n.setup&&t.push(i.writeDtlsParameters(n.dtlsParameters,n.setup)),n.candidates&&n.candidates.length)for(const e of n.candidates)t.push(`a=${i.writeCandidate(e)}\r\n`)}return t.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpClient=void 0;const i=n(16).__importStar(n(66)),r=n(11);class s{constructor(){this._httpRetryingRequests=new Map}requestApiWithRetry(e,t,n){const i=r.retryPromise(this.requestApi.bind(this,e,t),e=>{var n,i,r;let o=!1;if(null==e?void 0:e.response){o=s.retryStatusCodes.has(e.response.status||0);const a=(null===(n=e.response.headers)||void 0===n?void 0:n["retry-after"])||(null===(r=(i=e.response).getResponseHeader)||void 0===r?void 0:r.call(i,"retry-after"));a&&((t.logger||console).debug("retry-after header found on response. setting retry delay",{retryAfter:a}),o=1e3*parseInt(a,10))}return o},n,t.logger);return this._httpRetryingRequests.set(i._id,i),i.promise.then(()=>this.cancelRetryRequest(i._id),()=>this.cancelRetryRequest(i._id)),i}requestApi(e,t){const n=t.logger||console,r=(new Date).getTime(),s=this._buildUri(t.host,e,t.version),o={"content-type":t.contentType||"application/json",...t.customHeaders||{}},a={method:t.method,url:s,data:t.data,responseType:t.responseType,timeout:t.requestTimeout||3e4,headers:o};t.noAuthHeader||(a.headers.Authorization="Bearer "+t.authToken);const c=this.handleResponse.bind(this,n,r,a);return i.default(a).then(c,c)}handleResponse(e,t,n,r){var s,o,a;let c=(new Date).getTime(),u=c-t+"ms";if(r instanceof i.AxiosError){if((null===(o=null===(s=r.config)||void 0===s?void 0:s.headers)||void 0===o?void 0:o.Authorization)&&(r.config.headers.Authorization="redacted"),"ECONNABORTED"===r.code)return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:u},{skipServer:!0}),Promise.reject(r);const t=r.response||{};let i=t.status,l=t.headers&&t.headers["inin-correlation-id"],d=t.data,p={...r,text:null===(a=t.request)||void 0===a?void 0:a.response};return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:u,status:i,correlationId:l,body:d},{skipServer:!0}),Promise.reject(p)}let l=r.status,d=r.headers["inin-correlation-id"],p=JSON.stringify(r.data);return e.debug(`response: ${n.method.toUpperCase()} ${n.url}`,{now:c,status:l,elapsed:u,correlationId:d,body:p},{skipServer:!0}),Promise.resolve(r)}stopAllRetries(){Array.from(this._httpRetryingRequests.keys()).forEach(e=>this.cancelRetryRequest(e))}cancelRetryRequest(e){const t=this._httpRetryingRequests.get(e);return t&&(t.cancel(new Error("Retry request cancelled")),this._httpRetryingRequests.delete(e)),!0}formatRequestError(e){if(this.isSuperagentNetworkError(e))return{status:e.status,method:e.method,url:e.url,crossDomain:e.crossDomain,message:e.message,name:e.name,stack:e.stack};if(this.isSuperagentResponseError(e)){const t=e.response;return{status:e.status,correlationId:t.headers["inin-correlation-id"],message:"Error making HTTP request",method:t.req.method,name:t.error.name,stack:t.error.stack}}return e}isSuperagentNetworkError(e){return e&&e.hasOwnProperty("status")&&e.hasOwnProperty("method")&&e.hasOwnProperty("url")}isSuperagentResponseError(e){return!!(e&&e.response&&e.response.body&&e.response.req)}_buildUri(e,t,n="v2"){return t=t.replace(/^\/+|\/+$/g,""),0===e.indexOf("http")?`${e}/api/${n}/${t}`:`https://api.${e}/api/${n}/${t}`}}t.HttpClient=s,s.retryStatusCodes=new Set([408,413,429,500,502,503,504])},function(e,t){var n=Object.prototype.hasOwnProperty;function i(e){return"[Throws: "+(e?e.message:"?")+"]"}function r(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var s=e(r.toJSON());return t.pop(),s}catch(e){return i(e)}if(Array.isArray(r)){var o=r.map(e);return t.pop(),o}var a=Object.keys(r).reduce((function(t,s){return t[s]=e(function(e,t){if(n.call(e,t))try{return e[t]}catch(e){return i(e)}return e[t]}(r,s)),t}),{});return t.pop(),a}(e)}e.exports=function(e,t,n){return JSON.stringify(r(e),t,n)},e.exports.ensureProperties=r},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";function i(e,t){return function(){return e.apply(t,arguments)}}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";t.a=null},function(e,t,n){"use strict";let i;n.d(t,"a",(function(){return s}));const r=new Uint8Array(16);function s(){if(!i&&(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!i))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(r)}},function(e,t,n){(function(e,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof i&&i;o.global!==o&&o.window!==o&&o.self;var a,c=2147483647,u=/^xn--/,l=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,f=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function y(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+g((e=e.replace(d,".")).split("."),t).join(".")}function b(e){for(var t,n,i=[],r=0,s=e.length;r<s;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<s?56320==(64512&(n=e.charCodeAt(r++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--):i.push(t);return i}function _(e){return g(e,(function(e){var t="";return e>65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=f(e)})).join("")}function v(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var i=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;i+=36)e=h(e/35);return h(i+36*e/(e+38))}function w(e){var t,n,i,r,s,o,a,u,l,d,p,f=[],g=e.length,y=0,b=128,v=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&m("not-basic"),f.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<g;){for(s=y,o=1,a=36;r>=g&&m("invalid-input"),((u=(p=e.charCodeAt(r++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>h((c-y)/o))&&m("overflow"),y+=u*o,!(u<(l=a<=v?1:a>=v+26?26:a-v));a+=36)o>h(c/(d=36-l))&&m("overflow"),o*=d;v=S(y-s,t=f.length+1,0==s),h(y/t)>c-b&&m("overflow"),b+=h(y/t),y%=t,f.splice(y++,0,b)}return _(f)}function T(e){var t,n,i,r,s,o,a,u,l,d,p,g,y,_,w,T=[];for(g=(e=b(e)).length,t=128,n=0,s=72,o=0;o<g;++o)(p=e[o])<128&&T.push(f(p));for(i=r=T.length,r&&T.push("-");i<g;){for(a=c,o=0;o<g;++o)(p=e[o])>=t&&p<a&&(a=p);for(a-t>h((c-n)/(y=i+1))&&m("overflow"),n+=(a-t)*y,t=a,o=0;o<g;++o)if((p=e[o])<t&&++n>c&&m("overflow"),p==t){for(u=n,l=36;!(u<(d=l<=s?1:l>=s+26?26:l-s));l+=36)w=u-d,_=36-d,T.push(f(v(d+w%_,0))),u=h(w/_);T.push(f(v(u,0))),s=S(n,y,i==r),n=0,++i}++n,++t}return T.join("")}a={version:"1.4.1",ucs2:{decode:b,encode:_},decode:w,encode:T,toASCII:function(e){return y(e,(function(e){return l.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return y(e,(function(e){return u.test(e)?w(e.slice(4).toLowerCase()):e}))}},void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r)}()}).call(this,n(191)(e),n(15))},function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.JXTErrorCondition=void 0,function(e){e.NotWellFormed="not-well-formed",e.RestrictedXML="restricted-xml",e.AlreadyClosed="already-closed",e.UnknownRoot="unknown-stream-root"}(i=t.JXTErrorCondition||(t.JXTErrorCondition={}));class r extends Error{constructor(e){super(e.text),this.isJXTError=!0,this.condition=e.condition,this.text=e.text}static notWellFormed(e){return new r({condition:i.NotWellFormed,text:e})}static restrictedXML(e){return new r({condition:i.RestrictedXML,text:e})}static alreadyClosed(e){return new r({condition:i.AlreadyClosed,text:e})}static unknownRoot(e){return new r({condition:i.UnknownRoot,text:e})}}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.childAlternateLanguageRawElement=t.childLanguageRawElement=t.childRawElement=t.staticValue=t.splicePath=t.multipleChildEnum=t.multipleChildAlternateLanguageText=t.childAlternateLanguageText=t.multipleChildIntegerAttribute=t.multipleChildAttribute=t.multipleChildText=t.childDoubleEnum=t.childEnum=t.deepMultipleChildText=t.deepChildBoolean=t.deepChildInteger=t.deepChildText=t.childBoolean=t.childTimezoneOffset=t.childJSON=t.childFloat=t.childInteger=t.childDate=t.childTextBuffer=t.childText=t.childLanguageAttribute=t.languageAttribute=t.textBuffer=t.textJSON=t.text=t.childDateAttribute=t.childFloatAttribute=t.childIntegerAttribute=t.childBooleanAttribute=t.childAttribute=t.namespacedDateAttribute=t.namespacedFloatAttribute=t.namespacedIntegerAttribute=t.namespacedBooleanAttribute=t.namespacedAttribute=t.dateAttribute=t.floatAttribute=t.integerAttribute=t.booleanAttribute=t.attribute=t.findOrCreate=t.findAll=t.getTargetLang=t.getLang=t.createElement=void 0,t.parameterMap=void 0;const i=n(3),r=n(7),s=(0,i.__importDefault)(n(23)),o=n(37);function a(e,t,n,i){if(i){e=e||i.getNamespace();const n=i.getNamespaceRoot(e);if(n){t=`${n.useNamespace("",e)}:${t}`}}const r=new s.default(t);return t.indexOf(":")<0&&(!n||e!==n)&&r.setAttribute("xmlns",e),r}function c(e,t){return(e.getAttribute("xml:lang")||t||"").toLowerCase()}function u(e,t){const n=[];for(const i of e)n.push(c(i,t.lang));let i;return i=t.resolveLanguage?t.resolveLanguage(n,t.acceptLanguages||[],t.lang):t.lang,i||""}function l(e,t,n,i){const r=e.getChildren(n,t),s=c(e);return r.length?i?r.filter(e=>{if(c(e,s)===i)return!0}):r:[]}function d(e,t,n,i){t=t||e.getNamespace();const r=l(e,t,n,i);if(r.length)return r[0];const s=a(t,n,e.getDefaultNamespace(),e),o=c(e,i);return i&&o!==i&&s.setAttribute("xml:lang",i),e.appendChild(s),s}function p(e){return{importer(t){const n=t.getAttribute(e.name,e.namespace);return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);if(i||e.emitEmpty)if(e.namespace&&e.prefix){let n;const r=t.getNamespaceRoot(e.namespace);if(r)n=r.useNamespace(e.prefix,e.namespace);else{const i=t.getNamespaceContext();i[e.namespace]||(n=t.useNamespace(e.prefix,e.namespace),i[e.namespace]=n)}t.setAttribute(`${n}:${e.name}`,i,e.emitEmpty)}else t.setAttribute(e.name,i,e.emitEmpty)}}}function h(e,t){return(n,i,r={})=>(r={staticDefault:i,...r},p({name:n,...e,...t?t(r):r}))}function f(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},p({name:r,namespace:i,prefix:n,...e,...t?t(o):o}))}function m(e){const t=e.converter||p({...e,namespace:e.attributeNamespace});return{importer(n,i){const r=n.getChild(e.element,e.namespace||n.getNamespace());return r?t.importer(r,i):e.dynamicDefault?e.dynamicDefault():e.staticDefault},exporter(n,i,r){if(void 0!==i&&i!==e.staticDefault){const s=d(n,e.namespace||n.getNamespace(),e.element);t.exporter(s,i,r)}}}}function g(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},m({element:i,name:r,namespace:n,...e,...t?t(o):o}))}function y(e){return{importer(t){const n=t.getText();return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(!n&&e.emitEmpty)return void t.children.push("");if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);i&&t.children.push(i)}}}function b(e){const t=y(e);return{importer(n,i){const r=l(n,e.namespace||n.getNamespace(),e.element),s=u(r,i);if(!r.length)return e.dynamicDefault?e.dynamicDefault():e.staticDefault;if(e.matchLanguage)for(const e of r)if(c(e,i.lang)===s)return t.importer(e,i);return t.importer(r[0],i)},exporter(n,i,r){if(i||!e.emitEmpty){if(void 0!==i&&i!==e.staticDefault){const s=d(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0);t.exporter(s,i,r)}}else d(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0)}}}t.createElement=a,t.getLang=c,t.getTargetLang=u,t.findAll=l,t.findOrCreate=d;const _={parseValue:e=>e,writeValue:e=>e},v={parseValue:e=>parseInt(e,10),writeValue:e=>e.toString()},S={parseValue:e=>parseFloat(e),writeValue:e=>e.toString()},w={parseValue:e=>"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0,writeValue:e=>e?"1":"0"},T={parseValue:e=>new Date(e),writeValue:e=>"string"==typeof e?e:e.toISOString()},I={parseValue:e=>JSON.parse(e),writeValue:e=>JSON.stringify(e)},N=(e="utf8")=>({parseValue:t=>("base64"===e&&"="===t&&(t=""),r.Buffer.from(t.trim(),e)),writeValue:t=>{let n;return n="string"==typeof t?r.Buffer.from(t).toString(e):t?t.toString(e):"","base64"===e&&(n=n||"="),n}}),A={parseValue:e=>{let t=-1;"-"===e.charAt(0)&&(t=1,e=e.slice(1));const n=e.split(":");return(60*parseInt(n[0],10)+parseInt(n[1],10))*t},writeValue:e=>{if("string"==typeof e)return e;{let t="-";e<0&&(e=-e,t="+");const n=e/60,i=e%60;return t+=(n<10?"0":"")+n+":"+(i<10?"0":"")+i,t}}};t.attribute=h(_,e=>({dynamicDefault:e.emitEmpty?t=>""===t?"":e.staticDefault:void 0,...e})),t.booleanAttribute=h(w),t.integerAttribute=h(v),t.floatAttribute=h(S),t.dateAttribute=h(T),t.namespacedAttribute=f(_),t.namespacedBooleanAttribute=f(w),t.namespacedIntegerAttribute=f(v),t.namespacedFloatAttribute=f(S),t.namespacedDateAttribute=f(T),t.childAttribute=g(_),t.childBooleanAttribute=g(w),t.childIntegerAttribute=g(v),t.childFloatAttribute=g(S),t.childDateAttribute=g(T);t.text=e=>y({staticDefault:e,..._});t.textJSON=()=>y({...I});function E(){return{importer:(e,t)=>c(e,t.lang),exporter(e,t,n){t&&t.toLowerCase()!==n.lang?e.setAttribute("xml:lang",t):e.setAttribute("xml:lang",void 0)}}}t.textBuffer=(e="utf8")=>y({...N(e)}),t.languageAttribute=E;t.childLanguageAttribute=(e,t)=>m({converter:E(),element:t,name:"xml:lang",namespace:e,..._});t.childText=(e,t,n,i=!1)=>b({element:t,emitEmpty:i,matchLanguage:!0,namespace:e,staticDefault:n,..._});t.childTextBuffer=(e,t,n="utf8")=>b({element:t,matchLanguage:!0,namespace:e,...N(n)});t.childDate=(e,t)=>b({element:t,namespace:e,...T});t.childInteger=(e,t,n)=>b({element:t,namespace:e,staticDefault:n,...v});t.childFloat=(e,t,n)=>b({element:t,namespace:e,staticDefault:n,...S});t.childJSON=(e,t)=>b({element:t,namespace:e,...I}),t.childTimezoneOffset=function(e,t){return b({element:t,namespace:e,staticDefault:0,...A})},t.childBoolean=function(e,t){return{importer(n){if(n.getChild(t,e||n.getNamespace()))return!0},exporter(n,i){i&&d(n,e||n.getNamespace(),t)}}};const x=(e,t,n)=>{if(!n)return;let i=t;for(const t of e)i=d(i,t.namespace||i.getNamespace(),t.element);i.children.push(n.toString())};t.deepChildText=function(e,t){return{importer(n){let i=n;for(const n of e)if(i=i.getChild(n.element,n.namespace||i.getNamespace()),!i)return t;return i.getText()||t},exporter(t,n){x(e,t,n)}}},t.deepChildInteger=function(e,t){return{importer(n){let i=n;for(const t of e)if(i=i.getChild(t.element,t.namespace||i.getNamespace()),!i)return;const r=i.getText();return r?parseInt(r,10):t||void 0},exporter(t,n){x(e,t,n)}}},t.deepChildBoolean=function(e){return{importer(t){let n=t;for(const t of e)if(n=n.getChild(t.element,t.namespace||n.getNamespace()),!n)return!1;return!0},exporter(t,n){if(!n)return;let i=t;for(const t of e)i=d(i,t.namespace||i.getNamespace(),t.element)}}},t.deepMultipleChildText=function(e){const t=e.pop();return{importer(n,i){let r=n;for(const t of e)if(r=r.getChild(t.element,t.namespace||r.getNamespace()),!r)return[];const s=[],o=l(r,t.namespace||r.getNamespace(),t.element),a=u(o,i);for(const e of o)c(e,i.lang)===a&&s.push(e.getText());return s},exporter(n,i,r){if(!i.length)return;let s=n;for(const t of e)s=d(s,t.namespace||s.getNamespace(),t.element);const{namespace:o,element:c}=t;for(const e of i){const t=a(o||s.getNamespace(),c,r.namespace,s);t.children.push(e),s.appendChild(t)}}}},t.childEnum=function(e,t,n){const i=new Map,r=new Map;for(const e of t)"string"==typeof e?(i.set(e,e),r.set(e,e)):(i.set(e[1],e[0]),r.set(e[0],e[1]));return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&i.has(n.getName()))return i.get(n.getName());return n},exporter(t,n){r.has(n)&&d(t,e,r.get(n))}}},t.childDoubleEnum=function(e,t,n,i){const r=new Set(t),s=new Set(n);return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&r.has(n.getName())){for(const i of n.children)if("string"!=typeof i&&i.getNamespace()===(e||t.getNamespace())&&s.has(i.getName()))return[n.getName(),i.getName()];return[n.getName()]}return i},exporter(t,n){const i=d(t,e,n[0]);n[1]&&d(i,e,n[1])}}},t.multipleChildText=function(e,t){return{importer(n,i){const r=[],s=l(n,e||n.getNamespace(),t),o=u(s,i);for(const e of s)c(e,i.lang)===o&&r.push(e.getText());return r},exporter(n,i,r){for(const s of i){const i=a(e||n.getNamespace(),t,r.namespace,n);i.children.push(s),n.appendChild(i)}}}},t.multipleChildAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(t)}return r},exporter(i,r,s){for(const o of r){const r=a(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o),i.appendChild(r)}}}},t.multipleChildIntegerAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(parseInt(t,10))}return r},exporter(i,r,s){for(const o of r){const r=a(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o.toString()),i.appendChild(r)}}}},t.childAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=l(n,e||n.getNamespace(),t),o=new Set;for(const e of s){const t=e.getText();if(t){const n=c(e,i.lang);if(o.has(n))continue;r.push({lang:n,value:t}),o.add(n)}}return o.size>0?r:void 0},exporter(n,i,r){for(const s of i){const i=s.value;if(i){const o=a(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}}},t.multipleChildAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=new Map;let o=!1;const a=l(n,e||n.getNamespace(),t);for(const e of a){const t=e.getText();if(t){const n=c(e,i.lang);let a=s.get(n);a||(a=[],s.set(n,a),r.push({lang:n,value:a})),a.push(t),o=!0}}return o?r:void 0},exporter(n,i,r){for(const s of i)for(const i of s.value){const o=a(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}},t.multipleChildEnum=function(e,t){const n=new Map,i=new Map;for(const e of t)"string"==typeof e?(n.set(e,e),i.set(e,e)):(n.set(e[1],e[0]),i.set(e[0],e[1]));return{importer(t){const i=[];for(const r of t.children)"string"!=typeof r&&r.getNamespace()===(e||t.getNamespace())&&n.has(r.getName())&&i.push(n.get(r.getName()));return i},exporter(t,n){for(const r of n)d(t,e,i.get(r))}}},t.splicePath=function(e,t,n,i=!1){return{importer(r,s){const o=r.getChild(t,e||r.getNamespace());if(!o)return;const a=[];for(const e of o.children)if("string"!=typeof e&&s.registry.getImportKey(e)===n){const t=s.registry.import(e);t&&a.push(t)}return i?a:a[0]},exporter(i,r,s){let o=[];o=Array.isArray(r)?r:[r];const a=[];for(const t of o){const r=s.registry.export(n,t,{...s,namespace:e||i.getNamespace()||void 0});r&&a.push(r)}if(a.length){const n=d(i,e||i.getNamespace(),t);for(const e of a)n.appendChild(e)}}}},t.staticValue=function(e){return{exporter:()=>{},importer:()=>e}},t.childRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=i.getChild(t,e||i.getNamespace());return s?n?r.sanitizers[n](s.toJSON()):s.toJSON():void 0},exporter(i,r,a){if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(n){if(!a.sanitizers||!a.sanitizers[n])return;r=a.sanitizers[n](r)}r&&i.appendChild(new s.default(r.name,r.attributes,r.children))}}},t.childLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=l(i,e||i.getNamespace(),t),o=u(s,r);for(const e of s)if(c(e,r.lang)===o)return n?r.sanitizers[n](e.toJSON()):e.toJSON();return s[0]?n?r.sanitizers[n](s[0].toJSON()):s[0].toJSON():void 0},exporter(i,r,a){if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!a.sanitizers||!a.sanitizers[n])return;r=a.sanitizers[n](r)}if(!r)return;const c=d(i,e||i.getNamespace(),t,a.lang);for(const e of r.children)"string"==typeof e?c.appendChild(e):e&&c.appendChild(new s.default(e.name,e.attributes,e.children))}}},t.childAlternateLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=[],o=new Set,a=l(i,e||i.getNamespace(),t);for(const e of a){let t=e.toJSON();if(n&&(t=r.sanitizers[n](t)),t){const n=c(e,r.lang);if(o.has(n))continue;s.push({lang:n,value:t}),o.add(n)}}return o.size>0?s:void 0},exporter(i,r,c){for(const u of r){let r=u.value;if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!c.sanitizers||!c.sanitizers[n])continue;r=c.sanitizers[n](r)}if(r){const n=a(e||i.getNamespace(),t,c.namespace,i);i.appendChild(n),u.lang!==c.lang&&n.setAttribute("xml:lang",u.lang);for(const e of r.children)"string"==typeof e?n.appendChild(e):n.appendChild(new s.default(e.name,e.attributes,e.children))}}}}},t.parameterMap=function(e,n,i,r){return{importer(s,o){const a={},c=l(s,e,n),u=(0,t.attribute)(i).importer,d=(0,t.attribute)(r).importer;for(const e of c)a[u(e,o)]=d(e,o);return a},exporter(s,o,c){const u=(0,t.attribute)(i).exporter,l=(0,t.attribute)(r).exporter,d=e||s.getNamespace();for(const[e,t]of Object.entries(o)){const i=a(d,n,c.namespace,s);u(i,e,c),o[e]&&l(i,t,c),s.appendChild(i)}}}}},function(e,t,n){"use strict";t.Readable=n(57),t.Writable=n(59),t.Duplex=n(17),t.Transform=n(61),t.PassThrough=n(204)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0;const i=n(3),r=n(6),s=n(24),o=(0,i.__importDefault)(n(23)),a=(0,i.__importDefault)(n(34));function c(e){return 97<=e&&e<=122||65<=e&&e<=90||58===e||95===e}function u(e){return 192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=767||880<=e&&e<=893||895<=e&&e<=8191||8204<=e&&e<=8205||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||65008<=e&&e<=65533||65536<=e&&e<=983039}function l(e){return c(e)||u(e)}function d(e){return c(e)||45===e||46===e||48<=e&&e<=57||183===e||768<=e&&e<=879||8255<=e&&e<=8256||u(e)}function p(e){return 32===e||10===e||13===e||9===e}class h extends r.EventEmitter{constructor(e={}){super(),this.allowComments=!0,this.attributes={},this.state=34,this.tagName="",this.haveDeclaration=!1,this.recordBuffer=[],void 0!==e.allowComments&&(this.allowComments=e.allowComments)}write(e){for(const t of e){const e=t.codePointAt(0);switch(this.state){case 34:if(60===e){let e;try{e=(0,s.unescapeXML)(this.endRecord())}catch(e){return void this.emit("error",e)}e&&this.emit("text",e),this.transition(31);continue}this.record(t);continue;case 31:if(47===e){this.transition(7);continue}if(33===e){this.transition(24);continue}if(63===e){if(this.haveDeclaration)return this.restrictedXML();this.transition(25);continue}if(l(e)){this.transition(30),this.startRecord(t);continue}return this.notWellFormed();case 30:if(d(e)){this.record(t);continue}if(p(e)){this.startTag(),this.transition(32);continue}if(47===e){this.startTag(),this.transition(29);continue}if(62===e){this.startTag(),this.transition(34),this.emit("startElement",this.tagName,this.attributes);continue}return this.notWellFormed();case 29:if(62===e){this.emit("startElement",this.tagName,this.attributes),this.emit("endElement",this.tagName),this.transition(34);continue}return this.notWellFormed();case 33:if(p(e)){this.transition(32);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 32:if(p(e))continue;if(l(e)){this.startRecord(t),this.transition(0);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 7:if(l(e)){this.startRecord(t),this.transition(6);continue}return this.notWellFormed();case 6:if(d(e)){this.record(t);continue}if(p(e)){this.transition(8);continue}if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 8:if(p(e))continue;if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 0:if(d(e)){this.record(t);continue}if(61===e){this.addAttribute(),this.transition(4);continue}if(p(e)){this.addAttribute(),this.transition(3);continue}return this.notWellFormed();case 3:if(61===e){this.transition(4);continue}if(p(e))continue;return this.notWellFormed();case 4:if(34===e){this.startRecord(),this.transition(1);continue}if(39===e){this.startRecord(),this.transition(2);continue}if(p(e))continue;return this.notWellFormed();case 1:case 2:if(34===e&&1===this.state||39===e&&2===this.state){const e=this.endRecord();this.attributes[this.attributeName]=(0,s.unescapeXML)(e),this.transition(33);continue}if(60===e)return this.notWellFormed();this.record(t);continue;case 24:if(45===e){if(!this.allowComments)return this.restrictedXML();this.transition(23);continue}if(91===e){this.transition(21);continue}return this.notWellFormed();case 23:if(45===e){this.transition(14);continue}return this.notWellFormed();case 14:45===e&&this.transition(12);continue;case 12:45===e?this.transition(11):this.transition(14);continue;case 11:62===e?this.transition(34):this.transition(14);continue;case 25:if(88===e||120===e){this.transition(28);continue}return this.notWellFormed();case 28:if(77===e||109===e){this.transition(27);continue}return this.notWellFormed();case 27:if(76===e||108===e){this.transition(26);continue}return this.notWellFormed();case 26:if(p(e)){this.haveDeclaration=!0,this.transition(15);continue}return this.notWellFormed();case 13:if(62===e){this.transition(34);continue}return this.notWellFormed();case 15:63===e&&this.transition(13);continue;case 21:this.wait(e,67,20);continue;case 20:this.wait(e,68,19);continue;case 19:this.wait(e,65,18);continue;case 18:this.wait(e,84,17);continue;case 17:this.wait(e,65,16);continue;case 16:this.wait(e,91,5);continue;case 5:if(93===e){this.transition(10);continue}this.record(t);continue;case 10:93===e?this.transition(9):(this.record(String.fromCodePoint(93)),this.record(t),this.transition(5));continue;case 9:if(62===e){const e=this.endRecord();e&&this.emit("text",e),this.transition(34)}else this.record(String.fromCodePoint(93)),this.record(String.fromCodePoint(93)),this.record(t),this.transition(5);continue}}}end(e){e&&this.write(e),this.write=()=>{}}record(e){this.recordBuffer.push(e)}startRecord(e){this.recordBuffer=[],e&&this.recordBuffer.push(e)}endRecord(){const e=this.recordBuffer;return this.recordBuffer=[],e.join("")}startTag(){this.tagName=this.endRecord(),this.attributes={}}addAttribute(){const e=this.endRecord();if(void 0!==this.attributes[e])return this.notWellFormed();this.attributeName=e,this.attributes[e]=""}wait(e,t,n){if(e!==t)return this.notWellFormed();this.transition(n)}transition(e){this.state=e,34===e&&this.startRecord()}notWellFormed(e){this.emit("error",a.default.notWellFormed(e))}restrictedXML(e){this.emit("error",a.default.restrictedXML(e))}}t.parse=function(e,t={}){const n=new h(t);let i,r,s=null;if(n.on("text",e=>{r&&r.children.push(e)}),n.on("startElement",(e,t)=>{const n=new o.default(e,t);i||(i=n),r=r?r.appendChild(n):n}),n.on("endElement",e=>{r?e===r.name?r.parent&&(r=r.parent):n.emit("error",a.default.notWellFormed("b")):n.emit("error",a.default.notWellFormed("a"))}),n.on("error",e=>{s=e}),n.write(e),n.end(),s)throw s;return i},t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StanzaMediaSession=void 0;const i=n(16),r=i.__importDefault(n(6)),s=n(39),o=n(5),a=i.__importDefault(n(65)),c=n(21),u={"Discovered new ICE candidate":{skipMessage:!0}};class l extends s.MediaSession{constructor(e){super(e.options),this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.reinvite=!1,this.logger=e.logger,this.conversationId=e.conversationId,this.peerConnection=this.pc,this.fromUserId=e.fromUserId,this.meetingId=e.meetingId,this.id=this.sid,this.originalRoomJid=e.originalRoomJid,this.sessionType=c.SessionTypes[e.sessionType],this.ignoreHostCandidatesFromRemote=!!e.ignoreHostCandidatesFromRemote,this.allowIPv6=!!e.allowIPv6,this.allowTCP=!!e.allowTCP;const t=new r.default;Object.keys(t.__proto__).forEach(e=>{this[e]=t[e]}),e.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.pc.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.pc.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}async onTransportInfo(e,t){var n,i;const r=null===(n=e.contents)||void 0===n?void 0:n[0].transport,s=null==r?void 0:r.candidates;if(this.ignoreHostCandidatesFromRemote){const e=null==s?void 0:s.filter(e=>"host"!==e.type);(null==e?void 0:e.length)!==(null===(i=null==r?void 0:r.candidates)||void 0===i?void 0:i.length)&&(this._log("info","Ignoring remote host ice candidates"),r.candidates=e)}if(s)for(const e of s)this._log("info","Received candidate from peer",{candidateType:e.type}),this.iceCandidatesReceivedFromPeer++;return super.onTransportInfo(e,t)}_log(e,t,...n){const i=u[t];if(null==i?void 0:i.skipMessage)return;let r;if(n.length){const e=n[0];"object"!=typeof e||Array.isArray(e)||null===e?r={...this.getLogDetails(),data:e}:(Object.assign(n[0],this.getLogDetails()),r=n)}else r=[...n,this.getLogDetails()];this.logger[e](t,r)}async end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),setTimeout(()=>{"connected"!==this.pc.connectionState&&"connecting"!==this.pc.connectionState||this.pc.close()},2e3),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}setupStatsGatherer(){this.statsGatherer=new a.default(this.pc),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}onIceStateChange(){const e=this.pc.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;this._log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e?"stable"===this.pc.signalingState&&(this.interruptionStart=new Date,this._log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i})):"connected"===e?(this._log("info","sending session-info: active"),this.send(o.JingleAction.SessionInfo,{info:{infoType:o.JINGLE_INFO_ACTIVE}}),this._setupDataChannel()):"failed"===e&&this._log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer}),super.onIceStateChange()}onConnectionStateChange(){const e=this.pc.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this._log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this._log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this._log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this._log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url}),console.error("IceCandidateError",t)}onIceCandidate(e){if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this._log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this._log("debug","Processing ice candidate",e.candidate.candidate),this._log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++}return super.onIceCandidate(e)}onIceEndOfCandidates(){super.onIceEndOfCandidates(),this.emit("endOfCandidates")}addTrack(e,t){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{const n=this.pc.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.pc.addTrack(e,t)})}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.pc.localDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this._log("info","creating data channel"),this.dataChannel=this.pc.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this._log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this._log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this._log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this._log("error","Failed to parse data channel message",{error:e})}}}t.StanzaMediaSession=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=t.FileSession=t.MediaSession=t.ICESession=t.Session=t.exportToSDP=t.importFromSDP=void 0;const i=n(3),r=(0,i.__importDefault)(n(62));t.FileSession=r.default;const s=(0,i.__importDefault)(n(40));t.ICESession=s.default;const o=(0,i.__importDefault)(n(64));t.MediaSession=o.default;const a=(0,i.__importDefault)(n(42));t.Session=a.default;const c=(0,i.__importDefault)(n(213));t.SessionManager=c.default;var u=n(26);Object.defineProperty(t,"importFromSDP",{enumerable:!0,get:function(){return u.importFromSDP}}),Object.defineProperty(t,"exportToSDP",{enumerable:!0,get:function(){return u.exportToSDP}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=(0,i.__importStar)(n(63)),s=n(5),o=n(1),a=n(26),c=n(41),u=(0,i.__importDefault)(n(42));class l extends u.default{constructor(e){super(e),this.bitrateLimit=0,this.candidateBuffer=[],this.transportType=o.NS_JINGLE_ICE_UDP_1,this.restartingIce=!1,this.usingRelay=!1,this.maxRelayBandwidth=e.maxRelayBandwidth,this.pc=this.parent.createPeerConnection(this,{...e.config,iceServers:e.iceServers}),this.pc.oniceconnectionstatechange=()=>{this.onIceStateChange()},this.pc.onicecandidate=e=>{e.candidate?this.onIceCandidate(e):this.onIceEndOfCandidates()},this.restrictRelayBandwidth()}end(e="success",t=!1){this.pc.close(),super.end(e,t)}async restartIce(){if(this.isInitiator){void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this.restartingIce=!0;try{await this.processLocal("restart-ice",async()=>{const e=await this.pc.createOffer({iceRestart:!0}),t=(0,a.importFromSDP)(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:(0,c.convertIntermediateToTransport)(e,this.transportType)})),sid:this.sid}),await this.pc.setLocalDescription(e)})}catch(e){this._log("error","Could not create WebRTC offer",e),this.end(s.JingleReasonCondition.FailedTransport,!0)}}}async setMaximumBitrate(e){this.maximumBitrate&&(e=Math.min(e,this.maximumBitrate)),this.currentBitrate=e;const t=this.pc.getSenders().find(e=>!!e.track&&"video"===e.track.kind);if(t&&t.getParameters)try{await this.processLocal("set-bitrate",async()=>{const n=t.getParameters();n.encodings&&n.encodings.length||(n.encodings=[{}]),0===e?delete n.encodings[0].maxBitrate:n.encodings[0].maxBitrate=e,await t.setParameters(n)})}catch(e){this._log("error","Set maximumBitrate failed",e)}}async onTransportInfo(e,t){if(e.contents&&e.contents[0]&&e.contents[0].transport.gatheringComplete){const n={sdpMid:e.contents[0].name,candidate:""};try{"stable"===this.pc.signalingState?await this.pc.addIceCandidate(n):this.candidateBuffer.push(n)}catch(e){this._log("debug","Could not add null end-of-candidate")}finally{t()}return}if(this.pc.remoteDescription){const n=this.pc.remoteDescription,i=(0,a.importFromSDP)(n.sdp),r=i.media.find(t=>t.mid===e.contents[0].name).iceParameters.usernameFragment,o=e.contents[0].transport.usernameFragment;if(o&&r!==o){for(const[t,n]of e.contents.entries()){const e=n.transport;i.media[t].iceParameters={password:e.password,usernameFragment:e.usernameFragment},i.media[t].candidates=[]}try{if(await this.pc.setRemoteDescription({type:n.type,sdp:(0,a.exportToSDP)(i)}),await this.processBufferedCandidates(),"offer"===n.type){const e=await this.pc.createAnswer();await this.pc.setLocalDescription(e);const t=(0,a.importFromSDP)(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:(0,c.convertIntermediateToTransport)(e,this.transportType)})),sid:this.sid})}else this.restartingIce=!1}catch(e){return this._log("error","Could not do remote ICE restart",e),t(e),void this.end(s.JingleReasonCondition.FailedTransport)}}}const n=(e.contents||[]).map(e=>{const t=e.name,n=(e.transport.candidates||[]).map(async e=>{const n=r.writeCandidate((0,c.convertCandidateToIntermediate)(e));if(this.pc.remoteDescription&&"stable"===this.pc.signalingState)try{await this.pc.addIceCandidate({sdpMid:t,candidate:n})}catch(e){this._log("error","Could not add ICE candidate",e)}else this.candidateBuffer.push({sdpMid:t,candidate:n})});return Promise.all(n)});try{await Promise.all(n),t()}catch(e){this._log("error","Could not process transport-info: "+e),t(e)}}async onSessionAccept(e,t){this.state="active";const n=(0,c.convertRequestToIntermediate)(e,this.peerRole),i=(0,a.exportToSDP)(n);try{await this.pc.setRemoteDescription({type:"answer",sdp:i}),await this.processBufferedCandidates(),this.parent.emit("accepted",this,void 0),t()}catch(e){this._log("error","Could not process WebRTC answer: "+e),t({condition:"general-error"})}}onSessionTerminate(e,t){this._log("info","Terminating session"),this.pc.close(),super.end(e.reason,!0),t()}onIceCandidate(e){if(!e.candidate||!e.candidate.candidate)return;const t=r.parseCandidate(e.candidate.candidate),n={contents:[{creator:s.JingleSessionRole.Initiator,name:e.candidate.sdpMid,transport:{candidates:[(0,c.convertIntermediateToCandidate)(t)],transportType:this.transportType,usernameFragment:t.usernameFragment}}]};this._log("info","Discovered new ICE candidate",n),this.send(s.JingleAction.TransportInfo,n)}onIceEndOfCandidates(){this._log("info","ICE end of candidates");const e=(0,a.importFromSDP)(this.pc.localDescription.sdp).media[0];this.send(s.JingleAction.TransportInfo,{contents:[{creator:s.JingleSessionRole.Initiator,name:e.mid,transport:{gatheringComplete:!0,transportType:this.transportType,usernameFragment:e.iceParameters.usernameFragment}}]})}onIceStateChange(){switch(this.pc.iceConnectionState){case"checking":this.connectionState="connecting";break;case"completed":case"connected":this.connectionState="connected";break;case"disconnected":if("stable"===this.pc.signalingState?this.connectionState="interrupted":this.connectionState="disconnected",this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.maybeRestartIce();break;case"failed":if("failed"===this.connectionState||this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.connectionState="failed",this.restartIce();break;case"closed":this.connectionState="disconnected",this.restartingIce?this.end(s.JingleReasonCondition.FailedTransport):this.end()}}async processBufferedCandidates(){for(const e of this.candidateBuffer)try{await this.pc.addIceCandidate(e)}catch(e){this._log("error","Could not add ICE candidate",e)}this.candidateBuffer=[]}restrictRelayBandwidth(){this.pc.addEventListener("iceconnectionstatechange",async()=>{if("completed"!==this.pc.iceConnectionState&&"connected"!==this.pc.iceConnectionState)return;const e=await this.pc.getStats();let t;if(e.forEach(n=>{"transport"===n.type&&(t=e.get(n.selectedCandidatePairId))}),t||e.forEach(e=>{"candidate-pair"===e.type&&e.selected&&(t=e)}),!t)return;let n=!1,i="",r="";if(t.remoteCandidateId){const n=e.get(t.remoteCandidateId);n&&(r=n.candidateType)}if(t.localCandidateId){const n=e.get(t.localCandidateId);n&&(i=n.candidateType)}"relay"!==i&&"relay"!==r||(n=!0),this.usingRelay=n,this.parent.emit("iceConnectionType",this,{localCandidateType:i,relayed:n,remoteCandidateType:r}),n&&void 0!==this.maxRelayBandwidth&&(this.maximumBitrate=this.maxRelayBandwidth,this.currentBitrate?this.setMaximumBitrate(Math.min(this.currentBitrate,this.maximumBitrate)):this.setMaximumBitrate(this.maximumBitrate))})}maybeRestartIce(){this.isInitiator&&(void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this._maybeRestartingIce=setTimeout(()=>{this._maybeRestartingIce=void 0,"disconnected"===this.pc.iceConnectionState&&this.restartIce()},2e3))}}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertRequestToIntermediate=t.convertContentToIntermediate=t.convertIntermediateToRequest=t.convertIntermediateToTransport=t.convertCandidateToIntermediate=t.convertIntermediateToCandidate=t.convertIntermediateToApplication=void 0;const i=n(5),r=n(1);function s(e,t){const n=e.rtpParameters,s=e.rtcpParameters||{},o=e.rtpEncodingParameters||[];let a=!1;o&&o.length&&(a=!!o[0].ssrc);const c={applicationType:r.NS_JINGLE_RTP_1,codecs:[],headerExtensions:[],media:e.kind,rtcpMux:s.mux,rtcpReducedSize:s.reducedSize,sourceGroups:[],sources:[],ssrc:a?o[0].ssrc.toString():void 0,streams:[]};for(const e of n.headerExtensions||[]){const n={id:e.id,uri:e.uri};e.direction&&"sendrecv"!==e.direction&&(n.senders=(0,i.directionToSenders)(t,e.direction)),c.headerExtensions.push(n)}s.ssrc&&s.cname&&(c.sources=[{parameters:{cname:s.cname},ssrc:s.ssrc.toString()}]),a&&o[0]&&o[0].rtx&&(c.sourceGroups=[{semantics:"FID",sources:[o[0].ssrc.toString(),o[0].rtx.ssrc.toString()]}]);for(const t of e.streams||[])c.streams.push({id:t.stream,track:t.track});for(const e of n.codecs||[]){const t={channels:e.channels,clockRate:e.clockRate,id:e.payloadType.toString(),name:e.name,parameters:e.parameters,rtcpFeedback:e.rtcpFeedback};e.maxptime&&(t.maxptime=e.maxptime),e.parameters&&e.parameters.ptime&&(t.ptime=parseInt(e.parameters.ptime,10)),c.codecs.push(t)}return c}function o(e){let t;return t="rtp"===e.component?1:"rtcp"===e.component?2:e.component,{component:t,foundation:e.foundation,generation:void 0,id:void 0,ip:e.ip,network:void 0,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function a(e){return{address:e.ip,component:1===e.component?"rtp":2===e.component?"rtcp":e.component,foundation:e.foundation,ip:e.ip,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function c(e,t){const n=e.iceParameters,i=e.dtlsParameters,r={candidates:[],transportType:t};n&&(r.usernameFragment=n.usernameFragment,r.password=n.password,n.iceLite&&(r.iceLite=!0)),i&&(r.fingerprints=i.fingerprints.map(t=>({algorithm:t.algorithm,setup:e.setup,value:t.value}))),e.sctp&&(r.sctp=e.sctp);for(const t of e.candidates||[])r.candidates.push(o(t));return r}function u(e,t){const n=e.application||{},s=e.transport,o=n&&n.applicationType===r.NS_JINGLE_RTP_1,c={direction:(0,i.sendersToDirection)(t,e.senders),kind:n.media||"application",mid:e.name,protocol:o?"UDP/TLS/RTP/SAVPF":"UDP/DTLS/SCTP"};if(o){if(c.rtcpParameters={compound:!n.rtcpReducedSize,mux:n.rtcpMux,reducedSize:n.rtcpReducedSize},n.sources&&n.sources.length){const e=n.sources[0];c.rtcpParameters.ssrc=parseInt(e.ssrc,10),e.parameters&&(c.rtcpParameters.cname=e.parameters.cname)}if(c.rtpParameters={codecs:[],fecMechanisms:[],headerExtensions:[],rtcp:[]},n.streams){c.streams=[];for(const e of n.streams)c.streams.push({stream:e.id,track:e.track})}if(n.ssrc&&(c.rtpEncodingParameters=[{ssrc:parseInt(n.ssrc,10)}],n.sourceGroups&&n.sourceGroups.length)){const e=n.sourceGroups[0];c.rtpEncodingParameters[0].rtx={ssrc:parseInt(e.sources[1],10)}}let e=!1,r=!1;for(const t of n.codecs||[]){const n=t.parameters||{},i=[];for(const e of t.rtcpFeedback||[])i.push({parameter:e.parameter,type:e.type});if("red"===t.name||"ulpfec"===t.name){e=e||"red"===t.name,r=r||"ulpfec"===t.name;const n=t.name.toUpperCase();c.rtpParameters.fecMechanisms.includes(n)||c.rtpParameters.fecMechanisms.push(n)}c.rtpParameters.codecs.push({channels:t.channels,clockRate:t.clockRate,name:t.name,numChannels:t.channels,parameters:n,payloadType:parseInt(t.id,10),rtcpFeedback:i})}for(const e of n.headerExtensions||[])c.rtpParameters.headerExtensions.push({direction:(0,i.sendersToDirection)(t,e.senders||"both"),id:e.id,uri:e.uri,attributes:void 0})}if(s){if(s.usernameFragment&&s.password&&(c.iceParameters={password:s.password,usernameFragment:s.usernameFragment},s.iceLite&&(c.iceParameters.iceLite=!0)),s.fingerprints&&s.fingerprints.length){c.dtlsParameters={fingerprints:[],role:"auto"};for(const e of s.fingerprints)c.dtlsParameters.fingerprints.push({algorithm:e.algorithm,value:e.value});s.sctp&&(c.sctp=s.sctp),c.setup=s.fingerprints[0].setup}c.candidates=(s.candidates||[]).map(a)}return c}t.convertIntermediateToApplication=s,t.convertIntermediateToCandidate=o,t.convertCandidateToIntermediate=a,t.convertIntermediateToTransport=c,t.convertIntermediateToRequest=function(e,t,n){return{contents:e.media.map(e=>({application:"audio"===e.kind||"video"===e.kind?s(e,t):{applicationType:"datachannel",protocol:e.protocol},creator:i.JingleSessionRole.Initiator,name:e.mid,senders:(0,i.directionToSenders)(t,e.direction),transport:c(e,n)})),groups:e.groups?e.groups.map(e=>({contents:e.mids,semantics:e.semantics})):[]}},t.convertContentToIntermediate=u,t.convertRequestToIntermediate=function(e,t){const n={groups:[],media:[]};for(const t of e.groups||[])n.groups.push({mids:t.contents,semantics:t.semantics});for(const i of e.contents||[])n.media.push(u(i,t));return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(43),r=n(5),s=n(10),o={condition:r.StanzaErrorCondition.BadRequest},a={condition:r.StanzaErrorCondition.FeatureNotImplemented,jingleError:r.JingleErrorCondition.UnsupportedInfo,type:"modify"};t.default=class{constructor(e){this.parent=e.parent,this.sid=e.sid||(0,s.uuid)(),this.peerID=e.peerID,this.role=e.initiator?r.JingleSessionRole.Initiator:r.JingleSessionRole.Responder,this._sessionState="starting",this._connectionState="starting",this.pendingApplicationTypes=e.applicationTypes||[],this.pendingAction=void 0,this.processingQueue=(0,i.priorityQueue)(async(e,t)=>{if("ended"===this.state)return"local"===e.type&&e.reject&&e.reject(new Error("Session ended")),void(t&&t());if("local"===e.type){this._log("debug","Processing local action:",e.name);try{const t=await e.handler();e.resolve(t)}catch(t){e.reject(t)}return void(t&&t())}const{action:n,changes:i,cb:s}=e;return this._log("debug","Processing remote action:",n),new Promise(e=>{const o=(n,i)=>{s(n,i),t&&t(),e()};switch(n){case r.JingleAction.ContentAccept:return this.onContentAccept(i,o);case r.JingleAction.ContentAdd:return this.onContentAdd(i,o);case r.JingleAction.ContentModify:return this.onContentModify(i,o);case r.JingleAction.ContentReject:return this.onContentReject(i,o);case r.JingleAction.ContentRemove:return this.onContentRemove(i,o);case r.JingleAction.DescriptionInfo:return this.onDescriptionInfo(i,o);case r.JingleAction.SecurityInfo:return this.onSecurityInfo(i,o);case r.JingleAction.SessionAccept:return this.onSessionAccept(i,o);case r.JingleAction.SessionInfo:return this.onSessionInfo(i,o);case r.JingleAction.SessionInitiate:return this.onSessionInitiate(i,o);case r.JingleAction.SessionTerminate:return this.onSessionTerminate(i,o);case r.JingleAction.TransportAccept:return this.onTransportAccept(i,o);case r.JingleAction.TransportInfo:return this.onTransportInfo(i,o);case r.JingleAction.TransportReject:return this.onTransportReject(i,o);case r.JingleAction.TransportReplace:return this.onTransportReplace(i,o);default:this._log("error","Invalid or unsupported action: "+n),o({condition:r.StanzaErrorCondition.BadRequest})}})},1)}get isInitiator(){return this.role===r.JingleSessionRole.Initiator}get peerRole(){return this.isInitiator?r.JingleSessionRole.Responder:r.JingleSessionRole.Initiator}get state(){return this._sessionState}set state(e){e!==this._sessionState&&(this._log("info","Changing session state to: "+e),this._sessionState=e,this.parent&&this.parent.emit("sessionState",this,e))}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._log("info","Changing connection state to: "+e),this._connectionState=e,this.parent&&this.parent.emit("connectionState",this,e))}send(e,t){(t=t||{}).sid=this.sid,t.action=e;new Set([r.JingleAction.ContentAccept,r.JingleAction.ContentAdd,r.JingleAction.ContentModify,r.JingleAction.ContentReject,r.JingleAction.ContentRemove,r.JingleAction.SessionAccept,r.JingleAction.SessionInitiate,r.JingleAction.TransportAccept,r.JingleAction.TransportReject,r.JingleAction.TransportReplace]).has(e)?this.pendingAction=e:this.pendingAction=void 0,this.parent.signal(this,{id:(0,s.uuid)(),jingle:t,to:this.peerID,type:"set"})}processLocal(e,t){return new Promise((n,i)=>{this.processingQueue.push({handler:t,name:e,reject:i,resolve:n,type:"local"},1)})}process(e,t,n){this.processingQueue.push({action:e,cb:n,changes:t,type:"remote"},2)}start(e,t){this._log("error","Can not start base sessions"),this.end("unsupported-applications",!0)}accept(e,t){this._log("error","Can not accept base sessions"),this.end("unsupported-applications")}cancel(){this.end("cancel")}decline(){this.end("decline")}end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}_log(e,t,...n){this.parent&&(t=this.sid+": "+t,this.parent.emit("log",e,t,...n),this.parent.emit("log:"+e,t,...n))}onSessionInitiate(e,t){t()}onSessionAccept(e,t){t()}onSessionTerminate(e,t){this.end(e.reason,!0),t()}onSessionInfo(e,t){e.info?t(a):t()}onSecurityInfo(e,t){t(a)}onDescriptionInfo(e,t){t(a)}onTransportInfo(e,t){t(a)}onContentAdd(e,t){t(),this.send(r.JingleAction.ContentReject,{reason:{condition:r.JingleReasonCondition.FailedApplication,text:"content-add is not supported"}})}onContentAccept(e,t){t(o)}onContentReject(e,t){t(o)}onContentModify(e,t){t(o)}onContentRemove(e,t){t(o)}onTransportReplace(e,t){t(),this.send(r.JingleAction.TransportReject,{reason:{condition:r.JingleReasonCondition.FailedTransport,text:"transport-replace is not supported"}})}onTransportAccept(e,t){t(o)}onTransportReject(e,t){t(o)}}},function(e,t,n){"use strict";function i(e,...t){return(...n)=>e(...t,...n)}function r(e){return function(...t){var n=t.pop();return e.call(this,t,n)}}n.r(t),n.d(t,"all",(function(){return me})),n.d(t,"allLimit",(function(){return ge})),n.d(t,"allSeries",(function(){return ye})),n.d(t,"any",(function(){return tt})),n.d(t,"anyLimit",(function(){return nt})),n.d(t,"anySeries",(function(){return it})),n.d(t,"apply",(function(){return i})),n.d(t,"applyEach",(function(){return O})),n.d(t,"applyEachSeries",(function(){return j})),n.d(t,"asyncify",(function(){return d})),n.d(t,"auto",(function(){return D})),n.d(t,"autoInject",(function(){return J})),n.d(t,"cargo",(function(){return V})),n.d(t,"cargoQueue",(function(){return W})),n.d(t,"compose",(function(){return K})),n.d(t,"concat",(function(){return Z})),n.d(t,"concatLimit",(function(){return Y})),n.d(t,"concatSeries",(function(){return ee})),n.d(t,"constant",(function(){return te})),n.d(t,"default",(function(){return mt})),n.d(t,"detect",(function(){return ie})),n.d(t,"detectLimit",(function(){return re})),n.d(t,"detectSeries",(function(){return se})),n.d(t,"dir",(function(){return ae})),n.d(t,"doDuring",(function(){return ce})),n.d(t,"doUntil",(function(){return ue})),n.d(t,"doWhilst",(function(){return ce})),n.d(t,"during",(function(){return pt})),n.d(t,"each",(function(){return de})),n.d(t,"eachLimit",(function(){return pe})),n.d(t,"eachOf",(function(){return R})),n.d(t,"eachOfLimit",(function(){return A})),n.d(t,"eachOfSeries",(function(){return P})),n.d(t,"eachSeries",(function(){return he})),n.d(t,"ensureAsync",(function(){return fe})),n.d(t,"every",(function(){return me})),n.d(t,"everyLimit",(function(){return ge})),n.d(t,"everySeries",(function(){return ye})),n.d(t,"filter",(function(){return Se})),n.d(t,"filterLimit",(function(){return we})),n.d(t,"filterSeries",(function(){return Te})),n.d(t,"find",(function(){return ie})),n.d(t,"findLimit",(function(){return re})),n.d(t,"findSeries",(function(){return se})),n.d(t,"flatMap",(function(){return Z})),n.d(t,"flatMapLimit",(function(){return Y})),n.d(t,"flatMapSeries",(function(){return ee})),n.d(t,"foldl",(function(){return $})),n.d(t,"foldr",(function(){return ze})),n.d(t,"forEach",(function(){return de})),n.d(t,"forEachLimit",(function(){return pe})),n.d(t,"forEachOf",(function(){return R})),n.d(t,"forEachOfLimit",(function(){return A})),n.d(t,"forEachOfSeries",(function(){return P})),n.d(t,"forEachSeries",(function(){return he})),n.d(t,"forever",(function(){return Ie})),n.d(t,"groupBy",(function(){return Ae})),n.d(t,"groupByLimit",(function(){return Ne})),n.d(t,"groupBySeries",(function(){return Ee})),n.d(t,"inject",(function(){return $})),n.d(t,"log",(function(){return xe})),n.d(t,"map",(function(){return C})),n.d(t,"mapLimit",(function(){return X})),n.d(t,"mapSeries",(function(){return k})),n.d(t,"mapValues",(function(){return Ce})),n.d(t,"mapValuesLimit",(function(){return Re})),n.d(t,"mapValuesSeries",(function(){return Oe})),n.d(t,"memoize",(function(){return Pe})),n.d(t,"nextTick",(function(){return ke})),n.d(t,"parallel",(function(){return Le})),n.d(t,"parallelLimit",(function(){return Me})),n.d(t,"priorityQueue",(function(){return Ue})),n.d(t,"queue",(function(){return De})),n.d(t,"race",(function(){return Je})),n.d(t,"reduce",(function(){return $})),n.d(t,"reduceRight",(function(){return ze})),n.d(t,"reflect",(function(){return Ge})),n.d(t,"reflectAll",(function(){return He})),n.d(t,"reject",(function(){return We})),n.d(t,"rejectLimit",(function(){return $e})),n.d(t,"rejectSeries",(function(){return Qe})),n.d(t,"retry",(function(){return Xe})),n.d(t,"retryable",(function(){return Ze})),n.d(t,"select",(function(){return Se})),n.d(t,"selectLimit",(function(){return we})),n.d(t,"selectSeries",(function(){return Te})),n.d(t,"seq",(function(){return Q})),n.d(t,"series",(function(){return et})),n.d(t,"setImmediate",(function(){return l})),n.d(t,"some",(function(){return tt})),n.d(t,"someLimit",(function(){return nt})),n.d(t,"someSeries",(function(){return it})),n.d(t,"sortBy",(function(){return rt})),n.d(t,"timeout",(function(){return st})),n.d(t,"times",(function(){return at})),n.d(t,"timesLimit",(function(){return ot})),n.d(t,"timesSeries",(function(){return ct})),n.d(t,"transform",(function(){return ut})),n.d(t,"tryEach",(function(){return lt})),n.d(t,"unmemoize",(function(){return dt})),n.d(t,"until",(function(){return ht})),n.d(t,"waterfall",(function(){return ft})),n.d(t,"whilst",(function(){return pt})),n.d(t,"wrapSync",(function(){return d}));var s="function"==typeof queueMicrotask&&queueMicrotask,o="function"==typeof setImmediate&&setImmediate,a="object"==typeof process&&"function"==typeof process.nextTick;function c(e){setTimeout(e,0)}function u(e){return(t,...n)=>e(()=>t(...n))}var l=u(s?queueMicrotask:o?setImmediate:a?process.nextTick:c);function d(e){return f(e)?function(...t){const n=t.pop();return p(e.apply(this,t),n)}:r((function(t,n){var i;try{i=e.apply(this,t)}catch(e){return n(e)}if(i&&"function"==typeof i.then)return p(i,n);n(null,i)}))}function p(e,t){return e.then(e=>{h(t,null,e)},e=>{h(t,e&&(e instanceof Error||e.message)?e:new Error(e))})}function h(e,t,n){try{e(t,n)}catch(e){l(e=>{throw e},e)}}function f(e){return"AsyncFunction"===e[Symbol.toStringTag]}function m(e){if("function"!=typeof e)throw new Error("expected a function");return f(e)?d(e):e}function g(e,t){if(t||(t=e.length),!t)throw new Error("arity is undefined");return function(...n){return"function"==typeof n[t-1]?e.apply(this,n):new Promise((i,r)=>{n[t-1]=(e,...t)=>{if(e)return r(e);i(t.length>1?t:t[0])},e.apply(this,n)})}}function y(e){return function(t,...n){return g((function(i){var r=this;return e(t,(e,t)=>{m(e).apply(r,n.concat(t))},i)}))}}function b(e,t,n,i){t=t||[];var r=[],s=0,o=m(n);return e(t,(e,t,n)=>{var i=s++;o(e,(e,t)=>{r[i]=t,n(e)})},e=>{i(e,r)})}function _(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}var v={};function S(e){function t(...t){if(null!==e){var n=e;e=null,n.apply(this,t)}}return Object.assign(t,e),t}function w(e){if(_(e))return function(e){var t=-1,n=e.length;return function(){return++t<n?{value:e[t],key:t}:null}}(e);var t,n,i,r,s=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return s?function(e){var t=-1;return function(){var n=e.next();return n.done?null:(t++,{value:n.value,key:t})}}(s):(n=(t=e)?Object.keys(t):[],i=-1,r=n.length,function e(){var s=n[++i];return"__proto__"===s?e():i<r?{value:t[s],key:s}:null})}function T(e){return function(...t){if(null===e)throw new Error("Callback was already called.");var n=e;e=null,n.apply(this,t)}}function I(e,t,n,i){let r=!1,s=!1,o=!1,a=0,c=0;function u(){a>=t||o||r||(o=!0,e.next().then(({value:e,done:t})=>{if(!s&&!r){if(o=!1,t)return r=!0,void(a<=0&&i(null));a++,n(e,c,l),c++,u()}}).catch(d))}function l(e,t){if(a-=1,!s)return e?d(e):!1===e?(r=!0,void(s=!0)):t===v||r&&a<=0?(r=!0,i(null)):void u()}function d(e){s||(o=!1,r=!0,i(e))}u()}var N=e=>(t,n,i)=>{if(i=S(i),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return i(null);if("AsyncGenerator"===t[Symbol.toStringTag])return I(t,e,n,i);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(t))return I(t[Symbol.asyncIterator](),e,n,i);var r=w(t),s=!1,o=!1,a=0,c=!1;function u(e,t){if(!o)if(a-=1,e)s=!0,i(e);else if(!1===e)s=!0,o=!0;else{if(t===v||s&&a<=0)return s=!0,i(null);c||l()}}function l(){for(c=!0;a<e&&!s;){var t=r();if(null===t)return s=!0,void(a<=0&&i(null));a+=1,n(t.value,t.key,T(u))}c=!1}l()};var A=g((function(e,t,n,i){return N(t)(e,m(n),i)}),4);function E(e,t,n){n=S(n);var i=0,r=0,{length:s}=e,o=!1;function a(e,t){!1===e&&(o=!0),!0!==o&&(e?n(e):++r!==s&&t!==v||n(null))}for(0===s&&n(null);i<s;i++)t(e[i],i,T(a))}function x(e,t,n){return A(e,1/0,t,n)}var R=g((function(e,t,n){return(_(e)?E:x)(e,m(t),n)}),3);var C=g((function(e,t,n){return b(R,e,t,n)}),3),O=y(C);var P=g((function(e,t,n){return A(e,1,t,n)}),3);var k=g((function(e,t,n){return b(P,e,t,n)}),3),j=y(k);const L=Symbol("promiseCallback");function M(){let e,t;function n(n,...i){if(n)return t(n);e(i.length>1?i:i[0])}return n[L]=new Promise((n,i)=>{e=n,t=i}),n}function D(e,t,n){"number"!=typeof t&&(n=t,t=null),n=S(n||M());var i=Object.keys(e).length;if(!i)return n(null);t||(t=i);var r={},s=0,o=!1,a=!1,c=Object.create(null),u=[],l=[],d={};function p(e,t){u.push(()=>function(e,t){if(a)return;var i=T((t,...i)=>{if(s--,!1!==t)if(i.length<2&&([i]=i),t){var u={};if(Object.keys(r).forEach(e=>{u[e]=r[e]}),u[e]=i,a=!0,c=Object.create(null),o)return;n(t,u)}else r[e]=i,(c[e]||[]).forEach(e=>e()),h();else o=!0});s++;var u=m(t[t.length-1]);t.length>1?u(r,i):u(i)}(e,t))}function h(){if(!o){if(0===u.length&&0===s)return n(null,r);for(;u.length&&s<t;){u.shift()()}}}function f(t){var n=[];return Object.keys(e).forEach(i=>{const r=e[i];Array.isArray(r)&&r.indexOf(t)>=0&&n.push(i)}),n}return Object.keys(e).forEach(t=>{var n=e[t];if(!Array.isArray(n))return p(t,[n]),void l.push(t);var i=n.slice(0,n.length-1),r=i.length;if(0===r)return p(t,n),void l.push(t);d[t]=r,i.forEach(s=>{if(!e[s])throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+s+"` in "+i.join(", "));!function(e,t){var n=c[e];n||(n=c[e]=[]);n.push(t)}(s,()=>{0===--r&&p(t,n)})})}),function(){var e,t=0;for(;l.length;)e=l.pop(),t++,f(e).forEach(e=>{0==--d[e]&&l.push(e)});if(t!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),h(),n[L]}var B=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,F=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,q=/,/,U=/(=.+)?(\s*)$/;function J(e,t){var n={};return Object.keys(e).forEach(t=>{var i,r=e[t],s=f(r),o=!s&&1===r.length||s&&0===r.length;if(Array.isArray(r))i=[...r],r=i.pop(),n[t]=i.concat(i.length>0?a:r);else if(o)n[t]=r;else{if(i=function(e){const t=function(e){let t="",n=0,i=e.indexOf("*/");for(;n<e.length;)if("/"===e[n]&&"/"===e[n+1]){let t=e.indexOf("\n",n);n=-1===t?e.length:t}else if(-1!==i&&"/"===e[n]&&"*"===e[n+1]){let r=e.indexOf("*/",n);-1!==r?(n=r+2,i=e.indexOf("*/",n)):(t+=e[n],n++)}else t+=e[n],n++;return t}(e.toString());let n=t.match(B);if(n||(n=t.match(F)),!n)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,i]=n;return i.replace(/\s/g,"").split(q).map(e=>e.replace(U,"").trim())}(r),0===r.length&&!s&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");s||i.pop(),n[t]=i.concat(a)}function a(e,t){var n=i.map(t=>e[t]);n.push(t),m(r)(...n)}}),D(n,t)}class z{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):G(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):G(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:n}=t;e(t)&&this.removeLink(t),t=n}return this}}function G(e,t){e.length=1,e.head=e.tail=t}function H(e,t,n){if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var i=m(e),r=0,s=[];const o={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(e,t){return e?t?void(o[e]=o[e].filter(e=>e!==t)):o[e]=[]:Object.keys(o).forEach(e=>o[e]=[])}function c(e,...t){o[e].forEach(e=>e(...t))}var u=!1;function d(e,t,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");var r,s;function o(e,...t){return e?n?s(e):r():t.length<=1?r(t[0]):void r(t)}y.started=!0;var a=y._createTaskItem(e,n?o:i||o);if(t?y._tasks.unshift(a):y._tasks.push(a),u||(u=!0,l(()=>{u=!1,y.process()})),n||!i)return new Promise((e,t)=>{r=e,s=t})}function p(e){return function(t,...n){r-=1;for(var i=0,o=e.length;i<o;i++){var a=e[i],u=s.indexOf(a);0===u?s.shift():u>0&&s.splice(u,1),a.callback(t,...n),null!=t&&c("error",t,a.data)}r<=y.concurrency-y.buffer&&c("unsaturated"),y.idle()&&c("drain"),y.process()}}function h(e){return!(0!==e.length||!y.idle())&&(l(()=>c("drain")),!0)}const f=e=>t=>{if(!t)return new Promise((t,n)=>{!function(e,t){const n=(...i)=>{a(e,n),t(...i)};o[e].push(n)}(e,(e,i)=>{if(e)return n(e);t(i)})});a(e),function(e,t){o[e].push(t)}(e,t)};var g=!1,y={_tasks:new z,_createTaskItem:(e,t)=>({data:e,callback:t}),*[Symbol.iterator](){yield*y._tasks[Symbol.iterator]()},concurrency:t,payload:n,buffer:t/4,started:!1,paused:!1,push(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!1,t))}return d(e,!1,!1,t)},pushAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!0,t))}return d(e,!1,!0,t)},kill(){a(),y._tasks.empty()},unshift(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!1,t))}return d(e,!0,!1,t)},unshiftAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!0,t))}return d(e,!0,!0,t)},remove(e){y._tasks.remove(e)},process(){if(!g){for(g=!0;!y.paused&&r<y.concurrency&&y._tasks.length;){var e=[],t=[],n=y._tasks.length;y.payload&&(n=Math.min(n,y.payload));for(var o=0;o<n;o++){var a=y._tasks.shift();e.push(a),s.push(a),t.push(a.data)}r+=1,0===y._tasks.length&&c("empty"),r===y.concurrency&&c("saturated");var u=T(p(e));i(t,u)}g=!1}},length:()=>y._tasks.length,running:()=>r,workersList:()=>s,idle:()=>y._tasks.length+r===0,pause(){y.paused=!0},resume(){!1!==y.paused&&(y.paused=!1,l(y.process))}};return Object.defineProperties(y,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),y}function V(e,t){return H(e,1,t)}function W(e,t,n){return H(e,t,n)}var $=g((function(e,t,n,i){i=S(i);var r=m(n);return P(e,(e,n,i)=>{r(t,e,(e,n)=>{t=n,i(e)})},e=>i(e,t))}),4);function Q(...e){var t=e.map(m);return function(...e){var n=this,i=e[e.length-1];return"function"==typeof i?e.pop():i=M(),$(t,e,(e,t,i)=>{t.apply(n,e.concat((e,...t)=>{i(e,t)}))},(e,t)=>i(e,...t)),i[L]}}function K(...e){return Q(...e.reverse())}var X=g((function(e,t,n,i){return b(N(t),e,n,i)}),4);var Y=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(e,...n)=>e?t(e):t(e,n))},(e,t)=>{for(var n=[],r=0;r<t.length;r++)t[r]&&(n=n.concat(...t[r]));return i(e,n)})}),4);var Z=g((function(e,t,n){return Y(e,1/0,t,n)}),3);var ee=g((function(e,t,n){return Y(e,1,t,n)}),3);function te(...e){return function(...t){return t.pop()(null,...e)}}function ne(e,t){return(n,i,r,s)=>{var o,a=!1;const c=m(r);n(i,(n,i,r)=>{c(n,(i,s)=>i||!1===i?r(i):e(s)&&!o?(a=!0,o=t(!0,n),r(null,v)):void r())},e=>{if(e)return s(e);s(null,a?o:t(!1))})}}var ie=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(R,e,t,n)}),3);var re=g((function(e,t,n,i){return ne(e=>e,(e,t)=>t)(N(t),e,n,i)}),4);var se=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(N(1),e,t,n)}),3);function oe(e){return(t,...n)=>m(t)(...n,(t,...n)=>{"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&n.forEach(t=>console[e](t)))})}var ae=oe("dir");var ce=g((function(e,t,n){n=T(n);var i,r=m(e),s=m(t);function o(e,...t){if(e)return n(e);!1!==e&&(i=t,s(...t,a))}function a(e,t){return e?n(e):!1!==e?t?void r(o):n(null,...i):void 0}return a(null,!0)}),3);function ue(e,t,n){const i=m(t);return ce(e,(...e)=>{const t=e.pop();i(...e,(e,n)=>t(e,!n))},n)}function le(e){return(t,n,i)=>e(t,i)}var de=g((function(e,t,n){return R(e,le(m(t)),n)}),3);var pe=g((function(e,t,n,i){return N(t)(e,le(m(n)),i)}),4);var he=g((function(e,t,n){return pe(e,1,t,n)}),3);function fe(e){return f(e)?e:function(...t){var n=t.pop(),i=!0;t.push((...e)=>{i?l(()=>n(...e)):n(...e)}),e.apply(this,t),i=!1}}var me=g((function(e,t,n){return ne(e=>!e,e=>!e)(R,e,t,n)}),3);var ge=g((function(e,t,n,i){return ne(e=>!e,e=>!e)(N(t),e,n,i)}),4);var ye=g((function(e,t,n){return ne(e=>!e,e=>!e)(P,e,t,n)}),3);function be(e,t,n,i){var r=new Array(t.length);e(t,(e,t,i)=>{n(e,(e,n)=>{r[t]=!!n,i(e)})},e=>{if(e)return i(e);for(var n=[],s=0;s<t.length;s++)r[s]&&n.push(t[s]);i(null,n)})}function _e(e,t,n,i){var r=[];e(t,(e,t,i)=>{n(e,(n,s)=>{if(n)return i(n);s&&r.push({index:t,value:e}),i(n)})},e=>{if(e)return i(e);i(null,r.sort((e,t)=>e.index-t.index).map(e=>e.value))})}function ve(e,t,n,i){return(_(t)?be:_e)(e,t,m(n),i)}var Se=g((function(e,t,n){return ve(R,e,t,n)}),3);var we=g((function(e,t,n,i){return ve(N(t),e,n,i)}),4);var Te=g((function(e,t,n){return ve(P,e,t,n)}),3);var Ie=g((function(e,t){var n=T(t),i=m(fe(e));return function e(t){if(t)return n(t);!1!==t&&i(e)}()}),2);var Ne=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(n,i)=>n?t(n):t(n,{key:i,val:e}))},(e,t)=>{for(var n={},{hasOwnProperty:r}=Object.prototype,s=0;s<t.length;s++)if(t[s]){var{key:o}=t[s],{val:a}=t[s];r.call(n,o)?n[o].push(a):n[o]=[a]}return i(e,n)})}),4);function Ae(e,t,n){return Ne(e,1/0,t,n)}function Ee(e,t,n){return Ne(e,1,t,n)}var xe=oe("log");var Re=g((function(e,t,n,i){i=S(i);var r={},s=m(n);return N(t)(e,(e,t,n)=>{s(e,t,(e,i)=>{if(e)return n(e);r[t]=i,n(e)})},e=>i(e,r))}),4);function Ce(e,t,n){return Re(e,1/0,t,n)}function Oe(e,t,n){return Re(e,1,t,n)}function Pe(e,t=(e=>e)){var n=Object.create(null),i=Object.create(null),s=m(e),o=r((e,r)=>{var o=t(...e);o in n?l(()=>r(null,...n[o])):o in i?i[o].push(r):(i[o]=[r],s(...e,(e,...t)=>{e||(n[o]=t);var r=i[o];delete i[o];for(var s=0,a=r.length;s<a;s++)r[s](e,...t)}))});return o.memo=n,o.unmemoized=e,o}var ke=u(a?process.nextTick:o?setImmediate:c),je=g((e,t,n)=>{var i=_(t)?[]:{};e(t,(e,t,n)=>{m(e)((e,...r)=>{r.length<2&&([r]=r),i[t]=r,n(e)})},e=>n(e,i))},3);function Le(e,t){return je(R,e,t)}function Me(e,t,n){return je(N(t),e,n)}function De(e,t){var n=m(e);return H((e,t)=>{n(e[0],t)},t,1)}class Be{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let t;for(;e>0&&qe(this.heap[e],this.heap[t=Fe(e)]);){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}percDown(e){let t;for(;(t=1+(e<<1))<this.heap.length&&(t+1<this.heap.length&&qe(this.heap[t+1],this.heap[t])&&(t+=1),!qe(this.heap[e],this.heap[t]));){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let t=0;for(let n=0;n<this.heap.length;n++)e(this.heap[n])||(this.heap[t]=this.heap[n],t++);this.heap.splice(t);for(let e=Fe(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function Fe(e){return(e+1>>1)-1}function qe(e,t){return e.priority!==t.priority?e.priority<t.priority:e.pushCount<t.pushCount}function Ue(e,t){var n=De(e,t),{push:i,pushAsync:r}=n;function s(e,t){return Array.isArray(e)?e.map(e=>({data:e,priority:t})):{data:e,priority:t}}return n._tasks=new Be,n._createTaskItem=({data:e,priority:t},n)=>({data:e,priority:t,callback:n}),n.push=function(e,t=0,n){return i(s(e,t),n)},n.pushAsync=function(e,t=0,n){return r(s(e,t),n)},delete n.unshift,delete n.unshiftAsync,n}var Je=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var n=0,i=e.length;n<i;n++)m(e[n])(t)}),2);function ze(e,t,n,i){var r=[...e].reverse();return $(r,t,n,i)}function Ge(e){var t=m(e);return r((function(e,n){return e.push((e,...t)=>{let i={};if(e&&(i.error=e),t.length>0){var r=t;t.length<=1&&([r]=t),i.value=r}n(null,i)}),t.apply(this,e)}))}function He(e){var t;return Array.isArray(e)?t=e.map(Ge):(t={},Object.keys(e).forEach(n=>{t[n]=Ge.call(this,e[n])})),t}function Ve(e,t,n,i){const r=m(n);return ve(e,t,(e,t)=>{r(e,(e,n)=>{t(e,!n)})},i)}var We=g((function(e,t,n){return Ve(R,e,t,n)}),3);var $e=g((function(e,t,n,i){return Ve(N(t),e,n,i)}),4);var Qe=g((function(e,t,n){return Ve(P,e,t,n)}),3);function Ke(e){return function(){return e}}function Xe(e,t,n){var i={times:5,intervalFunc:Ke(0)};if(arguments.length<3&&"function"==typeof e?(n=t||M(),t=e):(Ye(i,e),n=n||M()),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var r=m(t),s=1;function o(){r((e,...t)=>{!1!==e&&(e&&s++<i.times&&("function"!=typeof i.errorFilter||i.errorFilter(e))?setTimeout(o,i.intervalFunc(s-1)):n(e,...t))})}return o(),n[L]}function Ye(e,t){if("object"==typeof t)e.times=+t.times||5,e.intervalFunc="function"==typeof t.interval?t.interval:Ke(+t.interval||0),e.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");e.times=+t||5}}function Ze(e,t){t||(t=e,e=null);let n=e&&e.arity||t.length;f(t)&&(n+=1);var i=m(t);return r((t,r)=>{function s(e){i(...t,e)}return(t.length<n-1||null==r)&&(t.push(r),r=M()),e?Xe(e,s,r):Xe(s,r),r[L]})}function et(e,t){return je(P,e,t)}var tt=g((function(e,t,n){return ne(Boolean,e=>e)(R,e,t,n)}),3);var nt=g((function(e,t,n,i){return ne(Boolean,e=>e)(N(t),e,n,i)}),4);var it=g((function(e,t,n){return ne(Boolean,e=>e)(P,e,t,n)}),3);var rt=g((function(e,t,n){var i=m(t);return C(e,(e,t)=>{i(e,(n,i)=>{if(n)return t(n);t(n,{value:e,criteria:i})})},(e,t)=>{if(e)return n(e);n(null,t.sort(r).map(e=>e.value))});function r(e,t){var n=e.criteria,i=t.criteria;return n<i?-1:n>i?1:0}}),3);function st(e,t,n){var i=m(e);return r((r,s)=>{var o,a=!1;r.push((...e)=>{a||(s(...e),clearTimeout(o))}),o=setTimeout((function(){var t=e.name||"anonymous",i=new Error('Callback function "'+t+'" timed out.');i.code="ETIMEDOUT",n&&(i.info=n),a=!0,s(i)}),t),i(...r)})}function ot(e,t,n,i){var r=m(n);return X(function(e){for(var t=Array(e);e--;)t[e]=e;return t}(e),t,r,i)}function at(e,t,n){return ot(e,1/0,t,n)}function ct(e,t,n){return ot(e,1,t,n)}function ut(e,t,n,i){arguments.length<=3&&"function"==typeof t&&(i=n,n=t,t=Array.isArray(e)?[]:{}),i=S(i||M());var r=m(n);return R(e,(e,n,i)=>{r(t,e,n,i)},e=>i(e,t)),i[L]}var lt=g((function(e,t){var n,i=null;return he(e,(e,t)=>{m(e)((e,...r)=>{if(!1===e)return t(e);r.length<2?[n]=r:n=r,i=e,t(e?null:{})})},()=>t(i,n))}));function dt(e){return(...t)=>(e.unmemoized||e)(...t)}var pt=g((function(e,t,n){n=T(n);var i=m(t),r=m(e),s=[];function o(e,...t){if(e)return n(e);s=t,!1!==e&&r(a)}function a(e,t){return e?n(e):!1!==e?t?void i(o):n(null,...s):void 0}return r(a)}),3);function ht(e,t,n){const i=m(e);return pt(e=>i((t,n)=>e(t,!n)),t,n)}var ft=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var n=0;function i(t){m(e[n++])(...t,T(r))}function r(r,...s){if(!1!==r)return r||n===e.length?t(r,...s):void i(s)}i([])})),mt={apply:i,applyEach:O,applyEachSeries:j,asyncify:d,auto:D,autoInject:J,cargo:V,cargoQueue:W,compose:K,concat:Z,concatLimit:Y,concatSeries:ee,constant:te,detect:ie,detectLimit:re,detectSeries:se,dir:ae,doUntil:ue,doWhilst:ce,each:de,eachLimit:pe,eachOf:R,eachOfLimit:A,eachOfSeries:P,eachSeries:he,ensureAsync:fe,every:me,everyLimit:ge,everySeries:ye,filter:Se,filterLimit:we,filterSeries:Te,forever:Ie,groupBy:Ae,groupByLimit:Ne,groupBySeries:Ee,log:xe,map:C,mapLimit:X,mapSeries:k,mapValues:Ce,mapValuesLimit:Re,mapValuesSeries:Oe,memoize:Pe,nextTick:ke,parallel:Le,parallelLimit:Me,priorityQueue:Ue,queue:De,race:Je,reduce:$,reduceRight:ze,reflect:Ge,reflectAll:He,reject:We,rejectLimit:$e,rejectSeries:Qe,retry:Xe,retryable:Ze,seq:Q,series:et,setImmediate:l,some:tt,someLimit:nt,someSeries:it,sortBy:rt,timeout:st,times:at,timesLimit:ot,timesSeries:ct,transform:ut,tryEach:lt,unmemoize:dt,until:ht,waterfall:ft,whilst:pt,all:me,allLimit:ge,allSeries:ye,any:tt,anyLimit:nt,anySeries:it,find:ie,findLimit:re,findSeries:se,flatMap:Z,flatMapLimit:Y,flatMapSeries:ee,forEach:de,forEachSeries:he,forEachLimit:pe,forEachOf:R,forEachOfSeries:P,forEachOfLimit:A,inject:$,foldl:$,foldr:ze,select:Se,selectLimit:we,selectSeries:Te,wrapSync:d,during:pt,doDuring:ce}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GenesysCloudMediaSession=void 0;const i=n(16).__importDefault(n(65)),r=n(6),s=n(18),o=n(11),a=n(21);t.GenesysCloudMediaSession=class{constructor(e,t){this.webrtcExtension=e,this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.state="pending",this.connectionState="starting",this.id=t.id,this.fromJid=t.fromJid,this.peerID=t.peerID,this.logger=t.logger,this.conversationId=t.conversationId,this.fromUserId=t.fromUserId,this.pc=this.peerConnection=new RTCPeerConnection({iceServers:t.iceServers,iceTransportPolicy:t.iceTransportPolicy}),this.originalRoomJid=t.originalRoomJid,this.sessionType=a.SessionTypes[t.sessionType],this.ignoreHostCandidatesFromRemote=!!t.ignoreHostCandidatesFromRemote,this.allowIPv6=!!t.allowIPv6,this.allowTCP=!!t.allowTCP,this.reinvite=!!t.reinvite;const n=new r.EventEmitter;Object.keys(n.__proto__).forEach(e=>{this[e]=n[e]}),t.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate.bind(this)),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceStateChange.bind(this)),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}async setRemoteDescription(e){return this.peerConnection.setRemoteDescription({sdp:e,type:"offer"})}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}log(e,t,n,i){n||(n={});const r={...n,...this.getLogDetails()};this.logger[e](t,r,i)}async sendGenesysWebrtc(e){e.id=e.id||s.v4(),e.jsonrpc=e.jsonrpc||"2.0";const t={type:"set",genesysWebrtc:e,from:this.webrtcExtension.jid,to:this.peerID};return this.webrtcExtension.sendIq(t)}async end(e="success",t=!1){this.state="ended";const n={sessionId:this.id,reason:e.condition||e};t||await o.timeoutPromise((e,t)=>this.sendGenesysWebrtc({jsonrpc:"2.0",method:"terminate",params:n}).then(e,t),2e3,"Timeout waiting for response to termination request",{sessionId:this.id,conversationId:this.conversationId,sessionType:this.sessionType}).catch(e=>this.logger.error(e)),this.onSessionTerminate(n.reason)}setupStatsGatherer(){this.statsGatherer=new i.default(this.peerConnection),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}async onIceStateChange(){const e=this.peerConnection.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e)"stable"===this.peerConnection.signalingState&&(this.interruptionStart=new Date,this.log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i}));else if("connected"===e){this.log("info","sending session-info: active");const e={sessionId:this.id,status:"active"};await this.sendGenesysWebrtc({jsonrpc:"2.0",params:e,method:"info"}),this._setupDataChannel()}else"failed"===e&&this.log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer})}onConnectionStateChange(){const e=this.connectionState=this.peerConnection.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this.log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this.log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this.log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url})}createIceCandidate(e,t){return new RTCIceCandidate({sdpMid:e,candidate:t})}async addRemoteIceCandidate(e){const t=e.match(/m=([^\s]+)/)[1],n=e.match(/a=([^\\\r]+)/)[1],i=this.createIceCandidate(t,n);await this.peerConnection.addIceCandidate(i)}onIceCandidate(e){var t,n;let i,r=null===(t=e.candidate)||void 0===t?void 0:t.candidate,s=null===(n=e.candidate)||void 0===n?void 0:n.sdpMid;if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this.log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this.log("debug","Processing ice candidate",e.candidate),this.log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++,i=`m=${s} 9 RTP/AVP 0\r\na=${r}`}else i="a=end-of-candidates",this.emit("endOfCandidates");return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"iceCandidate",params:{sessionId:this.id,sdp:i}})}onSessionTerminate(e){this.peerConnection&&this.peerConnection.close(),this.emit("terminated",{condition:e||"success"})}async addTrack(e,t){const n=this.peerConnection.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.peerConnection.addTrack(e,t)}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.peerConnection.remoteDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this.log("info","creating data channel"),this.dataChannel=this.peerConnection.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this.log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this.log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this.log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this.log("error","Failed to parse data channel message",{error:e})}}async accept(){this.state="active";const e=await this.peerConnection.createAnswer();await this.peerConnection.setLocalDescription(e);const t={sdp:e.sdp,sessionId:this.id};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"answer",params:t})}async mute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"mute",params:n})}async unmute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"unmute",params:n})}async removeTrack(){throw new Error("Not Implemented")}async hold(){throw new Error("Not Implemented")}async resume(){throw new Error("Not Implemented")}toString(){return{connectionState:this.connectionState,state:this.state,sessionType:this.sessionType,fromJid:this.fromJid,conversationId:this.conversationId,id:this.id,peerConnection:this.peerConnection}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.core=void 0;const i=n(3);(0,i.__exportStar)(n(69),t),(0,i.__exportStar)(n(70),t),(0,i.__exportStar)(n(71),t),(0,i.__exportStar)(n(72),t),(0,i.__exportStar)(n(73),t),(0,i.__exportStar)(n(74),t),(0,i.__exportStar)(n(75),t),(0,i.__exportStar)(n(76),t),(0,i.__exportStar)(n(77),t),(0,i.__exportStar)(n(78),t),(0,i.__exportStar)(n(79),t),(0,i.__exportStar)(n(81),t),(0,i.__exportStar)(n(82),t),(0,i.__exportStar)(n(83),t),(0,i.__exportStar)(n(84),t),(0,i.__exportStar)(n(85),t),(0,i.__exportStar)(n(86),t),(0,i.__exportStar)(n(87),t);const r=(0,i.__importDefault)(n(69)),s=(0,i.__importDefault)(n(70)),o=(0,i.__importDefault)(n(71)),a=(0,i.__importDefault)(n(72)),c=(0,i.__importDefault)(n(73)),u=(0,i.__importDefault)(n(74)),l=(0,i.__importDefault)(n(75)),d=(0,i.__importDefault)(n(76)),p=(0,i.__importDefault)(n(77)),h=(0,i.__importDefault)(n(78)),f=(0,i.__importDefault)(n(79)),m=(0,i.__importDefault)(n(81)),g=(0,i.__importDefault)(n(82)),y=(0,i.__importDefault)(n(83)),b=(0,i.__importDefault)(n(84)),_=(0,i.__importDefault)(n(85)),v=(0,i.__importDefault)(n(86)),S=(0,i.__importDefault)(n(87));t.core=function(e){e.use(d.default),e.use(u.default),e.use(o.default),e.use(c.default),e.use(p.default),e.use(v.default)},t.default=function(e){e.use(r.default),e.use(m.default),e.use(s.default),e.use(a.default),e.use(l.default),e.use(h.default),e.use(f.default),e.use(g.default),e.use(y.default),e.use(b.default),e.use(_.default),e.use(S.default)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"XRD",fields:{subject:(0,i.childText)(null,"Subject")},namespace:r.NS_XRD,path:"xrd"},{aliases:[{path:"xrd.links",multiple:!0}],element:"Link",fields:{href:(0,i.attribute)("href"),rel:(0,i.attribute)("rel"),type:(0,i.attribute)("type")},namespace:r.NS_XRD}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessengerExtension=void 0;const i=n(228),r=n(8),s=n(18);class o extends i.Emitter{constructor(e,t){super(),this.client=e,this.stanzaInstance=t}get bareJid(){return r.toBare(this.stanzaInstance.jid)}handleStanzaInstanceChange(e){this.stanzaInstance=e}isMediaMessage(e){return!!e.mediaMessage}handleMessage(e){if(!this.isMediaMessage(e))return;const t=e.from===this.stanzaInstance.jid,n=r.toBare(e.from)===this.bareJid;this.emit("mediaMessage",{...e,fromMyClient:t,fromMyUser:n})}async broadcastMessage(e){const t=s.v4();return e.id=t,e.from=this.stanzaInstance.jid,e.to||(e.to=this.bareJid),await this.stanzaInstance.send("message",e),t}get expose(){return{broadcastMessage:this.broadcastMessage.bind(this),on:this.on.bind(this),once:this.once.bind(this),off:this.off.bind(this),removeListener:this.removeListener.bind(this),addListener:this.addListener.bind(this)}}}t.MessengerExtension=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const i=n(16),r=n(173),s=n(229);n(187);const o=n(188),a=n(190),c=n(215),u=n(216),l=n(11),d=n(27),p=i.__importDefault(n(6)),h=n(217),f=n(49),m=i.__importDefault(n(227)),g=i.__importDefault(n(169)),y=n(53),b=n(47);let _={notifications:o.Notifications,webrtcSessions:a.WebrtcExtension,messenger:b.MessengerExtension};class v extends p.default{constructor(e){super(),this.connected=!1,this.connecting=!1,this.hardReconnectRequired=!0,this.isGuest=!1,this.backgroundAssistantMode=!1,this.autoReconnect=!0,this.extensions=[],this.channelReuses=0,this.hasMadeInitialAttempt=!1,this.http=new d.HttpClient,this.reconnectOnNoLongerSubscribed=!1!==e.reconnectOnNoLongerSubscribed,this.useServerSidePings=!1!==e.useServerSidePings,this.config={host:e.host,apiHost:e.apiHost||e.host.replace("wss://streaming.",""),authToken:e.authToken,jwt:e.jwt,jid:e.jid,jidResource:e.jidResource,channelId:null,appName:e.appName,appVersion:e.appVersion,appId:e.appId,customHeaders:e.customHeaders},this.backgroundAssistantMode=this.checkIsBackgroundAssistant(),this.isGuest=!this.backgroundAssistantMode&&!e.authToken;let t=e.authToken||"",n=`https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;this.backgroundAssistantMode&&(t=e.jwt,n+="/backgroundassistant"),this.logger=new s.Logger({accessToken:t,url:n,uploadDebounceTime:1e3,initializeServerLogging:!this.isGuest&&!e.optOutOfWebrtcStatsTelemetry,appVersion:v.version,appName:"streaming-client",logLevel:this.config.logLevel||"info",logger:e.logger||console,formatters:e.logFormatters,originAppName:e.appName,originAppVersion:e.appVersion,originAppId:e.appId,customHeaders:e.customHeaders}),this.connectionManager=new h.ConnectionManager(this.logger,this.config),Object.keys(_).forEach(t=>{const n=new _[t](this,e);this.extensions.push(n),n.tokenBucket||(n.tokenBucket=new r.TokenBucket(20,25,1e3),n.tokenBucket.content=25),"function"==typeof n.on&&n.on("send",this.handleSendEventFromExtension.bind(this,n)),this[t]=n.expose,this["_"+t]=n})}handleSendEventFromExtension(e,t,n=!1){return e.tokenBucket.removeTokens(1,()=>{const e=this.activeStanzaInstance;return e?!0===n?e.sendMessage(t):e.sendIQ(t):this.logger.warn("cannot send message, no active stanza client",{data:t,message:n},{skipServer:!0})})}checkIsBackgroundAssistant(){if(this.config.jwt){const e=l.parseJwt(this.config.jwt);return e&&"urn:purecloud:screenrecording"===e.iss}return!1}addInateEventHandlers(e){this.removeStanzaBoundEventHandlers(),this.boundStanzaDisconnect=this.handleStanzaDisconnectedEvent.bind(this,e),this.boundStanzaNoLongerSubscribed=this.handleNoLongerSubscribed.bind(this,e),this.boundStanzaDuplicateId=this.handleDuplicateId.bind(this,e),this.on("stanzaDisconnected",this.boundStanzaDisconnect),this.on("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.on("notify:duplicate_id",this.boundStanzaDuplicateId),this.extensions.forEach(t=>{"function"==typeof t.handleIq&&e.on("iq",t.handleIq.bind(t)),"function"==typeof t.handleMessage&&e.on("message",t.handleMessage.bind(t))})}removeStanzaBoundEventHandlers(){this.boundStanzaDisconnect&&(this.off("stanzaDisconnected",this.boundStanzaDisconnect),this.boundStanzaDisconnect=void 0),this.boundStanzaNoLongerSubscribed&&(this.off("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.boundStanzaNoLongerSubscribed=void 0),this.boundStanzaDuplicateId&&(this.off("notify:duplicate_id",this.boundStanzaDuplicateId),this.boundStanzaDuplicateId=void 0)}proxyStanzaEvents(e){e.originalEmitter=e.emit,e.emit=(t,...n)=>{const i=e.originalEmitter(t,...n);return"connected"===t?i:("disconnected"===t&&(t="stanzaDisconnected"),this.emit(t,...n))}}async handleStanzaDisconnectedEvent(e){var t,n;if(this.logger.info("stanzaDisconnected event received",{stanzaInstanceId:e.id,channelId:e.channelId}),this.connected=!1,this.connecting=!1,null===(t=e.pinger)||void 0===t||t.stop(),null===(n=e.serverMonitor)||void 0===n||n.stop(),this.removeAllListeners("stanzaDisconnected"),this.removeAllListeners("notify:no_longer_subscribed"),e.originalEmitter&&(e.emit=e.originalEmitter),this.activeStanzaInstance=void 0,this.emit("disconnected",{reconnecting:this.autoReconnect}),this.autoReconnect)return this.connect({keepTryingOnFailure:!0})}handleNoLongerSubscribed(e){var t,n;this.logger.warn("noLongerSubscribed event received",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),null===(n=e.serverMonitor)||void 0===n||n.stop(),this.hardReconnectRequired=!0,this.reconnectOnNoLongerSubscribed||(this.autoReconnect=!1)}handleDuplicateId(e){var t,n;this.logger.warn("duplicate_id event received, forcing hard reconnect",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),null===(n=e.serverMonitor)||void 0===n||n.stop(),this.hardReconnectRequired=!0}async disconnect(){if(this.logger.info("streamingClient.disconnect was called"),this.activeStanzaInstance)return l.timeoutPromise(e=>(this.autoReconnect=!1,this.http.stopAllRetries(),this.activeStanzaInstance.disconnect().then(e)),5e3,"disconnecting streaming service")}getConnectionData(){const e=sessionStorage.getItem("sc_connectionData"),t={currentDelayMs:0};if(e)try{return JSON.parse(e)}catch(e){return this.logger.warn("failed to parse streaming client connection data"),t}return t}setConnectionData(e){sessionStorage.setItem("sc_connectionData",JSON.stringify(e))}increaseBackoff(){const e=this.getConnectionData(),t=Math.max(2*e.currentDelayMs,2e3);this.setConnectionData({currentDelayMs:t,delayMsAfterNextReduction:t/2,nextDelayReductionTime:(new Date).getTime()+5*t,timeOfTotalReset:(new Date).getTime()+36e5})}decreaseBackoff(e){const t=this.getConnectionData(),n=5*e,i={currentDelayMs:e,delayMsAfterNextReduction:e/2,nextDelayReductionTime:(new Date).getTime()+n,timeOfTotalReset:t.timeOfTotalReset};if(t.timeOfTotalReset&&t.timeOfTotalReset<(new Date).getTime()||e<2e3)return this.logger.debug("decreaseBackoff() called, but timeOfTotalReset has elasped or next delay is below 2s. Resetting backoff"),this.setConnectionData({currentDelayMs:0});this.setConnectionData(i),clearTimeout(this.backoffReductionTimer),this.logger.debug("Setting timer for next backoff reduction since we haven't reached total reset",{msUntilReduction:n,delayMsAfterNextReduction:i.delayMsAfterNextReduction}),this.backoffReductionTimer=setTimeout(()=>this.decreaseBackoff(i.delayMsAfterNextReduction),n)}getStartingDelay(e,t){const n=Math.max(e.currentDelayMs,2e3);return e.timeOfTotalReset&&e.timeOfTotalReset<(new Date).getTime()?2e3:Math.min(n,t)}async connect(e){var t;if(this.connecting){const e=new Error("Already trying to connect streaming client");return this.logger.warn(e)}this.connecting=!0;const n=(null==e?void 0:e.maxDelayBetweenConnectionAttempts)||9e4;let i=(null==e?void 0:e.maxConnectionAttempts)||1;(null==e?void 0:e.keepTryingOnFailure)&&(i=1/0),clearTimeout(this.backoffReductionTimer);const r=this.getConnectionData(),s=this.getStartingDelay(r,n),o=this.hasMadeInitialAttempt;this.hasMadeInitialAttempt=!0;try{await f.backOff(async()=>{const e=this.getConnectionData();if(await this.makeConnectionAttempt(),e.nextDelayReductionTime){const t=e.nextDelayReductionTime-(new Date).getTime();this.logger.debug("Setting timer for next backoff reduction",{msUntilReduction:t,delayMsAfterNextReduction:e.delayMsAfterNextReduction}),this.backoffReductionTimer=setTimeout(()=>this.decreaseBackoff(e.delayMsAfterNextReduction||0),t)}},{jitter:"none",maxDelay:n,numOfAttempts:i,startingDelay:s,delayFirstAttempt:o,retry:this.backoffConnectRetryHandler.bind(this,{maxConnectionAttempts:i})})}catch(e){let n=e;if(e){if("AxiosError"===e.name){const i=e,r=i.config||{url:void 0,method:void 0};n={config:{url:r.url,method:r.method},status:null===(t=i.response)||void 0===t?void 0:t.status,code:i.code,name:i.name,message:i.message}}}else n=new Error("Streaming client connection attempted received and undefined error");if(this.logger.error("Failed to connect streaming client",{error:n}),!e)throw n;throw e}}async backoffConnectRetryHandler(e,t,n){var i,r,s,o,a;if(n>=e.maxConnectionAttempts)return!1;const c={connectionAttempt:n,error:t};if(t){if("AxiosError"===t.name){const e=t,n=e.config||{url:void 0,method:void 0};let s={config:{url:n.url,method:n.method},status:null===(i=e.response)||void 0===i?void 0:i.status,code:e.code,name:e.name,message:e.message};if(c.error=s,[401,403].includes((null===(r=t.response)||void 0===r?void 0:r.status)||0))return this.logger.error("Streaming client received an error that it can't recover from and will not attempt to reconnect",c),!1}}else c.error=new Error("streaming client backoff handler received undefined error");if(t instanceof g.default&&(this.logger.info("hardReconnectRequired set to true due to sasl error"),this.hardReconnectRequired=!0,Object.assign(c,{channelId:t.channelId,stanzaInstanceId:t.stanzaInstanceId})),t instanceof y.TimeoutError){c.error=t.message;const e=t.details;e&&(c.details=e)}if(null==t?void 0:t.response){const e=(null===(s=t.response.headers)||void 0===s?void 0:s["retry-after"])||(null===(a=(o=t.response).getResponseHeader)||void 0===a?void 0:a.call(o,"retry-after"));if(e){let n=1e3*parseInt(e,10);return c.retryDelay=n,this.logger.error("Failed streaming client connection attempt, respecting retry-after header and will retry afterwards.",c,{skipServer:t instanceof m.default}),await l.delay(n),this.logger.debug("finished waiting for retry-after"),!0}}return this.logger.error("Failed streaming client connection attempt, retrying",c,{skipServer:t instanceof m.default}),this.increaseBackoff(),!0}async makeConnectionAttempt(){var e,t;if(!navigator.onLine)throw new m.default("Browser is offline, skipping connection attempt");let n,i=this.connecting;try{await this.prepareForConnect(),n=await this.connectionManager.getNewStanzaConnection(),this.connected=!0,this.connecting=!1,this.addInateEventHandlers(n),this.proxyStanzaEvents(n);for(const e of this.extensions)e.configureNewStanzaInstance&&await e.configureNewStanzaInstance(n);for(const e of this.extensions)e.handleStanzaInstanceChange(n);this.activeStanzaInstance=n,await this.setupConnectionMonitoring(n),this.emit("connected")}catch(r){throw n&&(this.logger.error("Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected",{stanzaInstanceId:n.id,channelId:n.channelId}),this.removeStanzaBoundEventHandlers(),null===(e=n.pinger)||void 0===e||e.stop(),null===(t=n.serverMonitor)||void 0===t||t.stop(),await n.disconnect(),this.connected=!1,this.connecting=i),r}}async setupConnectionMonitoring(e){const t=t=>{this.logger.warn("$(message), falling back to client-side pinging",{stanzaInstanceId:e.id,channelId:e.channelId}),e.pinger=new c.Ping(this,e)};if(this.useServerSidePings)try{await e.subscribeToNode(this._notifications.pubsubHost,"enable.server.side.pings"),e.serverMonitor=new u.ServerMonitor(this,e)}catch(e){t()}else t()}async prepareForConnect(){if(this.config.jwt)return this.hardReconnectRequired=!1,this.connectionManager.setConfig(this.config);if(this.hardReconnectRequired||(this.channelReuses++,this.channelReuses>=10&&(this.logger.warn("Forcing a hard reconnect due to max channel reuses",{channelId:this.config.channelId,channelReuses:this.channelReuses}),this.channelReuses=0,this.hardReconnectRequired=!0)),this.hardReconnectRequired){let e;if(this.config.jid)e=Promise.resolve(this.config.jid);else{const t={method:"get",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger,customHeaders:this.config.customHeaders};e=this.http.requestApi("users/me",t).then(e=>e.data.chat.jabberId)}const t={method:"post",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger,customHeaders:this.config.customHeaders},n=this.http.requestApi("notifications/channels?connectionType=streaming",t).then(e=>e.data.id),[i,r]=await Promise.all([e,n]);this.config.jid=i,this.config.channelId=r,this.autoReconnect=!0,this.logger.info("attempting to connect streaming client on channel",{channelId:r}),this.connectionManager.setConfig(this.config),this.hardReconnectRequired=!1}}stopServerLogging(){this.logger.sendAllLogsInstantly(),this._webrtcSessions.flushStats(),this.logger.stopServerLogging()}startServerLogging(){this.logger.startServerLogging()}setAccessToken(e){this.config.authToken=e,this.logger.setAccessToken(e)}static extend(e,t){if(_[e])throw new Error("Cannot register already existing namespace "+e);_[e]=t}get version(){return v.version}static get version(){return"17.2.2"}}t.Client=v},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(176),o=n(177);t.backOff=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return n=s.getSanitizedOptions(t),[4,new a(e,n).execute()];case 1:return[2,i.sent()]}}))}))};var a=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return i(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,o.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()},function(e,t,n){"use strict";var i={};n.r(i),n.d(i,"hasBrowserEnv",(function(){return y})),n.d(i,"hasStandardBrowserWebWorkerEnv",(function(){return v})),n.d(i,"hasStandardBrowserEnv",(function(){return b}));var r=n(0),s=n(30),o=n(14);function a(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function c(e,t){this._pairs=[],e&&Object(o.a)(e,this,t)}const u=c.prototype;u.append=function(e,t){this._pairs.push([e,t])},u.toString=function(e){const t=e?function(t){return e.call(this,t,a)}:a;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var l=c;function d(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function p(e,t,n){if(!t)return e;const i=n&&n.encode||d,s=n&&n.serialize;let o;if(o=s?s(t,n):r.a.isURLSearchParams(t)?t.toString():new l(t,n).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var h=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){r.a.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},f=n(4),m={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},g={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:l,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const y="undefined"!=typeof window&&"undefined"!=typeof document,b=(_="undefined"!=typeof navigator&&navigator.product,y&&["ReactNative","NativeScript","NS"].indexOf(_)<0);var _;const v="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var S={...i,...g};var w=function(e){function t(e,n,i,s){let o=e[s++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),c=s>=e.length;if(o=!o&&r.a.isArray(i)?i.length:o,c)return r.a.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a;i[o]&&r.a.isObject(i[o])||(i[o]=[]);return t(e,n,i[o],s)&&r.a.isArray(i[o])&&(i[o]=function(e){const t={},n=Object.keys(e);let i;const r=n.length;let s;for(i=0;i<r;i++)s=n[i],t[s]=e[s];return t}(i[o])),!a}if(r.a.isFormData(e)&&r.a.isFunction(e.entries)){const n={};return r.a.forEachEntry(e,(e,i)=>{t(function(e){return r.a.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),i,n,0)}),n}return null};const T={transitional:m,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=r.a.isObject(e);s&&r.a.isHTMLForm(e)&&(e=new FormData(e));if(r.a.isFormData(e))return i&&i?JSON.stringify(w(e)):e;if(r.a.isArrayBuffer(e)||r.a.isBuffer(e)||r.a.isStream(e)||r.a.isFile(e)||r.a.isBlob(e))return e;if(r.a.isArrayBufferView(e))return e.buffer;if(r.a.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Object(o.a)(e,new S.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,i){return S.isNode&&r.a.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=r.a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Object(o.a)(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),function(e,t,n){if(r.a.isString(e))try{return(t||JSON.parse)(e),r.a.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||T.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&r.a.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw f.a.from(e,f.a.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:S.classes.FormData,Blob:S.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};r.a.forEach(["delete","get","head","post","put","patch"],e=>{T.headers[e]={}});var I=T;const N=r.a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const A=Symbol("internals");function E(e){return e&&String(e).trim().toLowerCase()}function x(e){return!1===e||null==e?e:r.a.isArray(e)?e.map(x):String(e)}function R(e,t,n,i,s){return r.a.isFunction(i)?i.call(this,t,n):(s&&(t=n),r.a.isString(t)?r.a.isString(i)?-1!==t.indexOf(i):r.a.isRegExp(i)?i.test(t):void 0:void 0)}class C{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(e,t,n){const s=E(t);if(!s)throw new Error("header name must be a non-empty string");const o=r.a.findKey(i,s);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||t]=x(e))}const o=(e,t)=>r.a.forEach(e,(e,n)=>s(e,n,t));return r.a.isPlainObject(e)||e instanceof this.constructor?o(e,t):r.a.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?o((e=>{const t={};let n,i,r;return e&&e.split("\n").forEach((function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),i=e.substring(r+1).trim(),!n||t[n]&&N[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=E(e)){const n=r.a.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(r.a.isFunction(t))return t.call(this,e,n);if(r.a.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=E(e)){const n=r.a.findKey(this,e);return!(!n||void 0===this[n]||t&&!R(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function s(e){if(e=E(e)){const s=r.a.findKey(n,e);!s||t&&!R(0,n[s],s,t)||(delete n[s],i=!0)}}return r.a.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const r=t[n];e&&!R(0,this[r],r,e,!0)||(delete this[r],i=!0)}return i}normalize(e){const t=this,n={};return r.a.forEach(this,(i,s)=>{const o=r.a.findKey(n,s);if(o)return t[o]=x(i),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();a!==s&&delete t[s],t[a]=x(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return r.a.forEach(this,(n,i)=>{null!=n&&!1!==n&&(t[i]=e&&r.a.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[A]=this[A]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=E(e);t[i]||(!function(e,t){const n=r.a.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(e,n,r){return this[i].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[i]=!0)}return r.a.isArray(e)?e.forEach(i):i(e),this}}C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),r.a.reduceDescriptors(C.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),r.a.freezeMethods(C);var O=C;function P(e,t){const n=this||I,i=t||n,s=O.from(i.headers);let o=i.data;return r.a.forEach(e,(function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)})),s.normalize(),o}function k(e){return!(!e||!e.__CANCEL__)}function j(e,t,n){f.a.call(this,null==e?"canceled":e,f.a.ERR_CANCELED,t,n),this.name="CanceledError"}r.a.inherits(j,f.a,{__CANCEL__:!0});var L=j,M=n(31);var D=S.hasStandardBrowserEnv?{write(e,t,n,i,s,o){const a=[e+"="+encodeURIComponent(t)];r.a.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.a.isString(i)&&a.push("path="+i),r.a.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function B(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var F=S.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function i(n){let i=n;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(e){const t=r.a.isString(e)?i(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};var q=function(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=i[o];r||(r=c),n[s]=a,i[s]=c;let l=o,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-r<t)return;const p=u&&c-u;return p?Math.round(1e3*d/p):void 0}};function U(e,t){let n=0;const i=q(50,250);return r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,c=i(a);n=s;const u={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r};u[t?"download":"upload"]=!0,e(u)}}var J="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let i=e.data;const s=O.from(e.headers).normalize();let o,a,{responseType:c,withXSRFToken:u}=e;function l(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if(r.a.isFormData(i))if(S.hasStandardBrowserEnv||S.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if(!1!==(a=s.getContentType())){const[e,...t]=a?a.split(";").map(e=>e.trim()).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}let d=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const h=B(e.baseURL,e.url);function g(){if(!d)return;const i=O.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());!function(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new f.a("Request failed with status code "+n.status,[f.a.ERR_BAD_REQUEST,f.a.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),l()}),(function(e){n(e),l()}),{data:c&&"text"!==c&&"json"!==c?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:i,config:e,request:d}),d=null}if(d.open(e.method.toUpperCase(),p(h,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,"onloadend"in d?d.onloadend=g:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(g)},d.onabort=function(){d&&(n(new f.a("Request aborted",f.a.ECONNABORTED,e,d)),d=null)},d.onerror=function(){n(new f.a("Network Error",f.a.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||m;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new f.a(t,i.clarifyTimeoutError?f.a.ETIMEDOUT:f.a.ECONNABORTED,e,d)),d=null},S.hasStandardBrowserEnv&&(u&&r.a.isFunction(u)&&(u=u(e)),u||!1!==u&&F(h))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&D.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===i&&s.setContentType(null),"setRequestHeader"in d&&r.a.forEach(s.toJSON(),(function(e,t){d.setRequestHeader(t,e)})),r.a.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),c&&"json"!==c&&(d.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",U(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",U(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{d&&(n(!t||t.type?new L(null,e,d):t),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(h);y&&-1===S.protocols.indexOf(y)?n(new f.a("Unsupported protocol "+y+":",f.a.ERR_BAD_REQUEST,e)):d.send(i||null)}))};const z={http:M.a,xhr:J};r.a.forEach(z,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const G=e=>"- "+e,H=e=>r.a.isFunction(e)||null===e||!1===e;var V=e=>{e=r.a.isArray(e)?e:[e];const{length:t}=e;let n,i;const s={};for(let r=0;r<t;r++){let t;if(n=e[r],i=n,!H(n)&&(i=z[(t=String(n)).toLowerCase()],void 0===i))throw new f.a(`Unknown adapter '${t}'`);if(i)break;s[t||"#"+r]=i}if(!i){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let n=t?e.length>1?"since :\n"+e.map(G).join("\n"):" "+G(e[0]):"as no adapter specified";throw new f.a("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return i};function W(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new L(null,e)}function $(e){W(e),e.headers=O.from(e.headers),e.data=P.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return V(e.adapter||I.adapter)(e).then((function(t){return W(e),t.data=P.call(e,e.transformResponse,t),t.headers=O.from(t.headers),t}),(function(t){return k(t)||(W(e),t&&t.response&&(t.response.data=P.call(e,e.transformResponse,t.response),t.response.headers=O.from(t.response.headers))),Promise.reject(t)}))}const Q=e=>e instanceof O?e.toJSON():e;function K(e,t){t=t||{};const n={};function i(e,t,n){return r.a.isPlainObject(e)&&r.a.isPlainObject(t)?r.a.merge.call({caseless:n},e,t):r.a.isPlainObject(t)?r.a.merge({},t):r.a.isArray(t)?t.slice():t}function s(e,t,n){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e,n):i(e,t,n)}function o(e,t){if(!r.a.isUndefined(t))return i(void 0,t)}function a(e,t){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function c(n,r,s){return s in t?i(n,r):s in e?i(void 0,n):void 0}const u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(e,t)=>s(Q(e),Q(t),!0)};return r.a.forEach(Object.keys(Object.assign({},e,t)),(function(i){const o=u[i]||s,a=o(e[i],t[i],i);r.a.isUndefined(a)&&o!==c||(n[i]=a)})),n}const X={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{X[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Y={};X.transitional=function(e,t,n){function i(e,t){return"[Axios v1.6.5] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,s)=>{if(!1===e)throw new f.a(i(r," has been removed"+(t?" in "+t:"")),f.a.ERR_DEPRECATED);return t&&!Y[r]&&(Y[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}};var Z={assertOptions:function(e,t,n){if("object"!=typeof e)throw new f.a("options must be an object",f.a.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const s=i[r],o=t[s];if(o){const t=e[s],n=void 0===t||o(t,s,e);if(!0!==n)throw new f.a("option "+s+" must be "+n,f.a.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new f.a("Unknown option "+s,f.a.ERR_BAD_OPTION)}},validators:X};const ee=Z.validators;class te{constructor(e){this.defaults=e,this.interceptors={request:new h,response:new h}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=K(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;void 0!==n&&Z.assertOptions(n,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1),null!=i&&(r.a.isFunction(i)?t.paramsSerializer={serialize:i}:Z.assertOptions(i,{encode:ee.function,serialize:ee.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&r.a.merge(s.common,s[t.method]);s&&r.a.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=O.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(c=c&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const u=[];let l;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let d,p=0;if(!c){const e=[$.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,u),d=e.length,l=Promise.resolve(t);p<d;)l=l.then(e[p++],e[p++]);return l}d=a.length;let h=t;for(p=0;p<d;){const e=a[p++],t=a[p++];try{h=e(h)}catch(e){t.call(this,e);break}}try{l=$.call(this,h)}catch(e){return Promise.reject(e)}for(p=0,d=u.length;p<d;)l=l.then(u[p++],u[p++]);return l}getUri(e){return p(B((e=K(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}r.a.forEach(["delete","get","head","options"],(function(e){te.prototype[e]=function(t,n){return this.request(K(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.a.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,r){return this.request(K(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}te.prototype[e]=t(),te.prototype[e+"Form"]=t(!0)}));var ne=te;class ie{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const i=new Promise(e=>{n.subscribe(e),t=e}).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,r){n.reason||(n.reason=new L(e,i,r),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new ie((function(t){e=t})),cancel:e}}}var re=ie;const se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(se).forEach(([e,t])=>{se[t]=e});var oe=se;const ae=function e(t){const n=new ne(t),i=Object(s.a)(ne.prototype.request,n);return r.a.extend(i,ne.prototype,n,{allOwnKeys:!0}),r.a.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(K(t,n))},i}(I);ae.Axios=ne,ae.CanceledError=L,ae.CancelToken=re,ae.isCancel=k,ae.VERSION="1.6.5",ae.toFormData=o.a,ae.AxiosError=f.a,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=function(e){return function(t){return e.apply(null,t)}},ae.isAxiosError=function(e){return r.a.isObject(e)&&!0===e.isAxiosError},ae.mergeConfig=K,ae.AxiosHeaders=O,ae.formToJSON=e=>w(r.a.isHTMLForm(e)?new FormData(e):e),ae.getAdapter=V,ae.HttpStatusCode=oe,ae.default=ae;t.a=ae},function(e,t,n){(function(t){var n=function(e,t,n,i){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,n){var i=this;return this.bucketSize?e>this.bucketSize?(t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?r():this.parentBucket?this.parentBucket.removeTokens(e,(function(t,s){return t?n(t,null):e>i.content?r():(i.content-=e,void n(null,Math.min(s,i.content)))})):(this.content-=e,t.nextTick(n.bind(null,null,this.content)),!0)):(t.nextTick(n.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function r(){var t=Math.ceil((e-i.content)*(i.interval/i.tokensPerInterval));return setTimeout((function(){i.removeTokens(e,n)}),t),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var n=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+n,this.bucketSize)}else this.content=this.bucketSize}},e.exports=n}).call(this,n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(179),r=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return i.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,n=this.numOfDelayedAttempts,i=e*Math.pow(t,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeoutError=void 0;class i extends Error{constructor(e){super(e)}}t.TimeoutError=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.saslprep=t.resourceprep=t.nodeprep=t.NodePrepProhibited=t.nameprep=t.prepare=t.D2=t.D1=t.C9=t.C8=t.C7=t.C6=t.C5=t.C4=t.C3=t.C22=t.C21=t.C12=t.C11=t.B3=t.B2=t.B1=t.A1=t.Table=void 0;const i=(0,n(3).__importDefault)(n(33)),r=n(192);class s{constructor(e,t){this.singles=new Set,this.ranges=[],this.mappings=new Map;const n=r.TABLE_DATA[e];this.name=e,n?(n.s&&(this.singles=new Set(n.s.split("|").map(e=>parseInt(e,32)))),n.r&&(this.ranges=n.r.split("|").map(e=>{const[t,n]=e.split(":");return[parseInt(t,32),parseInt(n,32)]})),n.m&&(this.mappings=new Map(n.m.split("|").map(e=>{const[t,n]=e.split(":"),i=n.split(";").map(e=>parseInt(e,32));return[parseInt(t,32),i]})))):t&&(this.singles=new Set(t))}contains(e){if(this.singles.has(e))return!0;let t=0,n=this.ranges.length-1;for(;t<=n;){const i=Math.floor((t+n)/2),r=this.ranges[i];if(e<r[0])n=i-1;else{if(!(e>r[1]))return!0;t=i+1}}return!1}hasMapping(e){return this.mappings.has(e)||this.contains(e)}map(e){return this.contains(e)&&!this.mappings.has(e)?String.fromCodePoint(e).toLowerCase().codePointAt(0):this.mappings.get(e)||null}}function o(e,n,r=""){const s=i.default.ucs2.decode(r);let o=[];for(const t of s){if(!n&&e.unassigned.contains(t))throw new Error("Unassigned code point: x"+t.toString(16));let i=!1;for(const n of e.mappings){if(!n.hasMapping(t))continue;i=!0;const e=n.map(t);e&&(Array.isArray(e)?o=o.concat(e):o.push(e))}i||o.push(t)}let a=o;if(e.normalize){const e=i.default.ucs2.encode(o).normalize("NFKC");a=i.default.ucs2.decode(e)}let c=!1,u=!1;for(const i of a){for(const t of e.prohibited)if(t.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));if(!n&&e.unassigned.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));e.bidirectional&&(c=c||t.D1.contains(i),u=u||t.D2.contains(i))}if(e.bidirectional){if(c&&u)throw new Error("String contained both LCat and RandALCat code points");if(c&&(!t.D1.contains(a[0])||!t.D1.contains(a[a.length-1])))throw new Error("String containing RandALCat code points must start and end with RandALCat code points")}return i.default.ucs2.encode(a)}t.Table=s,t.A1=new s("A.1"),t.B1=new s("B.1"),t.B2=new s("B.2"),t.B3=new s("B.3"),t.C11=new s("C.1.1"),t.C12=new s("C.1.2"),t.C21=new s("C.2.1"),t.C22=new s("C.2.2"),t.C3=new s("C.3"),t.C4=new s("C.4"),t.C5=new s("C.5"),t.C6=new s("C.6"),t.C7=new s("C.7"),t.C8=new s("C.8"),t.C9=new s("C.9"),t.D1=new s("D.1"),t.D2=new s("D.2"),t.B1.map=()=>null,t.C11.contains=e=>32===e,t.C12.map=e=>t.C12.contains(e)?32:null,t.prepare=o;const a={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C12,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.nameprep=function(e,t=!0){return o(a,t,e)},t.NodePrepProhibited=new s("NodePrepProhibited",[34,38,39,47,58,60,62,64]);const c={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C11,t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9,t.NodePrepProhibited],unassigned:t.A1};t.nodeprep=function(e,t=!0){return o(c,t,e)};const u={bidirectional:!0,mappings:[t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.resourceprep=function(e,t=!0){return o(u,t,e)};const l={bidirectional:!0,mappings:[t.C12,t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.saslprep=function(e,t=!1){return o(l,t,e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(35);t.default=class{constructor(){this.parents=new Set,this.placeholder=!1,this.typeField="",this.versionField="",this.defaultType="",this.defaultVersion="",this.languageField="lang",this.typeValues=new Map,this.typeOrders=new Map,this.importers=new Map,this.exporters=new Map,this.children=new Map,this.childrenIndex=new Map,this.implicitChildren=new Set,this.contexts=new Map}addChild(e,t,n=!1,i,r){const s={multiple:n||!1,name:e,selector:i,translator:t},o=this.children.get(e);if(!o){s.translator.parents.add(this),this.children.set(e,s);for(const[n]of t.importers)this.implicitChildren.has(n)||this.childrenIndex.set(n,e);return void(r&&this.implicitChildren.add(r))}const a=o.translator;o.multiple=n,i&&o.selector&&i!==o.selector&&(o.selector=void 0);for(const[n,i]of t.importers){const[r,s]=(a.typeValues.get(n)||"").split("__v__");a.updateDefinition({contexts:t.contexts,element:i.element,exporterOrdering:new Map,exporters:new Map,importerOrdering:i.fieldOrders,importers:i.fields,namespace:i.namespace,optionalNamespaces:new Map,type:r,version:s}),this.implicitChildren.has(n)||this.childrenIndex.set(n,e)}for(const[e,n]of t.exporters){const[i,r]=e.split("__v__");a.updateDefinition({contexts:t.contexts,element:n.element,exporterOrdering:n.fieldOrders,exporters:n.fields,importerOrdering:new Map,importers:new Map,namespace:n.namespace,optionalNamespaces:n.optionalNamespaces,type:i,version:r})}}addContext(e,t,n,i,r,s){t&&(e=`${e}[${t}]`);let o=this.contexts.get(e);o||(o={typeField:"",versionField:"",typeValues:new Map}),s&&(o.impliedType=r),o.typeField=n||"",o.typeValues.set(i,r),this.contexts.set(e,o)}getChild(e){const t=this.children.get(e);if(t)return t.translator}getImportKey(e){return this.childrenIndex.get(`{${e.getNamespace()}}${e.getName()}`)}updateDefinition(e){const t=`{${e.namespace}}${e.element}`,n=e.type||this.defaultType,i=e.version||this.defaultVersion,r=i?`${n}__v__${i}`:n,s=this.importers.get(t)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace};for(const[t,n]of e.importers)s.fields.set(t,n);for(const[t,n]of e.importerOrdering)s.fieldOrders.set(t,n);this.importers.set(t,s);const o=this.exporters.get(r)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace,optionalNamespaces:e.optionalNamespaces};for(const[t,n]of e.exporters)o.fields.set(t,n);for(const[t,n]of e.exporterOrdering)o.fieldOrders.set(t,n);for(const[t,n]of e.optionalNamespaces)o.optionalNamespaces.set(t,n);this.exporters.set(r,o);for(const[t,n]of e.contexts){const e=this.contexts.get(t)||{impliedType:void 0,typeField:n.typeField,versionField:n.versionField,typeValues:new Map};e.typeField||(e.typeField=n.typeField),e.versionField||(e.versionField=n.versionField),e.impliedType||(e.impliedType=n.impliedType);for(const[t,i]of n.typeValues)e.typeValues.set(t,i);this.contexts.set(t,e)}if(e.type)this.typeValues.set(t,r),e.typeOrder&&e.type&&this.typeOrders.set(e.type,e.typeOrder);else if(this.typeField&&!e.type){for(const[,t]of this.importers){for(const[n,i]of e.importers)t.fields.set(n,i);for(const[n,i]of e.importerOrdering)t.fieldOrders.set(n,i)}for(const[,t]of this.exporters){for(const[n,i]of e.exporters)t.fields.set(n,i);for(const[n,i]of e.exporterOrdering)t.fieldOrders.set(n,i)}}}replaceWith(e){for(const[t,n]of this.children)e.children.set(t,n);for(const[t,n]of this.childrenIndex)e.childrenIndex.set(t,n);for(const[t,n]of this.contexts)e.contexts.set(t,n);for(const t of this.implicitChildren)e.implicitChildren.add(t);for(const t of this.parents)for(const n of t.children.values())n.translator===this&&(n.translator=e);this.parents=new Set}import(e,t){const n=`{${e.getNamespace()}}${e.getName()}`,i={},r=this.importers.get(n);if(!r)return;const s=this.typeValues.get(n)||"",[o,a]=s.split("__v__"),c=t.path||"";let u;if(t.pathSelector&&(u=this.contexts.get(`${c}[${t.pathSelector}]`)),u||(u=this.contexts.get(c)),u){if(!u.impliedType){const e=u.typeValues.get(n)||"";e&&(i[u.typeField]=e)}}else this.typeField&&o&&o!==this.defaultType&&(i[this.typeField]=o);this.versionField&&a&&a!==this.defaultVersion&&(i[this.versionField]=a);const l={...t,data:i,importer:r,lang:(e.getAttribute("xml:lang")||t.lang||"").toLowerCase(),pathSelector:o,translator:this},d=[...r.fieldOrders.entries()].sort((e,t)=>e[1]>t[1]?-1:e[1]<t[1]?1:0),p=d.filter(e=>e[1]>=0),h=d.filter(e=>e[1]<0);for(const[n]of p){const s=r.fields.get(n);l.path=`${t.path}.${n}`;const o=s(e,l);null!=o&&(i[n]=o)}for(const n of e.children){if("string"==typeof n)continue;const e=`{${n.getNamespace()}}${n.getName()}`,r=this.childrenIndex.get(e);if(!r)continue;l.path=`${t.path}.${r}`;const{translator:s,multiple:a,selector:c}=this.children.get(r);if(!c||c===o){const e=s.import(n,l);void 0!==e&&(a?(i[r]||(i[r]=[]),i[r].push(e)):i[r]?i[r]=s.resolveCollision(i[r],e):i[r]=e)}}for(const[n]of h){const s=r.fields.get(n);l.path=`${t.path}.${n}`;const o=s(e,l);null!=o&&(i[n]=o)}return i}export(e,t){if(!e)return;let n=this.defaultType,r=this.defaultVersion;const s=t.path||"";let o;t.pathSelector&&(o=this.contexts.get(`${s}[${t.pathSelector}]`)),o||(o=this.contexts.get(s)),o?n=o.impliedType||e[o.typeField]||this.defaultType:this.typeField&&(n=e[this.typeField]||this.defaultType),this.versionField&&(r=e[this.versionField]||this.defaultVersion);const a=r?`${n}__v__${r}`:n,c=this.exporters.get(a);if(!c)return;const u=(0,i.createElement)(c.namespace,c.element,t.namespace,t.element);t.element&&(u.parent=t.element);for(const[e,t]of c.optionalNamespaces)u.addOptionalNamespace(e,t);const l={...t,data:e,element:u,exporter:c,lang:(e[this.languageField]||t.lang||"").toLowerCase(),namespace:u.getDefaultNamespace(),pathSelector:n,translator:this},d=c.fields.get(this.languageField);d&&d(u,e[this.languageField],t);const p=Object.keys(e);p.sort((e,t)=>(c.fieldOrders.get(e)||1e5)-(c.fieldOrders.get(t)||1e5));for(const i of p){if(i===this.languageField)continue;const r=e[i],s=c.fields.get(i);if(s){s(u,r,l);continue}const o=this.children.get(i);if(!o)continue;l.path=`${t.path?t.path+".":""}${i}`;const{translator:a,multiple:d,selector:p}=o;if(!p||p===n){let e;e=d?null!=r?r:[]:[r];for(const t of e){const e=a.export(t,l);e&&u.appendChild(e)}}}return u}resolveCollision(e,t){return(this.typeOrders.get(e[this.typeField]||this.defaultType)||0)<=(this.typeOrders.get(t[this.typeField]||this.defaultType)||0)?e:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=void 0;const i=n(3),r=(0,i.__importDefault)(n(19));t.Hash=r.default;const s=(0,i.__importDefault)(n(205)),o=(0,i.__importDefault)(n(206)),a=(0,i.__importDefault)(n(207)),c=(0,i.__importDefault)(n(208)),u=new Map([["md5",s.default],["sha-1",o.default],["sha-256",a.default],["sha-512",c.default],["sha1",o.default],["sha256",a.default],["sha512",c.default]]);t.default=function(e){e=e.toLowerCase();const t=u.get(e);if(t)return new t;throw new Error("Unsupported hash algorithm: "+e)}},function(e,t,n){"use strict";(function(t,i){var r,s=n(25);e.exports=g,g.ReadableState=m;n(6).EventEmitter;var o=function(e,t){return e.listeners(t).length},a=n(6).EventEmitter,c=n(9).Buffer,u=t.Uint8Array||function(){};var l,d=Object.create(n(20)),p=n(203).BufferList,h=n(58);d.inherits(g,a);var f=["error","close","destroy","pause","resume"];function m(e,t){e=e||{};var i=t instanceof(r=r||n(17));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var s=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=n(60).StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function g(e){if(r=r||n(17),!(this instanceof g))return new g(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function y(e,t,n,i,r){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,v(e)}(e,o)):(r||(s=function(e,t){var n;i=t,c.isBuffer(i)||i instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var i;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),i?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):b(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?b(e,o,t,!1):w(e,o)):b(e,o,t,!1))):i||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function b(e,t,n,i){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&v(e)),w(e,t)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),g.prototype.destroy=h.destroy,g.prototype._undestroy=h.undestroy,g.prototype._destroy=function(e,t){this.push(null),t(e)},g.prototype.push=function(e,t){var n,i=this._readableState;return i.objectMode?n=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=c.from(e,t),t=""),n=!0),y(this,e,t,!1,n)},g.prototype.unshift=function(e){return y(this,e,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(e){return l||(l=n(60).StringDecoder),this._readableState.decoder=new l(e),this._readableState.encoding=e,this};function _(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function v(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.flowing,t.emittedReadable=!0,t.sync?s.nextTick(S,e):S(e))}function S(e){e.emit("readable"),A(e)}function w(e,t){t.readingMore||(t.readingMore=!0,s.nextTick(T,e,t))}function T(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function I(e){e.read(0)}function N(e,t){t.reading||e.read(0),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(t.flowing;t.flowing&&null!==e.read(););}function E(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var i;e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):i=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,i=1,r=n.data;e-=r.length;for(;n=n.next;){var s=n.data,o=e>s.length?s.length:e;if(o===s.length?r+=s:r+=s.slice(0,e),0===(e-=o)){o===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++i}return t.length-=i,r}(e,t):function(e,t){var n=c.allocUnsafe(e),i=t.head,r=1;i.data.copy(n),e-=i.data.length;for(;i=i.next;){var s=i.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=s.slice(o));break}++r}return t.length-=r,n}(e,t);return i}(e,t.buffer,t.decoder),n);var n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,s.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}g.prototype.read=function(e){e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return t.length,t.ended,0===t.length&&t.ended?x(this):v(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&x(this),null;var i,r=t.needReadable;return(0===t.length||t.length-e<t.highWaterMark)&&(r=!0),t.ended||t.reading?r=!1:r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(n,t))),null===(i=e>0?E(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},g.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,r.pipesCount;var a=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?u:y;function c(t,i){t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",f),e.removeListener("unpipe",c),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",h),d=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){e.end()}r.endEmitted?s.nextTick(a):n.once("end",a),e.on("unpipe",c);var l=function(e){return function(){var t=e._readableState;t.awaitDrain,t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(n);e.on("drain",l);var d=!1;var p=!1;function h(t){p=!1,!1!==e.write(t)||p||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==C(r.pipes,e))&&!d&&(n._readableState.awaitDrain,n._readableState.awaitDrain++,p=!0),n.pause())}function f(t){y(),e.removeListener("error",f),0===o(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),y()}function g(){e.removeListener("close",m),y()}function y(){n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",m),e.once("finish",g),e.emit("pipe",n),r.flowing||n.resume(),e},g.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<r;s++)i[s].emit("unpipe",this,n);return this}var o=C(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},g.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&v(this):s.nextTick(I,this))}return n},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var e=this._readableState;return e.flowing||(e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,s.nextTick(N,e,t))}(this,e)),this},g.prototype.pause=function(){return this._readableState.flowing,!1!==this._readableState.flowing&&(this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;for(var r in e.on("end",(function(){if(n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(r){(n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r)||(n.objectMode||r&&r.length)&&(t.push(r)||(i=!0,e.pause()))})),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<f.length;s++)e.on(f[s],this.emit.bind(this,f[s]));return this._read=function(t){i&&(i=!1,e.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=E}).call(this,n(15),n(22))},function(e,t,n){"use strict";var i=n(25);function r(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i.nextTick(r,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(i.nextTick(r,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){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.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";(function(t){var i=n(25);function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var i=e.entry;e.entry=null;for(;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=m;var s,o=i.nextTick;m.WritableState=f;var a=Object.create(n(20)),c=n(6).EventEmitter,u=n(9).Buffer,l=t.Uint8Array||function(){};var d,p=n(58);function h(){}function f(e,t){s=s||n(17),e=e||{};var a=t instanceof s;this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var c=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:a&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var d=!1===e.decodeStrings;this.decodeStrings=!d,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,s=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,s){--t.pendingcb,n?(i.nextTick(s,r),i.nextTick(S,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(s(r),e._writableState.errorEmitted=!0,e.emit("error",r),S(e,t))}(e,n,r,t,s);else{var a=_(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||b(e,n),r?o(y,e,n,a,s):y(e,n,a,s)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function m(e){if(s=s||n(17),!(d.call(m,this)||this instanceof s))return new m(e);this._writableState=new f(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function g(e,t,n,i,r,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function y(e,t,n,i){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),S(e,t)}function b(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,s=new Array(i),o=t.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)s[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;s.allBuffers=c,g(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new r(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,d=n.callback;if(g(e,t,!1,t.objectMode?1:u.length,u,l,d),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function _(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function v(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),S(e,t)}))}function S(e,t){var n=_(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(v,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}a.inherits(m,c),f.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(f.prototype,"buffer",{get:function(){return this.getBuffer()}})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===m&&(e&&e._writableState instanceof f)}})):d=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,s=this._writableState,o=!1,a=!s.objectMode&&(r=e,u.isBuffer(r)||r instanceof l);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=s.defaultEncoding),"function"!=typeof n&&(n=h),s.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var s=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),i.nextTick(r,o),s=!1),s}(this,s,e,n))&&(s.pendingcb++,o=function(e,t,n,i,r,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,n));return t}(t,i,r);i!==o&&(n=!0,r="buffer",i=o)}var a=t.objectMode?1:i.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:r,isBuf:n,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else g(e,t,!1,a,i,r,s);return c}(this,s,a,e,t,n)),o},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||b(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,S(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=p.destroy,m.prototype._undestroy=p.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(15))},function(e,t,n){"use strict";var i=n(9).Buffer,r=i.isEncoding||function(e){switch((e=""+e)&&e.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 s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=p,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var r=o(t[i]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(e.lastNeed=r-2),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=s;var i=n(17);function r(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),i(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);i.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)}function o(){var e=this;"function"==typeof this._flush?this._flush((function(t,n){a(e,t,n)})):a(this,null,null)}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}Object.create(n(20)).inherits(s,i),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var n=this;i.prototype._destroy.call(this,e,(function(e){t(e),n.emit("close")}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Receiver=t.Sender=void 0;const i=n(3),r=n(6),s=(0,i.__importStar)(n(7)),o=n(5),a=n(1),c=(0,i.__importDefault)(n(40)),u=n(26),l=n(41);class d extends r.EventEmitter{constructor(e={}){super(),this.config={chunkSize:16384,hash:"sha-1",...e},this.file=void 0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}send(e,t){if(this.file&&this.channel)return;this.file=e,this.channel=t,this.channel.binaryType="arraybuffer";const n=new FileReader;let i=0,r=!1;const s=()=>{if(r||i>=e.size)return;r=!0;const t=e.slice(i,i+this.config.chunkSize);n.readAsArrayBuffer(t)};t.bufferedAmountLowThreshold=8*this.config.chunkSize,t.onbufferedamountlow=()=>{s()},n.addEventListener("load",t=>{const n=t.target.result;r=!1,i+=n.byteLength,this.channel.send(n),this.hash.update(new Uint8Array(n)),this.emit("progress",i,e.size,n),i<e.size?this.channel.bufferedAmount<=this.channel.bufferedAmountLowThreshold&&s():(this.emit("progress",e.size,e.size,null),this.emit("sentFile",{algorithm:this.config.hash,name:e.name,size:e.size,value:this.hash.digest()}))}),s()}}t.Sender=d;class p extends r.EventEmitter{constructor(e={}){super(),this.config={hash:"sha-1",...e},this.receiveBuffer=[],this.received=0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}receive(e,t){this.metadata=e,this.channel=t,this.channel.binaryType="arraybuffer",this.channel.onmessage=e=>{const t=e.data.byteLength;this.received+=t,this.receiveBuffer.push(e.data),e.data&&this.hash.update(new Uint8Array(e.data)),this.emit("progress",this.received,this.metadata.size,e.data),this.received===this.metadata.size?(this.metadata.actualhash=this.hash.digest("hex"),this.emit("receivedFile",new Blob(this.receiveBuffer),this.metadata),this.receiveBuffer=[]):this.received>this.metadata.size&&(console.error("received more than expected, discarding..."),this.receiveBuffer=[])}}}t.Receiver=p;class h extends c.default{constructor(e){super(e),this.sender=void 0,this.receiver=void 0,this.file=void 0}async start(e,t){if(t=t||(()=>{}),!e||"function"==typeof e)throw new Error("File object required");this.state="pending",this.role="initiator",this.file=e,this.sender=new d,this.sender.on("progress",(e,t)=>{this._log("info","Send progress "+e+"/"+t)}),this.sender.on("sentFile",e=>{this._log("info","Sent file",e.name),this.send(o.JingleAction.SessionInfo,{info:{creator:o.JingleSessionRole.Initiator,file:{hashes:[{algorithm:e.algorithm,value:e.value}]},infoType:o.JINGLE_INFO_CHECKSUM_5,name:this.contentName}}),this.parent.emit("sentFile",this,e)}),this.channel=this.pc.createDataChannel("filetransfer",{ordered:!0}),this.channel.onopen=()=>{this.sender.send(this.file,this.channel)};try{await this.processLocal(o.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1}),n=(0,u.importFromSDP)(t.sdp),i=(0,l.convertIntermediateToRequest)(n,this.role,this.transportType);this.contentName=i.contents[0].name,i.sid=this.sid,i.action=o.JingleAction.SessionInitiate,i.contents[0].application={applicationType:a.NS_JINGLE_FILE_TRANSFER_5,file:{date:e.lastModified?new Date(e.lastModified):void 0,hashesUsed:[{algorithm:"sha-1"}],name:e.name,size:e.size}},this.send("session-initiate",i),await this.pc.setLocalDescription(t)}),t()}catch(e){return this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e){this._log("info","Accepted incoming session"),this.role="responder",this.state="active",e=e||(()=>{});try{await this.processLocal(o.JingleAction.SessionAccept,async()=>{const e=await this.pc.createAnswer(),t=(0,u.importFromSDP)(e.sdp),n=(0,l.convertIntermediateToRequest)(t,this.role,this.transportType);n.sid=this.sid,n.action="session-accept";for(const e of n.contents)e.creator="initiator";this.contentName=n.contents[0].name,this.send("session-accept",n),await this.pc.setLocalDescription(e),await this.processBufferedCandidates()}),e()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.role="responder",this.state="pending",this.transportType=e.contents[0].transport.transportType;const n=(0,l.convertRequestToIntermediate)(e,this.peerRole),i=(0,u.exportToSDP)(n),r=e.contents[0].application,s=r.file.hashesUsed?r.file.hashesUsed:r.file.hashes||[];this.receiver=new p({hash:s[0]&&s[0].algorithm}),this.receiver.on("progress",(e,t)=>{this._log("info","Receive progress "+e+"/"+t)}),this.receiver.on("receivedFile",e=>{this.receivedFile=e,this._maybeReceivedFile()}),this.receiver.metadata=r.file,this.pc.addEventListener("datachannel",e=>{this.channel=e.channel,this.receiver.receive(this.receiver.metadata,e.channel)});try{await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionInfo(e,t){const n=e.info;n&&n.file&&n.file.hashes&&(this.receiver.metadata.hashes=n.file.hashes,this.receiver.metadata.actualhash&&this._maybeReceivedFile(),t())}_maybeReceivedFile(){if(this.receiver.metadata.hashes&&this.receiver.metadata.hashes.length){for(const e of this.receiver.metadata.hashes||[])if(e.value&&e.value.toString("hex")===this.receiver.metadata.actualhash)return this._log("info","File hash matches"),this.parent.emit("receivedFile",this,this.receivedFile,this.receiver.metadata),void this.end("success");this._log("error","File hash does not match"),this.end("media-error")}}}t.default=h},function(e,t,n){"use strict";const i={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},i.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},i.getDescription=function(e){const t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){const t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter(e=>0===e.indexOf(t))},i.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},i.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},i.parseIceOptions=function(e){return e.substring(14).split(" ")},i.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},i.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},i.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},i.parseFmtp=function(e){const t={};let n;const i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)n=i[e].trim().split("="),t[n[0].trim()]=n[1];return t},i.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)}),t+="a=fmtp:"+n+" "+i.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},i.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(n.attribute=e.substring(t+1,i),n.value=e.substring(i+1)):n.attribute=e.substring(t+1),n},i.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},i.getMid=function(e){const t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substring(6)},i.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},i.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){const n=i.matchPrefix(e+t,"a=ice-ufrag:")[0],r=i.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&r?{usernameFragment:n.substring(12),password:r.substring(10)}:null},i.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},i.parseRtpParameters=function(e){const t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=i.splitLines(e)[0].split(" ");t.profile=n[2];for(let r=3;r<n.length;r++){const s=n[r],o=i.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(o){const n=i.parseRtpMap(o),r=i.matchPrefix(e,"a=fmtp:"+s+" ");switch(n.parameters=r.length?i.parseFmtp(r[0]):{},n.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(i.parseRtcpFb),t.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(n.name.toUpperCase())}}}i.matchPrefix(e,"a=extmap:").forEach(e=>{t.headerExtensions.push(i.parseExtmap(e))});const r=i.matchPrefix(e,"a=rtcp-fb:* ").map(i.parseRtcpFb);return t.codecs.forEach(e=>{r.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),t},i.writeRtpDescription=function(e,t){let n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" "+(t.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=t.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(e=>{n+=i.writeRtpMap(e),n+=i.writeFmtp(e),n+=i.writeRtcpFb(e)});let r=0;return t.codecs.forEach(e=>{e.maxptime>r&&(r=e.maxptime)}),r>0&&(n+="a=maxptime:"+r+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach(e=>{n+=i.writeExtmap(e)}),n},i.parseRtpEncodingParameters=function(e){const t=[],n=i.parseRtpParameters(e),r=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),o=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=o.length>0&&o[0].ssrc;let c;const u=i.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let n={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(n.rtx={ssrc:c}),t.push(n),r&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:a,mechanism:s?"red+ulpfec":"red"},t.push(n))}}),0===t.length&&a&&t.push({ssrc:a});let l=i.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substring(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substring(5),10)*.95-16e3:void 0,t.forEach(e=>{e.maxBitrate=l})),t},i.parseRtcpParameters=function(e){const t={},n=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);const r=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=r.length>0,t.compound=0===r.length;const s=i.matchPrefix(e,"a=rtcp-mux");return t.mux=s.length>0,t},i.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},i.parseMsid=function(e){let t;const n=i.matchPrefix(e,"a=msid:");if(1===n.length)return t=n[0].substring(7).split(" "),{stream:t[0],track:t[1]};const r=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return r.length>0?(t=r[0].value.split(" "),{stream:t[0],track:t[1]}):void 0},i.parseSctpDescription=function(e){const t=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");let r;n.length>0&&(r=parseInt(n[0].substring(19),10)),isNaN(r)&&(r=65536);const s=i.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:t.fmt,maxMessageSize:r};const o=i.matchPrefix(e,"a=sctpmap:");if(o.length>0){const e=o[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:r}}},i.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,22)},i.writeSessionBoilerplate=function(e,t,n){let r;const s=void 0!==t?t:2;r=e||i.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+r+" "+s+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.getDirection=function(e,t){const n=i.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substring(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){const t=i.splitLines(e)[0].substring(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){const t=i.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const t=i.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||"="!==t[e].charAt(1))return!1;return!0},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=(0,i.__importDefault)(n(40)),o=n(26),a=n(41);function c(e){const t=e.application;if(t.streams&&t.streams.length&&t.sources&&t.sources.length){const e=t.streams[0];t.sources[0].parameters.msid=`${e.id} ${e.track}`,t.sourceGroups&&t.sourceGroups.length>0&&t.sources.push({parameters:{cname:t.sources[0].parameters.cname,msid:`${e.id} ${e.track}`},ssrc:t.sourceGroups[0].sources[1]})}}class u extends s.default{constructor(e){if(super(e),this.includesAudio=!1,this.includesVideo=!1,this._ringing=!1,this.pc.addEventListener("track",e=>{this.onAddTrack(e.track,e.streams[0])}),e.stream)for(const t of e.stream.getTracks())this.addTrack(t,e.stream)}get ringing(){return this._ringing}set ringing(e){e!==this._ringing&&(this._ringing=e)}get streams(){return"closed"!==this.pc.signalingState?this.pc.getRemoteStreams():[]}async start(e,t){this.state="pending",1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this.role="initiator",this.offerOptions=e;try{await this.processLocal(r.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer(e),n=(0,o.importFromSDP)(t.sdp),i=(0,a.convertIntermediateToRequest)(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionInitiate;for(const e of i.contents||[])e.creator="initiator",c(e);await this.pc.setLocalDescription(t),this.send("session-initiate",i)}),t()}catch(e){this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e,t){1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this._log("info","Accepted incoming session"),this.state="active",this.role="responder";try{await this.processLocal(r.JingleAction.SessionAccept,async()=>{const t=await this.pc.createAnswer(e),n=(0,o.importFromSDP)(t.sdp),i=(0,a.convertIntermediateToRequest)(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionAccept;for(const e of i.contents||[])e.creator="initiator";await this.pc.setLocalDescription(t),await this.processBufferedCandidates(),this.send("session-accept",i)}),t()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}end(e="success",t=!1){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.end(e,t)}ring(){return this.processLocal("ring",async()=>{this._log("info","Ringing on incoming session"),this.ringing=!0,this.send(r.JingleAction.SessionInfo,{info:{infoType:r.JINGLE_INFO_RINGING}})})}mute(e,t){return this.processLocal("mute",async()=>{this._log("info","Muting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_MUTE,name:t}})})}unmute(e,t){return this.processLocal("unmute",async()=>{this._log("info","Unmuting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_UNMUTE,name:t}})})}hold(){return this.processLocal("hold",async()=>{this._log("info","Placing on hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_HOLD}})})}resume(){return this.processLocal("resume",async()=>{this._log("info","Resuming from hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_ACTIVE}})})}addTrack(e,t,n){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{this.pc.addTrack?this.pc.addTrack(e,t):this.pc.addStream(t),n&&n()})}async removeTrack(e,t){return this.processLocal("removetrack",async()=>{if(this.pc.removeTrack(e),t)return t()})}onAddTrack(e,t){this._log("info","Track added"),this.parent.emit("peerTrackAdded",this,e,t)}onRemoveTrack(e){this._log("info","Track removed"),this.parent.emit("peerTrackRemoved",this,e)}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.state="pending",this.role="responder",this.transportType=e.contents[0].transport.transportType;const n=(0,a.convertRequestToIntermediate)(e,this.peerRole);for(const e of n.media)"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),e.streams||(e.streams=[{stream:"legacy",track:e.kind}]);const i=(0,o.exportToSDP)(n);try{return await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){return this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionTerminate(e,t){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.onSessionTerminate(e,t)}onSessionInfo(e,t){const n=e.info||{infoType:""};switch(n.infoType){case r.JINGLE_INFO_RINGING:return this._log("info","Outgoing session is ringing"),this.ringing=!0,this.parent.emit("ringing",this),t();case r.JINGLE_INFO_HOLD:return this._log("info","On hold"),this.parent.emit("hold",this),t();case r.JINGLE_INFO_UNHOLD:case r.JINGLE_INFO_ACTIVE:return this._log("info","Resuming from hold"),this.parent.emit("resumed",this),t();case r.JINGLE_INFO_MUTE:return this._log("info","Muting",n),this.parent.emit("mute",this,n),t();case r.JINGLE_INFO_UNMUTE:return this._log("info","Unmuting",n),this.parent.emit("unmute",this,n),t()}return t()}}t.default=u},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)},a=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u,l=n(6);o(n(214),t);var d=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this)||this;return i.peerConnection=t,i.haveConnectionMetrics=!1,i.statsArr=[],u="undefined"!=typeof window,i.session=n.session,i.initiator=n.initiator,i.conference=n.conference,i.statsInterval=1e3*(n.interval||5),i.logger=n.logger||console,["new","checking"].includes(t.iceConnectionState)&&("checking"===t.iceConnectionState&&(i.logger.warn("iceConnectionState is already in checking state so ice connect time may not be accurate"),i.handleIceStateChange()),t.addEventListener("iceconnectionstatechange",i.handleIceStateChange.bind(i))),t.addEventListener("connectionstatechange",i.handleConnectionStateChange.bind(i)),"connected"===t.connectionState&&i.pollForStats(),i}return r(t,e),t.prototype.handleIceStateChange=function(){var e=this,t=this.peerConnection.iceConnectionState;if("checking"===t&&u&&(this.iceStartTime=window.performance.now()),"connected"===t){if(this.haveConnectionMetrics)return;this.haveConnectionMetrics=!0;var n=void 0,i=void 0,r=void 0;u&&(this.iceConnectionTime=window.performance.now()-this.iceStartTime,n=window.navigator.userAgent,i=window.navigator.platform,r=window.navigator.hardwareConcurrency);var s={name:"connect",userAgent:n,platform:i,cores:r,session:this.session,conference:this.conference,connectTime:this.iceConnectionTime};return this.waitForSelectedCandidatePair().then((function(t){e.gatherSelectedCandidateInfo(t,s),e.emit("stats",s)}))}if("failed"===t)return u&&(this.iceFailedTime=window.performance.now()-this.iceStartTime),this.gatherStats().then((function(t){var n={name:"failure",session:e.session,initiator:e.initiator,conference:e.conference,failTime:e.iceFailedTime,iceRW:0,numLocalHostCandidates:0,numLocalSrflxCandidates:0,numLocalRelayCandidates:0,numRemoteHostCandidates:0,numRemoteSrflxCandidates:0,numRemoteRelayCandidates:0},i=e.peerConnection.localDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1})),r=e.peerConnection.remoteDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1}));["Host","Srflx","Relay"].forEach((function(e){n["numLocal"+e+"Candidates"]=i.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length,n["numRemote"+e+"Candidates"]=r.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length})),e.emit("stats",n)}))},t.prototype.waitForSelectedCandidatePair=function(e,t){var n=this;return void 0===e&&(e=300),void 0===t&&(t=1),this.gatherStats().then((function(i){return n.getSelectedCandidatePair(i)?i:t>3?Promise.reject(new Error("Max wait attempts for connected candidate info reached")):new Promise((function(i,r){setTimeout((function(){return n.waitForSelectedCandidatePair(e,t+1).then(i,r)}),e)}))}))},t.prototype.getSelectedCandidatePair=function(e){var t=null;return e.forEach((function(e){var n=e.value;"candidate-pair"===n.type&&n.nominated&&"succeeded"===n.state&&(t=n)})),t},t.prototype.gatherSelectedCandidateInfo=function(e,t){var n=this.getSelectedCandidatePair(e);if(n){var i,r,s=n.localCandidateId,o=n.remoteCandidateId;if(e.forEach((function(e){e.key;var n=e.value;s&&"local-candidate"===n.type&&n.id===s&&(i=n,t.localCandidateType=n.candidateType),o&&"remote-candidate"===n.type&&n.id===o&&(r=n,t.remoteCandidateType=n.candidateType)})),i&&r&&(t.candidatePair=i.candidateType+";"+r.candidateType,t.candidatePairDetails={local:i,remote:r,pair:n}),i){if(t.transport=i.transport||i.protocol,i.priority){var a=parseInt(i.priority,10);t.turnType={2:"udp",1:"tcp",0:"tls"}[a>>24],t.networkType=i.networkType}t.usingIPv6=i.ipAddress&&0===i.ipAddress.indexOf("[")}}},t.prototype.handleConnectionStateChange=function(){return a(this,void 0,void 0,(function(){var e,t=this;return c(this,(function(n){if("connected"===(e=this.peerConnection.connectionState))this.pollForStats();else{if("disconnected"===e)return"stable"!==this.peerConnection.signalingState?[2]:[2,this.gatherStats().then((function(e){var n=t.createStatsReport(e);n.type="disconnected",t.emit("stats",n)}))];"closed"===e&&this.pollingInterval&&(u&&window.clearInterval(this.pollingInterval),this.pollingInterval=null)}return[2]}))}))},t.prototype.pollForStats=function(){var e=this;if(!this.pollingInterval){var t=function(){return e.gatherStats().then((function(t){var n=e.createStatsReport(t,!0);(n.tracks.length>0||n.remoteTracks.length>0)&&e.checkBitrate(n)&&e.emit("stats",n)}))};u&&(window.setTimeout(t,0),this.pollingInterval=window.setInterval(t,this.statsInterval))}},t.prototype.checkBitrate=function(e){var t;return e.remoteTracks.length&&0!==(null===(t=e.remoteTracks[0])||void 0===t?void 0:t.bitrate)?(this.statsArr=[],!0):!(this.statsArr.length>=5)&&(this.statsArr.push(e),!0)},t.prototype.polyFillStats=function(e){if(!e)return[];if(Array.isArray(e))return e;var t=[];if(this.isNativeStatsReport(e))e.forEach((function(e,n){t.push({key:n,value:e})}));else{if(!(Object.keys(e).length>0))return this.logger.warn("Unknown stats results format, returning unmodified",e),[];Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})}))}return t},t.prototype.isNativeStatsReport=function(e){return void 0!==window.RTCStatsReport&&e instanceof window.RTCStatsReport},t.prototype.gatherStats=function(){return a(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.peerConnection.getStats(null).then(this.polyFillStats.bind(this))];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.logger.error("Failed to gather stats. Are you using RTCPeerConnection as your connection? {expect peerconnection.getStats}",{peerConnection:this.peerConnection,err:e}),[2,Promise.reject(e)];case 3:return[2]}}))}))},t.prototype.createStatsReport=function(e,t){var n=this;void 0===t&&(t=!0);var i={name:"getStats",session:this.session,initiator:this.initiator,conference:this.conference,tracks:[],remoteTracks:[]};e.filter((function(e){return["inbound-rtp","outbound-rtp"].indexOf(e.value.type)>-1})).forEach((function(t){n.processSource({source:t.value,event:i,results:e})}));var r=e.find((function(e){return"candidate-pair"===e.value.type&&"succeeded"===e.value.state&&!0===e.value.nominated}));return r&&this.processSelectedCandidatePair({report:r.value,event:i,results:e}),t&&(this.lastResult=e),i},t.prototype.processSource=function(e){var t,n,i,r,s,o,a,c=e.source,u=e.results,l=e.event,d=new Date(c.timestamp),h=this.lastResult&&this.lastResult.find((function(e){return e.key===c.id}));(h=h&&h.value)&&(t=(t=this.lastResult&&this.lastResult.find((function(e){return e.value.localId===h.id})))&&t.value),u.forEach((function(e){e.value.localId===c.id?n=e.value:e.key===c.transportId?i=e.value:e.key===c.trackId?s=e.value:e.key===c.mediaSourceId?o=e.value:e.key===c.codecId&&(a=e.value)})),i&&(r=(r=u.find((function(e){return e.key===i.selectedCandidatePairId})))&&r.value),r&&(l.candidatePairHadActiveSource=!0);var f=c.kind||c.mediaType,m="outbound-rtp"===c.type,g={track:s&&s.trackIdentifier,kind:f,jitter:p("jitter",c,n),roundTripTime:p("roundTripTime",c,n),packetsLost:p("packetsLost",c,n)||0,packetLoss:0,bytes:parseInt(m?c.bytesSent:c.bytesReceived,10)||0};if(a&&(g.codec=a.payloadType+" "+a.mimeType+" "+a.clockRate),h){var y=parseInt(m?h.bytesSent:h.bytesReceived,10)||0,b=d.getTime()-new Date(h.timestamp).getTime();g.bitrate=Math.floor(8*(g.bytes-y)/b)}var _=p("packetsLost",h,t);m?(g.packetsSent=c.packetsSent,g.packetLoss=g.packetsLost/(g.packetsSent||1)*100,h&&(g.intervalPacketsSent=g.packetsSent-(h.packetsSent||0),g.intervalPacketsLost=g.packetsLost-(_||0),g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsSent||1)*100),g.retransmittedBytesSent=c.retransmittedBytesSent,g.retransmittedPacketsSent=c.retransmittedPacketsSent):(g.packetsReceived=c.packetsReceived,g.packetLoss=g.packetsLost/(g.packetsReceived||1)*100,h&&(g.intervalPacketsReceived=g.packetsReceived-h.packetsReceived,g.intervalPacketsLost=g.packetsLost-_,g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsReceived||1)*100)),s&&"audio"===f&&(s.remoteSource?(g.audioLevel=s.audioLevel,g.totalAudioEnergy=s.totalAudioEnergy):(g.echoReturnLoss=s.echoReturnLoss,g.echoReturnLossEnhancement=s.echoReturnLossEnhancement)),"audio"!==f||!o||s&&s.remoteSource||(g.audioLevel=o.audioLevel,g.totalAudioEnergy=o.totalAudioEnergy),Object.keys(g).forEach((function(e){return void 0===g[e]&&delete g[e]})),m?l.tracks.push(g):l.remoteTracks.push(g)},t.prototype.processSelectedCandidatePair=function(e){var t=this,n=e.report,i=e.event,r=e.results,s=n.localCandidateId,o=n.remoteCandidateId;i.localCandidateChanged=!!this.lastActiveLocalCandidate&&s!==this.lastActiveLocalCandidate.id,i.remoteCandidateChanged=!!this.lastActiveRemoteCandidate&&o!==this.lastActiveRemoteCandidate.id,(!this.lastActiveLocalCandidate||i.localCandidateChanged||i.remoteCandidateChanged)&&r.forEach((function(e){t.checkLastActiveCandidate({localId:s,remoteId:o,key:e.key,report:e.value})})),this.lastActiveLocalCandidate&&(i.networkType=this.lastActiveLocalCandidate.networkType,this.lastActiveRemoteCandidate&&(i.candidatePair=this.lastActiveLocalCandidate.candidateType+";"+this.lastActiveRemoteCandidate.candidateType)),i.bytesSent=n.bytesSent,i.bytesReceived=n.bytesReceived,i.requestsReceived=n.requestsReceived,i.requestsSent=n.requestsSent,i.responsesReceived=n.responsesReceived,i.responsesSent=n.responsesSent,i.consentRequestsSent=n.consentRequestsSent,i.totalRoundTripTime=n.totalRoundTripTime},t.prototype.checkLastActiveCandidate=function(e){var t=e.localId,n=e.remoteId,i=(e.key,e.report);t&&"local-candidate"===i.type&&i.id===t&&(this.lastActiveLocalCandidate=i),n&&"remote-candidate"===i.type&&i.id===n&&(this.lastActiveRemoteCandidate=i)},t}(l.EventEmitter);function p(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=t.find((function(t){return t&&(t[e]||0===t[e])}));return i&&i[e]}t.default=d},function(e,t,n){"use strict";n.r(t),n.d(t,"Axios",(function(){return r})),n.d(t,"AxiosError",(function(){return s})),n.d(t,"CanceledError",(function(){return o})),n.d(t,"isCancel",(function(){return a})),n.d(t,"CancelToken",(function(){return c})),n.d(t,"VERSION",(function(){return u})),n.d(t,"all",(function(){return l})),n.d(t,"Cancel",(function(){return d})),n.d(t,"isAxiosError",(function(){return p})),n.d(t,"spread",(function(){return h})),n.d(t,"toFormData",(function(){return f})),n.d(t,"AxiosHeaders",(function(){return m})),n.d(t,"HttpStatusCode",(function(){return g})),n.d(t,"formToJSON",(function(){return y})),n.d(t,"getAdapter",(function(){return b})),n.d(t,"mergeConfig",(function(){return _}));var i=n(50);n.d(t,"default",(function(){return i.a}));const{Axios:r,AxiosError:s,CanceledError:o,isCancel:a,CancelToken:c,VERSION:u,all:l,Cancel:d,isAxiosError:p,spread:h,toFormData:f,AxiosHeaders:m,HttpStatusCode:g,formToJSON:y,getAdapter:b,mergeConfig:_}=i.a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),r=Math.pow(2,32),s=(e,t)=>(e%t+t)%t;class o extends i.EventEmitter{constructor(){super(),this.allowResume=!0,this.lastAck=0,this.handled=0,this.unacked=[],this.inboundStarted=!1,this.outboundStarted=!1,this.id=void 0,this.jid=void 0,this.allowResume=!0,this.started=!1,this.cacheHandler=()=>{},this._reset()}get started(){return this.outboundStarted&&this.inboundStarted}set started(e){e||(this.outboundStarted=!1,this.inboundStarted=!1)}get resumable(){return this.started&&this.allowResume}load(e){var t;this.id=e.id,this.allowResume=null===(t=e.allowResume)||void 0===t||t,this.handled=e.handled,this.lastAck=e.lastAck,this.unacked=e.unacked,this.emit("prebound",e.jid)}cache(e){this.cacheHandler=e}async bind(e){this.jid=e,await this._cache()}async enable(){this.emit("send",{allowResumption:this.allowResume,type:"enable"})}async resume(){this.emit("send",{handled:this.handled,previousSession:this.id,type:"resume"})}async enabled(e){this.id=e.id,this.allowResume=e.resume||!1,this.handled=0,this.inboundStarted=!0,await this._cache()}async resumed(e){this.id=e.previousSession,this.inboundStarted=!0,await this.process(e,!0),await this._cache()}async failed(e){await this.process(e);for(const[e,t]of this.unacked)this.emit("failed",{kind:e,stanza:t});this._reset(),await this._cache()}ack(){this.emit("send",{handled:this.handled,type:"ack"})}request(){this.emit("send",{type:"request"})}async process(e,t=!1){if(void 0===e.handled)return;const n=s(e.handled-this.lastAck,r);for(let e=0;e<n&&this.unacked.length>0;e++){const[e,t]=this.unacked.shift();this.emit("acked",{kind:e,stanza:t})}if(this.lastAck=e.handled,t){const e=this.unacked;if(this.unacked=[],e.length){this.emit("begin-resend");for(const[t,n]of e)this.emit("resend",{kind:t,stanza:n});this.emit("end-resend")}}await this._cache()}async track(e,t){const n="enable"===t.type;return"sm"!==e||!n&&"resume"!==t.type?!!this.outboundStarted&&(("message"===e||"presence"===e||"iq"===e)&&(this.unacked.push([e,t]),await this._cache(),!0)):(n&&(this.handled=0),this.outboundStarted=!0,await this._cache(),!1)}async handle(){this.inboundStarted&&(this.handled=s(this.handled+1,r),await this._cache())}async hibernate(){if(!this.resumable)return this.shutdown();for(const[e,t]of this.unacked)this.emit("hibernated",{kind:e,stanza:t})}async shutdown(){return this.failed({type:"failed"})}async _cache(){try{await this.cacheHandler({allowResume:this.allowResume,handled:this.handled,id:this.id,jid:this.jid,lastAck:this.lastAck,unacked:this.unacked})}catch(e){console.error("Failed to cache stream state",e)}}_reset(){this.id="",this.inboundStarted=!1,this.outboundStarted=!1,this.lastAck=0,this.handled=0,this.unacked=[]}}t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCRAM=t.DIGEST=t.OAUTH=t.PLAIN=t.EXTERNAL=t.ANONYMOUS=t.Hi=t.HMAC=t.H=t.XOR=t.createClientNonce=t.Factory=t.SimpleMech=void 0;const i=n(7),r=n(54);class s{constructor(e){this.authenticated=!1,this.mutuallyAuthenticated=!1,this.name=e}getCacheableCredentials(){return null}processChallenge(e){}processSuccess(e){this.authenticated=!0}finalize(){const e={authenticated:this.authenticated,mutuallyAuthenticated:this.mutuallyAuthenticated};return this.errorData&&(e.errorData=this.errorData),e}}t.SimpleMech=s;function o(e=32){return(0,i.randomBytes)(e).toString("hex")}function a(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e[i]^t[i]);return i.Buffer.from(n)}function c(e,t){return(0,i.createHash)(t).update(e).digest()}function u(e,t,n){return(0,i.createHmac)(n,e).update(t).digest()}function l(e,t,n,r){let s=u(e,i.Buffer.concat([t,i.Buffer.from("00000001","hex")]),r),o=s;for(let t=0;t<n-1;t++)s=u(e,s,r),o=a(o,s);return o}function d(e){const t={},n=e.toString().split(/,(?=(?:[^"]|"[^"]*")*$)/);for(let e=0,i=n.length;e<i;e++){const i=/(\w+)=["]?([^"]+)["]?$/.exec(n[e]);i&&(t[i[1]]=i[2])}return t}function p(e){const t=[];for(const n of e)","===n?t.push("=2C"):"="===n?t.push("=3D"):t.push(n);return t.join("")}t.Factory=class{constructor(){this.mechanisms=[]}register(e,t,n){this.mechanisms.push({constructor:t,name:e.toUpperCase(),priority:n}),this.mechanisms.sort((e,t)=>t.priority-e.priority)}disable(e){const t=e.toUpperCase();this.mechanisms=this.mechanisms.filter(e=>e.name!==t)}createMechanism(e){const t=e.map(e=>e.toUpperCase());for(const e of this.mechanisms)for(const n of t)if(n===e.name)return new e.constructor(e.name);return null}},t.createClientNonce=o,t.XOR=a,t.H=c,t.HMAC=u,t.Hi=l;t.ANONYMOUS=class extends s{getExpectedCredentials(){return{optional:["trace"],required:[]}}createResponse(e){return i.Buffer.from(e.trace||"")}};t.EXTERNAL=class extends s{getExpectedCredentials(){return{optional:["authzid"],required:[]}}createResponse(e){return i.Buffer.from(e.authzid||"")}};t.PLAIN=class extends s{getExpectedCredentials(){return{optional:["authzid"],required:["username","password"]}}createResponse(e){return i.Buffer.from((e.authzid||"")+"\0"+e.username+"\0"+(e.password||e.token))}};t.OAUTH=class extends s{constructor(e){super(e),this.failed=!1,this.name=e}getExpectedCredentials(){return{optional:["authzid"],required:["token"]}}createResponse(e){if(this.failed)return i.Buffer.from("");const t=`n,${p((0,r.saslprep)(e.authzid))},`,n=`auth=Bearer ${e.token}`;return i.Buffer.from(t+""+n+"","utf8")}processChallenge(e){this.failed=!0,this.errorData=JSON.parse(e.toString("utf8"))}};t.DIGEST=class extends s{constructor(e){super(e),this.providesMutualAuthentication=!1,this.state="INITIAL",this.name=e}processChallenge(e){this.state="CHALLENGE";const t=d(e);this.authenticated=!!t.rspauth,this.realm=t.realm,this.nonce=t.nonce,this.charset=t.charset}getExpectedCredentials(){return{optional:["authzid","clientNonce","realm"],required:["host","password","serviceName","serviceType","username"]}}createResponse(e){if("INITIAL"===this.state||this.authenticated)return null;let t=e.serviceType+"/"+e.host;e.serviceName&&e.host!==e.serviceName&&(t+="/"+e.serviceName);const n=e.realm||this.realm||"",r=e.clientNonce||o(16),s="00000001";let a="";a+='username="'+e.username+'"',n&&(a+=',realm="'+n+'"'),a+=',nonce="'+this.nonce+'"',a+=',cnonce="'+r+'"',a+=",nc="+s,a+=",qop=auth",a+=',digest-uri="'+t+'"';const c=(0,i.createHash)("md5").update(e.username).update(":").update(n).update(":").update(e.password).digest(),u=(0,i.createHash)("md5").update(c).update(":").update(this.nonce).update(":").update(r);e.authzid&&u.update(":").update(e.authzid);const l=u.digest("hex"),d=(0,i.createHash)("md5").update("AUTHENTICATE:").update(t).digest("hex");return a+=",response="+(0,i.createHash)("md5").update(l).update(":").update(this.nonce).update(":").update(s).update(":").update(r).update(":").update("auth").update(":").update(d).digest("hex"),"utf-8"===this.charset&&(a+=",charset=utf-8"),e.authzid&&(a+=',authzid="'+e.authzid+'"'),i.Buffer.from(a)}};t.SCRAM=class{constructor(e){this.providesMutualAuthentication=!0,this.name=e,this.state="INITIAL",this.useChannelBinding=this.name.toLowerCase().endsWith("-plus"),this.algorithm=this.name.toLowerCase().split("scram-")[1].split("-plus")[0]}getExpectedCredentials(){const e=["username","password"];return this.useChannelBinding&&e.push("tlsUnique"),{optional:["authzid","clientNonce"],required:e}}getCacheableCredentials(){return this.cache}createResponse(e){return"INITIAL"===this.state?this.initialResponse(e):this.challengeResponse(e)}processChallenge(e){const t=d(e);this.salt=i.Buffer.from(t.s||"","base64"),this.iterationCount=parseInt(t.i,10),this.nonce=t.r,this.verifier=t.v,this.error=t.e,this.challenge=e}processSuccess(e){this.processChallenge(e)}finalize(){return this.verifier?this.serverSignature.toString("base64")!==this.verifier?{authenticated:!1,error:"Mutual authentication failed",mutuallyAuthenticated:!1}:{authenticated:!0,mutuallyAuthenticated:!0}:{authenticated:!1,error:this.error,mutuallyAuthenticated:!1}}initialResponse(e){const t=p((0,r.saslprep)(e.authzid)),n=p((0,r.saslprep)(e.username));this.clientNonce=e.clientNonce||o();let s="n";e.tlsUnique&&(s=this.useChannelBinding?"p=tls-unique":"y"),this.gs2Header=i.Buffer.from(t?`${s},a=${t},`:s+",,"),this.clientFirstMessageBare=i.Buffer.from(`n=${n},r=${this.clientNonce}`);const a=i.Buffer.concat([this.gs2Header,this.clientFirstMessageBare]);return this.state="CHALLENGE",a}challengeResponse(e){const t=i.Buffer.from("Client Key"),n=i.Buffer.from("Server Key"),s=i.Buffer.concat([this.gs2Header,e.tlsUnique||i.Buffer.from("")]).toString("base64"),o=i.Buffer.from(`c=${s},r=${this.nonce}`);let d,p,h;const f=e.salt&&0===i.Buffer.compare(e.salt,this.salt);f&&e.clientKey&&e.serverKey?(p=i.Buffer.from(e.clientKey),h=i.Buffer.from(e.serverKey)):f&&e.saltedPassword?(d=i.Buffer.from(e.saltedPassword),p=u(d,t,this.algorithm),h=u(d,n,this.algorithm)):(d=l(i.Buffer.from((0,r.saslprep)(e.password)),this.salt,this.iterationCount,this.algorithm),p=u(d,t,this.algorithm),h=u(d,n,this.algorithm));const m=c(p,this.algorithm),g=i.Buffer.from(","),y=i.Buffer.concat([this.clientFirstMessageBare,g,this.challenge,g,o]),b=a(p,u(m,y,this.algorithm)).toString("base64");this.serverSignature=u(h,y,this.algorithm);const _=i.Buffer.concat([o,i.Buffer.from(",p="+b)]);return this.state="FINAL",this.cache={clientKey:p,salt:this.salt,saltedPassword:d,serverKey:h},_}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.getAccountInfo=async t=>(await e.sendIQ({account:{},to:t,type:"get"})).account,e.updateAccount=(t,n)=>e.sendIQ({account:n,to:t,type:"set"}),e.deleteAccount=t=>e.sendIQ({account:{remove:!0},to:t,type:"set"}),e.getPrivateData=async t=>(await e.sendIQ({privateStorage:{[t]:{}},type:"get"})).privateStorage[t],e.setPrivateData=async(t,n)=>e.sendIQ({privateStorage:{[t]:n},type:"set"}),e.getVCard=async t=>(await e.sendIQ({to:t,type:"get",vcard:{format:i.NS_VCARD_TEMP}})).vcard,e.publishVCard=async t=>{await e.sendIQ({type:"set",vcard:t})},e.enableNotifications=(t,n,i=[])=>e.sendIQ({push:{action:"enable",form:{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/pubsub#publish-options"},...i],type:"submit"},jid:t,node:n},type:"set"}),e.disableNotifications=(t,n)=>e.sendIQ({push:{action:"disable",jid:t,node:n},type:"set"})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_AVATAR_METADATA)),e.on("pubsub:published",t=>{if(t.pubsub.items.node!==i.NS_AVATAR_METADATA)return;const n=t.pubsub.items.published[0].content;e.emit("avatar",{avatars:n.versions||[],jid:t.from,source:"pubsub"})}),e.on("presence",t=>{t.vcardAvatar&&"string"==typeof t.vcardAvatar&&e.emit("avatar",{avatars:[{id:t.vcardAvatar}],jid:t.from,source:"vcard"})}),e.publishAvatar=(t,n)=>e.publish("",i.NS_AVATAR_DATA,{data:n,itemType:i.NS_AVATAR_DATA},t),e.useAvatars=(t,n=[])=>e.publish("",i.NS_AVATAR_METADATA,{itemType:i.NS_AVATAR_METADATA,pointers:n,versions:t},"current"),e.getAvatar=(t,n)=>e.getItem(t,i.NS_AVATAR_DATA,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.registerFeature("bind",300,async(t,n)=>{try{const i=await e.sendIQ({bind:{resource:e.config.resource},type:"set"});e.features.negotiated.bind=!0,e.emit("session:prebind",i.bind.jid);const r=!t.legacySession||t.legacySession&&t.legacySession.optional;return!e.sessionStarted&&r&&e.emit("session:started",e.jid),n()}catch(e){return console.error(e),n("disconnect","JID binding failed")}}),e.registerFeature("legacySession",1e3,async(t,n)=>{if(e.sessionStarted||t.legacySession&&t.legacySession.optional)return e.features.negotiated.session=!0,n();try{return await e.sendIQ({legacySession:!0,type:"set"}),e.features.negotiated.session=!0,e.sessionStarted||(e.sessionStarted=!0,e.emit("session:started",e.jid)),n()}catch(e){return n("disconnect","Session requeset failed")}}),e.on("session:started",()=>{e.sessionStarted=!0}),e.on("session:prebind",t=>{e.jid=t,e.emit("session:bound",e.jid)}),e.on("--reset-stream-features",()=>{e.sessionStarted=!1,e.features.negotiated.bind=!1,e.features.negotiated.session=!1})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature(i.NS_ADHOC_COMMANDS),e.disco.addItem({name:"Ad-Hoc Commands",node:i.NS_ADHOC_COMMANDS}),e.getCommands=t=>e.getDiscoItems(t,i.NS_ADHOC_COMMANDS)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r=n(10);function s(e,t){e.features.negotiated.clientStateIndication&&e.send("csi",{type:t})}t.default=function(e){e.disco.addFeature(i.NS_PING),e.on("iq:get:ping",t=>{e.sendIQResult(t)}),e.on("--reset-stream-features",()=>{e._stopKeepAliveInterval(),e.features.negotiated.streamManagement=!1,e.features.negotiated.clientStateIndication=!1}),e.markActive=()=>s(e,"active"),e.markInactive=()=>s(e,"inactive"),e.ping=async t=>{await e.sendIQ({ping:!0,to:t,type:"get"})},e.enableKeepAlive=(t={})=>{e._keepAliveOptions=t;const n=t.interval||300,i=t.timeout||e.config.timeout||15;clearInterval(e._keepAliveInterval),e._keepAliveInterval=setInterval((async function(){if(e.sessionStarted)try{await(0,r.timeoutPromise)(async function(e){if(e.sm.started)return new Promise(t=>{e.once("stream:management:ack",()=>t()),e.sm.request()});try{await e.ping()}catch(e){if(e.error&&"timeout"!==e.error.condition)return;throw e}}(e),1e3*i)}catch(t){e.emit("stream:error",{condition:"connection-timeout",text:"Server did not respond in "+i+" seconds"}),e.transport&&(e.transport.hasStream=!1,e.transport.disconnect(!1))}}),1e3*n)},e._stopKeepAliveInterval=()=>{e._keepAliveInterval&&(clearInterval(e._keepAliveInterval),delete e._keepAliveInterval)},e.disableKeepAlive=()=>{delete e._keepAliveOptions,e._stopKeepAliveInterval()},e.on("stream:management:resumed",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)}),e.on("stream:start",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)});const t=async(t,n)=>{if(!e.config.useStreamManagement)return n();const i=async t=>{switch(t.type){case"enabled":return await e.sm.enabled(t),e.features.negotiated.streamManagement=!0,e.off("sm",i),n();case"resumed":return await e.sm.resumed(t),e.features.negotiated.streamManagement=!0,e.features.negotiated.bind=!0,e.sessionStarted=!0,e.sessionStarting=!1,e.off("sm",i),e.emit("stream:management:resumed",t),n("break");case"failed":await e.sm.failed(t),e.off("sm",i),e.emit("session:end"),n()}};e.on("sm",i),e.sm.id?e.sm.id&&e.sm.allowResume?await e.sm.resume():(e.off("sm",i),n()):e.features.negotiated.bind?await e.sm.enable():(e.off("sm",i),n())};e.registerFeature("streamManagement",200,t),e.registerFeature("streamManagement",500,t),e.registerFeature("clientStateIndication",400,(t,n)=>{e.features.negotiated.clientStateIndication=!0,n()})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=(0,i.__importDefault)(n(220)),s=(0,i.__importStar)(n(8)),o=n(1);t.default=function(e){e.disco=new r.default,e.disco.addFeature(o.NS_DISCO_INFO),e.disco.addFeature(o.NS_DISCO_ITEMS),e.disco.addIdentity({category:"client",type:"web"}),e.registerFeature("caps",100,(t,n)=>{const i=s.getDomain(e.jid)||e.config.server;e.emit("disco:caps",{caps:t.legacyCapabilities||[],jid:i}),e.features.negotiated.caps=!0,n()}),e.getDiscoInfo=async(t,n)=>({extensions:[],features:[],identities:[],...(await e.sendIQ({disco:{node:n,type:"info"},to:t,type:"get"})).disco}),e.getDiscoItems=async(t,n)=>({items:[],...(await e.sendIQ({disco:{node:n,type:"items"},to:t,type:"get"})).disco}),e.updateCaps=()=>{const t=e.config.capsNode||"https://stanzajs.org";return e.disco.updateCaps(t)},e.getCurrentCaps=()=>{const t=e.disco.getCaps();if(!t)return;const n=`${t[0].node}#${t[0].value}`;return{info:e.disco.getNodeInfo(n),legacyCapabilities:t}},e.on("presence",t=>{t.legacyCapabilities&&e.emit("disco:caps",{caps:t.legacyCapabilities,jid:t.from})}),e.on("iq:get:disco",t=>{const{type:n,node:i}=t.disco;"info"===n&&e.sendIQResult(t,{disco:{...e.disco.getNodeInfo(i||""),node:i,type:"info"}}),"items"===n&&e.sendIQResult(t,{disco:{items:e.disco.items.get(i||"")||[],type:"items"}})})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=n(1),o=(0,i.__importStar)(n(7));t.default=function(e){e.disco.addFeature("jid\\20escaping"),e.disco.addFeature(s.NS_DELAY),e.disco.addFeature(s.NS_EME_0),e.disco.addFeature(s.NS_FORWARD_0),e.disco.addFeature(s.NS_HASHES_2),e.disco.addFeature(s.NS_HASHES_1),e.disco.addFeature(s.NS_IDLE_1),e.disco.addFeature(s.NS_JSON_0),e.disco.addFeature(s.NS_OOB),e.disco.addFeature(s.NS_PSA),e.disco.addFeature(s.NS_REFERENCE_0),e.disco.addFeature(s.NS_SHIM),e.disco.addFeature(s.NS_DATAFORM),e.disco.addFeature(s.NS_DATAFORM_MEDIA),e.disco.addFeature(s.NS_DATAFORM_VALIDATION),e.disco.addFeature(s.NS_DATAFORM_LAYOUT);const t=o.getHashes();for(const n of t)e.disco.addFeature((0,s.NS_HASH_NAME)(n));e.disco.addFeature(s.NS_TIME),e.disco.addFeature(s.NS_VERSION),e.on("iq:get:softwareVersion",t=>e.sendIQResult(t,{softwareVersion:e.config.softwareVersion||{name:"stanzajs.org",version:r.VERSION}})),e.on("iq:get:time",t=>{const n=new Date;e.sendIQResult(t,{time:{tzo:n.getTimezoneOffset(),utc:n}})}),e.getSoftwareVersion=async t=>(await e.sendIQ({softwareVersion:{},to:t,type:"get"})).softwareVersion,e.getTime=async t=>(await e.sendIQ({time:{},to:t,type:"get"})).time,e.getLastActivity=async t=>(await e.sendIQ({lastActivity:{},to:t,type:"get"})).lastActivity}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.features={handlers:Object.create(null),negotiated:Object.create(null),order:[]},e.registerFeature=function(t,n,i){this.features.order.push({name:t,priority:n}),this.features.order.sort((e,t)=>e.priority-t.priority),this.features.handlers[t]=i.bind(e)},e.on("features",async t=>{const n=e.features.negotiated,i=e.features.handlers,r=[];for(const{name:s}of e.features.order)t[s]&&i[s]&&!n[s]&&r.push(s);function s(e){return new Promise(n=>{i[e](t,(e,t)=>{n(e?{command:e,message:t}:null)})})}for(const t of r){if(n[t])continue;let i="",r="";try{const e=await s(t);e&&(i=e.command,r=e.message||"")}catch(e){i="disconnect",r=e.message,console.error(e)}if(i)return"restart"===i&&e.transport&&e.transport.restart(),void("disconnect"===i&&(e.emit("stream:error",{condition:"policy-violation",text:"Failed to negotiate stream features: "+r}),e.disconnect()))}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.discoverBindings=async t=>{const n=new Set,r=new Set,s=e.resolver.getHostMeta(t).then(e=>{var t;for(const s of null!==(t=e.links)&&void 0!==t?t:[])s.href&&s.rel===i.NS_ALT_CONNECTIONS_WEBSOCKET&&r.add(s.href),s.href&&s.rel===i.NS_ALT_CONNECTIONS_XBOSH&&n.add(s.href)}).catch(e=>console.error(e)),o=e.config.allowAlternateDNSDiscovery?e.resolver.resolveTXT("_xmppconnect."+t).then(e=>{for(const t of e)for(const e of t){if(e.startsWith("_xmpp-client-websocket=")){const t=e.substring(e.indexOf("=")+1);t&&r.add(t)}if(e.startsWith("_xmpp-client-xbosh=")){const t=e.substring(e.indexOf("=")+1);t&&n.add(t)}}}).catch(e=>console.error(e)):Promise.resolve();return await Promise.all([s,o]).catch(e=>console.error(e)),{bosh:[...n].filter(e=>e.startsWith("https://")),websocket:[...r].filter(e=>e.startsWith("wss://"))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(7),s=(0,i.__importStar)(n(39)),o=n(1);t.default=function(e){const t=!!r.RTCPeerConnection,n={...{advertiseAudio:t,advertiseFileTransfer:t,advertiseVideo:t,bundlePolicy:"balanced",hasRTCPeerConnection:t,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require",trickleIce:!0},...e.config.jingle},i=e.jingle=new s.SessionManager(n),a=[o.NS_JINGLE_1];n.hasRTCPeerConnection&&(a.push(o.NS_JINGLE_ICE_0,o.NS_JINGLE_ICE_UDP_1,o.NS_JINGLE_DTLS_SCTP_1,o.NS_JINGLE_DTLS_0,"urn:ietf:rfc:5888"),!1===n.trickleIce&&a.push("urn:ietf:rfc:3264"),(n.advertiseAudio||n.advertiseVideo)&&a.push(o.NS_JINGLE_RTP_1,o.NS_JINGLE_RTP_RTCP_FB_0,o.NS_JINGLE_RTP_HDREXT_0,"urn:ietf:rfc:5576"),n.advertiseAudio&&a.push(o.NS_JINGLE_RTP_AUDIO),n.advertiseVideo&&a.push(o.NS_JINGLE_RTP_VIDEO),n.advertiseFileTransfer&&a.push(o.NS_JINGLE_FILE_TRANSFER_4,o.NS_JINGLE_FILE_TRANSFER_5));for(const t of a)e.disco.addFeature(t);const c=["outgoing","incoming","accepted","terminated","ringing","mute","unmute","hold","resumed"];for(const t of c)i.on(t,(n,i)=>{e.emit("jingle:"+t,n,i)});i.on("createdSession",t=>{e.emit("jingle:created",t)}),i.on("send",async t=>{try{if("set"===t.type){const n=await e.sendIQ(t);n.jingle||(n.jingle={}),n.jingle.sid=t.jingle.sid,i.process(n)}"result"===t.type&&e.sendIQResult({type:"set",id:t.id,from:t.to},t),"error"===t.type&&e.sendIQError({type:"set",id:t.id,from:t.to},t)}catch(e){e.jingle||(e.jingle=t.jingle),e.jingle.sid=t.jingle.sid,i.process(e)}}),e.on("session:bound",e=>{i.selfID=e}),e.on("iq:set:jingle",e=>{i.process(e)}),e.on("unavailable",e=>{i.endPeerSessions(e.from,void 0,!0)}),e.getServices=async(t,n,i)=>{const r=(await e.sendIQ({externalServices:{type:n,version:i},to:t,type:"get"})).externalServices;return r.services=r.services||[],r},e.getServiceCredentials=async(t,n,i,r,s)=>(await e.sendIQ({externalServiceCredentials:{host:n,port:r,type:i,version:s},to:t,type:"get"})).externalServiceCredentials,e.discoverICEServers=async(t={})=>{try{const n=(await e.getServices(e.config.server,void 0,t.version)).services||[],i=[];for(const t of n)e.jingle.addICEServer(t);return i}catch(e){return[]}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(80),s=(0,i.__importStar)(n(8)),o=n(1);t.default=function(e){e.getHistorySearchForm=async(t,n={})=>(await e.sendIQ({archive:{type:"query",version:n.version},to:t,type:"get"})).archive.form,e.searchHistory=async(t,n={})=>{const i=e.nextId();let a="";"string"==typeof t?a=t:(a=t.to||"",n=t),n.queryId=i;const c=n.form||{};c.type="submit";const u=c.fields||[],l=[{name:"FORM_TYPE",type:"hidden",value:o.NS_MAM_2}];n.with&&l.push({name:"with",type:"text-single",value:n.with}),n.start&&l.push({name:"start",type:"text-single",value:n.start.toISOString()}),n.end&&l.push({name:"end",type:"text-single",value:n.end.toISOString()}),c.fields=(0,r.mergeFields)(l,u),n.form=c;const d=s.allowedResponders(e.jid,a),p=[],h=e=>{d.has(e.from)&&e.archive&&e.archive.queryId===i&&p.push(e.archive)};e.on("mam:item",h);try{return{...(await e.sendIQ({archive:n,id:i,to:a,type:"set"})).archive,results:p}}finally{e.off("mam:item",h)}},e.getHistoryPreferences=async()=>(await e.sendIQ({archive:{type:"preferences"},type:"get"})).archive,e.setHistoryPreferences=t=>e.sendIQ({archive:{type:"preferences",...t},type:"set"}),e.on("message",t=>{t.archive&&e.emit("mam:item",t)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeFields=void 0,t.mergeFields=function(e,t){const n=[],i=new Map;for(const e of t)e.name&&i.set(e.name,e);const r=new Set;for(const t of e)t.name&&i.has(t.name)?(n.push({...t,...i.get(t.name)}),r.add(t.name)):n.push({...t});for(const e of t)(!e.name||e.name&&!r.has(e.name))&&n.push({...e});return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1),s=new Set(["chat","groupchat","headline","normal"]),o=new Set(["chat","groupchat","normal"]),a=new Map([["markable",0],["received",1],["displayed",2],["acknowledged",3]]),c=(e,t)=>{var n;return e.marker&&(a.get(e.marker.type)<a.get(t)||"markable"===(null===(n=e.marker)||void 0===n?void 0:n.type))};async function u(e,t){await e.sendIQ({carbons:{action:t},type:"set"})}t.default=function(e){e.disco.addFeature(r.NS_ATTENTION_0),e.disco.addFeature(r.NS_CHAT_MARKERS_0),e.disco.addFeature(r.NS_CHAT_STATES),e.disco.addFeature(r.NS_CORRECTION_0),e.disco.addFeature(r.NS_RECEIPTS),e.disco.addFeature(r.NS_RTT_0),e.enableCarbons=()=>u(e,"enable"),e.disableCarbons=()=>u(e,"disable"),e.markReceived=t=>e.sendMarker(t,"received"),e.markDisplayed=t=>e.sendMarker(t,"displayed"),e.markAcknowledged=t=>e.sendMarker(t,"acknowledged"),e.getAttention=(t,n={})=>e.sendMessage({...n,requestingAttention:!0,to:t,type:"headline"}),e.sendMarker=(t,n,r)=>{if(!c(t,n)&&!r)return;const s=!1!==e.config.groupchatMarkersUseStanzaID;let o=t.id;if("groupchat"===t.type&&t.stanzaIds&&s){const e=t.stanzaIds.find(e=>i.equalBare(e.by,t.from));e&&(o=e.id)}e.sendMessage({marker:{id:o,type:n},to:"groupchat"===t.type?i.toBare(t.from):t.from,type:t.type})},e.on("message",t=>{if(t.carbon&&i.equalBare(t.from,e.jid)){const n=t.carbon.forward.message;n.delay||(n.delay=t.carbon.forward.delay||{timestamp:new Date(Date.now())}),(e=>!!e.carbon&&"received"===e.carbon.type)(t)&&(e.emit("carbon:received",t),e.emit("message",n)),(e=>!!e.carbon&&"sent"===e.carbon.type)(t)&&(e.emit("carbon:sent",t),e.emit("message:sent",n,!0))}(e=>!!e.forms&&e.forms.length>0)(t)&&e.emit("dataform",t),t.requestingAttention&&e.emit("attention",t),(e=>!!e.rtt)(t)&&e.emit("rtt",t),(e=>!!e.replace)(t)&&e.emit("replace",t),(e=>!!e.chatState)(t)&&o.has(t.type||"normal")&&e.emit("chat:state",t);const n=!1!==e.config.sendReceipts,r=!1!==e.config.sendMUCReceipts,a=!1!==e.config.chatMarkers,u=!1!==e.config.groupchatMarkersUseStanzaID,l=(e=>{var t;return!!e.receipt&&"request"===e.receipt.type&&s.has(null!==(t=e.type)&&void 0!==t?t:"normal")})(t),d=c(t,"received"),p=l&&n&&("groupchat"!==t.type||r);if(p||a&&d){const n="groupchat"===t.type?i.toBare(t.from):t.from;let r=t.id;if("groupchat"===t.type&&t.stanzaIds&&u){const e=t.stanzaIds.find(e=>i.equalBare(e.by,t.from));e&&(r=e.id)}e.sendMessage({receipt:p?{id:t.id,type:"received"}:void 0,marker:a&&d?{id:r,type:"received"}:void 0,to:n,type:t.type})}t.receipt&&"received"===t.receipt.type&&e.emit("receipt",t),t.marker&&"markable"!==t.marker.type&&e.emit("marker:"+t.marker.type,t)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=(0,i.__importStar)(n(8)),o=n(1),a=n(10);t.default=function(e){e.disco.addFeature(o.NS_MUC),e.disco.addFeature(o.NS_MUC_DIRECT_INVITE),e.disco.addFeature(o.NS_HATS_0),e.joinedRooms=new Map,e.joiningRooms=new Map,e.leavingRooms=new Map,e.on("session:started",(function(){const t=e.joiningRooms;e.joiningRooms=new Map;for(const[n,i]of t)e.joinRoom(n,i);const n=e.joinedRooms;e.joinedRooms=new Map;for(const[t,i]of n)e.joinRoom(t,i)})),e.on("message",t=>{if("groupchat"!==t.type||!t.hasSubject||t.body){if(t.muc)if("direct-invite"===t.muc.type||!t.muc.invite&&t.legacyMUC){const n="direct-invite"===t.muc.type?t.muc:t.legacyMUC;e.emit("muc:invite",{from:t.from,password:n.password,reason:n.reason,room:n.jid,thread:n.thread,type:"direct"})}else t.muc.invite?e.emit("muc:invite",{from:t.muc.invite[0].from,password:t.muc.password,reason:t.muc.invite[0].reason,room:t.from,thread:t.muc.invite[0].thread,type:"mediated"}):t.muc.decline?e.emit("muc:declined",{from:t.muc.decline.from,reason:t.muc.decline.reason,room:t.from}):e.emit("muc:other",t)}else e.emit("muc:topic",{from:t.from,room:s.toBare(t.from),topic:t.subject||""})}),e.on("presence",t=>{const n=s.toBare(t.from);if(e.joiningRooms.has(n)&&"error"===t.type)return e.joiningRooms.delete(n),e.emit("muc:failed",t),void e.emit("muc:error",t);if(!function(e){return!!e.muc}(t))return;const i=t.muc.statusCodes&&t.muc.statusCodes.indexOf(r.MUCStatusCode.SelfPresence)>=0,o=t.muc.statusCodes&&t.muc.statusCodes.indexOf(r.MUCStatusCode.NickChanged)>=0;if("error"===t.type)return void e.emit("muc:error",t);if("unavailable"===t.type)return e.emit("muc:unavailable",t),i&&(o?e.joinedRooms.set(n,t.muc.nick):(e.emit("muc:leave",t),e.joinedRooms.delete(n),e.leavingRooms.delete(n))),void(t.muc.destroy&&e.emit("muc:destroyed",{newRoom:t.muc.destroy.jid,password:t.muc.destroy.password,reason:t.muc.destroy.reason,room:n}));e.emit("muc:available",t);const a=e.joiningRooms.has(n)||!e.joinedRooms.has(n);i&&(e.joinedRooms.set(n,s.getResource(t.from)),a&&(e.joiningRooms.delete(n),e.emit("muc:join",t)))}),e.joinRoom=async(t,n,i={})=>{if(t=s.toBare(t),e.joiningRooms.set(t,n||""),!n)try{n=await e.getReservedNick(t),e.joiningRooms.set(t,n)}catch(e){throw new Error("Room nick required")}return new Promise((r,o)=>{function a(n){s.equalBare(n.from,t)&&(e.off("muc:join",a),e.off("muc:failed",c),r(n))}function c(n){s.equalBare(n.from,t)&&(e.off("muc:join",a),e.off("muc:failed",c),o(n))}e.on("muc:join",a),e.on("muc:failed",c),e.sendPresence({...i,muc:{...i.muc,type:"join"},to:s.createFull(t,n)})})},e.leaveRoom=(t,n,i={})=>(t=s.toBare(t),n=n||e.joinedRooms.get(t),e.leavingRooms.set(t,n),new Promise((r,o)=>{const c=i.id||(0,a.uuid)(),u=s.allowedResponders(t);function l(n){s.equalBare(n.from,t)&&(e.off("muc:leave",l),e.off("presence:error",d),r(n))}function d(n){n.id===c&&u.has(n.from)&&(e.joinedRooms.has(t)||e.leavingRooms.delete(t),e.off("muc:leave",l),e.off("presence:error",d),o(n))}e.on("muc:leave",l),e.on("presence:error",d),e.sendPresence({...i,id:c,to:s.createFull(t,n),type:"unavailable"})})),e.ban=(t,n,i)=>e.setRoomAffiliation(t,n,"outcast",i),e.kick=(t,n,i)=>e.setRoomRole(t,n,"none",i),e.invite=(t,n=[])=>{Array.isArray(n)||(n=[n]),e.sendMessage({muc:{invite:n,type:"info"},to:t})},e.directInvite=(t,n,i={})=>{e.sendMessage({muc:{...i,jid:t,type:"direct-invite"},to:n})},e.declineInvite=(t,n,i)=>{e.sendMessage({muc:{decline:{reason:i,to:n},type:"info"},to:t})},e.changeNick=(t,n)=>{const i=(0,a.uuid)(),o=s.createFull(t,n),c=s.allowedResponders(t);return new Promise((t,n)=>{function a(n){c.has(s.toBare(n.from))&&n.muc.statusCodes&&n.muc.statusCodes.includes(r.MUCStatusCode.SelfPresence)&&(e.off("muc:available",a),e.off("presence:id:"+i,u),t(n))}function u(r){c.has(s.toBare(r.from))&&r.id===i&&(e.off("muc:available",a),e.off("presence:id:"+i,u),"error"===r.type?n(r):t(r))}e.on("muc:available",a),e.on("presence:id:"+i,u),e.sendPresence({id:i,to:o})})},e.setSubject=(t,n)=>{e.sendMessage({subject:n,to:t,type:"groupchat"})},e.getReservedNick=async t=>{try{const n=(await e.getDiscoInfo(t,"x-roomuser-item")).identities[0];if(n.name)return n.name;throw new Error("No nickname reserved")}catch(e){throw new Error("No nickname reserved")}},e.requestRoomVoice=t=>{e.sendMessage({forms:[{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/muc#request"},{name:"muc#role",type:"text-single",value:"participant"}],type:"submit"}],to:t})},e.setRoomAffiliation=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{affiliation:i,jid:n,reason:r}]},to:t,type:"set"}),e.setRoomRole=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{nick:n,reason:r,role:i}]},to:t,type:"set"}),e.getRoomMembers=(t,n={affiliation:"member"})=>e.sendIQ({muc:{type:"user-list",users:[n]},to:t,type:"get"}),e.getRoomConfig=async t=>{const n=await e.sendIQ({muc:{type:"configure"},to:t,type:"get"});if(!n.muc.form)throw new Error("No configuration form returned");return n.muc.form},e.configureRoom=(t,n={})=>e.sendIQ({muc:{form:{...n,type:"submit"},type:"configure"},to:t,type:"set"}),e.destroyRoom=(t,n={})=>e.sendIQ({muc:{destroy:n,type:"configure"},to:t,type:"set"}),e.getUniqueRoomName=async function(e){const t=await this.sendIQ({muc:{type:"unique"},to:e,type:"get"});if(!t.muc.name)throw new Error("No unique name returned");return t.muc.name},e.getBookmarks=async()=>{const t=await e.getPrivateData("bookmarks");return t&&t.rooms?t.rooms:[]},e.setBookmarks=t=>e.setPrivateData("bookmarks",{rooms:t}),e.addBookmark=async t=>{const n=await e.getBookmarks(),i=[];let r=!1;for(const e of n)s.equalBare(e.jid,t.jid)?(i.push({...e,...t}),r=!0):i.push(e);return r||i.push(t),e.setBookmarks(i)},e.removeBookmark=async t=>{const n=(await e.getBookmarks()).filter(e=>!s.equalBare(e.jid,t));return e.setBookmarks(n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature(i.NS_ACTIVITY),e.disco.addFeature(i.NS_GEOLOC),e.disco.addFeature(i.NS_MOOD),e.disco.addFeature(i.NS_NICK),e.disco.addFeature(i.NS_TUNE),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_ACTIVITY)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_GEOLOC)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_MOOD)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_NICK)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_TUNE)),e.publishActivity=t=>e.publish("",i.NS_ACTIVITY,{itemType:i.NS_ACTIVITY,...t}),e.publishGeoLoc=t=>e.publish("",i.NS_GEOLOC,{itemType:i.NS_GEOLOC,...t}),e.publishMood=t=>e.publish("",i.NS_MOOD,{itemType:i.NS_MOOD,...t}),e.publishNick=t=>e.publish("",i.NS_NICK,{itemType:i.NS_NICK,nick:t}),e.publishTune=t=>e.publish("",i.NS_TUNE,{itemType:i.NS_TUNE,...t}),e.on("pubsub:published",t=>{const n=t.pubsub.items.published[0].content;switch(t.pubsub.items.node){case i.NS_ACTIVITY:return e.emit("activity",{activity:n,jid:t.from});case i.NS_GEOLOC:return e.emit("geoloc",{geoloc:n,jid:t.from});case i.NS_MOOD:return e.emit("mood",{jid:t.from,mood:n});case i.NS_NICK:return e.emit("nick",{jid:t.from,nick:n.nick});case i.NS_TUNE:return e.emit("tune",{jid:t.from,tune:t.pubsub.items.published[0].content})}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1);t.default=function(e){e.disco.addFeature(r.NS_SHIM+"#SubID",r.NS_SHIM),e.on("message",t=>{!function(e){return!!e.pubsub&&!(e.pubsub.context&&"user"!==e.pubsub.context||!e.pubsub.affiliations)}(t)?function(e){return!!e.pubsub}(t)&&(e.emit("pubsub:event",t),!function(e){return!!e.pubsub.items&&!!e.pubsub.items.published}(t)?!function(e){return!!e.pubsub.items&&!!e.pubsub.items.retracted}(t)?!function(e){return"purge"===e.pubsub.eventType}(t)?!function(e){return"delete"===e.pubsub.eventType}(t)?!function(e){return"subscription"===e.pubsub.eventType}(t)?function(e){return"configuration"===e.pubsub.eventType}(t)&&e.emit("pubsub:config",t):e.emit("pubsub:subscription",t):e.emit("pubsub:deleted",t):e.emit("pubsub:purged",t):e.emit("pubsub:retracted",t):e.emit("pubsub:published",t)):e.emit("pubsub:affiliations",t)}),e.subscribeToNode=async(t,n)=>{const r={};let s;"string"==typeof n?(r.node=n,r.jid=i.toBare(e.jid)):(r.node=n.node,r.jid=n.jid||(n.useBareJID?i.toBare(e.jid):e.jid),s=n.options);const o=await e.sendIQ({pubsub:{context:"user",subscribe:r,subscriptionOptions:s?{form:s}:void 0},to:t,type:"set"}),a=o.pubsub.subscription||{};return o.pubsub.subscriptionOptions&&(a.options=o.pubsub.subscriptionOptions.form),a},e.unsubscribeFromNode=async(t,n)=>{const r={};"string"==typeof n?(r.node=n,r.jid=i.toBare(e.jid)):(r.node=n.node,r.subid=n.subid,r.jid=n.jid||(n.useBareJID?i.toBare(e.jid):e.jid));const s=await e.sendIQ({pubsub:{context:"user",unsubscribe:r},to:t,type:"set"});return s.pubsub&&s.pubsub.subscription?s.pubsub.subscription:{...r,state:"none"}},e.publish=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",publish:{item:{content:i,id:r},node:n}},to:t,type:"set"}),e.getItem=async(t,n,i)=>(await e.sendIQ({pubsub:{context:"user",fetch:{items:[{id:i}],node:n}},to:t,type:"get"})).pubsub.fetch.items[0],e.getItems=async(t,n,i={})=>{const r=await e.sendIQ({pubsub:{context:"user",fetch:{max:i.max,node:n},paging:i},to:t,type:"get"}),s=r.pubsub.fetch;return s.paging=r.pubsub.paging,s},e.retract=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",retract:{id:i,node:n,notify:r}},to:t,type:"set"}),e.purgeNode=(t,n)=>e.sendIQ({pubsub:{context:"owner",purge:n},to:t,type:"set"}),e.deleteNode=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",destroy:{node:n,redirect:i}},to:t,type:"set"}),e.createNode=async(t,n,i)=>{const r=await e.sendIQ({pubsub:{configure:i?{form:i}:void 0,context:"user",create:{node:n}},to:t,type:"set"});return r.pubsub&&r.pubsub.create?r.pubsub.create:{node:n}},e.getSubscriptions=async(t,n={})=>(await e.sendIQ({pubsub:{context:"user",subscriptions:n},to:t,type:"get"})).pubsub.subscriptions,e.getAffiliations=(t,n)=>e.sendIQ({pubsub:{affiliations:{node:n}},to:t,type:"get"}),e.getNodeSubscribers=(t,n,i={})=>("string"==typeof n?i.node=n:i={...i,...n},e.sendIQ({pubsub:{context:"owner",subscriptions:i},to:t,type:"get"})),e.updateNodeSubscriptions=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",subscriptions:{items:i,node:n}},to:t,type:"set"}),e.getNodeAffiliations=async(t,n)=>(await e.sendIQ({pubsub:{affiliations:{node:n},context:"owner"},to:t,type:"get"})).pubsub.affiliations,e.updateNodeAffiliations=(t,n,i)=>e.sendIQ({pubsub:{affiliations:{items:i,node:n},context:"owner"},to:t,type:"set"}),e.getNodeConfig=async(t,n)=>(await e.sendIQ({pubsub:{configure:{node:n},context:"owner"},to:t,type:"get"})).pubsub.configure.form||{},e.getDefaultNodeConfig=async t=>(await e.sendIQ({pubsub:{context:"owner",defaultConfiguration:{}},to:t,type:"get"})).pubsub.defaultConfiguration.form||{},e.configureNode=async(t,n,i)=>e.sendIQ({pubsub:{configure:{form:i,node:n},context:"owner"},to:t,type:"set"}),e.getDefaultSubscriptionOptions=async t=>(await e.sendIQ({pubsub:{defaultSubscriptionOptions:{}},to:t,type:"get"})).pubsub.defaultSubscriptionOptions.form||{}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8));t.default=function(e){async function t(t,n){await e.sendIQ({blockList:{action:t,jids:[n]},type:"set"})}e.on("iq:set:roster",t=>{if(!i.allowedResponders(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});e.emit("roster:update",t),e.sendIQResult(t)}),e.on("iq:set:blockList",t=>{if(!i.allowedResponders(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});const n=t.blockList;e.emit(n.action,{jids:n.jids||[]}),e.sendIQResult(t)}),e.getRoster=async()=>{const t=await e.sendIQ({roster:{version:e.config.rosterVer},type:"get"});if(t.roster){const n=t.roster.version;return n&&(e.config.rosterVer=n,e.emit("roster:ver",n)),t.roster.items=t.roster.items||[],t.roster}return{items:[]}},e.updateRosterItem=async t=>{await e.sendIQ({roster:{items:[t]},type:"set"})},e.removeRosterItem=t=>e.updateRosterItem({jid:t,subscription:"remove"}),e.subscribe=t=>{e.sendPresence({type:"subscribe",to:t})},e.unsubscribe=t=>{e.sendPresence({type:"unsubscribe",to:t})},e.acceptSubscription=t=>{e.sendPresence({type:"subscribed",to:t})},e.denySubscription=t=>{e.sendPresence({type:"unsubscribed",to:t})},e.getBlocked=async()=>({jids:[],...(await e.sendIQ({blockList:{action:"list"},type:"get"})).blockList}),e.block=async e=>t("block",e),e.unblock=async e=>t("unblock",e),e.goInvisible=async(t=!1)=>{await e.sendIQ({type:"set",visiblity:{probe:t,type:"invisible"}})},e.goVisible=async()=>{await e.sendIQ({type:"set",visiblity:{type:"visible"}})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.registerFeature("sasl",100,async(t,n)=>{const i=e.sasl.createMechanism(t.sasl.mechanisms),r=async t=>{if(i)switch(t.type){case"success":return e.features.negotiated.sasl=!0,e.off("sasl",r),e.emit("auth:success",e.config.credentials),e.transport&&(e.transport.authenticated=!0),void n("restart");case"challenge":i.processChallenge(t.value);try{const t=await e.getCredentials(),n=i.createResponse(t);n||""===n?e.send("sasl",{type:"response",value:n}):e.send("sasl",{type:"response"});const r=i.getCacheableCredentials();r&&(e.config.credentials||(e.config.credentials={}),e.config.credentials={...e.config.credentials,...r},e.emit("credentials:update",e.config.credentials))}catch(t){console.error(t),e.send("sasl",{type:"abort"})}return;case"failure":case"abort":return e.off("sasl",r),e.emit("auth:failed"),void n("disconnect","authentication failed")}};if(!i)return e.off("sasl",r),e.emit("auth:failed"),n("disconnect","authentication failed");e.on("sasl",r),e.once("--reset-stream-features",()=>{e.features.negotiated.sasl=!1,e.off("sasl",r)});try{const t=await e.getCredentials();e.send("sasl",{mechanism:i.name,type:"auth",value:i.createResponse(t)})}catch(t){console.error(t),e.send("sasl",{type:"abort"})}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1);t.default=function(e){async function t(t){const n=await e.getDiscoInfo(t);if(!n.features||!n.features.includes(r.NS_HTTP_UPLOAD_0))return;let i;for(const e of n.extensions||[]){const n=e.fields||[];if(n.some(e=>"FORM_TYPE"===e.name&&e.value===r.NS_HTTP_UPLOAD_0)){const e=n.find(e=>"max-file-size"===e.name);return e&&(i=parseInt(e.value,10)),{jid:t,maxSize:i}}}}e.disco.addFeature(r.NS_BOB),e.getBits=async(t,n)=>(await e.sendIQ({bits:{cid:n},to:t,type:"get"})).bits,e.getUploadService=async(n=i.getDomain(e.jid))=>{const r=await t(n);if(r)return r;const s=await e.getDiscoItems(n);for(const e of s.items||[]){if(!e.jid)continue;const n=await t(e.jid);if(n)return n}throw new Error("No upload service discovered on: "+n)},e.getUploadSlot=async(t,n)=>(await e.sendIQ({httpUpload:{type:"request",...n},to:t,type:"get"})).httpUpload}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3);(0,i.__exportStar)(n(89),t),(0,i.__exportStar)(n(90),t),(0,i.__exportStar)(n(91),t),(0,i.__exportStar)(n(92),t),(0,i.__exportStar)(n(93),t),(0,i.__exportStar)(n(94),t),(0,i.__exportStar)(n(95),t),(0,i.__exportStar)(n(96),t),(0,i.__exportStar)(n(97),t),(0,i.__exportStar)(n(98),t),(0,i.__exportStar)(n(99),t),(0,i.__exportStar)(n(100),t),(0,i.__exportStar)(n(101),t),(0,i.__exportStar)(n(102),t),(0,i.__exportStar)(n(103),t),(0,i.__exportStar)(n(104),t),(0,i.__exportStar)(n(105),t),(0,i.__exportStar)(n(106),t),(0,i.__exportStar)(n(107),t),(0,i.__exportStar)(n(108),t),(0,i.__exportStar)(n(109),t),(0,i.__exportStar)(n(110),t),(0,i.__exportStar)(n(111),t),(0,i.__exportStar)(n(112),t),(0,i.__exportStar)(n(113),t),(0,i.__exportStar)(n(114),t),(0,i.__exportStar)(n(115),t),(0,i.__exportStar)(n(116),t),(0,i.__exportStar)(n(117),t),(0,i.__exportStar)(n(118),t),(0,i.__exportStar)(n(119),t),(0,i.__exportStar)(n(120),t),(0,i.__exportStar)(n(121),t),(0,i.__exportStar)(n(122),t),(0,i.__exportStar)(n(123),t),(0,i.__exportStar)(n(124),t),(0,i.__exportStar)(n(125),t),(0,i.__exportStar)(n(126),t),(0,i.__exportStar)(n(127),t),(0,i.__exportStar)(n(128),t),(0,i.__exportStar)(n(129),t),(0,i.__exportStar)(n(130),t),(0,i.__exportStar)(n(131),t),(0,i.__exportStar)(n(132),t),(0,i.__exportStar)(n(133),t),(0,i.__exportStar)(n(134),t),(0,i.__exportStar)(n(135),t),(0,i.__exportStar)(n(136),t),(0,i.__exportStar)(n(137),t),(0,i.__exportStar)(n(138),t),(0,i.__exportStar)(n(139),t),(0,i.__exportStar)(n(140),t),(0,i.__exportStar)(n(141),t),(0,i.__exportStar)(n(142),t),(0,i.__exportStar)(n(143),t),(0,i.__exportStar)(n(144),t),(0,i.__exportStar)(n(145),t),(0,i.__exportStar)(n(146),t),(0,i.__exportStar)(n(147),t),(0,i.__exportStar)(n(148),t),(0,i.__exportStar)(n(149),t),(0,i.__exportStar)(n(150),t),(0,i.__exportStar)(n(151),t),(0,i.__exportStar)(n(152),t),(0,i.__exportStar)(n(153),t),(0,i.__exportStar)(n(154),t),(0,i.__exportStar)(n(155),t),(0,i.__exportStar)(n(156),t),(0,i.__exportStar)(n(157),t),(0,i.__exportStar)(n(158),t),(0,i.__exportStar)(n(159),t),(0,i.__exportStar)(n(160),t),(0,i.__exportStar)(n(161),t),(0,i.__exportStar)(n(162),t),(0,i.__exportStar)(n(163),t),(0,i.__exportStar)(n(164),t),(0,i.__exportStar)(n(165),t),(0,i.__exportStar)(n(166),t),(0,i.__exportStar)(n(167),t),(0,i.__exportStar)(n(168),t),(0,i.__exportStar)(n(46),t);const r=(0,i.__importDefault)(n(89)),s=(0,i.__importDefault)(n(90)),o=(0,i.__importDefault)(n(91)),a=(0,i.__importDefault)(n(92)),c=(0,i.__importDefault)(n(93)),u=(0,i.__importDefault)(n(94)),l=(0,i.__importDefault)(n(95)),d=(0,i.__importDefault)(n(96)),p=(0,i.__importDefault)(n(97)),h=(0,i.__importDefault)(n(98)),f=(0,i.__importDefault)(n(99)),m=(0,i.__importDefault)(n(100)),g=(0,i.__importDefault)(n(101)),y=(0,i.__importDefault)(n(102)),b=(0,i.__importDefault)(n(103)),_=(0,i.__importDefault)(n(104)),v=(0,i.__importDefault)(n(105)),S=(0,i.__importDefault)(n(106)),w=(0,i.__importDefault)(n(107)),T=(0,i.__importDefault)(n(108)),I=(0,i.__importDefault)(n(109)),N=(0,i.__importDefault)(n(110)),A=(0,i.__importDefault)(n(111)),E=(0,i.__importDefault)(n(112)),x=(0,i.__importDefault)(n(113)),R=(0,i.__importDefault)(n(114)),C=(0,i.__importDefault)(n(115)),O=(0,i.__importDefault)(n(116)),P=(0,i.__importDefault)(n(117)),k=(0,i.__importDefault)(n(118)),j=(0,i.__importDefault)(n(119)),L=(0,i.__importDefault)(n(120)),M=(0,i.__importDefault)(n(122)),D=(0,i.__importDefault)(n(123)),B=(0,i.__importDefault)(n(124)),F=(0,i.__importDefault)(n(121)),q=(0,i.__importDefault)(n(125)),U=(0,i.__importDefault)(n(126)),J=(0,i.__importDefault)(n(127)),z=(0,i.__importDefault)(n(128)),G=(0,i.__importDefault)(n(129)),H=(0,i.__importDefault)(n(130)),V=(0,i.__importDefault)(n(131)),W=(0,i.__importDefault)(n(132)),$=(0,i.__importDefault)(n(133)),Q=(0,i.__importDefault)(n(134)),K=(0,i.__importDefault)(n(135)),X=(0,i.__importDefault)(n(136)),Y=(0,i.__importDefault)(n(137)),Z=(0,i.__importDefault)(n(138)),ee=(0,i.__importDefault)(n(139)),te=(0,i.__importDefault)(n(140)),ne=(0,i.__importDefault)(n(141)),ie=(0,i.__importDefault)(n(142)),re=(0,i.__importDefault)(n(143)),se=(0,i.__importDefault)(n(144)),oe=(0,i.__importDefault)(n(145)),ae=(0,i.__importDefault)(n(146)),ce=(0,i.__importDefault)(n(147)),ue=(0,i.__importDefault)(n(148)),le=(0,i.__importDefault)(n(149)),de=(0,i.__importDefault)(n(150)),pe=(0,i.__importDefault)(n(151)),he=(0,i.__importDefault)(n(152)),fe=(0,i.__importDefault)(n(153)),me=(0,i.__importDefault)(n(154)),ge=(0,i.__importDefault)(n(155)),ye=(0,i.__importDefault)(n(156)),be=(0,i.__importDefault)(n(157)),_e=(0,i.__importDefault)(n(158)),ve=(0,i.__importDefault)(n(159)),Se=(0,i.__importDefault)(n(160)),we=(0,i.__importDefault)(n(161)),Te=(0,i.__importDefault)(n(162)),Ie=(0,i.__importDefault)(n(163)),Ne=(0,i.__importDefault)(n(164)),Ae=(0,i.__importDefault)(n(165)),Ee=(0,i.__importDefault)(n(166)),xe=(0,i.__importDefault)(n(167)),Re=(0,i.__importDefault)(n(168)),Ce=(0,i.__importDefault)(n(46)),Oe=[r.default,s.default,o.default,a.default,c.default,u.default,l.default,d.default,p.default,h.default,f.default,m.default,g.default,y.default,b.default,_.default,v.default,S.default,w.default,T.default,I.default,N.default,A.default,E.default,x.default,R.default,C.default,O.default,P.default,k.default,j.default,L.default,M.default,D.default,B.default,F.default,q.default,U.default,J.default,z.default,G.default,H.default,V.default,W.default,$.default,Q.default,K.default,X.default,Y.default,Z.default,ee.default,te.default,ne.default,ie.default,re.default,se.default,oe.default,ae.default,ce.default,ue.default,le.default,de.default,pe.default,he.default,fe.default,me.default,ge.default,ye.default,be.default,_e.default,ve.default,Se.default,we.default,Te.default,Ie.default,Ne.default,Ae.default,Ee.default,xe.default,Re.default,Ce.default];t.default=Oe},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["features.legacySession","iq.legacySession"],element:"session",fields:{optional:(0,i.childBoolean)(null,"optional")},namespace:r.NS_SESSION};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["atomentry",...(0,i.pubsubItemContentAliases)()],element:"entry",fields:{id:(0,i.childText)(null,"id"),published:(0,i.childDate)(null,"published"),updated:(0,i.childDate)(null,"updated")},namespace:r.NS_ATOM,type:r.NS_ATOM,typeField:"itemType"},{element:"summary",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.summary"},{element:"title",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.title"},{aliases:[{path:"atomentry.links",multiple:!0}],element:"link",fields:{href:(0,i.attribute)("href"),mediaType:(0,i.attribute)("type"),rel:(0,i.attribute)("rel")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.authors",multiple:!0}],element:"author",fields:{name:(0,i.childText)(null,"name"),uri:(0,i.childText)(null,"uri"),email:(0,i.childText)(null,"email")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.contributors",multiple:!0}],element:"contributor",fields:{name:(0,i.childText)(null,"name"),uri:(0,i.childText)(null,"uri"),email:(0,i.childText)(null,"email")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.categories",multiple:!0}],element:"category",fields:{term:(0,i.attribute)("term"),scheme:(0,i.attribute)("scheme"),label:(0,i.attribute)("label")},namespace:r.NS_ATOM},{element:"content",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.content"},{element:"rights",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.rights"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={defaultType:"stream",element:"stream",fields:{from:(0,r.attribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.attribute)("to"),version:(0,r.attribute)("version")},namespace:s.NS_STREAM,path:"stream",type:"stream",typeField:"action"},a={element:"features",namespace:s.NS_STREAM,path:"features"},c={element:"error",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_STREAMS,"text"),condition:(0,r.childEnum)(s.NS_STREAMS,Object.values(i.StreamErrorCondition),i.StreamErrorCondition.UndefinedCondition),seeOtherHost:(0,r.childText)(s.NS_STREAMS,i.StreamErrorCondition.SeeOtherHost),text:(0,r.childText)(s.NS_STREAMS,"text")},namespace:s.NS_STREAM,path:"streamError"},u=Object.values(i.StreamType).map(e=>({aliases:["stanzaError","message.error","presence.error","iq.error"],defaultType:s.NS_CLIENT,element:"error",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_STANZAS,"text"),by:(0,r.JIDAttribute)("by"),condition:(0,r.childEnum)(s.NS_STANZAS,Object.values(i.StanzaErrorCondition),i.StanzaErrorCondition.UndefinedCondition),gone:(0,r.childText)(s.NS_STANZAS,i.StanzaErrorCondition.Gone),redirect:(0,r.childText)(s.NS_STANZAS,i.StanzaErrorCondition.Redirect),text:(0,r.childText)(s.NS_STANZAS,"text"),type:(0,r.attribute)("type")},namespace:e,type:e,typeField:"streamType"})),l=new Set(["from","id","lang","to","type","payloadType","error","streamType"]),d=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"iq",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),payloadType:{order:-1e4,importer(e,t){if("get"!==t.data.type&&"set"!==t.data.type)return;if(1!==e.children.filter(e=>"string"!=typeof e).length)return"invalid-payload-count";const n=Object.keys(t.data).filter(e=>!l.has(e));return 1!==n.length?"unknown-payload":n[0]}},to:(0,r.JIDAttribute)("to"),type:(0,r.attribute)("type")},namespace:e,path:"iq",type:e,typeField:"streamType"})),p=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"message",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.JIDAttribute)("to")},namespace:e,path:"message",type:e,typeField:"streamType"})),h=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"presence",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.JIDAttribute)("to")},namespace:e,path:"presence",type:e,typeField:"streamType"})),f=[o,a,c,...u,...[{element:"mechanisms",fields:{mechanisms:(0,r.multipleChildText)(null,"mechanism")},namespace:s.NS_SASL,path:"features.sasl"},{element:"abort",namespace:s.NS_SASL,path:"sasl",type:"abort",typeField:"type"},{element:"auth",fields:{mechanism:(0,r.attribute)("mechanism"),value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"auth",typeField:"type"},{element:"challenge",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"challenge",typeField:"type"},{element:"response",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"response",typeField:"type"},{element:"success",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"success",typeField:"type"},{element:"failure",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_SASL,"text"),condition:(0,r.childEnum)(s.NS_SASL,Object.values(i.SASLFailureCondition)),text:(0,r.childText)(s.NS_SASL,"text")},namespace:s.NS_SASL,path:"sasl",type:"failure",typeField:"type"}],...[{aliases:["features.tls"],defaultType:"start",element:"starttls",fields:{required:(0,r.childBoolean)(null,"required")},namespace:s.NS_STARTTLS,path:"tls",type:"start",typeField:"type"},{element:"proceed",namespace:s.NS_STARTTLS,path:"tls",type:"proceed",typeField:"type"},{element:"failure",namespace:s.NS_STARTTLS,path:"tls",type:"failure",typeField:"type"}],...d,...p,...h,{aliases:["features.bind","iq.bind"],element:"bind",fields:{jid:(0,r.childText)(null,"jid"),resource:(0,r.childText)(null,"resource")},namespace:s.NS_BIND}];t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({rosterPreApproval:(0,i.childBoolean)(r.NS_SUBSCRIPTION_PREAPPROVAL,"sub"),rosterVersioning:(0,i.childBoolean)(r.NS_ROSTER_VERSIONING,"ver")}),(0,i.extendMessage)({alternateLanguageBodies:(0,i.childAlternateLanguageText)(null,"body"),alternateLanguageSubjects:(0,i.childAlternateLanguageText)(null,"subject"),body:(0,i.childText)(null,"body"),hasSubject:(0,i.childBoolean)(null,"subject"),parentThread:(0,i.childAttribute)(null,"thread","parent"),subject:(0,i.childText)(null,"subject"),thread:(0,i.childText)(null,"thread"),type:(0,i.attribute)("type")}),(0,i.extendPresence)({alternateLanguageStatuses:(0,i.childAlternateLanguageText)(null,"status"),priority:(0,i.childInteger)(null,"priority",0),show:(0,i.childText)(null,"show"),status:(0,i.childText)(null,"status"),type:(0,i.attribute)("type")}),{element:"query",fields:{version:(0,i.attribute)("ver",void 0,{emitEmpty:!0})},namespace:r.NS_ROSTER,path:"iq.roster"},{aliases:[{path:"iq.roster.items",multiple:!0}],element:"item",fields:{groups:(0,i.multipleChildText)(null,"group"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),pending:(0,i.attribute)("ask"),preApproved:(0,i.booleanAttribute)("approved"),subscription:(0,i.attribute)("subscription")},namespace:r.NS_ROSTER}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"open",fields:{from:(0,i.attribute)("from"),id:(0,i.attribute)("id"),lang:(0,i.languageAttribute)(),to:(0,i.attribute)("to"),version:(0,i.attribute)("version")},namespace:r.NS_FRAMING,path:"stream",type:"open"},{element:"close",fields:{seeOtherURI:(0,i.attribute)("see-other-uri")},namespace:r.NS_FRAMING,path:"stream",type:"close"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o=[{aliases:[{path:"message.forms",multiple:!0}],element:"x",fields:{instructions:{...(0,r.multipleChildText)(null,"instructions"),exportOrder:2},reported:{...(0,r.splicePath)(null,"reported","dataformField",!0),exportOrder:3},title:{...(0,r.childText)(null,"title"),exportOrder:1},type:(0,r.attribute)("type")},namespace:s.NS_DATAFORM,optionalNamespaces:{xdv:s.NS_DATAFORM_VALIDATION},path:"dataform"},{aliases:[{path:"dataform.fields",multiple:!0},{path:"dataform.items.fields",multiple:!0}],element:"field",fields:{description:(0,r.childText)(null,"desc"),label:(0,r.attribute)("label"),name:(0,r.attribute)("var"),rawValues:{...(0,r.multipleChildText)(null,"value"),exporter:()=>null},required:(0,r.childBoolean)(null,"required"),type:(0,r.attribute)("type"),value:{importer(e,t){const n=e.getAttribute("type"),o=(0,r.multipleChildText)(s.NS_DATAFORM,"value").importer(e,t),a=o[0];switch(n){case i.DataFormFieldType.TextMultiple:case i.DataFormFieldType.ListMultiple:case i.DataFormFieldType.JIDMultiple:return o;case i.DataFormFieldType.Hidden:case i.DataFormFieldType.Fixed:return 1===o.length?a:o;case i.DataFormFieldType.Boolean:if(a)return"1"===a||"true"===a;break;default:return a}},exporter(e,t,n){const i=(0,r.multipleChildText)(null,"value");let o=[];const a=n.data&&n.data.rawValues?n.data.rawValues[0]:void 0;if("boolean"==typeof t)o="true"===a||"false"===a?[a]:[t?"1":"0"];else if(Array.isArray(t))for(const e of t)o.push(e.toString());else o=[t.toString()];i.exporter(e,o,Object.assign({},n,{namespace:s.NS_DATAFORM}))}}},namespace:s.NS_DATAFORM,path:"dataformField"},{aliases:[{path:"dataform.fields.options",multiple:!0}],element:"option",fields:{label:(0,r.attribute)("label"),value:(0,r.childText)(null,"value")},namespace:s.NS_DATAFORM},{aliases:[{path:"dataform.items",multiple:!0}],element:"item",namespace:s.NS_DATAFORM},{element:"validate",fields:{listMax:(0,r.childIntegerAttribute)(null,"list-range","max"),listMin:(0,r.childIntegerAttribute)(null,"list-range","min"),method:(0,r.childEnum)(null,["basic","open","range","regex"],"basic"),rangeMax:(0,r.childAttribute)(null,"range","max"),rangeMin:(0,r.childAttribute)(null,"range","min"),regex:(0,r.childText)(null,"regex"),type:(0,r.attribute)("datatype","xs:string")},namespace:s.NS_DATAFORM_VALIDATION,path:"dataform.fields.validation"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["presence.legacyLastActivity","iq.lastActivity"],element:"query",fields:{seconds:(0,i.integerAttribute)("seconds"),status:(0,i.text)()},namespace:r.NS_LAST_ACTIVITY}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"query",fields:{activeList:(0,i.childAttribute)(null,"active","name"),defaultList:(0,i.childAttribute)(null,"default","name")},namespace:r.NS_PRIVACY,path:"iq.privacy"},{aliases:[{path:"iq.privacy.lists",multiple:!0}],element:"list",fields:{name:(0,i.attribute)("name")},namespace:r.NS_PRIVACY},{aliases:[{path:"iq.privacy.lists.items",multiple:!0}],element:"item",fields:{action:(0,i.attribute)("action"),incomingPresence:(0,i.childBoolean)(null,"presence-in"),iq:(0,i.childBoolean)(null,"iq"),messages:(0,i.childBoolean)(null,"message"),order:(0,i.integerAttribute)("order"),outgoingPresence:(0,i.childBoolean)(null,"presence-out"),type:(0,i.attribute)("type"),value:(0,i.attribute)("value")},namespace:r.NS_PRIVACY}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["iq.disco","message.disco","features.disco"],childrenExportOrder:{identities:1,features:2,extensions:3},element:"query",fields:{features:(0,i.multipleChildAttribute)(null,"feature","var"),node:(0,i.attribute)("node")},namespace:r.NS_DISCO_INFO,path:"disco",type:"info",typeField:"type"},{aliases:[{path:"disco.identities",selector:"info",multiple:!0}],element:"identity",fields:{category:(0,i.attribute)("category"),lang:(0,i.languageAttribute)(),name:(0,i.attribute)("name"),type:(0,i.attribute)("type")},namespace:r.NS_DISCO_INFO},{aliases:[{path:"disco.items",multiple:!0,selector:"items"}],element:"item",fields:{jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),node:(0,i.attribute)("node")},namespace:r.NS_DISCO_ITEMS},{aliases:[{path:"disco.items",multiple:!0,selector:"info"}],element:"item",fields:{category:(0,i.JIDAttribute)("category"),lang:(0,i.languageAttribute)(),name:(0,i.attribute)("name"),type:(0,i.attribute)("type")},namespace:r.NS_DISCO_INFO},(0,i.addAlias)(r.NS_DATAFORM,"x",[{path:"disco.extensions",multiple:!0,selector:"info"}]),(0,i.addAlias)(r.NS_RSM,"set",[{path:"disco.paging",selector:"items"}]),{aliases:["iq.disco","message.disco","features.disco"],element:"query",fields:{node:(0,i.attribute)("node")},namespace:r.NS_DISCO_ITEMS,path:"disco",type:"items",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({addresses:(0,i.splicePath)(r.NS_ADDRESS,"addresses","extendedAddress",!0)}),(0,i.extendPresence)({addresses:(0,i.splicePath)(r.NS_ADDRESS,"addresses","extendedAddress",!0)}),{element:"address",fields:{alternateLanguageDescriptions:(0,i.childAlternateLanguageText)(null,"desc"),delivered:(0,i.booleanAttribute)("delivered"),description:(0,i.attribute)("desc"),jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node"),type:(0,i.attribute)("type"),uri:(0,i.attribute)("uri")},namespace:r.NS_ADDRESS,path:"extendedAddress"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",[{path:"iq.muc.form",selector:"configure"}]),{defaultType:"info",element:"x",fields:{password:(0,i.childText)(null,"password")},namespace:r.NS_MUC,path:"presence.muc",type:"join",typeField:"type"},{aliases:[{path:"presence.muc.history",selector:"join"}],element:"history",fields:{maxCharacters:(0,i.integerAttribute)("maxchars"),maxStanzas:(0,i.integerAttribute)("maxstanzas"),seconds:(0,i.integerAttribute)("seconds"),since:(0,i.dateAttribute)("since")},namespace:r.NS_MUC},{aliases:["presence.muc","message.muc"],defaultType:"info",element:"x",fields:{action:(0,i.childEnum)(null,["invite","decline","destroy"]),actor:(0,i.splicePath)(null,"item","mucactor"),affiliation:(0,i.childAttribute)(null,"item","affiliation"),jid:(0,i.childJIDAttribute)(null,"item","jid"),nick:(0,i.childAttribute)(null,"item","nick"),password:(0,i.childText)(null,"password"),reason:(0,i.deepChildText)([{namespace:null,element:"item"},{namespace:null,element:"reason"}]),role:(0,i.childAttribute)(null,"item","role"),statusCodes:(0,i.multipleChildAttribute)(null,"status","code")},namespace:r.NS_MUC_USER,type:"info",typeField:"type",typeOrder:1},{element:"actor",fields:{jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick")},namespace:r.NS_MUC_USER,path:"mucactor"},{element:"destroy",fields:{jid:(0,i.JIDAttribute)("jid"),password:(0,i.childText)(null,"password"),reason:(0,i.childText)(null,"reason")},namespace:r.NS_MUC_USER,path:"presence.muc.destroy"},{aliases:[{path:"message.muc.invite",multiple:!0}],element:"invite",fields:{continue:(0,i.childBoolean)(null,"continue"),from:(0,i.JIDAttribute)("from"),reason:(0,i.childText)(null,"reason"),thread:(0,i.childAttribute)(null,"continue","thread"),to:(0,i.JIDAttribute)("to")},namespace:r.NS_MUC_USER},{element:"decline",fields:{from:(0,i.JIDAttribute)("from"),reason:(0,i.childText)(null,"reason"),to:(0,i.JIDAttribute)("to")},namespace:r.NS_MUC_USER,path:"message.muc",type:"decline"},{element:"query",namespace:r.NS_MUC_ADMIN,path:"iq.muc",type:"user-list",typeField:"type"},{aliases:[{path:"iq.muc.users",multiple:!0,selector:"user-list"}],element:"item",fields:{affiliation:(0,i.attribute)("affiliation"),jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick"),reason:(0,i.childText)(null,"reason"),role:(0,i.attribute)("role")},namespace:r.NS_MUC_ADMIN},{aliases:["iq.muc.users.actor"],element:"actor",fields:{jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick")},namespace:r.NS_MUC_ADMIN},{element:"query",namespace:r.NS_MUC_OWNER,path:"iq.muc",type:"configure",typeField:"type"},{aliases:[{path:"iq.muc.destroy",selector:"configure"}],element:"destroy",fields:{jid:(0,i.JIDAttribute)("jid"),password:(0,i.childText)(null,"password"),reason:(0,i.childText)(null,"reason")},namespace:r.NS_MUC_OWNER},{element:"x",fields:{action:(0,i.staticValue)("invite"),continue:(0,i.booleanAttribute)("continue"),jid:(0,i.JIDAttribute)("jid"),legacyReason:(0,i.text)(),password:(0,i.attribute)("password"),reason:(0,i.attribute)("reason"),thread:(0,i.attribute)("thread")},namespace:r.NS_MUC_DIRECT_INVITE,path:"message.muc",type:"direct-invite",typeOrder:2},{element:"unique",fields:{name:(0,i.text)()},namespace:r.NS_MUC_UNIQUE,path:"iq.muc",type:"unique"},(0,i.extendMessage)({legacyMUC:{exporter(e,t,n){const i=n.registry?n.registry.export("message.muc",{...t,type:"direct-invite"}):void 0;i&&e.appendChild(i)},exportOrder:100001,importer(e,t){if(!(0,i.findAll)(e,r.NS_MUC_USER,"x")[0])return;const n=(0,i.findAll)(e,r.NS_MUC_DIRECT_INVITE,"x")[0];return n&&t.registry?t.registry.import(n,{...t,path:"message"}):void 0},importOrder:-1}})];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["iq.ibb","message.ibb"],element:"open",fields:{ack:{importer:(e,t)=>"message"!==(0,i.attribute)("stanza","iq").importer(e,t),exporter(e,t,n){(0,i.attribute)("stanza").exporter(e,t?"iq":"message",n)}},blockSize:(0,i.integerAttribute)("block-size"),sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"open",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"close",fields:{sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"close",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"data",fields:{data:(0,i.textBuffer)("base64"),seq:(0,i.integerAttribute)("seq"),sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"data",typeField:"action"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{path:"bookmarkStorage",impliedType:!0},{path:"iq.privateStorage.bookmarks",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"storage",namespace:r.NS_BOOKMARKS,type:r.NS_BOOKMARKS,typeField:"itemType"},{aliases:[{path:"bookmarkStorage.rooms",multiple:!0}],element:"conference",fields:{autoJoin:(0,i.booleanAttribute)("autojoin"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),nick:(0,i.childText)(null,"nick"),password:(0,i.childText)(null,"password")},namespace:r.NS_BOOKMARKS}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={element:"query",namespace:n(1).NS_PRIVATE,path:"iq.privateStorage"};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.command.form"]),(0,i.extendStanzaError)({commandError:(0,i.childEnum)(r.NS_ADHOC_COMMANDS,["bad-action","bad-locale","bad-payload","bad-sessionid","malformed-action","session-expired"])}),{element:"command",fields:{action:(0,i.attribute)("action"),node:(0,i.attribute)("node"),sid:(0,i.attribute)("sessionid"),status:(0,i.attribute)("status")},namespace:r.NS_ADHOC_COMMANDS,path:"iq.command"},{element:"actions",fields:{complete:(0,i.childBoolean)(null,"complete"),execute:(0,i.attribute)("execute"),next:(0,i.childBoolean)(null,"next"),prev:(0,i.childBoolean)(null,"prev")},namespace:r.NS_ADHOC_COMMANDS,path:"iq.command.availableActions"},{aliases:[{path:"iq.command.notes",multiple:!0}],element:"note",fields:{type:(0,i.attribute)("type"),value:(0,i.text)()},namespace:r.NS_ADHOC_COMMANDS}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s="vcardTemp.records";function o(e,t){return{aliases:[{multiple:!0,path:s}],element:e,fields:{value:(0,i.text)()},namespace:r.NS_VCARD_TEMP,type:t,typeField:"type"}}const a=[{aliases:[{path:"iq.vcard"}],defaultType:r.NS_VCARD_TEMP,element:"vCard",fields:{fullName:(0,i.childText)(null,"FN")},namespace:r.NS_VCARD_TEMP,path:"vcardTemp",type:r.NS_VCARD_TEMP,typeField:"format"},{element:"N",fields:{additional:{...(0,i.childText)(null,"MIDDLE"),order:3},family:{...(0,i.childText)(null,"FAMILY"),order:1},given:{...(0,i.childText)(null,"GIVEN"),order:2},prefix:{...(0,i.childText)(null,"PREFIX"),order:4},suffix:{...(0,i.childText)(null,"SUFFIX"),order:5}},namespace:r.NS_VCARD_TEMP,path:"vcardTemp.name"},o("NICKNAME","nickname"),o("BDAY","birthday"),o("JABBERID","jid"),o("TZ","timezone"),o("TITLE","title"),o("ROLE","role"),o("URL","url"),o("NOTE","note"),o("SORT-STRING","sort"),o("UID","uid"),o("REV","revision"),o("PRODID","productId"),o("DESC","description"),{aliases:[{multiple:!0,path:s}],element:"EMAIL",fields:{preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["internet","INTERNET"]]),value:(0,i.childText)(null,"USERID")},namespace:r.NS_VCARD_TEMP,type:"email"},{aliases:[{path:s,multiple:!0}],element:"ORG",fields:{units:{...(0,i.multipleChildText)(null,"ORGUNIT"),order:2},value:{...(0,i.childText)(null,"ORGNAME"),order:1}},namespace:r.NS_VCARD_TEMP,type:"organization",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"ADR",fields:{city:(0,i.childText)(null,"LOCALITY"),code:(0,i.childText)(null,"PCODE"),country:(0,i.childText)(null,"CTRY"),pobox:(0,i.childText)(null,"POBOX"),preferred:(0,i.childBoolean)(null,"PREF"),region:(0,i.childText)(null,"REGION"),street:(0,i.childText)(null,"STREET"),street2:(0,i.childText)(null,"EXTADD"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["domestic","DOM"],["international","INTL"],["postal","POSTAL"],["parcel","PARCEL"]])},namespace:r.NS_VCARD_TEMP,type:"address",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"LABEL",fields:{lines:(0,i.multipleChildText)(null,"LINE"),preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"]])},namespace:r.NS_VCARD_TEMP,type:"addressLabel",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"TEL",fields:{preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["cell","CELL"],["fax","FAX"],["voice","VOICE"],["msg","MSG"]]),value:(0,i.childText)(null,"NUMBER","",!0)},namespace:r.NS_VCARD_TEMP,type:"tel",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"PHOTO",fields:{data:(0,i.childText)(null,"BINVAL"),mediaType:(0,i.childText)(null,"TYPE"),url:(0,i.childText)(null,"EXTVAL")},namespace:r.NS_VCARD_TEMP,type:"photo",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"LOGO",fields:{data:(0,i.childText)(null,"BINVAL"),mediaType:(0,i.childText)(null,"TYPE"),url:(0,i.childText)(null,"EXTVAL")},namespace:r.NS_VCARD_TEMP,type:"logo",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"CATEGORIES",fields:{value:(0,i.multipleChildText)(null,"KEYWORD")},namespace:r.NS_VCARD_TEMP,type:"categories",typeField:"type"}];t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.search.form"]),(0,i.addAlias)(r.NS_RSM,"set",["iq.search.paging"]),{element:"query",fields:{email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),givenName:(0,i.childText)(null,"first"),instructions:(0,i.childText)(null,"instructions"),nick:(0,i.childText)(null,"nick")},namespace:r.NS_SEARCH,path:"iq.search"},{aliases:[{path:"iq.search.items",multiple:!0}],element:"item",fields:{email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),givenName:(0,i.childText)(null,"first"),jid:(0,i.JIDAttribute)("jid"),nick:(0,i.childText)(null,"nick")},namespace:r.NS_SEARCH}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["iq.pubsub.paging"],element:"set",fields:{after:(0,i.childText)(null,"after"),before:(0,i.childText)(null,"before"),count:(0,i.childInteger)(null,"count"),first:(0,i.childText)(null,"first"),firstIndex:(0,i.childIntegerAttribute)(null,"first","index"),index:(0,i.childInteger)(null,"index"),last:(0,i.childText)(null,"last"),max:(0,i.childInteger)(null,"max")},namespace:r.NS_RSM,path:"paging"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={configurable:(0,r.childBoolean)(null,"subscribe-options"),configurationRequired:(0,r.deepChildBoolean)([{namespace:null,element:"subscribe-options"},{namespace:null,element:"required"}]),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),state:(0,r.attribute)("subscription"),subid:(0,r.attribute)("subid")},a={node:(0,r.attribute)("node")},c=[{aliases:["pubsub","iq.pubsub","message.pubsub"],childrenExportOrder:{configure:0,create:100,publish:100,subscribe:100,subscriptionOptions:0},defaultType:"user",element:"pubsub",fields:{publishOptions:(0,r.splicePath)(null,"publish-options","dataform")},namespace:s.NS_PUBSUB,type:"user",typeField:"context"},{aliases:["pubsub","iq.pubsub","message.pubsub"],defaultType:"user",element:"pubsub",fields:{purge:(0,r.childAttribute)(null,"purge","node")},namespace:s.NS_PUBSUB_OWNER,type:"owner",typeField:"context"},(0,r.addAlias)(s.NS_DATAFORM,"x",["iq.pubsub.configure.form","iq.pubsub.defaultConfiguration.form","iq.pubsub.defaultSubscriptionOptions.form","iq.pubsub.subscriptionOptions.form","message.pubsub.configuration.form"]),(0,r.addAlias)(s.NS_RSM,"set",["iq.pubsub.fetch.paging"]),(0,r.extendStanzaError)({pubsubError:(0,r.childEnum)(s.NS_PUBSUB_ERRORS,Object.values(i.PubsubErrorCondition)),pubsubUnsupportedFeature:(0,r.childAttribute)(s.NS_PUBSUB_ERRORS,"unsupported","feature")}),{element:"subscribe",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.subscribe"},{element:"unsubscribe",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid")},namespace:s.NS_PUBSUB,path:"iq.pubsub.unsubscribe"},{element:"options",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid")},namespace:s.NS_PUBSUB,path:"iq.pubsub.subscriptionOptions"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"user",impliedType:!0}],element:"subscriptions",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,type:"user"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"owner",impliedType:!0}],element:"subscriptions",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.subscription",selector:"owner"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB},{aliases:[{path:"iq.pubsub.subscription",selector:"user"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"user"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.affiliations",selector:"user",impliedType:!0},{path:"message.pubsub.affiliations",selector:"user",impliedType:!0}],element:"affiliations",fields:a,namespace:s.NS_PUBSUB,type:"user"},{aliases:[{path:"iq.pubsub.affiliations",selector:"owner",impliedType:!0}],element:"affiliations",fields:a,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"user"},{impliedType:!0,multiple:!0,path:"message.pubsub.affiliations.items",selector:"user"}],element:"affiliation",fields:{affiliation:(0,r.attribute)("affiliation"),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"owner"}],element:"affiliation",fields:{affiliation:(0,r.attribute)("affiliation"),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB_OWNER,type:"owner"},{element:"create",fields:a,namespace:s.NS_PUBSUB,path:"iq.pubsub.create"},{aliases:[{path:"iq.pubsub.destroy",selector:"owner"}],element:"delete",fields:{node:(0,r.attribute)("node"),redirect:(0,r.childAttribute)(null,"redirect","uri")},namespace:s.NS_PUBSUB_OWNER},{aliases:[{path:"iq.pubsub.configure",selector:"owner",impliedType:!0}],element:"configure",fields:a,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.configure",selector:"user",impliedType:!0}],element:"configure",fields:a,namespace:s.NS_PUBSUB,type:"user"},{element:"default",fields:{node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.defaultSubscriptionOptions"},{element:"default",fields:{},namespace:s.NS_PUBSUB_OWNER,path:"iq.pubsub.defaultConfiguration"},{element:"publish",fields:a,namespace:s.NS_PUBSUB,path:"iq.pubsub.publish"},{element:"retract",fields:{id:(0,r.childAttribute)(null,"item","id"),node:(0,r.attribute)("node"),notify:(0,r.booleanAttribute)("notify")},namespace:s.NS_PUBSUB,path:"iq.pubsub.retract"},{element:"items",fields:{max:(0,r.integerAttribute)("max_items"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.fetch"},{aliases:["pubsubitem","iq.pubsub.publish.item",{multiple:!0,path:"iq.pubsub.fetch.items"}],element:"item",fields:{id:(0,r.attribute)("id"),publisher:(0,r.JIDAttribute)("publisher")},namespace:s.NS_PUBSUB},{element:"event",fields:{eventType:(0,r.childEnum)(null,["purge","delete","subscription","configuration","items"])},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub",type:"event",typeField:"context"},{aliases:[{path:"message.pubsub.items.published",multiple:!0}],element:"item",fields:{id:(0,r.attribute)("id"),publisher:(0,r.JIDAttribute)("publisher")},namespace:s.NS_PUBSUB_EVENT,path:"pubsubeventitem"},{element:"purge",fields:a,namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.purge"},{element:"delete",fields:{node:(0,r.attribute)("node"),redirect:(0,r.childAttribute)(null,"redirect","uri")},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.delete"},{aliases:[{path:"message.pubsub.subscription",selector:"event",impliedType:!0}],element:"subscription",fields:{expires:(u="expiry",{importer(e){const t=e.getAttribute(u);return"presence"===t?t:t?new Date(t):void 0},exporter(e,t){let n;n="string"==typeof t?t:t.toISOString(),e.setAttribute(u,n)}}),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid"),type:(0,r.attribute)("subscription")},namespace:s.NS_PUBSUB_EVENT,type:"event"},{element:"configuration",fields:a,namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.configuration"},{element:"items",fields:{node:(0,r.attribute)("node"),retracted:(0,r.multipleChildAttribute)(null,"retract","id")},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.items"}];var u;t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"query",fields:{activate:(0,i.childText)(null,"activate"),address:(0,i.attribute)("dstaddr"),candidateUsed:(0,i.childJIDAttribute)(null,"streamhost-used","jid"),mode:(0,i.attribute)("mode","tcp"),sid:(0,i.attribute)("sid"),udpSuccess:(0,i.childAttribute)(null,"udpsuccess","dstaddr")},namespace:r.NS_SOCKS5,path:"iq.socks5"},{aliases:[{multiple:!0,path:"iq.socks5.candidates"}],element:"streamhost",fields:{host:(0,i.attribute)("host"),jid:(0,i.JIDAttribute)("jid"),port:(0,i.integerAttribute)("port"),uri:(0,i.attribute)("uri")},namespace:r.NS_SOCKS5}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{multiple:!0,path:"message.links"}],element:"x",fields:{description:(0,i.childText)(null,"desc"),url:(0,i.childText)(null,"url")},namespace:r.NS_OOB},{element:"query",fields:{description:(0,i.childText)(null,"desc"),url:(0,i.childText)(null,"url")},namespace:r.NS_OOB_TRANSFER,path:"iq.transferLink"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"html",fields:{alternateLanguageBodies:(0,i.childAlternateLanguageRawElement)(r.NS_XHTML,"body","xhtmlim"),body:(0,i.childLanguageRawElement)(r.NS_XHTML,"body","xhtmlim")},namespace:r.NS_XHTML_IM,path:"message.html"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({inbandRegistration:(0,i.childBoolean)(r.NS_INBAND_REGISTRATION,"register")}),(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.account.form"]),(0,i.addAlias)(r.NS_OOB,"x",["iq.account.registrationLink"]),{element:"query",fields:{address:(0,i.childText)(null,"address"),date:(0,i.childDate)(null,"date"),email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),fullName:(0,i.childText)(null,"name"),givenName:(0,i.childText)(null,"first"),instructions:(0,i.childText)(null,"instructions"),key:(0,i.childText)(null,"key"),locality:(0,i.childText)(null,"city"),misc:(0,i.childText)(null,"misc"),nick:(0,i.childText)(null,"nick"),password:(0,i.childText)(null,"password"),phone:(0,i.childText)(null,"phone"),postalCode:(0,i.childText)(null,"zip"),region:(0,i.childText)(null,"state"),registered:(0,i.childBoolean)(null,"registered"),remove:(0,i.childBoolean)(null,"remove"),text:(0,i.childText)(null,"text"),uri:(0,i.childText)(null,"uri"),username:(0,i.childText)(null,"username")},namespace:r.NS_REGISTER,path:"iq.account"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"message.geoloc",impliedType:!0},{path:"dataform.fields.geoloc",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"geoloc",fields:{accuracy:(0,i.childFloat)(null,"accuracy"),altitude:(0,i.childFloat)(null,"alt"),altitudeAccuracy:(0,i.childFloat)(null,"altaccuracy"),area:(0,i.childText)(null,"area"),building:(0,i.childText)(null,"building"),country:(0,i.childText)(null,"country"),countryCode:(0,i.childText)(null,"countrycode"),datum:(0,i.childText)(null,"datum"),description:(0,i.childText)(null,"description"),error:(0,i.childFloat)(null,"error"),floor:(0,i.childText)(null,"floor"),heading:(0,i.childFloat)(null,"bearing"),lang:(0,i.languageAttribute)(),latitude:(0,i.childFloat)(null,"lat"),locality:(0,i.childText)(null,"locality"),longitude:(0,i.childFloat)(null,"lon"),postalCode:(0,i.childText)(null,"postalcode"),region:(0,i.childText)(null,"region"),room:(0,i.childText)(null,"room"),speed:(0,i.childFloat)(null,"speed"),street:(0,i.childText)(null,"street"),text:(0,i.childText)(null,"text"),timestamp:(0,i.childDate)(null,"timestamp"),tzo:(0,i.childTimezoneOffset)(null,"tzo"),uri:(0,i.childText)(null,"uri")},namespace:r.NS_GEOLOC,type:r.NS_GEOLOC};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:(0,i.pubsubItemContentAliases)(),element:"data",fields:{data:(0,i.textBuffer)("base64")},namespace:r.NS_AVATAR_DATA,path:"avatar",type:r.NS_AVATAR_DATA,typeField:"itemType"},{aliases:[{path:"avatar",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"metadata",namespace:r.NS_AVATAR_METADATA,type:r.NS_AVATAR_METADATA,typeField:"itemType",childrenExportOrder:{versions:1,pointers:2}},{aliases:[{multiple:!0,path:"avatar.versions",selector:r.NS_AVATAR_METADATA}],element:"info",fields:{bytes:(0,i.integerAttribute)("bytes"),height:(0,i.integerAttribute)("height"),id:(0,i.attribute)("id"),mediaType:(0,i.attribute)("type"),uri:(0,i.attribute)("url"),width:(0,i.integerAttribute)("width")},namespace:r.NS_AVATAR_METADATA},{aliases:[{multiple:!0,path:"avatar.pointers",selector:r.NS_AVATAR_METADATA}],element:"pointer",fields:{bytes:(0,i.integerAttribute)("bytes"),height:(0,i.integerAttribute)("height"),id:(0,i.attribute)("id"),mediaType:(0,i.attribute)("type"),width:(0,i.integerAttribute)("width")},namespace:r.NS_AVATAR_METADATA}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1);t.default=(0,r.extendMessage)({chatState:(0,r.childEnum)(s.NS_CHAT_STATES,Object.values(i.ChatState))})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"query",fields:{name:(0,i.childText)(null,"name"),os:(0,i.childText)(null,"os"),version:(0,i.childText)(null,"version")},namespace:r.NS_VERSION,path:"iq.softwareVersion"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={aliases:[{path:"message.mood",impliedType:!0},...(0,r.pubsubItemContentAliases)()],element:"mood",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(null,"text"),text:(0,r.childText)(null,"text"),value:(0,r.childEnum)(null,i.USER_MOODS)},namespace:s.NS_MOOD,type:s.NS_MOOD};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={aliases:[{path:"activity",impliedType:!0},...(0,r.pubsubItemContentAliases)()],element:"activity",fields:{activity:(0,r.childDoubleEnum)(null,i.USER_ACTIVITY_GENERAL,i.USER_ACTIVITY_SPECIFIC),alternateLanguageText:(0,r.childAlternateLanguageText)(null,"text"),text:(0,r.childText)(null,"text")},namespace:s.NS_ACTIVITY,type:s.NS_ACTIVITY};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"handshake",fields:{value:(0,i.textBuffer)("hex")},namespace:r.NS_COMPONENT,path:"handshake"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"presence.legacyCapabilities",multiple:!0},{path:"features.legacyCapabilities",multiple:!0}],element:"c",fields:{algorithm:(0,i.attribute)("hash"),legacy:(0,i.staticValue)(!0),node:(0,i.attribute)("node"),value:(0,i.attribute)("ver")},namespace:r.NS_DISCO_LEGACY_CAPS};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{impliedType:!0,path:"tune"},...(0,i.pubsubItemContentAliases)()],element:"tune",fields:{artist:(0,i.childText)(null,"artist"),length:(0,i.childInteger)(null,"length"),rating:(0,i.childInteger)(null,"rating"),source:(0,i.childText)(null,"source"),title:(0,i.childText)(null,"title"),track:(0,i.childText)(null,"track"),uri:(0,i.childText)(null,"uri")},namespace:r.NS_TUNE,type:r.NS_TUNE};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=["dataformLayout",{multiple:!0,path:"dataformLayout.contents"},{multiple:!0,path:"dataform.layout.contents"}],o=[{aliases:[{multiple:!0,path:"dataform.layout"}],element:"page",fields:{label:(0,i.attribute)("label")},namespace:r.NS_DATAFORM_LAYOUT},{aliases:s,element:"section",fields:{label:(0,i.attribute)("label")},namespace:r.NS_DATAFORM_LAYOUT,type:"section",typeField:"type"},{aliases:s,element:"text",fields:{value:(0,i.text)()},namespace:r.NS_DATAFORM_LAYOUT,type:"text",typeField:"type"},{aliases:s,element:"fieldref",fields:{field:(0,i.attribute)("var")},namespace:r.NS_DATAFORM_LAYOUT,type:"fieldref",typeField:"type"},{aliases:s,element:"reportedref",namespace:r.NS_DATAFORM_LAYOUT,type:"reportedref",typeField:"type"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"body",fields:{acceptMediaTypes:(0,i.attribute)("accept"),ack:(0,i.integerAttribute)("ack"),authId:(0,i.attribute)("authid"),characterSets:(0,i.attribute)("charsets"),condition:(0,i.attribute)("condition"),from:(0,i.JIDAttribute)("from"),key:(0,i.attribute)("key"),lang:(0,i.languageAttribute)(),maxClientRequests:(0,i.integerAttribute)("requests"),maxHoldOpen:(0,i.integerAttribute)("hold"),maxInactivityTime:(0,i.integerAttribute)("inactivity"),maxSessionPause:(0,i.integerAttribute)("maxpause"),maxWaitTime:(0,i.integerAttribute)("wait"),mediaType:(0,i.attribute)("content"),minPollingInterval:(0,i.integerAttribute)("polling"),newKey:(0,i.attribute)("newkey"),pauseSession:(0,i.integerAttribute)("pause"),report:(0,i.integerAttribute)("report"),rid:(0,i.integerAttribute)("rid"),route:(0,i.attribute)("string"),seeOtherURI:(0,i.childText)(null,"uri"),sid:(0,i.attribute)("sid"),stream:(0,i.attribute)("stream"),time:(0,i.integerAttribute)("time"),to:(0,i.JIDAttribute)("to"),type:(0,i.attribute)("type"),version:(0,i.attribute)("ver"),xmppRestart:(0,i.namespacedBooleanAttribute)("xmpp",r.NS_BOSH_XMPP,"restart",void 0,{writeValue:e=>e?"true":"false"}),xmppRestartLogic:(0,i.namespacedBooleanAttribute)("xmpp",r.NS_BOSH_XMPP,"restartlogic",void 0,{writeValue:e=>e?"true":"false"}),xmppVersion:(0,i.namespacedAttribute)("xmpp",r.NS_BOSH_XMPP,"version")},namespace:r.NS_BOSH,path:"bosh"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({headers:(0,i.splicePath)(r.NS_SHIM,"headers","header",!0)}),(0,i.extendPresence)({headers:(0,i.splicePath)(r.NS_SHIM,"headers","header",!0)}),{element:"header",fields:{name:(0,i.attribute)("name"),value:(0,i.text)()},namespace:r.NS_SHIM,path:"header"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"compression",fields:{methods:(0,i.multipleChildText)(null,"method")},namespace:r.NS_COMPRESSION_FEATURE,path:"features.compression"},{element:"compress",fields:{method:(0,i.childText)(null,"method")},namespace:r.NS_COMPRESSION,path:"compression",type:"start",typeField:"type"},{aliases:["error.compressionError"],element:"failure",fields:{condition:(0,i.childEnum)(null,["unsupported-method","setup-failed","processing-failed"])},namespace:r.NS_COMPRESSION,path:"compression",type:"failure",typeField:"type"},{element:"compressed",namespace:r.NS_COMPRESSION,path:"compression",type:"success",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({rosterExchange:(0,i.splicePath)(r.NS_ROSTER_EXCHANGE,"x","rosterExchange",!0)}),(0,i.extendIQ)({rosterExchange:(0,i.splicePath)(r.NS_ROSTER_EXCHANGE,"x","rosterExchange",!0)}),{element:"item",fields:{action:(0,i.attribute)("action"),groups:(0,i.multipleChildText)(null,"group"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name")},namespace:r.NS_ROSTER_EXCHANGE,path:"rosterExchange"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendPresence)({vcardAvatar:{importer(e){const t=(0,i.findAll)(e,r.NS_VCARD_TEMP_UPDATE,"x");if(!t.length)return;const n=(0,i.findAll)(t[0],r.NS_VCARD_TEMP_UPDATE,"photo");return!n.length||n[0].getText()},exporter(e,t){const n=(0,i.findOrCreate)(e,r.NS_VCARD_TEMP_UPDATE,"x");if(""===t)(0,i.findOrCreate)(n,r.NS_VCARD_TEMP_UPDATE,"photo");else{if(!0===t)return;if(t){(0,i.findOrCreate)(n,r.NS_VCARD_TEMP_UPDATE,"photo").children.push(t)}}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({captcha:(0,i.splicePath)(r.NS_CAPTCHA,"captcha","dataform")}),(0,i.extendIQ)({captcha:(0,i.splicePath)(r.NS_CAPTCHA,"captcha","dataform")})];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o=[(0,r.extendStanzaError)({jingleError:(0,r.childEnum)(s.NS_JINGLE_ERRORS_1,Object.values(i.JingleErrorCondition))}),{element:"jingle",fields:{action:(0,r.attribute)("action"),initiator:(0,r.JIDAttribute)("initiator"),responder:(0,r.JIDAttribute)("responder"),sid:(0,r.attribute)("sid")},namespace:s.NS_JINGLE_1,path:"iq.jingle"},{aliases:[{multiple:!0,path:"iq.jingle.contents"}],element:"content",fields:{creator:(0,r.attribute)("creator"),disposition:(0,r.attribute)("disposition","session"),name:(0,r.attribute)("name"),senders:(0,r.attribute)("senders","both")},namespace:s.NS_JINGLE_1},{element:"reason",fields:{alternativeSession:(0,r.childText)(null,"alternative-session"),condition:(0,r.childEnum)(null,Object.values(i.JingleReasonCondition)),text:(0,r.childText)(null,"text")},namespace:s.NS_JINGLE_1,path:"iq.jingle.reason"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1);function o(){return{importer(e,t){let n=(0,r.findAll)(e,s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb");const i=(0,r.attribute)("type").importer,o=(0,r.attribute)("subtype").importer,a=(0,r.attribute)("value").importer,c=[];for(const e of n){const n=i(e,t),r=o(e,t);c.push(r?{type:n,parameter:r}:{type:n})}n=(0,r.findAll)(e,s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb-trr-int");for(const e of n){const n=a(e,t);c.push(n?{type:"trr-int",parameter:n}:{type:"trr-int"})}return c},exporter(e,t,n){const i=(0,r.attribute)("type").exporter,o=(0,r.attribute)("subtype").exporter,a=(0,r.attribute)("value").exporter;for(const c of t){let t;"trr-int"===c.type?(t=(0,r.createElement)(s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb-trr-int",n.namespace,e),c.parameter&&a(t,c.parameter,n)):(t=(0,r.createElement)(s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb",n.namespace,e),i(t,c.type,n),c.parameter&&o(t,c.parameter,n)),e.appendChild(t)}}}}const a="iq.jingle.info",c=[{aliases:["iq.jingle.contents.application"],childrenExportOrder:{codecs:4,encryption:5,headerExtensions:6,sourceGroups:8,sources:7,streams:9},element:"description",fields:{media:(0,r.attribute)("media"),rtcpFeedback:{...o(),exportOrder:3},rtcpMux:{...(0,r.childBoolean)(null,"rtcp-mux"),exportOrder:1},rtcpReducedSize:{...(0,r.childBoolean)(null,"rtcp-reduced-size"),exportOrder:2},ssrc:(0,r.attribute)("ssrc")},namespace:s.NS_JINGLE_RTP_1,optionalNamespaces:{rtcpf:s.NS_JINGLE_RTP_RTCP_FB_0,rtph:s.NS_JINGLE_RTP_HDREXT_0},type:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.headerExtensions",selector:s.NS_JINGLE_RTP_1}],element:"rtp-hdrext",fields:{id:(0,r.integerAttribute)("id"),senders:(0,r.attribute)("senders"),uri:(0,r.attribute)("uri")},namespace:s.NS_JINGLE_RTP_HDREXT_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.codecs",selector:s.NS_JINGLE_RTP_1},"rtpcodec"],element:"payload-type",fields:{channels:(0,r.integerAttribute)("channels"),clockRate:(0,r.integerAttribute)("clockrate"),id:(0,r.attribute)("id"),maxptime:(0,r.integerAttribute)("maxptime"),name:(0,r.attribute)("name"),parameters:(0,r.parameterMap)(s.NS_JINGLE_RTP_1,"parameter","name","value"),ptime:(0,r.integerAttribute)("ptime"),rtcpFeedback:o()},namespace:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sources",selector:s.NS_JINGLE_RTP_1}],element:"source",fields:{parameters:(0,r.parameterMap)(s.NS_JINGLE_RTP_SSMA_0,"parameter","name","value"),ssrc:(0,r.attribute)("ssrc")},namespace:s.NS_JINGLE_RTP_SSMA_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sourceGroups",selector:s.NS_JINGLE_RTP_1}],element:"ssrc-group",fields:{semantics:(0,r.attribute)("semantics"),sources:(0,r.multipleChildAttribute)(null,"source","ssrc")},namespace:s.NS_JINGLE_RTP_SSMA_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.streams",selector:s.NS_JINGLE_RTP_1}],element:"stream",fields:{id:(0,r.attribute)("id"),track:(0,r.attribute)("track")},namespace:s.NS_JINGLE_RTP_MSID_0},{aliases:[{path:"iq.jingle.contents.application.encryption",selector:s.NS_JINGLE_RTP_1}],element:"encryption",fields:{required:(0,r.booleanAttribute)("required")},namespace:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.encryption.sdes",selector:s.NS_JINGLE_RTP_1}],element:"crypto",fields:{cryptoSuite:(0,r.attribute)("crypto-suite"),keyParameters:(0,r.attribute)("key-params"),sessionParameters:(0,r.attribute)("session-params"),tag:(0,r.integerAttribute)("tag")},namespace:s.NS_JINGLE_RTP_1},{aliases:[{path:"iq.jingle.contents.application.encryption.zrtp",selector:s.NS_JINGLE_RTP_1}],element:"zrtp-hash",fields:{value:(0,r.textBuffer)("hex"),version:(0,r.attribute)("version")},namespace:s.NS_JINGLE_RTP_1},{element:"mute",fields:{creator:(0,r.attribute)("creator"),name:(0,r.attribute)("name")},namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_MUTE},{element:"unmute",fields:{creator:(0,r.attribute)("creator"),name:(0,r.attribute)("name")},namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_UNMUTE},{element:"hold",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_HOLD},{element:"unhold",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_UNHOLD},{element:"active",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_ACTIVE},{element:"ringing",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_RINGING}];t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({nick:(0,i.childText)(r.NS_NICK,"nick")}),(0,i.extendPresence)({nick:(0,i.childText)(r.NS_NICK,"nick")}),{aliases:(0,i.pubsubItemContentAliases)(),element:"nick",fields:{nick:(0,i.text)()},namespace:r.NS_NICK,type:r.NS_NICK}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=e=>[{element:"transport",fields:{gatheringComplete:(0,i.childBoolean)(null,"gathering-complete"),password:(0,i.attribute)("pwd"),usernameFragment:(0,i.attribute)("ufrag")},namespace:e,path:"iq.jingle.contents.transport",type:e,typeField:"transportType"},{aliases:[{impliedType:!0,path:"iq.jingle.contents.transport.remoteCandidate",selector:e}],element:"remote-candidate",fields:{component:(0,i.integerAttribute)("component"),ip:(0,i.attribute)("ip"),port:(0,i.integerAttribute)("port")},namespace:e,type:e,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:e}],element:"candidate",fields:{component:(0,i.integerAttribute)("component"),foundation:(0,i.attribute)("foundation"),generation:(0,i.integerAttribute)("generation"),id:(0,i.attribute)("id"),ip:(0,i.attribute)("ip"),network:(0,i.integerAttribute)("network"),port:(0,i.integerAttribute)("port"),priority:(0,i.integerAttribute)("priority"),protocol:(0,i.attribute)("protocol"),relatedAddress:(0,i.attribute)("rel-addr"),relatedPort:(0,i.attribute)("rel-port"),tcpType:(0,i.attribute)("tcptype"),type:(0,i.attribute)("type")},namespace:e,type:e,typeField:"transportType"}],o=[...s(r.NS_JINGLE_ICE_0),...s(r.NS_JINGLE_ICE_UDP_1)];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"transport",fields:{gatheringComplete:(0,i.childBoolean)(null,"gathering-complete"),password:(0,i.attribute)("pwd"),usernameFragment:(0,i.attribute)("ufrag")},namespace:r.NS_JINGLE_RAW_UDP_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_RAW_UDP_1,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:r.NS_JINGLE_RAW_UDP_1}],element:"candidate",fields:{component:(0,i.integerAttribute)("component"),foundation:(0,i.attribute)("foundation"),generation:(0,i.integerAttribute)("generation"),id:(0,i.attribute)("id"),ip:(0,i.attribute)("ip"),port:(0,i.integerAttribute)("port"),type:(0,i.attribute)("type")},namespace:r.NS_JINGLE_RAW_UDP_1,type:r.NS_JINGLE_RAW_UDP_1,typeField:"transportType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"request",namespace:r.NS_RECEIPTS,path:"message.receipt",type:"request",typeField:"type"},{element:"received",fields:{id:(0,i.attribute)("id")},namespace:r.NS_RECEIPTS,path:"message.receipt",type:"received",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"invisible",fields:{probe:(0,i.booleanAttribute)("probe")},namespace:r.NS_INVISIBLE_0,path:"iq.visibility",type:"invisible",typeField:"type"},{element:"visible",namespace:r.NS_INVISIBLE_0,path:"iq.visibility",type:"visible"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStanzaError)({blocked:(0,i.childBoolean)(r.NS_BLOCKING_ERRORS,"blocked")}),{element:"blocklist",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"list",typeField:"action"},{element:"block",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"block",typeField:"action"},{element:"unblock",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"unblock",typeField:"action"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({streamManagement:(0,i.childBoolean)(r.NS_SMACKS_3,"sm")}),{element:"a",fields:{handled:(0,i.integerAttribute)("h")},namespace:r.NS_SMACKS_3,path:"sm",type:"ack",typeField:"type"},{element:"r",namespace:r.NS_SMACKS_3,path:"sm",type:"request",typeField:"type"},{element:"enable",fields:{allowResumption:(0,i.booleanAttribute)("resume")},namespace:r.NS_SMACKS_3,path:"sm",type:"enable",typeField:"type"},{element:"enabled",fields:{id:(0,i.attribute)("id"),resume:(0,i.booleanAttribute)("resume")},namespace:r.NS_SMACKS_3,path:"sm",type:"enabled",typeField:"type"},{element:"resume",fields:{handled:(0,i.integerAttribute)("h"),previousSession:(0,i.attribute)("previd")},namespace:r.NS_SMACKS_3,path:"sm",type:"resume",typeField:"type"},{element:"resumed",fields:{handled:(0,i.integerAttribute)("h"),previousSession:(0,i.attribute)("previd")},namespace:r.NS_SMACKS_3,path:"sm",type:"resumed",typeField:"type"},{element:"failed",fields:{handled:(0,i.integerAttribute)("h")},namespace:r.NS_SMACKS_3,path:"sm",type:"failed",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendIQ)({ping:(0,i.childBoolean)(r.NS_PING,"ping")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"time",fields:{tzo:(0,i.childTimezoneOffset)(null,"tzo"),utc:(0,i.childDate)(null,"utc")},namespace:r.NS_TIME,path:"iq.time"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["message.delay","presence.delay"],element:"delay",fields:{from:(0,i.JIDAttribute)("from"),reason:(0,i.text)(),timestamp:(0,i.dateAttribute)("stamp")},namespace:r.NS_DELAY};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={2:r.NS_DISCO_EXTERNAL_2,1:r.NS_DISCO_EXTERNAL_1},o=[];for(const[e,t]of Object.entries(s))o.push({aliases:["iq.externalServiceCredentials"],defaultType:"2",element:"credentials",fields:{expires:(0,i.childDateAttribute)(null,"service","expires"),host:(0,i.childAttribute)(null,"service","host"),name:(0,i.childAttribute)(null,"service","name"),password:(0,i.childAttribute)(null,"service","password"),port:(0,i.childIntegerAttribute)(null,"service","port"),restricted:(0,i.childBooleanAttribute)(null,"service","restricted"),transport:(0,i.childAttribute)(null,"service","transport"),type:(0,i.childAttribute)(null,"service","type"),username:(0,i.childAttribute)(null,"service","username")},namespace:t,type:e,typeField:"version"},{aliases:["iq.externalServices"],defaultType:"2",element:"services",fields:{type:(0,i.attribute)("type")},namespace:t,type:e,typeField:"version"},{aliases:[{path:"iq.externalServices.services",multiple:!0}],defaultType:"2",element:"service",fields:{expires:(0,i.dateAttribute)("expires"),host:(0,i.attribute)("host"),name:(0,i.attribute)("name"),password:(0,i.attribute)("password"),port:(0,i.integerAttribute)("port"),restricted:(0,i.booleanAttribute)("restricted"),transport:(0,i.attribute)("transport"),type:(0,i.attribute)("type"),username:(0,i.attribute)("username")},namespace:t,type:e,typeField:"version"});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"media",fields:{height:(0,i.integerAttribute)("height"),width:(0,i.integerAttribute)("width")},namespace:r.NS_DATAFORM_MEDIA,path:"dataform.fields.media"},{aliases:[{multiple:!0,path:"dataform.fields.media.sources"}],element:"uri",fields:{mediaType:(0,i.attribute)("type"),uri:(0,i.text)()},namespace:r.NS_DATAFORM_MEDIA}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({requestingAttention:(0,i.childBoolean)(r.NS_ATTENTION_0,"attention")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["iq.bits",{path:"message.bits",multiple:!0},{path:"presence.bits",multiple:!0},{path:"iq.jingle.bits",multiple:!0}],element:"data",fields:{cid:(0,i.attribute)("cid"),data:(0,i.textBuffer)("base64"),maxAge:(0,i.integerAttribute)("max-age"),mediaType:(0,i.attribute)("type")},namespace:r.NS_BOB};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);let s=[(0,i.addAlias)(r.NS_HASHES_2,"hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),(0,i.addAlias)(r.NS_HASHES_1,"hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),(0,i.addAlias)(r.NS_HASHES_2,"hash-used",[{path:"file.hashesUsed",multiple:!0}]),(0,i.addAlias)(r.NS_THUMBS_1,"thumbnail",[{path:"file.thumbnails",multiple:!0}])];for(const e of[r.NS_JINGLE_FILE_TRANSFER_4,r.NS_JINGLE_FILE_TRANSFER_5])s=s.concat([{aliases:["file",{impliedType:!0,path:"iq.jingle.contents.application.file",selector:e},{impliedType:!0,path:"iq.jingle.info.file",selector:`{${e}}checksum`}],defaultType:r.NS_JINGLE_FILE_TRANSFER_5,element:"file",fields:{date:(0,i.childDate)(null,"date"),description:(0,i.childText)(null,"desc"),mediaType:(0,i.childText)(null,"media-type"),name:(0,i.childText)(null,"name"),size:(0,i.childInteger)(null,"size")},namespace:e,type:e,typeField:"version"},{aliases:[{impliedType:!0,path:"file.range",selector:e}],defaultType:r.NS_JINGLE_FILE_TRANSFER_5,element:"range",fields:{length:(0,i.integerAttribute)("length"),offset:(0,i.integerAttribute)("offset",0)},namespace:e,type:e,typeField:"version"},{element:"description",namespace:e,path:"iq.jingle.contents.application",type:e,typeField:"applicationType"},{element:"received",fields:{creator:(0,i.attribute)("creator"),name:(0,i.attribute)("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}received`,typeField:"infoType"},{element:"checksum",fields:{creator:(0,i.attribute)("creator"),name:(0,i.attribute)("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}checksum`,typeField:"infoType"}]);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r={element:"description",namespace:i.NS_JINGLE_XML_0,path:"iq.jingle.contents.application",type:i.NS_JINGLE_XML_0,typeField:"applicationType"};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"transport",fields:{activated:(0,i.childAttribute)(null,"activated","cid"),address:(0,i.attribute)("dstaddr"),candidateError:(0,i.childBoolean)(null,"candidate-error"),candidateUsed:(0,i.childAttribute)(null,"candidate-used","cid"),mode:(0,i.attribute)("mode","tcp"),proxyError:(0,i.childBoolean)(null,"proxy-error"),sid:(0,i.attribute)("sid")},namespace:r.NS_JINGLE_SOCKS5_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_SOCKS5_1,typeField:"transportType"},{aliases:[{multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:r.NS_JINGLE_SOCKS5_1}],element:"candidate",fields:{cid:(0,i.attribute)("cid"),host:(0,i.attribute)("host"),jid:(0,i.JIDAttribute)("jid"),port:(0,i.integerAttribute)("port"),priority:(0,i.integerAttribute)("priority"),type:(0,i.attribute)("type"),uri:(0,i.attribute)("uri")},namespace:r.NS_JINGLE_SOCKS5_1}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"transport",fields:{ack:{importer:(e,t)=>"message"!==(0,i.attribute)("stanza","iq").importer(e,t),exporter(e,t,n){!1===t&&(0,i.attribute)("stanza").exporter(e,"message",n)}},blockSize:(0,i.integerAttribute)("block-size"),sid:(0,i.attribute)("sid")},namespace:r.NS_JINGLE_IBB_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_IBB_1,typeField:"transportType"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_BOB,"data",[{path:"iq.jingle.bits",multiple:!0}]),{element:"thumbnail",fields:{height:(0,i.integerAttribute)("height"),mediaType:(0,i.attribute)("media-type"),uri:(0,i.attribute)("uri"),width:(0,i.integerAttribute)("width")},namespace:r.NS_THUMBS_1,path:"thumbnail"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_FORWARD_0,"forwarded",["message.carbon.forward"]),{element:"enable",namespace:r.NS_CARBONS_2,path:"iq.carbons",type:"enable",typeField:"action"},{element:"disable",namespace:r.NS_CARBONS_2,path:"iq.carbons",type:"disable",typeField:"action"},{element:"sent",namespace:r.NS_CARBONS_2,path:"message.carbon",type:"sent",typeField:"type"},{element:"received",namespace:r.NS_CARBONS_2,path:"message.carbon",type:"received",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(5),s=n(1),o=[...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"message",["forward.message"])),...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"presence",["forward.presence"])),...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"iq",["forward.iq"])),(0,i.addAlias)(s.NS_DELAY,"delay",["forward.delay"]),{aliases:["message.forward"],element:"forwarded",namespace:s.NS_FORWARD_0,path:"forward"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{defaultType:"2",element:"hash",fields:{algorithm:(0,i.attribute)("algo"),value:(0,i.textBuffer)("base64"),version:(0,i.staticValue)("2")},namespace:r.NS_HASHES_2,path:"hash",type:"2",typeField:"version"},{element:"hash-used",fields:{algorithm:(0,i.attribute)("algo"),version:(0,i.staticValue)("2")},namespace:r.NS_HASHES_2,path:"hashUsed"},{element:"hash",fields:{algorithm:(0,i.attribute)("algo"),value:(0,i.textBuffer)("hex"),version:(0,i.staticValue)("1")},namespace:r.NS_HASHES_1,path:"hash",type:"1",typeField:"version"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"rtt",fields:{event:(0,i.attribute)("event","edit"),id:(0,i.attribute)("id"),seq:(0,i.integerAttribute)("seq")},namespace:r.NS_RTT_0,path:"message.rtt"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"t",fields:{position:(0,i.integerAttribute)("p"),text:(0,i.text)()},namespace:r.NS_RTT_0,type:"insert",typeField:"type"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"e",fields:{length:(0,i.integerAttribute)("n",1),position:(0,i.integerAttribute)("p")},namespace:r.NS_RTT_0,type:"erase",typeField:"type"},{aliases:[{multiple:!0,path:"message.rtt.actions"}],element:"w",fields:{duration:(0,i.integerAttribute)("n",0)},namespace:r.NS_RTT_0,type:"wait",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({replace:(0,i.childAttribute)(r.NS_CORRECTION_0,"replace","id")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={2:r.NS_MAM_2,1:r.NS_MAM_1},o=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.archive.form"]),(0,i.addAlias)(r.NS_FORWARD_0,"forwarded",["message.archive.item"]),(0,i.addAlias)(r.NS_RSM,"set",["iq.archive.paging"])];for(const[e,t]of Object.entries(s))o.push({defaultType:"query",defaultVersion:"2",element:"query",fields:{node:(0,i.attribute)("node"),queryId:(0,i.attribute)("queryid")},namespace:t,path:"iq.archive",type:"query",typeField:"type",version:e,versionField:"version"},{element:"fin",fields:{complete:(0,i.booleanAttribute)("complete"),stable:(0,i.booleanAttribute)("stable")},namespace:t,path:"iq.archive",type:"result",version:e},{element:"prefs",fields:{default:(0,i.attribute)("default"),always:(0,i.deepMultipleChildText)([{namespace:null,element:"always"},{namespace:null,element:"jid"}]),never:(0,i.deepMultipleChildText)([{namespace:null,element:"never"},{namespace:null,element:"jid"}])},namespace:t,path:"iq.archive",type:"preferences",version:e},{element:"result",defaultType:"2",fields:{id:(0,i.attribute)("id"),queryId:(0,i.attribute)("queryid")},namespace:t,path:"message.archive",type:e,typeField:"version"});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendPresence)({hats:(0,i.splicePath)(r.NS_HATS_0,"hats","hat",!0)}),{element:"hat",fields:{id:(0,i.attribute)("name"),name:(0,i.attribute)("displayName")},namespace:r.NS_HATS_0,path:"hat"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendPresence)({idleSince:(0,i.childDate)(r.NS_IDLE_1,"since")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:r.NS_JINGLE_ICE_UDP_1},{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:r.NS_JINGLE_ICE_0},{multiple:!0,path:"iq.jingle.contents.application.encryption.dtls",selector:r.NS_JINGLE_RTP_1}],element:"fingerprint",fields:{algorithm:(0,i.attribute)("hash"),setup:(0,i.attribute)("setup"),value:(0,i.text)()},namespace:r.NS_JINGLE_DTLS_0};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s="message.marker",o=[{element:"markable",namespace:r.NS_CHAT_MARKERS_0,path:s,type:"markable",typeField:"type"},{element:"received",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"received"},{element:"displayed",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"displayed"},{element:"acknowledged",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"acknowledged"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({processingHints:{importer(e){const t={};let n=!1;for(const i of e.children)if("string"!=typeof i&&i.getNamespace()===r.NS_HINTS)switch(i.getName()){case"no-copy":t.noCopy=!0,n=!0;break;case"no-permanent-store":t.noPermanentStore=!0,n=!0;break;case"no-store":t.noStore=!0,n=!0;break;case"store":t.store=!0,n=!0}return n?t:void 0},exporter(e,t,n){t.noCopy&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-copy",n.namespace,e)),t.noPermanentStore&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-permanent-store",n.namespace,e)),t.noStore&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-store",n.namespace,e)),t.store&&e.appendChild((0,i.createElement)(r.NS_HINTS,"store",n.namespace,e))}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({json:(0,i.childJSON)(r.NS_JSON_0,"json")}),{aliases:(0,i.pubsubItemContentAliases)(),element:"json",fields:{json:(0,i.textJSON)()},namespace:r.NS_JSON_0,type:r.NS_JSON_0},{aliases:[{path:"message.jsonPayloads",multiple:!0}],element:"payload",fields:{type:(0,i.attribute)("datatype"),data:(0,i.childJSON)(r.NS_JSON_0,"json")},namespace:r.NS_JSON_MESSAGE_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{path:"iq.jingle.groups",multiple:!0}],element:"group",fields:{contents:(0,i.multipleChildAttribute)(null,"content","name"),semantics:(0,i.attribute)("semantics")},namespace:r.NS_JINGLE_GROUPING_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"iq.jingle.contents.transport.sctp",selector:r.NS_JINGLE_ICE_UDP_1},{path:"iq.jingle.contents.transport.sctp",selector:r.NS_JINGLE_ICE_0}],element:"sctpmap",fields:{port:(0,i.integerAttribute)("number"),protocol:(0,i.attribute)("protocol"),streams:(0,i.attribute)("streams")},namespace:r.NS_JINGLE_DTLS_SCTP_1};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r=[{element:"active",namespace:i.NS_CSI_0,path:"csi",type:"active",typeField:"state"},{element:"inactive",namespace:i.NS_CSI_0,path:"csi",type:"inactive",typeField:"state"}];t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.push.form","pushNotification.form"]),{element:"enable",fields:{jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node")},namespace:r.NS_PUSH_0,path:"iq.push",type:"enable",typeField:"action"},{element:"disable",fields:{jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node")},namespace:r.NS_PUSH_0,path:"iq.push",type:"disable",typeField:"action"},{aliases:(0,i.pubsubItemContentAliases)(),element:"notification",namespace:r.NS_PUSH_0,path:"pushNotification",type:r.NS_PUSH_0,typeField:"itemType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({originId:(0,i.childAttribute)(r.NS_SID_0,"origin-id","id")}),{aliases:[{path:"message.stanzaIds",multiple:!0}],element:"stanza-id",fields:{by:(0,i.JIDAttribute)("by"),id:(0,i.attribute)("id")},namespace:r.NS_SID_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStanzaError)({httpUploadError:(0,i.childEnum)(r.NS_HTTP_UPLOAD_0,["file-too-large","retry"]),httpUploadMaxFileSize:(0,i.deepChildInteger)([{namespace:r.NS_HTTP_UPLOAD_0,element:"file-too-large"},{namespace:r.NS_HTTP_UPLOAD_0,element:"max-file-size"}]),httpUploadRetry:(0,i.childDateAttribute)(r.NS_HTTP_UPLOAD_0,"retry","stamp")}),{element:"request",fields:{mediaType:(0,i.attribute)("content-type"),name:(0,i.attribute)("filename"),size:(0,i.integerAttribute)("size")},namespace:r.NS_HTTP_UPLOAD_0,path:"iq.httpUpload",type:"request",typeField:"type"},{element:"slot",fields:{download:(0,i.childAttribute)(null,"get","url")},namespace:r.NS_HTTP_UPLOAD_0,path:"iq.httpUpload",type:"slot"},{aliases:[{path:"iq.httpUpload.upload",selector:"slot"}],element:"put",fields:{url:(0,i.attribute)("url")},namespace:r.NS_HTTP_UPLOAD_0},{aliases:[{path:"iq.httpUpload.upload.headers",multiple:!0}],element:"header",fields:{name:(0,i.attribute)("name"),value:(0,i.text)()},namespace:r.NS_HTTP_UPLOAD_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"encryption",fields:{id:(0,i.attribute)("namespace"),name:(0,i.attribute)("name")},namespace:r.NS_EME_0,path:"message.encryptionMethod"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["message.omemo"],element:"encrypted",fields:{payload:(0,i.childTextBuffer)(null,"payload","base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemo"},{element:"header",fields:{iv:(0,i.childTextBuffer)(null,"iv","base64"),sid:(0,i.integerAttribute)("sid")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemo.header"},{aliases:[{path:"omemo.header.keys",multiple:!0}],element:"key",fields:{preKey:(0,i.booleanAttribute)("prekey"),rid:(0,i.integerAttribute)("rid"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL},{aliases:(0,i.pubsubItemContentAliases)(),element:"list",fields:{devices:(0,i.multipleChildIntegerAttribute)(null,"device","id")},namespace:r.NS_OMEMO_AXOLOTL,type:r.NS_OMEMO_AXOLOTL_DEVICELIST,typeField:"itemType"},{element:"preKeyPublic",fields:{id:(0,i.integerAttribute)("preKeyId"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoPreKey"},{element:"signedPreKeyPublic",fields:{id:(0,i.integerAttribute)("signedPreKeyId"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoDevice.signedPreKeyPublic"},{aliases:(0,i.pubsubItemContentAliases)(),element:"bundle",fields:{identityKey:(0,i.childTextBuffer)(null,"identityKey","base64"),preKeys:(0,i.splicePath)(null,"prekeys","omemoPreKey",!0),signedPreKeySignature:(0,i.childTextBuffer)(null,"signedPreKeySignature","base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoDevice",type:r.NS_OMEMO_AXOLOTL_BUNDLES,typeField:"itemType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e,t,n){super(),this.condition=e,this.channelId=t,this.stanzaInstanceId=n,this.name="SaslError"}}t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";var i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},r=n(32),s=n(12);t.a=function(e,t,n){if(i.randomUUID&&!t&&!e)return i.randomUUID();const o=(e=e||{}).random||(e.rng||r.a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=o[e];return t}return Object(s.b)(o)}},function(e,t,n){"use strict";n.r(t);var i=n(48),r=n(44);for(var s in r)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(s);var o=n(38);for(var s in o)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);var a=n(170);for(var s in a)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(s);var c=n(21);for(var s in c)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return c[e]}))}(s);var u=n(47);for(var s in u)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return u[e]}))}(s);var l=n(27);n.d(t,"HttpClient",(function(){return l.HttpClient}));var d=n(11);n.d(t,"parseJwt",(function(){return d.parseJwt})),t.default=i.Client},function(e,t,n){t.RateLimiter=n(174),t.TokenBucket=n(51)},function(e,t,n){(function(t){var i=n(51),r=n(175),s=function(e,t,n){this.tokenBucket=new i(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=n};s.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,n){if(e>this.tokenBucket.bucketSize)return t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var i=this,s=r();if((s<this.curIntervalStart||s-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=s,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)t.nextTick(n.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-s);setTimeout((function(){i.tokenBucket.removeTokens(e,a)}),o)}return!1}return this.tokenBucket.removeTokens(e,a);function a(t,r){if(t)return n(t,null);i.tokensThisInterval+=e,n(null,r)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var n=this.tokenBucket.tryRemoveTokens(e);return n&&(this.tokensThisInterval+=e),n},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},e.exports=s}).call(this,n(22))},function(e,t,n){(function(t){e.exports=function(){if(void 0!==t&&t.hrtime){var e=t.hrtime(),n=e[0],i=e[1];return 1e3*n+Math.floor(i/1e6)}return(new Date).getTime()}}).call(this,n(22))},function(e,t,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var r={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=i(i({},r),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(178),r=n(182);t.DelayFactory=function(e,t){var n=function(e){if(!e.delayFirstAttempt)return new i.SkipFirstDelay(e);return new r.AlwaysDelay(e)}(e);return n.setAttemptNumber(t),n}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.apply=function(){return s(this,void 0,void 0,(function(){return o(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(n(52).Delay);t.SkipFirstDelay=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),r=n(181);t.JitterFactory=function(e){switch(e.jitter){case"full":return i.fullJitter;case"none":default:return r.noJitter}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(n(52).Delay);t.AlwaysDelay=s},function(e,t,n){"use strict";(function(e){
22
+ var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function o(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function c(e,t){return function(n,i){t(n,i,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function d(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function p(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function h(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function g(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof y?Promise.resolve(n.value.v).then(c,u):l(s[0][2],n)}catch(e){l(s[0][3],e)}var n}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function _(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:y(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function v(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}}function S(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function T(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var i=n(25),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=d;var s=Object.create(n(20)),o=n(57),a=n(59);s.inherits(d,o);for(var c=r(a.prototype),u=0;u<c.length;u++){var l=c[u];d.prototype[l]||(d.prototype[l]=a.prototype[l])}function d(e){if(!(this instanceof d))return new d(e);o.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||i.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),d.prototype._destroy=function(e,t){this.push(null),this.end(),i.nextTick(t,e)}},function(e,t,n){"use strict";n.r(t);var i=n(32),r=n(12);let s,o,a=0,c=0;var u=function(e,t,n){let u=t&&n||0;const l=t||new Array(16);let d=(e=e||{}).node||s,p=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==p){const t=e.random||(e.rng||i.a)();null==d&&(d=s=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==p&&(p=o=16383&(t[6]<<8|t[7]))}let h=void 0!==e.msecs?e.msecs:Date.now(),f=void 0!==e.nsecs?e.nsecs:c+1;const m=h-a+(f-c)/1e4;if(m<0&&void 0===e.clockseq&&(p=p+1&16383),(m<0||h>a)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,c=f,o=p,h+=122192928e5;const g=(1e4*(268435455&h)+f)%4294967296;l[u++]=g>>>24&255,l[u++]=g>>>16&255,l[u++]=g>>>8&255,l[u++]=255&g;const y=h/4294967296*1e4&268435455;l[u++]=y>>>8&255,l[u++]=255&y,l[u++]=y>>>24&15|16,l[u++]=y>>>16&255,l[u++]=p>>>8|128,l[u++]=255&p;for(let e=0;e<6;++e)l[u+e]=d[e];return t||Object(r.b)(l)},l=n(13);var d=function(e){if(!Object(l.a)(e))throw TypeError("Invalid UUID");let t;const n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};function p(e,t,n){function i(e,i,s,o){var a;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof i&&(i=d(i)),16!==(null===(a=i)||void 0===a?void 0:a.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+e.length);if(c.set(i),c.set(e,i.length),c=n(c),c[6]=15&c[6]|t,c[8]=63&c[8]|128,s){o=o||0;for(let e=0;e<16;++e)s[o+e]=c[e];return s}return Object(r.b)(c)}try{i.name=e}catch(e){}return i.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",i.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",i}function h(e){return 14+(e+64>>>9<<4)+1}function f(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t,n,i,r,s){return f((o=f(f(t,e),f(i,s)))<<(a=r)|o>>>32-a,n);var o,a}function g(e,t,n,i,r,s,o){return m(t&n|~t&i,e,t,r,s,o)}function y(e,t,n,i,r,s,o){return m(t&i|n&~i,e,t,r,s,o)}function b(e,t,n,i,r,s,o){return m(t^n^i,e,t,r,s,o)}function _(e,t,n,i,r,s,o){return m(n^(t|~i),e,t,r,s,o)}var v=p("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){const t=[],n=32*e.length;for(let i=0;i<n;i+=8){const n=e[i>>5]>>>i%32&255,r=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16);t.push(r)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[h(t)-1]=t;let n=1732584193,i=-271733879,r=-1732584194,s=271733878;for(let t=0;t<e.length;t+=16){const o=n,a=i,c=r,u=s;n=g(n,i,r,s,e[t],7,-680876936),s=g(s,n,i,r,e[t+1],12,-389564586),r=g(r,s,n,i,e[t+2],17,606105819),i=g(i,r,s,n,e[t+3],22,-1044525330),n=g(n,i,r,s,e[t+4],7,-176418897),s=g(s,n,i,r,e[t+5],12,1200080426),r=g(r,s,n,i,e[t+6],17,-1473231341),i=g(i,r,s,n,e[t+7],22,-45705983),n=g(n,i,r,s,e[t+8],7,1770035416),s=g(s,n,i,r,e[t+9],12,-1958414417),r=g(r,s,n,i,e[t+10],17,-42063),i=g(i,r,s,n,e[t+11],22,-1990404162),n=g(n,i,r,s,e[t+12],7,1804603682),s=g(s,n,i,r,e[t+13],12,-40341101),r=g(r,s,n,i,e[t+14],17,-1502002290),i=g(i,r,s,n,e[t+15],22,1236535329),n=y(n,i,r,s,e[t+1],5,-165796510),s=y(s,n,i,r,e[t+6],9,-1069501632),r=y(r,s,n,i,e[t+11],14,643717713),i=y(i,r,s,n,e[t],20,-373897302),n=y(n,i,r,s,e[t+5],5,-701558691),s=y(s,n,i,r,e[t+10],9,38016083),r=y(r,s,n,i,e[t+15],14,-660478335),i=y(i,r,s,n,e[t+4],20,-405537848),n=y(n,i,r,s,e[t+9],5,568446438),s=y(s,n,i,r,e[t+14],9,-1019803690),r=y(r,s,n,i,e[t+3],14,-187363961),i=y(i,r,s,n,e[t+8],20,1163531501),n=y(n,i,r,s,e[t+13],5,-1444681467),s=y(s,n,i,r,e[t+2],9,-51403784),r=y(r,s,n,i,e[t+7],14,1735328473),i=y(i,r,s,n,e[t+12],20,-1926607734),n=b(n,i,r,s,e[t+5],4,-378558),s=b(s,n,i,r,e[t+8],11,-2022574463),r=b(r,s,n,i,e[t+11],16,1839030562),i=b(i,r,s,n,e[t+14],23,-35309556),n=b(n,i,r,s,e[t+1],4,-1530992060),s=b(s,n,i,r,e[t+4],11,1272893353),r=b(r,s,n,i,e[t+7],16,-155497632),i=b(i,r,s,n,e[t+10],23,-1094730640),n=b(n,i,r,s,e[t+13],4,681279174),s=b(s,n,i,r,e[t],11,-358537222),r=b(r,s,n,i,e[t+3],16,-722521979),i=b(i,r,s,n,e[t+6],23,76029189),n=b(n,i,r,s,e[t+9],4,-640364487),s=b(s,n,i,r,e[t+12],11,-421815835),r=b(r,s,n,i,e[t+15],16,530742520),i=b(i,r,s,n,e[t+2],23,-995338651),n=_(n,i,r,s,e[t],6,-198630844),s=_(s,n,i,r,e[t+7],10,1126891415),r=_(r,s,n,i,e[t+14],15,-1416354905),i=_(i,r,s,n,e[t+5],21,-57434055),n=_(n,i,r,s,e[t+12],6,1700485571),s=_(s,n,i,r,e[t+3],10,-1894986606),r=_(r,s,n,i,e[t+10],15,-1051523),i=_(i,r,s,n,e[t+1],21,-2054922799),n=_(n,i,r,s,e[t+8],6,1873313359),s=_(s,n,i,r,e[t+15],10,-30611744),r=_(r,s,n,i,e[t+6],15,-1560198380),i=_(i,r,s,n,e[t+13],21,1309151649),n=_(n,i,r,s,e[t+4],6,-145523070),s=_(s,n,i,r,e[t+11],10,-1120210379),r=_(r,s,n,i,e[t+2],15,718787259),i=_(i,r,s,n,e[t+9],21,-343485551),n=f(n,o),i=f(i,a),r=f(r,c),s=f(s,u)}return[n,i,r,s]}(function(e){if(0===e.length)return[];const t=8*e.length,n=new Uint32Array(h(t));for(let i=0;i<t;i+=8)n[i>>5]|=(255&e[i/8])<<i%32;return n}(e),8*e.length))})),S=n(171);function w(e,t,n,i){switch(e){case 0:return t&n^~t&i;case 1:return t^n^i;case 2:return t&n^t&i^n&i;case 3:return t^n^i}}function T(e,t){return e<<t|e>>>32-t}var I=p("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let n=0;n<t.length;++n)e.push(t.charCodeAt(n))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);const i=e.length/4+2,r=Math.ceil(i/16),s=new Array(r);for(let t=0;t<r;++t){const n=new Uint32Array(16);for(let i=0;i<16;++i)n[i]=e[64*t+4*i]<<24|e[64*t+4*i+1]<<16|e[64*t+4*i+2]<<8|e[64*t+4*i+3];s[t]=n}s[r-1][14]=8*(e.length-1)/Math.pow(2,32),s[r-1][14]=Math.floor(s[r-1][14]),s[r-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<r;++e){const i=new Uint32Array(80);for(let t=0;t<16;++t)i[t]=s[e][t];for(let e=16;e<80;++e)i[e]=T(i[e-3]^i[e-8]^i[e-14]^i[e-16],1);let r=n[0],o=n[1],a=n[2],c=n[3],u=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=T(r,5)+w(n,o,a,c)+u+t[n]+i[e]>>>0;u=c,c=a,a=T(o,30)>>>0,o=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+u>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var N=function(e){if(!Object(l.a)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)};n.d(t,"v1",(function(){return u})),n.d(t,"v3",(function(){return v})),n.d(t,"v4",(function(){return S.a})),n.d(t,"v5",(function(){return I})),n.d(t,"NIL",(function(){return"00000000-0000-0000-0000-000000000000"})),n.d(t,"version",(function(){return N})),n.d(t,"validate",(function(){return l.a})),n.d(t,"stringify",(function(){return r.a})),n.d(t,"parse",(function(){return d}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9),r=n(36);class s extends r.Transform{constructor(e,t,n="be"){super(),this._block=i.Buffer.alloc(e),this._finalSize=t,this._blockSize=e,this._bigEndian="be"===n,this._len=0}_transform(e,t,n){let i=null;try{this.update(e,t)}catch(e){i=e}n(i)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){"string"==typeof e&&(t=t||"utf8",e=i.Buffer.from(e,t));const n=this._block,r=this._blockSize,s=e.length;let o=this._len;for(let t=0;t<s;){const i=o%r,a=Math.min(s-t,r-i);for(let r=0;r<a;r++)n[i+r]=e[t+r];o+=a,t+=a,o%r==0&&this._update(n)}return this._len+=s,this}digest(e){const t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));const n=8*this._len;if(n<=4294967295)this._bigEndian?(this._block.writeUInt32BE(0,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)):(this._block.writeUInt32LE(n,this._blockSize-8),this._block.writeUInt32LE(0,this._blockSize-4));else{const e=(4294967295&n)>>>0,t=(n-e)/4294967296;this._bigEndian?(this._block.writeUInt32BE(t,this._blockSize-8),this._block.writeUInt32BE(e,this._blockSize-4)):(this._block.writeUInt32LE(e,this._blockSize-8),this._block.writeUInt32LE(t,this._blockSize-4))}this._update(this._block);const i=this._hash();return e?i.toString(e):i}_update(e){throw new Error("_update must be implemented by subclass")}_hash(){throw new Error("_update must be implemented by subclass")}}t.default=s},function(e,t,n){"use strict";t.inherits=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionTypes=void 0,function(e){e.softphone="softphone",e.collaborateVideo="collaborateVideo",e.acdScreenShare="screenShare",e.screenRecording="screenRecording",e.unknown="unknown"}(t.SessionTypes||(t.SessionTypes={}))},function(e,t){const n=e.exports={};function i(){}n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=i,n.addListener=i,n.once=i,n.off=i,n.removeListener=i,n.removeAllListeners=i,n.emit=i,n.prependListener=i,n.prependOnceListener=i,n.nextTick=(e,...t)=>window.queueMicrotask(()=>e(...t)),n.listeners=e=>[],n.cwd=()=>"/",n.umask=()=>0,n.binding=e=>{throw new Error("process.binding is not supported")},n.chdir=e=>{throw new Error("process.chdir is not supported")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(24);class r{constructor(e,t={},n=[]){this.name=e,this.attributes=t,this.children=[],this.optionalNamespaces={};for(const e of n)if("string"!=typeof e){const t=new r(e.name,e.attributes,e.children);t.parent=this,this.children.push(t)}else this.children.push(e)}getName(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name}getNamespace(){if(this.name.indexOf(":")>=0){const e=this.name.substr(0,this.name.indexOf(":"));return this.findNamespaceForPrefix(e)}return this.findNamespaceForPrefix()}getNamespaceContext(){let e={};this.parent&&(e=this.parent.getNamespaceContext());for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")){const i=t.substr(6);e[n]=i}return e}getDefaultNamespace(){return this.attributes.xmlns?this.attributes.xmlns:this.parent?this.parent.getDefaultNamespace():""}getNamespaceRoot(e){if(this.parent){const t=this.parent.getNamespaceRoot(e);if(t)return t}for(const[t,n]of Object.entries(this.attributes))if(t.startsWith("xmlns:")&&n===e)return this;if(this.optionalNamespaces[e])return this}getAttribute(e,t){if(!t)return this.attributes[e];const n=this.getNamespaceContext();return n[t]?this.attributes[[n[t],e].join(":")]:void 0}getChild(e,t){return this.getChildren(e,t)[0]}getChildren(e,t){const n=[];for(const i of this.children)"string"==typeof i||i.getName()!==e||t&&i.getNamespace()!==t||n.push(i);return n}getText(){let e="";for(const t of this.children)"string"==typeof t&&(e+=t);return e}appendChild(e){return this.children.push(e),"string"!=typeof e&&(e.parent=this),e}setAttribute(e,t,n=!1){this.attributes[e]=t||void 0,""===t&&n&&(this.attributes[e]=t)}addOptionalNamespace(e,t){this.optionalNamespaces[t]=e}useNamespace(e,t){return this.optionalNamespaces[t]&&(e=this.optionalNamespaces[t]),this.setAttribute("xmlns:"+e,t),e}toJSON(){const e=this.children.map(e=>"string"==typeof e?e:e?e.toJSON():void 0).filter(e=>!!e),t={};for(const[e,n]of Object.entries(this.attributes))null!=n&&(t[e]=n);return{attributes:t,children:e,name:this.name}}toString(){let e=this.openTag(!0);if(this.children.length){for(const t of this.children)"string"==typeof t?e+=(0,i.escapeXMLText)(t):t&&(e+=t.toString());e+=this.closeTag()}return e}openTag(e=!1){let t="";t+="<"+this.name;for(const[e,n]of Object.entries(this.attributes))void 0!==n&&(t+=` ${e}="${(0,i.escapeXML)(n.toString())}"`);return e&&0===this.children.length?t+="/>":t+=">",t}closeTag(){return`</${this.name}>`}findNamespaceForPrefix(e){if(e){const t="xmlns:"+e;if(this.attributes[t])return this.attributes[t];if(this.parent)return this.parent.findNamespaceForPrefix(e)}else{if(this.attributes.xmlns)return this.attributes.xmlns;if(this.parent)return this.parent.findNamespaceForPrefix()}return""}}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.basicLanguageResolver=t.escapeXMLText=t.unescapeXML=t.escapeXML=void 0;const i=(0,n(3).__importDefault)(n(34)),r={'"':"&quot;","&":"&amp;","'":"&apos;","<":"&lt;",">":"&gt;"},s={"&amp;":"&","&apos;":"'","&gt;":">","&lt;":"<","&quot;":'"'},o=/&([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);/g,a=/&|<|>|"|'/g,c=/&|<|>/g;function u(e){return r[e]}t.escapeXML=function(e){return e.replace(a,u)},t.unescapeXML=function(e){return e.replace(o,e=>function(e){if(s[e])return s[e];const t=e.startsWith("&#x"),n=parseInt(e.substring(t?3:2,e.length-1),t?16:10);if(9===n||10===n||13===n||32<=n&&n<=55295||57344<=n&&n<=65533||65536<=n&&n<=1114111)return String.fromCodePoint(n);throw i.default.restrictedXML("Prohibited entity: "+e)}(e))},t.escapeXMLText=function(e){return e.replace(c,u)},t.basicLanguageResolver=function(e,t=[],n=""){const i=new Set(e.map(e=>e.toLowerCase()));for(let e of t.map(e=>e.toLowerCase()))if("*"!==e)for(;e.length>0;){if(i.has(e))return e;e=e.substring(0,e.lastIndexOf("-")).toLowerCase(),e.lastIndexOf("-")===e.length-2&&(e=e.substring(0,e.lastIndexOf("-")))}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nextTick=void 0,t.nextTick=function(e,...t){queueMicrotask(()=>e(...t))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.exportToSDP=t.importFromSDP=void 0;const i=(0,n(3).__importStar)(n(63));t.importFromSDP=function(e){const t=i.getMediaSections(e),n=i.getDescription(e),r={groups:[],media:[]};i.matchPrefix(n,"a=ice-lite").length>0&&(r.iceLite=!0);for(const e of i.matchPrefix(n,"a=group:")){const t=e.split(" "),n=t.shift().substr(8);r.groups.push({mids:t,semantics:n})}for(const e of t){const t=i.getKind(e),s=i.isRejected(e),o=i.parseMLine(e),a={direction:i.getDirection(e,n),kind:t,mid:i.getMid(e),protocol:o.protocol};if(s||(a.iceParameters=i.getIceParameters(e,n),a.dtlsParameters=i.getDtlsParameters(e,n),a.setup=i.matchPrefix(e,"a=setup:")[0].substr(8),r.iceLite&&(a.iceParameters.iceLite=!0)),"audio"===t||"video"===t){a.rtpParameters=i.parseRtpParameters(e),a.rtpEncodingParameters=i.parseRtpEncodingParameters(e),a.rtcpParameters=i.parseRtcpParameters(e);const t=i.parseMsid(e);a.streams=t?[t]:[]}else"application"===t&&(a.sctp=i.parseSctpDescription(e));a.candidates=i.matchPrefix(e,"a=candidate:").map(i.parseCandidate),r.media.push(a)}return r},t.exportToSDP=function(e){const t=[];t.push(i.writeSessionBoilerplate(e.sessionId,e.sessionVersion),"a=msid-semantic:WMS *\r\n"),(e.iceLite||e.media.filter(e=>e.iceParameters&&e.iceParameters.iceLite).length>0)&&t.push("a=ice-lite\r\n");for(const n of e.groups||[])t.push(`a=group:${n.semantics} ${n.mids.join(" ")}\r\n`);for(const n of e.media||[]){const e=!(n.iceParameters&&n.dtlsParameters);if("application"===n.kind&&n.sctp)t.push(i.writeSctpDescription(n,n.sctp));else if(n.rtpParameters){let r=i.writeRtpDescription(n.kind,n.rtpParameters);e&&(r=r.replace(`m=${n.kind} 9 `,`m=${n.kind} 0 `)),t.push(r),t.push(`a=${n.direction||"sendrecv"}\r\n`);for(const e of n.streams||[])t.push(`a=msid:${e.stream} ${e.track}\r\n`);if(n.rtcpParameters&&(t.push(i.writeRtcpParameters(n.rtcpParameters)),n.rtcpParameters.cname&&n.rtpEncodingParameters&&n.rtpEncodingParameters[0].rtx)){const e=n.rtpEncodingParameters[0];t.push(`a=ssrc-group:FID ${e.ssrc} ${e.rtx.ssrc}\r\n`),t.push(`a=ssrc:${e.rtx.ssrc} cname:${n.rtcpParameters.cname}\r\n`)}}if(void 0!==n.mid&&t.push(`a=mid:${n.mid}\r\n`),n.iceParameters&&t.push(i.writeIceParameters({usernameFragment:n.iceParameters.usernameFragment,password:n.iceParameters.password})),n.dtlsParameters&&n.setup&&t.push(i.writeDtlsParameters(n.dtlsParameters,n.setup)),n.candidates&&n.candidates.length)for(const e of n.candidates)t.push(`a=${i.writeCandidate(e)}\r\n`)}return t.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HttpClient=void 0;const i=n(16).__importStar(n(66)),r=n(11);class s{constructor(){this._httpRetryingRequests=new Map}requestApiWithRetry(e,t,n){const i=r.retryPromise(this.requestApi.bind(this,e,t),e=>{var n,i,r;let o=!1;if(null==e?void 0:e.response){o=s.retryStatusCodes.has(e.response.status||0);const a=(null===(n=e.response.headers)||void 0===n?void 0:n["retry-after"])||(null===(r=(i=e.response).getResponseHeader)||void 0===r?void 0:r.call(i,"retry-after"));a&&((t.logger||console).debug("retry-after header found on response. setting retry delay",{retryAfter:a}),o=1e3*parseInt(a,10))}return o},n,t.logger);return this._httpRetryingRequests.set(i._id,i),i.promise.then(()=>this.cancelRetryRequest(i._id),()=>this.cancelRetryRequest(i._id)),i}requestApi(e,t){const n=t.logger||console,r=(new Date).getTime(),s=this._buildUri(t.host,e,t.version),o={"content-type":t.contentType||"application/json",...t.customHeaders||{}},a={method:t.method,url:s,data:t.data,responseType:t.responseType,timeout:t.requestTimeout||3e4,headers:o};t.noAuthHeader||(a.headers.Authorization="Bearer "+t.authToken);const c=this.handleResponse.bind(this,n,r,a);return i.default(a).then(c,c)}handleResponse(e,t,n,r){var s,o,a;let c=(new Date).getTime(),u=c-t+"ms";if(r instanceof i.AxiosError){if((null===(o=null===(s=r.config)||void 0===s?void 0:s.headers)||void 0===o?void 0:o.Authorization)&&(r.config.headers.Authorization="redacted"),"ECONNABORTED"===r.code)return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:u},{skipServer:!0}),Promise.reject(r);const t=r.response||{};let i=t.status,l=t.headers&&t.headers["inin-correlation-id"],d=t.data,p={...r,text:null===(a=t.request)||void 0===a?void 0:a.response};return e.debug("request error: "+n.url,{message:r.message,now:c,elapsed:u,status:i,correlationId:l,body:d},{skipServer:!0}),Promise.reject(p)}let l=r.status,d=r.headers["inin-correlation-id"],p=JSON.stringify(r.data);return e.debug(`response: ${n.method.toUpperCase()} ${n.url}`,{now:c,status:l,elapsed:u,correlationId:d,body:p},{skipServer:!0}),Promise.resolve(r)}stopAllRetries(){Array.from(this._httpRetryingRequests.keys()).forEach(e=>this.cancelRetryRequest(e))}cancelRetryRequest(e){const t=this._httpRetryingRequests.get(e);return t&&(t.cancel(new Error("Retry request cancelled")),this._httpRetryingRequests.delete(e)),!0}formatRequestError(e){if(this.isSuperagentNetworkError(e))return{status:e.status,method:e.method,url:e.url,crossDomain:e.crossDomain,message:e.message,name:e.name,stack:e.stack};if(this.isSuperagentResponseError(e)){const t=e.response;return{status:e.status,correlationId:t.headers["inin-correlation-id"],message:"Error making HTTP request",method:t.req.method,name:t.error.name,stack:t.error.stack}}return e}isSuperagentNetworkError(e){return e&&e.hasOwnProperty("status")&&e.hasOwnProperty("method")&&e.hasOwnProperty("url")}isSuperagentResponseError(e){return!!(e&&e.response&&e.response.body&&e.response.req)}_buildUri(e,t,n="v2"){return t=t.replace(/^\/+|\/+$/g,""),0===e.indexOf("http")?`${e}/api/${n}/${t}`:`https://api.${e}/api/${n}/${t}`}}t.HttpClient=s,s.retryStatusCodes=new Set([408,413,429,500,502,503,504])},function(e,t){var n=Object.prototype.hasOwnProperty;function i(e){return"[Throws: "+(e?e.message:"?")+"]"}function r(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var s=e(r.toJSON());return t.pop(),s}catch(e){return i(e)}if(Array.isArray(r)){var o=r.map(e);return t.pop(),o}var a=Object.keys(r).reduce((function(t,s){return t[s]=e(function(e,t){if(n.call(e,t))try{return e[t]}catch(e){return i(e)}return e[t]}(r,s)),t}),{});return t.pop(),a}(e)}e.exports=function(e,t,n){return JSON.stringify(r(e),t,n)},e.exports.ensureProperties=r},function(e,t,n){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";function i(e,t){return function(){return e.apply(t,arguments)}}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";t.a=null},function(e,t,n){"use strict";let i;n.d(t,"a",(function(){return s}));const r=new Uint8Array(16);function s(){if(!i&&(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!i))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(r)}},function(e,t,n){(function(e,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof i&&i;o.global!==o&&o.window!==o&&o.self;var a,c=2147483647,u=/^xn--/,l=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,f=String.fromCharCode;function m(e){throw new RangeError(p[e])}function g(e,t){for(var n=e.length,i=[];n--;)i[n]=t(e[n]);return i}function y(e,t){var n=e.split("@"),i="";return n.length>1&&(i=n[0]+"@",e=n[1]),i+g((e=e.replace(d,".")).split("."),t).join(".")}function b(e){for(var t,n,i=[],r=0,s=e.length;r<s;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<s?56320==(64512&(n=e.charCodeAt(r++)))?i.push(((1023&t)<<10)+(1023&n)+65536):(i.push(t),r--):i.push(t);return i}function _(e){return g(e,(function(e){var t="";return e>65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=f(e)})).join("")}function v(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,n){var i=0;for(e=n?h(e/700):e>>1,e+=h(e/t);e>455;i+=36)e=h(e/35);return h(i+36*e/(e+38))}function w(e){var t,n,i,r,s,o,a,u,l,d,p,f=[],g=e.length,y=0,b=128,v=72;for((n=e.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)e.charCodeAt(i)>=128&&m("not-basic"),f.push(e.charCodeAt(i));for(r=n>0?n+1:0;r<g;){for(s=y,o=1,a=36;r>=g&&m("invalid-input"),((u=(p=e.charCodeAt(r++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>h((c-y)/o))&&m("overflow"),y+=u*o,!(u<(l=a<=v?1:a>=v+26?26:a-v));a+=36)o>h(c/(d=36-l))&&m("overflow"),o*=d;v=S(y-s,t=f.length+1,0==s),h(y/t)>c-b&&m("overflow"),b+=h(y/t),y%=t,f.splice(y++,0,b)}return _(f)}function T(e){var t,n,i,r,s,o,a,u,l,d,p,g,y,_,w,T=[];for(g=(e=b(e)).length,t=128,n=0,s=72,o=0;o<g;++o)(p=e[o])<128&&T.push(f(p));for(i=r=T.length,r&&T.push("-");i<g;){for(a=c,o=0;o<g;++o)(p=e[o])>=t&&p<a&&(a=p);for(a-t>h((c-n)/(y=i+1))&&m("overflow"),n+=(a-t)*y,t=a,o=0;o<g;++o)if((p=e[o])<t&&++n>c&&m("overflow"),p==t){for(u=n,l=36;!(u<(d=l<=s?1:l>=s+26?26:l-s));l+=36)w=u-d,_=36-d,T.push(f(v(d+w%_,0))),u=h(w/_);T.push(f(v(u,0))),s=S(n,y,i==r),n=0,++i}++n,++t}return T.join("")}a={version:"1.4.1",ucs2:{decode:b,encode:_},decode:w,encode:T,toASCII:function(e){return y(e,(function(e){return l.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return y(e,(function(e){return u.test(e)?w(e.slice(4).toLowerCase()):e}))}},void 0===(r=function(){return a}.call(t,n,t,e))||(e.exports=r)}()}).call(this,n(191)(e),n(15))},function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.JXTErrorCondition=void 0,function(e){e.NotWellFormed="not-well-formed",e.RestrictedXML="restricted-xml",e.AlreadyClosed="already-closed",e.UnknownRoot="unknown-stream-root"}(i=t.JXTErrorCondition||(t.JXTErrorCondition={}));class r extends Error{constructor(e){super(e.text),this.isJXTError=!0,this.condition=e.condition,this.text=e.text}static notWellFormed(e){return new r({condition:i.NotWellFormed,text:e})}static restrictedXML(e){return new r({condition:i.RestrictedXML,text:e})}static alreadyClosed(e){return new r({condition:i.AlreadyClosed,text:e})}static unknownRoot(e){return new r({condition:i.UnknownRoot,text:e})}}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.childAlternateLanguageRawElement=t.childLanguageRawElement=t.childRawElement=t.staticValue=t.splicePath=t.multipleChildEnum=t.multipleChildAlternateLanguageText=t.childAlternateLanguageText=t.multipleChildIntegerAttribute=t.multipleChildAttribute=t.multipleChildText=t.childDoubleEnum=t.childEnum=t.deepMultipleChildText=t.deepChildBoolean=t.deepChildInteger=t.deepChildText=t.childBoolean=t.childTimezoneOffset=t.childJSON=t.childFloat=t.childInteger=t.childDate=t.childTextBuffer=t.childText=t.childLanguageAttribute=t.languageAttribute=t.textBuffer=t.textJSON=t.text=t.childDateAttribute=t.childFloatAttribute=t.childIntegerAttribute=t.childBooleanAttribute=t.childAttribute=t.namespacedDateAttribute=t.namespacedFloatAttribute=t.namespacedIntegerAttribute=t.namespacedBooleanAttribute=t.namespacedAttribute=t.dateAttribute=t.floatAttribute=t.integerAttribute=t.booleanAttribute=t.attribute=t.findOrCreate=t.findAll=t.getTargetLang=t.getLang=t.createElement=void 0,t.parameterMap=void 0;const i=n(3),r=n(7),s=(0,i.__importDefault)(n(23)),o=n(37);function a(e,t,n,i){if(i){e=e||i.getNamespace();const n=i.getNamespaceRoot(e);if(n){t=`${n.useNamespace("",e)}:${t}`}}const r=new s.default(t);return t.indexOf(":")<0&&(!n||e!==n)&&r.setAttribute("xmlns",e),r}function c(e,t){return(e.getAttribute("xml:lang")||t||"").toLowerCase()}function u(e,t){const n=[];for(const i of e)n.push(c(i,t.lang));let i;return i=t.resolveLanguage?t.resolveLanguage(n,t.acceptLanguages||[],t.lang):t.lang,i||""}function l(e,t,n,i){const r=e.getChildren(n,t),s=c(e);return r.length?i?r.filter(e=>{if(c(e,s)===i)return!0}):r:[]}function d(e,t,n,i){t=t||e.getNamespace();const r=l(e,t,n,i);if(r.length)return r[0];const s=a(t,n,e.getDefaultNamespace(),e),o=c(e,i);return i&&o!==i&&s.setAttribute("xml:lang",i),e.appendChild(s),s}function p(e){return{importer(t){const n=t.getAttribute(e.name,e.namespace);return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);if(i||e.emitEmpty)if(e.namespace&&e.prefix){let n;const r=t.getNamespaceRoot(e.namespace);if(r)n=r.useNamespace(e.prefix,e.namespace);else{const i=t.getNamespaceContext();i[e.namespace]||(n=t.useNamespace(e.prefix,e.namespace),i[e.namespace]=n)}t.setAttribute(`${n}:${e.name}`,i,e.emitEmpty)}else t.setAttribute(e.name,i,e.emitEmpty)}}}function h(e,t){return(n,i,r={})=>(r={staticDefault:i,...r},p({name:n,...e,...t?t(r):r}))}function f(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},p({name:r,namespace:i,prefix:n,...e,...t?t(o):o}))}function m(e){const t=e.converter||p({...e,namespace:e.attributeNamespace});return{importer(n,i){const r=n.getChild(e.element,e.namespace||n.getNamespace());return r?t.importer(r,i):e.dynamicDefault?e.dynamicDefault():e.staticDefault},exporter(n,i,r){if(void 0!==i&&i!==e.staticDefault){const s=d(n,e.namespace||n.getNamespace(),e.element);t.exporter(s,i,r)}}}}function g(e,t){return(n,i,r,s,o={})=>(o={staticDefault:s,...o},m({element:i,name:r,namespace:n,...e,...t?t(o):o}))}function y(e){return{importer(t){const n=t.getText();return n?e.parseValue(n):e.dynamicDefault?e.dynamicDefault(n):e.staticDefault},exporter(t,n){if(!n&&e.emitEmpty)return void t.children.push("");if(void 0===n||n===e.staticDefault)return;const i=e.writeValue(n);i&&t.children.push(i)}}}function b(e){const t=y(e);return{importer(n,i){const r=l(n,e.namespace||n.getNamespace(),e.element),s=u(r,i);if(!r.length)return e.dynamicDefault?e.dynamicDefault():e.staticDefault;if(e.matchLanguage)for(const e of r)if(c(e,i.lang)===s)return t.importer(e,i);return t.importer(r[0],i)},exporter(n,i,r){if(i||!e.emitEmpty){if(void 0!==i&&i!==e.staticDefault){const s=d(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0);t.exporter(s,i,r)}}else d(n,e.namespace||n.getNamespace(),e.element,e.matchLanguage?r.lang:void 0)}}}t.createElement=a,t.getLang=c,t.getTargetLang=u,t.findAll=l,t.findOrCreate=d;const _={parseValue:e=>e,writeValue:e=>e},v={parseValue:e=>parseInt(e,10),writeValue:e=>e.toString()},S={parseValue:e=>parseFloat(e),writeValue:e=>e.toString()},w={parseValue:e=>"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0,writeValue:e=>e?"1":"0"},T={parseValue:e=>new Date(e),writeValue:e=>"string"==typeof e?e:e.toISOString()},I={parseValue:e=>JSON.parse(e),writeValue:e=>JSON.stringify(e)},N=(e="utf8")=>({parseValue:t=>("base64"===e&&"="===t&&(t=""),r.Buffer.from(t.trim(),e)),writeValue:t=>{let n;return n="string"==typeof t?r.Buffer.from(t).toString(e):t?t.toString(e):"","base64"===e&&(n=n||"="),n}}),A={parseValue:e=>{let t=-1;"-"===e.charAt(0)&&(t=1,e=e.slice(1));const n=e.split(":");return(60*parseInt(n[0],10)+parseInt(n[1],10))*t},writeValue:e=>{if("string"==typeof e)return e;{let t="-";e<0&&(e=-e,t="+");const n=e/60,i=e%60;return t+=(n<10?"0":"")+n+":"+(i<10?"0":"")+i,t}}};t.attribute=h(_,e=>({dynamicDefault:e.emitEmpty?t=>""===t?"":e.staticDefault:void 0,...e})),t.booleanAttribute=h(w),t.integerAttribute=h(v),t.floatAttribute=h(S),t.dateAttribute=h(T),t.namespacedAttribute=f(_),t.namespacedBooleanAttribute=f(w),t.namespacedIntegerAttribute=f(v),t.namespacedFloatAttribute=f(S),t.namespacedDateAttribute=f(T),t.childAttribute=g(_),t.childBooleanAttribute=g(w),t.childIntegerAttribute=g(v),t.childFloatAttribute=g(S),t.childDateAttribute=g(T);t.text=e=>y({staticDefault:e,..._});t.textJSON=()=>y({...I});function E(){return{importer:(e,t)=>c(e,t.lang),exporter(e,t,n){t&&t.toLowerCase()!==n.lang?e.setAttribute("xml:lang",t):e.setAttribute("xml:lang",void 0)}}}t.textBuffer=(e="utf8")=>y({...N(e)}),t.languageAttribute=E;t.childLanguageAttribute=(e,t)=>m({converter:E(),element:t,name:"xml:lang",namespace:e,..._});t.childText=(e,t,n,i=!1)=>b({element:t,emitEmpty:i,matchLanguage:!0,namespace:e,staticDefault:n,..._});t.childTextBuffer=(e,t,n="utf8")=>b({element:t,matchLanguage:!0,namespace:e,...N(n)});t.childDate=(e,t)=>b({element:t,namespace:e,...T});t.childInteger=(e,t,n)=>b({element:t,namespace:e,staticDefault:n,...v});t.childFloat=(e,t,n)=>b({element:t,namespace:e,staticDefault:n,...S});t.childJSON=(e,t)=>b({element:t,namespace:e,...I}),t.childTimezoneOffset=function(e,t){return b({element:t,namespace:e,staticDefault:0,...A})},t.childBoolean=function(e,t){return{importer(n){if(n.getChild(t,e||n.getNamespace()))return!0},exporter(n,i){i&&d(n,e||n.getNamespace(),t)}}};const x=(e,t,n)=>{if(!n)return;let i=t;for(const t of e)i=d(i,t.namespace||i.getNamespace(),t.element);i.children.push(n.toString())};t.deepChildText=function(e,t){return{importer(n){let i=n;for(const n of e)if(i=i.getChild(n.element,n.namespace||i.getNamespace()),!i)return t;return i.getText()||t},exporter(t,n){x(e,t,n)}}},t.deepChildInteger=function(e,t){return{importer(n){let i=n;for(const t of e)if(i=i.getChild(t.element,t.namespace||i.getNamespace()),!i)return;const r=i.getText();return r?parseInt(r,10):t||void 0},exporter(t,n){x(e,t,n)}}},t.deepChildBoolean=function(e){return{importer(t){let n=t;for(const t of e)if(n=n.getChild(t.element,t.namespace||n.getNamespace()),!n)return!1;return!0},exporter(t,n){if(!n)return;let i=t;for(const t of e)i=d(i,t.namespace||i.getNamespace(),t.element)}}},t.deepMultipleChildText=function(e){const t=e.pop();return{importer(n,i){let r=n;for(const t of e)if(r=r.getChild(t.element,t.namespace||r.getNamespace()),!r)return[];const s=[],o=l(r,t.namespace||r.getNamespace(),t.element),a=u(o,i);for(const e of o)c(e,i.lang)===a&&s.push(e.getText());return s},exporter(n,i,r){if(!i.length)return;let s=n;for(const t of e)s=d(s,t.namespace||s.getNamespace(),t.element);const{namespace:o,element:c}=t;for(const e of i){const t=a(o||s.getNamespace(),c,r.namespace,s);t.children.push(e),s.appendChild(t)}}}},t.childEnum=function(e,t,n){const i=new Map,r=new Map;for(const e of t)"string"==typeof e?(i.set(e,e),r.set(e,e)):(i.set(e[1],e[0]),r.set(e[0],e[1]));return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&i.has(n.getName()))return i.get(n.getName());return n},exporter(t,n){r.has(n)&&d(t,e,r.get(n))}}},t.childDoubleEnum=function(e,t,n,i){const r=new Set(t),s=new Set(n);return{importer(t){for(const n of t.children)if("string"!=typeof n&&n.getNamespace()===(e||t.getNamespace())&&r.has(n.getName())){for(const i of n.children)if("string"!=typeof i&&i.getNamespace()===(e||t.getNamespace())&&s.has(i.getName()))return[n.getName(),i.getName()];return[n.getName()]}return i},exporter(t,n){const i=d(t,e,n[0]);n[1]&&d(i,e,n[1])}}},t.multipleChildText=function(e,t){return{importer(n,i){const r=[],s=l(n,e||n.getNamespace(),t),o=u(s,i);for(const e of s)c(e,i.lang)===o&&r.push(e.getText());return r},exporter(n,i,r){for(const s of i){const i=a(e||n.getNamespace(),t,r.namespace,n);i.children.push(s),n.appendChild(i)}}}},t.multipleChildAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(t)}return r},exporter(i,r,s){for(const o of r){const r=a(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o),i.appendChild(r)}}}},t.multipleChildIntegerAttribute=function(e,t,n){return{importer(i){const r=[],s=i.getChildren(t,e||i.getNamespace());for(const e of s){const t=e.getAttribute(n);void 0!==t&&r.push(parseInt(t,10))}return r},exporter(i,r,s){for(const o of r){const r=a(e||i.getNamespace(),t,s.namespace,i);r.setAttribute(n,o.toString()),i.appendChild(r)}}}},t.childAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=l(n,e||n.getNamespace(),t),o=new Set;for(const e of s){const t=e.getText();if(t){const n=c(e,i.lang);if(o.has(n))continue;r.push({lang:n,value:t}),o.add(n)}}return o.size>0?r:void 0},exporter(n,i,r){for(const s of i){const i=s.value;if(i){const o=a(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}}},t.multipleChildAlternateLanguageText=function(e,t){return{importer(n,i){const r=[],s=new Map;let o=!1;const a=l(n,e||n.getNamespace(),t);for(const e of a){const t=e.getText();if(t){const n=c(e,i.lang);let a=s.get(n);a||(a=[],s.set(n,a),r.push({lang:n,value:a})),a.push(t),o=!0}}return o?r:void 0},exporter(n,i,r){for(const s of i)for(const i of s.value){const o=a(e||n.getNamespace(),t,r.namespace,n);s.lang!==r.lang&&o.setAttribute("xml:lang",s.lang),o.children.push(i),n.appendChild(o)}}}},t.multipleChildEnum=function(e,t){const n=new Map,i=new Map;for(const e of t)"string"==typeof e?(n.set(e,e),i.set(e,e)):(n.set(e[1],e[0]),i.set(e[0],e[1]));return{importer(t){const i=[];for(const r of t.children)"string"!=typeof r&&r.getNamespace()===(e||t.getNamespace())&&n.has(r.getName())&&i.push(n.get(r.getName()));return i},exporter(t,n){for(const r of n)d(t,e,i.get(r))}}},t.splicePath=function(e,t,n,i=!1){return{importer(r,s){const o=r.getChild(t,e||r.getNamespace());if(!o)return;const a=[];for(const e of o.children)if("string"!=typeof e&&s.registry.getImportKey(e)===n){const t=s.registry.import(e);t&&a.push(t)}return i?a:a[0]},exporter(i,r,s){let o=[];o=Array.isArray(r)?r:[r];const a=[];for(const t of o){const r=s.registry.export(n,t,{...s,namespace:e||i.getNamespace()||void 0});r&&a.push(r)}if(a.length){const n=d(i,e||i.getNamespace(),t);for(const e of a)n.appendChild(e)}}}},t.staticValue=function(e){return{exporter:()=>{},importer:()=>e}},t.childRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=i.getChild(t,e||i.getNamespace());return s?n?r.sanitizers[n](s.toJSON()):s.toJSON():void 0},exporter(i,r,a){if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(n){if(!a.sanitizers||!a.sanitizers[n])return;r=a.sanitizers[n](r)}r&&i.appendChild(new s.default(r.name,r.attributes,r.children))}}},t.childLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=l(i,e||i.getNamespace(),t),o=u(s,r);for(const e of s)if(c(e,r.lang)===o)return n?r.sanitizers[n](e.toJSON()):e.toJSON();return s[0]?n?r.sanitizers[n](s[0].toJSON()):s[0].toJSON():void 0},exporter(i,r,a){if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!a.sanitizers||!a.sanitizers[n])return;r=a.sanitizers[n](r)}if(!r)return;const c=d(i,e||i.getNamespace(),t,a.lang);for(const e of r.children)"string"==typeof e?c.appendChild(e):e&&c.appendChild(new s.default(e.name,e.attributes,e.children))}}},t.childAlternateLanguageRawElement=function(e,t,n){return{importer(i,r){if(n&&(!r.sanitizers||!r.sanitizers[n]))return;const s=[],o=new Set,a=l(i,e||i.getNamespace(),t);for(const e of a){let t=e.toJSON();if(n&&(t=r.sanitizers[n](t)),t){const n=c(e,r.lang);if(o.has(n))continue;s.push({lang:n,value:t}),o.add(n)}}return o.size>0?s:void 0},exporter(i,r,c){for(const u of r){let r=u.value;if("string"==typeof r){r=(0,o.parse)(`<${t} xmlns="${e||i.getNamespace()}">${r}</${t}>`).toJSON()}if(r&&n){if(!c.sanitizers||!c.sanitizers[n])continue;r=c.sanitizers[n](r)}if(r){const n=a(e||i.getNamespace(),t,c.namespace,i);i.appendChild(n),u.lang!==c.lang&&n.setAttribute("xml:lang",u.lang);for(const e of r.children)"string"==typeof e?n.appendChild(e):n.appendChild(new s.default(e.name,e.attributes,e.children))}}}}},t.parameterMap=function(e,n,i,r){return{importer(s,o){const a={},c=l(s,e,n),u=(0,t.attribute)(i).importer,d=(0,t.attribute)(r).importer;for(const e of c)a[u(e,o)]=d(e,o);return a},exporter(s,o,c){const u=(0,t.attribute)(i).exporter,l=(0,t.attribute)(r).exporter,d=e||s.getNamespace();for(const[e,t]of Object.entries(o)){const i=a(d,n,c.namespace,s);u(i,e,c),o[e]&&l(i,t,c),s.appendChild(i)}}}}},function(e,t,n){"use strict";t.Readable=n(57),t.Writable=n(59),t.Duplex=n(17),t.Transform=n(61),t.PassThrough=n(204)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parse=void 0;const i=n(3),r=n(6),s=n(24),o=(0,i.__importDefault)(n(23)),a=(0,i.__importDefault)(n(34));function c(e){return 97<=e&&e<=122||65<=e&&e<=90||58===e||95===e}function u(e){return 192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=767||880<=e&&e<=893||895<=e&&e<=8191||8204<=e&&e<=8205||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||65008<=e&&e<=65533||65536<=e&&e<=983039}function l(e){return c(e)||u(e)}function d(e){return c(e)||45===e||46===e||48<=e&&e<=57||183===e||768<=e&&e<=879||8255<=e&&e<=8256||u(e)}function p(e){return 32===e||10===e||13===e||9===e}class h extends r.EventEmitter{constructor(e={}){super(),this.allowComments=!0,this.attributes={},this.state=34,this.tagName="",this.haveDeclaration=!1,this.recordBuffer=[],void 0!==e.allowComments&&(this.allowComments=e.allowComments)}write(e){for(const t of e){const e=t.codePointAt(0);switch(this.state){case 34:if(60===e){let e;try{e=(0,s.unescapeXML)(this.endRecord())}catch(e){return void this.emit("error",e)}e&&this.emit("text",e),this.transition(31);continue}this.record(t);continue;case 31:if(47===e){this.transition(7);continue}if(33===e){this.transition(24);continue}if(63===e){if(this.haveDeclaration)return this.restrictedXML();this.transition(25);continue}if(l(e)){this.transition(30),this.startRecord(t);continue}return this.notWellFormed();case 30:if(d(e)){this.record(t);continue}if(p(e)){this.startTag(),this.transition(32);continue}if(47===e){this.startTag(),this.transition(29);continue}if(62===e){this.startTag(),this.transition(34),this.emit("startElement",this.tagName,this.attributes);continue}return this.notWellFormed();case 29:if(62===e){this.emit("startElement",this.tagName,this.attributes),this.emit("endElement",this.tagName),this.transition(34);continue}return this.notWellFormed();case 33:if(p(e)){this.transition(32);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 32:if(p(e))continue;if(l(e)){this.startRecord(t),this.transition(0);continue}if(47===e){this.transition(29);continue}if(62===e){this.emit("startElement",this.tagName,this.attributes),this.transition(34);continue}return this.notWellFormed();case 7:if(l(e)){this.startRecord(t),this.transition(6);continue}return this.notWellFormed();case 6:if(d(e)){this.record(t);continue}if(p(e)){this.transition(8);continue}if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 8:if(p(e))continue;if(62===e){const e=this.endRecord();this.emit("endElement",e,this.attributes),this.transition(34);continue}return this.notWellFormed();case 0:if(d(e)){this.record(t);continue}if(61===e){this.addAttribute(),this.transition(4);continue}if(p(e)){this.addAttribute(),this.transition(3);continue}return this.notWellFormed();case 3:if(61===e){this.transition(4);continue}if(p(e))continue;return this.notWellFormed();case 4:if(34===e){this.startRecord(),this.transition(1);continue}if(39===e){this.startRecord(),this.transition(2);continue}if(p(e))continue;return this.notWellFormed();case 1:case 2:if(34===e&&1===this.state||39===e&&2===this.state){const e=this.endRecord();this.attributes[this.attributeName]=(0,s.unescapeXML)(e),this.transition(33);continue}if(60===e)return this.notWellFormed();this.record(t);continue;case 24:if(45===e){if(!this.allowComments)return this.restrictedXML();this.transition(23);continue}if(91===e){this.transition(21);continue}return this.notWellFormed();case 23:if(45===e){this.transition(14);continue}return this.notWellFormed();case 14:45===e&&this.transition(12);continue;case 12:45===e?this.transition(11):this.transition(14);continue;case 11:62===e?this.transition(34):this.transition(14);continue;case 25:if(88===e||120===e){this.transition(28);continue}return this.notWellFormed();case 28:if(77===e||109===e){this.transition(27);continue}return this.notWellFormed();case 27:if(76===e||108===e){this.transition(26);continue}return this.notWellFormed();case 26:if(p(e)){this.haveDeclaration=!0,this.transition(15);continue}return this.notWellFormed();case 13:if(62===e){this.transition(34);continue}return this.notWellFormed();case 15:63===e&&this.transition(13);continue;case 21:this.wait(e,67,20);continue;case 20:this.wait(e,68,19);continue;case 19:this.wait(e,65,18);continue;case 18:this.wait(e,84,17);continue;case 17:this.wait(e,65,16);continue;case 16:this.wait(e,91,5);continue;case 5:if(93===e){this.transition(10);continue}this.record(t);continue;case 10:93===e?this.transition(9):(this.record(String.fromCodePoint(93)),this.record(t),this.transition(5));continue;case 9:if(62===e){const e=this.endRecord();e&&this.emit("text",e),this.transition(34)}else this.record(String.fromCodePoint(93)),this.record(String.fromCodePoint(93)),this.record(t),this.transition(5);continue}}}end(e){e&&this.write(e),this.write=()=>{}}record(e){this.recordBuffer.push(e)}startRecord(e){this.recordBuffer=[],e&&this.recordBuffer.push(e)}endRecord(){const e=this.recordBuffer;return this.recordBuffer=[],e.join("")}startTag(){this.tagName=this.endRecord(),this.attributes={}}addAttribute(){const e=this.endRecord();if(void 0!==this.attributes[e])return this.notWellFormed();this.attributeName=e,this.attributes[e]=""}wait(e,t,n){if(e!==t)return this.notWellFormed();this.transition(n)}transition(e){this.state=e,34===e&&this.startRecord()}notWellFormed(e){this.emit("error",a.default.notWellFormed(e))}restrictedXML(e){this.emit("error",a.default.restrictedXML(e))}}t.parse=function(e,t={}){const n=new h(t);let i,r,s=null;if(n.on("text",e=>{r&&r.children.push(e)}),n.on("startElement",(e,t)=>{const n=new o.default(e,t);i||(i=n),r=r?r.appendChild(n):n}),n.on("endElement",e=>{r?e===r.name?r.parent&&(r=r.parent):n.emit("error",a.default.notWellFormed("b")):n.emit("error",a.default.notWellFormed("a"))}),n.on("error",e=>{s=e}),n.write(e),n.end(),s)throw s;return i},t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StanzaMediaSession=void 0;const i=n(16),r=i.__importDefault(n(6)),s=n(39),o=n(5),a=i.__importDefault(n(65)),c=n(21),u={"Discovered new ICE candidate":{skipMessage:!0}};class l extends s.MediaSession{constructor(e){super(e.options),this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.reinvite=!1,this.logger=e.logger,this.conversationId=e.conversationId,this.peerConnection=this.pc,this.fromUserId=e.fromUserId,this.meetingId=e.meetingId,this.id=this.sid,this.originalRoomJid=e.originalRoomJid,this.sessionType=c.SessionTypes[e.sessionType],this.ignoreHostCandidatesFromRemote=!!e.ignoreHostCandidatesFromRemote,this.allowIPv6=!!e.allowIPv6,this.allowTCP=!!e.allowTCP;const t=new r.default;Object.keys(t.__proto__).forEach(e=>{this[e]=t[e]}),e.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.pc.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.pc.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}async onTransportInfo(e,t){var n,i;const r=null===(n=e.contents)||void 0===n?void 0:n[0].transport,s=null==r?void 0:r.candidates;if(this.ignoreHostCandidatesFromRemote){const e=null==s?void 0:s.filter(e=>"host"!==e.type);(null==e?void 0:e.length)!==(null===(i=null==r?void 0:r.candidates)||void 0===i?void 0:i.length)&&(this._log("info","Ignoring remote host ice candidates"),r.candidates=e)}if(s)for(const e of s)this._log("info","Received candidate from peer",{candidateType:e.type}),this.iceCandidatesReceivedFromPeer++;return super.onTransportInfo(e,t)}_log(e,t,...n){const i=u[t];if(null==i?void 0:i.skipMessage)return;let r;if(n.length){const e=n[0];"object"!=typeof e||Array.isArray(e)||null===e?r={...this.getLogDetails(),data:e}:(Object.assign(n[0],this.getLogDetails()),r=n)}else r=[...n,this.getLogDetails()];this.logger[e](t,r)}async end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),setTimeout(()=>{"connected"!==this.pc.connectionState&&"connecting"!==this.pc.connectionState||this.pc.close()},2e3),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}setupStatsGatherer(){this.statsGatherer=new a.default(this.pc),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}onIceStateChange(){const e=this.pc.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;this._log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e?"stable"===this.pc.signalingState&&(this.interruptionStart=new Date,this._log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i})):"connected"===e?(this._log("info","sending session-info: active"),this.send(o.JingleAction.SessionInfo,{info:{infoType:o.JINGLE_INFO_ACTIVE}}),this._setupDataChannel()):"failed"===e&&this._log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer}),super.onIceStateChange()}onConnectionStateChange(){const e=this.pc.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this._log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this._log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this._log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this._log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url}),console.error("IceCandidateError",t)}onIceCandidate(e){if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this._log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this._log("debug","Processing ice candidate",e.candidate.candidate),this._log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++}return super.onIceCandidate(e)}onIceEndOfCandidates(){super.onIceEndOfCandidates(),this.emit("endOfCandidates")}addTrack(e,t){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{const n=this.pc.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.pc.addTrack(e,t)})}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.pc.localDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this._log("info","creating data channel"),this.dataChannel=this.pc.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this._log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this._log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this._log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this._log("error","Failed to parse data channel message",{error:e})}}}t.StanzaMediaSession=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=t.FileSession=t.MediaSession=t.ICESession=t.Session=t.exportToSDP=t.importFromSDP=void 0;const i=n(3),r=(0,i.__importDefault)(n(62));t.FileSession=r.default;const s=(0,i.__importDefault)(n(40));t.ICESession=s.default;const o=(0,i.__importDefault)(n(64));t.MediaSession=o.default;const a=(0,i.__importDefault)(n(42));t.Session=a.default;const c=(0,i.__importDefault)(n(213));t.SessionManager=c.default;var u=n(26);Object.defineProperty(t,"importFromSDP",{enumerable:!0,get:function(){return u.importFromSDP}}),Object.defineProperty(t,"exportToSDP",{enumerable:!0,get:function(){return u.exportToSDP}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=(0,i.__importStar)(n(63)),s=n(5),o=n(1),a=n(26),c=n(41),u=(0,i.__importDefault)(n(42));class l extends u.default{constructor(e){super(e),this.bitrateLimit=0,this.candidateBuffer=[],this.transportType=o.NS_JINGLE_ICE_UDP_1,this.restartingIce=!1,this.usingRelay=!1,this.maxRelayBandwidth=e.maxRelayBandwidth,this.pc=this.parent.createPeerConnection(this,{...e.config,iceServers:e.iceServers}),this.pc.oniceconnectionstatechange=()=>{this.onIceStateChange()},this.pc.onicecandidate=e=>{e.candidate?this.onIceCandidate(e):this.onIceEndOfCandidates()},this.restrictRelayBandwidth()}end(e="success",t=!1){this.pc.close(),super.end(e,t)}async restartIce(){if(this.isInitiator){void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this.restartingIce=!0;try{await this.processLocal("restart-ice",async()=>{const e=await this.pc.createOffer({iceRestart:!0}),t=(0,a.importFromSDP)(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:(0,c.convertIntermediateToTransport)(e,this.transportType)})),sid:this.sid}),await this.pc.setLocalDescription(e)})}catch(e){this._log("error","Could not create WebRTC offer",e),this.end(s.JingleReasonCondition.FailedTransport,!0)}}}async setMaximumBitrate(e){this.maximumBitrate&&(e=Math.min(e,this.maximumBitrate)),this.currentBitrate=e;const t=this.pc.getSenders().find(e=>!!e.track&&"video"===e.track.kind);if(t&&t.getParameters)try{await this.processLocal("set-bitrate",async()=>{const n=t.getParameters();n.encodings&&n.encodings.length||(n.encodings=[{}]),0===e?delete n.encodings[0].maxBitrate:n.encodings[0].maxBitrate=e,await t.setParameters(n)})}catch(e){this._log("error","Set maximumBitrate failed",e)}}async onTransportInfo(e,t){if(e.contents&&e.contents[0]&&e.contents[0].transport.gatheringComplete){const n={sdpMid:e.contents[0].name,candidate:""};try{"stable"===this.pc.signalingState?await this.pc.addIceCandidate(n):this.candidateBuffer.push(n)}catch(e){this._log("debug","Could not add null end-of-candidate")}finally{t()}return}if(this.pc.remoteDescription){const n=this.pc.remoteDescription,i=(0,a.importFromSDP)(n.sdp),r=i.media.find(t=>t.mid===e.contents[0].name).iceParameters.usernameFragment,o=e.contents[0].transport.usernameFragment;if(o&&r!==o){for(const[t,n]of e.contents.entries()){const e=n.transport;i.media[t].iceParameters={password:e.password,usernameFragment:e.usernameFragment},i.media[t].candidates=[]}try{if(await this.pc.setRemoteDescription({type:n.type,sdp:(0,a.exportToSDP)(i)}),await this.processBufferedCandidates(),"offer"===n.type){const e=await this.pc.createAnswer();await this.pc.setLocalDescription(e);const t=(0,a.importFromSDP)(e.sdp);this.send(s.JingleAction.TransportInfo,{contents:t.media.map(e=>({creator:s.JingleSessionRole.Initiator,name:e.mid,transport:(0,c.convertIntermediateToTransport)(e,this.transportType)})),sid:this.sid})}else this.restartingIce=!1}catch(e){return this._log("error","Could not do remote ICE restart",e),t(e),void this.end(s.JingleReasonCondition.FailedTransport)}}}const n=(e.contents||[]).map(e=>{const t=e.name,n=(e.transport.candidates||[]).map(async e=>{const n=r.writeCandidate((0,c.convertCandidateToIntermediate)(e));if(this.pc.remoteDescription&&"stable"===this.pc.signalingState)try{await this.pc.addIceCandidate({sdpMid:t,candidate:n})}catch(e){this._log("error","Could not add ICE candidate",e)}else this.candidateBuffer.push({sdpMid:t,candidate:n})});return Promise.all(n)});try{await Promise.all(n),t()}catch(e){this._log("error","Could not process transport-info: "+e),t(e)}}async onSessionAccept(e,t){this.state="active";const n=(0,c.convertRequestToIntermediate)(e,this.peerRole),i=(0,a.exportToSDP)(n);try{await this.pc.setRemoteDescription({type:"answer",sdp:i}),await this.processBufferedCandidates(),this.parent.emit("accepted",this,void 0),t()}catch(e){this._log("error","Could not process WebRTC answer: "+e),t({condition:"general-error"})}}onSessionTerminate(e,t){this._log("info","Terminating session"),this.pc.close(),super.end(e.reason,!0),t()}onIceCandidate(e){if(!e.candidate||!e.candidate.candidate)return;const t=r.parseCandidate(e.candidate.candidate),n={contents:[{creator:s.JingleSessionRole.Initiator,name:e.candidate.sdpMid,transport:{candidates:[(0,c.convertIntermediateToCandidate)(t)],transportType:this.transportType,usernameFragment:t.usernameFragment}}]};this._log("info","Discovered new ICE candidate",n),this.send(s.JingleAction.TransportInfo,n)}onIceEndOfCandidates(){this._log("info","ICE end of candidates");const e=(0,a.importFromSDP)(this.pc.localDescription.sdp).media[0];this.send(s.JingleAction.TransportInfo,{contents:[{creator:s.JingleSessionRole.Initiator,name:e.mid,transport:{gatheringComplete:!0,transportType:this.transportType,usernameFragment:e.iceParameters.usernameFragment}}]})}onIceStateChange(){switch(this.pc.iceConnectionState){case"checking":this.connectionState="connecting";break;case"completed":case"connected":this.connectionState="connected";break;case"disconnected":if("stable"===this.pc.signalingState?this.connectionState="interrupted":this.connectionState="disconnected",this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.maybeRestartIce();break;case"failed":if("failed"===this.connectionState||this.restartingIce)return void this.end(s.JingleReasonCondition.FailedTransport);this.connectionState="failed",this.restartIce();break;case"closed":this.connectionState="disconnected",this.restartingIce?this.end(s.JingleReasonCondition.FailedTransport):this.end()}}async processBufferedCandidates(){for(const e of this.candidateBuffer)try{await this.pc.addIceCandidate(e)}catch(e){this._log("error","Could not add ICE candidate",e)}this.candidateBuffer=[]}restrictRelayBandwidth(){this.pc.addEventListener("iceconnectionstatechange",async()=>{if("completed"!==this.pc.iceConnectionState&&"connected"!==this.pc.iceConnectionState)return;const e=await this.pc.getStats();let t;if(e.forEach(n=>{"transport"===n.type&&(t=e.get(n.selectedCandidatePairId))}),t||e.forEach(e=>{"candidate-pair"===e.type&&e.selected&&(t=e)}),!t)return;let n=!1,i="",r="";if(t.remoteCandidateId){const n=e.get(t.remoteCandidateId);n&&(r=n.candidateType)}if(t.localCandidateId){const n=e.get(t.localCandidateId);n&&(i=n.candidateType)}"relay"!==i&&"relay"!==r||(n=!0),this.usingRelay=n,this.parent.emit("iceConnectionType",this,{localCandidateType:i,relayed:n,remoteCandidateType:r}),n&&void 0!==this.maxRelayBandwidth&&(this.maximumBitrate=this.maxRelayBandwidth,this.currentBitrate?this.setMaximumBitrate(Math.min(this.currentBitrate,this.maximumBitrate)):this.setMaximumBitrate(this.maximumBitrate))})}maybeRestartIce(){this.isInitiator&&(void 0!==this._maybeRestartingIce&&clearTimeout(this._maybeRestartingIce),this._maybeRestartingIce=setTimeout(()=>{this._maybeRestartingIce=void 0,"disconnected"===this.pc.iceConnectionState&&this.restartIce()},2e3))}}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertRequestToIntermediate=t.convertContentToIntermediate=t.convertIntermediateToRequest=t.convertIntermediateToTransport=t.convertCandidateToIntermediate=t.convertIntermediateToCandidate=t.convertIntermediateToApplication=void 0;const i=n(5),r=n(1);function s(e,t){const n=e.rtpParameters,s=e.rtcpParameters||{},o=e.rtpEncodingParameters||[];let a=!1;o&&o.length&&(a=!!o[0].ssrc);const c={applicationType:r.NS_JINGLE_RTP_1,codecs:[],headerExtensions:[],media:e.kind,rtcpMux:s.mux,rtcpReducedSize:s.reducedSize,sourceGroups:[],sources:[],ssrc:a?o[0].ssrc.toString():void 0,streams:[]};for(const e of n.headerExtensions||[]){const n={id:e.id,uri:e.uri};e.direction&&"sendrecv"!==e.direction&&(n.senders=(0,i.directionToSenders)(t,e.direction)),c.headerExtensions.push(n)}s.ssrc&&s.cname&&(c.sources=[{parameters:{cname:s.cname},ssrc:s.ssrc.toString()}]),a&&o[0]&&o[0].rtx&&(c.sourceGroups=[{semantics:"FID",sources:[o[0].ssrc.toString(),o[0].rtx.ssrc.toString()]}]);for(const t of e.streams||[])c.streams.push({id:t.stream,track:t.track});for(const e of n.codecs||[]){const t={channels:e.channels,clockRate:e.clockRate,id:e.payloadType.toString(),name:e.name,parameters:e.parameters,rtcpFeedback:e.rtcpFeedback};e.maxptime&&(t.maxptime=e.maxptime),e.parameters&&e.parameters.ptime&&(t.ptime=parseInt(e.parameters.ptime,10)),c.codecs.push(t)}return c}function o(e){let t;return t="rtp"===e.component?1:"rtcp"===e.component?2:e.component,{component:t,foundation:e.foundation,generation:void 0,id:void 0,ip:e.ip,network:void 0,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function a(e){return{address:e.ip,component:1===e.component?"rtp":2===e.component?"rtcp":e.component,foundation:e.foundation,ip:e.ip,port:e.port,priority:e.priority,protocol:e.protocol,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort,tcpType:e.tcpType,type:e.type}}function c(e,t){const n=e.iceParameters,i=e.dtlsParameters,r={candidates:[],transportType:t};n&&(r.usernameFragment=n.usernameFragment,r.password=n.password,n.iceLite&&(r.iceLite=!0)),i&&(r.fingerprints=i.fingerprints.map(t=>({algorithm:t.algorithm,setup:e.setup,value:t.value}))),e.sctp&&(r.sctp=e.sctp);for(const t of e.candidates||[])r.candidates.push(o(t));return r}function u(e,t){const n=e.application||{},s=e.transport,o=n&&n.applicationType===r.NS_JINGLE_RTP_1,c={direction:(0,i.sendersToDirection)(t,e.senders),kind:n.media||"application",mid:e.name,protocol:o?"UDP/TLS/RTP/SAVPF":"UDP/DTLS/SCTP"};if(o){if(c.rtcpParameters={compound:!n.rtcpReducedSize,mux:n.rtcpMux,reducedSize:n.rtcpReducedSize},n.sources&&n.sources.length){const e=n.sources[0];c.rtcpParameters.ssrc=parseInt(e.ssrc,10),e.parameters&&(c.rtcpParameters.cname=e.parameters.cname)}if(c.rtpParameters={codecs:[],fecMechanisms:[],headerExtensions:[],rtcp:[]},n.streams){c.streams=[];for(const e of n.streams)c.streams.push({stream:e.id,track:e.track})}if(n.ssrc&&(c.rtpEncodingParameters=[{ssrc:parseInt(n.ssrc,10)}],n.sourceGroups&&n.sourceGroups.length)){const e=n.sourceGroups[0];c.rtpEncodingParameters[0].rtx={ssrc:parseInt(e.sources[1],10)}}let e=!1,r=!1;for(const t of n.codecs||[]){const n=t.parameters||{},i=[];for(const e of t.rtcpFeedback||[])i.push({parameter:e.parameter,type:e.type});if("red"===t.name||"ulpfec"===t.name){e=e||"red"===t.name,r=r||"ulpfec"===t.name;const n=t.name.toUpperCase();c.rtpParameters.fecMechanisms.includes(n)||c.rtpParameters.fecMechanisms.push(n)}c.rtpParameters.codecs.push({channels:t.channels,clockRate:t.clockRate,name:t.name,numChannels:t.channels,parameters:n,payloadType:parseInt(t.id,10),rtcpFeedback:i})}for(const e of n.headerExtensions||[])c.rtpParameters.headerExtensions.push({direction:(0,i.sendersToDirection)(t,e.senders||"both"),id:e.id,uri:e.uri,attributes:void 0})}if(s){if(s.usernameFragment&&s.password&&(c.iceParameters={password:s.password,usernameFragment:s.usernameFragment},s.iceLite&&(c.iceParameters.iceLite=!0)),s.fingerprints&&s.fingerprints.length){c.dtlsParameters={fingerprints:[],role:"auto"};for(const e of s.fingerprints)c.dtlsParameters.fingerprints.push({algorithm:e.algorithm,value:e.value});s.sctp&&(c.sctp=s.sctp),c.setup=s.fingerprints[0].setup}c.candidates=(s.candidates||[]).map(a)}return c}t.convertIntermediateToApplication=s,t.convertIntermediateToCandidate=o,t.convertCandidateToIntermediate=a,t.convertIntermediateToTransport=c,t.convertIntermediateToRequest=function(e,t,n){return{contents:e.media.map(e=>({application:"audio"===e.kind||"video"===e.kind?s(e,t):{applicationType:"datachannel",protocol:e.protocol},creator:i.JingleSessionRole.Initiator,name:e.mid,senders:(0,i.directionToSenders)(t,e.direction),transport:c(e,n)})),groups:e.groups?e.groups.map(e=>({contents:e.mids,semantics:e.semantics})):[]}},t.convertContentToIntermediate=u,t.convertRequestToIntermediate=function(e,t){const n={groups:[],media:[]};for(const t of e.groups||[])n.groups.push({mids:t.contents,semantics:t.semantics});for(const i of e.contents||[])n.media.push(u(i,t));return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(43),r=n(5),s=n(10),o={condition:r.StanzaErrorCondition.BadRequest},a={condition:r.StanzaErrorCondition.FeatureNotImplemented,jingleError:r.JingleErrorCondition.UnsupportedInfo,type:"modify"};t.default=class{constructor(e){this.parent=e.parent,this.sid=e.sid||(0,s.uuid)(),this.peerID=e.peerID,this.role=e.initiator?r.JingleSessionRole.Initiator:r.JingleSessionRole.Responder,this._sessionState="starting",this._connectionState="starting",this.pendingApplicationTypes=e.applicationTypes||[],this.pendingAction=void 0,this.processingQueue=(0,i.priorityQueue)(async(e,t)=>{if("ended"===this.state)return"local"===e.type&&e.reject&&e.reject(new Error("Session ended")),void(t&&t());if("local"===e.type){this._log("debug","Processing local action:",e.name);try{const t=await e.handler();e.resolve(t)}catch(t){e.reject(t)}return void(t&&t())}const{action:n,changes:i,cb:s}=e;return this._log("debug","Processing remote action:",n),new Promise(e=>{const o=(n,i)=>{s(n,i),t&&t(),e()};switch(n){case r.JingleAction.ContentAccept:return this.onContentAccept(i,o);case r.JingleAction.ContentAdd:return this.onContentAdd(i,o);case r.JingleAction.ContentModify:return this.onContentModify(i,o);case r.JingleAction.ContentReject:return this.onContentReject(i,o);case r.JingleAction.ContentRemove:return this.onContentRemove(i,o);case r.JingleAction.DescriptionInfo:return this.onDescriptionInfo(i,o);case r.JingleAction.SecurityInfo:return this.onSecurityInfo(i,o);case r.JingleAction.SessionAccept:return this.onSessionAccept(i,o);case r.JingleAction.SessionInfo:return this.onSessionInfo(i,o);case r.JingleAction.SessionInitiate:return this.onSessionInitiate(i,o);case r.JingleAction.SessionTerminate:return this.onSessionTerminate(i,o);case r.JingleAction.TransportAccept:return this.onTransportAccept(i,o);case r.JingleAction.TransportInfo:return this.onTransportInfo(i,o);case r.JingleAction.TransportReject:return this.onTransportReject(i,o);case r.JingleAction.TransportReplace:return this.onTransportReplace(i,o);default:this._log("error","Invalid or unsupported action: "+n),o({condition:r.StanzaErrorCondition.BadRequest})}})},1)}get isInitiator(){return this.role===r.JingleSessionRole.Initiator}get peerRole(){return this.isInitiator?r.JingleSessionRole.Responder:r.JingleSessionRole.Initiator}get state(){return this._sessionState}set state(e){e!==this._sessionState&&(this._log("info","Changing session state to: "+e),this._sessionState=e,this.parent&&this.parent.emit("sessionState",this,e))}get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._log("info","Changing connection state to: "+e),this._connectionState=e,this.parent&&this.parent.emit("connectionState",this,e))}send(e,t){(t=t||{}).sid=this.sid,t.action=e;new Set([r.JingleAction.ContentAccept,r.JingleAction.ContentAdd,r.JingleAction.ContentModify,r.JingleAction.ContentReject,r.JingleAction.ContentRemove,r.JingleAction.SessionAccept,r.JingleAction.SessionInitiate,r.JingleAction.TransportAccept,r.JingleAction.TransportReject,r.JingleAction.TransportReplace]).has(e)?this.pendingAction=e:this.pendingAction=void 0,this.parent.signal(this,{id:(0,s.uuid)(),jingle:t,to:this.peerID,type:"set"})}processLocal(e,t){return new Promise((n,i)=>{this.processingQueue.push({handler:t,name:e,reject:i,resolve:n,type:"local"},1)})}process(e,t,n){this.processingQueue.push({action:e,cb:n,changes:t,type:"remote"},2)}start(e,t){this._log("error","Can not start base sessions"),this.end("unsupported-applications",!0)}accept(e,t){this._log("error","Can not accept base sessions"),this.end("unsupported-applications")}cancel(){this.end("cancel")}decline(){this.end("decline")}end(e="success",t=!1){this.state="ended",this.processingQueue.kill(),"string"==typeof e&&(e={condition:e}),t||this.send("session-terminate",{reason:e}),this.parent.emit("terminated",this,e),this.parent.forgetSession(this)}_log(e,t,...n){this.parent&&(t=this.sid+": "+t,this.parent.emit("log",e,t,...n),this.parent.emit("log:"+e,t,...n))}onSessionInitiate(e,t){t()}onSessionAccept(e,t){t()}onSessionTerminate(e,t){this.end(e.reason,!0),t()}onSessionInfo(e,t){e.info?t(a):t()}onSecurityInfo(e,t){t(a)}onDescriptionInfo(e,t){t(a)}onTransportInfo(e,t){t(a)}onContentAdd(e,t){t(),this.send(r.JingleAction.ContentReject,{reason:{condition:r.JingleReasonCondition.FailedApplication,text:"content-add is not supported"}})}onContentAccept(e,t){t(o)}onContentReject(e,t){t(o)}onContentModify(e,t){t(o)}onContentRemove(e,t){t(o)}onTransportReplace(e,t){t(),this.send(r.JingleAction.TransportReject,{reason:{condition:r.JingleReasonCondition.FailedTransport,text:"transport-replace is not supported"}})}onTransportAccept(e,t){t(o)}onTransportReject(e,t){t(o)}}},function(e,t,n){"use strict";function i(e,...t){return(...n)=>e(...t,...n)}function r(e){return function(...t){var n=t.pop();return e.call(this,t,n)}}n.r(t),n.d(t,"all",(function(){return me})),n.d(t,"allLimit",(function(){return ge})),n.d(t,"allSeries",(function(){return ye})),n.d(t,"any",(function(){return tt})),n.d(t,"anyLimit",(function(){return nt})),n.d(t,"anySeries",(function(){return it})),n.d(t,"apply",(function(){return i})),n.d(t,"applyEach",(function(){return O})),n.d(t,"applyEachSeries",(function(){return j})),n.d(t,"asyncify",(function(){return d})),n.d(t,"auto",(function(){return D})),n.d(t,"autoInject",(function(){return J})),n.d(t,"cargo",(function(){return V})),n.d(t,"cargoQueue",(function(){return W})),n.d(t,"compose",(function(){return K})),n.d(t,"concat",(function(){return Z})),n.d(t,"concatLimit",(function(){return Y})),n.d(t,"concatSeries",(function(){return ee})),n.d(t,"constant",(function(){return te})),n.d(t,"default",(function(){return mt})),n.d(t,"detect",(function(){return ie})),n.d(t,"detectLimit",(function(){return re})),n.d(t,"detectSeries",(function(){return se})),n.d(t,"dir",(function(){return ae})),n.d(t,"doDuring",(function(){return ce})),n.d(t,"doUntil",(function(){return ue})),n.d(t,"doWhilst",(function(){return ce})),n.d(t,"during",(function(){return pt})),n.d(t,"each",(function(){return de})),n.d(t,"eachLimit",(function(){return pe})),n.d(t,"eachOf",(function(){return R})),n.d(t,"eachOfLimit",(function(){return A})),n.d(t,"eachOfSeries",(function(){return P})),n.d(t,"eachSeries",(function(){return he})),n.d(t,"ensureAsync",(function(){return fe})),n.d(t,"every",(function(){return me})),n.d(t,"everyLimit",(function(){return ge})),n.d(t,"everySeries",(function(){return ye})),n.d(t,"filter",(function(){return Se})),n.d(t,"filterLimit",(function(){return we})),n.d(t,"filterSeries",(function(){return Te})),n.d(t,"find",(function(){return ie})),n.d(t,"findLimit",(function(){return re})),n.d(t,"findSeries",(function(){return se})),n.d(t,"flatMap",(function(){return Z})),n.d(t,"flatMapLimit",(function(){return Y})),n.d(t,"flatMapSeries",(function(){return ee})),n.d(t,"foldl",(function(){return $})),n.d(t,"foldr",(function(){return ze})),n.d(t,"forEach",(function(){return de})),n.d(t,"forEachLimit",(function(){return pe})),n.d(t,"forEachOf",(function(){return R})),n.d(t,"forEachOfLimit",(function(){return A})),n.d(t,"forEachOfSeries",(function(){return P})),n.d(t,"forEachSeries",(function(){return he})),n.d(t,"forever",(function(){return Ie})),n.d(t,"groupBy",(function(){return Ae})),n.d(t,"groupByLimit",(function(){return Ne})),n.d(t,"groupBySeries",(function(){return Ee})),n.d(t,"inject",(function(){return $})),n.d(t,"log",(function(){return xe})),n.d(t,"map",(function(){return C})),n.d(t,"mapLimit",(function(){return X})),n.d(t,"mapSeries",(function(){return k})),n.d(t,"mapValues",(function(){return Ce})),n.d(t,"mapValuesLimit",(function(){return Re})),n.d(t,"mapValuesSeries",(function(){return Oe})),n.d(t,"memoize",(function(){return Pe})),n.d(t,"nextTick",(function(){return ke})),n.d(t,"parallel",(function(){return Le})),n.d(t,"parallelLimit",(function(){return Me})),n.d(t,"priorityQueue",(function(){return Ue})),n.d(t,"queue",(function(){return De})),n.d(t,"race",(function(){return Je})),n.d(t,"reduce",(function(){return $})),n.d(t,"reduceRight",(function(){return ze})),n.d(t,"reflect",(function(){return Ge})),n.d(t,"reflectAll",(function(){return He})),n.d(t,"reject",(function(){return We})),n.d(t,"rejectLimit",(function(){return $e})),n.d(t,"rejectSeries",(function(){return Qe})),n.d(t,"retry",(function(){return Xe})),n.d(t,"retryable",(function(){return Ze})),n.d(t,"select",(function(){return Se})),n.d(t,"selectLimit",(function(){return we})),n.d(t,"selectSeries",(function(){return Te})),n.d(t,"seq",(function(){return Q})),n.d(t,"series",(function(){return et})),n.d(t,"setImmediate",(function(){return l})),n.d(t,"some",(function(){return tt})),n.d(t,"someLimit",(function(){return nt})),n.d(t,"someSeries",(function(){return it})),n.d(t,"sortBy",(function(){return rt})),n.d(t,"timeout",(function(){return st})),n.d(t,"times",(function(){return at})),n.d(t,"timesLimit",(function(){return ot})),n.d(t,"timesSeries",(function(){return ct})),n.d(t,"transform",(function(){return ut})),n.d(t,"tryEach",(function(){return lt})),n.d(t,"unmemoize",(function(){return dt})),n.d(t,"until",(function(){return ht})),n.d(t,"waterfall",(function(){return ft})),n.d(t,"whilst",(function(){return pt})),n.d(t,"wrapSync",(function(){return d}));var s="function"==typeof queueMicrotask&&queueMicrotask,o="function"==typeof setImmediate&&setImmediate,a="object"==typeof process&&"function"==typeof process.nextTick;function c(e){setTimeout(e,0)}function u(e){return(t,...n)=>e(()=>t(...n))}var l=u(s?queueMicrotask:o?setImmediate:a?process.nextTick:c);function d(e){return f(e)?function(...t){const n=t.pop();return p(e.apply(this,t),n)}:r((function(t,n){var i;try{i=e.apply(this,t)}catch(e){return n(e)}if(i&&"function"==typeof i.then)return p(i,n);n(null,i)}))}function p(e,t){return e.then(e=>{h(t,null,e)},e=>{h(t,e&&(e instanceof Error||e.message)?e:new Error(e))})}function h(e,t,n){try{e(t,n)}catch(e){l(e=>{throw e},e)}}function f(e){return"AsyncFunction"===e[Symbol.toStringTag]}function m(e){if("function"!=typeof e)throw new Error("expected a function");return f(e)?d(e):e}function g(e,t){if(t||(t=e.length),!t)throw new Error("arity is undefined");return function(...n){return"function"==typeof n[t-1]?e.apply(this,n):new Promise((i,r)=>{n[t-1]=(e,...t)=>{if(e)return r(e);i(t.length>1?t:t[0])},e.apply(this,n)})}}function y(e){return function(t,...n){return g((function(i){var r=this;return e(t,(e,t)=>{m(e).apply(r,n.concat(t))},i)}))}}function b(e,t,n,i){t=t||[];var r=[],s=0,o=m(n);return e(t,(e,t,n)=>{var i=s++;o(e,(e,t)=>{r[i]=t,n(e)})},e=>{i(e,r)})}function _(e){return e&&"number"==typeof e.length&&e.length>=0&&e.length%1==0}var v={};function S(e){function t(...t){if(null!==e){var n=e;e=null,n.apply(this,t)}}return Object.assign(t,e),t}function w(e){if(_(e))return function(e){var t=-1,n=e.length;return function(){return++t<n?{value:e[t],key:t}:null}}(e);var t,n,i,r,s=function(e){return e[Symbol.iterator]&&e[Symbol.iterator]()}(e);return s?function(e){var t=-1;return function(){var n=e.next();return n.done?null:(t++,{value:n.value,key:t})}}(s):(n=(t=e)?Object.keys(t):[],i=-1,r=n.length,function e(){var s=n[++i];return"__proto__"===s?e():i<r?{value:t[s],key:s}:null})}function T(e){return function(...t){if(null===e)throw new Error("Callback was already called.");var n=e;e=null,n.apply(this,t)}}function I(e,t,n,i){let r=!1,s=!1,o=!1,a=0,c=0;function u(){a>=t||o||r||(o=!0,e.next().then(({value:e,done:t})=>{if(!s&&!r){if(o=!1,t)return r=!0,void(a<=0&&i(null));a++,n(e,c,l),c++,u()}}).catch(d))}function l(e,t){if(a-=1,!s)return e?d(e):!1===e?(r=!0,void(s=!0)):t===v||r&&a<=0?(r=!0,i(null)):void u()}function d(e){s||(o=!1,r=!0,i(e))}u()}var N=e=>(t,n,i)=>{if(i=S(i),e<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!t)return i(null);if("AsyncGenerator"===t[Symbol.toStringTag])return I(t,e,n,i);if(function(e){return"function"==typeof e[Symbol.asyncIterator]}(t))return I(t[Symbol.asyncIterator](),e,n,i);var r=w(t),s=!1,o=!1,a=0,c=!1;function u(e,t){if(!o)if(a-=1,e)s=!0,i(e);else if(!1===e)s=!0,o=!0;else{if(t===v||s&&a<=0)return s=!0,i(null);c||l()}}function l(){for(c=!0;a<e&&!s;){var t=r();if(null===t)return s=!0,void(a<=0&&i(null));a+=1,n(t.value,t.key,T(u))}c=!1}l()};var A=g((function(e,t,n,i){return N(t)(e,m(n),i)}),4);function E(e,t,n){n=S(n);var i=0,r=0,{length:s}=e,o=!1;function a(e,t){!1===e&&(o=!0),!0!==o&&(e?n(e):++r!==s&&t!==v||n(null))}for(0===s&&n(null);i<s;i++)t(e[i],i,T(a))}function x(e,t,n){return A(e,1/0,t,n)}var R=g((function(e,t,n){return(_(e)?E:x)(e,m(t),n)}),3);var C=g((function(e,t,n){return b(R,e,t,n)}),3),O=y(C);var P=g((function(e,t,n){return A(e,1,t,n)}),3);var k=g((function(e,t,n){return b(P,e,t,n)}),3),j=y(k);const L=Symbol("promiseCallback");function M(){let e,t;function n(n,...i){if(n)return t(n);e(i.length>1?i:i[0])}return n[L]=new Promise((n,i)=>{e=n,t=i}),n}function D(e,t,n){"number"!=typeof t&&(n=t,t=null),n=S(n||M());var i=Object.keys(e).length;if(!i)return n(null);t||(t=i);var r={},s=0,o=!1,a=!1,c=Object.create(null),u=[],l=[],d={};function p(e,t){u.push(()=>function(e,t){if(a)return;var i=T((t,...i)=>{if(s--,!1!==t)if(i.length<2&&([i]=i),t){var u={};if(Object.keys(r).forEach(e=>{u[e]=r[e]}),u[e]=i,a=!0,c=Object.create(null),o)return;n(t,u)}else r[e]=i,(c[e]||[]).forEach(e=>e()),h();else o=!0});s++;var u=m(t[t.length-1]);t.length>1?u(r,i):u(i)}(e,t))}function h(){if(!o){if(0===u.length&&0===s)return n(null,r);for(;u.length&&s<t;){u.shift()()}}}function f(t){var n=[];return Object.keys(e).forEach(i=>{const r=e[i];Array.isArray(r)&&r.indexOf(t)>=0&&n.push(i)}),n}return Object.keys(e).forEach(t=>{var n=e[t];if(!Array.isArray(n))return p(t,[n]),void l.push(t);var i=n.slice(0,n.length-1),r=i.length;if(0===r)return p(t,n),void l.push(t);d[t]=r,i.forEach(s=>{if(!e[s])throw new Error("async.auto task `"+t+"` has a non-existent dependency `"+s+"` in "+i.join(", "));!function(e,t){var n=c[e];n||(n=c[e]=[]);n.push(t)}(s,()=>{0===--r&&p(t,n)})})}),function(){var e,t=0;for(;l.length;)e=l.pop(),t++,f(e).forEach(e=>{0==--d[e]&&l.push(e)});if(t!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),h(),n[L]}var B=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,F=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,q=/,/,U=/(=.+)?(\s*)$/;function J(e,t){var n={};return Object.keys(e).forEach(t=>{var i,r=e[t],s=f(r),o=!s&&1===r.length||s&&0===r.length;if(Array.isArray(r))i=[...r],r=i.pop(),n[t]=i.concat(i.length>0?a:r);else if(o)n[t]=r;else{if(i=function(e){const t=function(e){let t="",n=0,i=e.indexOf("*/");for(;n<e.length;)if("/"===e[n]&&"/"===e[n+1]){let t=e.indexOf("\n",n);n=-1===t?e.length:t}else if(-1!==i&&"/"===e[n]&&"*"===e[n+1]){let r=e.indexOf("*/",n);-1!==r?(n=r+2,i=e.indexOf("*/",n)):(t+=e[n],n++)}else t+=e[n],n++;return t}(e.toString());let n=t.match(B);if(n||(n=t.match(F)),!n)throw new Error("could not parse args in autoInject\nSource:\n"+t);let[,i]=n;return i.replace(/\s/g,"").split(q).map(e=>e.replace(U,"").trim())}(r),0===r.length&&!s&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");s||i.pop(),n[t]=i.concat(a)}function a(e,t){var n=i.map(t=>e[t]);n.push(t),m(r)(...n)}}),D(n,t)}class z{constructor(){this.head=this.tail=null,this.length=0}removeLink(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e}empty(){for(;this.head;)this.shift();return this}insertAfter(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1}insertBefore(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1}unshift(e){this.head?this.insertBefore(this.head,e):G(this,e)}push(e){this.tail?this.insertAfter(this.tail,e):G(this,e)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var e=this.head;e;)yield e.data,e=e.next}remove(e){for(var t=this.head;t;){var{next:n}=t;e(t)&&this.removeLink(t),t=n}return this}}function G(e,t){e.length=1,e.head=e.tail=t}function H(e,t,n){if(null==t)t=1;else if(0===t)throw new RangeError("Concurrency must not be zero");var i=m(e),r=0,s=[];const o={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(e,t){return e?t?void(o[e]=o[e].filter(e=>e!==t)):o[e]=[]:Object.keys(o).forEach(e=>o[e]=[])}function c(e,...t){o[e].forEach(e=>e(...t))}var u=!1;function d(e,t,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");var r,s;function o(e,...t){return e?n?s(e):r():t.length<=1?r(t[0]):void r(t)}y.started=!0;var a=y._createTaskItem(e,n?o:i||o);if(t?y._tasks.unshift(a):y._tasks.push(a),u||(u=!0,l(()=>{u=!1,y.process()})),n||!i)return new Promise((e,t)=>{r=e,s=t})}function p(e){return function(t,...n){r-=1;for(var i=0,o=e.length;i<o;i++){var a=e[i],u=s.indexOf(a);0===u?s.shift():u>0&&s.splice(u,1),a.callback(t,...n),null!=t&&c("error",t,a.data)}r<=y.concurrency-y.buffer&&c("unsaturated"),y.idle()&&c("drain"),y.process()}}function h(e){return!(0!==e.length||!y.idle())&&(l(()=>c("drain")),!0)}const f=e=>t=>{if(!t)return new Promise((t,n)=>{!function(e,t){const n=(...i)=>{a(e,n),t(...i)};o[e].push(n)}(e,(e,i)=>{if(e)return n(e);t(i)})});a(e),function(e,t){o[e].push(t)}(e,t)};var g=!1,y={_tasks:new z,_createTaskItem:(e,t)=>({data:e,callback:t}),*[Symbol.iterator](){yield*y._tasks[Symbol.iterator]()},concurrency:t,payload:n,buffer:t/4,started:!1,paused:!1,push(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!1,t))}return d(e,!1,!1,t)},pushAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!1,!0,t))}return d(e,!1,!0,t)},kill(){a(),y._tasks.empty()},unshift(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!1,t))}return d(e,!0,!1,t)},unshiftAsync(e,t){if(Array.isArray(e)){if(h(e))return;return e.map(e=>d(e,!0,!0,t))}return d(e,!0,!0,t)},remove(e){y._tasks.remove(e)},process(){if(!g){for(g=!0;!y.paused&&r<y.concurrency&&y._tasks.length;){var e=[],t=[],n=y._tasks.length;y.payload&&(n=Math.min(n,y.payload));for(var o=0;o<n;o++){var a=y._tasks.shift();e.push(a),s.push(a),t.push(a.data)}r+=1,0===y._tasks.length&&c("empty"),r===y.concurrency&&c("saturated");var u=T(p(e));i(t,u)}g=!1}},length:()=>y._tasks.length,running:()=>r,workersList:()=>s,idle:()=>y._tasks.length+r===0,pause(){y.paused=!0},resume(){!1!==y.paused&&(y.paused=!1,l(y.process))}};return Object.defineProperties(y,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),y}function V(e,t){return H(e,1,t)}function W(e,t,n){return H(e,t,n)}var $=g((function(e,t,n,i){i=S(i);var r=m(n);return P(e,(e,n,i)=>{r(t,e,(e,n)=>{t=n,i(e)})},e=>i(e,t))}),4);function Q(...e){var t=e.map(m);return function(...e){var n=this,i=e[e.length-1];return"function"==typeof i?e.pop():i=M(),$(t,e,(e,t,i)=>{t.apply(n,e.concat((e,...t)=>{i(e,t)}))},(e,t)=>i(e,...t)),i[L]}}function K(...e){return Q(...e.reverse())}var X=g((function(e,t,n,i){return b(N(t),e,n,i)}),4);var Y=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(e,...n)=>e?t(e):t(e,n))},(e,t)=>{for(var n=[],r=0;r<t.length;r++)t[r]&&(n=n.concat(...t[r]));return i(e,n)})}),4);var Z=g((function(e,t,n){return Y(e,1/0,t,n)}),3);var ee=g((function(e,t,n){return Y(e,1,t,n)}),3);function te(...e){return function(...t){return t.pop()(null,...e)}}function ne(e,t){return(n,i,r,s)=>{var o,a=!1;const c=m(r);n(i,(n,i,r)=>{c(n,(i,s)=>i||!1===i?r(i):e(s)&&!o?(a=!0,o=t(!0,n),r(null,v)):void r())},e=>{if(e)return s(e);s(null,a?o:t(!1))})}}var ie=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(R,e,t,n)}),3);var re=g((function(e,t,n,i){return ne(e=>e,(e,t)=>t)(N(t),e,n,i)}),4);var se=g((function(e,t,n){return ne(e=>e,(e,t)=>t)(N(1),e,t,n)}),3);function oe(e){return(t,...n)=>m(t)(...n,(t,...n)=>{"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&n.forEach(t=>console[e](t)))})}var ae=oe("dir");var ce=g((function(e,t,n){n=T(n);var i,r=m(e),s=m(t);function o(e,...t){if(e)return n(e);!1!==e&&(i=t,s(...t,a))}function a(e,t){return e?n(e):!1!==e?t?void r(o):n(null,...i):void 0}return a(null,!0)}),3);function ue(e,t,n){const i=m(t);return ce(e,(...e)=>{const t=e.pop();i(...e,(e,n)=>t(e,!n))},n)}function le(e){return(t,n,i)=>e(t,i)}var de=g((function(e,t,n){return R(e,le(m(t)),n)}),3);var pe=g((function(e,t,n,i){return N(t)(e,le(m(n)),i)}),4);var he=g((function(e,t,n){return pe(e,1,t,n)}),3);function fe(e){return f(e)?e:function(...t){var n=t.pop(),i=!0;t.push((...e)=>{i?l(()=>n(...e)):n(...e)}),e.apply(this,t),i=!1}}var me=g((function(e,t,n){return ne(e=>!e,e=>!e)(R,e,t,n)}),3);var ge=g((function(e,t,n,i){return ne(e=>!e,e=>!e)(N(t),e,n,i)}),4);var ye=g((function(e,t,n){return ne(e=>!e,e=>!e)(P,e,t,n)}),3);function be(e,t,n,i){var r=new Array(t.length);e(t,(e,t,i)=>{n(e,(e,n)=>{r[t]=!!n,i(e)})},e=>{if(e)return i(e);for(var n=[],s=0;s<t.length;s++)r[s]&&n.push(t[s]);i(null,n)})}function _e(e,t,n,i){var r=[];e(t,(e,t,i)=>{n(e,(n,s)=>{if(n)return i(n);s&&r.push({index:t,value:e}),i(n)})},e=>{if(e)return i(e);i(null,r.sort((e,t)=>e.index-t.index).map(e=>e.value))})}function ve(e,t,n,i){return(_(t)?be:_e)(e,t,m(n),i)}var Se=g((function(e,t,n){return ve(R,e,t,n)}),3);var we=g((function(e,t,n,i){return ve(N(t),e,n,i)}),4);var Te=g((function(e,t,n){return ve(P,e,t,n)}),3);var Ie=g((function(e,t){var n=T(t),i=m(fe(e));return function e(t){if(t)return n(t);!1!==t&&i(e)}()}),2);var Ne=g((function(e,t,n,i){var r=m(n);return X(e,t,(e,t)=>{r(e,(n,i)=>n?t(n):t(n,{key:i,val:e}))},(e,t)=>{for(var n={},{hasOwnProperty:r}=Object.prototype,s=0;s<t.length;s++)if(t[s]){var{key:o}=t[s],{val:a}=t[s];r.call(n,o)?n[o].push(a):n[o]=[a]}return i(e,n)})}),4);function Ae(e,t,n){return Ne(e,1/0,t,n)}function Ee(e,t,n){return Ne(e,1,t,n)}var xe=oe("log");var Re=g((function(e,t,n,i){i=S(i);var r={},s=m(n);return N(t)(e,(e,t,n)=>{s(e,t,(e,i)=>{if(e)return n(e);r[t]=i,n(e)})},e=>i(e,r))}),4);function Ce(e,t,n){return Re(e,1/0,t,n)}function Oe(e,t,n){return Re(e,1,t,n)}function Pe(e,t=(e=>e)){var n=Object.create(null),i=Object.create(null),s=m(e),o=r((e,r)=>{var o=t(...e);o in n?l(()=>r(null,...n[o])):o in i?i[o].push(r):(i[o]=[r],s(...e,(e,...t)=>{e||(n[o]=t);var r=i[o];delete i[o];for(var s=0,a=r.length;s<a;s++)r[s](e,...t)}))});return o.memo=n,o.unmemoized=e,o}var ke=u(a?process.nextTick:o?setImmediate:c),je=g((e,t,n)=>{var i=_(t)?[]:{};e(t,(e,t,n)=>{m(e)((e,...r)=>{r.length<2&&([r]=r),i[t]=r,n(e)})},e=>n(e,i))},3);function Le(e,t){return je(R,e,t)}function Me(e,t,n){return je(N(t),e,n)}function De(e,t){var n=m(e);return H((e,t)=>{n(e[0],t)},t,1)}class Be{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(e){let t;for(;e>0&&qe(this.heap[e],this.heap[t=Fe(e)]);){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}percDown(e){let t;for(;(t=1+(e<<1))<this.heap.length&&(t+1<this.heap.length&&qe(this.heap[t+1],this.heap[t])&&(t+=1),!qe(this.heap[e],this.heap[t]));){let n=this.heap[e];this.heap[e]=this.heap[t],this.heap[t]=n,e=t}}push(e){e.pushCount=++this.pushCount,this.heap.push(e),this.percUp(this.heap.length-1)}unshift(e){return this.heap.push(e)}shift(){let[e]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),e}toArray(){return[...this]}*[Symbol.iterator](){for(let e=0;e<this.heap.length;e++)yield this.heap[e].data}remove(e){let t=0;for(let n=0;n<this.heap.length;n++)e(this.heap[n])||(this.heap[t]=this.heap[n],t++);this.heap.splice(t);for(let e=Fe(this.heap.length-1);e>=0;e--)this.percDown(e);return this}}function Fe(e){return(e+1>>1)-1}function qe(e,t){return e.priority!==t.priority?e.priority<t.priority:e.pushCount<t.pushCount}function Ue(e,t){var n=De(e,t),{push:i,pushAsync:r}=n;function s(e,t){return Array.isArray(e)?e.map(e=>({data:e,priority:t})):{data:e,priority:t}}return n._tasks=new Be,n._createTaskItem=({data:e,priority:t},n)=>({data:e,priority:t,callback:n}),n.push=function(e,t=0,n){return i(s(e,t),n)},n.pushAsync=function(e,t=0,n){return r(s(e,t),n)},delete n.unshift,delete n.unshiftAsync,n}var Je=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var n=0,i=e.length;n<i;n++)m(e[n])(t)}),2);function ze(e,t,n,i){var r=[...e].reverse();return $(r,t,n,i)}function Ge(e){var t=m(e);return r((function(e,n){return e.push((e,...t)=>{let i={};if(e&&(i.error=e),t.length>0){var r=t;t.length<=1&&([r]=t),i.value=r}n(null,i)}),t.apply(this,e)}))}function He(e){var t;return Array.isArray(e)?t=e.map(Ge):(t={},Object.keys(e).forEach(n=>{t[n]=Ge.call(this,e[n])})),t}function Ve(e,t,n,i){const r=m(n);return ve(e,t,(e,t)=>{r(e,(e,n)=>{t(e,!n)})},i)}var We=g((function(e,t,n){return Ve(R,e,t,n)}),3);var $e=g((function(e,t,n,i){return Ve(N(t),e,n,i)}),4);var Qe=g((function(e,t,n){return Ve(P,e,t,n)}),3);function Ke(e){return function(){return e}}function Xe(e,t,n){var i={times:5,intervalFunc:Ke(0)};if(arguments.length<3&&"function"==typeof e?(n=t||M(),t=e):(Ye(i,e),n=n||M()),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var r=m(t),s=1;function o(){r((e,...t)=>{!1!==e&&(e&&s++<i.times&&("function"!=typeof i.errorFilter||i.errorFilter(e))?setTimeout(o,i.intervalFunc(s-1)):n(e,...t))})}return o(),n[L]}function Ye(e,t){if("object"==typeof t)e.times=+t.times||5,e.intervalFunc="function"==typeof t.interval?t.interval:Ke(+t.interval||0),e.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");e.times=+t||5}}function Ze(e,t){t||(t=e,e=null);let n=e&&e.arity||t.length;f(t)&&(n+=1);var i=m(t);return r((t,r)=>{function s(e){i(...t,e)}return(t.length<n-1||null==r)&&(t.push(r),r=M()),e?Xe(e,s,r):Xe(s,r),r[L]})}function et(e,t){return je(P,e,t)}var tt=g((function(e,t,n){return ne(Boolean,e=>e)(R,e,t,n)}),3);var nt=g((function(e,t,n,i){return ne(Boolean,e=>e)(N(t),e,n,i)}),4);var it=g((function(e,t,n){return ne(Boolean,e=>e)(P,e,t,n)}),3);var rt=g((function(e,t,n){var i=m(t);return C(e,(e,t)=>{i(e,(n,i)=>{if(n)return t(n);t(n,{value:e,criteria:i})})},(e,t)=>{if(e)return n(e);n(null,t.sort(r).map(e=>e.value))});function r(e,t){var n=e.criteria,i=t.criteria;return n<i?-1:n>i?1:0}}),3);function st(e,t,n){var i=m(e);return r((r,s)=>{var o,a=!1;r.push((...e)=>{a||(s(...e),clearTimeout(o))}),o=setTimeout((function(){var t=e.name||"anonymous",i=new Error('Callback function "'+t+'" timed out.');i.code="ETIMEDOUT",n&&(i.info=n),a=!0,s(i)}),t),i(...r)})}function ot(e,t,n,i){var r=m(n);return X(function(e){for(var t=Array(e);e--;)t[e]=e;return t}(e),t,r,i)}function at(e,t,n){return ot(e,1/0,t,n)}function ct(e,t,n){return ot(e,1,t,n)}function ut(e,t,n,i){arguments.length<=3&&"function"==typeof t&&(i=n,n=t,t=Array.isArray(e)?[]:{}),i=S(i||M());var r=m(n);return R(e,(e,n,i)=>{r(t,e,n,i)},e=>i(e,t)),i[L]}var lt=g((function(e,t){var n,i=null;return he(e,(e,t)=>{m(e)((e,...r)=>{if(!1===e)return t(e);r.length<2?[n]=r:n=r,i=e,t(e?null:{})})},()=>t(i,n))}));function dt(e){return(...t)=>(e.unmemoized||e)(...t)}var pt=g((function(e,t,n){n=T(n);var i=m(t),r=m(e),s=[];function o(e,...t){if(e)return n(e);s=t,!1!==e&&r(a)}function a(e,t){return e?n(e):!1!==e?t?void i(o):n(null,...s):void 0}return r(a)}),3);function ht(e,t,n){const i=m(e);return pt(e=>i((t,n)=>e(t,!n)),t,n)}var ft=g((function(e,t){if(t=S(t),!Array.isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var n=0;function i(t){m(e[n++])(...t,T(r))}function r(r,...s){if(!1!==r)return r||n===e.length?t(r,...s):void i(s)}i([])})),mt={apply:i,applyEach:O,applyEachSeries:j,asyncify:d,auto:D,autoInject:J,cargo:V,cargoQueue:W,compose:K,concat:Z,concatLimit:Y,concatSeries:ee,constant:te,detect:ie,detectLimit:re,detectSeries:se,dir:ae,doUntil:ue,doWhilst:ce,each:de,eachLimit:pe,eachOf:R,eachOfLimit:A,eachOfSeries:P,eachSeries:he,ensureAsync:fe,every:me,everyLimit:ge,everySeries:ye,filter:Se,filterLimit:we,filterSeries:Te,forever:Ie,groupBy:Ae,groupByLimit:Ne,groupBySeries:Ee,log:xe,map:C,mapLimit:X,mapSeries:k,mapValues:Ce,mapValuesLimit:Re,mapValuesSeries:Oe,memoize:Pe,nextTick:ke,parallel:Le,parallelLimit:Me,priorityQueue:Ue,queue:De,race:Je,reduce:$,reduceRight:ze,reflect:Ge,reflectAll:He,reject:We,rejectLimit:$e,rejectSeries:Qe,retry:Xe,retryable:Ze,seq:Q,series:et,setImmediate:l,some:tt,someLimit:nt,someSeries:it,sortBy:rt,timeout:st,times:at,timesLimit:ot,timesSeries:ct,transform:ut,tryEach:lt,unmemoize:dt,until:ht,waterfall:ft,whilst:pt,all:me,allLimit:ge,allSeries:ye,any:tt,anyLimit:nt,anySeries:it,find:ie,findLimit:re,findSeries:se,flatMap:Z,flatMapLimit:Y,flatMapSeries:ee,forEach:de,forEachSeries:he,forEachLimit:pe,forEachOf:R,forEachOfSeries:P,forEachOfLimit:A,inject:$,foldl:$,foldr:ze,select:Se,selectLimit:we,selectSeries:Te,wrapSync:d,during:pt,doDuring:ce}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GenesysCloudMediaSession=void 0;const i=n(16).__importDefault(n(65)),r=n(6),s=n(18),o=n(11),a=n(21);t.GenesysCloudMediaSession=class{constructor(e,t){this.webrtcExtension=e,this.iceCandidatesDiscovered=0,this.iceCandidatesReceivedFromPeer=0,this.state="pending",this.connectionState="starting",this.id=t.id,this.fromJid=t.fromJid,this.peerID=t.peerID,this.logger=t.logger,this.conversationId=t.conversationId,this.fromUserId=t.fromUserId,this.pc=this.peerConnection=new RTCPeerConnection({iceServers:t.iceServers,iceTransportPolicy:t.iceTransportPolicy}),this.originalRoomJid=t.originalRoomJid,this.sessionType=a.SessionTypes[t.sessionType],this.ignoreHostCandidatesFromRemote=!!t.ignoreHostCandidatesFromRemote,this.allowIPv6=!!t.allowIPv6,this.allowTCP=!!t.allowTCP,this.reinvite=!!t.reinvite;const n=new r.EventEmitter;Object.keys(n.__proto__).forEach(e=>{this[e]=n[e]}),t.optOutOfWebrtcStatsTelemetry||this.setupStatsGatherer(),this.peerConnection.addEventListener("icecandidate",this.onIceCandidate.bind(this)),this.peerConnection.addEventListener("iceconnectionstatechange",this.onIceStateChange.bind(this)),this.peerConnection.addEventListener("connectionstatechange",this.onConnectionStateChange.bind(this)),this.peerConnection.addEventListener("icecandidateerror",this.onIceCandidateError.bind(this))}async setRemoteDescription(e){return this.peerConnection.setRemoteDescription({sdp:e,type:"offer"})}getLogDetails(){return{conversationId:this.conversationId,sessionId:this.id,sessionType:this.sessionType}}log(e,t,n,i){n||(n={});const r={...n,...this.getLogDetails()};this.logger[e](t,r,i)}async sendGenesysWebrtc(e){e.id=e.id||s.v4(),e.jsonrpc=e.jsonrpc||"2.0";const t={type:"set",genesysWebrtc:e,from:this.webrtcExtension.jid,to:this.peerID};return this.webrtcExtension.sendIq(t)}async end(e="success",t=!1){this.state="ended";const n={sessionId:this.id,reason:e.condition||e};t||await o.timeoutPromise((e,t)=>this.sendGenesysWebrtc({jsonrpc:"2.0",method:"terminate",params:n}).then(e,t),2e3,"Timeout waiting for response to termination request",{sessionId:this.id,conversationId:this.conversationId,sessionType:this.sessionType}).catch(e=>this.logger.error(e)),this.onSessionTerminate(n.reason)}setupStatsGatherer(){this.statsGatherer=new i.default(this.peerConnection),this.statsGatherer.on("stats",this.emit.bind(this,"stats"))}async onIceStateChange(){const e=this.peerConnection.iceConnectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","ICE state changed: ",{iceState:e,sessionId:t,conversationId:n}),"disconnected"===e)"stable"===this.peerConnection.signalingState&&(this.interruptionStart=new Date,this.log("info","Connection state is interrupted",{sessionId:t,conversationId:n,sessionType:i}));else if("connected"===e){this.log("info","sending session-info: active");const e={sessionId:this.id,status:"active"};await this.sendGenesysWebrtc({jsonrpc:"2.0",params:e,method:"info"}),this._setupDataChannel()}else"failed"===e&&this.log("info","ICE connection failed",{candidatesDiscovered:this.iceCandidatesDiscovered,candidatesReceivedFromPeer:this.iceCandidatesReceivedFromPeer})}onConnectionStateChange(){const e=this.connectionState=this.peerConnection.connectionState,t=this.id,n=this.conversationId,i=this.sessionType;if(this.log("info","Connection state changed: ",{connectionState:e,sessionId:t,conversationId:n,sessionType:i}),this.interruptionStart)if("connected"===e){const e=(new Date).getTime()-this.interruptionStart.getTime();this.log("info","Connection was interrupted but was successfully recovered/connected",{sessionId:t,conversationId:n,sessionType:i,timeToRecover:e}),this.interruptionStart=void 0}else"failed"===e&&this.log("info","Connection was interrupted and failed to recover",{sessionId:t,conversationId:n,sessionType:i})}onIceCandidateError(e){const t=e;this.log("error","IceCandidateError",{errorCode:t.errorCode,errorText:t.errorText,url:t.url})}createIceCandidate(e,t){return new RTCIceCandidate({sdpMid:e,candidate:t})}async addRemoteIceCandidate(e){const t=e.match(/m=([^\s]+)/)[1],n=e.match(/a=([^\\\r]+)/)[1],i=this.createIceCandidate(t,n);await this.peerConnection.addIceCandidate(i)}onIceCandidate(e){var t,n;let i,r=null===(t=e.candidate)||void 0===t?void 0:t.candidate,s=null===(n=e.candidate)||void 0===n?void 0:n.sdpMid;if(e.candidate){if(!this.allowTCP&&"tcp"===e.candidate.protocol)return;if(!this.allowIPv6){const t=/.+udp [^ ]+ ([^ ]+).*typ host/.exec(e.candidate.candidate),n=/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;if(t&&!t[1].match(n))return void this.log("debug","Filtering out IPv6 candidate",e.candidate.candidate)}this.log("debug","Processing ice candidate",e.candidate),this.log("info","Discovered ice candidate to send to peer",{type:e.candidate.type}),this.iceCandidatesDiscovered++,i=`m=${s} 9 RTP/AVP 0\r\na=${r}`}else i="a=end-of-candidates",this.emit("endOfCandidates");return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"iceCandidate",params:{sessionId:this.id,sdp:i}})}onSessionTerminate(e){this.peerConnection&&this.peerConnection.close(),this.emit("terminated",{condition:e||"success"})}async addTrack(e,t){const n=this.peerConnection.getTransceivers().find(t=>{var n;return!t.sender.track&&(null===(n=t.receiver.track)||void 0===n?void 0:n.kind)===e.kind});if(n)return n.sender.replaceTrack(e);this.peerConnection.addTrack(e,t)}_setupDataChannel(){var e;this.dataChannel||(null===(e=this.peerConnection.remoteDescription)||void 0===e?void 0:e.sdp.includes("webrtc-datachannel"))&&(this.log("info","creating data channel"),this.dataChannel=this.peerConnection.createDataChannel("videoConferenceControl"),this.dataChannel.addEventListener("open",()=>{this.log("info","data channel opened")}),this.dataChannel.addEventListener("message",this._handleDataChannelMessage.bind(this)),this.dataChannel.addEventListener("close",()=>{this.log("info","closing data channel")}),this.dataChannel.addEventListener("error",e=>{this.log("error","Error occurred with the data channel",e)}))}_handleDataChannelMessage(e){try{const t=JSON.parse(e.data);this.emit("dataChannelMessage",t)}catch(e){this.log("error","Failed to parse data channel message",{error:e})}}async accept(){this.state="active";const e=await this.peerConnection.createAnswer();await this.peerConnection.setLocalDescription(e);const t={sdp:e.sdp,sessionId:this.id};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"answer",params:t})}async mute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"mute",params:n})}async unmute(e,t){const n={sessionId:this.id,type:t};return this.sendGenesysWebrtc({jsonrpc:"2.0",method:"unmute",params:n})}async removeTrack(){throw new Error("Not Implemented")}async hold(){throw new Error("Not Implemented")}async resume(){throw new Error("Not Implemented")}toString(){return{connectionState:this.connectionState,state:this.state,sessionType:this.sessionType,fromJid:this.fromJid,conversationId:this.conversationId,id:this.id,peerConnection:this.peerConnection}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.core=void 0;const i=n(3);(0,i.__exportStar)(n(69),t),(0,i.__exportStar)(n(70),t),(0,i.__exportStar)(n(71),t),(0,i.__exportStar)(n(72),t),(0,i.__exportStar)(n(73),t),(0,i.__exportStar)(n(74),t),(0,i.__exportStar)(n(75),t),(0,i.__exportStar)(n(76),t),(0,i.__exportStar)(n(77),t),(0,i.__exportStar)(n(78),t),(0,i.__exportStar)(n(79),t),(0,i.__exportStar)(n(81),t),(0,i.__exportStar)(n(82),t),(0,i.__exportStar)(n(83),t),(0,i.__exportStar)(n(84),t),(0,i.__exportStar)(n(85),t),(0,i.__exportStar)(n(86),t),(0,i.__exportStar)(n(87),t);const r=(0,i.__importDefault)(n(69)),s=(0,i.__importDefault)(n(70)),o=(0,i.__importDefault)(n(71)),a=(0,i.__importDefault)(n(72)),c=(0,i.__importDefault)(n(73)),u=(0,i.__importDefault)(n(74)),l=(0,i.__importDefault)(n(75)),d=(0,i.__importDefault)(n(76)),p=(0,i.__importDefault)(n(77)),h=(0,i.__importDefault)(n(78)),f=(0,i.__importDefault)(n(79)),m=(0,i.__importDefault)(n(81)),g=(0,i.__importDefault)(n(82)),y=(0,i.__importDefault)(n(83)),b=(0,i.__importDefault)(n(84)),_=(0,i.__importDefault)(n(85)),v=(0,i.__importDefault)(n(86)),S=(0,i.__importDefault)(n(87));t.core=function(e){e.use(d.default),e.use(u.default),e.use(o.default),e.use(c.default),e.use(p.default),e.use(v.default)},t.default=function(e){e.use(r.default),e.use(m.default),e.use(s.default),e.use(a.default),e.use(l.default),e.use(h.default),e.use(f.default),e.use(g.default),e.use(y.default),e.use(b.default),e.use(_.default),e.use(S.default)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"XRD",fields:{subject:(0,i.childText)(null,"Subject")},namespace:r.NS_XRD,path:"xrd"},{aliases:[{path:"xrd.links",multiple:!0}],element:"Link",fields:{href:(0,i.attribute)("href"),rel:(0,i.attribute)("rel"),type:(0,i.attribute)("type")},namespace:r.NS_XRD}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessengerExtension=void 0;const i=n(228),r=n(8),s=n(18);class o extends i.Emitter{constructor(e,t){super(),this.client=e,this.stanzaInstance=t}get bareJid(){return r.toBare(this.stanzaInstance.jid)}handleStanzaInstanceChange(e){this.stanzaInstance=e}isMediaMessage(e){return!!e.mediaMessage}handleMessage(e){if(!this.isMediaMessage(e))return;const t=e.from===this.stanzaInstance.jid,n=r.toBare(e.from)===this.bareJid;this.emit("mediaMessage",{...e,fromMyClient:t,fromMyUser:n})}async broadcastMessage(e){const t=s.v4();return e.id=t,e.from=this.stanzaInstance.jid,e.to||(e.to=this.bareJid),await this.stanzaInstance.send("message",e),t}get expose(){return{broadcastMessage:this.broadcastMessage.bind(this),on:this.on.bind(this),once:this.once.bind(this),off:this.off.bind(this),removeListener:this.removeListener.bind(this),addListener:this.addListener.bind(this)}}}t.MessengerExtension=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const i=n(16),r=n(173),s=n(229);n(187);const o=n(188),a=n(190),c=n(215),u=n(216),l=n(11),d=n(27),p=i.__importDefault(n(6)),h=n(217),f=n(49),m=i.__importDefault(n(227)),g=i.__importDefault(n(169)),y=n(53),b=n(47);let _={notifications:o.Notifications,webrtcSessions:a.WebrtcExtension,messenger:b.MessengerExtension};class v extends p.default{constructor(e){super(),this.connected=!1,this.connecting=!1,this.hardReconnectRequired=!0,this.isGuest=!1,this.backgroundAssistantMode=!1,this.autoReconnect=!0,this.extensions=[],this.channelReuses=0,this.hasMadeInitialAttempt=!1,this.http=new d.HttpClient,this.reconnectOnNoLongerSubscribed=!1!==e.reconnectOnNoLongerSubscribed,this.useServerSidePings=!1!==e.useServerSidePings,this.config={host:e.host,apiHost:e.apiHost||e.host.replace("wss://streaming.",""),authToken:e.authToken,jwt:e.jwt,jid:e.jid,jidResource:e.jidResource,channelId:null,appName:e.appName,appVersion:e.appVersion,appId:e.appId,customHeaders:e.customHeaders},this.backgroundAssistantMode=this.checkIsBackgroundAssistant(),this.isGuest=!this.backgroundAssistantMode&&!e.authToken;let t=e.authToken||"",n=`https://api.${this.config.apiHost}/api/v2/diagnostics/trace`;this.backgroundAssistantMode&&(t=e.jwt,n+="/backgroundassistant"),this.logger=new s.Logger({accessToken:t,url:n,uploadDebounceTime:1e3,initializeServerLogging:!this.isGuest&&!e.optOutOfWebrtcStatsTelemetry,appVersion:v.version,appName:"streaming-client",logLevel:this.config.logLevel||"info",logger:e.logger||console,formatters:e.logFormatters,originAppName:e.appName,originAppVersion:e.appVersion,originAppId:e.appId,customHeaders:e.customHeaders}),this.connectionManager=new h.ConnectionManager(this.logger,this.config),Object.keys(_).forEach(t=>{const n=new _[t](this,e);this.extensions.push(n),n.tokenBucket||(n.tokenBucket=new r.TokenBucket(20,25,1e3),n.tokenBucket.content=25),"function"==typeof n.on&&n.on("send",this.handleSendEventFromExtension.bind(this,n)),this[t]=n.expose,this["_"+t]=n})}handleSendEventFromExtension(e,t,n=!1){return e.tokenBucket.removeTokens(1,()=>{const e=this.activeStanzaInstance;return e?!0===n?e.sendMessage(t):e.sendIQ(t):this.logger.warn("cannot send message, no active stanza client",{data:t,message:n},{skipServer:!0})})}checkIsBackgroundAssistant(){if(this.config.jwt){const e=l.parseJwt(this.config.jwt);return e&&"urn:purecloud:screenrecording"===e.iss}return!1}addInateEventHandlers(e){this.removeStanzaBoundEventHandlers(),this.boundStanzaDisconnect=this.handleStanzaDisconnectedEvent.bind(this,e),this.boundStanzaNoLongerSubscribed=this.handleNoLongerSubscribed.bind(this,e),this.boundStanzaDuplicateId=this.handleDuplicateId.bind(this,e),this.on("stanzaDisconnected",this.boundStanzaDisconnect),this.on("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.on("notify:duplicate_id",this.boundStanzaDuplicateId),this.extensions.forEach(t=>{"function"==typeof t.handleIq&&e.on("iq",t.handleIq.bind(t)),"function"==typeof t.handleMessage&&e.on("message",t.handleMessage.bind(t))})}removeStanzaBoundEventHandlers(){this.boundStanzaDisconnect&&(this.off("stanzaDisconnected",this.boundStanzaDisconnect),this.boundStanzaDisconnect=void 0),this.boundStanzaNoLongerSubscribed&&(this.off("notify:no_longer_subscribed",this.boundStanzaNoLongerSubscribed),this.boundStanzaNoLongerSubscribed=void 0),this.boundStanzaDuplicateId&&(this.off("notify:duplicate_id",this.boundStanzaDuplicateId),this.boundStanzaDuplicateId=void 0)}proxyStanzaEvents(e){e.originalEmitter=e.emit,e.emit=(t,...n)=>{const i=e.originalEmitter(t,...n);return"connected"===t?i:("disconnected"===t&&(t="stanzaDisconnected"),this.emit(t,...n))}}async handleStanzaDisconnectedEvent(e){var t,n;if(this.logger.info("stanzaDisconnected event received",{stanzaInstanceId:e.id,channelId:e.channelId}),this.connected=!1,this.connecting=!1,null===(t=e.pinger)||void 0===t||t.stop(),null===(n=e.serverMonitor)||void 0===n||n.stop(),this.removeAllListeners("stanzaDisconnected"),this.removeAllListeners("notify:no_longer_subscribed"),e.originalEmitter&&(e.emit=e.originalEmitter),this.activeStanzaInstance=void 0,this.emit("disconnected",{reconnecting:this.autoReconnect}),this.autoReconnect)return this.connect({keepTryingOnFailure:!0})}handleNoLongerSubscribed(e){var t,n;this.logger.warn("noLongerSubscribed event received",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),null===(n=e.serverMonitor)||void 0===n||n.stop(),this.hardReconnectRequired=!0,this.reconnectOnNoLongerSubscribed||(this.autoReconnect=!1)}handleDuplicateId(e){var t,n;this.logger.warn("duplicate_id event received, forcing hard reconnect",{stanzaInstanceId:e.id,channelId:e.channelId}),null===(t=e.pinger)||void 0===t||t.stop(),null===(n=e.serverMonitor)||void 0===n||n.stop(),this.hardReconnectRequired=!0}async disconnect(){if(this.logger.info("streamingClient.disconnect was called"),this.activeStanzaInstance)return l.timeoutPromise(e=>(this.autoReconnect=!1,this.http.stopAllRetries(),this.activeStanzaInstance.disconnect().then(e)),5e3,"disconnecting streaming service")}getConnectionData(){const e=sessionStorage.getItem("sc_connectionData"),t={currentDelayMs:0};if(e)try{return JSON.parse(e)}catch(e){return this.logger.warn("failed to parse streaming client connection data"),t}return t}setConnectionData(e){sessionStorage.setItem("sc_connectionData",JSON.stringify(e))}increaseBackoff(){const e=this.getConnectionData(),t=Math.max(2*e.currentDelayMs,2e3);this.setConnectionData({currentDelayMs:t,delayMsAfterNextReduction:t/2,nextDelayReductionTime:(new Date).getTime()+5*t,timeOfTotalReset:(new Date).getTime()+36e5})}decreaseBackoff(e){const t=this.getConnectionData(),n=5*e,i={currentDelayMs:e,delayMsAfterNextReduction:e/2,nextDelayReductionTime:(new Date).getTime()+n,timeOfTotalReset:t.timeOfTotalReset};if(t.timeOfTotalReset&&t.timeOfTotalReset<(new Date).getTime()||e<2e3)return this.logger.debug("decreaseBackoff() called, but timeOfTotalReset has elasped or next delay is below 2s. Resetting backoff"),this.setConnectionData({currentDelayMs:0});this.setConnectionData(i),clearTimeout(this.backoffReductionTimer),this.logger.debug("Setting timer for next backoff reduction since we haven't reached total reset",{msUntilReduction:n,delayMsAfterNextReduction:i.delayMsAfterNextReduction}),this.backoffReductionTimer=setTimeout(()=>this.decreaseBackoff(i.delayMsAfterNextReduction),n)}getStartingDelay(e,t){const n=Math.max(e.currentDelayMs,2e3);return e.timeOfTotalReset&&e.timeOfTotalReset<(new Date).getTime()?2e3:Math.min(n,t)}async connect(e){var t;if(this.connecting){const e=new Error("Already trying to connect streaming client");return this.logger.warn(e)}this.connecting=!0;const n=(null==e?void 0:e.maxDelayBetweenConnectionAttempts)||9e4;let i=(null==e?void 0:e.maxConnectionAttempts)||1;(null==e?void 0:e.keepTryingOnFailure)&&(i=1/0),clearTimeout(this.backoffReductionTimer);const r=this.getConnectionData(),s=this.getStartingDelay(r,n),o=this.hasMadeInitialAttempt;this.hasMadeInitialAttempt=!0;try{await f.backOff(async()=>{const e=this.getConnectionData();if(await this.makeConnectionAttempt(),e.nextDelayReductionTime){const t=e.nextDelayReductionTime-(new Date).getTime();this.logger.debug("Setting timer for next backoff reduction",{msUntilReduction:t,delayMsAfterNextReduction:e.delayMsAfterNextReduction}),this.backoffReductionTimer=setTimeout(()=>this.decreaseBackoff(e.delayMsAfterNextReduction||0),t)}},{jitter:"none",maxDelay:n,numOfAttempts:i,startingDelay:s,delayFirstAttempt:o,retry:this.backoffConnectRetryHandler.bind(this,{maxConnectionAttempts:i})})}catch(e){let n=e;if(e){if("AxiosError"===e.name){const i=e,r=i.config||{url:void 0,method:void 0};n={config:{url:r.url,method:r.method},status:null===(t=i.response)||void 0===t?void 0:t.status,code:i.code,name:i.name,message:i.message}}}else n=new Error("Streaming client connection attempted received and undefined error");if(this.logger.error("Failed to connect streaming client",{error:n}),!e)throw n;throw e}}async backoffConnectRetryHandler(e,t,n){var i,r,s,o,a;if(n>=e.maxConnectionAttempts)return!1;const c={connectionAttempt:n,error:t};if(t){if("AxiosError"===t.name){const e=t,n=e.config||{url:void 0,method:void 0};let s={config:{url:n.url,method:n.method},status:null===(i=e.response)||void 0===i?void 0:i.status,code:e.code,name:e.name,message:e.message};if(c.error=s,[401,403].includes((null===(r=t.response)||void 0===r?void 0:r.status)||0))return this.logger.error("Streaming client received an error that it can't recover from and will not attempt to reconnect",c),!1}}else c.error=new Error("streaming client backoff handler received undefined error");if(t instanceof g.default&&(this.logger.info("hardReconnectRequired set to true due to sasl error"),this.hardReconnectRequired=!0,Object.assign(c,{channelId:t.channelId,stanzaInstanceId:t.stanzaInstanceId})),t instanceof y.TimeoutError){c.error=t.message;const e=t.details;e&&(c.details=e)}if(null==t?void 0:t.response){const e=(null===(s=t.response.headers)||void 0===s?void 0:s["retry-after"])||(null===(a=(o=t.response).getResponseHeader)||void 0===a?void 0:a.call(o,"retry-after"));if(e){let n=1e3*parseInt(e,10);return c.retryDelay=n,this.logger.error("Failed streaming client connection attempt, respecting retry-after header and will retry afterwards.",c,{skipServer:t instanceof m.default}),await l.delay(n),this.logger.debug("finished waiting for retry-after"),!0}}return this.logger.error("Failed streaming client connection attempt, retrying",c,{skipServer:t instanceof m.default}),this.increaseBackoff(),!0}async makeConnectionAttempt(){var e,t;if(!navigator.onLine)throw new m.default("Browser is offline, skipping connection attempt");let n,i=this.connecting;try{await this.prepareForConnect(),n=await this.connectionManager.getNewStanzaConnection(),this.connected=!0,this.connecting=!1,this.addInateEventHandlers(n),this.proxyStanzaEvents(n);for(const e of this.extensions)e.configureNewStanzaInstance&&await e.configureNewStanzaInstance(n);for(const e of this.extensions)e.handleStanzaInstanceChange(n);this.activeStanzaInstance=n,await this.setupConnectionMonitoring(n),this.emit("connected")}catch(r){throw n&&(this.logger.error("Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected",{stanzaInstanceId:n.id,channelId:n.channelId}),this.removeStanzaBoundEventHandlers(),null===(e=n.pinger)||void 0===e||e.stop(),null===(t=n.serverMonitor)||void 0===t||t.stop(),await n.disconnect(),this.connected=!1,this.connecting=i),r}}async setupConnectionMonitoring(e){const t=t=>{const n=t+", falling back to client-side pinging";this.logger.warn(n,{stanzaInstanceId:e.id,channelId:e.channelId}),e.pinger=new c.Ping(this,e)};if(this.useServerSidePings)try{await e.subscribeToNode(this._notifications.pubsubHost,"enable.server.side.pings"),e.serverMonitor=new u.ServerMonitor(this,e)}catch(e){t("failed to establish server-side pinging")}else t("client configured to not use server-side pinging")}async prepareForConnect(){if(this.config.jwt)return this.hardReconnectRequired=!1,this.connectionManager.setConfig(this.config);if(this.hardReconnectRequired||(this.channelReuses++,this.channelReuses>=10&&(this.logger.warn("Forcing a hard reconnect due to max channel reuses",{channelId:this.config.channelId,channelReuses:this.channelReuses}),this.channelReuses=0,this.hardReconnectRequired=!0)),this.hardReconnectRequired){let e;if(this.config.jid)e=Promise.resolve(this.config.jid);else{const t={method:"get",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger,customHeaders:this.config.customHeaders};e=this.http.requestApi("users/me",t).then(e=>e.data.chat.jabberId)}const t={method:"post",host:this.config.apiHost,authToken:this.config.authToken,logger:this.logger,customHeaders:this.config.customHeaders},n=this.http.requestApi("notifications/channels?connectionType=streaming",t).then(e=>e.data.id),[i,r]=await Promise.all([e,n]);this.config.jid=i,this.config.channelId=r,this.autoReconnect=!0,this.logger.info("attempting to connect streaming client on channel",{channelId:r}),this.connectionManager.setConfig(this.config),this.hardReconnectRequired=!1}}stopServerLogging(){this.logger.sendAllLogsInstantly(),this._webrtcSessions.flushStats(),this.logger.stopServerLogging()}startServerLogging(){this.logger.startServerLogging()}setAccessToken(e){this.config.authToken=e,this.logger.setAccessToken(e)}static extend(e,t){if(_[e])throw new Error("Cannot register already existing namespace "+e);_[e]=t}get version(){return v.version}static get version(){return"17.2.2"}}t.Client=v},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(176),o=n(177);t.backOff=function(e,t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var n;return r(this,(function(i){switch(i.label){case 0:return n=s.getSanitizedOptions(t),[4,new a(e,n).execute()];case 1:return[2,i.sent()]}}))}))};var a=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return i(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return i(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,o.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()},function(e,t,n){"use strict";var i={};n.r(i),n.d(i,"hasBrowserEnv",(function(){return y})),n.d(i,"hasStandardBrowserWebWorkerEnv",(function(){return v})),n.d(i,"hasStandardBrowserEnv",(function(){return b}));var r=n(0),s=n(30),o=n(14);function a(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function c(e,t){this._pairs=[],e&&Object(o.a)(e,this,t)}const u=c.prototype;u.append=function(e,t){this._pairs.push([e,t])},u.toString=function(e){const t=e?function(t){return e.call(this,t,a)}:a;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var l=c;function d(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function p(e,t,n){if(!t)return e;const i=n&&n.encode||d,s=n&&n.serialize;let o;if(o=s?s(t,n):r.a.isURLSearchParams(t)?t.toString():new l(t,n).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}var h=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){r.a.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},f=n(4),m={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},g={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:l,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const y="undefined"!=typeof window&&"undefined"!=typeof document,b=(_="undefined"!=typeof navigator&&navigator.product,y&&["ReactNative","NativeScript","NS"].indexOf(_)<0);var _;const v="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var S={...i,...g};var w=function(e){function t(e,n,i,s){let o=e[s++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),c=s>=e.length;if(o=!o&&r.a.isArray(i)?i.length:o,c)return r.a.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!a;i[o]&&r.a.isObject(i[o])||(i[o]=[]);return t(e,n,i[o],s)&&r.a.isArray(i[o])&&(i[o]=function(e){const t={},n=Object.keys(e);let i;const r=n.length;let s;for(i=0;i<r;i++)s=n[i],t[s]=e[s];return t}(i[o])),!a}if(r.a.isFormData(e)&&r.a.isFunction(e.entries)){const n={};return r.a.forEachEntry(e,(e,i)=>{t(function(e){return r.a.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),i,n,0)}),n}return null};const T={transitional:m,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=r.a.isObject(e);s&&r.a.isHTMLForm(e)&&(e=new FormData(e));if(r.a.isFormData(e))return i&&i?JSON.stringify(w(e)):e;if(r.a.isArrayBuffer(e)||r.a.isBuffer(e)||r.a.isStream(e)||r.a.isFile(e)||r.a.isBlob(e))return e;if(r.a.isArrayBufferView(e))return e.buffer;if(r.a.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Object(o.a)(e,new S.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,i){return S.isNode&&r.a.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=r.a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Object(o.a)(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),function(e,t,n){if(r.a.isString(e))try{return(t||JSON.parse)(e),r.a.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||T.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&r.a.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw f.a.from(e,f.a.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:S.classes.FormData,Blob:S.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};r.a.forEach(["delete","get","head","post","put","patch"],e=>{T.headers[e]={}});var I=T;const N=r.a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const A=Symbol("internals");function E(e){return e&&String(e).trim().toLowerCase()}function x(e){return!1===e||null==e?e:r.a.isArray(e)?e.map(x):String(e)}function R(e,t,n,i,s){return r.a.isFunction(i)?i.call(this,t,n):(s&&(t=n),r.a.isString(t)?r.a.isString(i)?-1!==t.indexOf(i):r.a.isRegExp(i)?i.test(t):void 0:void 0)}class C{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(e,t,n){const s=E(t);if(!s)throw new Error("header name must be a non-empty string");const o=r.a.findKey(i,s);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||t]=x(e))}const o=(e,t)=>r.a.forEach(e,(e,n)=>s(e,n,t));return r.a.isPlainObject(e)||e instanceof this.constructor?o(e,t):r.a.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?o((e=>{const t={};let n,i,r;return e&&e.split("\n").forEach((function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),i=e.substring(r+1).trim(),!n||t[n]&&N[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=E(e)){const n=r.a.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(r.a.isFunction(t))return t.call(this,e,n);if(r.a.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=E(e)){const n=r.a.findKey(this,e);return!(!n||void 0===this[n]||t&&!R(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function s(e){if(e=E(e)){const s=r.a.findKey(n,e);!s||t&&!R(0,n[s],s,t)||(delete n[s],i=!0)}}return r.a.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const r=t[n];e&&!R(0,this[r],r,e,!0)||(delete this[r],i=!0)}return i}normalize(e){const t=this,n={};return r.a.forEach(this,(i,s)=>{const o=r.a.findKey(n,s);if(o)return t[o]=x(i),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();a!==s&&delete t[s],t[a]=x(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return r.a.forEach(this,(n,i)=>{null!=n&&!1!==n&&(t[i]=e&&r.a.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[A]=this[A]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=E(e);t[i]||(!function(e,t){const n=r.a.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(e,n,r){return this[i].call(this,t,e,n,r)},configurable:!0})})}(n,e),t[i]=!0)}return r.a.isArray(e)?e.forEach(i):i(e),this}}C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),r.a.reduceDescriptors(C.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),r.a.freezeMethods(C);var O=C;function P(e,t){const n=this||I,i=t||n,s=O.from(i.headers);let o=i.data;return r.a.forEach(e,(function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)})),s.normalize(),o}function k(e){return!(!e||!e.__CANCEL__)}function j(e,t,n){f.a.call(this,null==e?"canceled":e,f.a.ERR_CANCELED,t,n),this.name="CanceledError"}r.a.inherits(j,f.a,{__CANCEL__:!0});var L=j,M=n(31);var D=S.hasStandardBrowserEnv?{write(e,t,n,i,s,o){const a=[e+"="+encodeURIComponent(t)];r.a.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.a.isString(i)&&a.push("path="+i),r.a.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function B(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var F=S.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function i(n){let i=n;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(e){const t=r.a.isString(e)?i(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};var q=function(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r,s=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=i[o];r||(r=c),n[s]=a,i[s]=c;let l=o,d=0;for(;l!==s;)d+=n[l++],l%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-r<t)return;const p=u&&c-u;return p?Math.round(1e3*d/p):void 0}};function U(e,t){let n=0;const i=q(50,250);return r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,c=i(a);n=s;const u={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r};u[t?"download":"upload"]=!0,e(u)}}var J="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let i=e.data;const s=O.from(e.headers).normalize();let o,a,{responseType:c,withXSRFToken:u}=e;function l(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if(r.a.isFormData(i))if(S.hasStandardBrowserEnv||S.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if(!1!==(a=s.getContentType())){const[e,...t]=a?a.split(";").map(e=>e.trim()).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}let d=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const h=B(e.baseURL,e.url);function g(){if(!d)return;const i=O.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());!function(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new f.a("Request failed with status code "+n.status,[f.a.ERR_BAD_REQUEST,f.a.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),l()}),(function(e){n(e),l()}),{data:c&&"text"!==c&&"json"!==c?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:i,config:e,request:d}),d=null}if(d.open(e.method.toUpperCase(),p(h,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,"onloadend"in d?d.onloadend=g:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(g)},d.onabort=function(){d&&(n(new f.a("Request aborted",f.a.ECONNABORTED,e,d)),d=null)},d.onerror=function(){n(new f.a("Network Error",f.a.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||m;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new f.a(t,i.clarifyTimeoutError?f.a.ETIMEDOUT:f.a.ECONNABORTED,e,d)),d=null},S.hasStandardBrowserEnv&&(u&&r.a.isFunction(u)&&(u=u(e)),u||!1!==u&&F(h))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&D.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===i&&s.setContentType(null),"setRequestHeader"in d&&r.a.forEach(s.toJSON(),(function(e,t){d.setRequestHeader(t,e)})),r.a.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),c&&"json"!==c&&(d.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",U(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",U(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{d&&(n(!t||t.type?new L(null,e,d):t),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(h);y&&-1===S.protocols.indexOf(y)?n(new f.a("Unsupported protocol "+y+":",f.a.ERR_BAD_REQUEST,e)):d.send(i||null)}))};const z={http:M.a,xhr:J};r.a.forEach(z,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const G=e=>"- "+e,H=e=>r.a.isFunction(e)||null===e||!1===e;var V=e=>{e=r.a.isArray(e)?e:[e];const{length:t}=e;let n,i;const s={};for(let r=0;r<t;r++){let t;if(n=e[r],i=n,!H(n)&&(i=z[(t=String(n)).toLowerCase()],void 0===i))throw new f.a(`Unknown adapter '${t}'`);if(i)break;s[t||"#"+r]=i}if(!i){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let n=t?e.length>1?"since :\n"+e.map(G).join("\n"):" "+G(e[0]):"as no adapter specified";throw new f.a("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return i};function W(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new L(null,e)}function $(e){W(e),e.headers=O.from(e.headers),e.data=P.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return V(e.adapter||I.adapter)(e).then((function(t){return W(e),t.data=P.call(e,e.transformResponse,t),t.headers=O.from(t.headers),t}),(function(t){return k(t)||(W(e),t&&t.response&&(t.response.data=P.call(e,e.transformResponse,t.response),t.response.headers=O.from(t.response.headers))),Promise.reject(t)}))}const Q=e=>e instanceof O?e.toJSON():e;function K(e,t){t=t||{};const n={};function i(e,t,n){return r.a.isPlainObject(e)&&r.a.isPlainObject(t)?r.a.merge.call({caseless:n},e,t):r.a.isPlainObject(t)?r.a.merge({},t):r.a.isArray(t)?t.slice():t}function s(e,t,n){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e,n):i(e,t,n)}function o(e,t){if(!r.a.isUndefined(t))return i(void 0,t)}function a(e,t){return r.a.isUndefined(t)?r.a.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function c(n,r,s){return s in t?i(n,r):s in e?i(void 0,n):void 0}const u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(e,t)=>s(Q(e),Q(t),!0)};return r.a.forEach(Object.keys(Object.assign({},e,t)),(function(i){const o=u[i]||s,a=o(e[i],t[i],i);r.a.isUndefined(a)&&o!==c||(n[i]=a)})),n}const X={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{X[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Y={};X.transitional=function(e,t,n){function i(e,t){return"[Axios v1.6.5] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,s)=>{if(!1===e)throw new f.a(i(r," has been removed"+(t?" in "+t:"")),f.a.ERR_DEPRECATED);return t&&!Y[r]&&(Y[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}};var Z={assertOptions:function(e,t,n){if("object"!=typeof e)throw new f.a("options must be an object",f.a.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const s=i[r],o=t[s];if(o){const t=e[s],n=void 0===t||o(t,s,e);if(!0!==n)throw new f.a("option "+s+" must be "+n,f.a.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new f.a("Unknown option "+s,f.a.ERR_BAD_OPTION)}},validators:X};const ee=Z.validators;class te{constructor(e){this.defaults=e,this.interceptors={request:new h,response:new h}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=K(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;void 0!==n&&Z.assertOptions(n,{silentJSONParsing:ee.transitional(ee.boolean),forcedJSONParsing:ee.transitional(ee.boolean),clarifyTimeoutError:ee.transitional(ee.boolean)},!1),null!=i&&(r.a.isFunction(i)?t.paramsSerializer={serialize:i}:Z.assertOptions(i,{encode:ee.function,serialize:ee.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&r.a.merge(s.common,s[t.method]);s&&r.a.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=O.concat(o,s);const a=[];let c=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(c=c&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const u=[];let l;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let d,p=0;if(!c){const e=[$.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,u),d=e.length,l=Promise.resolve(t);p<d;)l=l.then(e[p++],e[p++]);return l}d=a.length;let h=t;for(p=0;p<d;){const e=a[p++],t=a[p++];try{h=e(h)}catch(e){t.call(this,e);break}}try{l=$.call(this,h)}catch(e){return Promise.reject(e)}for(p=0,d=u.length;p<d;)l=l.then(u[p++],u[p++]);return l}getUri(e){return p(B((e=K(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}r.a.forEach(["delete","get","head","options"],(function(e){te.prototype[e]=function(t,n){return this.request(K(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.a.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,r){return this.request(K(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}te.prototype[e]=t(),te.prototype[e+"Form"]=t(!0)}));var ne=te;class ie{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const i=new Promise(e=>{n.subscribe(e),t=e}).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,r){n.reason||(n.reason=new L(e,i,r),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new ie((function(t){e=t})),cancel:e}}}var re=ie;const se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(se).forEach(([e,t])=>{se[t]=e});var oe=se;const ae=function e(t){const n=new ne(t),i=Object(s.a)(ne.prototype.request,n);return r.a.extend(i,ne.prototype,n,{allOwnKeys:!0}),r.a.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(K(t,n))},i}(I);ae.Axios=ne,ae.CanceledError=L,ae.CancelToken=re,ae.isCancel=k,ae.VERSION="1.6.5",ae.toFormData=o.a,ae.AxiosError=f.a,ae.Cancel=ae.CanceledError,ae.all=function(e){return Promise.all(e)},ae.spread=function(e){return function(t){return e.apply(null,t)}},ae.isAxiosError=function(e){return r.a.isObject(e)&&!0===e.isAxiosError},ae.mergeConfig=K,ae.AxiosHeaders=O,ae.formToJSON=e=>w(r.a.isHTMLForm(e)?new FormData(e):e),ae.getAdapter=V,ae.HttpStatusCode=oe,ae.default=ae;t.a=ae},function(e,t,n){(function(t){var n=function(e,t,n,i){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,n){var i=this;return this.bucketSize?e>this.bucketSize?(t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?r():this.parentBucket?this.parentBucket.removeTokens(e,(function(t,s){return t?n(t,null):e>i.content?r():(i.content-=e,void n(null,Math.min(s,i.content)))})):(this.content-=e,t.nextTick(n.bind(null,null,this.content)),!0)):(t.nextTick(n.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function r(){var t=Math.ceil((e-i.content)*(i.interval/i.tokensPerInterval));return setTimeout((function(){i.removeTokens(e,n)}),t),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var n=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+n,this.bucketSize)}else this.content=this.bucketSize}},e.exports=n}).call(this,n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(179),r=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return i.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,n=this.numOfDelayedAttempts,i=e*Math.pow(t,n);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimeoutError=void 0;class i extends Error{constructor(e){super(e)}}t.TimeoutError=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.saslprep=t.resourceprep=t.nodeprep=t.NodePrepProhibited=t.nameprep=t.prepare=t.D2=t.D1=t.C9=t.C8=t.C7=t.C6=t.C5=t.C4=t.C3=t.C22=t.C21=t.C12=t.C11=t.B3=t.B2=t.B1=t.A1=t.Table=void 0;const i=(0,n(3).__importDefault)(n(33)),r=n(192);class s{constructor(e,t){this.singles=new Set,this.ranges=[],this.mappings=new Map;const n=r.TABLE_DATA[e];this.name=e,n?(n.s&&(this.singles=new Set(n.s.split("|").map(e=>parseInt(e,32)))),n.r&&(this.ranges=n.r.split("|").map(e=>{const[t,n]=e.split(":");return[parseInt(t,32),parseInt(n,32)]})),n.m&&(this.mappings=new Map(n.m.split("|").map(e=>{const[t,n]=e.split(":"),i=n.split(";").map(e=>parseInt(e,32));return[parseInt(t,32),i]})))):t&&(this.singles=new Set(t))}contains(e){if(this.singles.has(e))return!0;let t=0,n=this.ranges.length-1;for(;t<=n;){const i=Math.floor((t+n)/2),r=this.ranges[i];if(e<r[0])n=i-1;else{if(!(e>r[1]))return!0;t=i+1}}return!1}hasMapping(e){return this.mappings.has(e)||this.contains(e)}map(e){return this.contains(e)&&!this.mappings.has(e)?String.fromCodePoint(e).toLowerCase().codePointAt(0):this.mappings.get(e)||null}}function o(e,n,r=""){const s=i.default.ucs2.decode(r);let o=[];for(const t of s){if(!n&&e.unassigned.contains(t))throw new Error("Unassigned code point: x"+t.toString(16));let i=!1;for(const n of e.mappings){if(!n.hasMapping(t))continue;i=!0;const e=n.map(t);e&&(Array.isArray(e)?o=o.concat(e):o.push(e))}i||o.push(t)}let a=o;if(e.normalize){const e=i.default.ucs2.encode(o).normalize("NFKC");a=i.default.ucs2.decode(e)}let c=!1,u=!1;for(const i of a){for(const t of e.prohibited)if(t.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));if(!n&&e.unassigned.contains(i))throw new Error("Prohibited code point: x"+i.toString(16));e.bidirectional&&(c=c||t.D1.contains(i),u=u||t.D2.contains(i))}if(e.bidirectional){if(c&&u)throw new Error("String contained both LCat and RandALCat code points");if(c&&(!t.D1.contains(a[0])||!t.D1.contains(a[a.length-1])))throw new Error("String containing RandALCat code points must start and end with RandALCat code points")}return i.default.ucs2.encode(a)}t.Table=s,t.A1=new s("A.1"),t.B1=new s("B.1"),t.B2=new s("B.2"),t.B3=new s("B.3"),t.C11=new s("C.1.1"),t.C12=new s("C.1.2"),t.C21=new s("C.2.1"),t.C22=new s("C.2.2"),t.C3=new s("C.3"),t.C4=new s("C.4"),t.C5=new s("C.5"),t.C6=new s("C.6"),t.C7=new s("C.7"),t.C8=new s("C.8"),t.C9=new s("C.9"),t.D1=new s("D.1"),t.D2=new s("D.2"),t.B1.map=()=>null,t.C11.contains=e=>32===e,t.C12.map=e=>t.C12.contains(e)?32:null,t.prepare=o;const a={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C12,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.nameprep=function(e,t=!0){return o(a,t,e)},t.NodePrepProhibited=new s("NodePrepProhibited",[34,38,39,47,58,60,62,64]);const c={bidirectional:!0,mappings:[t.B1,t.B2],normalize:!0,prohibited:[t.C11,t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9,t.NodePrepProhibited],unassigned:t.A1};t.nodeprep=function(e,t=!0){return o(c,t,e)};const u={bidirectional:!0,mappings:[t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.resourceprep=function(e,t=!0){return o(u,t,e)};const l={bidirectional:!0,mappings:[t.C12,t.B1],normalize:!0,prohibited:[t.C12,t.C21,t.C22,t.C3,t.C4,t.C5,t.C6,t.C7,t.C8,t.C9],unassigned:t.A1};t.saslprep=function(e,t=!1){return o(l,t,e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(35);t.default=class{constructor(){this.parents=new Set,this.placeholder=!1,this.typeField="",this.versionField="",this.defaultType="",this.defaultVersion="",this.languageField="lang",this.typeValues=new Map,this.typeOrders=new Map,this.importers=new Map,this.exporters=new Map,this.children=new Map,this.childrenIndex=new Map,this.implicitChildren=new Set,this.contexts=new Map}addChild(e,t,n=!1,i,r){const s={multiple:n||!1,name:e,selector:i,translator:t},o=this.children.get(e);if(!o){s.translator.parents.add(this),this.children.set(e,s);for(const[n]of t.importers)this.implicitChildren.has(n)||this.childrenIndex.set(n,e);return void(r&&this.implicitChildren.add(r))}const a=o.translator;o.multiple=n,i&&o.selector&&i!==o.selector&&(o.selector=void 0);for(const[n,i]of t.importers){const[r,s]=(a.typeValues.get(n)||"").split("__v__");a.updateDefinition({contexts:t.contexts,element:i.element,exporterOrdering:new Map,exporters:new Map,importerOrdering:i.fieldOrders,importers:i.fields,namespace:i.namespace,optionalNamespaces:new Map,type:r,version:s}),this.implicitChildren.has(n)||this.childrenIndex.set(n,e)}for(const[e,n]of t.exporters){const[i,r]=e.split("__v__");a.updateDefinition({contexts:t.contexts,element:n.element,exporterOrdering:n.fieldOrders,exporters:n.fields,importerOrdering:new Map,importers:new Map,namespace:n.namespace,optionalNamespaces:n.optionalNamespaces,type:i,version:r})}}addContext(e,t,n,i,r,s){t&&(e=`${e}[${t}]`);let o=this.contexts.get(e);o||(o={typeField:"",versionField:"",typeValues:new Map}),s&&(o.impliedType=r),o.typeField=n||"",o.typeValues.set(i,r),this.contexts.set(e,o)}getChild(e){const t=this.children.get(e);if(t)return t.translator}getImportKey(e){return this.childrenIndex.get(`{${e.getNamespace()}}${e.getName()}`)}updateDefinition(e){const t=`{${e.namespace}}${e.element}`,n=e.type||this.defaultType,i=e.version||this.defaultVersion,r=i?`${n}__v__${i}`:n,s=this.importers.get(t)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace};for(const[t,n]of e.importers)s.fields.set(t,n);for(const[t,n]of e.importerOrdering)s.fieldOrders.set(t,n);this.importers.set(t,s);const o=this.exporters.get(r)||{element:e.element,fieldOrders:new Map,fields:new Map,namespace:e.namespace,optionalNamespaces:e.optionalNamespaces};for(const[t,n]of e.exporters)o.fields.set(t,n);for(const[t,n]of e.exporterOrdering)o.fieldOrders.set(t,n);for(const[t,n]of e.optionalNamespaces)o.optionalNamespaces.set(t,n);this.exporters.set(r,o);for(const[t,n]of e.contexts){const e=this.contexts.get(t)||{impliedType:void 0,typeField:n.typeField,versionField:n.versionField,typeValues:new Map};e.typeField||(e.typeField=n.typeField),e.versionField||(e.versionField=n.versionField),e.impliedType||(e.impliedType=n.impliedType);for(const[t,i]of n.typeValues)e.typeValues.set(t,i);this.contexts.set(t,e)}if(e.type)this.typeValues.set(t,r),e.typeOrder&&e.type&&this.typeOrders.set(e.type,e.typeOrder);else if(this.typeField&&!e.type){for(const[,t]of this.importers){for(const[n,i]of e.importers)t.fields.set(n,i);for(const[n,i]of e.importerOrdering)t.fieldOrders.set(n,i)}for(const[,t]of this.exporters){for(const[n,i]of e.exporters)t.fields.set(n,i);for(const[n,i]of e.exporterOrdering)t.fieldOrders.set(n,i)}}}replaceWith(e){for(const[t,n]of this.children)e.children.set(t,n);for(const[t,n]of this.childrenIndex)e.childrenIndex.set(t,n);for(const[t,n]of this.contexts)e.contexts.set(t,n);for(const t of this.implicitChildren)e.implicitChildren.add(t);for(const t of this.parents)for(const n of t.children.values())n.translator===this&&(n.translator=e);this.parents=new Set}import(e,t){const n=`{${e.getNamespace()}}${e.getName()}`,i={},r=this.importers.get(n);if(!r)return;const s=this.typeValues.get(n)||"",[o,a]=s.split("__v__"),c=t.path||"";let u;if(t.pathSelector&&(u=this.contexts.get(`${c}[${t.pathSelector}]`)),u||(u=this.contexts.get(c)),u){if(!u.impliedType){const e=u.typeValues.get(n)||"";e&&(i[u.typeField]=e)}}else this.typeField&&o&&o!==this.defaultType&&(i[this.typeField]=o);this.versionField&&a&&a!==this.defaultVersion&&(i[this.versionField]=a);const l={...t,data:i,importer:r,lang:(e.getAttribute("xml:lang")||t.lang||"").toLowerCase(),pathSelector:o,translator:this},d=[...r.fieldOrders.entries()].sort((e,t)=>e[1]>t[1]?-1:e[1]<t[1]?1:0),p=d.filter(e=>e[1]>=0),h=d.filter(e=>e[1]<0);for(const[n]of p){const s=r.fields.get(n);l.path=`${t.path}.${n}`;const o=s(e,l);null!=o&&(i[n]=o)}for(const n of e.children){if("string"==typeof n)continue;const e=`{${n.getNamespace()}}${n.getName()}`,r=this.childrenIndex.get(e);if(!r)continue;l.path=`${t.path}.${r}`;const{translator:s,multiple:a,selector:c}=this.children.get(r);if(!c||c===o){const e=s.import(n,l);void 0!==e&&(a?(i[r]||(i[r]=[]),i[r].push(e)):i[r]?i[r]=s.resolveCollision(i[r],e):i[r]=e)}}for(const[n]of h){const s=r.fields.get(n);l.path=`${t.path}.${n}`;const o=s(e,l);null!=o&&(i[n]=o)}return i}export(e,t){if(!e)return;let n=this.defaultType,r=this.defaultVersion;const s=t.path||"";let o;t.pathSelector&&(o=this.contexts.get(`${s}[${t.pathSelector}]`)),o||(o=this.contexts.get(s)),o?n=o.impliedType||e[o.typeField]||this.defaultType:this.typeField&&(n=e[this.typeField]||this.defaultType),this.versionField&&(r=e[this.versionField]||this.defaultVersion);const a=r?`${n}__v__${r}`:n,c=this.exporters.get(a);if(!c)return;const u=(0,i.createElement)(c.namespace,c.element,t.namespace,t.element);t.element&&(u.parent=t.element);for(const[e,t]of c.optionalNamespaces)u.addOptionalNamespace(e,t);const l={...t,data:e,element:u,exporter:c,lang:(e[this.languageField]||t.lang||"").toLowerCase(),namespace:u.getDefaultNamespace(),pathSelector:n,translator:this},d=c.fields.get(this.languageField);d&&d(u,e[this.languageField],t);const p=Object.keys(e);p.sort((e,t)=>(c.fieldOrders.get(e)||1e5)-(c.fieldOrders.get(t)||1e5));for(const i of p){if(i===this.languageField)continue;const r=e[i],s=c.fields.get(i);if(s){s(u,r,l);continue}const o=this.children.get(i);if(!o)continue;l.path=`${t.path?t.path+".":""}${i}`;const{translator:a,multiple:d,selector:p}=o;if(!p||p===n){let e;e=d?null!=r?r:[]:[r];for(const t of e){const e=a.export(t,l);e&&u.appendChild(e)}}}return u}resolveCollision(e,t){return(this.typeOrders.get(e[this.typeField]||this.defaultType)||0)<=(this.typeOrders.get(t[this.typeField]||this.defaultType)||0)?e:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=void 0;const i=n(3),r=(0,i.__importDefault)(n(19));t.Hash=r.default;const s=(0,i.__importDefault)(n(205)),o=(0,i.__importDefault)(n(206)),a=(0,i.__importDefault)(n(207)),c=(0,i.__importDefault)(n(208)),u=new Map([["md5",s.default],["sha-1",o.default],["sha-256",a.default],["sha-512",c.default],["sha1",o.default],["sha256",a.default],["sha512",c.default]]);t.default=function(e){e=e.toLowerCase();const t=u.get(e);if(t)return new t;throw new Error("Unsupported hash algorithm: "+e)}},function(e,t,n){"use strict";(function(t,i){var r,s=n(25);e.exports=g,g.ReadableState=m;n(6).EventEmitter;var o=function(e,t){return e.listeners(t).length},a=n(6).EventEmitter,c=n(9).Buffer,u=t.Uint8Array||function(){};var l,d=Object.create(n(20)),p=n(203).BufferList,h=n(58);d.inherits(g,a);var f=["error","close","destroy","pause","resume"];function m(e,t){e=e||{};var i=t instanceof(r=r||n(17));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var s=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=n(60).StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function g(e){if(r=r||n(17),!(this instanceof g))return new g(e);this._readableState=new m(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function y(e,t,n,i,r){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,v(e)}(e,o)):(r||(s=function(e,t){var n;i=t,c.isBuffer(i)||i instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var i;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),i?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):b(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?b(e,o,t,!1):w(e,o)):b(e,o,t,!1))):i||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function b(e,t,n,i){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&v(e)),w(e,t)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),g.prototype.destroy=h.destroy,g.prototype._undestroy=h.undestroy,g.prototype._destroy=function(e,t){this.push(null),t(e)},g.prototype.push=function(e,t){var n,i=this._readableState;return i.objectMode?n=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=c.from(e,t),t=""),n=!0),y(this,e,t,!1,n)},g.prototype.unshift=function(e){return y(this,e,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(e){return l||(l=n(60).StringDecoder),this._readableState.decoder=new l(e),this._readableState.encoding=e,this};function _(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function v(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.flowing,t.emittedReadable=!0,t.sync?s.nextTick(S,e):S(e))}function S(e){e.emit("readable"),A(e)}function w(e,t){t.readingMore||(t.readingMore=!0,s.nextTick(T,e,t))}function T(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function I(e){e.read(0)}function N(e,t){t.reading||e.read(0),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),A(e),t.flowing&&!t.reading&&e.read(0)}function A(e){var t=e._readableState;for(t.flowing;t.flowing&&null!==e.read(););}function E(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var i;e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):i=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,i=1,r=n.data;e-=r.length;for(;n=n.next;){var s=n.data,o=e>s.length?s.length:e;if(o===s.length?r+=s:r+=s.slice(0,e),0===(e-=o)){o===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++i}return t.length-=i,r}(e,t):function(e,t){var n=c.allocUnsafe(e),i=t.head,r=1;i.data.copy(n),e-=i.data.length;for(;i=i.next;){var s=i.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=s.slice(o));break}++r}return t.length-=r,n}(e,t);return i}(e,t.buffer,t.decoder),n);var n}function x(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,s.nextTick(R,t,e))}function R(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}g.prototype.read=function(e){e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return t.length,t.ended,0===t.length&&t.ended?x(this):v(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&x(this),null;var i,r=t.needReadable;return(0===t.length||t.length-e<t.highWaterMark)&&(r=!0),t.ended||t.reading?r=!1:r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(n,t))),null===(i=e>0?E(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&x(this)),null!==i&&this.emit("data",i),i},g.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,r.pipesCount;var a=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?u:y;function c(t,i){t===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",l),e.removeListener("error",f),e.removeListener("unpipe",c),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",h),d=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){e.end()}r.endEmitted?s.nextTick(a):n.once("end",a),e.on("unpipe",c);var l=function(e){return function(){var t=e._readableState;t.awaitDrain,t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&o(e,"data")&&(t.flowing=!0,A(e))}}(n);e.on("drain",l);var d=!1;var p=!1;function h(t){p=!1,!1!==e.write(t)||p||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==C(r.pipes,e))&&!d&&(n._readableState.awaitDrain,n._readableState.awaitDrain++,p=!0),n.pause())}function f(t){y(),e.removeListener("error",f),0===o(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),y()}function g(){e.removeListener("close",m),y()}function y(){n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",m),e.once("finish",g),e.emit("pipe",n),r.flowing||n.resume(),e},g.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<r;s++)i[s].emit("unpipe",this,n);return this}var o=C(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},g.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&v(this):s.nextTick(I,this))}return n},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var e=this._readableState;return e.flowing||(e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,s.nextTick(N,e,t))}(this,e)),this},g.prototype.pause=function(){return this._readableState.flowing,!1!==this._readableState.flowing&&(this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;for(var r in e.on("end",(function(){if(n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(r){(n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r)||(n.objectMode||r&&r.length)&&(t.push(r)||(i=!0,e.pause()))})),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<f.length;s++)e.on(f[s],this.emit.bind(this,f[s]));return this._read=function(t){i&&(i=!1,e.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=E}).call(this,n(15),n(22))},function(e,t,n){"use strict";var i=n(25);function r(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i.nextTick(r,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(i.nextTick(r,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){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.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";(function(t){var i=n(25);function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var i=e.entry;e.entry=null;for(;i;){var r=i.callback;t.pendingcb--,r(n),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=m;var s,o=i.nextTick;m.WritableState=f;var a=Object.create(n(20)),c=n(6).EventEmitter,u=n(9).Buffer,l=t.Uint8Array||function(){};var d,p=n(58);function h(){}function f(e,t){s=s||n(17),e=e||{};var a=t instanceof s;this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var c=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:a&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var d=!1===e.decodeStrings;this.decodeStrings=!d,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,s=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,s){--t.pendingcb,n?(i.nextTick(s,r),i.nextTick(S,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(s(r),e._writableState.errorEmitted=!0,e.emit("error",r),S(e,t))}(e,n,r,t,s);else{var a=_(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||b(e,n),r?o(y,e,n,a,s):y(e,n,a,s)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function m(e){if(s=s||n(17),!(d.call(m,this)||this instanceof s))return new m(e);this._writableState=new f(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function g(e,t,n,i,r,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(r,t.onwrite):e._write(r,s,t.onwrite),t.sync=!1}function y(e,t,n,i){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),S(e,t)}function b(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,s=new Array(i),o=t.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)s[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;s.allBuffers=c,g(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new r(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,d=n.callback;if(g(e,t,!1,t.objectMode?1:u.length,u,l,d),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function _(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function v(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),S(e,t)}))}function S(e,t){var n=_(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(v,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}a.inherits(m,c),f.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(f.prototype,"buffer",{get:function(){return this.getBuffer()}})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===m&&(e&&e._writableState instanceof f)}})):d=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,s=this._writableState,o=!1,a=!s.objectMode&&(r=e,u.isBuffer(r)||r instanceof l);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=s.defaultEncoding),"function"!=typeof n&&(n=h),s.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var s=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),i.nextTick(r,o),s=!1),s}(this,s,e,n))&&(s.pendingcb++,o=function(e,t,n,i,r,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,n));return t}(t,i,r);i!==o&&(n=!0,r="buffer",i=o)}var a=t.objectMode?1:i.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:r,isBuf:n,callback:s,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else g(e,t,!1,a,i,r,s);return c}(this,s,a,e,t,n)),o},m.prototype.cork=function(){this._writableState.corked++},m.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||b(this,e))},m.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,S(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=p.destroy,m.prototype._undestroy=p.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(15))},function(e,t,n){"use strict";var i=n(9).Buffer,r=i.isEncoding||function(e){switch((e=""+e)&&e.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 s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=p,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var r=o(t[i]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(e.lastNeed=r-2),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=s;var i=n(17);function r(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),i(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);i.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)}function o(){var e=this;"function"==typeof this._flush?this._flush((function(t,n){a(e,t,n)})):a(this,null,null)}function a(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}Object.create(n(20)).inherits(s,i),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var n=this;i.prototype._destroy.call(this,e,(function(e){t(e),n.emit("close")}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Receiver=t.Sender=void 0;const i=n(3),r=n(6),s=(0,i.__importStar)(n(7)),o=n(5),a=n(1),c=(0,i.__importDefault)(n(40)),u=n(26),l=n(41);class d extends r.EventEmitter{constructor(e={}){super(),this.config={chunkSize:16384,hash:"sha-1",...e},this.file=void 0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}send(e,t){if(this.file&&this.channel)return;this.file=e,this.channel=t,this.channel.binaryType="arraybuffer";const n=new FileReader;let i=0,r=!1;const s=()=>{if(r||i>=e.size)return;r=!0;const t=e.slice(i,i+this.config.chunkSize);n.readAsArrayBuffer(t)};t.bufferedAmountLowThreshold=8*this.config.chunkSize,t.onbufferedamountlow=()=>{s()},n.addEventListener("load",t=>{const n=t.target.result;r=!1,i+=n.byteLength,this.channel.send(n),this.hash.update(new Uint8Array(n)),this.emit("progress",i,e.size,n),i<e.size?this.channel.bufferedAmount<=this.channel.bufferedAmountLowThreshold&&s():(this.emit("progress",e.size,e.size,null),this.emit("sentFile",{algorithm:this.config.hash,name:e.name,size:e.size,value:this.hash.digest()}))}),s()}}t.Sender=d;class p extends r.EventEmitter{constructor(e={}){super(),this.config={hash:"sha-1",...e},this.receiveBuffer=[],this.received=0,this.channel=void 0,this.hash=s.createHash(this.config.hash)}receive(e,t){this.metadata=e,this.channel=t,this.channel.binaryType="arraybuffer",this.channel.onmessage=e=>{const t=e.data.byteLength;this.received+=t,this.receiveBuffer.push(e.data),e.data&&this.hash.update(new Uint8Array(e.data)),this.emit("progress",this.received,this.metadata.size,e.data),this.received===this.metadata.size?(this.metadata.actualhash=this.hash.digest("hex"),this.emit("receivedFile",new Blob(this.receiveBuffer),this.metadata),this.receiveBuffer=[]):this.received>this.metadata.size&&(console.error("received more than expected, discarding..."),this.receiveBuffer=[])}}}t.Receiver=p;class h extends c.default{constructor(e){super(e),this.sender=void 0,this.receiver=void 0,this.file=void 0}async start(e,t){if(t=t||(()=>{}),!e||"function"==typeof e)throw new Error("File object required");this.state="pending",this.role="initiator",this.file=e,this.sender=new d,this.sender.on("progress",(e,t)=>{this._log("info","Send progress "+e+"/"+t)}),this.sender.on("sentFile",e=>{this._log("info","Sent file",e.name),this.send(o.JingleAction.SessionInfo,{info:{creator:o.JingleSessionRole.Initiator,file:{hashes:[{algorithm:e.algorithm,value:e.value}]},infoType:o.JINGLE_INFO_CHECKSUM_5,name:this.contentName}}),this.parent.emit("sentFile",this,e)}),this.channel=this.pc.createDataChannel("filetransfer",{ordered:!0}),this.channel.onopen=()=>{this.sender.send(this.file,this.channel)};try{await this.processLocal(o.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1}),n=(0,u.importFromSDP)(t.sdp),i=(0,l.convertIntermediateToRequest)(n,this.role,this.transportType);this.contentName=i.contents[0].name,i.sid=this.sid,i.action=o.JingleAction.SessionInitiate,i.contents[0].application={applicationType:a.NS_JINGLE_FILE_TRANSFER_5,file:{date:e.lastModified?new Date(e.lastModified):void 0,hashesUsed:[{algorithm:"sha-1"}],name:e.name,size:e.size}},this.send("session-initiate",i),await this.pc.setLocalDescription(t)}),t()}catch(e){return this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e){this._log("info","Accepted incoming session"),this.role="responder",this.state="active",e=e||(()=>{});try{await this.processLocal(o.JingleAction.SessionAccept,async()=>{const e=await this.pc.createAnswer(),t=(0,u.importFromSDP)(e.sdp),n=(0,l.convertIntermediateToRequest)(t,this.role,this.transportType);n.sid=this.sid,n.action="session-accept";for(const e of n.contents)e.creator="initiator";this.contentName=n.contents[0].name,this.send("session-accept",n),await this.pc.setLocalDescription(e),await this.processBufferedCandidates()}),e()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.role="responder",this.state="pending",this.transportType=e.contents[0].transport.transportType;const n=(0,l.convertRequestToIntermediate)(e,this.peerRole),i=(0,u.exportToSDP)(n),r=e.contents[0].application,s=r.file.hashesUsed?r.file.hashesUsed:r.file.hashes||[];this.receiver=new p({hash:s[0]&&s[0].algorithm}),this.receiver.on("progress",(e,t)=>{this._log("info","Receive progress "+e+"/"+t)}),this.receiver.on("receivedFile",e=>{this.receivedFile=e,this._maybeReceivedFile()}),this.receiver.metadata=r.file,this.pc.addEventListener("datachannel",e=>{this.channel=e.channel,this.receiver.receive(this.receiver.metadata,e.channel)});try{await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionInfo(e,t){const n=e.info;n&&n.file&&n.file.hashes&&(this.receiver.metadata.hashes=n.file.hashes,this.receiver.metadata.actualhash&&this._maybeReceivedFile(),t())}_maybeReceivedFile(){if(this.receiver.metadata.hashes&&this.receiver.metadata.hashes.length){for(const e of this.receiver.metadata.hashes||[])if(e.value&&e.value.toString("hex")===this.receiver.metadata.actualhash)return this._log("info","File hash matches"),this.parent.emit("receivedFile",this,this.receivedFile,this.receiver.metadata),void this.end("success");this._log("error","File hash does not match"),this.end("media-error")}}}t.default=h},function(e,t,n){"use strict";const i={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},i.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},i.getDescription=function(e){const t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){const t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter(e=>0===e.indexOf(t))},i.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":n.relatedAddress=t[e+1];break;case"rport":n.relatedPort=parseInt(t[e+1],10);break;case"tcptype":n.tcpType=t[e+1];break;case"ufrag":n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:void 0===n[t[e]]&&(n[t[e]]=t[e+1])}return n},i.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},i.parseIceOptions=function(e){return e.substring(14).split(" ")},i.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},i.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},i.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},i.parseFmtp=function(e){const t={};let n;const i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)n=i[e].trim().split("="),t[n[0].trim()]=n[1];return t},i.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)}),t+="a=fmtp:"+n+" "+i.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},i.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(n.attribute=e.substring(t+1,i),n.value=e.substring(i+1)):n.attribute=e.substring(t+1),n},i.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},i.getMid=function(e){const t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substring(6)},i.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},i.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){const n=i.matchPrefix(e+t,"a=ice-ufrag:")[0],r=i.matchPrefix(e+t,"a=ice-pwd:")[0];return n&&r?{usernameFragment:n.substring(12),password:r.substring(10)}:null},i.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},i.parseRtpParameters=function(e){const t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=i.splitLines(e)[0].split(" ");t.profile=n[2];for(let r=3;r<n.length;r++){const s=n[r],o=i.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(o){const n=i.parseRtpMap(o),r=i.matchPrefix(e,"a=fmtp:"+s+" ");switch(n.parameters=r.length?i.parseFmtp(r[0]):{},n.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(i.parseRtcpFb),t.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(n.name.toUpperCase())}}}i.matchPrefix(e,"a=extmap:").forEach(e=>{t.headerExtensions.push(i.parseExtmap(e))});const r=i.matchPrefix(e,"a=rtcp-fb:* ").map(i.parseRtcpFb);return t.codecs.forEach(e=>{r.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),t},i.writeRtpDescription=function(e,t){let n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" "+(t.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=t.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(e=>{n+=i.writeRtpMap(e),n+=i.writeFmtp(e),n+=i.writeRtcpFb(e)});let r=0;return t.codecs.forEach(e=>{e.maxptime>r&&(r=e.maxptime)}),r>0&&(n+="a=maxptime:"+r+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach(e=>{n+=i.writeExtmap(e)}),n},i.parseRtpEncodingParameters=function(e){const t=[],n=i.parseRtpParameters(e),r=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),o=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=o.length>0&&o[0].ssrc;let c;const u=i.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let n={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(n.rtx={ssrc:c}),t.push(n),r&&(n=JSON.parse(JSON.stringify(n)),n.fec={ssrc:a,mechanism:s?"red+ulpfec":"red"},t.push(n))}}),0===t.length&&a&&t.push({ssrc:a});let l=i.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substring(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substring(5),10)*.95-16e3:void 0,t.forEach(e=>{e.maxBitrate=l})),t},i.parseRtcpParameters=function(e){const t={},n=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];n&&(t.cname=n.value,t.ssrc=n.ssrc);const r=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=r.length>0,t.compound=0===r.length;const s=i.matchPrefix(e,"a=rtcp-mux");return t.mux=s.length>0,t},i.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},i.parseMsid=function(e){let t;const n=i.matchPrefix(e,"a=msid:");if(1===n.length)return t=n[0].substring(7).split(" "),{stream:t[0],track:t[1]};const r=i.matchPrefix(e,"a=ssrc:").map(e=>i.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return r.length>0?(t=r[0].value.split(" "),{stream:t[0],track:t[1]}):void 0},i.parseSctpDescription=function(e){const t=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");let r;n.length>0&&(r=parseInt(n[0].substring(19),10)),isNaN(r)&&(r=65536);const s=i.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:t.fmt,maxMessageSize:r};const o=i.matchPrefix(e,"a=sctpmap:");if(o.length>0){const e=o[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:r}}},i.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,22)},i.writeSessionBoilerplate=function(e,t,n){let r;const s=void 0!==t?t:2;r=e||i.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+r+" "+s+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.getDirection=function(e,t){const n=i.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substring(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){const t=i.splitLines(e)[0].substring(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){const t=i.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const t=i.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||"="!==t[e].charAt(1))return!1;return!0},e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=(0,i.__importDefault)(n(40)),o=n(26),a=n(41);function c(e){const t=e.application;if(t.streams&&t.streams.length&&t.sources&&t.sources.length){const e=t.streams[0];t.sources[0].parameters.msid=`${e.id} ${e.track}`,t.sourceGroups&&t.sourceGroups.length>0&&t.sources.push({parameters:{cname:t.sources[0].parameters.cname,msid:`${e.id} ${e.track}`},ssrc:t.sourceGroups[0].sources[1]})}}class u extends s.default{constructor(e){if(super(e),this.includesAudio=!1,this.includesVideo=!1,this._ringing=!1,this.pc.addEventListener("track",e=>{this.onAddTrack(e.track,e.streams[0])}),e.stream)for(const t of e.stream.getTracks())this.addTrack(t,e.stream)}get ringing(){return this._ringing}set ringing(e){e!==this._ringing&&(this._ringing=e)}get streams(){return"closed"!==this.pc.signalingState?this.pc.getRemoteStreams():[]}async start(e,t){this.state="pending",1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this.role="initiator",this.offerOptions=e;try{await this.processLocal(r.JingleAction.SessionInitiate,async()=>{const t=await this.pc.createOffer(e),n=(0,o.importFromSDP)(t.sdp),i=(0,a.convertIntermediateToRequest)(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionInitiate;for(const e of i.contents||[])e.creator="initiator",c(e);await this.pc.setLocalDescription(t),this.send("session-initiate",i)}),t()}catch(e){this._log("error","Could not create WebRTC offer",e),this.end("failed-application",!0)}}async accept(e,t){1===arguments.length&&"function"==typeof e&&(t=e,e={}),t=t||(()=>{}),e=e||{},this._log("info","Accepted incoming session"),this.state="active",this.role="responder";try{await this.processLocal(r.JingleAction.SessionAccept,async()=>{const t=await this.pc.createAnswer(e),n=(0,o.importFromSDP)(t.sdp),i=(0,a.convertIntermediateToRequest)(n,this.role,this.transportType);i.sid=this.sid,i.action=r.JingleAction.SessionAccept;for(const e of i.contents||[])e.creator="initiator";await this.pc.setLocalDescription(t),await this.processBufferedCandidates(),this.send("session-accept",i)}),t()}catch(e){this._log("error","Could not create WebRTC answer",e),this.end("failed-application")}}end(e="success",t=!1){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.end(e,t)}ring(){return this.processLocal("ring",async()=>{this._log("info","Ringing on incoming session"),this.ringing=!0,this.send(r.JingleAction.SessionInfo,{info:{infoType:r.JINGLE_INFO_RINGING}})})}mute(e,t){return this.processLocal("mute",async()=>{this._log("info","Muting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_MUTE,name:t}})})}unmute(e,t){return this.processLocal("unmute",async()=>{this._log("info","Unmuting",t),this.send(r.JingleAction.SessionInfo,{info:{creator:e,infoType:r.JINGLE_INFO_UNMUTE,name:t}})})}hold(){return this.processLocal("hold",async()=>{this._log("info","Placing on hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_HOLD}})})}resume(){return this.processLocal("resume",async()=>{this._log("info","Resuming from hold"),this.send("session-info",{info:{infoType:r.JINGLE_INFO_ACTIVE}})})}addTrack(e,t,n){return"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),this.processLocal("addtrack",async()=>{this.pc.addTrack?this.pc.addTrack(e,t):this.pc.addStream(t),n&&n()})}async removeTrack(e,t){return this.processLocal("removetrack",async()=>{if(this.pc.removeTrack(e),t)return t()})}onAddTrack(e,t){this._log("info","Track added"),this.parent.emit("peerTrackAdded",this,e,t)}onRemoveTrack(e){this._log("info","Track removed"),this.parent.emit("peerTrackRemoved",this,e)}async onSessionInitiate(e,t){this._log("info","Initiating incoming session"),this.state="pending",this.role="responder",this.transportType=e.contents[0].transport.transportType;const n=(0,a.convertRequestToIntermediate)(e,this.peerRole);for(const e of n.media)"audio"===e.kind&&(this.includesAudio=!0),"video"===e.kind&&(this.includesVideo=!0),e.streams||(e.streams=[{stream:"legacy",track:e.kind}]);const i=(0,o.exportToSDP)(n);try{return await this.pc.setRemoteDescription({type:"offer",sdp:i}),await this.processBufferedCandidates(),t()}catch(e){return this._log("error","Could not create WebRTC answer",e),t({condition:"general-error"})}}onSessionTerminate(e,t){for(const e of this.pc.getReceivers())this.onRemoveTrack(e.track);super.onSessionTerminate(e,t)}onSessionInfo(e,t){const n=e.info||{infoType:""};switch(n.infoType){case r.JINGLE_INFO_RINGING:return this._log("info","Outgoing session is ringing"),this.ringing=!0,this.parent.emit("ringing",this),t();case r.JINGLE_INFO_HOLD:return this._log("info","On hold"),this.parent.emit("hold",this),t();case r.JINGLE_INFO_UNHOLD:case r.JINGLE_INFO_ACTIVE:return this._log("info","Resuming from hold"),this.parent.emit("resumed",this),t();case r.JINGLE_INFO_MUTE:return this._log("info","Muting",n),this.parent.emit("mute",this,n),t();case r.JINGLE_INFO_UNMUTE:return this._log("info","Unmuting",n),this.parent.emit("unmute",this,n),t()}return t()}}t.default=u},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||s(t,e,n)},a=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u,l=n(6);o(n(214),t);var d=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this)||this;return i.peerConnection=t,i.haveConnectionMetrics=!1,i.statsArr=[],u="undefined"!=typeof window,i.session=n.session,i.initiator=n.initiator,i.conference=n.conference,i.statsInterval=1e3*(n.interval||5),i.logger=n.logger||console,["new","checking"].includes(t.iceConnectionState)&&("checking"===t.iceConnectionState&&(i.logger.warn("iceConnectionState is already in checking state so ice connect time may not be accurate"),i.handleIceStateChange()),t.addEventListener("iceconnectionstatechange",i.handleIceStateChange.bind(i))),t.addEventListener("connectionstatechange",i.handleConnectionStateChange.bind(i)),"connected"===t.connectionState&&i.pollForStats(),i}return r(t,e),t.prototype.handleIceStateChange=function(){var e=this,t=this.peerConnection.iceConnectionState;if("checking"===t&&u&&(this.iceStartTime=window.performance.now()),"connected"===t){if(this.haveConnectionMetrics)return;this.haveConnectionMetrics=!0;var n=void 0,i=void 0,r=void 0;u&&(this.iceConnectionTime=window.performance.now()-this.iceStartTime,n=window.navigator.userAgent,i=window.navigator.platform,r=window.navigator.hardwareConcurrency);var s={name:"connect",userAgent:n,platform:i,cores:r,session:this.session,conference:this.conference,connectTime:this.iceConnectionTime};return this.waitForSelectedCandidatePair().then((function(t){e.gatherSelectedCandidateInfo(t,s),e.emit("stats",s)}))}if("failed"===t)return u&&(this.iceFailedTime=window.performance.now()-this.iceStartTime),this.gatherStats().then((function(t){var n={name:"failure",session:e.session,initiator:e.initiator,conference:e.conference,failTime:e.iceFailedTime,iceRW:0,numLocalHostCandidates:0,numLocalSrflxCandidates:0,numLocalRelayCandidates:0,numRemoteHostCandidates:0,numRemoteSrflxCandidates:0,numRemoteRelayCandidates:0},i=e.peerConnection.localDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1})),r=e.peerConnection.remoteDescription.sdp.split("\r\n").filter((function(e){return e.indexOf("a=candidate:")>-1}));["Host","Srflx","Relay"].forEach((function(e){n["numLocal"+e+"Candidates"]=i.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length,n["numRemote"+e+"Candidates"]=r.filter((function(t){return t.split(" ")[7]===e.toLowerCase()})).length})),e.emit("stats",n)}))},t.prototype.waitForSelectedCandidatePair=function(e,t){var n=this;return void 0===e&&(e=300),void 0===t&&(t=1),this.gatherStats().then((function(i){return n.getSelectedCandidatePair(i)?i:t>3?Promise.reject(new Error("Max wait attempts for connected candidate info reached")):new Promise((function(i,r){setTimeout((function(){return n.waitForSelectedCandidatePair(e,t+1).then(i,r)}),e)}))}))},t.prototype.getSelectedCandidatePair=function(e){var t=null;return e.forEach((function(e){var n=e.value;"candidate-pair"===n.type&&n.nominated&&"succeeded"===n.state&&(t=n)})),t},t.prototype.gatherSelectedCandidateInfo=function(e,t){var n=this.getSelectedCandidatePair(e);if(n){var i,r,s=n.localCandidateId,o=n.remoteCandidateId;if(e.forEach((function(e){e.key;var n=e.value;s&&"local-candidate"===n.type&&n.id===s&&(i=n,t.localCandidateType=n.candidateType),o&&"remote-candidate"===n.type&&n.id===o&&(r=n,t.remoteCandidateType=n.candidateType)})),i&&r&&(t.candidatePair=i.candidateType+";"+r.candidateType,t.candidatePairDetails={local:i,remote:r,pair:n}),i){if(t.transport=i.transport||i.protocol,i.priority){var a=parseInt(i.priority,10);t.turnType={2:"udp",1:"tcp",0:"tls"}[a>>24],t.networkType=i.networkType}t.usingIPv6=i.ipAddress&&0===i.ipAddress.indexOf("[")}}},t.prototype.handleConnectionStateChange=function(){return a(this,void 0,void 0,(function(){var e,t=this;return c(this,(function(n){if("connected"===(e=this.peerConnection.connectionState))this.pollForStats();else{if("disconnected"===e)return"stable"!==this.peerConnection.signalingState?[2]:[2,this.gatherStats().then((function(e){var n=t.createStatsReport(e);n.type="disconnected",t.emit("stats",n)}))];"closed"===e&&this.pollingInterval&&(u&&window.clearInterval(this.pollingInterval),this.pollingInterval=null)}return[2]}))}))},t.prototype.pollForStats=function(){var e=this;if(!this.pollingInterval){var t=function(){return e.gatherStats().then((function(t){var n=e.createStatsReport(t,!0);(n.tracks.length>0||n.remoteTracks.length>0)&&e.checkBitrate(n)&&e.emit("stats",n)}))};u&&(window.setTimeout(t,0),this.pollingInterval=window.setInterval(t,this.statsInterval))}},t.prototype.checkBitrate=function(e){var t;return e.remoteTracks.length&&0!==(null===(t=e.remoteTracks[0])||void 0===t?void 0:t.bitrate)?(this.statsArr=[],!0):!(this.statsArr.length>=5)&&(this.statsArr.push(e),!0)},t.prototype.polyFillStats=function(e){if(!e)return[];if(Array.isArray(e))return e;var t=[];if(this.isNativeStatsReport(e))e.forEach((function(e,n){t.push({key:n,value:e})}));else{if(!(Object.keys(e).length>0))return this.logger.warn("Unknown stats results format, returning unmodified",e),[];Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})}))}return t},t.prototype.isNativeStatsReport=function(e){return void 0!==window.RTCStatsReport&&e instanceof window.RTCStatsReport},t.prototype.gatherStats=function(){return a(this,void 0,void 0,(function(){var e;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.peerConnection.getStats(null).then(this.polyFillStats.bind(this))];case 1:return[2,t.sent()];case 2:return e=t.sent(),this.logger.error("Failed to gather stats. Are you using RTCPeerConnection as your connection? {expect peerconnection.getStats}",{peerConnection:this.peerConnection,err:e}),[2,Promise.reject(e)];case 3:return[2]}}))}))},t.prototype.createStatsReport=function(e,t){var n=this;void 0===t&&(t=!0);var i={name:"getStats",session:this.session,initiator:this.initiator,conference:this.conference,tracks:[],remoteTracks:[]};e.filter((function(e){return["inbound-rtp","outbound-rtp"].indexOf(e.value.type)>-1})).forEach((function(t){n.processSource({source:t.value,event:i,results:e})}));var r=e.find((function(e){return"candidate-pair"===e.value.type&&"succeeded"===e.value.state&&!0===e.value.nominated}));return r&&this.processSelectedCandidatePair({report:r.value,event:i,results:e}),t&&(this.lastResult=e),i},t.prototype.processSource=function(e){var t,n,i,r,s,o,a,c=e.source,u=e.results,l=e.event,d=new Date(c.timestamp),h=this.lastResult&&this.lastResult.find((function(e){return e.key===c.id}));(h=h&&h.value)&&(t=(t=this.lastResult&&this.lastResult.find((function(e){return e.value.localId===h.id})))&&t.value),u.forEach((function(e){e.value.localId===c.id?n=e.value:e.key===c.transportId?i=e.value:e.key===c.trackId?s=e.value:e.key===c.mediaSourceId?o=e.value:e.key===c.codecId&&(a=e.value)})),i&&(r=(r=u.find((function(e){return e.key===i.selectedCandidatePairId})))&&r.value),r&&(l.candidatePairHadActiveSource=!0);var f=c.kind||c.mediaType,m="outbound-rtp"===c.type,g={track:s&&s.trackIdentifier,kind:f,jitter:p("jitter",c,n),roundTripTime:p("roundTripTime",c,n),packetsLost:p("packetsLost",c,n)||0,packetLoss:0,bytes:parseInt(m?c.bytesSent:c.bytesReceived,10)||0};if(a&&(g.codec=a.payloadType+" "+a.mimeType+" "+a.clockRate),h){var y=parseInt(m?h.bytesSent:h.bytesReceived,10)||0,b=d.getTime()-new Date(h.timestamp).getTime();g.bitrate=Math.floor(8*(g.bytes-y)/b)}var _=p("packetsLost",h,t);m?(g.packetsSent=c.packetsSent,g.packetLoss=g.packetsLost/(g.packetsSent||1)*100,h&&(g.intervalPacketsSent=g.packetsSent-(h.packetsSent||0),g.intervalPacketsLost=g.packetsLost-(_||0),g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsSent||1)*100),g.retransmittedBytesSent=c.retransmittedBytesSent,g.retransmittedPacketsSent=c.retransmittedPacketsSent):(g.packetsReceived=c.packetsReceived,g.packetLoss=g.packetsLost/(g.packetsReceived||1)*100,h&&(g.intervalPacketsReceived=g.packetsReceived-h.packetsReceived,g.intervalPacketsLost=g.packetsLost-_,g.intervalPacketLoss=g.intervalPacketsLost/(g.intervalPacketsReceived||1)*100)),s&&"audio"===f&&(s.remoteSource?(g.audioLevel=s.audioLevel,g.totalAudioEnergy=s.totalAudioEnergy):(g.echoReturnLoss=s.echoReturnLoss,g.echoReturnLossEnhancement=s.echoReturnLossEnhancement)),"audio"!==f||!o||s&&s.remoteSource||(g.audioLevel=o.audioLevel,g.totalAudioEnergy=o.totalAudioEnergy),Object.keys(g).forEach((function(e){return void 0===g[e]&&delete g[e]})),m?l.tracks.push(g):l.remoteTracks.push(g)},t.prototype.processSelectedCandidatePair=function(e){var t=this,n=e.report,i=e.event,r=e.results,s=n.localCandidateId,o=n.remoteCandidateId;i.localCandidateChanged=!!this.lastActiveLocalCandidate&&s!==this.lastActiveLocalCandidate.id,i.remoteCandidateChanged=!!this.lastActiveRemoteCandidate&&o!==this.lastActiveRemoteCandidate.id,(!this.lastActiveLocalCandidate||i.localCandidateChanged||i.remoteCandidateChanged)&&r.forEach((function(e){t.checkLastActiveCandidate({localId:s,remoteId:o,key:e.key,report:e.value})})),this.lastActiveLocalCandidate&&(i.networkType=this.lastActiveLocalCandidate.networkType,this.lastActiveRemoteCandidate&&(i.candidatePair=this.lastActiveLocalCandidate.candidateType+";"+this.lastActiveRemoteCandidate.candidateType)),i.bytesSent=n.bytesSent,i.bytesReceived=n.bytesReceived,i.requestsReceived=n.requestsReceived,i.requestsSent=n.requestsSent,i.responsesReceived=n.responsesReceived,i.responsesSent=n.responsesSent,i.consentRequestsSent=n.consentRequestsSent,i.totalRoundTripTime=n.totalRoundTripTime},t.prototype.checkLastActiveCandidate=function(e){var t=e.localId,n=e.remoteId,i=(e.key,e.report);t&&"local-candidate"===i.type&&i.id===t&&(this.lastActiveLocalCandidate=i),n&&"remote-candidate"===i.type&&i.id===n&&(this.lastActiveRemoteCandidate=i)},t}(l.EventEmitter);function p(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=t.find((function(t){return t&&(t[e]||0===t[e])}));return i&&i[e]}t.default=d},function(e,t,n){"use strict";n.r(t),n.d(t,"Axios",(function(){return r})),n.d(t,"AxiosError",(function(){return s})),n.d(t,"CanceledError",(function(){return o})),n.d(t,"isCancel",(function(){return a})),n.d(t,"CancelToken",(function(){return c})),n.d(t,"VERSION",(function(){return u})),n.d(t,"all",(function(){return l})),n.d(t,"Cancel",(function(){return d})),n.d(t,"isAxiosError",(function(){return p})),n.d(t,"spread",(function(){return h})),n.d(t,"toFormData",(function(){return f})),n.d(t,"AxiosHeaders",(function(){return m})),n.d(t,"HttpStatusCode",(function(){return g})),n.d(t,"formToJSON",(function(){return y})),n.d(t,"getAdapter",(function(){return b})),n.d(t,"mergeConfig",(function(){return _}));var i=n(50);n.d(t,"default",(function(){return i.a}));const{Axios:r,AxiosError:s,CanceledError:o,isCancel:a,CancelToken:c,VERSION:u,all:l,Cancel:d,isAxiosError:p,spread:h,toFormData:f,AxiosHeaders:m,HttpStatusCode:g,formToJSON:y,getAdapter:b,mergeConfig:_}=i.a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6),r=Math.pow(2,32),s=(e,t)=>(e%t+t)%t;class o extends i.EventEmitter{constructor(){super(),this.allowResume=!0,this.lastAck=0,this.handled=0,this.unacked=[],this.inboundStarted=!1,this.outboundStarted=!1,this.id=void 0,this.jid=void 0,this.allowResume=!0,this.started=!1,this.cacheHandler=()=>{},this._reset()}get started(){return this.outboundStarted&&this.inboundStarted}set started(e){e||(this.outboundStarted=!1,this.inboundStarted=!1)}get resumable(){return this.started&&this.allowResume}load(e){var t;this.id=e.id,this.allowResume=null===(t=e.allowResume)||void 0===t||t,this.handled=e.handled,this.lastAck=e.lastAck,this.unacked=e.unacked,this.emit("prebound",e.jid)}cache(e){this.cacheHandler=e}async bind(e){this.jid=e,await this._cache()}async enable(){this.emit("send",{allowResumption:this.allowResume,type:"enable"})}async resume(){this.emit("send",{handled:this.handled,previousSession:this.id,type:"resume"})}async enabled(e){this.id=e.id,this.allowResume=e.resume||!1,this.handled=0,this.inboundStarted=!0,await this._cache()}async resumed(e){this.id=e.previousSession,this.inboundStarted=!0,await this.process(e,!0),await this._cache()}async failed(e){await this.process(e);for(const[e,t]of this.unacked)this.emit("failed",{kind:e,stanza:t});this._reset(),await this._cache()}ack(){this.emit("send",{handled:this.handled,type:"ack"})}request(){this.emit("send",{type:"request"})}async process(e,t=!1){if(void 0===e.handled)return;const n=s(e.handled-this.lastAck,r);for(let e=0;e<n&&this.unacked.length>0;e++){const[e,t]=this.unacked.shift();this.emit("acked",{kind:e,stanza:t})}if(this.lastAck=e.handled,t){const e=this.unacked;if(this.unacked=[],e.length){this.emit("begin-resend");for(const[t,n]of e)this.emit("resend",{kind:t,stanza:n});this.emit("end-resend")}}await this._cache()}async track(e,t){const n="enable"===t.type;return"sm"!==e||!n&&"resume"!==t.type?!!this.outboundStarted&&(("message"===e||"presence"===e||"iq"===e)&&(this.unacked.push([e,t]),await this._cache(),!0)):(n&&(this.handled=0),this.outboundStarted=!0,await this._cache(),!1)}async handle(){this.inboundStarted&&(this.handled=s(this.handled+1,r),await this._cache())}async hibernate(){if(!this.resumable)return this.shutdown();for(const[e,t]of this.unacked)this.emit("hibernated",{kind:e,stanza:t})}async shutdown(){return this.failed({type:"failed"})}async _cache(){try{await this.cacheHandler({allowResume:this.allowResume,handled:this.handled,id:this.id,jid:this.jid,lastAck:this.lastAck,unacked:this.unacked})}catch(e){console.error("Failed to cache stream state",e)}}_reset(){this.id="",this.inboundStarted=!1,this.outboundStarted=!1,this.lastAck=0,this.handled=0,this.unacked=[]}}t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCRAM=t.DIGEST=t.OAUTH=t.PLAIN=t.EXTERNAL=t.ANONYMOUS=t.Hi=t.HMAC=t.H=t.XOR=t.createClientNonce=t.Factory=t.SimpleMech=void 0;const i=n(7),r=n(54);class s{constructor(e){this.authenticated=!1,this.mutuallyAuthenticated=!1,this.name=e}getCacheableCredentials(){return null}processChallenge(e){}processSuccess(e){this.authenticated=!0}finalize(){const e={authenticated:this.authenticated,mutuallyAuthenticated:this.mutuallyAuthenticated};return this.errorData&&(e.errorData=this.errorData),e}}t.SimpleMech=s;function o(e=32){return(0,i.randomBytes)(e).toString("hex")}function a(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e[i]^t[i]);return i.Buffer.from(n)}function c(e,t){return(0,i.createHash)(t).update(e).digest()}function u(e,t,n){return(0,i.createHmac)(n,e).update(t).digest()}function l(e,t,n,r){let s=u(e,i.Buffer.concat([t,i.Buffer.from("00000001","hex")]),r),o=s;for(let t=0;t<n-1;t++)s=u(e,s,r),o=a(o,s);return o}function d(e){const t={},n=e.toString().split(/,(?=(?:[^"]|"[^"]*")*$)/);for(let e=0,i=n.length;e<i;e++){const i=/(\w+)=["]?([^"]+)["]?$/.exec(n[e]);i&&(t[i[1]]=i[2])}return t}function p(e){const t=[];for(const n of e)","===n?t.push("=2C"):"="===n?t.push("=3D"):t.push(n);return t.join("")}t.Factory=class{constructor(){this.mechanisms=[]}register(e,t,n){this.mechanisms.push({constructor:t,name:e.toUpperCase(),priority:n}),this.mechanisms.sort((e,t)=>t.priority-e.priority)}disable(e){const t=e.toUpperCase();this.mechanisms=this.mechanisms.filter(e=>e.name!==t)}createMechanism(e){const t=e.map(e=>e.toUpperCase());for(const e of this.mechanisms)for(const n of t)if(n===e.name)return new e.constructor(e.name);return null}},t.createClientNonce=o,t.XOR=a,t.H=c,t.HMAC=u,t.Hi=l;t.ANONYMOUS=class extends s{getExpectedCredentials(){return{optional:["trace"],required:[]}}createResponse(e){return i.Buffer.from(e.trace||"")}};t.EXTERNAL=class extends s{getExpectedCredentials(){return{optional:["authzid"],required:[]}}createResponse(e){return i.Buffer.from(e.authzid||"")}};t.PLAIN=class extends s{getExpectedCredentials(){return{optional:["authzid"],required:["username","password"]}}createResponse(e){return i.Buffer.from((e.authzid||"")+"\0"+e.username+"\0"+(e.password||e.token))}};t.OAUTH=class extends s{constructor(e){super(e),this.failed=!1,this.name=e}getExpectedCredentials(){return{optional:["authzid"],required:["token"]}}createResponse(e){if(this.failed)return i.Buffer.from("");const t=`n,${p((0,r.saslprep)(e.authzid))},`,n=`auth=Bearer ${e.token}`;return i.Buffer.from(t+""+n+"","utf8")}processChallenge(e){this.failed=!0,this.errorData=JSON.parse(e.toString("utf8"))}};t.DIGEST=class extends s{constructor(e){super(e),this.providesMutualAuthentication=!1,this.state="INITIAL",this.name=e}processChallenge(e){this.state="CHALLENGE";const t=d(e);this.authenticated=!!t.rspauth,this.realm=t.realm,this.nonce=t.nonce,this.charset=t.charset}getExpectedCredentials(){return{optional:["authzid","clientNonce","realm"],required:["host","password","serviceName","serviceType","username"]}}createResponse(e){if("INITIAL"===this.state||this.authenticated)return null;let t=e.serviceType+"/"+e.host;e.serviceName&&e.host!==e.serviceName&&(t+="/"+e.serviceName);const n=e.realm||this.realm||"",r=e.clientNonce||o(16),s="00000001";let a="";a+='username="'+e.username+'"',n&&(a+=',realm="'+n+'"'),a+=',nonce="'+this.nonce+'"',a+=',cnonce="'+r+'"',a+=",nc="+s,a+=",qop=auth",a+=',digest-uri="'+t+'"';const c=(0,i.createHash)("md5").update(e.username).update(":").update(n).update(":").update(e.password).digest(),u=(0,i.createHash)("md5").update(c).update(":").update(this.nonce).update(":").update(r);e.authzid&&u.update(":").update(e.authzid);const l=u.digest("hex"),d=(0,i.createHash)("md5").update("AUTHENTICATE:").update(t).digest("hex");return a+=",response="+(0,i.createHash)("md5").update(l).update(":").update(this.nonce).update(":").update(s).update(":").update(r).update(":").update("auth").update(":").update(d).digest("hex"),"utf-8"===this.charset&&(a+=",charset=utf-8"),e.authzid&&(a+=',authzid="'+e.authzid+'"'),i.Buffer.from(a)}};t.SCRAM=class{constructor(e){this.providesMutualAuthentication=!0,this.name=e,this.state="INITIAL",this.useChannelBinding=this.name.toLowerCase().endsWith("-plus"),this.algorithm=this.name.toLowerCase().split("scram-")[1].split("-plus")[0]}getExpectedCredentials(){const e=["username","password"];return this.useChannelBinding&&e.push("tlsUnique"),{optional:["authzid","clientNonce"],required:e}}getCacheableCredentials(){return this.cache}createResponse(e){return"INITIAL"===this.state?this.initialResponse(e):this.challengeResponse(e)}processChallenge(e){const t=d(e);this.salt=i.Buffer.from(t.s||"","base64"),this.iterationCount=parseInt(t.i,10),this.nonce=t.r,this.verifier=t.v,this.error=t.e,this.challenge=e}processSuccess(e){this.processChallenge(e)}finalize(){return this.verifier?this.serverSignature.toString("base64")!==this.verifier?{authenticated:!1,error:"Mutual authentication failed",mutuallyAuthenticated:!1}:{authenticated:!0,mutuallyAuthenticated:!0}:{authenticated:!1,error:this.error,mutuallyAuthenticated:!1}}initialResponse(e){const t=p((0,r.saslprep)(e.authzid)),n=p((0,r.saslprep)(e.username));this.clientNonce=e.clientNonce||o();let s="n";e.tlsUnique&&(s=this.useChannelBinding?"p=tls-unique":"y"),this.gs2Header=i.Buffer.from(t?`${s},a=${t},`:s+",,"),this.clientFirstMessageBare=i.Buffer.from(`n=${n},r=${this.clientNonce}`);const a=i.Buffer.concat([this.gs2Header,this.clientFirstMessageBare]);return this.state="CHALLENGE",a}challengeResponse(e){const t=i.Buffer.from("Client Key"),n=i.Buffer.from("Server Key"),s=i.Buffer.concat([this.gs2Header,e.tlsUnique||i.Buffer.from("")]).toString("base64"),o=i.Buffer.from(`c=${s},r=${this.nonce}`);let d,p,h;const f=e.salt&&0===i.Buffer.compare(e.salt,this.salt);f&&e.clientKey&&e.serverKey?(p=i.Buffer.from(e.clientKey),h=i.Buffer.from(e.serverKey)):f&&e.saltedPassword?(d=i.Buffer.from(e.saltedPassword),p=u(d,t,this.algorithm),h=u(d,n,this.algorithm)):(d=l(i.Buffer.from((0,r.saslprep)(e.password)),this.salt,this.iterationCount,this.algorithm),p=u(d,t,this.algorithm),h=u(d,n,this.algorithm));const m=c(p,this.algorithm),g=i.Buffer.from(","),y=i.Buffer.concat([this.clientFirstMessageBare,g,this.challenge,g,o]),b=a(p,u(m,y,this.algorithm)).toString("base64");this.serverSignature=u(h,y,this.algorithm);const _=i.Buffer.concat([o,i.Buffer.from(",p="+b)]);return this.state="FINAL",this.cache={clientKey:p,salt:this.salt,saltedPassword:d,serverKey:h},_}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.getAccountInfo=async t=>(await e.sendIQ({account:{},to:t,type:"get"})).account,e.updateAccount=(t,n)=>e.sendIQ({account:n,to:t,type:"set"}),e.deleteAccount=t=>e.sendIQ({account:{remove:!0},to:t,type:"set"}),e.getPrivateData=async t=>(await e.sendIQ({privateStorage:{[t]:{}},type:"get"})).privateStorage[t],e.setPrivateData=async(t,n)=>e.sendIQ({privateStorage:{[t]:n},type:"set"}),e.getVCard=async t=>(await e.sendIQ({to:t,type:"get",vcard:{format:i.NS_VCARD_TEMP}})).vcard,e.publishVCard=async t=>{await e.sendIQ({type:"set",vcard:t})},e.enableNotifications=(t,n,i=[])=>e.sendIQ({push:{action:"enable",form:{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/pubsub#publish-options"},...i],type:"submit"},jid:t,node:n},type:"set"}),e.disableNotifications=(t,n)=>e.sendIQ({push:{action:"disable",jid:t,node:n},type:"set"})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_AVATAR_METADATA)),e.on("pubsub:published",t=>{if(t.pubsub.items.node!==i.NS_AVATAR_METADATA)return;const n=t.pubsub.items.published[0].content;e.emit("avatar",{avatars:n.versions||[],jid:t.from,source:"pubsub"})}),e.on("presence",t=>{t.vcardAvatar&&"string"==typeof t.vcardAvatar&&e.emit("avatar",{avatars:[{id:t.vcardAvatar}],jid:t.from,source:"vcard"})}),e.publishAvatar=(t,n)=>e.publish("",i.NS_AVATAR_DATA,{data:n,itemType:i.NS_AVATAR_DATA},t),e.useAvatars=(t,n=[])=>e.publish("",i.NS_AVATAR_METADATA,{itemType:i.NS_AVATAR_METADATA,pointers:n,versions:t},"current"),e.getAvatar=(t,n)=>e.getItem(t,i.NS_AVATAR_DATA,n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.registerFeature("bind",300,async(t,n)=>{try{const i=await e.sendIQ({bind:{resource:e.config.resource},type:"set"});e.features.negotiated.bind=!0,e.emit("session:prebind",i.bind.jid);const r=!t.legacySession||t.legacySession&&t.legacySession.optional;return!e.sessionStarted&&r&&e.emit("session:started",e.jid),n()}catch(e){return console.error(e),n("disconnect","JID binding failed")}}),e.registerFeature("legacySession",1e3,async(t,n)=>{if(e.sessionStarted||t.legacySession&&t.legacySession.optional)return e.features.negotiated.session=!0,n();try{return await e.sendIQ({legacySession:!0,type:"set"}),e.features.negotiated.session=!0,e.sessionStarted||(e.sessionStarted=!0,e.emit("session:started",e.jid)),n()}catch(e){return n("disconnect","Session requeset failed")}}),e.on("session:started",()=>{e.sessionStarted=!0}),e.on("session:prebind",t=>{e.jid=t,e.emit("session:bound",e.jid)}),e.on("--reset-stream-features",()=>{e.sessionStarted=!1,e.features.negotiated.bind=!1,e.features.negotiated.session=!1})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature(i.NS_ADHOC_COMMANDS),e.disco.addItem({name:"Ad-Hoc Commands",node:i.NS_ADHOC_COMMANDS}),e.getCommands=t=>e.getDiscoItems(t,i.NS_ADHOC_COMMANDS)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r=n(10);function s(e,t){e.features.negotiated.clientStateIndication&&e.send("csi",{type:t})}t.default=function(e){e.disco.addFeature(i.NS_PING),e.on("iq:get:ping",t=>{e.sendIQResult(t)}),e.on("--reset-stream-features",()=>{e._stopKeepAliveInterval(),e.features.negotiated.streamManagement=!1,e.features.negotiated.clientStateIndication=!1}),e.markActive=()=>s(e,"active"),e.markInactive=()=>s(e,"inactive"),e.ping=async t=>{await e.sendIQ({ping:!0,to:t,type:"get"})},e.enableKeepAlive=(t={})=>{e._keepAliveOptions=t;const n=t.interval||300,i=t.timeout||e.config.timeout||15;clearInterval(e._keepAliveInterval),e._keepAliveInterval=setInterval((async function(){if(e.sessionStarted)try{await(0,r.timeoutPromise)(async function(e){if(e.sm.started)return new Promise(t=>{e.once("stream:management:ack",()=>t()),e.sm.request()});try{await e.ping()}catch(e){if(e.error&&"timeout"!==e.error.condition)return;throw e}}(e),1e3*i)}catch(t){e.emit("stream:error",{condition:"connection-timeout",text:"Server did not respond in "+i+" seconds"}),e.transport&&(e.transport.hasStream=!1,e.transport.disconnect(!1))}}),1e3*n)},e._stopKeepAliveInterval=()=>{e._keepAliveInterval&&(clearInterval(e._keepAliveInterval),delete e._keepAliveInterval)},e.disableKeepAlive=()=>{delete e._keepAliveOptions,e._stopKeepAliveInterval()},e.on("stream:management:resumed",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)}),e.on("stream:start",()=>{e._keepAliveOptions&&e.enableKeepAlive(e._keepAliveOptions)});const t=async(t,n)=>{if(!e.config.useStreamManagement)return n();const i=async t=>{switch(t.type){case"enabled":return await e.sm.enabled(t),e.features.negotiated.streamManagement=!0,e.off("sm",i),n();case"resumed":return await e.sm.resumed(t),e.features.negotiated.streamManagement=!0,e.features.negotiated.bind=!0,e.sessionStarted=!0,e.sessionStarting=!1,e.off("sm",i),e.emit("stream:management:resumed",t),n("break");case"failed":await e.sm.failed(t),e.off("sm",i),e.emit("session:end"),n()}};e.on("sm",i),e.sm.id?e.sm.id&&e.sm.allowResume?await e.sm.resume():(e.off("sm",i),n()):e.features.negotiated.bind?await e.sm.enable():(e.off("sm",i),n())};e.registerFeature("streamManagement",200,t),e.registerFeature("streamManagement",500,t),e.registerFeature("clientStateIndication",400,(t,n)=>{e.features.negotiated.clientStateIndication=!0,n()})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=(0,i.__importDefault)(n(220)),s=(0,i.__importStar)(n(8)),o=n(1);t.default=function(e){e.disco=new r.default,e.disco.addFeature(o.NS_DISCO_INFO),e.disco.addFeature(o.NS_DISCO_ITEMS),e.disco.addIdentity({category:"client",type:"web"}),e.registerFeature("caps",100,(t,n)=>{const i=s.getDomain(e.jid)||e.config.server;e.emit("disco:caps",{caps:t.legacyCapabilities||[],jid:i}),e.features.negotiated.caps=!0,n()}),e.getDiscoInfo=async(t,n)=>({extensions:[],features:[],identities:[],...(await e.sendIQ({disco:{node:n,type:"info"},to:t,type:"get"})).disco}),e.getDiscoItems=async(t,n)=>({items:[],...(await e.sendIQ({disco:{node:n,type:"items"},to:t,type:"get"})).disco}),e.updateCaps=()=>{const t=e.config.capsNode||"https://stanzajs.org";return e.disco.updateCaps(t)},e.getCurrentCaps=()=>{const t=e.disco.getCaps();if(!t)return;const n=`${t[0].node}#${t[0].value}`;return{info:e.disco.getNodeInfo(n),legacyCapabilities:t}},e.on("presence",t=>{t.legacyCapabilities&&e.emit("disco:caps",{caps:t.legacyCapabilities,jid:t.from})}),e.on("iq:get:disco",t=>{const{type:n,node:i}=t.disco;"info"===n&&e.sendIQResult(t,{disco:{...e.disco.getNodeInfo(i||""),node:i,type:"info"}}),"items"===n&&e.sendIQResult(t,{disco:{items:e.disco.items.get(i||"")||[],type:"items"}})})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=n(1),o=(0,i.__importStar)(n(7));t.default=function(e){e.disco.addFeature("jid\\20escaping"),e.disco.addFeature(s.NS_DELAY),e.disco.addFeature(s.NS_EME_0),e.disco.addFeature(s.NS_FORWARD_0),e.disco.addFeature(s.NS_HASHES_2),e.disco.addFeature(s.NS_HASHES_1),e.disco.addFeature(s.NS_IDLE_1),e.disco.addFeature(s.NS_JSON_0),e.disco.addFeature(s.NS_OOB),e.disco.addFeature(s.NS_PSA),e.disco.addFeature(s.NS_REFERENCE_0),e.disco.addFeature(s.NS_SHIM),e.disco.addFeature(s.NS_DATAFORM),e.disco.addFeature(s.NS_DATAFORM_MEDIA),e.disco.addFeature(s.NS_DATAFORM_VALIDATION),e.disco.addFeature(s.NS_DATAFORM_LAYOUT);const t=o.getHashes();for(const n of t)e.disco.addFeature((0,s.NS_HASH_NAME)(n));e.disco.addFeature(s.NS_TIME),e.disco.addFeature(s.NS_VERSION),e.on("iq:get:softwareVersion",t=>e.sendIQResult(t,{softwareVersion:e.config.softwareVersion||{name:"stanzajs.org",version:r.VERSION}})),e.on("iq:get:time",t=>{const n=new Date;e.sendIQResult(t,{time:{tzo:n.getTimezoneOffset(),utc:n}})}),e.getSoftwareVersion=async t=>(await e.sendIQ({softwareVersion:{},to:t,type:"get"})).softwareVersion,e.getTime=async t=>(await e.sendIQ({time:{},to:t,type:"get"})).time,e.getLastActivity=async t=>(await e.sendIQ({lastActivity:{},to:t,type:"get"})).lastActivity}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.features={handlers:Object.create(null),negotiated:Object.create(null),order:[]},e.registerFeature=function(t,n,i){this.features.order.push({name:t,priority:n}),this.features.order.sort((e,t)=>e.priority-t.priority),this.features.handlers[t]=i.bind(e)},e.on("features",async t=>{const n=e.features.negotiated,i=e.features.handlers,r=[];for(const{name:s}of e.features.order)t[s]&&i[s]&&!n[s]&&r.push(s);function s(e){return new Promise(n=>{i[e](t,(e,t)=>{n(e?{command:e,message:t}:null)})})}for(const t of r){if(n[t])continue;let i="",r="";try{const e=await s(t);e&&(i=e.command,r=e.message||"")}catch(e){i="disconnect",r=e.message,console.error(e)}if(i)return"restart"===i&&e.transport&&e.transport.restart(),void("disconnect"===i&&(e.emit("stream:error",{condition:"policy-violation",text:"Failed to negotiate stream features: "+r}),e.disconnect()))}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.discoverBindings=async t=>{const n=new Set,r=new Set,s=e.resolver.getHostMeta(t).then(e=>{var t;for(const s of null!==(t=e.links)&&void 0!==t?t:[])s.href&&s.rel===i.NS_ALT_CONNECTIONS_WEBSOCKET&&r.add(s.href),s.href&&s.rel===i.NS_ALT_CONNECTIONS_XBOSH&&n.add(s.href)}).catch(e=>console.error(e)),o=e.config.allowAlternateDNSDiscovery?e.resolver.resolveTXT("_xmppconnect."+t).then(e=>{for(const t of e)for(const e of t){if(e.startsWith("_xmpp-client-websocket=")){const t=e.substring(e.indexOf("=")+1);t&&r.add(t)}if(e.startsWith("_xmpp-client-xbosh=")){const t=e.substring(e.indexOf("=")+1);t&&n.add(t)}}}).catch(e=>console.error(e)):Promise.resolve();return await Promise.all([s,o]).catch(e=>console.error(e)),{bosh:[...n].filter(e=>e.startsWith("https://")),websocket:[...r].filter(e=>e.startsWith("wss://"))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(7),s=(0,i.__importStar)(n(39)),o=n(1);t.default=function(e){const t=!!r.RTCPeerConnection,n={...{advertiseAudio:t,advertiseFileTransfer:t,advertiseVideo:t,bundlePolicy:"balanced",hasRTCPeerConnection:t,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",rtcpMuxPolicy:"require",trickleIce:!0},...e.config.jingle},i=e.jingle=new s.SessionManager(n),a=[o.NS_JINGLE_1];n.hasRTCPeerConnection&&(a.push(o.NS_JINGLE_ICE_0,o.NS_JINGLE_ICE_UDP_1,o.NS_JINGLE_DTLS_SCTP_1,o.NS_JINGLE_DTLS_0,"urn:ietf:rfc:5888"),!1===n.trickleIce&&a.push("urn:ietf:rfc:3264"),(n.advertiseAudio||n.advertiseVideo)&&a.push(o.NS_JINGLE_RTP_1,o.NS_JINGLE_RTP_RTCP_FB_0,o.NS_JINGLE_RTP_HDREXT_0,"urn:ietf:rfc:5576"),n.advertiseAudio&&a.push(o.NS_JINGLE_RTP_AUDIO),n.advertiseVideo&&a.push(o.NS_JINGLE_RTP_VIDEO),n.advertiseFileTransfer&&a.push(o.NS_JINGLE_FILE_TRANSFER_4,o.NS_JINGLE_FILE_TRANSFER_5));for(const t of a)e.disco.addFeature(t);const c=["outgoing","incoming","accepted","terminated","ringing","mute","unmute","hold","resumed"];for(const t of c)i.on(t,(n,i)=>{e.emit("jingle:"+t,n,i)});i.on("createdSession",t=>{e.emit("jingle:created",t)}),i.on("send",async t=>{try{if("set"===t.type){const n=await e.sendIQ(t);n.jingle||(n.jingle={}),n.jingle.sid=t.jingle.sid,i.process(n)}"result"===t.type&&e.sendIQResult({type:"set",id:t.id,from:t.to},t),"error"===t.type&&e.sendIQError({type:"set",id:t.id,from:t.to},t)}catch(e){e.jingle||(e.jingle=t.jingle),e.jingle.sid=t.jingle.sid,i.process(e)}}),e.on("session:bound",e=>{i.selfID=e}),e.on("iq:set:jingle",e=>{i.process(e)}),e.on("unavailable",e=>{i.endPeerSessions(e.from,void 0,!0)}),e.getServices=async(t,n,i)=>{const r=(await e.sendIQ({externalServices:{type:n,version:i},to:t,type:"get"})).externalServices;return r.services=r.services||[],r},e.getServiceCredentials=async(t,n,i,r,s)=>(await e.sendIQ({externalServiceCredentials:{host:n,port:r,type:i,version:s},to:t,type:"get"})).externalServiceCredentials,e.discoverICEServers=async(t={})=>{try{const n=(await e.getServices(e.config.server,void 0,t.version)).services||[],i=[];for(const t of n)e.jingle.addICEServer(t);return i}catch(e){return[]}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(80),s=(0,i.__importStar)(n(8)),o=n(1);t.default=function(e){e.getHistorySearchForm=async(t,n={})=>(await e.sendIQ({archive:{type:"query",version:n.version},to:t,type:"get"})).archive.form,e.searchHistory=async(t,n={})=>{const i=e.nextId();let a="";"string"==typeof t?a=t:(a=t.to||"",n=t),n.queryId=i;const c=n.form||{};c.type="submit";const u=c.fields||[],l=[{name:"FORM_TYPE",type:"hidden",value:o.NS_MAM_2}];n.with&&l.push({name:"with",type:"text-single",value:n.with}),n.start&&l.push({name:"start",type:"text-single",value:n.start.toISOString()}),n.end&&l.push({name:"end",type:"text-single",value:n.end.toISOString()}),c.fields=(0,r.mergeFields)(l,u),n.form=c;const d=s.allowedResponders(e.jid,a),p=[],h=e=>{d.has(e.from)&&e.archive&&e.archive.queryId===i&&p.push(e.archive)};e.on("mam:item",h);try{return{...(await e.sendIQ({archive:n,id:i,to:a,type:"set"})).archive,results:p}}finally{e.off("mam:item",h)}},e.getHistoryPreferences=async()=>(await e.sendIQ({archive:{type:"preferences"},type:"get"})).archive,e.setHistoryPreferences=t=>e.sendIQ({archive:{type:"preferences",...t},type:"set"}),e.on("message",t=>{t.archive&&e.emit("mam:item",t)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeFields=void 0,t.mergeFields=function(e,t){const n=[],i=new Map;for(const e of t)e.name&&i.set(e.name,e);const r=new Set;for(const t of e)t.name&&i.has(t.name)?(n.push({...t,...i.get(t.name)}),r.add(t.name)):n.push({...t});for(const e of t)(!e.name||e.name&&!r.has(e.name))&&n.push({...e});return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1),s=new Set(["chat","groupchat","headline","normal"]),o=new Set(["chat","groupchat","normal"]),a=new Map([["markable",0],["received",1],["displayed",2],["acknowledged",3]]),c=(e,t)=>{var n;return e.marker&&(a.get(e.marker.type)<a.get(t)||"markable"===(null===(n=e.marker)||void 0===n?void 0:n.type))};async function u(e,t){await e.sendIQ({carbons:{action:t},type:"set"})}t.default=function(e){e.disco.addFeature(r.NS_ATTENTION_0),e.disco.addFeature(r.NS_CHAT_MARKERS_0),e.disco.addFeature(r.NS_CHAT_STATES),e.disco.addFeature(r.NS_CORRECTION_0),e.disco.addFeature(r.NS_RECEIPTS),e.disco.addFeature(r.NS_RTT_0),e.enableCarbons=()=>u(e,"enable"),e.disableCarbons=()=>u(e,"disable"),e.markReceived=t=>e.sendMarker(t,"received"),e.markDisplayed=t=>e.sendMarker(t,"displayed"),e.markAcknowledged=t=>e.sendMarker(t,"acknowledged"),e.getAttention=(t,n={})=>e.sendMessage({...n,requestingAttention:!0,to:t,type:"headline"}),e.sendMarker=(t,n,r)=>{if(!c(t,n)&&!r)return;const s=!1!==e.config.groupchatMarkersUseStanzaID;let o=t.id;if("groupchat"===t.type&&t.stanzaIds&&s){const e=t.stanzaIds.find(e=>i.equalBare(e.by,t.from));e&&(o=e.id)}e.sendMessage({marker:{id:o,type:n},to:"groupchat"===t.type?i.toBare(t.from):t.from,type:t.type})},e.on("message",t=>{if(t.carbon&&i.equalBare(t.from,e.jid)){const n=t.carbon.forward.message;n.delay||(n.delay=t.carbon.forward.delay||{timestamp:new Date(Date.now())}),(e=>!!e.carbon&&"received"===e.carbon.type)(t)&&(e.emit("carbon:received",t),e.emit("message",n)),(e=>!!e.carbon&&"sent"===e.carbon.type)(t)&&(e.emit("carbon:sent",t),e.emit("message:sent",n,!0))}(e=>!!e.forms&&e.forms.length>0)(t)&&e.emit("dataform",t),t.requestingAttention&&e.emit("attention",t),(e=>!!e.rtt)(t)&&e.emit("rtt",t),(e=>!!e.replace)(t)&&e.emit("replace",t),(e=>!!e.chatState)(t)&&o.has(t.type||"normal")&&e.emit("chat:state",t);const n=!1!==e.config.sendReceipts,r=!1!==e.config.sendMUCReceipts,a=!1!==e.config.chatMarkers,u=!1!==e.config.groupchatMarkersUseStanzaID,l=(e=>{var t;return!!e.receipt&&"request"===e.receipt.type&&s.has(null!==(t=e.type)&&void 0!==t?t:"normal")})(t),d=c(t,"received"),p=l&&n&&("groupchat"!==t.type||r);if(p||a&&d){const n="groupchat"===t.type?i.toBare(t.from):t.from;let r=t.id;if("groupchat"===t.type&&t.stanzaIds&&u){const e=t.stanzaIds.find(e=>i.equalBare(e.by,t.from));e&&(r=e.id)}e.sendMessage({receipt:p?{id:t.id,type:"received"}:void 0,marker:a&&d?{id:r,type:"received"}:void 0,to:n,type:t.type})}t.receipt&&"received"===t.receipt.type&&e.emit("receipt",t),t.marker&&"markable"!==t.marker.type&&e.emit("marker:"+t.marker.type,t)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3),r=n(5),s=(0,i.__importStar)(n(8)),o=n(1),a=n(10);t.default=function(e){e.disco.addFeature(o.NS_MUC),e.disco.addFeature(o.NS_MUC_DIRECT_INVITE),e.disco.addFeature(o.NS_HATS_0),e.joinedRooms=new Map,e.joiningRooms=new Map,e.leavingRooms=new Map,e.on("session:started",(function(){const t=e.joiningRooms;e.joiningRooms=new Map;for(const[n,i]of t)e.joinRoom(n,i);const n=e.joinedRooms;e.joinedRooms=new Map;for(const[t,i]of n)e.joinRoom(t,i)})),e.on("message",t=>{if("groupchat"!==t.type||!t.hasSubject||t.body){if(t.muc)if("direct-invite"===t.muc.type||!t.muc.invite&&t.legacyMUC){const n="direct-invite"===t.muc.type?t.muc:t.legacyMUC;e.emit("muc:invite",{from:t.from,password:n.password,reason:n.reason,room:n.jid,thread:n.thread,type:"direct"})}else t.muc.invite?e.emit("muc:invite",{from:t.muc.invite[0].from,password:t.muc.password,reason:t.muc.invite[0].reason,room:t.from,thread:t.muc.invite[0].thread,type:"mediated"}):t.muc.decline?e.emit("muc:declined",{from:t.muc.decline.from,reason:t.muc.decline.reason,room:t.from}):e.emit("muc:other",t)}else e.emit("muc:topic",{from:t.from,room:s.toBare(t.from),topic:t.subject||""})}),e.on("presence",t=>{const n=s.toBare(t.from);if(e.joiningRooms.has(n)&&"error"===t.type)return e.joiningRooms.delete(n),e.emit("muc:failed",t),void e.emit("muc:error",t);if(!function(e){return!!e.muc}(t))return;const i=t.muc.statusCodes&&t.muc.statusCodes.indexOf(r.MUCStatusCode.SelfPresence)>=0,o=t.muc.statusCodes&&t.muc.statusCodes.indexOf(r.MUCStatusCode.NickChanged)>=0;if("error"===t.type)return void e.emit("muc:error",t);if("unavailable"===t.type)return e.emit("muc:unavailable",t),i&&(o?e.joinedRooms.set(n,t.muc.nick):(e.emit("muc:leave",t),e.joinedRooms.delete(n),e.leavingRooms.delete(n))),void(t.muc.destroy&&e.emit("muc:destroyed",{newRoom:t.muc.destroy.jid,password:t.muc.destroy.password,reason:t.muc.destroy.reason,room:n}));e.emit("muc:available",t);const a=e.joiningRooms.has(n)||!e.joinedRooms.has(n);i&&(e.joinedRooms.set(n,s.getResource(t.from)),a&&(e.joiningRooms.delete(n),e.emit("muc:join",t)))}),e.joinRoom=async(t,n,i={})=>{if(t=s.toBare(t),e.joiningRooms.set(t,n||""),!n)try{n=await e.getReservedNick(t),e.joiningRooms.set(t,n)}catch(e){throw new Error("Room nick required")}return new Promise((r,o)=>{function a(n){s.equalBare(n.from,t)&&(e.off("muc:join",a),e.off("muc:failed",c),r(n))}function c(n){s.equalBare(n.from,t)&&(e.off("muc:join",a),e.off("muc:failed",c),o(n))}e.on("muc:join",a),e.on("muc:failed",c),e.sendPresence({...i,muc:{...i.muc,type:"join"},to:s.createFull(t,n)})})},e.leaveRoom=(t,n,i={})=>(t=s.toBare(t),n=n||e.joinedRooms.get(t),e.leavingRooms.set(t,n),new Promise((r,o)=>{const c=i.id||(0,a.uuid)(),u=s.allowedResponders(t);function l(n){s.equalBare(n.from,t)&&(e.off("muc:leave",l),e.off("presence:error",d),r(n))}function d(n){n.id===c&&u.has(n.from)&&(e.joinedRooms.has(t)||e.leavingRooms.delete(t),e.off("muc:leave",l),e.off("presence:error",d),o(n))}e.on("muc:leave",l),e.on("presence:error",d),e.sendPresence({...i,id:c,to:s.createFull(t,n),type:"unavailable"})})),e.ban=(t,n,i)=>e.setRoomAffiliation(t,n,"outcast",i),e.kick=(t,n,i)=>e.setRoomRole(t,n,"none",i),e.invite=(t,n=[])=>{Array.isArray(n)||(n=[n]),e.sendMessage({muc:{invite:n,type:"info"},to:t})},e.directInvite=(t,n,i={})=>{e.sendMessage({muc:{...i,jid:t,type:"direct-invite"},to:n})},e.declineInvite=(t,n,i)=>{e.sendMessage({muc:{decline:{reason:i,to:n},type:"info"},to:t})},e.changeNick=(t,n)=>{const i=(0,a.uuid)(),o=s.createFull(t,n),c=s.allowedResponders(t);return new Promise((t,n)=>{function a(n){c.has(s.toBare(n.from))&&n.muc.statusCodes&&n.muc.statusCodes.includes(r.MUCStatusCode.SelfPresence)&&(e.off("muc:available",a),e.off("presence:id:"+i,u),t(n))}function u(r){c.has(s.toBare(r.from))&&r.id===i&&(e.off("muc:available",a),e.off("presence:id:"+i,u),"error"===r.type?n(r):t(r))}e.on("muc:available",a),e.on("presence:id:"+i,u),e.sendPresence({id:i,to:o})})},e.setSubject=(t,n)=>{e.sendMessage({subject:n,to:t,type:"groupchat"})},e.getReservedNick=async t=>{try{const n=(await e.getDiscoInfo(t,"x-roomuser-item")).identities[0];if(n.name)return n.name;throw new Error("No nickname reserved")}catch(e){throw new Error("No nickname reserved")}},e.requestRoomVoice=t=>{e.sendMessage({forms:[{fields:[{name:"FORM_TYPE",type:"hidden",value:"http://jabber.org/protocol/muc#request"},{name:"muc#role",type:"text-single",value:"participant"}],type:"submit"}],to:t})},e.setRoomAffiliation=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{affiliation:i,jid:n,reason:r}]},to:t,type:"set"}),e.setRoomRole=(t,n,i,r)=>e.sendIQ({muc:{type:"user-list",users:[{nick:n,reason:r,role:i}]},to:t,type:"set"}),e.getRoomMembers=(t,n={affiliation:"member"})=>e.sendIQ({muc:{type:"user-list",users:[n]},to:t,type:"get"}),e.getRoomConfig=async t=>{const n=await e.sendIQ({muc:{type:"configure"},to:t,type:"get"});if(!n.muc.form)throw new Error("No configuration form returned");return n.muc.form},e.configureRoom=(t,n={})=>e.sendIQ({muc:{form:{...n,type:"submit"},type:"configure"},to:t,type:"set"}),e.destroyRoom=(t,n={})=>e.sendIQ({muc:{destroy:n,type:"configure"},to:t,type:"set"}),e.getUniqueRoomName=async function(e){const t=await this.sendIQ({muc:{type:"unique"},to:e,type:"get"});if(!t.muc.name)throw new Error("No unique name returned");return t.muc.name},e.getBookmarks=async()=>{const t=await e.getPrivateData("bookmarks");return t&&t.rooms?t.rooms:[]},e.setBookmarks=t=>e.setPrivateData("bookmarks",{rooms:t}),e.addBookmark=async t=>{const n=await e.getBookmarks(),i=[];let r=!1;for(const e of n)s.equalBare(e.jid,t.jid)?(i.push({...e,...t}),r=!0):i.push(e);return r||i.push(t),e.setBookmarks(i)},e.removeBookmark=async t=>{const n=(await e.getBookmarks()).filter(e=>!s.equalBare(e.jid,t));return e.setBookmarks(n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1);t.default=function(e){e.disco.addFeature(i.NS_ACTIVITY),e.disco.addFeature(i.NS_GEOLOC),e.disco.addFeature(i.NS_MOOD),e.disco.addFeature(i.NS_NICK),e.disco.addFeature(i.NS_TUNE),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_ACTIVITY)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_GEOLOC)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_MOOD)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_NICK)),e.disco.addFeature((0,i.NS_PEP_NOTIFY)(i.NS_TUNE)),e.publishActivity=t=>e.publish("",i.NS_ACTIVITY,{itemType:i.NS_ACTIVITY,...t}),e.publishGeoLoc=t=>e.publish("",i.NS_GEOLOC,{itemType:i.NS_GEOLOC,...t}),e.publishMood=t=>e.publish("",i.NS_MOOD,{itemType:i.NS_MOOD,...t}),e.publishNick=t=>e.publish("",i.NS_NICK,{itemType:i.NS_NICK,nick:t}),e.publishTune=t=>e.publish("",i.NS_TUNE,{itemType:i.NS_TUNE,...t}),e.on("pubsub:published",t=>{const n=t.pubsub.items.published[0].content;switch(t.pubsub.items.node){case i.NS_ACTIVITY:return e.emit("activity",{activity:n,jid:t.from});case i.NS_GEOLOC:return e.emit("geoloc",{geoloc:n,jid:t.from});case i.NS_MOOD:return e.emit("mood",{jid:t.from,mood:n});case i.NS_NICK:return e.emit("nick",{jid:t.from,nick:n.nick});case i.NS_TUNE:return e.emit("tune",{jid:t.from,tune:t.pubsub.items.published[0].content})}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1);t.default=function(e){e.disco.addFeature(r.NS_SHIM+"#SubID",r.NS_SHIM),e.on("message",t=>{!function(e){return!!e.pubsub&&!(e.pubsub.context&&"user"!==e.pubsub.context||!e.pubsub.affiliations)}(t)?function(e){return!!e.pubsub}(t)&&(e.emit("pubsub:event",t),!function(e){return!!e.pubsub.items&&!!e.pubsub.items.published}(t)?!function(e){return!!e.pubsub.items&&!!e.pubsub.items.retracted}(t)?!function(e){return"purge"===e.pubsub.eventType}(t)?!function(e){return"delete"===e.pubsub.eventType}(t)?!function(e){return"subscription"===e.pubsub.eventType}(t)?function(e){return"configuration"===e.pubsub.eventType}(t)&&e.emit("pubsub:config",t):e.emit("pubsub:subscription",t):e.emit("pubsub:deleted",t):e.emit("pubsub:purged",t):e.emit("pubsub:retracted",t):e.emit("pubsub:published",t)):e.emit("pubsub:affiliations",t)}),e.subscribeToNode=async(t,n)=>{const r={};let s;"string"==typeof n?(r.node=n,r.jid=i.toBare(e.jid)):(r.node=n.node,r.jid=n.jid||(n.useBareJID?i.toBare(e.jid):e.jid),s=n.options);const o=await e.sendIQ({pubsub:{context:"user",subscribe:r,subscriptionOptions:s?{form:s}:void 0},to:t,type:"set"}),a=o.pubsub.subscription||{};return o.pubsub.subscriptionOptions&&(a.options=o.pubsub.subscriptionOptions.form),a},e.unsubscribeFromNode=async(t,n)=>{const r={};"string"==typeof n?(r.node=n,r.jid=i.toBare(e.jid)):(r.node=n.node,r.subid=n.subid,r.jid=n.jid||(n.useBareJID?i.toBare(e.jid):e.jid));const s=await e.sendIQ({pubsub:{context:"user",unsubscribe:r},to:t,type:"set"});return s.pubsub&&s.pubsub.subscription?s.pubsub.subscription:{...r,state:"none"}},e.publish=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",publish:{item:{content:i,id:r},node:n}},to:t,type:"set"}),e.getItem=async(t,n,i)=>(await e.sendIQ({pubsub:{context:"user",fetch:{items:[{id:i}],node:n}},to:t,type:"get"})).pubsub.fetch.items[0],e.getItems=async(t,n,i={})=>{const r=await e.sendIQ({pubsub:{context:"user",fetch:{max:i.max,node:n},paging:i},to:t,type:"get"}),s=r.pubsub.fetch;return s.paging=r.pubsub.paging,s},e.retract=(t,n,i,r)=>e.sendIQ({pubsub:{context:"user",retract:{id:i,node:n,notify:r}},to:t,type:"set"}),e.purgeNode=(t,n)=>e.sendIQ({pubsub:{context:"owner",purge:n},to:t,type:"set"}),e.deleteNode=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",destroy:{node:n,redirect:i}},to:t,type:"set"}),e.createNode=async(t,n,i)=>{const r=await e.sendIQ({pubsub:{configure:i?{form:i}:void 0,context:"user",create:{node:n}},to:t,type:"set"});return r.pubsub&&r.pubsub.create?r.pubsub.create:{node:n}},e.getSubscriptions=async(t,n={})=>(await e.sendIQ({pubsub:{context:"user",subscriptions:n},to:t,type:"get"})).pubsub.subscriptions,e.getAffiliations=(t,n)=>e.sendIQ({pubsub:{affiliations:{node:n}},to:t,type:"get"}),e.getNodeSubscribers=(t,n,i={})=>("string"==typeof n?i.node=n:i={...i,...n},e.sendIQ({pubsub:{context:"owner",subscriptions:i},to:t,type:"get"})),e.updateNodeSubscriptions=(t,n,i)=>e.sendIQ({pubsub:{context:"owner",subscriptions:{items:i,node:n}},to:t,type:"set"}),e.getNodeAffiliations=async(t,n)=>(await e.sendIQ({pubsub:{affiliations:{node:n},context:"owner"},to:t,type:"get"})).pubsub.affiliations,e.updateNodeAffiliations=(t,n,i)=>e.sendIQ({pubsub:{affiliations:{items:i,node:n},context:"owner"},to:t,type:"set"}),e.getNodeConfig=async(t,n)=>(await e.sendIQ({pubsub:{configure:{node:n},context:"owner"},to:t,type:"get"})).pubsub.configure.form||{},e.getDefaultNodeConfig=async t=>(await e.sendIQ({pubsub:{context:"owner",defaultConfiguration:{}},to:t,type:"get"})).pubsub.defaultConfiguration.form||{},e.configureNode=async(t,n,i)=>e.sendIQ({pubsub:{configure:{form:i,node:n},context:"owner"},to:t,type:"set"}),e.getDefaultSubscriptionOptions=async t=>(await e.sendIQ({pubsub:{defaultSubscriptionOptions:{}},to:t,type:"get"})).pubsub.defaultSubscriptionOptions.form||{}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8));t.default=function(e){async function t(t,n){await e.sendIQ({blockList:{action:t,jids:[n]},type:"set"})}e.on("iq:set:roster",t=>{if(!i.allowedResponders(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});e.emit("roster:update",t),e.sendIQResult(t)}),e.on("iq:set:blockList",t=>{if(!i.allowedResponders(e.jid).has(t.from))return e.sendIQError(t,{error:{condition:"service-unavailable",type:"cancel"}});const n=t.blockList;e.emit(n.action,{jids:n.jids||[]}),e.sendIQResult(t)}),e.getRoster=async()=>{const t=await e.sendIQ({roster:{version:e.config.rosterVer},type:"get"});if(t.roster){const n=t.roster.version;return n&&(e.config.rosterVer=n,e.emit("roster:ver",n)),t.roster.items=t.roster.items||[],t.roster}return{items:[]}},e.updateRosterItem=async t=>{await e.sendIQ({roster:{items:[t]},type:"set"})},e.removeRosterItem=t=>e.updateRosterItem({jid:t,subscription:"remove"}),e.subscribe=t=>{e.sendPresence({type:"subscribe",to:t})},e.unsubscribe=t=>{e.sendPresence({type:"unsubscribe",to:t})},e.acceptSubscription=t=>{e.sendPresence({type:"subscribed",to:t})},e.denySubscription=t=>{e.sendPresence({type:"unsubscribed",to:t})},e.getBlocked=async()=>({jids:[],...(await e.sendIQ({blockList:{action:"list"},type:"get"})).blockList}),e.block=async e=>t("block",e),e.unblock=async e=>t("unblock",e),e.goInvisible=async(t=!1)=>{await e.sendIQ({type:"set",visiblity:{probe:t,type:"invisible"}})},e.goVisible=async()=>{await e.sendIQ({type:"set",visiblity:{type:"visible"}})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e.registerFeature("sasl",100,async(t,n)=>{const i=e.sasl.createMechanism(t.sasl.mechanisms),r=async t=>{if(i)switch(t.type){case"success":return e.features.negotiated.sasl=!0,e.off("sasl",r),e.emit("auth:success",e.config.credentials),e.transport&&(e.transport.authenticated=!0),void n("restart");case"challenge":i.processChallenge(t.value);try{const t=await e.getCredentials(),n=i.createResponse(t);n||""===n?e.send("sasl",{type:"response",value:n}):e.send("sasl",{type:"response"});const r=i.getCacheableCredentials();r&&(e.config.credentials||(e.config.credentials={}),e.config.credentials={...e.config.credentials,...r},e.emit("credentials:update",e.config.credentials))}catch(t){console.error(t),e.send("sasl",{type:"abort"})}return;case"failure":case"abort":return e.off("sasl",r),e.emit("auth:failed"),void n("disconnect","authentication failed")}};if(!i)return e.off("sasl",r),e.emit("auth:failed"),n("disconnect","authentication failed");e.on("sasl",r),e.once("--reset-stream-features",()=>{e.features.negotiated.sasl=!1,e.off("sasl",r)});try{const t=await e.getCredentials();e.send("sasl",{mechanism:i.name,type:"auth",value:i.createResponse(t)})}catch(t){console.error(t),e.send("sasl",{type:"abort"})}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=(0,n(3).__importStar)(n(8)),r=n(1);t.default=function(e){async function t(t){const n=await e.getDiscoInfo(t);if(!n.features||!n.features.includes(r.NS_HTTP_UPLOAD_0))return;let i;for(const e of n.extensions||[]){const n=e.fields||[];if(n.some(e=>"FORM_TYPE"===e.name&&e.value===r.NS_HTTP_UPLOAD_0)){const e=n.find(e=>"max-file-size"===e.name);return e&&(i=parseInt(e.value,10)),{jid:t,maxSize:i}}}}e.disco.addFeature(r.NS_BOB),e.getBits=async(t,n)=>(await e.sendIQ({bits:{cid:n},to:t,type:"get"})).bits,e.getUploadService=async(n=i.getDomain(e.jid))=>{const r=await t(n);if(r)return r;const s=await e.getDiscoItems(n);for(const e of s.items||[]){if(!e.jid)continue;const n=await t(e.jid);if(n)return n}throw new Error("No upload service discovered on: "+n)},e.getUploadSlot=async(t,n)=>(await e.sendIQ({httpUpload:{type:"request",...n},to:t,type:"get"})).httpUpload}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3);(0,i.__exportStar)(n(89),t),(0,i.__exportStar)(n(90),t),(0,i.__exportStar)(n(91),t),(0,i.__exportStar)(n(92),t),(0,i.__exportStar)(n(93),t),(0,i.__exportStar)(n(94),t),(0,i.__exportStar)(n(95),t),(0,i.__exportStar)(n(96),t),(0,i.__exportStar)(n(97),t),(0,i.__exportStar)(n(98),t),(0,i.__exportStar)(n(99),t),(0,i.__exportStar)(n(100),t),(0,i.__exportStar)(n(101),t),(0,i.__exportStar)(n(102),t),(0,i.__exportStar)(n(103),t),(0,i.__exportStar)(n(104),t),(0,i.__exportStar)(n(105),t),(0,i.__exportStar)(n(106),t),(0,i.__exportStar)(n(107),t),(0,i.__exportStar)(n(108),t),(0,i.__exportStar)(n(109),t),(0,i.__exportStar)(n(110),t),(0,i.__exportStar)(n(111),t),(0,i.__exportStar)(n(112),t),(0,i.__exportStar)(n(113),t),(0,i.__exportStar)(n(114),t),(0,i.__exportStar)(n(115),t),(0,i.__exportStar)(n(116),t),(0,i.__exportStar)(n(117),t),(0,i.__exportStar)(n(118),t),(0,i.__exportStar)(n(119),t),(0,i.__exportStar)(n(120),t),(0,i.__exportStar)(n(121),t),(0,i.__exportStar)(n(122),t),(0,i.__exportStar)(n(123),t),(0,i.__exportStar)(n(124),t),(0,i.__exportStar)(n(125),t),(0,i.__exportStar)(n(126),t),(0,i.__exportStar)(n(127),t),(0,i.__exportStar)(n(128),t),(0,i.__exportStar)(n(129),t),(0,i.__exportStar)(n(130),t),(0,i.__exportStar)(n(131),t),(0,i.__exportStar)(n(132),t),(0,i.__exportStar)(n(133),t),(0,i.__exportStar)(n(134),t),(0,i.__exportStar)(n(135),t),(0,i.__exportStar)(n(136),t),(0,i.__exportStar)(n(137),t),(0,i.__exportStar)(n(138),t),(0,i.__exportStar)(n(139),t),(0,i.__exportStar)(n(140),t),(0,i.__exportStar)(n(141),t),(0,i.__exportStar)(n(142),t),(0,i.__exportStar)(n(143),t),(0,i.__exportStar)(n(144),t),(0,i.__exportStar)(n(145),t),(0,i.__exportStar)(n(146),t),(0,i.__exportStar)(n(147),t),(0,i.__exportStar)(n(148),t),(0,i.__exportStar)(n(149),t),(0,i.__exportStar)(n(150),t),(0,i.__exportStar)(n(151),t),(0,i.__exportStar)(n(152),t),(0,i.__exportStar)(n(153),t),(0,i.__exportStar)(n(154),t),(0,i.__exportStar)(n(155),t),(0,i.__exportStar)(n(156),t),(0,i.__exportStar)(n(157),t),(0,i.__exportStar)(n(158),t),(0,i.__exportStar)(n(159),t),(0,i.__exportStar)(n(160),t),(0,i.__exportStar)(n(161),t),(0,i.__exportStar)(n(162),t),(0,i.__exportStar)(n(163),t),(0,i.__exportStar)(n(164),t),(0,i.__exportStar)(n(165),t),(0,i.__exportStar)(n(166),t),(0,i.__exportStar)(n(167),t),(0,i.__exportStar)(n(168),t),(0,i.__exportStar)(n(46),t);const r=(0,i.__importDefault)(n(89)),s=(0,i.__importDefault)(n(90)),o=(0,i.__importDefault)(n(91)),a=(0,i.__importDefault)(n(92)),c=(0,i.__importDefault)(n(93)),u=(0,i.__importDefault)(n(94)),l=(0,i.__importDefault)(n(95)),d=(0,i.__importDefault)(n(96)),p=(0,i.__importDefault)(n(97)),h=(0,i.__importDefault)(n(98)),f=(0,i.__importDefault)(n(99)),m=(0,i.__importDefault)(n(100)),g=(0,i.__importDefault)(n(101)),y=(0,i.__importDefault)(n(102)),b=(0,i.__importDefault)(n(103)),_=(0,i.__importDefault)(n(104)),v=(0,i.__importDefault)(n(105)),S=(0,i.__importDefault)(n(106)),w=(0,i.__importDefault)(n(107)),T=(0,i.__importDefault)(n(108)),I=(0,i.__importDefault)(n(109)),N=(0,i.__importDefault)(n(110)),A=(0,i.__importDefault)(n(111)),E=(0,i.__importDefault)(n(112)),x=(0,i.__importDefault)(n(113)),R=(0,i.__importDefault)(n(114)),C=(0,i.__importDefault)(n(115)),O=(0,i.__importDefault)(n(116)),P=(0,i.__importDefault)(n(117)),k=(0,i.__importDefault)(n(118)),j=(0,i.__importDefault)(n(119)),L=(0,i.__importDefault)(n(120)),M=(0,i.__importDefault)(n(122)),D=(0,i.__importDefault)(n(123)),B=(0,i.__importDefault)(n(124)),F=(0,i.__importDefault)(n(121)),q=(0,i.__importDefault)(n(125)),U=(0,i.__importDefault)(n(126)),J=(0,i.__importDefault)(n(127)),z=(0,i.__importDefault)(n(128)),G=(0,i.__importDefault)(n(129)),H=(0,i.__importDefault)(n(130)),V=(0,i.__importDefault)(n(131)),W=(0,i.__importDefault)(n(132)),$=(0,i.__importDefault)(n(133)),Q=(0,i.__importDefault)(n(134)),K=(0,i.__importDefault)(n(135)),X=(0,i.__importDefault)(n(136)),Y=(0,i.__importDefault)(n(137)),Z=(0,i.__importDefault)(n(138)),ee=(0,i.__importDefault)(n(139)),te=(0,i.__importDefault)(n(140)),ne=(0,i.__importDefault)(n(141)),ie=(0,i.__importDefault)(n(142)),re=(0,i.__importDefault)(n(143)),se=(0,i.__importDefault)(n(144)),oe=(0,i.__importDefault)(n(145)),ae=(0,i.__importDefault)(n(146)),ce=(0,i.__importDefault)(n(147)),ue=(0,i.__importDefault)(n(148)),le=(0,i.__importDefault)(n(149)),de=(0,i.__importDefault)(n(150)),pe=(0,i.__importDefault)(n(151)),he=(0,i.__importDefault)(n(152)),fe=(0,i.__importDefault)(n(153)),me=(0,i.__importDefault)(n(154)),ge=(0,i.__importDefault)(n(155)),ye=(0,i.__importDefault)(n(156)),be=(0,i.__importDefault)(n(157)),_e=(0,i.__importDefault)(n(158)),ve=(0,i.__importDefault)(n(159)),Se=(0,i.__importDefault)(n(160)),we=(0,i.__importDefault)(n(161)),Te=(0,i.__importDefault)(n(162)),Ie=(0,i.__importDefault)(n(163)),Ne=(0,i.__importDefault)(n(164)),Ae=(0,i.__importDefault)(n(165)),Ee=(0,i.__importDefault)(n(166)),xe=(0,i.__importDefault)(n(167)),Re=(0,i.__importDefault)(n(168)),Ce=(0,i.__importDefault)(n(46)),Oe=[r.default,s.default,o.default,a.default,c.default,u.default,l.default,d.default,p.default,h.default,f.default,m.default,g.default,y.default,b.default,_.default,v.default,S.default,w.default,T.default,I.default,N.default,A.default,E.default,x.default,R.default,C.default,O.default,P.default,k.default,j.default,L.default,M.default,D.default,B.default,F.default,q.default,U.default,J.default,z.default,G.default,H.default,V.default,W.default,$.default,Q.default,K.default,X.default,Y.default,Z.default,ee.default,te.default,ne.default,ie.default,re.default,se.default,oe.default,ae.default,ce.default,ue.default,le.default,de.default,pe.default,he.default,fe.default,me.default,ge.default,ye.default,be.default,_e.default,ve.default,Se.default,we.default,Te.default,Ie.default,Ne.default,Ae.default,Ee.default,xe.default,Re.default,Ce.default];t.default=Oe},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["features.legacySession","iq.legacySession"],element:"session",fields:{optional:(0,i.childBoolean)(null,"optional")},namespace:r.NS_SESSION};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["atomentry",...(0,i.pubsubItemContentAliases)()],element:"entry",fields:{id:(0,i.childText)(null,"id"),published:(0,i.childDate)(null,"published"),updated:(0,i.childDate)(null,"updated")},namespace:r.NS_ATOM,type:r.NS_ATOM,typeField:"itemType"},{element:"summary",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.summary"},{element:"title",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.title"},{aliases:[{path:"atomentry.links",multiple:!0}],element:"link",fields:{href:(0,i.attribute)("href"),mediaType:(0,i.attribute)("type"),rel:(0,i.attribute)("rel")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.authors",multiple:!0}],element:"author",fields:{name:(0,i.childText)(null,"name"),uri:(0,i.childText)(null,"uri"),email:(0,i.childText)(null,"email")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.contributors",multiple:!0}],element:"contributor",fields:{name:(0,i.childText)(null,"name"),uri:(0,i.childText)(null,"uri"),email:(0,i.childText)(null,"email")},namespace:r.NS_ATOM},{aliases:[{path:"atomentry.categories",multiple:!0}],element:"category",fields:{term:(0,i.attribute)("term"),scheme:(0,i.attribute)("scheme"),label:(0,i.attribute)("label")},namespace:r.NS_ATOM},{element:"content",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.content"},{element:"rights",fields:{text:(0,i.text)(),type:(0,i.attribute)("type","text")},namespace:r.NS_ATOM,path:"atomentry.rights"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={defaultType:"stream",element:"stream",fields:{from:(0,r.attribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.attribute)("to"),version:(0,r.attribute)("version")},namespace:s.NS_STREAM,path:"stream",type:"stream",typeField:"action"},a={element:"features",namespace:s.NS_STREAM,path:"features"},c={element:"error",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_STREAMS,"text"),condition:(0,r.childEnum)(s.NS_STREAMS,Object.values(i.StreamErrorCondition),i.StreamErrorCondition.UndefinedCondition),seeOtherHost:(0,r.childText)(s.NS_STREAMS,i.StreamErrorCondition.SeeOtherHost),text:(0,r.childText)(s.NS_STREAMS,"text")},namespace:s.NS_STREAM,path:"streamError"},u=Object.values(i.StreamType).map(e=>({aliases:["stanzaError","message.error","presence.error","iq.error"],defaultType:s.NS_CLIENT,element:"error",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_STANZAS,"text"),by:(0,r.JIDAttribute)("by"),condition:(0,r.childEnum)(s.NS_STANZAS,Object.values(i.StanzaErrorCondition),i.StanzaErrorCondition.UndefinedCondition),gone:(0,r.childText)(s.NS_STANZAS,i.StanzaErrorCondition.Gone),redirect:(0,r.childText)(s.NS_STANZAS,i.StanzaErrorCondition.Redirect),text:(0,r.childText)(s.NS_STANZAS,"text"),type:(0,r.attribute)("type")},namespace:e,type:e,typeField:"streamType"})),l=new Set(["from","id","lang","to","type","payloadType","error","streamType"]),d=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"iq",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),payloadType:{order:-1e4,importer(e,t){if("get"!==t.data.type&&"set"!==t.data.type)return;if(1!==e.children.filter(e=>"string"!=typeof e).length)return"invalid-payload-count";const n=Object.keys(t.data).filter(e=>!l.has(e));return 1!==n.length?"unknown-payload":n[0]}},to:(0,r.JIDAttribute)("to"),type:(0,r.attribute)("type")},namespace:e,path:"iq",type:e,typeField:"streamType"})),p=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"message",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.JIDAttribute)("to")},namespace:e,path:"message",type:e,typeField:"streamType"})),h=Object.values(i.StreamType).map(e=>({childrenExportOrder:{error:2e5},defaultType:s.NS_CLIENT,element:"presence",fields:{from:(0,r.JIDAttribute)("from"),id:(0,r.attribute)("id"),lang:(0,r.languageAttribute)(),to:(0,r.JIDAttribute)("to")},namespace:e,path:"presence",type:e,typeField:"streamType"})),f=[o,a,c,...u,...[{element:"mechanisms",fields:{mechanisms:(0,r.multipleChildText)(null,"mechanism")},namespace:s.NS_SASL,path:"features.sasl"},{element:"abort",namespace:s.NS_SASL,path:"sasl",type:"abort",typeField:"type"},{element:"auth",fields:{mechanism:(0,r.attribute)("mechanism"),value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"auth",typeField:"type"},{element:"challenge",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"challenge",typeField:"type"},{element:"response",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"response",typeField:"type"},{element:"success",fields:{value:(0,r.textBuffer)("base64")},namespace:s.NS_SASL,path:"sasl",type:"success",typeField:"type"},{element:"failure",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(s.NS_SASL,"text"),condition:(0,r.childEnum)(s.NS_SASL,Object.values(i.SASLFailureCondition)),text:(0,r.childText)(s.NS_SASL,"text")},namespace:s.NS_SASL,path:"sasl",type:"failure",typeField:"type"}],...[{aliases:["features.tls"],defaultType:"start",element:"starttls",fields:{required:(0,r.childBoolean)(null,"required")},namespace:s.NS_STARTTLS,path:"tls",type:"start",typeField:"type"},{element:"proceed",namespace:s.NS_STARTTLS,path:"tls",type:"proceed",typeField:"type"},{element:"failure",namespace:s.NS_STARTTLS,path:"tls",type:"failure",typeField:"type"}],...d,...p,...h,{aliases:["features.bind","iq.bind"],element:"bind",fields:{jid:(0,r.childText)(null,"jid"),resource:(0,r.childText)(null,"resource")},namespace:s.NS_BIND}];t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({rosterPreApproval:(0,i.childBoolean)(r.NS_SUBSCRIPTION_PREAPPROVAL,"sub"),rosterVersioning:(0,i.childBoolean)(r.NS_ROSTER_VERSIONING,"ver")}),(0,i.extendMessage)({alternateLanguageBodies:(0,i.childAlternateLanguageText)(null,"body"),alternateLanguageSubjects:(0,i.childAlternateLanguageText)(null,"subject"),body:(0,i.childText)(null,"body"),hasSubject:(0,i.childBoolean)(null,"subject"),parentThread:(0,i.childAttribute)(null,"thread","parent"),subject:(0,i.childText)(null,"subject"),thread:(0,i.childText)(null,"thread"),type:(0,i.attribute)("type")}),(0,i.extendPresence)({alternateLanguageStatuses:(0,i.childAlternateLanguageText)(null,"status"),priority:(0,i.childInteger)(null,"priority",0),show:(0,i.childText)(null,"show"),status:(0,i.childText)(null,"status"),type:(0,i.attribute)("type")}),{element:"query",fields:{version:(0,i.attribute)("ver",void 0,{emitEmpty:!0})},namespace:r.NS_ROSTER,path:"iq.roster"},{aliases:[{path:"iq.roster.items",multiple:!0}],element:"item",fields:{groups:(0,i.multipleChildText)(null,"group"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),pending:(0,i.attribute)("ask"),preApproved:(0,i.booleanAttribute)("approved"),subscription:(0,i.attribute)("subscription")},namespace:r.NS_ROSTER}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"open",fields:{from:(0,i.attribute)("from"),id:(0,i.attribute)("id"),lang:(0,i.languageAttribute)(),to:(0,i.attribute)("to"),version:(0,i.attribute)("version")},namespace:r.NS_FRAMING,path:"stream",type:"open"},{element:"close",fields:{seeOtherURI:(0,i.attribute)("see-other-uri")},namespace:r.NS_FRAMING,path:"stream",type:"close"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o=[{aliases:[{path:"message.forms",multiple:!0}],element:"x",fields:{instructions:{...(0,r.multipleChildText)(null,"instructions"),exportOrder:2},reported:{...(0,r.splicePath)(null,"reported","dataformField",!0),exportOrder:3},title:{...(0,r.childText)(null,"title"),exportOrder:1},type:(0,r.attribute)("type")},namespace:s.NS_DATAFORM,optionalNamespaces:{xdv:s.NS_DATAFORM_VALIDATION},path:"dataform"},{aliases:[{path:"dataform.fields",multiple:!0},{path:"dataform.items.fields",multiple:!0}],element:"field",fields:{description:(0,r.childText)(null,"desc"),label:(0,r.attribute)("label"),name:(0,r.attribute)("var"),rawValues:{...(0,r.multipleChildText)(null,"value"),exporter:()=>null},required:(0,r.childBoolean)(null,"required"),type:(0,r.attribute)("type"),value:{importer(e,t){const n=e.getAttribute("type"),o=(0,r.multipleChildText)(s.NS_DATAFORM,"value").importer(e,t),a=o[0];switch(n){case i.DataFormFieldType.TextMultiple:case i.DataFormFieldType.ListMultiple:case i.DataFormFieldType.JIDMultiple:return o;case i.DataFormFieldType.Hidden:case i.DataFormFieldType.Fixed:return 1===o.length?a:o;case i.DataFormFieldType.Boolean:if(a)return"1"===a||"true"===a;break;default:return a}},exporter(e,t,n){const i=(0,r.multipleChildText)(null,"value");let o=[];const a=n.data&&n.data.rawValues?n.data.rawValues[0]:void 0;if("boolean"==typeof t)o="true"===a||"false"===a?[a]:[t?"1":"0"];else if(Array.isArray(t))for(const e of t)o.push(e.toString());else o=[t.toString()];i.exporter(e,o,Object.assign({},n,{namespace:s.NS_DATAFORM}))}}},namespace:s.NS_DATAFORM,path:"dataformField"},{aliases:[{path:"dataform.fields.options",multiple:!0}],element:"option",fields:{label:(0,r.attribute)("label"),value:(0,r.childText)(null,"value")},namespace:s.NS_DATAFORM},{aliases:[{path:"dataform.items",multiple:!0}],element:"item",namespace:s.NS_DATAFORM},{element:"validate",fields:{listMax:(0,r.childIntegerAttribute)(null,"list-range","max"),listMin:(0,r.childIntegerAttribute)(null,"list-range","min"),method:(0,r.childEnum)(null,["basic","open","range","regex"],"basic"),rangeMax:(0,r.childAttribute)(null,"range","max"),rangeMin:(0,r.childAttribute)(null,"range","min"),regex:(0,r.childText)(null,"regex"),type:(0,r.attribute)("datatype","xs:string")},namespace:s.NS_DATAFORM_VALIDATION,path:"dataform.fields.validation"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["presence.legacyLastActivity","iq.lastActivity"],element:"query",fields:{seconds:(0,i.integerAttribute)("seconds"),status:(0,i.text)()},namespace:r.NS_LAST_ACTIVITY}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"query",fields:{activeList:(0,i.childAttribute)(null,"active","name"),defaultList:(0,i.childAttribute)(null,"default","name")},namespace:r.NS_PRIVACY,path:"iq.privacy"},{aliases:[{path:"iq.privacy.lists",multiple:!0}],element:"list",fields:{name:(0,i.attribute)("name")},namespace:r.NS_PRIVACY},{aliases:[{path:"iq.privacy.lists.items",multiple:!0}],element:"item",fields:{action:(0,i.attribute)("action"),incomingPresence:(0,i.childBoolean)(null,"presence-in"),iq:(0,i.childBoolean)(null,"iq"),messages:(0,i.childBoolean)(null,"message"),order:(0,i.integerAttribute)("order"),outgoingPresence:(0,i.childBoolean)(null,"presence-out"),type:(0,i.attribute)("type"),value:(0,i.attribute)("value")},namespace:r.NS_PRIVACY}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["iq.disco","message.disco","features.disco"],childrenExportOrder:{identities:1,features:2,extensions:3},element:"query",fields:{features:(0,i.multipleChildAttribute)(null,"feature","var"),node:(0,i.attribute)("node")},namespace:r.NS_DISCO_INFO,path:"disco",type:"info",typeField:"type"},{aliases:[{path:"disco.identities",selector:"info",multiple:!0}],element:"identity",fields:{category:(0,i.attribute)("category"),lang:(0,i.languageAttribute)(),name:(0,i.attribute)("name"),type:(0,i.attribute)("type")},namespace:r.NS_DISCO_INFO},{aliases:[{path:"disco.items",multiple:!0,selector:"items"}],element:"item",fields:{jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),node:(0,i.attribute)("node")},namespace:r.NS_DISCO_ITEMS},{aliases:[{path:"disco.items",multiple:!0,selector:"info"}],element:"item",fields:{category:(0,i.JIDAttribute)("category"),lang:(0,i.languageAttribute)(),name:(0,i.attribute)("name"),type:(0,i.attribute)("type")},namespace:r.NS_DISCO_INFO},(0,i.addAlias)(r.NS_DATAFORM,"x",[{path:"disco.extensions",multiple:!0,selector:"info"}]),(0,i.addAlias)(r.NS_RSM,"set",[{path:"disco.paging",selector:"items"}]),{aliases:["iq.disco","message.disco","features.disco"],element:"query",fields:{node:(0,i.attribute)("node")},namespace:r.NS_DISCO_ITEMS,path:"disco",type:"items",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({addresses:(0,i.splicePath)(r.NS_ADDRESS,"addresses","extendedAddress",!0)}),(0,i.extendPresence)({addresses:(0,i.splicePath)(r.NS_ADDRESS,"addresses","extendedAddress",!0)}),{element:"address",fields:{alternateLanguageDescriptions:(0,i.childAlternateLanguageText)(null,"desc"),delivered:(0,i.booleanAttribute)("delivered"),description:(0,i.attribute)("desc"),jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node"),type:(0,i.attribute)("type"),uri:(0,i.attribute)("uri")},namespace:r.NS_ADDRESS,path:"extendedAddress"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",[{path:"iq.muc.form",selector:"configure"}]),{defaultType:"info",element:"x",fields:{password:(0,i.childText)(null,"password")},namespace:r.NS_MUC,path:"presence.muc",type:"join",typeField:"type"},{aliases:[{path:"presence.muc.history",selector:"join"}],element:"history",fields:{maxCharacters:(0,i.integerAttribute)("maxchars"),maxStanzas:(0,i.integerAttribute)("maxstanzas"),seconds:(0,i.integerAttribute)("seconds"),since:(0,i.dateAttribute)("since")},namespace:r.NS_MUC},{aliases:["presence.muc","message.muc"],defaultType:"info",element:"x",fields:{action:(0,i.childEnum)(null,["invite","decline","destroy"]),actor:(0,i.splicePath)(null,"item","mucactor"),affiliation:(0,i.childAttribute)(null,"item","affiliation"),jid:(0,i.childJIDAttribute)(null,"item","jid"),nick:(0,i.childAttribute)(null,"item","nick"),password:(0,i.childText)(null,"password"),reason:(0,i.deepChildText)([{namespace:null,element:"item"},{namespace:null,element:"reason"}]),role:(0,i.childAttribute)(null,"item","role"),statusCodes:(0,i.multipleChildAttribute)(null,"status","code")},namespace:r.NS_MUC_USER,type:"info",typeField:"type",typeOrder:1},{element:"actor",fields:{jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick")},namespace:r.NS_MUC_USER,path:"mucactor"},{element:"destroy",fields:{jid:(0,i.JIDAttribute)("jid"),password:(0,i.childText)(null,"password"),reason:(0,i.childText)(null,"reason")},namespace:r.NS_MUC_USER,path:"presence.muc.destroy"},{aliases:[{path:"message.muc.invite",multiple:!0}],element:"invite",fields:{continue:(0,i.childBoolean)(null,"continue"),from:(0,i.JIDAttribute)("from"),reason:(0,i.childText)(null,"reason"),thread:(0,i.childAttribute)(null,"continue","thread"),to:(0,i.JIDAttribute)("to")},namespace:r.NS_MUC_USER},{element:"decline",fields:{from:(0,i.JIDAttribute)("from"),reason:(0,i.childText)(null,"reason"),to:(0,i.JIDAttribute)("to")},namespace:r.NS_MUC_USER,path:"message.muc",type:"decline"},{element:"query",namespace:r.NS_MUC_ADMIN,path:"iq.muc",type:"user-list",typeField:"type"},{aliases:[{path:"iq.muc.users",multiple:!0,selector:"user-list"}],element:"item",fields:{affiliation:(0,i.attribute)("affiliation"),jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick"),reason:(0,i.childText)(null,"reason"),role:(0,i.attribute)("role")},namespace:r.NS_MUC_ADMIN},{aliases:["iq.muc.users.actor"],element:"actor",fields:{jid:(0,i.JIDAttribute)("jid"),nick:(0,i.attribute)("nick")},namespace:r.NS_MUC_ADMIN},{element:"query",namespace:r.NS_MUC_OWNER,path:"iq.muc",type:"configure",typeField:"type"},{aliases:[{path:"iq.muc.destroy",selector:"configure"}],element:"destroy",fields:{jid:(0,i.JIDAttribute)("jid"),password:(0,i.childText)(null,"password"),reason:(0,i.childText)(null,"reason")},namespace:r.NS_MUC_OWNER},{element:"x",fields:{action:(0,i.staticValue)("invite"),continue:(0,i.booleanAttribute)("continue"),jid:(0,i.JIDAttribute)("jid"),legacyReason:(0,i.text)(),password:(0,i.attribute)("password"),reason:(0,i.attribute)("reason"),thread:(0,i.attribute)("thread")},namespace:r.NS_MUC_DIRECT_INVITE,path:"message.muc",type:"direct-invite",typeOrder:2},{element:"unique",fields:{name:(0,i.text)()},namespace:r.NS_MUC_UNIQUE,path:"iq.muc",type:"unique"},(0,i.extendMessage)({legacyMUC:{exporter(e,t,n){const i=n.registry?n.registry.export("message.muc",{...t,type:"direct-invite"}):void 0;i&&e.appendChild(i)},exportOrder:100001,importer(e,t){if(!(0,i.findAll)(e,r.NS_MUC_USER,"x")[0])return;const n=(0,i.findAll)(e,r.NS_MUC_DIRECT_INVITE,"x")[0];return n&&t.registry?t.registry.import(n,{...t,path:"message"}):void 0},importOrder:-1}})];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["iq.ibb","message.ibb"],element:"open",fields:{ack:{importer:(e,t)=>"message"!==(0,i.attribute)("stanza","iq").importer(e,t),exporter(e,t,n){(0,i.attribute)("stanza").exporter(e,t?"iq":"message",n)}},blockSize:(0,i.integerAttribute)("block-size"),sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"open",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"close",fields:{sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"close",typeField:"action"},{aliases:["iq.ibb","message.ibb"],element:"data",fields:{data:(0,i.textBuffer)("base64"),seq:(0,i.integerAttribute)("seq"),sid:(0,i.attribute)("sid")},namespace:r.NS_IBB,type:"data",typeField:"action"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{path:"bookmarkStorage",impliedType:!0},{path:"iq.privateStorage.bookmarks",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"storage",namespace:r.NS_BOOKMARKS,type:r.NS_BOOKMARKS,typeField:"itemType"},{aliases:[{path:"bookmarkStorage.rooms",multiple:!0}],element:"conference",fields:{autoJoin:(0,i.booleanAttribute)("autojoin"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name"),nick:(0,i.childText)(null,"nick"),password:(0,i.childText)(null,"password")},namespace:r.NS_BOOKMARKS}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={element:"query",namespace:n(1).NS_PRIVATE,path:"iq.privateStorage"};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.command.form"]),(0,i.extendStanzaError)({commandError:(0,i.childEnum)(r.NS_ADHOC_COMMANDS,["bad-action","bad-locale","bad-payload","bad-sessionid","malformed-action","session-expired"])}),{element:"command",fields:{action:(0,i.attribute)("action"),node:(0,i.attribute)("node"),sid:(0,i.attribute)("sessionid"),status:(0,i.attribute)("status")},namespace:r.NS_ADHOC_COMMANDS,path:"iq.command"},{element:"actions",fields:{complete:(0,i.childBoolean)(null,"complete"),execute:(0,i.attribute)("execute"),next:(0,i.childBoolean)(null,"next"),prev:(0,i.childBoolean)(null,"prev")},namespace:r.NS_ADHOC_COMMANDS,path:"iq.command.availableActions"},{aliases:[{path:"iq.command.notes",multiple:!0}],element:"note",fields:{type:(0,i.attribute)("type"),value:(0,i.text)()},namespace:r.NS_ADHOC_COMMANDS}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s="vcardTemp.records";function o(e,t){return{aliases:[{multiple:!0,path:s}],element:e,fields:{value:(0,i.text)()},namespace:r.NS_VCARD_TEMP,type:t,typeField:"type"}}const a=[{aliases:[{path:"iq.vcard"}],defaultType:r.NS_VCARD_TEMP,element:"vCard",fields:{fullName:(0,i.childText)(null,"FN")},namespace:r.NS_VCARD_TEMP,path:"vcardTemp",type:r.NS_VCARD_TEMP,typeField:"format"},{element:"N",fields:{additional:{...(0,i.childText)(null,"MIDDLE"),order:3},family:{...(0,i.childText)(null,"FAMILY"),order:1},given:{...(0,i.childText)(null,"GIVEN"),order:2},prefix:{...(0,i.childText)(null,"PREFIX"),order:4},suffix:{...(0,i.childText)(null,"SUFFIX"),order:5}},namespace:r.NS_VCARD_TEMP,path:"vcardTemp.name"},o("NICKNAME","nickname"),o("BDAY","birthday"),o("JABBERID","jid"),o("TZ","timezone"),o("TITLE","title"),o("ROLE","role"),o("URL","url"),o("NOTE","note"),o("SORT-STRING","sort"),o("UID","uid"),o("REV","revision"),o("PRODID","productId"),o("DESC","description"),{aliases:[{multiple:!0,path:s}],element:"EMAIL",fields:{preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["internet","INTERNET"]]),value:(0,i.childText)(null,"USERID")},namespace:r.NS_VCARD_TEMP,type:"email"},{aliases:[{path:s,multiple:!0}],element:"ORG",fields:{units:{...(0,i.multipleChildText)(null,"ORGUNIT"),order:2},value:{...(0,i.childText)(null,"ORGNAME"),order:1}},namespace:r.NS_VCARD_TEMP,type:"organization",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"ADR",fields:{city:(0,i.childText)(null,"LOCALITY"),code:(0,i.childText)(null,"PCODE"),country:(0,i.childText)(null,"CTRY"),pobox:(0,i.childText)(null,"POBOX"),preferred:(0,i.childBoolean)(null,"PREF"),region:(0,i.childText)(null,"REGION"),street:(0,i.childText)(null,"STREET"),street2:(0,i.childText)(null,"EXTADD"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["domestic","DOM"],["international","INTL"],["postal","POSTAL"],["parcel","PARCEL"]])},namespace:r.NS_VCARD_TEMP,type:"address",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"LABEL",fields:{lines:(0,i.multipleChildText)(null,"LINE"),preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"]])},namespace:r.NS_VCARD_TEMP,type:"addressLabel",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"TEL",fields:{preferred:(0,i.childBoolean)(null,"PREF"),types:(0,i.multipleChildEnum)(null,[["home","HOME"],["work","WORK"],["cell","CELL"],["fax","FAX"],["voice","VOICE"],["msg","MSG"]]),value:(0,i.childText)(null,"NUMBER","",!0)},namespace:r.NS_VCARD_TEMP,type:"tel",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"PHOTO",fields:{data:(0,i.childText)(null,"BINVAL"),mediaType:(0,i.childText)(null,"TYPE"),url:(0,i.childText)(null,"EXTVAL")},namespace:r.NS_VCARD_TEMP,type:"photo",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"LOGO",fields:{data:(0,i.childText)(null,"BINVAL"),mediaType:(0,i.childText)(null,"TYPE"),url:(0,i.childText)(null,"EXTVAL")},namespace:r.NS_VCARD_TEMP,type:"logo",typeField:"type"},{aliases:[{multiple:!0,path:s}],element:"CATEGORIES",fields:{value:(0,i.multipleChildText)(null,"KEYWORD")},namespace:r.NS_VCARD_TEMP,type:"categories",typeField:"type"}];t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.search.form"]),(0,i.addAlias)(r.NS_RSM,"set",["iq.search.paging"]),{element:"query",fields:{email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),givenName:(0,i.childText)(null,"first"),instructions:(0,i.childText)(null,"instructions"),nick:(0,i.childText)(null,"nick")},namespace:r.NS_SEARCH,path:"iq.search"},{aliases:[{path:"iq.search.items",multiple:!0}],element:"item",fields:{email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),givenName:(0,i.childText)(null,"first"),jid:(0,i.JIDAttribute)("jid"),nick:(0,i.childText)(null,"nick")},namespace:r.NS_SEARCH}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["iq.pubsub.paging"],element:"set",fields:{after:(0,i.childText)(null,"after"),before:(0,i.childText)(null,"before"),count:(0,i.childInteger)(null,"count"),first:(0,i.childText)(null,"first"),firstIndex:(0,i.childIntegerAttribute)(null,"first","index"),index:(0,i.childInteger)(null,"index"),last:(0,i.childText)(null,"last"),max:(0,i.childInteger)(null,"max")},namespace:r.NS_RSM,path:"paging"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={configurable:(0,r.childBoolean)(null,"subscribe-options"),configurationRequired:(0,r.deepChildBoolean)([{namespace:null,element:"subscribe-options"},{namespace:null,element:"required"}]),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),state:(0,r.attribute)("subscription"),subid:(0,r.attribute)("subid")},a={node:(0,r.attribute)("node")},c=[{aliases:["pubsub","iq.pubsub","message.pubsub"],childrenExportOrder:{configure:0,create:100,publish:100,subscribe:100,subscriptionOptions:0},defaultType:"user",element:"pubsub",fields:{publishOptions:(0,r.splicePath)(null,"publish-options","dataform")},namespace:s.NS_PUBSUB,type:"user",typeField:"context"},{aliases:["pubsub","iq.pubsub","message.pubsub"],defaultType:"user",element:"pubsub",fields:{purge:(0,r.childAttribute)(null,"purge","node")},namespace:s.NS_PUBSUB_OWNER,type:"owner",typeField:"context"},(0,r.addAlias)(s.NS_DATAFORM,"x",["iq.pubsub.configure.form","iq.pubsub.defaultConfiguration.form","iq.pubsub.defaultSubscriptionOptions.form","iq.pubsub.subscriptionOptions.form","message.pubsub.configuration.form"]),(0,r.addAlias)(s.NS_RSM,"set",["iq.pubsub.fetch.paging"]),(0,r.extendStanzaError)({pubsubError:(0,r.childEnum)(s.NS_PUBSUB_ERRORS,Object.values(i.PubsubErrorCondition)),pubsubUnsupportedFeature:(0,r.childAttribute)(s.NS_PUBSUB_ERRORS,"unsupported","feature")}),{element:"subscribe",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.subscribe"},{element:"unsubscribe",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid")},namespace:s.NS_PUBSUB,path:"iq.pubsub.unsubscribe"},{element:"options",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid")},namespace:s.NS_PUBSUB,path:"iq.pubsub.subscriptionOptions"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"user",impliedType:!0}],element:"subscriptions",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,type:"user"},{aliases:[{path:"iq.pubsub.subscriptions",selector:"owner",impliedType:!0}],element:"subscriptions",fields:{jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.subscription",selector:"owner"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB},{aliases:[{path:"iq.pubsub.subscription",selector:"user"},{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"user"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.subscriptions.items",selector:"owner"}],element:"subscription",fields:o,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.affiliations",selector:"user",impliedType:!0},{path:"message.pubsub.affiliations",selector:"user",impliedType:!0}],element:"affiliations",fields:a,namespace:s.NS_PUBSUB,type:"user"},{aliases:[{path:"iq.pubsub.affiliations",selector:"owner",impliedType:!0}],element:"affiliations",fields:a,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"user"},{impliedType:!0,multiple:!0,path:"message.pubsub.affiliations.items",selector:"user"}],element:"affiliation",fields:{affiliation:(0,r.attribute)("affiliation"),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,type:"user"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.pubsub.affiliations.items",selector:"owner"}],element:"affiliation",fields:{affiliation:(0,r.attribute)("affiliation"),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB_OWNER,type:"owner"},{element:"create",fields:a,namespace:s.NS_PUBSUB,path:"iq.pubsub.create"},{aliases:[{path:"iq.pubsub.destroy",selector:"owner"}],element:"delete",fields:{node:(0,r.attribute)("node"),redirect:(0,r.childAttribute)(null,"redirect","uri")},namespace:s.NS_PUBSUB_OWNER},{aliases:[{path:"iq.pubsub.configure",selector:"owner",impliedType:!0}],element:"configure",fields:a,namespace:s.NS_PUBSUB_OWNER,type:"owner"},{aliases:[{path:"iq.pubsub.configure",selector:"user",impliedType:!0}],element:"configure",fields:a,namespace:s.NS_PUBSUB,type:"user"},{element:"default",fields:{node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.defaultSubscriptionOptions"},{element:"default",fields:{},namespace:s.NS_PUBSUB_OWNER,path:"iq.pubsub.defaultConfiguration"},{element:"publish",fields:a,namespace:s.NS_PUBSUB,path:"iq.pubsub.publish"},{element:"retract",fields:{id:(0,r.childAttribute)(null,"item","id"),node:(0,r.attribute)("node"),notify:(0,r.booleanAttribute)("notify")},namespace:s.NS_PUBSUB,path:"iq.pubsub.retract"},{element:"items",fields:{max:(0,r.integerAttribute)("max_items"),node:(0,r.attribute)("node")},namespace:s.NS_PUBSUB,path:"iq.pubsub.fetch"},{aliases:["pubsubitem","iq.pubsub.publish.item",{multiple:!0,path:"iq.pubsub.fetch.items"}],element:"item",fields:{id:(0,r.attribute)("id"),publisher:(0,r.JIDAttribute)("publisher")},namespace:s.NS_PUBSUB},{element:"event",fields:{eventType:(0,r.childEnum)(null,["purge","delete","subscription","configuration","items"])},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub",type:"event",typeField:"context"},{aliases:[{path:"message.pubsub.items.published",multiple:!0}],element:"item",fields:{id:(0,r.attribute)("id"),publisher:(0,r.JIDAttribute)("publisher")},namespace:s.NS_PUBSUB_EVENT,path:"pubsubeventitem"},{element:"purge",fields:a,namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.purge"},{element:"delete",fields:{node:(0,r.attribute)("node"),redirect:(0,r.childAttribute)(null,"redirect","uri")},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.delete"},{aliases:[{path:"message.pubsub.subscription",selector:"event",impliedType:!0}],element:"subscription",fields:{expires:(u="expiry",{importer(e){const t=e.getAttribute(u);return"presence"===t?t:t?new Date(t):void 0},exporter(e,t){let n;n="string"==typeof t?t:t.toISOString(),e.setAttribute(u,n)}}),jid:(0,r.JIDAttribute)("jid"),node:(0,r.attribute)("node"),subid:(0,r.attribute)("subid"),type:(0,r.attribute)("subscription")},namespace:s.NS_PUBSUB_EVENT,type:"event"},{element:"configuration",fields:a,namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.configuration"},{element:"items",fields:{node:(0,r.attribute)("node"),retracted:(0,r.multipleChildAttribute)(null,"retract","id")},namespace:s.NS_PUBSUB_EVENT,path:"message.pubsub.items"}];var u;t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"query",fields:{activate:(0,i.childText)(null,"activate"),address:(0,i.attribute)("dstaddr"),candidateUsed:(0,i.childJIDAttribute)(null,"streamhost-used","jid"),mode:(0,i.attribute)("mode","tcp"),sid:(0,i.attribute)("sid"),udpSuccess:(0,i.childAttribute)(null,"udpsuccess","dstaddr")},namespace:r.NS_SOCKS5,path:"iq.socks5"},{aliases:[{multiple:!0,path:"iq.socks5.candidates"}],element:"streamhost",fields:{host:(0,i.attribute)("host"),jid:(0,i.JIDAttribute)("jid"),port:(0,i.integerAttribute)("port"),uri:(0,i.attribute)("uri")},namespace:r.NS_SOCKS5}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{multiple:!0,path:"message.links"}],element:"x",fields:{description:(0,i.childText)(null,"desc"),url:(0,i.childText)(null,"url")},namespace:r.NS_OOB},{element:"query",fields:{description:(0,i.childText)(null,"desc"),url:(0,i.childText)(null,"url")},namespace:r.NS_OOB_TRANSFER,path:"iq.transferLink"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"html",fields:{alternateLanguageBodies:(0,i.childAlternateLanguageRawElement)(r.NS_XHTML,"body","xhtmlim"),body:(0,i.childLanguageRawElement)(r.NS_XHTML,"body","xhtmlim")},namespace:r.NS_XHTML_IM,path:"message.html"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({inbandRegistration:(0,i.childBoolean)(r.NS_INBAND_REGISTRATION,"register")}),(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.account.form"]),(0,i.addAlias)(r.NS_OOB,"x",["iq.account.registrationLink"]),{element:"query",fields:{address:(0,i.childText)(null,"address"),date:(0,i.childDate)(null,"date"),email:(0,i.childText)(null,"email"),familyName:(0,i.childText)(null,"last"),fullName:(0,i.childText)(null,"name"),givenName:(0,i.childText)(null,"first"),instructions:(0,i.childText)(null,"instructions"),key:(0,i.childText)(null,"key"),locality:(0,i.childText)(null,"city"),misc:(0,i.childText)(null,"misc"),nick:(0,i.childText)(null,"nick"),password:(0,i.childText)(null,"password"),phone:(0,i.childText)(null,"phone"),postalCode:(0,i.childText)(null,"zip"),region:(0,i.childText)(null,"state"),registered:(0,i.childBoolean)(null,"registered"),remove:(0,i.childBoolean)(null,"remove"),text:(0,i.childText)(null,"text"),uri:(0,i.childText)(null,"uri"),username:(0,i.childText)(null,"username")},namespace:r.NS_REGISTER,path:"iq.account"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"message.geoloc",impliedType:!0},{path:"dataform.fields.geoloc",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"geoloc",fields:{accuracy:(0,i.childFloat)(null,"accuracy"),altitude:(0,i.childFloat)(null,"alt"),altitudeAccuracy:(0,i.childFloat)(null,"altaccuracy"),area:(0,i.childText)(null,"area"),building:(0,i.childText)(null,"building"),country:(0,i.childText)(null,"country"),countryCode:(0,i.childText)(null,"countrycode"),datum:(0,i.childText)(null,"datum"),description:(0,i.childText)(null,"description"),error:(0,i.childFloat)(null,"error"),floor:(0,i.childText)(null,"floor"),heading:(0,i.childFloat)(null,"bearing"),lang:(0,i.languageAttribute)(),latitude:(0,i.childFloat)(null,"lat"),locality:(0,i.childText)(null,"locality"),longitude:(0,i.childFloat)(null,"lon"),postalCode:(0,i.childText)(null,"postalcode"),region:(0,i.childText)(null,"region"),room:(0,i.childText)(null,"room"),speed:(0,i.childFloat)(null,"speed"),street:(0,i.childText)(null,"street"),text:(0,i.childText)(null,"text"),timestamp:(0,i.childDate)(null,"timestamp"),tzo:(0,i.childTimezoneOffset)(null,"tzo"),uri:(0,i.childText)(null,"uri")},namespace:r.NS_GEOLOC,type:r.NS_GEOLOC};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:(0,i.pubsubItemContentAliases)(),element:"data",fields:{data:(0,i.textBuffer)("base64")},namespace:r.NS_AVATAR_DATA,path:"avatar",type:r.NS_AVATAR_DATA,typeField:"itemType"},{aliases:[{path:"avatar",impliedType:!0},...(0,i.pubsubItemContentAliases)()],element:"metadata",namespace:r.NS_AVATAR_METADATA,type:r.NS_AVATAR_METADATA,typeField:"itemType",childrenExportOrder:{versions:1,pointers:2}},{aliases:[{multiple:!0,path:"avatar.versions",selector:r.NS_AVATAR_METADATA}],element:"info",fields:{bytes:(0,i.integerAttribute)("bytes"),height:(0,i.integerAttribute)("height"),id:(0,i.attribute)("id"),mediaType:(0,i.attribute)("type"),uri:(0,i.attribute)("url"),width:(0,i.integerAttribute)("width")},namespace:r.NS_AVATAR_METADATA},{aliases:[{multiple:!0,path:"avatar.pointers",selector:r.NS_AVATAR_METADATA}],element:"pointer",fields:{bytes:(0,i.integerAttribute)("bytes"),height:(0,i.integerAttribute)("height"),id:(0,i.attribute)("id"),mediaType:(0,i.attribute)("type"),width:(0,i.integerAttribute)("width")},namespace:r.NS_AVATAR_METADATA}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1);t.default=(0,r.extendMessage)({chatState:(0,r.childEnum)(s.NS_CHAT_STATES,Object.values(i.ChatState))})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"query",fields:{name:(0,i.childText)(null,"name"),os:(0,i.childText)(null,"os"),version:(0,i.childText)(null,"version")},namespace:r.NS_VERSION,path:"iq.softwareVersion"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={aliases:[{path:"message.mood",impliedType:!0},...(0,r.pubsubItemContentAliases)()],element:"mood",fields:{alternateLanguageText:(0,r.childAlternateLanguageText)(null,"text"),text:(0,r.childText)(null,"text"),value:(0,r.childEnum)(null,i.USER_MOODS)},namespace:s.NS_MOOD,type:s.NS_MOOD};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o={aliases:[{path:"activity",impliedType:!0},...(0,r.pubsubItemContentAliases)()],element:"activity",fields:{activity:(0,r.childDoubleEnum)(null,i.USER_ACTIVITY_GENERAL,i.USER_ACTIVITY_SPECIFIC),alternateLanguageText:(0,r.childAlternateLanguageText)(null,"text"),text:(0,r.childText)(null,"text")},namespace:s.NS_ACTIVITY,type:s.NS_ACTIVITY};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"handshake",fields:{value:(0,i.textBuffer)("hex")},namespace:r.NS_COMPONENT,path:"handshake"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"presence.legacyCapabilities",multiple:!0},{path:"features.legacyCapabilities",multiple:!0}],element:"c",fields:{algorithm:(0,i.attribute)("hash"),legacy:(0,i.staticValue)(!0),node:(0,i.attribute)("node"),value:(0,i.attribute)("ver")},namespace:r.NS_DISCO_LEGACY_CAPS};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{impliedType:!0,path:"tune"},...(0,i.pubsubItemContentAliases)()],element:"tune",fields:{artist:(0,i.childText)(null,"artist"),length:(0,i.childInteger)(null,"length"),rating:(0,i.childInteger)(null,"rating"),source:(0,i.childText)(null,"source"),title:(0,i.childText)(null,"title"),track:(0,i.childText)(null,"track"),uri:(0,i.childText)(null,"uri")},namespace:r.NS_TUNE,type:r.NS_TUNE};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=["dataformLayout",{multiple:!0,path:"dataformLayout.contents"},{multiple:!0,path:"dataform.layout.contents"}],o=[{aliases:[{multiple:!0,path:"dataform.layout"}],element:"page",fields:{label:(0,i.attribute)("label")},namespace:r.NS_DATAFORM_LAYOUT},{aliases:s,element:"section",fields:{label:(0,i.attribute)("label")},namespace:r.NS_DATAFORM_LAYOUT,type:"section",typeField:"type"},{aliases:s,element:"text",fields:{value:(0,i.text)()},namespace:r.NS_DATAFORM_LAYOUT,type:"text",typeField:"type"},{aliases:s,element:"fieldref",fields:{field:(0,i.attribute)("var")},namespace:r.NS_DATAFORM_LAYOUT,type:"fieldref",typeField:"type"},{aliases:s,element:"reportedref",namespace:r.NS_DATAFORM_LAYOUT,type:"reportedref",typeField:"type"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"body",fields:{acceptMediaTypes:(0,i.attribute)("accept"),ack:(0,i.integerAttribute)("ack"),authId:(0,i.attribute)("authid"),characterSets:(0,i.attribute)("charsets"),condition:(0,i.attribute)("condition"),from:(0,i.JIDAttribute)("from"),key:(0,i.attribute)("key"),lang:(0,i.languageAttribute)(),maxClientRequests:(0,i.integerAttribute)("requests"),maxHoldOpen:(0,i.integerAttribute)("hold"),maxInactivityTime:(0,i.integerAttribute)("inactivity"),maxSessionPause:(0,i.integerAttribute)("maxpause"),maxWaitTime:(0,i.integerAttribute)("wait"),mediaType:(0,i.attribute)("content"),minPollingInterval:(0,i.integerAttribute)("polling"),newKey:(0,i.attribute)("newkey"),pauseSession:(0,i.integerAttribute)("pause"),report:(0,i.integerAttribute)("report"),rid:(0,i.integerAttribute)("rid"),route:(0,i.attribute)("string"),seeOtherURI:(0,i.childText)(null,"uri"),sid:(0,i.attribute)("sid"),stream:(0,i.attribute)("stream"),time:(0,i.integerAttribute)("time"),to:(0,i.JIDAttribute)("to"),type:(0,i.attribute)("type"),version:(0,i.attribute)("ver"),xmppRestart:(0,i.namespacedBooleanAttribute)("xmpp",r.NS_BOSH_XMPP,"restart",void 0,{writeValue:e=>e?"true":"false"}),xmppRestartLogic:(0,i.namespacedBooleanAttribute)("xmpp",r.NS_BOSH_XMPP,"restartlogic",void 0,{writeValue:e=>e?"true":"false"}),xmppVersion:(0,i.namespacedAttribute)("xmpp",r.NS_BOSH_XMPP,"version")},namespace:r.NS_BOSH,path:"bosh"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({headers:(0,i.splicePath)(r.NS_SHIM,"headers","header",!0)}),(0,i.extendPresence)({headers:(0,i.splicePath)(r.NS_SHIM,"headers","header",!0)}),{element:"header",fields:{name:(0,i.attribute)("name"),value:(0,i.text)()},namespace:r.NS_SHIM,path:"header"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"compression",fields:{methods:(0,i.multipleChildText)(null,"method")},namespace:r.NS_COMPRESSION_FEATURE,path:"features.compression"},{element:"compress",fields:{method:(0,i.childText)(null,"method")},namespace:r.NS_COMPRESSION,path:"compression",type:"start",typeField:"type"},{aliases:["error.compressionError"],element:"failure",fields:{condition:(0,i.childEnum)(null,["unsupported-method","setup-failed","processing-failed"])},namespace:r.NS_COMPRESSION,path:"compression",type:"failure",typeField:"type"},{element:"compressed",namespace:r.NS_COMPRESSION,path:"compression",type:"success",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({rosterExchange:(0,i.splicePath)(r.NS_ROSTER_EXCHANGE,"x","rosterExchange",!0)}),(0,i.extendIQ)({rosterExchange:(0,i.splicePath)(r.NS_ROSTER_EXCHANGE,"x","rosterExchange",!0)}),{element:"item",fields:{action:(0,i.attribute)("action"),groups:(0,i.multipleChildText)(null,"group"),jid:(0,i.JIDAttribute)("jid"),name:(0,i.attribute)("name")},namespace:r.NS_ROSTER_EXCHANGE,path:"rosterExchange"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendPresence)({vcardAvatar:{importer(e){const t=(0,i.findAll)(e,r.NS_VCARD_TEMP_UPDATE,"x");if(!t.length)return;const n=(0,i.findAll)(t[0],r.NS_VCARD_TEMP_UPDATE,"photo");return!n.length||n[0].getText()},exporter(e,t){const n=(0,i.findOrCreate)(e,r.NS_VCARD_TEMP_UPDATE,"x");if(""===t)(0,i.findOrCreate)(n,r.NS_VCARD_TEMP_UPDATE,"photo");else{if(!0===t)return;if(t){(0,i.findOrCreate)(n,r.NS_VCARD_TEMP_UPDATE,"photo").children.push(t)}}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({captcha:(0,i.splicePath)(r.NS_CAPTCHA,"captcha","dataform")}),(0,i.extendIQ)({captcha:(0,i.splicePath)(r.NS_CAPTCHA,"captcha","dataform")})];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1),o=[(0,r.extendStanzaError)({jingleError:(0,r.childEnum)(s.NS_JINGLE_ERRORS_1,Object.values(i.JingleErrorCondition))}),{element:"jingle",fields:{action:(0,r.attribute)("action"),initiator:(0,r.JIDAttribute)("initiator"),responder:(0,r.JIDAttribute)("responder"),sid:(0,r.attribute)("sid")},namespace:s.NS_JINGLE_1,path:"iq.jingle"},{aliases:[{multiple:!0,path:"iq.jingle.contents"}],element:"content",fields:{creator:(0,r.attribute)("creator"),disposition:(0,r.attribute)("disposition","session"),name:(0,r.attribute)("name"),senders:(0,r.attribute)("senders","both")},namespace:s.NS_JINGLE_1},{element:"reason",fields:{alternativeSession:(0,r.childText)(null,"alternative-session"),condition:(0,r.childEnum)(null,Object.values(i.JingleReasonCondition)),text:(0,r.childText)(null,"text")},namespace:s.NS_JINGLE_1,path:"iq.jingle.reason"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5),r=n(2),s=n(1);function o(){return{importer(e,t){let n=(0,r.findAll)(e,s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb");const i=(0,r.attribute)("type").importer,o=(0,r.attribute)("subtype").importer,a=(0,r.attribute)("value").importer,c=[];for(const e of n){const n=i(e,t),r=o(e,t);c.push(r?{type:n,parameter:r}:{type:n})}n=(0,r.findAll)(e,s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb-trr-int");for(const e of n){const n=a(e,t);c.push(n?{type:"trr-int",parameter:n}:{type:"trr-int"})}return c},exporter(e,t,n){const i=(0,r.attribute)("type").exporter,o=(0,r.attribute)("subtype").exporter,a=(0,r.attribute)("value").exporter;for(const c of t){let t;"trr-int"===c.type?(t=(0,r.createElement)(s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb-trr-int",n.namespace,e),c.parameter&&a(t,c.parameter,n)):(t=(0,r.createElement)(s.NS_JINGLE_RTP_RTCP_FB_0,"rtcp-fb",n.namespace,e),i(t,c.type,n),c.parameter&&o(t,c.parameter,n)),e.appendChild(t)}}}}const a="iq.jingle.info",c=[{aliases:["iq.jingle.contents.application"],childrenExportOrder:{codecs:4,encryption:5,headerExtensions:6,sourceGroups:8,sources:7,streams:9},element:"description",fields:{media:(0,r.attribute)("media"),rtcpFeedback:{...o(),exportOrder:3},rtcpMux:{...(0,r.childBoolean)(null,"rtcp-mux"),exportOrder:1},rtcpReducedSize:{...(0,r.childBoolean)(null,"rtcp-reduced-size"),exportOrder:2},ssrc:(0,r.attribute)("ssrc")},namespace:s.NS_JINGLE_RTP_1,optionalNamespaces:{rtcpf:s.NS_JINGLE_RTP_RTCP_FB_0,rtph:s.NS_JINGLE_RTP_HDREXT_0},type:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.headerExtensions",selector:s.NS_JINGLE_RTP_1}],element:"rtp-hdrext",fields:{id:(0,r.integerAttribute)("id"),senders:(0,r.attribute)("senders"),uri:(0,r.attribute)("uri")},namespace:s.NS_JINGLE_RTP_HDREXT_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.codecs",selector:s.NS_JINGLE_RTP_1},"rtpcodec"],element:"payload-type",fields:{channels:(0,r.integerAttribute)("channels"),clockRate:(0,r.integerAttribute)("clockrate"),id:(0,r.attribute)("id"),maxptime:(0,r.integerAttribute)("maxptime"),name:(0,r.attribute)("name"),parameters:(0,r.parameterMap)(s.NS_JINGLE_RTP_1,"parameter","name","value"),ptime:(0,r.integerAttribute)("ptime"),rtcpFeedback:o()},namespace:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sources",selector:s.NS_JINGLE_RTP_1}],element:"source",fields:{parameters:(0,r.parameterMap)(s.NS_JINGLE_RTP_SSMA_0,"parameter","name","value"),ssrc:(0,r.attribute)("ssrc")},namespace:s.NS_JINGLE_RTP_SSMA_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.sourceGroups",selector:s.NS_JINGLE_RTP_1}],element:"ssrc-group",fields:{semantics:(0,r.attribute)("semantics"),sources:(0,r.multipleChildAttribute)(null,"source","ssrc")},namespace:s.NS_JINGLE_RTP_SSMA_0},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.streams",selector:s.NS_JINGLE_RTP_1}],element:"stream",fields:{id:(0,r.attribute)("id"),track:(0,r.attribute)("track")},namespace:s.NS_JINGLE_RTP_MSID_0},{aliases:[{path:"iq.jingle.contents.application.encryption",selector:s.NS_JINGLE_RTP_1}],element:"encryption",fields:{required:(0,r.booleanAttribute)("required")},namespace:s.NS_JINGLE_RTP_1},{aliases:[{multiple:!0,path:"iq.jingle.contents.application.encryption.sdes",selector:s.NS_JINGLE_RTP_1}],element:"crypto",fields:{cryptoSuite:(0,r.attribute)("crypto-suite"),keyParameters:(0,r.attribute)("key-params"),sessionParameters:(0,r.attribute)("session-params"),tag:(0,r.integerAttribute)("tag")},namespace:s.NS_JINGLE_RTP_1},{aliases:[{path:"iq.jingle.contents.application.encryption.zrtp",selector:s.NS_JINGLE_RTP_1}],element:"zrtp-hash",fields:{value:(0,r.textBuffer)("hex"),version:(0,r.attribute)("version")},namespace:s.NS_JINGLE_RTP_1},{element:"mute",fields:{creator:(0,r.attribute)("creator"),name:(0,r.attribute)("name")},namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_MUTE},{element:"unmute",fields:{creator:(0,r.attribute)("creator"),name:(0,r.attribute)("name")},namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_UNMUTE},{element:"hold",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_HOLD},{element:"unhold",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_UNHOLD},{element:"active",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_ACTIVE},{element:"ringing",namespace:s.NS_JINGLE_RTP_INFO_1,path:a,type:i.JINGLE_INFO_RINGING}];t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({nick:(0,i.childText)(r.NS_NICK,"nick")}),(0,i.extendPresence)({nick:(0,i.childText)(r.NS_NICK,"nick")}),{aliases:(0,i.pubsubItemContentAliases)(),element:"nick",fields:{nick:(0,i.text)()},namespace:r.NS_NICK,type:r.NS_NICK}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=e=>[{element:"transport",fields:{gatheringComplete:(0,i.childBoolean)(null,"gathering-complete"),password:(0,i.attribute)("pwd"),usernameFragment:(0,i.attribute)("ufrag")},namespace:e,path:"iq.jingle.contents.transport",type:e,typeField:"transportType"},{aliases:[{impliedType:!0,path:"iq.jingle.contents.transport.remoteCandidate",selector:e}],element:"remote-candidate",fields:{component:(0,i.integerAttribute)("component"),ip:(0,i.attribute)("ip"),port:(0,i.integerAttribute)("port")},namespace:e,type:e,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:e}],element:"candidate",fields:{component:(0,i.integerAttribute)("component"),foundation:(0,i.attribute)("foundation"),generation:(0,i.integerAttribute)("generation"),id:(0,i.attribute)("id"),ip:(0,i.attribute)("ip"),network:(0,i.integerAttribute)("network"),port:(0,i.integerAttribute)("port"),priority:(0,i.integerAttribute)("priority"),protocol:(0,i.attribute)("protocol"),relatedAddress:(0,i.attribute)("rel-addr"),relatedPort:(0,i.attribute)("rel-port"),tcpType:(0,i.attribute)("tcptype"),type:(0,i.attribute)("type")},namespace:e,type:e,typeField:"transportType"}],o=[...s(r.NS_JINGLE_ICE_0),...s(r.NS_JINGLE_ICE_UDP_1)];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"transport",fields:{gatheringComplete:(0,i.childBoolean)(null,"gathering-complete"),password:(0,i.attribute)("pwd"),usernameFragment:(0,i.attribute)("ufrag")},namespace:r.NS_JINGLE_RAW_UDP_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_RAW_UDP_1,typeField:"transportType"},{aliases:[{impliedType:!0,multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:r.NS_JINGLE_RAW_UDP_1}],element:"candidate",fields:{component:(0,i.integerAttribute)("component"),foundation:(0,i.attribute)("foundation"),generation:(0,i.integerAttribute)("generation"),id:(0,i.attribute)("id"),ip:(0,i.attribute)("ip"),port:(0,i.integerAttribute)("port"),type:(0,i.attribute)("type")},namespace:r.NS_JINGLE_RAW_UDP_1,type:r.NS_JINGLE_RAW_UDP_1,typeField:"transportType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"request",namespace:r.NS_RECEIPTS,path:"message.receipt",type:"request",typeField:"type"},{element:"received",fields:{id:(0,i.attribute)("id")},namespace:r.NS_RECEIPTS,path:"message.receipt",type:"received",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"invisible",fields:{probe:(0,i.booleanAttribute)("probe")},namespace:r.NS_INVISIBLE_0,path:"iq.visibility",type:"invisible",typeField:"type"},{element:"visible",namespace:r.NS_INVISIBLE_0,path:"iq.visibility",type:"visible"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStanzaError)({blocked:(0,i.childBoolean)(r.NS_BLOCKING_ERRORS,"blocked")}),{element:"blocklist",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"list",typeField:"action"},{element:"block",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"block",typeField:"action"},{element:"unblock",fields:{jids:(0,i.multipleChildAttribute)(null,"item","jid")},namespace:r.NS_BLOCKING,path:"iq.blockList",type:"unblock",typeField:"action"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStreamFeatures)({streamManagement:(0,i.childBoolean)(r.NS_SMACKS_3,"sm")}),{element:"a",fields:{handled:(0,i.integerAttribute)("h")},namespace:r.NS_SMACKS_3,path:"sm",type:"ack",typeField:"type"},{element:"r",namespace:r.NS_SMACKS_3,path:"sm",type:"request",typeField:"type"},{element:"enable",fields:{allowResumption:(0,i.booleanAttribute)("resume")},namespace:r.NS_SMACKS_3,path:"sm",type:"enable",typeField:"type"},{element:"enabled",fields:{id:(0,i.attribute)("id"),resume:(0,i.booleanAttribute)("resume")},namespace:r.NS_SMACKS_3,path:"sm",type:"enabled",typeField:"type"},{element:"resume",fields:{handled:(0,i.integerAttribute)("h"),previousSession:(0,i.attribute)("previd")},namespace:r.NS_SMACKS_3,path:"sm",type:"resume",typeField:"type"},{element:"resumed",fields:{handled:(0,i.integerAttribute)("h"),previousSession:(0,i.attribute)("previd")},namespace:r.NS_SMACKS_3,path:"sm",type:"resumed",typeField:"type"},{element:"failed",fields:{handled:(0,i.integerAttribute)("h")},namespace:r.NS_SMACKS_3,path:"sm",type:"failed",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendIQ)({ping:(0,i.childBoolean)(r.NS_PING,"ping")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"time",fields:{tzo:(0,i.childTimezoneOffset)(null,"tzo"),utc:(0,i.childDate)(null,"utc")},namespace:r.NS_TIME,path:"iq.time"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["message.delay","presence.delay"],element:"delay",fields:{from:(0,i.JIDAttribute)("from"),reason:(0,i.text)(),timestamp:(0,i.dateAttribute)("stamp")},namespace:r.NS_DELAY};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={2:r.NS_DISCO_EXTERNAL_2,1:r.NS_DISCO_EXTERNAL_1},o=[];for(const[e,t]of Object.entries(s))o.push({aliases:["iq.externalServiceCredentials"],defaultType:"2",element:"credentials",fields:{expires:(0,i.childDateAttribute)(null,"service","expires"),host:(0,i.childAttribute)(null,"service","host"),name:(0,i.childAttribute)(null,"service","name"),password:(0,i.childAttribute)(null,"service","password"),port:(0,i.childIntegerAttribute)(null,"service","port"),restricted:(0,i.childBooleanAttribute)(null,"service","restricted"),transport:(0,i.childAttribute)(null,"service","transport"),type:(0,i.childAttribute)(null,"service","type"),username:(0,i.childAttribute)(null,"service","username")},namespace:t,type:e,typeField:"version"},{aliases:["iq.externalServices"],defaultType:"2",element:"services",fields:{type:(0,i.attribute)("type")},namespace:t,type:e,typeField:"version"},{aliases:[{path:"iq.externalServices.services",multiple:!0}],defaultType:"2",element:"service",fields:{expires:(0,i.dateAttribute)("expires"),host:(0,i.attribute)("host"),name:(0,i.attribute)("name"),password:(0,i.attribute)("password"),port:(0,i.integerAttribute)("port"),restricted:(0,i.booleanAttribute)("restricted"),transport:(0,i.attribute)("transport"),type:(0,i.attribute)("type"),username:(0,i.attribute)("username")},namespace:t,type:e,typeField:"version"});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"media",fields:{height:(0,i.integerAttribute)("height"),width:(0,i.integerAttribute)("width")},namespace:r.NS_DATAFORM_MEDIA,path:"dataform.fields.media"},{aliases:[{multiple:!0,path:"dataform.fields.media.sources"}],element:"uri",fields:{mediaType:(0,i.attribute)("type"),uri:(0,i.text)()},namespace:r.NS_DATAFORM_MEDIA}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({requestingAttention:(0,i.childBoolean)(r.NS_ATTENTION_0,"attention")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:["iq.bits",{path:"message.bits",multiple:!0},{path:"presence.bits",multiple:!0},{path:"iq.jingle.bits",multiple:!0}],element:"data",fields:{cid:(0,i.attribute)("cid"),data:(0,i.textBuffer)("base64"),maxAge:(0,i.integerAttribute)("max-age"),mediaType:(0,i.attribute)("type")},namespace:r.NS_BOB};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);let s=[(0,i.addAlias)(r.NS_HASHES_2,"hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),(0,i.addAlias)(r.NS_HASHES_1,"hash",[{path:"file.hashes",multiple:!0},{path:"file.range.hashes",multiple:!0}]),(0,i.addAlias)(r.NS_HASHES_2,"hash-used",[{path:"file.hashesUsed",multiple:!0}]),(0,i.addAlias)(r.NS_THUMBS_1,"thumbnail",[{path:"file.thumbnails",multiple:!0}])];for(const e of[r.NS_JINGLE_FILE_TRANSFER_4,r.NS_JINGLE_FILE_TRANSFER_5])s=s.concat([{aliases:["file",{impliedType:!0,path:"iq.jingle.contents.application.file",selector:e},{impliedType:!0,path:"iq.jingle.info.file",selector:`{${e}}checksum`}],defaultType:r.NS_JINGLE_FILE_TRANSFER_5,element:"file",fields:{date:(0,i.childDate)(null,"date"),description:(0,i.childText)(null,"desc"),mediaType:(0,i.childText)(null,"media-type"),name:(0,i.childText)(null,"name"),size:(0,i.childInteger)(null,"size")},namespace:e,type:e,typeField:"version"},{aliases:[{impliedType:!0,path:"file.range",selector:e}],defaultType:r.NS_JINGLE_FILE_TRANSFER_5,element:"range",fields:{length:(0,i.integerAttribute)("length"),offset:(0,i.integerAttribute)("offset",0)},namespace:e,type:e,typeField:"version"},{element:"description",namespace:e,path:"iq.jingle.contents.application",type:e,typeField:"applicationType"},{element:"received",fields:{creator:(0,i.attribute)("creator"),name:(0,i.attribute)("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}received`,typeField:"infoType"},{element:"checksum",fields:{creator:(0,i.attribute)("creator"),name:(0,i.attribute)("name")},namespace:e,path:"iq.jingle.info",type:`{${e}}checksum`,typeField:"infoType"}]);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r={element:"description",namespace:i.NS_JINGLE_XML_0,path:"iq.jingle.contents.application",type:i.NS_JINGLE_XML_0,typeField:"applicationType"};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"transport",fields:{activated:(0,i.childAttribute)(null,"activated","cid"),address:(0,i.attribute)("dstaddr"),candidateError:(0,i.childBoolean)(null,"candidate-error"),candidateUsed:(0,i.childAttribute)(null,"candidate-used","cid"),mode:(0,i.attribute)("mode","tcp"),proxyError:(0,i.childBoolean)(null,"proxy-error"),sid:(0,i.attribute)("sid")},namespace:r.NS_JINGLE_SOCKS5_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_SOCKS5_1,typeField:"transportType"},{aliases:[{multiple:!0,path:"iq.jingle.contents.transport.candidates",selector:r.NS_JINGLE_SOCKS5_1}],element:"candidate",fields:{cid:(0,i.attribute)("cid"),host:(0,i.attribute)("host"),jid:(0,i.JIDAttribute)("jid"),port:(0,i.integerAttribute)("port"),priority:(0,i.integerAttribute)("priority"),type:(0,i.attribute)("type"),uri:(0,i.attribute)("uri")},namespace:r.NS_JINGLE_SOCKS5_1}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"transport",fields:{ack:{importer:(e,t)=>"message"!==(0,i.attribute)("stanza","iq").importer(e,t),exporter(e,t,n){!1===t&&(0,i.attribute)("stanza").exporter(e,"message",n)}},blockSize:(0,i.integerAttribute)("block-size"),sid:(0,i.attribute)("sid")},namespace:r.NS_JINGLE_IBB_1,path:"iq.jingle.contents.transport",type:r.NS_JINGLE_IBB_1,typeField:"transportType"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_BOB,"data",[{path:"iq.jingle.bits",multiple:!0}]),{element:"thumbnail",fields:{height:(0,i.integerAttribute)("height"),mediaType:(0,i.attribute)("media-type"),uri:(0,i.attribute)("uri"),width:(0,i.integerAttribute)("width")},namespace:r.NS_THUMBS_1,path:"thumbnail"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_FORWARD_0,"forwarded",["message.carbon.forward"]),{element:"enable",namespace:r.NS_CARBONS_2,path:"iq.carbons",type:"enable",typeField:"action"},{element:"disable",namespace:r.NS_CARBONS_2,path:"iq.carbons",type:"disable",typeField:"action"},{element:"sent",namespace:r.NS_CARBONS_2,path:"message.carbon",type:"sent",typeField:"type"},{element:"received",namespace:r.NS_CARBONS_2,path:"message.carbon",type:"received",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(5),s=n(1),o=[...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"message",["forward.message"])),...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"presence",["forward.presence"])),...Object.values(r.StreamType).map(e=>(0,i.addAlias)(e,"iq",["forward.iq"])),(0,i.addAlias)(s.NS_DELAY,"delay",["forward.delay"]),{aliases:["message.forward"],element:"forwarded",namespace:s.NS_FORWARD_0,path:"forward"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{defaultType:"2",element:"hash",fields:{algorithm:(0,i.attribute)("algo"),value:(0,i.textBuffer)("base64"),version:(0,i.staticValue)("2")},namespace:r.NS_HASHES_2,path:"hash",type:"2",typeField:"version"},{element:"hash-used",fields:{algorithm:(0,i.attribute)("algo"),version:(0,i.staticValue)("2")},namespace:r.NS_HASHES_2,path:"hashUsed"},{element:"hash",fields:{algorithm:(0,i.attribute)("algo"),value:(0,i.textBuffer)("hex"),version:(0,i.staticValue)("1")},namespace:r.NS_HASHES_1,path:"hash",type:"1",typeField:"version"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{element:"rtt",fields:{event:(0,i.attribute)("event","edit"),id:(0,i.attribute)("id"),seq:(0,i.integerAttribute)("seq")},namespace:r.NS_RTT_0,path:"message.rtt"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"t",fields:{position:(0,i.integerAttribute)("p"),text:(0,i.text)()},namespace:r.NS_RTT_0,type:"insert",typeField:"type"},{aliases:[{path:"message.rtt.actions",multiple:!0}],element:"e",fields:{length:(0,i.integerAttribute)("n",1),position:(0,i.integerAttribute)("p")},namespace:r.NS_RTT_0,type:"erase",typeField:"type"},{aliases:[{multiple:!0,path:"message.rtt.actions"}],element:"w",fields:{duration:(0,i.integerAttribute)("n",0)},namespace:r.NS_RTT_0,type:"wait",typeField:"type"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({replace:(0,i.childAttribute)(r.NS_CORRECTION_0,"replace","id")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={2:r.NS_MAM_2,1:r.NS_MAM_1},o=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.archive.form"]),(0,i.addAlias)(r.NS_FORWARD_0,"forwarded",["message.archive.item"]),(0,i.addAlias)(r.NS_RSM,"set",["iq.archive.paging"])];for(const[e,t]of Object.entries(s))o.push({defaultType:"query",defaultVersion:"2",element:"query",fields:{node:(0,i.attribute)("node"),queryId:(0,i.attribute)("queryid")},namespace:t,path:"iq.archive",type:"query",typeField:"type",version:e,versionField:"version"},{element:"fin",fields:{complete:(0,i.booleanAttribute)("complete"),stable:(0,i.booleanAttribute)("stable")},namespace:t,path:"iq.archive",type:"result",version:e},{element:"prefs",fields:{default:(0,i.attribute)("default"),always:(0,i.deepMultipleChildText)([{namespace:null,element:"always"},{namespace:null,element:"jid"}]),never:(0,i.deepMultipleChildText)([{namespace:null,element:"never"},{namespace:null,element:"jid"}])},namespace:t,path:"iq.archive",type:"preferences",version:e},{element:"result",defaultType:"2",fields:{id:(0,i.attribute)("id"),queryId:(0,i.attribute)("queryid")},namespace:t,path:"message.archive",type:e,typeField:"version"});t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendPresence)({hats:(0,i.splicePath)(r.NS_HATS_0,"hats","hat",!0)}),{element:"hat",fields:{id:(0,i.attribute)("name"),name:(0,i.attribute)("displayName")},namespace:r.NS_HATS_0,path:"hat"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendPresence)({idleSince:(0,i.childDate)(r.NS_IDLE_1,"since")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:r.NS_JINGLE_ICE_UDP_1},{multiple:!0,path:"iq.jingle.contents.transport.fingerprints",selector:r.NS_JINGLE_ICE_0},{multiple:!0,path:"iq.jingle.contents.application.encryption.dtls",selector:r.NS_JINGLE_RTP_1}],element:"fingerprint",fields:{algorithm:(0,i.attribute)("hash"),setup:(0,i.attribute)("setup"),value:(0,i.text)()},namespace:r.NS_JINGLE_DTLS_0};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s="message.marker",o=[{element:"markable",namespace:r.NS_CHAT_MARKERS_0,path:s,type:"markable",typeField:"type"},{element:"received",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"received"},{element:"displayed",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"displayed"},{element:"acknowledged",fields:{id:(0,i.attribute)("id")},namespace:r.NS_CHAT_MARKERS_0,path:s,type:"acknowledged"}];t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1);t.default=(0,i.extendMessage)({processingHints:{importer(e){const t={};let n=!1;for(const i of e.children)if("string"!=typeof i&&i.getNamespace()===r.NS_HINTS)switch(i.getName()){case"no-copy":t.noCopy=!0,n=!0;break;case"no-permanent-store":t.noPermanentStore=!0,n=!0;break;case"no-store":t.noStore=!0,n=!0;break;case"store":t.store=!0,n=!0}return n?t:void 0},exporter(e,t,n){t.noCopy&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-copy",n.namespace,e)),t.noPermanentStore&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-permanent-store",n.namespace,e)),t.noStore&&e.appendChild((0,i.createElement)(r.NS_HINTS,"no-store",n.namespace,e)),t.store&&e.appendChild((0,i.createElement)(r.NS_HINTS,"store",n.namespace,e))}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({json:(0,i.childJSON)(r.NS_JSON_0,"json")}),{aliases:(0,i.pubsubItemContentAliases)(),element:"json",fields:{json:(0,i.textJSON)()},namespace:r.NS_JSON_0,type:r.NS_JSON_0},{aliases:[{path:"message.jsonPayloads",multiple:!0}],element:"payload",fields:{type:(0,i.attribute)("datatype"),data:(0,i.childJSON)(r.NS_JSON_0,"json")},namespace:r.NS_JSON_MESSAGE_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:[{path:"iq.jingle.groups",multiple:!0}],element:"group",fields:{contents:(0,i.multipleChildAttribute)(null,"content","name"),semantics:(0,i.attribute)("semantics")},namespace:r.NS_JINGLE_GROUPING_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={aliases:[{path:"iq.jingle.contents.transport.sctp",selector:r.NS_JINGLE_ICE_UDP_1},{path:"iq.jingle.contents.transport.sctp",selector:r.NS_JINGLE_ICE_0}],element:"sctpmap",fields:{port:(0,i.integerAttribute)("number"),protocol:(0,i.attribute)("protocol"),streams:(0,i.attribute)("streams")},namespace:r.NS_JINGLE_DTLS_SCTP_1};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1),r=[{element:"active",namespace:i.NS_CSI_0,path:"csi",type:"active",typeField:"state"},{element:"inactive",namespace:i.NS_CSI_0,path:"csi",type:"inactive",typeField:"state"}];t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.addAlias)(r.NS_DATAFORM,"x",["iq.push.form","pushNotification.form"]),{element:"enable",fields:{jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node")},namespace:r.NS_PUSH_0,path:"iq.push",type:"enable",typeField:"action"},{element:"disable",fields:{jid:(0,i.JIDAttribute)("jid"),node:(0,i.attribute)("node")},namespace:r.NS_PUSH_0,path:"iq.push",type:"disable",typeField:"action"},{aliases:(0,i.pubsubItemContentAliases)(),element:"notification",namespace:r.NS_PUSH_0,path:"pushNotification",type:r.NS_PUSH_0,typeField:"itemType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendMessage)({originId:(0,i.childAttribute)(r.NS_SID_0,"origin-id","id")}),{aliases:[{path:"message.stanzaIds",multiple:!0}],element:"stanza-id",fields:{by:(0,i.JIDAttribute)("by"),id:(0,i.attribute)("id")},namespace:r.NS_SID_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[(0,i.extendStanzaError)({httpUploadError:(0,i.childEnum)(r.NS_HTTP_UPLOAD_0,["file-too-large","retry"]),httpUploadMaxFileSize:(0,i.deepChildInteger)([{namespace:r.NS_HTTP_UPLOAD_0,element:"file-too-large"},{namespace:r.NS_HTTP_UPLOAD_0,element:"max-file-size"}]),httpUploadRetry:(0,i.childDateAttribute)(r.NS_HTTP_UPLOAD_0,"retry","stamp")}),{element:"request",fields:{mediaType:(0,i.attribute)("content-type"),name:(0,i.attribute)("filename"),size:(0,i.integerAttribute)("size")},namespace:r.NS_HTTP_UPLOAD_0,path:"iq.httpUpload",type:"request",typeField:"type"},{element:"slot",fields:{download:(0,i.childAttribute)(null,"get","url")},namespace:r.NS_HTTP_UPLOAD_0,path:"iq.httpUpload",type:"slot"},{aliases:[{path:"iq.httpUpload.upload",selector:"slot"}],element:"put",fields:{url:(0,i.attribute)("url")},namespace:r.NS_HTTP_UPLOAD_0},{aliases:[{path:"iq.httpUpload.upload.headers",multiple:!0}],element:"header",fields:{name:(0,i.attribute)("name"),value:(0,i.text)()},namespace:r.NS_HTTP_UPLOAD_0}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s={element:"encryption",fields:{id:(0,i.attribute)("namespace"),name:(0,i.attribute)("name")},namespace:r.NS_EME_0,path:"message.encryptionMethod"};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2),r=n(1),s=[{aliases:["message.omemo"],element:"encrypted",fields:{payload:(0,i.childTextBuffer)(null,"payload","base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemo"},{element:"header",fields:{iv:(0,i.childTextBuffer)(null,"iv","base64"),sid:(0,i.integerAttribute)("sid")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemo.header"},{aliases:[{path:"omemo.header.keys",multiple:!0}],element:"key",fields:{preKey:(0,i.booleanAttribute)("prekey"),rid:(0,i.integerAttribute)("rid"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL},{aliases:(0,i.pubsubItemContentAliases)(),element:"list",fields:{devices:(0,i.multipleChildIntegerAttribute)(null,"device","id")},namespace:r.NS_OMEMO_AXOLOTL,type:r.NS_OMEMO_AXOLOTL_DEVICELIST,typeField:"itemType"},{element:"preKeyPublic",fields:{id:(0,i.integerAttribute)("preKeyId"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoPreKey"},{element:"signedPreKeyPublic",fields:{id:(0,i.integerAttribute)("signedPreKeyId"),value:(0,i.textBuffer)("base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoDevice.signedPreKeyPublic"},{aliases:(0,i.pubsubItemContentAliases)(),element:"bundle",fields:{identityKey:(0,i.childTextBuffer)(null,"identityKey","base64"),preKeys:(0,i.splicePath)(null,"prekeys","omemoPreKey",!0),signedPreKeySignature:(0,i.childTextBuffer)(null,"signedPreKeySignature","base64")},namespace:r.NS_OMEMO_AXOLOTL,path:"omemoDevice",type:r.NS_OMEMO_AXOLOTL_BUNDLES,typeField:"itemType"}];t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e,t,n){super(),this.condition=e,this.channelId=t,this.stanzaInstanceId=n,this.name="SaslError"}}t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";var i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},r=n(32),s=n(12);t.a=function(e,t,n){if(i.randomUUID&&!t&&!e)return i.randomUUID();const o=(e=e||{}).random||(e.rng||r.a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=o[e];return t}return Object(s.b)(o)}},function(e,t,n){"use strict";n.r(t);var i=n(48),r=n(44);for(var s in r)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(s);var o=n(38);for(var s in o)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);var a=n(170);for(var s in a)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(s);var c=n(21);for(var s in c)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return c[e]}))}(s);var u=n(47);for(var s in u)["HttpClient","parseJwt","default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return u[e]}))}(s);var l=n(27);n.d(t,"HttpClient",(function(){return l.HttpClient}));var d=n(11);n.d(t,"parseJwt",(function(){return d.parseJwt})),t.default=i.Client},function(e,t,n){t.RateLimiter=n(174),t.TokenBucket=n(51)},function(e,t,n){(function(t){var i=n(51),r=n(175),s=function(e,t,n){this.tokenBucket=new i(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=n};s.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,n){if(e>this.tokenBucket.bucketSize)return t.nextTick(n.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var i=this,s=r();if((s<this.curIntervalStart||s-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=s,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)t.nextTick(n.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-s);setTimeout((function(){i.tokenBucket.removeTokens(e,a)}),o)}return!1}return this.tokenBucket.removeTokens(e,a);function a(t,r){if(t)return n(t,null);i.tokensThisInterval+=e,n(null,r)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var n=this.tokenBucket.tryRemoveTokens(e);return n&&(this.tokensThisInterval+=e),n},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},e.exports=s}).call(this,n(22))},function(e,t,n){(function(t){e.exports=function(){if(void 0!==t&&t.hrtime){var e=t.hrtime(),n=e[0],i=e[1];return 1e3*n+Math.floor(i/1e6)}return(new Date).getTime()}}).call(this,n(22))},function(e,t,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var r={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=i(i({},r),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(178),r=n(182);t.DelayFactory=function(e,t){var n=function(e){if(!e.delayFirstAttempt)return new i.SkipFirstDelay(e);return new r.AlwaysDelay(e)}(e);return n.setAttemptNumber(t),n}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.apply=function(){return s(this,void 0,void 0,(function(){return o(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(n(52).Delay);t.SkipFirstDelay=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(180),r=n(181);t.JitterFactory=function(e){switch(e.jitter){case"full":return i.fullJitter;case"none":default:return r.noJitter}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}},function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(n(52).Delay);t.AlwaysDelay=s},function(e,t,n){"use strict";(function(e){
23
23
  /*!
24
24
  * The buffer module from node.js, for the browser.
25
25
  *