uneeq-js 2.40.4 → 2.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var r=n(101),i=n(102),V=n(103);function o(){return a.TYPED_ARRAY_SUPPORT?2147483
|
|
|
32
32
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
33
33
|
var r=n(43),i=r.Buffer;function V(t,e){for(var n in t)e[n]=t[n]}function o(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(V(r,e),e.Buffer=o),o.prototype=Object.create(i.prototype),V(i,o),o.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},o.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e,r){var i;t.exports=x,x.ReadableState=S;n(88).EventEmitter;var V=function(t,e){return t.listeners(e).length},o=n(89),s=n(43).Buffer,a=e.Uint8Array||function(){};var c,u=n(122);c=u&&u.debuglog?u.debuglog("stream"):function(){};var h,l,f,d=n(123),p=n(90),v=n(91).getHighWaterMark,g=n(44).codes,y=g.ERR_INVALID_ARG_TYPE,m=g.ERR_STREAM_PUSH_AFTER_EOF,b=g.ERR_METHOD_NOT_IMPLEMENTED,_=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(59)(x,o);var w=p.errorOrDestroy,A=["error","close","destroy","pause","resume"];function S(t,e,r){i=i||n(45),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=v(this,t,"readableHighWaterMark",r),this.buffer=new d,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=n(93).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function x(t){if(i=i||n(45),!(this instanceof x))return new x(t);var e=this instanceof i;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function C(t,e,n,r,i){c("readableAddChunk",e);var V,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?R(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,M(t)))}(t,o);else if(i||(V=function(t,e){var n;r=e,s.isBuffer(r)||r instanceof a||"string"==typeof e||void 0===e||t.objectMode||(n=new y("chunk",["string","Buffer","Uint8Array"],e));var r;return n}(o,e)),V)w(t,V);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),r)o.endEmitted?w(t,new _):T(t,o,e,!0);else if(o.ended)w(t,new m);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(e=o.decoder.write(e),o.objectMode||0!==e.length?T(t,o,e,!1):O(t,o)):T(t,o,e,!1)}else r||(o.reading=!1,O(t,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function T(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&R(t)),O(t,e)}Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),x.prototype.destroy=p.destroy,x.prototype._undestroy=p.undestroy,x.prototype._destroy=function(t,e){e(t)},x.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=s.from(t,e),e=""),n=!0),C(this,t,e,!1,n)},x.prototype.unshift=function(t){return C(this,t,null,!0,!1)},x.prototype.isPaused=function(){return!1===this._readableState.flowing},x.prototype.setEncoding=function(t){h||(h=n(93).StringDecoder);var e=new h(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function E(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function R(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(M,t))}function M(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,N(t)}function O(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(P,t,e))}function P(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var n=e.length;if(c("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function k(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function I(t){c("readable nexttick read 0"),t.read(0)}function D(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),N(t),e.flowing&&!e.reading&&t.read(0)}function N(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function j(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function L(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(U,e,t))}function U(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function F(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}x.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?L(this):R(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&L(this),null;var r,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=E(n,e))),null===(r=t>0?j(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&L(this)),null!==r&&this.emit("data",r),r},x.prototype._read=function(t){w(this,new b("_read()"))},x.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var o=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?a:v;function s(e,r){c("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",u),t.removeListener("error",f),t.removeListener("unpipe",s),n.removeListener("end",a),n.removeListener("end",v),n.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}function a(){c("onend"),t.end()}i.endEmitted?r.nextTick(o):n.once("end",o),t.on("unpipe",s);var u=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&V(t,"data")&&(e.flowing=!0,N(t))}}(n);t.on("drain",u);var h=!1;function l(e){c("ondata");var r=t.write(e);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function f(e){c("onerror",e),v(),t.removeListener("error",f),0===V(t,"error")&&w(t,e)}function d(){t.removeListener("finish",p),v()}function p(){c("onfinish"),t.removeListener("close",d),v()}function v(){c("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",f),t.once("close",d),t.once("finish",p),t.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),t},x.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var V=0;V<i;V++)r[V].emit("unpipe",this,{hasUnpiped:!1});return this}var o=F(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},x.prototype.on=function(t,e){var n=o.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?R(this):i.reading||r.nextTick(I,this))),n},x.prototype.addListener=x.prototype.on,x.prototype.removeListener=function(t,e){var n=o.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(k,this),n},x.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(k,this),e},x.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(D,t,e))}(this,t)),t.paused=!1,this},x.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},x.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var V=0;V<A.length;V++)t.on(A[V],this.emit.bind(this,A[V]));return this._read=function(e){c("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(x.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=n(126)),l(this)}),Object.defineProperty(x.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(x.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(x.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),x._fromList=j,Object.defineProperty(x.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(x.from=function(t,e){return void 0===f&&(f=n(127)),f(x,t,e)})}).call(this,n(34),n(37))},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,V=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,V),r(n)}function V(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}g(t,e,V,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,n)}(t,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,V,o,s;if(c(n),void 0===(V=t._events)?(V=t._events=Object.create(null),t._eventsCount=0):(void 0!==V.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),V=t._events),o=V[e]),void 0===o)o=V[e]=n,++t._eventsCount;else if("function"==typeof o?o=V[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=u(t))>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,s=a,console&&console.warn&&console.warn(s)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):v(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function v(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function g(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(V){r.once&&t.removeEventListener(e,i),n(V)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[t];if(void 0===a)return!1;if("function"==typeof a)V(a,this,e);else{var c=a.length,u=v(a,c);for(n=0;n<c;++n)V(u[n],this,e)}return!0},s.prototype.addListener=function(t,e){return h(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return h(this,t,e,!0)},s.prototype.once=function(t,e){return c(e),this.on(t,f(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,f(this,t,e)),this},s.prototype.removeListener=function(t,e){var n,r,i,V,o;if(c(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,V=n.length-1;V>=0;V--)if(n[V]===e||n[V].listener===e){o=n[V].listener,i=V;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,o||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,V=Object.keys(n);for(r=0;r<V.length;++r)"removeListener"!==(i=V[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){t.exports=n(88).EventEmitter},function(t,e,n){"use strict";(function(e){function n(t,e){i(t,e),r(t)}function r(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,V){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(V?V(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!V&&t?o._writableState?o._writableState.errorEmitted?e.nextTick(r,o):(o._writableState.errorEmitted=!0,e.nextTick(n,o,t)):e.nextTick(n,o,t):V?(e.nextTick(r,o),V(t)):e.nextTick(r,o)})),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.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,n(37))},function(t,e,n){"use strict";var r=n(44).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var V=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=V){if(!isFinite(V)||Math.floor(V)!==V||V<0)throw new r(i?n:"highWaterMark",V);return Math.floor(V)}return t.objectMode?16:16384}}},function(t,e,n){"use strict";(function(e,r){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var V;t.exports=x,x.WritableState=S;var o={deprecate:n(125)},s=n(89),a=n(43).Buffer,c=e.Uint8Array||function(){};var u,h=n(90),l=n(91).getHighWaterMark,f=n(44).codes,d=f.ERR_INVALID_ARG_TYPE,p=f.ERR_METHOD_NOT_IMPLEMENTED,v=f.ERR_MULTIPLE_CALLBACK,g=f.ERR_STREAM_CANNOT_PIPE,y=f.ERR_STREAM_DESTROYED,m=f.ERR_STREAM_NULL_VALUES,b=f.ERR_STREAM_WRITE_AFTER_END,_=f.ERR_UNKNOWN_ENCODING,w=h.errorOrDestroy;function A(){}function S(t,e,o){V=V||n(45),t=t||{},"boolean"!=typeof o&&(o=e instanceof V),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=l(this,t,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,V=n.writecb;if("function"!=typeof V)throw new v;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,V){--e.pendingcb,n?(r.nextTick(V,i),r.nextTick(O,t,e),t._writableState.errorEmitted=!0,w(t,i)):(V(i),t._writableState.errorEmitted=!0,w(t,i),O(t,e))}(t,n,i,e,V);else{var o=R(n)||t.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),i?r.nextTick(T,t,n,o,V):T(t,n,o,V)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function x(t){var e=this instanceof(V=V||n(45));if(!e&&!u.call(x,this))return new x(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function C(t,e,n,r,i,V,o){e.writelen=r,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):n?t._writev(i,e.onwrite):t._write(i,V,e.onwrite),e.sync=!1}function T(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),O(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,V=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var s=0,a=!0;n;)V[s]=n,n.isBuf||(a=!1),n=n.next,s+=1;V.allBuffers=a,C(t,e,!0,e.length,V,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,u=n.encoding,h=n.callback;if(C(t,e,!1,e.objectMode?1:c.length,c,u,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function R(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function M(t,e){t._final((function(n){e.pendingcb--,n&&w(t,n),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var n=R(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(M,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}n(59)(x,s),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(t){return!!u.call(this,t)||this===x&&(t&&t._writableState instanceof S)}})):u=function(t){return t instanceof this},x.prototype.pipe=function(){w(this,new g)},x.prototype.write=function(t,e,n){var i,V=this._writableState,o=!1,s=!V.objectMode&&(i=t,a.isBuffer(i)||i instanceof c);return s&&!a.isBuffer(t)&&(t=function(t){return a.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=V.defaultEncoding),"function"!=typeof n&&(n=A),V.ending?function(t,e){var n=new b;w(t,n),r.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var V;return null===n?V=new m:"string"==typeof n||e.objectMode||(V=new d("chunk",["string","Buffer"],n)),!V||(w(t,V),r.nextTick(i,V),!1)}(this,V,t,n))&&(V.pendingcb++,o=function(t,e,n,r,i,V){if(!n){var o=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,n));return e}(e,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=e.objectMode?1:r.length;e.length+=s;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var u=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:V,next:null},u?u.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else C(t,e,!1,s,r,i,V);return c}(this,V,s,t,e,n)),o},x.prototype.cork=function(){this._writableState.corked++},x.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||E(this,t))},x.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new _(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(t,e,n){n(new p("_write()"))},x.prototype._writev=null,x.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,O(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),x.prototype.destroy=h.destroy,x.prototype._undestroy=h.undestroy,x.prototype._destroy=function(t,e){e(t)}}).call(this,n(34),n(37))},function(t,e,n){"use strict";var r=n(86).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 V(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=a,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=u,this.end=h,e=3;break;default:return this.write=l,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function a(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=V,V.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},V.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},V.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=o(e[r]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=o(e[r]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=o(e[r]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},V.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=u;var r=n(44).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,V=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,a=n(45);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new V);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function u(t){if(!(this instanceof u))return new u(t);a.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(e,n){l(t,e,n)}))}function l(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new s;if(t._transformState.transforming)throw new o;return t.push(null)}n(59)(u,a),u.prototype.push=function(t,e){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,e)},u.prototype._transform=function(t,e,n){n(new i("_transform()"))},u.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},u.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},u.prototype._destroy=function(t,e){a.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function V(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Counter=void 0;var c=function(t){function e(){return i(this,e),o(this,s(e).apply(this,arguments))}var n,r,c;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(e,t),n=e,(r=[{key:"inc",value:function(t){return this.add(1,t),this}},{key:"add",value:function(t,e){if(t<0)throw new Error("Expected increment amount to be greater than -1. Received: ".concat(t));var n=this.get(e);return this.set(n?n.value+t:t,e),this}},{key:"reset",value:function(t){this.set(0,t)}}])&&V(n.prototype,r),c&&V(n,c),e}(n(96).Collector);e.Counter=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Collector=void 0;var r=n(63),i=n(97);function V(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){var e,n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=void 0,(n="data")in(e=this)?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,this.data=[]}var e,n,o;return e=t,(n=[{key:"get",value:function(t){return(0,i.findExistingMetric)(t,this.data)}},{key:"set",value:function(t,e){var n=(0,i.findExistingMetric)(e,this.data);return n?n.value=t:this.data.push({labels:e,value:t}),this}},{key:"collect",value:function(t){return(0,r.filter)(this.data,(function(e){return(0,r.matches)(t)(e.labels)}))}},{key:"resetAll",value:function(){var t=this;return(0,r.each)(this.data,(function(e){t.reset(e.labels)})),this}}])&&V(e.prototype,n),o&&V(e,o),t}();e.Collector=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.formatHistogramOrSummary=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"le",V="",o=i(e);o.length>0?(V+="".concat(t,"_count{").concat(o,"} ").concat(e.value.count,"\n"),V+="".concat(t,"_sum{").concat(o,"} ").concat(e.value.sum,"\n")):(V+="".concat(t,"_count ").concat(e.value.count,"\n"),V+="".concat(t,"_sum ").concat(e.value.sum,"\n"));return(0,r.reduce)(e.value.entries,(function(e,r,i){return o.length>0?V+="".concat(t,"_bucket{").concat(n,'="').concat(i,'",').concat(o,"} ").concat(r,"\n"):V+="".concat(t,"_bucket{").concat(n,'="').concat(i,'"} ').concat(r,"\n"),V}),V)},e.findExistingMetric=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t)return e[0];return(0,r.find)(e,(function(e){return(0,r.isEqual)(e.labels,t)}))},e.formatCounterOrGauge=function(t,e){var n=" ".concat(e.value.toString());if(null==e.labels||0===Object.keys(e.labels).length)return"".concat(t).concat(n,"\n");var i=(0,r.map)(e.labels,(function(t,e){return"".concat(e,'="').concat(t,'"')}));return"".concat(t,"{").concat(i.join(","),"}").concat(n,"\n")};var r=n(63);function i(t){var e=(0,r.map)(t.labels,(function(t,e){return"".concat(e,'="').concat(t,'"')}));return 0===e.length?"":"".concat(e.join(","))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingState=void 0,function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"}(e.MessagingState||(e.MessagingState={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceInputMode=void 0,function(t){t.PUSH_TO_TALK="PUSH_TO_TALK",t.VOICE_ACTIVITY="VOICE_ACTIVITY"}(e.VoiceInputMode||(e.VoiceInputMode={}))},function(t,e,n){(function(t,e){!function(t){function n(){}function r(t,e){if(t=void 0===t?"utf-8":t,e=void 0===e?{fatal:!1}:e,-1===V.indexOf(t.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+t+"') is invalid.");if(e.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}function i(t){for(var e=0,n=Math.min(65536,t.length+1),r=new Uint16Array(n),i=[],V=0;;){var o=e<t.length;if(!o||V>=n-1){if(i.push(String.fromCharCode.apply(null,r.subarray(0,V))),!o)return i.join("");t=t.subarray(e),V=e=0}if(0==(128&(o=t[e++])))r[V++]=o;else if(192==(224&o)){var s=63&t[e++];r[V++]=(31&o)<<6|s}else if(224==(240&o)){s=63&t[e++];var a=63&t[e++];r[V++]=(31&o)<<12|s<<6|a}else if(240==(248&o)){65535<(o=(7&o)<<18|(s=63&t[e++])<<12|(a=63&t[e++])<<6|63&t[e++])&&(o-=65536,r[V++]=o>>>10&1023|55296,o=56320|1023&o),r[V++]=o}}}if(t.TextEncoder&&t.TextDecoder)return!1;var V=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(n.prototype,"encoding",{value:"utf-8"}),n.prototype.encode=function(t,e){if((e=void 0===e?{stream:!1}:e).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");e=0;for(var n=t.length,r=0,i=Math.max(32,n+(n>>>1)+7),V=new Uint8Array(i>>>3<<3);e<n;){var o=t.charCodeAt(e++);if(55296<=o&&56319>=o){if(e<n){var s=t.charCodeAt(e);56320==(64512&s)&&(++e,o=((1023&o)<<10)+(1023&s)+65536)}if(55296<=o&&56319>=o)continue}if(r+4>V.length&&(i+=8,i=(i*=1+e/t.length*2)>>>3<<3,(s=new Uint8Array(i)).set(V),V=s),0==(4294967168&o))V[r++]=o;else{if(0==(4294965248&o))V[r++]=o>>>6&31|192;else if(0==(4294901760&o))V[r++]=o>>>12&15|224,V[r++]=o>>>6&63|128;else{if(0!=(4292870144&o))continue;V[r++]=o>>>18&7|240,V[r++]=o>>>12&63|128,V[r++]=o>>>6&63|128}V[r++]=63&o|128}}return V.slice?V.slice(0,r):V.subarray(0,r)},Object.defineProperty(r.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(r.prototype,"fatal",{value:!1}),Object.defineProperty(r.prototype,"ignoreBOM",{value:!1});var o=i;"function"==typeof e&&e.from?o=function(t){return e.from(t.buffer,t.byteOffset,t.byteLength).toString("utf-8")}:"function"==typeof Blob&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&(o=function(t){try{var e=URL.createObjectURL(new Blob([t],{type:"text/plain;charset=UTF-8"})),n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(),n.responseText}catch(e){return i(t)}finally{e&&URL.revokeObjectURL(e)}}),r.prototype.decode=function(t,e){if((e=void 0===e?{stream:!1}:e).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");return t=t instanceof Uint8Array?t:t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer):new Uint8Array(t),o(t)},t.TextEncoder=n,t.TextDecoder=r}("undefined"!=typeof window?window:void 0!==t?t:this)}).call(this,n(34),n(43).Buffer)},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),o=r[0],s=r[1],a=new V(function(t,e,n){return 3*(e+n)/4-n}(0,o,s)),u=0,h=s>0?o-4:o;for(n=0;n<h;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],a[u++]=e>>16&255,a[u++]=e>>8&255,a[u++]=255&e;2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,a[u++]=255&e);1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e);return a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,V=[],o=0,s=n-i;o<s;o+=16383)V.push(u(t,o,o+16383>s?s:o+16383));1===i?(e=t[n-1],V.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],V.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return V.join("")};for(var r=[],i=[],V="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],i[o.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function u(t,e,n){for(var i,V,o=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(r[(V=i)>>18&63]+r[V>>12&63]+r[V>>6&63]+r[63&V]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
|
|
34
34
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
35
|
-
e.read=function(t,e,n,r,i){var V,o,s=8*i-r-1,a=(1<<s)-1,c=a>>1,u=-7,h=n?i-1:0,l=n?-1:1,f=t[e+h];for(h+=l,V=f&(1<<-u)-1,f>>=-u,u+=s;u>0;V=256*V+t[e+h],h+=l,u-=8);for(o=V&(1<<-u)-1,V>>=-u,u+=r;u>0;o=256*o+t[e+h],h+=l,u-=8);if(0===V)V=1-c;else{if(V===a)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),V-=c}return(f?-1:1)*o*Math.pow(2,V-r)},e.write=function(t,e,n,r,i,V){var o,s,a,c=8*V-i-1,u=(1<<c)-1,h=u>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:V-1,d=r?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),(e+=o+h>=1?l/a:l*Math.pow(2,1-h))*a>=2&&(o++,a/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(e*a-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[n+f]=255&s,f+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;t[n+f]=255&o,f+=d,o/=256,c-=8);t[n+f-d]|=128*p}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(105)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(46),i=n(106);r.Observable.prototype.filter=i.filter},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(81);e.filter=function(t,e){return r.filter(t,e)(this)}},function(t){t.exports=JSON.parse('{"name":"uneeq-js","version":"2.40.3","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"./node_modules/karma/bin/karma start karma.conf.js -logLevel=DEBUG","test":"./node_modules/karma/bin/karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"./node_modules/tslint/bin/tslint -p tsconfig.json --fix","docs":"./node_modules/typedoc/bin/typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","promjs":"^0.4.1","rxjs":"^6.2.2","rxjs-compat":"^6.3.2","simple-peer":"9.11.0","webrtc-adapter":"8.1.0"},"devDependencies":{"@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^3.2.0","jasmine-class-mock":"^1.0.1","jasmine-core":"^3.3.0","karma":"^5.0.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^2.0.1","karma-jasmine-html-reporter":"^1.4.0","karma-requirejs":"^1.1.0","karma-safari-launcher":"^1.0.0","karma-typescript":"^5.0.0","karma-typescript-es6-transform":"^5.0.0","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^5.0.0","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^3.9.7","webpack":"^4.17.1","webpack-cli":"^3.1.0"}}')},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,V){function o(t){try{a(r.next(t))}catch(t){V(t)}}function s(t){try{a(r.throw(t))}catch(t){V(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.API=void 0;e.API=class{constructor(t,e="",n=(()=>{})){this.xAuthToken="",this.apiUrl=t,this.apiKey=e,this.loggedOutHandler=n}set callId(t){this._callId=t}get authToken(){return this.xAuthToken}startSession(t){return this.postRequest("/api/v1/customers/",t,{},{"faceme-api-key":this.apiKey})}endCall(){return this.postRequest("/api/v1/calls/"+this._callId+"/endCall")}avatarStart(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/start",t)}avatarWelcome(){return this.postRequest("/api/v1/avatar/"+this._callId+"/welcome")}avatarAsk(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/ask",{text:t})}avatarStartRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/start")}avatarStopRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/stop")}avatarStopSpeaking(){return this.postRequest("/api/v1/avatar/"+this._callId+"/stopSpeaking")}getAvailableAvatarCount(){return this.getRequest("/api/v1/avatar/"+this._callId+"/available")}startSessionWithToken(t){return this.postRequest("/api/v2/clients/start-session",t,{},{"x-timezone-name":this.getTimeZone()})}setAvatarDebug(t){return this.putRequest("/api/v1/avatar/"+this._callId+"/debug",{enabled:t})}sendMediaUnavailable(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/media/unavailable-update",t)}getEdgeNodeId(t){let e=t.replace("turn:","http://");e=e.replace("turns:","https://");const n=new Request(e,{method:"GET"});return this.makeRequest(n)}getTimeZone(){return Intl.DateTimeFormat().resolvedOptions().timeZone}makeRequest(t){return r(this,void 0,void 0,(function*(){const e=yield fetch(t);if(!e.ok){401===e.status&&this.loggedOutHandler();const t=yield e.json();throw{status:e.status,body:t}}return 204===e.status?new Promise((t,e)=>{t()}):(this.xAuthToken=e.headers.get("x-auth-token")||this.xAuthToken,yield e.json())}))}getRequest(t){const e=new Request(this.apiUrl+t,{method:"GET",credentials:"omit",headers:{"x-auth-token":this.xAuthToken}});return this.makeRequest(e)}postRequest(t,e={},n={},r={}){const i={method:"POST",credentials:"omit",headers:Object.assign({"Content-Type":"application/json","x-auth-token":this.xAuthToken},r),body:JSON.stringify(e)},V=new Request(this.apiUrl+t,Object.assign(i,n));return this.makeRequest(V)}putRequest(t,e={},n={}){const r={method:"PUT",credentials:"omit",headers:{"Content-Type":"application/json","x-auth-token":this.xAuthToken},body:JSON.stringify(e)},i=new Request(this.apiUrl+t,Object.assign(r,n));return this.makeRequest(i)}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,V){function o(t){try{a(r.next(t))}catch(t){V(t)}}function s(t){try{a(r.throw(t))}catch(t){V(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceManager=void 0;const i=n(36),V=n(110);e.DeviceManager=class{constructor(t,e){this.options=t,this.api=e,this.speakerConstraints={},this.publishStream=new MediaStream,this.devices={audioInput:[],audioOutput:[],videoInput:[]},this.previousMediaOptions={},this.mediaHandler=new V.MediaHandler(this.options,()=>this.remoteVideoReady()),this.initMediaConstraints(),this.getDevices(!1)}set edgeNodeId(t){this.mediaHandler.setEdgeNodeId(t),this.getDevices(!0)}enableLocalDevices(t,e){const n=this.options.uneeqOptions.sendLocalVideo!==t,r=this.options.uneeqOptions.sendLocalAudio!==e;(n||r)&&(this.previousMediaOptions={sendLocalVideo:this.options.uneeqOptions.sendLocalVideo,sendLocalAudio:this.options.uneeqOptions.sendLocalAudio},this.options.uneeqOptions.sendLocalVideo=t,this.options.uneeqOptions.sendLocalAudio=e,n&&!1===t&&this.publishStream.getVideoTracks().forEach(t=>t.stop()),r&&!1===e&&this.publishStream.getAudioTracks().forEach(t=>t.stop()),this.mediaHandler.publishingStream=!1,this.initMediaConstraints(),this.getDevices(!0))}getDevices(t=!0){if(!this.options.uneeqOptions.sendLocalVideo&&!this.options.uneeqOptions.sendLocalAudio)return void this.initStreamWithoutDevices();const e=this;this.publishStream=new MediaStream,this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),navigator.mediaDevices.getUserMedia(this.userMediaConstraints).then(e=>r(this,void 0,void 0,(function*(){if(this.initDeviceList(),this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),t){if(this.options.uneeqOptions.sendLocalVideo){const t=e.getVideoTracks();t.length>0&&(this.publishStream.getVideoTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}if(this.options.uneeqOptions.sendLocalAudio){const t=e.getAudioTracks();t.length>0&&(this.publishStream.getAudioTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}this.mediaHandler.localStream$.next(this.publishStream)}}))).catch(t=>{e.options.userMessages.next(new i.DeviceErrorMessage(t)),console.error("device error: ",t),this.sendMediaUnavailableInfo("NotAllowedError"===t.name),this.revertMediaOptions()})}setMicDevice(t,e=!0){const n=this.devices.audioInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredMicrophoneId=t,this.audioConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetMicSuccessMessage(t));else{const e="Uneeq setMic: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setCamDevice(t,e=!0){const n=this.devices.videoInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredCameraId=t,this.videoConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetCameraSuccessMessage(t));else{const e="Uneeq setCamera: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setAvatarSpeakerDevice(t){if(this.mediaHandler.avatarVideoElement){const e=this.devices.audioOutput.filter(e=>e.deviceId===t);if(e&&e.length>0)this.options.uneeqOptions.preferredSpeakerId=t,this.mediaHandler.avatarVideoElement.setSinkId(t).then(()=>{this.speakerConstraints.deviceId=t,this.options.userMessages.next(new i.SetSpeakerSuccessMessage(t))}).catch(e=>{const n="Uneeq setSpeaker: Error setting device. "+e.message;this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(n,t))});else{const e="Uneeq setSpeaker: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}}revertMediaOptions(){this.previousMediaOptions&&(this.options.uneeqOptions.sendLocalAudio=this.previousMediaOptions.sendLocalAudio,this.options.uneeqOptions.sendLocalVideo=this.previousMediaOptions.sendLocalVideo)}initMediaConstraints(){this.audioConstraints={},this.videoConstraints={facingMode:"user",width:640,height:480},this.userMediaConstraints={audio:!!this.options.uneeqOptions.sendLocalAudio&&this.audioConstraints,video:!!this.options.uneeqOptions.sendLocalVideo&&this.videoConstraints}}initStreamWithoutDevices(){this.publishStream.getTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream=new MediaStream,this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),this.mediaHandler.localStream$.next(this.publishStream)}remoteVideoReady(){this.options.uneeqOptions.preferredSpeakerId&&this.setAvatarSpeakerDevice(this.options.uneeqOptions.preferredSpeakerId)}sendMediaUnavailableInfo(t){return r(this,void 0,void 0,(function*(){const e=yield this.getMediaDevices(),n={audioInputs:e.audioInput.length,videoInputs:e.videoInput.length,hasUserDeniedPermission:t};return this.api.sendMediaUnavailable(n)}))}getMediaDevices(){return r(this,void 0,void 0,(function*(){const t=yield navigator.mediaDevices.enumerateDevices(),e={audioInput:[],audioOutput:[],videoInput:[]};return e.audioInput=t.filter(t=>"audioinput"===t.kind),e.audioOutput=t.filter(t=>"audiooutput"===t.kind),e.videoInput=t.filter(t=>"videoinput"===t.kind),e}))}initDeviceList(){return r(this,void 0,void 0,(function*(){navigator.mediaDevices.ondevicechange=t=>{this.initDeviceList()};const t=yield this.getMediaDevices();JSON.stringify(t)!==JSON.stringify(this.devices)&&(this.devices=t,this.options.uneeqOptions.preferredCameraId&&this.setCamDevice(this.options.uneeqOptions.preferredCameraId,!1),this.options.uneeqOptions.preferredMicrophoneId&&this.setMicDevice(this.options.uneeqOptions.preferredMicrophoneId,!1),this.options.userMessages.next(new i.DeviceListUpdatedMessage(this.devices)))}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MediaHandler=void 0;const r=n(46),i=n(36),V=n(111),o=n(85),s=n(113),a=n(58),c=n(114);e.MediaHandler=class{constructor(t,e){this.options=t,this.remoteVideoReady=e,this.remoteStream$=new r.BehaviorSubject(null),this.localStream$=new r.BehaviorSubject(null),this.publishState$=new r.BehaviorSubject(o.PublishSubscribeState.DISCONNECTED),this.publishingStream=!1,this.remoteStream$.filter(t=>null!==t).subscribe(n=>{const r=document.createElement("video");this.avatarVideoElement=r,r.srcObject=n,r.volume=1,r.controls=!1,r.setAttribute("playsinline","true"),r.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.uneeqOptions.avatarVideoContainerElement.style.overflow="hidden",t.uneeqOptions.avatarVideoContainerElement.innerHTML="",t.uneeqOptions.avatarVideoContainerElement.appendChild(r),this.options.uneeqOptions.enableTransparentBackground&&this.initTransparentBackground(r),e()}),this.localStream$.filter(t=>null!==t).subscribe(e=>{const n=document.createElement("video");this.localVideoElement=n,n.srcObject=e,n.autoplay=!0,n.muted=!0,n.setAttribute("playsinline","true"),n.setAttribute("style","width: 100%; height: 100%;"),t.uneeqOptions.localVideoContainerElement.innerHTML="",t.uneeqOptions.localVideoContainerElement.appendChild(n),this.options.voiceInputManager.initMicActivity(e),this.options.session.edgeNodeId&&!this.publishingStream&&this.publishVideo()}),this.options.internalMessages$.filter(t=>"AnswerMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleAnswerMessage(t)}),this.options.internalMessages$.filter(t=>"IceCandidateMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleIceCandidate(t)})}setEdgeNodeId(t){this.options.session.edgeNodeId=t,this.options.session.edgeNodeId&&!this.publishingStream&&this.localStream$.getValue()&&this.publishVideo()}unpublishVideo(){a.logger.log("UserSession | unpublishVideo"),void 0!==this.webRTC&&(this.webRTC.close(),this.webRTC=void 0),this.publishState$.next(o.PublishSubscribeState.DISCONNECTED)}pause(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();this.avatarVideoElement.pause(),this.localVideoElement.pause(),e&&e.getTracks().forEach(t=>t.enabled=!1),t&&t.getTracks().forEach(t=>t.enabled=!1)}resume(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();e&&e.getTracks().forEach(t=>t.enabled=!0),t&&t.getTracks().forEach(t=>t.enabled=!0),this.avatarVideoElement.play(),this.localVideoElement.play()}stopAllLocalStreams(){const t=this.localStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.publishingStream=!1}endSession(){this.stopAllLocalStreams(),this.options.uneeqOptions.localVideoContainerElement&&this.options.uneeqOptions.localVideoContainerElement&&(this.options.uneeqOptions.localVideoContainerElement.innerHTML=""),this.unpublishVideo(),this.options.uneeqOptions.avatarVideoContainerElement&&this.options.uneeqOptions.avatarVideoContainerElement&&(this.options.uneeqOptions.avatarVideoContainerElement.innerHTML="");const t=this.remoteStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.options.voiceInputManager.handleSessionEnd()}sendDataMessage(t){this.webRTC&&this.webRTC.sendDataMessage(t)}gatherWebRTCStats(t){var e;null===(e=this.webRTC)||void 0===e||e.getStats(t)}publishVideo(){const t=this.options.session.streamId,e=this.options.session.avatarStreamId,n=this.options.session.turnServerAddresses,r=this.options.session.turnUsername,V=this.options.session.turnPassword,s=this.options.session.forceTurnServerUse,u=this.publishState$,h=this.remoteStream$,l=this.localStream$.getValue();if(!l||!this.options.session.edgeNodeId)return void console.error("Not ready to publish");let f=0;a.logger.log("UserSession | publishVideo - stream:",l,"publishStreamName:",t),a.logger.log("PublishVideo with edge node id: ",this.options.session.edgeNodeId),this.publishingStream=!0,null==this.webRTC?(this.webRTC=new c.UneeqWebRTC({messaging:this.options.messaging,userMessages:this.options.userMessages,publishStreamName:t,subscribeStreamName:e,edgeNodeId:this.options.session.edgeNodeId||"id",diagnostics:this.options.uneeqOptions.diagnostics,onAddStream:t=>{a.logger.log("WEBRTC: onAddStream "+t.stream),h.next(t.stream)},forceTurnServerUse:s,iceServers:[{urls:n,username:r,credential:V}],onConnect:()=>{a.logger.log("UserSession | publishVideo | webRtcInstance | onStateChange - connected");u.getValue()===o.PublishSubscribeState.CONNECTING&&u.next(o.PublishSubscribeState.CONNECTED)},onError:t=>{a.logger.log("UserSession | publishVideo | webRtcInstance | onConnectionFailed - ",f),f<3?(f++,this.performWebRTCConnection(l),this.options.userMessages.next(new i.ConnectionLostMessage(o.PublishSubscribeState.DISCONNECTED))):(a.logger.log("UserSession | publishVideo | webRtcInstance | Publish failures > 3, so giving up"),u.next(o.PublishSubscribeState.FAILED),this.options.userMessages.next(new i.ConnectionLostMessage(o.PublishSubscribeState.FAILED)))}}),this.performWebRTCConnection(l)):this.webRTC.updateStreamTracks(l)}performWebRTCConnection(t){this.webRTC&&(this.publishState$.next(o.PublishSubscribeState.CONNECTING),this.webRTC.connect(t))}initTransparentBackground(t){const e=new s.CanvasService(this.options.uneeqOptions).createCanvas();(new V.VideoEditor).applyChromaKeyEffect(e,t),this.avatarVideoElement.style.display="none"}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.VideoEditor=void 0;const o=V(n(83));e.VideoEditor=class{constructor(){}applyChromaKeyEffect(t,e){try{n(112);const r=o.default();let i,V,s;i=r.transform("reformat"),i.source=e,i.width=t.width,i.height=t.height,s=r.target(t),V=r.effect("chroma"),V.source=i,s.source=V,r.go()}catch(t){console.error(t)}}}},function(t,e,n){"use strict";n.r(e),n(83).default.plugin("chroma",{shader:function(t,e){return e.vertex=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 transform;","varying vec2 vTexCoord;","uniform vec4 screen;","uniform float balance;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat fmin = min(min(screen.r, screen.g), screen.b);","\tfloat fmax = max(max(screen.r, screen.g), screen.b);","\tfloat secondaryComponents;","\tscreenPrimary = step(fmax, screen.rgb);","\tsecondaryComponents = dot(1.0 - screenPrimary, screen.rgb);","\tscreenSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position = screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tvTexCoord = texCoord;","}"].join("\n"),e.fragment=[this.inputs.mask?"#define MASK":"","precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform vec4 screen;","uniform float screenWeight;","uniform float balance;","uniform float clipBlack;","uniform float clipWhite;","uniform bool mask;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat pixelSat, secondaryComponents;","\tvec4 sourcePixel = texture2D(source, vTexCoord);","\tfloat fmin = min(min(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tfloat fmax = max(max(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tvec3 pixelPrimary = step(fmax, sourcePixel.rgb);","\tsecondaryComponents = dot(1.0 - pixelPrimary, sourcePixel.rgb);","\tpixelSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tfloat diffPrimary = dot(abs(pixelPrimary - screenPrimary), vec3(1.0));","\tfloat solid = step(1.0, step(pixelSat, 0.1) + step(fmax, 0.1) + diffPrimary);","\tfloat alpha = max(0.0, 1.0 - pixelSat / screenSat);","\talpha = smoothstep(clipBlack, clipWhite, alpha);","\tvec4 semiTransparentPixel = vec4((sourcePixel.rgb - (1.0 - alpha) * screen.rgb * screenWeight) / max(0.00001, alpha), alpha);","\tvec4 pixel = mix(semiTransparentPixel, sourcePixel, solid);","#ifdef MASK","\tgl_FragColor = vec4(vec3(pixel.a), 1.0);","#else","\tgl_FragColor = pixel;","#endif","}"].join("\n"),e},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},screen:{type:"color",uniform:"screen",defaultValue:[66/255,195/255,31/255,1]},weight:{type:"number",uniform:"screenWeight",defaultValue:1,min:0},balance:{type:"number",uniform:"balance",defaultValue:1,min:0,max:1},clipBlack:{type:"number",uniform:"clipBlack",defaultValue:0,min:0,max:1},clipWhite:{type:"number",uniform:"clipWhite",defaultValue:1,min:0,max:1},mask:{type:"boolean",defaultValue:!1,uniform:"mask",shaderDirty:!0}},title:"Chroma Key",description:""})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasService=void 0;e.CanvasService=class{constructor(t){this.canvasHeight=720,this.canvasWidth=1280,this.uneeqOptions=t}createCanvas(){const t=document.createElement("canvas");return this.uneeqOptions.avatarVideoContainerElement.appendChild(t),t.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.height=this.canvasHeight,t.width=this.canvasWidth,t}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.UneeqWebRTC=void 0;const i=r(n(115)),V=r(n(82)),o=n(36),s=n(58);e.UneeqWebRTC=class{constructor(t){this.fakeDataChannel={},this.MESSAGING_ENDPOINT="/app/v2/webRTC",this.onStats=(t,e)=>{this.options.userMessages.next(new o.WebRtcStatsMessage(e)),this.statTimer=window.setTimeout(()=>{this.client.getStats(this.onStats)},2e3)},this.options=Object.assign({forceTurnServerUse:!1,iceServers:[]},t),this.log("Options",this.options),this.uniqueId=Math.random().toString(36).substring(2,12),RTCPeerConnection.prototype.createDataChannel||(this.warn("Implementing a fake createDataChannel"),RTCPeerConnection.prototype.createDataChannel=()=>this.fakeDataChannel)}connect(t){this.close(),this.client=new i.default({initiator:!0,config:{iceServers:this.options.iceServers},stream:t,channelName:"UneeqChannel"}),this.options.diagnostics&&this.enableDiagnostics(),this.fakeDataChannel.onopen&&(this.warn("Calling channel open on fake data channel"),this.fakeDataChannel.onopen()),this.client.on("error",t=>{this.log("error",t),void 0!==this.options.onError&&this.options.onError(t)}),this.client.on("signal",t=>{const e={payload:"",publishStreamName:this.options.publishStreamName,subscribeStreamName:this.options.subscribeStreamName,uniqueId:this.uniqueId,userAgent:navigator.userAgent,edgeNodeId:this.options.edgeNodeId};if("type"in t&&"offer"===t.type)e.payload=JSON.stringify({type:"offer",sdp:t.sdp}),e.type="OfferMessage",this.log("Offer payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e);else if("candidate"in t){const n=JSON.stringify(t.candidate);this.options.forceTurnServerUse&&!n.match(/typ relay/)||n.match(/::/)||(e.payload=n,e.type="IceCandidate",this.log("IC payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e))}else this.warn("WARNING Unhandled signal: ",JSON.stringify(t))}),this.client.on("connect",()=>{this.log("CONNECT"),void 0!==this.options.onConnect&&this.options.onConnect()}),this.client.on("data",t=>{this.log("data: "+t),void 0!==this.options.onData&&this.options.onData(t),this.options.userMessages.next(new o.WebRtcDataMessage(t))}),this.client.on("close",()=>{this.log("WebRTC session closed: "+this.uniqueId),this.client=null,void 0!==this.options.onClose&&this.options.onClose()}),this.client.on("stream",t=>{void 0!==this.options.onAddStream&&this.options.onAddStream({stream:t})})}close(){this.client&&(this.client.destroy(),this.client=null),this.statTimer&&clearTimeout(this.statTimer)}handleAnswerMessage(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);return this.log("got answer: ",e),this.client.signal(e),!0}return this.log("ignoring answer: ",t),!1}handleIceCandidate(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);if("candidate"in e&&""===e.candidate){if("edge"===V.default.browserDetails.browser){const t=this.client._pc;t.remoteDescription&&t.remoteDescription.type&&t.addIceCandidate(null)}}else this.client.signal({candidate:e});return!0}return!1}sendDataMessage(t){this.client.send(t)}getStats(t){return this.client&&this.client.getStats(t)}updateStreamTracks(t){t.getTracks().forEach(t=>{this.client._pc.getSenders().find(e=>t.kind===e.track.kind).replaceTrack(t).then(()=>{s.logger.log("Updated publish media stream track for "+t.kind)}).catch(e=>{s.logger.error("Error: updating publish media stream track failed for "+t.kind,e)})})}enableDiagnostics(){this.client._pc&&0!==this.client._pc.getStats.length&&(this.client._pc.getStats=""),this.client.getStats(this.onStats)}isMessageForUs(t){return t.requestUniqueId===this.uniqueId}log(t,...e){s.logger.log("UneeqWebRTC: "+t,e)}warn(t,...e){s.logger.warn("UneeqWebRTC: "+t,e)}}},function(t,e,n){
|
|
35
|
+
e.read=function(t,e,n,r,i){var V,o,s=8*i-r-1,a=(1<<s)-1,c=a>>1,u=-7,h=n?i-1:0,l=n?-1:1,f=t[e+h];for(h+=l,V=f&(1<<-u)-1,f>>=-u,u+=s;u>0;V=256*V+t[e+h],h+=l,u-=8);for(o=V&(1<<-u)-1,V>>=-u,u+=r;u>0;o=256*o+t[e+h],h+=l,u-=8);if(0===V)V=1-c;else{if(V===a)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),V-=c}return(f?-1:1)*o*Math.pow(2,V-r)},e.write=function(t,e,n,r,i,V){var o,s,a,c=8*V-i-1,u=(1<<c)-1,h=u>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:V-1,d=r?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),(e+=o+h>=1?l/a:l*Math.pow(2,1-h))*a>=2&&(o++,a/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(e*a-1)*Math.pow(2,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[n+f]=255&s,f+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;t[n+f]=255&o,f+=d,o/=256,c-=8);t[n+f-d]|=128*p}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(105)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(46),i=n(106);r.Observable.prototype.filter=i.filter},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(81);e.filter=function(t,e){return r.filter(t,e)(this)}},function(t){t.exports=JSON.parse('{"name":"uneeq-js","version":"2.41.0","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"./node_modules/karma/bin/karma start karma.conf.js -logLevel=DEBUG","test":"./node_modules/karma/bin/karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"./node_modules/tslint/bin/tslint -p tsconfig.json --fix","docs":"./node_modules/typedoc/bin/typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","promjs":"^0.4.1","rxjs":"^6.2.2","rxjs-compat":"^6.3.2","simple-peer":"9.11.0","webrtc-adapter":"8.1.0"},"devDependencies":{"@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^3.2.0","jasmine-class-mock":"^1.0.1","jasmine-core":"^3.3.0","karma":"^5.0.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^2.0.1","karma-jasmine-html-reporter":"^1.4.0","karma-requirejs":"^1.1.0","karma-safari-launcher":"^1.0.0","karma-typescript":"^5.0.0","karma-typescript-es6-transform":"^5.0.0","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^5.0.0","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^3.9.7","webpack":"^4.17.1","webpack-cli":"^3.1.0"}}')},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,V){function o(t){try{a(r.next(t))}catch(t){V(t)}}function s(t){try{a(r.throw(t))}catch(t){V(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.API=void 0;e.API=class{constructor(t,e="",n=(()=>{})){this.xAuthToken="",this.apiUrl=t,this.apiKey=e,this.loggedOutHandler=n}set callId(t){this._callId=t}get authToken(){return this.xAuthToken}startSession(t){return this.postRequest("/api/v1/customers/",t,{},{"faceme-api-key":this.apiKey})}endCall(){return this.postRequest("/api/v1/calls/"+this._callId+"/endCall")}avatarStart(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/start",t)}avatarWelcome(){return this.postRequest("/api/v1/avatar/"+this._callId+"/welcome")}avatarAsk(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/ask",{text:t})}avatarStartRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/start")}avatarStopRecording(){return this.postRequest("/api/v1/avatar/"+this._callId+"/audioCapture/stop")}avatarStopSpeaking(){return this.postRequest("/api/v1/avatar/"+this._callId+"/stopSpeaking")}getAvailableAvatarCount(){return this.getRequest("/api/v1/avatar/"+this._callId+"/available")}startSessionWithToken(t){return this.postRequest("/api/v2/clients/start-session",t,{},{"x-timezone-name":this.getTimeZone()})}setAvatarDebug(t){return this.putRequest("/api/v1/avatar/"+this._callId+"/debug",{enabled:t})}sendMediaUnavailable(t){return this.postRequest("/api/v1/avatar/"+this._callId+"/media/unavailable-update",t)}getEdgeNodeId(t){let e=t.replace("turn:","http://");e=e.replace("turns:","https://");const n=new Request(e,{method:"GET"});return this.makeRequest(n)}getTimeZone(){return Intl.DateTimeFormat().resolvedOptions().timeZone}makeRequest(t){return r(this,void 0,void 0,(function*(){const e=yield fetch(t);if(!e.ok){401===e.status&&this.loggedOutHandler();const t=yield e.json();throw{status:e.status,body:t}}return 204===e.status?new Promise((t,e)=>{t()}):(this.xAuthToken=e.headers.get("x-auth-token")||this.xAuthToken,yield e.json())}))}getRequest(t){const e=new Request(this.apiUrl+t,{method:"GET",credentials:"omit",headers:{"x-auth-token":this.xAuthToken}});return this.makeRequest(e)}postRequest(t,e={},n={},r={}){const i={method:"POST",credentials:"omit",headers:Object.assign({"Content-Type":"application/json","x-auth-token":this.xAuthToken},r),body:JSON.stringify(e)},V=new Request(this.apiUrl+t,Object.assign(i,n));return this.makeRequest(V)}putRequest(t,e={},n={}){const r={method:"PUT",credentials:"omit",headers:{"Content-Type":"application/json","x-auth-token":this.xAuthToken},body:JSON.stringify(e)},i=new Request(this.apiUrl+t,Object.assign(r,n));return this.makeRequest(i)}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,V){function o(t){try{a(r.next(t))}catch(t){V(t)}}function s(t){try{a(r.throw(t))}catch(t){V(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}a((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceManager=void 0;const i=n(36),V=n(110);e.DeviceManager=class{constructor(t,e){this.options=t,this.api=e,this.speakerConstraints={},this.publishStream=new MediaStream,this.devices={audioInput:[],audioOutput:[],videoInput:[]},this.previousMediaOptions={},this.mediaHandler=new V.MediaHandler(this.options,()=>this.remoteVideoReady()),this.initMediaConstraints(),this.getDevices(!1)}set edgeNodeId(t){this.mediaHandler.setEdgeNodeId(t),this.getDevices(!0)}enableLocalDevices(t,e){const n=this.options.uneeqOptions.sendLocalVideo!==t,r=this.options.uneeqOptions.sendLocalAudio!==e;(n||r)&&(this.previousMediaOptions={sendLocalVideo:this.options.uneeqOptions.sendLocalVideo,sendLocalAudio:this.options.uneeqOptions.sendLocalAudio},this.options.uneeqOptions.sendLocalVideo=t,this.options.uneeqOptions.sendLocalAudio=e,n&&!1===t&&this.publishStream.getVideoTracks().forEach(t=>t.stop()),r&&!1===e&&this.publishStream.getAudioTracks().forEach(t=>t.stop()),this.mediaHandler.publishingStream=!1,this.initMediaConstraints(),this.getDevices(!0))}getDevices(t=!0){if(!this.options.uneeqOptions.sendLocalVideo&&!this.options.uneeqOptions.sendLocalAudio)return void this.initStreamWithoutDevices();const e=this;this.publishStream=new MediaStream,this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),navigator.mediaDevices.getUserMedia(this.userMediaConstraints).then(e=>r(this,void 0,void 0,(function*(){if(this.initDeviceList(),this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),t){if(this.options.uneeqOptions.sendLocalVideo){const t=e.getVideoTracks();t.length>0&&(this.publishStream.getVideoTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}if(this.options.uneeqOptions.sendLocalAudio){const t=e.getAudioTracks();t.length>0&&(this.publishStream.getAudioTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream.addTrack(t[0]))}this.mediaHandler.localStream$.next(this.publishStream)}}))).catch(t=>{e.options.userMessages.next(new i.DeviceErrorMessage(t)),console.error("device error: ",t),this.sendMediaUnavailableInfo("NotAllowedError"===t.name),this.revertMediaOptions()})}setMicDevice(t,e=!0){const n=this.devices.audioInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredMicrophoneId=t,this.audioConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetMicSuccessMessage(t));else{const e="Uneeq setMic: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setCamDevice(t,e=!0){const n=this.devices.videoInput.filter(e=>e.deviceId===t);if(n&&n.length>0)this.options.uneeqOptions.preferredCameraId=t,this.videoConstraints.deviceId=t,e&&(this.mediaHandler.publishingStream=!1,this.getDevices(!0)),this.options.userMessages.next(new i.SetCameraSuccessMessage(t));else{const e="Uneeq setCamera: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}setAvatarSpeakerDevice(t){if(this.mediaHandler.avatarVideoElement){const e=this.devices.audioOutput.filter(e=>e.deviceId===t);if(e&&e.length>0)this.options.uneeqOptions.preferredSpeakerId=t,this.mediaHandler.avatarVideoElement.setSinkId(t).then(()=>{this.speakerConstraints.deviceId=t,this.options.userMessages.next(new i.SetSpeakerSuccessMessage(t))}).catch(e=>{const n="Uneeq setSpeaker: Error setting device. "+e.message;this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(n,t))});else{const e="Uneeq setSpeaker: Error setting device. Device not found.";this.options.userMessages.next(new i.DeviceNotFoundErrorMessage(e,t))}}}revertMediaOptions(){this.previousMediaOptions&&(this.options.uneeqOptions.sendLocalAudio=this.previousMediaOptions.sendLocalAudio,this.options.uneeqOptions.sendLocalVideo=this.previousMediaOptions.sendLocalVideo)}initMediaConstraints(){this.audioConstraints={},this.videoConstraints={facingMode:"user",width:640,height:480},this.userMediaConstraints={audio:!!this.options.uneeqOptions.sendLocalAudio&&this.audioConstraints,video:!!this.options.uneeqOptions.sendLocalVideo&&this.videoConstraints}}initStreamWithoutDevices(){this.publishStream.getTracks().forEach(t=>this.publishStream.removeTrack(t)),this.publishStream=new MediaStream,this.options.internalMessages$.next({faceMeMessageType:"DevicePermissionAllowedInternal"}),this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream),this.options.streamManager.addSilentAudioTrackToStream(this.publishStream),this.mediaHandler.localStream$.next(this.publishStream)}remoteVideoReady(){this.options.uneeqOptions.preferredSpeakerId&&this.setAvatarSpeakerDevice(this.options.uneeqOptions.preferredSpeakerId)}sendMediaUnavailableInfo(t){return r(this,void 0,void 0,(function*(){const e=yield this.getMediaDevices(),n={audioInputs:e.audioInput.length,videoInputs:e.videoInput.length,hasUserDeniedPermission:t};return this.api.sendMediaUnavailable(n)}))}getMediaDevices(){return r(this,void 0,void 0,(function*(){const t=yield navigator.mediaDevices.enumerateDevices(),e={audioInput:[],audioOutput:[],videoInput:[]};return e.audioInput=t.filter(t=>"audioinput"===t.kind),e.audioOutput=t.filter(t=>"audiooutput"===t.kind),e.videoInput=t.filter(t=>"videoinput"===t.kind),e}))}initDeviceList(){return r(this,void 0,void 0,(function*(){navigator.mediaDevices.ondevicechange=t=>{this.initDeviceList()};const t=yield this.getMediaDevices();JSON.stringify(t)!==JSON.stringify(this.devices)&&(this.devices=t,this.options.uneeqOptions.preferredCameraId&&this.setCamDevice(this.options.uneeqOptions.preferredCameraId,!1),this.options.uneeqOptions.preferredMicrophoneId&&this.setMicDevice(this.options.uneeqOptions.preferredMicrophoneId,!1),this.options.userMessages.next(new i.DeviceListUpdatedMessage(this.devices)))}))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MediaHandler=void 0;const r=n(46),i=n(36),V=n(111),o=n(85),s=n(113),a=n(58),c=n(114);e.MediaHandler=class{constructor(t,e){this.options=t,this.remoteVideoReady=e,this.remoteStream$=new r.BehaviorSubject(null),this.localStream$=new r.BehaviorSubject(null),this.publishState$=new r.BehaviorSubject(o.PublishSubscribeState.DISCONNECTED),this.publishingStream=!1,this.remoteStream$.filter(t=>null!==t).subscribe(n=>{const r=document.createElement("video");this.avatarVideoElement=r,r.srcObject=n,r.volume=1,r.controls=!1,r.setAttribute("playsinline","true"),r.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.uneeqOptions.avatarVideoContainerElement.style.overflow="hidden",t.uneeqOptions.avatarVideoContainerElement.innerHTML="",t.uneeqOptions.avatarVideoContainerElement.appendChild(r),this.options.uneeqOptions.enableTransparentBackground&&this.initTransparentBackground(r),e()}),this.localStream$.filter(t=>null!==t).subscribe(e=>{const n=document.createElement("video");this.localVideoElement=n,n.srcObject=e,n.autoplay=!0,n.muted=!0,n.setAttribute("playsinline","true"),n.setAttribute("style","width: 100%; height: 100%;"),t.uneeqOptions.localVideoContainerElement.innerHTML="",t.uneeqOptions.localVideoContainerElement.appendChild(n),this.options.voiceInputManager.initMicActivity(e),this.options.session.edgeNodeId&&!this.publishingStream&&this.publishVideo()}),this.options.internalMessages$.filter(t=>"AnswerMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleAnswerMessage(t)}),this.options.internalMessages$.filter(t=>"IceCandidateMessage"===t.faceMeMessageType).subscribe(t=>{void 0!==this.webRTC&&this.webRTC.handleIceCandidate(t)})}setEdgeNodeId(t){this.options.session.edgeNodeId=t,this.options.session.edgeNodeId&&!this.publishingStream&&this.localStream$.getValue()&&this.publishVideo()}unpublishVideo(){a.logger.log("UserSession | unpublishVideo"),void 0!==this.webRTC&&(this.webRTC.close(),this.webRTC=void 0),this.publishState$.next(o.PublishSubscribeState.DISCONNECTED)}pause(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();this.avatarVideoElement.pause(),this.localVideoElement.pause(),e&&e.getTracks().forEach(t=>t.enabled=!1),t&&t.getTracks().forEach(t=>t.enabled=!1)}resume(){const t=this.remoteStream$.getValue(),e=this.localStream$.getValue();e&&e.getTracks().forEach(t=>t.enabled=!0),t&&t.getTracks().forEach(t=>t.enabled=!0),this.avatarVideoElement.play(),this.localVideoElement.play()}stopAllLocalStreams(){const t=this.localStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.publishingStream=!1}endSession(){this.stopAllLocalStreams(),this.options.uneeqOptions.localVideoContainerElement&&this.options.uneeqOptions.localVideoContainerElement&&(this.options.uneeqOptions.localVideoContainerElement.innerHTML=""),this.unpublishVideo(),this.options.uneeqOptions.avatarVideoContainerElement&&this.options.uneeqOptions.avatarVideoContainerElement&&(this.options.uneeqOptions.avatarVideoContainerElement.innerHTML="");const t=this.remoteStream$.getValue();t&&t.getTracks().forEach(t=>t.stop()),this.options.voiceInputManager.handleSessionEnd()}sendDataMessage(t){this.webRTC&&this.webRTC.sendDataMessage(t)}gatherWebRTCStats(t){var e;null===(e=this.webRTC)||void 0===e||e.getStats(t)}publishVideo(){const t=this.options.session.streamId,e=this.options.session.avatarStreamId,n=this.options.session.turnServerAddresses,r=this.options.session.turnUsername,V=this.options.session.turnPassword,s=this.options.session.forceTurnServerUse,u=this.publishState$,h=this.remoteStream$,l=this.localStream$.getValue();if(!l||!this.options.session.edgeNodeId)return void console.error("Not ready to publish");let f=0;a.logger.log("UserSession | publishVideo - stream:",l,"publishStreamName:",t),a.logger.log("PublishVideo with edge node id: ",this.options.session.edgeNodeId),this.publishingStream=!0,null==this.webRTC?(this.webRTC=new c.UneeqWebRTC({messaging:this.options.messaging,userMessages:this.options.userMessages,publishStreamName:t,subscribeStreamName:e,edgeNodeId:this.options.session.edgeNodeId||"id",diagnostics:this.options.uneeqOptions.diagnostics,onAddStream:t=>{a.logger.log("WEBRTC: onAddStream "+t.stream),h.next(t.stream)},forceTurnServerUse:s,iceServers:[{urls:n,username:r,credential:V}],onConnect:()=>{a.logger.log("UserSession | publishVideo | webRtcInstance | onStateChange - connected");u.getValue()===o.PublishSubscribeState.CONNECTING&&u.next(o.PublishSubscribeState.CONNECTED)},onError:t=>{a.logger.log("UserSession | publishVideo | webRtcInstance | onConnectionFailed - ",f),f<3?(f++,this.performWebRTCConnection(l),this.options.userMessages.next(new i.ConnectionLostMessage(o.PublishSubscribeState.DISCONNECTED))):(a.logger.log("UserSession | publishVideo | webRtcInstance | Publish failures > 3, so giving up"),u.next(o.PublishSubscribeState.FAILED),this.options.userMessages.next(new i.ConnectionLostMessage(o.PublishSubscribeState.FAILED)))}}),this.performWebRTCConnection(l)):this.webRTC.updateStreamTracks(l)}performWebRTCConnection(t){this.webRTC&&(this.publishState$.next(o.PublishSubscribeState.CONNECTING),this.webRTC.connect(t))}initTransparentBackground(t){const e=new s.CanvasService(this.options.uneeqOptions).createCanvas();(new V.VideoEditor).applyChromaKeyEffect(e,t),this.avatarVideoElement.style.display="none"}}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.VideoEditor=void 0;const o=V(n(83));e.VideoEditor=class{constructor(){}applyChromaKeyEffect(t,e){try{n(112);const r=o.default();let i,V,s;i=r.transform("reformat"),i.source=e,i.width=t.width,i.height=t.height,s=r.target(t),V=r.effect("chroma"),V.source=i,s.source=V,r.go()}catch(t){console.error(t)}}}},function(t,e,n){"use strict";n.r(e),n(83).default.plugin("chroma",{shader:function(t,e){return e.vertex=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 transform;","varying vec2 vTexCoord;","uniform vec4 screen;","uniform float balance;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat fmin = min(min(screen.r, screen.g), screen.b);","\tfloat fmax = max(max(screen.r, screen.g), screen.b);","\tfloat secondaryComponents;","\tscreenPrimary = step(fmax, screen.rgb);","\tsecondaryComponents = dot(1.0 - screenPrimary, screen.rgb);","\tscreenSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position = screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tvTexCoord = texCoord;","}"].join("\n"),e.fragment=[this.inputs.mask?"#define MASK":"","precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform vec4 screen;","uniform float screenWeight;","uniform float balance;","uniform float clipBlack;","uniform float clipWhite;","uniform bool mask;","varying float screenSat;","varying vec3 screenPrimary;","void main(void) {","\tfloat pixelSat, secondaryComponents;","\tvec4 sourcePixel = texture2D(source, vTexCoord);","\tfloat fmin = min(min(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tfloat fmax = max(max(sourcePixel.r, sourcePixel.g), sourcePixel.b);","\tvec3 pixelPrimary = step(fmax, sourcePixel.rgb);","\tsecondaryComponents = dot(1.0 - pixelPrimary, sourcePixel.rgb);","\tpixelSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);","\tfloat diffPrimary = dot(abs(pixelPrimary - screenPrimary), vec3(1.0));","\tfloat solid = step(1.0, step(pixelSat, 0.1) + step(fmax, 0.1) + diffPrimary);","\tfloat alpha = max(0.0, 1.0 - pixelSat / screenSat);","\talpha = smoothstep(clipBlack, clipWhite, alpha);","\tvec4 semiTransparentPixel = vec4((sourcePixel.rgb - (1.0 - alpha) * screen.rgb * screenWeight) / max(0.00001, alpha), alpha);","\tvec4 pixel = mix(semiTransparentPixel, sourcePixel, solid);","#ifdef MASK","\tgl_FragColor = vec4(vec3(pixel.a), 1.0);","#else","\tgl_FragColor = pixel;","#endif","}"].join("\n"),e},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},screen:{type:"color",uniform:"screen",defaultValue:[66/255,195/255,31/255,1]},weight:{type:"number",uniform:"screenWeight",defaultValue:1,min:0},balance:{type:"number",uniform:"balance",defaultValue:1,min:0,max:1},clipBlack:{type:"number",uniform:"clipBlack",defaultValue:0,min:0,max:1},clipWhite:{type:"number",uniform:"clipWhite",defaultValue:1,min:0,max:1},mask:{type:"boolean",defaultValue:!1,uniform:"mask",shaderDirty:!0}},title:"Chroma Key",description:""})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasService=void 0;e.CanvasService=class{constructor(t){this.canvasHeight=720,this.canvasWidth=1280,this.uneeqOptions=t}createCanvas(){const t=document.createElement("canvas");return this.uneeqOptions.avatarVideoContainerElement.appendChild(t),t.setAttribute("style","object-fit: cover; width: 100%; height: 100%;"),t.height=this.canvasHeight,t.width=this.canvasWidth,t}}},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.UneeqWebRTC=void 0;const i=r(n(115)),V=r(n(82)),o=n(36),s=n(58);e.UneeqWebRTC=class{constructor(t){this.fakeDataChannel={},this.MESSAGING_ENDPOINT="/app/v2/webRTC",this.onStats=(t,e)=>{this.options.userMessages.next(new o.WebRtcStatsMessage(e)),this.statTimer=window.setTimeout(()=>{this.client.getStats(this.onStats)},2e3)},this.options=Object.assign({forceTurnServerUse:!1,iceServers:[]},t),this.log("Options",this.options),this.uniqueId=Math.random().toString(36).substring(2,12),RTCPeerConnection.prototype.createDataChannel||(this.warn("Implementing a fake createDataChannel"),RTCPeerConnection.prototype.createDataChannel=()=>this.fakeDataChannel)}connect(t){this.close(),this.client=new i.default({initiator:!0,config:{iceServers:this.options.iceServers},stream:t,channelName:"UneeqChannel"}),this.options.diagnostics&&this.enableDiagnostics(),this.fakeDataChannel.onopen&&(this.warn("Calling channel open on fake data channel"),this.fakeDataChannel.onopen()),this.client.on("error",t=>{this.log("error",t),void 0!==this.options.onError&&this.options.onError(t)}),this.client.on("signal",t=>{const e={payload:"",publishStreamName:this.options.publishStreamName,subscribeStreamName:this.options.subscribeStreamName,uniqueId:this.uniqueId,userAgent:navigator.userAgent,edgeNodeId:this.options.edgeNodeId};if("type"in t&&"offer"===t.type)e.payload=JSON.stringify({type:"offer",sdp:t.sdp}),e.type="OfferMessage",this.log("Offer payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e);else if("candidate"in t){const n=JSON.stringify(t.candidate);this.options.forceTurnServerUse&&!n.match(/typ relay/)||n.match(/::/)||(e.payload=n,e.type="IceCandidate",this.log("IC payload ",e),this.options.messaging.send(this.MESSAGING_ENDPOINT,e))}else this.warn("WARNING Unhandled signal: ",JSON.stringify(t))}),this.client.on("connect",()=>{this.log("CONNECT"),void 0!==this.options.onConnect&&this.options.onConnect()}),this.client.on("data",t=>{this.log("data: "+t),void 0!==this.options.onData&&this.options.onData(t),this.options.userMessages.next(new o.WebRtcDataMessage(t))}),this.client.on("close",()=>{this.log("WebRTC session closed: "+this.uniqueId),this.client=null,void 0!==this.options.onClose&&this.options.onClose()}),this.client.on("stream",t=>{void 0!==this.options.onAddStream&&this.options.onAddStream({stream:t})})}close(){this.client&&(this.client.destroy(),this.client=null),this.statTimer&&clearTimeout(this.statTimer)}handleAnswerMessage(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);return this.log("got answer: ",e),this.client.signal(e),!0}return this.log("ignoring answer: ",t),!1}handleIceCandidate(t){if(this.isMessageForUs(t)&&this.client){const e=JSON.parse(t.payload);if("candidate"in e&&""===e.candidate){if("edge"===V.default.browserDetails.browser){const t=this.client._pc;t.remoteDescription&&t.remoteDescription.type&&t.addIceCandidate(null)}}else this.client.signal({candidate:e});return!0}return!1}sendDataMessage(t){this.client.send(t)}getStats(t){return this.client&&this.client.getStats(t)}updateStreamTracks(t){t.getTracks().forEach(t=>{this.client._pc.getSenders().find(e=>t.kind===e.track.kind).replaceTrack(t).then(()=>{s.logger.log("Updated publish media stream track for "+t.kind)}).catch(e=>{s.logger.error("Error: updating publish media stream track failed for "+t.kind,e)})})}enableDiagnostics(){this.client._pc&&0!==this.client._pc.getStats.length&&(this.client._pc.getStats=""),this.client.getStats(this.onStats)}isMessageForUs(t){return t.requestUniqueId===this.uniqueId}log(t,...e){s.logger.log("UneeqWebRTC: "+t,e)}warn(t,...e){s.logger.warn("UneeqWebRTC: "+t,e)}}},function(t,e,n){
|
|
36
36
|
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
37
37
|
const r=n(116)("simple-peer"),i=n(119),V=n(120),o=n(121),s=n(130),a=n(131),{Buffer:c}=n(43);function u(t){return t.replace(/a=ice-options:trickle\s\n/g,"")}class h extends o.Duplex{constructor(t){if(super(t=Object.assign({allowHalfOpen:!1},t)),this._id=V(4).toString("hex").slice(0,7),this._debug("new peer %o",t),this.channelName=t.initiator?t.channelName||V(20).toString("hex"):null,this.initiator=t.initiator||!1,this.channelConfig=t.channelConfig||h.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},h.config,t.config),this.offerOptions=t.offerOptions||{},this.answerOptions=t.answerOptions||{},this.sdpTransform=t.sdpTransform||(t=>t),this.streams=t.streams||(t.stream?[t.stream]:[]),this.trickle=void 0===t.trickle||t.trickle,this.allowHalfTrickle=void 0!==t.allowHalfTrickle&&t.allowHalfTrickle,this.iceCompleteTimeout=t.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=t.wrtc&&"object"==typeof t.wrtc?t.wrtc:i(),!this._wrtc)throw"undefined"==typeof window?a(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):a(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(t){return void this.destroy(a(t,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=t=>{this._onIceCandidate(t)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch(t=>{this.destroy(a(t,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=t=>{this._setupData(t)},this.streams&&this.streams.forEach(t=>{this.addStream(t)}),this._pc.ontrack=t=>{this._onTrack(t)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(t){if(!this.destroying){if(this.destroyed)throw a(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t={}}this._debug("signal()"),t.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),t.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(t.transceiverRequest.kind,t.transceiverRequest.init)),t.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(t.candidate):this._pendingCandidates.push(t.candidate)),t.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(t)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(t=>{this._addIceCandidate(t)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(t=>{this.destroy(a(t,"ERR_SET_REMOTE_DESCRIPTION"))}),t.sdp||t.candidate||t.renegotiate||t.transceiverRequest||this.destroy(a(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(t){const e=new this._wrtc.RTCIceCandidate(t);this._pc.addIceCandidate(e).catch(t=>{var n;!e.address||e.address.endsWith(".local")?(n="Ignoring unsupported ICE candidate.",console.warn(n)):this.destroy(a(t,"ERR_ADD_ICE_CANDIDATE"))})}send(t){if(!this.destroying){if(this.destroyed)throw a(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(t)}}addTransceiver(t,e){if(!this.destroying){if(this.destroyed)throw a(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(t,e),this._needsNegotiation()}catch(t){this.destroy(a(t,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:t,init:e}})}}addStream(t){if(!this.destroying){if(this.destroyed)throw a(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),t.getTracks().forEach(e=>{this.addTrack(e,t)})}}addTrack(t,e){if(this.destroying)return;if(this.destroyed)throw a(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const n=this._senderMap.get(t)||new Map;let r=n.get(e);if(r)throw r.removed?a(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):a(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");r=this._pc.addTrack(t,e),n.set(e,r),this._senderMap.set(t,n),this._needsNegotiation()}replaceTrack(t,e,n){if(this.destroying)return;if(this.destroyed)throw a(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const r=this._senderMap.get(t),i=r?r.get(n):null;if(!i)throw a(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");e&&this._senderMap.set(e,r),null!=i.replaceTrack?i.replaceTrack(e):this.destroy(a(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(t,e){if(this.destroying)return;if(this.destroyed)throw a(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const n=this._senderMap.get(t),r=n?n.get(e):null;if(!r)throw a(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{r.removed=!0,this._pc.removeTrack(r)}catch(t){"NS_ERROR_UNEXPECTED"===t.name?this._sendersAwaitingStable.push(r):this.destroy(a(t,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(t){if(!this.destroying){if(this.destroyed)throw a(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),t.getTracks().forEach(e=>{this.removeTrack(e,t)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,s(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw a(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(t){this._destroy(t,()=>{})}_destroy(t,e){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",t&&(t.message||t)),s(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",t&&(t.message||t)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(t){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(t){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,t&&this.emit("error",t),this.emit("close"),e()}))}_setupData(t){if(!t.channel)return this.destroy(a(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=t.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=65536),this.channelName=this._channel.label,this._channel.onmessage=t=>{this._onChannelMessage(t)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=t=>{const e=t.error instanceof Error?t.error:new Error(`Datachannel error: ${t.message} ${t.filename}:${t.lineno}:${t.colno}`);this.destroy(a(e,"ERR_DATA_CHANNEL"))};let e=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(e&&this._onChannelClose(),e=!0):e=!1},5e3)}_read(){}_write(t,e,n){if(this.destroyed)return n(a(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(t)}catch(t){return this.destroy(a(t,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=t,this._cb=n}_onFinish(){if(this.destroyed)return;const t=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?t():this.once("connect",t)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=u(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp})};this._pc.setLocalDescription(t).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))}).catch(t=>{this.destroy(a(t,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(t=>{this.destroy(a(t,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(t=>{t.mid||!t.sender.track||t.requested||(t.requested=!0,this.addTransceiver(t.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(t=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(t.sdp=u(t.sdp)),t.sdp=this.sdpTransform(t.sdp);const e=()=>{if(this.destroyed)return;const e=this._pc.localDescription||t;this._debug("signal"),this.emit("signal",{type:e.type,sdp:e.sdp}),this.initiator||this._requestMissingTransceivers()};this._pc.setLocalDescription(t).then(()=>{this.destroyed||(this.trickle||this._iceComplete?e():this.once("_iceComplete",e))}).catch(t=>{this.destroy(a(t,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(t=>{this.destroy(a(t,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(a(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const t=this._pc.iceConnectionState,e=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",t,e),this.emit("iceStateChange",t,e),"connected"!==t&&"completed"!==t||(this._pcReady=!0,this._maybeReady()),"failed"===t&&this.destroy(a(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&this.destroy(a(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(t){const e=t=>("[object Array]"===Object.prototype.toString.call(t.values)&&t.values.forEach(e=>{Object.assign(t,e)}),t);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(n=>{const r=[];n.forEach(t=>{r.push(e(t))}),t(null,r)},e=>t(e)):this._pc.getStats.length>0?this._pc.getStats(n=>{if(this.destroyed)return;const r=[];n.result().forEach(t=>{const n={};t.names().forEach(e=>{n[e]=t.stat(e)}),n.id=t.id,n.type=t.type,n.timestamp=t.timestamp,r.push(e(n))}),t(null,r)},e=>t(e)):t(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const t=()=>{this.destroyed||this.getStats((e,n)=>{if(this.destroyed)return;e&&(n=[]);const r={},i={},V={};let o=!1;n.forEach(t=>{"remotecandidate"!==t.type&&"remote-candidate"!==t.type||(r[t.id]=t),"localcandidate"!==t.type&&"local-candidate"!==t.type||(i[t.id]=t),"candidatepair"!==t.type&&"candidate-pair"!==t.type||(V[t.id]=t)});const s=t=>{o=!0;let e=i[t.localCandidateId];e&&(e.ip||e.address)?(this.localAddress=e.ip||e.address,this.localPort=Number(e.port)):e&&e.ipAddress?(this.localAddress=e.ipAddress,this.localPort=Number(e.portNumber)):"string"==typeof t.googLocalAddress&&(e=t.googLocalAddress.split(":"),this.localAddress=e[0],this.localPort=Number(e[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let n=r[t.remoteCandidateId];n&&(n.ip||n.address)?(this.remoteAddress=n.ip||n.address,this.remotePort=Number(n.port)):n&&n.ipAddress?(this.remoteAddress=n.ipAddress,this.remotePort=Number(n.portNumber)):"string"==typeof t.googRemoteAddress&&(n=t.googRemoteAddress.split(":"),this.remoteAddress=n[0],this.remotePort=Number(n[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(n.forEach(t=>{"transport"===t.type&&t.selectedCandidatePairId&&s(V[t.selectedCandidatePairId]),("googCandidatePair"===t.type&&"true"===t.googActiveConnection||("candidatepair"===t.type||"candidate-pair"===t.type)&&t.selected)&&s(t)}),o||Object.keys(V).length&&!Object.keys(i).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(a(e,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const t=this._cb;this._cb=null,t(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(t,100)})};t()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>65536||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(t=>{this._pc.removeTrack(t),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(t){this.destroyed||(t.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:t.candidate.candidate,sdpMLineIndex:t.candidate.sdpMLineIndex,sdpMid:t.candidate.sdpMid}}):t.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),t.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(t){if(this.destroyed)return;let e=t.data;e instanceof ArrayBuffer&&(e=c.from(e)),this.push(e)}_onChannelBufferedAmountLow(){if(this.destroyed||!this._cb)return;this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const t=this._cb;this._cb=null,t(null)}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(t){this.destroyed||t.streams.forEach(e=>{this._debug("on track"),this.emit("track",t.track,e),this._remoteTracks.push({track:t.track,stream:e}),this._remoteStreams.some(t=>t.id===e.id)||(this._remoteStreams.push(e),s(()=>{this._debug("on stream"),this.emit("stream",e)}))})}_debug(){const t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],r.apply(null,t)}}h.WEBRTC_SUPPORT=!!i(),h.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},h.channelConfig={},t.exports=h},function(t,e,n){(function(r){e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(r++,"%c"===t&&(i=r))}),e.splice(i,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}!t&&void 0!==r&&"env"in r&&(t=r.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=n(117)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,n(37))},function(t,e,n){t.exports=function(t){function e(t){let n,i,V,o=null;function s(...t){if(!s.enabled)return;const r=s,i=Number(new Date),V=i-(n||i);r.diff=V,r.prev=n,r.curr=i,n=i,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(n,i)=>{if("%%"===n)return"%";o++;const V=e.formatters[i];if("function"==typeof V){const e=t[o];n=V.call(r,e),t.splice(o,1),o--}return n}),e.formatArgs.call(r,t);(r.log||e.log).apply(r,t)}return s.namespace=t,s.useColors=e.useColors(),s.color=e.selectColor(t),s.extend=r,s.destroy=e.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==e.namespaces&&(i=e.namespaces,V=e.enabled(t)),V),set:t=>{o=t}}),"function"==typeof e.init&&e.init(s),s}function r(t,n){const r=e(this.namespace+(void 0===n?":":n)+t);return r.log=this.log,r}function i(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return e.debug=e,e.default=e,e.coerce=function(t){if(t instanceof Error)return t.stack||t.message;return t},e.disable=function(){const t=[...e.names.map(i),...e.skips.map(i).map(t=>"-"+t)].join(",");return e.enable(""),t},e.enable=function(t){let n;e.save(t),e.namespaces=t,e.names=[],e.skips=[];const r=("string"==typeof t?t:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(t=r[n].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.slice(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){if("*"===t[t.length-1])return!0;let n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1},e.humanize=n(118),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(n=>{e[n]=t[n]}),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e}},function(t,e){var n=1e3,r=6e4,i=60*r,V=24*i;function o(t,e,n,r){var i=e>=1.5*n;return Math.round(t/n)+" "+r+(i?"s":"")}t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var o=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*V;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return o*r;case"seconds":case"second":case"secs":case"sec":case"s":return o*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}(t);if("number"===s&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=V)return o(t,e,V,"day");if(e>=i)return o(t,e,i,"hour");if(e>=r)return o(t,e,r,"minute");if(e>=n)return o(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=V)return Math.round(t/V)+"d";if(e>=i)return Math.round(t/i)+"h";if(e>=r)return Math.round(t/r)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e){t.exports=function(){if("undefined"==typeof globalThis)return null;var t={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return t.RTCPeerConnection?t:null}},function(t,e,n){"use strict";(function(e,r){var i=n(86).Buffer,V=e.crypto||e.msCrypto;V&&V.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=i.allocUnsafe(t);if(t>0)if(t>65536)for(var o=0;o<t;o+=65536)V.getRandomValues(n.slice(o,o+65536));else V.getRandomValues(n);if("function"==typeof e)return r.nextTick((function(){e(null,n)}));return n}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(34),n(37))},function(t,e,n){(e=t.exports=n(87)).Stream=e,e.Readable=e,e.Writable=n(92),e.Duplex=n(45),e.Transform=n(94),e.PassThrough=n(128),e.finished=n(78),e.pipeline=n(129)},function(t,e){},function(t,e,n){"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function V(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(43).Buffer,s=n(124).inspect,a=s&&s.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,n,c;return e=t,(n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,n,r,i=o.allocUnsafe(t>>>0),V=this.head,s=0;V;)e=V.data,n=i,r=s,o.prototype.copy.call(e,n,r),s+=V.data.length,V=V.next;return i}},{key:"consume",value:function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,n=1,r=e.data;for(t-=r.length;e=e.next;){var i=e.data,V=t>i.length?i.length:t;if(V===i.length?r+=i:r+=i.slice(0,t),0==(t-=V)){V===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(V));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,V=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,V),0==(t-=V)){V===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(V));break}++r}return this.length-=r,e}},{key:a,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&V(e.prototype,n),c&&V(e,c),t}()},function(t,e){},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(34))},function(t,e,n){"use strict";(function(e){var r;function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var V=n(78),o=Symbol("lastResolve"),s=Symbol("lastReject"),a=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function f(t,e){return{value:t,done:e}}function d(t){var e=t[o];if(null!==e){var n=t[l].read();null!==n&&(t[u]=null,t[o]=null,t[s]=null,e(f(n,!1)))}}function p(t){e.nextTick(d,t)}var v=Object.getPrototypeOf((function(){})),g=Object.setPrototypeOf((i(r={get stream(){return this[l]},next:function(){var t=this,n=this[a];if(null!==n)return Promise.reject(n);if(this[c])return Promise.resolve(f(void 0,!0));if(this[l].destroyed)return new Promise((function(n,r){e.nextTick((function(){t[a]?r(t[a]):n(f(void 0,!0))}))}));var r,i=this[u];if(i)r=new Promise(function(t,e){return function(n,r){t.then((function(){e[c]?n(f(void 0,!0)):e[h](n,r)}),r)}}(i,this));else{var V=this[l].read();if(null!==V)return Promise.resolve(f(V,!1));r=new Promise(this[h])}return this[u]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var t=this;return new Promise((function(e,n){t[l].destroy(null,(function(t){t?n(t):e(f(void 0,!0))}))}))})),r),v);t.exports=function(t){var e,n=Object.create(g,(i(e={},l,{value:t,writable:!0}),i(e,o,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var r=n[l].read();r?(n[u]=null,n[o]=null,n[s]=null,t(f(r,!1))):(n[o]=t,n[s]=e)},writable:!0}),e));return n[u]=null,V(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[s];return null!==e&&(n[u]=null,n[o]=null,n[s]=null,e(t)),void(n[a]=t)}var r=n[o];null!==r&&(n[u]=null,n[o]=null,n[s]=null,r(f(void 0,!0))),n[c]=!0})),t.on("readable",p.bind(null,n)),n}}).call(this,n(37))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,n){"use strict";t.exports=i;var r=n(94);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(59)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";var r;var i=n(44).codes,V=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function a(t,e,i,V){V=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(V);var s=!1;t.on("close",(function(){s=!0})),void 0===r&&(r=n(78)),r(t,{readable:e,writable:i},(function(t){if(t)return V(t);s=!0,V()}));var a=!1;return function(e){if(!s&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void V(e||new o("pipe"))}}function c(t){t()}function u(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=h(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new V("streams");var o=e.map((function(t,n){var V=n<e.length-1;return a(t,V,n>0,(function(t){r||(r=t),t&&o.forEach(c),V||(o.forEach(c),i(r))}))}));return e.reduce(u)}},function(t,e,n){(function(e){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
38
38
|
let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):t=>(n||(n=Promise.resolve())).then(t).catch(t=>setTimeout(()=>{throw t},0))}).call(this,n(34))},function(t,e,n){"use strict";function r(t,e){for(const n in e)Object.defineProperty(t,n,{value:e[n],enumerable:!0,configurable:!0});return t}t.exports=function(t,e,n){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof e&&(n=e,e=""),e&&(n.code=e);try{return r(t,n)}catch(e){n.message=t.message,n.stack=t.stack;const i=function(){};i.prototype=Object.create(Object.getPrototypeOf(t));return r(new i,n)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;const r=n(36),i=n(79);e.MessageHandler=class{constructor(t,e){this.internalMessages$=t,this.messages=e,this.deviceManager={getDevices:(t,e)=>{}},this.getMessagesOfType("AvatarQuestionText").subscribe(t=>{const e={type:i.PromMessageType.QuestionMessageReceived,value:{id:t.id,receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e}),this.messages.next(new r.AvatarQuestionMessage(t.question,t.id))}),this.getMessagesOfType("AvatarAnswerText").subscribe(t=>{const e={type:i.PromMessageType.AnswerMessageReceived,value:{id:t.questionId,receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e}),this.messages.next(new r.AvatarAnswerMessage(t.answer,t.answerAvatar,t.answerSpeech,t.questionId))}),this.getMessagesOfType("AvatarAnswerHTML").subscribe(t=>{this.messages.next(new r.AvatarAnswerContentMessage(t.html,t.messageId,t.hasDisplayHtml)),this.messages.next(new r.InstructionsMessage(t.instructions))}),this.getMessagesOfType("AvatarTextInputStarted").subscribe(t=>this.messages.next(new r.StartedSpeakingMessage)),this.getMessagesOfType("AvatarTextInputFinished").subscribe(t=>{this.messages.next(new r.FinishedSpeakingMessage),this.messages.next(new r.AvatarTextInputFinishedMessage)}),this.getMessagesOfType("AvatarStarting").subscribe(t=>{this.deviceManager.edgeNodeId=t.edgeNodeId}),this.getMessagesOfType("ClientMediaStreamUpdate").subscribe(t=>{this.messages.next(new r.ClientMediaStreamUpdateMessage(t.clientStreamingAudio,t.clientStreamingVideo,t.serverStreamingAudio,t.serverStreamingVideo)),t.clientStreamingAudio&&t.clientStreamingVideo&&t.serverStreamingAudio&&t.serverStreamingVideo&&(this.internalMessages$.next({faceMeMessageType:"sessionLive"}),this.internalMessages$.next({faceMeMessageType:"remoteVideoReadyToPlay"}))}),this.getMessagesOfType("SessionErrorMessage").subscribe(t=>{console.error(t.error),this.messages.next(new r.SessionErrorMessage(t.error))}),this.getMessagesOfType("SessionInfoMessage").subscribe(t=>{this.messages.next(new r.SessionInfoMessage(t.info))}),this.getMessagesOfType("SessionEndedMessage").subscribe(()=>{const t={type:i.PromMessageType.SessionEnded,value:{receivedOn:Date.now()}};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:t}),this.internalMessages$.next({faceMeMessageType:"sessionEnd"})}),this.getMessagesOfType("AvatarRequestCompleted").subscribe(t=>{this.messages.next(new r.AvatarRequestCompleted(t.reason))}),this.getMessagesOfType("AvatarRequestIgnored").subscribe(t=>{this.messages.next(new r.AvatarRequestIgnored(t.reason))})}setDeviceManager(t){this.deviceManager=t}getMessagesOfType(t){return this.internalMessages$.filter(e=>e.faceMeMessageType===t)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={};e.default=void 0;var i=n(134),V=n(138);Object.keys(V).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return V[t]}}))}));e.default=function(){return new i.Registry}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Registry=void 0;var r=n(63),i=n(95),V=n(136),o=n(137),s=n(97);function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var c=function(){function t(){var e,n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=void 0,(n="data")in(e=this)?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,this.data={counter:{},gauge:{},histogram:{}}}var e,n,c;return e=t,(n=[{key:"validateInput",value:function(t,e,n,i){if(""===String(e))throw new Error("Metric name cannot be empty");if(-1===["counter","gauge","histogram"].indexOf(t))throw new Error("Unknown metric type ".concat(t));if("string"!=typeof n&&null!=n)throw new Error("help must be string or undefined/null");if((0,r.has)(this.data,"".concat(t,".").concat(e)))throw new Error("A metric with the name '".concat(e,"' already exists for type '").concat(t,"'"));if(!Array.isArray(i)&&null!=i)throw new Error("buckets must be array or undefined/null")}},{key:"create",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return this.validateInput(t,e,r,s),"counter"===t?(n=new i.Counter,this.data.counter[e]={help:r,instance:n,type:t}):"gauge"===t?(n=new V.Gauge,this.data.gauge[e]={help:r,instance:n,type:t}):(n=new o.Histogram(s),this.data.histogram[e]={help:r,instance:n,type:t}),n}},{key:"metrics",value:function(){return(0,r.reduce)(this.data,(function(t,e,n){return t+(0,r.reduce)(e,(function(t,e,i){var V=e.instance.collect(),o=t;return e.help.length>0&&(o+="# HELP ".concat(i," ").concat(e.help,"\n")),o+="# TYPE ".concat(i," ").concat(n,"\n"),o+=(0,r.reduce)(V,(function(t,e){return t+("histogram"===n?(0,s.formatHistogramOrSummary)(i,e):(0,s.formatCounterOrGauge)(i,e))}),"")}),"")}),"")}},{key:"reset",value:function(){return(0,r.each)(this.data,(function(t){(0,r.each)(t,(function(t){t.instance.resetAll()}))})),this}},{key:"clear",value:function(){return this.data={counter:{},gauge:{},histogram:{}},this}},{key:"get",value:function(t,e){var n=(null!=t?[this.data[t]]:(0,r.valuesIn)(this.data)).find((function(t){return(0,r.has)(t,e)}));return null!=n?n[e].instance:void 0}}])&&a(e.prototype,n),c&&a(e,c),t}();e.Registry=c},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function V(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Gauge=void 0;var c=function(t){function e(){return i(this,e),o(this,s(e).apply(this,arguments))}var n,r,c;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(e,t),n=e,(r=[{key:"dec",value:function(t){var e=this.get(t);return this.set(e?e.value-1:0,t),this}},{key:"sub",value:function(t,e){var n=this.get(e);return this.set(n?n.value-t:0,e),this}}])&&V(n.prototype,r),c&&V(n,c),e}(n(95).Counter);e.Gauge=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Histogram=void 0;var r=n(63);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function V(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?c(t):e}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t){return{entries:(0,r.reduce)(t,(function(t,e){return t[e.toString()]=0,t}),{"+Inf":0}),sum:0,count:0,raw:[]}}var f=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return V(this,e),h(c(t=s(this,a(e).call(this))),"buckets",void 0),t.buckets=n.sort((function(t,e){return t>e?1:-1})),t.set(l(t.buckets)),t.observe=t.observe.bind(c(t)),t}var n,i,f;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(e,t),n=e,(i=[{key:"observe",value:function(t,e){var n=this.get(e);null==n&&(n=this.set(l(this.buckets),e).get(e)),n.value.raw.push(t),n.value.entries["+Inf"]+=1;var i=function(t,e){if(e<t[t.length-1])for(var n=0;n<t.length;n+=1)if(e<=t[n])return n}(this.buckets,t);if(null!=i)for(var V=i;V<this.buckets.length;V+=1){var o=n.value.entries[this.buckets[V].toString()];n.value.entries[this.buckets[V].toString()]=o+1}return n.value.sum=(0,r.sum)(n.value.raw),n.value.count+=1,this}},{key:"reset",value:function(t){this.set(l(this.buckets),t)}}])&&o(n.prototype,i),f&&o(n,f),e}(n(96).Collector);e.Histogram=f},function(t,e,n){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingState=e.MessagingService=void 0;const r=n(140);Object.defineProperty(e,"MessagingService",{enumerable:!0,get:function(){return r.MessagingService}});const i=n(98);Object.defineProperty(e,"MessagingState",{enumerable:!0,get:function(){return i.MessagingState}})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessagingService=void 0;const r=n(153),i=n(141),V=n(143),o=n(58),s=n(98);e.MessagingService=class{constructor(t,e){this.options={autoReconnect:!0,reconnectTime:5e3,maxReconnectAttempts:3,connectionHeaders:{},maxReconnectLimitReached:()=>{},onReconnect:()=>{}},this.url=t,this.options=Object.assign(this.options,e),this.subscriptions={},this.connectionAttempts=0,this.state$=new i.BehaviorSubject(s.MessagingState.DISCONNECTED),this.messages$=new V.Subject,console.log("connect headers messaging: ",this.options.connectionHeaders);const n={connectHeaders:this.options.connectionHeaders,reconnectDelay:0,connectionTimeout:5e3,discardWebsocketOnCommFailure:!0,brokerURL:this.url.replace("https://","wss://").replace("http://","ws://")};this.stompClient=new r.Client(n),this.stompClient.onConnect=t=>this.onStompConnected(t),this.stompClient.onDisconnect=t=>{o.logger.log("Stomp client disconnected",t)},this.stompClient.onStompError=t=>{o.logger.log("Stomp client error",t),this.onStompClientConnectionClosed(t)},this.stompClient.onWebSocketError=t=>{o.logger.log("Stomp client web socket error",t),this.onStompClientConnectionClosed(t)},this.stompClient.onWebSocketClose=t=>{o.logger.log("Stomp client web socket closed",t),this.onStompClientConnectionClosed(t)}}connect(){this.disconnect(),o.logger.log("MessagingService | connecting..."),this.state$.next(s.MessagingState.CONNECTING),this.connectionAttempts++,this.stompClient.activate()}disconnect(){const t=this.state$.getValue();if(t===s.MessagingState.CONNECTED||t===s.MessagingState.CONNECTING){o.logger.log("Disconnecting stomp client");try{this.subscriptions={},this.stompClient.deactivate(),this.stompClient.forceDisconnect(),this.state$.next(s.MessagingState.DISCONNECTED)}catch(t){console.error("MessagingService | disconnect: error",t),this.state$.next(s.MessagingState.DISCONNECTED)}}}send(t,e){o.logger.log("MessagingService | send:",t,e);const n={"content-type":"application/json","x-auth-token":this.options.connectionHeaders["x-auth-token"]},r=JSON.stringify(e);this.stompClient.publish({destination:t,body:r,headers:n})}getTopic(t){o.logger.log("MessagingService | subscribeToTopic: "+t);const e=this.subscriptions[t];if(e)return o.logger.log("existing subscription... not re-subscribing to topic"),e;const n=new V.Subject;return this.stompClient.subscribe(t,t=>{n.next(t),this.messages$.next(t)}),this.subscriptions[t]=n,n}onStompConnected(t){o.logger.log("MessagingService | connected"),this.state$.next(s.MessagingState.CONNECTED),this.initMessagingSubscription(),this.connectionAttempts=0}onStompClientConnectionClosed(t){this.options.autoReconnect?this.options.maxReconnectAttempts&&this.connectionAttempts<this.options.maxReconnectAttempts?setTimeout(()=>{this.connect()},this.options.reconnectTime):this.options.maxReconnectLimitReached&&(this.options.maxReconnectLimitReached(),this.disconnect()):this.disconnect()}initMessagingSubscription(){o.logger.log("MessagingService | initMessagingSubscription");this.stompClient.subscribe("/",t=>{this.messages$.next(t)})}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(142))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(46);e.BehaviorSubject=r.BehaviorSubject},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(144))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(46);e.Subject=r.Subject},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetricsService=void 0;const r=n(36),i=n(146),V=n(79);e.MetricsService=class{constructor(t,e,n){this.uneeqOptions=t,this.internalMessages=e,this.messages=n,this.clientPerformanceStats={},this.options=t,this.internalMessages$=e,this.messages$=n}parseAndLogWebRtcStats(t){try{t.forEach(t=>{var e,n;if("inbound-rtp"===t.type&&"video"===t.kind){this.clientPerformanceStats.frameHeight=new i.ClientPerformanceStat("Frame height",t.frameHeight),this.clientPerformanceStats.frameWidth=new i.ClientPerformanceStat("Frame width",t.frameWidth);const r=t.framesDropped,V=r?r-(null===(e=this.clientPerformanceStats.totalFramesDropped)||void 0===e?void 0:e.value):0;this.clientPerformanceStats.newFramesDropped=V?new i.ClientPerformanceStat("New Frames Dropped",V):new i.ClientPerformanceStat,this.clientPerformanceStats.totalFramesDropped=r?new i.ClientPerformanceStat("Total Frames Dropped",r):new i.ClientPerformanceStat;const o=t.packetsLost,s=o?o-(null===(n=this.clientPerformanceStats.inboundTotalPacketsLost)||void 0===n?void 0:n.value):0;this.clientPerformanceStats.inboundNewPacketsLost=s?new i.ClientPerformanceStat("New packets lost",s):new i.ClientPerformanceStat,this.clientPerformanceStats.inboundTotalPacketsLost=o?new i.ClientPerformanceStat("Total packets lost",o):new i.ClientPerformanceStat;const a=t.framesPerSecond;this.clientPerformanceStats.framesPerSec=a?new i.ClientPerformanceStat("Frames per second",a):new i.ClientPerformanceStat}else if("remote-inbound-rtp"===t.type&&"video"===t.kind){const e=t.roundTripTime;this.clientPerformanceStats.inboundRoundTripTime=e?new i.ClientPerformanceStat("Round Trip Time",e):new i.ClientPerformanceStat}else if("outbound-rtp"===t.type&&"video"===t.kind){const e=t.qualityLimitationReason;this.clientPerformanceStats.outboundQualityLimitationReason=new i.ClientPerformanceStat("Quality Limitation Reason",e)}}),this.options.enableClientPerformanceMessage&&this.messages$.next(new r.ClientPerformanceMessage(this.clientPerformanceStats));const e={type:V.PromMessageType.WebRtcPerformance,value:this.clientPerformanceStats};this.internalMessages$.next({faceMeMessageType:"prom",promMsg:e})}catch(t){console.warn("Unable to parseAndLogWebRTCStats",t)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ClientPerformanceStat=void 0;e.ClientPerformanceStat=class{constructor(t="",e=0){this.label=t,this.value=e}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnlineStatusService=void 0;const r=n(36);e.OnlineStatusService=class{constructor(t,e){this.messages=t,this.offlineTimeoutLimitHandler=e,this.online=!0,this.offlineDisconnectTimeLimitMS=1e4,window.addEventListener("offline",()=>this.handleOffline()),window.addEventListener("online",()=>this.handleOnline())}handleOffline(){this.online=!1,this.disconnectTimer=setTimeout(()=>{this.offlineTimeoutLimitHandler()},this.offlineDisconnectTimeLimitMS),this.sendStatusUpdate()}handleOnline(){this.online=!0,window.clearTimeout(this.disconnectTimer),this.sendStatusUpdate()}sendStatusUpdate(){this.messages.next(new r.OnlineStatusUpdateMessage(this.online))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StreamManager=void 0;class r{constructor(){window.AudioContext=window.AudioContext||window.webkitAudioContext,this.silentAudioElement=document.createElement("audio"),this.silentAudioTrack=this.generateSilentAudioTrack(),this.canvasVideoTrack=this.generateCanvasVideoTrack()}addCanvasVideoTrackToStream(t){return t.getVideoTracks().forEach(e=>t.removeTrack(e)),t.addTrack(this.canvasVideoTrack),t}addSilentAudioTrackToStream(t){return t.getAudioTracks().forEach(e=>t.removeTrack(e)),t.addTrack(this.silentAudioTrack),t}remoteVideoReadyToPlay(){null!==this.silentAudioElement&&setTimeout(()=>{this.silentAudioElement.pause(),setTimeout(()=>{this.silentAudioElement.play()},500)},500)}resumeAudioContext(){this.audioContextInstance&&this.audioContextInstance.resume()}generateCanvasVideoTrack(){this.canvasInterval&&clearInterval(this.canvasInterval);const t=document.createElement("canvas");t.width=40,t.height=30;const e=t.getContext("2d");this.canvasInterval=setInterval(()=>(e.fillStyle="#"+(16777216+16777215*Math.random()).toString(16).substr(1,6),e.fillRect(0,0,t.width,t.height),t),1e3);return t.captureStream(1).getVideoTracks()[0]}generateSilentAudioTrack(){if(!this.audioSourceNode||!this.audioSourceDestination){this.silentAudioElement.loop=!0,this.silentAudioElement.volume=1;const t=(t=>{const e=t.indexOf(";base64,")+";base64,".length,n=t.substring(e),r=window.atob(n),i=r.length,V=new Uint8Array(new ArrayBuffer(i));for(let t=0;t<i;t++)V[t]=r.charCodeAt(t);return V})(r.audioData),e=new Blob([t],{type:"audio/mpeg"});this.silentAudioElement.src=URL.createObjectURL(e),this.silentAudioElement.play().then().catch(t=>{console.log("UneeQ audio track could not play: ",t)});const n=new window.AudioContext;this.audioContextInstance=n,this.audioSourceDestination=n.createMediaStreamDestination(),this.audioSourceNode=n.createMediaElementSource(this.silentAudioElement),this.audioSourceNode.connect(this.audioSourceDestination),this.audioSourceNode.connect(n.destination)}return this.audioSourceDestination.stream.getAudioTracks()[0]}}e.StreamManager=r,r.audioData="data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU3LjgzLjEwMAAAAAAAAAAAAAAA//tUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAArAABBQAAICA4OFBQaGhogICYmLCwsMjI3Nz09PUNDSUlPT09VVVtbYWFhZmZsbHJycnh4fn6EhISKipCQlpaWm5uhoaenp62ts7O5ubm/v8XFy8vL0NDW1tzc3OLi6Oju7u709Pr6//8AAAAATGF2YzU3LjEwAAAAAAAAAAAAAAAAJAPAAAAAAAAAQUCaftgR//uUZAAP8AAAaQAAAAgAAA0gAAABAAABpAAAACAAADSAAAAETEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV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VVVVVVVV"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceInputManager=void 0;const r=n(81),i=n(150),V=n(80),o=n(99);e.VoiceInputManager=class{constructor(t,e,n,r){this.options=t,this.api=e,this.messages=n,this.enableMicrophone=r,this.microphoneEngageVolume=.02,this.voiceActivityNotSpeakingTimeoutMS=1e3,this.digitalHumanSpeaking=!1,this.recording=!1,this.setVoiceInputMode(t.voiceInputMode);try{window.AudioContext=window.AudioContext||window.webkitAudioContext,this.audioContext=new AudioContext}catch(t){this.audioContextNotSupported()}this.handleAppMessages()}setVoiceInputMode(t){t===o.VoiceInputMode.PUSH_TO_TALK?this.options.voiceInputMode=o.VoiceInputMode.PUSH_TO_TALK:t===o.VoiceInputMode.VOICE_ACTIVITY?this.options.voiceInputMode=o.VoiceInputMode.VOICE_ACTIVITY:this.messages.next(new V.WarningMessage("Invalid voice input mode selected: "+t))}startRecording(){this.options.voiceInputMode===o.VoiceInputMode.PUSH_TO_TALK?this.apiStartRecording():this.requestNotSupportedInVoiceActivityMode("startRecording")}stopRecording(){this.options.voiceInputMode===o.VoiceInputMode.PUSH_TO_TALK?this.apiStopRecording():this.requestNotSupportedInVoiceActivityMode("stopRecording")}handleSessionEnd(){this.soundMeter&&this.soundMeter.stop()}initMicActivity(t){this.soundMeter=new i.SoundMeter(this.audioContext),this.soundMeter.connectToSource(t,t=>this.micActivityConnected(t))}audioContextNotSupported(){this.options.micActivityMessages&&this.messages.next(new V.MicActivityNotSupportedMessage),this.messages.next(new V.VoiceActivityInputModeNotSupportedMessage),this.setVoiceInputMode(o.VoiceInputMode.PUSH_TO_TALK)}handleAppMessages(){this.messages.subscribe(t=>{switch(t.uneeqMessageType){case V.UneeqMessageType.StartedSpeaking:this.digitalHumanSpeaking=!0;break;case V.UneeqMessageType.FinishedSpeaking:this.digitalHumanSpeaking=!1;break;case V.UneeqMessageType.SessionLive:this.options.voiceInputMode===o.VoiceInputMode.VOICE_ACTIVITY&&this.enableMicrophone(!0)}})}requestNotSupportedInVoiceActivityMode(t){this.messages.next(new V.WarningMessage("Request not supported in voice activity mode: "+t))}apiStartRecording(){this.recording=!0,this.api.avatarStartRecording().then(()=>this.messages.next(new V.RecordingStartedMessage))}apiStopRecording(){this.recording=!1,this.api.avatarStopRecording().then(()=>this.messages.next(new V.RecordingStoppedMessage))}micActivityConnected(t){t?this.messages.next(new V.MicActivityErrorMessage(t)):this.soundMeter&&this.soundMeter.instant$.pipe(r.distinctUntilChanged()).subscribe(t=>{this.handleVoiceActivity(t)})}handleVoiceActivity(t){this.options.micActivityMessages&&this.messages.next(new V.MicActivityMessage(t)),this.options.voiceInputMode!==o.VoiceInputMode.VOICE_ACTIVITY||this.digitalHumanSpeaking||(t>this.microphoneEngageVolume?(this.recording||this.apiStartRecording(),this.silenceTimeout&&clearTimeout(this.silenceTimeout)):t<this.microphoneEngageVolume&&this.recording&&(this.silenceTimeout=setTimeout(()=>{this.recording&&this.apiStopRecording()},this.voiceActivityNotSpeakingTimeoutMS)))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SoundMeter=void 0;const r=n(46),i=n(58);e.SoundMeter=class{constructor(t){this.instant$=new r.BehaviorSubject(0),this.context=t,this.instant=0,this.slow=0,this.clip=0,this.script=t.createScriptProcessor(2048,1,1);const e=this;this.script.onaudioprocess=t=>{const n=t.inputBuffer.getChannelData(0);let r,i=0,V=0;for(r=0;r<n.length;++r)i+=n[r]*n[r],Math.abs(n[r])>.99&&(V+=1);e.instant=Math.sqrt(i/n.length),e.slow=.95*e.slow+.05*e.instant,e.clip=V/n.length,e.instant$.next(parseFloat(e.instant.toFixed(2)))}}connectToSource(t,e){i.logger.log("SoundMeter connecting");try{this.mic=this.context.createMediaStreamSource(t),this.mic.connect(this.script),this.script.connect(this.context.destination),void 0!==e&&e(null)}catch(t){console.error(t),void 0!==e&&e(t)}}stop(){this.mic.disconnect(),this.script.disconnect()}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SessionType=void 0,function(t){t[t.WEB=0]="WEB"}(e.SessionType||(e.SessionType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SourceApp=void 0,function(t){t.HOSTED_EXPERIENCE="HOSTED_EXPERIENCE",t.SHOWCASE="SHOWCASE",t.SPLIT_SCREEN="SPLIT_SCREEN",t.INTERACTIONS="INTERACTIONS",t.UNKNOWN="UNKNOWN"}(e.SourceApp||(e.SourceApp={}))},function(t,e,n){"use strict";n.r(e),n.d(e,"Client",(function(){return l})),n.d(e,"FrameImpl",(function(){return V})),n.d(e,"Parser",(function(){return o})),n.d(e,"StompConfig",(function(){return f})),n.d(e,"StompHeaders",(function(){return d})),n.d(e,"StompSubscription",(function(){return p})),n.d(e,"StompSocketState",(function(){return s})),n.d(e,"ActivationState",(function(){return a})),n.d(e,"Versions",(function(){return c})),n.d(e,"CompatClient",(function(){return g})),n.d(e,"Stomp",(function(){return y}));const r="\n",i="\0";class V{constructor(t){const{command:e,headers:n,body:r,binaryBody:i,escapeHeaderValues:V,skipContentLengthHeader:o}=t;this.command=e,this.headers=Object.assign({},n||{}),i?(this._binaryBody=i,this.isBinaryBody=!0):(this._body=r||"",this.isBinaryBody=!1),this.escapeHeaderValues=V||!1,this.skipContentLengthHeader=o||!1}get body(){return!this._body&&this.isBinaryBody&&(this._body=(new TextDecoder).decode(this._binaryBody)),this._body}get binaryBody(){return this._binaryBody||this.isBinaryBody||(this._binaryBody=(new TextEncoder).encode(this._body)),this._binaryBody}static fromRawFrame(t,e){const n={},r=t=>t.replace(/^\s+|\s+$/g,"");for(const i of t.headers.reverse()){i.indexOf(":");const o=r(i[0]);let s=r(i[1]);e&&"CONNECT"!==t.command&&"CONNECTED"!==t.command&&(s=V.hdrValueUnEscape(s)),n[o]=s}return new V({command:t.command,headers:n,binaryBody:t.binaryBody,escapeHeaderValues:e})}toString(){return this.serializeCmdAndHeaders()}serialize(){const t=this.serializeCmdAndHeaders();return this.isBinaryBody?V.toUnit8Array(t,this._binaryBody).buffer:t+this._body+i}serializeCmdAndHeaders(){const t=[this.command];this.skipContentLengthHeader&&delete this.headers["content-length"];for(const e of Object.keys(this.headers||{})){const n=this.headers[e];this.escapeHeaderValues&&"CONNECT"!==this.command&&"CONNECTED"!==this.command?t.push(`${e}:${V.hdrValueEscape(""+n)}`):t.push(`${e}:${n}`)}return(this.isBinaryBody||!this.isBodyEmpty()&&!this.skipContentLengthHeader)&&t.push("content-length:"+this.bodyLength()),t.join(r)+r+r}isBodyEmpty(){return 0===this.bodyLength()}bodyLength(){const t=this.binaryBody;return t?t.length:0}static sizeOfUTF8(t){return t?(new TextEncoder).encode(t).length:0}static toUnit8Array(t,e){const n=(new TextEncoder).encode(t),r=new Uint8Array([0]),i=new Uint8Array(n.length+e.length+r.length);return i.set(n),i.set(e,n.length),i.set(r,n.length+e.length),i}static marshall(t){return new V(t).serialize()}static hdrValueEscape(t){return t.replace(/\\/g,"\\\\").replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/:/g,"\\c")}static hdrValueUnEscape(t){return t.replace(/\\r/g,"\r").replace(/\\n/g,"\n").replace(/\\c/g,":").replace(/\\\\/g,"\\")}}class o{constructor(t,e){this.onFrame=t,this.onIncomingPing=e,this._encoder=new TextEncoder,this._decoder=new TextDecoder,this._token=[],this._initState()}parseChunk(t,e=!1){let n;if(n=t instanceof ArrayBuffer?new Uint8Array(t):this._encoder.encode(t),e&&0!==n[n.length-1]){const t=new Uint8Array(n.length+1);t.set(n,0),t[n.length]=0,n=t}for(let t=0;t<n.length;t++){const e=n[t];this._onByte(e)}}_collectFrame(t){0!==t&&13!==t&&(10!==t?(this._onByte=this._collectCommand,this._reinjectByte(t)):this.onIncomingPing())}_collectCommand(t){if(13!==t)return 10===t?(this._results.command=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaders)):void this._consumeByte(t)}_collectHeaders(t){13!==t&&(10!==t?(this._onByte=this._collectHeaderKey,this._reinjectByte(t)):this._setupCollectBody())}_reinjectByte(t){this._onByte(t)}_collectHeaderKey(t){if(58===t)return this._headerKey=this._consumeTokenAsUTF8(),void(this._onByte=this._collectHeaderValue);this._consumeByte(t)}_collectHeaderValue(t){if(13!==t)return 10===t?(this._results.headers.push([this._headerKey,this._consumeTokenAsUTF8()]),this._headerKey=void 0,void(this._onByte=this._collectHeaders)):void this._consumeByte(t)}_setupCollectBody(){const t=this._results.headers.filter(t=>"content-length"===t[0])[0];t?(this._bodyBytesRemaining=parseInt(t[1],10),this._onByte=this._collectBodyFixedSize):this._onByte=this._collectBodyNullTerminated}_collectBodyNullTerminated(t){0!==t?this._consumeByte(t):this._retrievedBody()}_collectBodyFixedSize(t){0!=this._bodyBytesRemaining--?this._consumeByte(t):this._retrievedBody()}_retrievedBody(){this._results.binaryBody=this._consumeTokenAsRaw(),this.onFrame(this._results),this._initState()}_consumeByte(t){this._token.push(t)}_consumeTokenAsUTF8(){return this._decoder.decode(this._consumeTokenAsRaw())}_consumeTokenAsRaw(){const t=new Uint8Array(this._token);return this._token=[],t}_initState(){this._results={command:void 0,headers:[],binaryBody:void 0},this._token=[],this._headerKey=void 0,this._onByte=this._collectFrame}}var s,a;!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSING=2]="CLOSING",t[t.CLOSED=3]="CLOSED"}(s||(s={})),function(t){t[t.ACTIVE=0]="ACTIVE",t[t.DEACTIVATING=1]="DEACTIVATING",t[t.INACTIVE=2]="INACTIVE"}(a||(a={}));class c{constructor(t){this.versions=t}supportedVersions(){return this.versions.join(",")}protocolVersions(){return this.versions.map(t=>`v${t.replace(".","")}.stomp`)}}c.V1_0="1.0",c.V1_1="1.1",c.V1_2="1.2",c.default=new c([c.V1_0,c.V1_1,c.V1_2]);class u{constructor(t,e,n={}){this._client=t,this._webSocket=e,this._serverFrameHandlers={CONNECTED:t=>{this.debug("connected to server "+t.headers.server),this._connected=!0,this._connectedVersion=t.headers.version,this._connectedVersion===c.V1_2&&(this._escapeHeaderValues=!0),this._setupHeartbeat(t.headers),this.onConnect(t)},MESSAGE:t=>{const e=t.headers.subscription,n=this._subscriptions[e]||this.onUnhandledMessage,r=t,i=this,V=this._connectedVersion===c.V1_2?r.headers.ack:r.headers["message-id"];r.ack=(t={})=>i.ack(V,e,t),r.nack=(t={})=>i.nack(V,e,t),n(r)},RECEIPT:t=>{const e=this._receiptWatchers[t.headers["receipt-id"]];e?(e(t),delete this._receiptWatchers[t.headers["receipt-id"]]):this.onUnhandledReceipt(t)},ERROR:t=>{this.onStompError(t)}},this._counter=0,this._subscriptions={},this._receiptWatchers={},this._partialData="",this._escapeHeaderValues=!1,this._lastServerActivityTS=Date.now(),this.configure(n)}get connectedVersion(){return this._connectedVersion}get connected(){return this._connected}configure(t){Object.assign(this,t)}start(){const t=new o(t=>{const e=V.fromRawFrame(t,this._escapeHeaderValues);this.logRawCommunication||this.debug("<<< "+e);(this._serverFrameHandlers[e.command]||this.onUnhandledFrame)(e)},()=>{this.debug("<<< PONG")});this._webSocket.onmessage=e=>{if(this.debug("Received data"),this._lastServerActivityTS=Date.now(),this.logRawCommunication){const t=e.data instanceof ArrayBuffer?(new TextDecoder).decode(e.data):e.data;this.debug("<<< "+t)}t.parseChunk(e.data,this.appendMissingNULLonIncoming)},this._onclose=t=>{this.debug("Connection closed to "+this._client.brokerURL),this._cleanUp(),this.onWebSocketClose(t)},this._webSocket.onclose=this._onclose,this._webSocket.onerror=t=>{this.onWebSocketError(t)},this._webSocket.onopen=()=>{const t=Object.assign({},this.connectHeaders);this.debug("Web Socket Opened..."),t["accept-version"]=this.stompVersions.supportedVersions(),t["heart-beat"]=[this.heartbeatOutgoing,this.heartbeatIncoming].join(","),this._transmit({command:"CONNECT",headers:t})}}_setupHeartbeat(t){if(t.version!==c.V1_1&&t.version!==c.V1_2)return;if(!t["heart-beat"])return;const[e,n]=t["heart-beat"].split(",").map(t=>parseInt(t,10));if(0!==this.heartbeatOutgoing&&0!==n){const t=Math.max(this.heartbeatOutgoing,n);this.debug(`send PING every ${t}ms`),this._pinger=setInterval(()=>{this._webSocket.readyState===s.OPEN&&(this._webSocket.send(r),this.debug(">>> PING"))},t)}if(0!==this.heartbeatIncoming&&0!==e){const t=Math.max(this.heartbeatIncoming,e);this.debug(`check PONG every ${t}ms`),this._ponger=setInterval(()=>{const e=Date.now()-this._lastServerActivityTS;e>2*t&&(this.debug(`did not receive server activity for the last ${e}ms`),this._closeOrDiscardWebsocket())},t)}}_closeOrDiscardWebsocket(){this.discardWebsocketOnCommFailure?(this.debug("Discarding websocket, the underlying socket may linger for a while"),this._discardWebsocket()):(this.debug("Issuing close on the websocket"),this._closeWebsocket())}forceDisconnect(){this._webSocket&&(this._webSocket.readyState!==s.CONNECTING&&this._webSocket.readyState!==s.OPEN||this._closeOrDiscardWebsocket())}_closeWebsocket(){this._webSocket.onmessage=()=>{},this._webSocket.close()}_discardWebsocket(){var t,e;this._webSocket.terminate||(t=this._webSocket,e=t=>this.debug(t),t.terminate=function(){const t=()=>{};this.onerror=t,this.onmessage=t,this.onopen=t;const n=new Date,r=this.onclose;this.onclose=t=>{const r=(new Date).getTime()-n.getTime();e(`Discarded socket closed after ${r}ms, with code/reason: ${t.code}/${t.reason}`)},this.close(),r.call(this,{code:4001,reason:"Heartbeat failure, discarding the socket",wasClean:!1})}),this._webSocket.terminate()}_transmit(t){const{command:e,headers:n,body:r,binaryBody:i,skipContentLengthHeader:o}=t,s=new V({command:e,headers:n,body:r,binaryBody:i,escapeHeaderValues:this._escapeHeaderValues,skipContentLengthHeader:o});let a=s.serialize();if(this.logRawCommunication?this.debug(">>> "+a):this.debug(">>> "+s),this.forceBinaryWSFrames&&"string"==typeof a&&(a=(new TextEncoder).encode(a)),"string"==typeof a&&this.splitLargeFrames){let t=a;for(;t.length>0;){const e=t.substring(0,this.maxWebSocketChunkSize);t=t.substring(this.maxWebSocketChunkSize),this._webSocket.send(e),this.debug(`chunk sent = ${e.length}, remaining = ${t.length}`)}}else this._webSocket.send(a)}dispose(){if(this.connected)try{const t=Object.assign({},this.disconnectHeaders);t.receipt||(t.receipt="close-"+this._counter++),this.watchForReceipt(t.receipt,t=>{this._closeWebsocket(),this._cleanUp(),this.onDisconnect(t)}),this._transmit({command:"DISCONNECT",headers:t})}catch(t){this.debug("Ignoring error during disconnect "+t)}else this._webSocket.readyState!==s.CONNECTING&&this._webSocket.readyState!==s.OPEN||this._closeWebsocket()}_cleanUp(){this._connected=!1,this._pinger&&clearInterval(this._pinger),this._ponger&&clearInterval(this._ponger)}publish(t){const{destination:e,headers:n,body:r,binaryBody:i,skipContentLengthHeader:V}=t,o=Object.assign({destination:e},n);this._transmit({command:"SEND",headers:o,body:r,binaryBody:i,skipContentLengthHeader:V})}watchForReceipt(t,e){this._receiptWatchers[t]=e}subscribe(t,e,n={}){(n=Object.assign({},n)).id||(n.id="sub-"+this._counter++),n.destination=t,this._subscriptions[n.id]=e,this._transmit({command:"SUBSCRIBE",headers:n});const r=this;return{id:n.id,unsubscribe:t=>r.unsubscribe(n.id,t)}}unsubscribe(t,e={}){e=Object.assign({},e),delete this._subscriptions[t],e.id=t,this._transmit({command:"UNSUBSCRIBE",headers:e})}begin(t){const e=t||"tx-"+this._counter++;this._transmit({command:"BEGIN",headers:{transaction:e}});const n=this;return{id:e,commit(){n.commit(e)},abort(){n.abort(e)}}}commit(t){this._transmit({command:"COMMIT",headers:{transaction:t}})}abort(t){this._transmit({command:"ABORT",headers:{transaction:t}})}ack(t,e,n={}){n=Object.assign({},n),this._connectedVersion===c.V1_2?n.id=t:n["message-id"]=t,n.subscription=e,this._transmit({command:"ACK",headers:n})}nack(t,e,n={}){return n=Object.assign({},n),this._connectedVersion===c.V1_2?n.id=t:n["message-id"]=t,n.subscription=e,this._transmit({command:"NACK",headers:n})}}var h=function(t,e,n,r){return new(n||(n=Promise))((function(i,V){function o(t){try{a(r.next(t))}catch(t){V(t)}}function s(t){try{a(r.throw(t))}catch(t){V(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}a((r=r.apply(t,e||[])).next())}))};class l{constructor(t={}){this.stompVersions=c.default,this.connectionTimeout=0,this.reconnectDelay=5e3,this.heartbeatIncoming=1e4,this.heartbeatOutgoing=1e4,this.splitLargeFrames=!1,this.maxWebSocketChunkSize=8192,this.forceBinaryWSFrames=!1,this.appendMissingNULLonIncoming=!1,this.state=a.INACTIVE;const e=()=>{};this.debug=e,this.beforeConnect=e,this.onConnect=e,this.onDisconnect=e,this.onUnhandledMessage=e,this.onUnhandledReceipt=e,this.onUnhandledFrame=e,this.onStompError=e,this.onWebSocketClose=e,this.onWebSocketError=e,this.logRawCommunication=!1,this.onChangeState=e,this.connectHeaders={},this._disconnectHeaders={},this.configure(t)}get webSocket(){return this._stompHandler?this._stompHandler._webSocket:void 0}get disconnectHeaders(){return this._disconnectHeaders}set disconnectHeaders(t){this._disconnectHeaders=t,this._stompHandler&&(this._stompHandler.disconnectHeaders=this._disconnectHeaders)}get connected(){return!!this._stompHandler&&this._stompHandler.connected}get connectedVersion(){return this._stompHandler?this._stompHandler.connectedVersion:void 0}get active(){return this.state===a.ACTIVE}_changeState(t){this.state=t,this.onChangeState(t)}configure(t){Object.assign(this,t)}activate(){if(this.state===a.DEACTIVATING)throw this.debug("Still DEACTIVATING, please await call to deactivate before trying to re-activate"),new Error("Still DEACTIVATING, can not activate now");this.active?this.debug("Already ACTIVE, ignoring request to activate"):(this._changeState(a.ACTIVE),this._connect())}_connect(){return h(this,void 0,void 0,(function*(){if(this.connected)return void this.debug("STOMP: already connected, nothing to do");if(yield this.beforeConnect(),!this.active)return void this.debug("Client has been marked inactive, will not attempt to connect");this.connectionTimeout>0&&(this._connectionWatcher&&clearTimeout(this._connectionWatcher),this._connectionWatcher=setTimeout(()=>{this.connected||(this.debug(`Connection not established in ${this.connectionTimeout}ms, closing socket`),this.forceDisconnect())},this.connectionTimeout)),this.debug("Opening Web Socket...");const t=this._createWebSocket();this._stompHandler=new u(this,t,{debug:this.debug,stompVersions:this.stompVersions,connectHeaders:this.connectHeaders,disconnectHeaders:this._disconnectHeaders,heartbeatIncoming:this.heartbeatIncoming,heartbeatOutgoing:this.heartbeatOutgoing,splitLargeFrames:this.splitLargeFrames,maxWebSocketChunkSize:this.maxWebSocketChunkSize,forceBinaryWSFrames:this.forceBinaryWSFrames,logRawCommunication:this.logRawCommunication,appendMissingNULLonIncoming:this.appendMissingNULLonIncoming,discardWebsocketOnCommFailure:this.discardWebsocketOnCommFailure,onConnect:t=>{if(this._connectionWatcher&&(clearTimeout(this._connectionWatcher),this._connectionWatcher=void 0),!this.active)return this.debug("STOMP got connected while deactivate was issued, will disconnect now"),void this._disposeStompHandler();this.onConnect(t)},onDisconnect:t=>{this.onDisconnect(t)},onStompError:t=>{this.onStompError(t)},onWebSocketClose:t=>{this._stompHandler=void 0,this.state===a.DEACTIVATING&&(this._resolveSocketClose(),this._resolveSocketClose=void 0,this._changeState(a.INACTIVE)),this.onWebSocketClose(t),this.active&&this._schedule_reconnect()},onWebSocketError:t=>{this.onWebSocketError(t)},onUnhandledMessage:t=>{this.onUnhandledMessage(t)},onUnhandledReceipt:t=>{this.onUnhandledReceipt(t)},onUnhandledFrame:t=>{this.onUnhandledFrame(t)}}),this._stompHandler.start()}))}_createWebSocket(){let t;return t=this.webSocketFactory?this.webSocketFactory():new WebSocket(this.brokerURL,this.stompVersions.protocolVersions()),t.binaryType="arraybuffer",t}_schedule_reconnect(){this.reconnectDelay>0&&(this.debug(`STOMP: scheduling reconnection in ${this.reconnectDelay}ms`),this._reconnector=setTimeout(()=>{this._connect()},this.reconnectDelay))}deactivate(){return h(this,void 0,void 0,(function*(){let t;return this.state!==a.ACTIVE?(this.debug(`Already ${a[this.state]}, ignoring call to deactivate`),Promise.resolve()):(this._changeState(a.DEACTIVATING),this._reconnector&&clearTimeout(this._reconnector),this._stompHandler&&this.webSocket.readyState!==s.CLOSED?(t=new Promise((t,e)=>{this._resolveSocketClose=t}),this._disposeStompHandler(),t):(this._changeState(a.INACTIVE),Promise.resolve()))}))}forceDisconnect(){this._stompHandler&&this._stompHandler.forceDisconnect()}_disposeStompHandler(){this._stompHandler&&(this._stompHandler.dispose(),this._stompHandler=null)}publish(t){this._stompHandler.publish(t)}watchForReceipt(t,e){this._stompHandler.watchForReceipt(t,e)}subscribe(t,e,n={}){return this._stompHandler.subscribe(t,e,n)}unsubscribe(t,e={}){this._stompHandler.unsubscribe(t,e)}begin(t){return this._stompHandler.begin(t)}commit(t){this._stompHandler.commit(t)}abort(t){this._stompHandler.abort(t)}ack(t,e,n={}){this._stompHandler.ack(t,e,n)}nack(t,e,n={}){this._stompHandler.nack(t,e,n)}}class f{}class d{}class p{}class v{constructor(t){this.client=t}get outgoing(){return this.client.heartbeatOutgoing}set outgoing(t){this.client.heartbeatOutgoing=t}get incoming(){return this.client.heartbeatIncoming}set incoming(t){this.client.heartbeatIncoming=t}}class g extends l{constructor(t){super(),this.maxWebSocketFrameSize=16384,this._heartbeatInfo=new v(this),this.reconnect_delay=0,this.webSocketFactory=t,this.debug=(...t)=>{console.log(...t)}}_parseConnect(...t){let e,n,r,i={};if(t.length<2)throw new Error("Connect requires at least 2 arguments");if("function"==typeof t[1])[i,n,r,e]=t;else switch(t.length){case 6:[i.login,i.passcode,n,r,e,i.host]=t;break;default:[i.login,i.passcode,n,r,e]=t}return[i,n,r,e]}connect(...t){const e=this._parseConnect(...t);e[0]&&(this.connectHeaders=e[0]),e[1]&&(this.onConnect=e[1]),e[2]&&(this.onStompError=e[2]),e[3]&&(this.onWebSocketClose=e[3]),super.activate()}disconnect(t,e={}){t&&(this.onDisconnect=t),this.disconnectHeaders=e,super.deactivate()}send(t,e={},n=""){const r=!1===(e=Object.assign({},e))["content-length"];r&&delete e["content-length"],this.publish({destination:t,headers:e,body:n,skipContentLengthHeader:r})}set reconnect_delay(t){this.reconnectDelay=t}get ws(){return this.webSocket}get version(){return this.connectedVersion}get onreceive(){return this.onUnhandledMessage}set onreceive(t){this.onUnhandledMessage=t}get onreceipt(){return this.onUnhandledReceipt}set onreceipt(t){this.onUnhandledReceipt=t}get heartbeat(){return this._heartbeatInfo}set heartbeat(t){this.heartbeatIncoming=t.incoming,this.heartbeatOutgoing=t.outgoing}}class y{static client(t,e){null==e&&(e=c.default.protocolVersions());return new g(()=>new(y.WebSocketClass||WebSocket)(t,e))}static over(t){let e;return"function"==typeof t?e=t:(console.warn("Stomp.over did not receive a factory, auto reconnect will not work. Please see https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over"),e=()=>t),new g(e)}}y.WebSocketClass=null}]));
|
package/dist/umd/index.js
CHANGED
|
@@ -18117,7 +18117,7 @@ function zipAll(project) {
|
|
|
18117
18117
|
/* 224 */
|
|
18118
18118
|
/***/ (function(module) {
|
|
18119
18119
|
|
|
18120
|
-
module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.
|
|
18120
|
+
module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.41.0\",\"description\":\"\",\"main\":\"dist/index.js\",\"types\":\"dist/src/index.d.ts\",\"scripts\":{\"start\":\"npx webpack -w\",\"test-local\":\"./node_modules/karma/bin/karma start karma.conf.js -logLevel=DEBUG\",\"test\":\"./node_modules/karma/bin/karma start --browsers ChromeHeadless --single-run\",\"test:windows\":\"karma start karma.conf.js\",\"build\":\"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js\",\"lint\":\"./node_modules/tslint/bin/tslint -p tsconfig.json --fix\",\"docs\":\"./node_modules/typedoc/bin/typedoc --options\"},\"files\":[\"dist\",\"!dist/test\"],\"author\":\"\",\"license\":\"ISC\",\"dependencies\":{\"@stomp/stompjs\":\"^6.0.0\",\"@uehreka/seriously\":\"^1.0.1\",\"fast-text-encoding\":\"^1.0.0\",\"intrinsic-scale\":\"^3.0.4\",\"promjs\":\"^0.4.1\",\"rxjs\":\"^6.2.2\",\"rxjs-compat\":\"^6.3.2\",\"simple-peer\":\"9.11.0\",\"webrtc-adapter\":\"8.1.0\"},\"devDependencies\":{\"@types/jasmine\":\"^2.8.8\",\"@types/node\":\"^10.9.4\",\"fetch-mock\":\"7.7.3\",\"ignore-styles\":\"^5.0.1\",\"jasmine\":\"^3.2.0\",\"jasmine-class-mock\":\"^1.0.1\",\"jasmine-core\":\"^3.3.0\",\"karma\":\"^5.0.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-jasmine\":\"^2.0.1\",\"karma-jasmine-html-reporter\":\"^1.4.0\",\"karma-requirejs\":\"^1.1.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-typescript\":\"^5.0.0\",\"karma-typescript-es6-transform\":\"^5.0.0\",\"nock\":\"^9.6.1\",\"requirejs\":\"^2.3.6\",\"ts-loader\":\"^5.0.0\",\"ts-node\":\"^7.0.1\",\"tslint\":\"^5.11.0\",\"tslint-no-focused-test\":\"^0.5.0\",\"typedoc\":\"^0.18.0\",\"typescript\":\"^3.9.7\",\"webpack\":\"^4.17.1\",\"webpack-cli\":\"^3.1.0\"}}");
|
|
18121
18121
|
|
|
18122
18122
|
/***/ }),
|
|
18123
18123
|
/* 225 */
|