@cg-devcenter/rtc-fpnn-webjs-sdk 1.0.0-cg.4 → 1.0.0-cg.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,11 +5,9 @@ RTC WebSocket Client SDK。新接入建议使用 `protocol: 'tlv-v1'`;`fpnn`
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- npm install @cg-devcenter/rtc-fpnn-webjs-sdk@1.0.0-cg.3
8
+ npm install @cg-devcenter/rtc-fpnn-webjs-sdk@latest
9
9
  ```
10
10
 
11
- 本文档中的 Promise API、`RTMSharedWorkerClient` 和 Vite 入口从 `1.0.0-cg.3` 起提供;此前发布的 `1.0.0-cg.2` 不包含这些能力。若 `.3` 尚未发布到 npm,可让测试项目安装本地 tarball:`npm install ./cg-devcenter-rtc-fpnn-webjs-sdk-1.0.0-cg.3.tgz`。
12
-
13
11
  浏览器可加载 `dist/rtm.min.js` 并从 `window.rtm` 使用;CommonJS:
14
12
 
15
13
  ```js
@@ -20,9 +18,9 @@ Node.js 使用 TLV v1 时,需自行提供 `webSocketFactory(url)`。SDK 不携
20
18
 
21
19
  ## Quick Start
22
20
 
23
- ### 默认共享入口(当前源码)
21
+ ### 默认共享入口
24
22
 
25
- `createClient()` 默认共享连接,默认协议为 TLV。Worker 名称由 SDK 按 **PID + 协议 + UID** 自动生成,UID 可直接从 `login()` 获取,业务无需维护 `workerName`。已发布 `.3` 不包含这个入口;请先使用本地构建或后续版本。
23
+ `createClient()` 默认共享连接,默认协议为 TLV。SDK 自动按 PID、协议、UID 和 Gate 地址隔离共享会话;同一环境的页面自动复用,业务无需配置 Worker 名称或路径。UID 可直接从 `login()` 获取。
26
24
 
27
25
  ```js
28
26
  const client = rtm.createClient({ pid, tlvEndpoint: endpoint });
@@ -60,7 +58,7 @@ async function startChat(rtm, { pid, endpoint, uid, peerUid, credential }) {
60
58
  try {
61
59
  if (loggedIn) await client.promises.bye(5000);
62
60
  } finally {
63
- client.destroy();
61
+ try { client.close(); } finally { client.destroy(); }
64
62
  }
65
63
  }
66
64
  }
@@ -70,11 +68,11 @@ async function startChat(rtm, { pid, endpoint, uid, peerUid, credential }) {
70
68
 
71
69
  ## 同 UID 多窗口
72
70
 
73
- 需要同一浏览器内多个同源页面共用一个 UID 的 RTC 登录和 WebSocket 时,新接入推荐使用 SDK 的 `createClient()` 默认共享入口。SDK 按 PID、协议和 UID 确定共享会话,业务代码无需维护 `workerName`;普通浏览器部署时将 `rtm.min.js` 和 `rtm.shared-worker.js` 放在同一同源目录即可。首次登录需要 credential;同 UID 后续页面复用共享会话。完整说明见 [默认共享接入](docs/USAGE.md#默认共享接入当前源码)。
71
+ 需要同一浏览器内多个同源页面共用一个 UID 的 RTC 登录和 WebSocket 时,新接入推荐使用 SDK 的 `createClient()` 默认共享入口。SDK 按 PID、协议、UID 和 Gate 地址确定共享会话,业务代码无需维护 Worker 配置;普通浏览器部署时将 `rtm.min.js` 和 `rtm.shared-worker.js` 放在同一同源目录即可。首次登录需要 credential;同 UID 后续页面复用共享会话。完整说明见 [默认共享接入](docs/USAGE.md#默认共享接入当前源码)。
74
72
 
75
- Vite 项目从 `@cg-devcenter/rtc-fpnn-webjs-sdk/vite` 导入 ESM 入口,SDK 会自动打包和配置 Worker 文件。若使用底层 `RTMSharedWorkerClient` 构造器,可通过 `uid` 自动生成 Worker 名称,或显式传入 `workerName`;`createClient()` 会按登录 UID 自动绑定,不要求手动设置名称。最后一个页面 detach 后默认 5 秒关闭共享连接。需要固定在已发布 `.3` 上时仍可直接使用 `RTMSharedWorkerClient`;当前源码新增的 `createClient()` 尚未包含在 `.3` 中。
73
+ Vite 项目从 `@cg-devcenter/rtc-fpnn-webjs-sdk/vite` 导入 ESM 入口,SDK 会自动打包和配置 Worker 文件。若使用底层 `RTMSharedWorkerClient` 构造器,可通过 `uid` 自动生成 Worker 名称,或显式传入 `workerName`;`createClient()` 会按登录 UID 自动绑定,不要求手动设置名称。最后一个页面 detach 后默认 5 秒关闭共享连接。
76
74
 
77
- 当前源码的 SharedWorker 也支持显式选择 `clientOptions.protocol: 'fpnn'`,登录共享和会话路由沿用同一套 API。已发布的 `1.0.0-cg.3` 尚不含 FPNN 共享扩展;本地构建或后续版本的用法与限制见 [FPNN 多窗口接入](docs/USAGE.md#fpnn-多窗口接入)。
75
+ SharedWorker 也支持显式选择 `clientOptions.protocol: 'fpnn'`,登录共享和会话路由沿用同一套 API。用法与限制见 [FPNN 多窗口接入](docs/USAGE.md#fpnn-多窗口接入)。
78
76
 
79
77
  仓库的演示页面可用以下命令启动:
80
78
 
@@ -83,13 +81,15 @@ npm run build
83
81
  npm run demo:shared-worker
84
82
  ```
85
83
 
86
- 发送台和收件箱 demo 地址、真实 Gate 配置方式见 [Demo 使用说明](examples/shared-worker-demo/README.md)。
84
+ 发送台和收件箱 demo 地址、真实 Gate 配置方式见 `examples/shared-worker-demo/README.md`(仅源码仓库)。
85
+
86
+ HTML 与 Vue 3 Demo 共用同一份框架无关的 RTC 工作流控制器,覆盖发送账号登录与发送、收件箱登录、历史、Push 路由、回复和重试。两者展示相同的核心 RTC 流程;页面适配、credential 签发器和本地模拟由各自 Demo 提供。Demo 不复制 SDK 的 SharedWorker 连接、登录态复用或 Push 分发逻辑。窗口内的消息列表、草稿和未读展示仍属于页面状态,不会由 SDK 跨窗口同步。文件结构和职责边界见 `examples/shared-worker-demo/README.md` 的职责边界章节(仅源码仓库)。
87
87
 
88
- 另有使用 Vue 3、Vite 和 npm 包导入方式的同功能示例;本次新入口需先通过 yalc 链接本地构建:[Vue 3 SharedWorker Demo](examples/vue3-shared-worker-demo/README.md)。
88
+ 另有使用 Vue 3、Vite 和 npm 包导入方式的同功能示例;本次新入口需先通过 yalc 链接本地构建:`examples/vue3-shared-worker-demo/README.md`(仅源码仓库)。
89
89
 
90
90
  ## TLV v1 最小接入 Demo
91
91
 
92
- 需要在浏览器里手动验证普通 `RTMClient` 接入时,在仓库根目录运行 `npm run build` 后执行 `npm run demo:tlv-basic`,再打开 `http://127.0.0.1:4174`。Demo 使用本机静态服务器;PID、WebSocket endpoint、UID 和服务端签发的 credential 由接入者填写,不会保存到浏览器存储。详见 [Demo 使用说明](examples/tlv-basic-demo/README.md)。
92
+ 需要在浏览器里手动验证普通 `RTMClient` 接入时,在仓库根目录运行 `npm run build` 后执行 `npm run demo:tlv-basic`,再打开 `http://127.0.0.1:4174`。Demo 使用本机静态服务器;PID、WebSocket endpoint、UID 和服务端签发的 credential 由接入者填写,不会保存到浏览器存储。详见 `examples/tlv-basic-demo/README.md`(仅源码仓库)。
93
93
 
94
94
  ## 文档
95
95
 
