2 lines
472 KiB
JavaScript
2 lines
472 KiB
JavaScript
(()=>{var e={742:(e,t)=>{"use strict";t.byteLength=function(e){var t=l(e),a=t[0],n=t[1];return 3*(a+n)/4-n},t.toByteArray=function(e){var t,a,s=l(e),r=s[0],o=s[1],c=new i(function(e,t,a){return 3*(t+a)/4-a}(0,r,o)),d=0,h=o>0?r-4:r;for(a=0;a<h;a+=4)t=n[e.charCodeAt(a)]<<18|n[e.charCodeAt(a+1)]<<12|n[e.charCodeAt(a+2)]<<6|n[e.charCodeAt(a+3)],c[d++]=t>>16&255,c[d++]=t>>8&255,c[d++]=255&t;2===o&&(t=n[e.charCodeAt(a)]<<2|n[e.charCodeAt(a+1)]>>4,c[d++]=255&t);1===o&&(t=n[e.charCodeAt(a)]<<10|n[e.charCodeAt(a+1)]<<4|n[e.charCodeAt(a+2)]>>2,c[d++]=t>>8&255,c[d++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],r=16383,o=0,l=n-i;o<l;o+=r)s.push(c(e,o,o+r>l?l:o+r));1===i?(t=e[n-1],s.push(a[t>>2]+a[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return s.join("")};for(var a=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,o=s.length;r<o;++r)a[r]=s[r],n[s.charCodeAt(r)]=r;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var a=e.indexOf("=");return-1===a&&(a=t),[a,a===t?0:4-a%4]}function c(e,t,n){for(var i,s,r=[],o=t;o<n;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),r.push(a[(s=i)>>18&63]+a[s>>12&63]+a[s>>6&63]+a[63&s]);return r.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},764:(e,t,a)=>{"use strict";var n=a(742),i=a(645),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50;var r=2147483647;function o(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,a){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return c(e,t,a)}function c(e,t,a){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var a=0|g(e,t),n=o(a),i=n.write(e,t);i!==a&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(j(e,Uint8Array)){var t=new Uint8Array(e);return u(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer))return u(e,t,a);if("undefined"!=typeof SharedArrayBuffer&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return u(e,t,a);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,a);var i=function(e){if(l.isBuffer(e)){var t=0|m(e.length),a=o(t);return 0===a.length||e.copy(a,0,0,t),a}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?o(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return d(e),o(e<0?0:0|m(e))}function p(e){for(var t=e.length<0?0:0|m(e.length),a=o(t),n=0;n<t;n+=1)a[n]=255&e[n];return a}function u(e,t,a){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(a||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===a?new Uint8Array(e):void 0===a?new Uint8Array(e,t):new Uint8Array(e,t,a),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var a=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===a)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return L(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*a;case"hex":return a>>>1;case"base64":return O(e).length;default:if(i)return n?-1:L(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,a){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return"";if((a>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,a);case"utf8":case"utf-8":return T(this,t,a);case"ascii":return A(this,t,a);case"latin1":case"binary":return D(this,t,a);case"base64":return k(this,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,a);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function _(e,t,a){var n=e[t];e[t]=e[a],e[a]=n}function v(e,t,a,n,i){if(0===e.length)return-1;if("string"==typeof a?(n=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),z(a=+a)&&(a=i?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(i)return-1;a=e.length-1}else if(a<0){if(!i)return-1;a=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:b(e,t,a,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):b(e,[t],a,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,a,n,i){var s,r=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;r=2,o/=2,l/=2,a/=2}function c(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(i){var d=-1;for(s=a;s<o;s++)if(c(e,s)===c(t,-1===d?0:s-d)){if(-1===d&&(d=s),s-d+1===l)return d*r}else-1!==d&&(s-=s-d),d=-1}else for(a+l>o&&(a=o-l),s=a;s>=0;s--){for(var h=!0,p=0;p<l;p++)if(c(e,s+p)!==c(t,p)){h=!1;break}if(h)return s}return-1}function y(e,t,a,n){a=Number(a)||0;var i=e.length-a;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;n>s/2&&(n=s/2);for(var r=0;r<n;++r){var o=parseInt(t.substr(2*r,2),16);if(z(o))return r;e[a+r]=o}return r}function w(e,t,a,n){return q(L(t,e.length-a),e,a,n)}function E(e,t,a,n){return q(function(e){for(var t=[],a=0;a<e.length;++a)t.push(255&e.charCodeAt(a));return t}(t),e,a,n)}function C(e,t,a,n){return q(O(t),e,a,n)}function S(e,t,a,n){return q(function(e,t){for(var a,n,i,s=[],r=0;r<e.length&&!((t-=2)<0);++r)n=(a=e.charCodeAt(r))>>8,i=a%256,s.push(i),s.push(n);return s}(t,e.length-a),e,a,n)}function k(e,t,a){return 0===t&&a===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,a))}function T(e,t,a){a=Math.min(e.length,a);for(var n=[],i=t;i<a;){var s,r,o,l,c=e[i],d=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=a)switch(h){case 1:c<128&&(d=c);break;case 2:128==(192&(s=e[i+1]))&&(l=(31&c)<<6|63&s)>127&&(d=l);break;case 3:s=e[i+1],r=e[i+2],128==(192&s)&&128==(192&r)&&(l=(15&c)<<12|(63&s)<<6|63&r)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:s=e[i+1],r=e[i+2],o=e[i+3],128==(192&s)&&128==(192&r)&&128==(192&o)&&(l=(15&c)<<18|(63&s)<<12|(63&r)<<6|63&o)>65535&&l<1114112&&(d=l)}null===d?(d=65533,h=1):d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|1023&d),n.push(d),i+=h}return function(e){var t=e.length;if(t<=M)return String.fromCharCode.apply(String,e);var a="",n=0;for(;n<t;)a+=String.fromCharCode.apply(String,e.slice(n,n+=M));return a}(n)}t.kMaxLength=r,l.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,a){return c(e,t,a)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,a){return function(e,t,a){return d(e),e<=0?o(e):void 0!==t?"string"==typeof a?o(e).fill(t,a):o(e).fill(t):o(e)}(e,t,a)},l.allocUnsafe=function(e){return h(e)},l.allocUnsafeSlow=function(e){return h(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(j(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),j(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var a=e.length,n=t.length,i=0,s=Math.min(a,n);i<s;++i)if(e[i]!==t[i]){a=e[i],n=t[i];break}return a<n?-1:n<a?1:0},l.isEncoding=function(e){switch(String(e).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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var n=l.allocUnsafe(t),i=0;for(a=0;a<e.length;++a){var s=e[a];if(j(s,Uint8Array))i+s.length>n.length?l.from(s).copy(n,i):Uint8Array.prototype.set.call(n,s,i);else{if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i)}i+=s.length}return n},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)_(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)_(this,t,t+3),_(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)_(this,t,t+7),_(this,t+1,t+6),_(this,t+2,t+5),_(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):f.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",a=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(e+=" ... "),"<Buffer "+e+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,a,n,i){if(j(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||a>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=a)return 0;if(n>=i)return-1;if(t>=a)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(n>>>=0),r=(a>>>=0)-(t>>>=0),o=Math.min(s,r),c=this.slice(n,i),d=e.slice(t,a),h=0;h<o;++h)if(c[h]!==d[h]){s=c[h],r=d[h];break}return s<r?-1:r<s?1:0},l.prototype.includes=function(e,t,a){return-1!==this.indexOf(e,t,a)},l.prototype.indexOf=function(e,t,a){return v(this,e,t,a,!0)},l.prototype.lastIndexOf=function(e,t,a){return v(this,e,t,a,!1)},l.prototype.write=function(e,t,a,n){if(void 0===t)n="utf8",a=this.length,t=0;else if(void 0===a&&"string"==typeof t)n=t,a=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(a)?(a>>>=0,void 0===n&&(n="utf8")):(n=a,a=void 0)}var i=this.length-t;if((void 0===a||a>i)&&(a=i),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return y(this,e,t,a);case"utf8":case"utf-8":return w(this,e,t,a);case"ascii":case"latin1":case"binary":return E(this,e,t,a);case"base64":return C(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,a);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function A(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(127&e[i]);return n}function D(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(e[i]);return n}function I(e,t,a){var n=e.length;(!t||t<0)&&(t=0),(!a||a<0||a>n)&&(a=n);for(var i="",s=t;s<a;++s)i+=V[e[s]];return i}function N(e,t,a){for(var n=e.slice(t,a),i="",s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function P(e,t,a){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>a)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,a,n,i,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(a+n>e.length)throw new RangeError("Index out of range")}function R(e,t,a,n,i,s){if(a+n>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function U(e,t,a,n,s){return t=+t,a>>>=0,s||R(e,0,a,4),i.write(e,t,a,n,23,4),a+4}function F(e,t,a,n,s){return t=+t,a>>>=0,s||R(e,0,a,8),i.write(e,t,a,n,52,8),a+8}l.prototype.slice=function(e,t){var a=this.length;(e=~~e)<0?(e+=a)<0&&(e=0):e>a&&(e=a),(t=void 0===t?a:~~t)<0?(t+=a)<0&&(t=0):t>a&&(t=a),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,a){e>>>=0,t>>>=0,a||P(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,a){e>>>=0,t>>>=0,a||P(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,a){e>>>=0,t>>>=0,a||P(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,a){e>>>=0,t>>>=0,a||P(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},l.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),i.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),i.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,a,n){(e=+e,t>>>=0,a>>>=0,n)||x(this,e,t,a,Math.pow(2,8*a)-1,0);var i=1,s=0;for(this[t]=255&e;++s<a&&(i*=256);)this[t+s]=e/i&255;return t+a},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,a,n){(e=+e,t>>>=0,a>>>=0,n)||x(this,e,t,a,Math.pow(2,8*a)-1,0);var i=a-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+a},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeIntLE=function(e,t,a,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*a-1);x(this,e,t,a,i-1,-i)}var s=0,r=1,o=0;for(this[t]=255&e;++s<a&&(r*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/r>>0)-o&255;return t+a},l.prototype.writeIntBE=function(e,t,a,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*a-1);x(this,e,t,a,i-1,-i)}var s=a-1,r=1,o=0;for(this[t+s]=255&e;--s>=0&&(r*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/r>>0)-o&255;return t+a},l.prototype.writeInt8=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,a){return e=+e,t>>>=0,a||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeFloatLE=function(e,t,a){return U(this,e,t,!0,a)},l.prototype.writeFloatBE=function(e,t,a){return U(this,e,t,!1,a)},l.prototype.writeDoubleLE=function(e,t,a){return F(this,e,t,!0,a)},l.prototype.writeDoubleBE=function(e,t,a){return F(this,e,t,!1,a)},l.prototype.copy=function(e,t,a,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(a||(a=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<a&&(n=a),n===a)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-a&&(n=e.length-t+a);var i=n-a;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,a,n):Uint8Array.prototype.set.call(e,this.subarray(a,n),t),i},l.prototype.fill=function(e,t,a,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,a=this.length):"string"==typeof a&&(n=a,a=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<a)throw new RangeError("Out of range index");if(a<=t)return this;var s;if(t>>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(s=t;s<a;++s)this[s]=e;else{var r=l.isBuffer(e)?e:l.from(e,n),o=r.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<a-t;++s)this[s+t]=r[s%o]}return this};var B=/[^+/0-9A-Za-z-_]/g;function L(e,t){var a;t=t||1/0;for(var n=e.length,i=null,s=[],r=0;r<n;++r){if((a=e.charCodeAt(r))>55295&&a<57344){if(!i){if(a>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(r+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=a;continue}if(a<56320){(t-=3)>-1&&s.push(239,191,189),i=a;continue}a=65536+(i-55296<<10|a-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,a<128){if((t-=1)<0)break;s.push(a)}else if(a<2048){if((t-=2)<0)break;s.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;s.push(a>>12|224,a>>6&63|128,63&a|128)}else{if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return s}function O(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,a,n){for(var i=0;i<n&&!(i+a>=t.length||i>=e.length);++i)t[i+a]=e[i];return i}function j(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}var V=function(){for(var e="0123456789abcdef",t=new Array(256),a=0;a<16;++a)for(var n=16*a,i=0;i<16;++i)t[n+i]=e[a]+e[i];return t}()},586:(e,t,a)=>{var n=a(721);e.exports=function(e){var t={},a=new n(e);t.trackNumber=a.nextUIntV(),t.timecode=a.nextInt16BE();var i=a.nextUInt8();t.invisible=!!(8&i),t.keyframe=!!(128&i),t.discardable=!!(1&i);var s=(6&i)>>1;return t.frames=function(e,t){if(!t)return[e.nextBuffer()];var a,n,i=[],s=e.nextUInt8()+1;if(2===t){if(e.length%s!=0)throw new Error("Fixed-Size Lacing Error");for(n=e.length/s,a=0;a<s;a++)i.push(e.nextBuffer(n));return i}var r=[];if(1===t)for(a=0;a<s-1;a++){var o;n=0;do{n+=o=e.nextUInt8()}while(255===o);r.push(n)}else if(3===t)for(n=e.nextUIntV(),r.push(n),a=1;a<s-1;a++)n+=e.nextIntV(),r.push(n);for(a=0;a<s-1;a++)i.push(e.nextBuffer(r[a]));return i.push(e.nextBuffer()),i}(a,s),t}},721:(e,t,a)=>{var n=a(826);function i(e){this.buffer=e,this.offset=0}i.prototype.nextInt16BE=function(){var e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e},i.prototype.nextUInt8=function(){var e=this.buffer.readUInt8(this.offset);return this.offset+=1,e},i.prototype.nextUIntV=function(){var e=n(this.buffer,this.offset);return this.offset+=e.length,e.value},i.prototype.nextIntV=function(){var e=n(this.buffer,this.offset,!0);return this.offset+=e.length,e.value},i.prototype.nextBuffer=function(e){var t=e?this.buffer.slice(this.offset,this.offset+e):this.buffer.slice(this.offset);return this.offset+=e||this.length,t},Object.defineProperty(i.prototype,"length",{get:function(){return this.buffer.length-this.offset}}),e.exports=i},826:e=>{e.exports=function(e,t,a){t=t||0;for(var n=1;n<=8&&!(e[t]>=Math.pow(2,8-n));n++);if(n>8)throw new Error("Unrepresentable length: "+n+" "+e.toString("hex",t,t+n));if(t+n>e.length)return null;var i,s=e[t]&(1<<8-n)-1;for(i=1;i<n;i++){if(7===i&&s>=Math.pow(2,45)&&e[t+7]>0)return{length:n,value:-1};s*=Math.pow(2,8),s+=e[t+i]}return a&&(s-=Math.pow(2,7*n-1)-1),{length:n,value:s}}},168:e=>{var t={readVint:function(e,t){t=t||0;for(var a=1;a<=8&&!(e[t]>=Math.pow(2,8-a));a++);if(a>8)throw new Error("Unrepresentable length: "+a+" "+e.toString("hex",t,t+a));if(t+a>e.length)return null;for(var n=e[t]&(1<<8-a)-1,i=1;i<a;i++){if(7===i&&n>=Math.pow(2,45)&&e[t+7]>0)return{length:a,value:-1};n*=Math.pow(2,8),n+=e[t+i]}return{length:a,value:n}},writeVint:function(e){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: "+e);for(var t=1;t<=8&&!(e<Math.pow(2,7*t)-1);t++);for(var a=new Buffer(t),n=1;n<=t;n++){var i=255&e;a[t-n]=i,e-=i,e/=Math.pow(2,8)}return a[0]=a[0]|1<<8-t,a}};e.exports=t},645:(e,t)=>{t.read=function(e,t,a,n,i){var s,r,o=8*i-n-1,l=(1<<o)-1,c=l>>1,d=-7,h=a?i-1:0,p=a?-1:1,u=e[t+h];for(h+=p,s=u&(1<<-d)-1,u>>=-d,d+=o;d>0;s=256*s+e[t+h],h+=p,d-=8);for(r=s&(1<<-d)-1,s>>=-d,d+=n;d>0;r=256*r+e[t+h],h+=p,d-=8);if(0===s)s=1-c;else{if(s===l)return r?NaN:1/0*(u?-1:1);r+=Math.pow(2,n),s-=c}return(u?-1:1)*r*Math.pow(2,s-n)},t.write=function(e,t,a,n,i,s){var r,o,l,c=8*s-i-1,d=(1<<c)-1,h=d>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,u=n?0:s-1,m=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,r=d):(r=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-r))<1&&(r--,l*=2),(t+=r+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(r++,l/=2),r+h>=d?(o=0,r=d):r+h>=1?(o=(t*l-1)*Math.pow(2,i),r+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),r=0));i>=8;e[a+u]=255&o,u+=m,o/=256,i-=8);for(r=r<<i|o,c+=i;c>0;e[a+u]=255&r,u+=m,r/=256,c-=8);e[a+u-m]|=128*g}},166:function(e,t){!function(e){var t,a="undefined",n=a!==typeof Buffer&&Buffer,i=a!==typeof Uint8Array&&Uint8Array,s=a!==typeof ArrayBuffer&&ArrayBuffer,r=[0,0,0,0,0,0,0,0],o=Array.isArray||function(e){return!!e&&"[object Array]"==Object.prototype.toString.call(e)},l=4294967296;function c(o,c,y){var w=c?0:4,E=c?4:0,C=c?0:3,S=c?1:2,k=c?2:1,T=c?3:0,M=c?f:v,A=c?_:b,D=P.prototype,I="is"+o,N="_"+I;return D.buffer=void 0,D.offset=0,D[N]=!0,D.toNumber=x,D.toString=function(e){var t=this.buffer,a=this.offset,n=U(t,a+w),i=U(t,a+E),s="",r=!y&&2147483648&n;r&&(n=~n,i=l-i);e=e||10;for(;;){var o=n%e*l+i;if(n=Math.floor(n/e),i=Math.floor(o/e),s=(o%e).toString(e)+s,!n&&!i)break}r&&(s="-"+s);return s},D.toJSON=x,D.toArray=d,n&&(D.toBuffer=h),i&&(D.toArrayBuffer=p),P[I]=function(e){return!(!e||!e[N])},e[o]=P,P;function P(e,n,o,c){return this instanceof P?function(e,n,o,c,d){i&&s&&(n instanceof s&&(n=new i(n)),c instanceof s&&(c=new i(c)));if(!(n||o||c||t))return void(e.buffer=g(r,0));if(!u(n,o)){d=o,c=n,o=0,n=new(t||Array)(8)}if(e.buffer=n,e.offset=o|=0,a===typeof c)return;"string"==typeof c?function(e,t,a,n){var i=0,s=a.length,r=0,o=0;"-"===a[0]&&i++;var c=i;for(;i<s;){var d=parseInt(a[i++],n);if(!(d>=0))break;o=o*n+d,r=r*n+Math.floor(o/l),o%=l}c&&(r=~r,o?o=l-o:r++);R(e,t+w,r),R(e,t+E,o)}(n,o,c,d||10):u(c,d)?m(n,o,c,d):"number"==typeof d?(R(n,o+w,c),R(n,o+E,d)):c>0?M(n,o,c):c<0?A(n,o,c):m(n,o,r,0)}(this,e,n,o,c):new P(e,n,o,c)}function x(){var e=this.buffer,t=this.offset,a=U(e,t+w),n=U(e,t+E);return y||(a|=0),a?a*l+n:n}function R(e,t,a){e[t+T]=255&a,a>>=8,e[t+k]=255&a,a>>=8,e[t+S]=255&a,a>>=8,e[t+C]=255&a}function U(e,t){return 16777216*e[t+C]+(e[t+S]<<16)+(e[t+k]<<8)+e[t+T]}}function d(e){var a=this.buffer,n=this.offset;return t=null,!1!==e&&0===n&&8===a.length&&o(a)?a:g(a,n)}function h(e){var a=this.buffer,i=this.offset;if(t=n,!1!==e&&0===i&&8===a.length&&Buffer.isBuffer(a))return a;var s=new n(8);return m(s,0,a,i),s}function p(e){var a=this.buffer,n=this.offset,r=a.buffer;if(t=i,!1!==e&&0===n&&r instanceof s&&8===r.byteLength)return r;var o=new i(8);return m(o,0,a,n),o.buffer}function u(e,t){var a=e&&e.length;return t|=0,a&&t+8<=a&&"string"!=typeof e[t]}function m(e,t,a,n){t|=0,n|=0;for(var i=0;i<8;i++)e[t++]=255&a[n++]}function g(e,t){return Array.prototype.slice.call(e,t,t+8)}function f(e,t,a){for(var n=t+8;n>t;)e[--n]=255&a,a/=256}function _(e,t,a){var n=t+8;for(a++;n>t;)e[--n]=255&-a^255,a/=256}function v(e,t,a){for(var n=t+8;t<n;)e[t++]=255&a,a/=256}function b(e,t,a){var n=t+8;for(a++;t<n;)e[t++]=255&-a^255,a/=256}c("Uint64BE",!0,!0),c("Int64BE",!0,!1),c("Uint64LE",!1,!0),c("Int64LE",!1,!1)}("string"!=typeof t.nodeName?t:this||{})},426:e=>{"use strict";var t={128:{name:"ChapterDisplay",level:4,type:"m",multiple:!0,webm:!0,description:"Contains all possible strings to use for the chapter display."},131:{name:"TrackType",level:3,type:"u",mandatory:!0,description:"The `TrackType` defines the type of each frame found in the Track. The value **SHOULD** be stored on 1 octet."},133:{name:"ChapString",cppname:"ChapterString",level:5,type:"8",mandatory:!0,webm:!0,description:"Contains the string to use as the chapter atom."},134:{name:"CodecID",level:3,type:"s",mandatory:!0,description:"An ID corresponding to the codec, see [@!MatroskaCodec] for more info."},136:{name:"FlagDefault",cppname:"TrackFlagDefault",level:3,type:"u",mandatory:!0,default:"1",range:"0-1",description:"Set if that track (audio, video or subs) **SHOULD** be eligible for automatic selection by the player; see (#default-track-selection) for more details."},137:{name:"ChapterTrackUID",cppname:"ChapterTrackNumber",level:5,type:"u",mandatory:!0,multiple:!0,range:"not 0",description:"UID of the Track to apply this chapter to. In the absence of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absence of this Element indicates that the Chapter **SHOULD** be applied to any currently used Tracks."},142:{name:"Slices",level:3,type:"m",maxver:0,description:"Contains slices description."},143:{name:"ChapterTrack",level:4,type:"m",description:"List of tracks on which the chapter applies. If this Element is not present, all tracks apply"},145:{name:"ChapterTimeStart",level:4,type:"u",mandatory:!0,webm:!0,description:"Timestamp of the start of Chapter, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)."},146:{name:"ChapterTimeEnd",level:4,type:"u",webm:!0,description:"Timestamp of the end of Chapter timestamp excluded, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). The value **MUST** be greater than or equal to the `ChapterTimeStart` of the same `ChapterAtom`."},150:{name:"CueRefTime",level:5,type:"u",mandatory:!0,minver:2,description:"Timestamp of the referenced Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)."},151:{name:"CueRefCluster",level:5,type:"u",mandatory:!0,minver:0,maxver:0,description:"The Segment Position of the Cluster containing the referenced Block."},152:{name:"ChapterFlagHidden",level:4,type:"u",mandatory:!0,default:"0",range:"0-1",description:"Set to 1 if a chapter is hidden. Hidden chapters **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapterflaghidden) on Chapter flags)."},154:{name:"FlagInterlaced",cppname:"VideoFlagInterlaced",level:4,type:"u",mandatory:!0,minver:2,webm:!0,default:"0",description:"Specify whether the video frames in this track are interlaced or not."},155:{name:"BlockDuration",level:3,type:"u",description:"The duration of the Block, expressed in Track Ticks; see (#timestamp-ticks). The BlockDuration Element can be useful at the end of a Track to define the duration of the last frame (as there is no subsequent Block available), or when there is a break in a track like for subtitle tracks."},156:{name:"FlagLacing",cppname:"TrackFlagLacing",level:3,type:"u",mandatory:!0,default:"1",range:"0-1",description:"Set to 1 if the track **MAY** contain blocks using lacing. When set to 0 all blocks **MUST** have their lacing flags set to No lacing; see (#block-lacing) on Block Lacing."},157:{name:"FieldOrder",cppname:"VideoFieldOrder",level:4,type:"u",mandatory:!0,minver:4,default:"2",description:"Specify the field ordering of video frames in this track."},159:{name:"Channels",cppname:"AudioChannels",level:4,type:"u",mandatory:!0,default:"1",range:"not 0",description:"Numbers of channels in the track."},160:{name:"BlockGroup",level:2,type:"m",multiple:!0,description:"Basic container of information containing a single Block and information specific to that Block."},161:{name:"Block",level:3,type:"b",mandatory:!0,description:"Block containing the actual data to be rendered and a timestamp relative to the Cluster Timestamp; see (#block-structure) on Block Structure."},162:{name:"BlockVirtual",level:3,type:"b",minver:0,maxver:0,description:"A Block with no data. It **MUST** be stored in the stream at the place the real Block would be in display order. "},163:{name:"SimpleBlock",level:2,type:"b",multiple:!0,minver:2,webm:!0,divx:!0,description:"Similar to Block, see (#block-structure), but without all the extra information, mostly used to reduced overhead when no extra feature is needed; see (#simpleblock-structure) on SimpleBlock Structure."},164:{name:"CodecState",level:3,type:"b",minver:2,description:"The new codec state to use. Data interpretation is private to the codec. This information **SHOULD** always be referenced by a seek entry."},165:{name:"BlockAdditional",level:5,type:"b",mandatory:!0,webm:!0,description:"Interpreted by the codec as it wishes (using the BlockAddID)."},166:{name:"BlockMore",level:4,type:"m",mandatory:!0,multiple:!0,webm:!0,description:"Contain the BlockAdditional and some parameters."},167:{name:"Position",cppname:"ClusterPosition",level:2,type:"u",description:"The Segment Position of the Cluster in the Segment (0 in live streams). It might help to resynchronise offset on damaged streams."},170:{name:"CodecDecodeAll",level:3,type:"u",mandatory:!0,maxver:0,default:"1",range:"0-1",description:"Set to 1 if the codec can decode potentially damaged data."},171:{name:"PrevSize",cppname:"ClusterPrevSize",level:2,type:"u",description:"Size of the previous Cluster, in octets. Can be useful for backward playing."},174:{name:"TrackEntry",level:2,type:"m",mandatory:!0,multiple:!0,description:"Describes a track with all Elements."},175:{name:"EncryptedBlock",level:2,type:"b",multiple:!0,minver:0,maxver:0,description:"Similar to SimpleBlock, see (#simpleblock-structure), but the data inside the Block are Transformed (encrypt and/or signed)."},176:{name:"PixelWidth",cppname:"VideoPixelWidth",level:4,type:"u",mandatory:!0,range:"not 0",description:"Width of the encoded video frames in pixels."},178:{name:"CueDuration",level:4,type:"u",minver:4,webm:!0,description:"The duration of the block, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks). If missing, the track's DefaultDuration does not apply and no duration information is available in terms of the cues."},179:{name:"CueTime",level:3,type:"u",mandatory:!0,description:"Absolute timestamp of the seek point, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)."},181:{name:"SamplingFrequency",cppname:"AudioSamplingFreq",level:4,type:"f",mandatory:!0,default:"0x1.f4p+12",range:"> 0x0p+0",description:"Sampling frequency in Hz."},182:{name:"ChapterAtom",level:3,type:"m",mandatory:!0,multiple:!0,webm:!0,description:"Contains the atom information to use as the chapter atom (apply to all tracks)."},183:{name:"CueTrackPositions",level:3,type:"m",mandatory:!0,multiple:!0,description:"Contain positions for different tracks corresponding to the timestamp."},185:{name:"FlagEnabled",cppname:"TrackFlagEnabled",level:3,type:"u",mandatory:!0,minver:2,webm:!0,default:"1",range:"0-1",description:"Set to 1 if the track is usable. It is possible to turn a not usable track into a usable track using chapter codecs or control tracks."},186:{name:"PixelHeight",cppname:"VideoPixelHeight",level:4,type:"u",mandatory:!0,range:"not 0",description:"Height of the encoded video frames in pixels."},187:{name:"CuePoint",level:2,type:"m",mandatory:!0,multiple:!0,description:"Contains all information relative to a seek point in the Segment."},191:{name:"CRC-32",level:-1,type:"b",minver:1,webm:!1,description:"The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian.",crc:!0},192:{name:"TrickTrackUID",level:3,type:"u",minver:0,maxver:0,divx:!0,description:"The TrackUID of the Smooth FF/RW video in the paired EBML structure corresponding to this video track. See [@?DivXTrickTrack]."},193:{name:"TrickTrackSegmentUID",level:3,type:"b",minver:0,maxver:0,divx:!0,description:"The SegmentUID of the Segment containing the track identified by TrickTrackUID. See [@?DivXTrickTrack]."},196:{name:"TrickMasterTrackSegmentUID",level:3,type:"b",minver:0,maxver:0,divx:!0,description:"The SegmentUID of the Segment containing the track identified by MasterTrackUID. See [@?DivXTrickTrack]."},198:{name:"TrickTrackFlag",level:3,type:"u",minver:0,maxver:0,divx:!0,default:"0",description:"Set to 1 if this video track is a Smooth FF/RW track. If set to 1, MasterTrackUID and MasterTrackSegUID should must be present and BlockGroups for this track must contain ReferenceFrame structures. Otherwise, TrickTrackUID and TrickTrackSegUID must be present if this track has a corresponding Smooth FF/RW track. See [@?DivXTrickTrack]."},199:{name:"TrickMasterTrackUID",level:3,type:"u",minver:0,maxver:0,divx:!0,description:"The TrackUID of the video track in the paired EBML structure that corresponds to this Smooth FF/RW track. See [@?DivXTrickTrack]."},200:{name:"ReferenceFrame",level:3,type:"m",minver:0,maxver:0,divx:!0,description:"Contains information about the last reference frame. See [@?DivXTrickTrack]."},201:{name:"ReferenceOffset",level:4,type:"u",mandatory:!0,minver:0,maxver:0,divx:!0,description:"The relative offset, in bytes, from the previous BlockGroup element for this Smooth FF/RW video track to the containing BlockGroup element. See [@?DivXTrickTrack]."},202:{name:"ReferenceTimestamp",cppname:"ReferenceTimeCode",level:4,type:"u",mandatory:!0,minver:0,maxver:0,divx:!0,description:"The timestamp of the BlockGroup pointed to by ReferenceOffset, expressed in Track Ticks; see (#timestamp-ticks). See [@?DivXTrickTrack]."},203:{name:"BlockAdditionID",cppname:"SliceBlockAddID",level:5,type:"u",minver:0,maxver:0,default:"0",description:"The ID of the BlockAdditional Element (0 is the main Block)."},204:{name:"LaceNumber",cppname:"SliceLaceNumber",level:5,type:"u",minver:0,maxver:0,description:"The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). Being able to interpret this Element is not **REQUIRED** for playback."},205:{name:"FrameNumber",cppname:"SliceFrameNumber",level:5,type:"u",minver:0,maxver:0,default:"0",description:"The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)."},206:{name:"Delay",cppname:"SliceDelay",level:5,type:"u",minver:0,maxver:0,default:"0",description:"The delay to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)."},207:{name:"SliceDuration",level:5,type:"u",minver:0,maxver:0,default:"0",description:"The duration to apply to the Element, expressed in Track Ticks; see (#timestamp-ticks)."},215:{name:"TrackNumber",level:3,type:"u",mandatory:!0,range:"not 0",description:"The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)."},219:{name:"CueReference",level:4,type:"m",multiple:!0,minver:2,description:"The Clusters containing the referenced Blocks."},224:{name:"Video",cppname:"TrackVideo",level:3,type:"m",description:"Video settings."},225:{name:"Audio",cppname:"TrackAudio",level:3,type:"m",description:"Audio settings."},226:{name:"TrackOperation",level:3,type:"m",minver:3,description:"Operation that needs to be applied on tracks to create this virtual track. For more details look at (#track-operation)."},227:{name:"TrackCombinePlanes",level:4,type:"m",minver:3,description:"Contains the list of all video plane tracks that need to be combined to create this 3D track"},228:{name:"TrackPlane",level:5,type:"m",mandatory:!0,multiple:!0,minver:3,description:"Contains a video plane track that need to be combined to create this 3D track"},229:{name:"TrackPlaneUID",level:6,type:"u",mandatory:!0,minver:3,range:"not 0",description:"The trackUID number of the track representing the plane."},230:{name:"TrackPlaneType",level:6,type:"u",mandatory:!0,minver:3,description:"The kind of plane this track corresponds to."},231:{name:"Timestamp",cppname:"ClusterTimecode",level:2,type:"u",mandatory:!0,description:"Absolute timestamp of the cluster, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)."},232:{name:"TimeSlice",level:4,type:"m",multiple:!0,minver:0,maxver:0,description:"Contains extra time information about the data contained in the Block. Being able to interpret this Element is not **REQUIRED** for playback."},233:{name:"TrackJoinBlocks",level:4,type:"m",minver:3,description:"Contains the list of all tracks whose Blocks need to be combined to create this virtual track"},234:{name:"CueCodecState",level:4,type:"u",mandatory:!0,minver:2,default:"0",description:"The Segment Position of the Codec State corresponding to this Cue Element. 0 means that the data is taken from the initial Track Entry."},235:{name:"CueRefCodecState",level:5,type:"u",minver:0,maxver:0,default:"0",description:"The Segment Position of the Codec State corresponding to this referenced Element. 0 means that the data is taken from the initial Track Entry."},236:{name:"Void",level:-1,type:"b",minver:1,description:"Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use."},237:{name:"TrackJoinUID",level:5,type:"u",mandatory:!0,multiple:!0,minver:3,range:"not 0",description:"The trackUID number of a track whose blocks are used to create this virtual track."},238:{name:"BlockAddID",level:5,type:"u",mandatory:!0,webm:!0,default:"1",range:"not 0",description:"An ID to identify the BlockAdditional level. If BlockAddIDType of the corresponding block is 0, this value is also the value of BlockAddIDType for the meaning of the content of BlockAdditional."},240:{name:"CueRelativePosition",level:4,type:"u",minver:4,webm:!0,description:"The relative position inside the Cluster of the referenced SimpleBlock or BlockGroup with 0 being the first possible position for an Element inside that Cluster."},241:{name:"CueClusterPosition",level:4,type:"u",mandatory:!0,description:"The Segment Position of the Cluster containing the associated Block."},247:{name:"CueTrack",level:4,type:"u",mandatory:!0,range:"not 0",description:"The track for which a position is given."},250:{name:"ReferencePriority",level:3,type:"u",mandatory:!0,default:"0",description:"This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced."},251:{name:"ReferenceBlock",level:3,type:"i",multiple:!0,description:"A timestamp value, relative to the timestamp of the Block in this BlockGroup, expressed in Track Ticks; see (#timestamp-ticks). This is used to reference other frames necessary to decode this frame. The relative value **SHOULD** correspond to a valid `Block` this `Block` depends on. Historically Matroska Writer didn't write the actual `Block(s)` this `Block` depends on, but *some* `Block` in the past. The value \"0\" **MAY** also be used to signify this `Block` cannot be decoded on its own, but without knownledge of which `Block` is necessary. In this case, other `ReferenceBlock` **MUST NOT** be found in the same `BlockGroup`. If the `BlockGroup` doesn't have any `ReferenceBlock` element, then the `Block` it contains can be decoded without using any other `Block` data."},253:{name:"ReferenceVirtual",level:3,type:"i",minver:0,maxver:0,description:"The Segment Position of the data that would otherwise be in position of the virtual block."},16804:{name:"BlockAddIDName",level:4,type:"s",minver:4,description:"A human-friendly name describing the type of BlockAdditional data, as defined by the associated Block Additional Mapping."},16868:{name:"BlockAdditionMapping",level:3,type:"m",multiple:!0,minver:4,description:"Contains elements that extend the track format, by adding content either to each frame, with BlockAddID ((#blockaddid-element)), or to the track as a whole with BlockAddIDExtraData."},16871:{name:"BlockAddIDType",level:4,type:"u",mandatory:!0,minver:4,default:"0",description:"Stores the registered identifier of the Block Additional Mapping to define how the BlockAdditional data should be handled."},16877:{name:"BlockAddIDExtraData",level:4,type:"b",minver:4,description:"Extra binary data that the BlockAddIDType can use to interpret the BlockAdditional data. The interpretation of the binary data depends on the BlockAddIDType value and the corresponding Block Additional Mapping."},16880:{name:"BlockAddIDValue",level:4,type:"u",minver:4,range:">=2",description:"If the track format extension needs content beside frames, the value refers to the BlockAddID ((#blockaddid-element)), value being described. To keep MaxBlockAdditionID as low as possible, small values **SHOULD** be used."},16980:{name:"ContentCompAlgo",level:6,type:"u",mandatory:!0,default:"0",description:"The compression algorithm used."},16981:{name:"ContentCompSettings",level:6,type:"b",description:"Settings that might be needed by the decompressor. For Header Stripping (`ContentCompAlgo`=3), the bytes that were removed from the beginning of each frames of the track."},17026:{name:"DocType",level:1,type:"s",mandatory:!0,default:"matroska",minver:1,description:"A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files."},17029:{name:"DocTypeReadVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The minimum DocType version an interpreter has to support to read this file."},17030:{name:"EBMLVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of EBML parser used to create the file."},17031:{name:"DocTypeVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The version of DocType interpreter used to create the file."},17138:{name:"EBMLMaxIDLength",level:1,type:"u",mandatory:!0,default:"4",range:">=4"},17139:{name:"EBMLMaxSizeLength",level:1,type:"u",mandatory:!0,default:"8",range:"not 0"},17143:{name:"EBMLReadVersion",level:1,type:"u",mandatory:!0,default:1,minver:1,description:"The minimum EBML version a parser has to support to read this file."},17276:{name:"ChapLanguage",cppname:"ChapterLanguage",level:5,type:"s",mandatory:!0,multiple:!0,webm:!0,default:"eng",description:"A language corresponding to the string, in the bibliographic ISO-639-2 form [@!ISO639-2]. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element."},17277:{name:"ChapLanguageIETF",level:5,type:"s",multiple:!0,minver:4,description:"Specifies a language corresponding to the ChapString in the format defined in [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If a ChapLanguageIETF Element is used, then any ChapLanguage and ChapCountry Elements used in the same ChapterDisplay **MUST** be ignored."},17278:{name:"ChapCountry",cppname:"ChapterCountry",level:5,type:"s",multiple:!0,webm:!0,description:"A country corresponding to the string, using the same 2 octets country-codes as in Internet domains [@!IANADomains] based on [@!ISO3166-1] alpha-2 codes. This Element **MUST** be ignored if a ChapLanguageIETF Element is used within the same ChapterDisplay Element."},17476:{name:"SegmentFamily",level:2,type:"b",multiple:!0,description:"A randomly generated unique ID that all Segments of a Linked Segment **MUST** share (128 bits)."},17505:{name:"DateUTC",level:2,type:"d",description:"The date and time that the Segment was created by the muxing application or library."},17530:{name:"TagLanguage",cppname:"TagLangue",level:4,type:"s",mandatory:!0,webm:!0,default:"und",description:"Specifies the language of the tag specified, in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the TagLanguageIETF Element is used within the same SimpleTag Element."},17531:{name:"TagLanguageIETF",level:4,type:"s",minver:4,description:"Specifies the language used in the TagString according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any TagLanguage Elements used in the same SimpleTag **MUST** be ignored."},17540:{name:"TagDefault",level:4,type:"u",mandatory:!0,webm:!0,default:"1",range:"0-1",description:"A boolean value to indicate if this is the default/original language to use for the given tag."},17541:{name:"TagBinary",level:4,type:"b",webm:!0,description:"The values of the Tag, if it is binary. Note that this cannot be used in the same SimpleTag as TagString."},17543:{name:"TagString",level:4,type:"8",webm:!0,description:"The value of the Tag."},17545:{name:"Duration",level:2,type:"f",range:"> 0x0p+0",description:"Duration of the Segment, expressed in Segment Ticks which is based on TimestampScale; see (#timestamp-ticks)."},17588:{name:"TagDefaultBogus",level:4,type:"u",mandatory:!0,minver:0,maxver:0,default:"1",range:"0-1",description:"A variant of the TagDefault element with a bogus Element ID; see (#tagdefault-element)."},17677:{name:"ChapProcessPrivate",cppname:"ChapterProcessPrivate",level:5,type:"b",description:'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent; see (#menu-features) on DVD menus.'},17816:{name:"ChapterFlagEnabled",level:4,type:"u",mandatory:!0,default:"1",range:"0-1",description:"Set to 1 if the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie **SHOULD** skip all the content between the TimeStart and TimeEnd of this chapter; see (#chapter-flags) on Chapter flags."},17827:{name:"TagName",level:4,type:"8",mandatory:!0,webm:!0,description:"The name of the Tag that is going to be stored."},17849:{name:"EditionEntry",level:2,type:"m",mandatory:!0,multiple:!0,webm:!0,description:"Contains all information about a Segment edition."},17852:{name:"EditionUID",level:3,type:"u",range:"not 0",description:"A unique ID to identify the edition. It's useful for tagging an edition."},17853:{name:"EditionFlagHidden",level:3,type:"u",mandatory:!0,default:"0",range:"0-1",description:"Set to 1 if an edition is hidden. Hidden editions **SHOULD NOT** be available to the user interface (but still to Control Tracks; see (#chapter-flags) on Chapter flags)."},17883:{name:"EditionFlagDefault",level:3,type:"u",mandatory:!0,default:"0",range:"0-1",description:"Set to 1 if the edition **SHOULD** be used as the default one."},17885:{name:"EditionFlagOrdered",level:3,type:"u",mandatory:!0,default:"0",range:"0-1",description:"Set to 1 if the chapters can be defined multiple times and the order to play them is enforced; see (#editionflagordered)."},18012:{name:"FileData",level:3,type:"b",mandatory:!0,description:"The data of the file."},18016:{name:"FileMimeType",cppname:"MimeType",level:3,type:"s",mandatory:!0,description:"MIME type of the file."},18017:{name:"FileUsedStartTime",level:3,type:"u",minver:0,maxver:0,divx:!0,description:"The timestamp at which this optimized font attachment comes into context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]."},18018:{name:"FileUsedEndTime",level:3,type:"u",minver:0,maxver:0,divx:!0,description:"The timestamp at which this optimized font attachment goes out of context, expressed in Segment Ticks which is based on TimestampScale. See [@?DivXWorldFonts]."},18030:{name:"FileName",level:3,type:"8",mandatory:!0,description:"Filename of the attached file."},18037:{name:"FileReferral",level:3,type:"b",minver:0,maxver:0,description:"A binary value that a track/codec can refer to when the attachment is needed."},18046:{name:"FileDescription",level:3,type:"8",description:"A human-friendly name for the attached file."},18094:{name:"FileUID",level:3,type:"u",mandatory:!0,range:"not 0",description:"Unique ID representing the file, as random as possible."},18401:{name:"ContentEncAlgo",level:6,type:"u",mandatory:!0,webm:!0,default:"0",description:'The encryption algorithm used. The value "0" means that the contents have not been encrypted.'},18402:{name:"ContentEncKeyID",level:6,type:"b",webm:!0,description:"For public key algorithms this is the ID of the public key the the data was encrypted with."},18403:{name:"ContentSignature",level:6,type:"b",maxver:0,description:"A cryptographic signature of the contents."},18404:{name:"ContentSigKeyID",level:6,type:"b",maxver:0,description:"This is the ID of the private key the data was signed with."},18405:{name:"ContentSigAlgo",level:6,type:"u",maxver:0,default:"0",description:"The algorithm used for the signature."},18406:{name:"ContentSigHashAlgo",level:6,type:"u",maxver:0,default:"0",description:"The hash algorithm used for the signature."},18407:{name:"ContentEncAESSettings",level:6,type:"m",minver:4,webm:!0,description:"Settings describing the encryption algorithm used. If `ContentEncAlgo` != 5 this **MUST** be ignored."},18408:{name:"AESSettingsCipherMode",level:7,type:"u",mandatory:!0,minver:4,webm:!0,description:"The AES cipher mode used in the encryption."},19840:{name:"MuxingApp",level:2,type:"8",mandatory:!0,description:'Muxing application or library (example: "libmatroska-0.4.3").'},19899:{name:"Seek",level:2,type:"m",mandatory:!0,multiple:!0,description:"Contains a single seek entry to an EBML Element."},20529:{name:"ContentEncodingOrder",level:5,type:"u",mandatory:!0,webm:!0,default:"0",description:"Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder Elements in the TrackEntry that contains this ContentEncodingOrder element."},20530:{name:"ContentEncodingScope",level:5,type:"u",mandatory:!0,webm:!0,default:"1",description:"A bit field that describes which Elements have been modified in this way. Values (big-endian) can be OR'ed."},20531:{name:"ContentEncodingType",level:5,type:"u",mandatory:!0,webm:!0,default:"0",description:"A value describing what kind of transformation is applied."},20532:{name:"ContentCompression",level:5,type:"m",description:"Settings describing the compression used. This Element **MUST** be present if the value of ContentEncodingType is 0 and absent otherwise. Each block **MUST** be decompressable even if no previous block is available in order not to prevent seeking."},20533:{name:"ContentEncryption",level:5,type:"m",webm:!0,description:"Settings describing the encryption used. This Element **MUST** be present if the value of `ContentEncodingType` is 1 (encryption) and **MUST** be ignored otherwise."},21343:{name:"CueRefNumber",level:5,type:"u",minver:0,maxver:0,default:"1",range:"not 0",description:"Number of the referenced Block of Track X in the specified Cluster."},21358:{name:"Name",cppname:"TrackName",level:3,type:"8",description:"A human-readable track name."},21368:{name:"CueBlockNumber",level:4,type:"u",range:"not 0",description:"Number of the Block in the specified Cluster."},21375:{name:"TrackOffset",level:3,type:"i",minver:0,maxver:0,default:"0",description:"A value to add to the Block's Timestamp, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). This can be used to adjust the playback offset of a track."},21419:{name:"SeekID",level:3,type:"b",mandatory:!0,description:"The binary ID corresponding to the Element name."},21420:{name:"SeekPosition",level:3,type:"u",mandatory:!0,description:"The Segment Position of the Element."},21432:{name:"StereoMode",cppname:"VideoStereoMode",level:4,type:"u",mandatory:!0,minver:3,webm:!0,default:"0",description:"Stereo-3D video mode. There are some more details in (#multi-planar-and-3d-videos)."},21433:{name:"OldStereoMode",level:4,type:"u",maxver:0,description:"DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska."},21440:{name:"AlphaMode",cppname:"VideoAlphaMode",level:4,type:"u",mandatory:!0,minver:3,webm:!0,default:"0",description:'Indicate whether the BlockAdditional Element with BlockAddID of "1" contains Alpha data, as defined by to the Codec Mapping for the `CodecID`. Undefined values **SHOULD NOT** be used as the behavior of known implementations is different (considered either as 0 or 1).'},21674:{name:"PixelCropBottom",cppname:"VideoPixelCropBottom",level:4,type:"u",mandatory:!0,default:"0",description:"The number of video pixels to remove at the bottom of the image."},21680:{name:"DisplayWidth",cppname:"VideoDisplayWidth",level:4,type:"u",range:"not 0",description:"Width of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)."},21682:{name:"DisplayUnit",cppname:"VideoDisplayUnit",level:4,type:"u",mandatory:!0,default:"0",description:"How DisplayWidth & DisplayHeight are interpreted."},21683:{name:"AspectRatioType",cppname:"VideoAspectRatio",level:4,type:"u",minver:0,maxver:0,default:"0",description:"Specify the possible modifications to the aspect ratio."},21690:{name:"DisplayHeight",cppname:"VideoDisplayHeight",level:4,type:"u",range:"not 0",description:"Height of the video frames to display. Applies to the video frame after cropping (PixelCrop* Elements)."},21691:{name:"PixelCropTop",cppname:"VideoPixelCropTop",level:4,type:"u",mandatory:!0,default:"0",description:"The number of video pixels to remove at the top of the image."},21708:{name:"PixelCropLeft",cppname:"VideoPixelCropLeft",level:4,type:"u",mandatory:!0,default:"0",description:"The number of video pixels to remove on the left of the image."},21725:{name:"PixelCropRight",cppname:"VideoPixelCropRight",level:4,type:"u",mandatory:!0,default:"0",description:"The number of video pixels to remove on the right of the image."},21930:{name:"FlagForced",cppname:"TrackFlagForced",level:3,type:"u",mandatory:!0,default:"0",range:"0-1",description:"Applies only to subtitles. Set if that track **SHOULD** be eligible for automatic selection by the player if it matches the user's language preference, even if the user's preferences would normally not enable subtitles with the selected audio track; this can be used for tracks containing only translations of foreign-language audio or onscreen text. See (#default-track-selection) for more details."},21931:{name:"FlagHearingImpaired",level:3,type:"u",minver:4,range:"0-1",description:"Set to 1 if that track is suitable for users with hearing impairments, set to 0 if it is unsuitable for users with hearing impairments."},21932:{name:"FlagVisualImpaired",level:3,type:"u",minver:4,range:"0-1",description:"Set to 1 if that track is suitable for users with visual impairments, set to 0 if it is unsuitable for users with visual impairments."},21933:{name:"FlagTextDescriptions",level:3,type:"u",minver:4,range:"0-1",description:"Set to 1 if that track contains textual descriptions of video content, set to 0 if that track does not contain textual descriptions of video content."},21934:{name:"FlagOriginal",level:3,type:"u",minver:4,range:"0-1",description:"Set to 1 if that track is in the content's original language, set to 0 if it is a translation."},21935:{name:"FlagCommentary",level:3,type:"u",minver:4,range:"0-1",description:"Set to 1 if that track contains commentary, set to 0 if it does not contain commentary."},21936:{name:"Colour",cppname:"VideoColour",level:4,type:"m",minver:4,webm:!0,description:"Settings describing the colour format."},21937:{name:"MatrixCoefficients",cppname:"VideoColourMatrix",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"2",description:"The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273."},21938:{name:"BitsPerChannel",cppname:"VideoBitsPerChannel",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"0",description:"Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified."},21939:{name:"ChromaSubsamplingHorz",cppname:"VideoChromaSubsampHorz",level:5,type:"u",minver:4,webm:!0,description:"The amount of pixels to remove in the Cr and Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1."},21940:{name:"ChromaSubsamplingVert",cppname:"VideoChromaSubsampVert",level:5,type:"u",minver:4,webm:!0,description:"The amount of pixels to remove in the Cr and Cb channels for every pixel not removed vertically. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingVert **SHOULD** be set to 1."},21941:{name:"CbSubsamplingHorz",cppname:"VideoCbSubsampHorz",level:5,type:"u",minver:4,webm:!0,description:"The amount of pixels to remove in the Cb channel for every pixel not removed horizontally. This is additive with ChromaSubsamplingHorz. Example: For video with 4:2:1 chroma subsampling, the ChromaSubsamplingHorz **SHOULD** be set to 1 and CbSubsamplingHorz **SHOULD** be set to 1."},21942:{name:"CbSubsamplingVert",cppname:"VideoCbSubsampVert",level:5,type:"u",minver:4,webm:!0,description:"The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert."},21943:{name:"ChromaSitingHorz",cppname:"VideoChromaSitHorz",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"0",description:"How chroma is subsampled horizontally."},21944:{name:"ChromaSitingVert",cppname:"VideoChromaSitVert",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"0",description:"How chroma is subsampled vertically."},21945:{name:"Range",cppname:"VideoColourRange",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"0",description:"Clipping of the color ranges."},21946:{name:"TransferCharacteristics",cppname:"VideoColourTransferCharacter",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"2",description:"The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273."},21947:{name:"Primaries",cppname:"VideoColourPrimaries",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"2",description:"The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273."},21948:{name:"MaxCLL",cppname:"VideoColourMaxCLL",level:5,type:"u",minver:4,webm:!0,description:"Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m^2^)."},21949:{name:"MaxFALL",cppname:"VideoColourMaxFALL",level:5,type:"u",minver:4,webm:!0,description:"Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m^2^)."},21968:{name:"MasteringMetadata",cppname:"VideoColourMasterMeta",level:5,type:"m",minver:4,webm:!0,description:"SMPTE 2086 mastering data."},21969:{name:"PrimaryRChromaticityX",cppname:"VideoRChromaX",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"Red X chromaticity coordinate, as defined by CIE 1931."},21970:{name:"PrimaryRChromaticityY",cppname:"VideoRChromaY",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"Red Y chromaticity coordinate, as defined by CIE 1931."},21971:{name:"PrimaryGChromaticityX",cppname:"VideoGChromaX",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"Green X chromaticity coordinate, as defined by CIE 1931."},21972:{name:"PrimaryGChromaticityY",cppname:"VideoGChromaY",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"Green Y chromaticity coordinate, as defined by CIE 1931."},21973:{name:"PrimaryBChromaticityX",cppname:"VideoBChromaX",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"Blue X chromaticity coordinate, as defined by CIE 1931."},21974:{name:"PrimaryBChromaticityY",cppname:"VideoBChromaY",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"Blue Y chromaticity coordinate, as defined by CIE 1931."},21975:{name:"WhitePointChromaticityX",cppname:"VideoWhitePointChromaX",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"White X chromaticity coordinate, as defined by CIE 1931."},21976:{name:"WhitePointChromaticityY",cppname:"VideoWhitePointChromaY",level:6,type:"f",minver:4,webm:!0,range:"0-1",description:"White Y chromaticity coordinate, as defined by CIE 1931."},21977:{name:"LuminanceMax",cppname:"VideoLuminanceMax",level:6,type:"f",minver:4,webm:!0,range:">= 0x0p+0",description:"Maximum luminance. Represented in candelas per square meter (cd/m^2^)."},21978:{name:"LuminanceMin",cppname:"VideoLuminanceMin",level:6,type:"f",minver:4,webm:!0,range:">= 0x0p+0",description:"Minimum luminance. Represented in candelas per square meter (cd/m^2^)."},21998:{name:"MaxBlockAdditionID",level:3,type:"u",mandatory:!0,default:"0",description:"The maximum value of BlockAddID ((#blockaddid-element)). A value 0 means there is no BlockAdditions ((#blockadditions-element)) for this track."},22100:{name:"ChapterStringUID",level:4,type:"8",minver:3,webm:!0,description:"A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage [@!WebVTT]."},22186:{name:"CodecDelay",level:3,type:"u",mandatory:!0,minver:4,webm:!0,description:"CodecDelay is The codec-built-in delay, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). It represents the amount of codec samples that will be discarded by the decoder during playback. This timestamp value **MUST** be subtracted from each frame timestamp in order to get the timestamp that will be actually played. The value **SHOULD** be small so the muxing of tracks with the same actual timestamp are in the same Cluster."},22203:{name:"SeekPreRoll",level:3,type:"u",mandatory:!0,minver:4,webm:!0,default:"0",description:"After a discontinuity, SeekPreRoll is the duration of the data the decoder **MUST** decode before the decoded data is valid, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks)."},22337:{name:"WritingApp",level:2,type:"8",mandatory:!0,description:'Writing application (example: "mkvmerge-0.3.3").'},22612:{name:"SilentTracks",cppname:"ClusterSilentTracks",level:2,type:"m",minver:0,maxver:0,description:"The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking or to decide what track to use."},22743:{name:"SilentTrackNumber",cppname:"ClusterSilentTrackNumber",level:3,type:"u",multiple:!0,minver:0,maxver:0,description:"One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster."},24999:{name:"AttachedFile",cppname:"Attached",level:2,type:"m",mandatory:!0,multiple:!0,description:"An attached file."},25152:{name:"ContentEncoding",level:4,type:"m",mandatory:!0,multiple:!0,webm:!0,description:"Settings for one content encoding like compression or encryption."},25188:{name:"BitDepth",cppname:"AudioBitDepth",level:4,type:"u",range:"not 0",description:"Bits per sample, mostly used for PCM."},25506:{name:"CodecPrivate",level:3,type:"b",description:"Private data only known to the codec."},25536:{name:"Targets",cppname:"TagTargets",level:3,type:"m",mandatory:!0,webm:!0,description:"Specifies which other elements the metadata represented by the Tag applies to. If empty or not present, then the Tag describes everything in the Segment."},25539:{name:"ChapterPhysicalEquiv",level:4,type:"u",description:'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50); see (#physical-types) for a complete list of values.'},25540:{name:"TagChapterUID",level:4,type:"u",multiple:!0,default:"0",description:"A unique ID to identify the Chapter(s) the tags belong to."},25541:{name:"TagTrackUID",level:4,type:"u",multiple:!0,webm:!0,default:"0",description:"A unique ID to identify the Track(s) the tags belong to."},25542:{name:"TagAttachmentUID",level:4,type:"u",multiple:!0,default:"0",description:"A unique ID to identify the Attachment(s) the tags belong to."},25545:{name:"TagEditionUID",level:4,type:"u",multiple:!0,default:"0",description:"A unique ID to identify the EditionEntry(s) the tags belong to."},25546:{name:"TargetType",cppname:"TagTargetType",level:4,type:"s",webm:!0,description:'An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc ; see Section 6.4 of [@!MatroskaTags].'},25906:{name:"SignedElement",level:2,type:"b",multiple:!0,webm:!1,description:"An element ID whose data will be used to compute the signature."},26148:{name:"TrackTranslate",level:3,type:"m",multiple:!0,description:"The mapping between this `TrackEntry` and a track value in the given Chapter Codec."},26277:{name:"TrackTranslateTrackID",level:4,type:"b",mandatory:!0,description:"The binary value used to represent this `TrackEntry` in the chapter codec data. The format depends on the `ChapProcessCodecID` used; see (#chapprocesscodecid-element)."},26303:{name:"TrackTranslateCodec",level:4,type:"u",mandatory:!0,description:"This `TrackTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)."},26364:{name:"TrackTranslateEditionUID",level:4,type:"u",multiple:!0,description:"Specify a chapter edition UID on which this `TrackTranslate` applies."},26568:{name:"SimpleTag",cppname:"TagSimple",level:3,type:"m",mandatory:!0,multiple:!0,webm:!0,description:"Contains general information about the target."},26826:{name:"TargetTypeValue",cppname:"TagTargetTypeValue",level:4,type:"u",mandatory:!0,webm:!0,default:"50",description:"A number to indicate the logical level of the target."},26897:{name:"ChapProcessCommand",cppname:"ChapterProcessCommand",level:5,type:"m",multiple:!0,description:"Contains all the commands associated to the Atom."},26914:{name:"ChapProcessTime",cppname:"ChapterProcessTime",level:6,type:"u",mandatory:!0,description:"Defines when the process command **SHOULD** be handled"},26916:{name:"ChapterTranslate",level:2,type:"m",multiple:!0,description:"The mapping between this `Segment` and a segment value in the given Chapter Codec."},26931:{name:"ChapProcessData",cppname:"ChapterProcessData",level:6,type:"b",mandatory:!0,description:"Contains the command information. The data **SHOULD** be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands; see (#menu-features) on DVD menus."},26948:{name:"ChapProcess",cppname:"ChapterProcess",level:4,type:"m",multiple:!0,description:"Contains all the commands associated to the Atom."},26965:{name:"ChapProcessCodecID",cppname:"ChapterProcessCodecID",level:5,type:"u",mandatory:!0,default:"0",description:"Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used; see (#menu-features) on DVD menus. More codec IDs can be added later."},27045:{name:"ChapterTranslateID",level:3,type:"b",mandatory:!0,description:"The binary value used to represent this Segment in the chapter codec data. The format depends on the ChapProcessCodecID used; see (#chapprocesscodecid-element)."},27071:{name:"ChapterTranslateCodec",level:3,type:"u",mandatory:!0,description:"This `ChapterTranslate` applies to this chapter codec of the given chapter edition(s); see (#chapprocesscodecid-element)."},27132:{name:"ChapterTranslateEditionUID",level:3,type:"u",multiple:!0,description:"Specify a chapter edition UID on which this `ChapterTranslate` applies."},28032:{name:"ContentEncodings",level:3,type:"m",webm:!0,description:"Settings for several content encoding mechanisms like compression or encryption."},28135:{name:"MinCache",cppname:"TrackMinCache",level:3,type:"u",mandatory:!0,default:"0",description:"The minimum number of frames a player **SHOULD** be able to cache during playback. If set to 0, the reference pseudo-cache system is not used."},28152:{name:"MaxCache",cppname:"TrackMaxCache",level:3,type:"u",description:"The maximum cache size necessary to store referenced frames in and the current frame. 0 means no cache is needed."},28263:{name:"ChapterSegmentUID",level:4,type:"b",range:">0",description:"The SegmentUID of another Segment to play during this chapter."},28348:{name:"ChapterSegmentEditionUID",level:4,type:"u",range:"not 0",description:"The EditionUID to play from the Segment linked in ChapterSegmentUID. If ChapterSegmentEditionUID is undeclared, then no Edition of the linked Segment is used; see (#medium-linking) on medium-linking Segments."},28587:{name:"TrackOverlay",level:3,type:"u",multiple:!0,description:"Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap, see (#silenttracks-element) on SilentTracks, the overlay track **SHOULD** be used instead. The order of multiple TrackOverlay matters, the first one is the one that **SHOULD** be used. If not found it **SHOULD** be the second, etc."},29555:{name:"Tag",level:2,type:"m",mandatory:!0,multiple:!0,webm:!0,description:"A single metadata descriptor."},29572:{name:"SegmentFilename",level:2,type:"8",description:"A filename corresponding to this Segment."},29604:{name:"SegmentUID",level:2,type:"b",range:"not 0",description:"A randomly generated unique ID to identify the Segment amongst many others (128 bits)."},29636:{name:"ChapterUID",level:4,type:"u",mandatory:!0,webm:!0,range:"not 0",description:"A unique ID to identify the Chapter."},29637:{name:"TrackUID",level:3,type:"u",mandatory:!0,range:"not 0",description:"A unique ID to identify the Track."},29766:{name:"AttachmentLink",cppname:"TrackAttachmentLink",level:3,type:"u",maxver:3,range:"not 0",description:"The UID of an attachment that is used by this codec."},30113:{name:"BlockAdditions",level:3,type:"m",webm:!0,description:"Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data."},30114:{name:"DiscardPadding",level:3,type:"i",minver:4,webm:!0,description:"Duration of the silent data added to the Block, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and **SHOULD** be discarded during playback."},30320:{name:"Projection",cppname:"VideoProjection",level:4,type:"m",minver:4,webm:!0,description:"Describes the video projection details. Used to render spherical, VR videos or flipping videos horizontally/vertically."},30321:{name:"ProjectionType",cppname:"VideoProjectionType",level:5,type:"u",mandatory:!0,minver:4,webm:!0,default:"0",description:"Describes the projection used for this video track."},30322:{name:"ProjectionPrivate",cppname:"VideoProjectionPrivate",level:5,type:"b",minver:4,webm:!0,description:"Private data that only applies to a specific projection. * If `ProjectionType` equals 0 (Rectangular), then this element must not be present. * If `ProjectionType` equals 1 (Equirectangular), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Equirectangular Projection Box ('equi'). * If `ProjectionType` equals 2 (Cubemap), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Cubemap Projection Box ('cbmp'). * If `ProjectionType` equals 3 (Mesh), then this element must be present and contain the same binary data that would be stored inside an ISOBMFF Mesh Projection Box ('mshp')."},30323:{name:"ProjectionPoseYaw",cppname:"VideoProjectionPoseYaw",level:5,type:"f",mandatory:!0,minver:4,webm:!0,default:"0x0p+0",range:">= -0xB4p+0, <= 0xB4p+0",description:"Specifies a yaw rotation to the projection. Value represents a clockwise rotation, in degrees, around the up vector. This rotation must be applied before any `ProjectionPosePitch` or `ProjectionPoseRoll` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseYaw` to 180 or -180 degrees, with the `ProjectionPoseRoll` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally."},30324:{name:"ProjectionPosePitch",cppname:"VideoProjectionPosePitch",level:5,type:"f",mandatory:!0,minver:4,webm:!0,default:"0x0p+0",range:">= -0x5Ap+0, <= 0x5Ap+0",description:"Specifies a pitch rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the right vector. This rotation must be applied after the `ProjectionPoseYaw` rotation and before the `ProjectionPoseRoll` rotation. The value of this element **MUST** be in the -90 to 90 degree range, both included."},30325:{name:"ProjectionPoseRoll",cppname:"VideoProjectionPoseRoll",level:5,type:"f",mandatory:!0,minver:4,webm:!0,default:"0x0p+0",range:">= -0xB4p+0, <= 0xB4p+0",description:"Specifies a roll rotation to the projection. Value represents a counter-clockwise rotation, in degrees, around the forward vector. This rotation must be applied after the `ProjectionPoseYaw` and `ProjectionPosePitch` rotations. The value of this element **MUST** be in the -180 to 180 degree range, both included. Setting `ProjectionPoseRoll` to 180 or -180 degrees, the `ProjectionPoseYaw` to 180 or -180 degrees with `ProjectionPosePitch` set to 0 degrees flips the image vertically. Setting `ProjectionPoseRoll` to 180 or -180 degrees, with the `ProjectionPoseYaw` and `ProjectionPosePitch` set to 0 degrees flips the image horizontally and vertically."},30901:{name:"OutputSamplingFrequency",cppname:"AudioOutputSamplingFreq",level:4,type:"f",range:"> 0x0p+0",description:"Real output sampling frequency in Hz (used for SBR techniques)."},31657:{name:"Title",level:2,type:"8",webm:!0,description:"General name of the Segment."},32123:{name:"ChannelPositions",cppname:"AudioPosition",level:4,type:"b",minver:0,maxver:0,description:"Table of horizontal angles for each successive channel."},32347:{name:"SignatureElements",level:1,type:"m",webm:!1,description:"Contains elements that will be used to compute the signature."},32379:{name:"SignatureElementList",level:2,type:"m",multiple:!0,webm:!1,i:"Cluster|Block|BlockAdditional",description:"A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption."},32394:{name:"SignatureAlgo",level:2,type:"u",webm:!1,description:"Signature algorithm used (1=RSA, 2=elliptic)."},32410:{name:"SignatureHash",level:2,type:"u",webm:!1,description:"Hash algorithm used (1=SHA1-160, 2=MD5)."},32421:{name:"SignaturePublicKey",level:2,type:"b",webm:!1,description:"The public key to use with the algorithm (in the case of a PKI-based signature)."},32437:{name:"Signature",level:2,type:"b",webm:!1,description:"The signature of the data (until a new."},2274716:{name:"Language",cppname:"TrackLanguage",level:3,type:"s",mandatory:!0,default:"eng",description:"Specifies the language of the track in the Matroska languages form; see (#language-codes) on language codes. This Element **MUST** be ignored if the LanguageIETF Element is used in the same TrackEntry."},2274717:{name:"LanguageIETF",level:3,type:"s",minver:4,description:"Specifies the language of the track according to [@!BCP47] and using the IANA Language Subtag Registry [@!IANALangRegistry]. If this Element is used, then any Language Elements used in the same TrackEntry **MUST** be ignored."},2306383:{name:"TrackTimestampScale",cppname:"TrackTimecodeScale",level:3,type:"f",mandatory:!0,maxver:3,default:"0x1p+0",range:"> 0x0p+0",description:"DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)."},2313850:{name:"DefaultDecodedFieldDuration",cppname:"TrackDefaultDecodedFieldDuration",level:3,type:"u",minver:4,range:"not 0",description:"The period between two successive fields at the output of the decoding process, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks). see (#defaultdecodedfieldduration) for more information"},2327523:{name:"FrameRate",cppname:"VideoFrameRate",level:4,type:"f",minver:0,maxver:0,range:"> 0x0p+0",description:"Number of frames per second. This value is Informational only. It is intended for constant frame rate streams, and **SHOULD NOT** be used for a variable frame rate TrackEntry."},2352003:{name:"DefaultDuration",cppname:"TrackDefaultDuration",level:3,type:"u",range:"not 0",description:"Number of nanoseconds per frame, expressed in Matroska Ticks -- ie in nanoseconds; see (#timestamp-ticks) (frame in the Matroska sense -- one Element put into a (Simple)Block)."},2459272:{name:"CodecName",level:3,type:"8",description:"A human-readable string specifying the codec."},2536e3:{name:"CodecDownloadURL",level:3,type:"s",multiple:!0,minver:0,maxver:0,description:"A URL to download about the codec used."},2807729:{name:"TimestampScale",cppname:"TimecodeScale",level:2,type:"u",mandatory:!0,default:"1000000",range:"not 0",description:"Base unit for Segment Ticks and Track Ticks, in nanoseconds. A TimestampScale value of 1.000.000 means scaled timestamps in the Segment are expressed in milliseconds; see (#timestamps) on how to interpret timestamps."},2807730:{name:"TimecodeScaleDenominator",level:2,type:"u",mandatory:!0,minver:4,default:"1000000000",description:"Timestamp scale numerator, see TimecodeScale."},3061028:{name:"UncompressedFourCC",cppname:"VideoColourSpace",level:4,type:"b",description:"Specify the uncompressed pixel format used for the Track's data as a FourCC. This value is similar in scope to the biCompression value of AVI's `BITMAPINFO` [@?AVIFormat]. See the YUV video formats [@?FourCC-YUV] and RGB video formats [@?FourCC-RGB] for common values."},3126563:{name:"GammaValue",cppname:"VideoGamma",level:4,type:"f",minver:0,maxver:0,range:"> 0x0p+0",description:"Gamma Value."},3839639:{name:"CodecSettings",level:3,type:"8",minver:0,maxver:0,description:"A string describing the encoding setting used."},3883072:{name:"CodecInfoURL",level:3,type:"s",multiple:!0,minver:0,maxver:0,description:"A URL to find information about the codec used."},3965867:{name:"PrevFilename",level:2,type:"8",description:"A filename corresponding to the file of the previous Linked Segment."},3979555:{name:"PrevUID",level:2,type:"b",description:"A unique ID to identify the previous Segment of a Linked Segment (128 bits)."},4096955:{name:"NextFilename",level:2,type:"8",description:"A filename corresponding to the file of the next Linked Segment."},4110627:{name:"NextUID",level:2,type:"b",description:"A unique ID to identify the next Segment of a Linked Segment (128 bits)."},272869232:{name:"Chapters",level:1,type:"m",webm:!0,description:"A system to define basic menus and partition data. For more detailed information, look at the Chapters explanation in (#chapters)."},290298740:{name:"SeekHead",level:1,type:"m",multiple:!0,description:"Contains the Segment Position of other Top-Level Elements."},307544935:{name:"Tags",level:1,type:"m",multiple:!0,webm:!0,description:"Element containing metadata describing Tracks, Editions, Chapters, Attachments, or the Segment as a whole. A list of valid tags can be found in [@!MatroskaTags]."},357149030:{name:"Info",level:1,type:"m",mandatory:!0,description:"Contains general information about the Segment."},374648427:{name:"Tracks",level:1,type:"m",description:"A Top-Level Element of information with many tracks described."},408125543:{name:"Segment",level:0,type:"m",mandatory:!0,description:"The Root Element that contains all other Top-Level Elements (Elements defined only at Level 1). A Matroska file is composed of 1 Segment."},423732329:{name:"Attachments",level:1,type:"m",description:"Contain attached files."},440786851:{name:"EBML",level:"0",type:"m",mandatory:!0,multiple:!1,minver:1,description:"Set the EBML characteristics of the data to follow. Each EBML document has to start with this."},458458727:{name:"SignatureSlot",level:1,type:"m",multiple:!0,webm:!1,description:"Contain signature of some (coming) elements in the stream."},475249515:{name:"Cues",level:1,type:"m",description:"A Top-Level Element to speed seeking access. All entries are local to the Segment."},524531317:{name:"Cluster",level:1,type:"m",multiple:!0,description:"The Top-Level Element containing the (monolithic) Block structure."}},a={},n={byEbmlID:t,byName:a};for(var i in t){a[t[i].name.replace("-","_")]=parseInt(i,10)}e.exports=n},471:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=a(965),s=a(166),r=a(965),o=a(426).byEbmlID;!function(e){e[e.STATE_TAG=1]="STATE_TAG",e[e.STATE_SIZE=2]="STATE_SIZE",e[e.STATE_CONTENT=3]="STATE_CONTENT"}(n||(n={}));var l=function(){function e(){this._buffer=new i.Buffer(0),this._tag_stack=[],this._state=n.STATE_TAG,this._cursor=0,this._total=0,this._schema=o,this._result=[]}return e.prototype.decode=function(e){this.readChunk(e);var t=this._result;return this._result=[],t},e.prototype.readChunk=function(e){for(this._buffer=r.concat([this._buffer,new i.Buffer(e)]);this._cursor<this._buffer.length&&(this._state!==n.STATE_TAG||this.readTag())&&(this._state!==n.STATE_SIZE||this.readSize())&&(this._state!==n.STATE_CONTENT||this.readContent()););},e.prototype.getSchemaInfo=function(e){return this._schema[e]||{name:"unknown",level:-1,type:"unknown",description:"unknown"}},e.prototype.readTag=function(){if(this._cursor>=this._buffer.length)return!1;var e=i.readVint(this._buffer,this._cursor);if(null==e)return!1;var t=this._buffer.slice(this._cursor,this._cursor+e.length).reduce((function(e,t,a,n){return e+t*Math.pow(16,2*(n.length-1-a))}),0),a=this.getSchemaInfo(t),s={EBML_ID:t.toString(16),schema:a,type:a.type,name:a.name,level:a.level,tagStart:this._total,tagEnd:this._total+e.length,sizeStart:this._total+e.length,sizeEnd:null,dataStart:null,dataEnd:null,dataSize:null,data:null};return this._tag_stack.push(s),this._cursor+=e.length,this._total+=e.length,this._state=n.STATE_SIZE,!0},e.prototype.readSize=function(){if(this._cursor>=this._buffer.length)return!1;var e=i.readVint(this._buffer,this._cursor);if(null==e)return!1;var t=this._tag_stack[this._tag_stack.length-1];return t.sizeEnd=t.sizeStart+e.length,t.dataStart=t.sizeEnd,t.dataSize=e.value,-1===e.value?(t.dataEnd=-1,"m"===t.type&&(t.unknownSize=!0)):t.dataEnd=t.sizeEnd+e.value,this._cursor+=e.length,this._total+=e.length,this._state=n.STATE_CONTENT,!0},e.prototype.readContent=function(){var e=this._tag_stack[this._tag_stack.length-1];if("m"===e.type){if(e.isEnd=!1,this._result.push(e),this._state=n.STATE_TAG,0===e.dataSize){var t=Object.assign({},e,{isEnd:!0});this._result.push(t),this._tag_stack.pop()}return!0}if(this._buffer.length<this._cursor+e.dataSize)return!1;var a=this._buffer.slice(this._cursor,this._cursor+e.dataSize);switch(this._buffer=this._buffer.slice(this._cursor+e.dataSize),e.data=a,e.type){case"u":e.value=a.readUIntBE(0,a.length);break;case"i":e.value=a.readIntBE(0,a.length);break;case"f":e.value=4===e.dataSize?a.readFloatBE(0):8===e.dataSize?a.readDoubleBE(0):(console.warn("cannot read "+e.dataSize+" octets float. failback to 0"),0);break;case"s":e.value=a.toString("ascii");break;case"8":e.value=a.toString("utf8");break;case"b":e.value=a;break;case"d":e.value=i.convertEBMLDateToJSDate(new s.Int64BE(a).toNumber())}if(null===e.value)throw new Error("unknown tag type:"+e.type);for(this._result.push(e),this._total+=e.dataSize,this._state=n.STATE_TAG,this._cursor=0,this._tag_stack.pop();this._tag_stack.length>0;){var r=this._tag_stack[this._tag_stack.length-1];if(r.dataEnd<0)return this._tag_stack.pop(),!0;if(this._total<r.dataEnd)break;if("m"!==r.type)throw new Error("parent element is not master element");t=Object.assign({},r,{isEnd:!0});this._result.push(t),this._tag_stack.pop()}return!0},e}();t.default=l},765:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(965),i=a(965),s=a(426).byEbmlID,r=function(){function e(){this._schema=s,this._buffers=[],this._stack=[]}return e.prototype.encode=function(e){var t=this;return n.concat(e.reduce((function(e,a){return e.concat(t.encodeChunk(a))}),[])).buffer},e.prototype.encodeChunk=function(e){return"m"===e.type?e.isEnd?this.endTag(e):this.startTag(e):this.writeTag(e),this.flush()},e.prototype.flush=function(){var e=this._buffers;return this._buffers=[],e},e.prototype.getSchemaInfo=function(e){for(var t=Object.keys(this._schema).map(Number),a=0;a<t.length;a++){var n=t[a];if(this._schema[n].name===e)return new i.Buffer(n.toString(16),"hex")}return null},e.prototype.writeTag=function(e){var t=e.name,a=this.getSchemaInfo(t),i=e.data;if(null==a)throw new Error("No schema entry found for "+t);var s=n.encodeTag(a,i);this._stack.length>0?this._stack[this._stack.length-1].children.push({tagId:a,elm:e,children:[],data:s}):this._buffers=this._buffers.concat(s)},e.prototype.startTag=function(e){var t=e.name,a=this.getSchemaInfo(t);if(null==a)throw new Error("No schema entry found for "+t);if(e.unknownSize){var s=n.encodeTag(a,new i.Buffer(0),e.unknownSize);this._buffers=this._buffers.concat(s)}else{var r={tagId:a,elm:e,children:[],data:null};this._stack.length>0&&this._stack[this._stack.length-1].children.push(r),this._stack.push(r)}},e.prototype.endTag=function(e){e.name;var t=this._stack.pop();if(null==t)throw new Error("EBML structure is broken");if(t.elm.name!==e.name)throw new Error("EBML structure is broken");var a=t.children.reduce((function(e,t){if(null===t.data)throw new Error("EBML structure is broken");return e.concat(t.data)}),[]),i=n.concat(a);"m"===t.elm.type?t.data=n.encodeTag(t.tagId,i,t.elm.unknownSize):t.data=n.encodeTag(t.tagId,i),this._stack.length<1&&(this._buffers=this._buffers.concat(t.data))},e}();t.default=r},494:function(e,t,a){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var a in t)t.hasOwnProperty(a)&&(e[a]=t[a])},function(e,t){function a(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(a.prototype=t.prototype,new a)});Object.defineProperty(t,"__esModule",{value:!0});var s=a(35),r=a(965),o=function(e){function t(){var t=e.call(this)||this;return t.logGroup="",t.hasLoggingStarted=!1,t.metadataloaded=!1,t.chunks=[],t.stack=[],t.segmentOffset=0,t.last2SimpleBlockVideoTrackTimecode=[0,0],t.last2SimpleBlockAudioTrackTimecode=[0,0],t.lastClusterTimecode=0,t.lastClusterPosition=0,t.timecodeScale=1e6,t.metadataSize=0,t.metadatas=[],t.cues=[],t.firstVideoBlockRead=!1,t.firstAudioBlockRead=!1,t.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null},t.trackTypes=[],t.trackDefaultDuration=[],t.trackCodecDelay=[],t.trackInfo={type:"nothing"},t.ended=!1,t.logging=!1,t.use_duration_every_simpleblock=!1,t.use_webp=!1,t.use_segment_info=!0,t.drop_default_duration=!0,t}return i(t,e),t.prototype.stop=function(){for(this.ended=!0,this.emit_segment_info();this.stack.length;)this.stack.pop(),this.logging&&console.groupEnd();this.logging&&this.hasLoggingStarted&&this.logGroup&&console.groupEnd()},t.prototype.emit_segment_info=function(){var e=this.chunks;if(this.chunks=[],this.metadataloaded){if(!this.use_segment_info)return;var t=this.lastClusterTimecode,a=this.duration,n=this.timecodeScale;this.emit("cluster",{timecode:t,data:e}),this.emit("duration",{timecodeScale:n,duration:a})}else{this.metadataloaded=!0,this.metadatas=e;var i=this.trackTypes.indexOf(1),s=this.trackTypes.indexOf(2);if(this.trackInfo=i>=0&&s>=0?{type:"both",trackNumber:i}:i>=0?{type:"video",trackNumber:i}:s>=0?{type:"audio",trackNumber:s}:{type:"nothing"},!this.use_segment_info)return;this.emit("metadata",{data:e,metadataSize:this.metadataSize})}},t.prototype.read=function(e){var t=this,a=!1;if(!this.ended){if("m"===e.type)if(e.isEnd)this.stack.pop();else{var n=this.stack[this.stack.length-1];if(null!=n&&n.level>=e.level){this.stack.pop(),this.logging&&console.groupEnd(),n.dataEnd=e.dataEnd,n.dataSize=e.dataEnd-n.dataStart,n.unknownSize=!1;var i=Object.assign({},n,{name:n.name,type:n.type,isEnd:!0});this.chunks.push(i)}this.stack.push(e)}if("m"===e.type&&"Segment"==e.name)0!=this.segmentOffset&&console.warn("Multiple segments detected!"),this.segmentOffset=e.dataStart,this.emit("segment_offset",this.segmentOffset);else if("b"===e.type&&"SimpleBlock"===e.name){var s=r.ebmlBlock(e.data),o=s.timecode,l=s.trackNumber,c=s.frames;if(1===this.trackTypes[l]){if(!this.firstVideoBlockRead&&(this.firstVideoBlockRead=!0,"both"===this.trackInfo.type||"video"===this.trackInfo.type)){var d=this.lastClusterTimecode+o;this.cues.push({CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:d}),this.emit("cue_info",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit("cue",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:d})}this.last2SimpleBlockVideoTrackTimecode=[this.last2SimpleBlockVideoTrackTimecode[1],o]}else if(2===this.trackTypes[l]){if(!this.firstAudioBlockRead&&(this.firstAudioBlockRead=!0,"audio"===this.trackInfo.type)){d=this.lastClusterTimecode+o;this.cues.push({CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:d}),this.emit("cue_info",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimecode}),this.emit("cue",{CueTrack:l,CueClusterPosition:this.lastClusterPosition,CueTime:d})}this.last2SimpleBlockAudioTrackTimecode=[this.last2SimpleBlockAudioTrackTimecode[1],o]}this.use_duration_every_simpleblock&&this.emit("duration",{timecodeScale:this.timecodeScale,duration:this.duration}),this.use_webp&&c.forEach((function(e){if("9d012a"===e.slice(3,6).toString("hex")){var a=r.VP8BitStreamToRiffWebPBuffer(e),n=new Blob([a],{type:"image/webp"}),i=t.duration;t.emit("webp",{currentTime:i,webp:n})}}))}else"m"===e.type&&"Cluster"===e.name&&!1===e.isEnd?(this.firstVideoBlockRead=!1,this.firstAudioBlockRead=!1,this.emit_segment_info(),this.emit("cluster_ptr",e.tagStart),this.lastClusterPosition=e.tagStart):"u"===e.type&&"Timecode"===e.name?this.lastClusterTimecode=e.value:"u"===e.type&&"TimecodeScale"===e.name?this.timecodeScale=e.value:"m"===e.type&&"TrackEntry"===e.name?e.isEnd?(this.trackTypes[this.currentTrack.TrackNumber]=this.currentTrack.TrackType,this.trackDefaultDuration[this.currentTrack.TrackNumber]=this.currentTrack.DefaultDuration,this.trackCodecDelay[this.currentTrack.TrackNumber]=this.currentTrack.CodecDelay):this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null}:"u"===e.type&&"TrackType"===e.name?this.currentTrack.TrackType=e.value:"u"===e.type&&"TrackNumber"===e.name?this.currentTrack.TrackNumber=e.value:"u"===e.type&&"CodecDelay"===e.name?this.currentTrack.CodecDelay=e.value:"u"===e.type&&"DefaultDuration"===e.name?this.drop_default_duration?(console.warn("DefaultDuration detected!, remove it"),a=!0):this.currentTrack.DefaultDuration=e.value:"unknown"===e.name&&console.warn(e);!this.metadataloaded&&e.dataEnd>0&&(this.metadataSize=e.dataEnd),a||this.chunks.push(e),this.logging&&this.put(e)}},Object.defineProperty(t.prototype,"duration",{get:function(){if("nothing"===this.trackInfo.type)return console.warn("no video, no audio track"),0;var e=0,t=0,a=0,n=this.trackDefaultDuration[this.trackInfo.trackNumber];if("number"==typeof n)e=n;else if("both"===this.trackInfo.type)this.last2SimpleBlockAudioTrackTimecode[1]>this.last2SimpleBlockVideoTrackTimecode[1]?(e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackTypes.indexOf(2)])&&(t=i),a=this.last2SimpleBlockAudioTrackTimecode[1]):(e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackTypes.indexOf(1)])&&(t=i),a=this.last2SimpleBlockVideoTrackTimecode[1]);else if("video"===this.trackInfo.type){e=(this.last2SimpleBlockVideoTrackTimecode[1]-this.last2SimpleBlockVideoTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackInfo.trackNumber])&&(t=i),a=this.last2SimpleBlockVideoTrackTimecode[1]}else if("audio"===this.trackInfo.type){var i;e=(this.last2SimpleBlockAudioTrackTimecode[1]-this.last2SimpleBlockAudioTrackTimecode[0])*this.timecodeScale,"number"==typeof(i=this.trackCodecDelay[this.trackInfo.trackNumber])&&(t=i),a=this.last2SimpleBlockAudioTrackTimecode[1]}var s=((this.lastClusterTimecode+a)*this.timecodeScale+e-t)/this.timecodeScale;return Math.floor(s)},enumerable:!0,configurable:!0}),t.prototype.addListener=function(t,a){return e.prototype.addListener.call(this,t,a)},t.prototype.put=function(e){this.hasLoggingStarted||(this.hasLoggingStarted=!0,this.logging&&this.logGroup&&console.groupCollapsed(this.logGroup)),"m"===e.type?e.isEnd?console.groupEnd():console.group(e.name+":"+e.tagStart):"b"===e.type?console.log(e.name,e.type):console.log(e.name,e.tagStart,e.type,e.value)},t}(s.EventEmitter);t.default=o},349:(e,t,a)=>{"use strict";var n=a(471);t.h=n.default,a(765).default;var i=a(494);t.Ej=i.default;var s=a(965);t.rj=s,a(846).i8},965:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(166),i=a(765),s=a(764),r=a(168),o=a(586);function l(e){return e.reduce((function(e,a){return"b"!==a.type||"SimpleBlock"!==a.name?e:t.ebmlBlock(a.data).frames.some((function(e){return"9d012a"===e.slice(3,6).toString("hex")}))?e.concat(a):e}),[])}function c(e){var a=d("VP8 ",e);return d("RIFF",f([new t.Buffer("WEBP","ascii"),a]))}function d(e,a){var n=new t.Buffer(4);return n.writeUInt32LE(a.byteLength,0),f([new t.Buffer(e.substr(0,4),"ascii"),n,a,new t.Buffer(a.byteLength%2==0?0:1)])}function h(e,t){for(var a=-1,n=0;n<t.length;n++){var i=t[n];if(i.name===e){if("m"!==i.type)return void t.splice(n,1);if(i.isEnd){if(-1==a)throw new Error("Detected "+e+" closing element before finding the start");return void t.splice(a,n-a+1)}a=n}}}function p(e,t){for(var a=[],n=-1,i=0;i<t.length;i++){var s=t[i];if(s.name===e){if("m"!==s.type){a.push(t[i]);break}if(s.isEnd){if(-1==n)throw new Error("Detected "+e+" closing element before finding the start");a=t.slice(n,i+1);break}n=i}}return a}function u(e){var t=new i.default;return e.reduce((function(e,a){return e.concat(t.encode([a]))}),[]).reduce((function(e,t){return e+t.byteLength}),0)}function m(e,a,n){var i=n.duration,s=n.clusterPtrs,r=n.cues,o=e.slice(0);if("number"==typeof i){var l=!1;o.forEach((function(e){"f"===e.type&&"Duration"===e.name&&(l=!0,e.data=b(i,8))})),l||g(o,"Info",[{name:"Duration",type:"f",data:b(i,8)}])}Array.isArray(r)&&g(o,"Cues",function(e,t){var a=[];return e.forEach((function(e){var n=e.CueTrack,i=e.CueClusterPosition,s=e.CueTime;a.push({name:"CuePoint",type:"m",isEnd:!1}),a.push({name:"CueTime",type:"u",data:_(s)}),a.push({name:"CueTrackPositions",type:"m",isEnd:!1}),a.push({name:"CueTrack",type:"u",data:_(n)}),a.push({name:"CueClusterPosition",type:"u",data:_(i+t)}),a.push({name:"CueTrackPositions",type:"m",isEnd:!0}),a.push({name:"CuePoint",type:"m",isEnd:!0})})),a}(r,a));var c=[];return Array.isArray(s)&&(console.warn("append cluster pointers to seekhead is deprecated. please use cues"),c=function(e,a){var n=[];return e.forEach((function(e){n.push({name:"Seek",type:"m",isEnd:!1}),n.push({name:"SeekID",type:"b",data:new t.Buffer([31,67,182,117])}),n.push({name:"SeekPosition",type:"u",data:_(e+a)}),n.push({name:"Seek",type:"m",isEnd:!0})})),n}(s,a)),g(o,"SeekHead",c,!0),o}function g(e,t,a,n){void 0===n&&(n=!1);for(var i=-1,s=0;s<e.length;s++){var r=e[s];if("m"===r.type&&r.name===t&&!1===r.isEnd){i=s;break}}i>=0?Array.prototype.splice.apply(e,[i+1,0].concat(a)):n?[].concat([{name:t,type:"m",isEnd:!1}],a,[{name:t,type:"m",isEnd:!0}]).reverse().forEach((function(t){e.unshift(t)})):(e.push({name:t,type:"m",isEnd:!1}),a.forEach((function(t){e.push(t)})),e.push({name:t,type:"m",isEnd:!0}))}function f(e){for(var a=0,n=0;a<e.length;++a)n+=e[a].length;var i=t.Buffer.allocUnsafe(n),s=0;for(a=0;a<e.length;++a){var r=e[a];r.copy(i,s),s+=r.length}return i}function _(e){for(var a=1;e>=Math.pow(2,8*a);a++);if(a>=7)return console.warn("7bit or more bigger uint not supported."),new n.Uint64BE(e).toBuffer();var i=new t.Buffer(a);return i.writeUIntBE(e,0,a),i}function v(e){for(var a=1;e>=Math.pow(2,8*a);a++);if(a>=7)return console.warn("7bit or more bigger uint not supported."),new n.Int64BE(e).toBuffer();var i=new t.Buffer(a);return i.writeIntBE(e,0,a),i}function b(e,a){var n;if(void 0===a&&(a=8),8===a)return(n=new t.Buffer(8)).writeDoubleBE(e,0),n;if(4===a)return(n=new t.Buffer(4)).writeFloatBE(e,0),n;throw new Error("float type bits must 4bytes or 8bytes")}t.Buffer=s.Buffer,t.readVint=r.readVint,t.writeVint=r.writeVint,t.ebmlBlock=o,t.readBlock=function(e){return t.ebmlBlock(new t.Buffer(e))},t.encodeTag=function(e,a,n){return void 0===n&&(n=!1),f([e,n?new t.Buffer("01ffffffffffffff","hex"):t.writeVint(a.length),a])},t.WebPFrameFilter=function(e){return l(e).reduce((function(e,a){return t.ebmlBlock(a.data).frames.reduce((function(e,t){var a=c(t),n=new Blob([a],{type:"image/webp"});return e.concat(n)}),e)}),[])},t.WebPBlockFilter=l,t.VP8BitStreamToRiffWebPBuffer=c,t.createRIFFChunk=d,t.makeMetadataSeekable=function(e,a,n){var s=p("EBML",e),r=u(s)+12,o=e[e.length-1].dataEnd-r,l=p("Info",e);h("Duration",l),l.splice(1,0,{name:"Duration",type:"f",data:b(a,8)});for(var c=u(l),d=p("Tracks",e),m=u(d),g=47,f=[],v=5+15*n.length,y=[],w=-1,E=function(e){var a=g,i=a+c,s=i+m,l=s+v-o;if((f=[]).push({name:"SeekHead",type:"m",isEnd:!1}),f.push({name:"Seek",type:"m",isEnd:!1}),f.push({name:"SeekID",type:"b",data:new t.Buffer([21,73,169,102])}),f.push({name:"SeekPosition",type:"u",data:_(a)}),f.push({name:"Seek",type:"m",isEnd:!0}),f.push({name:"Seek",type:"m",isEnd:!1}),f.push({name:"SeekID",type:"b",data:new t.Buffer([22,84,174,107])}),f.push({name:"SeekPosition",type:"u",data:_(i)}),f.push({name:"Seek",type:"m",isEnd:!0}),f.push({name:"Seek",type:"m",isEnd:!1}),f.push({name:"SeekID",type:"b",data:new t.Buffer([28,83,187,107])}),f.push({name:"SeekPosition",type:"u",data:_(s)}),f.push({name:"Seek",type:"m",isEnd:!0}),f.push({name:"SeekHead",type:"m",isEnd:!0}),g=u(f),(y=[]).push({name:"Cues",type:"m",isEnd:!1}),n.forEach((function(e){var t=e.CueTrack,a=e.CueClusterPosition,n=e.CueTime;y.push({name:"CuePoint",type:"m",isEnd:!1}),y.push({name:"CueTime",type:"u",data:_(n)}),y.push({name:"CueTrackPositions",type:"m",isEnd:!1}),y.push({name:"CueTrack",type:"u",data:_(t)}),a-=r,a+=l,y.push({name:"CueClusterPosition",type:"u",data:_(a)}),y.push({name:"CueTrackPositions",type:"m",isEnd:!0}),y.push({name:"CuePoint",type:"m",isEnd:!0})})),y.push({name:"Cues",type:"m",isEnd:!0}),v=u(y),w===l)return"break";if(w=l,9===e)throw new Error("Failed to converge to a stable metadata size")},C=0;C<10;C++){if("break"===E(C))break}var S=[].concat.apply([],[s,{name:"Segment",type:"m",isEnd:!1,unknownSize:!0},f,l,d,y]);return(new i.default).encode(S)},t.removeElement=h,t.extractElement=p,t.putRefinedMetaData=function(e,a){Array.isArray(a.cueInfos)&&!Array.isArray(a.cues)&&(console.warn("putRefinedMetaData: info.cueInfos property is deprecated. please use info.cues"),a.cues=a.cueInfos);for(var n=[],s=[],r=0;r<e.length;r++){var o=e[r];if("m"===o.type&&"Segment"===o.name){if(n=e.slice(0,r),s=e.slice(r),o.unknownSize){s.shift();break}throw new Error("this metadata is not streaming webm file")}}if(!(s[s.length-1].dataEnd>0))throw new Error("metadata dataEnd has wrong number");var l,c=s[s.length-1].dataEnd,d=n[n.length-1].dataEnd,h=(new i.default).encode(n).byteLength-d,p=c-s[0].tagStart,u=(s[0].tagStart,s[0].tagStart,new t.Buffer([24,83,128,103])),g=new t.Buffer("01ffffffffffffff","hex"),f=u.byteLength+g.byteLength,_=p;for(l=1;l<20;l++){var v=m(s,h+(d+f+_-c),a),b=(new i.default).encode(v).byteLength;if(b===_)return(new i.default).encode([].concat(n,[{type:"m",name:"Segment",isEnd:!1,unknownSize:!0}],v));_=b}throw new Error("unable to refine metadata, stable size could not be found in "+l+" iterations!")},t.concat=f,t.encodeValueToBuffer=function(e){var a=new t.Buffer(0);if("m"===e.type)return e;switch(e.type){case"u":a=_(e.value);break;case"i":a=v(e.value);break;case"f":a=b(e.value);break;case"s":a=new t.Buffer(e.value,"ascii");break;case"8":a=new t.Buffer(e.value,"utf8");break;case"b":a=e.value;break;case"d":a=new n.Int64BE(e.value.getTime().toString()).toBuffer()}return Object.assign({},e,{data:a})},t.createUIntBuffer=_,t.createIntBuffer=v,t.createFloatBuffer=b,t.convertEBMLDateToJSDate=function(e){return e instanceof Date?e:new Date(new Date("2001-01-01T00:00:00.000Z").getTime()+Number(e)/1e3/1e3)}},35:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.EventEmitter=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,s,r,o,l,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var d=new Error('Uncaught, unspecified "error" event. ('+t+")");throw d.context=t,d}if(i(s=this._events[e]))return!1;if(a(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),s.apply(this,o)}else if(n(s))for(o=Array.prototype.slice.call(arguments,1),r=(c=s.slice()).length,l=0;l<r;l++)c[l].apply(this,o);return!0},t.prototype.addListener=function(e,s){var r;if(!a(s))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,a(s.listener)?s.listener:s),this._events[e]?n(this._events[e])?this._events[e].push(s):this._events[e]=[this._events[e],s]:this._events[e]=s,n(this._events[e])&&!this._events[e].warned&&(r=i(this._maxListeners)?t.defaultMaxListeners:this._maxListeners)&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!a(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,s,r,o;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=(i=this._events[e]).length,s=-1,i===t||a(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(o=r;o-- >0;)if(i[o]===t||i[o].listener&&i[o].listener===t){s=o;break}if(s<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(a(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(a(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},846:e=>{"use strict";e.exports={i8:"2.0.2"}}},t={};function a(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,a),s.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=React;var t=a.n(e);const n=ReactDOM;var i=a.n(n);const s=ReactIntl,r=JSON.parse('{"de":{"action_block_contact":"Kontakt blockieren","action_cancel":"Abbrechen","action_clear_messages":"Nachrichten leeren","action_delete_messages":"Nachrichten für alle löschen","action_leave_chat":"Unterhaltung verlassen","action_report_chat":"Unterhaltung melden","archived_contacts":"Archivierte Kontakte ({count})","badge_danger":"Verdächtig","badge_owner":"Besitzer","badge_staff":"Verwaltung","badge_verified":"Verifiziert","badge_you":"Sie","block_contact_warning":"Möchten Sie diesen Kontakt wirklich blockieren?","blocked_contacts_link":"Blockierte Kontakte ({count})","button_add_another":"Hinzufügen","button_add_members":"Mitglieder hinzufügen","button_cancel":"Abbrechen","button_confirm":"Bestätigen","button_create":"Erstellen","button_delete_account":"Konto löschen","button_edit":"Bearbeiten","button_logout":"Abmelden","button_ok":"OK","button_reset":"Zurücksetzen","button_send_request":"Anfrage senden","button_sign_in":"Anmelden","button_sign_up":"Anmelden","button_subscribe":"Abbonieren","button_update":"Aktualisieren","cannot_initiate_file_upload":"Datei kann nicht hochgeladen werden.","channel":"Sender","channel_prompt":"Dies ist ein Sender","chat_invitation":"Sie sind eingeladen, an einem neuen Chat teilzunehmen. Was möchten Sie tun?","chat_invitation_accept":"Akzeptieren","chat_invitation_block":"Blockieren","chat_invitation_ignore":"Ignorieren","clear_messages_warning":"Sind Sie sicher, dass Sie diese Unterhaltung für alle leeren wollen? Das kann nicht rückgängig gemacht werden.","code_doesnot_match":"Code stimmt nicht überein","contacts_not_found":"Sie haben keine Unterhaltungen<br />¯∖_(ツ)_/¯","contacts_not_found_short":"Keine Kontakte für \'\'{query}\'\'","credential_email_prompt":"E-Mail Adresse für Registrierung","delete_account":"Konto löschen","delete_account_warning":"Möchten Sie das Konto wirklich löschen? Das kann nicht rückgängig gemacht werden","delete_messages_warning":"Sind Sie sicher, dass Sie diese Unterhaltung für alle löschen wollen? Das kann nicht rückgängig gemacht werden.","deleted_content":"Inhalt gelöscht","download_action":"herunterladen","drafty_attachment":"Dateianhang","drafty_form":"Formular:","drafty_image":"Bild","email_dative":"E-Mail","email_prompt":"E-Mail, z.B. lisam@beispiel.de","enable_peers_messaging":"Aktivieren","enter_confirmation_code_prompt":"Geben Sie den Bestätigungscode ein, der per {method} geschickt wurde:","error_invalid_id":"ungültige ID","file_attachment_too_large":"Die Dateigröße {size} überschreitet das Limit von {limit}.","forgot_password_link":"Passwort vergessen?","full_name_prompt":"Vollständiger Name, z.B. Lisa Musterfrau","granted_permissions":"Erteilt","group_has_no_members":"Keine Mitglieder","group_user_id_prompt":"Gruppe oder Benutzer ID","image_caption_prompt":"Bildunterschrift","invalid_content":"ungültiger Inhalt","invalid_security_token":"Ungültiger Sicherheitsschlüssel","label_client":"Client:","label_content_type":"Inhaltsart:","label_default_access_mode":"Standard Zugriffsmodus:","label_file_name":"Dateiname:","label_group_members":"Gruppenmitglieder:","label_incognito_mode":"inkognito-Modus:","label_message_sound":"Benachrichtigungston:","label_muting_topic":"Stumm geschaltet:","label_other_user":"Andere","label_password":"Passwort","label_permissions":"Berechtigungen:","label_private":"Privater Kommentar","label_push_notifications":"Benachrichtigungsmeldungen:","label_push_notifications_disabled":"Benachrichtigungsmeldungen (erfordert HTTPS):","label_reset_password":"Passwort per E-Mail wiederherstellen:","label_sdk":"SDK:","label_server":"Server:","label_server_address":"Server Adresse:","label_server_to_use":"Server verwenden:","label_size":"Größe:","label_topic_name":"Name","label_user_contacts":"Kontakte:","label_user_id":"ID:","label_wire_transport":"Übertragung per Kabel:","label_you":"Sie:","label_your_name":"Ihr Name","label_your_permissions":"Ihre Berechtigungen:","last_seen_timestamp":"Zuletzt gesehen","leave_chat_warning":"Möchten Sie diese Unterhaltung wirklich verlassen?","link_contact_us":"Kontakt","link_privacy_policy":"Datenschutzerklärung","link_terms_of_service":"Nutzungsbedingungen","login_prompt":"Anmelden","menu_item_archive_topic":"Archivieren","menu_item_block":"Blockieren","menu_item_clear_messages":"Nachrichten leeren","menu_item_clear_messages_for_all":"Für alle leeren","menu_item_delete":"Löschen","menu_item_delete_for_all":"Für alle löschen","menu_item_delete_topic":"Entfernen","menu_item_edit_permissions":"Berechtigungen ändern","menu_item_info":"Info","menu_item_member_delete":"Entfernen","menu_item_mute":"Unterhaltung stumm schalten","menu_item_restore_topic":"Wiederherstellen","menu_item_send_retry":"Wiederholen","menu_item_unblock":"Blockierung aufheben","menu_item_unmute":"Stumm schalten beenden","message_sending":"wird gesendet...","message_sending_failed":"fehlgeschlagen","messages_not_readable":"Neue Nachrichten können nicht gelesen werden","messaging_disabled_prompt":"Nachrichtenübermittlung deaktiviert","more_online_members":"+{overflow} mehr","new_message_prompt":"Neue Nachricht","new_password_placeholder":"Geben Sie ein neues Passwort ein","no_connection":"Keine Verbindung","no_contacts":"Sie haben keine Kontakte :-(","numeric_confirmation_code_prompt":"Nur zahlen","online_now":"jetzt online","password_prompt":"Passwort","password_unchanged_prompt":"unverändert","peers_messaging_disabled":"Gruppennachrichten sind deaktiviert","permission_admin":"Bestätigen ({val})","permission_delete":"Entfernen ({val})","permission_join":"Beitreten ({val})","permission_owner":"Besitzer ({val})","permission_pres":"Benachrichtigt werden ({val})","permission_read":"Lesen ({val})","permission_share":"Teilen ({val})","permission_write":"Schreiben ({val})","phone_dative":"Telefon","private_editing_placeholder":"Nur für Sie sichtbar","push_init_failed":"Initialisierung von Push-Benachrichtigungen fehlgeschlagen","reconnect_countdown":"Getrennt. Wiederverbinden in {seconds}…","reconnect_now":"Jetzt probieren","reload_update":"Neu laden","report_chat_warning":"Möchten Sie diese Unterhaltung wirklich blockieren und melden?","requested_permissions":"Angefordert","save_attachment":"Speichern","search_for_contacts":"Nutzen Sie die Suche um Kontakte zu finden","search_no_results":"Die Suche hatte keine Ergebnisse","search_placeholder":"Liste: email:lisa@beispiel.de, tel:17025550003...","sidepanel_title_acc_notifications":"Benachrichtigungen","sidepanel_title_acc_support":"Unterstützung","sidepanel_title_account_settings":"Konto-Einstellungen","sidepanel_title_archive":"Archivierte Unterhaltungen","sidepanel_title_blocked":"Blockierte Unterhaltungen","sidepanel_title_cred":"Anmeldeinformationen bestätigen","sidepanel_title_login":"Anmelden","sidepanel_title_newtpk":"Neue Unterhaltung starten","sidepanel_title_register":"Konto erstellen","sidepanel_title_reset":"Passwort zurücksetzen","sidepanel_title_settings":"Einstellungen","stay_logged_in":"Angemeldet bleiben","tabtitle_find_user":"Suchen","tabtitle_group_by_id":"nach ID","tabtitle_new_group":"Neue Gruppe","tags_editor_no_tags":"Schlagworte hinzufügen","tags_not_found":"Keine Schlagworte definiert. Erstellen Sie welche.","title_all_contacts":"Alle Kontakte","title_group_members":"Gruppenmitglieder","panel_title_info":"Info","title_manage_tags":"Verwalten","title_not_found":"Nicht gefunden","title_permissions":"Berechtigungen","title_tag_manager":"Schlagworte (Nutzer entdecken)","topic_block_warning":"Möchten Sie diese Unterhaltung wirklich blockieren?","topic_delete_warning":"Möchten Sie diese Unterhaltung wirklich löschen?","topic_name_editing_placeholder":"Freiform Name der Gruppe","unnamed_topic":"Unbenannt","update_available":"Aktualisierung verfügbar.","upload_finishing":"wird abgeschlossen...","user_not_found":"Nicht gefunden","validate_credential_action":"bestätigen","description_editing_placeholder":"Beschreibung (optional)","label_description":"Beschreibung","button_security":"Sicherheit","panel_title_general":"Allgemein","panel_title_security":"Sicherheit","panel_title_crop":"Zum Anpassen ziehen","panel_title_members":"Mitglieder","permissions_anonymous":"Anonym","permissions_authenticated":"Authentifiziert","topic_delete":"Chat löschen","permissions_user":"Benutzerberechtigungen","password_reset_email_sent":"Eine E-Mail wurde an {email} gesendet. Folgen Sie den Anweisungen in der E-Mail, um Ihr Passwort zurückzusetzen.","label_unarchive_topic":"Archiviert:","menu_item_reply":"Antwort","menu_item_forward":"Nach vorne","forward_to":"Weiterleiten","forward_to_search_placeholder":"Kontakte durchsuchen","label_new_password":"Neues Kennwort","drafty_unknown":"Nicht unterstützt","calls_incoming":"Eingehender Anruf","calls_outgoing":"Ausgehender Anruf","calls_you_label":"Du","menu_item_video_call":"Videoanruf","already_in_call":"Du redest schon!","call_cancelled":"abgebrochen","call_missed":"verpasster","call_declined":"abgelehnt","call_disconnected":"getrennt","label_use_secure_connection":"Verwenden Sie eine sichere Verbindung","phone_or_email_prompt":"Telefonnummer oder E-Mail","cred_confirmed_successfully":"Erfolgreich bestätigt"},"en":{"action_block_contact":"Block Contact","action_cancel":"cancel","action_clear_messages":"Clear Messages","action_delete_messages":"Clear Messages for All","action_leave_chat":"Leave Conversation","action_report_chat":"Report Conversation","archived_contacts":"Archived contacts ({count})","badge_danger":"Untrustworthy","badge_owner":"owner","badge_staff":"Staff-managed","badge_verified":"Verified/official","badge_you":"you","block_contact_warning":"Are you sure you want to block this contact?","blocked_contacts_link":"Blocked contacts ({count})","button_add_another":"Add another","button_add_members":"Add members","button_cancel":"Cancel","button_confirm":"Confirm","button_create":"Create","button_delete_account":"Delete account","button_edit":"Edit","button_logout":"Logout","button_ok":"OK","button_reset":"Reset","button_send_request":"Send request","button_sign_in":"Sign in","button_sign_up":"Sign up","button_subscribe":"Subscribe","button_update":"Update","cannot_initiate_file_upload":"Cannot initiate file upload.","channel":"channel","channel_prompt":"This is a channel","chat_invitation":"You are invited to start a new chat. What would you like to do?","chat_invitation_accept":"Accept","chat_invitation_block":"Block","chat_invitation_ignore":"Ignore","clear_messages_warning":"Are you sure you want to clear all messages? It cannot be undone.","code_doesnot_match":"Code does not match","contacts_not_found":"You have no chats<br />¯∖_(ツ)_/¯","contacts_not_found_short":"No contacts match \'\'{query}\'\'","credential_email_prompt":"Your registration email","delete_account":"Delete account","delete_account_warning":"Are you sure you want to delete your account? It cannot be undone.","delete_messages_warning":"Are you sure you want to delete all messages for everyone? It cannot be undone.","deleted_content":"content deleted","download_action":"download","drafty_attachment":"Attachment","drafty_form":"Form:","drafty_image":"Picture","email_dative":"email","email_prompt":"Email, e.g. jdoe@example.com","enable_peers_messaging":"Enable","enter_confirmation_code_prompt":"Enter confirmation code sent to you by {method}:","error_invalid_id":"Invalid ID","file_attachment_too_large":"The file size {size} exceeds the {limit} limit.","forgot_password_link":"Forgot password?","full_name_prompt":"Full name, e.g. John Doe","granted_permissions":"Granted","group_has_no_members":"No members","group_user_id_prompt":"Group or User ID","image_caption_prompt":"Image caption","invalid_content":"invalid content","invalid_security_token":"Invalid security token","label_client":"Client:","label_content_type":"Content type:","label_default_access_mode":"Default access mode:","label_file_name":"File name:","label_group_members":"Group members:","label_incognito_mode":"Incognito mode:","label_message_sound":"Message sound:","label_muting_topic":"Muted:","label_other_user":"Other","label_password":"Password","label_permissions":"Permissions:","label_private":"Private comment","label_push_notifications":"Notification alerts:","label_push_notifications_disabled":"Notification alerts (requires HTTPS):","label_reset_password":"Send a password reset email:","label_sdk":"SDK:","label_server":"Server:","label_server_address":"Server address:","label_server_to_use":"Server to use:","label_size":"Size:","label_topic_name":"Name","label_user_contacts":"Contacts:","label_user_id":"ID:","label_wire_transport":"Wire transport:","label_you":"You:","label_your_name":"Your name","label_your_permissions":"Your permissions:","last_seen_timestamp":"Last seen","leave_chat_warning":"Are you sure you want to leave this conversation?","link_contact_us":"Contact Us","link_privacy_policy":"Privacy Policy","link_terms_of_service":"Terms of Service","login_prompt":"Login","menu_item_archive_topic":"Archive","menu_item_block":"Block","menu_item_clear_messages":"Clear messages","menu_item_clear_messages_for_all":"Clear for All","menu_item_delete":"Delete","menu_item_delete_for_all":"Delete for All","menu_item_delete_topic":"Delete","menu_item_edit_permissions":"Edit permissions","menu_item_info":"Info","menu_item_member_delete":"Remove","menu_item_mute":"Mute","menu_item_reply":"Reply","menu_item_restore_topic":"Restore","menu_item_send_retry":"Retry","menu_item_unblock":"Unblock","menu_item_unmute":"Unmute","message_sending":"sending...","message_sending_failed":"failed","messages_not_readable":"no access to messages","messaging_disabled_prompt":"Messaging disabled","more_online_members":"+{overflow} more","new_message_prompt":"New message","new_password_placeholder":"Enter new password","no_connection":"No connection","no_contacts":"You have no contacts :-(","numeric_confirmation_code_prompt":"Numbers only","online_now":"online now","password_prompt":"Password","password_unchanged_prompt":"Unchanged","peers_messaging_disabled":"Peer\'s messaging is disabled.","permission_admin":"Approve ({val})","permission_delete":"Delete ({val})","permission_join":"Join ({val})","permission_owner":"Owner ({val})","permission_pres":"Get notified ({val})","permission_read":"Read ({val})","permission_share":"Share ({val})","permission_write":"Write ({val})","phone_dative":"phone","private_editing_placeholder":"Visible to you only","push_init_failed":"Failed to initialize push notifications","reconnect_countdown":"Disconnected. Reconnecting in {seconds}…","reconnect_now":"Try now","reload_update":"Reload","report_chat_warning":"Are you sure you want to block and report this conversation?","requested_permissions":"Requested","save_attachment":"save","search_for_contacts":"Use search to find contacts","search_no_results":"Search returned no results","search_placeholder":"List like email:alice@example.com, tel:17025550003...","sidepanel_title_acc_notifications":"Notifications","sidepanel_title_acc_support":"Support","sidepanel_title_account_settings":"Account Settings","sidepanel_title_archive":"Archived Chats","sidepanel_title_blocked":"Blocked Chats","sidepanel_title_cred":"Confirm Credentials","sidepanel_title_login":"Sign In","sidepanel_title_newtpk":"Start New Chat","sidepanel_title_register":"Create Account","sidepanel_title_reset":"Reset Password","sidepanel_title_settings":"Settings","stay_logged_in":"Stay logged in","tabtitle_find_user":"find","tabtitle_group_by_id":"by id","tabtitle_new_group":"new group","tags_editor_no_tags":"Add some tags","tags_not_found":"No tags defined. Add some.","title_all_contacts":"All Contacts","title_group_members":"Group Members","title_manage_tags":"Manage","title_not_found":"Not found","title_permissions":"Permissions","title_tag_manager":"Tags (search & discovery)","topic_block_warning":"Are you sure you want to block this conversation?","topic_delete_warning":"Are you sure you want to delete this conversation?","topic_name_editing_placeholder":"Freeform name of the group","unnamed_topic":"Unnamed","update_available":"Update available.","upload_finishing":"finishing...","user_not_found":"Not found","validate_credential_action":"confirm","description_editing_placeholder":"Optional description","label_description":"Description","button_security":"Security","panel_title_crop":"Drag to Adjust","panel_title_general":"General","panel_title_members":"Members","panel_title_security":"Security","panel_title_info":"Info","permissions_anonymous":"Anonymous","permissions_authenticated":"Authenticated","topic_delete":"Delete Conversation","permissions_user":"User\'s Permissions","password_reset_email_sent":"An email has been sent to {email}. Follow the directions in the email to reset your password.","label_unarchive_topic":"Archived:","menu_item_forward":"Forward","forward_to":"Forward to","forward_to_search_placeholder":"Search contacts","label_new_password":"New password","drafty_unknown":"Unsupported","calls_incoming":"Incoming call","calls_outgoing":"Outgoing call","calls_you_label":"You","menu_item_video_call":"Video call","already_in_call":"You already in an ongoing call!","call_cancelled":"cancelled","call_missed":"missed","call_declined":"declined","call_disconnected":"disconnected","label_use_secure_connection":"Use secure connection","phone_or_email_prompt":"Phone number or email","cred_confirmed_successfully":"Confirmed successfully"},"es":{"action_block_contact":"Bloquear contacto","action_cancel":"cancelar","action_clear_messages":"Borrar mensajes","action_delete_messages":"Borrar mensajes para todos","action_leave_chat":"Dejar conversación","action_report_chat":"Reportar conversación","archived_contacts":"Contactos archivados ({count})","badge_danger":"Suspicaz","badge_owner":"propietario","badge_staff":"Administración","badge_verified":"Verificado","badge_you":"tú","block_contact_warning":"¿Estás seguro de que quieres bloquear a este contacto?","blocked_contacts_link":"Contactos bloqueados ({count})","button_add_another":"Añadir contacto","button_add_members":"Añadir miembros","button_cancel":"Cancelar","button_confirm":"Confirmar","button_create":"Crear","button_delete_account":"Eliminar cuenta","button_edit":"Editar","button_logout":"Cerrar sesión","button_ok":"OK","button_reset":"Restablecer","button_send_request":"Enviar petición","button_sign_in":"Entrar","button_sign_up":"Regístrate","button_subscribe":"Suscribirse","button_update":"Actualizar","cannot_initiate_file_upload":"No se pudo iniciar la carga del archivo.","channel":"canal","channel_prompt":"Este es un canal","chat_invitation":"Estás invitado a participar en un nuevo chat. ¿Qué te gustaría hacer?","chat_invitation_accept":"Aceptar","chat_invitation_block":"Bloquear","chat_invitation_ignore":"Ignorar","clear_messages_warning":"¿Estás seguro de que quieres eliminar todos los mensajes? Esta acción es irreversible.","code_doesnot_match":"El código no coincide","contacts_not_found":"No tienes chats<br />¯∖_(ツ)_/¯","contacts_not_found_short":"Ningún contacto coincide con \'\'{query}\'\'","credential_email_prompt":"Tu correo electrónico de registro","delete_account":"Eliminar cuenta","delete_account_warning":"¿Estás seguro de que deseas eliminar permanentemente tu cuenta? Esta acción es irreversible.","delete_messages_warning":"¿Estás seguro de que quieres eliminar todos los mensajes para todos? Esta acción es irreversible.","deleted_content":"este mensaje fue eliminado","download_action":"descargar","drafty_attachment":"Archivo","drafty_form":"Formulario:","drafty_image":"Imagen","email_dative":"correo electrónico","email_prompt":"Correo electrónico, p.ej. juan@example.com","enable_peers_messaging":"Habilitar","enter_confirmation_code_prompt":"Introduzca el código de confirmación enviado a tu {method}:","error_invalid_id":"ID inválido","file_attachment_too_large":"El tamaño del archivo {size} excede el límite de {limit}.","forgot_password_link":"¿Olvidaste tu contraseña?","full_name_prompt":"Nombre completo, p.ej. Juan González Hernández","granted_permissions":"Otorgados","group_has_no_members":"No hay miembros","group_user_id_prompt":"ID del grupo o usuario","image_caption_prompt":"Añade un comentario","invalid_content":"contenido inválido","invalid_security_token":"Token de seguridad inválido","label_client":"Cliente:","label_content_type":"Tipo de contenido:","label_default_access_mode":"Modo de acceso predeterminado:","label_file_name":"Nombre del archivo:","label_group_members":"Miembros del grupo:","label_incognito_mode":"Modo incógnito:","label_message_sound":"Sonido de mensaje:","label_muting_topic":"Silenciado:","label_other_user":"Otros","label_password":"Contraseña","label_permissions":"Permisos:","label_private":"Comentario privado","label_push_notifications":"Alertas de notificaciones:","label_push_notifications_disabled":"Alertas de notificaciones (requiere HTTPS):","label_reset_password":"Enviar un correo electrónico de restablecimiento de contraseña:","label_sdk":"SDK:","label_server":"Servidor:","label_server_address":"Dirección del servidor:","label_server_to_use":"Servidor para usar:","label_size":"Tamaño:","label_topic_name":"Nombre del tema","label_user_contacts":"Contactos:","label_user_id":"ID:","label_wire_transport":"Transporte de alambre:","label_you":"Tú:","label_your_name":"Tu nombre","label_your_permissions":"Tus permisos:","last_seen_timestamp":"Últ. vez","leave_chat_warning":"¿Estás seguro de que quieres dejar esta conversación?","link_contact_us":"Contáctanos","link_privacy_policy":"Política de privacidad","link_terms_of_service":"Términos de uso","login_prompt":"Nombre de usuario","menu_item_archive_topic":"Archivar","menu_item_block":"Bloquear","menu_item_clear_messages":"Borrar mensajes","menu_item_clear_messages_for_all":"Borrar para todos","menu_item_delete":"Eliminar","menu_item_delete_for_all":"Eliminar para todos","menu_item_delete_topic":"Eliminar","menu_item_edit_permissions":"Editar permisos","menu_item_info":"Información","menu_item_member_delete":"Eliminar","menu_item_mute":"Silenciar","menu_item_restore_topic":"Restaurar","menu_item_send_retry":"Inténtalo de nuevo","menu_item_unblock":"Desbloquear","menu_item_unmute":"Anular el silencio","message_sending":"enviando...","message_sending_failed":"no se pudo enviar el mensaje","messages_not_readable":"sin acceso a mensajes","messaging_disabled_prompt":"El envío de mensajes está deshabilitado","more_online_members":"+{overflow} más","new_message_prompt":"Nuevo mensaje","new_password_placeholder":"Introduzca una nueva contraseña","no_connection":"Sin conexión","no_contacts":"No tienes contactos :-(","numeric_confirmation_code_prompt":"Sólo números","online_now":"en línea","password_prompt":"Contraseña","password_unchanged_prompt":"Sin cambios","peers_messaging_disabled":"La mensajería Peer está deshabilitada.","permission_admin":"Approbar ({val})","permission_delete":"Eliminar ({val})","permission_join":"Unirse ({val})","permission_owner":"Propietario ({val})","permission_pres":"Ser notificado ({val})","permission_read":"Leer ({val})","permission_share":"Compartir ({val})","permission_write":"Escribir ({val})","phone_dative":"teléfono","private_editing_placeholder":"Sólo visible para tí","push_init_failed":"Error al inicializar las notificaciones push","reconnect_countdown":"Desconectado. Reconectando en {seconds}…","reconnect_now":"Reintentar","reload_update":"Recargar","report_chat_warning":"¿Estás seguro de que quieres bloquear y reportar a esta conversación?","requested_permissions":"Solicitados","save_attachment":"guardar","search_for_contacts":"Usa la búsqueda para encontrar contactos","search_no_results":"La búsqueda no arrojó resultados","search_placeholder":"Ej. email:alice@example.com, tel:17025550003...","sidepanel_title_acc_notifications":"Notificaciones","sidepanel_title_acc_support":"Soporte","sidepanel_title_account_settings":"Ajustes de la cuenta","sidepanel_title_archive":"Chats archivados","sidepanel_title_blocked":"Chats bloqueados","sidepanel_title_cred":"Confirmar credenciales","sidepanel_title_login":"Iniciar sesión","sidepanel_title_newtpk":"Iniciar un nuevo chat","sidepanel_title_register":"Crear cuenta","sidepanel_title_reset":"Restablecer contraseña","sidepanel_title_settings":"Ajustes","stay_logged_in":"Permanecer conectado","tabtitle_find_user":"encontrar","tabtitle_group_by_id":"por ID","tabtitle_new_group":"nuevo grupo","tags_editor_no_tags":"Añadir etiquetas","tags_not_found":"No hay etiquetas definidas. Añade unas.","title_all_contacts":"Todos los contactos","title_group_members":"Miembros del grupo","title_manage_tags":"Gestionar","title_not_found":"No encontrado","title_permissions":"Permisos","title_tag_manager":"Etiquetas (descubrimiento de usuarios)","topic_block_warning":"¿Estás seguro de que quieres bloquear esta conversación","topic_delete_warning":"¿Estás seguro de que quieres eliminar esta conversación?","topic_name_editing_placeholder":"Nombre del grupo","unnamed_topic":"Sin nombre","update_available":"Actualización disponible.","upload_finishing":"terminando...","user_not_found":"Usuario no encontrado","validate_credential_action":"confirmar","description_editing_placeholder":"Descripción (opcional)","label_description":"Descripción","button_security":"Seguridad","panel_title_crop":"Arrastra para ajustar","panel_title_general":"General","panel_title_members":"Miembros","panel_title_security":"Seguridad","panel_title_info":"Información","permissions_anonymous":"Anónimo","permissions_authenticated":"Autenticado","topic_delete":"Eliminar chat","permissions_user":"Permisos del usuario","password_reset_email_sent":"Se ha enviado un correo electrónico a {email}. Siga las instrucciones del correo electrónico para restablecer su contraseña.","label_unarchive_topic":"Archivado:","menu_item_reply":"Respuesta","menu_item_forward":"Reenviar","forward_to":"Reenviar a","forward_to_search_placeholder":"Buscar contactos","label_new_password":"Nueva contraseña","drafty_unknown":"No soportado","calls_incoming":"Llamada entrante","calls_outgoing":"Llamada saliente","calls_you_label":"Tú","menu_item_video_call":"Videollamada","already_in_call":"¡Ya estás hablando!","call_cancelled":"cancelada","call_missed":"perdida","call_declined":"rechazada","call_disconnected":"desconectada","label_use_secure_connection":"Usar conexión segura","phone_or_email_prompt":"Número de teléfono o correo electrónico","cred_confirmed_successfully":"Confirmado con éxito"},"fr":{"action_block_contact":"Bloquer le Contact","action_cancel":"annuler","action_clear_messages":"Effacer les Messages","action_delete_messages":"Effacer les Messages pour Tous","action_leave_chat":"Quitter la Conversation","action_report_chat":"Signaler la Conversation","archived_contacts":"Contacts archivés ({count})","badge_danger":"Non fiable","badge_owner":"propriétaire","badge_staff":"Géré par le Staff","badge_verified":"Vérifié / Officiel","badge_you":"vous","block_contact_warning":"Êtes-vous sûr de bloquer le contact ?","blocked_contacts_link":"Contacts bloqués ({count})","button_add_another":"Ajouter un autre","button_add_members":"Ajouter des membres","button_cancel":"Annuler","button_confirm":"Confirmer","button_create":"Créer","button_delete_account":"Supprimer le compte","button_edit":"Modifier","button_logout":"Déconnexion","button_ok":"OK","button_reset":"Remettre à Zéro","button_send_request":"Envoyer une demande","button_sign_in":"Connexion","button_sign_up":"Créer un compte","button_subscribe":"S\'abonner","button_update":"Mettre à jour","cannot_initiate_file_upload":"Impossible de démarrer l\'envoi.","channel":"canal","channel_prompt":"C\'est un canal","chat_invitation":"Vous êtes invité à démarrer une conversation. Que voulez vous faire ?","chat_invitation_accept":"Accepter","chat_invitation_block":"Bloquer","chat_invitation_ignore":"Ignorer","clear_messages_warning":"Êtes-vous sûr de vouloir effacer tous les messages ? Aucun retour possible.","code_doesnot_match":"Le code ne correspond pas","contacts_not_found":"Vous n\'avez aucune conversation<br />¯∖_(ツ)_/¯","contacts_not_found_short":"Aucun contact ne correspond à \'\'{query}\'\'","credential_email_prompt":"Votre email d\'enregistrement","delete_account":"Supprimer le compte","delete_account_warning":"Êtes-vous sûr de vouloir supprimer votre compte ? Aucun retour possible.","delete_messages_warning":"Êtes-vous sûr de vouloir supprimer tous les messages pour tous ? Aucun retour possible.","deleted_content":"contenu supprimé","download_action":"télécharger","drafty_attachment":"Pièce(s) jointe(s)","drafty_form":"Formulaire:","drafty_image":"Image","email_dative":"email","email_prompt":"Email, par exemple jdoe@exemple.com","enable_peers_messaging":"Activer","enter_confirmation_code_prompt":"Entrez le code de confirmation envoyé par {method}:","error_invalid_id":"Identifiant invalide","file_attachment_too_large":"Le fichier de taille {size} dépasse la limite de {limit}.","forgot_password_link":"Mot de passe oublié ?","full_name_prompt":"Nom complet, par exemple John Doe","granted_permissions":"Accordé","group_has_no_members":"Aucun membre","group_user_id_prompt":"Identifiant d\'utilisateur ou de groupe","image_caption_prompt":"Description de l\'image","invalid_content":"contenu invalide","invalid_security_token":"Token de sécurité invalide","label_client":"Client :","label_content_type":"Type de contenu :","label_default_access_mode":"Mode d\'accès par défaut :","label_file_name":"Nom du fichier :","label_group_members":"Membres du groupe :","label_incognito_mode":"Mode incognito :","label_message_sound":"Son du message :","label_muting_topic":"Mué :","label_other_user":"Autre","label_password":"Mot de passe","label_permissions":"Permissions :","label_private":"Commentaire privé","label_push_notifications":"Notifications :","label_push_notifications_disabled":"Notifications (requière HTTPS):","label_reset_password":"Envoyer un mail de remise à zéro de mot de passe :","label_sdk":"SDK :","label_server":"Serveur :","label_server_address":"Adresse du serveur :","label_server_to_use":"Serveur à utiliser :","label_size":"Taille :","label_topic_name":"Nom","label_user_contacts":"Contacts :","label_user_id":"ID :","label_wire_transport":"Transport par cable :","label_you":"Vous :","label_your_name":"Votre nom","label_your_permissions":"Vos permissions :","last_seen_timestamp":"Vu pour la dernière fois","leave_chat_warning":"Êtes-vous sûr de vouloir quitter cette conversation ?","link_contact_us":"Contactez Nous","link_privacy_policy":"Politique de confidentialité","link_terms_of_service":"Conditions d\'utilisation","login_prompt":"Connexion","menu_item_archive_topic":"Archiver","menu_item_block":"Bloquer","menu_item_clear_messages":"Effacer les messages","menu_item_clear_messages_for_all":"Effacer pour Tous","menu_item_delete":"Supprimer","menu_item_delete_for_all":"Supprimer pour Tous","menu_item_delete_topic":"Supprimer","menu_item_edit_permissions":"Modifier les permissions","menu_item_info":"Informations","menu_item_member_delete":"Supprimer","menu_item_mute":"Rendre muer","menu_item_reply":"Répondre","menu_item_restore_topic":"Restorer","menu_item_send_retry":"Réessayer","menu_item_unblock":"Débloquer","menu_item_unmute":"Recevoir à nouveau","message_sending":"envoi en cours...","message_sending_failed":"échoué","messages_not_readable":"aucun accès aux messages","messaging_disabled_prompt":"Discussion désactivée","more_online_members":"+{overflow} de plus","new_message_prompt":"Nouveau message","new_password_placeholder":"Entrez un nouveau mot de passe","no_connection":"Aucune connexion","no_contacts":"Vous n\'avez pas de contacts :-(","numeric_confirmation_code_prompt":"Nombres seulement","online_now":"en ligne","password_prompt":"Mot de passe","password_unchanged_prompt":"Non changé","peers_messaging_disabled":"La messagerie point à point est désactivée.","permission_admin":"Approver ({val})","permission_delete":"Supprimer ({val})","permission_join":"Rejoindre ({val})","permission_owner":"Propriétaire ({val})","permission_pres":"Recevoir une notification ({val})","permission_read":"Lire ({val})","permission_share":"Partager ({val})","permission_write":"Ecrire ({val})","phone_dative":"téléphone","private_editing_placeholder":"Visible par vous seulement","push_init_failed":"Impossible d\'initialiser les notifications push","reconnect_countdown":"Déconnecté. Reconnexion dans {seconds}…","reconnect_now":"Essayer maintenant","reload_update":"Recharger","report_chat_warning":"Êtes-vous sûr de vouloir bloquer et signaler cette conversation ?","requested_permissions":"Demandé","save_attachment":"sauvegarder","search_for_contacts":"Utilisez la recherche pour trouver des contacts","search_no_results":"La recherche n\'a donné aucun résultat","search_placeholder":"Liste comme email:alice@exemple.com, tel:17025550003...","sidepanel_title_acc_notifications":"Notifications","sidepanel_title_acc_support":"Support","sidepanel_title_account_settings":"Paramètres du compte","sidepanel_title_archive":"Conversations Archivées","sidepanel_title_blocked":"Conversations Bloquées","sidepanel_title_cred":"Confirmer les identifiants","sidepanel_title_login":"Se Connecter","sidepanel_title_newtpk":"Démarrer une nouvelle Conversation","sidepanel_title_register":"Créer un compte","sidepanel_title_reset":"Remettre à Zéro le Mot de Passe","sidepanel_title_settings":"Paramètres","stay_logged_in":"Rester connecté","tabtitle_find_user":"trouver","tabtitle_group_by_id":"par identifiant","tabtitle_new_group":"nouveau groupe","tags_editor_no_tags":"Ajouter des étiquettes","tags_not_found":"Aucune étiquette définie. Ajoutez en.","title_all_contacts":"Tous les Contacts","title_group_members":"Membres du Groupe","title_manage_tags":"Gérer","title_not_found":"Pas trouvé","title_permissions":"Permissions","title_tag_manager":"Etiquettes (recherche & découverte)","topic_block_warning":"Êtes-vous sûr de vouloir bloquer cette conversation ?","topic_delete_warning":"Êtes-vous sûr de vouloir supprimer cette conversation ?","topic_name_editing_placeholder":"Nom libre du groupe","unnamed_topic":"Non nommé","update_available":"Mise à jour disponible.","upload_finishing":"fin...","user_not_found":"Pas trouvé","validate_credential_action":"confirmer","description_editing_placeholder":"Description facultative","label_description":"Description","button_security":"Sécurité","panel_title_crop":"Déplacez pour ajuster","panel_title_general":"Général","panel_title_members":"Membres","panel_title_security":"Sécurité","panel_title_info":"Informations","permissions_anonymous":"Anonyme","permissions_authenticated":"Authentifié","topic_delete":"Supprimer la Conversation","permissions_user":"Permissions d\'Utilisateur","password_reset_email_sent":"Un email a été envoyé à {email}. Suivez les instructions du mail pour remettre à zéro votre mot de passe.","label_unarchive_topic":"Archivé:","menu_item_forward":"Transférer","forward_to":"Transférer à","forward_to_search_placeholder":"Rechercher des contacts","label_new_password":"Nouveau mot de passe","drafty_unknown":"Non supporté","already_in_call":"Vous êtes déjà dans un appel en cours!","call_cancelled":"annulé","call_declined":"refusé","call_missed":"manqué","calls_incoming":"Appel entrant","calls_outgoing":"Appel sortant","calls_you_label":"Tu","menu_item_video_call":"Appel vidéo","call_disconnected":"débranché","label_use_secure_connection":"Utiliser une connexion sécurisée","phone_or_email_prompt":"Numéro de téléphone ou email","cred_confirmed_successfully":"Confirmé avec succès"},"ko":{"action_block_contact":"연락차단","action_cancel":"취소","action_clear_messages":"메시지지우기","action_delete_messages":"모든메시지지우기","action_leave_chat":"대화나누기","action_report_chat":"대화기록","archived_contacts":"보관된연락처({수})","badge_danger":"의심 많은","badge_owner":"소유자","badge_staff":"직원 관리하에","badge_verified":"확인 됨","badge_you":"당신","block_contact_warning":"이연락처를차단하시겠습니까?","blocked_contacts_link":"차단된연락처({수})","button_add_another":"다른항목추가","button_add_members":"회원추가","button_cancel":"취소","button_confirm":"확인","button_create":"작성","button_delete_account":"계정삭제","button_edit":"편집","button_logout":"로그아웃","button_ok":"OK","button_reset":"재설정","button_send_request":"요청보내기","button_sign_in":"로그인","button_sign_up":"가입","button_subscribe":"구독","button_update":"업데이트","cannot_initiate_file_upload":"파일업로드를시작할수없습니다.","channel":"채널","channel_prompt":"이 채널입니다","chat_invitation":"새로운대화를시작하도록초대되었습니다.무엇을하시겠습니까?","chat_invitation_accept":"수락","chat_invitation_block":"차단","chat_invitation_ignore":"무시","clear_messages_warning":"모든메시지를지우시겠습니까?실행취소할수없습니다.","code_doesnot_match":"코드가일치하지않습니다","contacts_not_found":"채팅이없습니다<br/>¯∖_(ツ)_/¯","contacts_not_found_short":"\'{문의}\'와일치하는연락처가없습니다.","credential_email_prompt":"등록이메일","delete_account":"계정삭제","delete_account_warning":"계정을삭제하시겠습니까?실행취소할수없습니다.","delete_messages_warning":"모든사람의모든메시지를삭제하시겠습니까?실행취소할수없습니다.","deleted_content":"내용이 삭제되었습니다","download_action":"다운로드","drafty_attachment":"부착","drafty_form":"형태:","drafty_image":"이미지","email_dative":"이메일","email_prompt":"이메일(예:hong@example.com)","enable_peers_messaging":"활성화","enter_confirmation_code_prompt":"{방법}으로보낸확인코드를입력하십시오:","error_invalid_id":"잘못된ID","file_attachment_too_large":"파일크기{크기}이(가){제한}제한을초과합니다.","forgot_password_link":"비밀번호를잊으셨습니까?","full_name_prompt":"전체이름(예:홍길동)","granted_permissions":"승낙하다","group_has_no_members":"회원없음","group_user_id_prompt":"그룹또는사용자ID","image_caption_prompt":"이미지설명","invalid_content":"잘못된내용","invalid_security_token":"유효하지않은보안토큰","label_client":"클라이언트: ","label_content_type":"컨텐츠유형: ","label_default_access_mode":"기본액세스모드: ","label_file_name":"파일이름: ","label_group_members":"그룹회원: ","label_incognito_mode":"시크릿모드: ","label_message_sound":"메시지소리: ","label_muting_topic":"음소거: ","label_other_user":"기타","label_password":"비밀번호","label_permissions":"권한: ","label_private":"개인코멘트","label_push_notifications":"통지경보: ","label_push_notifications_disabled":"통지경보(HTTPS필요): ","label_reset_password":"비밀번호재설정이메일보내기: ","label_sdk":"SDK:","label_server":"서버: ","label_server_address":"서버주소: ","label_server_to_use":"사용할서버:","label_size":"크기: ","label_topic_name":"이름","label_user_contacts":"연락처: ","label_user_id":"ID:","label_wire_transport":"와이어수송:","label_you":"당신: ","label_your_name":"이름","label_your_permissions":"권한: ","last_seen_timestamp":"마지막으로본","leave_chat_warning":"이대화를나가시겠습니까?","link_contact_us":"문의처","link_privacy_policy":"개인정보보호정책","link_terms_of_service":"서비스약관","login_prompt":"로그인","menu_item_archive_topic":"보관","menu_item_block":"차단","menu_item_clear_messages":"메시지지우기","menu_item_clear_messages_for_all":"모두지우기","menu_item_delete":"삭제","menu_item_delete_for_all":"모두삭제","menu_item_delete_topic":"삭제","menu_item_edit_permissions":"편집권한","menu_item_info":"정보","menu_item_member_delete":"제거","menu_item_mute":"음소거","menu_item_restore_topic":"복원","menu_item_send_retry":"다시시도","menu_item_unblock":"차단해제","menu_item_unmute":"음소거해제","message_sending":"보내기...","message_sending_failed":"실패","messages_not_readable":"메시지에 액세스 할 수 없습니다","messaging_disabled_prompt":"메시지비활성화","more_online_members":"+{넘침}더보기","new_message_prompt":"새메시지","new_password_placeholder":"새비밀번호입력","no_connection":"연결없음","no_contacts":"연락처가없습니다 (._.)","numeric_confirmation_code_prompt":"숫자만","online_now":"현재접속중","password_prompt":"비밀번호","password_unchanged_prompt":"변경되지않음","peers_messaging_disabled":"동료의메시지가비활성화되었습니다.","permission_admin":"승인({val})","permission_delete":"삭제({val})","permission_join":"참여({val})","permission_owner":"소유자({val})","permission_pres":"알림받기({val})","permission_read":"읽기({val})","permission_share":"공유({val})","permission_write":"쓰기({val})","phone_dative":"전화","private_editing_placeholder":"나만볼수있습니다","push_init_failed":"푸시알림을초기화하지못했습니다","reconnect_countdown":"연결이끊어졌습니다.다시연결하는중{초}…","reconnect_now":"지금시도","reload_update":"재로드","report_chat_warning":"이대화를차단하고기록하시겠습니까?","requested_permissions":"요청","save_attachment":"저장","search_for_contacts":"검색을사용하여연락처찾기","search_no_results":"검색결과가없습니다","search_placeholder":"email:alice@example.com,tel:17025550003...와같은목록","sidepanel_title_acc_notifications":"알림","sidepanel_title_acc_support":"지원","sidepanel_title_account_settings":"계정설정","sidepanel_title_archive":"보관된채팅","sidepanel_title_blocked":"차단된채팅","sidepanel_title_cred":"자격증명확인","sidepanel_title_login":"로그인","sidepanel_title_newtpk":"새채팅시작","sidepanel_title_register":"계정만들기","sidepanel_title_reset":"비밀번호재설정","sidepanel_title_settings":"설정","stay_logged_in":"로그인상태유지","tabtitle_find_user":"찾기","tabtitle_group_by_id":"id로","tabtitle_new_group":"새그룹","tags_editor_no_tags":"일부태그추가","tags_not_found":"태그가정의되지않았습니다.일부를추가하십시오.","title_all_contacts":"모든연락처","title_group_members":"그룹구성원","title_manage_tags":"관리","title_not_found":"찾을수없음","title_permissions":"권한","title_tag_manager":"태그(사용자검색)","topic_block_warning":"이대화를차단하시겠습니까?","topic_delete_warning":"이대화를삭제하시겠습니까?","topic_name_editing_placeholder":"그룹의자유형이름","unnamed_topic":"이름없는","update_available":"업데이트가능.","upload_finishing":"마무리...","user_not_found":"찾을수없음","validate_credential_action":"확인","description_editing_placeholder":"설명(선택 사항)","label_description":"설명","button_security":"보안","panel_title_crop":"드래그하여 조정","panel_title_general":"일반","panel_title_members":"구성원","panel_title_security":"보안","panel_title_info":"정보","permissions_anonymous":"익명","permissions_authenticated":"인증됨","topic_delete":"채팅 삭제","permissions_user":"사용자 권한","password_reset_email_sent":"이메일이 {email}(으)로 전송되었습니다. 이메일의 지침에 따라 비밀번호를 재설정하세요.","label_unarchive_topic":"보관됨:","menu_item_reply":"회신하다","menu_item_forward":"리디렉션","forward_to":"메시지를 리디렉션","forward_to_search_placeholder":"연락처 검색","label_new_password":"새 비밀번호","drafty_unknown":"지원되지 않음","calls_incoming":"수신 전화","calls_outgoing":"발신 전화","calls_you_label":"너","menu_item_video_call":"영상 통화","already_in_call":"당신은 이미 말하고 있습니다!","call_cancelled":"취소 된","call_missed":"부재중","call_declined":"통화 거부","call_disconnected":"연결 끊김","label_use_secure_connection":"보안 연결 사용","phone_or_email_prompt":"전화번호 또는 이메일","cred_confirmed_successfully":"성공적으로 확인됨"},"ro":{"action_block_contact":"Blochează contact","action_cancel":"anulează","action_clear_messages":"Șterge mesajele","action_delete_messages":"Șterge toate mesajele","action_leave_chat":"Ieși din conversație","action_report_chat":"Raportează conversația","archived_contacts":"Contacte arhivate ({count})","badge_danger":"Suspicios","badge_owner":"owner","badge_staff":"Administrare","badge_verified":"Verificat","badge_you":"tu","block_contact_warning":"Ești sigur că dorești să blochezi acest contact?","blocked_contacts_link":"Contact blocate ({count})","button_add_another":"Adaugă","button_add_members":"Adaugă persoane","button_cancel":"Anulează","button_confirm":"Confirmă","button_create":"Creează","button_delete_account":"Șterge cont","button_edit":"Editează","button_logout":"Deconectare","button_ok":"OK","button_reset":"Resetează","button_send_request":"Trimite cerere","button_sign_in":"Conectează-te","button_sign_up":"Creează cont","button_subscribe":"Subscribe","button_update":"Actualizează","cannot_initiate_file_upload":"Nu se poate face încărcarea.","channel":"canal","channel_prompt":"Acesta este un canal","chat_invitation":"Ai primit invitație într-o conversație. Accepți?","chat_invitation_accept":"Da, accept","chat_invitation_block":"Blochează","chat_invitation_ignore":"Ignoră","clear_messages_warning":"Ești sigur că dorești să ștergi mesajele? Acestea nu pot fi recuperate.","code_doesnot_match":"Codul furnizat nu este valid","contacts_not_found":"Nu ai contacte salvate<br />¯∖_(ツ)_/¯","contacts_not_found_short":"Niciun contact găsit după criteriile \'\'{query}\'\'","credential_email_prompt":"Adresa de e-mail","delete_account":"Șterge contul","delete_account_warning":"Ești sigur că dorești să ștergi contul? Acesta nu va putea fi recuperat.","delete_messages_warning":"Ești sigur că dorești să șterge mesajele din toate conversațiile? Acestea nu pot fi recuperate.","deleted_content":"conținut șters","download_action":"download","drafty_attachment":"Atasament","drafty_form":"Formă:","drafty_image":"Imagine","email_dative":"email","email_prompt":"Adresa de e-mail","enable_peers_messaging":"Activează","enter_confirmation_code_prompt":"Introu codul de confirmare trimis pe {method}:","error_invalid_id":"ID Invalid","file_attachment_too_large":"Dimensiunea fișiterului {size} depășește limita de {limit}.","forgot_password_link":"Ți-ai uitat parola?","full_name_prompt":"Numele tău","granted_permissions":"Oferite","group_has_no_members":"În acest grup nu se află persoane","group_user_id_prompt":"Grup sau user ID","image_caption_prompt":"Titlul imaginii","invalid_content":"conținut invalid","invalid_security_token":"Codul de securitate este invalid","label_client":"Client:","label_content_type":"Tip conținut:","label_default_access_mode":"Default access mode:","label_file_name":"Nume fișier:","label_group_members":"Membrii grupului:","label_incognito_mode":"Mod incognito:","label_message_sound":"Sunet de mesaj:","label_muting_topic":"Mod silențios (muted):","label_other_user":"Altele","label_password":"Parola","label_permissions":"Permisiuni:","label_private":"Comentariu privat","label_push_notifications":"Alerte de notificare:","label_push_notifications_disabled":"Alerte de notificare (necesită HTTPS):","label_reset_password":"Resetează parola:","label_sdk":"SDK:","label_server":"Server:","label_server_address":"Adresa serverului:","label_server_to_use":"Server de utilizat:","label_size":"Size:","label_topic_name":"Nume","label_user_contacts":"Contacte:","label_user_id":"ID:","label_wire_transport":"Transportul legat:","label_you":"Tu:","label_your_name":"Numele tău","label_your_permissions":"Permisiuniile tale:","last_seen_timestamp":"Văzut ultima dată","leave_chat_warning":"Ești sigur că dorești să ieși din conersație?","link_contact_us":"Contactează-ne","link_privacy_policy":"Politica de Confidențialitate","link_terms_of_service":"Termenii Serviciului","login_prompt":"Conectează-te","menu_item_archive_topic":"Arhivează","menu_item_block":"Blochează","menu_item_clear_messages":"Șterge mesajele","menu_item_clear_messages_for_all":"Ștergele pe toate","menu_item_delete":"Șterge","menu_item_delete_for_all":"Ștergele pe toate","menu_item_delete_topic":"Șterge","menu_item_edit_permissions":"Editează permisiuni","menu_item_info":"Info","menu_item_member_delete":"Șterge persoană","menu_item_mute":"Mute","menu_item_restore_topic":"Restabili","menu_item_send_retry":"Reîncearcă","menu_item_unblock":"Deblochează","menu_item_unmute":"Unmute","message_sending":"se trimite...","message_sending_failed":"eroare","messages_not_readable":"Mesajele nu pot fi citite","messaging_disabled_prompt":"Mesageria este dezactivată","more_online_members":"+{overflow} mai mult","new_message_prompt":"Mesaj nou","new_password_placeholder":"Introdu parolă","no_connection":"Nu există conexiune","no_contacts":"Nu ai contacte adăugate :-(","numeric_confirmation_code_prompt":"Doar cifre","online_now":"online acum","password_prompt":"Parola","password_unchanged_prompt":"Neschimbată","peers_messaging_disabled":"Mesageria de tip Peer este dezactivată.","permission_admin":"Aprobare ({val})","permission_delete":"Ștergere ({val})","permission_join":"Participare ({val})","permission_owner":"Deținător ({val})","permission_pres":"Notificare ({val})","permission_read":"Citire ({val})","permission_share":"Distribuire ({val})","permission_write":"Scriere ({val})","phone_dative":"telefon","private_editing_placeholder":"Vizibil doar ție","push_init_failed":"Nu s-a reușit inițializarea tip push notifications","reconnect_countdown":"Deconectat. Se încearcă conectarea în {seconds}…","reconnect_now":"Încearcă din nou","reload_update":"Reîncarcă","report_chat_warning":"Ești sigur că dorești să blochezi și să raportezi această conversație?","requested_permissions":"Necesare","save_attachment":"salvează","search_for_contacts":"Caută în contacte","search_no_results":"Nu s-au găsit rezultate","search_placeholder":"Caută după e-mail sau număr telefon...","sidepanel_title_acc_notifications":"Notificări","sidepanel_title_acc_support":"Ajutor","sidepanel_title_account_settings":"Setările Contului","sidepanel_title_archive":"Conversații Arhivate","sidepanel_title_blocked":"Conversații Blocate","sidepanel_title_cred":"Confirmă credențiale","sidepanel_title_login":"Conectează-te","sidepanel_title_newtpk":"Creeză un nou Chat","sidepanel_title_register":"Creează Cont","sidepanel_title_reset":"Resetează Parola","sidepanel_title_settings":"Setări","stay_logged_in":"Rămâi conectat","tabtitle_find_user":"caută","tabtitle_group_by_id":"după id","tabtitle_new_group":"grup nou","tags_editor_no_tags":"Adaugă tag-uri","tags_not_found":"Niciun tag definit. Adaugă.","title_all_contacts":"Toate Contactele","title_group_members":"Persoanele din grup","title_manage_tags":"Administrează","title_not_found":"Nu a fost găsit","title_permissions":"Permisiuni","title_tag_manager":"Tag-uri (user discovery)","topic_block_warning":"Ești sigur că dorești să blochezi această conversație?","topic_delete_warning":"Ești sigur că dorești să șterge această conversație?","topic_name_editing_placeholder":"Numele grupului","unnamed_topic":"Nedenumit","update_available":"Actualizare disponibilă.","upload_finishing":"se încarcă...","user_not_found":"Utilizatorul nu a fost găsit","validate_credential_action":"confirmă","description_editing_placeholder":"Descriere (opțional)","label_description":"Descriere","button_security":"Securitate","panel_title_crop":"Trageți pentru a ajusta","panel_title_general":"Generale","panel_title_members":"Membri","panel_title_security":"Securitate","panel_title_info":"Info","permissions_anonymous":"Anonim","permissions_authenticated":"Autentificat","topic_delete":"Ștergeți Chat","permissions_user":"Permisiunile utilizatorului","password_reset_email_sent":"Un e-mail a fost trimis către {email}. Urmați instrucțiunile din e-mail pentru a vă reseta parola.","label_unarchive_topic":"Arhivat:","menu_item_reply":"A raspunde","menu_item_forward":"Redirecţiona","forward_to":"Redirecționați către","forward_to_search_placeholder":"Căutați contacte","label_new_password":"Parolă Nouă","drafty_unknown":"Neacceptat","calls_incoming":"Apel primit","calls_outgoing":"Apel efectuat","calls_you_label":"Tu","menu_item_video_call":"Apel video","already_in_call":"Deja vorbesti!","call_cancelled":"anulat","call_missed":"pierdut","call_declined":"refuzat","call_disconnected":"deconectat","label_use_secure_connection":"Utilizați conexiune securizată","phone_or_email_prompt":"Număr de telefon sau e-mail","cred_confirmed_successfully":"Confirmat cu succes"},"ru":{"action_block_contact":"Заблокировать контакт","action_cancel":"отменить","action_clear_messages":"Удалить сообщения","action_delete_messages":"Удалить сообщения","action_leave_chat":"Уйти из чата","action_report_chat":"Сообщить о нарушении","archived_contacts":"Чаты в архиве ({count})","badge_danger":"Подозрительный","badge_owner":"влад.","badge_staff":"Администрация","badge_verified":"Верифицированный","badge_you":"вы","block_contact_warning":"Вы действительно заблокировать этот контакт?","blocked_contacts_link":"Заблокированные ({count})","button_add_another":"Добавить","button_add_members":"Добавить","button_cancel":"Отменить","button_confirm":"Подтвердить","button_create":"Создать","button_delete_account":"Удалить аккаунт","button_edit":"Изменить","button_logout":"Выйти","button_ok":"OK","button_reset":"Изменить","button_send_request":"Отправить","button_sign_in":"Войти","button_sign_up":"Создать аккаунт","button_subscribe":"Подписаться","button_update":"Применить","cannot_initiate_file_upload":"Ошибка загрузки файла.","channel":"канал","channel_prompt":"Создать канал","chat_invitation":"Вас пригласили начать новый чат. Как вы хотите поступить?","chat_invitation_accept":"Принять","chat_invitation_block":"Заблокировать","chat_invitation_ignore":"Игнорировать","clear_messages_warning":"Вы действительно хотите удалить все сообщения в чате? Их будет невозможно восстановить.","code_doesnot_match":"Код не совпадает","contacts_not_found":"Чатов нет<br />¯∖_(ツ)_/¯","contacts_not_found_short":"Нет контактов для запроса \'\'{query}\'\'","credential_email_prompt":"Регистрационный емейл","delete_account":"Удалить аккаунт","delete_account_warning":"Вы уверены, что ходите удалить свой аккаунт? Его невозможно будет восстановить.","delete_messages_warning":"Вы действительно хотите удалить все сообщения?","deleted_content":"удалено","download_action":"скачать","drafty_attachment":"Аттачмент","drafty_form":"Форма:","drafty_image":"Картинка","email_dative":"емейлу","email_prompt":"Email, напр. ivan@example.com","enable_peers_messaging":"Разблокировать.","enter_confirmation_code_prompt":"Код подтверждения, полученный по {method}:","error_invalid_id":"Неверный ID","file_attachment_too_large":"Размер файла {size} превышает {limit} лимит.","forgot_password_link":"Напомнить пароль","full_name_prompt":"Полное имя, напр. Иван Петров","granted_permissions":"Получены","group_has_no_members":"Нет участников","group_user_id_prompt":"ID чата или пользователя","image_caption_prompt":"Подпись к фото","invalid_content":"сообщение не читается","invalid_security_token":"Токен некорректен","label_client":"Клиент:","label_content_type":"Тип:","label_default_access_mode":"Доступ по умолчанию:","label_file_name":"Имя файла:","label_group_members":"Участники чата:","label_incognito_mode":"Режим инкогнито:","label_message_sound":"Звук нового сообщения:","label_muting_topic":"Без уведомлений","label_other_user":"Второй","label_password":"Пароль","label_permissions":"Права доступа:","label_private":"Комментарий","label_push_notifications":"Уведомления:","label_push_notifications_disabled":"Уведомления (требуют HTTPS):","label_reset_password":"Отправить емейл для смены пароля:","label_sdk":"SDK:","label_server":"Сервер:","label_server_address":"Адрес сервера:","label_server_to_use":"Использовать сервер:","label_size":"Размер:","label_topic_name":"Название","label_user_contacts":"Конакты:","label_user_id":"ID:","label_wire_transport":"Соединение:","label_you":"Вы:","label_your_name":"Ваше имя","label_your_permissions":"Ваши права доступа:","last_seen_timestamp":"Был активен","leave_chat_warning":"Вы действительно хотите покинуть этот чат?","link_contact_us":"Связаться с нами","link_privacy_policy":"Политика конфиденциальности","link_terms_of_service":"Условия сервиса","login_prompt":"Логин","menu_item_archive_topic":"В архив","menu_item_block":"Заблокировать","menu_item_clear_messages":"Удалить сообщения","menu_item_clear_messages_for_all":"Удалить для всех","menu_item_delete":"Удалить","menu_item_delete_for_all":"Удалить для всех","menu_item_delete_topic":"Удалить чат","menu_item_edit_permissions":"Права доступа","menu_item_info":"Информация","menu_item_member_delete":"Отписать","menu_item_mute":"Не уведомлять","menu_item_restore_topic":"Разархивировать","menu_item_send_retry":"Отправить заново","menu_item_unblock":"Разблокировать","menu_item_unmute":"Уведомлять","message_sending":"в пути...","message_sending_failed":"ошибка","messages_not_readable":"нет доступа к сообщениям","messaging_disabled_prompt":"Отправка недоступна","more_online_members":"+еще {overflow}","new_message_prompt":"Новое сообщение","new_password_placeholder":"Введите новый пароль","no_connection":"Нет связи","no_contacts":"Ничего нет :-(","numeric_confirmation_code_prompt":"Только цифры","online_now":"онлайн","password_prompt":"Пароль","password_unchanged_prompt":"Не изменен","peers_messaging_disabled":"Чат заблокирован у корреспондента.","permission_admin":"Подтверждать ({val})","permission_delete":"Удалять ({val})","permission_join":"Подписываться ({val})","permission_owner":"Владелец ({val})","permission_pres":"Уведомлять ({val})","permission_read":"Читать ({val})","permission_share":"Приглашать ({val})","permission_write":"Писать ({val})","phone_dative":"телефону","private_editing_placeholder":"Виден только вам","push_init_failed":"Ошибка инициализации пуш уведомлений","reconnect_countdown":"Нет связи. Подключение через {seconds}…","reconnect_now":"Подключить сейчас.","reload_update":"Обновить","report_chat_warning":"Вы действительно хотите сообщить о нарушении и заблокировать этот чат?","requested_permissions":"Требуются","save_attachment":"сохранить","search_for_contacts":"Поиск контактов","search_no_results":"Ничего не найдено","search_placeholder":"Список, напр. email:alice@example.com, tel:+17025550003...","sidepanel_title_acc_notifications":"Уведомления","sidepanel_title_acc_support":"Поддержка","sidepanel_title_account_settings":"Настройки аккаунта","sidepanel_title_archive":"Архив чатов","sidepanel_title_blocked":"Заблокированные чаты","sidepanel_title_cred":"Подтвердить","sidepanel_title_login":"Авторизация","sidepanel_title_newtpk":"Новый чат","sidepanel_title_register":"Зарегистрироваться","sidepanel_title_reset":"Сменить пароль","sidepanel_title_settings":"Настройки","stay_logged_in":"Запомнить","tabtitle_find_user":"найти","tabtitle_group_by_id":"по id","tabtitle_new_group":"создать","tags_editor_no_tags":"Добавьте теги","tags_not_found":"Тегов нет. Добавьте","title_all_contacts":"Все контакты","title_group_members":"Участники","title_manage_tags":"Редактировать","title_not_found":"Не найден","title_permissions":"Права доступа","title_tag_manager":"Теги для поиска","topic_block_warning":"Вы действительно хотите заблокировать этот чат?","topic_delete_warning":"Вы действительно хотите удалить этот чат?","topic_name_editing_placeholder":"Название чата","unnamed_topic":"Без названия","update_available":"Есть новая версия приложения.","upload_finishing":"завершение...","user_not_found":"Не найден","validate_credential_action":"подтвердить","description_editing_placeholder":"Описание (не обязательно)","label_description":"Описание","button_security":"Безопасность","panel_title_crop":"Обрезать картинку","panel_title_general":"Общие настройки","panel_title_members":"Участники","panel_title_security":"Безопасность","panel_title_info":"Подробности","permissions_anonymous":"Анонимный","permissions_authenticated":"Авторизованный","topic_delete":"Удалить чат","permissions_user":"Права доступа","password_reset_email_sent":"Сообщение было отправлено на адрес {email}. Следуйте инструкциям в сообщении, чтобы изменить пароль.","label_unarchive_topic":"Архивирован:","menu_item_reply":"Ответить","menu_item_forward":"Переслать","forward_to":"Переслать","forward_to_search_placeholder":"Поиск контактов","label_new_password":"Новый пароль","drafty_unknown":"Не поддерживается","calls_incoming":"Входящий звонок","calls_outgoing":"Исходящий звонок","calls_you_label":"Вы","menu_item_video_call":"Видеозвонок","already_in_call":"Вы уже звоните кому-то!","call_cancelled":"отменен","call_missed":"пропущен","call_declined":"отклонен","call_disconnected":"разъединен","label_use_secure_connection":"Безопасное соединение","phone_or_email_prompt":"Телефон или емейл","cred_confirmed_successfully":"Подтверждено успешно"},"zh-TW":{"action_block_contact":"封鎖聯絡人","action_cancel":"取消","action_clear_messages":"清除訊息","action_delete_messages":"為所有人清除訊息","action_leave_chat":"離開對話","action_report_chat":"檢舉對話","archived_contacts":"已封存的聯絡人 ({count})","badge_danger":"不可信","badge_owner":"擁有者","badge_staff":"員工管理","badge_verified":"已驗證/官方","badge_you":"您","block_contact_warning":"您確定要封鎖此聯絡人嗎?","blocked_contacts_link":"已封鎖的聯絡人 ({count})","button_add_another":"新增其他人","button_add_members":"新增成員","button_cancel":"取消","button_confirm":"確認","button_create":"建立","button_delete_account":"刪除帳號","button_edit":"編輯","button_logout":"登出","button_ok":"OK","button_reset":"重設","button_send_request":"傳送要求","button_sign_in":"登入","button_sign_up":"註冊","button_subscribe":"訂閱","button_update":"更新","cannot_initiate_file_upload":"無法為檔案上傳初始化。","channel":"頻道","channel_prompt":"這是頻道","chat_invitation":"您已被邀請開始新對話。您接下來要做什麼呢?","chat_invitation_accept":"接受","chat_invitation_block":"封鎖","chat_invitation_ignore":"忽略","clear_messages_warning":"您確定要清除所有訊息嗎?此操作無法復原。","code_doesnot_match":"代碼不相符","contacts_not_found":"您沒有任何對話<br />¯∖_(ツ)_/¯","contacts_not_found_short":"沒有符合 \'\'{query}\'\' 的聯絡人","credential_email_prompt":"您的註冊電子郵件地址","delete_account":"刪除帳號","delete_account_warning":"您確定要刪除您的帳戶嗎?此操作無法撤消。","delete_messages_warning":"您確定要為所有人刪除所有訊息嗎?此操作無法復原。","deleted_content":"內容已被刪除","download_action":"下載","drafty_attachment":"附加檔案","drafty_form":"表單:","drafty_image":"圖片","email_dative":"電子郵件地址","email_prompt":"電子郵件地址,例如:jdoe@example.com","enable_peers_messaging":"啟用","enter_confirmation_code_prompt":"輸入透過 {method} 傳送給您的確認碼:","error_invalid_id":"ID 無效","file_attachment_too_large":"檔案大小 {size} 超出 {limit} 限制。","forgot_password_link":"忘記密碼?","full_name_prompt":"全名,例如:王小明","granted_permissions":"已授權","group_has_no_members":"無成員","group_user_id_prompt":"群組或使用者 ID","image_caption_prompt":"圖片說明","invalid_content":"內容無效","invalid_security_token":"安全權杖無效","label_client":"客戶端:","label_content_type":"類型:","label_default_access_mode":"預設存取模式:","label_file_name":"檔名:","label_group_members":"群組成員:","label_incognito_mode":"無痕模式:","label_message_sound":"訊息提示聲:","label_muting_topic":"靜音:","label_other_user":"其他","label_password":"密碼","label_permissions":"權限:","label_private":"私人留言","label_push_notifications":"通知:","label_push_notifications_disabled":"通知 (需要 HTTPS):","label_reset_password":"傳送重設密碼郵件:","label_sdk":"SDK:","label_server":"伺服器:","label_server_address":"伺服器位址:","label_server_to_use":"使用的伺服器:","label_size":"大小:","label_topic_name":"名稱","label_user_contacts":"聯絡人:","label_user_id":"ID:","label_wire_transport":"Wire transport:","label_you":"您:","label_your_name":"您的名字","label_your_permissions":"您的權限:","last_seen_timestamp":"最後上線","leave_chat_warning":"您確定要離開此對話嗎?","link_contact_us":"聯絡我們","link_privacy_policy":"隱私權政策","link_terms_of_service":"服務條款","login_prompt":"登入","menu_item_archive_topic":"封存","menu_item_block":"封鎖","menu_item_clear_messages":"清除訊息","menu_item_clear_messages_for_all":"為所有人清除訊息","menu_item_delete":"刪除","menu_item_delete_for_all":"為所有人刪除","menu_item_delete_topic":"刪除","menu_item_edit_permissions":"編輯權限","menu_item_info":"Info","menu_item_member_delete":"移除","menu_item_mute":"靜音","menu_item_restore_topic":"恢復","menu_item_send_retry":"重試","menu_item_unblock":"解除封鎖","menu_item_unmute":"解除靜音","message_sending":"正在傳送...","message_sending_failed":"失敗","messages_not_readable":"沒有存取訊息的權限","messaging_disabled_prompt":"停用訊息","more_online_members":"+{overflow}","new_message_prompt":"新訊息","new_password_placeholder":"輸入新的密碼","no_connection":"無連線","no_contacts":"您沒有任何聯絡人 :-(","numeric_confirmation_code_prompt":"僅數字","online_now":"上線中","password_prompt":"密碼","password_unchanged_prompt":"未修改","peers_messaging_disabled":"Peer 已停用訊息。","permission_admin":"核可 ({val})","permission_delete":"刪除 ({val})","permission_join":"加入 ({val})","permission_owner":"擁有者 ({val})","permission_pres":"收到通知 ({val})","permission_read":"讀取 ({val})","permission_share":"分享 ({val})","permission_write":"撰寫 ({val})","phone_dative":"phone","private_editing_placeholder":"僅您可見","push_init_failed":"初始化通知失敗。","reconnect_countdown":"已斷線。將在 {seconds} 秒後重新連線…","reconnect_now":"現在重試","reload_update":"重新載入","report_chat_warning":"您確定要封鎖並檢舉此對話嗎?","requested_permissions":"重新請求","save_attachment":"儲存","search_for_contacts":"使用搜尋來尋找聯絡人","search_no_results":"搜尋無結果","search_placeholder":"例如 email:alice@example.com, tel:17025550003... 的清單","sidepanel_title_acc_notifications":"通知","sidepanel_title_acc_support":"支援","sidepanel_title_account_settings":"帳號設定","sidepanel_title_archive":"已封存的對話","sidepanel_title_blocked":"已封鎖的對話","sidepanel_title_cred":"確認認證","sidepanel_title_login":"登入","sidepanel_title_newtpk":"開始新對話","sidepanel_title_register":"建立帳號","sidepanel_title_reset":"重設密碼","sidepanel_title_settings":"設定","stay_logged_in":"保持登入","tabtitle_find_user":"尋找","tabtitle_group_by_id":"以 id","tabtitle_new_group":"新群組","tags_editor_no_tags":"新增一些標籤","tags_not_found":"未定義任何標籤。請新增一些標籤。","title_all_contacts":"所有聯絡人","title_group_members":"群組成員","title_manage_tags":"管理","title_not_found":"找不到","title_permissions":"權限","title_tag_manager":"標籤 (使用者探索)","topic_block_warning":"您確定要封鎖此對話嗎?","topic_delete_warning":"您確定要刪除此對話嗎?","topic_name_editing_placeholder":"群組的任意名稱","unnamed_topic":"未命名","update_available":"有可用的更新。","upload_finishing":"正在完成...","user_not_found":"找不到","validate_credential_action":"確認","description_editing_placeholder":"說明(可選)","label_description":"說明","button_security":"安全性","panel_title_crop":"拖動調整","panel_title_general":"一般","panel_title_members":"成員","panel_title_security":"安全性","panel_title_info":"資訊","permissions_anonymous":"匿名","permissions_authenticated":"已認證","topic_delete":"刪除聊天","permissions_user":"用戶權限","password_reset_email_sent":"一封電子郵件已發送至 {email}。按照電子郵件中的說明重置密碼。","label_unarchive_topic":"存檔聊天:","menu_item_reply":"回答","menu_item_forward":"重定向","forward_to":"重定向消息","forward_to_search_placeholder":"搜索聯繫人","label_new_password":"新密碼","drafty_unknown":"不支持","calls_incoming":"來電","calls_outgoing":"撥出電話","calls_you_label":"你","menu_item_video_call":"視頻電話","already_in_call":"你已經在說話了!","call_cancelled":"取消","call_missed":"未接","call_declined":"被拒","call_disconnected":"斷開連接","label_use_secure_connection":"使用安全連接","phone_or_email_prompt":"電話號碼或電子郵件","cred_confirmed_successfully":"確認成功"},"zh":{"action_block_contact":"屏蔽联系人","action_cancel":"取消","action_clear_messages":"删除讯息","action_delete_messages":"删除所有帖子","action_leave_chat":"离开","action_report_chat":"检举垃圾邮件","archived_contacts":"已归档联系人 ({count})","badge_danger":"可疑的","badge_owner":"所有者","badge_staff":"在员工管理下","badge_verified":"值得信赖","badge_you":"你","block_contact_warning":"您确定要阻止此联系人吗?","blocked_contacts_link":"封锁的联络人 ({count})","button_add_another":"加上另一个","button_add_members":"添加成员","button_cancel":"取消","button_confirm":"确认","button_create":"创建","button_delete_account":"删除帐户","button_edit":"编辑","button_logout":"登出","button_ok":"好","button_reset":"重置","button_send_request":"发送请求","button_sign_in":"登录","button_sign_up":"注册","button_subscribe":"订阅","button_update":"更新","cannot_initiate_file_upload":"无法初始化文件上传。","channel":"频道","channel_prompt":"这是一个频道","chat_invitation":"你受邀开始新会话。你想怎么做?","chat_invitation_accept":"接受","chat_invitation_block":"屏蔽","chat_invitation_ignore":"忽略","clear_messages_warning":"您确定要清除所有消息吗?无法撤消。","code_doesnot_match":"代码不匹配","contacts_not_found":"你尚无会话<br />¯∖_(ツ)_/¯","contacts_not_found_short":"无联系人匹配\'\'{query}\'\'","credential_email_prompt":"你的注册邮箱","delete_account":"删除帐户","delete_account_warning":"您确定要删除您的帐户吗?无法撤消。","delete_messages_warning":"您确定要删除所有消息吗?无法撤消。","deleted_content":"内容已删除","download_action":"下载","drafty_attachment":"附件","drafty_form":"形式:","drafty_image":"图像","email_dative":"电子邮件","email_prompt":"电子邮件,例如 zhang@example.com","enable_peers_messaging":"启用","enter_confirmation_code_prompt":"输入通过{method}发送的验证码:","error_invalid_id":"无效 ID","file_attachment_too_large":"文件大小 {size} 超过 {limit} 限制。","forgot_password_link":"忘记密码?","full_name_prompt":"全名,例如张伟","granted_permissions":"已授予","group_has_no_members":"无成员","group_user_id_prompt":"群组或用户 ID","image_caption_prompt":"图片标题","invalid_content":"无效内容","invalid_security_token":"无效的安全令牌","label_client":"客户端:","label_content_type":"内容类型:","label_default_access_mode":"蓦然访问模式:","label_file_name":"文件名:","label_group_members":"群组成员:","label_incognito_mode":"无痕模式:","label_message_sound":"消息提示音:","label_muting_topic":"已静音:","label_other_user":"其他","label_password":"密码","label_permissions":"权限:","label_private":"私人评论","label_push_notifications":"通知提醒:","label_push_notifications_disabled":"通知提醒(需要 HTTPS):","label_reset_password":"发送密码重置邮件:","label_sdk":"开发包:","label_server":"服务器:","label_server_address":"服务器地址:","label_server_to_use":"使用的服务器:","label_size":"大小:","label_topic_name":"名称","label_user_contacts":"往来:","label_user_id":"地址:","label_wire_transport":"线路传输:","label_you":"你:","label_your_name":"你的姓名","label_your_permissions":"你的权限:","last_seen_timestamp":"最后可见","leave_chat_warning":"您确定要退出此对话吗?","link_contact_us":"联系我们","link_privacy_policy":"隐私政策","link_terms_of_service":"条款和条件","login_prompt":"登录","menu_item_archive_topic":"归档","menu_item_block":"屏蔽","menu_item_clear_messages":"清空消息","menu_item_clear_messages_for_all":"全部清除","menu_item_delete":"删除","menu_item_delete_for_all":"全部删除","menu_item_delete_topic":"删除","menu_item_edit_permissions":"编辑权限","menu_item_info":"信息","menu_item_member_delete":"移除","menu_item_mute":"静音","menu_item_restore_topic":"从存档中恢复","menu_item_send_retry":"重试","menu_item_unblock":"取消屏蔽","menu_item_unmute":"取消静音","message_sending":"正在发送...","message_sending_failed":"发送失败","messages_not_readable":"无消息访问权限","messaging_disabled_prompt":"消息已禁用","more_online_members":"还有{overflow}个","new_message_prompt":"新消息","new_password_placeholder":"输入新密码","no_connection":"无连接","no_contacts":"你尚无联系人 (._.)","numeric_confirmation_code_prompt":"仅数字","online_now":"在线","password_prompt":"密码","password_unchanged_prompt":"未改变","peers_messaging_disabled":"成员间消息已禁用。","permission_admin":"批准 ({val})","permission_delete":"删除 ({val})","permission_join":"加入 ({val})","permission_owner":"所有者 ({val})","permission_pres":"获取通知 ({val})","permission_read":"读取 ({val})","permission_share":"分享 ({val})","permission_write":"写入 ({val})","phone_dative":"电话","private_editing_placeholder":"仅自己可见","push_init_failed":"初始化推送通知失败","reconnect_countdown":"连接已断开。{seconds} 秒后重新连接…","reconnect_now":"立即尝试","reload_update":"重新载入","report_chat_warning":"您确定要停止并报告此对话吗?","requested_permissions":"已请求","save_attachment":"保存","search_for_contacts":"使用搜索寻找联系人","search_no_results":"搜索返回任何结果","search_placeholder":"列表如 email:alice@example.com, tel:+17025550003...","sidepanel_title_acc_notifications":"通知","sidepanel_title_acc_support":"支持","sidepanel_title_account_settings":"帐号设定","sidepanel_title_archive":"已存档会话","sidepanel_title_blocked":"被阻止的聊天","sidepanel_title_cred":"确认凭据","sidepanel_title_login":"登录","sidepanel_title_newtpk":"开始新会话","sidepanel_title_register":"创建账户","sidepanel_title_reset":"重置密码","sidepanel_title_settings":"设置","stay_logged_in":"保持登录","tabtitle_find_user":"搜索","tabtitle_group_by_id":"通过 id","tabtitle_new_group":"新群组","tags_editor_no_tags":"添加一些标签","tags_not_found":"尚未定义标签。添加一些。","title_all_contacts":"全部联系人","title_group_members":"群组成员","title_manage_tags":"管理标签","title_not_found":"无法找到","title_permissions":"权限","title_tag_manager":"标签(用户发现)","topic_block_warning":"您确定要阻止此对话吗?","topic_delete_warning":"您确定要删除此对话吗?","topic_name_editing_placeholder":"群组自由格式名称","unnamed_topic":"未命名","update_available":"更新可用。","upload_finishing":"正在结束...","user_not_found":"未找到","validate_credential_action":"确认","description_editing_placeholder":"说明(可选)","label_description":"说明","button_security":"安全","panel_title_crop":"拖动调整","panel_title_general":"常用设定","panel_title_members":"成员","panel_title_security":"安全","panel_title_info":"信息","permissions_anonymous":"匿名","permissions_authenticated":"已认证","topic_delete":"删除聊天","permissions_user":"用户权限","password_reset_email_sent":"一封电子邮件已发送至 {email}。按照电子邮件中的说明重置密码。","label_unarchive_topic":"存档:","menu_item_reply":"回复","menu_item_forward":"重定向","forward_to":"重定向消息","forward_to_search_placeholder":"搜索联系人","label_new_password":"新密码","drafty_unknown":"不支持","calls_incoming":"来电","calls_outgoing":"拨出电话","calls_you_label":"你","menu_item_video_call":"视频电话","already_in_call":"你已经在说话了!","call_cancelled":"取消","call_missed":"未接","call_declined":"被拒","call_disconnected":"断开连接","label_use_secure_connection":"使用安全连接","phone_or_email_prompt":"电话号码或电子邮件","cred_confirmed_successfully":"确认成功"}}'),o=function(e){const t=[];let a=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[a++]=i:i<2048?(t[a++]=i>>6|192,t[a++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[a++]=i>>18|240,t[a++]=i>>12&63|128,t[a++]=i>>6&63|128,t[a++]=63&i|128):(t[a++]=i>>12|224,t[a++]=i>>6&63|128,t[a++]=63&i|128)}return t},l={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const a=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const i=e[t],s=t+1<e.length,r=s?e[t+1]:0,o=t+2<e.length,l=o?e[t+2]:0,c=i>>2,d=(3&i)<<4|r>>4;let h=(15&r)<<2|l>>6,p=63&l;o||(p=64,s||(h=64)),n.push(a[c],a[d],a[h],a[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(o(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let a=0,n=0;for(;a<e.length;){const i=e[a++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[a++];t[n++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&e[a++])<<12|(63&e[a++])<<6|63&e[a++])-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{const s=e[a++],r=e[a++];t[n++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&r)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const a=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const i=a[e.charAt(t++)],s=t<e.length?a[e.charAt(t)]:0;++t;const r=t<e.length?a[e.charAt(t)]:64;++t;const o=t<e.length?a[e.charAt(t)]:64;if(++t,null==i||null==s||null==r||null==o)throw Error();const l=i<<2|s>>4;if(n.push(l),64!==r){const e=s<<4&240|r>>2;if(n.push(e),64!==o){const e=r<<6&192|o;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},c=function(e){return function(e){const t=o(e);return l.encodeByteArray(t,!0)}(e).replace(/\./g,"")},d=function(e){try{return l.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function h(){return"object"==typeof indexedDB}function p(){return new Promise(((e,t)=>{try{let a=!0;const n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),a||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{a=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}const u=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==a.g)return a.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,m=()=>{try{return u()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&d(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}};class g{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,a)=>{t?this.reject(t):this.resolve(a),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,a))}}}class f extends Error{constructor(e,t,a){super(t),this.code=e,this.customData=a,this.name="FirebaseError",Object.setPrototypeOf(this,f.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_.prototype.create)}}class _{constructor(e,t,a){this.service=e,this.serviceName=t,this.errors=a}create(e,...t){const a=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],s=i?function(e,t){return e.replace(v,((e,a)=>{const n=t[a];return null!=n?String(n):`<${a}?>`}))}(i,a):"Error",r=`${this.serviceName}: ${s} (${n}).`;return new f(n,r,a)}}const v=/\{\$([^}]+)}/g;function b(e,t){if(e===t)return!0;const a=Object.keys(e),n=Object.keys(t);for(const i of a){if(!n.includes(i))return!1;const a=e[i],s=t[i];if(y(a)&&y(s)){if(!b(a,s))return!1}else if(a!==s)return!1}for(const e of n)if(!a.includes(e))return!1;return!0}function y(e){return null!==e&&"object"==typeof e}function w(e){return e&&e._delegate?e._delegate:e}class E{constructor(e,t,a){this.name=e,this.instanceFactory=t,this.type=a,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const C="[DEFAULT]";class S{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new g;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const a=this.getOrInitializeService({instanceIdentifier:t});a&&e.resolve(a)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const a=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(a)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:a})}catch(e){if(n)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:C})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:a});t.resolve(e)}catch(e){}}}}clearInstance(e="[DEFAULT]"){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e="[DEFAULT]"){return this.instances.has(e)}getOptions(e="[DEFAULT]"){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,a=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(a))throw Error(`${this.name}(${a}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const n=this.getOrInitializeService({instanceIdentifier:a,options:t});for(const[e,t]of this.instancesDeferred.entries()){a===this.normalizeInstanceIdentifier(e)&&t.resolve(n)}return n}onInit(e,t){var a;const n=this.normalizeInstanceIdentifier(t),i=null!==(a=this.onInitCallbacks.get(n))&&void 0!==a?a:new Set;i.add(e),this.onInitCallbacks.set(n,i);const s=this.instances.get(n);return s&&e(s,n),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const a=this.onInitCallbacks.get(t);if(a)for(const n of a)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let a=this.instances.get(e);if(!a&&this.component&&(a=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e,n===C?void 0:n),options:t}),this.instances.set(e,a),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(a,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,a)}catch(e){}var n;return a||null}normalizeInstanceIdentifier(e="[DEFAULT]"){return this.component?this.component.multipleInstances?e:C:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class k{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new S(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const T=[];var M;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(M||(M={}));const A={debug:M.DEBUG,verbose:M.VERBOSE,info:M.INFO,warn:M.WARN,error:M.ERROR,silent:M.SILENT},D=M.INFO,I={[M.DEBUG]:"log",[M.VERBOSE]:"log",[M.INFO]:"info",[M.WARN]:"warn",[M.ERROR]:"error"},N=(e,t,...a)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),i=I[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...a)};let P,x;const R=new WeakMap,U=new WeakMap,F=new WeakMap,B=new WeakMap,L=new WeakMap;let O={get(e,t,a){if(e instanceof IDBTransaction){if("done"===t)return U.get(e);if("objectStoreNames"===t)return e.objectStoreNames||F.get(e);if("store"===t)return a.objectStoreNames[1]?void 0:a.objectStore(a.objectStoreNames[0])}return z(e[t])},set:(e,t,a)=>(e[t]=a,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function q(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x||(x=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(V(this),t),z(R.get(this))}:function(...t){return z(e.apply(V(this),t))}:function(t,...a){const n=e.call(V(this),t,...a);return F.set(n,t.sort?t.sort():[t]),z(n)}}function j(e){return"function"==typeof e?q(e):(e instanceof IDBTransaction&&function(e){if(U.has(e))return;const t=new Promise(((t,a)=>{const n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),n()},s=()=>{a(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)}));U.set(e,t)}(e),t=e,(P||(P=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,O):e);var t}function z(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,a)=>{const n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(z(e.result)),n()},s=()=>{a(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&R.set(t,e)})).catch((()=>{})),L.set(t,e),t}(e);if(B.has(e))return B.get(e);const t=j(e);return t!==e&&(B.set(e,t),L.set(t,e)),t}const V=e=>L.get(e);function H(e,t,{blocked:a,upgrade:n,blocking:i,terminated:s}={}){const r=indexedDB.open(e,t),o=z(r);return n&&r.addEventListener("upgradeneeded",(e=>{n(z(r.result),e.oldVersion,e.newVersion,z(r.transaction))})),a&&r.addEventListener("blocked",(()=>a())),o.then((e=>{s&&e.addEventListener("close",(()=>s())),i&&e.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),o}function W(e,{blocked:t}={}){const a=indexedDB.deleteDatabase(e);return t&&a.addEventListener("blocked",(()=>t())),z(a).then((()=>{}))}const K=["get","getKey","getAll","getAllKeys","count"],G=["put","add","delete","clear"],Y=new Map;function $(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Y.get(t))return Y.get(t);const a=t.replace(/FromIndex$/,""),n=t!==a,i=G.includes(a);if(!(a in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!K.includes(a))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let r=s.store;return n&&(r=r.index(t.shift())),(await Promise.all([r[a](...t),i&&s.done]))[0]};return Y.set(t,s),s}O=(e=>({...e,get:(t,a,n)=>$(t,a)||e.get(t,a,n),has:(t,a)=>!!$(t,a)||e.has(t,a)}))(O);class X{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const Q="@firebase/app",J="0.8.4",Z=new class{constructor(e){this.name=e,this._logLevel=D,this._logHandler=N,this._userLogHandler=null,T.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in M))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?A[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,M.DEBUG,...e),this._logHandler(this,M.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,M.VERBOSE,...e),this._logHandler(this,M.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,M.INFO,...e),this._logHandler(this,M.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,M.WARN,...e),this._logHandler(this,M.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,M.ERROR,...e),this._logHandler(this,M.ERROR,...e)}}("@firebase/app"),ee="[DEFAULT]",te={[Q]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},ae=new Map,ne=new Map;function ie(e,t){try{e.container.addComponent(t)}catch(a){Z.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,a)}}function se(e){const t=e.name;if(ne.has(t))return Z.debug(`There were multiple attempts to register component ${t}.`),!1;ne.set(t,e);for(const t of ae.values())ie(t,e);return!0}function re(e,t){const a=e.container.getProvider("heartbeat").getImmediate({optional:!0});return a&&a.triggerHeartbeat(),e.container.getProvider(t)}const oe=new _("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class le{constructor(e,t,a){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=a,this.container.addComponent(new E("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw oe.create("app-deleted",{appName:this._name})}}function ce(e,t={}){let a=e;if("object"!=typeof t){t={name:t}}const n=Object.assign({name:ee,automaticDataCollectionEnabled:!1},t),i=n.name;if("string"!=typeof i||!i)throw oe.create("bad-app-name",{appName:String(i)});var s;if(a||(a=null===(s=m())||void 0===s?void 0:s.config),!a)throw oe.create("no-options");const r=ae.get(i);if(r){if(b(a,r.options)&&b(n,r.config))return r;throw oe.create("duplicate-app",{appName:i})}const o=new k(i);for(const e of ne.values())o.addComponent(e);const l=new le(a,n,o);return ae.set(i,l),l}function de(e,t,a){var n;let i=null!==(n=te[e])&&void 0!==n?n:e;a&&(i+=`-${a}`);const s=i.match(/\s|\//),r=t.match(/\s|\//);if(s||r){const e=[`Unable to register library "${i}" with version "${t}":`];return s&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&r&&e.push("and"),r&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Z.warn(e.join(" "))}se(new E(`${i}-version`,(()=>({library:i,version:t})),"VERSION"))}const he="firebase-heartbeat-store";let pe=null;function ue(){return pe||(pe=H("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(he)}}).catch((e=>{throw oe.create("idb-open",{originalErrorMessage:e.message})}))),pe}async function me(e,t){var a;try{const a=(await ue()).transaction(he,"readwrite"),n=a.objectStore(he);return await n.put(t,ge(e)),a.done}catch(e){if(e instanceof f)Z.warn(e.message);else{const t=oe.create("idb-set",{originalErrorMessage:null===(a=e)||void 0===a?void 0:a.message});Z.warn(t.message)}}}function ge(e){return`${e.name}!${e.options.appId}`}class fe{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ve(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=_e();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const e=_e(),{heartbeatsToSend:t,unsentEntries:a}=function(e,t=1024){const a=[];let n=e.slice();for(const i of e){const e=a.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),be(a)>t){e.dates.pop();break}}else if(a.push({agent:i.agent,dates:[i.date]}),be(a)>t){a.pop();break}n=n.slice(1)}return{heartbeatsToSend:a,unsentEntries:n}}(this._heartbeatsCache.heartbeats),n=c(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,a.length>0?(this._heartbeatsCache.heartbeats=a,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}}function _e(){return(new Date).toISOString().substring(0,10)}class ve{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!h()&&p().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(e){var t;try{return(await ue()).transaction(he).objectStore(he).get(ge(e))}catch(e){if(e instanceof f)Z.warn(e.message);else{const a=oe.create("idb-get",{originalErrorMessage:null===(t=e)||void 0===t?void 0:t.message});Z.warn(a.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const a=await this.read();return me(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:a.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const a=await this.read();return me(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:a.lastSentHeartbeatDate,heartbeats:[...a.heartbeats,...e.heartbeats]})}}}function be(e){return c(JSON.stringify({version:2,heartbeats:e})).length}var ye;ye="",se(new E("platform-logger",(e=>new X(e)),"PRIVATE")),se(new E("heartbeat",(e=>new fe(e)),"PRIVATE")),de(Q,J,ye),de(Q,J,"esm2017"),de("fire-js","");de("firebase","9.14.0","app");const we="@firebase/installations",Ee="0.5.16",Ce=1e4,Se="w:0.5.16",ke="FIS_v2",Te=36e5,Me=new _("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function Ae(e){return e instanceof f&&e.code.includes("request-failed")}function De({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function Ie(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function Ne(e,t){const a=(await t.json()).error;return Me.create("request-failed",{requestName:e,serverCode:a.code,serverMessage:a.message,serverStatus:a.status})}function Pe({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function xe(e,{refreshToken:t}){const a=Pe(e);return a.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),a}async function Re(e){const t=await e();return t.status>=500&&t.status<600?e():t}function Ue(e){return new Promise((t=>{setTimeout(t,e)}))}const Fe=/^[cdef][\w-]{21}$/;function Be(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return Fe.test(t)?t:""}catch(e){return""}}function Le(e){return`${e.appName}!${e.appId}`}const Oe=new Map;function qe(e,t){const a=Le(e);je(a,t),function(e,t){const a=Ve();a&&a.postMessage({key:e,fid:t});He()}(a,t)}function je(e,t){const a=Oe.get(e);if(a)for(const e of a)e(t)}let ze=null;function Ve(){return!ze&&"BroadcastChannel"in self&&(ze=new BroadcastChannel("[Firebase] FID Change"),ze.onmessage=e=>{je(e.data.key,e.data.fid)}),ze}function He(){0===Oe.size&&ze&&(ze.close(),ze=null)}const We="firebase-installations-store";let Ke=null;function Ge(){return Ke||(Ke=H("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(We)}})),Ke}async function Ye(e,t){const a=Le(e),n=(await Ge()).transaction(We,"readwrite"),i=n.objectStore(We),s=await i.get(a);return await i.put(t,a),await n.done,s&&s.fid===t.fid||qe(e,t.fid),t}async function $e(e){const t=Le(e),a=(await Ge()).transaction(We,"readwrite");await a.objectStore(We).delete(t),await a.done}async function Xe(e,t){const a=Le(e),n=(await Ge()).transaction(We,"readwrite"),i=n.objectStore(We),s=await i.get(a),r=t(s);return void 0===r?await i.delete(a):await i.put(r,a),await n.done,!r||s&&s.fid===r.fid||qe(e,r.fid),r}async function Qe(e){let t;const a=await Xe(e.appConfig,(a=>{const n=function(e){return et(e||{fid:Be(),registrationStatus:0})}(a),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(Me.create("app-offline"))}}const a={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(e,t){try{const a=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:a}){const n=De(e),i=Pe(e),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const r={fid:a,authVersion:ke,appId:e.appId,sdkVersion:Se},o={method:"POST",headers:i,body:JSON.stringify(r)},l=await Re((()=>fetch(n,o)));if(l.ok){const e=await l.json();return{fid:e.fid||a,registrationStatus:2,refreshToken:e.refreshToken,authToken:Ie(e.authToken)}}throw await Ne("Create Installation",l)}(e,t);return Ye(e.appConfig,a)}catch(a){throw Ae(a)&&409===a.customData.serverCode?await $e(e.appConfig):await Ye(e.appConfig,{fid:t.fid,registrationStatus:0}),a}}(e,a);return{installationEntry:a,registrationPromise:n}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:Je(e)}:{installationEntry:t}}(e,n);return t=i.registrationPromise,i.installationEntry}));return""===a.fid?{installationEntry:await t}:{installationEntry:a,registrationPromise:t}}async function Je(e){let t=await Ze(e.appConfig);for(;1===t.registrationStatus;)await Ue(100),t=await Ze(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:a}=await Qe(e);return a||t}return t}function Ze(e){return Xe(e,(e=>{if(!e)throw Me.create("installation-not-found");return et(e)}))}function et(e){return 1===(t=e).registrationStatus&&t.registrationTime+Ce<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function tt({appConfig:e,heartbeatServiceProvider:t},a){const n=function(e,{fid:t}){return`${De(e)}/${t}/authTokens:generate`}(e,a),i=xe(e,a),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const r={installation:{sdkVersion:Se,appId:e.appId}},o={method:"POST",headers:i,body:JSON.stringify(r)},l=await Re((()=>fetch(n,o)));if(l.ok){return Ie(await l.json())}throw await Ne("Generate Auth Token",l)}async function at(e,t=!1){let a;const n=await Xe(e.appConfig,(n=>{if(!it(n))throw Me.create("not-registered");const i=n.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Te}(e)}(i))return n;if(1===i.requestStatus)return a=async function(e,t){let a=await nt(e.appConfig);for(;1===a.authToken.requestStatus;)await Ue(100),a=await nt(e.appConfig);const n=a.authToken;return 0===n.requestStatus?at(e,t):n}(e,t),n;{if(!navigator.onLine)throw Me.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(n);return a=async function(e,t){try{const a=await tt(e,t),n=Object.assign(Object.assign({},t),{authToken:a});return await Ye(e.appConfig,n),a}catch(a){if(!Ae(a)||401!==a.customData.serverCode&&404!==a.customData.serverCode){const a=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await Ye(e.appConfig,a)}else await $e(e.appConfig);throw a}}(e,t),t}}));return a?await a:n.authToken}function nt(e){return Xe(e,(e=>{if(!it(e))throw Me.create("not-registered");const t=e.authToken;return 1===(a=t).requestStatus&&a.requestTime+Ce<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var a}))}function it(e){return void 0!==e&&2===e.registrationStatus}async function st(e,t=!1){const a=e;await async function(e){const{registrationPromise:t}=await Qe(e);t&&await t}(a);return(await at(a,t)).token}function rt(e){return Me.create("missing-app-config-values",{valueName:e})}const ot="installations",lt=e=>{const t=re(e.getProvider("app").getImmediate(),ot).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:a,registrationPromise:n}=await Qe(t);return n?n.catch(console.error):at(t).catch(console.error),a.fid}(t),getToken:e=>st(t,e)}};se(new E(ot,(e=>{const t=e.getProvider("app").getImmediate(),a=function(e){if(!e||!e.options)throw rt("App Configuration");if(!e.name)throw rt("App Name");const t=["projectId","apiKey","appId"];for(const a of t)if(!e.options[a])throw rt(a);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:a,heartbeatServiceProvider:re(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),se(new E("installations-internal",lt,"PRIVATE")),de(we,Ee),de(we,Ee,"esm2017");const ct="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",dt="google.c.a.c_id";var ht,pt;function ut(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function mt(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),a=atob(t),n=new Uint8Array(a.length);for(let e=0;e<a.length;++e)n[e]=a.charCodeAt(e);return n}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(ht||(ht={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(pt||(pt={}));const gt="fcm_token_details_db",ft="fcm_token_object_Store";const _t="firebase-messaging-store";let vt=null;function bt(){return vt||(vt=H("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(_t)}})),vt}async function yt(e){const t=Et(e),a=await bt(),n=await a.transaction(_t).objectStore(_t).get(t);if(n)return n;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes(gt))return null}let t=null;return(await H(gt,5,{upgrade:async(a,n,i,s)=>{var r;if(n<2)return;if(!a.objectStoreNames.contains(ft))return;const o=s.objectStore(ft),l=await o.index("fcmSenderId").get(e);if(await o.clear(),l)if(2===n){const e=l;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(r=e.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:ut(e.vapidKey)}}}else if(3===n){const e=l;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:ut(e.auth),p256dh:ut(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:ut(e.vapidKey)}}}else if(4===n){const e=l;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:ut(e.auth),p256dh:ut(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:ut(e.vapidKey)}}}}})).close(),await W(gt),await W("fcm_vapid_details_db"),await W("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await wt(e,t),t}}async function wt(e,t){const a=Et(e),n=(await bt()).transaction(_t,"readwrite");return await n.objectStore(_t).put(t,a),await n.done,t}function Et({appConfig:e}){return e.appId}const Ct=new _("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function St(e,t){var a;const n={method:"DELETE",headers:await Tt(e)};try{const a=await fetch(`${kt(e.appConfig)}/${t}`,n),i=await a.json();if(i.error){const e=i.error.message;throw Ct.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw Ct.create("token-unsubscribe-failed",{errorInfo:null===(a=e)||void 0===a?void 0:a.toString()})}}function kt({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function Tt({appConfig:e,installations:t}){const a=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${a}`})}function Mt({p256dh:e,auth:t,endpoint:a,vapidKey:n}){const i={web:{endpoint:a,auth:t,p256dh:e}};return n!==ct&&(i.web.applicationPubKey=n),i}async function At(e){const t=await async function(e,t){const a=await e.pushManager.getSubscription();if(a)return a;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:mt(t)})}(e.swRegistration,e.vapidKey),a={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:ut(t.getKey("auth")),p256dh:ut(t.getKey("p256dh"))},n=await yt(e.firebaseDependencies);if(n){if(function(e,t){const a=t.vapidKey===e.vapidKey,n=t.endpoint===e.endpoint,i=t.auth===e.auth,s=t.p256dh===e.p256dh;return a&&n&&i&&s}(n.subscriptionOptions,a))return Date.now()>=n.createTime+6048e5?async function(e,t){try{const a=await async function(e,t){var a;const n=await Tt(e),i=Mt(t.subscriptionOptions),s={method:"PATCH",headers:n,body:JSON.stringify(i)};let r;try{const a=await fetch(`${kt(e.appConfig)}/${t.token}`,s);r=await a.json()}catch(e){throw Ct.create("token-update-failed",{errorInfo:null===(a=e)||void 0===a?void 0:a.toString()})}if(r.error){const e=r.error.message;throw Ct.create("token-update-failed",{errorInfo:e})}if(!r.token)throw Ct.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:a,createTime:Date.now()});return await wt(e.firebaseDependencies,n),a}catch(t){throw await Dt(e),t}}(e,{token:n.token,createTime:Date.now(),subscriptionOptions:a}):n.token;try{await St(e.firebaseDependencies,n.token)}catch(e){console.warn(e)}return It(e.firebaseDependencies,a)}return It(e.firebaseDependencies,a)}async function Dt(e){const t=await yt(e.firebaseDependencies);t&&(await St(e.firebaseDependencies,t.token),await async function(e){const t=Et(e),a=(await bt()).transaction(_t,"readwrite");await a.objectStore(_t).delete(t),await a.done}(e.firebaseDependencies));const a=await e.swRegistration.pushManager.getSubscription();return!a||a.unsubscribe()}async function It(e,t){const a=await async function(e,t){var a;const n=await Tt(e),i=Mt(t),s={method:"POST",headers:n,body:JSON.stringify(i)};let r;try{const t=await fetch(kt(e.appConfig),s);r=await t.json()}catch(e){throw Ct.create("token-subscribe-failed",{errorInfo:null===(a=e)||void 0===a?void 0:a.toString()})}if(r.error){const e=r.error.message;throw Ct.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw Ct.create("token-subscribe-no-token");return r.token}(e,t),n={token:a,createTime:Date.now(),subscriptionOptions:t};return await wt(e,n),n.token}function Nt(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const a=t.notification.title;a&&(e.notification.title=a);const n=t.notification.body;n&&(e.notification.body=n);const i=t.notification.image;i&&(e.notification.image=i);const s=t.notification.icon;s&&(e.notification.icon=s)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var a,n,i,s,r;if(!t.fcmOptions&&!(null===(a=t.notification)||void 0===a?void 0:a.click_action))return;e.fcmOptions={};const o=null!==(i=null===(n=t.fcmOptions)||void 0===n?void 0:n.link)&&void 0!==i?i:null===(s=t.notification)||void 0===s?void 0:s.click_action;o&&(e.fcmOptions.link=o);const l=null===(r=t.fcmOptions)||void 0===r?void 0:r.analytics_label;l&&(e.fcmOptions.analyticsLabel=l)}(t,e),t}function Pt(e,t){const a=[];for(let n=0;n<e.length;n++)a.push(e.charAt(n)),n<t.length&&a.push(t.charAt(n));return a.join("")}function xt(e){return Ct.create("missing-app-config-values",{valueName:e})}Pt("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),Pt("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class Rt{constructor(e,t,a){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const n=function(e){if(!e||!e.options)throw xt("App Configuration Object");if(!e.name)throw xt("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:a}=e;for(const e of t)if(!a[e])throw xt(e);return{appName:e.name,projectId:a.projectId,apiKey:a.apiKey,appId:a.appId,senderId:a.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:a}}_delete(){return Promise.resolve()}}async function Ut(e){var t;try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch((()=>{}))}catch(e){throw Ct.create("failed-service-worker-registration",{browserErrorMessage:null===(t=e)||void 0===t?void 0:t.message})}}async function Ft(e,t){if(!navigator)throw Ct.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw Ct.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=ct)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await Ut(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw Ct.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),At(e)}async function Bt(e,t,a){const n=function(e){switch(e){case pt.NOTIFICATION_CLICKED:return"notification_open";case pt.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(n,{message_id:a["google.c.a.c_id"],message_name:a["google.c.a.c_l"],message_time:a["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function Lt(e,t){const a=t.data;if(!a.isFirebaseMessaging)return;e.onMessageHandler&&a.messageType===pt.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(Nt(a)):e.onMessageHandler.next(Nt(a)));const n=a.data;var i;"object"==typeof(i=n)&&i&&dt in i&&"1"===n["google.c.a.e"]&&await Bt(e,a.messageType,n)}const Ot="@firebase/messaging",qt="0.11.0",jt=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>Ft(t,e)}};async function zt(){try{await p()}catch(e){return!1}return"undefined"!=typeof window&&h()&&!("undefined"==typeof navigator||!navigator.cookieEnabled)&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}function Vt(e=function(e="[DEFAULT]"){const t=ae.get(e);if(!t&&e===ee)return ce();if(!t)throw oe.create("no-app",{appName:e});return t}()){return zt().then((e=>{if(!e)throw Ct.create("unsupported-browser")}),(e=>{throw Ct.create("indexed-db-unsupported")})),re(w(e),"messaging").getImmediate()}async function Ht(e,t){return Ft(e=w(e),t)}function Wt(e){return async function(e){if(!navigator)throw Ct.create("only-available-in-window");return e.swRegistration||await Ut(e),Dt(e)}(e=w(e))}function Kt(e,t){return function(e,t){if(!navigator)throw Ct.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=w(e),t)}se(new E("messaging",(e=>{const t=new Rt(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",(e=>Lt(t,e))),t}),"PUBLIC")),se(new E("messaging-internal",jt,"PRIVATE")),de(Ot,qt),de(Ot,qt,"esm2017");const Gt=Tinode;class Yt extends t().PureComponent{render(){return this.props.visible?t().createElement("div",{className:"alert-container"},t().createElement("div",{className:"alert"},t().createElement("div",{className:"title"},this.props.title),t().createElement("div",{className:"content"},this.props.content),t().createElement("div",{className:"dialog-buttons"},this.props.onReject?t().createElement("button",{className:"outline",onClick:this.props.onReject},this.props.reject||t().createElement(s.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})):null,t().createElement("button",{className:"primary",onClick:this.props.onConfirm},this.props.confirm||t().createElement(s.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}))))):null}}const $t="0.20.2",Xt="TinodeWeb/0.20.2",Qt={hosted:"web.tinode.co",local:"localhost:6060"},Jt=Qt.hosted,Zt=3e3,ea="JRWPS",ta=13,aa=384,na=4096,ia=262144,sa=1<<23,ra=36,oa=60,la=360,ca=(0,s.defineMessages)({info:{id:"menu_item_info",defaultMessage:[{type:0,value:"Info"}]},clear_messages:{id:"menu_item_clear_messages",defaultMessage:[{type:0,value:"Clear messages"}]},clear_for_all:{id:"menu_item_clear_messages_for_all",defaultMessage:[{type:0,value:"Clear for All"}]},delete:{id:"menu_item_delete",defaultMessage:[{type:0,value:"Delete"}]},delete_for_all:{id:"menu_item_delete_for_all",defaultMessage:[{type:0,value:"Delete for All"}]},send_retry:{id:"menu_item_send_retry",defaultMessage:[{type:0,value:"Retry"}]},mute:{id:"menu_item_mute",defaultMessage:[{type:0,value:"Mute"}]},unmute:{id:"menu_item_unmute",defaultMessage:[{type:0,value:"Unmute"}]},reply:{id:"menu_item_reply",defaultMessage:[{type:0,value:"Reply"}]},forward:{id:"menu_item_forward",defaultMessage:[{type:0,value:"Forward"}]},topic_delete:{id:"menu_item_delete_topic",defaultMessage:[{type:0,value:"Delete"}]},topic_delete_warning:{id:"topic_delete_warning",defaultMessage:[{type:0,value:"Are you sure you want to delete this conversation? It cannot be undone."}]},delete_messages_warning:{id:"delete_messages_warning",defaultMessage:[{type:0,value:"Are you sure you want to delete all messages for everyone? It cannot be undone."}]},unblock:{id:"menu_item_unblock",defaultMessage:[{type:0,value:"Unblock"}]},block:{id:"menu_item_block",defaultMessage:[{type:0,value:"Block"}]},topic_block_warning:{id:"topic_block_warning",defaultMessage:[{type:0,value:"Are you sure you want to block this conversation?"}]},member_delete:{id:"menu_item_member_delete",defaultMessage:[{type:0,value:"Remove"}]},archive:{id:"menu_item_archive_topic",defaultMessage:[{type:0,value:"Archive"}]},unarchive:{id:"menu_item_restore_topic",defaultMessage:[{type:0,value:"Restore"}]},edit_permissions:{id:"menu_item_edit_permissions",defaultMessage:[{type:0,value:"Edit permissions"}]},clear_messages_warning:{id:"clear_messages_warning",defaultMessage:[{type:0,value:"Are you sure you want to clear all messages? It cannot be undone."}]}});class da extends t().Component{constructor(e){super(e),this.selfRef=t().createRef();const{formatMessage:a}=e.intl;this.handlePageClick=this.handlePageClick.bind(this),this.handleEscapeKey=this.handleEscapeKey.bind(this),this.handleClick=this.handleClick.bind(this),this.MenuItems={topic_info:{id:"topic_info",title:a(ca.info),handler:null},messages_clear:{id:"messages_clear",title:a(ca.clear_messages),handler:(t,n)=>e.onShowAlert(a(ca.clear_messages),a(ca.clear_messages_warning),(e=>{this.deleteMessages(!0,!1,t,n)}),null,!0,null)},messages_clear_hard:{id:"messages_clear_hard",title:a(ca.clear_for_all),handler:(t,n)=>e.onShowAlert(a(ca.clear_for_all),a(ca.delete_messages_warning),(e=>this.deleteMessages(!0,!0,t,n)),null,!0,null)},message_delete:{id:"message_delete",title:a(ca.delete),handler:(e,t)=>this.deleteMessages(!1,!1,e,t)},message_delete_hard:{id:"message_delete_hard",title:a(ca.delete_for_all),handler:(e,t)=>this.deleteMessages(!1,!0,e,t)},menu_item_send_retry:{id:"menu_item_send_retry",title:a(ca.send_retry),handler:(e,t)=>this.retryMessage(e,t)},menu_item_reply:{id:"menu_item_reply",title:a(ca.reply),handler:(e,t)=>this.replyToMessage(e,t)},menu_item_forward:{id:"menu_item_forward",title:a(ca.forward),handler:()=>{}},topic_unmute:{id:"topic_unmute",title:a(ca.unmute),handler:this.topicPermissionSetter.bind(this,"+P")},topic_mute:{id:"topic_mute",title:a(ca.mute),handler:this.topicPermissionSetter.bind(this,"-P")},topic_unblock:{id:"topic_unblock",title:a(ca.unblock),handler:this.topicPermissionSetter.bind(this,"+JP")},topic_block:{id:"topic_block",title:a(ca.block),handler:(t,n)=>e.onShowAlert(a(ca.block),a(ca.topic_block_warning),(()=>this.topicPermissionSetter("-JP",t,n).then((e=>(this.props.onTopicRemoved(t.topicName),e)))),null,!0,null)},topic_delete:{id:"topic_delete",title:a(ca.topic_delete),handler:(t,n)=>e.onShowAlert(a(ca.topic_delete),a(ca.topic_delete_warning),(()=>{const e=this.props.tinode.getTopic(t.topicName);if(e)return e.delTopic(!0).catch((e=>{n&&n(e.message,"err")}));console.warn("Topic not found: ",t.topicName)}),null,!0,null)},topic_archive:{id:"topic_archive",title:a(ca.archive),handler:(e,t)=>{const a=this.props.tinode.getTopic(e.topicName);if(a)return a.archive(!0).catch((e=>{t&&t(e.message,"err")}));console.warn("Topic not found: ",e.topicName)}},topic_restore:{id:"topic_restore",title:a(ca.unarchive),handler:(e,t)=>{const a=this.props.tinode.getTopic(e.topicName);if(a)return a.archive(!1).catch((e=>{t&&t(e.message,"err")}));console.warn("Topic not found: ",e.topicName)}},permissions:{id:"permissions",title:a(ca.edit_permissions),handler:null},member_delete:{id:"member_delete",title:a(ca.member_delete),handler:(e,t)=>{const a=this.props.tinode.getTopic(e.topicName);if(a&&e.user)return a.delSubscription(e.user).catch((e=>{t&&t(e.message,"err")}));console.warn("Topic or user not found: '"+e.topicName+"', '"+e.user+"'")}},member_mute:{id:"member_mute",title:a(ca.mute),handler:this.topicPermissionSetter.bind(this,"-P")},member_unmute:{id:"member_unmute",title:a(ca.unmute),handler:this.topicPermissionSetter.bind(this,"+P")},member_block:{id:"member_block",title:a(ca.block),handler:this.topicPermissionSetter.bind(this,"-JP")},member_unblock:{id:"member_unblock",title:a(ca.unblock),handler:this.topicPermissionSetter.bind(this,"+JP")}}}componentDidMount(){document.addEventListener("mousedown",this.handlePageClick,!1),document.addEventListener("keyup",this.handleEscapeKey,!1)}componentWillUnmount(){document.removeEventListener("mousedown",this.handlePageClick,!1),document.removeEventListener("keyup",this.handleEscapeKey,!1)}handlePageClick(e){this.selfRef.current.contains(e.target)||(e.preventDefault(),e.stopPropagation(),this.props.hide())}handleEscapeKey(e){27===e.keyCode&&this.props.hide()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.props.hide();let t=this.props.items[e.currentTarget.dataset.id];"string"==typeof t&&(t=this.MenuItems[t]),t?this.props.onAction(t.id,t.handler(this.props.params,this.props.onError),this.props.params):console.error("Invalid menu item ID",e.currentTarget.dataset.id)}deleteMessages(e,t,a,n){const i=this.props.tinode.getTopic(a.topicName);if(!i)return void console.warn("Topic not found: ",a.topicName);if(!e&&i.cancelSend(a.seq))return;return(e?i.delMessagesAll(t):i.delMessagesList([a.seq],t)).catch((e=>{n&&n(e.message,"err")}))}retryMessage(e,t){const a=this.props.tinode.getTopic(e.topicName);if(!a||!a.flushMessage(e.seq))return;const n=a.createMessage(e.content,!1);return a.publishDraft(n).catch((e=>{t&&t(e.message,"err")}))}topicPermissionSetter(e,t,a){const n=this.props.tinode.getTopic(t.topicName);if(!n)return void console.warn("Topic not found",t.topicName);let i=n.updateMode(t.user,e);return a&&(i=i.catch((e=>{a(e.message,"err")}))),i}replyToMessage(e,t){e.pickReply(e.seq,e.content,e.userFrom,e.userName,t)}render(){const e=[];let a=0;this.props.items.map((n=>{"string"==typeof n&&(n=this.MenuItems[n]),n&&n.title&&e.push("-"==n.title?t().createElement("li",{className:"separator",key:a}):t().createElement("li",{onClick:this.handleClick,"data-id":a,key:a},n.title)),a++}));const n=ta*(.7+2.5*e.length),i={left:(this.props.bounds.right-this.props.clickAt.x<156?this.props.clickAt.x-this.props.bounds.left-156:this.props.clickAt.x-this.props.bounds.left)+"px",top:(this.props.bounds.bottom-this.props.clickAt.y<n?this.props.clickAt.y-this.props.bounds.top-n:this.props.clickAt.y-this.props.bounds.top)+"px"};return t().createElement("ul",{className:"menu",style:i,ref:this.selfRef},e)}}const ha=(0,s.injectIntl)(da),pa={muted:"notifications_off",banned:"block",staff:"verified_user"};class ua extends t().PureComponent{render(){let e=null;return this.props.badges&&this.props.badges.length>0?(e=[],this.props.badges.map((a=>{const n=a.color?" "+a.color:"";a.icon?e.push(t().createElement("i",{className:"material-icons as-badge"+n,key:a.key||a.icon},pa[a.icon]||a.icon)):e.push(t().createElement("span",{className:"badge"+n,key:a.key||a.name},a.name))})),t().createElement(t().Fragment,null,e)):null}}function ma(e,t){let a=0|Math.floor(e/60),n=0|Math.floor(a/60);(t||n>0)&&(a=a<10?`0${a}`:a);let i=e%60|0;return i=i<10?`0${i}`:i,0==n?`${a}:${i}`:`${n}:${a}:${i}`}function ga(e){if(!e||0==e)return"0 Bytes";const t=["Bytes","KB","MB","GB","TB","PB"],a=Math.min(0|Math.floor(Math.log2(e)/10),t.length-1),n=e/Math.pow(1024,a),i=a>0?n<3?2:n<30?1:0:0;return n.toFixed(i)+" "+t[a]}function fa(e,t){return"string"!=typeof e?e:e.length>t?e.slice(0,t/2-1)+"…"+e.slice(1-t/2):e}function _a(e,t,a){return(t?"lt-":"dk-")+(a?"fg-":"bg-")+(n=e,Math.abs(function(e){let t=0;e=""+e;for(let a=0;a<e.length;a++)t=(t<<5)-t+e.charCodeAt(a),t&=t;return t}(n))%16);var n}function va(e){const t=document.getElementById("shortcut-icon"),a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("link");n.type="image/png",n.id="shortcut-icon",n.rel="shortcut icon",n.href="img/logo32x32"+(e>0?"a":"")+".png",t&&a.removeChild(t),a.appendChild(n),document.title=(e>0?"("+e+") ":"")+"Tinode"}function ba(e,t,a,n){let i=null;if((e=e&&e.trim())&&(i={fn:e}),"string"==typeof(n=n&&n.trim())&&(i=i||{},i.note=n||Gt.Tinode.DEL_CHAR),t){i=i||{};let e=a;const n=/^data:(image\/[-a-z0-9+.]+)?(;base64)?,/i.exec(t);n?(e=n[1],i.photo={data:t.substring(t.indexOf(",")+1),ref:Gt.Tinode.DEL_CHAR}):i.photo={data:Gt.Tinode.DEL_CHAR,ref:t},i.photo.type=(e||"image/jpeg").substring("image/".length)}return i}function ya(e,t){if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!=t.length)return!1;e.sort(),t.sort();for(let a=0,n=e.length;a<n;a++)if(e[a]!==t[a])return!1;return!0}function wa(e,t){if("string"!=typeof e)return e;if(e=e.replace(/[^\x20-\x7E]/gim,"").trim(),!/^([a-z][a-z0-9+.-]*:|\/\/)/i.test(e))return e;if(/^blob:http/.test(e))return e;const a=Array.isArray(t)?t.join("|"):"http|https";return new RegExp("^(("+a+"):|//)","i").test(e)?e:null}function Ea(e,t){if(!e)return null;const a=wa(e);if(a)return a;return new RegExp(`data:${t}/[a-z0-9.-]+;base64,`,"i").test(e.trim())?e:null}function Ca(e){switch(e){case Gt.Tinode.MESSAGE_STATUS_SENDING:return{name:"access_time"};case Gt.Tinode.MESSAGE_STATUS_FAILED:return{name:"warning",color:"danger-color"};case Gt.Tinode.MESSAGE_STATUS_SENT:return{name:"done"};case Gt.Tinode.MESSAGE_STATUS_RECEIVED:return{name:"done_all"};case Gt.Tinode.MESSAGE_STATUS_READ:return{name:"done_all",color:"blue"}}return null}function Sa(e){let t=!1;return{promise:e instanceof Error?Promise.reject(e):new Promise(((a,n)=>{e.then((e=>t?n({isCanceled:!0}):a(e)),(e=>n(t?{isCanceled:!0}:e)))})),cancel(){t=!0}}}function ka(e,t){return e&&e.substring(0,t)}class Ta extends t().PureComponent{render(){let e;if(!0===this.props.avatar){const a=Gt.Tinode.isGroupTopicName(this.props.topic),n=_a(this.props.topic,a);if(this.props.topic&&this.props.title&&this.props.title.trim()){const a=this.props.title.trim().charAt(0),i="lettertile "+n+(this.props.deleted?" disabled":"");e=t().createElement("div",{className:i},t().createElement("div",null,a))}else{const i="material-icons "+n+(this.props.deleted?" disabled":"");e=a?t().createElement("i",{className:i},"group"):t().createElement("i",{className:i},"person")}}else if(this.props.avatar){const a=this.props.tinode.authorizeURL(Ea(this.props.avatar,"image")),n="avatar"+(this.props.deleted?" deleted":"");e=t().createElement("img",{className:n,alt:"avatar",src:a,onError:e=>{e.target.onerror=null,e.target.src="../img/broken_image.png"}})}else e=null;return e}}class Ma extends t().PureComponent{render(){return this.props.count>0?t().createElement("span",{className:"unread"},this.props.count>9?"9+":this.props.count):null}}const Aa=["image/jpeg","image/gif","image/png","image/svg","image/svg+xml"],Da=["jpg","gif","png","svg","svg"];function Ia(e){if(e&&"object"==typeof e){if(e.ref)return e.ref;if(e.data&&e.type){return"data:"+(e.type.startsWith("image/")?e.type:"image/"+e.type)+";base64,"+e.data}}return null}function Na(e,t,a,n,i){if(t|=0,a|=0,n|=0,(e|=0)<=0||t<=0||a<=0||n<=0)return null;i&&(a=n=Math.min(a,n));const s=Math.min(Math.min(e,a)/e,Math.min(t,n)/t),r={dstWidth:e*s|0,dstHeight:t*s|0};return i?(r.dstWidth=r.dstHeight=Math.min(r.dstWidth,r.dstHeight),r.srcWidth=r.srcHeight=Math.min(e,t),r.xoffset=(e-r.srcWidth)/2|0,r.yoffset=(t-r.srcWidth)/2|0):(r.xoffset=r.yoffset=0,r.srcWidth=e,r.srcHeight=t),r}function Pa(e,t){const a=Aa.indexOf(t);if(a<0||!e)return e;const n=Da[a],i=e.lastIndexOf(".");return i>=0&&(e=e.substring(0,i)),e+"."+n}function xa(e,t,a,n,i){return new Promise(((s,r)=>{const o=new Image;o.crossOrigin="Anonymous",o.onerror=function(e){r(new Error("Image format unrecognized"))},o.onload=async function(){URL.revokeObjectURL(o.src);const l=Na(o.width,o.height,t,a,i);if(!l)return void r(new Error("Invalid image"));let c=document.createElement("canvas");c.width=l.dstWidth,c.height=l.dstHeight;let d=c.getContext("2d");d.imageSmoothingEnabled=!0,d.drawImage(o,l.xoffset,l.yoffset,l.srcWidth,l.srcHeight,0,0,l.dstWidth,l.dstHeight);const h=Aa.includes(e.type)?e.type:"image/jpeg";let p=await new Promise((e=>c.toBlob(e,h)));if(p){for(;n>0&&p.length>n;)l.dstWidth=.70710678118*l.dstWidth|0,l.dstHeight=.70710678118*l.dstHeight|0,c.width=l.dstWidth,c.height=l.dstHeight,d=c.getContext("2d"),d.clearRect(0,0,c.width,c.height),d.drawImage(o,l.xoffset,l.yoffset,l.srcWidth,l.srcHeight,0,0,l.dstWidth,l.dstHeight),p=await new Promise((e=>c.toBlob(e,h)));c=null,s({mime:h,blob:p,width:l.dstWidth,height:l.dstHeight,name:Pa(e.name,h)})}else r(new Error("Unsupported image format"))},o.src=URL.createObjectURL(e)}))}function Ra(e){return new Promise(((t,a)=>{const n=new FileReader;n.onerror=e=>{a(n.error)},n.onload=()=>{t({mime:e.type,bits:n.result.split(",")[1]})},n.readAsDataURL(e)}))}function Ua(e){if(!Array.isArray(e))return null;try{let t="";return new Uint8Array(e).forEach((e=>t+=String.fromCharCode(e))),window.btoa(t)}catch(e){}return null}function Fa(e){const t=[];try{return[...window.atob(e)].forEach((e=>{t.push(e.charCodeAt(0))})),t}catch(e){}return null}const Ba="#666C";class La extends t().PureComponent{constructor(e){super(e);let a=Fa(this.props.preview);(!Array.isArray(a)||a.length<16)&&(a=null),this.state={canPlay:!1,playing:!1,currentTime:"0:00",duration:this.props.duration>0?ma(this.props.duration/1e3):"-:--",longMin:this.props.duration>=6e5,preview:a},this.initAudio=this.initAudio.bind(this),this.initCanvas=this.initCanvas.bind(this),this.resampleBars=this.resampleBars.bind(this),this.visualize=this.visualize.bind(this),this.handlePlay=this.handlePlay.bind(this),this.handleSeek=this.handleSeek.bind(this),this.handleError=this.handleError.bind(this),this.audioPlayer=null,this.viewBuffer=[],this.canvasRef=t().createRef()}componentDidMount(){this.props.src&&this.initAudio(),this.initCanvas()}componentWillUnmount(){this.audioPlayer&&(this.audioPlayer.oncanplay=null,this.audioPlayer.ontimeupdate=null,this.audioPlayer.onended=null,this.audioPlayer.pause(),this.audioPlayer=null)}componentDidUpdate(e){if(this.props.src!=e.src&&this.initAudio(),this.props.preview!=e.preview){let e=Fa(this.props.preview);(!Array.isArray(e)||e.length<16)&&(e=null),this.setState({preview:e},this.initCanvas)}}initAudio(){this.audioPlayer=new Audio(this.props.src),this.audioPlayer.oncanplay=e=>this.setState({canPlay:!0}),this.audioPlayer.ontimeupdate=e=>this.setState({currentTime:ma(this.audioPlayer.currentTime,this.state.longMin)}),this.audioPlayer.onended=e=>{this.audioPlayer.currentTime=0,this.setState({playing:!1,currentTime:ma(0,this.state.longMin)})}}initCanvas(){this.canvasRef.current.width=2*this.canvasRef.current.offsetWidth,this.canvasRef.current.height=2*this.canvasRef.current.offsetHeight,this.canvasContext=this.canvasRef.current.getContext("2d"),this.canvasContext.lineCap="round",this.viewBuffer=this.resampleBars(this.state.preview),this.visualize()}visualize(){if(!this.canvasRef.current)return;const e=this.effectiveWidth,t=this.canvasRef.current.height;this.canvasContext.lineWidth=6;const a=()=>{if(this.canvasRef.current&&this.audioPlayer&&(this.canvasContext.clearRect(0,0,this.canvasRef.current.width,t),this.viewBuffer)){this.state.playing&&window.requestAnimationFrame(a);const n=this.props.duration?Math.max(0,Math.min(1e3*this.audioPlayer.currentTime/this.props.duration,1))*(e-12):-1;this.canvasContext.beginPath(),this.canvasContext.strokeStyle=Ba;for(let e=0;e<this.viewBuffer.length;e++){let a=1+10*e+3,i=this.viewBuffer[e]*t*.9;const s=a<n?Ba:"#888A";this.canvasContext.strokeStyle!=s&&(this.canvasContext.stroke(),this.canvasContext.beginPath(),this.canvasContext.strokeStyle=s),this.canvasContext.moveTo(a,.5*(t-i)),this.canvasContext.lineTo(a,.5*t+.5*i)}this.canvasContext.stroke(),this.props.duration&&(this.canvasContext.beginPath(),this.canvasContext.arc(n+12,.5*t,12,0,2*Math.PI),this.canvasContext.fillStyle="#444E",this.canvasContext.fill())}};a()}resampleBars(e){const t=(this.canvasRef.current.width-4)/10|0;if(this.effectiveWidth=10*t+4,!Array.isArray(e)||0==e.length)return Array.apply(null,Array(t)).map((e=>.01));const a=e.length/t;let n=[],i=-1;for(let s=0;s<t;s++){let t=s*a|0,r=(s+1)*a|0;if(r==t)n[s]=e[t];else{let a=0;for(let n=t;n<r;n++)a+=e[n];n[s]=Math.max(0,a/(r-t))}i=Math.max(n[s],i)}return i>0?n.map((e=>e/i)):Array.apply(null,Array(t)).map((e=>.01))}handlePlay(e){e.preventDefault(),this.state.canPlay&&(this.state.playing?(this.audioPlayer.pause(),this.setState({playing:!1})):(this.audioPlayer.play(),this.setState({playing:!0},this.visualize)))}handleError(e){console.error(e)}handleSeek(e){if(e.preventDefault(),e.target&&this.props.duration){const t=e.target.getBoundingClientRect(),a=(e.clientX-t.left)/this.effectiveWidth*2;this.audioPlayer.currentTime=this.props.duration*a/1e3,this.setState({currentTime:ma(this.audioPlayer.currentTime,this.state.longMin)}),this.state.playing||this.visualize()}}render(){const e="material-icons"+(this.props.short?"":" large")+(this.state.canPlay?"":" disabled"),a=t().createElement("a",{href:"#",onClick:this.handlePlay,title:"Play"},t().createElement("i",{className:e},this.state.playing?"pause_circle":this.state.canPlay?"play_circle":"not_interested"));return t().createElement("div",{className:"audio-player"},this.props.short?t().createElement(t().Fragment,null,t().createElement("canvas",{className:"playback",ref:this.canvasRef,onClick:this.handleSeek}),a):t().createElement(t().Fragment,null,a,t().createElement("div",null,t().createElement("canvas",{className:"playback",ref:this.canvasRef,onClick:this.handleSeek}),t().createElement("div",{className:"timer"},this.state.currentTime,"/",this.state.duration))))}}class Oa extends t().PureComponent{render(){const e=["declined","disconnected","missed"].includes(this.props.callState),a="material-icons medium "+(e?"red":"green"),n=this.props.incoming?e?"call_missed":"call_received":e?"call_missed_outgoing":"call_made";let i;if(e)switch(this.props.callState){case"declined":i=t().createElement(s.FormattedMessage,{id:"call_declined",defaultMessage:[{type:0,value:"declined"}]});break;case"missed":i=this.props.incoming?t().createElement(s.FormattedMessage,{id:"call_missed",defaultMessage:[{type:0,value:"missed"}]}):t().createElement(s.FormattedMessage,{id:"call_cancelled",defaultMessage:[{type:0,value:"cancelled"}]});break;default:i=t().createElement(s.FormattedMessage,{id:"call_disconnected",defaultMessage:[{type:0,value:"disconnected"}]})}else i=t().createElement("span",null,ma(this.props.duration/1e3));return t().createElement("div",{className:"call-message"},t().createElement("div",null,t().createElement("i",{className:"material-icons big gray"},"call")),t().createElement("div",{className:"flex-column narrow"},t().createElement("div",null,this.props.incoming?t().createElement(s.FormattedMessage,{id:"calls_incoming",defaultMessage:[{type:0,value:"Incoming call"}]}):t().createElement(s.FormattedMessage,{id:"calls_outgoing",defaultMessage:[{type:0,value:"Outgoing call"}]})),t().createElement("div",{className:"duration"},t().createElement("i",{className:a},n)," ",i)))}}class qa extends t().PureComponent{render(){const e=["declined","disconnected","missed"].includes(this.props.callState),a=this.props.incoming?e?"call_missed":"call_received":e?"call_missed_outgoing":"call_made";let n;if(e)switch(this.props.callState){case"declined":n=t().createElement(s.FormattedMessage,{id:"call_declined",defaultMessage:[{type:0,value:"declined"}]});break;case"missed":n=this.props.incoming?t().createElement(s.FormattedMessage,{id:"call_missed",defaultMessage:[{type:0,value:"missed"}]}):t().createElement(s.FormattedMessage,{id:"call_cancelled",defaultMessage:[{type:0,value:"cancelled"}]});break;default:n=t().createElement(s.FormattedMessage,{id:"call_disconnected",defaultMessage:[{type:0,value:"disconnected"}]})}else n=t().createElement("span",null,ma(this.props.duration/1e3));return t().createElement(t().Fragment,null,t().createElement("div",{className:"composed-material"},t().createElement("i",{className:"material-icons"},"call"),t().createElement("i",{className:"material-icons second"},a))," ",n)}}class ja extends t().PureComponent{constructor(e){super(e),this.state={src:"img/placeholder.png",style:Object.assign({padding:"4px"},this.props.style),className:this.props.className,alt:this.props.alt,onClick:this.props.onClick}}componentDidMount(){this.props.whenDone.promise.then((e=>this.setState({src:e.src,style:{...this.state.style,padding:0}}))).catch((()=>this.setState({src:"img/broken_image.png"})))}componentWillUnmount(){this.props.whenDone.cancel()}componentDidUpdate(e){e.whenDone!=this.props.whenDone&&(this.setState({src:"img/placeholder.png",style:{...this.state.style,padding:"4px"}}),this.props.whenDone.promise.then((e=>this.setState({src:e.src,style:{...this.state.style,padding:0}}))).catch((()=>this.setState({src:"img/broken_image.png"}))))}render(){return t().createElement("img",this.state)}}class za extends t().PureComponent{render(){return t().createElement("div",{className:"uploader"},t().createElement("div",null,t().createElement("span",{style:{width:100*this.props.progress+"%"}})),this.props.progress<.999?t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCancel()}},t().createElement("i",{className:"material-icons"},"close")," ",t().createElement(s.FormattedMessage,{id:"action_cancel",defaultMessage:[{type:0,value:"cancel"}]})):t().createElement(s.FormattedMessage,{id:"upload_finishing",defaultMessage:[{type:0,value:"finishing..."}]}))}}class Va extends t().PureComponent{constructor(e){super(e)}render(){return t().createElement("div",{className:"inline-image"},t().createElement("img",this.props),t().createElement("div",{className:"rounded-container"},t().createElement(za,{progress:this.props.progress,onCancel:this.props.onCancelUpload})))}}const Ha=(0,s.defineMessages)({drafty_form:{id:"drafty_form",defaultMessage:[{type:0,value:"Form:"}]},drafty_attachment:{id:"drafty_attachment",defaultMessage:[{type:0,value:"Attachment"}]},drafty_image:{id:"drafty_image",defaultMessage:[{type:0,value:"Picture"}]},drafty_unknown:{id:"drafty_unknown",defaultMessage:[{type:0,value:"Unsupported"}]}});function Wa(e,t,a){if(!t)return a.src="img/broken_image.png",a.style={width:"36px",height:"36px"},e;a.className="inline-image";const n=Na(t.width,t.height,this.viewportWidth>0?Math.min(this.viewportWidth-84.5,448.5):448.5,312,!1)||{dstWidth:32,dstHeight:32};return a.style={width:n.dstWidth+"px",height:n.dstHeight+"px",minWidth:n.dstWidth+"px",minHeight:n.dstHeight+"px"},Gt.Drafty.isProcessing(t)?e=Va:(a.src=this.authorizeURL(Ea(a.src,"image")),a.alt=t.name,a.src?(Math.max(t.width||0,t.height||0)>ra&&(a.onClick=this.onImagePreview,a.className+=" image-clickable"),a.loading="lazy"):a.src="img/broken_image.png"),e}function Ka(e,a,n,i,s){if(s.includes("QQ"))return $a.call(this,e,a,n,i);if(!e)return n;let r=Gt.Drafty.tagName(e),o=Gt.Drafty.attrValue(e,a)||{};switch(o.key=i,e){case"AU":o.src&&(o.src=this.authorizeURL(Ea(o.src,"audio")),o.duration=a.duration>0?0|a.duration:void 0,o.preview=a.preview,o.loading="lazy"),r=La,n=null;break;case"BR":n=null;break;case"EX":case"RW":break;case"HL":o.className="highlight";break;case"HD":r=null,n=null;break;case"IM":r=Wa.call(this,r,a,o),n=null;break;case"BN":o.onClick=this.onFormButtonClick;let e=t().Children.map(n,(e=>"string"==typeof e?e:void 0));e&&0!=e.length||(e=[o.name]),o["data-title"]=e.join("");break;case"MN":o.className="mention",a&&(o.className+=" "+_a(a.val,!1,!0));break;case"FM":o.className="bot-form";break;case"QQ":o.className="reply-quote",o.onClick=this.onQuoteClick;break;case"VC":r=Oa,n=null,a&&(o.callState=a.state,o.incoming=a.incoming,o.duration=a.duration);break;default:if(!r){r=t().Fragment,o={key:i};let e=n;Array.isArray(n)&&n.join("").trim()||(e=[t().createElement("span",{key:"x1",className:"gray"},this.formatMessage(Ha.drafty_unknown))]),n=[t().createElement("i",{key:"x0",className:"material-icons gray"},"extension")," "].concat(e)}}return r?t().createElement(r,o,n):n}function Ga(e,a,n,i){if(!e)return n;let s=Gt.Drafty.tagName(e);const r={key:i};switch(e){case"AU":s=t().Fragment,n=[t().createElement("i",{key:"au",className:"material-icons"},"mic")," ",ma(a.duration/1e3)];break;case"BR":s=t().Fragment,n=[" "];break;case"HL":r.className="highlight preview";break;case"LN":case"MN":s="span";break;case"IM":s=t().Fragment,n=[t().createElement("i",{key:"im",className:"material-icons"},"photo")," ",this.formatMessage(Ha.drafty_image)];break;case"BN":s="span",r.className="flat-button faux";break;case"FM":s=t().Fragment,n=[t().createElement("i",{key:"fm",className:"material-icons"},"dashboard"),this.formatMessage(Ha.drafty_form)].concat(" ",n||[]);break;case"RW":s=t().Fragment;break;case"EX":if(a){if("application/json"==a.mime)return null;delete a.val,delete a.ref}s=t().Fragment,n=[t().createElement("i",{key:"ex",className:"material-icons"},"attachment")," ",this.formatMessage(Ha.drafty_attachment)];break;case"VC":s=qa,a&&(r.callState=a.state,r.incoming=a.incoming,r.duration=a.duration),n=null;break;case"QQ":case"HD":s=null,n=null;break;default:s||(s=t().Fragment,n=[t().createElement("i",{key:"x0",className:"material-icons gray"},"extension")," ",this.formatMessage(Ha.drafty_unknown)])}return s?t().createElement(s,r,n):n}function Ya(e,t){return e.style={width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px"},e.className="inline-image",e.alt=this.formatMessage(Ha.drafty_image),t||(e.src="img/broken_image.png"),e.title=e.alt,e}function $a(e,a,n,i){if(["BR","EX","IM","MN"].includes(e)){let s=Gt.Drafty.tagName(e),r=Gt.Drafty.attrValue(e,a)||{};switch(r.key=i,e){case"BR":n=null;break;case"IM":r=Ya.call(this,r,a),n=[t().createElement("img",r,null)," ",r.alt],s=t().Fragment,r={key:i};break;case"MN":s="span",r.className="mention",a&&(r.className+=" "+_a(a.val,!1,!0));break;case"EX":let e;if(a){if("application/json"==a.mime)return null;e=a.name,delete a.val,delete a.ref}s=t().Fragment,n=[t().createElement("i",{key:"ex",className:"material-icons"},"attachment"),fa(e,16)||this.formatMessage(Ha.drafty_attachment)]}return t().createElement(s,r,n)}return Ga.call(this,e,a,n,i)}function Xa(e){let t;if(e.val){const a=function(e,t){if(!e)return null;try{const a=atob(e),n=a.length,i=new ArrayBuffer(n),s=new Uint8Array(i);for(let e=0;e<n;e++)s[e]=a.charCodeAt(e);return new Blob([i],{type:t})}catch(e){console.error("Failed to convert base64 to blob: ",e)}return null}(e.val,e.mime);if(!a)throw new Error("Invalid image");t=Promise.resolve(a)}else{if(!e.ref)throw new Error("Missing image data");t=fetch(this.authorizeURL(Ea(e.ref,"image"))).then((e=>{if(e.ok)return e.blob();throw new Error(`Image fetch unsuccessful: ${e.status} ${e.statusText}`)}))}return t.then((e=>xa(e,ra,ra,-1,!0))).then((t=>(e.mime=t.mime,e.size=t.blob.size,e.width=t.width,e.height=t.height,delete e.ref,e.src=URL.createObjectURL(t.blob),Ra(t.blob)))).then((t=>(e.val=t.bits,e))).catch((t=>{throw delete e.val,delete e.src,e.width=ra,e.height=ra,t}))}function Qa(e,a,n,i,s){if("IM"==e){const e=Ya.call(this,{key:i},a);let s;try{s=Sa(Xa.call(this,a))}catch(e){s=Sa(e)}return e.whenDone=s,n=[t().createElement(ja,e,null)," ",e.alt],t().createElement(t().Fragment,{key:i},n)}if("QQ"==e){if(s.includes("QQ"))return t().createElement("span",{key:i},[t().createElement("i",{key:"qq",className:"material-icons"},"format_quote")," "]);const e=Gt.Drafty.attrValue("QQ",a)||{};return e.key=i,e.className="reply-quote",t().createElement(Gt.Drafty.tagName("QQ"),e,n)}return $a.call(this,e,a,n,i)}class Ja extends t().Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleContextClick=this.handleContextClick.bind(this)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.props.onSelected&&this.props.onSelected(this.props.item,this.props.index)}handleContextClick(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.props.item,y:e.pageY,x:e.pageX})}render(){let e=this.props.title;e?e.length>30&&(e=e.substring(0,28)+"…"):e=t().createElement("i",null,t().createElement(s.FormattedMessage,{id:"unnamed_topic",defaultMessage:[{type:0,value:"Unnamed"}]}));const a=this.props.now?"online":"offline",n=!this.props.avatar||this.props.avatar,i=this.props.badges?this.props.badges.slice():[],r=[];let o;this.props.isVerified&&r.push({icon:"verified",color:"verified-color"}),this.props.isStaff&&r.push({icon:"staff",color:"staff-color"}),this.props.isDangerous&&r.push({icon:"dangerous",color:"danger-color"}),this.props.acs&&(this.props.showMode&&i.push({name:this.props.acs.getMode(),key:"mode"}),this.props.acs.isMuted()&&r.push({icon:"muted"}),this.props.acs.isJoiner()||r.push({icon:"banned"})),"string"==typeof this.props.preview?o=this.props.preview:Gt.Drafty.isValid(this.props.preview)?o=t().createElement(t().Fragment,null,Gt.Drafty.format(this.props.preview,Ga,{formatMessage:this.props.intl.formatMessage,previewIsResponse:this.props.previewIsResponse})):this.props.preview&&(o=t().createElement(t().Fragment,null,t().createElement("i",{className:"material-icons gray"},"warning_amber")," ",t().createElement("i",{className:"gray"},t().createElement(s.FormattedMessage,{id:"invalid_content",defaultMessage:[{type:0,value:"invalid content"}]}))));const l=Ca(this.props.received),c=l?t().createElement("i",{className:"material-icons small space-right"+(l.color?" "+l.color:"")},l.name):null,d="contact-title"+(this.props.deleted?" deleted":"");return t().createElement("li",{className:!this.props.showCheckmark&&this.props.selected?"selected":null,onClick:this.handleClick},t().createElement("div",{className:"avatar-box"},t().createElement(Ta,{tinode:this.props.tinode,avatar:n,title:this.props.title,topic:this.props.item,deleted:this.props.deleted}),this.props.deleted?t().createElement("i",{className:"deleted material-icons"},"cancel"):this.props.showOnline?t().createElement("span",{className:a}):this.props.showCheckmark&&this.props.selected?t().createElement("i",{className:"checkmark material-icons"},"check_circle"):null),t().createElement("div",{className:"text-box"},t().createElement("div",null,t().createElement("span",{className:d},e),this.props.isChannel?t().createElement("img",{src:"/img/channel.png",className:"channel",alt:"channel"}):null,t().createElement(ua,{badges:r}),this.props.deleted?null:t().createElement(Ma,{count:this.props.unread})),this.props.showMode?t().createElement("span",null,t().createElement(ua,{badges:i})):this.props.small?null:t().createElement("div",{className:"contact-comment"},c,t().createElement("span",null,o||this.props.comment||" "))),this.props.showContextMenu?t().createElement("span",{className:"menuTrigger"},t().createElement("a",{href:"#",onClick:this.handleContextClick},t().createElement("i",{className:"material-icons"},"expand_more"))):null)}}const Za=(0,s.injectIntl)(Ja);class en extends t().PureComponent{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.props.onAction(this.props.action)}render(){const{formatMessage:e}=this.props.intl;return t().createElement("li",{onClick:this.handleClick,className:"action"},t().createElement("div",{className:"action-text"},e(this.props.title,this.props.values)))}}const tn=(0,s.injectIntl)(en),an=(0,s.defineMessages)({badge_you:{id:"badge_you",defaultMessage:[{type:0,value:"you"}]},badge_owner:{id:"badge_owner",defaultMessage:[{type:0,value:"owner"}]}});class nn extends t().Component{render(){const{formatMessage:e}=this.props.intl,a=Array.isArray(this.props.topicSelected),n=[];let i=0;return this.props.contacts&&this.props.contacts.length>0&&this.props.contacts.map((s=>{if(s.action)n.push(t().createElement(tn,{title:s.title,action:s.action,values:s.values,key:s.action,onAction:this.props.onAction}));else{const r=this.props.showMode?s.user:s.topic||s.user;if(this.props.filterFunc&&this.props.filter){const e=[r];if(s.private&&s.private.comment&&e.push((""+s.private.comment).toLowerCase()),s.public&&s.public.fn&&e.push((""+s.public.fn).toLowerCase()),!this.props.filterFunc(this.props.filter,e))return}const o=Gt.Tinode.isChannelTopicName(r),l=a?this.props.topicSelected.indexOf(r)>-1:this.props.topicSelected===r,c=[];this.props.showMode&&(r==this.props.myUserId&&c.push({name:e(an.badge_you),color:"green"}),s.acs&&s.acs.isOwner()&&c.push({name:e(an.badge_owner),color:"blue"}));const d=Array.isArray(s.private)?s.private.join(","):s.private?s.private.comment:null;let h,p,u,m;if(!this.props.showMode&&s.latestMessage){const e=s.latestMessage(!0);e&&(p=e.head?e.head.forwarded:null,m=e._status||s.msgStatus(e,!0),u=e.from!=this.props.myUserId,e.content&&(h="string"==typeof e.content?e.content.substr(0,80):Gt.Drafty.preview(e.content,80)))}n.push(t().createElement(Za,{tinode:this.props.tinode,title:s.public?s.public.fn:null,avatar:Ia(s.public?s.public.photo:null),comment:d,preview:h,previewIsResponse:u,forwarded:p,received:m,unread:this.props.showUnread?s.unread:0,now:s.online&&this.props.connected,acs:s.acs,showMode:this.props.showMode,badges:c,showCheckmark:a,selected:l,showOnline:this.props.showOnline&&!o,isChannel:o,showContextMenu:this.props.showContextMenu,isVerified:s.trusted&&s.trusted.verified,isStaff:s.trusted&&s.trusted.staff,isDangerous:s.trusted&&s.trusted.danger,deleted:s._deleted,onSelected:this.props.onTopicSelected,item:r,index:n.length,key:r})),i++}}),this),t().createElement("div",{className:this.props.noScroll?null:"scrollable-panel"},0==i?t().createElement("div",{className:"center-medium-text",dangerouslySetInnerHTML:{__html:this.props.emptyListMessage}}):null,n.length>0?t().createElement("ul",{className:"contact-box"},n):null)}}const sn=(0,s.injectIntl)(nn);class rn extends t().PureComponent{constructor(e){super(e),this.state={edited:!1,search:""},this.handleSearchChange=this.handleSearchChange.bind(this),this.handleSearch=this.handleSearch.bind(this),this.handleClear=this.handleClear.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentWillUnmount(){this.state.edited&&(this.setState({search:"",edited:!1}),this.props.onSearchContacts(Gt.Tinode.DEL_CHAR))}handleSearchChange(e){this.setState({search:e.target.value})}handleSearch(e){e.preventDefault();var t=this.state.search.trim();this.setState({edited:t.length>0}),this.props.onSearchContacts(t.length>0?t:Gt.Tinode.DEL_CHAR)}handleClear(e){e.preventDefault(),this.state.edited&&this.props.onSearchContacts(Gt.Tinode.DEL_CHAR),this.setState({search:"",edited:!1})}handleKeyDown(e){"Enter"===e.key?this.handleSearch(e):"Escape"===e.key&&this.handleClear()}render(){return t().createElement("div",{className:"panel-form"},t().createElement("div",{className:"panel-form-row"},t().createElement("i",{className:"material-icons search"},"search"),t().createElement("input",{className:"search",type:"text",placeholder:this.props.placeholder,value:this.state.search,onChange:this.handleSearchChange,onKeyDown:this.handleKeyDown,required:!0,autoFocus:!0}),this.state.search?t().createElement("a",{href:"#",onClick:this.handleClear},t().createElement("i",{className:"material-icons"},"highlight_off")):t().createElement("span",null,t().createElement("i",{className:"material-icons"}," "))))}}class on extends t().Component{constructor(e){super(e),this.state={query:null},this.handleEscapeKey=this.handleEscapeKey.bind(this),this.handleClose=this.handleClose.bind(this),this.handleSearchContacts=this.handleSearchContacts.bind(this),this.handleContactSelected=this.handleContactSelected.bind(this)}componentDidMount(){this.props.onInitFind()}handleEscapeKey(e){27===e.keyCode&&this.props.hide(!1)}handleClose(e){e.preventDefault(),this.props.hide(!1)}handleSearchContacts(e){this.setState({query:Gt.Tinode.isNullValue(e)?null:e}),this.props.onSearchContacts(e)}handleContactSelected(e){this.props.onTopicSelected(e),this.props.hide(!0)}render(){let e=null!=this.state.query?this.props.searchResults:this.props.contacts;return e=e.filter((e=>e.name!=this.props.topicSelected&&e.acs.isJoiner()&&e.acs.isWriter())),t().createElement("div",{className:"alert-container"},t().createElement("div",{className:"forward-dialog"},t().createElement("div",{className:"title with-control"},t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"forward_to",defaultMessage:[{type:0,value:"Forward to"}],desription:"Title of the contact selector dialog when forwarding a message"})),t().createElement("div",null,t().createElement("a",{href:"#",onClick:this.handleClose},t().createElement("i",{className:"material-icons"},"close")))),t().createElement(s.FormattedMessage,{id:"forward_to_search_placeholder",defaultMessage:[{type:0,value:"Search contacts"}]},(e=>t().createElement(rn,{placeholder:e,onSearchContacts:this.handleSearchContacts}))),t().createElement(s.FormattedMessage,{id:"search_no_results",defaultMessage:[{type:0,value:"Search returned no results"}]},(a=>t().createElement(sn,{tinode:this.props.tinode,contacts:e,myUserId:this.props.myUserId,emptyListMessage:a,showOnline:!1,showUnread:!1,showContextMenu:!1,onTopicSelected:this.handleContactSelected})))))}}const ln={staff:"verified_user"},cn=(0,s.defineMessages)({badge_verified:{id:"badge_verified",defaultMessage:[{type:0,value:"Verified/official"}]},badge_staff:{id:"badge_staff",defaultMessage:[{type:0,value:"Staff-managed"}]},badge_danger:{id:"badge_danger",defaultMessage:[{type:0,value:"Untrustworthy"}]}});class dn extends t().PureComponent{render(){const{formatMessage:e}=this.props.intl;let a=null;return this.props.trustedBadges&&this.props.trustedBadges.length>0?(a=[],this.props.trustedBadges.map((n=>{const i=this.props.short?null:e(cn["badge_"+n]),s="material-icons "+n+"-color";a.push(t().createElement("div",{className:"trusted-badge",key:n},t().createElement("i",{className:s},ln[n]||n)," ",i))})),t().createElement(t().Fragment,null,a)):null}}const hn=(0,s.injectIntl)(dn),pn="started",un=new Audio("audio/call-in.m4a");class mn extends t().Component{constructor(e){super(e),this.state={topic:null,fullName:void 0,avatar:null,trustedBadges:[],previousMetaDesc:void 0},this.resetDesc=this.resetDesc.bind(this),this.onMetaDesc=this.onMetaDesc.bind(this),this.handleRejectCall=this.handleRejectCall.bind(this),this.handleAcceptCall=this.handleAcceptCall.bind(this),this.ringTimer=null}componentDidMount(){const e=this.props.tinode.getTopic(this.props.topic);e&&(this.resetDesc(e,this.props),2==this.props.callState&&(un.play().catch((e=>{})),this.ringTimer=setInterval((e=>{un.play().catch((e=>{}))}),2e3),this.props.onRinging(this.props.topic,this.props.seq)))}componentDidUpdate(e){const t=this.props.tinode.getTopic(e.topic);t&&(this.onMetaDesc!=t.onMetaDesc&&(this.previousMetaDesc=t.onMetaDesc,t.onMetaDesc=this.onMetaDesc),this.state.topic!=e.topic&&(this.setState({topic:e.topic}),this.resetDesc(t,e)))}componentWillUnmount(){null!=this.ringTimer&&(clearInterval(this.ringTimer),un.pause());const e=this.props.tinode.getTopic(this.props.topic);e&&(this.setState({topic:null}),e.onMetaDesc=this.previousMetaDesc)}resetDesc(e,t){e.getDefaultAccess(),e.getAccessMode();const a=[];if(e.trusted)for(const[t,n]of Object.entries(e.trusted))n&&a.push(t);this.setState({fullName:ka(e.public?e.public.fn:void 0,oa),avatar:Ia(e.public?e.public.photo:null),trustedBadges:a})}onMetaDesc(e){const t=this.props.tinode.getTopic(this.props.topic);t&&(this.resetDesc(t,this.props),this.previousMetaDesc&&this.previousMetaDesc!=this.onMetaDesc&&this.previousMetaDesc(e))}handleAcceptCall(){this.props.onAcceptCall(this.props.topic)}handleRejectCall(){this.props.onReject(this.props.topic,this.props.seq),this.props.onClose()}render(){return t().createElement("div",{className:"alert-container"},t().createElement("div",{className:"incoming-call"},t().createElement("div",{className:"caller-card incoming pulse"},t().createElement("div",{className:"avatar-box"},t().createElement(Ta,{tinode:this.props.tinode,avatar:this.state.avatar||!0,topic:this.props.topic,title:this.state.fullName})),t().createElement("div",{className:"caller-name"},ka(this.state.fullName,20),t().createElement(hn,{short:!0,trustedBadges:this.state.trustedBadges}))),t().createElement("div",{className:"controls"},2==this.props.callState?t().createElement(t().Fragment,null,t().createElement("button",{className:"danger",onClick:this.handleRejectCall},t().createElement("i",{className:"material-icons"},"call_end")),t().createElement("button",{className:"positive",onClick:this.handleAcceptCall},t().createElement("i",{className:"material-icons"},"call"))):null)))}}class gn extends t().PureComponent{render(){const e="load-spinner-box"+(this.props.large?" large":"")+(this.props.clear?" clear":"")+(this.props.centered?" centered":"");return this.props.show?t().createElement("div",{className:e},t().createElement("div",{className:"loader-spinner"})):null}}class fn extends t().Component{constructor(e){super(e),this.state={source:e.avatar},this.handleFileReceived=this.handleFileReceived.bind(this)}componentDidUpdate(e){this.props.avatar!=e.avatar&&this.setState({source:this.props.avatar})}handleFileReceived(e){const t=e.target.files[0];this.props.onImageUpdated(t.type,URL.createObjectURL(t),t.name),e.target.value=""}render(){const e="file-input-avatar-"+(""+Math.random()).substring(0,4),a="avatar-upload"+(this.props.readOnly?" read-only":"");return t().createElement("div",{className:a},this.props.readOnly||!this.state.source?null:t().createElement("a",{href:"#",className:"clear-avatar",onClick:e=>{e.preventDefault(),this.props.onImageUpdated()}},t().createElement("i",{className:"material-icons"},"clear")),this.state.source?t().createElement("img",{src:this.props.tinode.authorizeURL(Ea(this.state.source,"image")),className:"preview"}):this.props.readOnly&&this.props.uid?t().createElement("div",{className:"avatar-box"},t().createElement(Ta,{tinode:this.props.tinode,avatar:!0,topic:this.props.uid,title:this.props.title})):t().createElement("div",{className:"blank"},aa,"×",aa),this.props.readOnly?null:t().createElement("input",{type:"file",id:e,className:"inputfile hidden",accept:"image/*",onChange:this.handleFileReceived}),this.props.readOnly?null:t().createElement("label",{htmlFor:e,className:"round"},t().createElement("i",{className:"material-icons"},"file_upload")),t().createElement(gn,{show:this.props.uploading,large:!0,clear:!0,centered:!0}))}}class _n extends t().PureComponent{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(){this.props.onChange(this.props.name,!this.props.checked)}render(){let e,a=["material-icons"];Array.isArray(this.props.className)?a.push(...this.props.className):this.props.className&&a.push(this.props.className),this.props.onChange?this.props.checked?(a.push("blue","clickable"),e="check_box"):!1===this.props.checked?(a.push("blue","clickable"),e="check_box_outline_blank"):(a.push("lt-blue"),e="indeterminate_check_box"):e=this.props.checked?"check_box":"check_box_outline_blank";let n={className:a.join(" "),id:this.props.id};return this.props.onChange&&(n.onClick=this.handleChange),t().createElement("i",n,e)}}class vn extends t().PureComponent{render(){return t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCancel()}},t().createElement("i",{className:"material-icons"},"close"))}}class bn extends t().PureComponent{constructor(e){super(e),this.state={show:!1},this.hide=this.hide.bind(this)}componentDidUpdate(e){e.level!==this.props.level&&this.setState({show:!!this.props.level})}hide(){this.setState({show:!1}),this.props.onClearError&&this.props.onClearError()}render(){const e={err:"error",warn:"warning",info:"info"}[this.props.level]||"",a="info-box "+e;return t().createElement("div",{className:a},t().createElement("div",{className:"icon"},t().createElement("i",{className:"material-icons"},e)),t().createElement("span",null,this.props.text,this.props.action?t().createElement(t().Fragment,null,t().createElement("a",{href:"#",style:{whiteSpace:"nowrap"},onClick:e=>{e.preventDefault(),this.props.action()}},this.props.actionText)):null),t().createElement("div",{className:"cancel"},t().createElement(vn,{onCancel:this.hide})))}}class yn extends t().PureComponent{constructor(e){super(e),this.handleCancel=this.handleCancel.bind(this)}handleCancel(e){e.preventDefault(),this.props.onCancel(this.props.topic,this.props.index)}render(){const e=this.props.title||this.props.topic,a=this.props.invalid?"chip invalid":"chip";return t().createElement("div",{className:a},this.props.noAvatar?t().createElement("span",{className:"spacer"}):t().createElement("div",{className:"avatar-box"},t().createElement(Ta,{tinode:this.props.tinode,avatar:this.props.avatar||!0,topic:this.props.topic,title:this.props.title})),t().createElement("span",null,e),this.props.onCancel&&!this.props.required?t().createElement("a",{href:"#",onClick:this.handleCancel},"×"):t().createElement("span",{className:"spacer"}))}}class wn extends t().Component{constructor(e){super(e),this.state=wn.deriveStateFromProps(e),this.state.input="",this.state.focused=!1,this.handleTextInput=this.handleTextInput.bind(this),this.removeChipAt=this.removeChipAt.bind(this),this.handleChipCancel=this.handleChipCancel.bind(this),this.handleFocusGained=this.handleFocusGained.bind(this),this.handleFocusLost=this.handleFocusLost.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}static deriveStateFromProps(e){return{placeholder:e.chips?"":e.prompt,sortedChips:wn.sortChips(e.chips,e.staticMembers),chipIndex:wn.indexChips(e.chips)}}componentDidUpdate(e,t){e.chips==this.props.chips&&e.staticMembers==this.props.staticMembers&&e.prompt==this.props.prompt||this.setState(wn.deriveStateFromProps(this.props)),(!t||this.props.chips.length>t.sortedChips.length)&&this.setState({input:""})}static indexChips(e){const t={};let a=0;return e.map((e=>{t[e.user]=a,a++})),t}static sortChips(e,t){const a=[],n=[];return e.map((e=>{t&&t.includes(e.user)?a.push(e):n.push(e)})),a.concat(n)}handleTextInput(e){this.setState({input:e.target.value}),this.props.filterFunc&&this.props.filterFunc(e.target.value)}removeChipAt(e){const t=this.state.sortedChips[e];this.props.onChipRemoved(t.user,this.state.chipIndex[t.user])}handleChipCancel(e,t){this.removeChipAt(t)}handleFocusGained(){this.setState({focused:!0})}handleFocusLost(){this.setState({focused:!1}),this.props.onFocusLost&&this.props.onFocusLost(this.state.input)}handleKeyDown(e){if("Backspace"===e.key){if(0==this.state.input.length&&this.state.sortedChips.length>0){const e=this.state.sortedChips.length-1;this.state.sortedChips[e].user!==this.props.staticMembers&&this.removeChipAt(e)}}else"Enter"===e.key?this.props.onEnter&&this.props.onEnter(this.state.input):"Escape"===e.key&&this.props.onCancel&&this.props.onCancel()}render(){const e=[];let a=0;const n=this.props.staticMembers||[];this.state.sortedChips.map((i=>{e.push(t().createElement(yn,{tinode:this.props.tinode,onCancel:this.handleChipCancel,avatar:Ia(i.public?i.public.photo:null),title:i.public?i.public.fn:void 0,noAvatar:this.props.avatarDisabled,topic:i.user,required:n.includes(i.user),invalid:i.invalid,index:a,key:i.user})),a++}));const i="chip-input"+(this.state.focused?" focused":""),s=!(this.props.tabIndex>0);return t().createElement("div",{className:i},e,t().createElement("input",{type:"text",placeholder:this.state.placeholder,onChange:this.handleTextInput,onFocus:this.handleFocusGained,onBlur:this.handleFocusLost,onKeyDown:this.handleKeyDown,value:this.state.input,tabIndex:this.props.tabIndex,autoFocus:s}))}}const En=(0,s.defineMessages)({no_contacts:{id:"no_contacts",defaultMessage:[{type:0,value:"You have no contacts :-("}]},contacts_not_found_short:{id:"contacts_not_found_short",defaultMessage:[{type:0,value:"No contacts match '"},{type:1,value:"query"},{type:0,value:"'"}]}});class Cn extends t().Component{constructor(e){super(e),this.state={members:e.members,index:Cn.indexMembers(e.members),staticMembers:Cn.staticMembers(e.members,e.keepInitialMembers,e.requiredMember),contactFilter:"",noContactsMessage:e.intl.formatMessage(En.no_contacts),selectedContacts:Cn.selectedContacts(e.members)},this.handleContactSelected=this.handleContactSelected.bind(this),this.handleMemberRemoved=this.handleMemberRemoved.bind(this),this.handleContactFilter=this.handleContactFilter.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleCancel=this.handleCancel.bind(this)}static indexMembers(e){let t={};return e.map((e=>{t[e.user]={delta:0,present:!0}})),t}static staticMembers(e,t,a){let n=[];return e.map((e=>{(t||e.user==a)&&n.push(e.user)})),n}static selectedContacts(e){let t=[];return e.map((e=>{t.push(e.user)})),t}handleContactSelected(e,t){let a=this.state.index[e];if(a){if(a.present)return;a.delta+=1,a.present=!0}else a={delta:1,present:!0};let n=this.state.members.slice();n.push(this.props.contacts[t]);const i=Cn.selectedContacts(n),s=this.state.index;s[e]=a,this.setState({members:n,index:s,selectedContacts:i})}handleMemberRemoved(e,t){const a=this.state.index[e];if(!a||!a.present)return;a.present=!1,a.delta-=1;let n=this.state.members.slice();n.splice(t,1);const i=Cn.selectedContacts(n),s=this.state.index;s[e]=a,this.setState({members:n,index:s,selectedContacts:i})}handleContactFilter(e){const{formatMessage:t}=this.props.intl,a=e?t(En.contacts_not_found_short,{query:e}):t(En.no_contacts);this.setState({contactFilter:e,noContactsMessage:a})}static doContactFiltering(e,t){if(e){for(let a=0;a<t.length;a++)if(t[a].indexOf(e)>=0)return!0;return!1}return!0}handleSubmit(){var e=this,t=[],a=[],n=[];Object.keys(this.state.index).map((function(i){e.state.index[i].present&&t.push(i),e.state.index[i].delta>0?a.push(i):e.state.index[i].delta<0&&n.push(i)})),this.props.onSubmit(t,a,n)}handleCancel(){this.props.onCancel()}render(){const{formatMessage:e}=this.props.intl;return t().createElement("div",{id:"group-manager"},t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"title_group_members",defaultMessage:[{type:0,value:"Group Members"}]}))),t().createElement("div",{className:"panel-form-row"},t().createElement(wn,{tinode:this.props.tinode,chips:this.state.members,staticMembers:this.state.staticMembers,prompt:"add members",filterFunc:this.handleContactFilter,onChipRemoved:this.handleMemberRemoved})),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"title_all_contacts",defaultMessage:[{type:0,value:"All Contacts"}]}))),t().createElement(sn,{tinode:this.props.tinode,contacts:this.props.contacts,myUserId:this.props.myUserId,topicSelected:this.state.selectedContacts,filter:this.state.contactFilter,filterFunc:Cn.doContactFiltering,emptyListMessage:this.state.noContactsMessage,showOnline:!1,showUnread:!1,onTopicSelected:this.handleContactSelected}),t().createElement("div",{id:"group-manager-buttons",className:"panel-form-row"},t().createElement("button",{className:"secondary",onClick:this.handleCancel},t().createElement(s.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})),t().createElement("button",{className:"primary",onClick:this.handleSubmit},t().createElement(s.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}))))}}const Sn=(0,s.injectIntl)(Cn),kn=(0,s.defineMessages)({joiner:{id:"permission_join",defaultMessage:[{type:0,value:"Join ("},{type:1,value:"val"},{type:0,value:")"}]},reader:{id:"permission_read",defaultMessage:[{type:0,value:"Read ("},{type:1,value:"val"},{type:0,value:")"}]},writer:{id:"permission_write",defaultMessage:[{type:0,value:"Write ("},{type:1,value:"val"},{type:0,value:")"}]},preser:{id:"permission_pres",defaultMessage:[{type:0,value:"Get notified ("},{type:1,value:"val"},{type:0,value:")"}]},approver:{id:"permission_admin",defaultMessage:[{type:0,value:"Approve ("},{type:1,value:"val"},{type:0,value:")"}]},sharer:{id:"permission_share",defaultMessage:[{type:0,value:"Share ("},{type:1,value:"val"},{type:0,value:")"}]},deleter:{id:"permission_delete",defaultMessage:[{type:0,value:"Delete ("},{type:1,value:"val"},{type:0,value:")"}]},owner:{id:"permission_owner",defaultMessage:[{type:0,value:"Owner ("},{type:1,value:"val"},{type:0,value:")"}]}});class Tn extends t().Component{constructor(e){super(e),this.state={mode:(e.mode||"").replace("N","")},this.handleChange=this.handleChange.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleCancel=this.handleCancel.bind(this)}handleChange(e){let t=this.state.mode;-1==t.indexOf(e)?t+=e:t=t.replace(e,""),this.setState({mode:t})}handleSubmit(){const e=(this.state.mode||"N").split("").sort().join("");e!==(this.props.mode||"N").split("").sort().join("")?this.props.onSubmit(e):this.props.onCancel()}handleCancel(){this.props.onCancel()}render(){const{formatMessage:e}=this.props.intl,a="JRWPASDO",n={J:e(kn.joiner,{val:"J"}),R:e(kn.reader,{val:"R"}),W:e(kn.writer,{val:"W"}),P:e(kn.preser,{val:"P"}),A:e(kn.approver,{val:"A"}),S:e(kn.sharer,{val:"S"}),D:e(kn.deleter,{val:"D"}),O:e(kn.owner,{val:"O"})};let i=this.props.skip||"",r=this.state.mode,o=(this.props.compare||"").replace("N",""),l=[];for(let e=0;e<a.length;e++){let s=a.charAt(e);i.indexOf(s)>=0&&r.indexOf(s)<0||l.push(t().createElement("tr",{key:s},t().createElement("td",null,n[s]),t().createElement("td",{className:"checkbox"},i.indexOf(s)<0?t().createElement(_n,{name:s,checked:r.indexOf(s)>=0,onChange:this.handleChange}):t().createElement(_n,{name:s,checked:r.indexOf(s)>=0})),this.props.compare?t().createElement("td",{className:"checkbox"},t().createElement(_n,{name:s,checked:o.indexOf(s)>=0})):null))}return t().createElement("div",{className:"panel-form-column"},this.props.userTitle?t().createElement("ul",{className:"contact-box small"},t().createElement(Za,{tinode:this.props.tinode,item:this.props.item,title:this.props.userTitle,small:!0,avatar:Ia(this.props.userAvatar?this.props.userAvatar:null)})):null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"title_permissions",defaultMessage:[{type:0,value:"Permissions"}]})),t().createElement("table",{className:"permission-editor"},this.props.compare?t().createElement("thead",null,t().createElement("tr",null,t().createElement("th",null),t().createElement("th",null,this.props.modeTitle),t().createElement("th",null,this.props.compareTitle))):null,t().createElement("tbody",null,l)),t().createElement("br",null),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{className:"outline",onClick:this.handleCancel},t().createElement(s.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})),t().createElement("button",{className:"primary",onClick:this.handleSubmit},t().createElement(s.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}))))}}const Mn=(0,s.injectIntl)(Tn);class An extends t().Component{constructor(e){super(e),this.state={panX:0,panY:0,originX:0,originY:0,zoom:1,minZoom:0,maxZoom:2.5},this.overlay=t().createRef(),this.cutout=t().createRef(),this.preview=t().createRef(),this.boundingBox=t().createRef(),this.imageWidth=0,this.imageHeight=0,this.mouseX=0,this.mouseY=0,this.prevDistance=0,this.cutoutRect={},this.bBoxRect={},this.originX=0,this.originY=0,this.initScaling=this.initScaling.bind(this),this.onZoom=this.onZoom.bind(this),this.handleZoom=this.handleZoom.bind(this),this.mouseDown=this.mouseDown.bind(this),this.mouseUp=this.mouseUp.bind(this),this.mouseMove=this.mouseMove.bind(this),this.mouseTouch=this.mouseTouch.bind(this),this.positionAll=this.positionAll.bind(this),this.translate=this.translate.bind(this)}componentDidMount(){this.overlay.current.addEventListener("mousedown",this.mouseDown,{passive:!0}),this.overlay.current.addEventListener("touchstart",this.mouseDown,{passive:!0}),this.bBoxRect=this.boundingBox.current.getBoundingClientRect(),this.originX=this.bBoxRect.width/2,this.originY=this.bBoxRect.height/2,this.cutoutRect=this.cutout.current.getBoundingClientRect()}componentWillUnmount(){this.overlay.current.removeEventListener("mousedown",this.mouseDown),this.overlay.current.removeEventListener("touchstart",this.mouseDown)}positionAll(e,t,a){this.setState({panX:e,panY:t,zoom:a,originX:this.originX-e,originY:this.originY-t});const n=(this.originX-e)*a-this.originX,i=(this.originY-t)*a-this.originY;this.props.onChange((n+this.cutoutRect.left-this.bBoxRect.left)/a,(i+this.cutoutRect.top-this.bBoxRect.top)/a,this.cutoutRect.width/a,this.cutoutRect.height/a,a)}static checkBound(e,t,a,n){let i=Math.min(0,a[0]-t[0]-n,t[1]-a[1]+n);return(0==i||Math.min(0,a[0]-t[0],t[1]-a[1])<i)&&(e+=n),e}initScaling(){const e=this.preview.current.getBoundingClientRect();this.imageWidth=e.width,this.imageHeight=e.height;const t=Math.max(this.cutoutRect.width/e.width,this.cutoutRect.height/e.height);this.setState({minZoom:t,maxZoom:Math.max(2.5,t+1)});const a=Math.max(this.bBoxRect.width/e.width,this.bBoxRect.height/e.height),n=this.cutoutRect.left-this.bBoxRect.left-(e.width-this.cutoutRect.width)/2,i=this.cutoutRect.top-this.bBoxRect.top-(e.height-this.cutoutRect.height)/2;this.positionAll(n,i,a)}onZoom(e){this.handleZoom(e.target.value)}handleZoom(e){let t=this.state.panX,a=this.state.panY;const n=this.originX-(this.originX-t)*e,i=n+this.imageWidth*e,s=this.cutoutRect.left-this.bBoxRect.left,r=s+this.cutoutRect.width;s<n?t-=n-s:r>i&&(t+=r-i);const o=this.originY-(this.originY-a)*e,l=o+this.imageHeight*e,c=this.cutoutRect.top-this.bBoxRect.top,d=c+this.cutoutRect.height;c<o?a-=o-c:d>l&&(a+=d-l),this.positionAll(t,a,e)}mouseDown(e){e.touches?(this.mouseX=e.touches[0].pageX,this.mouseY=e.touches[0].pageY):(this.mouseX=e.pageX,this.mouseY=e.pageY),window.addEventListener("mousemove",this.mouseMove,{passive:!1}),window.addEventListener("touchmove",this.mouseTouch,{passive:!1}),window.addEventListener("mouseup",this.mouseUp,{passive:!0}),window.addEventListener("touchend",this.mouseUp,{passive:!0}),document.body.style.userSelect="none"}translate(e,t){const a=e-this.mouseX,n=t-this.mouseY;this.mouseX=e,this.mouseY=t;const i=this.preview.current.getBoundingClientRect();let s=An.checkBound(this.state.panX,[i.left,i.right],[this.cutoutRect.left,this.cutoutRect.right],a),r=An.checkBound(this.state.panY,[i.top,i.bottom],[this.cutoutRect.top,this.cutoutRect.bottom],n);this.positionAll(s,r,this.state.zoom)}mouseMove(e){e.preventDefault(),this.translate(e.pageX,e.pageY)}mouseTouch(e){if(e.preventDefault(),1==e.touches.length)return void this.translate(e.touches[0].pageX,e.touches[0].pageY);const[t,a]=e.touches,n=Math.sqrt((t.pageX-a.pageX)*(t.pageX-a.pageX)+(t.pageY-a.pageY)*(t.pageY-a.pageY));this.prevDistance||(this.prevDistance=n/this.state.zoom);let i=n/this.prevDistance;this.handleZoom(Math.max(this.minZoom,Math.min(this.maxZoom,i)))}mouseUp(e){window.removeEventListener("mousemove",this.mouseMove),window.removeEventListener("touchmove",this.mouseTouch),window.removeEventListener("mouseup",this.mouseUp),window.removeEventListener("touchend",this.mouseUp),document.body.style.userSelect="",this.positionAll(this.state.panX,this.state.panY,this.state.zoom)}render(){const e=`translate3d(${this.state.panX}px, ${this.state.panY}px, 0) scale(${this.state.zoom})`,a=`${this.state.originX}px ${this.state.originY}px`,n={top:this.originY-this.state.originY*this.state.zoom+"px",left:this.originX-this.state.originX*this.state.zoom+"px",width:this.imageWidth*this.state.zoom+"px",height:this.imageHeight*this.state.zoom+"px"};return t().createElement("div",{className:"cropper"},t().createElement("div",{className:"bounding-box",ref:this.boundingBox},t().createElement("img",{src:this.props.source,className:"preview",alt:"",style:{transform:e,transformOrigin:a},ref:this.preview,onLoad:this.initScaling}),t().createElement("div",{className:"cutout circle",ref:this.cutout}),t().createElement("div",{className:"overlay",style:n,ref:this.overlay})),t().createElement("div",{className:"zoom-wrapper"},t().createElement("input",{type:"range",className:"zoomer",step:"0.001",min:this.state.minZoom,max:this.state.maxZoom,value:this.state.zoom,onChange:this.onZoom})))}}class Dn extends t().PureComponent{constructor(e){super(e),this.state={top:0,left:0,width:0,height:0,scale:1},this.handleSubmit=this.handleSubmit.bind(this),this.handleChange=this.handleChange.bind(this)}handleChange(e,t,a,n,i){this.setState({left:e,top:t,width:a,height:n,scale:i})}handleSubmit(){var e,t,a,n,i,s,r;(e=this.props.mime,t=this.props.avatar,a=this.state.left,n=this.state.top,i=this.state.width,s=this.state.height,r=this.state.scale,new Promise(((o,l)=>{const c=new Image;c.crossOrigin="Anonymous",c.onerror=e=>{l(new Error("Image format unrecognized"))},c.onload=()=>{URL.revokeObjectURL(c.src);let t=document.createElement("canvas");t.width=i*r,t.height=s*r;let d=t.getContext("2d");d.imageSmoothingEnabled=!0,d.drawImage(c,a,n,i,s,0,0,t.width,t.height),e=Aa.includes(e)?e:"image/jpeg",t.toBlob((a=>{t=null,a?o({mime:e,blob:a,width:i,height:s}):l(new Error("Unsupported image format"))}),e)},c.src=t}))).then((e=>{this.props.onSubmit(e.mime,e.blob,e.width,e.height)})).catch((e=>{this.props.onError(e)}))}render(){return t().createElement("div",{className:"panel-form"},t().createElement("div",{className:"panel-form-row"},t().createElement(An,{source:this.props.avatar,onChange:this.handleChange})),t().createElement("div",{className:"dialog-buttons"},this.props.onCancel?t().createElement("button",{className:"secondary",onClick:this.props.onCancel},t().createElement(s.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})):null,t().createElement("button",{className:"primary",onClick:this.handleSubmit},t().createElement(s.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}))))}}class In extends t().PureComponent{constructor(e){super(e),this.inputRef=t().createRef(),this.state={value:this.props.value,visible:!1},this.handleVisibility=this.handleVisibility.bind(this),this.handeTextChange=this.handeTextChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleEditingFinished=this.handleEditingFinished.bind(this)}componentDidMount(){this.props.autoFocus&&this.inputRef.current.focus()}handeTextChange(e){this.setState({value:e.target.value}),this.props.onChange&&this.props.onChange(e)}handleVisibility(e){e.preventDefault(),this.setState({visible:!this.state.visible})}handleKeyDown(e){27==e.keyCode?(this.setState({value:this.props.value,visible:!1}),this.props.onFinished&&this.props.onFinished()):13==e.keyCode&&this.handleEditingFinished()}handleEditingFinished(e){if(e){let t=e.currentTarget;setTimeout((()=>{t.contains(document.activeElement)||this.props.onFinished&&this.props.onFinished(this.state.value)}),0)}else this.props.onFinished&&this.props.onFinished(this.state.value.trim())}render(){return t().createElement("div",{tabIndex:"-1",className:"group-focus",onBlur:this.handleEditingFinished},t().createElement("input",{className:"with-visibility",type:this.state.visible?"text":"password",value:this.state.value,placeholder:this.props.placeholder,required:this.props.required?"required":"",autoFocus:this.props.autoFocus?"autoFocus":"",autoComplete:this.props.autoComplete,onChange:this.handeTextChange,onKeyDown:this.handleKeyDown,ref:this.inputRef}),t().createElement("span",{onClick:this.handleVisibility},t().createElement("i",{className:"material-icons clickable light-gray"},this.state.visible?"visibility":"visibility_off")))}}class Nn extends t().Component{constructor(e){super(e),this.selfRef=t().createRef(),this.state={active:e.active,initialValue:e.value||"",value:e.value||""},this.handeTextChange=this.handeTextChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleStartEditing=this.handleStartEditing.bind(this),this.handleEditingFinished=this.handleEditingFinished.bind(this),this.handlePasswordFinished=this.handlePasswordFinished.bind(this)}componentDidUpdate(e,t){const a=this.props.value||"";t.initialValue==a||t.active||this.setState({initialValue:a,value:a})}handeTextChange(e){this.setState({value:e.target.value||""})}handleKeyDown(e){27===e.keyCode?this.setState({value:this.props.value,active:!1}):13===e.keyCode&&this.handleEditingFinished(e)}handleStartEditing(){this.props.readOnly||this.setState({active:!0},(()=>{this.selfRef.current&&this.selfRef.current.focus()}))}handleEditingFinished(e){const t=this.state.value.trim();!this.props.required||e.target.checkValidity()&&t?(this.setState({active:!1}),(t||this.props.value)&&t!==this.props.value&&this.props.onFinished(t)):this.setState({value:this.props.value,active:!1})}handlePasswordFinished(e){this.setState({active:!1}),e&&e!==this.props.value&&this.props.onFinished(e)}render(){if(!this.state.active){let e="password"==this.props.type?"••••••••":this.state.value,a="in-place-edit"+(this.props.readOnly?" disabled":"");return e||(e=this.props.placeholder,a+=" placeholder"),this.props.multiline&&1!=this.props.multiline||(a+=" short"),t().createElement("span",{className:a,onClick:this.handleStartEditing},t().createElement("span",null,e))}let e;const a={};return"password"==this.props.type?(e=In,a.onFinished=this.handlePasswordFinished):(this.props.multiline>1?(e="textarea",a.rows=this.props.multiline,a.className="inplace-edit"):(e="input",a.type=this.props.type||"text"),a.value=this.state.value,a.ref=this.selfRef,a.onChange=this.handeTextChange,a.onKeyDown=this.handleKeyDown,a.onBlur=this.handleEditingFinished),a.placeholder=this.props.placeholder,a.required=this.props.required?"required":"",a.autoComplete=this.props.autoComplete,a.autoFocus=!0,t().createElement(e,a,null)}}class Pn extends t().Component{constructor(e){super(e),this.state={tags:this.props.tags||[],tagInput:"",activated:this.props.activated},this.handleTagInput=this.handleTagInput.bind(this),this.handleAddTag=this.handleAddTag.bind(this),this.handleRemoveTag=this.handleRemoveTag.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleCancel=this.handleCancel.bind(this)}static getDerivedStateFromProps(e,t){const a=e.tags||[];return ya(a,t.tags)||t.activated?null:{tags:a}}handleTagInput(e){if(this.setState({tagInput:e}),e.length>0){const t=e[e.length-1];'"'==e[0]?e.length>1&&'"'==t&&this.handleAddTag(e.substring(1,e.length-1)):","!=t&&" "!=t&&";"!=t&&'"'!=t||this.handleAddTag(e.substring(0,e.length-1).trim())}}handleAddTag(e){const t=this.props.tinode.getServerParam("maxTagCount",16);if(e.length>0&&this.state.tags.length<t){const t=this.state.tags.slice(0);return t.push(e),this.setState({tags:t,tagInput:""}),this.props.onTagsChanged&&this.props.onTagsChanged(t),t}return this.state.tags}handleRemoveTag(e,t){const a=this.state.tags.slice(0);a.splice(t,1),this.setState({tags:a}),this.props.onTagsChanged&&this.props.onTagsChanged(a)}handleSubmit(){this.props.onSubmit(this.handleAddTag(this.state.tagInput.trim())),this.setState({activated:!1,tags:this.props.tags||[]})}handleCancel(){this.setState({activated:!1,tagInput:"",tags:this.props.tags||[]}),this.props.onCancel&&this.props.onCancel()}render(){const e=this.props.tinode.getServerParam("minTagLength",2),a=this.props.tinode.getServerParam("maxTagLength",96);let n=[];return this.state.activated?this.state.tags.map((t=>{n.push({user:t,invalid:t.length<e||t.length>a})})):(this.state.tags.map((e=>{n.push(t().createElement("span",{className:"badge",key:n.length},e))})),0==n.length&&(n=t().createElement("i",null,t().createElement(s.FormattedMessage,{id:"tags_not_found",defaultMessage:[{type:0,value:"No tags defined. Add some."}]})))),t().createElement("div",{className:"panel-form-column"},t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},this.props.title)),this.state.activated?t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"tags_editor_no_tags",defaultMessage:[{type:0,value:"Add some tags"}]},(e=>t().createElement(wn,{tinode:this.props.tinode,chips:n,avatarDisabled:!0,prompt:e,tabIndex:this.props.tabIndex,onEnter:this.handleAddTag,onFocusLost:this.handleAddTag,onCancel:this.handleCancel,onChipRemoved:this.handleRemoveTag,filterFunc:this.handleTagInput}))),this.props.onSubmit||this.props.onCancel?t().createElement("div",{id:"tag-manager-buttons",className:"dialog-buttons panel-form-row"},t().createElement("button",{className:"outline",onClick:this.handleCancel},t().createElement(s.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})),t().createElement("button",{className:"primary",onClick:this.handleSubmit},t().createElement(s.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}))):null):t().createElement("div",{className:"quoted"},t().createElement("a",{href:"#",className:"flat-button",onClick:e=>{e.preventDefault(),this.setState({activated:!0})}},t().createElement("i",{className:"material-icons"},"edit")," ",t().createElement(s.FormattedMessage,{id:"title_manage_tags",defaultMessage:[{type:0,value:"Manage"}]})),t().createElement(t().Fragment,null,n)))}}class xn extends t().Component{constructor(e){super(e);const t=this.props.tinode.getTopic(this.props.topic),a=t.getAccessMode();this.state={isMe:Gt.Tinode.isMeTopicName(this.props.topic),owner:a&&a.isOwner(),fullName:t.public?t.public.fn:void 0,private:t.private?t.private.comment:null,description:t.public?t.public.note:void 0,avatar:Ia(t.public?t.public.photo:null),tags:t.tags()||[],newAvatar:null,newAvatarMime:null},this.previousOnTags=null,this.tnNewTags=this.tnNewTags.bind(this),this.handleFullNameUpdate=this.handleFullNameUpdate.bind(this),this.handleImageUpdated=this.handleImageUpdated.bind(this),this.handleAvatarCropped=this.handleAvatarCropped.bind(this),this.handleAvatarCropCancel=this.handleAvatarCropCancel.bind(this),this.uploadAvatar=this.uploadAvatar.bind(this),this.handlePrivateUpdate=this.handlePrivateUpdate.bind(this),this.handleDescriptionUpdate=this.handleDescriptionUpdate.bind(this),this.handleTagsUpdated=this.handleTagsUpdated.bind(this)}componentDidMount(){const e=this.props.tinode.getTopic(this.props.topic);this.previousOnTags=e.onTagsUpdated,e.onTagsUpdated=this.tnNewTags}componentWillUnmount(){this.props.tinode.getTopic(this.props.topic).onTagsUpdated=this.previousOnTags}tnNewTags(e){this.setState({tags:e})}handleFullNameUpdate(e){(e=e.trim().substring(0,oa))&&this.state.fullName!==e&&(this.setState({fullName:e}),this.props.onUpdateTopicDesc(this.props.topic,ba(e,null)))}handlePrivateUpdate(e){e=e.trim().substring(0,oa),this.state.private!==e&&(this.setState({private:e}),this.props.onUpdateTopicDesc(this.props.topic,null,e||Gt.Tinode.DEL_CHAR))}handleDescriptionUpdate(e){(e=e.trim().substring(0,la))&&(this.setState({description:e}),this.props.onUpdateTopicDesc(this.props.topic,ba(null,null,null,e)))}handleImageUpdated(e,t){this.setState({newAvatar:t,newAvatarMime:e}),t||(this.setState({avatar:null}),this.props.onUpdateTopicDesc(this.props.topic,ba(null,Gt.Tinode.DEL_CHAR)))}handleAvatarCropped(e,t,a,n){const i=t?URL.createObjectURL(t):null;this.setState({avatar:i,newAvatar:null,newAvatarMime:null}),t&&this.uploadAvatar(e,t,a,n)}uploadAvatar(e,t,a,n){const i=e=>{let{mime:t,blob:a}=e;if(a.size>na){this.props.tinode.getLargeFileHelper().upload(a).then((e=>this.props.onUpdateTopicDesc(this.props.topic,ba(null,e)))).catch((e=>this.props.onError(e.message,"err")))}else Ra(a).then((e=>{const a=Ia({data:e.bits,type:t});this.setState({source:a}),this.props.onUpdateTopicDesc(this.props.topic,ba(null,a))}))};a>aa||n>aa||a!=n?xa(t,aa,aa,sa,!0).then((e=>i(e))).catch((e=>this.props.onError(e.message,"err"))):i({mime:e,blob:t,width:a,height:n})}handleAvatarCropCancel(){this.setState({newAvatar:null,newAvatarMime:null})}handleTagsUpdated(e){ya(this.state.tags.slice(0),e.slice(0))||this.props.onUpdateTags(e)}render(){if(this.state.newAvatar)return t().createElement(Dn,{avatar:this.state.newAvatar,mime:this.state.newAvatarMime,onSubmit:this.handleAvatarCropped,onCancel:this.handleAvatarCropCancel,onError:this.props.onError});const e=this.state.isMe||this.state.owner;return t().createElement(t().Fragment,null,t().createElement("div",{className:"panel-form-column"},t().createElement("center",null,t().createElement(fn,{tinode:this.props.tinode,avatar:this.state.avatar,readOnly:!e,uid:this.props.topic,title:this.state.fullName,onImageUpdated:this.handleImageUpdated,onError:this.props.onError})),this.state.isMe?t().createElement("div",{className:"group"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_your_name",defaultMessage:[{type:0,value:"Your name"}]})),t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"full_name_prompt",defaultMessage:[{type:0,value:"Full name, e.g. John Doe"}]},(e=>t().createElement(Nn,{placeholder:e,value:this.state.fullName,required:!0,onFinished:this.handleFullNameUpdate}))))):t().createElement(t().Fragment,null,t().createElement("div",{className:"group"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_topic_name",defaultMessage:[{type:0,value:"Name"}]}))),t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"topic_name_editing_placeholder",defaultMessage:[{type:0,value:"Freeform name of the group"}]},(a=>t().createElement(Nn,{placeholder:a,readOnly:!e,value:this.state.fullName,required:!0,onFinished:this.handleFullNameUpdate}))))),t().createElement("div",{className:"group"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_private",defaultMessage:[{type:0,value:"Private comment"}]}))),t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"private_editing_placeholder",defaultMessage:[{type:0,value:"Visible to you only"}]},(e=>t().createElement(Nn,{placeholder:e,value:this.state.private,onFinished:this.handlePrivateUpdate})))))),e||this.state.description?t().createElement("div",{className:"group"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_description",defaultMessage:[{type:0,value:"Description"}]}))),t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"description_editing_placeholder",defaultMessage:[{type:0,value:"Description (optional)"}]},(a=>t().createElement(Nn,{placeholder:a,readOnly:!e,value:this.state.description,multiline:2,onFinished:this.handleDescriptionUpdate}))))):null),e?t().createElement(t().Fragment,null,t().createElement("div",{className:"hr"}),t().createElement(s.FormattedMessage,{id:"title_tag_manager",defaultMessage:[{type:0,value:"Tags (search & discovery)"}]},(e=>t().createElement(Pn,{tinode:this.props.tinode,title:e,activated:!1,tags:this.state.tags,onSubmit:this.handleTagsUpdated})))):null)}}class Rn extends t().Component{constructor(e){super(e);const t=this.props.tinode.getTopic(this.props.topic),a=t.getAccessMode();this.state={isMe:"me"==this.props.topic,owner:a&&a.isOwner(),credentials:(t.getCredentials?t.getCredentials():null)||[],addCredActive:!1,addCredInvalid:!1,newCred:"",tags:[]},this.previousTagsUpdated=void 0,this.onTagsUpdated=this.onTagsUpdated.bind(this),this.handleTagsUpdated=this.handleTagsUpdated.bind(this),this.tnCredsUpdated=this.tnCredsUpdated.bind(this),this.handleCredChange=this.handleCredChange.bind(this),this.handleCredKeyDown=this.handleCredKeyDown.bind(this),this.handleCredEntered=this.handleCredEntered.bind(this)}componentDidUpdate(e){const t=this.props.tinode.getTopic(e.topic);t&&(t.onCredsUpdated=this.tnCredsUpdated,t.onTagsUpdated!=this.onTagsUpdated&&("grp"==t.getType()?(this.previousTagsUpdated=t.onTagsUpdated,t.onTagsUpdated=this.onTagsUpdated):this.previousTagsUpdated=void 0),this.state.topic!=e.topic&&this.setState({topic:e.topic}))}componentWillUnmount(){const e=this.props.tinode.getTopic(this.props.topic);e.onCredsUpdated=void 0,e.onTagsUpdated=this.previousTagsUpdated}tnCredsUpdated(e){this.setState({credentials:e||[]})}handleCredChange(e){this.setState({newCred:e.target.value,addCredInvalid:!1})}handleCredKeyDown(e){27===e.keyCode?this.setState({newCred:"",addCredActive:!1}):13===e.keyCode&&this.handleCredEntered(e)}handleCredEntered(e){const t=this.state.newCred.trim();if(!t)return void this.setState({addCredActive:!1,addCredInvalid:!1});let a,n=function(e){return e=e.trim(),/^(?:\+?(\d{1,3}))?[- (.]*(\d{3})[- ).]*(\d{3})[- .]*(\d{2})[- .]*(\d{2})?$/.test(e)?e.replace(/[- ().]*/,""):null}(t);n?a="tel":(n=function(e){return e=e.trim(),/^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/.test(e)?e:null}(t),n&&(a="email")),a?(this.props.onCredAdd(a,n),this.setState({addCredActive:!1,newCred:""})):this.setState({addCredInvalid:!0})}onTagsUpdated(e){this.setState({tags:e}),this.previousTagsUpdated&&this.previousTagsUpdated!=this.onTagsUpdated&&this.previousTagsUpdated(e)}handleTagsUpdated(e){ya(this.state.tags.slice(0),e.slice(0))||this.props.onTopicTagsUpdateRequest(this.props.topic,e)}render(){const e=[];return this.state.isMe&&this.state.credentials.map((a=>{e.push(t().createElement("div",{key:a.meth+":"+a.val+":"+a.done},a.meth,": ",t().createElement("tt",null,a.val),t().createElement("span",null," ",a.done?null:t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCredConfirm(a.meth,a.val)}},t().createElement(s.FormattedMessage,{id:"validate_credential_action",defaultMessage:[{type:0,value:"confirm"}]}))," ",t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCredDelete(a.meth,a.val)}},t().createElement("i",{className:"material-icons gray"},"delete_outline")))))})),t().createElement("div",{className:"scrollable-panel"},t().createElement(xn,{tinode:this.props.tinode,topic:this.props.topic,onUpdateTopicDesc:this.props.onUpdateTopicDesc,onUpdateTags:this.handleTagsUpdated,onError:this.props.onError}),this.state.isMe?t().createElement(t().Fragment,null,t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-column"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_user_contacts",defaultMessage:[{type:0,value:"Contacts:"}]})),t().createElement("div",{className:"quoted"},e,this.state.addCredActive?t().createElement(s.FormattedMessage,{id:"phone_or_email_prompt",defaultMessage:[{type:0,value:"Phone number or email"}]},(e=>t().createElement("input",{type:"text",value:this.state.value,className:this.state.addCredInvalid?"invalid":null,placeholder:e,required:"required",autoFocus:!0,onChange:this.handleCredChange,onKeyDown:this.handleCredKeyDown,onBlur:this.handleCredEntered}))):null,t().createElement("div",null,t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.setState({addCredActive:!0})}},t().createElement("i",{className:"material-icons"},"add"),t().createElement(s.FormattedMessage,{id:"button_add_another",defaultMessage:[{type:0,value:"Add another"}]})))))):null)}}const Un=(0,s.defineMessages)({clear_messages:{id:"action_clear_messages",defaultMessage:[{type:0,value:"Clear Messages"}]},clear_messages_warning:{id:"clear_messages_warning",defaultMessage:[{type:0,value:"Are you sure you want to clear all messages? It cannot be undone."}]},delete_messages:{id:"action_delete_messages",defaultMessage:[{type:0,value:"Clear Messages for All"}]},delete_messages_warning:{id:"delete_messages_warning",defaultMessage:[{type:0,value:"Are you sure you want to delete all messages for everyone? It cannot be undone."}]},topic_delete:{id:"topic_delete",defaultMessage:[{type:0,value:"Delete Conversation"}]},topic_delete_warning:{id:"topic_delete_warning",defaultMessage:[{type:0,value:"Are you sure you want to delete this conversation? It cannot be undone."}]},leave_chat:{id:"action_leave_chat",defaultMessage:[{type:0,value:"Leave Conversation"}]},leave_chat_warning:{id:"leave_chat_warning",defaultMessage:[{type:0,value:"Are you sure you want to leave this conversation?"}]},block_contact:{id:"action_block_contact",defaultMessage:[{type:0,value:"Block Contact"}]},block_contact_warning:{id:"block_contact_warning",defaultMessage:[{type:0,value:"Are you sure you want to block this contact?"}]},report_chat:{id:"action_report_chat",defaultMessage:[{type:0,value:"Report Conversation"}]},report_chat_warning:{id:"report_chat_warning",defaultMessage:[{type:0,value:"Are you sure you want to block and report this conversation?"}]},other_user:{id:"label_other_user",defaultMessage:[{type:0,value:"Other"}]}});class Fn extends t().PureComponent{constructor(e){super(e),this.handleDeleteTopic=this.handleDeleteTopic.bind(this),this.handleDeleteMessages=this.handleDeleteMessages.bind(this),this.handleLeave=this.handleLeave.bind(this),this.handleBlock=this.handleBlock.bind(this),this.handleReport=this.handleReport.bind(this)}handleDeleteTopic(e){e.preventDefault();const{formatMessage:t}=this.props.intl;this.props.onShowAlert(t(Un.topic_delete),t(Un.topic_delete_warning),(()=>{this.props.onDeleteTopic(this.props.topic)}),null,!0,null)}handleDeleteMessages(e){e.preventDefault();const{formatMessage:t}=this.props.intl;this.props.onShowAlert(t(this.props.deleter?Un.delete_messages:Un.clear_messages),t(this.props.deleter?Un.delete_messages_warning:Un.clear_messages_warning),(()=>{this.props.onDeleteMessages(this.props.topic)}),null,!0,null)}handleLeave(e){e.preventDefault();const{formatMessage:t}=this.props.intl;this.props.onShowAlert(t(Un.leave_chat),t(Un.leave_chat_warning),(()=>{this.props.onLeaveTopic(this.props.topic)}),null,!0,null)}handleBlock(e){e.preventDefault();const{formatMessage:t}=this.props.intl;this.props.onShowAlert(t(Un.block_contact),t(Un.block_contact_warning),(()=>{this.props.onBlockTopic(this.props.topic)}),null,!0,null)}handleReport(e){e.preventDefault();const{formatMessage:t}=this.props.intl;this.props.onShowAlert(t(Un.report_chat),t(Un.report_chat_warning),(e=>{this.props.onReportTopic(this.props.topic)}),null,!0,null)}render(){const{formatMessage:e}=this.props.intl;return t().createElement("div",{className:"scrollable-panel"},t().createElement("div",{className:"panel-form-column"},this.props.channel?null:t().createElement("a",{href:"#",className:"flat-button",onClick:this.handleDeleteMessages},t().createElement("i",{className:"material-icons"},"delete_outline")," ",e(this.props.deleter?Un.delete_messages:Un.clear_messages)),this.props.owner?t().createElement("a",{href:"#",className:"danger flat-button",onClick:this.handleDeleteTopic},t().createElement("i",{className:"material-icons"},"delete")," ",e(Un.topic_delete)):t().createElement("a",{href:"#",className:"danger flat-button",onClick:this.handleLeave},t().createElement("i",{className:"material-icons"},"exit_to_app")," ",e(Un.leave_chat)),this.props.groupTopic?null:t().createElement("a",{href:"#",className:"danger flat-button",onClick:this.handleBlock},t().createElement("i",{className:"material-icons"},"block")," ",e(Un.block_contact)),this.props.owner?null:t().createElement("a",{href:"#",className:"danger flat-button",onClick:this.handleReport},t().createElement("i",{className:"material-icons"},"report")," ",e(Un.report_chat))),t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-column"},this.props.groupTopic?t().createElement(t().Fragment,null,t().createElement("div",{className:"group"},t().createElement("label",null,t().createElement(s.FormattedMessage,{id:"label_your_permissions",defaultMessage:[{type:0,value:"Your permissions:"}]}))," ",t().createElement("tt",{className:"clickable",onClick:e=>{e.preventDefault(),this.props.onLaunchPermissionsEditor("want")}},this.props.access)),this.props.channel?null:t().createElement("div",{className:"group"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_default_access_mode",defaultMessage:[{type:0,value:"Default access mode:"}]}))),t().createElement("div",{className:"quoted"},t().createElement("div",null,"Auth: ",t().createElement("tt",{className:this.props.owner?"clickable":null,onClick:e=>{e.preventDefault(),this.props.owner&&this.props.onLaunchPermissionsEditor("auth")}},this.props.auth)),t().createElement("div",null,"Anon: ",t().createElement("tt",{className:this.props.owner?"clickable":null,onClick:e=>{e.preventDefault(),this.props.owner&&this.props.onLaunchPermissionsEditor("anon")}},this.props.anon))))):t().createElement("div",{className:"group"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_permissions",defaultMessage:[{type:0,value:"Permissions:"}]}))),t().createElement("div",{className:"quoted"},t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"label_you",defaultMessage:[{type:0,value:"You:"}]})," ",t().createElement("tt",{className:"clickable",onClick:e=>{e.preventDefault(),this.props.onLaunchPermissionsEditor("want")}},this.props.access)),t().createElement("div",null,this.props.fullName?this.props.fullName:e(Un.other_user),": ",t().createElement("tt",{className:"clickable",onClick:e=>{e.preventDefault(),this.props.onLaunchPermissionsEditor("given")}},this.props.modeGiven2))))))}}const Bn=(0,s.injectIntl)(Fn),Ln=(0,s.defineMessages)({info:{id:"panel_title_info",defaultMessage:[{type:0,value:"Info"}]},general:{id:"panel_title_general",defaultMessage:[{type:0,value:"General"}]},security:{id:"panel_title_security",defaultMessage:[{type:0,value:"Security"}]},members:{id:"panel_title_members",defaultMessage:[{type:0,value:"Members"}]},crop:{id:"panel_title_crop",defaultMessage:[{type:0,value:"Drag to Adjust"}]},perm_want:{id:"requested_permissions",defaultMessage:[{type:0,value:"Requested"}]},perm_given:{id:"granted_permissions",defaultMessage:[{type:0,value:"Granted"}]},perm_auth:{id:"permissions_authenticated",defaultMessage:[{type:0,value:"Authenticated"}]},perm_anon:{id:"permissions_anonymous",defaultMessage:[{type:0,value:"Anonymous"}]},perm_user:{id:"permissions_user",defaultMessage:[{type:0,value:"User's Permissions"}]},edit_permissions:{id:"menu_item_edit_permissions",defaultMessage:[{type:0,value:"Edit permissions"}]}});class On extends t().Component{constructor(e){super(e),this.state={topic:null,owner:!1,admin:!1,sharer:!1,deleter:!1,muted:!1,address:null,groupTopic:void 0,channel:void 0,fullName:void 0,description:void 0,avatar:null,private:null,selectedContact:null,access:null,modeGiven:null,modeWant:null,modeGiven2:null,modeWant2:null,auth:null,anon:null,contactList:[],trustedBadges:[],previousMetaDesc:void 0,previousSubsUpdated:void 0},this.resetSubs=this.resetSubs.bind(this),this.resetDesc=this.resetDesc.bind(this),this.resetTags=this.resetTags.bind(this),this.onMetaDesc=this.onMetaDesc.bind(this),this.onSubsUpdated=this.onSubsUpdated.bind(this),this.handleImageChanged=this.handleImageChanged.bind(this),this.handleMuted=this.handleMuted.bind(this),this.handleUnarchive=this.handleUnarchive.bind(this),this.handlePermissionsChanged=this.handlePermissionsChanged.bind(this),this.handleLaunchPermissionsEditor=this.handleLaunchPermissionsEditor.bind(this),this.handleShowAddMembers=this.handleShowAddMembers.bind(this),this.handleMemberUpdateRequest=this.handleMemberUpdateRequest.bind(this),this.handleMemberSelected=this.handleMemberSelected.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleBackNavigate=this.handleBackNavigate.bind(this)}componentDidUpdate(e){const t=this.props.tinode.getTopic(e.topic);t&&(this.onMetaDesc!=t.onMetaDesc&&(this.previousMetaDesc=t.onMetaDesc,t.onMetaDesc=this.onMetaDesc,this.previousSubsUpdated=t.onSubsUpdated,t.onSubsUpdated=this.onSubsUpdated),this.state.topic!=e.topic&&(this.setState({topic:e.topic}),this.resetDesc(t,e),this.resetSubs(t,e),this.resetTags(t)))}componentWillUnmount(){const e=this.props.tinode.getTopic(this.props.topic);e&&(this.setState({topic:null}),e.onMetaDesc=this.previousMetaDesc,e.onSubsUpdated=this.previousSubsUpdated)}resetSubs(e,t){const a={contactList:[]};if("p2p"==e.getType()){const n=e.subscriber(t.topic);n?(a.modeGiven2=n.acs.getGiven(),a.modeWant2=n.acs.getWant()):(a.modeGiven2="N",a.modeWant2="N")}else e.subscribers((e=>{a.contactList.push(e)}),this);this.setState(a)}resetDesc(e,t){const a=e.getDefaultAccess()||{},n=e.getAccessMode(),i=[];if(e.trusted)for(const[t,a]of Object.entries(e.trusted))a&&i.push(t);this.setState({owner:n&&n.isOwner(),admin:n&&n.isAdmin(),sharer:n&&n.isSharer(),deleter:n&&n.isDeleter(),muted:n&&n.isMuted(),fullName:ka(e.public&&e.public.fn,oa),description:ka(e.public&&e.public.note,la),avatar:Ia(e.public?e.public.photo:null),trustedBadges:i,private:ka(e.private&&e.private.comment,oa),archived:e.isArchived(),address:e.name,groupTopic:e.isGroupType(),channel:e.isChannelType()||e.chan,access:n?n.getMode():void 0,modeGiven:n?n.getGiven():void 0,modeWant:n?n.getWant():void 0,auth:a.auth,anon:a.anon})}resetTags(e){if("grp"!=e.getType())return;const t=e.getAccessMode();t&&t.isOwner()&&e.getMeta(e.startMetaQuery().withTags().build())}onMetaDesc(e){const t=this.props.tinode.getTopic(this.props.topic);t&&(this.resetDesc(t,this.props),this.previousMetaDesc&&this.previousMetaDesc!=this.onMetaDesc&&this.previousMetaDesc(e))}onSubsUpdated(e){const t=this.props.tinode.getTopic(this.props.topic);t&&(this.resetSubs(t,this.props),this.previousSubsUpdated&&this.previousSubsUpdated!=this.onSubsUpdated&&this.previousSubsUpdated(e))}handleImageChanged(e,t){this.setState({avatar:t}),this.props.onTopicDescUpdate(this.props.topic,ba(null,t||Gt.Tinode.DEL_CHAR),null)}handleMuted(e,t){this.setState({muted:t}),this.props.onChangePermissions(this.props.topic,t?"-P":"+P")}handleUnarchive(e,t){this.props.onTopicUnArchive(this.props.topic)}handlePermissionsChanged(e,t){switch(e){case"auth":this.props.onTopicDescUpdateRequest(this.props.topic,null,null,{auth:t});break;case"anon":this.props.onTopicDescUpdateRequest(this.props.topic,null,null,{anon:t});break;case"mode":case"want":this.props.onChangePermissions(this.props.topic,t);break;case"given":this.props.onChangePermissions(this.props.topic,t,this.props.topic);break;case"user":this.props.onChangePermissions(this.props.topic,t,this.state.userPermissionsEdited)}this.handleBackNavigate()}handleLaunchPermissionsEditor(e,t){const{formatMessage:a}=this.props.intl;let n,i,s,r,o,l,c;switch(e){case"mode":n=this.state.access;break;case"want":n=this.state.modeWant,i=this.state.modeGiven,this.state.owner?s="O":(s=Gt.AccessMode.encode(Gt.AccessMode.diff("ASDO",this.state.modeGiven)),this.state.channel&&(s+="W")),r=a(Ln.perm_want),o=a(Ln.perm_given);break;case"given":n=this.state.modeGiven2,i=this.state.modeWant2,s=this.state.groupTopic?this.state.owner?"":"O":"ASDO",r=a(Ln.perm_given),o=a(Ln.perm_want);break;case"auth":n=this.state.auth,s="O";break;case"anon":n=this.state.anon,s="O";break;case"user":{const e=this.props.tinode.getTopic(this.props.topic);if(!e)return;const d=e.subscriber(t);if(!d||!d.acs)return;n=d.acs.getGiven(),i=d.acs.getWant(),s=this.state.owner?"":"O",r=a(Ln.perm_given),o=a(Ln.perm_want),d.public&&(l=d.public.fn,c=d.public.photo);break}default:return void console.error("Unknown permission editing mode '"+e+"'")}this.setState({userPermissionsEdited:t,userPermissionsTitle:l,userPermissionsAvatar:c,editedPermissions:n,immutablePermissions:i,editedPermissionsTitle:r,immutablePermissionsTitle:o,editedPermissionsSkipped:s}),this.props.onNavigate(`perm/${e}`)}handleShowAddMembers(e){e.preventDefault(),this.props.onInitFind(),this.props.onNavigate("members")}handleMemberUpdateRequest(e,t,a){this.props.onMemberUpdateRequest(this.props.topic,t,a),this.props.onNavigate("info")}handleMemberSelected(e){this.setState({selectedContact:e})}handleBackNavigate(){const e=(this.props.panel||"info").split("/");"info"==e[0]?this.props.onNavigate(null):"perm"==e[0]?"user"==e[1]?this.props.onNavigate("info"):this.props.onNavigate("security"):this.props.onNavigate("info")}handleContextMenu(e){const{formatMessage:t}=this.props.intl,a=this.props.tinode.getTopic(this.props.topic);if(!a)return;const n=a.subscriber(e.topicName);if(!n||!n.acs)return;const i=this.props.tinode.isMe(e.topicName),s=[{title:t(Ln.edit_permissions),handler:()=>{this.handleLaunchPermissionsEditor(i?"want":"user",e.topicName)}}];i||s.push("member_delete"),s.push(n.acs.isMuted()?"member_unmute":"member_mute"),i||s.push(n.acs.isJoiner()?"member_block":"member_unblock"),this.props.showContextMenu({topicName:this.props.topic,x:e.x,y:e.y,user:e.topicName},s)}render(){const e=(this.props.panel||"info").split("/"),a=e[0];e.shift();const{formatMessage:n}=this.props.intl,i=n(("perm"==a?Ln["perm_"+e[0]]:Ln[a])||Ln.info);return t().createElement("div",{id:"info-view"},t().createElement("div",{className:"caption-panel",id:"info-caption-panel"},t().createElement("div",{className:"panel-title",id:"info-title"},i),t().createElement("div",null,t().createElement(vn,{onCancel:this.handleBackNavigate}))),this.props.displayMobile?t().createElement(bn,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,"members"==a?t().createElement(Sn,{tinode:this.props.tinode,members:this.state.contactList,requiredMember:this.props.myUserId,keepInitialMembers:!this.state.admin&&!this.state.owner,myUserId:this.props.myUserId,contacts:this.props.searchableContacts,onCancel:this.handleBackNavigate,onSubmit:this.handleMemberUpdateRequest}):"perm"==a&&e.length>0?t().createElement(Mn,{tinode:this.props.tinode,mode:this.state.editedPermissions,compare:this.state.immutablePermissions,skip:this.state.editedPermissionsSkipped,modeTitle:this.state.editedPermissionsTitle,compareTitle:this.state.immutablePermissionsTitle,userTitle:this.state.userPermissionsTitle,item:this.state.userPermissionsEdited,userAvatar:this.state.userPermissionsAvatar,onSubmit:t=>this.handlePermissionsChanged(e[0],t),onCancel:this.handleBackNavigate}):"general"==a?t().createElement(Rn,{tinode:this.props.tinode,topic:this.props.topic,onCredAdd:this.props.onCredAdd,onTopicTagsUpdateRequest:this.props.onTopicTagsUpdateRequest,onCredConfirm:this.props.onCredConfirm,onCredDelete:this.props.onCredDelete,onUpdateTopicDesc:this.props.onTopicDescUpdateRequest,onError:this.props.onError}):"security"==a?t().createElement(Bn,{topic:this.props.topic,owner:this.state.owner,admin:this.state.admin,sharer:this.state.sharer,deleter:this.state.deleter,muted:this.state.muted,groupTopic:this.state.groupTopic,channel:this.state.channel,access:this.state.access,modeGiven:this.state.modeGiven,modeWant:this.state.modeWant,modeGiven2:this.state.modeGiven2,modeWant2:this.state.modeWant2,auth:this.state.auth,anon:this.state.anon,onShowAlert:this.props.onShowAlert,onDeleteMessages:this.props.onDeleteMessages,onLeaveTopic:this.props.onLeaveTopic,onBlockTopic:this.props.onBlockTopic,onReportTopic:this.props.onReportTopic,onLaunchPermissionsEditor:this.handleLaunchPermissionsEditor,onNavigate:this.props.onNavigate}):t().createElement("div",{id:"info-view-content",className:"scrollable-panel"},t().createElement("div",{className:"panel-form-column"},t().createElement("a",{href:"#",className:"flat-button float-right",onClick:e=>{e.preventDefault(),this.props.onNavigate("general")}},t().createElement("i",{className:"material-icons"},"edit")," ",t().createElement(s.FormattedMessage,{id:"button_edit",defaultMessage:[{type:0,value:"Edit"}]})),t().createElement("center",null,t().createElement(fn,{tinode:this.props.tinode,avatar:this.state.avatar,readOnly:!0,uid:this.props.topic,title:this.state.fullName})),t().createElement("div",{className:"group"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_topic_name",defaultMessage:[{type:0,value:"Name"}]}))),t().createElement("div",{className:"large ellipsized"},this.state.fullName,this.state.channel?t().createElement("img",{src:"/img/channel.png",className:"channel",alt:"channel"}):null)),this.state.private?t().createElement("div",{className:"group"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_private",defaultMessage:[{type:0,value:"Private comment"}]}))),t().createElement("div",{className:"large ellipsized"},this.state.private)):null,t().createElement("div",{className:"group"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_user_id",defaultMessage:[{type:0,value:"ID:"}]}))," ",t().createElement("tt",null,this.state.address)),t().createElement("div",{className:"group"},t().createElement(hn,{trustedBadges:this.state.trustedBadges})),this.state.description?t().createElement("div",{className:"group"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_description",defaultMessage:[{type:0,value:"Description"}]})),t().createElement("div",null,this.state.description)):null),t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-row"},t().createElement("label",null,t().createElement(s.FormattedMessage,{id:"label_muting_topic",defaultMessage:[{type:0,value:"Muted:"}]})),t().createElement(_n,{name:"P",checked:this.state.muted,onChange:this.handleMuted})),this.state.archived?t().createElement("div",{className:"panel-form-row"},t().createElement("label",null,t().createElement(s.FormattedMessage,{id:"label_unarchive_topic",defaultMessage:[{type:0,value:"Archived:"}]})),t().createElement(_n,{name:"archived",checked:!0,onChange:this.handleUnarchive})):null,t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-row"},t().createElement("a",{href:"#",className:"flat-button",onClick:e=>{e.preventDefault(),this.props.onNavigate("security")}},t().createElement("i",{className:"material-icons"},"security")," ",t().createElement(s.FormattedMessage,{id:"button_security",defaultMessage:[{type:0,value:"Security"}]}))),this.state.groupTopic&&this.state.sharer?t().createElement(t().Fragment,null,t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_group_members",defaultMessage:[{type:0,value:"Group members:"}]}))),t().createElement("div",{className:"panel-form-row"},t().createElement("a",{href:"#",className:"flat-button",onClick:this.handleShowAddMembers},t().createElement("i",{className:"material-icons"},"person_add")," ",t().createElement(s.FormattedMessage,{id:"button_add_members",defaultMessage:[{type:0,value:"Add members"}]}))),t().createElement(s.FormattedMessage,{id:"group_has_no_members",defaultMessage:[{type:0,value:"No members"}]},(e=>t().createElement(sn,{tinode:this.props.tinode,contacts:this.state.contactList,myUserId:this.props.myUserId,emptyListMessage:e,topicSelected:this.state.selectedContact,showOnline:!1,showUnread:!1,showMode:!0,noScroll:!0,onTopicSelected:this.handleMemberSelected,showContextMenu:!!this.state.admin&&this.handleContextMenu})))):null))}}const qn=(0,s.injectIntl)(On),jn=new Audio("audio/call-out.m4a");jn.loop=!0;const zn=new Audio("audio/call-end.m4a");zn.loop=!0;const Vn=new Audio("audio/dialing.m4a"),Hn=(0,s.defineMessages)({already_in_call:{id:"already_in_call",defaultMessage:[{type:0,value:"You already in an ongoing call!"}]}});class Wn extends t().PureComponent{constructor(e){super(e),this.state={localStream:void 0,pc:void 0,previousOnInfo:void 0,waitingForPeer:!1,callInitialSetupComplete:!1},this.localStreamConstraints={audio:!0,video:!0},this.isOutgoingCall=1==e.callState,this.localRef=t().createRef(),this.remoteRef=t().createRef(),this.remoteIceCandidatesCache=[],this.onInfo=this.onInfo.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.createPeerConnection=this.createPeerConnection.bind(this),this.canSendOffer=this.canSendOffer.bind(this),this.drainRemoteIceCandidatesCache=this.drainRemoteIceCandidatesCache.bind(this),this.handleNegotiationNeededEvent=this.handleNegotiationNeededEvent.bind(this),this.handleICECandidateEvent=this.handleICECandidateEvent.bind(this),this.handleNewICECandidateMsg=this.handleNewICECandidateMsg.bind(this),this.handleICEConnectionStateChangeEvent=this.handleICEConnectionStateChangeEvent.bind(this),this.handleSignalingStateChangeEvent=this.handleSignalingStateChangeEvent.bind(this),this.handleICEGatheringStateChangeEvent=this.handleICEGatheringStateChangeEvent.bind(this),this.handleIceCandidateErrorEvent=this.handleIceCandidateErrorEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.handleVideoOfferMsg=this.handleVideoOfferMsg.bind(this),this.handleVideoAnswerMsg=this.handleVideoAnswerMsg.bind(this),this.handleNewICECandidateMsg=this.handleNewICECandidateMsg.bind(this),this.reportError=this.reportError.bind(this),this.handleGetUserMediaError=this.handleGetUserMediaError.bind(this),this.stopTracks=this.stopTracks.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleToggleCameraClick=this.handleToggleCameraClick.bind(this),this.handleToggleMicClick=this.handleToggleMicClick.bind(this),this.toggleMedia=this.toggleMedia.bind(this),this.handleRemoteHangup=this.handleRemoteHangup.bind(this),this.handleVideoCallAccepted=this.handleVideoCallAccepted.bind(this)}componentDidMount(){const e=this.props.tinode.getTopic(this.props.topic);this.previousOnInfo=e.onInfo,e.onInfo=this.onInfo,1!=this.props.callState&&3!=this.props.callState||!this.localRef.current||this.start()}componentWillUnmount(){this.props.tinode.getTopic(this.props.topic).onInfo=this.previousOnInfo,this.stop()}handleVideoCallAccepted(e){jn.pause();const t=this.createPeerConnection(),a=this.state.localStream;a.getTracks().forEach((e=>{t.addTrack(e,a)}))}onInfo(e){if("call"==e.what)switch(e.event){case"accept":this.handleVideoCallAccepted(e);break;case"answer":this.handleVideoAnswerMsg(e);break;case"ice-candidate":this.handleNewICECandidateMsg(e);break;case"hang-up":this.handleRemoteHangup(e);break;case"offer":this.handleVideoOfferMsg(e);break;case"ringing":jn.play().catch((e=>{}));break;default:console.warn("Unknown call event",e.event)}}start(){this.state.localStream?this.props.onError(this.props.intl.formatMessage(Hn.already_in_call)):3!=this.props.callState?navigator.mediaDevices.getUserMedia(this.localStreamConstraints).then((e=>{this.setState({localStream:e,waitingForPeer:!0}),this.localRef.current.srcObject=e,Vn.play(),this.props.onInvite(this.props.topic,this.props.seq,this.props.callState)})).catch(this.handleGetUserMediaError):this.props.onInvite(this.props.topic,this.props.seq,this.props.callState)}stop(){zn.pause(),zn.currentTime=0,jn.pause(),jn.currentTime=0,this.stopTracks(this.localRef.current),this.stopTracks(this.remoteRef.current),this.state.pc&&(this.state.pc.ontrack=null,this.state.pc.onremovetrack=null,this.state.pc.onremovestream=null,this.state.pc.onicecandidate=null,this.state.pc.oniceconnectionstatechange=null,this.state.pc.onsignalingstatechange=null,this.state.pc.onicegatheringstatechange=null,this.state.pc.onnegotiationneeded=null,this.state.pc.onicecandidateerror=null,this.state.pc.close()),this.setState({pc:null,waitingForPeer:!1})}stopTracks(e){if(!e)return;let t=e.srcObject;if(!t)return;let a=t.getTracks();a&&a.forEach((e=>{e.stop(),e.enabled=!1})),e.srcObject=null,e.src=""}createPeerConnection(){const e=this.props.tinode.getServerParam("iceServers",null),t=e?new RTCPeerConnection({iceServers:e}):new RTCPeerConnection;return t.onicecandidate=this.handleICECandidateEvent,t.oniceconnectionstatechange=this.handleICEConnectionStateChangeEvent,t.onicegatheringstatechange=this.handleICEGatheringStateChangeEvent,t.onsignalingstatechange=this.handleSignalingStateChangeEvent,t.onnegotiationneeded=this.handleNegotiationNeededEvent,t.onicecandidateerror=this.handleIceCandidateErrorEvent,t.ontrack=this.handleTrackEvent,this.setState({pc:t,waitingForPeer:!1}),t}handleVideoAnswerMsg(e){const t=new RTCSessionDescription(e.payload);this.state.pc.setRemoteDescription(t).then((e=>{this.setState({callInitialSetupComplete:!0},(()=>this.drainRemoteIceCandidatesCache()))})).catch(this.reportError)}reportError(e){this.props.onError(e.message,"err")}canSendOffer(){return this.isOutgoingCall||this.state.callInitialSetupComplete}handleNegotiationNeededEvent(){this.canSendOffer()&&this.state.pc.createOffer().then((e=>this.state.pc.setLocalDescription(e))).then((e=>{this.props.onSendOffer(this.props.topic,this.props.seq,this.state.pc.localDescription.toJSON())})).catch(this.reportError)}handleIceCandidateErrorEvent(e){console.warn("ICE candidate error:",e)}handleICECandidateEvent(e){e.candidate&&this.props.onIceCandidate(this.props.topic,this.props.seq,e.candidate.toJSON())}handleNewICECandidateMsg(e){const t=new RTCIceCandidate(e.payload);this.state.callInitialSetupComplete?this.state.pc.addIceCandidate(t).catch(this.reportError):this.remoteIceCandidatesCache.push(t)}drainRemoteIceCandidatesCache(){this.remoteIceCandidatesCache.forEach((e=>{this.state.pc.addIceCandidate(e).catch(this.reportError)})),this.remoteIceCandidatesCache=[]}handleICEConnectionStateChangeEvent(e){switch(this.state.pc.iceConnectionState){case"closed":case"failed":this.handleCloseClick()}}handleSignalingStateChangeEvent(e){"closed"==this.state.pc.signalingState&&this.handleCloseClick()}handleICEGatheringStateChangeEvent(e){}handleTrackEvent(e){this.remoteRef.current.srcObject=e.streams[0],this.forceUpdate()}handleGetUserMediaError(e){switch(e.name){case"NotFoundError":this.reportError(e.message);break;case"SecurityError":case"PermissionDeniedError":break;default:this.reportError(e.message),console.error("Error opening your camera and/or microphone:",e.message)}this.handleCloseClick()}handleVideoOfferMsg(e){let t=null;const a=this.createPeerConnection(),n=new RTCSessionDescription(e.payload);a.setRemoteDescription(n).then((e=>navigator.mediaDevices.getUserMedia(this.localStreamConstraints))).then((e=>{t=e,this.localRef.current.srcObject=e,this.setState({localStream:e}),t.getTracks().forEach((e=>{a.addTrack(e,t)}))})).then((e=>a.createAnswer())).then((e=>a.setLocalDescription(e))).then((e=>{this.props.onSendAnswer(this.props.topic,this.props.seq,a.localDescription.toJSON()),this.setState({callInitialSetupComplete:!0},(()=>this.drainRemoteIceCandidatesCache()))})).catch(this.handleGetUserMediaError)}handleRemoteHangup(){this.state.waitingForPeer?(this.setState({waitingForPeer:!1}),jn.pause(),jn.currentTime=0,zn.loop=!0,zn.play().catch((e=>{})),setTimeout((e=>{this.handleCloseClick()}),2e3)):this.handleCloseClick()}handleCloseClick(){this.stop(),this.props.onHangup(this.props.topic,this.props.seq)}toggleMedia(e){this.state.localStream.getTracks().forEach((t=>{t.kind==e&&(t.enabled=!t.enabled)})),this.forceUpdate()}handleToggleCameraClick(){this.toggleMedia("video")}handleToggleMicClick(){this.toggleMedia("audio")}render(){const e=this.remoteRef.current&&this.remoteRef.current.srcObject,a=!(this.state.localStream&&this.state.localStream.getTracks()),n=this.state.localStream&&this.state.localStream.getAudioTracks()[0].enabled?"mic":"mic_off",i=this.state.localStream&&this.state.localStream.getVideoTracks()[0].enabled?"videocam":"videocam_off",r=ka(this.props.title,20),o=this.state.waitingForPeer?" pulse":"";return t().createElement(t().Fragment,null,t().createElement("div",{id:"video-container"},t().createElement("div",{id:"video-container-panel"},t().createElement("div",{className:"call-party self"},t().createElement("video",{ref:this.localRef,autoPlay:!0,muted:!0,playsInline:!0}),t().createElement("div",{className:"caller-name inactive"},t().createElement(s.FormattedMessage,{id:"calls_you_label",defaultMessage:[{type:0,value:"You"}]}))),t().createElement("div",{className:"call-party peer"},t().createElement("video",{ref:this.remoteRef,autoPlay:!0,playsInline:!0}),e?t().createElement("div",{className:"caller-name inactive"},r):t().createElement("div",{className:`caller-card${o}`},t().createElement("div",{className:"avatar-box"},t().createElement(Ta,{tinode:this.props.tinode,avatar:this.props.avatar,topic:this.props.topic,title:this.props.title})),t().createElement("div",{className:"caller-name"},r)))),t().createElement("div",{className:"controls"},t().createElement("button",{className:"danger",onClick:this.handleCloseClick},t().createElement("i",{className:"material-icons"},"call_end")),t().createElement("button",{className:"secondary",onClick:this.handleToggleCameraClick,disabled:a},t().createElement("i",{className:"material-icons"},i)),t().createElement("button",{className:"secondary",onClick:this.handleToggleMicClick,disabled:a},t().createElement("i",{className:"material-icons"},n)))))}}const Kn=(0,s.injectIntl)(Wn);class Gn extends t().Component{constructor(e){super(e),this.state={downloader:null,progress:0},this.downloadFile=this.downloadFile.bind(this),this.handleCancel=this.handleCancel.bind(this)}downloadFile(e,t,a){if(!e)return void this.props.onError("Invalid download URL '"+e+"'");const n=this.props.tinode.getLargeFileHelper();this.setState({downloader:n}),n.download(e,t,a,(e=>{this.setState({progress:e/this.props.size})}),(e=>{this.props.onError(e,"err")})).then((()=>{this.setState({downloader:null,progress:0})})).catch((e=>{e&&this.props.onError("Error downloading file: "+e.message,"err"),this.setState({downloader:null,progress:0})}))}handleCancel(){this.props.uploading?this.props.onCancelUpload():this.state.downloader&&this.state.downloader.cancel()}render(){let e=this.props.filename||"file_attachment";e.length>36&&(e=e.substr(0,16)+"..."+e.substr(-16));let a,n,i=this.props.size>0?t().createElement("span",{className:"small gray"},"(",ga(this.props.size),")"):null;this.props.uploading||this.state.downloader||!function(e){return e&&!/^\s*([a-z][a-z0-9+.-]*:|\/\/)/im.test(e)}(this.props.downloadUrl)?(a=wa(this.props.downloadUrl),n=null):(a="#",n=e=>{e.preventDefault(),this.downloadFile(this.props.downloadUrl,this.props.filename,this.props.mimetype)});const r=t().createElement(t().Fragment,null,t().createElement("i",{className:"material-icons"},"file_download")," ",t().createElement(s.FormattedMessage,{id:"save_attachment",defaultMessage:[{type:0,value:"save"}]}));return t().createElement("div",{className:"attachment"},t().createElement("div",null,t().createElement("i",{className:"material-icons big gray"},"insert_drive_file")),t().createElement("div",{className:"flex-column"},t().createElement("div",null,e," ",i),this.props.uploading||this.state.downloader?t().createElement(za,{progress:this.props.uploading?this.props.progress:this.state.progress,onCancel:this.handleCancel}):t().createElement("div",null,a?t().createElement("a",{href:a,download:this.props.filename,onClick:n},r):t().createElement("span",{className:"light-gray"},r))))}}const Yn=(0,s.defineMessages)({message_sending:{id:"message_sending",defaultMessage:[{type:0,value:"sending..."}]},message_sending_failed:{id:"message_sending_failed",defaultMessage:[{type:0,value:"failed"}]}});class $n extends t().PureComponent{render(){const{formatMessage:e}=this.props.intl;let a;a=this.props.received<=Gt.Tinode.MESSAGE_STATUS_SENDING?e(Yn.message_sending):this.props.received==Gt.Tinode.MESSAGE_STATUS_FAILED?e(Yn.message_sending_failed):this.props.timestamp.toLocaleTimeString(this.props.intl.locale,{timeStyle:"short"});const n=Ca(this.props.received),i=n?t().createElement("i",{className:"material-icons small "+n.color},n.name):null;return t().createElement("span",{className:"timestamp"},a," ",i)}}const Xn=(0,s.injectIntl)($n);function Qn(){return Qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Qn.apply(this,arguments)}class Jn extends t().PureComponent{constructor(e){super(e),this.state={progress:0},e.uploader&&(e.uploader.onProgress=this.handleProgress.bind(this)),this.handleImagePreview=this.handleImagePreview.bind(this),this.handleFormButtonClick=this.handleFormButtonClick.bind(this),this.handleContextClick=this.handleContextClick.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleQuoteClick=this.handleQuoteClick.bind(this),this.formatterContext={formatMessage:e.intl.formatMessage.bind(e.intl),viewportWidth:e.viewportWidth,authorizeURL:e.tinode.authorizeURL.bind(e.tinode),onImagePreview:this.handleImagePreview,onFormButtonClick:this.handleFormButtonClick,onQuoteClick:this.handleQuoteClick}}handleImagePreview(e){e.preventDefault(),this.props.onImagePreview({url:e.target.src,filename:e.target.title,width:e.target.dataset.width,height:e.target.dataset.height,size:e.target.dataset.size,type:e.target.dataset.mime})}handleFormButtonClick(e){e.preventDefault();const t={seq:this.props.seq,resp:{}};e.target.dataset.name&&(t.resp[e.target.dataset.name]=e.target.dataset.val?e.target.dataset.val:void 0===e.target.dataset.val?1:""+e.target.dataset.val),"url"==e.target.dataset.act&&(t.ref=wa(e.target.dataset.ref)||"about:blank");const a=e.target.dataset.title||"unknown";this.props.onFormResponse(e.target.dataset.act,a,t)}handleContextClick(e){e.preventDefault(),e.stopPropagation();const t=[];this.props.received==Gt.Tinode.MESSAGE_STATUS_FAILED&&t.push("menu_item_send_retry"),this.props.userIsWriter&&this.props.received>Gt.Tinode.MESSAGE_STATUS_FAILED&&this.props.received<Gt.Tinode.MESSAGE_STATUS_DEL_RANGE&&t.push("menu_item_reply"),t.push("menu_item_forward"),this.props.showContextMenu({seq:this.props.seq,content:this.props.content,userFrom:this.props.userFrom,userName:this.props.userName,y:e.pageY,x:e.pageX,pickReply:this.props.pickReply},t)}handleProgress(e){this.setState({progress:e})}handleCancelUpload(){this.props.onCancelUpload(this.props.seq,this.props.uploader)}handleQuoteClick(e){e.preventDefault(),e.stopPropagation();const t=this.props.replyToSeq;t&&this.props.onQuoteClick(t)}render(){const e=this.props.sequence+" "+(this.props.response?"left":"right"),a="single"==this.props.sequence||"last"==this.props.sequence?"bubble tip":"bubble",n=this.props.userAvatar||!0,i=this.props.isGroup&&this.props.response&&("single"==this.props.sequence||"last"==this.props.sequence);let r=this.props.content;const o=[];if(this.props.mimeType==Gt.Drafty.getContentType()&&Gt.Drafty.isValid(r)){Gt.Drafty.attachments(r,((e,a)=>{"application/json"!=e.mime&&o.push(t().createElement(Gn,{tinode:this.props.tinode,downloadUrl:Gt.Drafty.getDownloadUrl(e),filename:e.name,uploading:Gt.Drafty.isProcessing(e),mimetype:e.mime,size:Gt.Drafty.getEntitySize(e),progress:this.state.progress,onCancelUpload:this.handleCancelUpload,onError:this.props.onError,key:a}))}),this);const e=Gt.Drafty.format(r,Ka,this.formatterContext);r=t().createElement(t().Fragment,null,e)}else this.props.deleted?r=t().createElement(t().Fragment,null,t().createElement("i",{className:"material-icons gray"},"block")," ",t().createElement("i",{className:"gray"},t().createElement(s.FormattedMessage,{id:"deleted_content",defaultMessage:[{type:0,value:"content deleted"}]}))):"string"!=typeof r&&(r=t().createElement(t().Fragment,null,t().createElement("i",{className:"material-icons gray"},"warning_amber")," ",t().createElement("i",{className:"gray"},t().createElement(s.FormattedMessage,{id:"invalid_content",defaultMessage:[{type:0,value:"invalid content"}]}))));return t().createElement("li",{ref:this.props.innerRef,className:e},this.props.isGroup&&this.props.response?t().createElement("div",{className:"avatar-box"},i?t().createElement(Ta,{tinode:this.props.tinode,topic:this.props.userFrom,title:this.props.userName,avatar:n}):null):null,t().createElement("div",null,t().createElement("div",{className:a},t().createElement("div",{className:"content-meta"},t().createElement("div",{className:"message-content"},r,o),this.props.timestamp?t().createElement(Xn,{timestamp:this.props.timestamp,received:this.props.received}):null),this.props.showContextMenu?t().createElement("span",{className:"menuTrigger"},t().createElement("a",{href:"#",onClick:this.handleContextClick},t().createElement("i",{className:"material-icons"},"expand_more"))):null),i?t().createElement("div",{className:"author"},this.props.userName||t().createElement("i",null,t().createElement(s.FormattedMessage,{id:"user_not_found",defaultMessage:[{type:0,value:"Not found"}]}))):null))}}const Zn=(0,s.injectIntl)(Jn),ei=t().forwardRef(((e,a)=>t().createElement(Zn,Qn({innerRef:a},e))));var ti=a(349);const ai=100,ni="audio/webm";class ii extends t().PureComponent{constructor(e){super(e),this.state={enabled:!0,audioRecord:null,recording:!0,paused:!1,duration:"0:00",blobUrl:null,preview:null},this.visualize=this.visualize.bind(this),this.initMediaRecording=this.initMediaRecording.bind(this),this.initCanvas=this.initCanvas.bind(this),this.getRecording=this.getRecording.bind(this),this.cleanUp=this.cleanUp.bind(this),this.handleResume=this.handleResume.bind(this),this.handlePause=this.handlePause.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDone=this.handleDone.bind(this),this.durationMillis=0,this.startedOn=null,this.viewBuffer=[],this.canvasRef=t().createRef()}componentDidMount(){this.stream=null,this.mediaRecorder=null,this.audioContext=null,this.audioInput=null,this.analyser=null,this.audioChunks=[];try{navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(this.initMediaRecording,this.props.onError)}catch(e){this.props.onError(e)}}componentWillUnmount(){this.startedOn=null,this.stream&&this.cleanUp()}visualize(){this.initCanvas();const e=new Uint8Array(this.analyser.frequencyBinCount),t=this.canvasWidth,a=this.canvasHeight,n=t/10|0,i=ai*n;this.canvasContext.lineWidth=6,this.canvasContext.strokeStyle="#BBBD";let s=0,r=0,o=0;const l=()=>{if(!this.startedOn)return;window.requestAnimationFrame(l);const c=this.durationMillis+(Date.now()-this.startedOn);this.setState({duration:ma(c/1e3)}),c>6e5&&(this.startedOn=null,this.mediaRecorder.pause(),this.durationMillis+=Date.now()-this.startedOn,this.setState({enabled:!1,recording:!1,duration:ma(this.durationMillis/1e3)})),this.analyser.getByteTimeDomainData(e);let d=0;for(const t of e)d+=(t-127)**2;r+=Math.sqrt(d/e.length),o++;let h=c/ai|0;const p=i>c?0:(c-ai*h)/ai*10;s!=h&&(s=h,this.viewBuffer.push(r/o),r=0,o=0,this.viewBuffer.length>n&&this.viewBuffer.shift()),this.canvasContext.clearRect(0,0,t,a),this.canvasContext.beginPath();for(let e=0;e<this.viewBuffer.length;e++){let t=10*e-p,n=Math.min(this.viewBuffer[e]/64,.9)*a;this.canvasContext.moveTo(t,.5*(a-n)),this.canvasContext.lineTo(t,.5*a+.5*n)}this.canvasContext.stroke()};l()}handlePause(e){e.preventDefault(),this.mediaRecorder.pause(),this.mediaRecorder.requestData(),this.durationMillis+=Date.now()-this.startedOn,this.startedOn=null,this.setState({recording:!1})}handleResume(e){e.preventDefault(),this.state.enabled&&(this.startedOn=Date.now(),this.mediaRecorder.resume(),this.setState({recording:!0},this.visualize))}handleDelete(e){e.preventDefault(),this.durationMillis=0,this.startedOn=null,this.mediaRecorder.stop(),this.cleanUp(),this.setState({recording:!1})}handleDone(e){e.preventDefault(),this.setState({recording:!1}),this.startedOn&&(this.durationMillis+=Date.now()-this.startedOn,this.startedOn=null),this.mediaRecorder&&this.mediaRecorder.stop()}initCanvas(){this.canvasRef.current.width=2*this.canvasRef.current.offsetWidth,this.canvasRef.current.height=2*this.canvasRef.current.offsetHeight,this.canvasContext=this.canvasRef.current.getContext("2d"),this.canvasContext.lineCap="round",this.canvasContext.translate(.5,.5),this.canvasWidth=this.canvasRef.current.width,this.canvasHeight=this.canvasRef.current.height}initMediaRecording(e){this.stream=e,this.mediaRecorder=new MediaRecorder(e,{mimeType:ni,audioBitsPerSecond:24e3}),this.audioContext=new AudioContext,this.audioInput=this.audioContext.createMediaStreamSource(e),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=256,this.audioInput.connect(this.analyser),this.mediaRecorder.onstop=e=>{this.durationMillis>2e3?this.getRecording(this.mediaRecorder.mimeType,this.durationMillis).then((e=>this.props.onFinished(e.url,e.preview,this.durationMillis))):this.props.onDeleted(),this.cleanUp()},this.mediaRecorder.ondataavailable=e=>{e.data.size>0&&this.audioChunks.push(e.data),"inactive"!=this.mediaRecorder.state&&this.getRecording(this.mediaRecorder.mimeType).then((e=>{this.setState({blobUrl:e.url,preview:e.preview})}))},this.durationMillis=0,this.startedOn=Date.now(),this.mediaRecorder.start(),this.visualize()}getRecording(e,t){e=e||ni;let a=new Blob(this.audioChunks,{type:e});return this.tempFixMetadata(a,e).then((e=>(a=e,e.arrayBuffer()))).then((e=>this.audioContext.decodeAudioData(e))).then((e=>this.createPreview(e))).then((e=>({url:window.URL.createObjectURL(a),preview:Ua(e)})))}tempFixMetadata(e,t){const a=new ti.h,n=new ti.Ej;let i;n.logging=!0,n.logGroup="Raw WebM file",n.drop_default_duration=!1,e.arrayBuffer().then((e=>(i=e,a.decode(e)))).then((e=>{e.forEach((e=>n.read(e))),n.stop();const a=ti.rj.makeMetadataSeekable(n.metadatas,n.duration,n.cues),s=i.slice(n.metadataSize);return new Blob([a,s],{type:t})}))}createPreview(e){const t=e.getChannelData(0),a=Math.min(t.length,96),n=t.length/a|0,i=Math.max(1,n/10|0);let s=[],r=-1;for(let e=0;e<a;e++){let a=0,o=0;for(let s=0;s<n;s+=i)a+=t[n*e+s]**2,o++;const l=Math.sqrt(a/o);s.push(l),r=Math.max(r,l)}return r>0&&(s=s.map((e=>100*e/r|0))),s}cleanUp(){this.audioInput.disconnect(),this.stream.getTracks().forEach((e=>e.stop()))}render(){const e="material-icons "+(this.state.enabled?"red":"gray");return t().createElement("div",{className:"audio"},t().createElement("a",{href:"#",onClick:this.handleDelete,title:"Delete"},t().createElement("i",{className:"material-icons gray"},"delete_outline")),this.state.recording?t().createElement("canvas",{ref:this.canvasRef}):t().createElement(La,{src:this.state.blobUrl,preview:this.state.preview,duration:this.durationMillis,short:!0}),t().createElement("div",{className:"duration"},this.state.duration),this.state.recording?t().createElement("a",{href:"#",onClick:this.handlePause,title:"Pause"},t().createElement("i",{className:"material-icons"},"pause_circle_outline")):t().createElement("a",{href:"#",onClick:this.handleResume,title:"Resume"},t().createElement("i",{className:e},"radio_button_checked")),t().createElement("a",{href:"#",onClick:this.handleDone,title:"Send"},t().createElement("i",{className:"material-icons"},"send")))}}const si=(0,s.defineMessages)({messaging_disabled:{id:"messaging_disabled_prompt",defaultMessage:[{type:0,value:"Messaging disabled"}]},type_new_message:{id:"new_message_prompt",defaultMessage:[{type:0,value:"New message"}]},add_image_caption:{id:"image_caption_prompt",defaultMessage:[{type:0,value:"Image caption"}]},file_attachment_too_large:{id:"file_attachment_too_large",defaultMessage:[{type:0,value:"The file size "},{type:1,value:"size"},{type:0,value:" exceeds the "},{type:1,value:"limit"},{type:0,value:" limit."}]},cannot_initiate_upload:{id:"cannot_initiate_file_upload",defaultMessage:[{type:0,value:"Cannot initiate file upload."}]}});class ri extends t().PureComponent{constructor(e){super(e),this.state={quote:null,message:"",audioRec:!1,audioAvailable:!(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia),keypressTimestamp:(new Date).getTime()-Zt-1},this.handlePasteEvent=this.handlePasteEvent.bind(this),this.handleAttachImage=this.handleAttachImage.bind(this),this.handleAttachFile=this.handleAttachFile.bind(this),this.handleAttachAudio=this.handleAttachAudio.bind(this),this.handleSend=this.handleSend.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMessageTyping=this.handleMessageTyping.bind(this),this.handleQuoteClick=this.handleQuoteClick.bind(this),this.formatReply=this.formatReply.bind(this)}componentDidMount(){this.messageEditArea&&this.messageEditArea.addEventListener("paste",this.handlePasteEvent,!1),this.setState({quote:this.formatReply()})}componentWillUnmount(){this.messageEditArea&&this.messageEditArea.removeEventListener("paste",this.handlePasteEvent,!1)}componentDidUpdate(e){this.messageEditArea&&this.messageEditArea.focus(),e.topicName!=this.props.topicName&&this.setState({message:"",audioRec:!1,quote:null}),e.reply!=this.props.reply&&this.setState({quote:this.formatReply()})}formatReply(){return this.props.reply?Gt.Drafty.format(this.props.reply.content,Qa,{formatMessage:this.props.intl.formatMessage.bind(this.props.intl),authorizeURL:this.props.tinode.authorizeURL.bind(this.props.tinode)}):null}handlePasteEvent(e){this.props.disabled||function(e,t,a,n){const i=(e.clipboardData||e.originalEvent.clipboardData||{}).items;if(!i||!i.length)return!1;for(let e in i){const s=i[e];if("file"===s.kind){const e=s.getAsFile();if(!e){console.error("Failed to get file object from pasted file item",s.kind,s.type),n("Failed to get file object from pasted file item");continue}return e.type&&"image"==e.type.split("/")[0]?t(e):a(e),!0}}return!1}(e,(e=>{this.props.onAttachImage(e)}),(e=>{this.props.onAttachFile(e)}),this.props.onError)&&e.preventDefault()}handleAttachImage(e){e.target.files&&e.target.files.length>0&&this.props.onAttachImage(e.target.files[0]),e.target.value=""}handleAttachFile(e){e.target.files&&e.target.files.length>0&&this.props.onAttachFile(e.target.files[0]),e.target.value=""}handleAttachAudio(e,t,a){this.setState({audioRec:!1}),this.props.onAttachAudio(e,t,a)}handleSend(e){e.preventDefault();const t=this.state.message.trim();(t||this.props.acceptBlank||this.props.noInput)&&(this.props.onSendMessage(t),this.setState({message:""}))}handleKeyPress(e){if(this.state.audioRec)return e.preventDefault(),void e.stopPropagation();"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),e.stopPropagation(),this.handleSend(e)))}handleMessageTyping(e){const t={message:e.target.value};if(this.props.onKeyPress){const e=(new Date).getTime();e-this.state.keypressTimestamp>Zt&&(this.props.onKeyPress(),t.keypressTimestamp=e)}this.setState(t)}handleQuoteClick(e){if(e.preventDefault(),e.stopPropagation(),this.props.reply&&this.props.onQuoteClick){const e=this.props.reply.seq;this.props.onQuoteClick(e)}}render(){const{formatMessage:e}=this.props.intl,a=this.props.disabled?e(si.messaging_disabled):this.props.messagePrompt?e(si[this.props.messagePrompt]):e(si.type_new_message),n=this.state.quote?t().createElement("div",{id:"reply-quote-preview"},t().createElement("div",{className:"cancel"},t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCancelReply()}},t().createElement("i",{className:"material-icons gray"},"close"))),this.state.quote):null,i=this.state.audioAvailable&&this.props.onAttachAudio;return t().createElement("div",{id:"send-message-wrapper"},this.props.noInput?null:n,t().createElement("div",{id:"send-message-panel"},this.props.disabled?t().createElement("div",{id:"writing-disabled"},a):t().createElement(t().Fragment,null,this.props.onAttachFile&&!this.state.audioRec?t().createElement(t().Fragment,null,t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.attachImage.click()},title:"Add image"},t().createElement("i",{className:"material-icons secondary"},"photo")),t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.attachFile.click()},title:"Attach file"},t().createElement("i",{className:"material-icons secondary"},"attach_file"))):null,this.props.noInput?n||t().createElement("div",{className:"hr thin"}):this.state.audioRec?t().createElement(ii,{onDeleted:e=>this.setState({audioRec:!1}),onFinished:this.handleAttachAudio}):t().createElement("textarea",{id:"sendMessage",placeholder:a,value:this.state.message,onChange:this.handleMessageTyping,onKeyPress:this.handleKeyPress,ref:e=>{this.messageEditArea=e},autoFocus:!0}),this.state.message||!i?t().createElement("a",{href:"#",onClick:this.handleSend,title:"Send"},t().createElement("i",{className:"material-icons"},"send")):this.state.audioRec?null:t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.setState({audioRec:!0})},title:"Voice"},t().createElement("i",{className:"material-icons"},"mic")),t().createElement("input",{type:"file",ref:e=>{this.attachFile=e},onChange:this.handleAttachFile,style:{display:"none"}}),t().createElement("input",{type:"file",ref:e=>{this.attachImage=e},accept:"image/*",onChange:this.handleAttachImage,style:{display:"none"}}))))}}const oi=(0,s.injectIntl)(ri);class li extends t().PureComponent{constructor(e){super(e),this.handleSendDoc=this.handleSendDoc.bind(this)}handleSendDoc(e){this.props.onClose(),this.props.onSendMessage(this.props.content.file)}render(){return this.props.content?t().createElement("div",{id:"image-preview"},t().createElement("div",{id:"image-preview-caption-panel"},t().createElement("span",null,this.props.content.name),t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onClose()}},t().createElement("i",{className:"material-icons gray"},"close"))),t().createElement("div",{id:"image-preview-container"},t().createElement("div",{className:"flex-column narrow"},t().createElement("i",{className:"material-icons gray"},function(e){const t={default:"insert_drive_file",image:"image",text:"description",video:"theaters"};return t[e]||t[(e||"").split("/")[0]]||t.default}(this.props.content.type)),t().createElement("div",null,t().createElement("b",null,t().createElement(s.FormattedMessage,{id:"label_file_name",defaultMessage:[{type:0,value:"File name:"}]}))," ",fa(this.props.content.name,24)||"-"),t().createElement("div",null,t().createElement("b",null,t().createElement(s.FormattedMessage,{id:"label_content_type",defaultMessage:[{type:0,value:"Content type:"}]}))," ",this.props.content.type||"application/octet-stream"),t().createElement("div",null,t().createElement("b",null,t().createElement(s.FormattedMessage,{id:"label_size",defaultMessage:[{type:0,value:"Size:"}]}))," ",ga(this.props.content.size)))),t().createElement(oi,{noInput:!0,tinode:this.props.tinode,reply:this.props.reply,onCancelReply:this.props.onCancelReply,onSendMessage:this.handleSendDoc,onError:this.props.onError})):null}}class ci extends t().Component{constructor(e){super(e)}render(){const e=[],a=(this.props.subscribers||[]).length,n=Math.min(4,a);return(this.props.subscribers||[]).some((a=>(e.push(t().createElement("div",{className:"avatar-box",key:a.user},t().createElement(Ta,{tinode:this.props.tinode,topic:a.user,avatar:Ia(a.public?a.public.photo:null)||!0,title:a.public?a.public.fn:null}))),e.length==n))),t().createElement("div",{id:"topic-users"},e," ",a>n?t().createElement("span",null,t().createElement(s.FormattedMessage,{id:"more_online_members",defaultMessage:[{type:0,value:"+"},{type:1,value:"overflow"},{type:0,value:" more"}],values:{overflow:a-n}})):null)}}class di extends t().PureComponent{constructor(e){super(e),this.state={width:0,height:0},this.handleSendImage=this.handleSendImage.bind(this)}assignWidth(e){if(e&&!this.state.width){const t=e.getBoundingClientRect();this.setState({width:0|t.width,height:0|t.height})}}handleSendImage(e){this.props.onClose(),this.props.onSendMessage(e,this.props.content.blob)}render(){if(!this.props.content)return null;const e=Na(this.props.content.width,this.props.content.height,this.state.width,this.state.height,!1),a=e?{width:e.dstWidth+"px",height:e.dstHeight+"px"}:this.props.content.width>this.props.content.height?{width:"100%"}:{height:"100%"};a.maxWidth="100%",a.maxHeight="100%";const n=Math.max((this.state.width/ta/1.5|0)-2,12),i=fa(this.props.content.name,n)||"-",r=this.props.content.width||"-",o=this.props.content.height||"-";return t().createElement("div",{id:"image-preview"},t().createElement("div",{id:"image-preview-caption-panel"},this.props.onSendMessage?t().createElement("span",null,i):t().createElement("a",{href:this.props.content.url,download:!0},t().createElement("i",{className:"material-icons"},"file_download")," ",t().createElement(s.FormattedMessage,{id:"download_action",defaultMessage:[{type:0,value:"download"}]})),t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onClose()}},t().createElement("i",{className:"material-icons gray"},"close"))),t().createElement("div",{id:"image-preview-container",ref:e=>this.assignWidth(e)},t().createElement("img",{src:this.props.content.url,style:a,className:"image-preview",alt:this.props.content.name})),this.props.onSendMessage?t().createElement(oi,{messagePrompt:"add_image_caption",acceptBlank:!0,tinode:this.props.tinode,reply:this.props.reply,onCancelReply:this.props.onCancelReply,onSendMessage:this.handleSendImage,onError:this.props.onError}):t().createElement("div",{id:"image-preview-footer"},t().createElement("div",null,t().createElement("div",null,t().createElement("b",null,t().createElement(s.FormattedMessage,{id:"label_file_name",defaultMessage:[{type:0,value:"File name:"}]}))),t().createElement("div",null,t().createElement("span",{title:this.props.content.name},i))),t().createElement("div",null,t().createElement("div",null,t().createElement("b",null,t().createElement(s.FormattedMessage,{id:"label_content_type",defaultMessage:[{type:0,value:"Content type:"}]}))),t().createElement("div",null,this.props.content.type)),t().createElement("div",null,t().createElement("div",null,t().createElement("b",null,t().createElement(s.FormattedMessage,{id:"label_size",defaultMessage:[{type:0,value:"Size:"}]}))),t().createElement("div",null,r," × ",o," px; ",ga(this.props.content.size)))))}}class hi extends t().PureComponent{constructor(e){super(e),this.handleButtonAction=this.handleButtonAction.bind(this)}handleButtonAction(e,t){e.preventDefault(),this.props.onAction(t)}render(){return t().createElement("div",{className:"accept-invite-panel"},t().createElement("div",{className:"title"},t().createElement(s.FormattedMessage,{id:"chat_invitation",defaultMessage:[{type:0,value:"You are invited to start a new chat. What would you like to do?"}]})),t().createElement("div",{className:"footer"},t().createElement("button",{className:"primary",onClick:e=>{this.handleButtonAction(e,"accept")}},t().createElement(s.FormattedMessage,{id:"chat_invitation_accept",defaultMessage:[{type:0,value:"Accept"}]})),t().createElement("button",{className:"secondary",onClick:e=>{this.handleButtonAction(e,"delete")}},t().createElement(s.FormattedMessage,{id:"chat_invitation_ignore",defaultMessage:[{type:0,value:"Ignore"}]})),t().createElement("button",{className:"secondary",onClick:e=>{this.handleButtonAction(e,"block")}},t().createElement(s.FormattedMessage,{id:"chat_invitation_block",defaultMessage:[{type:0,value:"Block"}]}))))}}class pi extends t().PureComponent{render(){const e=Xt+" ("+Gt.Tinode.getLibrary()+")";return t().createElement("div",{id:"dummy-view"},t().createElement("div",null,t().createElement("a",{href:"https://github.com/tinode/chat/"},t().createElement("img",{id:"logo",alt:"logo",src:"img/logo.svg"}),t().createElement("h2",null,"Tinode Web")),t().createElement("p",null,t().createElement(s.FormattedMessage,{id:"label_client",defaultMessage:[{type:0,value:"Client:"}]})," ",e),t().createElement("p",null,t().createElement(s.FormattedMessage,{id:"label_server",defaultMessage:[{type:0,value:"Server:"}]})," ",this.props.serverVersion," (",this.props.serverAddress,")")))}}class ui extends t().PureComponent{constructor(e){super(e)}render(){let e=null,a="bubble";return this.props.deleted?(e=t().createElement(t().Fragment,null,t().createElement("i",{className:"material-icons gray"},"block")," ",t().createElement("i",{className:"gray"},t().createElement(s.FormattedMessage,{id:"deleted_content",defaultMessage:[{type:0,value:"content deleted"}]}))),a+=" deleted"):this.props.date&&(e=t().createElement(t().Fragment,null,this.props.date),a+=" date"),e?t().createElement("li",{className:"meta"},t().createElement("div",{className:a},t().createElement("div",{className:"message-content"},e))):t().createElement(t().Fragment,null,null)}}class mi{static parseUrlHash(e){const t=e.split("?",2),a={};let n=[];return t[0]&&(n=t[0].replace("#","").split("/")),t[1]&&t[1].split("&").forEach((e=>{const t=e.indexOf("=");t>0&&(a[e.slice(0,t)]=decodeURIComponent(e.slice(t+1)))})),{path:n,params:a}}static navigateTo(e){window.location.hash=e}static composeUrlHash(e,t){let a=e.join("/");const n=[];for(const e in t)t.hasOwnProperty(e)&&n.push(e+"="+encodeURIComponent(t[e]));return n.length>0&&(a+="?"+n.join("&")),a}static addUrlParam(e,t,a){const n=mi.parseUrlHash(e);return n.params[t]=a,mi.composeUrlHash(n.path,n.params)}static removeUrlParam(e,t){const a=mi.parseUrlHash(e);return delete a.params[t],mi.composeUrlHash(a.path,a.params)}static setUrlSidePanel(e,t){const a=mi.parseUrlHash(e);return a.path[0]=t,mi.composeUrlHash(a.path,a.params)}static setUrlInfoPanel(e,t){const a=mi.parseUrlHash(e);return t?a.params.info=t:delete a.params.info,mi.composeUrlHash(a.path,a.params)}static setUrlTopic(e,t){const a=mi.parseUrlHash(e);return a.path[1]=t,delete a.params.info,mi.composeUrlHash(a.path,a.params)}}const gi=(0,s.defineMessages)({online_now:{id:"online_now",defaultMessage:[{type:0,value:"online now"}]},last_seen:{id:"last_seen_timestamp",defaultMessage:[{type:0,value:"Last seen"}]},not_found:{id:"title_not_found",defaultMessage:[{type:0,value:"Not found"}]},channel:{id:"channel",defaultMessage:[{type:0,value:"channel"}]},file_attachment_too_large:{id:"file_attachment_too_large",defaultMessage:[{type:0,value:"The file size "},{type:1,value:"size"},{type:0,value:" exceeds the "},{type:1,value:"limit"},{type:0,value:" limit."}]},invalid_content:{id:"invalid_content",defaultMessage:[{type:0,value:"invalid content"}]}});function fi(e){if(e){const t=e.getExcessive()||"";return e.isJoiner("given")&&(t.includes("R")||t.includes("W"))}return!1}function _i(e){if(e){const t=e.getMissing()||"";return e.isJoiner("want")&&(t.includes("R")||t.includes("W"))}return!1}function vi(e){return 1==e||3==e}class bi extends t().Component{constructor(e){super(e),this.state=bi.getDerivedStateFromProps(e,{}),this.leave=this.leave.bind(this),this.sendMessage=this.sendMessage.bind(this),this.retrySend=this.retrySend.bind(this),this.sendImageAttachment=this.sendImageAttachment.bind(this),this.sendFileAttachment=this.sendFileAttachment.bind(this),this.sendAudioAttachment=this.sendAudioAttachment.bind(this),this.sendKeyPress=this.sendKeyPress.bind(this),this.subscribe=this.subscribe.bind(this),this.handleScrollReference=this.handleScrollReference.bind(this),this.handleScrollEvent=this.handleScrollEvent.bind(this),this.handleDescChange=this.handleDescChange.bind(this),this.handleSubsUpdated=this.handleSubsUpdated.bind(this),this.handleMessageUpdate=this.handleMessageUpdate.bind(this),this.handleAllMessagesReceived=this.handleAllMessagesReceived.bind(this),this.handleInfoReceipt=this.handleInfoReceipt.bind(this),this.handleImagePostview=this.handleImagePostview.bind(this),this.handleClosePreview=this.handleClosePreview.bind(this),this.handleFormResponse=this.handleFormResponse.bind(this),this.handleContextClick=this.handleContextClick.bind(this),this.handleShowMessageContextMenu=this.handleShowMessageContextMenu.bind(this),this.handleNewChatAcceptance=this.handleNewChatAcceptance.bind(this),this.handleEnablePeer=this.handleEnablePeer.bind(this),this.handleAttachFile=this.handleAttachFile.bind(this),this.handleAttachImage=this.handleAttachImage.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.postReadNotification=this.postReadNotification.bind(this),this.clearNotificationQueue=this.clearNotificationQueue.bind(this),this.goToLatestMessage=this.goToLatestMessage.bind(this),this.handlePickReply=this.handlePickReply.bind(this),this.handleCancelReply=this.handleCancelReply.bind(this),this.handleQuoteClick=this.handleQuoteClick.bind(this),this.handleCallHangup=this.handleCallHangup.bind(this),this.chatMessageRefs={},this.getOrCreateMessageRef=this.getOrCreateMessageRef.bind(this),this.readNotificationQueue=[],this.readNotificationTimer=null,this.keyPressTimer=null}getOrCreateMessageRef(e){if(this.chatMessageRefs.hasOwnProperty(e))return this.chatMessageRefs[e];const a=t().createRef();return this.chatMessageRefs[e]=a,a}componentDidMount(){this.messagesScroller&&this.messagesScroller.addEventListener("scroll",this.handleScrollEvent)}componentWillUnmount(){this.messagesScroller&&this.messagesScroller.removeEventListener("scroll",this.handleScrollEvent),this.clearNotificationQueue()}componentDidUpdate(e,t){!this.messagesScroller||t.topic==this.state.topic&&t.messageCount==this.state.messageCount||this.state.scrollPosition<100&&(this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.state.scrollPosition-this.messagesScroller.offsetHeight);const a=this.props.tinode?this.props.tinode.getTopic(this.state.topic):void 0;this.state.topic!=t.topic&&(t.topic&&!Gt.Tinode.isNewGroupTopicName(t.topic)&&(this.leave(t.topic),t.rtcPanel&&this.handleCallHangup(t.topic,e.callSeq)),a&&(a.onData=this.handleMessageUpdate,a.onAllMessagesReceived=this.handleAllMessagesReceived,a.onInfo=this.handleInfoReceipt,a.onMetaDesc=this.handleDescChange,a.onSubsUpdated=this.handleSubsUpdated,a.onPres=this.handleSubsUpdated)),this.props.applicationVisible?this.postReadNotification(0):this.clearNotificationQueue(),!a||this.state.topic==t.topic&&e.ready||(a._new&&a.isP2PType()?a.getMeta(a.startMetaQuery().withDesc().build()):this.subscribe(a))}static getDerivedStateFromProps(e,t){let a={};if(e.topic)if(e.topic!=t.topic){const n=e.tinode.getTopic(e.topic);if(a={topic:e.topic,docPreview:null,imagePreview:null,imagePostview:null,rtcPanel:null,typingIndicator:!1,scrollPosition:0,fetchingMessages:!1,showGoToLastButton:!1,deleted:n._deleted},e.forwardMessage&&(a.reply={content:e.forwardMessage.preview,seq:null}),n){const i=[];e.connected&&n.subscribers((t=>{t.online&&t.user!=e.myUserId&&i.push(t)})),Object.assign(a,{onlineSubs:i}),n.public?Object.assign(a,{title:n.public.fn,avatar:Ia(n.public.photo)}):Object.assign(a,{title:"",avatar:null});const s=n.p2pPeerDesc();s?Object.assign(a,{peerMessagingDisabled:_i(s.acs)}):t.peerMessagingDisabled&&Object.assign(a,{peerMessagingDisabled:!1}),Object.assign(a,{messageCount:n.messageCount(),latestClearId:n.maxClearId(),channel:n.isChannelType()}),e.callTopic==n.name&&vi(e.callState)&&(a.rtcPanel=e.callTopic)}else Object.assign(a,{messageCount:0,latestClearId:-1,onlineSubs:[],title:"",avatar:null,peerMessagingDisabled:!1,channel:!1})}else e.callTopic==t.topic&&!t.rtcPanel&&vi(e.callState)&&(a.rtcPanel=e.callTopic);else a={messageCount:0,latestClearId:-1,onlineSubs:[],topic:null,title:"",avatar:null,isVerified:!1,isStaff:!1,isDangerous:!1,deleted:!1,docPreview:null,imagePreview:null,imagePostview:null,rtcPanel:null,typingIndicator:!1,scrollPosition:0,fetchingMessages:!1,peerMessagingDisabled:!1,channel:!1,reply:null,showGoToLastButton:!1};return e.acs?(e.acs.isWriter()!=t.isWriter&&(a.isWriter=!t.isWriter),e.acs.isReader()!=t.isReader&&(a.isReader=!t.isReader),!e.acs.isReader("given")!=t.readingBlocked&&(a.readingBlocked=!t.readingBlocked),e.acs.isSharer()!=t.isSharer&&(a.isSharer=!t.isSharer)):(t.isWriter&&(a.isWriter=!1),t.isReader&&(a.isReader=!1),t.readingBlocked||(t.readingBlocked=!0),t.isSharer&&(a.isSharer=!1)),fi(e.acs)==!t.unconformed&&(a.unconfirmed=!t.unconformed),!e.connected&&t.onlineSubs&&t.onlineSubs.length>0&&(a.onlineSubs=[]),a}subscribe(e){if(e.isSubscribed()||!this.props.ready)return;const t=this.props.newTopicParams&&this.props.newTopicParams._topicName==this.props.topic;let a=e.startMetaQuery().withLaterDesc().withLaterSub();(this.state.isReader||t)&&(a=a.withLaterData(24),this.state.isReader&&(a=a.withLaterDel()),this.setState({fetchingMessages:!0}));const n=t?this.props.newTopicParams:void 0;e.subscribe(a.build(),n).then((t=>{if(303==t.code)return void mi.navigateTo(mi.setUrlTopic("",t.params.topic));this.state.topic!=t.topic&&this.setState({topic:t.topic}),this.props.onNewTopicCreated(this.props.topic,t.topic);let a=[];e.queuedMessages((t=>{t._sending||(t.head&&t.head.webrtc?a.push(t.seq):e.isSubscribed()&&this.retrySend(t))})),a.length>0&&e.delMessagesList(a,!0)})).catch((e=>{console.error("Failed subscription to",this.state.topic,e),this.props.onError(e.message,"err");const t=bi.getDerivedStateFromProps({},{});t.title=this.props.intl.formatMessage(gi.not_found),this.setState(t)}))}leave(e){if(!e||!this.props.tinode.isTopicCached(e))return;const t=this.props.tinode.getTopic(e);t&&t.isSubscribed()&&t.leave(!1).catch((()=>{})).finally((()=>{this.setState({fetchingMessages:!1}),t.onData=void 0,t.onAllMessagesReceived=void 0,t.onInfo=void 0,t.onMetaDesc=void 0,t.onSubsUpdated=void 0,t.onPres=void 0}))}handleScrollReference(e){e&&(e.addEventListener("scroll",this.handleScrollEvent),this.messagesScroller=e,this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.state.scrollPosition)}handleScrollEvent(e){const t=e.target.scrollHeight-e.target.scrollTop-e.target.offsetHeight;if(this.setState({scrollPosition:t,showGoToLastButton:t>100&&t<this.state.scrollPosition}),!this.state.fetchingMessages&&e.target.scrollTop<=0){const e=this.props.tinode.getTopic(this.state.topic);e&&e.isSubscribed()&&e.msgHasMoreMessages()&&this.setState({fetchingMessages:!0},(()=>{e.getMessagesPage(24).catch((e=>this.props.onError(e.message,"err"))).finally((()=>this.setState({fetchingMessages:!1})))}))}}goToLatestMessage(){this.setState({scrollPosition:0}),this.messagesScroller&&(this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight)}handleDescChange(e){e.public?this.setState({title:e.public.fn,avatar:Ia(e.public.photo)}):this.setState({title:"",avatar:null}),e.acs&&this.setState({isWriter:e.acs.isWriter(),isReader:e.acs.isReader(),readingBlocked:!e.acs.isReader("given"),unconfirmed:fi(e.acs)})}postReadNotification(e){if(!this.props.applicationVisible)return;this.readNotificationTimer||(this.readNotificationTimer=setInterval((e=>{if(0==this.readNotificationQueue.length)return clearInterval(this.readNotificationTimer),void(this.readNotificationTimer=null);let t=-1;for(;this.readNotificationQueue.length>0;){const e=this.readNotificationQueue[0];if(e.topicName!=this.state.topic){this.readNotificationQueue.shift();continue}const a=new Date;if(!(e.sendAt<=a))break;this.readNotificationQueue.shift(),t=Math.max(t,e.seq)}if(t>=0){const e=this.props.tinode.getTopic(this.state.topic);e&&e.noteRead(t)}}),300));const t=new Date;this.readNotificationQueue.push({topicName:this.state.topic,seq:e,sendAt:t.setMilliseconds(t.getMilliseconds()+1500)})}clearNotificationQueue(){this.readNotificationQueue=[],this.readNotificationTimer&&(clearInterval(this.readNotificationTimer),this.readNotificationTimer=null)}handleSubsUpdated(){if(this.state.topic){const e=[],t=this.props.tinode.getTopic(this.state.topic);t.subscribers((t=>{t.online&&t.user!=this.props.myUserId&&e.push(t)}));const a={onlineSubs:e},n=t.p2pPeerDesc();n?Object.assign(a,{peerMessagingDisabled:_i(n.acs)}):this.state.peerMessagingDisabled&&Object.assign(a,{peerMessagingDisabled:!1}),this.setState(a)}}handleMessageUpdate(e){const t=this.props.tinode.getTopic(this.state.topic);if(!e)return void this.setState({latestClearId:t.maxClearId()});clearTimeout(this.keyPressTimer),this.setState({messageCount:t.messageCount(),typingIndicator:!1},(a=>{t.isNewMessage(e.seq)&&(this.state.scrollPosition>100?this.setState({showGoToLastButton:!0}):this.goToLatestMessage())}));t.msgStatus(e,!0)>=Gt.Tinode.MESSAGE_STATUS_SENT&&e.from!=this.props.myUserId&&this.postReadNotification(e.seq)}handleAllMessagesReceived(e){this.setState({fetchingMessages:!1}),e>0&&this.postReadNotification(0)}handleInfoReceipt(e){switch(e.what){case"kp":clearTimeout(this.keyPressTimer),this.keyPressTimer=setTimeout((()=>{this.setState({typingIndicator:!1})}),4e3),this.state.typingIndicator||this.setState({typingIndicator:!0});break;case"read":case"recv":this.forceUpdate();break;default:console.info("Other change in topic: ",e.what)}}handleImagePostview(e){this.setState({imagePostview:e})}handleClosePreview(){this.state.imagePreview&&this.state.imagePreview.url&&URL.revokeObjectURL(this.state.imagePreview.url),this.setState({imagePostview:null,imagePreview:null,docPreview:null})}handleFormResponse(e,t,a){if("pub"==e)this.sendMessage(Gt.Drafty.attachJSON(Gt.Drafty.parse(t),a));else if("url"==e){const e=new URL(a.ref),t=e.searchParams;for(let e in a.resp)a.resp.hasOwnProperty(e)&&t.set(e,a.resp[e]);["name","seq"].map((e=>{a[e]&&t.set(e,a[e])})),t.set("uid",this.props.myUserId),t.set("topic",this.state.topic),e.search=t,window.open(e,"_blank")}else console.info("Unknown action in form",e)}handleContextClick(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.state.topic,y:e.pageY,x:e.pageX})}handleShowMessageContextMenu(e,t){"chan"==e.userFrom&&(e.userFrom=this.state.topic,e.userName=this.state.title),e.topicName=this.state.topic;const a=t||[],n=this.props.tinode.getTopic(e.topicName);if(n){n.isChannelType()||a.push("message_delete");const e=n.getAccessMode();e&&e.isDeleter()&&a.push("message_delete_hard")}this.props.showContextMenu(e,a)}handleNewChatAcceptance(e){this.props.onNewChat(this.state.topic,e)}handleEnablePeer(e){e.preventDefault(),this.props.onChangePermissions(this.state.topic,ea,this.state.topic)}sendKeyPress(){const e=this.props.tinode.getTopic(this.state.topic);e.isSubscribed()&&e.noteKeyPress()}sendMessage(e,t,a){let n;this.props.forwardMessage?(e=this.props.forwardMessage.msg,n=this.props.forwardMessage.head,this.handleCancelReply()):this.state.reply&&this.state.reply.content&&(n={reply:""+this.state.reply.seq},"string"==typeof e&&(e=Gt.Drafty.parse(e)),e=Gt.Drafty.append(Gt.Drafty.sanitizeEntities(this.state.reply.content),e),this.handleCancelReply()),this.props.sendMessage(e,t,a,n)}retrySend(e){this.props.sendMessage(e.content,void 0,void 0,e.head).then((()=>{this.props.tinode.getTopic(this.state.topic).delMessagesList([e.seq],!0)}))}sendFileAttachment(e){const t=.75*this.props.tinode.getServerParam("maxMessageSize",ia)-1024|0;if(e.size>t){const t=this.props.tinode.getLargeFileHelper();if(!t)return void this.props.onError(this.props.intl.formatMessage(gi.cannot_initiate_upload));const a=t.upload(e),n=Gt.Drafty.attachFile(null,{mime:e.type,filename:e.name,size:e.size,urlPromise:a});this.sendMessage(n,a,t)}else(function(e){return new Promise(((t,a)=>{const n=new FileReader;n.onerror=e=>{a(n.error)},n.onload=()=>{t({mime:e.type,bits:n.result.split(",")[1],name:e.name})},n.readAsDataURL(e)}))})(e).then((e=>this.sendMessage(Gt.Drafty.attachFile(null,{mime:e.mime,data:e.bits,filename:e.name})))).catch((e=>this.props.onError(e)))}handleAttachFile(e){const t=this.props.tinode.getServerParam("maxFileUploadSize",sa);e.size>t?this.props.onError(this.props.intl.formatMessage(gi.file_attachment_too_large,{size:ga(e.size),limit:ga(t)}),"err"):this.setState({docPreview:{file:e,name:e.name,size:e.size,type:e.type}})}handleCallHangup(e,t){this.props.onVideoCallClosed(),this.setState({rtcPanel:null}),this.props.onCallHangup(e,t)}sendImageAttachment(e,t){const a=this.state.imagePreview.mime,n=this.state.imagePreview.width,i=this.state.imagePreview.height,s=this.state.imagePreview.name,r=.75*this.props.tinode.getServerParam("maxMessageSize",ia)-1024|0;if(t.size>r){const r=this.props.tinode.getLargeFileHelper();if(!r)return void this.props.onError(this.props.intl.formatMessage(gi.cannot_initiate_upload));const o=r.upload(t);xa(t,64,64,-1,!1).then((e=>Ra(e.blob))).then((l=>{let c=Gt.Drafty.insertImage(null,0,{mime:a,_tempPreview:l.bits,width:n,height:i,filename:s,size:t.size,urlPromise:o});e&&(c=Gt.Drafty.appendLineBreak(c),c=Gt.Drafty.append(c,Gt.Drafty.parse(e))),this.sendMessage(c,o,r)})).catch((e=>{this.props.onError(e,"err")}))}else Ra(t).then((a=>{let r=Gt.Drafty.insertImage(null,0,{mime:a.mime,preview:a.bits,width:n,height:i,filename:s,size:t.size});e&&(r=Gt.Drafty.appendLineBreak(r),r=Gt.Drafty.append(r,Gt.Drafty.parse(e))),this.sendMessage(r)}))}handleAttachImage(e){xa(e,1024,1024,this.props.tinode.getServerParam("maxFileUploadSize",sa),!1).then((e=>{this.setState({imagePreview:{url:URL.createObjectURL(e.blob),blob:e.blob,name:e.name,width:e.width,height:e.height,size:e.blob.size,mime:e.mime}})})).catch((e=>{this.props.onError(e,"err")}))}sendAudioAttachment(e,t,a){fetch(e).then((e=>e.blob())).then((e=>{const n=.75*this.props.tinode.getServerParam("maxMessageSize",ia)-1024;if(e.size>n){const n=this.props.tinode.getLargeFileHelper();if(!n)return void this.props.onError(this.props.intl.formatMessage(gi.cannot_initiate_upload));const i=n.upload(e),s=Gt.Drafty.appendAudio(null,{mime:e.type,size:e.size,duration:a,preview:t,urlPromise:i});this.sendMessage(s,i,n)}else Ra(e).then((n=>{this.sendMessage(Gt.Drafty.appendAudio(null,{mime:n.mime,size:e.size,data:n.bits,duration:a,preview:t}))}))})).catch((e=>{this.props.onError(e)}))}handleCancelUpload(e,t){const a=this.props.tinode.getTopic(this.state.topic).findMessage(e);a&&(a._cancelled=!0),t.cancel()}handlePickReply(e,t,a,n){this.setState({reply:null}),e&&t&&(t="string"==typeof t?Gt.Drafty.init(t):t,t=Gt.Drafty.isValid(t)?Gt.Drafty.replyContent(t,30):Gt.Drafty.append(Gt.Drafty.init("⚠ "),Gt.Drafty.wrapInto(this.props.intl.formatMessage(gi.invalid_content),"EM")),this.setState({reply:{content:Gt.Drafty.quote(n,a,t),seq:e}}),this.props.onCancelForwardMessage())}handleCancelReply(){this.setState({reply:null}),this.props.onCancelForwardMessage()}handleQuoteClick(e){const t=this.getOrCreateMessageRef(e);t&&t.current?(t.current.scrollIntoView({block:"center",behavior:"smooth"}),t.current.classList.add("flash"),setTimeout((()=>{t.current.classList.remove("flash")}),1e3)):console.error("Unresolved message ref",e)}render(){const{formatMessage:e}=this.props.intl;let a;if(this.props.hideSelf)a=null;else if(this.state.topic){let n;if(this.state.imagePreview)n=t().createElement(di,{content:this.state.imagePreview,tinode:this.props.tinode,reply:this.state.reply,onCancelReply:this.handleCancelReply,onClose:this.handleClosePreview,onSendMessage:this.sendImageAttachment});else if(this.state.imagePostview)n=t().createElement(di,{content:this.state.imagePostview,onClose:this.handleClosePreview});else if(this.state.docPreview)n=t().createElement(li,{content:this.state.docPreview,tinode:this.props.tinode,reply:this.state.reply,onCancelReply:this.handleCancelReply,onClose:this.handleClosePreview,onSendMessage:this.sendFileAttachment});else if(this.state.rtcPanel)n=t().createElement(Kn,{topic:this.state.topic,seq:this.props.callSeq,callState:this.props.callState,tinode:this.props.tinode,title:this.state.title,avatar:this.state.avatar||!0,onError:this.props.onError,onHangup:this.handleCallHangup,onInvite:this.props.onCallInvite,onSendOffer:this.props.onCallSendOffer,onIceCandidate:this.props.onCallIceCandidate,onSendAnswer:this.props.onCallSendAnswer});else{const a=this.props.tinode.getTopic(this.state.topic),i=a.isChannelType(),r=a.isGroupType()&&!i,o=[];a.trusted&&(a.trusted.verified&&o.push({icon:"verified",color:"badge-inv"}),a.trusted.staff&&o.push({icon:"staff",color:"badge-inv"}),a.trusted.danger&&o.push({icon:"dangerous",color:"badge-inv"}));const l=[];let c=null,d=null,h=null;const p=new Intl.DateTimeFormat(this.props.intl.locale);a.messages(((e,n,i,s)=>{let o=i?i.from||"chan":null,u="single",m=e.from||"chan";m==c?u=m==o?"middle":"last":m==o&&(u="first"),c=m;const g=!(m==this.props.myUserId),f=a.msgStatus(e,!0);let _,v,b=m;const y=a.userDesc(m);y&&y.public&&(_=y.public.fn,v=Ia(y.public.photo)),h=r?"chat-box group":"chat-box";const w=this.getOrCreateMessageRef(e.seq);let E=e.head?parseInt(e.head.reply):null;if(E&&!isNaN(E)||(E=null),e.hi)l.push(t().createElement(ui,{deleted:!0,key:e.seq}));else{const a=new Date(e.ts);d&&d.toDateString()==a.toDateString()||(l.push(t().createElement(ui,{date:p.format(e.ts),locale:this.props.intl.locale,key:"date-"+e.seq})),d=a),l.push(t().createElement(ei,{tinode:this.props.tinode,content:e.content,mimeType:e.head&&e.head.mime,timestamp:e.ts,response:g,seq:e.seq,isGroup:r,isChan:this.state.channel,userFrom:b,userName:_,userAvatar:v,sequence:u,received:f,uploader:e._uploader,viewportWidth:this.props.viewportWidth,showContextMenu:this.handleShowMessageContextMenu,onImagePreview:this.handleImagePostview,onFormResponse:this.handleFormResponse,onError:this.props.onError,onCancelUpload:this.handleCancelUpload,pickReply:this.handlePickReply,replyToSeq:E,onQuoteClick:this.handleQuoteClick,ref:w,userIsWriter:this.state.isWriter,key:e.seq}))}}));let u=null;if(i)u=e(gi.channel);else{const t=this.props.tinode.getMeTopic().getContact(this.state.topic);t&&Gt.Tinode.isP2PTopicName(t.topic)&&(t.online?u=e(gi.online_now):t.seen&&(u=e(gi.last_seen)+": "+function(e,t){t=t||window.navigator.userLanguage||window.navigator.language;const a=new Date;return e.getFullYear()==a.getFullYear()?e.getMonth()==a.getMonth()&&e.getDate()==a.getDate()?e.toLocaleTimeString(t,{hour12:!1,hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{year:"numeric",month:"short",day:"numeric"})}(t.seen.when,this.props.intl.locale)))}const m=this.state.avatar||!0,g=this.state.deleted?null:this.props.online?"online"+(this.state.typingIndicator?" typing":""):"offline",f="panel-title"+(this.state.deleted?" deleted":"");n=t().createElement(t().Fragment,null,t().createElement("div",{id:"topic-caption-panel",className:"caption-panel"},this.props.displayMobile?t().createElement("a",{href:"#",id:"hide-message-view",onClick:e=>{e.preventDefault(),this.props.onHideMessagesView()}},t().createElement("i",{className:"material-icons"},"arrow_back")):null,t().createElement("div",{className:"avatar-box"},t().createElement(Ta,{tinode:this.props.tinode,avatar:m,topic:this.state.topic,title:this.state.title,deleted:this.state.deleted}),i?null:t().createElement("span",{className:g})),t().createElement("div",{id:"topic-title-group"},t().createElement("div",{id:"topic-title",className:f},this.state.title||t().createElement("i",null,t().createElement(s.FormattedMessage,{id:"unnamed_topic",defaultMessage:[{type:0,value:"Unnamed"}]})),t().createElement(ua,{badges:o})),t().createElement("div",{id:"topic-last-seen"},u)),r?t().createElement(ci,{tinode:this.props.tinode,subscribers:this.state.onlineSubs}):t().createElement("div",{id:"topic-users"}),t().createElement("div",null,t().createElement("a",{href:"#",onClick:this.handleContextClick},t().createElement("i",{className:"material-icons"},"more_vert")))),this.props.displayMobile?t().createElement(bn,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,t().createElement(gn,{show:this.state.fetchingMessages}),t().createElement("div",{id:"messages-container"},t().createElement("button",{className:"action-button"+(this.state.showGoToLastButton?"":" hidden"),onClick:this.goToLatestMessage},t().createElement("i",{className:"material-icons"},"arrow_downward")),t().createElement("div",{id:"messages-panel",ref:this.handleScrollReference},t().createElement("ul",{id:"scroller",className:h},l)),this.state.isReader?null:t().createElement("div",{id:"write-only-background"},this.state.readingBlocked?t().createElement("div",{id:"write-only-note"},t().createElement(s.FormattedMessage,{id:"messages_not_readable",defaultMessage:[{type:0,value:"no access to messages"}]})):null)),this.state.peerMessagingDisabled&&!this.state.unconfirmed?t().createElement("div",{id:"peer-messaging-disabled-note"},t().createElement("i",{className:"material-icons secondary"},"block")," ",t().createElement(s.FormattedMessage,{id:"peers_messaging_disabled",defaultMessage:[{type:0,value:"Peer's messaging is disabled."}]})," ",t().createElement("a",{href:"#",onClick:this.handleEnablePeer},t().createElement(s.FormattedMessage,{id:"enable_peers_messaging",defaultMessage:[{type:0,value:"Enable"}]})),"."):null,this.state.unconfirmed?t().createElement(hi,{onAction:this.handleNewChatAcceptance}):t().createElement(oi,{tinode:this.props.tinode,topicName:this.state.topic,noInput:!!this.props.forwardMessage,disabled:!this.state.isWriter||this.state.deleted,onKeyPress:this.sendKeyPress,onSendMessage:this.sendMessage,onAttachFile:this.props.forwardMessage?null:this.handleAttachFile,onAttachImage:this.props.forwardMessage?null:this.handleAttachImage,onAttachAudio:this.props.forwardMessage?null:this.sendAudioAttachment,onError:this.props.onError,reply:this.state.reply,onQuoteClick:this.handleQuoteClick,onCancelReply:this.handleCancelReply}))}a=t().createElement("div",{id:"topic-view"},n)}else a=t().createElement(pi,{serverVersion:this.props.serverVersion,serverAddress:this.props.serverAddress});return a}}const yi=(0,s.injectIntl)(bi);class wi extends t().PureComponent{render(){return t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onBack()}},t().createElement("i",{className:"material-icons"},"arrow_back"))}}class Ei extends t().PureComponent{render(){return t().createElement("div",null,t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onNewTopic()}},t().createElement("i",{className:"material-icons"},"chat"))," ",t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onSettings()}},t().createElement("i",{className:"material-icons"},"settings")))}}class Ci extends t().PureComponent{render(){return t().createElement("div",null,t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onSignUp()}},t().createElement("i",{className:"material-icons"},"person_add"))," ",t().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onSettings()}},t().createElement("i",{className:"material-icons"},"settings")))}}class Si extends t().PureComponent{render(){const e=[];this.props.trustedBadges&&this.props.trustedBadges.map((t=>{e.push({icon:t,color:"badge-inv"})}));let a=null;return this.props.tinode&&(a=this.props.tinode.authorizeURL(Ea(this.props.avatar,"image"))),t().createElement("div",{id:"side-caption-panel",className:"caption-panel"},this.props.onCancel?t().createElement(wi,{onBack:this.props.onCancel}):null,a?t().createElement("div",{id:"self-avatar",className:"avatar-box"},t().createElement(Ta,{tinode:this.props.tinode,avatar:a,topic:this.props.myUserId,title:this.props.title})):null,t().createElement("div",{id:"sidepanel-title",className:"panel-title"},this.props.title,t().createElement(ua,{badges:e})),"login"===this.props.state?t().createElement(Ci,{onSignUp:this.props.onSignUp,onSettings:this.props.onSettings}):"contacts"===this.props.state?t().createElement(Ei,{onNewTopic:this.props.onNewTopic,onSettings:this.props.onSettings}):null)}}function ki(e,t){return e&&e.substring(0,t)}class Ti extends t().Component{constructor(e){super(e);const t=this.props.tinode.getMeTopic();this.state={fullName:ki(t.public?t.public.fn:void 0,oa),description:ki(t.public?t.public.note:void 0,la),avatar:Ia(t.public?t.public.photo:null)}}render(){return t().createElement("div",{className:"scrollable-panel"},t().createElement("div",{className:"panel-form-column"},t().createElement("a",{href:"#",className:"flat-button float-right",onClick:e=>{e.preventDefault(),this.props.onNavigate("general")}},t().createElement("i",{className:"material-icons"},"edit")," ",t().createElement(s.FormattedMessage,{id:"button_edit",defaultMessage:[{type:0,value:"Edit"}]})),t().createElement("center",null,t().createElement(fn,{tinode:this.props.tinode,avatar:this.state.avatar,readOnly:!0,uid:this.props.myUserId,title:this.state.fullName})),t().createElement("div",{className:"group"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_your_name",defaultMessage:[{type:0,value:"Your name"}]})),t().createElement("div",{className:"large ellipsized"},this.state.fullName)),t().createElement("div",{className:"group"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_user_id",defaultMessage:[{type:0,value:"ID:"}]}))," ",t().createElement("tt",null,this.props.myUserId)),t().createElement("div",{className:"group"},t().createElement(hn,{trustedBadges:this.props.trustedBadges})),this.state.description?t().createElement("div",{className:"group"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_description",defaultMessage:[{type:0,value:"Description"}]})),t().createElement("div",null,this.state.description)):null),t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-column"},t().createElement("a",{href:"#",className:"flat-button",onClick:e=>{e.preventDefault(),this.props.onNavigate("notif")}},t().createElement("i",{className:"material-icons"},"notifications")," ",t().createElement(s.FormattedMessage,{id:"sidepanel_title_acc_notifications",defaultMessage:[{type:0,value:"Notifications"}]})),t().createElement("a",{href:"#",className:"flat-button",onClick:e=>{e.preventDefault(),this.props.onNavigate("security")}},t().createElement("i",{className:"material-icons"},"security")," ",t().createElement(s.FormattedMessage,{id:"button_security",defaultMessage:[{type:0,value:"Security"}]})),t().createElement("a",{href:"#",className:"flat-button",onClick:e=>{e.preventDefault(),this.props.onNavigate("support")}},t().createElement("i",{className:"material-icons"},"contact_support")," ",t().createElement(s.FormattedMessage,{id:"sidepanel_title_acc_support",defaultMessage:[{type:0,value:"Support"}]}))))}}const Mi=(0,s.defineMessages)({archived_contacts_title:{id:"archived_contacts",defaultMessage:[{type:0,value:"Archived contacts ("},{type:1,value:"count"},{type:0,value:")"}]}});class Ai extends t().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this),this.state=Ai.deriveStateFromProps(e)}static deriveStateFromProps(e){const t=[];let a=0,n=0;return e.chatList.map((i=>{const s=i.acs&&!i.acs.isJoiner();s&&e.blocked&&t.push(i),s||e.blocked||(i.private&&i.private.arch?e.archive?t.push(i):n++:e.archive||(t.push(i),a+=i.unread>0?1:0))})),t.sort(((e,t)=>(t.touched||0)-(e.touched||0))),n>0&&t.push({action:"archive",title:Mi.archived_contacts_title,values:{count:n}}),{contactList:t,unreadThreads:a}}componentDidUpdate(e,t){if(e.chatList!=this.props.chatList||e.archive!=this.props.archive||e.blocked!=this.props.blocked){const e=Ai.deriveStateFromProps(this.props);this.setState(e),e.unreadThreads!=t.unreadThreads&&va(e.unreadThreads)}}handleAction(e){this.props.onShowArchive()}render(){return t().createElement(s.FormattedMessage,{id:"contacts_not_found",defaultMessage:[{type:0,value:"You have no chats"},{type:0,value:"<br/>"},{type:0,value:"¯∖_(ツ)_/¯"}]},(e=>t().createElement(sn,{tinode:this.props.tinode,connected:this.props.connected,contacts:this.state.contactList,emptyListMessage:e,topicSelected:this.props.topicSelected,myUserId:this.props.myUserId,showOnline:!0,showUnread:!0,onTopicSelected:this.props.onTopicSelected,showContextMenu:this.props.showContextMenu,onAction:this.handleAction})))}}class Di{static setObject(e,t){localStorage.setItem(e,JSON.stringify(t))}static getObject(e){const t=localStorage.getItem(e);return t&&JSON.parse(t)}static updateObject(e,t){const a=this.getObject(e);this.setObject(e,Object.assign(a||{},t))}static removeItem(e){localStorage.removeItem(e)}}class Ii extends t().PureComponent{constructor(e){super(e),this.state={login:"",password:"",email:"",fn:"",imageUrl:null,uploadUrl:null,newAvatar:null,newAvatarMime:null,errorCleared:!1,buttonDisabled:!1,saveToken:Di.getObject("keep-logged-in")},this.handleLoginChange=this.handleLoginChange.bind(this),this.handlePasswordChange=this.handlePasswordChange.bind(this),this.handleEmailChange=this.handleEmailChange.bind(this),this.handleFnChange=this.handleFnChange.bind(this),this.handleImageChanged=this.handleImageChanged.bind(this),this.handleToggleSaveToken=this.handleToggleSaveToken.bind(this),this.handleAvatarCropped=this.handleAvatarCropped.bind(this),this.handleAvatarCropCancel=this.handleAvatarCropCancel.bind(this),this.uploadAvatar=this.uploadAvatar.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleLoginChange(e){this.setState({login:e.target.value})}handlePasswordChange(e){this.setState({password:e})}handleEmailChange(e){this.setState({email:e.target.value})}handleFnChange(e){this.setState({fn:e.target.value})}handleImageChanged(e,t){this.setState({newAvatar:t,newAvatarMime:e})}handleToggleSaveToken(){Di.setObject("keep-logged-in",!this.state.saveToken),this.setState({saveToken:!this.state.saveToken})}handleSubmit(e){e.preventDefault(),this.setState({errorCleared:!1}),this.props.onCreateAccount(this.state.login.trim(),this.state.password.trim(),ba(this.state.fn.trim().substring(0,oa),this.state.uploadUrl),{meth:"email",val:this.state.email})}handleAvatarCropped(e,t,a,n){const i=t?URL.createObjectURL(t):null;this.setState({avatar:i,newAvatar:null,newAvatarMime:null}),t&&this.uploadAvatar(e,t,a,n)}handleAvatarCropCancel(){this.setState({newAvatar:null,newAvatarMime:null})}uploadAvatar(e,t,a,n){const i=e=>{let{mime:t,blob:a}=e;if(this.setState({imageUrl:URL.createObjectURL(a),buttonDisabled:!0}),a.size>na){this.props.tinode.getLargeFileHelper().upload(a,"newacc").then((e=>this.setState({uploadUrl:e}))).catch((e=>this.props.onError(e.message,"err"))).finally((e=>this.setState({buttonDisabled:!1})))}else Ra(a).then((e=>this.setState({uploadUrl:Ia({data:e.bits,type:t})}))).finally((e=>this.setState({buttonDisabled:!1})))};a>aa||n>aa||a!=n?xa(t,aa,aa,sa,!0).then((e=>i(e))).catch((e=>this.props.onError(e.message,"err"))):i({mime:e,blob:t,width:a,height:n})}render(){if(this.state.newAvatar)return t().createElement(Dn,{avatar:this.state.newAvatar,mime:this.state.newAvatarMime,onSubmit:this.handleAvatarCropped,onCancel:this.handleAvatarCropCancel,onError:this.props.onError});let e="primary";return this.props.disabled&&(e+=" disabled"),t().createElement("form",{className:"panel-form-column",onSubmit:this.handleSubmit},t().createElement("div",{className:"panel-form-row"},t().createElement("div",{className:"panel-form-column"},t().createElement(s.FormattedMessage,{id:"login_prompt",defaultMessage:[{type:0,value:"Login"}]},(e=>t().createElement("input",{type:"text",placeholder:e,autoComplete:"user-name",value:this.state.login,onChange:this.handleLoginChange,required:!0,autoFocus:!0}))),t().createElement(s.FormattedMessage,{id:"password_prompt",defaultMessage:[{type:0,value:"Password"}]},(e=>t().createElement(In,{placeholder:e,autoComplete:"new-password",value:this.state.password,onFinished:this.handlePasswordChange,required:!0})))),t().createElement(fn,{tinode:this.props.tinode,avatar:this.state.imageUrl,onImageUpdated:this.handleImageChanged,onError:this.props.onError})),t().createElement("div",{className:"panel-form-row"},t().createElement(s.FormattedMessage,{id:"full_name_prompt",defaultMessage:[{type:0,value:"Full name, e.g. John Doe"}]},(e=>t().createElement("input",{type:"text",placeholder:e,autoComplete:"name",value:this.state.fn,onChange:this.handleFnChange,required:!0})))),t().createElement("div",{className:"panel-form-row"},t().createElement(s.FormattedMessage,{id:"email_prompt",defaultMessage:[{type:0,value:"Email, e.g. jdoe@example.com"}]},(e=>t().createElement("input",{type:"email",placeholder:e,autoComplete:"email",value:this.state.email,onChange:this.handleEmailChange,required:!0})))),t().createElement("div",{className:"panel-form-row"},t().createElement(_n,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),t().createElement(s.FormattedMessage,{id:"stay_logged_in",defaultMessage:[{type:0,value:"Stay logged in"}]},(e=>t().createElement("label",{htmlFor:"save-token"}," ",e)))),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{className:e,type:"submit",disabled:this.state.buttonDisabled},t().createElement(s.FormattedMessage,{id:"button_sign_up",defaultMessage:[{type:0,value:"Sign up"}]}))))}}class Ni extends t().PureComponent{constructor(e){super(e),this.handleCheckboxClick=this.handleCheckboxClick.bind(this)}handleCheckboxClick(e,t){"sound"==e?this.props.onToggleMessageSounds(t):"alert"==e?this.props.onTogglePushNotifications(t):"incognito"==e&&this.props.onToggleIncognitoMode(t)}render(){return t().createElement("div",{className:"scrollable-panel"},t().createElement("div",{className:"panel-form-row"},t().createElement("label",{htmlFor:"message-sound"},t().createElement(s.FormattedMessage,{id:"label_message_sound",defaultMessage:[{type:0,value:"Message sound:"}]})),t().createElement(_n,{name:"sound",id:"message-sound",checked:this.props.messageSounds,onChange:this.handleCheckboxClick})),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{htmlFor:"desktop-alerts"},this.props.desktopAlertsEnabled?t().createElement(s.FormattedMessage,{id:"label_push_notifications",defaultMessage:[{type:0,value:"Notification alerts:"}]}):t().createElement(s.FormattedMessage,{id:"label_push_notifications_disabled",defaultMessage:[{type:0,value:"Notification alerts (requires HTTPS):"}]})),t().createElement(_n,{name:"alert",id:"desktop-alerts",checked:this.props.desktopAlerts,onChange:this.props.desktopAlertsEnabled?this.handleCheckboxClick:null})),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{htmlFor:"incognito-mode"},t().createElement(s.FormattedMessage,{id:"label_incognito_mode",defaultMessage:[{type:0,value:"Incognito mode:"}]})),t().createElement(_n,{name:"incognito",id:"incognito-mode",checked:this.props.incognitoMode,onChange:this.handleCheckboxClick})))}}const Pi=(0,s.defineMessages)({delete_account:{id:"delete_account",defaultMessage:[{type:0,value:"Delete account"}]},delete_account_warning:{id:"delete_account_warning",defaultMessage:[{type:0,value:"Are you sure you want to delete your account? It cannot be undone."}]}});class xi extends t().Component{constructor(e){super(e);const t=this.props.tinode.getMeTopic();let a=0;t.contacts((e=>{e.acs&&!e.acs.isJoiner()&&a++}));const n=t.getDefaultAccess();this.state={auth:n?n.auth:null,anon:n?n.anon:null,showPermissionEditorFor:void 0,blockedCount:a},this.handlePasswordUpdate=this.handlePasswordUpdate.bind(this),this.handleLaunchPermissionsEditor=this.handleLaunchPermissionsEditor.bind(this),this.handleHidePermissionsEditor=this.handleHidePermissionsEditor.bind(this),this.handlePermissionsChanged=this.handlePermissionsChanged.bind(this),this.handleDeleteAccount=this.handleDeleteAccount.bind(this)}handlePasswordUpdate(e){this.setState({password:e}),this.props.onUpdatePassword(e)}handleLaunchPermissionsEditor(e){this.setState({showPermissionEditorFor:e,editedPermissions:this.state[e]})}handleHidePermissionsEditor(){this.setState({showPermissionEditorFor:void 0})}handlePermissionsChanged(e){let t={};t[this.state.showPermissionEditorFor]=e,this.props.onUpdateAccountDesc("me",void 0,void 0,t);let a={showPermissionEditorFor:void 0};a[this.state.showPermissionEditorFor]=e,this.setState(a)}handleDeleteAccount(e){e.preventDefault();const{formatMessage:t}=this.props.intl;this.props.onShowAlert(t(Pi.delete_account),t(Pi.delete_account_warning),(()=>{this.props.onDeleteAccount()}),null,!0,null)}render(){return t().createElement(t().Fragment,null,this.state.showPermissionEditorFor?t().createElement(Mn,{mode:this.state.editedPermissions,skip:"O",onSubmit:this.handlePermissionsChanged,onCancel:this.handleHidePermissionsEditor}):t().createElement("div",{className:"scrollable-panel"},t().createElement("div",{className:"panel-form-column"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_password",defaultMessage:[{type:0,value:"Password"}]})),t().createElement("div",null,t().createElement(s.FormattedMessage,{id:"password_unchanged_prompt",defaultMessage:[{type:0,value:"Unchanged"}]},(e=>t().createElement(Nn,{placeholder:e,type:"password",onFinished:this.handlePasswordUpdate}))))),t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-column"},t().createElement("a",{href:"#",className:"danger flat-button",onClick:e=>{e.preventDefault(),this.props.onLogout()}},t().createElement("i",{className:"material-icons"},"exit_to_app")," ",t().createElement(s.FormattedMessage,{id:"button_logout",defaultMessage:[{type:0,value:"Logout"}]})),t().createElement("a",{href:"#",className:"danger flat-button",onClick:e=>{this.handleDeleteAccount(e)}},t().createElement("i",{className:"material-icons"},"delete")," ",t().createElement(s.FormattedMessage,{id:"button_delete_account",defaultMessage:[{type:0,value:"Delete account"}]}))),t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-column"},t().createElement("div",null,t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_default_access_mode",defaultMessage:[{type:0,value:"Default access mode:"}]}))),t().createElement("div",{className:"quoted"},t().createElement("div",null,"Auth: ",t().createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"auth")},this.state.auth)),t().createElement("div",null,"Anon: ",t().createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"anon")},this.state.anon)))),this.state.blockedCount>0?t().createElement(t().Fragment,null,t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-row"},t().createElement("i",{className:"material-icons"},"block")," ",t().createElement("a",{href:"#",className:"gray",onClick:e=>{e.preventDefault(),this.props.onShowBlocked()}},t().createElement(s.FormattedMessage,{id:"blocked_contacts_link",defaultMessage:[{type:0,value:"Blocked contacts ("},{type:1,value:"count"},{type:0,value:")"}],values:{count:this.state.blockedCount}})))):null))}}const Ri=(0,s.injectIntl)(xi);class Ui extends t().PureComponent{render(){return t().createElement("div",{className:"scrollable-panel"},t().createElement("div",{className:"panel-form-column"},t().createElement("a",{href:"mailto:support@tinode.co",className:"flat-button",target:"_blank"},t().createElement("i",{className:"material-icons"},"email")," ",t().createElement(s.FormattedMessage,{id:"link_contact_us",defaultMessage:[{type:0,value:"Contact Us"}]})),t().createElement("a",{href:"https://tinode.co/terms.html",className:"flat-button",target:"_blank"},t().createElement("i",{className:"material-icons"},"description")," ",t().createElement(s.FormattedMessage,{id:"link_terms_of_service",defaultMessage:[{type:0,value:"Terms of Service"}]})),t().createElement("a",{href:"https://tinode.co/privacy.html",className:"flat-button",target:"_blank"},t().createElement("i",{className:"material-icons"},"policy")," ",t().createElement(s.FormattedMessage,{id:"link_privacy_policy",defaultMessage:[{type:0,value:"Privacy Policy"}]}))),t().createElement("div",{className:"hr"}),t().createElement("div",{className:"panel-form-column"},t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_client",defaultMessage:[{type:0,value:"Client:"}]})),Xt),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_sdk",defaultMessage:[{type:0,value:"SDK:"}]})),Gt.Tinode.getLibrary()),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_server",defaultMessage:[{type:0,value:"Server:"}]})),this.props.serverVersion),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_server_address",defaultMessage:[{type:0,value:"Server address:"}]})),this.props.serverAddress)))}}class Fi extends t().Component{constructor(e){super(e),this.state={login:e.login,password:"",hostName:e.serverAddress,saveToken:e.persist},this.handleLoginChange=this.handleLoginChange.bind(this),this.handlePasswordChange=this.handlePasswordChange.bind(this),this.handleToggleSaveToken=this.handleToggleSaveToken.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleLoginChange(e){this.setState({login:e.target.value})}handlePasswordChange(e){this.setState({password:e.target.value})}handleToggleSaveToken(){this.props.onPersistenceChange(!this.state.saveToken),this.setState({saveToken:!this.state.saveToken})}handleSubmit(e){e.preventDefault(),this.props.onLogin(this.state.login.trim(),this.state.password.trim())}render(){let e="primary";return this.props.disabled&&(e+=" disabled"),t().createElement("form",{id:"login-form",onSubmit:this.handleSubmit},t().createElement(s.FormattedMessage,{id:"login_prompt",defaultMessage:[{type:0,value:"Login"}]},(e=>t().createElement("input",{type:"text",id:"inputLogin",placeholder:e,autoComplete:"username",autoCorrect:"off",autoCapitalize:"none",value:this.state.login,onChange:this.handleLoginChange,required:!0,autoFocus:!0}))),t().createElement(s.FormattedMessage,{id:"password_prompt",defaultMessage:[{type:0,value:"Password"}]},(e=>t().createElement(In,{type:"password",id:"inputPassword",placeholder:e,autoComplete:"current-password",value:this.state.password,onChange:this.handlePasswordChange,required:!0}))),t().createElement("div",{className:"panel-form-row"},t().createElement(_n,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),t().createElement("label",{htmlFor:"save-token"}," ",t().createElement(s.FormattedMessage,{id:"stay_logged_in",defaultMessage:[{type:0,value:"Stay logged in"}]})),t().createElement("a",{href:"#reset"},t().createElement(s.FormattedMessage,{id:"forgot_password_link",defaultMessage:[{type:0,value:"Forgot password?"}]}))),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{className:e,type:"submit"},t().createElement(s.FormattedMessage,{id:"button_sign_in",defaultMessage:[{type:0,value:"Sign in"}]}))))}}const Bi=(0,s.defineMessages)({invalid_id:{id:"error_invalid_id",defaultMessage:[{type:0,value:"Invalid ID"}]}});class Li extends t().PureComponent{constructor(e){super(e),this.state={groupId:""},this.handleChange=this.handleChange.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleChange(e){this.setState({groupId:e.target.value})}handleKeyPress(e){"Enter"===e.key&&this.handleSubmit(e)}handleSubmit(e){if(e.preventDefault(),this.state.groupId){const e=this.state.groupId.trim(),t=e.substr(0,3);e.length>3&&["usr","grp","chn"].includes(t)?this.props.onSubmit(e):this.props.onError(this.props.intl.formatMessage(Bi.invalid_id),"err")}}render(){return t().createElement("div",{className:"panel-form"},t().createElement("div",{className:"panel-form-row"},t().createElement(s.FormattedMessage,{id:"group_user_id_prompt",defaultMessage:[{type:0,value:"Group or User ID"}]},(e=>t().createElement("input",{type:"text",placeholder:e,value:this.state.groupId,onChange:this.handleChange,onKeyPress:this.handleKeyPress,required:!0,autoFocus:!0})))),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{className:"primary",onClick:this.handleSubmit},t().createElement(s.FormattedMessage,{id:"button_subscribe",defaultMessage:[{type:0,value:"Subscribe"}]}))))}}const Oi=(0,s.injectIntl)(Li);class qi extends t().PureComponent{constructor(e){super(e),this.fullName=t().createRef(),this.state={fullName:"",private:"",description:"",imageUrl:null,tags:[],isChannel:!1,newAvatar:null,newAvatarMime:null},this.handleFieldEdit=this.handleFieldEdit.bind(this),this.handleImageChanged=this.handleImageChanged.bind(this),this.handleAvatarCropped=this.handleAvatarCropped.bind(this),this.handleAvatarCropCancel=this.handleAvatarCropCancel.bind(this),this.uploadAvatar=this.uploadAvatar.bind(this),this.handleTagsChanged=this.handleTagsChanged.bind(this),this.handleChannelToggle=this.handleChannelToggle.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){}handleFieldEdit(e,t){this.setState({[e]:t.target.value||""})}handleImageChanged(e,t){this.setState({newAvatar:t,newAvatarMime:e})}handleAvatarCropped(e,t,a,n){const i=t?URL.createObjectURL(t):null;this.setState({imageUrl:i,newAvatar:null,newAvatarMime:null}),t&&this.uploadAvatar(e,t,a,n)}handleAvatarCropCancel(){this.setState({newAvatar:null,newAvatarMime:null})}uploadAvatar(e,t,a,n){const i=e=>{let{mime:t,blob:a}=e;if(a.size>na){this.props.tinode.getLargeFileHelper().upload(a).then((e=>this.setState({imageUrl:e}))).catch((e=>this.props.onError(e.message,"err")))}else Ra(a).then((e=>this.setState({imageUrl:Ia({data:e.bits,type:t})})))};a>aa||n>aa||a!=n?xa(t,aa,aa,sa,!0).then((e=>i(e))).catch((e=>this.props.onError(e.message,"err"))):i({mime:e,blob:t,width:a,height:n})}handleTagsChanged(e){this.setState({tags:e})}handleChannelToggle(){this.setState({isChannel:!this.state.isChannel})}handleSubmit(e){e.preventDefault();const t=this.state.fullName.trim().substring(0,oa),a=this.state.private.trim().substring(0,oa),n=this.state.description.trim().substring(0,la);t&&this.props.onSubmit(t,n,this.state.imageUrl,a,this.state.tags,this.state.isChannel)}render(){if(this.state.newAvatar)return t().createElement(Dn,{avatar:this.state.newAvatar,mime:this.state.newAvatarMime,onSubmit:this.handleAvatarCropped,onCancel:this.handleAvatarCropCancel,onError:this.props.onError});let e="primary";return this.props.disabled&&(e+=" disabled"),t().createElement("form",{className:"panel-form",onSubmit:this.handleSubmit},t().createElement("div",{className:"panel-form-column"},t().createElement("center",null,t().createElement(fn,{tinode:this.props.tinode,avatar:this.state.imageUrl,onError:this.props.onError,onImageUpdated:this.handleImageChanged})),t().createElement("div",{className:"group"},t().createElement("label",{className:"small",htmlFor:"new-topic-fn"},t().createElement(s.FormattedMessage,{id:"label_topic_name",defaultMessage:[{type:0,value:"Name"}]})),t().createElement(s.FormattedMessage,{id:"topic_name_editing_placeholder",defaultMessage:[{type:0,value:"Freeform name of the group"}]},(e=>t().createElement("input",{type:"text",id:"new-topic-fn",placeholder:e,ref:this.fullName,value:this.state.fullName,onChange:this.handleFieldEdit.bind(this,"fullName"),autoFocus:!0,required:!0,tabIndex:0})))),t().createElement("div",{className:"group"},t().createElement("label",{className:"small",htmlFor:"new-topic-priv"},t().createElement(s.FormattedMessage,{id:"label_private",defaultMessage:[{type:0,value:"Private comment"}]})),t().createElement(s.FormattedMessage,{id:"private_editing_placeholder",defaultMessage:[{type:0,value:"Visible to you only"}]},(e=>t().createElement("input",{type:"text",id:"new-topic-priv",placeholder:e,value:this.state.private,onChange:this.handleFieldEdit.bind(this,"private"),tabIndex:1})))),t().createElement("div",{className:"group"},t().createElement("label",{className:"small",htmlFor:"new-topic-desc"},t().createElement(s.FormattedMessage,{id:"label_description",defaultMessage:[{type:0,value:"Description"}]})),t().createElement(s.FormattedMessage,{id:"description_editing_placeholder",defaultMessage:[{type:0,value:"Description (optional)"}]},(e=>t().createElement("input",{type:"text",id:"new-topic-desc",placeholder:e,value:this.state.description,onChange:this.handleFieldEdit.bind(this,"description"),tabIndex:2}))))),t().createElement("div",{className:"panel-form-row"},t().createElement(_n,{checked:this.state.isChannel,tabIndex:3,onChange:this.handleChannelToggle})," ",t().createElement("label",{onClick:this.handleChannelToggle},t().createElement(s.FormattedMessage,{id:"channel_prompt",defaultMessage:[{type:0,value:"This is a channel"}]}))),t().createElement(s.FormattedMessage,{id:"title_tag_manager",defaultMessage:[{type:0,value:"Tags (search & discovery)"}]},(e=>t().createElement(Pn,{tinode:this.props.tinode,tags:this.state.tags,activated:!0,onTagsChanged:this.handleTagsChanged,tabIndex:4,title:e}))),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{className:e},t().createElement(s.FormattedMessage,{id:"button_create",defaultMessage:[{type:0,value:"Create"}]}))))}}const ji=(0,s.defineMessages)({search_for_contacts:{id:"search_for_contacts",defaultMessage:[{type:0,value:"Use search to find contacts"}]},search_no_results:{id:"search_no_results",defaultMessage:[{type:0,value:"Search returned no results"}]},search_placeholder:{id:"search_placeholder",defaultMessage:[{type:0,value:"List like email:alice@example.com, tel:17025550003..."}]}});class zi extends t().Component{constructor(e){super(e),this.state={tabSelected:"find",searchQuery:null},this.handleTabClick=this.handleTabClick.bind(this),this.handleSearchContacts=this.handleSearchContacts.bind(this),this.handleSearchResultSelected=this.handleSearchResultSelected.bind(this),this.handleNewGroupSubmit=this.handleNewGroupSubmit.bind(this),this.handleGroupByID=this.handleGroupByID.bind(this)}componentDidMount(){this.props.onInitFind()}handleTabClick(e){e.preventDefault(),mi.navigateTo(mi.addUrlParam(window.location.hash,"tab",e.currentTarget.dataset.id)),this.setState({tabSelected:e.currentTarget.dataset.id})}handleSearchContacts(e){this.props.onSearchContacts(e),this.setState({searchQuery:Gt.Tinode.isNullValue(e)?null:e})}handleSearchResultSelected(e){"find"==this.state.tabSelected&&(mi.navigateTo(mi.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e))}handleNewGroupSubmit(e,t,a,n,i,s){mi.navigateTo(mi.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(void 0,{public:ba(e,a,null,t),private:n,tags:i},s)}handleGroupByID(e){mi.navigateTo(mi.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e)}render(){const{formatMessage:e}=this.props.intl,a=e(this.state.searchQuery?ji.search_no_results:ji.search_for_contacts),n=e(ji.search_placeholder);return t().createElement("div",{className:"flex-column"},t().createElement("ul",{className:"tabbar"},t().createElement("li",{className:"find"===this.state.tabSelected?"active":null},t().createElement("a",{href:"#","data-id":"find",onClick:this.handleTabClick},t().createElement(s.FormattedMessage,{id:"tabtitle_find_user",defaultMessage:[{type:0,value:"find"}]}))),t().createElement("li",{className:"grp"===this.state.tabSelected?"active":null},t().createElement("a",{href:"#","data-id":"grp",onClick:this.handleTabClick},t().createElement(s.FormattedMessage,{id:"tabtitle_new_group",defaultMessage:[{type:0,value:"new group"}]}))),t().createElement("li",{className:"byid"===this.state.tabSelected?"active":null},t().createElement("a",{href:"#","data-id":"byid",onClick:this.handleTabClick},t().createElement(s.FormattedMessage,{id:"tabtitle_group_by_id",defaultMessage:[{type:0,value:"by id"}]})))),"grp"===this.state.tabSelected?t().createElement(qi,{tinode:this.props.tinode,onSubmit:this.handleNewGroupSubmit,onError:this.props.onError}):"byid"===this.state.tabSelected?t().createElement(Oi,{onSubmit:this.handleGroupByID,onError:this.props.onError}):t().createElement("div",{className:"flex-column"},t().createElement(rn,{placeholder:n,onSearchContacts:this.handleSearchContacts}),t().createElement(sn,{tinode:this.props.tinode,contacts:this.props.searchResults,myUserId:this.props.myUserId,emptyListMessage:a,showOnline:!1,showUnread:!1,showContextMenu:!1,onTopicSelected:this.handleSearchResultSelected})))}}const Vi=(0,s.injectIntl)(zi);class Hi extends t().PureComponent{constructor(e){super(e),this.state={email:"",password:"",sent:!1},this.handleSubmit=this.handleSubmit.bind(this),this.handleEmailChange=this.handleEmailChange.bind(this),this.handlePasswordChange=this.handlePasswordChange.bind(this)}componentDidMount(){const e=mi.parseUrlHash(window.location.hash);this.setState({token:e.params.token,scheme:e.params.scheme})}handleSubmit(e){if(e.preventDefault(),this.state.token)this.props.onReset(this.state.scheme,this.state.password.trim(),this.state.token);else if(this.state.sent)this.props.onCancel();else{const e=this.state.email.trim();this.setState({email:e}),this.props.onRequest("email",e).then((()=>{this.setState({sent:!0})}))}}handleEmailChange(e){this.setState({email:e.target.value})}handlePasswordChange(e){this.setState({password:e.target.value})}render(){return t().createElement("form",{id:"password-reset-form",onSubmit:this.handleSubmit},this.state.token&&this.state.scheme?t().createElement(t().Fragment,null,t().createElement("label",{htmlFor:"new-password"},t().createElement(s.FormattedMessage,{id:"label_new_password",defaultMessage:[{type:0,value:"New password"}]})),t().createElement(s.FormattedMessage,{id:"new_password_placeholder",defaultMessage:[{type:0,value:"Enter new password"}]},(e=>t().createElement(In,{id:"new-password",placeholder:e,autoComplete:"new-password",value:this.state.password,required:!0,autoFocus:!0,onChange:this.handlePasswordChange})))):this.state.sent?t().createElement(t().Fragment,null,t().createElement("br",null),t().createElement("center",null,t().createElement("i",{className:"material-icons huge green"},"task_alt")),t().createElement("br",null),t().createElement("center",null,t().createElement(s.FormattedMessage,{id:"password_reset_email_sent",defaultMessage:[{type:0,value:"An email has been sent to "},{type:1,value:"email"},{type:0,value:". Follow the directions in the email to reset your password."}],values:{email:t().createElement("tt",null,this.state.email)}}))):t().createElement(t().Fragment,null,t().createElement("label",{htmlFor:"inputEmail"},t().createElement(s.FormattedMessage,{id:"label_reset_password",defaultMessage:[{type:0,value:"Send a password reset email:"}]})),t().createElement(s.FormattedMessage,{id:"credential_email_prompt",defaultMessage:[{type:0,value:"Your registration email"}]},(e=>t().createElement("input",{type:"email",id:"inputEmail",placeholder:e,autoComplete:"email",value:this.state.email,onChange:this.handleEmailChange,required:!0,autoFocus:!0})))),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{className:"primary",type:"submit"},this.state.token&&this.state.scheme?t().createElement(s.FormattedMessage,{id:"button_reset",defaultMessage:[{type:0,value:"Reset"}]}):this.state.sent?t().createElement(s.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}):t().createElement(s.FormattedMessage,{id:"button_send_request",defaultMessage:[{type:0,value:"Send request"}]}))))}}class Wi extends t().PureComponent{constructor(e){super(e),this.state={hostName:e.serverAddress,changed:!1},this.handleHostNameChange=this.handleHostNameChange.bind(this),this.handleEditingFinished=this.handleEditingFinished.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}handleHostNameChange(e){this.setState({hostName:e.target.value,changed:!0})}handleEditingFinished(){this.state.changed&&(this.setState({changed:!1}),this.props.onServerAddressChange(this.state.hostName.trim()))}handleKeyDown(e){"Enter"==e.key&&this.handleEditingFinished()}render(){var e=[];for(let a in Qt){let n=Qt[a];e.push(t().createElement("option",{key:n,value:n}))}return t().createElement("div",{className:"panel-form-row"},t().createElement("input",{type:"search",id:"host-name",placeholder:this.props.hostName,list:"known-hosts",className:"quoted",value:this.state.hostName,onChange:this.handleHostNameChange,onBlur:this.handleEditingFinished,onKeyDown:this.handleKeyDown,required:!0}),t().createElement("datalist",{id:"known-hosts"},e))}}class Ki extends t().PureComponent{constructor(e){super(e),this.state={transport:e.transport||"def",serverAddress:e.serverAddress,secureConnection:e.secureConnection},this.handleSubmit=this.handleSubmit.bind(this),this.handleTransportSelected=this.handleTransportSelected.bind(this),this.handleServerAddressChange=this.handleServerAddressChange.bind(this),this.handleToggleSecure=this.handleToggleSecure.bind(this)}handleSubmit(e){e.preventDefault(),this.props.onUpdate({transport:this.state.transport,serverAddress:this.state.serverAddress,secureConnection:this.state.secureConnection})}handleTransportSelected(e){this.setState({transport:e.currentTarget.value})}handleServerAddressChange(e){this.setState({serverAddress:e})}handleToggleSecure(e){this.setState({secureConnection:!this.state.secureConnection})}render(){const e={def:"default",ws:"websocket",lp:"long polling"},a=[];return["def","ws","lp"].map((n=>{const i="transport-"+n,s=e[n];a.push(t().createElement("li",{key:n},t().createElement("input",{type:"radio",id:i,name:"transport-select",value:n,checked:this.state.transport===n,onChange:this.handleTransportSelected}),t().createElement("label",{htmlFor:i},s)))})),t().createElement("form",{id:"settings-form",className:"panel-form",onSubmit:this.handleSubmit},t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_server_to_use",defaultMessage:[{type:0,value:"Server to use:"}]}))),t().createElement(Wi,{serverAddress:this.state.serverAddress,onServerAddressChange:this.handleServerAddressChange}),t().createElement("div",{className:"panel-form-row"},t().createElement(_n,{id:"secure-connection",name:"secure-connection",checked:this.state.secureConnection,className:"quoted",onChange:this.handleToggleSecure}),t().createElement("label",{htmlFor:"secure-connection"},t().createElement(s.FormattedMessage,{id:"label_use_secure_connection",defaultMessage:[{type:0,value:"Use secure connection"}]}))),t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small"},t().createElement(s.FormattedMessage,{id:"label_wire_transport",defaultMessage:[{type:0,value:"Wire transport:"}]}))),t().createElement("div",{className:"panel-form-row"},t().createElement("ul",{className:"quoted"},a)),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{type:"submit",className:"primary"},t().createElement(s.FormattedMessage,{id:"button_update",defaultMessage:[{type:0,value:"Update"}]}))))}}const Gi=(0,s.defineMessages)({phone:{id:"phone_dative",defaultMessage:[{type:0,value:"phone"}]},email:{id:"email_dative",defaultMessage:[{type:0,value:"email"}]}});class Yi extends t().PureComponent{constructor(e){super(e),this.state={code:e.credCode||"",codeReceived:e.credCode},this.handleChange=this.handleChange.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleCancel=this.handleCancel.bind(this)}static getDerivedStateFromProps(e,t){return e.credCode!=t.codeReceived?{code:e.credCode||"",codeReceived:e.credCode}:t}componentDidMount(){this.props.credCode&&this.props.onSubmit(this.props.credMethod,this.props.credCode,this.props.credToken)}componentDidUpdate(e,t){this.state.codeReceived&&this.state.code&&this.state.code!=t.code&&this.props.onSubmit(this.props.credMethod,this.state.code,this.props.credToken)}handleChange(e){this.setState({code:e.target.value.trim()})}handleKeyPress(e){"Enter"===e.key?this.handleSubmit(e):"Escape"==e.key&&this.handleCancel(e)}handleSubmit(e){e.preventDefault(),this.state.code&&this.state.code.trim()&&this.props.onSubmit(this.props.credMethod,this.state.code.trim(),this.props.credToken)}handleCancel(e){e.preventDefault(),this.props.onCancel()}render(){const{formatMessage:e}=this.props.intl,a={email:e(Gi.email),tel:e(Gi.phone)}[this.props.credMethod]||this.props.credMethod;return t().createElement("div",{className:"panel-form"},t().createElement("div",{className:"panel-form-row"},t().createElement("label",{className:"small",htmlFor:"enter-confirmation-code"},t().createElement(s.FormattedMessage,{id:"enter_confirmation_code_prompt",defaultMessage:[{type:0,value:"Enter confirmation code sent to you by "},{type:1,value:"method"},{type:0,value:":"}],values:{method:a}}))),t().createElement("div",{className:"panel-form-row"},t().createElement(s.FormattedMessage,{id:"numeric_confirmation_code_prompt",defaultMessage:[{type:0,value:"Numbers only"}]},(e=>t().createElement("input",{type:"text",id:"enter-confirmation-code",placeholder:e,value:this.state.code,onChange:this.handleChange,onKeyPress:this.handleKeyPress,required:!0})))),t().createElement("div",{className:"dialog-buttons"},t().createElement("button",{className:"secondary",onClick:this.handleCancel},t().createElement(s.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})),t().createElement("button",{className:"primary",onClick:this.handleSubmit},t().createElement(s.FormattedMessage,{id:"button_confirm",defaultMessage:[{type:0,value:"Confirm"}]}))))}}const $i=(0,s.injectIntl)(Yi),Xi=(0,s.defineMessages)({login:{id:"sidepanel_title_login",defaultMessage:[{type:0,value:"Sign In"}]},register:{id:"sidepanel_title_register",defaultMessage:[{type:0,value:"Create Account"}]},settings:{id:"sidepanel_title_settings",defaultMessage:[{type:0,value:"Settings"}]},edit:{id:"sidepanel_title_account_settings",defaultMessage:[{type:0,value:"Account Settings"}]},general:{id:"panel_title_general",defaultMessage:[{type:0,value:"General"}]},security:{id:"panel_title_security",defaultMessage:[{type:0,value:"Security"}]},crop:{id:"panel_title_crop",defaultMessage:[{type:0,value:"Drag to Adjust"}]},notif:{id:"sidepanel_title_acc_notifications",defaultMessage:[{type:0,value:"Notifications"}]},support:{id:"sidepanel_title_acc_support",defaultMessage:[{type:0,value:"Support"}]},newtpk:{id:"sidepanel_title_newtpk",defaultMessage:[{type:0,value:"Start New Chat"}]},cred:{id:"sidepanel_title_cred",defaultMessage:[{type:0,value:"Confirm Credentials"}]},reset:{id:"sidepanel_title_reset",defaultMessage:[{type:0,value:"Reset Password"}]},archive:{id:"sidepanel_title_archive",defaultMessage:[{type:0,value:"Archived Chats"}]},blocked:{id:"sidepanel_title_blocked",defaultMessage:[{type:0,value:"Blocked Chats"}]}});class Qi extends t().PureComponent{constructor(e){super(e),this.handleNewTopic=this.handleNewTopic.bind(this)}handleNewTopic(){this.props.onNavigate("newtpk")}render(){const{formatMessage:e}=this.props.intl,a=this.props.state||(this.props.myUserId?"contacts":"login");let n,i,s,r;return"contacts"==a?(n=this.props.title,i=!this.props.avatar||this.props.avatar,s=this.props.trustedBadges):(n=e(Xi[a]),i=!1,s=null),-1==["login","contacts"].indexOf(a)&&(r=this.props.onCancel),t().createElement("div",{id:"sidepanel",className:this.props.hideSelf?"nodisplay":null},t().createElement(Si,{state:a,title:n,avatar:i,tinode:this.props.tinode,trustedBadges:s,myUserId:this.props.myUserId,onSignUp:this.props.onSignUp,onSettings:this.props.onSettings,onNewTopic:this.handleNewTopic,onCancel:r}),t().createElement(bn,{level:this.props.errorLevel,text:this.props.errorText,action:this.props.errorAction,actionText:this.props.errorActionText,onClearError:this.props.onError}),t().createElement(gn,{show:this.props.loadSpinnerVisible}),"login"===a?t().createElement(Fi,{login:this.props.login,disabled:this.props.loginDisabled,persist:this.props.persist,onLogin:this.props.onLoginRequest,onPersistenceChange:this.props.onPersistenceChange}):"register"===a?t().createElement(Ii,{tinode:this.props.tinode,onCreateAccount:this.props.onCreateAccount,onCancel:this.props.onCancel,onError:this.props.onError}):"settings"===a?t().createElement(Ki,{transport:this.props.transport,serverAddress:this.props.serverAddress,secureConnection:this.props.secureConnection,onCancel:this.props.onCancel,onUpdate:this.props.onGlobalSettings}):"edit"===a?t().createElement(Ti,{tinode:this.props.tinode,myUserId:this.props.myUserId,trustedBadges:this.props.trustedBadges,onNavigate:this.props.onNavigate}):"general"===a||"crop"===a?t().createElement(Rn,{topic:"me",tinode:this.props.tinode,myUserId:this.props.myUserId,onUpdateTopicDesc:this.props.onUpdateAccountDesc,onUpdateTags:this.props.onUpdateAccountTags,onCredAdd:this.props.onCredAdd,onCredDelete:this.props.onCredDelete,onCredConfirm:this.props.onCredConfirm,onError:this.props.onError}):"notif"===a?t().createElement(Ni,{messageSounds:this.props.messageSounds,desktopAlerts:this.props.desktopAlerts,desktopAlertsEnabled:this.props.desktopAlertsEnabled,incognitoMode:this.props.incognitoMode,onTogglePushNotifications:this.props.onTogglePushNotifications,onToggleMessageSounds:this.props.onToggleMessageSounds,onToggleIncognitoMode:this.props.onToggleIncognitoMode}):"security"===a?t().createElement(Ri,{tinode:this.props.tinode,onUpdateAccountDesc:this.props.onUpdateAccountDesc,onUpdatePassword:this.props.onUpdatePassword,onLogout:this.props.onLogout,onDeleteAccount:this.props.onDeleteAccount,onShowAlert:this.props.onShowAlert,onShowBlocked:this.props.onShowBlocked}):"support"===a?t().createElement(Ui,{serverAddress:this.props.serverAddress,serverVersion:this.props.serverVersion}):"contacts"===a||"archive"==a||"blocked"==a?t().createElement(Ai,{tinode:this.props.tinode,myUserId:this.props.myUserId,connected:this.props.connected,topicSelected:this.props.topicSelected,archive:"archive"==a,blocked:"blocked"==a,chatList:this.props.chatList,showContextMenu:this.props.showContextMenu,onTopicSelected:this.props.onTopicSelected,onShowArchive:this.props.onShowArchive}):"newtpk"===a?t().createElement(Vi,{tinode:this.props.tinode,searchResults:this.props.searchResults,onInitFind:this.props.onInitFind,onSearchContacts:this.props.onSearchContacts,onCreateTopic:this.props.onCreateTopic,onError:this.props.onError}):"cred"===a?t().createElement($i,{credCode:this.props.credCode,credMethod:this.props.credMethod,credToken:this.props.credToken,onSubmit:this.props.onValidateCredentials,onCancel:this.props.onCancel}):"reset"===a?t().createElement(Hi,{onRequest:this.props.onPasswordResetRequest,onReset:this.props.onResetPassword,onCancel:this.props.onCancel}):null)}}const Ji=(0,s.injectIntl)(Qi);function Zi(){let e=Jt;return"object"==typeof window.location&&("file:"==window.location.protocol||"localhost"==window.location.hostname?e=Qt.local:window.location.hostname&&(e=window.location.hostname+(window.location.port?":"+window.location.port:""))),e}function es(){return"object"==typeof window.location&&"https:"==window.location.protocol}const ts=new Audio("audio/msg.m4a"),as=(0,s.defineMessages)({reconnect_countdown:{id:"reconnect_countdown",defaultMessage:[{type:0,value:"Disconnected. Reconnecting in "},{type:1,value:"seconds"},{type:0,value:"…"}]},reconnect_now:{id:"reconnect_now",defaultMessage:[{type:0,value:"Try now"}]},push_init_failed:{id:"push_init_failed",defaultMessage:[{type:0,value:"Failed to initialize push notifications"}]},invalid_security_token:{id:"invalid_security_token",defaultMessage:[{type:0,value:"Invalid security token"}]},no_connection:{id:"no_connection",defaultMessage:[{type:0,value:"No connection"}]},code_doesnot_match:{id:"code_doesnot_match",defaultMessage:[{type:0,value:"Code does not match"}]},menu_item_info:{id:"menu_item_info",defaultMessage:[{type:0,value:"Info"}]},menu_item_video_call:{id:"menu_item_video_call",defaultMessage:[{type:0,value:"Video call"}]},cred_confirmed_successfully:{id:"cred_confirmed_successfully",defaultMessage:[{type:0,value:"Confirmed successfully"}]}});class ns extends t().Component{constructor(e){super(e),this.selfRef=t().createRef(),this.state=this.getBlankState(),this.handleResize=this.handleResize.bind(this),this.handleHashRoute=this.handleHashRoute.bind(this),this.handleOnline=this.handleOnline.bind(this),this.checkForAppUpdate=this.checkForAppUpdate.bind(this),this.handleVisibilityEvent=this.handleVisibilityEvent.bind(this),this.handleError=this.handleError.bind(this),this.handleLoginRequest=this.handleLoginRequest.bind(this),this.handlePersistenceChange=this.handlePersistenceChange.bind(this),this.handleConnected=this.handleConnected.bind(this),this.handleAutoreconnectIteration=this.handleAutoreconnectIteration.bind(this),this.doLogin=this.doLogin.bind(this),this.handleLoginSuccessful=this.handleLoginSuccessful.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.tnMeMetaDesc=this.tnMeMetaDesc.bind(this),this.tnMeContactUpdate=this.tnMeContactUpdate.bind(this),this.tnMeSubsUpdated=this.tnMeSubsUpdated.bind(this),this.resetContactList=this.resetContactList.bind(this),this.tnInitFind=this.tnInitFind.bind(this),this.tnFndSubsUpdated=this.tnFndSubsUpdated.bind(this),this.handleSearchContacts=this.handleSearchContacts.bind(this),this.handleTopicSelected=this.handleTopicSelected.bind(this),this.handleHideMessagesView=this.handleHideMessagesView.bind(this),this.handleSendMessage=this.handleSendMessage.bind(this),this.handleNewChatInvitation=this.handleNewChatInvitation.bind(this),this.handleNewAccount=this.handleNewAccount.bind(this),this.handleNewAccountRequest=this.handleNewAccountRequest.bind(this),this.handleUpdatePasswordRequest=this.handleUpdatePasswordRequest.bind(this),this.handleUpdateAccountTagsRequest=this.handleUpdateAccountTagsRequest.bind(this),this.handleToggleIncognitoMode=this.handleToggleIncognitoMode.bind(this),this.handleSettings=this.handleSettings.bind(this),this.handleGlobalSettings=this.handleGlobalSettings.bind(this),this.handleShowArchive=this.handleShowArchive.bind(this),this.handleShowBlocked=this.handleShowBlocked.bind(this),this.handleToggleMessageSounds=this.handleToggleMessageSounds.bind(this),this.handleCredAdd=this.handleCredAdd.bind(this),this.handleCredDelete=this.handleCredDelete.bind(this),this.handleCredConfirm=this.handleCredConfirm.bind(this),this.initFCMessaging=this.initFCMessaging.bind(this),this.toggleFCMToken=this.toggleFCMToken.bind(this),this.handlePushMessage=this.handlePushMessage.bind(this),this.handleSidepanelCancel=this.handleSidepanelCancel.bind(this),this.handleStartTopicRequest=this.handleStartTopicRequest.bind(this),this.handleNewTopicCreated=this.handleNewTopicCreated.bind(this),this.handleTopicUpdateRequest=this.handleTopicUpdateRequest.bind(this),this.handleUnarchive=this.handleUnarchive.bind(this),this.handleChangePermissions=this.handleChangePermissions.bind(this),this.handleTagsUpdateRequest=this.handleTagsUpdateRequest.bind(this),this.handleLogout=this.handleLogout.bind(this),this.handleDeleteAccount=this.handleDeleteAccount.bind(this),this.handleDeleteTopicRequest=this.handleDeleteTopicRequest.bind(this),this.handleDeleteMessagesRequest=this.handleDeleteMessagesRequest.bind(this),this.handleLeaveUnsubRequest=this.handleLeaveUnsubRequest.bind(this),this.handleBlockTopicRequest=this.handleBlockTopicRequest.bind(this),this.handleReportTopic=this.handleReportTopic.bind(this),this.handleShowContextMenu=this.handleShowContextMenu.bind(this),this.defaultTopicContextMenu=this.defaultTopicContextMenu.bind(this),this.handleHideContextMenu=this.handleHideContextMenu.bind(this),this.handleShowAlert=this.handleShowAlert.bind(this),this.handleShowInfoView=this.handleShowInfoView.bind(this),this.handleMemberUpdateRequest=this.handleMemberUpdateRequest.bind(this),this.handleValidateCredentialsRequest=this.handleValidateCredentialsRequest.bind(this),this.handlePasswordResetRequest=this.handlePasswordResetRequest.bind(this),this.handleResetPassword=this.handleResetPassword.bind(this),this.handleContextMenuAction=this.handleContextMenuAction.bind(this),this.handleShowForwardDialog=this.handleShowForwardDialog.bind(this),this.handleHideForwardDialog=this.handleHideForwardDialog.bind(this),this.handleStartVideoCall=this.handleStartVideoCall.bind(this),this.handleInfoMessage=this.handleInfoMessage.bind(this),this.handleDataMessage=this.handleDataMessage.bind(this),this.handleCallClose=this.handleCallClose.bind(this),this.handleCallInvite=this.handleCallInvite.bind(this),this.handleCallRinging=this.handleCallRinging.bind(this),this.handleCallHangup=this.handleCallHangup.bind(this),this.handleCallSendOffer=this.handleCallSendOffer.bind(this),this.handleCallIceCandidate=this.handleCallIceCandidate.bind(this),this.handleCallSendAnswer=this.handleCallSendAnswer.bind(this),this.handleCallAcceptCall=this.handleCallAcceptCall.bind(this),this.sendMessageToTopic=this.sendMessageToTopic.bind(this),this.callTimeoutTimer=null}getBlankState(){const e=Di.getObject("settings")||{},t=!!Di.getObject("keep-logged-in");return{connected:!1,ready:!1,autoLogin:!1,transport:e.transport||null,serverAddress:e.serverAddress||Zi(),secureConnection:void 0===e.secureConnection?es():e.secureConnection,serverVersion:"no connection",messageSounds:!e.messageSoundsOff,incognitoMode:!1,desktopAlerts:t&&!!e.desktopAlerts,desktopAlertsEnabled:(es()||"object"==typeof window.location&&"localhost"==window.location.hostname)&&"undefined"!=typeof navigator&&"undefined"!=typeof FIREBASE_INIT,firebaseToken:t?Di.getObject("firebase-token"):null,applicationVisible:!document.hidden,errorText:"",errorLevel:null,errorAction:void 0,errorActionText:null,sidePanelSelected:"login",sidePanelTitle:null,sidePanelAvatar:null,myTrustedBadges:[],loadSpinnerVisible:!1,login:"",password:"",persist:t,myUserId:null,liveConnection:navigator.onLine,topicSelected:"",topicSelectedOnline:!1,topicSelectedAcs:null,newTopicParams:null,loginDisabled:!1,displayMobile:window.innerWidth<=640,infoPanel:void 0,mobilePanel:"sidepanel",callTopic:void 0,callState:0,callShouldStart:!1,contextMenuVisible:!1,contextMenuBounds:null,contextMenuClickAt:null,contextMenuParams:null,contextMenuItems:[],forwardDialogVisible:!1,forwardMessage:null,alertVisible:!1,alertParams:{},chatList:[],searchResults:[],searchableContacts:[],credMethod:void 0,credCode:void 0,credToken:void 0,requestedTopic:void 0}}componentDidMount(){if(window.addEventListener("resize",this.handleResize),window.addEventListener("online",(e=>{this.handleOnline(!0)})),window.addEventListener("offline",(e=>{this.handleOnline(!1)})),window.addEventListener("hashchange",this.handleHashRoute),"function"==typeof BroadcastChannel){new BroadcastChannel("tinode-sw").addEventListener("message",this.handlePushMessage)}else console.warn("Your browser does not support BroadcastChannel. Some features will not be available");document.addEventListener("visibilitychange",this.handleVisibilityEvent),this.setState({viewportWidth:document.documentElement.clientWidth,viewportHeight:document.documentElement.clientHeight}),new Promise(((e,t)=>{this.tinode=ns.tnSetup(this.state.serverAddress,es(),this.state.transport,this.props.intl.locale,this.state.persist,e),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.tinode.onAutoreconnectIteration=this.handleAutoreconnectIteration,this.tinode.onInfoMessage=this.handleInfoMessage,this.tinode.onDataMessage=this.handleDataMessage})).then((e=>{this.state.desktopAlertsEnabled&&this.initFCMessaging().then((e=>{this.state.desktopAlerts&&this.tinode.setDeviceToken(this.state.firebaseToken)})).catch((()=>{}));const t=mi.parseUrlHash(window.location.hash);this.resetContactList();const a=this.state.persist?Di.getObject("auth-token"):void 0;if(a&&(this.setState({autoLogin:!0}),a.expires=new Date(a.expires),this.tinode.setAuthToken(a),this.tinode.connect().catch((e=>{this.handleError(e.message,"err")}))),this.readTimer=null,this.readTimerCallback=null,["cred","reset","register"].includes(t.path[0]))this.handleHashRoute();else{this.setState({requestedTopic:t.path[1]});const e=t.params&&t.params.cred_done?mi.addUrlParam("","cred_done",t.params.cred_done):"";mi.navigateTo(e)}}))}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("hashchange",this.handleHashRoute),document.removeEventListener("visibilitychange",this.handleVisibilityEvent)}static tnSetup(e,t,a,n,i,s){const r=new Gt.Tinode({appName:Xt,host:e,apiKey:"AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K",transport:a,secure:t,persist:i},s);return r.setHumanLanguage(n),r.enableLogging(true,!0),r}handlePushMessage(e){this.tinode.oobNotification(e.data||{})}initFCMessaging(){const{formatMessage:e,locale:t}=this.props.intl,a=(t,a)=>{console.error(t,a),this.handleError(e(as.push_init_failed),"err"),this.setState({desktopAlertsEnabled:!1,firebaseToken:null}),Di.updateObject("settings",{desktopAlerts:!1})};try{return this.fcm=Vt(ce(FIREBASE_INIT,Xt)),navigator.serviceWorker.register("/service-worker.js").then((e=>(this.checkForAppUpdate(e),e.active.postMessage(JSON.stringify({locale:t,version:$t})),e))).then((e=>ns.requestFCMToken(this.fcm,e))).then((e=>{const t=Di.getObject("keep-logged-in");e!=this.state.firebaseToken&&(this.tinode.setDeviceToken(e),t&&Di.setObject("firebase-token",e)),this.setState({firebaseToken:e,desktopAlerts:!0}),t&&Di.updateObject("settings",{desktopAlerts:!0}),Kt(this.fcm,(e=>{this.handlePushMessage(e)}))})).catch((e=>{throw a(e),e}))}catch(e){return a(e),Promise.reject(e)}}static requestFCMToken(e,t){return Ht(e,{serviceWorkerRegistration:t,vapidKey:FIREBASE_INIT.messagingVapidKey}).then((t=>t||Notification.requestPermission().then((t=>{if("granted"===t)return Ht(e,{serviceWorkerRegistration:reg,vapidKey:FIREBASE_INIT.messagingVapidKey}).then((e=>{if(e)return e;throw new Error("Failed to initialize notifications")}));throw new Error("No permission to send notifications: "+t)}))))}handleResize(){const e=document.documentElement.clientWidth<=640;this.setState({viewportWidth:document.documentElement.clientWidth,viewportHeight:document.documentElement.clientHeight}),this.state.displayMobile!=e&&this.setState({displayMobile:e})}checkForAppUpdate(e){e.onupdatefound=()=>{const a=e.installing;a.onstatechange=()=>{if("installed"==a.state&&navigator.serviceWorker.controller){const e=t().createElement(t().Fragment,null,t().createElement(s.FormattedMessage,{id:"update_available",defaultMessage:[{type:0,value:"Update available."}]})," ",t().createElement("a",{href:""},t().createElement(s.FormattedMessage,{id:"reload_update",defaultMessage:[{type:0,value:"Reload"}]})),".");this.handleError(e,"info")}}}}handleHashRoute(){const e=mi.parseUrlHash(window.location.hash),t={infoPanel:e.params.info,newTopicTabSelected:e.params.tab};if(e.path&&e.path.length>0){["register","settings","edit","notif","security","support","general","crop","cred","reset","newtpk","archive","blocked","contacts",""].includes(e.path[0])?t.sidePanelSelected=e.path[0]:console.warn("Unknown sidepanel view",e.path[0]);let a=e.path[1]||null;a!=this.state.topicSelected&&(Gt.Tinode.topicType(a)||(a=null),Object.assign(t,{topicSelected:a,topicSelectedAcs:this.tinode.getTopicAccessMode(a)}))}else Object.assign(t,{sidePanelSelected:"",topicSelected:null});e.params.method&&(t.credMethod=e.params.method),e.params.code&&(t.credCode=e.params.code),e.params.token&&(t.credToken=e.params.token),e.params.cred_done&&Object.assign(t,ns.stateForError(this.props.intl.formatMessage(as.cred_confirmed_successfully),"info")),this.setState(t)}handleOnline(e){e?(this.handleError(),clearInterval(this.reconnectCountdown),this.tinode.reconnect()):this.handleError(this.props.intl.formatMessage(as.no_connection),"warn"),this.setState({liveConnection:e})}handleVisibilityEvent(){this.setState({applicationVisible:!document.hidden})}static stateForError(e,t,a,n){return{errorText:e,errorLevel:t,errorAction:a,errorActionText:n,callShouldStart:!1}}handleError(e,t,a,n){this.setState(ns.stateForError(e,t,a,n))}handleLoginRequest(e,t){this.setState({loginDisabled:!0,login:e,password:t,loadSpinnerVisible:!0,autoLogin:!0}),this.handleError("",null),this.tinode.isConnected()?this.doLogin(e,t,null,{meth:this.state.credMethod,resp:this.state.credCode}):this.tinode.connect().catch((e=>{this.setState({loginDisabled:!1,autoLogin:!1,loadSpinnerVisible:!1}),this.handleError(e.message,"err")}))}handlePersistenceChange(e){e?this.tinode.initStorage().then((()=>{Di.setObject("keep-logged-in",!0),this.setState({persist:!0})})):this.tinode.clearStorage().then((()=>{Di.setObject("keep-logged-in",!1),this.setState({persist:!1})}))}handleConnected(){clearInterval(this.reconnectCountdown),this.handleError();const e=this.tinode.getServerInfo();this.setState({serverVersion:e.ver+" "+(e.build?e.build:"none")}),this.state.autoLogin&&this.doLogin(this.state.login,this.state.password,null,{meth:this.state.credMethod,resp:this.state.credCode})}handleAutoreconnectIteration(e,t){if(clearInterval(this.reconnectCountdown),e<0)return void this.handleError();if(t)return void t.then((e=>{this.handleError()})).catch((e=>{this.handleError(e.message,"err")}));const{formatMessage:a}=this.props.intl;let n=e/1e3;n|=n,this.reconnectCountdown=setInterval((e=>{if(n<-10)return clearInterval(this.reconnectCountdown),void this.tinode.reconnect();const t=n>99?ma(n):n;this.handleError(a(as.reconnect_countdown,{seconds:t}),"warn",(e=>{clearInterval(this.reconnectCountdown),this.tinode.reconnect()}),a(as.reconnect_now)),n-=1}),1e3)}handleDisconnect(e){this.setState({connected:!1,ready:!1,topicSelectedOnline:!1,errorText:e&&e.message?e.message:"Disconnected",errorLevel:e&&e.message?"err":"warn",loginDisabled:!1,contextMenuVisible:!1,forwardDialogVisible:!1,serverVersion:"no connection"})}doLogin(e,t,a,n){if(this.tinode.isAuthenticated())return void mi.navigateTo("");let i=a||(this.tinode.getAuthToken()||{}).token;if(!(e&&t||i))return mi.navigateTo(""),void this.setState({loginDisabled:!1});n=Gt.Tinode.credential(n);let s,r=this.tinode.isConnected()?Promise.resolve():this.tinode.connect();e&&t?(i=null,this.setState({password:null}),s=r.then((a=>this.tinode.loginBasic(e,t,n)))):s=r.then((e=>this.tinode.loginToken(i,n))),s.then((e=>{e.code>=300&&"validate credentials"===e.text?(this.setState({loadSpinnerVisible:!1}),n&&this.handleError(this.props.intl.formatMessage(as.code_doesnot_match),"warn"),ns.navigateToCredentialsView(e.params)):this.handleLoginSuccessful()})).catch((e=>{this.setState({loginDisabled:!1,credMethod:void 0,credCode:void 0,loadSpinnerVisible:!1,autoLogin:!1}),this.handleError(e.message,"err"),console.warn("Login failed",e),i&&this.handleLogout(),mi.navigateTo("")}))}static navigateToCredentialsView(e){const t=mi.parseUrlHash(window.location.hash);t.path[0]="cred",t.params.method=e.cred[0],t.params.token=e.token,mi.navigateTo(mi.composeUrlHash(t.path,t.params))}handleLoginSuccessful(){this.handleError(),Di.getObject("keep-logged-in")&&Di.setObject("auth-token",this.tinode.getAuthToken());const e=this.state.requestedTopic,t=this.tinode.getMeTopic();t.onMetaDesc=this.tnMeMetaDesc,t.onContactUpdate=this.tnMeContactUpdate,t.onSubsUpdated=this.tnMeSubsUpdated,this.setState({connected:!0,credMethod:void 0,credCode:void 0,credToken:void 0,myUserId:this.tinode.getCurrentUserID(),autoLogin:!0,requestedTopic:void 0}),t.subscribe(t.startMetaQuery().withLaterSub().withDesc().withTags().withCred().build()).catch((e=>{this.tinode.disconnect(),localStorage.removeItem("auth-token"),this.handleError(e.message,"err"),mi.navigateTo("")})).finally((()=>{this.setState({loadSpinnerVisible:!1})}));let a=mi.setUrlSidePanel(window.location.hash,"contacts");e&&(a=mi.setUrlTopic(a,e)),mi.navigateTo(a)}tnMeMetaDesc(e){if(e){if(e.public&&this.setState({sidePanelTitle:e.public.fn,sidePanelAvatar:Ia(e.public.photo)}),e.trusted){const t=[];for(const[a,n]of Object.entries(e.trusted))n&&t.push(a);this.setState({myTrustedBadges:t})}e.acs&&this.setState({incognitoMode:!e.acs.isPresencer()})}}tnMeContactUpdate(e,t){if("on"==e||"off"==e)this.resetContactList(),this.state.topicSelected==t.topic&&this.setState({topicSelectedOnline:"on"==e});else if("read"==e)this.resetContactList();else if("msg"==e){const e=this.tinode.getTopic(t.topic),a=e&&e.isArchived();t.unread>0&&this.state.messageSounds&&!a&&(document.hidden||this.state.topicSelected!=t.topic)&&ts.play().catch((e=>{})),this.resetContactList()}else"recv"==e||("gone"==e||"unsub"==e?(this.state.topicSelected==t.topic&&this.handleTopicSelected(null),this.resetContactList()):"acs"==e?this.state.topicSelected==t.topic&&this.setState({topicSelectedAcs:t.acs}):"del"==e||"upd"==e||"call"==e||console.info("Unsupported (yet) presence update:",e,"in",t.topic))}tnMeSubsUpdated(e){this.resetContactList()}static prepareSearchableContacts(e,t){const a={};for(const t of e)Gt.Tinode.isP2PTopicName(t.topic)&&(a[t.topic]={user:t.topic,updated:t.updated,public:t.public,private:t.private,acs:t.acs});for(const e of t)a[e.user]||(a[e.user]=e);return Object.values(a)}resetContactList(){const e={chatList:[]};this.state.ready||(e.ready=!0),this.tinode.getMeTopic().contacts((t=>{t.topic||t.user||(t.topic=t.name),e.chatList.push(t),this.state.topicSelected==t.topic&&(e.topicSelectedOnline=t.online,e.topicSelectedAcs=t.acs)}));const t=new Date(0);e.chatList.sort(((e,a)=>(e.touched||t).getTime()-(a.touched||t).getTime())),e.searchableContacts=ns.prepareSearchableContacts(e.chatList,this.state.searchResults),this.setState(e)}tnInitFind(){const e=this.tinode.getFndTopic();e.onSubsUpdated=this.tnFndSubsUpdated,e.isSubscribed()?this.tnFndSubsUpdated():e.subscribe(e.startMetaQuery().withSub().build()).catch((e=>{this.handleError(e.message,"err")}))}tnFndSubsUpdated(){const e=[];this.tinode.getFndTopic().contacts((t=>{e.push(t)})),this.setState({searchResults:e,searchableContacts:ns.prepareSearchableContacts(this.state.chatList,e)})}handleSearchContacts(e){const t=this.tinode.getFndTopic();t.setMeta({desc:{public:e}}).then((e=>t.getMeta(t.startMetaQuery().withSub().build()))).catch((e=>{this.handleError(e.message,"err")}))}handleTopicSelected(e){this.state.newTopicParams&&this.state.newTopicParams._topicName!=e&&this.setState({newTopicParams:null}),e?(this.setState({errorText:"",errorLevel:null,mobilePanel:"topic-view",infoPanel:void 0}),this.state.topicSelected!=e&&(this.setState({topicSelectedOnline:this.tinode.isTopicOnline(e),topicSelectedAcs:this.tinode.getTopicAccessMode(e),forwardMessage:null}),mi.navigateTo(mi.setUrlTopic("",e)))):(this.setState({errorText:"",errorLevel:null,mobilePanel:"sidepanel",topicSelectedOnline:!1,topicSelectedAcs:null,infoPanel:void 0,forwardMessage:null}),mi.navigateTo(mi.setUrlTopic("",null)))}handleHideMessagesView(){this.setState({mobilePanel:"sidepanel"}),mi.navigateTo(mi.setUrlTopic(window.location.hash,null))}handleSendMessage(e,t,a,n){const i=this.tinode.getTopic(this.state.topicSelected);return this.sendMessageToTopic(i,e,t,a,n)}sendMessageToTopic(e,t,a,n,i){(t=e.createMessage(t,!1))._uploader=n,i&&(t.head=Object.assign(t.head||{},i));const s=[];if(a&&s.push(a),!e.isSubscribed()){const a=e.subscribe().then((()=>{let a=[];e.queuedMessages((n=>{n._sending||n.seq==t.seq||(n.head&&n.head.webrtc?a.push(n.seq):e.isSubscribed()&&e.publishMessage(n))})),a.length>0&&e.delMessagesList(a,!0)}));s.push(a)}return e.publishDraft(t,Promise.all(s)).then((t=>(e.isArchived()&&e.archive(!1),t))).catch((e=>{this.handleError(e.message,"err")}))}handleNewChatInvitation(e,t){const a=this.tinode.getTopic(e);let n=null;switch(t){case"accept":const i=a.getAccessMode().getGiven();n=a.setMeta({sub:{mode:i}}),a.isP2PType()&&(n=n.then((t=>{a.setMeta({sub:{user:e,mode:i}})})));break;case"delete":n=a.delTopic(!0);break;case"block":const s=a.getAccessMode().updateWant("-JP").getWant();n=a.setMeta({sub:{mode:s}}).then((e=>this.handleTopicSelected(null)));break;default:console.warn("Unknown invitation action",'"'+t+'""')}null!=n&&n.catch((e=>{this.handleError(e.message,"err")}))}handleNewAccount(){this.handleError(),mi.navigateTo(mi.setUrlSidePanel(window.location.hash,"register"))}handleNewAccountRequest(e,t,a,n,i){this.handleError(),this.tinode.connect(this.state.serverAddress).then((s=>{let r;return a&&a.photo&&a.photo.ref&&(r=[a.photo.ref]),this.tinode.createAccountBasic(e,t,{public:a,tags:i,cred:Gt.Tinode.credential(n),attachments:r})})).then((e=>{e.code>=300&&"validate credentials"==e.text?ns.navigateToCredentialsView(e.params):this.handleLoginSuccessful(this)})).catch((e=>{this.handleError(e.message,"err")}))}handleToggleIncognitoMode(e){this.setState({incognitoMode:null});const t=this.tinode.getMeTopic(),a=t.getAccessMode().updateWant(e?"-P":"+P").getWant();t.setMeta({sub:{mode:a}}).catch((t=>{this.setState({incognitoMode:!e}),this.handleError(t.message,"err")}))}handleUpdateAccountTagsRequest(e){this.tinode.getMeTopic().setMeta({tags:e}).catch((e=>{this.handleError(e.message,"err")}))}handleSettings(){this.handleError(),mi.navigateTo(mi.setUrlSidePanel(window.location.hash,this.state.myUserId?"edit":"settings"))}handleGlobalSettings(e){const t=e.serverAddress||this.state.serverAddress,a=e.transport||this.state.transport,n=void 0===e.secureConnection?this.state.secureConnection:e.secureConnection;this.tinode&&(this.tinode.clearStorage(),this.tinode.onDisconnect=void 0,this.tinode.disconnect()),this.tinode=ns.tnSetup(t,n,a,this.props.intl.locale,Di.getObject("keep-logged-in")),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.tinode.onAutoreconnectIteration=this.handleAutoreconnectIteration,this.tinode.onInfoMessage=this.handleInfoMessage,this.tinode.onDataMessage=this.handleDataMessage,this.setState({serverAddress:t,transport:a,secureConnection:n}),Di.setObject("settings",{serverAddress:t,transport:a,secureConnection:n}),mi.navigateTo(mi.setUrlSidePanel(window.location.hash,""))}handleShowArchive(){mi.navigateTo(mi.setUrlSidePanel(window.location.hash,this.state.myUserId?"archive":""))}handleShowBlocked(){mi.navigateTo(mi.setUrlSidePanel(window.location.hash,this.state.myUserId?"blocked":""))}toggleFCMToken(e){e?(this.setState({desktopAlerts:null}),this.state.firebaseToken?(this.setState({desktopAlerts:!0}),Di.getObject("keep-logged-in")&&Di.updateObject("settings",{desktopAlerts:!0})):this.initFCMessaging()):this.state.firebaseToken&&this.fcm?Wt(this.fcm).catch((e=>{console.error("Unable to delete token.",e)})).finally((()=>{Di.updateObject("settings",{desktopAlerts:!1}),localStorage.removeItem("firebase-token"),this.setState({desktopAlerts:!1,firebaseToken:null}),this.tinode.setDeviceToken(null)})):(this.setState({desktopAlerts:!1,firebaseToken:null}),Di.updateObject("settings",{desktopAlerts:!1}))}handleToggleMessageSounds(e){this.setState({messageSounds:e}),Di.updateObject("settings",{messageSoundsOff:!e})}handleCredAdd(e,t){this.tinode.getMeTopic().setMeta({cred:{meth:e,val:t}}).catch((e=>{this.handleError(e.message,"err")}))}handleCredDelete(e,t){this.tinode.getMeTopic().delCredential(e,t).catch((e=>{this.handleError(e.message,"err")}))}handleCredConfirm(e,t){ns.navigateToCredentialsView({cred:[e]})}handleSidepanelCancel(){const e=mi.parseUrlHash(window.location.hash);let t="";["security","support","general","notif"].includes(e.path[0])?t="edit":"crop"==e.path[0]?t="general":"blocked"==e.path[0]?t="security":this.state.myUserId&&(t="contacts"),e.path[0]=t,e.params&&(delete e.params.code,delete e.params.method,delete e.params.tab,delete e.params.scheme,delete e.params.token),mi.navigateTo(mi.composeUrlHash(e.path,e.params)),this.setState({errorText:"",errorLevel:null})}basicNavigator(e){mi.navigateTo(mi.setUrlSidePanel(window.location.hash,e))}infoNavigator(e){mi.navigateTo(mi.setUrlInfoPanel(window.location.hash,e))}handleStartTopicRequest(e,t,a){if(e&&this.tinode.isTopicCached(e))return void this.handleTopicSelected(e);const n={};Gt.Tinode.isP2PTopicName(e)?(n.sub={mode:ea},n.desc={defacs:{auth:ea}}):(e=e||this.tinode.newGroupTopicName(a),t&&(n.desc={public:t.public,private:{comment:t.private}},n.tags=t.tags)),n._topicName=e,this.setState({newTopicParams:n},(()=>{this.handleTopicSelected(e)}))}handleNewTopicCreated(e,t){let a={};this.state.callShouldStart&&(a={callState:3,callShouldStart:!1}),this.state.topicSelected==e&&e!=t&&(a.topicSelected=t),this.setState(a,(e=>{mi.navigateTo(mi.setUrlTopic("",t))}))}handleTopicUpdateRequest(e,t,a,n){this.handleError();const i=this.tinode.getTopic(e);if(i){const e={};let s;t&&(t.photo&&(t.photo.ref&&t.photo.ref!=Gt.Tinode.DEL_CHAR?s=[t.photo.ref]:t.photo.data&&t.photo.data!=Gt.Tinode.DEL_CHAR||(t.photo=Gt.Tinode.DEL_CHAR)),e.public=t),"string"==typeof a&&(e.private=a===Gt.Tinode.DEL_CHAR?Gt.Tinode.DEL_CHAR:{comment:a}),n&&(e.defacs=n),i.setMeta({desc:e,attachments:s}).catch((e=>{this.handleError(e.message,"err")}))}}handleUnarchive(e){const t=this.tinode.getTopic(e);t&&t.archive(!1).catch((e=>{this.handleError(e.message,"err")}))}handleUpdatePasswordRequest(e){this.handleError(),e&&this.tinode.updateAccountBasic(null,this.tinode.getCurrentLogin(),e).catch((e=>{this.handleError(e.message,"err")}))}handleChangePermissions(e,t,a){const n=this.tinode.getTopic(e);if(n){const e=n.getAccessMode();a?(e.updateGiven(t),t=e.getGiven()):(e.updateWant(t),t=e.getWant()),n.setMeta({sub:{user:a,mode:t}}).catch((e=>{this.handleError(e.message,"err")}))}}handleTagsUpdateRequest(e,t){const a=this.tinode.getTopic(e);a&&a.setMeta({tags:t}).catch((e=>{this.handleError(e.message,"err")}))}handleLogout(){let e;va(0),localStorage.removeItem("auth-token"),localStorage.removeItem("firebase-token"),localStorage.removeItem("settings"),this.state.firebaseToken&&Wt(this.fcm),clearInterval(this.reconnectCountdown),this.tinode?(e=this.tinode.clearStorage(),this.tinode.onDisconnect=void 0,this.tinode.disconnect()):e=Promose.resolve(),this.setState(this.getBlankState()),e.then((()=>{this.tinode=ns.tnSetup(this.state.serverAddress,es(),this.state.transport,this.props.intl.locale,Di.getObject("keep-logged-in"),(()=>{this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.tinode.onAutoreconnectIteration=this.handleAutoreconnectIteration,this.tinode.onInfoMessage=this.handleInfoMessage,this.tinode.onDataMessage=this.handleDataMessage,mi.navigateTo("")}))}))}handleDeleteAccount(){this.tinode.delCurrentUser(!0).then((e=>{this.handleLogout()}))}handleDeleteTopicRequest(e){const t=this.tinode.getTopic(e);t&&t.delTopic(!0).then((e=>{mi.navigateTo(mi.setUrlTopic(window.location.hash,""))})).catch((e=>{this.handleError(e.message,"err")}))}handleDeleteMessagesRequest(e){const t=this.tinode.getTopic(e);t&&t.delMessagesAll(!0).catch((e=>{this.handleError(e.message,"err")}))}handleLeaveUnsubRequest(e){const t=this.tinode.getTopic(e);t&&t.leave(!0).then((e=>{mi.navigateTo(mi.setUrlTopic(window.location.hash,""))})).catch((e=>{this.handleError(e.message,"err")}))}handleBlockTopicRequest(e){const t=this.tinode.getTopic(e);t&&t.updateMode(null,"-JP").then((e=>{mi.navigateTo(mi.setUrlTopic(window.location.hash,""))})).catch((e=>{this.handleError(e.message,"err")}))}handleReportTopic(e){const t=this.tinode.getTopic(e);t&&(this.tinode.report("report",e),t.updateMode(null,"-JP").then((e=>{mi.navigateTo(mi.setUrlTopic(window.location.hash,""))})).catch((e=>{this.handleError(e.message,"err")})))}handleShowContextMenu(e,t){this.setState({contextMenuVisible:!0,contextMenuClickAt:{x:e.x,y:e.y},contextMenuParams:e,contextMenuItems:t||this.defaultTopicContextMenu(e.topicName),contextMenuBounds:this.selfRef.current.getBoundingClientRect()})}handleShowForwardDialog(e){"newtpk"==this.state.sidePanelSelected&&this.handleSidepanelCancel();const t="➦ "+e.userName,a="string"==typeof e.content?Gt.Drafty.init(e.content):Gt.Drafty.forwardedContent(e.content),n=Gt.Drafty.preview(a,84,!0),i=Gt.Drafty.append(Gt.Drafty.appendLineBreak(Gt.Drafty.mention(t,e.userFrom)),a),s=Gt.Drafty.quote(t,e.userFrom,n),r={forwarded:e.topicName+":"+e.seq};this.setState({forwardDialogVisible:!0,forwardMessage:{head:r,msg:i,preview:s}})}defaultTopicContextMenu(e){const t=this.tinode.getTopic(e);if(t._deleted)return["topic_delete"];let a=!1,n=!1,i=!1,s=!1,r=!1,o=!1,l=!1;if(t){s=t.isSubscribed(),o=t.isArchived();const e=t.getAccessMode();e&&(a=e.isMuted(),n=!e.isJoiner(),i=!e.isJoiner("want"),r=e.isDeleter())}return l=!!this.tinode.getServerParam("iceServers"),[s?{title:this.props.intl.formatMessage(as.menu_item_info),handler:this.handleShowInfoView}:null,s&&Gt.Tinode.isP2PTopicName(e)&&l?{title:this.props.intl.formatMessage(as.menu_item_video_call),handler:this.handleStartVideoCall}:null,s?"messages_clear":null,s&&r?"messages_clear_hard":null,a?n?null:"topic_unmute":"topic_mute",i?"topic_unblock":"topic_block",o?"topic_restore":"topic_archive","topic_delete"]}handleHideContextMenu(){this.setState({contextMenuVisible:!1,contextMenuClickAt:null,contextMenuParams:null,contextMenuBounds:null})}handleHideForwardDialog(e){this.setState({forwardDialogVisible:!1,forwardMessage:e?this.state.forwardMessage:null})}handleContextMenuAction(e,t,a){"topic_archive"==e?t&&a.topicName&&a.topicName==this.state.topicSelected&&t.then((()=>{this.handleTopicSelected(null)})):"menu_item_forward"==e&&this.handleShowForwardDialog(a)}handleShowAlert(e,t,a,n,i,s){this.setState({alertVisible:!0,alertParams:{title:e,content:t,onConfirm:a,confirm:n,onReject:i,reject:s}})}handleShowInfoView(){mi.navigateTo(mi.addUrlParam(window.location.hash,"info","info")),this.setState({infoPanel:"info"})}handleMemberUpdateRequest(e,t,a){if(!e)return;const n=this.tinode.getTopic(e);n&&(t&&t.length>0&&t.map((e=>{n.invite(e,null).catch((e=>{this.handleError(e.message,"err")}))})),a&&a.length>0&&a.map((e=>{n.delSubscription(e).catch((e=>{this.handleError(e.message,"err")}))})))}handleValidateCredentialsRequest(e,t,a){this.tinode.isAuthenticated()?this.tinode.getMeTopic().setMeta({cred:{meth:e,resp:t}}).catch((e=>{this.handleError(e.message,"err")})):(this.setState({credMethod:e,credCode:t,credToken:a}),this.doLogin(null,null,a,{meth:e,resp:t}))}handlePasswordResetRequest(e,t){return this.tinode.connect().then((()=>this.tinode.requestResetAuthSecret("basic",e,t))).catch((e=>{this.handleError(e.message,"err")}))}handleResetPassword(e,t,a){(a=function(e){if(e){e=e.replace(/-/g,"+").replace(/_/g,"/");try{e=btoa(atob(e))}catch(t){console.error("Failed to base64 re-encode string.",t),e=null}}return e}(a))?this.tinode.connect().then((()=>this.tinode.updateAccountBasic(null,null,t,{token:a}))).then((()=>{mi.navigateTo("")})).catch((e=>{this.handleError(e.message,"err")})):this.handleError(this.props.intl.formatMessage(as.invalid_security_token),"err")}handleStartVideoCall(){this.setState({callTopic:this.state.topicSelected,callState:1})}handleCallInvite(e,t,a){switch(a){case 1:let a={webrtc:pn};this.handleSendMessage(Gt.Drafty.videoCall(),void 0,void 0,a).then((e=>{e.code<200||e.code>=300||!e.params||!e.params.seq?this.handleCallClose():this.setState({callSeq:e.params.seq})}));break;case 3:const n=this.tinode.getTopic(e);if(!n)return;n.videoCall("accept",t)}}handleCallRinging(e,t){const a=this.tinode.getTopic(e);a&&a.videoCall("ringing",t)}handleCallHangup(e,t){const a=this.tinode.getTopic(e);a&&a.videoCall("hang-up",t)}handleCallSendOffer(e,t,a){const n=this.tinode.getTopic(e);n&&n.videoCall("offer",t,a)}handleCallIceCandidate(e,t,a){const n=this.tinode.getTopic(e);n&&n.videoCall("ice-candidate",t,a)}handleCallSendAnswer(e,t,a){const n=this.tinode.getTopic(e);n&&n.videoCall("answer",t,a)}handleCallClose(){this.callTimeoutTimer&&clearTimeout(this.callTimeoutTimer),this.setState({callTopic:void 0,callState:0})}handleCallAcceptCall(e){const t=this.tinode.getTopic(e);t&&(t.isSubscribed()?(this.handleTopicSelected(this.state.callTopic),this.setState({callState:3})):this.setState({callShouldStart:!0},(()=>this.handleTopicSelected(this.state.callTopic))))}handleInfoMessage(e){if("call"==e.what)switch(e.event){case"accept":if(Gt.Tinode.isMeTopicName(e.topic)&&this.tinode.isMe(e.from))return void this.setState({callTopic:null,callState:0,callSeq:null});e.topic==this.state.callTopic&&this.setState({callState:3});break;case"hang-up":this.handleCallClose()}}handleDataMessage(e){if(e.head&&e.head.webrtc&&e.head.webrtc==pn){const t=this.tinode.getTopic(e.topic);if(t){const a=t.latestMsgVersion(e.seq)||e;a.head&&a.head.webrtc&&a.head.webrtc==pn&&e.from!=this.state.myUserId&&(0==this.state.callState?this.setState({callTopic:e.topic,callState:2,callSeq:e.seq}):this.handleCallHangup(e.topic,e.seq))}else console.warn("Received vc data message from unknown topic",e.topic)}}render(){return t().createElement("div",{id:"app-container",ref:this.selfRef},this.state.contextMenuVisible?t().createElement(ha,{tinode:this.tinode,bounds:this.state.contextMenuBounds,clickAt:this.state.contextMenuClickAt,params:this.state.contextMenuParams,items:this.state.contextMenuItems,hide:this.handleHideContextMenu,onShowAlert:this.handleShowAlert,onAction:this.handleContextMenuAction,onTopicRemoved:e=>{e==this.state.topicSelected&&this.handleTopicSelected(null)},onError:this.handleError}):null,this.state.forwardDialogVisible?t().createElement(on,{tinode:this.tinode,contacts:this.state.chatList,topicSelected:this.state.topicSelected,myUserId:this.state.myUserId,hide:this.handleHideForwardDialog,onInitFind:this.tnInitFind,searchResults:this.state.searchResults,onSearchContacts:this.handleSearchContacts,onTopicSelected:this.handleStartTopicRequest}):null,this.state.callTopic&&2==this.state.callState?t().createElement(mn,{tinode:this.tinode,onClose:this.handleCallClose,topic:this.state.callTopic,seq:this.state.callSeq,callState:this.state.callState,onRinging:this.handleCallRinging,onAcceptCall:this.handleCallAcceptCall,onReject:this.handleCallHangup}):null,t().createElement(Yt,{visible:this.state.alertVisible,title:this.state.alertParams.title,content:this.state.alertParams.content,onReject:this.state.alertParams.onReject?()=>{this.setState({alertVisible:!1})}:null,reject:this.state.alertParams.reject,onConfirm:()=>{this.setState({alertVisible:!1}),this.state.alertParams.onConfirm()},confirm:this.state.alertParams.confirm}),t().createElement(Ji,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,hideSelf:this.state.displayMobile&&"sidepanel"!==this.state.mobilePanel,state:this.state.sidePanelSelected,title:this.state.sidePanelTitle,avatar:this.state.sidePanelAvatar,trustedBadges:this.state.myTrustedBadges,login:this.state.login,persist:this.state.persist,myUserId:this.state.myUserId,loginDisabled:this.state.loginDisabled,loadSpinnerVisible:this.state.loadSpinnerVisible,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,topicSelected:this.state.topicSelected,chatList:this.state.chatList,credMethod:this.state.credMethod,credCode:this.state.credCode,credToken:this.state.credToken,transport:this.state.transport,messageSounds:this.state.messageSounds,desktopAlerts:this.state.desktopAlerts,desktopAlertsEnabled:this.state.desktopAlertsEnabled,incognitoMode:this.state.incognitoMode,serverAddress:this.state.serverAddress,secureConnection:this.state.secureConnection,serverVersion:this.state.serverVersion,onGlobalSettings:this.handleGlobalSettings,onSignUp:this.handleNewAccount,onSettings:this.handleSettings,onNavigate:this.basicNavigator,onLoginRequest:this.handleLoginRequest,onPersistenceChange:this.handlePersistenceChange,onCreateAccount:this.handleNewAccountRequest,onUpdateAccountDesc:this.handleTopicUpdateRequest,onUpdatePassword:this.handleUpdatePasswordRequest,onUpdateAccountTags:this.handleUpdateAccountTagsRequest,onTogglePushNotifications:this.toggleFCMToken,onToggleMessageSounds:this.handleToggleMessageSounds,onToggleIncognitoMode:this.handleToggleIncognitoMode,onCredAdd:this.handleCredAdd,onCredDelete:this.handleCredDelete,onCredConfirm:this.handleCredConfirm,onTopicSelected:this.handleTopicSelected,onCreateTopic:this.handleStartTopicRequest,onLogout:this.handleLogout,onDeleteAccount:this.handleDeleteAccount,onShowAlert:this.handleShowAlert,onCancel:this.handleSidepanelCancel,onError:this.handleError,onValidateCredentials:this.handleValidateCredentialsRequest,onPasswordResetRequest:this.handlePasswordResetRequest,onResetPassword:this.handleResetPassword,onShowArchive:this.handleShowArchive,onShowBlocked:this.handleShowBlocked,onInitFind:this.tnInitFind,searchResults:this.state.searchResults,onSearchContacts:this.handleSearchContacts,showContextMenu:this.handleShowContextMenu}),t().createElement(yi,{tinode:this.tinode,connected:this.state.connected,ready:this.state.ready,online:this.state.topicSelectedOnline,acs:this.state.topicSelectedAcs,displayMobile:this.state.displayMobile,viewportWidth:this.state.viewportWidth,viewportHeight:this.state.viewportHeight,hideSelf:this.state.displayMobile&&("topic-view"!==this.state.mobilePanel||this.state.infoPanel),topic:this.state.topicSelected,myUserId:this.state.myUserId,myUserName:this.state.sidePanelTitle,serverVersion:this.state.serverVersion,serverAddress:this.state.serverAddress,applicationVisible:this.state.applicationVisible,forwardMessage:this.state.forwardMessage,onCancelForwardMessage:this.handleHideForwardDialog,callTopic:this.state.callTopic,callSeq:this.state.callSeq,callState:this.state.callState,onCallHangup:this.handleCallHangup,onCallInvite:this.handleCallInvite,onCallSendOffer:this.handleCallSendOffer,onCallIceCandidate:this.handleCallIceCandidate,onCallSendAnswer:this.handleCallSendAnswer,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,newTopicParams:this.state.newTopicParams,onHideMessagesView:this.handleHideMessagesView,onError:this.handleError,onNewTopicCreated:this.handleNewTopicCreated,showContextMenu:this.handleShowContextMenu,onChangePermissions:this.handleChangePermissions,onNewChat:this.handleNewChatInvitation,sendMessage:this.handleSendMessage,onVideoCallClosed:this.handleCallClose}),this.state.infoPanel?t().createElement(qn,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,topic:this.state.topicSelected,searchableContacts:this.state.searchableContacts,myUserId:this.state.myUserId,panel:this.state.infoPanel,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,onNavigate:this.infoNavigator,onTopicDescUpdateRequest:this.handleTopicUpdateRequest,onShowAlert:this.handleShowAlert,onChangePermissions:this.handleChangePermissions,onMemberUpdateRequest:this.handleMemberUpdateRequest,onDeleteTopic:this.handleDeleteTopicRequest,onDeleteMessages:this.handleDeleteMessagesRequest,onLeaveTopic:this.handleLeaveUnsubRequest,onBlockTopic:this.handleBlockTopicRequest,onReportTopic:this.handleReportTopic,onAddMember:this.handleManageGroupMembers,onTopicTagsUpdateRequest:this.handleTagsUpdateRequest,onTopicUnArchive:this.handleUnarchive,onInitFind:this.tnInitFind,onError:this.handleError,showContextMenu:this.handleShowContextMenu}):null)}}const is=(0,s.injectIntl)(ns),{params:ss}=mi.parseUrlHash(window.location.hash),rs=ss&&ss.hl||navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage||"en",os=rs.toLowerCase().split(/[-_]/)[0],ls=r[rs]?rs:r[os]?os:"en",cs=r[ls];document.getElementsByTagName("html")[0].setAttribute("lang",ls),i().render(t().createElement(t().StrictMode,null,t().createElement(s.IntlProvider,{locale:rs,messages:cs,textComponent:t().Fragment},t().createElement(is,null))),document.getElementById("mountPoint"))})()})();
|
||
//# sourceMappingURL=index.prod.js.map
|