chat4app-client-angular 1.0.7 → 1.0.9

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.
@@ -5,5 +5,5 @@
5
5
  * @author Feross Aboukhadijeh <http://feross.org>
6
6
  * @license MIT
7
7
  */
8
- var n=r(9),o=r(10),i=r(11);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return h(this,t,e,r)}function h(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=p(t,e),t}(t,e,r,n):"string"==typeof e?function(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=a(t,n)).write(e,r);return o!==n&&(t=t.slice(0,o)),t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|l(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):p(t,e);if("Buffer"===e.type&&i(e.data))return p(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(c(e),t=a(t,e<0?0:0|l(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function p(t,e){var r=e.length<0?0:0|l(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function l(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return j(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return _(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var c=-1;for(i=r;i<a;i++)if(h(t,i)===h(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===u)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var f=!0,p=0;p<u;p++)if(h(t,i+p)!==h(e,p)){f=!1;break}if(f)return i}return-1}function m(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function I(t,e,r,n){return Y(j(e,t.length-r),t,r,n)}function w(t,e,r,n){return Y(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return w(t,e,r,n)}function C(t,e,r,n){return Y(F(e),t,r,n)}function T(t,e,r,n){return Y(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,h=t[o],c=null,f=h>239?4:h>223?3:h>191?2:1;if(o+f<=r)switch(f){case 1:h<128&&(c=h);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&h)<<6|63&i)>127&&(c=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&h)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function N(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function _(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=D(t[i]);return o}function U(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function M(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function x(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function H(t,e,r,n,i){return i||x(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,i){return i||x(t,0,r,8),o.write(t,e,r,n,52,8),r+8}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return h(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?O(this,0,t):g.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(i,s),h=this.slice(n,o),c=t.slice(e,r),f=0;f<a;++f)if(h[f]!==c[f]){i=h[f],s=c[f];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return I(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return C(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var o=e-t;r=new u(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e|=0,r|=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);B(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s|0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);B(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s|0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return H(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return H(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=u.isBuffer(t)?t:j(new u(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var k=/[^+\/0-9A-Za-z-_]/g;function D(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(8))},function(t,e,r){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){n=Object({})}t.exports=n},function(t,e,r){e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),s=n[0],a=n[1],h=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),c=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],h[c++]=e>>16&255,h[c++]=e>>8&255,h[c++]=255&e;return 2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,h[c++]=255&e),1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,h[c++]=e>>8&255,h[c++]=255&e),h},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=0,a=r-o;s<a;s+=16383)i.push(h(t,s,s+16383>a?a:s+16383));return 1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,h=u>>1,c=-7,f=r?o-1:0,p=r?-1:1,l=t[e+f];for(f+=p,i=l&(1<<-c)-1,l>>=-c,c+=a;c>0;i=256*i+t[e+f],f+=p,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+f],f+=p,c-=8);if(0===i)i=1-h;else{if(i===u)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),i-=h}return(l?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,h=8*i-o-1,c=(1<<h)-1,f=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(e*u-1)*Math.pow(2,o),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;t[r+l]=255&a,l+=d,a/=256,o-=8);for(s=s<<o|a,h+=o;h>0;t[r+l]=255&s,l+=d,s/=256,h-=8);t[r+l-d]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){r.r(e);var n=r(2),o=r(0),i=r(3),s=r(1),a=r(4),u=r(6);function h(t){return c.connect(t)}var c=function(){function t(t){if(this.closeListeners=[],this.errorListeners=[],this.draining=!1,this.nuid=new u.a,this.options={url:"ws://localhost:4222"},void 0===t.payload&&(t.payload=i.a.STRING),!["json","string","binary"].includes(t.payload))throw o.c.errorForCode(o.a.INVALID_PAYLOAD_TYPE);if(t.user&&t.token)throw o.c.errorForCode(o.a.BAD_AUTHENTICATION);Object(s.b)(this.options,t)}return t.connect=function(e){return new Promise(function(r,n){var o=new t(e);a.e.connect(e,o).then(function(t){o.protocol=t,r(o)}).catch(function(t){n(t)})})},t.prototype.close=function(){this.protocol.close()},t.prototype.publish=function(t,e,r){return void 0===r&&(r=""),0===(t=t||"").length?(this.errorHandler(o.c.errorForCode(o.a.BAD_SUBJECT)),this):(Object(s.d)(e)||(this.options.payload!==i.a.JSON?e=e||"":(e=void 0===e?null:e,e=JSON.stringify(e)),e=Object(s.f)(e)),this.protocol.publish(t,e,r),this)},t.prototype.subscribe=function(t,e,r){var n=this;return void 0===r&&(r={}),new Promise(function(i,u){n.isClosed()&&u(o.c.errorForCode(o.a.CONNECTION_CLOSED)),n.isDraining()&&u(o.c.errorForCode(o.a.CONNECTION_DRAINING));var h=Object(a.k)();Object(s.b)(h,r),h.subject=t,h.callback=e,i(n.protocol.subscribe(h))})},t.prototype.request=function(t,e,r){var n=this;return void 0===e&&(e=1e3),new Promise(function(i,u){n.isClosed()&&u(o.c.errorForCode(o.a.CONNECTION_CLOSED)),n.isDraining()&&u(o.c.errorForCode(o.a.CONNECTION_DRAINING));var h=Object(a.j)();Object(s.b)(h,{max:1}),h.token=n.nuid.next(),h.timeout=setTimeout(function(){c.cancel(),u("timeout")},e),h.callback=function(t){i(t)};var c=n.protocol.request(h);n.publish(t,r,""+n.protocol.muxSubscriptions.baseInbox+h.token)})},t.prototype.flush=function(t){var e=this;if(void 0===t)return new Promise(function(t){e.protocol.flush(function(){t()})});this.protocol.flush(t)},t.prototype.drain=function(){return this.isClosed()?Promise.reject(o.c.errorForCode(o.a.CONNECTION_CLOSED)):this.isDraining()?Promise.reject(o.c.errorForCode(o.a.CONNECTION_DRAINING)):(this.draining=!0,this.protocol.drain())},t.prototype.errorHandler=function(t){this.errorListeners.forEach(function(e){try{e(t)}catch(t){}})},t.prototype.closeHandler=function(){this.closeListeners.forEach(function(t){try{t()}catch(t){}})},t.prototype.addEventListener=function(t,e){"close"===t?this.closeListeners.push(e):"error"===t&&this.errorListeners.push(e)},t.prototype.isClosed=function(){return this.protocol.isClosed()},t.prototype.isDraining=function(){return this.draining},t}(),f=r(5);r.d(e,"DataBuffer",function(){return n.a}),r.d(e,"ErrorCode",function(){return o.a}),r.d(e,"Messages",function(){return o.b}),r.d(e,"NatsError",function(){return o.c}),r.d(e,"connect",function(){return h}),r.d(e,"Connection",function(){return c}),r.d(e,"ParserState",function(){return a.d}),r.d(e,"createInbox",function(){return a.i}),r.d(e,"Connect",function(){return a.a}),r.d(e,"defaultSub",function(){return a.k}),r.d(e,"defaultReq",function(){return a.j}),r.d(e,"Request",function(){return a.f}),r.d(e,"Subscription",function(){return a.g}),r.d(e,"MuxSubscription",function(){return a.c}),r.d(e,"Subscriptions",function(){return a.h}),r.d(e,"MsgBuffer",function(){return a.b}),r.d(e,"ProtocolHandler",function(){return a.e}),r.d(e,"WSTransport",function(){return f.a}),r.d(e,"isArrayBuffer",function(){return s.d}),r.d(e,"extend",function(){return s.b}),r.d(e,"extractProtocolMessage",function(){return s.c}),r.d(e,"buildWSMessage",function(){return s.a}),r.d(e,"settle",function(){return s.e}),r.d(e,"stringToUint8Array",function(){return s.f})}])},t.exports=r()}),l=function(){function t(t){this.http=t,this.chatServer="",this.chatUrl="",this.debug=!1,this.chatUserExternalId="",this.timeoutReconnect=500}return t.prototype.ngOnInit=function(){},t.prototype.config=function(t){this.chatServer=t.endpoint,this.chatUrl=t.endpoint+"/api/v1/",this.debug=t.debug},t.prototype.init=function(t,e,r,n){if(!this.chatServer||0==this.chatServer.trim().length)throw new Error("Endpoint is empty");if(!t||0==t.trim().length)throw new Error("SecurityChatToken is empty");this.setTokenChat4app(t),r&&n&&this.connectWebsocket(r,n),e(t)},t.prototype.getChatUrlDownload=function(t){return this.chatUrl+"chatmessage/getFile?messageFileId="+t+"&token="+this.getBearerToken()},t.prototype.getMessageChat=function(t,e,n){var o=this.chatUrl+"chatmessage/"+t+"/"+e+"/"+n;return this.http.get(o,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getMessageChatByGrop=function(t,e,n){var o=this.chatUrl+"chatmessage/byGroup/"+t+"/"+e+"/"+n;return this.http.get(o,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.addMessageChat=function(t){var e=this.chatUrl+"chatmessage/"+t.chatId;return this.http.post(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.props=function(t){var e=this.chatUrl+"chatmessage/props";return this.http.post(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.removeUsersChat=function(t,e,n){var o=new Array;e&&e.length>0?e.forEach(function(t){o.push("chatUserId="+t)}):n&&n.length>0&&n.forEach(function(t){o.push("chatUserExternalId="+t)});var i=this.chatUrl+"chatuser/"+t+"?"+o.join("&");return this.http.delete(i,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.removeUserChat=function(t,e,n){var o="";o=e?"chatUserId="+e:"chatUserExternalId="+n;var i=this.chatUrl+"chatuser/"+t+"?"+o;return this.http.delete(i,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.updateUserChat=function(t,e){var n=this.chatUrl+"chatuser/"+t;return this.http.put(n,e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUserChat=function(t,e){var n=this.chatUrl+"chatuser/"+t;return this.http.post(n,e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUsersChat=function(t,e){var n=this.chatUrl+"chatuser/users/"+t;return this.http.post(n,e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createChat=function(t){var e=this.chatUrl+"chat";return this.http.post(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUpdateChat=function(t){var e=this.chatUrl+"chat";return this.http.put(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getLastMessageGroup=function(t,e){var n=this.chatUrl+"chatmessage/lastMessageGroup?chatExternalId="+t+"&groupId="+e;return this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getLastMessage=function(t,e){var n=this.chatUrl+"chatmessage/lastMessage?chatExternalId="+t+"&chatUserExternalId="+e;return this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.countNotReadMessages=function(t,e,n,o){var i=this.chatUrl+"chatmessage/countNotReadMessages?chatUserExternalId="+t;return e&&e.length>0&&(i+="&chatExternalId="+e),n&&n.length>0&&(i+="&groupId="+n),o&&o.length>0&&(i+="&fromId="+n),this.http.get(i,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getChatByExternalId=function(t){var e=this.chatUrl+"chat?externalId="+t;return this.http.get(e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getChatById=function(t){var e=this.chatUrl+"chat?chatId="+t;return this.http.get(e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.listChatByUser=function(t,e,n){var o=this.chatUrl+"chat/listChatByUser/?externalUserId="+t+"&userId="+e+"&chatStatus="+n;return this.http.get(o,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.closeChat=function(t,e){var n=this.chatUrl;return t&&t.length>0&&(n+="chat?chatId="+t),e&&e.length>0&&(n+="chat?externalId="+e),this.http.delete(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.readMessage=function(t,e){var n=this.chatUrl+"chatmessage/read/"+t;return e&&e.length>0&&(n+="/"+e),this.http.put(n,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.online=function(t){var e=this.chatUrl+"chatmessage/online/"+t;return this.http.get(e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.setOffLine=function(t){var e=this.chatUrl+"chatmessage/set-offline/"+t;return this.http.put(e,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.sendFile=function(t,e,n,o){var i=this.chatUrl+"chatmessage/sendFile/"+t+"/"+e+"/"+n,s=new FormData;return s.append("file",o),this.http.post(i,s,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.sendFileGroup=function(t,e,n,o){var i=this.chatUrl+"chatmessage/sendFileGroup/"+t+"/"+e+"/"+n,s=new FormData;return s.append("file",o),this.http.post(i,s,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.translateMessage=function(t,e){var n=this.chatUrl+"chatmessage/translate/"+t+"/"+e;return this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.startTyping=function(t,e,n){var o=this.chatUrl+"chatmessage/startTyping/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.startTypingGroup=function(t,e,n){var o=this.chatUrl+"chatmessage/startTypingGroup/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.stopTyping=function(t,e,n){var o=this.chatUrl+"chatmessage/stopTyping/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.stopTypingGroup=function(t,e,n){var o=this.chatUrl+"chatmessage/stopTypingGroup/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createGroup=function(t){var e=this.chatUrl+"/group";return this.http.post(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getGroup=function(t,e){var n=this.chatUrl+"/group/"+e+"/"+t;return this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.listGroups=function(t,e){var n=this.chatUrl+"/group/";return t&&t.length>0&&(n+="&chatId="+t),e&&e.length>0&&(n+="&externalId="+e),this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.listFilesGroup=function(t,e){var n=this.chatUrl+"/group/"+t;return e&&e.length>0&&(n+="&groupId="+t),this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getBearerToken=function(){return"Bearer "+window.sessionStorage.getItem("chat4AppSessionToken")},t.prototype.setTokenChat4app=function(t){window.sessionStorage.setItem("chat4AppSessionToken",t)},t.prototype.onMessageFirebaseReceived=function(t,e){if("msg"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type,o.notification.body=t.body,t.fileId&&t.fileId.length>0&&(o.data.fileId=t.fileId,o.data.fileName=t.fileName,o.data.fileSize=t.fileSize,o.data.fileType=t.fileType);var r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onMessage(o)}else if("on"==t.type||"off"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onOffline(o)}else if("read"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onRead(o)}else if("startTyping"==t.type||"stopTyping"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onStartStopTyping(o)}else if("new_user"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onNewUser(o)}else if("remove_user"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onRemoveUser(o)}else if("chat_closed"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onChatClosed(o)}else if("count_notread"==t.type){var o;(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onCountNotRead(o)}},t.prototype.ensureConn=function(t){return u(this,void 0,void 0,function(){var e,r,n,o;return h(this,function(i){switch(i.label){case 0:return this.debug&&(console.log("chatServer: "+this.chatServer),console.log("userId: "+t),console.log("getBearerToken: "+this.getBearerToken())),e=this,r=this.chatServer.replace(/^https/,"wss"),n=r.replace(/(\/\/.*?)\//,"$1/ws/"),this.debug&&console.log("ws server: "+n),!this.nc||this.nc.isClose&&this.nc.isClose()?(o=e,[4,p.connect({url:n,user:t,pass:this.getBearerToken(),reconnect:!0})]):[3,2];case 1:o.nc=i.sent(),i.label=2;case 2:return this.chatUserExternalId=t,[2,e.nc]}})})},t.prototype.disconnect=function(){return u(this,void 0,void 0,function(){var t,e=this;return h(this,function(r){switch(r.label){case 0:if(this.interval)try{clearInterval(this.interval)}catch(t){}if(this.nc&&this.chatUserExternalId&&this.chatUserExternalId.length>0&&this.getBearerToken()&&this.getBearerToken().length>0&&this.setOffLine(this.chatUserExternalId).subscribe(function(){e.debug&&console.log("had set offline")}),!this.nc)return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.nc.close()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this.debug&&console.error(t),[3,4];case 4:this.nc=void 0,r.label=5;case 5:return this.debug&&console.log("disconect"),[2]}})})},t.prototype.processAndCallback=function(t,e){this.debug&&t&&console.log("Msg Received: "+JSON.stringify(t));var r=new Map;for(var n in t.data)r.set(n,t.data[n]);t.data.all=r,"msg"==t.data.type?e.onMessage(t):"on"==t.data.type||"off"==t.data.type?e.onOffline(t):"read"==t.data.type?e.onRead(t):"startTyping"==t.data.type||"stopTyping"==t.data.type?e.onStartStopTyping(t):"new_user"==t.data.type?e.onNewUser(t):"remove_user"==t.data.type?e.onRemoveUser(t):"chat_closed"==t.data.type?e.onChatClosed(t):"count_notread"==t.data.type&&e.onCountNotRead(t)},t.prototype.connectWebsocket=function(t,e){return u(this,void 0,void 0,function(){var r,n,o,i,s,a=this;return h(this,function(u){switch(u.label){case 0:return r=this,this.disconnect(),n=this.getBearerToken(),n&&n.startsWith("Bearer ")?n:"Bearer "+n,o=this.chatServer.split("/")[3],[4,this.ensureConn(e)];case 1:if(i=u.sent(),s="chat4app.config."+o+".user."+e,i.subscribe(s,function(e){a.debug&&console.log(e),a.processAndCallback(JSON.parse(e.data),t)}),this.interval)try{clearInterval(this.interval)}catch(t){}return r.interval=setInterval(function(){r.debug&&console.log("publish chat4app.user.online "+e+" "),r.nc.publish("chat4app.user.online",e)},1e3),this.debug&&console.log("Subscribe online chat4app.user."+e+".online"),[2]}})})},t.prototype.convertChat4AppMessageReceiveToChatMessage4App=function(t){var e,r,n=new m;(n.body=null===(e=null==t?void 0:t.notification)||void 0===e?void 0:e.body,n.chatId=t.data.chatId,n.fromId=t.data.fromId,n.toId=t.data.toId,n.groupId=t.data.groupId,n.replyFrom=t.data.replyFrom,t.data.dateHour&&t.data.dateHour.length>0&&(n.dateHourIncluded=t.data.dateHour.substring(6,10)+"-"+t.data.dateHour.substring(3,5)+"-"+t.data.dateHour.substring(0,2)+t.data.dateHour.substring(10)),n.id=t.data.chatMessageId,t.data.fileId&&t.data.fileId.length>0)&&((r=new I).id=t.data.fileId,r.name=t.data.fileName,r.size=t.data.fileSize,r.type=t.data.fileType,n.chatMessageFile=r);t.data.vFileId&&t.data.vFileId.length>0&&((r=new I).id=t.data.vFileId,r.name=t.data.vFileName,r.size=t.data.vFileSize,r.type=t.data.vFileType,n.chatVoiceFile=r);return n},t}();l.ɵprov=o.ɵɵdefineInjectable({factory:function(){return new l(o.ɵɵinject(i.HttpClient))},token:l,providedIn:"root"}),l.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],l.ctorParameters=function(){return[{type:r.HttpClient}]};var d,g,y,b=function(){},v=function(){},m=function(){},I=function(){},w=function(){},A=function(){this.data=new C,this.notification=new T},C=function(){},T=function(){},E=function(){},O=function(){},S=function(t,e){this.endpoint=t,this.debug=e},N=function(){},_=function(){};t.ChatStatus4App=void 0,(d=t.ChatStatus4App||(t.ChatStatus4App={})).CREATED="CREATED",d.CLOSED="CLOSED",t.ChatUserStatus4App=void 0,(t.ChatUserStatus4App||(t.ChatUserStatus4App={})).REMOVED="REMOVED",t.ChatFilterType=void 0,(g=t.ChatFilterType||(t.ChatFilterType={}))[g.COUNT_NOT_READ=1]="COUNT_NOT_READ",g[g.LAST_MESSAGE=2]="LAST_MESSAGE",t.GroupStatus4App=void 0,(y=t.GroupStatus4App||(t.GroupStatus4App={})).CREATED="CREATED",y.CLOSED="REMOVED";var U=function(){function t(){}return t.prototype.ngOnInit=function(){},t}();U.decorators=[{type:e.Component,args:[{selector:"lib-chat4app-client-angular",template:"\n <p>\n chat4app-client-angular works!\n </p>\n "}]}],U.ctorParameters=function(){return[]};var R=function(){};R.decorators=[{type:e.NgModule,args:[{declarations:[U],imports:[],exports:[U]}]}],t.Chat4App=b,t.Chat4AppConfig=S,t.Chat4AppMessageReceive=A,t.Chat4AppMessageReceiveData=C,t.Chat4AppMessageReceiveNotification=T,t.Chat4AppTranslate=N,t.Chat4appClientAngularComponent=U,t.Chat4appClientAngularModule=R,t.Chat4appClientAngularService=l,t.ChatFilterRequest4App=O,t.ChatGroupApp=_,t.ChatMessage4App=m,t.ChatMessageFile4App=I,t.ChatMessageMeta4App=w,t.ChatUser4App=v,t.ChatUserResponse4App=E,Object.defineProperty(t,"__esModule",{value:!0})});
8
+ var n=r(9),o=r(10),i=r(11);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return h(this,t,e,r)}function h(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=p(t,e),t}(t,e,r,n):"string"==typeof e?function(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=a(t,n)).write(e,r);return o!==n&&(t=t.slice(0,o)),t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|l(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):p(t,e);if("Buffer"===e.type&&i(e.data))return p(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(c(e),t=a(t,e<0?0:0|l(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function p(t,e){var r=e.length<0?0:0|l(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function l(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return j(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return _(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var c=-1;for(i=r;i<a;i++)if(h(t,i)===h(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===u)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var f=!0,p=0;p<u;p++)if(h(t,i+p)!==h(e,p)){f=!1;break}if(f)return i}return-1}function m(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function I(t,e,r,n){return Y(j(e,t.length-r),t,r,n)}function w(t,e,r,n){return Y(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return w(t,e,r,n)}function C(t,e,r,n){return Y(F(e),t,r,n)}function T(t,e,r,n){return Y(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function E(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,h=t[o],c=null,f=h>239?4:h>223?3:h>191?2:1;if(o+f<=r)switch(f){case 1:h<128&&(c=h);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&h)<<6|63&i)>127&&(c=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&h)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function N(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function _(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=H(t[i]);return o}function U(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function M(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function x(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,i){return i||x(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return i||x(t,0,r,8),o.write(t,e,r,n,52,8),r+8}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return h(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?O(this,0,t):g.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(i,s),h=this.slice(n,o),c=t.slice(e,r),f=0;f<a;++f)if(h[f]!==c[f]){i=h[f],s=c[f];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return I(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return C(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var o=e-t;r=new u(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e|=0,r|=0,n||B(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);B(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s|0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);B(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s|0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=u.isBuffer(t)?t:j(new u(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var k=/[^+\/0-9A-Za-z-_]/g;function H(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(8))},function(t,e,r){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){n=Object({})}t.exports=n},function(t,e,r){e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),s=n[0],a=n[1],h=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),c=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],h[c++]=e>>16&255,h[c++]=e>>8&255,h[c++]=255&e;return 2===a&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,h[c++]=255&e),1===a&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,h[c++]=e>>8&255,h[c++]=255&e),h},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=0,a=r-o;s<a;s+=16383)i.push(h(t,s,s+16383>a?a:s+16383));return 1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,h=u>>1,c=-7,f=r?o-1:0,p=r?-1:1,l=t[e+f];for(f+=p,i=l&(1<<-c)-1,l>>=-c,c+=a;c>0;i=256*i+t[e+f],f+=p,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+f],f+=p,c-=8);if(0===i)i=1-h;else{if(i===u)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),i-=h}return(l?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,h=8*i-o-1,c=(1<<h)-1,f=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=c?(a=0,s=c):s+f>=1?(a=(e*u-1)*Math.pow(2,o),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;t[r+l]=255&a,l+=d,a/=256,o-=8);for(s=s<<o|a,h+=o;h>0;t[r+l]=255&s,l+=d,s/=256,h-=8);t[r+l-d]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){r.r(e);var n=r(2),o=r(0),i=r(3),s=r(1),a=r(4),u=r(6);function h(t){return c.connect(t)}var c=function(){function t(t){if(this.closeListeners=[],this.errorListeners=[],this.draining=!1,this.nuid=new u.a,this.options={url:"ws://localhost:4222"},void 0===t.payload&&(t.payload=i.a.STRING),!["json","string","binary"].includes(t.payload))throw o.c.errorForCode(o.a.INVALID_PAYLOAD_TYPE);if(t.user&&t.token)throw o.c.errorForCode(o.a.BAD_AUTHENTICATION);Object(s.b)(this.options,t)}return t.connect=function(e){return new Promise(function(r,n){var o=new t(e);a.e.connect(e,o).then(function(t){o.protocol=t,r(o)}).catch(function(t){n(t)})})},t.prototype.close=function(){this.protocol.close()},t.prototype.publish=function(t,e,r){return void 0===r&&(r=""),0===(t=t||"").length?(this.errorHandler(o.c.errorForCode(o.a.BAD_SUBJECT)),this):(Object(s.d)(e)||(this.options.payload!==i.a.JSON?e=e||"":(e=void 0===e?null:e,e=JSON.stringify(e)),e=Object(s.f)(e)),this.protocol.publish(t,e,r),this)},t.prototype.subscribe=function(t,e,r){var n=this;return void 0===r&&(r={}),new Promise(function(i,u){n.isClosed()&&u(o.c.errorForCode(o.a.CONNECTION_CLOSED)),n.isDraining()&&u(o.c.errorForCode(o.a.CONNECTION_DRAINING));var h=Object(a.k)();Object(s.b)(h,r),h.subject=t,h.callback=e,i(n.protocol.subscribe(h))})},t.prototype.request=function(t,e,r){var n=this;return void 0===e&&(e=1e3),new Promise(function(i,u){n.isClosed()&&u(o.c.errorForCode(o.a.CONNECTION_CLOSED)),n.isDraining()&&u(o.c.errorForCode(o.a.CONNECTION_DRAINING));var h=Object(a.j)();Object(s.b)(h,{max:1}),h.token=n.nuid.next(),h.timeout=setTimeout(function(){c.cancel(),u("timeout")},e),h.callback=function(t){i(t)};var c=n.protocol.request(h);n.publish(t,r,""+n.protocol.muxSubscriptions.baseInbox+h.token)})},t.prototype.flush=function(t){var e=this;if(void 0===t)return new Promise(function(t){e.protocol.flush(function(){t()})});this.protocol.flush(t)},t.prototype.drain=function(){return this.isClosed()?Promise.reject(o.c.errorForCode(o.a.CONNECTION_CLOSED)):this.isDraining()?Promise.reject(o.c.errorForCode(o.a.CONNECTION_DRAINING)):(this.draining=!0,this.protocol.drain())},t.prototype.errorHandler=function(t){this.errorListeners.forEach(function(e){try{e(t)}catch(t){}})},t.prototype.closeHandler=function(){this.closeListeners.forEach(function(t){try{t()}catch(t){}})},t.prototype.addEventListener=function(t,e){"close"===t?this.closeListeners.push(e):"error"===t&&this.errorListeners.push(e)},t.prototype.isClosed=function(){return this.protocol.isClosed()},t.prototype.isDraining=function(){return this.draining},t}(),f=r(5);r.d(e,"DataBuffer",function(){return n.a}),r.d(e,"ErrorCode",function(){return o.a}),r.d(e,"Messages",function(){return o.b}),r.d(e,"NatsError",function(){return o.c}),r.d(e,"connect",function(){return h}),r.d(e,"Connection",function(){return c}),r.d(e,"ParserState",function(){return a.d}),r.d(e,"createInbox",function(){return a.i}),r.d(e,"Connect",function(){return a.a}),r.d(e,"defaultSub",function(){return a.k}),r.d(e,"defaultReq",function(){return a.j}),r.d(e,"Request",function(){return a.f}),r.d(e,"Subscription",function(){return a.g}),r.d(e,"MuxSubscription",function(){return a.c}),r.d(e,"Subscriptions",function(){return a.h}),r.d(e,"MsgBuffer",function(){return a.b}),r.d(e,"ProtocolHandler",function(){return a.e}),r.d(e,"WSTransport",function(){return f.a}),r.d(e,"isArrayBuffer",function(){return s.d}),r.d(e,"extend",function(){return s.b}),r.d(e,"extractProtocolMessage",function(){return s.c}),r.d(e,"buildWSMessage",function(){return s.a}),r.d(e,"settle",function(){return s.e}),r.d(e,"stringToUint8Array",function(){return s.f})}])},t.exports=r()}),l=function(){function t(t){this.http=t,this.chatServer="",this.chatUrl="",this.debug=!1,this.chatUserExternalId="",this.timeoutReconnect=500}return t.prototype.ngOnInit=function(){},t.prototype.config=function(t){this.chatServer=t.endpoint,this.chatUrl=t.endpoint+"/api/v1/",this.debug=t.debug},t.prototype.init=function(t,e,r,n){if(!this.chatServer||0==this.chatServer.trim().length)throw new Error("Endpoint is empty");if(!t||0==t.trim().length)throw new Error("SecurityChatToken is empty");this.setTokenChat4app(t),r&&n&&this.connectWebsocket(r,n),e(t)},t.prototype.getChatUrlDownload=function(t){return this.chatUrl+"chatmessage/getFile?messageFileId="+t+"&token="+this.getBearerToken()},t.prototype.getMessageChat=function(t,e,n){var o=this.chatUrl+"chatmessage/"+t+"/"+e+"/"+n;return this.http.get(o,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getMessageChatByGrop=function(t,e,n){var o=this.chatUrl+"chatmessage/byGroup/"+t+"/"+e+"/"+n;return this.http.get(o,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.addMessageChat=function(t){var e=this.chatUrl+"chatmessage/"+t.chatId;return this.http.post(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.removeUsersChat=function(t,e,n){var o=new Array;e&&e.length>0?e.forEach(function(t){o.push("chatUserId="+t)}):n&&n.length>0&&n.forEach(function(t){o.push("chatUserExternalId="+t)});var i=this.chatUrl+"chatuser/"+t+"?"+o.join("&");return this.http.delete(i,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.removeUserChat=function(t,e,n){var o="";o=e?"chatUserId="+e:"chatUserExternalId="+n;var i=this.chatUrl+"chatuser/"+t+"?"+o;return this.http.delete(i,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.updateUserChat=function(t,e){var n=this.chatUrl+"chatuser/"+t;return this.http.put(n,e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUserChat=function(t,e){var n=this.chatUrl+"chatuser/"+t;return this.http.post(n,e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUsersChat=function(t,e){var n=this.chatUrl+"chatuser/users/"+t;return this.http.post(n,e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createChat=function(t){var e=this.chatUrl+"chat";return this.http.post(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createUpdateChat=function(t){var e=this.chatUrl+"chat";return this.http.put(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getChatByExternalId=function(t){var e=this.chatUrl+"chat?externalId="+t;return this.http.get(e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getChatById=function(t){var e=this.chatUrl+"chat?chatId="+t;return this.http.get(e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.listChatByUser=function(t,e,n){var o=this.chatUrl+"chat/listChatByUser/?externalUserId="+t+"&userId="+e+"&chatStatus="+n;return this.http.get(o,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.closeChat=function(t,e){var n=this.chatUrl;return t&&t.length>0&&(n+="chat?chatId="+t),e&&e.length>0&&(n+="chat?externalId="+e),this.http.delete(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.readMessage=function(t,e){var n=this.chatUrl+"chatmessage/read/"+t;return e&&e.length>0&&(n+="/"+e),this.http.put(n,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.online=function(t){var e=this.chatUrl+"chatmessage/online/"+t;return this.http.get(e,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.setOffLine=function(t){var e=this.chatUrl+"chatmessage/set-offline/"+t;return this.http.put(e,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.sendFile=function(t,e,n,o){var i=this.chatUrl+"chatmessage/sendFile/"+t+"/"+e+"/"+n,s=new FormData;return s.append("file",o),this.http.post(i,s,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.sendFileGroup=function(t,e,n,o){var i=this.chatUrl+"chatmessage/sendFileGroup/"+t+"/"+e+"/"+n,s=new FormData;return s.append("file",o),this.http.post(i,s,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.startTyping=function(t,e,n){var o=this.chatUrl+"chatmessage/startTyping/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.startTypingGroup=function(t,e,n){var o=this.chatUrl+"chatmessage/startTypingGroup/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.stopTyping=function(t,e,n){var o=this.chatUrl+"chatmessage/stopTyping/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.stopTypingGroup=function(t,e,n){var o=this.chatUrl+"chatmessage/stopTypingGroup/"+t+"/"+e+"/"+n;return this.http.put(o,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.createGroup=function(t){var e=this.chatUrl+"group";return this.http.post(e,t,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getGroup=function(t,e){var n=this.chatUrl+"group/"+e+"/"+t;return this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.listGroups=function(t,e){var n=this.chatUrl+"group/";return t&&t.length>0&&(n+="&chatId="+t),e&&e.length>0&&(n+="&externalId="+e),this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.listFilesGroup=function(t,e){var n=this.chatUrl+"group/"+t;return e&&e.length>0&&(n+="&groupId="+t),this.http.get(n,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.event=function(t,e){var n=this.chatUrl+"event/"+t+"?chatUserExternalId="+e;return this.http.put(n,null,{headers:(new r.HttpHeaders).set("Authorization",this.getBearerToken())})},t.prototype.getBearerToken=function(){return"Bearer "+window.sessionStorage.getItem("chat4AppSessionToken")},t.prototype.setTokenChat4app=function(t){window.sessionStorage.setItem("chat4AppSessionToken",t)},t.prototype.onMessageFirebaseReceived=function(t,e){if("msg"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type,o.notification.body=t.body,t.fileId&&t.fileId.length>0&&(o.data.fileId=t.fileId,o.data.fileName=t.fileName,o.data.fileSize=t.fileSize,o.data.fileType=t.fileType);var r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onMessage(o)}else if("on"==t.type||"off"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onOffline(o)}else if("read"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onRead(o)}else if("startTyping"==t.type||"stopTyping"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onStartStopTyping(o)}else if("new_user"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onNewUser(o)}else if("remove_user"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onRemoveUser(o)}else if("chat_closed"==t.type){(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onChatClosed(o)}else if("count_notread"==t.type){var o;console.log("count_notread"),console.log(t),(o=new A).data.chatId=t.chatId,o.data.chatMessageId=t.chatMessageId,o.data.externalId=t.externalId,o.data.fromId=t.fromId,o.data.toId=t.toId,o.data.groupId=t.groupId,o.data.dateHour=t.dateHour,o.data.type=t.type;r=new Map;for(var n in t)r.set(n,t[n]);o.data.all=r,e.onCountNotRead(o)}},t.prototype.ensureConn=function(t){return u(this,void 0,void 0,function(){var e,r,n,o;return h(this,function(i){switch(i.label){case 0:return this.debug&&(console.log("chatServer: "+this.chatServer),console.log("userId: "+t),console.log("getBearerToken: "+this.getBearerToken())),e=this,r=this.chatServer.replace(/^https/,"wss"),n=r.replace(/(\/\/.*?)\//,"$1/ws/"),this.debug&&console.log("ws server: "+n),!this.nc||this.nc.isClose&&this.nc.isClose()?(o=e,[4,p.connect({url:n,user:t,pass:this.getBearerToken(),reconnect:!0})]):[3,2];case 1:o.nc=i.sent(),i.label=2;case 2:return this.chatUserExternalId=t,[2,e.nc]}})})},t.prototype.disconnect=function(){return u(this,void 0,void 0,function(){var t,e=this;return h(this,function(r){switch(r.label){case 0:if(this.interval)try{clearInterval(this.interval)}catch(t){}if(this.nc&&this.chatUserExternalId&&this.chatUserExternalId.length>0&&this.getBearerToken()&&this.getBearerToken().length>0&&this.setOffLine(this.chatUserExternalId).subscribe(function(){e.debug&&console.log("had set offline")}),!this.nc)return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.nc.close()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this.debug&&console.error(t),[3,4];case 4:this.nc=void 0,r.label=5;case 5:return this.debug&&console.log("disconect"),[2]}})})},t.prototype.processAndCallback=function(t,e){this.debug&&t&&console.log("Msg Received: "+JSON.stringify(t));var r=new Map;for(var n in t.data)r.set(n,t.data[n]);t.data.all=r,"msg"==t.data.type?e.onMessage(t):"on"==t.data.type||"off"==t.data.type?e.onOffline(t):"read"==t.data.type?e.onRead(t):"startTyping"==t.data.type||"stopTyping"==t.data.type?e.onStartStopTyping(t):"new_user"==t.data.type?e.onNewUser(t):"remove_user"==t.data.type?e.onRemoveUser(t):"chat_closed"==t.data.type?e.onChatClosed(t):"count_notread"==t.data.type&&e.onCountNotRead(t)},t.prototype.connectWebsocket=function(t,e){return u(this,void 0,void 0,function(){var r,n,o,i,s,a=this;return h(this,function(u){switch(u.label){case 0:return r=this,this.disconnect(),n=this.getBearerToken(),n&&n.startsWith("Bearer ")?n:"Bearer "+n,o=this.chatServer.split("/")[3],[4,this.ensureConn(e)];case 1:if(i=u.sent(),s="chat4app.config."+o+".user."+e,i.subscribe(s,function(e){a.debug&&console.log(e),a.processAndCallback(JSON.parse(e.data),t)}),this.interval)try{clearInterval(this.interval)}catch(t){}return r.interval=setInterval(function(){r.debug&&console.log("publish chat4app.user.online "+e+" ");try{r.nc.publish("chat4app.user.online",e)}catch(t){a.debug&&console.log("try reconnect..."),a.ensureConn(e)}},1e3),this.debug&&console.log("Subscribe online chat4app.user."+e+".online"),[2]}})})},t.prototype.convertChat4AppMessageReceiveToChatMessage4App=function(t){var e,r,n=new m;(n.body=null===(e=null==t?void 0:t.notification)||void 0===e?void 0:e.body,n.chatId=t.data.chatId,n.fromId=t.data.fromId,n.toId=t.data.toId,n.groupId=t.data.groupId,n.replyFrom=t.data.replyFrom,t.data.dateHour&&t.data.dateHour.length>0&&(n.dateHourIncluded=t.data.dateHour.substring(6,10)+"-"+t.data.dateHour.substring(3,5)+"-"+t.data.dateHour.substring(0,2)+t.data.dateHour.substring(10)),n.id=t.data.chatMessageId,t.data.fileId&&t.data.fileId.length>0)&&((r=new I).id=t.data.fileId,r.name=t.data.fileName,r.size=t.data.fileSize,r.type=t.data.fileType,n.chatMessageFile=r);t.data.vFileId&&t.data.vFileId.length>0&&((r=new I).id=t.data.vFileId,r.name=t.data.vFileName,r.size=t.data.vFileSize,r.type=t.data.vFileType,n.chatVoiceFile=r);return n},t}();l.ɵprov=o.ɵɵdefineInjectable({factory:function(){return new l(o.ɵɵinject(i.HttpClient))},token:l,providedIn:"root"}),l.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],l.ctorParameters=function(){return[{type:r.HttpClient}]};var d,g,y,b=function(){},v=function(){},m=function(){},I=function(){},w=function(){},A=function(){this.data=new C,this.notification=new T},C=function(){},T=function(){},E=function(){},O=function(){},S=function(t,e){this.endpoint=t,this.debug=e},N=function(){},_=function(){};t.ChatStatus4App=void 0,(d=t.ChatStatus4App||(t.ChatStatus4App={})).CREATED="CREATED",d.CLOSED="CLOSED",t.ChatUserStatus4App=void 0,(t.ChatUserStatus4App||(t.ChatUserStatus4App={})).REMOVED="REMOVED",t.ChatFilterType=void 0,(g=t.ChatFilterType||(t.ChatFilterType={}))[g.COUNT_NOT_READ=1]="COUNT_NOT_READ",g[g.LAST_MESSAGE=2]="LAST_MESSAGE",t.GroupStatus4App=void 0,(y=t.GroupStatus4App||(t.GroupStatus4App={})).CREATED="CREATED",y.CLOSED="REMOVED";var U=function(){function t(){}return t.prototype.ngOnInit=function(){},t}();U.decorators=[{type:e.Component,args:[{selector:"lib-chat4app-client-angular",template:"\n <p>\n chat4app-client-angular works!\n </p>\n "}]}],U.ctorParameters=function(){return[]};var R=function(){};R.decorators=[{type:e.NgModule,args:[{declarations:[U],imports:[],exports:[U]}]}],t.Chat4App=b,t.Chat4AppConfig=S,t.Chat4AppMessageReceive=A,t.Chat4AppMessageReceiveData=C,t.Chat4AppMessageReceiveNotification=T,t.Chat4AppTranslate=N,t.Chat4appClientAngularComponent=U,t.Chat4appClientAngularModule=R,t.Chat4appClientAngularService=l,t.ChatFilterRequest4App=O,t.ChatGroupApp=_,t.ChatMessage4App=m,t.ChatMessageFile4App=I,t.ChatMessageMeta4App=w,t.ChatUser4App=v,t.ChatUserResponse4App=E,Object.defineProperty(t,"__esModule",{value:!0})});
9
9
  //# sourceMappingURL=chat4app-client-angular.umd.min.js.map