package/dist/rtm.d.ts CHANGED
@@ -292,12 +292,12 @@ declare namespace rtm {
292
292
 
293
293
  export class RTMSharedWorkerClient {
294
294
  constructor(options: RTMSharedWorkerOptions);
295
- /** Creates a stable name for the same protocol, project, UID, endpoint, and optional application/environment namespace. */
295
+ /** Creates a stable protocol/project/UID/environment name; endpoint and namespace isolate different environments. */
296
296
  static createWorkerName(identity: RTMSharedWorkerIdentity): string;
297
297
  /** Promise facade for callback-based business request methods. */
298
298
  readonly promises: RTMSharedWorkerPromiseApi;
299
299
  processor: RTMSharedProcessor;
300
- /** Resolves with the session snapshot after this page attaches to the Worker. */
300
+ /** Resolves with the initial snapshot after this page attaches. Use getSharedSession() for current state. */
301
301
  whenReady(): Promise<RTMSharedSessionSnapshot>;
302
302
  /** Returns the latest session snapshot observed by this page. */
303
303
  getSharedSession(): RTMSharedSessionSnapshot;
@@ -319,6 +319,7 @@ declare namespace rtm {
319
319
  protocol?: RTMProtocol;
320
320
  pid: string | number;
321
321
  uid: RTMId;
322
+ /** Optional explicit environment isolation; omitted in default client identities. */
322
323
  endpoint?: string;
323
324
  namespace?: string;
324
325
  }
package/dist/rtm.min.js CHANGED
@@ -24,4 +24,4 @@ t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,h=
24
24
  * @author Chen, Yi-Cyuan [emn178@gmail.com]
25
25
  * @copyright Chen, Yi-Cyuan 2014-2017
26
26
  * @license MIT
27
- */!function(){"use strict";function t(e){if(e)d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d,this.buffer8=l;else if(a){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var r="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1);var s=!e&&"object"==typeof self,h=!i.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;h?i=global:s&&(i=self);var f=!i.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,o=__webpack_require__(21),a=!i.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],y=[0,8,16,24],c=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),d=[],l;if(a){var A=new ArrayBuffer(68);l=new Uint8Array(A),d=new Uint32Array(A)}!i.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var b=function(e){return function(r){return new t(!0).update(r)[e]()}},v=function(){var e=b("hex");h&&(e=w(e)),e.create=function(){return new t},e.update=function(t){return e.create().update(t)};for(var r=0;r<c.length;++r){var n=c[r];e[n]=b(n)}return e},w=function(t){var e=eval("require('crypto')"),i=eval("require('buffer').Buffer"),s=function(n){if("string"==typeof n)return e.createHash("md5").update(n,"utf8").digest("hex");if(null==n)throw r;return n.constructor===ArrayBuffer&&(n=new Uint8Array(n)),Array.isArray(n)||ArrayBuffer.isView(n)||n.constructor===i?e.createHash("md5").update(new i(n)).digest("hex"):t(n)};return s};t.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw r;if(null===e)throw r;if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw r;t=!0}for(var i,o,s=0,u=e.length,c=this.blocks,f=this.buffer8;s<u;){if(this.hashed&&(this.hashed=!1,c[0]=c[16],c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),t)if(a)for(o=this.start;s<u&&o<64;++s)f[o++]=e[s];else for(o=this.start;s<u&&o<64;++s)c[o>>2]|=e[s]<<y[3&o++];else if(a)for(o=this.start;s<u&&o<64;++s)(i=e.charCodeAt(s))<128?f[o++]=i:i<2048?(f[o++]=192|i>>6,f[o++]=128|63&i):i<55296||i>=57344?(f[o++]=224|i>>12,f[o++]=128|i>>6&63,f[o++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++s)),f[o++]=240|i>>18,f[o++]=128|i>>12&63,f[o++]=128|i>>6&63,f[o++]=128|63&i);else for(o=this.start;s<u&&o<64;++s)(i=e.charCodeAt(s))<128?c[o>>2]|=i<<y[3&o++]:i<2048?(c[o>>2]|=(192|i>>6)<<y[3&o++],c[o>>2]|=(128|63&i)<<y[3&o++]):i<55296||i>=57344?(c[o>>2]|=(224|i>>12)<<y[3&o++],c[o>>2]|=(128|i>>6&63)<<y[3&o++],c[o>>2]|=(128|63&i)<<y[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++s)),c[o>>2]|=(240|i>>18)<<y[3&o++],c[o>>2]|=(128|i>>12&63)<<y[3&o++],c[o>>2]|=(128|i>>6&63)<<y[3&o++],c[o>>2]|=(128|63&i)<<y[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=u[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},t.prototype.hash=function(){var e,t,r,n,i,o,s=this.blocks;this.first?t=((t=((e=((e=s[0]-680876937)<<7|e>>>25)-271733879<<0)^(r=((r=(-271733879^(n=((n=(-1732584194^2004318071&e)+s[1]-117830708)<<12|n>>>20)+e<<0)&(-271733879^e))+s[2]-1126478375)<<17|r>>>15)+n<<0)&(n^e))+s[3]-1316259209)<<22|t>>>10)+r<<0:(e=this.h0,t=this.h1,r=this.h2,t=((t+=((e=((e+=((n=this.h3)^t&(r^n))+s[0]-680876936)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[1]-389564586)<<12|n>>>20)+e<<0)&(e^t))+s[2]+606105819)<<17|r>>>15)+n<<0)&(n^e))+s[3]-1044525330)<<22|t>>>10)+r<<0),t=((t+=((e=((e+=(n^t&(r^n))+s[4]-176418897)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[5]+1200080426)<<12|n>>>20)+e<<0)&(e^t))+s[6]-1473231341)<<17|r>>>15)+n<<0)&(n^e))+s[7]-45705983)<<22|t>>>10)+r<<0,t=((t+=((e=((e+=(n^t&(r^n))+s[8]+1770035416)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[9]-1958414417)<<12|n>>>20)+e<<0)&(e^t))+s[10]-42063)<<17|r>>>15)+n<<0)&(n^e))+s[11]-1990404162)<<22|t>>>10)+r<<0,t=((t+=((e=((e+=(n^t&(r^n))+s[12]+1804603682)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[13]-40341101)<<12|n>>>20)+e<<0)&(e^t))+s[14]-1502002290)<<17|r>>>15)+n<<0)&(n^e))+s[15]+1236535329)<<22|t>>>10)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[1]-165796510)<<5|e>>>27)+t<<0)^t))+s[6]-1069501632)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[11]+643717713)<<14|r>>>18)+n<<0)^n))+s[0]-373897302)<<20|t>>>12)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[5]-701558691)<<5|e>>>27)+t<<0)^t))+s[10]+38016083)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[15]-660478335)<<14|r>>>18)+n<<0)^n))+s[4]-405537848)<<20|t>>>12)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[9]+568446438)<<5|e>>>27)+t<<0)^t))+s[14]-1019803690)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[3]-187363961)<<14|r>>>18)+n<<0)^n))+s[8]+1163531501)<<20|t>>>12)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[13]-1444681467)<<5|e>>>27)+t<<0)^t))+s[2]-51403784)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[7]+1735328473)<<14|r>>>18)+n<<0)^n))+s[12]-1926607734)<<20|t>>>12)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[5]-378558)<<4|e>>>28)+t<<0))+s[8]-2022574463)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[11]+1839030562)<<16|r>>>16)+n<<0))+s[14]-35309556)<<23|t>>>9)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[1]-1530992060)<<4|e>>>28)+t<<0))+s[4]+1272893353)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[7]-155497632)<<16|r>>>16)+n<<0))+s[10]-1094730640)<<23|t>>>9)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[13]+681279174)<<4|e>>>28)+t<<0))+s[0]-358537222)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[3]-722521979)<<16|r>>>16)+n<<0))+s[6]+76029189)<<23|t>>>9)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[9]-640364487)<<4|e>>>28)+t<<0))+s[12]-421815835)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[15]+530742520)<<16|r>>>16)+n<<0))+s[2]-995338651)<<23|t>>>9)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[0]-198630844)<<6|e>>>26)+t<<0)|~r))+s[7]+1126891415)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[14]-1416354905)<<15|r>>>17)+n<<0)|~e))+s[5]-57434055)<<21|t>>>11)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[12]+1700485571)<<6|e>>>26)+t<<0)|~r))+s[3]-1894986606)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[10]-1051523)<<15|r>>>17)+n<<0)|~e))+s[1]-2054922799)<<21|t>>>11)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[8]+1873313359)<<6|e>>>26)+t<<0)|~r))+s[15]-30611744)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[6]-1560198380)<<15|r>>>17)+n<<0)|~e))+s[13]+1309151649)<<21|t>>>11)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[4]-145523070)<<6|e>>>26)+t<<0)|~r))+s[11]-1120210379)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[2]+718787259)<<15|r>>>17)+n<<0)|~e))+s[9]-343485551)<<21|t>>>11)+r<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=r-1732584194<<0,this.h3=n+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0)},t.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3;return n[e>>4&15]+n[15&e]+n[e>>12&15]+n[e>>8&15]+n[e>>20&15]+n[e>>16&15]+n[e>>28&15]+n[e>>24&15]+n[t>>4&15]+n[15&t]+n[t>>12&15]+n[t>>8&15]+n[t>>20&15]+n[t>>16&15]+n[t>>28&15]+n[t>>24&15]+n[r>>4&15]+n[15&r]+n[r>>12&15]+n[r>>8&15]+n[r>>20&15]+n[r>>16&15]+n[r>>28&15]+n[r>>24&15]+n[i>>4&15]+n[15&i]+n[i>>12&15]+n[i>>8&15]+n[i>>20&15]+n[i>>16&15]+n[i>>28&15]+n[i>>24&15]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.base64=function(){for(var e,t,r,n="",i=this.array(),o=0;o<15;)e=i[o++],t=i[o++],r=i[o++],n+=p[e>>>2]+p[63&(e<<4|t>>>4)]+p[63&(t<<2|r>>>6)]+p[63&r];return e=i[o],n+(p[e>>>2]+p[e<<4&63]+"==")};var _=v();f?module.exports=_:(i.md5=_,o&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return _}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()}).call(this,__webpack_require__(20),__webpack_require__(3))},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&d())}function d(){if(!f){var e=a(h);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l<t;)u&&u[l].run();l=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){(function(e){!function(t){function r(e,r,g){function m(e,t,r,n){return this instanceof m?function(e,t,r,n,i){if(h&&d&&(t instanceof d&&(t=new h(t)),n instanceof d&&(n=new h(n))),t||r||n||c){if(!s(t,r))i=r,n=t,r=0,t=new(c||Array)(8);e.buffer=t,e.offset=r|=0,f!==typeof n&&("string"==typeof n?function(e,t,r,n){var i=0,o=r.length,s=0,a=0;"-"===r[0]&&i++;for(var u=i;i<o;){var c=parseInt(r[i++],n);if(!(c>=0))break;a=a*n+c,s=s*n+Math.floor(a/y),a%=y}u&&(s=~s,a?a=y-a:s++),b(e,t+E,s),b(e,t+k,a)}(t,r,n,i||10):s(n,i)?a(t,r,n,i):"number"==typeof i?(b(t,r+E,n),b(t,r+k,i)):n>0?T(t,r,n):n<0?A(t,r,n):a(t,r,p,0))}else e.buffer=u(p,0)}(this,e,t,r,n):new m(e,t,r,n)}function v(){var e=this.buffer,t=this.offset,r=w(e,t+E),n=w(e,t+k);return g||(r|=0),r?r*y+n:n}function b(e,t,r){e[t+O]=255&r,r>>=8,e[t+C]=255&r,r>>=8,e[t+P]=255&r,r>>=8,e[t+R]=255&r}function w(e,t){return e[t+R]*_+(e[t+P]<<16)+(e[t+C]<<8)+e[t+O]}var E=r?0:4,k=r?4:0,R=r?0:3,P=r?1:2,C=r?2:1,O=r?3:0,T=r?function(e,t,r){for(var n=t+8;n>t;)e[--n]=255&r,r/=256}:function(e,t,r){for(var n=t+8;t<n;)e[t++]=255&r,r/=256},A=r?function(e,t,r){var n=t+8;for(r++;n>t;)e[--n]=255&-r^255,r/=256}:function(e,t,r){var n=t+8;for(r++;t<n;)e[t++]=255&-r^255,r/=256},S=m.prototype,M="is"+e,I="_"+M;return S.buffer=void 0,S.offset=0,S[I]=!0,S.toNumber=v,S.toString=function(e){var t=this.buffer,r=this.offset,n=w(t,r+E),i=w(t,r+k),o="",s=!g&&2147483648&n;for(s&&(n=~n,i=y-i),e=e||10;;){var a=n%e*y+i;if(n=Math.floor(n/e),i=Math.floor(a/e),o=(a%e).toString(e)+o,!n&&!i)break}return s&&(o="-"+o),o},S.toJSON=v,S.toArray=n,l&&(S.toBuffer=i),h&&(S.toArrayBuffer=o),m[M]=function(e){return!(!e||!e[I])},t[e]=m,m}function n(e){var t=this.buffer,r=this.offset;return c=null,!1!==e&&0===r&&8===t.length&&g(t)?t:u(t,r)}function i(t){var r=this.buffer,n=this.offset;if(c=l,!1!==t&&0===n&&8===r.length&&e.isBuffer(r))return r;var i=new l(8);return a(i,0,r,n),i}function o(e){var t=this.buffer,r=this.offset,n=t.buffer;if(c=h,!1!==e&&0===r&&n instanceof d&&8===n.byteLength)return n;var i=new h(8);return a(i,0,t,r),i.buffer}function s(e,t){var r=e&&e.length;return t|=0,r&&t+8<=r&&"string"!=typeof e[t]}function a(e,t,r,n){t|=0,n|=0;for(var i=0;i<8;i++)e[t++]=255&r[n++]}function u(e,t){return Array.prototype.slice.call(e,t,t+8)}var c,f="undefined",l=f!==typeof e&&e,h=f!==typeof Uint8Array&&Uint8Array,d=f!==typeof ArrayBuffer&&ArrayBuffer,p=[0,0,0,0,0,0,0,0],g=Array.isArray||function(e){return!!e&&"[object Array]"==Object.prototype.toString.call(e)},y=4294967296,_=16777216;r("Uint64BE",!0,!0),r("Int64BE",!0,!1),r("Uint64LE",!1,!0),r("Int64LE",!1,!1)}("string"!=typeof t.nodeName?t:this||{})}).call(this,r(6).Buffer)},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=r(4),o=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,r));return n.name="TLVContractError",n.status=e,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),t}();function s(e,t,r,n){var i=n||{};return{defaults:i.defaults||{},pass:i.pass||[],request:t||{},required:i.required||[],response:r||{},uri:e}}var a={cursor:0,end_ms:0,limit:20,reverse:!1,start_ms:0},u={end_ms:0,limit:20,reverse:!1,start_ms:0},c={end_ms:0,start_ms:0},f={begin:"start_ms",desc:"reverse",end:"end_ms",lastid:"cursor",mtypes:"kinds",num:"limit"},l={begin:"start_ms",desc:"reverse",end:"end_ms",mid:"anchor",mtypes:"kinds",num:"limit"},h={begin:"start_ms",end:"end_ms",mtypes:"kinds"},d={begin:"first_ms",end:"last_ms",lastid:"next",msgs:"items",num:"size"},p={auth:s("auth.login",{attrs:"props",authv:"auth_ver",lang:"locale",pid:"project",token:"credential",ts:"auth_sec",uid:"user",version:"client_ver"},{ok:"accepted"},{required:["project","user","credential","client_ver"]}),bye:s("connection.close"),getservertime:s("system.time",null,{mts:"server_ms"}),addattrs:s("connection.set_props",{attrs:"props"},null,{required:["props"]}),getattrs:s("connection.get_props",null,{attrs:"props"}),adddebuglog:s("system.debug",{attrs:"context",msg:"entry"},null,{required:["entry","context"]}),getonlineusers:s("presence.online",{uids:"users"},{uids:"online_users"},{required:["users"]}),setuserinfo:s("user.set_profile",{oinfo:"public_data",pinfo:"private_data"}),getuserinfo:s("user.get_profile",null,{oinfo:"public_data",pinfo:"private_data"}),getuseropeninfo:s("user.get_public",{uids:"users"},{info:"profiles"},{required:["users"]}),setlang:s("user.set_locale",{lang:"locale"},{ok:"updated"},{required:["locale"]}),dataget:s("storage.get",{key:"slot"},{val:"value"},{required:["slot"]}),dataset:s("storage.set",{key:"slot",val:"value"},null,{required:["slot","value"]}),datadel:s("storage.delete",{key:"slot"},null,{required:["slot"]}),addblacks:s("blacklist.add",{blacks:"blocked_users"},null,{required:["blocked_users"]}),delblacks:s("blacklist.remove",{blacks:"blocked_users"},null,{required:["blocked_users"]}),getblacks:s("blacklist.list",null,{uids:"blocked_users"}),addgroupmembers:s("group.add",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),delgroupmembers:s("group.remove",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),getgroupmembers:s("group.members",{gid:"group_ref",online:"with_online"},{onlines:"active_members",uids:"members"},{required:["group_ref"]}),getgroupcount:s("group.count",{gid:"group_ref",online:"with_online"},{cn:"total",online:"active_total"},{required:["group_ref"]}),getusergroups:s("group.joined",null,{gids:"group_refs"}),setgroupinfo:s("group.set_profile",{gid:"group_ref",oinfo:"public_data",pinfo:"private_data"},null,{required:["group_ref"]}),getgroupinfo:s("group.get_profile",{gid:"group_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["group_ref"]}),getgroupopeninfo:s("group.get_public",{gid:"group_ref"},{oinfo:"public_data"},{required:["group_ref"]}),getgroupsopeninfo:s("group.get_public_batch",{gids:"group_refs"},{info:"profiles"},{required:["group_refs"]}),enterroom:s("room.join",{rid:"room_ref"},null,{required:["room_ref"]}),leaveroom:s("room.leave",{rid:"room_ref"},null,{required:["room_ref"]}),enterrooms:s("room.join_batch",{rids:"room_refs"},null,{required:["room_refs"]}),getuserrooms:s("room.joined",null,{rooms:"room_refs"}),getroommembers:s("room.members",{rid:"room_ref"},{uids:"members"},{required:["room_ref"]}),getroomcount:s("room.counts",{rids:"room_refs"},{cn:"totals"},{required:["room_refs"]}),setroominfo:s("room.set_profile",{icon:"avatar",name:"label",oinfo:"public_data",pinfo:"private_data",rid:"room_ref"},null,{required:["room_ref"]}),getroominfo:s("room.get_profile",{rid:"room_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["room_ref"]}),getroomopeninfo:s("room.get_public",{rid:"room_ref"},{oinfo:"public_data"},{required:["room_ref"]}),getroomsopeninfo:s("room.get_public_batch",{rids:"room_refs"},{info:"profiles"},{required:["room_refs"]}),getuserroomsandlastmsg:s("room.last_messages",{mtypes:"kinds"},{rooms:"last_by_room"}),sendmsg:s("message.send",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",to:"recipient"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["recipient","message_ref","kind","payload","extra"]}),sendmsgs:s("message.send_batch",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",tos:"recipients"},{mid:"message_ref",mtime:"time_ms"},{required:["recipients","message_ref","kind","payload","extra"]}),sendgroupmsg:s("message.send_group",{attrs:"extra",gid:"group_ref",mid:"message_ref",msg:"payload",mtype:"kind"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["group_ref","message_ref","kind","payload","extra"]}),sendroommsg:s("message.send_room",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",rid:"room_ref"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["room_ref","message_ref","kind","payload","extra"]}),tcheck:s("moderation.check",{region:"zone",text:"payload"},{language:"detected_locale",result:"decision",text:"filtered",wlist:"matches"},{pass:["checkParams","strategyId"],required:["payload"]}),translate:s("translation.run",{dst:"to_locale",profanity:"filter_mode",src:"from_locale",text:"input",type:"format"},{dtext:"output",dst:"to_locale",source:"detected_locale",sourceText:"original",src:"from_locale",stext:"input",target:"resolved_locale",targetText:"translated"},{defaults:{filter_mode:"off",format:"chat"},required:["input","to_locale","format","filter_mode"]}),getp2pmsg:s("history.direct",Object.assign({ouid:"peer"},f),d,{defaults:a,required:["peer","reverse","limit","start_ms","end_ms","cursor"]}),getgroupmsg:s("history.group",Object.assign({gid:"group_ref"},f),d,{defaults:a,required:["group_ref","reverse","limit","start_ms","end_ms","cursor"]}),getroommsg:s("history.room",Object.assign({rid:"room_ref"},f),d,{defaults:a,required:["room_ref","reverse","limit","start_ms","end_ms","cursor"]}),getbroadcastmsg:s("history.broadcast",f,d,{defaults:a,required:["reverse","limit","start_ms","end_ms","cursor"]}),getp2pmsgbymessageid:s("history.direct_anchor",Object.assign({ouid:"peer"},l),d,{defaults:u,required:["peer","anchor","reverse","limit","start_ms","end_ms"]}),getgroupmsgbymessageid:s("history.group_anchor",Object.assign({gid:"group_ref"},l),d,{defaults:u,required:["group_ref","anchor","reverse","limit","start_ms","end_ms"]}),getroommsgbymessageid:s("history.room_anchor",Object.assign({rid:"room_ref"},l),d,{defaults:u,required:["room_ref","anchor","reverse","limit","start_ms","end_ms"]}),getbroadcastmsgbymessageid:s("history.broadcast_anchor",l,d,{defaults:u,required:["anchor","reverse","limit","start_ms","end_ms"]}),getp2pmsgcount:s("history.direct_count",Object.assign({ouid:"peer"},h),{count:"total"},{defaults:c,required:["peer","start_ms","end_ms"]}),getgroupmsgcount:s("history.group_count",Object.assign({gid:"group_ref"},h),{count:"total"},{defaults:c,required:["group_ref","start_ms","end_ms"]}),getroommsgcount:s("history.room_count",Object.assign({rid:"room_ref"},h),{count:"total"},{defaults:c,required:["room_ref","start_ms","end_ms"]}),getbroadcastmsgcount:s("history.broadcast_count",h,{count:"total"},{defaults:c,required:["start_ms","end_ms"]}),getmsg:s("message.get",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},{attrs:"extra",from:"sender",id:"sequence",mid:"message_ref",msg:"payload",mtime:"time_ms",mtype:"kind"},{required:["sender","message_ref","target_ref","channel"]}),delmsg:s("message.revoke",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},null,{required:["sender","message_ref","target_ref","channel"]}),getunread:s("unread.summary",{clear:"mark_read",gettime:"with_logout"},{group:"group_refs",logouttime:"logout_sec",p2p:"peers"},{defaults:{mark_read:!1},required:["mark_read"]}),getsession:s("session.list",null,{group:"group_refs",p2p:"peers"}),cleanunread:s("unread.clear"),setsessionread:s("session.read",{category:"channel",read_seq:"through",xid:"target_ref"},null,{required:["channel","target_ref","through"]}),getp2punread:s("unread.direct",{mtime:"since_ms",mtypes:"kinds",uids:"peers"},{ltime:"times",p2p:"counts"},{required:["peers"]}),getgroupunread:s("unread.group",{gids:"group_refs",mtime:"since_ms",mtypes:"kinds"},{group:"counts",ltime:"times"},{required:["group_refs"]}),removesession:s("session.remove",{oneway:"local_only",to:"peer"},null,{defaults:{local_only:!1},required:["peer","local_only"]}),getp2pconversationlist:s("conversation.direct",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getp2punreadconversationlist:s("conversation.direct_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getgroupconversationlist:s("conversation.group",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getgroupunreadconversationlist:s("conversation.group_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getunreadconversationlist:s("conversation.unread",{clear:"mark_read",mtime:"since_ms",mtypes:"kinds"},{groupConversations:"group_refs",groupMsgs:"group_last",groupUnreads:"group_badges",p2pConversations:"peers",p2pMsgs:"peer_last",p2pUnreads:"peer_badges"},{defaults:{mark_read:!1},required:["mark_read"]})},g=new Set(["acheck","adddevice","addfriends","addoption","addprojectban","adminCommand","broadcastfile","closeRTCRoom","delfriends","filetoken","getfriends","getoption","getRTCRoomList","getRTCRoomMemberCount","getRTCRoomMembers","icheck","inviteUserIntoRTCRoom","isfriend","isfriends","isprojectban","kickoutFromRTCRoom","profanity","pullIntoRTCRoom","removedevice","removeoption","removeprojectban","sendfile","sendfiles","sendgroupfile","sendroomfile","setRTCRoomMicStatus","speech2text","speechtranslation","uploadfile","vcheck"]),y={"event.broadcast":!0,"event.direct":!0,"event.group":!0,"event.room":!0},_={"event.kicked":!0,"event.room_removed":!0},m="9223372036854775807";function v(e,t,r){return Object.assign({required:!!t,type:e},r||{})}function b(e,t){return v("integer",e,Object.assign({min:"-9223372036854775808",max:m},t||{}))}function w(e,t){return v("integer",e,Object.assign({min:"-2147483648",max:"2147483647"},t||{}))}function E(e,t){return b(e,Object.assign({min:"1"},t||{}))}function k(e,t){return b(e,Object.assign({min:"0"},t||{}))}function R(e,t){return w(e,Object.assign({min:"0"},t||{}))}function P(e,t){return v("string",e,t)}function C(e){return v("boolean",e)}function O(e,t,r){return v("array",e,Object.assign({element:t},r||{}))}function T(e,t,r,n){return v("map",e,Object.assign({key:t,value:r},n||{}))}function A(e){return Object.assign({sent_ms:b(!1),trace:P(!1)},e||{})}function S(e,t){return{allowEmpty:!(!t||!t.allowEmpty),fields:e||{}}}var M=b(!1),I=w(!1),U=R(!1),N=b(!1),B=k(!1),x=E(!1),D=P(!1),F=v("string_or_bin",!1),L=v("tuple8",!1);function j(e,t){return O(e,x,t)}function q(e,t){return O(e,M,t)}function Y(e,t){return O(e,I,t)}function V(e){return T(e,"string",D)}function H(e){return T(e,"positive_decimal_int64",D)}function W(e){return T(e,"positive_decimal_int64",U)}function G(e){return T(e,"positive_decimal_int64",B)}function z(e){return b(e,{max:"255",min:"0"})}var K,J={extra:P(!0,{maxBytes:65535}),kind:(K=!0,b(K,{messageKind:!0})),message_ref:k(!0),payload:v("string_or_bin",!0,{maxBytes:65535})},Q={cursor:b(!0),end_ms:k(!0),kinds:q(!1),limit:R(!0),reverse:C(!0),start_ms:k(!0)},X={anchor:E(!0),end_ms:k(!0),kinds:q(!1),limit:R(!0),reverse:C(!0),start_ms:k(!0)},$={end_ms:k(!0),kinds:q(!1),start_ms:k(!0)},Z={"auth.login":A({auth_sec:k(!1),auth_ver:w(!1,{enum:["2"]}),client_ver:P(!0,{nonEmpty:!0}),credential:P(!0,{nonEmpty:!0}),locale:P(!1),project:b(!0,{max:"4294967295",min:"1"}),props:V(!1),user:E(!0)}),"connection.close":A(),"system.time":A(),"connection.set_props":A({props:V(!0)}),"connection.get_props":A(),"system.debug":A({context:P(!0),entry:P(!0,{nonEmpty:!0})}),"presence.online":A({users:j(!0,{minItems:1})}),"user.set_profile":A({private_data:P(!1),public_data:P(!1)}),"user.get_profile":A(),"user.get_public":A({users:j(!0,{minItems:1})}),"user.set_locale":A({locale:P(!0)}),"storage.get":A({slot:P(!0)}),"storage.set":A({slot:P(!0),value:P(!0)}),"storage.delete":A({slot:P(!0)}),"blacklist.add":A({blocked_users:j(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.remove":A({blocked_users:j(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.list":A(),"group.add":A({group_ref:E(!0),members:j(!0,{minItems:1})}),"group.remove":A({group_ref:E(!0),members:j(!0,{minItems:1})}),"group.members":A({group_ref:E(!0),with_online:C(!1)}),"group.count":A({group_ref:E(!0),with_online:C(!1)}),"group.joined":A(),"group.set_profile":A({group_ref:E(!0),private_data:P(!1),public_data:P(!1)}),"group.get_profile":A({group_ref:E(!0)}),"group.get_public":A({group_ref:E(!0)}),"group.get_public_batch":A({group_refs:j(!0,{minItems:1})}),"room.join":A({room_ref:E(!0)}),"room.leave":A({room_ref:E(!0)}),"room.join_batch":A({room_refs:j(!0,{maxItems:100,minItems:1})}),"room.joined":A(),"room.members":A({room_ref:E(!0)}),"room.counts":A({room_refs:j(!0,{minItems:1})}),"room.set_profile":A({avatar:P(!1),label:P(!1),private_data:P(!1),public_data:P(!1),room_ref:E(!0)}),"room.get_profile":A({room_ref:E(!0)}),"room.get_public":A({room_ref:E(!0)}),"room.get_public_batch":A({room_refs:j(!0,{minItems:1})}),"room.last_messages":A({kinds:q(!1)}),"message.send":A(Object.assign({recipient:E(!0)},J,{checkParams:P(!1),strategyid:P(!1)})),"message.send_batch":A(Object.assign({recipients:j(!0,{maxItems:100,minItems:1})},J)),"message.send_group":A(Object.assign({group_ref:E(!0)},J,{checkParams:P(!1),strategyid:P(!1)})),"message.send_room":A(Object.assign({room_ref:E(!0)},J,{checkParams:P(!1),strategyid:P(!1)})),"moderation.check":A({checkParams:P(!1),payload:P(!0,{nonEmpty:!0}),strategyId:P(!1),zone:P(!1)}),"translation.run":A({filter_mode:P(!0,{enum:["off","stop","censor"]}),format:P(!0,{nonEmpty:!0}),from_locale:P(!1),input:P(!0,{nonEmpty:!0}),to_locale:P(!0)}),"history.direct":A(Object.assign({peer:E(!0)},Q)),"history.group":A(Object.assign({group_ref:E(!0)},Q)),"history.room":A(Object.assign({room_ref:E(!0)},Q)),"history.broadcast":A(Q),"history.direct_anchor":A(Object.assign({peer:E(!0)},X)),"history.group_anchor":A(Object.assign({group_ref:E(!0)},X)),"history.room_anchor":A(Object.assign({room_ref:E(!0)},X)),"history.broadcast_anchor":A(X),"history.direct_count":A(Object.assign({peer:E(!0)},$)),"history.group_count":A(Object.assign({group_ref:E(!0)},$)),"history.room_count":A(Object.assign({room_ref:E(!0)},$)),"history.broadcast_count":A($),"message.get":A({channel:w(!0,{enum:["1","2","3","4"]}),message_ref:b(!0),sender:E(!0),target_ref:k(!0)}),"message.revoke":A({channel:w(!0,{enum:["1","2","3","4"]}),message_ref:b(!0),sender:E(!0),target_ref:k(!0)}),"unread.summary":A({mark_read:C(!0),with_logout:C(!1)}),"session.list":A(),"unread.clear":A(),"session.read":A({channel:w(!0,{enum:["1","2","3","4","5"]}),target_ref:k(!0),through:E(!0)}),"unread.direct":A({kinds:q(!1),peers:j(!0,{minItems:1}),since_ms:k(!1)}),"unread.group":A({group_refs:j(!0,{minItems:1}),kinds:q(!1),since_ms:k(!1)}),"session.remove":A({local_only:C(!0),peer:E(!0)}),"conversation.direct":A({kinds:q(!1),since_ms:k(!1)}),"conversation.direct_unread":A({kinds:q(!1),since_ms:k(!1)}),"conversation.group":A({kinds:q(!1),since_ms:k(!1)}),"conversation.group_unread":A({kinds:q(!1),since_ms:k(!1)}),"conversation.unread":A({kinds:q(!1),mark_read:C(!0),since_ms:k(!1)})},ee={first_ms:k(!0),items:O(!0,L),last_ms:k(!0),next:b(!0),size:R(!0)},te={message_ref:b(!0),time_ms:b(!0)},re={extra:P(!0),kind:z(!0),message_ref:b(!0),payload:v("string_or_bin",!0),sender:E(!0),sequence:b(!0),time_ms:b(!0)},ne={"auth.login":S({accepted:C(!0),telemetry_on:C(!1)}),"connection.close":S(),"system.time":S({server_ms:b(!0)}),"connection.set_props":S(),"connection.get_props":S({props:V(!0)}),"system.debug":S(),"presence.online":S({online_users:j(!0)}),"user.set_profile":S(),"user.get_profile":S({private_data:P(!0),public_data:P(!0)}),"user.get_public":S({profiles:H(!0)}),"user.set_locale":S({updated:C(!0)}),"storage.get":S({value:P(!0)}),"storage.set":S(),"storage.delete":S(),"blacklist.add":S(),"blacklist.remove":S(),"blacklist.list":S({blocked_users:j(!0)}),"group.add":S(),"group.remove":S(),"group.members":S({active_members:j(!1),members:j(!0)}),"group.count":S({active_total:R(!1),total:R(!0)}),"group.joined":S({group_refs:j(!0)}),"group.set_profile":S(),"group.get_profile":S({private_data:P(!0),public_data:P(!0)}),"group.get_public":S({public_data:P(!0)}),"group.get_public_batch":S({profiles:H(!0)}),"room.join":S(),"room.leave":S(),"room.join_batch":S(),"room.joined":S({room_refs:j(!0)}),"room.members":S({members:j(!0)}),"room.counts":S({totals:W(!0)}),"room.set_profile":S(),"room.get_profile":S({private_data:P(!0),public_data:P(!0)}),"room.get_public":S({public_data:P(!0)}),"room.get_public_batch":S({profiles:H(!0)}),"room.last_messages":S({last_by_room:function(e){return T(e,"positive_decimal_int64",L)}(!0)}),"message.send":S(te),"message.send_batch":S(te),"message.send_group":S(te),"message.send_room":S(te),"moderation.check":S({decision:w(!0),detected_locale:P(!0),filtered:P(!0),matches:function(e,t){return O(e,D,t)}(!1)}),"translation.run":S({detected_locale:P(!0),from_locale:P(!0),input:P(!0),original:P(!0),output:P(!0),resolved_locale:P(!0),to_locale:P(!0),translated:P(!0)}),"history.direct":S(ee),"history.group":S(ee),"history.room":S(ee),"history.broadcast":S(ee),"history.direct_anchor":S(ee),"history.group_anchor":S(ee),"history.room_anchor":S(ee),"history.broadcast_anchor":S(ee),"history.direct_count":S({total:R(!0)}),"history.group_count":S({total:R(!0)}),"history.room_count":S({total:R(!0)}),"history.broadcast_count":S({total:R(!0)}),"message.get":S(re,{allowEmpty:!0}),"message.revoke":S(),"unread.summary":S({group_refs:j(!0),logout_sec:k(!1),peers:j(!0)}),"session.list":S({group_refs:j(!0),peers:j(!0)}),"unread.clear":S(),"session.read":S(),"unread.direct":S({counts:W(!0),times:G(!0)}),"unread.group":S({counts:W(!0),times:G(!0)}),"session.remove":S(),"conversation.direct":S({badges:Y(!0),last_items:O(!0,L),peers:j(!0)}),"conversation.direct_unread":S({badges:Y(!0),last_items:O(!0,L),peers:j(!0)}),"conversation.group":S({badges:Y(!0),group_refs:j(!0),last_items:O(!0,L)}),"conversation.group_unread":S({badges:Y(!0),group_refs:j(!0),last_items:O(!0,L)}),"conversation.unread":S({group_badges:Y(!0),group_last:O(!0,L),group_refs:j(!0),peer_badges:Y(!0),peer_last:O(!0,L),peers:j(!0)}),"control.ping":S({ts:b(!1)})},ie={from_locale:P(!0),original:P(!0),to_locale:P(!0),translated:P(!0)},oe={extra:P(!0,{maxBytes:65535}),kind:z(!0),message_ref:b(!0),payload:v("push_payload",!0),sender:E(!0),time_ms:b(!0)},se={"event.direct":Object.assign({recipient:E(!0)},oe),"event.group":Object.assign({group_ref:E(!0)},oe),"event.room":Object.assign({room_ref:E(!0)},oe),"event.broadcast":oe,"event.kicked":{},"event.room_removed":{room_ref:E(!0)}};function ae(e){return p[e]||null}function ue(e){var t=String(e);if(!/^-?[0-9]+$/.test(t))return null;var r="-"===t.charAt(0),n=(r?t.slice(1):t).replace(/^0+/,"")||"0";return r&&"0"!==n?"-"+n:n}function ce(e){return"number"==typeof e?function(e){if(Number.isSafeInteger)return Number.isSafeInteger(e);return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991}(e)?ue(e):null:"bigint"==typeof e||e instanceof i.Int64Value||e&&"object"===(void 0===e?"undefined":n(e))&&"number"==typeof e.offset&&e.buffer&&"function"==typeof e.toString?ue(e.toString()):null}function fe(e,t){var r=ue(e),n=ue(t);if(null===r||null===n)throw new Error("integer comparison requires decimal integers");if(r===n)return 0;var i="-"===r.charAt(0),o="-"===n.charAt(0);if(i!==o)return i?-1:1;var s=i?r.slice(1):r,a=o?n.slice(1):n,u=void 0;return u=s.length!==a.length?s.length<a.length?-1:1:s<a?-1:1,i?-u:u}function le(e){for(var t=0,r=0;r<e.length;r+=1){var n=e.charCodeAt(r);if(n>=55296&&n<=56319){var i=e.charCodeAt(r+1);if(i<56320||i>57343)throw new o(200034,"string contains an unpaired surrogate");t+=4,r+=1}else{if(n>=56320&&n<=57343)throw new o(200034,"string contains an unpaired surrogate");t+=n<=127?1:n<=2047?2:3}}return t}function he(e,t){throw new o(200034,e+" "+t)}function de(e,t,r){if(null==e&&he(r,"must not be nil"),"integer"!==t.type)if("boolean"!==t.type){if("string"===t.type)return"string"!=typeof e&&he(r,"must be a UTF-8 string"),t.nonEmpty&&0===e.length&&he(r,"must not be empty"),t.enum&&-1===t.enum.indexOf(e)&&he(r,"is not an allowed value"),void(void 0!==t.maxBytes&&le(e)>t.maxBytes&&he(r,"exceeds "+t.maxBytes+" UTF-8 bytes"));if("string_or_bin"===t.type){if("string"==typeof e)return void(void 0!==t.maxBytes&&le(e)>t.maxBytes&&he(r,"exceeds "+t.maxBytes+" UTF-8 bytes"));var n=i.getByteView(e);return n||he(r,"must be a string or MsgPack bin value"),void(void 0!==t.maxBytes&&n.byteLength>t.maxBytes&&he(r,"exceeds "+t.maxBytes+" bytes"))}if("array"!==t.type){if("map"===t.type)return i.isPlainMap(e)||he(r,"must be a map"),void Object.keys(e).forEach((function(n){!function(e,t,r){if("string"!==t)if("positive_decimal_int64"!==t)he(r,"uses an unsupported map-key contract");else{var n=ue(e);(null===n||"-"===n.charAt(0)||"0"===n||fe(n,m)>0)&&he(r,"must be a positive decimal int64 map key")}}(n,t.key,r+"."+n),de(e[n],t.value,r+"."+n)}));if("tuple8"!==t.type)if("push_payload"!==t.type)he(r,"uses an unsupported value contract");else{if("string"==typeof e||i.getByteView(e))return;pe("Chat payload",e,ie)}else!function(e,t){Array.isArray(e)&&8===e.length||he(t,"must be an 8-item message tuple"),de(e[0],N,t+"[0]"),de(e[1],N,t+"[1]"),de(e[2],M,t+"[2]"),de(e[3],N,t+"[3]"),de(e[4],v("boolean",!1),t+"[4]"),de(e[5],F,t+"[5]"),de(e[6],D,t+"[6]"),de(e[7],N,t+"[7]")}(e,r)}else if(Array.isArray(e)||he(r,"must be an array"),void 0!==t.minItems&&e.length<t.minItems&&he(r,"must not be empty"),void 0!==t.maxItems&&e.length>t.maxItems&&he(r,"contains too many items"),e.forEach((function(e,n){de(e,t.element,r+"["+n+"]")})),void 0!==t.uniqueInt64Max){var o={};e.forEach((function(e){o[ce(e)]=!0})),Object.keys(o).length>t.uniqueInt64Max&&he(r,"contains too many distinct int64 items")}}else"boolean"!=typeof e&&he(r,"must be boolean");else!function(e,t,r){var n=ce(e);(null===n||fe(n,"-9223372036854775808")<0||fe(n,m)>0)&&he(r,"must be a signed int64 integer"),void 0!==t.min&&fe(n,t.min)<0&&he(r,"is below the allowed range"),void 0!==t.max&&fe(n,t.max)>0&&he(r,"is above the allowed range"),t.enum&&-1===t.enum.indexOf(n)&&he(r,"is not an allowed value"),t.messageKind&&!(fe(n,"1")>=0&&fe(n,"39")<=0||fe(n,"51")>=0&&fe(n,"127")<=0)&&he(r,"must be in kind ranges [1,39] or [51,127]")}(e,t,r)}function pe(e,t,r){i.isPlainMap(t)||he(e,"body must be a map"),Object.keys(t).forEach((function(t){Object.prototype.hasOwnProperty.call(r,t)||he(e+"."+t,"is not defined by this contract")})),Object.keys(r).forEach((function(n){var i=r[n];Object.prototype.hasOwnProperty.call(t,n)?de(t[n],i,e+"."+n):i.required&&he(e+"."+n,"is required")}))}function ge(e,t,r){for(var n=t[r[0]].length,i=1;i<r.length;i+=1)t[r[i]].length!==n&&he(e+" Answer",r.join(", ")+" must have matching lengths")}function ye(e){return g.has(e)||"string"==typeof e&&0===e.indexOf("imclient_")}e.exports={RELIABLE_PUSHES:y,REQUEST_SCHEMAS:Z,RESPONSE_SCHEMAS:ne,RESERVED_WIRES:g,ROUTES:p,TLVContractError:o,getRoute:ae,getRouteByUri:function(e){for(var t=Object.keys(p),r=0;r<t.length;r+=1){var n=p[t[r]];if(n.uri===e)return{method:t[r],route:n}}return null},isOneWayPush:function(e){return Object.prototype.hasOwnProperty.call(_,e)},isReliablePush:function(e){return Object.prototype.hasOwnProperty.call(y,e)},isReservedWire:ye,toWireRequest:function(e,t,r,n){var s=ae(e);if(!s){if(ye(e))throw new o(200020,e+" is reserved and unavailable on the TLV Client port");throw new o(20004,"unknown or unsupported TLV Client wire: "+e)}if(!i.isPlainMap(t))throw new o(200034,e+" request body must be a map");var a={};return Object.keys(t).forEach((function(e){var r=void 0;if("trace_id"!==e&&"send_ts"!==e){if("trace"===e||"sent_ms"===e)r=e;else if(Object.prototype.hasOwnProperty.call(s.request,e))r=s.request[e];else{if(-1===s.pass.indexOf(e))throw new o(200034,s.uri+" does not accept field "+e);r=e}if(Object.prototype.hasOwnProperty.call(a,r))throw new o(200034,s.uri+" received duplicate field mapping for "+r);n&&n.omitLegacyNil&&(void 0===t[e]||null===t[e])&&function(e,t){if("trace"===t||"sent_ms"===t)return!0;if(Object.prototype.hasOwnProperty.call(e.defaults,t))return!0;var r=Z[e.uri];return!(!r||!r[t]||r[t].required)}(s,r)||(a[r]=t[e])}})),Object.keys(s.defaults).forEach((function(e){Object.prototype.hasOwnProperty.call(a,e)||(a[e]=s.defaults[e])})),function(e,t,r){if(!t)return;var n="function"==typeof t?t():t;if(!n)return;if(!i.isPlainMap(n))throw new o(200034,r+" request metadata must be a map");["trace","sent_ms"].forEach((function(t){if(void 0!==n[t]){if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==n[t])throw new o(200034,r+" has conflicting "+t+" values");e[t]=n[t]}}))}(a,r,s.uri),function(e,t){var r=Z[e.uri];if(!r)throw new o(200034,"missing request schema for "+e.uri);if(pe(e.uri+" request",t,r),"auth.login"===e.uri){var n=Object.prototype.hasOwnProperty.call(t,"auth_sec"),i=Object.prototype.hasOwnProperty.call(t,"auth_ver");if(n!==i)throw new o(200034,"auth.login requires auth_sec and auth_ver together");if(i&&"2"!==ce(t.auth_ver))throw new o(200034,"auth.login auth_ver must be 2")}}(s,a),{payload:a,uri:s.uri}},validateControlError:function(e){pe("control.error Answer",e,{reason:P(!0),status:w(!0)})},validatePush:function(e,t){var r=se[e];if(!r)throw new o(200034,"unsupported Push URI: "+e);pe(e+" Push",t,r)},validateResponse:function(e,t){var r=ne[e];if(!r)throw new o(200034,"unsupported Answer URI: "+e);r.allowEmpty&&i.isPlainMap(t)&&0===Object.keys(t).length||(pe(e+" Answer",t,r.fields),function(e,t){var r=void 0;if("conversation.direct"===e||"conversation.direct_unread"===e)r=["peers","badges","last_items"];else if("conversation.group"===e||"conversation.group_unread"===e)r=["group_refs","badges","last_items"];else if("conversation.unread"===e)return ge(e,t,["group_refs","group_badges","group_last"]),void ge(e,t,["peers","peer_badges","peer_last"]);r&&ge(e,t,r)}(e,t))}}},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=r(2),s=r(10),a=r(0),u=r(5),c=r(11).normalizeClientOptions,f=r(12),l=["sharing","uid","conversation","workerName","workerUrl","workerNamespace","readyTimeout","idleShutdownTimeout"],h=function(){function e(t){if(i(this,e),"undefined"==typeof SharedWorker)throw g("Browser SharedWorker support is required; use sharing: false for an independent connection","RTM_SHARED_WORKER_UNSUPPORTED");var r,n;this._config=Object.assign({},t),this._options=c(p(t)),this._config.conversation=f(t.conversation),this._delegate=null,this._uid=null,this._destroyed=!1,this._events=new d,this.processor=new d,this.promises=(r=this,(n=Object.assign({},u(r,o.prototype))).login=function(e,t,n){return arguments.length>3?Promise.reject(new TypeError("promises.login(uid, credential, timeout?)")):r.loginIfNeeded(e,t,n).then((function(e){if(e.accepted)return{accepted:!0,errorCode:e.errorCode||0};var t=new Error("RTM login rejected ("+String(e.errorCode)+")");throw t.code=e.errorCode,t.status=e.errorCode,t}))},Object.freeze(n)),void 0!==t.uid&&null!==t.uid&&this._attach(t.uid)}return n(e,[{key:"_attach",value:function(e){if(this._assertActive(),"number"==typeof e&&(!isFinite(e)||Math.floor(e)!==e||Math.abs(e)>9007199254740991))throw g("Use a decimal string for a UID outside the safe integer range","RTM_SHARED_UID_INVALID");var t=null==e?"":String(e).trim().replace(/^0+(?=\d)/,"");if(!/^\d+$/.test(t)||/^0+$/.test(t))throw g("Provide a positive UID in login() or createClient({ uid }) before attaching","RTM_SHARED_UID_REQUIRED");if(t.length>20||20===t.length&&t>"18446744073709551615")throw g("UID exceeds the uint64 range","RTM_SHARED_UID_INVALID");if(null!==this._uid&&this._uid!==t)throw g("This client is bound to UID "+this._uid+"; create another client for UID "+t,"RTM_SHARED_UID_MISMATCH");if(!this._delegate){var r=this._config,n=new s({workerName:r.workerName||s.createWorkerName({pid:this._options.pid,protocol:this._options.protocol,uid:t,namespace:r.workerNamespace}),workerUrl:r.workerUrl,conversation:r.conversation,readyTimeout:r.readyTimeout,idleShutdownTimeout:r.idleShutdownTimeout,clientOptions:this._options});this._uid=t,this._delegate=n,this._events.bind(n),this.processor.bind(n.processor)}return this._delegate}},{key:"_assertActive",value:function(){if(this._destroyed)throw g("RTM client has been destroyed","RTM_CLIENT_DESTROYED")}},{key:"login",value:function(e,t,r,n){var i=this;this.loginIfNeeded(e,t,n).then((function(e){"function"==typeof r&&r(e.accepted,e.errorCode)}),(function(e){var t="number"==typeof e.status?e.status:"number"==typeof e.code?e.code:a.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;try{"function"==typeof r&&r(!1,t)}finally{i._events.emit("SharedWorkerError",e)}}))}},{key:"loginIfNeeded",value:function(e,t,r){try{var n=this._attach(e),i=this._uid.length>19||19===this._uid.length&&this._uid>"9223372036854775807"?a.Uint64(this._uid):a.Int64(this._uid);return n.loginIfNeeded(i,t,r)}catch(e){return Promise.reject(e)}}},{key:"whenReady",value:function(e){try{return this._attach(void 0===e?this._uid:e).whenReady()}catch(e){return Promise.reject(e)}}},{key:"getSharedSession",value:function(){return this._delegate?this._delegate.getSharedSession():{status:"idle",uid:null}}},{key:"setConversation",value:function(e,t){return this._assertActive(),e=f(e),this._delegate?this._delegate.setConversation(e,t):(this._config.conversation=e,"function"==typeof t&&t(null)),this}},{key:"on",value:function(e,t){return this._events.on(e,t),this}},{key:"off",value:function(e,t){return this._events.off(e,t),this}},{key:"removeEvent",value:function(){return this._events.removeEvent.apply(this._events,arguments),this}},{key:"emit",value:function(){this._events.emit.apply(this._events,arguments)}},{key:"close",value:function(){this._assertActive(),this._delegate&&this._delegate.close()}},{key:"destroy",value:function(){if(!this._destroyed){this._destroyed=!0;try{this._delegate&&this._delegate.destroy()}finally{this._events.clear(),this.processor.clear()}}}},{key:"_invoke",value:function(e,t){try{if(this._assertActive(),!this._delegate)throw g("Call login() before "+e+"()","RTM_SHARED_UID_REQUIRED")}catch(e){var r=t.slice().reverse().find((function(e){return"function"==typeof e}));if(r)return void r(e,null);throw e}return this._delegate[e].apply(this._delegate,t)}}]),e}(),d=function(){function e(){i(this,e),this._listeners=Object.create(null),this._target=null}return n(e,[{key:"bind",value:function(e){var t=this;this._target=e,Object.keys(this._listeners).forEach((function(r){t._listeners[r].forEach((function(t){return e.on(r,t)}))}))}},{key:"on",value:function(e,t){if("function"!=typeof t)return this;var r=this._listeners[e]||(this._listeners[e]=[]);return-1===r.indexOf(t)&&(r.push(t),this._target&&this._target.on(e,t)),this}},{key:"off",value:function(e,t){var r=this,n=this._listeners[e]||[];return n.slice().forEach((function(i){void 0!==t&&i!==t||(r._target&&r._target.removeEvent(e,i),n.splice(n.indexOf(i),1))})),n.length||delete this._listeners[e],this}},{key:"removeEvent",value:function(e,t){var r=this;return arguments.length?this.off(e,t):(Object.keys(this._listeners).forEach((function(e){return r.off(e)})),this)}},{key:"emit",value:function(e){var t=Array.prototype.slice.call(arguments,1);(this._listeners[e]||[]).slice().forEach((function(e){return e.apply(null,t)}))}},{key:"clear",value:function(){this._target=null,this._listeners=Object.create(null)}}]),e}();function p(e){var t=Object.assign({},e);return l.forEach((function(e){delete t[e]})),t}function g(e,t){var r=new Error(e);return r.code=t,r}Object.getOwnPropertyNames(o.prototype).forEach((function(e){"constructor"===e||"_"===e.charAt(0)||Object.prototype.hasOwnProperty.call(h.prototype,e)||"function"==typeof Object.getOwnPropertyDescriptor(o.prototype,e).value&&(h.prototype[e]=function(){return this._invoke(e,Array.prototype.slice.call(arguments))})})),e.exports=function(e){var t=e||{};if(void 0!==t.sharing&&"boolean"!=typeof t.sharing)throw new TypeError("sharing must be a boolean");if(!1===t.sharing){var r=p(t);return void 0===r.protocol&&(r.protocol="tlv-v1"),new o(r)}return new h(t)}}])}));
27
+ */!function(){"use strict";function t(e){if(e)d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d,this.buffer8=l;else if(a){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var r="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1);var s=!e&&"object"==typeof self,h=!i.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;h?i=global:s&&(i=self);var f=!i.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,o=__webpack_require__(21),a=!i.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],y=[0,8,16,24],c=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),d=[],l;if(a){var A=new ArrayBuffer(68);l=new Uint8Array(A),d=new Uint32Array(A)}!i.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var b=function(e){return function(r){return new t(!0).update(r)[e]()}},v=function(){var e=b("hex");h&&(e=w(e)),e.create=function(){return new t},e.update=function(t){return e.create().update(t)};for(var r=0;r<c.length;++r){var n=c[r];e[n]=b(n)}return e},w=function(t){var e=eval("require('crypto')"),i=eval("require('buffer').Buffer"),s=function(n){if("string"==typeof n)return e.createHash("md5").update(n,"utf8").digest("hex");if(null==n)throw r;return n.constructor===ArrayBuffer&&(n=new Uint8Array(n)),Array.isArray(n)||ArrayBuffer.isView(n)||n.constructor===i?e.createHash("md5").update(new i(n)).digest("hex"):t(n)};return s};t.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw r;if(null===e)throw r;if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw r;t=!0}for(var i,o,s=0,u=e.length,c=this.blocks,f=this.buffer8;s<u;){if(this.hashed&&(this.hashed=!1,c[0]=c[16],c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),t)if(a)for(o=this.start;s<u&&o<64;++s)f[o++]=e[s];else for(o=this.start;s<u&&o<64;++s)c[o>>2]|=e[s]<<y[3&o++];else if(a)for(o=this.start;s<u&&o<64;++s)(i=e.charCodeAt(s))<128?f[o++]=i:i<2048?(f[o++]=192|i>>6,f[o++]=128|63&i):i<55296||i>=57344?(f[o++]=224|i>>12,f[o++]=128|i>>6&63,f[o++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++s)),f[o++]=240|i>>18,f[o++]=128|i>>12&63,f[o++]=128|i>>6&63,f[o++]=128|63&i);else for(o=this.start;s<u&&o<64;++s)(i=e.charCodeAt(s))<128?c[o>>2]|=i<<y[3&o++]:i<2048?(c[o>>2]|=(192|i>>6)<<y[3&o++],c[o>>2]|=(128|63&i)<<y[3&o++]):i<55296||i>=57344?(c[o>>2]|=(224|i>>12)<<y[3&o++],c[o>>2]|=(128|i>>6&63)<<y[3&o++],c[o>>2]|=(128|63&i)<<y[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++s)),c[o>>2]|=(240|i>>18)<<y[3&o++],c[o>>2]|=(128|i>>12&63)<<y[3&o++],c[o>>2]|=(128|i>>6&63)<<y[3&o++],c[o>>2]|=(128|63&i)<<y[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=u[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},t.prototype.hash=function(){var e,t,r,n,i,o,s=this.blocks;this.first?t=((t=((e=((e=s[0]-680876937)<<7|e>>>25)-271733879<<0)^(r=((r=(-271733879^(n=((n=(-1732584194^2004318071&e)+s[1]-117830708)<<12|n>>>20)+e<<0)&(-271733879^e))+s[2]-1126478375)<<17|r>>>15)+n<<0)&(n^e))+s[3]-1316259209)<<22|t>>>10)+r<<0:(e=this.h0,t=this.h1,r=this.h2,t=((t+=((e=((e+=((n=this.h3)^t&(r^n))+s[0]-680876936)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[1]-389564586)<<12|n>>>20)+e<<0)&(e^t))+s[2]+606105819)<<17|r>>>15)+n<<0)&(n^e))+s[3]-1044525330)<<22|t>>>10)+r<<0),t=((t+=((e=((e+=(n^t&(r^n))+s[4]-176418897)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[5]+1200080426)<<12|n>>>20)+e<<0)&(e^t))+s[6]-1473231341)<<17|r>>>15)+n<<0)&(n^e))+s[7]-45705983)<<22|t>>>10)+r<<0,t=((t+=((e=((e+=(n^t&(r^n))+s[8]+1770035416)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[9]-1958414417)<<12|n>>>20)+e<<0)&(e^t))+s[10]-42063)<<17|r>>>15)+n<<0)&(n^e))+s[11]-1990404162)<<22|t>>>10)+r<<0,t=((t+=((e=((e+=(n^t&(r^n))+s[12]+1804603682)<<7|e>>>25)+t<<0)^(r=((r+=(t^(n=((n+=(r^e&(t^r))+s[13]-40341101)<<12|n>>>20)+e<<0)&(e^t))+s[14]-1502002290)<<17|r>>>15)+n<<0)&(n^e))+s[15]+1236535329)<<22|t>>>10)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[1]-165796510)<<5|e>>>27)+t<<0)^t))+s[6]-1069501632)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[11]+643717713)<<14|r>>>18)+n<<0)^n))+s[0]-373897302)<<20|t>>>12)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[5]-701558691)<<5|e>>>27)+t<<0)^t))+s[10]+38016083)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[15]-660478335)<<14|r>>>18)+n<<0)^n))+s[4]-405537848)<<20|t>>>12)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[9]+568446438)<<5|e>>>27)+t<<0)^t))+s[14]-1019803690)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[3]-187363961)<<14|r>>>18)+n<<0)^n))+s[8]+1163531501)<<20|t>>>12)+r<<0,t=((t+=((n=((n+=(t^r&((e=((e+=(r^n&(t^r))+s[13]-1444681467)<<5|e>>>27)+t<<0)^t))+s[2]-51403784)<<9|n>>>23)+e<<0)^e&((r=((r+=(e^t&(n^e))+s[7]+1735328473)<<14|r>>>18)+n<<0)^n))+s[12]-1926607734)<<20|t>>>12)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[5]-378558)<<4|e>>>28)+t<<0))+s[8]-2022574463)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[11]+1839030562)<<16|r>>>16)+n<<0))+s[14]-35309556)<<23|t>>>9)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[1]-1530992060)<<4|e>>>28)+t<<0))+s[4]+1272893353)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[7]-155497632)<<16|r>>>16)+n<<0))+s[10]-1094730640)<<23|t>>>9)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[13]+681279174)<<4|e>>>28)+t<<0))+s[0]-358537222)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[3]-722521979)<<16|r>>>16)+n<<0))+s[6]+76029189)<<23|t>>>9)+r<<0,t=((t+=((o=(n=((n+=((i=t^r)^(e=((e+=(i^n)+s[9]-640364487)<<4|e>>>28)+t<<0))+s[12]-421815835)<<11|n>>>21)+e<<0)^e)^(r=((r+=(o^t)+s[15]+530742520)<<16|r>>>16)+n<<0))+s[2]-995338651)<<23|t>>>9)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[0]-198630844)<<6|e>>>26)+t<<0)|~r))+s[7]+1126891415)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[14]-1416354905)<<15|r>>>17)+n<<0)|~e))+s[5]-57434055)<<21|t>>>11)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[12]+1700485571)<<6|e>>>26)+t<<0)|~r))+s[3]-1894986606)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[10]-1051523)<<15|r>>>17)+n<<0)|~e))+s[1]-2054922799)<<21|t>>>11)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[8]+1873313359)<<6|e>>>26)+t<<0)|~r))+s[15]-30611744)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[6]-1560198380)<<15|r>>>17)+n<<0)|~e))+s[13]+1309151649)<<21|t>>>11)+r<<0,t=((t+=((n=((n+=(t^((e=((e+=(r^(t|~n))+s[4]-145523070)<<6|e>>>26)+t<<0)|~r))+s[11]-1120210379)<<10|n>>>22)+e<<0)^((r=((r+=(e^(n|~t))+s[2]+718787259)<<15|r>>>17)+n<<0)|~e))+s[9]-343485551)<<21|t>>>11)+r<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=r-1732584194<<0,this.h3=n+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0)},t.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,i=this.h3;return n[e>>4&15]+n[15&e]+n[e>>12&15]+n[e>>8&15]+n[e>>20&15]+n[e>>16&15]+n[e>>28&15]+n[e>>24&15]+n[t>>4&15]+n[15&t]+n[t>>12&15]+n[t>>8&15]+n[t>>20&15]+n[t>>16&15]+n[t>>28&15]+n[t>>24&15]+n[r>>4&15]+n[15&r]+n[r>>12&15]+n[r>>8&15]+n[r>>20&15]+n[r>>16&15]+n[r>>28&15]+n[r>>24&15]+n[i>>4&15]+n[15&i]+n[i>>12&15]+n[i>>8&15]+n[i>>20&15]+n[i>>16&15]+n[i>>28&15]+n[i>>24&15]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.base64=function(){for(var e,t,r,n="",i=this.array(),o=0;o<15;)e=i[o++],t=i[o++],r=i[o++],n+=p[e>>>2]+p[63&(e<<4|t>>>4)]+p[63&(t<<2|r>>>6)]+p[63&r];return e=i[o],n+(p[e>>>2]+p[e<<4&63]+"==")};var _=v();f?module.exports=_:(i.md5=_,o&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return _}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()}).call(this,__webpack_require__(20),__webpack_require__(3))},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],f=!1,l=-1;function h(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&d())}function d(){if(!f){var e=a(h);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l<t;)u&&u[l].run();l=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t,r){(function(e){!function(t){function r(e,r,g){function m(e,t,r,n){return this instanceof m?function(e,t,r,n,i){if(h&&d&&(t instanceof d&&(t=new h(t)),n instanceof d&&(n=new h(n))),t||r||n||c){if(!s(t,r))i=r,n=t,r=0,t=new(c||Array)(8);e.buffer=t,e.offset=r|=0,f!==typeof n&&("string"==typeof n?function(e,t,r,n){var i=0,o=r.length,s=0,a=0;"-"===r[0]&&i++;for(var u=i;i<o;){var c=parseInt(r[i++],n);if(!(c>=0))break;a=a*n+c,s=s*n+Math.floor(a/y),a%=y}u&&(s=~s,a?a=y-a:s++),b(e,t+E,s),b(e,t+k,a)}(t,r,n,i||10):s(n,i)?a(t,r,n,i):"number"==typeof i?(b(t,r+E,n),b(t,r+k,i)):n>0?T(t,r,n):n<0?A(t,r,n):a(t,r,p,0))}else e.buffer=u(p,0)}(this,e,t,r,n):new m(e,t,r,n)}function v(){var e=this.buffer,t=this.offset,r=w(e,t+E),n=w(e,t+k);return g||(r|=0),r?r*y+n:n}function b(e,t,r){e[t+O]=255&r,r>>=8,e[t+C]=255&r,r>>=8,e[t+P]=255&r,r>>=8,e[t+R]=255&r}function w(e,t){return e[t+R]*_+(e[t+P]<<16)+(e[t+C]<<8)+e[t+O]}var E=r?0:4,k=r?4:0,R=r?0:3,P=r?1:2,C=r?2:1,O=r?3:0,T=r?function(e,t,r){for(var n=t+8;n>t;)e[--n]=255&r,r/=256}:function(e,t,r){for(var n=t+8;t<n;)e[t++]=255&r,r/=256},A=r?function(e,t,r){var n=t+8;for(r++;n>t;)e[--n]=255&-r^255,r/=256}:function(e,t,r){var n=t+8;for(r++;t<n;)e[t++]=255&-r^255,r/=256},S=m.prototype,M="is"+e,I="_"+M;return S.buffer=void 0,S.offset=0,S[I]=!0,S.toNumber=v,S.toString=function(e){var t=this.buffer,r=this.offset,n=w(t,r+E),i=w(t,r+k),o="",s=!g&&2147483648&n;for(s&&(n=~n,i=y-i),e=e||10;;){var a=n%e*y+i;if(n=Math.floor(n/e),i=Math.floor(a/e),o=(a%e).toString(e)+o,!n&&!i)break}return s&&(o="-"+o),o},S.toJSON=v,S.toArray=n,l&&(S.toBuffer=i),h&&(S.toArrayBuffer=o),m[M]=function(e){return!(!e||!e[I])},t[e]=m,m}function n(e){var t=this.buffer,r=this.offset;return c=null,!1!==e&&0===r&&8===t.length&&g(t)?t:u(t,r)}function i(t){var r=this.buffer,n=this.offset;if(c=l,!1!==t&&0===n&&8===r.length&&e.isBuffer(r))return r;var i=new l(8);return a(i,0,r,n),i}function o(e){var t=this.buffer,r=this.offset,n=t.buffer;if(c=h,!1!==e&&0===r&&n instanceof d&&8===n.byteLength)return n;var i=new h(8);return a(i,0,t,r),i.buffer}function s(e,t){var r=e&&e.length;return t|=0,r&&t+8<=r&&"string"!=typeof e[t]}function a(e,t,r,n){t|=0,n|=0;for(var i=0;i<8;i++)e[t++]=255&r[n++]}function u(e,t){return Array.prototype.slice.call(e,t,t+8)}var c,f="undefined",l=f!==typeof e&&e,h=f!==typeof Uint8Array&&Uint8Array,d=f!==typeof ArrayBuffer&&ArrayBuffer,p=[0,0,0,0,0,0,0,0],g=Array.isArray||function(e){return!!e&&"[object Array]"==Object.prototype.toString.call(e)},y=4294967296,_=16777216;r("Uint64BE",!0,!0),r("Int64BE",!0,!1),r("Uint64LE",!1,!0),r("Int64LE",!1,!1)}("string"!=typeof t.nodeName?t:this||{})}).call(this,r(6).Buffer)},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=r(4),o=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,r));return n.name="TLVContractError",n.status=e,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),t}();function s(e,t,r,n){var i=n||{};return{defaults:i.defaults||{},pass:i.pass||[],request:t||{},required:i.required||[],response:r||{},uri:e}}var a={cursor:0,end_ms:0,limit:20,reverse:!1,start_ms:0},u={end_ms:0,limit:20,reverse:!1,start_ms:0},c={end_ms:0,start_ms:0},f={begin:"start_ms",desc:"reverse",end:"end_ms",lastid:"cursor",mtypes:"kinds",num:"limit"},l={begin:"start_ms",desc:"reverse",end:"end_ms",mid:"anchor",mtypes:"kinds",num:"limit"},h={begin:"start_ms",end:"end_ms",mtypes:"kinds"},d={begin:"first_ms",end:"last_ms",lastid:"next",msgs:"items",num:"size"},p={auth:s("auth.login",{attrs:"props",authv:"auth_ver",lang:"locale",pid:"project",token:"credential",ts:"auth_sec",uid:"user",version:"client_ver"},{ok:"accepted"},{required:["project","user","credential","client_ver"]}),bye:s("connection.close"),getservertime:s("system.time",null,{mts:"server_ms"}),addattrs:s("connection.set_props",{attrs:"props"},null,{required:["props"]}),getattrs:s("connection.get_props",null,{attrs:"props"}),adddebuglog:s("system.debug",{attrs:"context",msg:"entry"},null,{required:["entry","context"]}),getonlineusers:s("presence.online",{uids:"users"},{uids:"online_users"},{required:["users"]}),setuserinfo:s("user.set_profile",{oinfo:"public_data",pinfo:"private_data"}),getuserinfo:s("user.get_profile",null,{oinfo:"public_data",pinfo:"private_data"}),getuseropeninfo:s("user.get_public",{uids:"users"},{info:"profiles"},{required:["users"]}),setlang:s("user.set_locale",{lang:"locale"},{ok:"updated"},{required:["locale"]}),dataget:s("storage.get",{key:"slot"},{val:"value"},{required:["slot"]}),dataset:s("storage.set",{key:"slot",val:"value"},null,{required:["slot","value"]}),datadel:s("storage.delete",{key:"slot"},null,{required:["slot"]}),addblacks:s("blacklist.add",{blacks:"blocked_users"},null,{required:["blocked_users"]}),delblacks:s("blacklist.remove",{blacks:"blocked_users"},null,{required:["blocked_users"]}),getblacks:s("blacklist.list",null,{uids:"blocked_users"}),addgroupmembers:s("group.add",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),delgroupmembers:s("group.remove",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),getgroupmembers:s("group.members",{gid:"group_ref",online:"with_online"},{onlines:"active_members",uids:"members"},{required:["group_ref"]}),getgroupcount:s("group.count",{gid:"group_ref",online:"with_online"},{cn:"total",online:"active_total"},{required:["group_ref"]}),getusergroups:s("group.joined",null,{gids:"group_refs"}),setgroupinfo:s("group.set_profile",{gid:"group_ref",oinfo:"public_data",pinfo:"private_data"},null,{required:["group_ref"]}),getgroupinfo:s("group.get_profile",{gid:"group_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["group_ref"]}),getgroupopeninfo:s("group.get_public",{gid:"group_ref"},{oinfo:"public_data"},{required:["group_ref"]}),getgroupsopeninfo:s("group.get_public_batch",{gids:"group_refs"},{info:"profiles"},{required:["group_refs"]}),enterroom:s("room.join",{rid:"room_ref"},null,{required:["room_ref"]}),leaveroom:s("room.leave",{rid:"room_ref"},null,{required:["room_ref"]}),enterrooms:s("room.join_batch",{rids:"room_refs"},null,{required:["room_refs"]}),getuserrooms:s("room.joined",null,{rooms:"room_refs"}),getroommembers:s("room.members",{rid:"room_ref"},{uids:"members"},{required:["room_ref"]}),getroomcount:s("room.counts",{rids:"room_refs"},{cn:"totals"},{required:["room_refs"]}),setroominfo:s("room.set_profile",{icon:"avatar",name:"label",oinfo:"public_data",pinfo:"private_data",rid:"room_ref"},null,{required:["room_ref"]}),getroominfo:s("room.get_profile",{rid:"room_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["room_ref"]}),getroomopeninfo:s("room.get_public",{rid:"room_ref"},{oinfo:"public_data"},{required:["room_ref"]}),getroomsopeninfo:s("room.get_public_batch",{rids:"room_refs"},{info:"profiles"},{required:["room_refs"]}),getuserroomsandlastmsg:s("room.last_messages",{mtypes:"kinds"},{rooms:"last_by_room"}),sendmsg:s("message.send",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",to:"recipient"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["recipient","message_ref","kind","payload","extra"]}),sendmsgs:s("message.send_batch",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",tos:"recipients"},{mid:"message_ref",mtime:"time_ms"},{required:["recipients","message_ref","kind","payload","extra"]}),sendgroupmsg:s("message.send_group",{attrs:"extra",gid:"group_ref",mid:"message_ref",msg:"payload",mtype:"kind"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["group_ref","message_ref","kind","payload","extra"]}),sendroommsg:s("message.send_room",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",rid:"room_ref"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["room_ref","message_ref","kind","payload","extra"]}),tcheck:s("moderation.check",{region:"zone",text:"payload"},{language:"detected_locale",result:"decision",text:"filtered",wlist:"matches"},{pass:["checkParams","strategyId"],required:["payload"]}),translate:s("translation.run",{dst:"to_locale",profanity:"filter_mode",src:"from_locale",text:"input",type:"format"},{dtext:"output",dst:"to_locale",source:"detected_locale",sourceText:"original",src:"from_locale",stext:"input",target:"resolved_locale",targetText:"translated"},{defaults:{filter_mode:"off",format:"chat"},required:["input","to_locale","format","filter_mode"]}),getp2pmsg:s("history.direct",Object.assign({ouid:"peer"},f),d,{defaults:a,required:["peer","reverse","limit","start_ms","end_ms","cursor"]}),getgroupmsg:s("history.group",Object.assign({gid:"group_ref"},f),d,{defaults:a,required:["group_ref","reverse","limit","start_ms","end_ms","cursor"]}),getroommsg:s("history.room",Object.assign({rid:"room_ref"},f),d,{defaults:a,required:["room_ref","reverse","limit","start_ms","end_ms","cursor"]}),getbroadcastmsg:s("history.broadcast",f,d,{defaults:a,required:["reverse","limit","start_ms","end_ms","cursor"]}),getp2pmsgbymessageid:s("history.direct_anchor",Object.assign({ouid:"peer"},l),d,{defaults:u,required:["peer","anchor","reverse","limit","start_ms","end_ms"]}),getgroupmsgbymessageid:s("history.group_anchor",Object.assign({gid:"group_ref"},l),d,{defaults:u,required:["group_ref","anchor","reverse","limit","start_ms","end_ms"]}),getroommsgbymessageid:s("history.room_anchor",Object.assign({rid:"room_ref"},l),d,{defaults:u,required:["room_ref","anchor","reverse","limit","start_ms","end_ms"]}),getbroadcastmsgbymessageid:s("history.broadcast_anchor",l,d,{defaults:u,required:["anchor","reverse","limit","start_ms","end_ms"]}),getp2pmsgcount:s("history.direct_count",Object.assign({ouid:"peer"},h),{count:"total"},{defaults:c,required:["peer","start_ms","end_ms"]}),getgroupmsgcount:s("history.group_count",Object.assign({gid:"group_ref"},h),{count:"total"},{defaults:c,required:["group_ref","start_ms","end_ms"]}),getroommsgcount:s("history.room_count",Object.assign({rid:"room_ref"},h),{count:"total"},{defaults:c,required:["room_ref","start_ms","end_ms"]}),getbroadcastmsgcount:s("history.broadcast_count",h,{count:"total"},{defaults:c,required:["start_ms","end_ms"]}),getmsg:s("message.get",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},{attrs:"extra",from:"sender",id:"sequence",mid:"message_ref",msg:"payload",mtime:"time_ms",mtype:"kind"},{required:["sender","message_ref","target_ref","channel"]}),delmsg:s("message.revoke",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},null,{required:["sender","message_ref","target_ref","channel"]}),getunread:s("unread.summary",{clear:"mark_read",gettime:"with_logout"},{group:"group_refs",logouttime:"logout_sec",p2p:"peers"},{defaults:{mark_read:!1},required:["mark_read"]}),getsession:s("session.list",null,{group:"group_refs",p2p:"peers"}),cleanunread:s("unread.clear"),setsessionread:s("session.read",{category:"channel",read_seq:"through",xid:"target_ref"},null,{required:["channel","target_ref","through"]}),getp2punread:s("unread.direct",{mtime:"since_ms",mtypes:"kinds",uids:"peers"},{ltime:"times",p2p:"counts"},{required:["peers"]}),getgroupunread:s("unread.group",{gids:"group_refs",mtime:"since_ms",mtypes:"kinds"},{group:"counts",ltime:"times"},{required:["group_refs"]}),removesession:s("session.remove",{oneway:"local_only",to:"peer"},null,{defaults:{local_only:!1},required:["peer","local_only"]}),getp2pconversationlist:s("conversation.direct",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getp2punreadconversationlist:s("conversation.direct_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getgroupconversationlist:s("conversation.group",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getgroupunreadconversationlist:s("conversation.group_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getunreadconversationlist:s("conversation.unread",{clear:"mark_read",mtime:"since_ms",mtypes:"kinds"},{groupConversations:"group_refs",groupMsgs:"group_last",groupUnreads:"group_badges",p2pConversations:"peers",p2pMsgs:"peer_last",p2pUnreads:"peer_badges"},{defaults:{mark_read:!1},required:["mark_read"]})},g=new Set(["acheck","adddevice","addfriends","addoption","addprojectban","adminCommand","broadcastfile","closeRTCRoom","delfriends","filetoken","getfriends","getoption","getRTCRoomList","getRTCRoomMemberCount","getRTCRoomMembers","icheck","inviteUserIntoRTCRoom","isfriend","isfriends","isprojectban","kickoutFromRTCRoom","profanity","pullIntoRTCRoom","removedevice","removeoption","removeprojectban","sendfile","sendfiles","sendgroupfile","sendroomfile","setRTCRoomMicStatus","speech2text","speechtranslation","uploadfile","vcheck"]),y={"event.broadcast":!0,"event.direct":!0,"event.group":!0,"event.room":!0},_={"event.kicked":!0,"event.room_removed":!0},m="9223372036854775807";function v(e,t,r){return Object.assign({required:!!t,type:e},r||{})}function b(e,t){return v("integer",e,Object.assign({min:"-9223372036854775808",max:m},t||{}))}function w(e,t){return v("integer",e,Object.assign({min:"-2147483648",max:"2147483647"},t||{}))}function E(e,t){return b(e,Object.assign({min:"1"},t||{}))}function k(e,t){return b(e,Object.assign({min:"0"},t||{}))}function R(e,t){return w(e,Object.assign({min:"0"},t||{}))}function P(e,t){return v("string",e,t)}function C(e){return v("boolean",e)}function O(e,t,r){return v("array",e,Object.assign({element:t},r||{}))}function T(e,t,r,n){return v("map",e,Object.assign({key:t,value:r},n||{}))}function A(e){return Object.assign({sent_ms:b(!1),trace:P(!1)},e||{})}function S(e,t){return{allowEmpty:!(!t||!t.allowEmpty),fields:e||{}}}var M=b(!1),I=w(!1),U=R(!1),N=b(!1),B=k(!1),x=E(!1),D=P(!1),F=v("string_or_bin",!1),L=v("tuple8",!1);function j(e,t){return O(e,x,t)}function q(e,t){return O(e,M,t)}function Y(e,t){return O(e,I,t)}function V(e){return T(e,"string",D)}function H(e){return T(e,"positive_decimal_int64",D)}function W(e){return T(e,"positive_decimal_int64",U)}function G(e){return T(e,"positive_decimal_int64",B)}function z(e){return b(e,{max:"255",min:"0"})}var K,J={extra:P(!0,{maxBytes:65535}),kind:(K=!0,b(K,{messageKind:!0})),message_ref:k(!0),payload:v("string_or_bin",!0,{maxBytes:65535})},Q={cursor:b(!0),end_ms:k(!0),kinds:q(!1),limit:R(!0),reverse:C(!0),start_ms:k(!0)},X={anchor:E(!0),end_ms:k(!0),kinds:q(!1),limit:R(!0),reverse:C(!0),start_ms:k(!0)},$={end_ms:k(!0),kinds:q(!1),start_ms:k(!0)},Z={"auth.login":A({auth_sec:k(!1),auth_ver:w(!1,{enum:["2"]}),client_ver:P(!0,{nonEmpty:!0}),credential:P(!0,{nonEmpty:!0}),locale:P(!1),project:b(!0,{max:"4294967295",min:"1"}),props:V(!1),user:E(!0)}),"connection.close":A(),"system.time":A(),"connection.set_props":A({props:V(!0)}),"connection.get_props":A(),"system.debug":A({context:P(!0),entry:P(!0,{nonEmpty:!0})}),"presence.online":A({users:j(!0,{minItems:1})}),"user.set_profile":A({private_data:P(!1),public_data:P(!1)}),"user.get_profile":A(),"user.get_public":A({users:j(!0,{minItems:1})}),"user.set_locale":A({locale:P(!0)}),"storage.get":A({slot:P(!0)}),"storage.set":A({slot:P(!0),value:P(!0)}),"storage.delete":A({slot:P(!0)}),"blacklist.add":A({blocked_users:j(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.remove":A({blocked_users:j(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.list":A(),"group.add":A({group_ref:E(!0),members:j(!0,{minItems:1})}),"group.remove":A({group_ref:E(!0),members:j(!0,{minItems:1})}),"group.members":A({group_ref:E(!0),with_online:C(!1)}),"group.count":A({group_ref:E(!0),with_online:C(!1)}),"group.joined":A(),"group.set_profile":A({group_ref:E(!0),private_data:P(!1),public_data:P(!1)}),"group.get_profile":A({group_ref:E(!0)}),"group.get_public":A({group_ref:E(!0)}),"group.get_public_batch":A({group_refs:j(!0,{minItems:1})}),"room.join":A({room_ref:E(!0)}),"room.leave":A({room_ref:E(!0)}),"room.join_batch":A({room_refs:j(!0,{maxItems:100,minItems:1})}),"room.joined":A(),"room.members":A({room_ref:E(!0)}),"room.counts":A({room_refs:j(!0,{minItems:1})}),"room.set_profile":A({avatar:P(!1),label:P(!1),private_data:P(!1),public_data:P(!1),room_ref:E(!0)}),"room.get_profile":A({room_ref:E(!0)}),"room.get_public":A({room_ref:E(!0)}),"room.get_public_batch":A({room_refs:j(!0,{minItems:1})}),"room.last_messages":A({kinds:q(!1)}),"message.send":A(Object.assign({recipient:E(!0)},J,{checkParams:P(!1),strategyid:P(!1)})),"message.send_batch":A(Object.assign({recipients:j(!0,{maxItems:100,minItems:1})},J)),"message.send_group":A(Object.assign({group_ref:E(!0)},J,{checkParams:P(!1),strategyid:P(!1)})),"message.send_room":A(Object.assign({room_ref:E(!0)},J,{checkParams:P(!1),strategyid:P(!1)})),"moderation.check":A({checkParams:P(!1),payload:P(!0,{nonEmpty:!0}),strategyId:P(!1),zone:P(!1)}),"translation.run":A({filter_mode:P(!0,{enum:["off","stop","censor"]}),format:P(!0,{nonEmpty:!0}),from_locale:P(!1),input:P(!0,{nonEmpty:!0}),to_locale:P(!0)}),"history.direct":A(Object.assign({peer:E(!0)},Q)),"history.group":A(Object.assign({group_ref:E(!0)},Q)),"history.room":A(Object.assign({room_ref:E(!0)},Q)),"history.broadcast":A(Q),"history.direct_anchor":A(Object.assign({peer:E(!0)},X)),"history.group_anchor":A(Object.assign({group_ref:E(!0)},X)),"history.room_anchor":A(Object.assign({room_ref:E(!0)},X)),"history.broadcast_anchor":A(X),"history.direct_count":A(Object.assign({peer:E(!0)},$)),"history.group_count":A(Object.assign({group_ref:E(!0)},$)),"history.room_count":A(Object.assign({room_ref:E(!0)},$)),"history.broadcast_count":A($),"message.get":A({channel:w(!0,{enum:["1","2","3","4"]}),message_ref:b(!0),sender:E(!0),target_ref:k(!0)}),"message.revoke":A({channel:w(!0,{enum:["1","2","3","4"]}),message_ref:b(!0),sender:E(!0),target_ref:k(!0)}),"unread.summary":A({mark_read:C(!0),with_logout:C(!1)}),"session.list":A(),"unread.clear":A(),"session.read":A({channel:w(!0,{enum:["1","2","3","4","5"]}),target_ref:k(!0),through:E(!0)}),"unread.direct":A({kinds:q(!1),peers:j(!0,{minItems:1}),since_ms:k(!1)}),"unread.group":A({group_refs:j(!0,{minItems:1}),kinds:q(!1),since_ms:k(!1)}),"session.remove":A({local_only:C(!0),peer:E(!0)}),"conversation.direct":A({kinds:q(!1),since_ms:k(!1)}),"conversation.direct_unread":A({kinds:q(!1),since_ms:k(!1)}),"conversation.group":A({kinds:q(!1),since_ms:k(!1)}),"conversation.group_unread":A({kinds:q(!1),since_ms:k(!1)}),"conversation.unread":A({kinds:q(!1),mark_read:C(!0),since_ms:k(!1)})},ee={first_ms:k(!0),items:O(!0,L),last_ms:k(!0),next:b(!0),size:R(!0)},te={message_ref:b(!0),time_ms:b(!0)},re={extra:P(!0),kind:z(!0),message_ref:b(!0),payload:v("string_or_bin",!0),sender:E(!0),sequence:b(!0),time_ms:b(!0)},ne={"auth.login":S({accepted:C(!0),telemetry_on:C(!1)}),"connection.close":S(),"system.time":S({server_ms:b(!0)}),"connection.set_props":S(),"connection.get_props":S({props:V(!0)}),"system.debug":S(),"presence.online":S({online_users:j(!0)}),"user.set_profile":S(),"user.get_profile":S({private_data:P(!0),public_data:P(!0)}),"user.get_public":S({profiles:H(!0)}),"user.set_locale":S({updated:C(!0)}),"storage.get":S({value:P(!0)}),"storage.set":S(),"storage.delete":S(),"blacklist.add":S(),"blacklist.remove":S(),"blacklist.list":S({blocked_users:j(!0)}),"group.add":S(),"group.remove":S(),"group.members":S({active_members:j(!1),members:j(!0)}),"group.count":S({active_total:R(!1),total:R(!0)}),"group.joined":S({group_refs:j(!0)}),"group.set_profile":S(),"group.get_profile":S({private_data:P(!0),public_data:P(!0)}),"group.get_public":S({public_data:P(!0)}),"group.get_public_batch":S({profiles:H(!0)}),"room.join":S(),"room.leave":S(),"room.join_batch":S(),"room.joined":S({room_refs:j(!0)}),"room.members":S({members:j(!0)}),"room.counts":S({totals:W(!0)}),"room.set_profile":S(),"room.get_profile":S({private_data:P(!0),public_data:P(!0)}),"room.get_public":S({public_data:P(!0)}),"room.get_public_batch":S({profiles:H(!0)}),"room.last_messages":S({last_by_room:function(e){return T(e,"positive_decimal_int64",L)}(!0)}),"message.send":S(te),"message.send_batch":S(te),"message.send_group":S(te),"message.send_room":S(te),"moderation.check":S({decision:w(!0),detected_locale:P(!0),filtered:P(!0),matches:function(e,t){return O(e,D,t)}(!1)}),"translation.run":S({detected_locale:P(!0),from_locale:P(!0),input:P(!0),original:P(!0),output:P(!0),resolved_locale:P(!0),to_locale:P(!0),translated:P(!0)}),"history.direct":S(ee),"history.group":S(ee),"history.room":S(ee),"history.broadcast":S(ee),"history.direct_anchor":S(ee),"history.group_anchor":S(ee),"history.room_anchor":S(ee),"history.broadcast_anchor":S(ee),"history.direct_count":S({total:R(!0)}),"history.group_count":S({total:R(!0)}),"history.room_count":S({total:R(!0)}),"history.broadcast_count":S({total:R(!0)}),"message.get":S(re,{allowEmpty:!0}),"message.revoke":S(),"unread.summary":S({group_refs:j(!0),logout_sec:k(!1),peers:j(!0)}),"session.list":S({group_refs:j(!0),peers:j(!0)}),"unread.clear":S(),"session.read":S(),"unread.direct":S({counts:W(!0),times:G(!0)}),"unread.group":S({counts:W(!0),times:G(!0)}),"session.remove":S(),"conversation.direct":S({badges:Y(!0),last_items:O(!0,L),peers:j(!0)}),"conversation.direct_unread":S({badges:Y(!0),last_items:O(!0,L),peers:j(!0)}),"conversation.group":S({badges:Y(!0),group_refs:j(!0),last_items:O(!0,L)}),"conversation.group_unread":S({badges:Y(!0),group_refs:j(!0),last_items:O(!0,L)}),"conversation.unread":S({group_badges:Y(!0),group_last:O(!0,L),group_refs:j(!0),peer_badges:Y(!0),peer_last:O(!0,L),peers:j(!0)}),"control.ping":S({ts:b(!1)})},ie={from_locale:P(!0),original:P(!0),to_locale:P(!0),translated:P(!0)},oe={extra:P(!0,{maxBytes:65535}),kind:z(!0),message_ref:b(!0),payload:v("push_payload",!0),sender:E(!0),time_ms:b(!0)},se={"event.direct":Object.assign({recipient:E(!0)},oe),"event.group":Object.assign({group_ref:E(!0)},oe),"event.room":Object.assign({room_ref:E(!0)},oe),"event.broadcast":oe,"event.kicked":{},"event.room_removed":{room_ref:E(!0)}};function ae(e){return p[e]||null}function ue(e){var t=String(e);if(!/^-?[0-9]+$/.test(t))return null;var r="-"===t.charAt(0),n=(r?t.slice(1):t).replace(/^0+/,"")||"0";return r&&"0"!==n?"-"+n:n}function ce(e){return"number"==typeof e?function(e){if(Number.isSafeInteger)return Number.isSafeInteger(e);return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991}(e)?ue(e):null:"bigint"==typeof e||e instanceof i.Int64Value||e&&"object"===(void 0===e?"undefined":n(e))&&"number"==typeof e.offset&&e.buffer&&"function"==typeof e.toString?ue(e.toString()):null}function fe(e,t){var r=ue(e),n=ue(t);if(null===r||null===n)throw new Error("integer comparison requires decimal integers");if(r===n)return 0;var i="-"===r.charAt(0),o="-"===n.charAt(0);if(i!==o)return i?-1:1;var s=i?r.slice(1):r,a=o?n.slice(1):n,u=void 0;return u=s.length!==a.length?s.length<a.length?-1:1:s<a?-1:1,i?-u:u}function le(e){for(var t=0,r=0;r<e.length;r+=1){var n=e.charCodeAt(r);if(n>=55296&&n<=56319){var i=e.charCodeAt(r+1);if(i<56320||i>57343)throw new o(200034,"string contains an unpaired surrogate");t+=4,r+=1}else{if(n>=56320&&n<=57343)throw new o(200034,"string contains an unpaired surrogate");t+=n<=127?1:n<=2047?2:3}}return t}function he(e,t){throw new o(200034,e+" "+t)}function de(e,t,r){if(null==e&&he(r,"must not be nil"),"integer"!==t.type)if("boolean"!==t.type){if("string"===t.type)return"string"!=typeof e&&he(r,"must be a UTF-8 string"),t.nonEmpty&&0===e.length&&he(r,"must not be empty"),t.enum&&-1===t.enum.indexOf(e)&&he(r,"is not an allowed value"),void(void 0!==t.maxBytes&&le(e)>t.maxBytes&&he(r,"exceeds "+t.maxBytes+" UTF-8 bytes"));if("string_or_bin"===t.type){if("string"==typeof e)return void(void 0!==t.maxBytes&&le(e)>t.maxBytes&&he(r,"exceeds "+t.maxBytes+" UTF-8 bytes"));var n=i.getByteView(e);return n||he(r,"must be a string or MsgPack bin value"),void(void 0!==t.maxBytes&&n.byteLength>t.maxBytes&&he(r,"exceeds "+t.maxBytes+" bytes"))}if("array"!==t.type){if("map"===t.type)return i.isPlainMap(e)||he(r,"must be a map"),void Object.keys(e).forEach((function(n){!function(e,t,r){if("string"!==t)if("positive_decimal_int64"!==t)he(r,"uses an unsupported map-key contract");else{var n=ue(e);(null===n||"-"===n.charAt(0)||"0"===n||fe(n,m)>0)&&he(r,"must be a positive decimal int64 map key")}}(n,t.key,r+"."+n),de(e[n],t.value,r+"."+n)}));if("tuple8"!==t.type)if("push_payload"!==t.type)he(r,"uses an unsupported value contract");else{if("string"==typeof e||i.getByteView(e))return;pe("Chat payload",e,ie)}else!function(e,t){Array.isArray(e)&&8===e.length||he(t,"must be an 8-item message tuple"),de(e[0],N,t+"[0]"),de(e[1],N,t+"[1]"),de(e[2],M,t+"[2]"),de(e[3],N,t+"[3]"),de(e[4],v("boolean",!1),t+"[4]"),de(e[5],F,t+"[5]"),de(e[6],D,t+"[6]"),de(e[7],N,t+"[7]")}(e,r)}else if(Array.isArray(e)||he(r,"must be an array"),void 0!==t.minItems&&e.length<t.minItems&&he(r,"must not be empty"),void 0!==t.maxItems&&e.length>t.maxItems&&he(r,"contains too many items"),e.forEach((function(e,n){de(e,t.element,r+"["+n+"]")})),void 0!==t.uniqueInt64Max){var o={};e.forEach((function(e){o[ce(e)]=!0})),Object.keys(o).length>t.uniqueInt64Max&&he(r,"contains too many distinct int64 items")}}else"boolean"!=typeof e&&he(r,"must be boolean");else!function(e,t,r){var n=ce(e);(null===n||fe(n,"-9223372036854775808")<0||fe(n,m)>0)&&he(r,"must be a signed int64 integer"),void 0!==t.min&&fe(n,t.min)<0&&he(r,"is below the allowed range"),void 0!==t.max&&fe(n,t.max)>0&&he(r,"is above the allowed range"),t.enum&&-1===t.enum.indexOf(n)&&he(r,"is not an allowed value"),t.messageKind&&!(fe(n,"1")>=0&&fe(n,"39")<=0||fe(n,"51")>=0&&fe(n,"127")<=0)&&he(r,"must be in kind ranges [1,39] or [51,127]")}(e,t,r)}function pe(e,t,r){i.isPlainMap(t)||he(e,"body must be a map"),Object.keys(t).forEach((function(t){Object.prototype.hasOwnProperty.call(r,t)||he(e+"."+t,"is not defined by this contract")})),Object.keys(r).forEach((function(n){var i=r[n];Object.prototype.hasOwnProperty.call(t,n)?de(t[n],i,e+"."+n):i.required&&he(e+"."+n,"is required")}))}function ge(e,t,r){for(var n=t[r[0]].length,i=1;i<r.length;i+=1)t[r[i]].length!==n&&he(e+" Answer",r.join(", ")+" must have matching lengths")}function ye(e){return g.has(e)||"string"==typeof e&&0===e.indexOf("imclient_")}e.exports={RELIABLE_PUSHES:y,REQUEST_SCHEMAS:Z,RESPONSE_SCHEMAS:ne,RESERVED_WIRES:g,ROUTES:p,TLVContractError:o,getRoute:ae,getRouteByUri:function(e){for(var t=Object.keys(p),r=0;r<t.length;r+=1){var n=p[t[r]];if(n.uri===e)return{method:t[r],route:n}}return null},isOneWayPush:function(e){return Object.prototype.hasOwnProperty.call(_,e)},isReliablePush:function(e){return Object.prototype.hasOwnProperty.call(y,e)},isReservedWire:ye,toWireRequest:function(e,t,r,n){var s=ae(e);if(!s){if(ye(e))throw new o(200020,e+" is reserved and unavailable on the TLV Client port");throw new o(20004,"unknown or unsupported TLV Client wire: "+e)}if(!i.isPlainMap(t))throw new o(200034,e+" request body must be a map");var a={};return Object.keys(t).forEach((function(e){var r=void 0;if("trace_id"!==e&&"send_ts"!==e){if("trace"===e||"sent_ms"===e)r=e;else if(Object.prototype.hasOwnProperty.call(s.request,e))r=s.request[e];else{if(-1===s.pass.indexOf(e))throw new o(200034,s.uri+" does not accept field "+e);r=e}if(Object.prototype.hasOwnProperty.call(a,r))throw new o(200034,s.uri+" received duplicate field mapping for "+r);n&&n.omitLegacyNil&&(void 0===t[e]||null===t[e])&&function(e,t){if("trace"===t||"sent_ms"===t)return!0;if(Object.prototype.hasOwnProperty.call(e.defaults,t))return!0;var r=Z[e.uri];return!(!r||!r[t]||r[t].required)}(s,r)||(a[r]=t[e])}})),Object.keys(s.defaults).forEach((function(e){Object.prototype.hasOwnProperty.call(a,e)||(a[e]=s.defaults[e])})),function(e,t,r){if(!t)return;var n="function"==typeof t?t():t;if(!n)return;if(!i.isPlainMap(n))throw new o(200034,r+" request metadata must be a map");["trace","sent_ms"].forEach((function(t){if(void 0!==n[t]){if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==n[t])throw new o(200034,r+" has conflicting "+t+" values");e[t]=n[t]}}))}(a,r,s.uri),function(e,t){var r=Z[e.uri];if(!r)throw new o(200034,"missing request schema for "+e.uri);if(pe(e.uri+" request",t,r),"auth.login"===e.uri){var n=Object.prototype.hasOwnProperty.call(t,"auth_sec"),i=Object.prototype.hasOwnProperty.call(t,"auth_ver");if(n!==i)throw new o(200034,"auth.login requires auth_sec and auth_ver together");if(i&&"2"!==ce(t.auth_ver))throw new o(200034,"auth.login auth_ver must be 2")}}(s,a),{payload:a,uri:s.uri}},validateControlError:function(e){pe("control.error Answer",e,{reason:P(!0),status:w(!0)})},validatePush:function(e,t){var r=se[e];if(!r)throw new o(200034,"unsupported Push URI: "+e);pe(e+" Push",t,r)},validateResponse:function(e,t){var r=ne[e];if(!r)throw new o(200034,"unsupported Answer URI: "+e);r.allowEmpty&&i.isPlainMap(t)&&0===Object.keys(t).length||(pe(e+" Answer",t,r.fields),function(e,t){var r=void 0;if("conversation.direct"===e||"conversation.direct_unread"===e)r=["peers","badges","last_items"];else if("conversation.group"===e||"conversation.group_unread"===e)r=["group_refs","badges","last_items"];else if("conversation.unread"===e)return ge(e,t,["group_refs","group_badges","group_last"]),void ge(e,t,["peers","peer_badges","peer_last"]);r&&ge(e,t,r)}(e,t))}}},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=r(2),s=r(10),a=r(0),u=r(5),c=r(11),f=c.normalizeClientOptions,l=c.sharedEndpoint,h=r(12),d=["sharing","uid","conversation","workerName","workerUrl","workerNamespace","readyTimeout","idleShutdownTimeout"],p=function(){function e(t){if(i(this,e),"undefined"==typeof SharedWorker)throw _("Browser SharedWorker support is required; use sharing: false for an independent connection","RTM_SHARED_WORKER_UNSUPPORTED");var r,n;this._config=Object.assign({},t),this._options=f(y(t)),this._config.conversation=h(t.conversation),this._delegate=null,this._uid=null,this._destroyed=!1,this._events=new g,this.processor=new g,this.promises=(r=this,(n=Object.assign({},u(r,o.prototype))).login=function(e,t,n){return arguments.length>3?Promise.reject(new TypeError("promises.login(uid, credential, timeout?)")):r.loginIfNeeded(e,t,n).then((function(e){if(e.accepted)return{accepted:!0,errorCode:e.errorCode||0};var t=new Error("RTM login rejected ("+String(e.errorCode)+")");throw t.code=e.errorCode,t.status=e.errorCode,t}))},Object.freeze(n)),void 0!==t.uid&&null!==t.uid&&this._attach(t.uid)}return n(e,[{key:"_attach",value:function(e){if(this._assertActive(),"number"==typeof e&&(!isFinite(e)||Math.floor(e)!==e||Math.abs(e)>9007199254740991))throw _("Use a decimal string for a UID outside the safe integer range","RTM_SHARED_UID_INVALID");var t=null==e?"":String(e).trim().replace(/^0+(?=\d)/,"");if(!/^\d+$/.test(t)||/^0+$/.test(t))throw _("Provide a positive UID in login() or createClient({ uid }) before attaching","RTM_SHARED_UID_REQUIRED");if(t.length>20||20===t.length&&t>"18446744073709551615")throw _("UID exceeds the uint64 range","RTM_SHARED_UID_INVALID");if(null!==this._uid&&this._uid!==t)throw _("This client is bound to UID "+this._uid+"; create another client for UID "+t,"RTM_SHARED_UID_MISMATCH");if(!this._delegate){var r=this._config,n=new s({workerName:r.workerName||s.createWorkerName({pid:this._options.pid,protocol:this._options.protocol,uid:t,endpoint:l(this._options),namespace:r.workerNamespace}),workerUrl:r.workerUrl,conversation:r.conversation,readyTimeout:r.readyTimeout,idleShutdownTimeout:r.idleShutdownTimeout,clientOptions:this._options});this._uid=t,this._delegate=n,this._events.bind(n),this.processor.bind(n.processor)}return this._delegate}},{key:"_assertActive",value:function(){if(this._destroyed)throw _("RTM client has been destroyed","RTM_CLIENT_DESTROYED")}},{key:"login",value:function(e,t,r,n){var i=this;this.loginIfNeeded(e,t,n).then((function(e){"function"==typeof r&&r(e.accepted,e.errorCode)}),(function(e){var t="number"==typeof e.status?e.status:"number"==typeof e.code?e.code:a.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;try{"function"==typeof r&&r(!1,t)}finally{i._events.emit("SharedWorkerError",e)}}))}},{key:"loginIfNeeded",value:function(e,t,r){try{var n=this._attach(e),i=this._uid.length>19||19===this._uid.length&&this._uid>"9223372036854775807"?a.Uint64(this._uid):a.Int64(this._uid);return n.loginIfNeeded(i,t,r)}catch(e){return Promise.reject(e)}}},{key:"whenReady",value:function(e){try{return this._attach(void 0===e?this._uid:e).whenReady()}catch(e){return Promise.reject(e)}}},{key:"getSharedSession",value:function(){return this._delegate?this._delegate.getSharedSession():{status:"idle",uid:null}}},{key:"setConversation",value:function(e,t){return this._assertActive(),e=h(e),this._delegate?this._delegate.setConversation(e,t):(this._config.conversation=e,"function"==typeof t&&t(null)),this}},{key:"on",value:function(e,t){return this._events.on(e,t),this}},{key:"off",value:function(e,t){return this._events.off(e,t),this}},{key:"removeEvent",value:function(){return this._events.removeEvent.apply(this._events,arguments),this}},{key:"emit",value:function(){this._events.emit.apply(this._events,arguments)}},{key:"close",value:function(){this._assertActive(),this._delegate&&this._delegate.close()}},{key:"destroy",value:function(){if(!this._destroyed){this._destroyed=!0;try{this._delegate&&this._delegate.destroy()}finally{this._events.clear(),this.processor.clear()}}}},{key:"_invoke",value:function(e,t){try{if(this._assertActive(),!this._delegate)throw _("Call login() before "+e+"()","RTM_SHARED_UID_REQUIRED")}catch(e){var r=t.slice().reverse().find((function(e){return"function"==typeof e}));if(r)return void r(e,null);throw e}return this._delegate[e].apply(this._delegate,t)}}]),e}(),g=function(){function e(){i(this,e),this._listeners=Object.create(null),this._target=null}return n(e,[{key:"bind",value:function(e){var t=this;this._target=e,Object.keys(this._listeners).forEach((function(r){t._listeners[r].forEach((function(t){return e.on(r,t)}))}))}},{key:"on",value:function(e,t){if("function"!=typeof t)return this;var r=this._listeners[e]||(this._listeners[e]=[]);return-1===r.indexOf(t)&&(r.push(t),this._target&&this._target.on(e,t)),this}},{key:"off",value:function(e,t){var r=this,n=this._listeners[e]||[];return n.slice().forEach((function(i){void 0!==t&&i!==t||(r._target&&r._target.removeEvent(e,i),n.splice(n.indexOf(i),1))})),n.length||delete this._listeners[e],this}},{key:"removeEvent",value:function(e,t){var r=this;return arguments.length?this.off(e,t):(Object.keys(this._listeners).forEach((function(e){return r.off(e)})),this)}},{key:"emit",value:function(e){var t=Array.prototype.slice.call(arguments,1);(this._listeners[e]||[]).slice().forEach((function(e){return e.apply(null,t)}))}},{key:"clear",value:function(){this._target=null,this._listeners=Object.create(null)}}]),e}();function y(e){var t=Object.assign({},e);return d.forEach((function(e){delete t[e]})),t}function _(e,t){var r=new Error(e);return r.code=t,r}Object.getOwnPropertyNames(o.prototype).forEach((function(e){"constructor"===e||"_"===e.charAt(0)||Object.prototype.hasOwnProperty.call(p.prototype,e)||"function"==typeof Object.getOwnPropertyDescriptor(o.prototype,e).value&&(p.prototype[e]=function(){return this._invoke(e,Array.prototype.slice.call(arguments))})})),e.exports=function(e){var t=e||{};if(void 0!==t.sharing&&"boolean"!=typeof t.sharing)throw new TypeError("sharing must be a boolean");if(!1===t.sharing){var r=y(t);return void 0===r.protocol&&(r.protocol="tlv-v1"),new o(r)}return new p(t)}}])}));
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 能力地图
10
10
 
11
- 当前源码推荐通过 `createClient()` 默认共享接入:扁平配置,UID 从登录参数取得,SDK 按 PID + 协议 + UID 自动命名并复用连接。`sharing: false` 显式选择独立连接;旧构造器保留原行为。已发布 `.3` 尚无此新入口,配置、错误和生命周期见 [默认共享接入](USAGE.md#默认共享接入当前源码)。
11
+ 推荐通过 `createClient()` 默认共享接入:扁平配置,UID 从登录参数取得,SDK 按 PID、协议、UID 和 Gate endpoint 自动隔离并复用连接。`sharing: false` 显式选择独立连接;旧构造器保留业务 API;共享构造器与工厂自动采用同一环境身份。若 npm `latest` 尚未包含此入口,请使用本地构建;配置、错误和生命周期见 [默认共享接入](USAGE.md#默认共享接入当前源码)。
12
12
 
13
13
  | 业务目标 | SDK 能力 | 常用 API |
14
14
  | --- | --- | --- |
@@ -55,11 +55,11 @@ TLV v1 的能力以 [Client API 契约](TLV_CONTRACT.md) 的 URI 表为准;旧
55
55
 
56
56
  - SDK 会默认从加载它的页面脚本同目录定位 `rtm.shared-worker.js`;Vite 项目可从 `@cg-devcenter/rtc-fpnn-webjs-sdk/vite` 导入 ESM 入口,由 SDK 自动将 Worker 作为构建资源配置给客户端。部署时 Worker 必须在页面同源下可访问;非 Vite 自定义部署路径时可显式提供 `workerUrl`。
57
57
  - 共享键由浏览器 origin、Worker URL、Worker 名称和完全相同的 `clientOptions` 共同决定;这些值不同的页面不会共用连接。
58
- - 支持 `clientOptions.protocol: 'tlv-v1'` 或 `'fpnn'`,默认仍为 TLV;FPNN 扩展目前为源码/本地构建能力,已发布 `.3` 尚不包含它。同 UID 使用不同协议会建立独立连接。
58
+ - 支持 `clientOptions.protocol: 'tlv-v1'` 或 `'fpnn'`,默认仍为 TLV;FPNN 扩展是否可用以 npm `latest` 标签对应的 SDK 为准,同 UID 使用不同协议会建立独立连接。
59
59
  - 一个 Worker 只登录一个 UID。不同 UID 同时在线必须分别建立 Worker/RTC 连接;单 UID 的多页面共享登录态。
60
60
  - 每个页面有独立的 Push 监听端口。配置 `conversation` 后,SDK 按所选协议提取 direct sender、group ref 或 room ref 后过滤,保留原协议事件名和数据;未配置时该页面接收全部会话 Push。
61
61
  - SDK 负责连接、重连、Push ACK/去重和端口分发;业务仍负责消息展示、历史补拉、业务未读规则、草稿与页面状态。
62
- - 登录态保存在 Worker 内存。Worker 被浏览器回收或空闲回收完成后,需要业务重新创建 client 并登录;SDK 不持久化 credential,也不承诺把断线期间未投递的 Push 自动补齐。
62
+ - 登录态保存在 Worker 内存。底层 RTC 断线由 `autoReconnect` 处理;初始化失败、Worker `error` 或消息端口错误会报告 `SharedWorkerError`,此时业务可丢弃失效 client 并重新创建。SDK 目前没有 Worker 就绪后的心跳检测;浏览器静默回收 Worker 时不保证触发该事件,页面可能无法及时察觉。新 Worker 的登录快照为 `idle` 时,业务需重新提供服务端签发的 credential。SDK 不持久化 credential,也不承诺把断线期间未投递的 Push 自动补齐。
63
63
  - `destroy()` 只 detach 当前页面;最后一个页面 detach 后默认等待 5 秒再销毁共享 RTMClient,期间有新页面接入会取消回收。可通过 `idleShutdownTimeout` 调整,设为 0 表示立即关闭;同一个 Worker 的页面须使用相同值。`bye()` / `close()` 会结束所有共用页面的 RTC 会话。共享 Worker 初始化失败时不会静默降级为每页单独连接。
64
64
 
65
65
  TLV v1 使用 MessagePack 二进制 WebSocket frame。SDK 提供以下基础模块: