easemob-websdk 5.1.1 → 5.1.2

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.
Files changed (94) hide show
  1. package/bundle/im-sdk-web.iife.js +1 -1
  2. package/chat-client.d.ts +42 -8
  3. package/chunks/{chat-manager-QJCNq-in.cjs → chat-manager-BFd2Z4oY.cjs} +1 -1
  4. package/chunks/{chat-manager-QxcfwVLg.js → chat-manager-CId_M_e5.js} +1 -1
  5. package/chunks/common-BvlDAw4a.js +1 -0
  6. package/chunks/common-tHGz9VBk.cjs +1 -0
  7. package/chunks/event-system-B62vbKqG.js +1 -0
  8. package/chunks/{event-system-COBJFEIq.cjs → event-system-TYhmgy4K.cjs} +1 -1
  9. package/chunks/group-user-info-resolver-B-dyr__b.cjs +1 -0
  10. package/chunks/group-user-info-resolver-DMccCqez.js +1 -0
  11. package/chunks/index-BBFJYOM8.js +1 -0
  12. package/chunks/{index-DIV5mZP8.cjs → index-DJPAjXAp.cjs} +1 -1
  13. package/chunks/index-DtWkVcfb.cjs +1 -0
  14. package/chunks/index-l_BUKi77.js +1 -0
  15. package/chunks/{session-list-query-rynxSxtv.js → session-list-query-Cvr6rlme.js} +1 -1
  16. package/chunks/{session-list-query-C4OQMvPf.cjs → session-list-query-Dslj2k3t.cjs} +1 -1
  17. package/chunks/{user-info-DfbCp80h.js → user-info-AlshAvdy.js} +1 -1
  18. package/chunks/{user-info-DsDDTJrw.cjs → user-info-DH3aE1gm.cjs} +1 -1
  19. package/config/timeouts.d.ts +11 -0
  20. package/core/connection/connection-manager.d.ts +18 -1
  21. package/core/connection/login-deadline.d.ts +22 -0
  22. package/core/events/event-hub.d.ts +1 -0
  23. package/core/index.d.ts +8 -1
  24. package/core/message/attachment-downloader.d.ts +1 -1
  25. package/core/session-list-sync/session-list-sync-controller.d.ts +5 -0
  26. package/index.cjs +1 -1
  27. package/index.d.ts +11 -9
  28. package/index.js +2 -2
  29. package/log.d.ts +27 -0
  30. package/managers/chat/index.cjs +1 -1
  31. package/managers/chat/index.js +1 -1
  32. package/managers/chat-thread/index.cjs +1 -1
  33. package/managers/chat-thread/index.js +1 -1
  34. package/managers/chatroom/chatroom.d.ts +1 -1
  35. package/managers/chatroom/index.cjs +1 -1
  36. package/managers/chatroom/index.js +1 -1
  37. package/managers/chatroom-manager.d.ts +6 -1
  38. package/managers/contact/index.cjs +1 -1
  39. package/managers/contact/index.js +1 -1
  40. package/managers/group/index.cjs +1 -1
  41. package/managers/group/index.js +1 -1
  42. package/managers/presence/index.cjs +1 -1
  43. package/managers/presence/index.js +1 -1
  44. package/managers/push/index.cjs +1 -1
  45. package/managers/push/index.d.ts +2 -0
  46. package/managers/push/index.js +1 -1
  47. package/managers/push/native-push-controller.d.ts +62 -0
  48. package/managers/push/native-push-normalizer.d.ts +15 -0
  49. package/managers/push-manager.d.ts +63 -4
  50. package/managers/user-info/index.cjs +1 -1
  51. package/managers/user-info/index.js +1 -1
  52. package/managers/user-info-manager.d.ts +3 -2
  53. package/message/combine-payload-codec.d.ts +2 -1
  54. package/package.json +1 -1
  55. package/platform/index.d.ts +1 -1
  56. package/platform/request/default-request-adapter.d.ts +7 -0
  57. package/platform/socket/default-socket-adapter.d.ts +6 -0
  58. package/platform/types.d.ts +22 -2
  59. package/platform/upload/legacy-multipart-upload.d.ts +14 -0
  60. package/platform/upload/legacy-simple-upload.d.ts +3 -0
  61. package/protocol/msync/codec.d.ts +5 -0
  62. package/rest/client.d.ts +0 -4
  63. package/rest/contact-management.d.ts +1 -0
  64. package/rest/dns-config.d.ts +6 -1
  65. package/rest/error-maps/chatroom.d.ts +6 -0
  66. package/rest/error-maps/common.d.ts +3 -0
  67. package/rest/error-maps/contact.d.ts +8 -3
  68. package/rest/error-maps/push.d.ts +13 -1
  69. package/rest/error-maps/user-info.d.ts +51 -3
  70. package/rest/service-url.d.ts +6 -0
  71. package/types/chat-client.d.ts +16 -9
  72. package/types/chatroom.d.ts +3 -34
  73. package/types/event-system.d.ts +52 -1
  74. package/types/index.d.ts +5 -7
  75. package/types/log.d.ts +19 -0
  76. package/types/manager.d.ts +31 -0
  77. package/types/push.d.ts +77 -0
  78. package/upload/attachment-uploader.d.ts +1 -5
  79. package/upload/multipart-upload.d.ts +4 -14
  80. package/upload/simple-upload.d.ts +4 -3
  81. package/upload/types.d.ts +2 -1
  82. package/utils/error-codes.generated.d.ts +1 -0
  83. package/utils/log-reporter.d.ts +1 -7
  84. package/utils/logger.d.ts +28 -2
  85. package/validators/chat-client.d.ts +22 -50
  86. package/validators/message-create.d.ts +18 -18
  87. package/chunks/common-BIpcR2uQ.cjs +0 -1
  88. package/chunks/common-D_DfwSd3.js +0 -1
  89. package/chunks/event-system-D6IJA0C4.js +0 -1
  90. package/chunks/group-user-info-resolver-Ds35Z1Uf.cjs +0 -1
  91. package/chunks/group-user-info-resolver-lEtRdWli.js +0 -1
  92. package/chunks/index-Baofxzfc.cjs +0 -1
  93. package/chunks/index-CKbroPac.js +0 -1
  94. package/chunks/index-DPi6gEFw.js +0 -1
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 支持缓存、分片与定时上报
5
5
  */
6
- import type { LogLevel } from '../types';
6
+ import type { LogEntry } from '../types/log';
7
7
  import type { RequestAdapter } from '../platform/types';
8
8
  export interface LogReporterContext {
9
9
  restBaseUrl?: string;
@@ -13,12 +13,6 @@ export interface LogReporterContext {
13
13
  resource?: string;
14
14
  requestAdapter?: RequestAdapter;
15
15
  }
16
- export interface LogEntry {
17
- timestamp: string;
18
- level: LogLevel;
19
- message: string;
20
- args: ReadonlyArray<unknown>;
21
- }
22
16
  export interface LogReporterOptions {
23
17
  reportIntervalMs?: number;
24
18
  reportTimeoutMs?: number;
package/utils/logger.d.ts CHANGED
@@ -4,16 +4,41 @@
4
4
  * 支持结构化日志,多级别日志控制
5
5
  */
6
6
  import { type LogReporterContext, type LogReportState } from './log-reporter';
7
- import type { LogLevel } from '../types';
7
+ import type { LogEntry, LogLevel } from '../types/log';
8
8
  export interface Logger {
9
9
  debug(message: string, ...args: unknown[]): void;
10
10
  warn(message: string, ...args: unknown[]): void;
11
11
  error(message: string, ...args: unknown[]): void;
12
12
  }
13
+ type LogEntrySink = (entry: LogEntry) => void;
13
14
  /**
14
- * 设置全局日志级别
15
+ * [zh-CN] 设置控制台、onLog 事件和日志上报共同使用的最低日志级别。
16
+ * [en-US] Sets the minimum log level shared by console output, onLog events, and log reporting.
17
+ *
18
+ * @param level - [zh-CN] 最低日志级别。 [en-US] The minimum log level.
19
+ * @returns [zh-CN] 无返回值。 [en-US] No return value.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * setLogLevel('WARN');
24
+ * ```
15
25
  */
16
26
  export declare function setLogLevel(level: LogLevel): void;
27
+ /**
28
+ * [zh-CN] 设置 SDK 日志是否输出到运行环境控制台。该开关不影响 onLog 事件或日志上报。
29
+ * [en-US] Enables or disables SDK log output to the runtime console. This does not affect onLog events or log reporting.
30
+ *
31
+ * @param enabled - [zh-CN] 是否启用控制台输出。 [en-US] Whether console output is enabled.
32
+ * @returns {void} [zh-CN] 无返回值;不抛出业务错误。 [en-US] No return value; throws no business errors.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * setConsoleLogEnabled(false);
37
+ * ```
38
+ */
39
+ export declare function setConsoleLogEnabled(enabled: boolean): void;
40
+ /** @internal 安装结构化日志出口;仅供 ChatClient 桥接 onLog。 */
41
+ export declare function setLogEntrySink(sink: LogEntrySink | null): void;
17
42
  /**
18
43
  * 设置自定义日志器
19
44
  */
@@ -46,3 +71,4 @@ export declare function stopLogReporter(): void;
46
71
  * 导出日志方法
47
72
  */
48
73
  export declare const logger: Logger;
74
+ export {};
@@ -24,33 +24,23 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
24
24
  serverUrls: z.ZodOptional<z.ZodObject<{
25
25
  restApiUrl: z.ZodOptional<z.ZodString>;
26
26
  wsUrl: z.ZodOptional<z.ZodString>;
27
- syncRestApiUrl: z.ZodOptional<z.ZodString>;
28
- syncWsUrl: z.ZodOptional<z.ZodString>;
29
27
  }, "strip", z.ZodTypeAny, {
30
28
  restApiUrl?: string | undefined;
31
29
  wsUrl?: string | undefined;
32
- syncRestApiUrl?: string | undefined;
33
- syncWsUrl?: string | undefined;
34
30
  }, {
35
31
  restApiUrl?: string | undefined;
36
32
  wsUrl?: string | undefined;
37
- syncRestApiUrl?: string | undefined;
38
- syncWsUrl?: string | undefined;
39
33
  }>>;
40
34
  }, "strip", z.ZodTypeAny, {
41
35
  serverUrls?: {
42
36
  restApiUrl?: string | undefined;
43
37
  wsUrl?: string | undefined;
44
- syncRestApiUrl?: string | undefined;
45
- syncWsUrl?: string | undefined;
46
38
  } | undefined;
47
39
  dnsConfigUrls?: [string, ...string[]] | undefined;
48
40
  }, {
49
41
  serverUrls?: {
50
42
  restApiUrl?: string | undefined;
51
43
  wsUrl?: string | undefined;
52
- syncRestApiUrl?: string | undefined;
53
- syncWsUrl?: string | undefined;
54
44
  } | undefined;
55
45
  dnsConfigUrls?: [string, ...string[]] | undefined;
56
46
  }>>;
@@ -63,12 +53,15 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
63
53
  platformAdapterOptions: z.ZodOptional<z.ZodObject<{
64
54
  prefer: z.ZodOptional<z.ZodEnum<["web", "wechat-miniapp", "qq-miniapp", "toutiao-miniapp", "baidu-miniapp", "alipay-miniapp", "dingtalk-miniapp", "lark-miniapp", "kuaishou-miniapp", "jd-miniapp", "360-miniapp", "harmony-miniapp", "quickapp", "uniapp", "react-native", "electron-renderer", "electron-main", "unknown"]>>;
65
55
  runtimeInput: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
56
+ transportAdapter: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
66
57
  overrides: z.ZodOptional<z.ZodType<object | ((...args: ReadonlyArray<unknown>) => unknown), z.ZodTypeDef, object | ((...args: ReadonlyArray<unknown>) => unknown)>>;
67
58
  }, "strict", z.ZodTypeAny, {
59
+ transportAdapter?: object | undefined;
68
60
  runtimeInput?: object | undefined;
69
61
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
70
62
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
71
63
  }, {
64
+ transportAdapter?: object | undefined;
72
65
  runtimeInput?: object | undefined;
73
66
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
74
67
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
@@ -95,33 +88,23 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
95
88
  serverUrls: z.ZodOptional<z.ZodObject<{
96
89
  restApiUrl: z.ZodOptional<z.ZodString>;
97
90
  wsUrl: z.ZodOptional<z.ZodString>;
98
- syncRestApiUrl: z.ZodOptional<z.ZodString>;
99
- syncWsUrl: z.ZodOptional<z.ZodString>;
100
91
  }, "strip", z.ZodTypeAny, {
101
92
  restApiUrl?: string | undefined;
102
93
  wsUrl?: string | undefined;
103
- syncRestApiUrl?: string | undefined;
104
- syncWsUrl?: string | undefined;
105
94
  }, {
106
95
  restApiUrl?: string | undefined;
107
96
  wsUrl?: string | undefined;
108
- syncRestApiUrl?: string | undefined;
109
- syncWsUrl?: string | undefined;
110
97
  }>>;
111
98
  }, "strip", z.ZodTypeAny, {
112
99
  serverUrls?: {
113
100
  restApiUrl?: string | undefined;
114
101
  wsUrl?: string | undefined;
115
- syncRestApiUrl?: string | undefined;
116
- syncWsUrl?: string | undefined;
117
102
  } | undefined;
118
103
  dnsConfigUrls?: [string, ...string[]] | undefined;
119
104
  }, {
120
105
  serverUrls?: {
121
106
  restApiUrl?: string | undefined;
122
107
  wsUrl?: string | undefined;
123
- syncRestApiUrl?: string | undefined;
124
- syncWsUrl?: string | undefined;
125
108
  } | undefined;
126
109
  dnsConfigUrls?: [string, ...string[]] | undefined;
127
110
  }>>;
@@ -134,12 +117,15 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
134
117
  platformAdapterOptions: z.ZodOptional<z.ZodObject<{
135
118
  prefer: z.ZodOptional<z.ZodEnum<["web", "wechat-miniapp", "qq-miniapp", "toutiao-miniapp", "baidu-miniapp", "alipay-miniapp", "dingtalk-miniapp", "lark-miniapp", "kuaishou-miniapp", "jd-miniapp", "360-miniapp", "harmony-miniapp", "quickapp", "uniapp", "react-native", "electron-renderer", "electron-main", "unknown"]>>;
136
119
  runtimeInput: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
120
+ transportAdapter: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
137
121
  overrides: z.ZodOptional<z.ZodType<object | ((...args: ReadonlyArray<unknown>) => unknown), z.ZodTypeDef, object | ((...args: ReadonlyArray<unknown>) => unknown)>>;
138
122
  }, "strict", z.ZodTypeAny, {
123
+ transportAdapter?: object | undefined;
139
124
  runtimeInput?: object | undefined;
140
125
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
141
126
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
142
127
  }, {
128
+ transportAdapter?: object | undefined;
143
129
  runtimeInput?: object | undefined;
144
130
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
145
131
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
@@ -166,33 +152,23 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
166
152
  serverUrls: z.ZodOptional<z.ZodObject<{
167
153
  restApiUrl: z.ZodOptional<z.ZodString>;
168
154
  wsUrl: z.ZodOptional<z.ZodString>;
169
- syncRestApiUrl: z.ZodOptional<z.ZodString>;
170
- syncWsUrl: z.ZodOptional<z.ZodString>;
171
155
  }, "strip", z.ZodTypeAny, {
172
156
  restApiUrl?: string | undefined;
173
157
  wsUrl?: string | undefined;
174
- syncRestApiUrl?: string | undefined;
175
- syncWsUrl?: string | undefined;
176
158
  }, {
177
159
  restApiUrl?: string | undefined;
178
160
  wsUrl?: string | undefined;
179
- syncRestApiUrl?: string | undefined;
180
- syncWsUrl?: string | undefined;
181
161
  }>>;
182
162
  }, "strip", z.ZodTypeAny, {
183
163
  serverUrls?: {
184
164
  restApiUrl?: string | undefined;
185
165
  wsUrl?: string | undefined;
186
- syncRestApiUrl?: string | undefined;
187
- syncWsUrl?: string | undefined;
188
166
  } | undefined;
189
167
  dnsConfigUrls?: [string, ...string[]] | undefined;
190
168
  }, {
191
169
  serverUrls?: {
192
170
  restApiUrl?: string | undefined;
193
171
  wsUrl?: string | undefined;
194
- syncRestApiUrl?: string | undefined;
195
- syncWsUrl?: string | undefined;
196
172
  } | undefined;
197
173
  dnsConfigUrls?: [string, ...string[]] | undefined;
198
174
  }>>;
@@ -205,12 +181,15 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
205
181
  platformAdapterOptions: z.ZodOptional<z.ZodObject<{
206
182
  prefer: z.ZodOptional<z.ZodEnum<["web", "wechat-miniapp", "qq-miniapp", "toutiao-miniapp", "baidu-miniapp", "alipay-miniapp", "dingtalk-miniapp", "lark-miniapp", "kuaishou-miniapp", "jd-miniapp", "360-miniapp", "harmony-miniapp", "quickapp", "uniapp", "react-native", "electron-renderer", "electron-main", "unknown"]>>;
207
183
  runtimeInput: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
184
+ transportAdapter: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
208
185
  overrides: z.ZodOptional<z.ZodType<object | ((...args: ReadonlyArray<unknown>) => unknown), z.ZodTypeDef, object | ((...args: ReadonlyArray<unknown>) => unknown)>>;
209
186
  }, "strict", z.ZodTypeAny, {
187
+ transportAdapter?: object | undefined;
210
188
  runtimeInput?: object | undefined;
211
189
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
212
190
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
213
191
  }, {
192
+ transportAdapter?: object | undefined;
214
193
  runtimeInput?: object | undefined;
215
194
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
216
195
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
@@ -237,33 +216,23 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
237
216
  serverUrls: z.ZodOptional<z.ZodObject<{
238
217
  restApiUrl: z.ZodOptional<z.ZodString>;
239
218
  wsUrl: z.ZodOptional<z.ZodString>;
240
- syncRestApiUrl: z.ZodOptional<z.ZodString>;
241
- syncWsUrl: z.ZodOptional<z.ZodString>;
242
219
  }, "strip", z.ZodTypeAny, {
243
220
  restApiUrl?: string | undefined;
244
221
  wsUrl?: string | undefined;
245
- syncRestApiUrl?: string | undefined;
246
- syncWsUrl?: string | undefined;
247
222
  }, {
248
223
  restApiUrl?: string | undefined;
249
224
  wsUrl?: string | undefined;
250
- syncRestApiUrl?: string | undefined;
251
- syncWsUrl?: string | undefined;
252
225
  }>>;
253
226
  }, "strip", z.ZodTypeAny, {
254
227
  serverUrls?: {
255
228
  restApiUrl?: string | undefined;
256
229
  wsUrl?: string | undefined;
257
- syncRestApiUrl?: string | undefined;
258
- syncWsUrl?: string | undefined;
259
230
  } | undefined;
260
231
  dnsConfigUrls?: [string, ...string[]] | undefined;
261
232
  }, {
262
233
  serverUrls?: {
263
234
  restApiUrl?: string | undefined;
264
235
  wsUrl?: string | undefined;
265
- syncRestApiUrl?: string | undefined;
266
- syncWsUrl?: string | undefined;
267
236
  } | undefined;
268
237
  dnsConfigUrls?: [string, ...string[]] | undefined;
269
238
  }>>;
@@ -276,12 +245,15 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
276
245
  platformAdapterOptions: z.ZodOptional<z.ZodObject<{
277
246
  prefer: z.ZodOptional<z.ZodEnum<["web", "wechat-miniapp", "qq-miniapp", "toutiao-miniapp", "baidu-miniapp", "alipay-miniapp", "dingtalk-miniapp", "lark-miniapp", "kuaishou-miniapp", "jd-miniapp", "360-miniapp", "harmony-miniapp", "quickapp", "uniapp", "react-native", "electron-renderer", "electron-main", "unknown"]>>;
278
247
  runtimeInput: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
248
+ transportAdapter: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
279
249
  overrides: z.ZodOptional<z.ZodType<object | ((...args: ReadonlyArray<unknown>) => unknown), z.ZodTypeDef, object | ((...args: ReadonlyArray<unknown>) => unknown)>>;
280
250
  }, "strict", z.ZodTypeAny, {
251
+ transportAdapter?: object | undefined;
281
252
  runtimeInput?: object | undefined;
282
253
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
283
254
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
284
255
  }, {
256
+ transportAdapter?: object | undefined;
285
257
  runtimeInput?: object | undefined;
286
258
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
287
259
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
@@ -308,33 +280,23 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
308
280
  serverUrls: z.ZodOptional<z.ZodObject<{
309
281
  restApiUrl: z.ZodOptional<z.ZodString>;
310
282
  wsUrl: z.ZodOptional<z.ZodString>;
311
- syncRestApiUrl: z.ZodOptional<z.ZodString>;
312
- syncWsUrl: z.ZodOptional<z.ZodString>;
313
283
  }, "strip", z.ZodTypeAny, {
314
284
  restApiUrl?: string | undefined;
315
285
  wsUrl?: string | undefined;
316
- syncRestApiUrl?: string | undefined;
317
- syncWsUrl?: string | undefined;
318
286
  }, {
319
287
  restApiUrl?: string | undefined;
320
288
  wsUrl?: string | undefined;
321
- syncRestApiUrl?: string | undefined;
322
- syncWsUrl?: string | undefined;
323
289
  }>>;
324
290
  }, "strip", z.ZodTypeAny, {
325
291
  serverUrls?: {
326
292
  restApiUrl?: string | undefined;
327
293
  wsUrl?: string | undefined;
328
- syncRestApiUrl?: string | undefined;
329
- syncWsUrl?: string | undefined;
330
294
  } | undefined;
331
295
  dnsConfigUrls?: [string, ...string[]] | undefined;
332
296
  }, {
333
297
  serverUrls?: {
334
298
  restApiUrl?: string | undefined;
335
299
  wsUrl?: string | undefined;
336
- syncRestApiUrl?: string | undefined;
337
- syncWsUrl?: string | undefined;
338
300
  } | undefined;
339
301
  dnsConfigUrls?: [string, ...string[]] | undefined;
340
302
  }>>;
@@ -347,12 +309,15 @@ export declare const initConfigSchema: z.ZodEffects<z.ZodObject<{
347
309
  platformAdapterOptions: z.ZodOptional<z.ZodObject<{
348
310
  prefer: z.ZodOptional<z.ZodEnum<["web", "wechat-miniapp", "qq-miniapp", "toutiao-miniapp", "baidu-miniapp", "alipay-miniapp", "dingtalk-miniapp", "lark-miniapp", "kuaishou-miniapp", "jd-miniapp", "360-miniapp", "harmony-miniapp", "quickapp", "uniapp", "react-native", "electron-renderer", "electron-main", "unknown"]>>;
349
311
  runtimeInput: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
312
+ transportAdapter: z.ZodOptional<z.ZodType<object, z.ZodTypeDef, object>>;
350
313
  overrides: z.ZodOptional<z.ZodType<object | ((...args: ReadonlyArray<unknown>) => unknown), z.ZodTypeDef, object | ((...args: ReadonlyArray<unknown>) => unknown)>>;
351
314
  }, "strict", z.ZodTypeAny, {
315
+ transportAdapter?: object | undefined;
352
316
  runtimeInput?: object | undefined;
353
317
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
354
318
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
355
319
  }, {
320
+ transportAdapter?: object | undefined;
356
321
  runtimeInput?: object | undefined;
357
322
  prefer?: "unknown" | "web" | "wechat-miniapp" | "qq-miniapp" | "toutiao-miniapp" | "baidu-miniapp" | "alipay-miniapp" | "dingtalk-miniapp" | "lark-miniapp" | "kuaishou-miniapp" | "jd-miniapp" | "360-miniapp" | "harmony-miniapp" | "quickapp" | "uniapp" | "react-native" | "electron-renderer" | "electron-main" | undefined;
358
323
  overrides?: object | ((...args: ReadonlyArray<unknown>) => unknown) | undefined;
@@ -368,6 +333,13 @@ export declare const authContextSchema: z.ZodObject<{
368
333
  userId: string;
369
334
  token: string;
370
335
  }>;
336
+ export declare const loginOptionsSchema: z.ZodObject<{
337
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
338
+ }, "strict", z.ZodTypeAny, {
339
+ timeoutMs?: number | undefined;
340
+ }, {
341
+ timeoutMs?: number | undefined;
342
+ }>;
371
343
  export declare const renewTokenSchema: z.ZodString;
372
344
  export declare const getRTCTokenInfoParamsSchema: z.ZodOptional<z.ZodObject<{
373
345
  channelName: z.ZodOptional<z.ZodString>;
@@ -11,7 +11,7 @@ export declare const createTextMessageSchema: z.ZodType<{
11
11
  receiverList?: [string, ...string[]] | undefined;
12
12
  deliverOnlineOnly?: boolean | undefined;
13
13
  webhookEnv?: string | undefined;
14
- priority?: "high" | "normal" | "low" | undefined;
14
+ priority?: "normal" | "high" | "low" | undefined;
15
15
  needReadReceipt?: boolean | undefined;
16
16
  isChatThread?: boolean | undefined;
17
17
  targetLanguages?: string[] | undefined;
@@ -24,7 +24,7 @@ export declare const createTextMessageSchema: z.ZodType<{
24
24
  receiverList?: [string, ...string[]] | undefined;
25
25
  deliverOnlineOnly?: boolean | undefined;
26
26
  webhookEnv?: string | undefined;
27
- priority?: "high" | "normal" | "low" | undefined;
27
+ priority?: "normal" | "high" | "low" | undefined;
28
28
  needReadReceipt?: boolean | undefined;
29
29
  isChatThread?: boolean | undefined;
30
30
  targetLanguages?: string[] | undefined;
@@ -37,7 +37,7 @@ export declare const createImageMessageSchema: z.ZodType<{
37
37
  receiverList?: [string, ...string[]] | undefined;
38
38
  deliverOnlineOnly?: boolean | undefined;
39
39
  webhookEnv?: string | undefined;
40
- priority?: "high" | "normal" | "low" | undefined;
40
+ priority?: "normal" | "high" | "low" | undefined;
41
41
  needReadReceipt?: boolean | undefined;
42
42
  isChatThread?: boolean | undefined;
43
43
  width?: number | undefined;
@@ -68,7 +68,7 @@ export declare const createImageMessageSchema: z.ZodType<{
68
68
  receiverList?: [string, ...string[]] | undefined;
69
69
  deliverOnlineOnly?: boolean | undefined;
70
70
  webhookEnv?: string | undefined;
71
- priority?: "high" | "normal" | "low" | undefined;
71
+ priority?: "normal" | "high" | "low" | undefined;
72
72
  needReadReceipt?: boolean | undefined;
73
73
  isChatThread?: boolean | undefined;
74
74
  width?: number | undefined;
@@ -100,7 +100,7 @@ export declare const createFileMessageSchema: z.ZodType<{
100
100
  receiverList?: [string, ...string[]] | undefined;
101
101
  deliverOnlineOnly?: boolean | undefined;
102
102
  webhookEnv?: string | undefined;
103
- priority?: "high" | "normal" | "low" | undefined;
103
+ priority?: "normal" | "high" | "low" | undefined;
104
104
  needReadReceipt?: boolean | undefined;
105
105
  isChatThread?: boolean | undefined;
106
106
  filename?: string | undefined;
@@ -127,7 +127,7 @@ export declare const createFileMessageSchema: z.ZodType<{
127
127
  receiverList?: [string, ...string[]] | undefined;
128
128
  deliverOnlineOnly?: boolean | undefined;
129
129
  webhookEnv?: string | undefined;
130
- priority?: "high" | "normal" | "low" | undefined;
130
+ priority?: "normal" | "high" | "low" | undefined;
131
131
  needReadReceipt?: boolean | undefined;
132
132
  isChatThread?: boolean | undefined;
133
133
  filename?: string | undefined;
@@ -156,7 +156,7 @@ export declare const createVoiceMessageSchema: z.ZodType<{
156
156
  receiverList?: [string, ...string[]] | undefined;
157
157
  deliverOnlineOnly?: boolean | undefined;
158
158
  webhookEnv?: string | undefined;
159
- priority?: "high" | "normal" | "low" | undefined;
159
+ priority?: "normal" | "high" | "low" | undefined;
160
160
  needReadReceipt?: boolean | undefined;
161
161
  isChatThread?: boolean | undefined;
162
162
  filename?: string | undefined;
@@ -183,7 +183,7 @@ export declare const createVoiceMessageSchema: z.ZodType<{
183
183
  receiverList?: [string, ...string[]] | undefined;
184
184
  deliverOnlineOnly?: boolean | undefined;
185
185
  webhookEnv?: string | undefined;
186
- priority?: "high" | "normal" | "low" | undefined;
186
+ priority?: "normal" | "high" | "low" | undefined;
187
187
  needReadReceipt?: boolean | undefined;
188
188
  isChatThread?: boolean | undefined;
189
189
  filename?: string | undefined;
@@ -211,7 +211,7 @@ export declare const createVideoMessageSchema: z.ZodType<{
211
211
  receiverList?: [string, ...string[]] | undefined;
212
212
  deliverOnlineOnly?: boolean | undefined;
213
213
  webhookEnv?: string | undefined;
214
- priority?: "high" | "normal" | "low" | undefined;
214
+ priority?: "normal" | "high" | "low" | undefined;
215
215
  needReadReceipt?: boolean | undefined;
216
216
  isChatThread?: boolean | undefined;
217
217
  width?: number | undefined;
@@ -241,7 +241,7 @@ export declare const createVideoMessageSchema: z.ZodType<{
241
241
  receiverList?: [string, ...string[]] | undefined;
242
242
  deliverOnlineOnly?: boolean | undefined;
243
243
  webhookEnv?: string | undefined;
244
- priority?: "high" | "normal" | "low" | undefined;
244
+ priority?: "normal" | "high" | "low" | undefined;
245
245
  needReadReceipt?: boolean | undefined;
246
246
  isChatThread?: boolean | undefined;
247
247
  width?: number | undefined;
@@ -273,7 +273,7 @@ export declare const createLocationMessageSchema: z.ZodType<{
273
273
  receiverList?: [string, ...string[]] | undefined;
274
274
  deliverOnlineOnly?: boolean | undefined;
275
275
  webhookEnv?: string | undefined;
276
- priority?: "high" | "normal" | "low" | undefined;
276
+ priority?: "normal" | "high" | "low" | undefined;
277
277
  needReadReceipt?: boolean | undefined;
278
278
  isChatThread?: boolean | undefined;
279
279
  address?: string | undefined;
@@ -288,7 +288,7 @@ export declare const createLocationMessageSchema: z.ZodType<{
288
288
  receiverList?: [string, ...string[]] | undefined;
289
289
  deliverOnlineOnly?: boolean | undefined;
290
290
  webhookEnv?: string | undefined;
291
- priority?: "high" | "normal" | "low" | undefined;
291
+ priority?: "normal" | "high" | "low" | undefined;
292
292
  needReadReceipt?: boolean | undefined;
293
293
  isChatThread?: boolean | undefined;
294
294
  address?: string | undefined;
@@ -303,7 +303,7 @@ export declare const createCmdMessageSchema: z.ZodType<{
303
303
  receiverList?: [string, ...string[]] | undefined;
304
304
  deliverOnlineOnly?: boolean | undefined;
305
305
  webhookEnv?: string | undefined;
306
- priority?: "high" | "normal" | "low" | undefined;
306
+ priority?: "normal" | "high" | "low" | undefined;
307
307
  needReadReceipt?: boolean | undefined;
308
308
  isChatThread?: boolean | undefined;
309
309
  }, z.ZodTypeDef, {
@@ -315,7 +315,7 @@ export declare const createCmdMessageSchema: z.ZodType<{
315
315
  receiverList?: [string, ...string[]] | undefined;
316
316
  deliverOnlineOnly?: boolean | undefined;
317
317
  webhookEnv?: string | undefined;
318
- priority?: "high" | "normal" | "low" | undefined;
318
+ priority?: "normal" | "high" | "low" | undefined;
319
319
  needReadReceipt?: boolean | undefined;
320
320
  isChatThread?: boolean | undefined;
321
321
  }>;
@@ -328,7 +328,7 @@ export declare const createCustomMessageSchema: z.ZodType<{
328
328
  receiverList?: [string, ...string[]] | undefined;
329
329
  deliverOnlineOnly?: boolean | undefined;
330
330
  webhookEnv?: string | undefined;
331
- priority?: "high" | "normal" | "low" | undefined;
331
+ priority?: "normal" | "high" | "low" | undefined;
332
332
  needReadReceipt?: boolean | undefined;
333
333
  isChatThread?: boolean | undefined;
334
334
  params?: Record<string, string> | undefined;
@@ -341,7 +341,7 @@ export declare const createCustomMessageSchema: z.ZodType<{
341
341
  receiverList?: [string, ...string[]] | undefined;
342
342
  deliverOnlineOnly?: boolean | undefined;
343
343
  webhookEnv?: string | undefined;
344
- priority?: "high" | "normal" | "low" | undefined;
344
+ priority?: "normal" | "high" | "low" | undefined;
345
345
  needReadReceipt?: boolean | undefined;
346
346
  isChatThread?: boolean | undefined;
347
347
  params?: Record<string, string> | undefined;
@@ -377,7 +377,7 @@ export declare const createCombineMessageSchema: z.ZodType<{
377
377
  receiverList?: [string, ...string[]] | undefined;
378
378
  deliverOnlineOnly?: boolean | undefined;
379
379
  webhookEnv?: string | undefined;
380
- priority?: "high" | "normal" | "low" | undefined;
380
+ priority?: "normal" | "high" | "low" | undefined;
381
381
  needReadReceipt?: boolean | undefined;
382
382
  isChatThread?: boolean | undefined;
383
383
  compatibleText?: string | undefined;
@@ -412,7 +412,7 @@ export declare const createCombineMessageSchema: z.ZodType<{
412
412
  receiverList?: [string, ...string[]] | undefined;
413
413
  deliverOnlineOnly?: boolean | undefined;
414
414
  webhookEnv?: string | undefined;
415
- priority?: "high" | "normal" | "low" | undefined;
415
+ priority?: "normal" | "high" | "low" | undefined;
416
416
  needReadReceipt?: boolean | undefined;
417
417
  isChatThread?: boolean | undefined;
418
418
  compatibleText?: string | undefined;
@@ -1 +0,0 @@
1
- "use strict";const e={VALIDATION_REQUIRED:110,VALIDATION_INVALID_FORMAT:110,VALIDATION_UNKNOWN:110,AUTH_ALREADY_LOGIN:200,AUTH_NOT_LOGIN:201,AUTH_UNAUTHORIZED:202,AUTH_FORBIDDEN:210,AUTH_TOKEN_EXPIRED:108,AUTH_BIND_ANOTHER_DEVICE:213,AUTH_LOGIN_TOO_MANY_DEVICES:214,AUTH_USER_MUTED:215,CONNECTION_TIMEOUT:301,CONNECTION_WEBSOCKET_ERROR:300,CONNECTION_NOT_CREATED:1,CONNECTION_CLOSED_BEFORE_READY:300,CONNECTION_CANCELLED:1,CONNECTION_PROVISION_TIMEOUT:301,CONNECTION_PROVISION_REJECTED:202,CONNECTION_PROVISION_CLOSED:300,CONNECTION_DNSLIST_FAILED:304,STORAGE_OPERATION_FAILED:3,MESSAGE_NOT_CONNECTED:300,MESSAGE_ACK_TIMEOUT:301,MESSAGE_SEND_FAILED:303,MESSAGE_SENDER_DESTROYED:1,MESSAGE_ENCODE_FAILED:500,MESSAGE_DECODE_FAILED:500,MESSAGE_ACK_MISSING:301,MESSAGE_BLOCKED_BY_RECIPIENT:222,OPERATION_UNSUPPORTED:111,SERVER_BUSY:302,ATTACHMENT_NOT_FOUND:400,ATTACHMENT_INVALID:401,ATTACHMENT_EXPIRED:407,MESSAGE_INCLUDE_ILLEGAL_CONTENT:501,MESSAGE_SEND_TRAFFIC_LIMIT:502,MESSAGE_RECALL_TIME_LIMIT:504,SERVICE_NOT_ENABLED:505,MESSAGE_EXPIRED:506,MESSAGE_ILLEGAL_WHITELIST:507,MESSAGE_EXTERNAL_LOGIC_BLOCKED:508,MESSAGE_CURRENT_LIMITING:509,MESSAGE_SIZE_LIMIT:510,MESSAGE_EDIT_FAILED:511,INVALID_CONVERSATION:107,USER_LOGIN_ANOTHER_DEVICE:206,USER_REMOVED:207,USER_KICKED_BY_CHANGE_PASSWORD:216,USER_KICKED_BY_OTHER_DEVICE:217,USER_ALREADY_LOGIN_ANOTHER:218,USER_MUTED_BY_ADMIN:219,USER_DEVICE_CHANGED:220,USER_NOT_ON_ROSTER:221,SERVER_SERVING_DISABLED:305,FILE_DOWNLOAD_FAILED:403,FILE_TOO_LARGE:405,FILE_CONTENT_IMPROPER:406,THIRD_MODERATION_FAILED:1200,THIRD_DEFAULT_FAILED:1299,STREAM_SEND_NOT_SUPPORTED:303,STREAM_CHUNK_INVALID:500,STREAM_TIMEOUT_BY_SERVER:500,STREAM_STATE_CONFLICT:500,COMBINE_INVALID_INPUT:110,COMBINE_LEVEL_EXCEEDED:4,COMBINE_ITEM_LIMIT_EXCEEDED:4,COMBINE_ENCODE_FAILED:500,COMBINE_UPLOAD_FAILED:402,COMBINE_DOWNLOAD_FAILED:2,COMBINE_PARSE_FAILED:500,REST_NETWORK_ERROR:2,REST_TIMEOUT:301,REST_HTTP_ERROR:303,REST_BUSINESS_UNKNOWN:303,PUSH_TOKEN_UPLOAD_FAILED:1500,PUSH_SILENT_MODE_OPERATION_FAILED:1501,PUSH_LANGUAGE_OPERATION_FAILED:1502,USER_INFO_SUBSCRIPTION_LIMIT_EXCEEDED:1600,USER_INFO_SUBSCRIPTION_TARGET_LIMIT_EXCEEDED:1601,USERINFO_USERCOUNT_EXCEED:900,USERINFO_DATALENGTH_EXCEED:901,CONTACT_ADD_USER_NOT_FOUND:204,CONTACT_ADD_ALREADY_FRIEND:1e3,CONTACT_ADD_BLOCKED_BY_USER:210,CONTACT_SET_REMARK_NOT_FRIEND:223,CONTACT_REACH_LIMIT:1001,CONTACT_REACH_LIMIT_PEER:1002,CONTACT_BLOCKLIST_USER_NOT_FOUND:204,GROUP_INVALID_ID:600,GROUP_ALREADY_JOINED:601,GROUP_NOT_JOINED:602,GROUP_PERMISSION_DENIED:603,GROUP_MEMBERS_FULL:604,GROUP_SHARED_FILE_INVALID_ID:605,GROUP_NOT_EXIST:606,GROUP_DISABLED:607,GROUP_NAME_VIOLATION:608,GROUP_MEMBER_ATTRIBUTES_REACH_LIMIT:609,GROUP_MEMBER_ATTRIBUTES_UPDATE_FAILED:610,GROUP_MEMBER_ATTRIBUTES_KEY_REACH_LIMIT:611,GROUP_MEMBER_ATTRIBUTES_VALUE_REACH_LIMIT:612,GROUP_USER_IN_BLOCKLIST:613,CHATROOM_INVALID_ID:700,CHATROOM_NOT_JOINED:702,CHATROOM_PERMISSION_DENIED:703,CHATROOM_MEMBERS_FULL:704,CHATROOM_NOT_EXIST:705,CHATROOM_OWNER_NOT_ALLOW_LEAVE:706,CHATROOM_USER_IN_BLOCKLIST:707,CONTACT_SYNC_METADATA_FAILED:1700,CONTACT_SYNC_SOCKET_FAILED:1701,CONTACT_SYNC_CURSOR_INVALID:1702,CONTACT_SYNC_PROTO_DECODE_FAILED:1703,CONTACT_SYNC_CANCELLED:1704,SESSION_LIST_SOCKET_FAILED:300,SESSION_LIST_PROTO_DECODE_FAILED:500,SESSION_LIST_REQUEST_INVALID:110,SESSION_LIST_FETCH_FAILED:303,SESSION_LIST_SERVICE_DISABLED:305,SESSION_LIST_CANCELLED:1,PRESENCE_PARAM_LENGTH_EXCEED:1100,PRESENCE_CANNOT_SUBSCRIBE_YOURSELF:1101,TRANSLATE_PARAM_INVALID:1110,TRANSLATE_SERVICE_NOT_ENABLED:1111,TRANSLATE_USAGE_LIMIT:1112,TRANSLATE_FAILED:1113,VOICE_TO_TEXT_FILE_INVALID:407,VOICE_TO_TEXT_FILE_DURATION_TOO_LONG:408,VOICE_TO_TEXT_FAILED:409,VOICE_TO_TEXT_FILE_NOT_FOUND:410,VOICE_TO_TEXT_FILE_TOO_LARGE:411,REACTION_REACH_LIMIT:1300,REACTION_ALREADY_OPERATED:1301,REACTION_OPERATION_ILLEGAL:1302,UPLOAD_REQUIRED_FIELD_MISSING:110,UPLOAD_INVALID_APPKEY:100,UPLOAD_SIZE_EXCEEDED:405,UPLOAD_REQUEST_FAILED:402,UPLOAD_TIMEOUT:301,UPLOAD_ABORTED:1,SERVICE_LIMIT_EXCEEDED:4,UNKNOWN:1},t="[REDACTED]",o=e=>{if(!e)return"";const o=e.includes("?"),r=e.includes("#");try{return((e,o,r)=>(e.username&&(e.username=t),e.password&&(e.password=t),e.search=o?`?${t}`:"",e.hash=r?`#${t}`:"",e.toString()))(new URL(e),o,r)}catch{const o=[e.indexOf("?"),e.indexOf("#")].filter(e=>e>=0).sort((e,t)=>e-t)[0];return void 0===o?"[invalid-url]":`${e.slice(0,o)}?${t}`}},r=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>"url"===e.toLowerCase()&&"string"==typeof t?[e,o(t)]:[e,t]));class s extends Error{constructor(t,o=e.UNKNOWN,i){super(t),this.name="SDKError",this.code=o,this.details=i?.details?r(i.details):void 0,Error.captureStackTrace&&Error.captureStackTrace(this,s)}toJSON(){return{name:this.name,message:this.message,code:this.code,details:this.details,stack:this.stack}}}class i extends s{constructor(t,o){super(t,o?.code??e.AUTH_UNAUTHORIZED,o),this.name="AuthenticationError"}}class n extends s{constructor(t,o){super(t,o?.code??e.VALIDATION_UNKNOWN,o),this.name="ValidationError"}}class a extends s{constructor(t,o){super(t,o?.code??e.REST_NETWORK_ERROR,o),this.name="RestTransportError"}}class p extends s{constructor(t,o){super(t,o?.code??e.REST_BUSINESS_UNKNOWN,o),this.name="RestBusinessError"}}class E extends s{constructor(t,o){super(t,o?.code??e.UPLOAD_REQUEST_FAILED,o),this.name="UploadError"}}const c={jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",heic:"image/heic",heif:"image/heif",svg:"image/svg+xml",mp4:"video/mp4",mov:"video/quicktime",mp3:"audio/mpeg",m4a:"audio/mp4",wav:"audio/wav",aac:"audio/aac",amr:"audio/amr",pdf:"application/pdf",txt:"text/plain",json:"application/json"},T=e=>"undefined"!=typeof Blob&&e instanceof Blob,u=e=>{const t=e.replace(/[?#].*$/,"").split(/[\\/]/).filter(Boolean),o=t.length>0?t[t.length-1]:void 0;if(o)return o},_=e=>{if(!e)return;const t=e.lastIndexOf(".");if(t<0||t===e.length-1)return;const o=e.slice(t+1).toLowerCase();return c[o]},O=(e,t)=>{for(const o of t){const t=e[o];if("string"==typeof t&&t.length>0)return t}},d=e=>{const t=e.file,o=e.sourceMeta,r=t.name||(o?O(o,["name","fileName","filename"]):void 0),s=e.file.type||(o?O(o,["type","mimeType","filetype"]):void 0),i=e.file.size||(o?((e,t)=>{for(const o of t){const t=e[o];if("number"==typeof t&&Number.isFinite(t))return t}})(o,["size","fileSize","fileLength"]):void 0),n=l({fileName:r,fileType:s,fileSize:i,fallbackName:e.fallbackName,fallbackMimeType:e.fallbackMimeType,fallbackSize:e.fallbackSize});return{source:{sourceType:"web-file",file:e.file,name:n.fileName,mimeType:n.fileType,size:n.fileSize},fileName:n.fileName,fileType:n.fileType,fileSize:n.fileSize,webFile:e.file}},l=e=>({fileName:e.fileName??e.fallbackName??"file",fileType:e.fileType??e.fallbackMimeType??"application/octet-stream",fileSize:e.fileSize??e.fallbackSize??0}),R=e=>{const{file:t,fallbackName:o,fallbackMimeType:r,fallbackSize:s}=e,i=(e=>{if(T(e))return e;if("object"!=typeof e||null===e)return;const t=e;for(const o of["file","originFileObj","raw","blob"]){const e=t[o];if(T(e))return e}})(t);if(i)return d({file:i,fallbackName:o,fallbackMimeType:r,fallbackSize:s,sourceMeta:"object"==typeof t&&null!==t?t:void 0});if((e=>"object"==typeof e&&null!==e&&"path"in e)(t)){const e=u(t.path),i=l({fileName:t.name??e,fileType:t.type??_(t.name??e),fileSize:t.size,fallbackName:o,fallbackMimeType:r,fallbackSize:s});return{source:{sourceType:"miniapp-path",path:t.path,name:i.fileName,mimeType:i.fileType,size:i.fileSize},fileName:i.fileName,fileType:i.fileType,fileSize:i.fileSize}}if((e=>"object"==typeof e&&null!==e&&"uri"in e)(t)){const e=u(t.uri),i=l({fileName:t.name??e,fileType:t.type??_(t.name??e),fileSize:t.size,fallbackName:o,fallbackMimeType:r,fallbackSize:s});return{source:{sourceType:"rn-uri",uri:t.uri,name:i.fileName,mimeType:i.fileType,size:i.fileSize},fileName:i.fileName,fileType:i.fileType,fileSize:i.fileSize}}const n=l({fallbackName:o,fallbackMimeType:r,fallbackSize:s});return{source:{sourceType:"web-file",name:n.fileName,mimeType:n.fileType,size:n.fileSize},fileName:n.fileName,fileType:n.fileType,fileSize:n.fileSize}},m="CHAT",h="GROUP",N="ROOM",A="original",I="large",S=e=>/^https?:\/\//i.test(e),f=t=>{const o=t.split("#");if(2!==o.length||!o[0]||!o[1])throw new E("Invalid appKey for upload",{code:e.UPLOAD_INVALID_APPKEY,details:{appKey:t}});return{orgName:o[0],appName:o[1]}},C=(e,t)=>D(e,{size:t}),y=e=>{try{return decodeURIComponent(e)}catch{return e}},D=(e,t)=>{const[o="",r]=e.split("#",2),[s,i=""]=o.split("?",2),n=i.split("&").filter(Boolean);return Object.entries(t).forEach(([e,t])=>{const o=encodeURIComponent(e),r=n.filter(t=>{const[r=""]=t.split("=",2);return r!==o&&y(r)!==e});n.length=0,n.push(...r),void 0!==t&&n.push(`${o}=${encodeURIComponent(String(t))}`)}),`${s}${n.length>0?`?${n.join("&")}`:""}${r?`#${r}`:""}`},M=(e,t)=>{if(!e)return{};if(!1===t?.deriveVariants)return{originalImageUrl:e};const o=(e=>{const[t="",o]=e.split("#",2),[r,s=""]=t.split("?",2),i=s.split("&").filter(Boolean).filter(e=>{const[t="",o=""]=e.split("=",2),r=y(t),s=y(o);return"size"!==r||!["big","large","thumbnail","small"].includes(s)}).join("&");return`${r}${i?`?${i}`:""}${o?`#${o}`:""}`})(e);return{originalImageUrl:o,bigImageUrl:C(o,"large"),thumbnailUrl:C(o,"small")}},U=e=>new Promise(t=>{setTimeout(t,e)});const g=new class{constructor(e){this.state="disabled",this.timerId=null,this.reporting=!1,this.context={},this.buffer=[],this.bufferBytes=0,this.reportIntervalMs=this.normalizeReportInterval(e?.reportIntervalMs),this.reportTimeoutMs=e?.reportTimeoutMs??15e3,this.chunkDelayMs=e?.chunkDelayMs??3e3,this.maxChunkBytes=e?.maxChunkBytes??2097152,this.maxBufferBytes=e?.maxBufferBytes??3145728}setEnabled(e){this.setState(e?"enabled":"disabled")}setState(e){this.state=e,"enabled"!==e?(this.stop(),this.clearBuffer()):this.start()}updateContext(e){this.context={...this.context,...e}}updateReportInterval(e){this.reportIntervalMs=this.normalizeReportInterval(e),"enabled"===this.state&&this.start()}append(e){if("disabled"===this.state)return;const t=this.formatEntry(e);this.pushBuffer(t)}async reportNow(){await this.reportLogs()}stop(){this.timerId&&(clearInterval(this.timerId),this.timerId=null)}clearBuffer(){this.buffer=[],this.bufferBytes=0}start(){this.stop(),this.timerId=setInterval(()=>{this.reportLogs()},this.reportIntervalMs)}normalizeReportInterval(e){const t=void 0!==e&&Number.isFinite(e)&&e>0?e:3e5;return Math.max(t,6e4)}canReport(){return Boolean(this.context.restBaseUrl&&this.context.appKey&&this.context.userId&&this.context.token&&this.context.requestAdapter)}formatEntry(e){const t=e.args.length>0?e.args.map(e=>(e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch{return String(e)}})(e)).join(" "):"",o=t?`${e.message} ${t}`:e.message;return`${e.timestamp} [${e.level}] ${o}`}pushBuffer(e){const t=e.length;if(!(t>=this.maxBufferBytes)){for(;this.bufferBytes+t>this.maxBufferBytes&&this.buffer.length>0;){const e=this.buffer.shift();e&&(this.bufferBytes-=e.length)}this.buffer.push(e),this.bufferBytes+=t}}consumeBuffer(){if(0===this.buffer.length)return[];const e=`${this.buffer.join("\n")}\n`;this.clearBuffer();const t=[];let o=e;for(;o.length>this.maxChunkBytes;)t.push(o.slice(0,this.maxChunkBytes)),o=o.slice(this.maxChunkBytes);return o.length>0&&t.push(o),t}requeueChunk(e){this.pushBuffer(e)}async reportLogs(){if("enabled"===this.state&&!this.reporting&&0!==this.buffer.length){this.reporting=!0;try{const e=this.consumeBuffer();if(0===e.length)return;if(!this.canReport())return void e.forEach(e=>this.requeueChunk(e));for(const t of e){await this.reportChunk(t)||this.requeueChunk(t),await U(this.chunkDelayMs)}}finally{this.reporting=!1}}}async reportChunk(e){if(!this.canReport())return!1;const{restBaseUrl:t,appKey:o,userId:r,token:s,resource:i,requestAdapter:n}=this.context;if(!(t&&o&&r&&s&&n))return!1;let a="",p="";try{const e=f(o);a=e.orgName,p=e.appName}catch{return!1}const E=`${t}/${a}/${p}/sdk/users/${r}/client/logs`,c={resource:i??"webim",logContent:e};try{const e=await n.request({url:E,method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json",Accept:"application/json"},body:c,responseType:"json",timeoutMs:this.reportTimeoutMs});if(e.status<200||e.status>=300)return!1;const t="string"==typeof e.data?(e=>{try{return JSON.parse(e)}catch{return}})(e.data):e.data;return!t||!t.status||"ok"===t.status}catch{return!1}}},L="[MASKED]",P=new Set(["token","password","authorization","appkey","userid","deviceid","accesstoken","refreshtoken","secret","authtoken","sessionid","clientresource"]),b=e=>!!e&&P.has((e=>e.toLowerCase())(e)),G=(e,t,o)=>{const r=o??new WeakSet;if("string"==typeof e)return((e,t)=>b(t)?L:e)(e,t);if("number"==typeof e||"boolean"==typeof e||null==e)return e;if("bigint"==typeof e||"symbol"==typeof e)return e.toString();if("function"==typeof e)return`[Function ${e.name||"anonymous"}]`;if(e instanceof Error)return{name:(s=e).name,message:s.message};var s;if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(e=>G(e,void 0,r));if("object"==typeof e){if(r.has(e))return"[Circular]";if(r.add(e),(e=>!("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Date||e instanceof Error))(e)){const t={};for(const[o,s]of Object.entries(e))b(o)?t[o]=L:t[o]=G(s,o,r);return t}return Object.prototype.toString.call(e)}return"[Unsupported]"},H="undefined"!=typeof document,w={DEBUG:0,WARN:1,ERROR:2};class B{constructor(e="WARN"){this.level=e}setLevel(e){this.level=e}shouldLog(e){return w[e]>=w[this.level]}emit(e,t,o){const r=(e=>{const t=new WeakSet;return e.map(e=>G(e,void 0,t))})(o),s=((e,t,o)=>({timestamp:(new Date).toISOString(),level:e,message:t,args:o}))(e,t,r);g.append(s);const i=new Date,n=`[Chat][${e}][${`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}:${String(i.getSeconds()).padStart(2,"0")}.${String(i.getMilliseconds()).padStart(3,"0")}`}]`;H?console.log(`%c${n}`,"color: rgb(0, 157, 255); font-weight: bold",t,...r):console.log(n,t,...r)}debug(e,...t){this.shouldLog("DEBUG")&&this.emit("DEBUG",e,t)}warn(e,...t){this.shouldLog("WARN")&&this.emit("WARN",e,t)}error(e,...t){this.shouldLog("ERROR")&&this.emit("ERROR",e,t)}}let v=new B;const F={debug:(e,...t)=>v.debug(e,...t),warn:(e,...t)=>v.warn(e,...t),error:(e,...t)=>v.error(e,...t)},x=["__uniConfig","skipWaiting","registration","navigator","process","window","document","localStorage","fetch","WebSocket","XMLHttpRequest","FormData","TextEncoder","TextDecoder","crypto"],k=e=>{if(e)return e;return((e,t)=>{if(!e)return t;if(0===Object.keys(t).length)return e;const o={},r=e;for(const s of x)try{const e=r[s];void 0!==e&&(o[s]=e)}catch{}for(const s of Object.keys(t))o[s]=t[s];return o})("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0,{..."undefined"!=typeof wx?{wx:wx}:{},..."undefined"!=typeof qq?{qq:qq}:{},..."undefined"!=typeof tt?{tt:tt}:{},..."undefined"!=typeof swan?{swan:swan}:{},..."undefined"!=typeof my?{my:my}:{},..."undefined"!=typeof dd?{dd:dd}:{},..."undefined"!=typeof jd?{jd:jd}:{},..."undefined"!=typeof ks?{ks:ks}:{},..."undefined"!=typeof uni?{uni:uni}:{}})},K=()=>`${Date.now()}${Math.floor(1e6*Math.random()).toString().padStart(6,"0")}`,V="X-Request-Id",q="direct";class ${constructor(e){this.events=[],this.enabled=!1,this.acceptedInWindow=0,this.capacityDiagnosticEmitted=!1,this.rateDiagnosticEmitted=!1,this.sendBatch=e.send,this.capacity=e.capacity??1e3,this.batchSize=e.batchSize??10,this.rateLimit=e.rateLimit??1e3,this.flushIntervalMs=e.flushIntervalMs??1e3,this.now=e.now??Date.now,this.onDrop=e.onDrop,this.windowStartedAt=this.now()}get size(){return this.events.length}enqueue(e){return this.refreshRateWindow(),this.acceptedInWindow>=this.rateLimit?(this.rateDiagnosticEmitted||(this.rateDiagnosticEmitted=!0,this.onDrop?.("rate-limit")),!1):this.events.length>=this.capacity?(this.capacityDiagnosticEmitted||(this.capacityDiagnosticEmitted=!0,this.onDrop?.("capacity")),!1):(this.events.push(e),this.acceptedInWindow+=1,this.schedule(),!0)}enable(){this.enabled=!0,this.schedule()}updateAppKey(e,t){for(let o=0;o<this.events.length;o+=1){const r=this.events[o];r&&r.appKey===e&&(this.events[o]={appKey:t,wire:{...r.wire,body:{...r.wire.body,appkey:t}}})}}pause(){this.enabled=!1,this.clearTimer()}clear(){this.pause(),this.events.splice(0,this.events.length),this.acceptedInWindow=0,this.windowStartedAt=this.now(),this.capacityDiagnosticEmitted=!1,this.rateDiagnosticEmitted=!1}refreshRateWindow(){const e=this.now();e-this.windowStartedAt<6e4||(this.windowStartedAt=e,this.acceptedInWindow=0,this.rateDiagnosticEmitted=!1)}schedule(){this.enabled&&0!==this.events.length&&!this.timer&&(this.timer=setTimeout(()=>{this.timer=void 0,this.consume()},this.flushIntervalMs))}async consume(){if(!this.enabled||0===this.events.length)return;const e=this.events[0];if(!e)return;const t=[];for(let o=0;o<this.events.length&&t.length<this.batchSize;){const r=this.events[o];r?.appKey===e.appKey?(t.push(r.wire),this.events.splice(o,1)):o+=1}this.events.length<this.capacity&&(this.capacityDiagnosticEmitted=!1);try{await this.sendBatch(e.appKey,t)}catch{}finally{this.schedule()}}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=void 0)}}class W{constructor(e){this.requestAdapter=e.requestAdapter,this.debug=e.debug??!1,this.now=e.now??Date.now,this.onFailure=e.onFailure}async send(e,t){if(this.requestAdapter&&0!==t.length)try{const o=await this.requestAdapter.request({url:this.debug?"https://data-reporting.realtimemesh.com/report":"https://data-reporting.rtnsvc.com/report",method:"POST",headers:{"Content-Type":"application/json",token:"32f24ab2ddb74f508aa9286c356cec84",appid:e,sendts:String(Math.floor(this.now()/1e3)),biz:"im",debug:String(this.debug)},body:JSON.stringify(t),responseType:"text",timeoutMs:15e3});(o.status<200||o.status>=300)&&this.onFailure?.({reason:"non-success-response",status:o.status})}catch(o){this.onFailure?.({reason:"transport-error",message:o instanceof Error?o.message:String(o)})}else this.onFailure?.({reason:"request-adapter-unavailable",eventCount:t.length})}}const z={none:0,disconnected:0,ethernet:1,lan:1,wifi:2,"slow-2g":7,"2g":7,"3g":7,"4g":7,"5g":7,cellular:7},j=()=>{const e=k(),t=e.crypto?.randomUUID;return("function"==typeof t?t.call(e.crypto):void 0)??`${Date.now()}_${Math.random().toString(36).slice(2)}`};class Y{constructor(e){this.currentState="disabled",this.networkType=-1,this.now=e.now??Date.now,this.randomId=e.randomId??j;const t=new W({requestAdapter:e.requestAdapter,debug:e.debug,now:this.now,onFailure:t=>{e.onDiagnostic?.("DataReport transport failed",t)}}),o=e.send??((e,o)=>t.send(e,o));this.queue=new $({send:o,now:this.now,onDrop:t=>{e.onDiagnostic?.("DataReport event dropped",{reason:t})}})}get state(){return this.currentState}get queuedEventCount(){return this.queue.size}get serviceId(){return this.session?.serviceId}startSession(e){this.queue.clear(),this.currentState="unknown";const t=this.randomId();return this.session={...e,sessionId:`session_${t}`,serviceId:`sid_${t}`},this.enqueue(9674,{did:e.did??"",os:e.os??e.platform,sdkVersion:e.sdkVersion,deviceId:e.deviceId??""}),this.session.serviceId}updateSession(e){this.session&&(e.appKey&&e.appKey!==this.session.appKey&&this.queue.updateAppKey(this.session.appKey,e.appKey),this.session={...this.session,...e})}updateNetworkType(e){this.networkType=(e=>"number"==typeof e&&Number.isFinite(e)?e:"string"!=typeof e?-1:z[e.trim().toLowerCase()]??-1)(e)}applyDnsSwitch(e){if(this.session){if("true"===e)return this.currentState="enabled",void this.queue.enable();this.currentState="disabled",this.queue.clear()}else this.currentState="disabled"}startOperation(e){const t=this.session?.sessionId;if(!t||"disabled"===this.currentState)return this.createNoopOperation();const o=`opr_${this.randomId()}`,r=this.now();let s=!1,i=!1,n=`req_${this.randomId()}`,a=0,p="";const E=()=>!s&&!i&&this.session?.sessionId===t,c=(t,r,s,i,n)=>{E()&&(a=n.success?0:n.code,p=n.success?"":n.description??"",this.enqueue(9675,{uid:e.uid??this.session?.uid,operationId:o,requestid:r,operationName:e.operationName,operationType:e.operationType,requestName:t.requestName??e.operationName,subrequestid:String(s),requestMethod:t.method??"",requestUrl:t.url??"",requestElapse:Math.max(0,this.now()-i),code:n.code,codeDesc:n.description??"",isLastApi:0,isSuccess:n.success?1:0,accessChannel:this.session?.accessChannel??q,msgId:e.msgId,messageType:e.messageType,resultCount:n.resultCount}))},T=(e,t,o,r)=>{const s=this.now();let i=!1;return{retry:()=>(r.next+=1,T(e,t,r.next,r)),finish:r=>{i||(i=!0,c(e,t,o,s,r))}}};return{startRequest:(e={})=>(n=`req_${this.randomId()}`,T(e,n,1,{next:1})),finish:t=>{E()&&(s=!0,this.enqueue(9675,{uid:e.uid??this.session?.uid,operationId:o,requestid:n,operationName:e.operationName,operationType:e.operationType,requestName:"",subrequestid:"0",requestMethod:"",requestUrl:"",requestElapse:Math.max(0,this.now()-r),code:t.success?0:t.code??a,codeDesc:t.success?"":t.description??p,isLastApi:1,isSuccess:t.success?1:0,accessChannel:this.session?.accessChannel??q,msgId:e.msgId,messageType:e.messageType,resultCount:t.resultCount}))},discard:()=>{i=!0}}}reset(){this.currentState="disabled",this.session=void 0,this.queue.clear()}enqueue(e,t){const o=this.session;if(!o||"disabled"===this.currentState)return;const r={lts:this.now(),net:this.networkType,appkey:o.appKey,sdkServiceId:o.serviceId,sdkProduct:0,uikitVersion:o.uikitVersion??"",...t},s={eventId:e,body:Object.fromEntries(Object.entries(r).filter(([,e])=>void 0!==e))};this.queue.enqueue({appKey:o.appKey,wire:s})}createNoopOperation(){const e={retry:()=>e,finish:()=>{}};return{startRequest:()=>e,finish:()=>{},discard:()=>{}}}}let X;const J=e=>{if("disabled"!==X?.state)return X?.startOperation(e)},Q=(e,t)=>{if(!e.matchField)return!1;const o=t[e.matchField];return void 0!==e.matchPattern?"string"==typeof o&&o.includes(e.matchPattern):void 0===e.matchValue?void 0!==o:o===e.matchValue||!("string"!=typeof o&&"number"!=typeof o||"string"!=typeof e.matchValue&&"number"!=typeof e.matchValue)&&String(o)===String(e.matchValue)};function Z(t){const o=t.entry?.code??e.REST_BUSINESS_UNKNOWN,r=t.message??function(e){const t=e.apiName?`${e.apiName} failed`:"request failed";if(e.entry?.runtimeMessage)return`REST business error: ${e.entry.runtimeMessage}`;if(e.mapped??Boolean(e.entry)){if(e.reasonKey){const t=e.reasonKey.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split("_").join(" ").split("-").join(" ").toLowerCase();return`REST business error: ${t.charAt(0).toUpperCase()}${t.slice(1)}`}return`REST business error: ${t}`}return e.reasonKey?`REST business error: ${t} (${e.reasonKey})`:`REST business error: ${t}`}({apiName:t.apiName,entry:t.entry,mapped:t.mapped,reasonKey:t.reasonKey});return new p(r,{code:o,details:{api:t.apiName,serverCode:t.serverCode,serverMessage:t.serverMessage,httpStatus:t.httpStatus,mapped:t.mapped??Boolean(t.entry),reasonKey:t.reasonKey,matchedBy:t.matchedBy,retryable:t.entry?.retryable,canonicalCode:t.entry?.canonicalCode??t.entry?.code}})}const ee={getHistoryMessages:{operationName:"REST_GET_HISTORY_MESSAGE",operationType:"REST"},removeHistoryMessages:{operationName:"REST_DELETE_MESSAGES_CONVERSATIONS",operationType:"REST"},searchMessages:{operationName:"REST_SEARCH_MESSAGES",operationType:"REST"},addContact:{operationName:"ROSTER_ADD",operationType:"ROSTER"},deleteContact:{operationName:"ROSTER_REMOVE",operationType:"ROSTER"},acceptContactInvite:{operationName:"ROSTER_ACCEPT",operationType:"ROSTER"},declineContactInvite:{operationName:"ROSTER_DECLINE",operationType:"ROSTER"},addUsersToBlocklist:{operationName:"ROSTER_BAN",operationType:"ROSTER"},removeUserFromBlocklist:{operationName:"ROSTER_ALLOW",operationType:"ROSTER"},getBlocklist:{operationName:"ROSTER_BLACKLIST",operationType:"ROSTER"},getContactList:{operationName:"ROSTER_CONTACTS",operationType:"ROSTER"},setContactRemark:{operationName:"ROSTER_SET_CONTACT_REMARK",operationType:"ROSTER"},updateOwnInfo:{operationName:"USER_UPDATE_USERINFO",operationType:"USER"},getUserInfoByUserId:{operationName:"USER_FETCH_USERINFO",operationType:"USER"},uploadPushToken:{operationName:"USER_UPLOAD_PUSH_TOKEN",operationType:"USER"},createGroup:{operationName:"GROUP_CREATEGROUP",operationType:"GROUP"},destroyGroup:{operationName:"GROUP_DESTOTYGROUP",operationType:"GROUP"},leaveGroup:{operationName:"GROUP_LEAVEGROUP",operationType:"GROUP"},joinGroup:{operationName:"GROUP_JOIN_PUBLICGROUP",operationType:"GROUP"},getGroupMemberList:{operationName:"GROUP_FETCH_MEMEBERS",operationType:"GROUP"},uploadGroupSharedFile:{operationName:"GROUP_UPLOAD_SHAREDFILE",operationType:"GROUP"},downloadGroupSharedFile:{operationName:"GROUP_DOWNLOAD_SHAREDFILE",operationType:"GROUP"},getChatRoomList:{operationName:"CHATROOM_FETCH_CHATROOMSWITHPAGE",operationType:"CHATROOM"},getChatRoomInfo:{operationName:"CHATROOM_FETCH_SPECIFICATION",operationType:"CHATROOM"},joinChatRoom:{operationName:"CHATROOM_JOINCAHTROOM",operationType:"CHATROOM"},leaveChatRoom:{operationName:"CHATROOM_LEAVECAHTROOM",operationType:"CHATROOM"},getConversationList:{operationName:"REST_GET_SESSION_LIST",operationType:"REST"},deleteConversation:{operationName:"REST_DEL_SESSION",operationType:"REST"},setConversationPinned:{operationName:"REST_PIN_CONVERSATION",operationType:"REST"},getPinnedMessageList:{operationName:"REST_FETCH_PINMESSAGES",operationType:"REST"},clearAllMessagesAndConversations:{operationName:"REST_DELETE_MESSAGES_CONVERSATIONS",operationType:"REST"},setPinned:{operationName:"REST_PIN_MESSAGE",operationType:"REST"},getSelfIdsOnOtherPlatform:{operationName:"USER_LOGGEDIN_OTHER_PLATFORM",operationType:"USER"},getJoinedGroupList:{operationName:"GROUP_FETCH_USERS_GROUP",operationType:"GROUP"},changeGroupOwner:{operationName:"GROUP_CHANGE_OWNER",operationType:"GROUP"},getGroupInfo:{operationName:"GROUP_FETCH_SPECIFICATION",operationType:"GROUP"},getGroupInfoList:{operationName:"GROUP_FETCH_SPECIFICATION",operationType:"GROUP"},updateGroupInfo:{operationName:"GROUP_CHANGE_GROUPATTRIBUTE",operationType:"GROUP"},getGroupAdminList:{operationName:"GROUP_GET_ADMIN",operationType:"GROUP"},addGroupAdmin:{operationName:"GROUP_SET_ADMIN",operationType:"GROUP"},removeGroupAdmin:{operationName:"GROUP_REMOVE_ADMIN",operationType:"GROUP"},inviteUsersToGroup:{operationName:"GROUP_INVITE_TO_GROUP",operationType:"GROUP"},acceptGroupJoinRequest:{operationName:"GROUP_ACCEPT_JOINPUBLICGROUPAPPL",operationType:"GROUP"},rejectGroupJoinRequest:{operationName:"GROUP_DECLINE_JOINPUBLICGROUPAPPL",operationType:"GROUP"},acceptInvitation:{operationName:"GROUP_ACCEPT_INVITATION",operationType:"GROUP"},rejectInvitation:{operationName:"GROUP_DECLINE_INVITATION",operationType:"GROUP"},removeGroupMembers:{operationName:"GROUP_REMOVE_MEMBERS",operationType:"GROUP"},muteGroupMembers:{operationName:"GROUP_MUTE_MEMBERS",operationType:"GROUP"},unmuteGroupMembers:{operationName:"GROUP_UNMUTE_MEMBERS",operationType:"GROUP"},getGroupMuteList:{operationName:"GROUP_FETCH_MUTES",operationType:"GROUP"},blockGroupMembers:{operationName:"GROUP_BLOCK_MEMBERS",operationType:"GROUP"},unblockGroupMembers:{operationName:"GROUP_UNBLOCK_MEMBERS",operationType:"GROUP"},getGroupBlocklist:{operationName:"GROUP_GET_BLOCK_LIST",operationType:"GROUP"},muteAllGroupMembers:{operationName:"GROUP_MUTE_ALLMEMBERS",operationType:"GROUP"},unmuteAllGroupMembers:{operationName:"GROUP_UNMUTE_ALLMEMBERS",operationType:"GROUP"},addUsersToGroupAllowlist:{operationName:"GROUP_ADD_WHITELIST",operationType:"GROUP"},removeUsersFromGroupAllowlist:{operationName:"GROUP_REMOVE_WHITELIST",operationType:"GROUP"},getGroupAllowlist:{operationName:"GROUP_FETCH_WHITELIST",operationType:"GROUP"},checkIfInGroupAllowList:{operationName:"GROUP_IS_IN_WHITELIST",operationType:"GROUP"},getGroupMessageReadUsers:{operationName:"GROUP_GET_READ_USERS",operationType:"GROUP"},getGroupAnnouncement:{operationName:"GROUP_FETCH_ANNOUNCEMENT",operationType:"GROUP"},updateGroupAnnouncement:{operationName:"GROUP_UPDATE_ANNOUNCEMENT",operationType:"GROUP"},deleteGroupSharedFile:{operationName:"GROUP_DELETE_SHAREDFILE",operationType:"GROUP"},getGroupSharedFileList:{operationName:"GROUP_FETCH_SHAREDFILE",operationType:"GROUP"},setGroupMemberAttributes:{operationName:"GROUP_MEMBER_SET_META_DATA",operationType:"GROUP"},getGroupMembersAttributes:{operationName:"GROUP_MEMBER_FETCH_META_DATA",operationType:"GROUP"},destroyChatRoom:{operationName:"CHATROOM_DESTORYCHATROOM",operationType:"CHATROOM"},updateChatRoomInfo:{operationName:"CHATROOM_CHANGE_ATTRIBUTE",operationType:"CHATROOM"},removeChatRoomMembers:{operationName:"CHATROOM_REMOVE_MEMBERS",operationType:"CHATROOM"},addChatRoomMembers:{operationName:"CHATROOM_ADD_MEMBERS",operationType:"CHATROOM"},getChatRoomMemberList:{operationName:"CHATROOM_FETCH_MEMBERS",operationType:"CHATROOM"},getChatRoomAdminList:{operationName:"CHATROOM_GET_ADMIN",operationType:"CHATROOM"},setChatRoomAdmin:{operationName:"CHATROOM_SET_ADMIN",operationType:"CHATROOM"},removeChatRoomAdmin:{operationName:"CHATROOM_REMOVE_ADMIN",operationType:"CHATROOM"},muteChatRoomMembers:{operationName:"CHATROOM_MUTE_USER",operationType:"CHATROOM"},unmuteChatRoomMembers:{operationName:"CHATROOM_UNMUTE_USER",operationType:"CHATROOM"},getChatRoomMuteList:{operationName:"CHATROOM_FETCH_MUTES",operationType:"CHATROOM"},blockChatRoomMembers:{operationName:"CHATROOM_BLOCK_USERS",operationType:"CHATROOM"},unblockChatRoomMembers:{operationName:"CHATROOM_UNBLOCK_USERS",operationType:"CHATROOM"},getChatRoomBlocklist:{operationName:"CHATROOM_FETCH_BANS",operationType:"CHATROOM"},muteAllChatRoomMembers:{operationName:"CHATROOM_MUTE_ALLMEMEBERS",operationType:"CHATROOM"},unmuteAllChatRoomMembers:{operationName:"CHATROOM_UNMUTE_ALLMEMEBERS",operationType:"CHATROOM"},addUsersToChatRoomAllowlist:{operationName:"CHATROOM_ADD_WHITELIST",operationType:"CHATROOM"},removeUsersFromChatRoomAllowlist:{operationName:"CHATROOM_REMOVE_WHITELIST",operationType:"CHATROOM"},getChatRoomAllowlist:{operationName:"CHATROOM_FETCH_WHITELIST",operationType:"CHATROOM"},checkIfInChatRoomAllowList:{operationName:"CHATROOM_FETCH_MEMBERIN_WHITELIST",operationType:"CHATROOM"},getChatRoomAnnouncement:{operationName:"CHATROOM_FETCH_ANNOUNCEMENT",operationType:"CHATROOM"},updateChatRoomAnnouncement:{operationName:"CHATROOM_UPDATE_ANNOUNCEMENT",operationType:"CHATROOM"},deleteChatRoomSharedFile:{operationName:"CHATROOM_REMOVE_SHARE_FILE",operationType:"CHATROOM"},getChatRoomSharedFileList:{operationName:"CHATROOM_GET_SHARE_FILE_LIST",operationType:"CHATROOM"},setChatRoomAttributes:{operationName:"CHATROOM_SET_META_DATA",operationType:"CHATROOM"},removeChatRoomAttributes:{operationName:"CHATROOM_DELETE_META_DATA",operationType:"CHATROOM"},getChatRoomAttributes:{operationName:"CHATROOM_FETCH_META_DATA",operationType:"CHATROOM"}},te=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").toUpperCase(),oe=e=>{if(Array.isArray(e))return e.length;if(!e||"object"!=typeof e)return;const t=e;for(const o of["entities","data","items","messages","conversations","results"]){const e=t[o];if(Array.isArray(e))return e.length}};exports.AuthenticationError=i,exports.COMMON_ERROR_MAP={common:{validation:{range:"100-110",errors:{MISSING_REQUIRED:{code:110},INVALID_FORMAT:{code:110},UNKNOWN:{code:110}}},auth:{range:"108,200-215",errors:{ALREADY_LOGIN:{code:200},NOT_LOGIN:{code:201},UNAUTHORIZED:{code:202},FORBIDDEN:{code:210},TOKEN_EXPIRED:{code:108},BIND_ANOTHER_DEVICE:{code:213},LOGIN_TOO_MANY_DEVICES:{code:214},USER_MUTED:{code:215}}},connection:{range:"1,100,202,300-304",errors:{TIMEOUT:{code:301},WEBSOCKET_ERROR:{code:300},NOT_CREATED:{code:1},CLOSED_BEFORE_READY:{code:300},CANCELLED:{code:1},PROVISION_TIMEOUT:{code:301},PROVISION_REJECTED:{code:202},PROVISION_CLOSED:{code:300},DNSLIST_FAILED:{code:304},SERVER_BUSY:{code:302}}},storage:{range:"3",errors:{OPERATION_FAILED:{code:3}}},message:{range:"1,300-511",errors:{NOT_CONNECTED:{code:300},ACK_TIMEOUT:{code:301},SEND_FAILED:{code:303},SENDER_DESTROYED:{code:1},ENCODE_FAILED:{code:500},DECODE_FAILED:{code:500},ACK_MISSING:{code:301}}},transport:{range:"2,301,303",errors:{NETWORK_ERROR:{code:2},TIMEOUT:{code:301},HTTP_ERROR:{code:303},BUSINESS_UNKNOWN:{code:303}}},upload:{range:"1,100,110,301,402,405",errors:{REQUIRED_FIELD_MISSING:{code:110},INVALID_APPKEY:{code:100},SIZE_EXCEEDED:{code:405},REQUEST_FAILED:{code:402},TIMEOUT:{code:301},ABORTED:{code:1}}},unknown:{range:"1,4",errors:{UNKNOWN:{code:1},SERVICE_LIMIT_EXCEEDED:{code:4}}},push:{range:"1500,1501,1502",errors:{TOKEN_UPLOAD_FAILED:{code:1500},SILENT_MODE_OPERATION_FAILED:{code:1501},PUSH_LANGUAGE_OPERATION_FAILED:{code:1502}}},chatroom:{range:"700-707",errors:{CHATROOM_INVALID_ID:{code:700},CHATROOM_NOT_JOINED:{code:702},CHATROOM_PERMISSION_DENIED:{code:703},CHATROOM_MEMBERS_FULL:{code:704},CHATROOM_NOT_EXIST:{code:705},CHATROOM_OWNER_NOT_ALLOW_LEAVE:{code:706},CHATROOM_USER_IN_BLOCKLIST:{code:707}}}},apis:{}},exports.CONNECT_TIMEOUT=1e4,exports.ConnectionError=class extends s{constructor(t,o){super(t,o?.code??e.CONNECTION_WEBSOCKET_ERROR,o),this.name="ConnectionError"}},exports.DATA_REPORT_CORRELATION_LIMIT=1e3,exports.DEFAULT_PART_SIZE=5242880,exports.ERROR_CODES=e,exports.GROUP_NAMECARD_HYDRATION_BATCH_SIZE=50,exports.GROUP_NAMECARD_HYDRATION_MAX_CONCURRENCY=5,exports.GROUP_NAMECARD_HYDRATION_MIN_WINDOW_MS=1e3,exports.GROUP_NAMECARD_HYDRATION_WINDOW_MS=7e3,exports.GROUP_SHARED_FILE_DOWNLOAD_TIMEOUT=6e4,exports.GROUP_SHARED_FILE_UPLOAD_TIMEOUT=3e5,exports.HEARTBEAT_INTERVAL=3e4,exports.HEARTBEAT_TIMEOUT=6e4,exports.IMAGE_TYPE_ORIGINAL=A,exports.MAX_POOL=4,exports.MESSAGE_TIMEOUT=15e3,exports.MULTIPART_THRESHOLD=5242880,exports.MessageReceiveError=class extends s{constructor(t,o){super(t,o?.code??e.MESSAGE_DECODE_FAILED,o),this.name="MessageReceiveError"}},exports.MessageSendError=class extends s{constructor(t,o){super(t,o?.code??e.MESSAGE_SEND_FAILED,o),this.name="MessageSendError"}},exports.NetworkError=class extends s{constructor(t,o){super(t,o?.code??e.REST_NETWORK_ERROR,o),this.name="NetworkError"}},exports.PROVISION_TIMEOUT=1e4,exports.RECONNECT_BACKOFF_MULTIPLIER=2,exports.RECONNECT_INITIAL_DELAY=1e3,exports.RECONNECT_MAX_DELAY=6e4,exports.REQUEST_ID_HEADER=V,exports.RestBusinessError=p,exports.RestClient=class{constructor(e,t){this.baseUrl=e.replace(/\/$/,""),this.timeout=t?.timeout??15e3,this.errorMap=t?.errorMap,this.requestAdapter=t?.requestAdapter,this.includeRequestId=t?.includeRequestId??!1,this.defaultHeaders={Accept:"application/json",...t?.headers}}sanitizeUrl(e){try{const t=new URL(e),o=t.searchParams;for(const e of o.keys())o.set(e,"***");const r=o.toString(),s=r?`?${r}`:"";return`${t.origin}${t.pathname}${s}`}catch{return e.split("?")[0]??e}}setAuthToken(e){this.defaultHeaders.Authorization=`Bearer ${e}`}removeAuthToken(){delete this.defaultHeaders.Authorization}buildHttpStatusFallbackError(t,o,r,s){const a={...o.operation?{api:o.operation}:{},url:o.url,method:o.method,httpStatus:t,serverCode:r,serverMessage:s,mapped:!1};if(400===t)return new n("Invalid request parameters",{code:e.VALIDATION_UNKNOWN,details:{...a,canonicalCode:e.VALIDATION_UNKNOWN}});if(401===t){const t=[r,s].some(e=>"string"==typeof e&&/token[ _-]?(?:has[ _-]?)?expired/i.test(e)),o=t?e.AUTH_TOKEN_EXPIRED:e.AUTH_UNAUTHORIZED;return new i(t?"Authentication token expired":"Authentication failed",{code:o,details:{...a,reasonKey:t?"token_expired":"unauthorized",canonicalCode:o}})}return 403===t?new i("Access forbidden",{code:e.AUTH_FORBIDDEN,details:{...a,canonicalCode:e.AUTH_FORBIDDEN}}):429===t?new p("REST rate limit exceeded",{code:e.SERVICE_LIMIT_EXCEEDED,details:{...a,retryable:!0,reasonKey:"request_rate_limited",canonicalCode:e.SERVICE_LIMIT_EXCEEDED}}):t>=500?new p("REST business error: request failed",{code:e.REST_BUSINESS_UNKNOWN,details:{...a,retryable:!0,reasonKey:"server_unknown_error",canonicalCode:e.REST_BUSINESS_UNKNOWN}}):void 0}async request(t,o={}){const r=`${this.baseUrl}${t}`,i=o.method??"GET",n=Date.now(),p=this.sanitizeUrl(r);F.debug("REST request",{method:i,url:p,operation:o.operation});const E=o.operation?(e=>{const t=ee[e];if(t)return t;const o=(e=>{const t=e.toLowerCase();return t.includes("chatroom")||t.includes("chat_room")?"CHATROOM":t.includes("group")?"GROUP":t.includes("contact")||t.includes("blocklist")?"ROSTER":t.includes("userinfo")||t.includes("presence")?"USER":"REST"})(e);return{operationName:`REST_${te(e)}`,operationType:o}})(o.operation):void 0,c=E?J(E):void 0,T=c?.startRequest({requestName:E?.operationName,method:i,url:r});let u=0;const _={...this.defaultHeaders,...o.headers};this.includeRequestId&&(_[V]=K());const O={method:i,headers:_};if(o.body&&"GET"!==i){const e=Object.keys(_).some(e=>"content-type"===e.toLowerCase());"string"==typeof o.body?(e||(_["Content-Type"]="application/x-www-form-urlencoded"),O.body=o.body):(e||(_["Content-Type"]="application/json"),O.body=JSON.stringify(o.body))}else if("GET"===i)for(const e of Object.keys(_))"content-type"===e.toLowerCase()&&delete _[e];try{if(this.requestAdapter){const e=await this.requestAdapter.request({url:r,method:i,headers:_,body:o.body,timeoutMs:o.timeout??this.timeout});u=e.status;const t=((e,t)=>{if("string"!=typeof e)return e;const o=Object.entries(t).find(([e])=>"content-type"===e.toLowerCase()),r=e.trim();if(!(o?.[1].includes("application/json")||r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]")))return e;try{return JSON.parse(r)}catch{return e}})(e.data,e.headers),s=Date.now()-n;(e.status<200||e.status>=300)&&(F.warn("REST response error",{method:i,url:p,status:e.status,duration:s}),this.handleErrorPayload(e.status,"",t,{operation:o.operation,url:r,method:i})),F.debug("REST response",{method:i,url:p,status:e.status,duration:s});const a=oe(t);return T?.finish({code:e.status,success:!0,resultCount:a}),c?.finish({code:0,success:!0,resultCount:a}),t}const e=new AbortController,t=setTimeout(()=>e.abort(),o.timeout??this.timeout),s=await fetch(r,{...O,signal:e.signal});u=s.status,clearTimeout(t);const a=Date.now()-n;s.ok||(F.warn("REST response error",{method:i,url:p,status:s.status,duration:a}),await this.handleErrorResponse(s,{operation:o.operation,url:r,method:i})),F.debug("REST response",{method:i,url:p,status:s.status,duration:a});const E=s.headers.get("content-type");if(E?.includes("application/json")){const e=await s.json(),t=oe(e);return T?.finish({code:s.status,success:!0,resultCount:t}),c?.finish({code:0,success:!0,resultCount:t}),e}const d=await s.text();return T?.finish({code:s.status,success:!0}),c?.finish({code:0,success:!0}),d}catch(d){const t=0!==u?u:d instanceof s?d.code:-1,n=d instanceof Error?d.message:String(d);if(T?.finish({code:t,success:!1,description:n}),c?.finish({code:t,success:!1,description:n}),d instanceof s)throw d;if(d instanceof Error&&"AbortError"===d.name)throw F.warn("REST request timeout",{method:i,url:p,timeout:o.timeout??this.timeout}),new a(`Request timeout: ${r}`,{code:e.REST_TIMEOUT,details:{url:r,method:i,timeout:o.timeout??this.timeout}});throw F.warn("REST request failed",{method:i,url:p}),new a(`Request failed: ${r}`,{code:e.REST_NETWORK_ERROR,details:{url:r,method:i}})}}async handleErrorResponse(e,t){let o;try{o=await e.json()}catch{o=await e.text()}this.handleErrorPayload(e.status,e.statusText,o,t)}handleErrorPayload(t,o,r,s){const i=r&&"object"==typeof r?r:{},n=((e,t)=>{if(!e.error||"object"!=typeof e.error||Array.isArray(e.error))return;const o=e.error,r=o.code;if("number"!=typeof r&&"string"!=typeof r)return;const s=String(r);return/^\d{7}$/.test(s)&&Number(s.slice(0,3))===t?o:void 0})(i,t),p=n?{...i,code:n.code,message:n.message}:r,E=function(e,t,o){if(!e)return;const r=o&&"object"==typeof o?o:{},s="string"==typeof r.error?r.error:void 0,i=(e=>"string"==typeof e.error_code||"number"==typeof e.error_code?e.error_code:"string"==typeof e.errorCode||"number"==typeof e.errorCode?e.errorCode:"string"==typeof e.error||"number"==typeof e.error?e.error:"string"==typeof e.code||"number"==typeof e.code?e.code:void 0)(r),n="string"==typeof r.error_description?r.error_description:"string"==typeof r.message?r.message:void 0,a=(e,t=!1)=>{const o=(e,o,r)=>({reasonKey:e,entry:o,matchedBy:t?"common":r});if(s&&e[s])return o(s,e[s],"key");for(const[s,i]of Object.entries(e))if(Q(i,r))return o(s,i,"field");if(void 0!==i)for(const[r,s]of Object.entries(e)){if(s.code===i||s.canonicalCode===i)return o(r,s,"code");if(Array.isArray(s.aliases)&&s.aliases.includes(String(i)))return o(r,s,"alias")}if(n)for(const[r,s]of Object.entries(e))if(Array.isArray(s.aliases)&&s.aliases.includes(n))return o(r,s,"alias")},p=t?e.apis[t]:void 0,E=p?a(p.errors):void 0;if(E)return E;for(const c of Object.values(e.common)){const e=a(c.errors,!0);if(e)return e}}(this.errorMap,s.operation,p),c="string"==typeof i.error?i.error:void 0,T="number"==typeof i.error_code||"string"==typeof i.error_code?i.error_code:"number"==typeof i.errorCode||"string"==typeof i.errorCode?i.errorCode:"number"==typeof i.code||"string"==typeof i.code?i.code:"string"==typeof i.error?i.error:"number"==typeof n?.code||"string"==typeof n?.code?n.code:void 0,u="string"==typeof i.message?i.message:"string"==typeof i.error_description?i.error_description:"string"==typeof n?.message?n.message:void 0,_=!!(401!==t&&403!==t||void 0!==c&&"unauthorized"!==c&&"auth_failed"!==c&&"forbidden"!==c)&&(void 0!==c||"string"==typeof i.error_description||"string"==typeof i.message);if(s.operation&&E)throw Z({apiName:s.operation,entry:E.entry,serverCode:T,serverMessage:u,httpStatus:t,mapped:!0,reasonKey:E.reasonKey,matchedBy:E.matchedBy});const O=this.buildHttpStatusFallbackError(t,s,T,u);if(O)throw O;if(s.operation&&_)throw Z({apiName:s.operation,serverCode:T,serverMessage:u,httpStatus:t,mapped:!1,reasonKey:c});throw new a(`HTTP ${t}: ${o}`,{code:e.REST_HTTP_ERROR,details:{url:s.url,method:s.method,httpStatus:t}})}get(e,t){return this.request(e,{...t,method:"GET"})}post(e,t,o){return this.request(e,{...o,method:"POST",body:t})}put(e,t,o){return this.request(e,{...o,method:"PUT",body:t})}delete(e,t){return this.request(e,{...t,method:"DELETE"})}patch(e,t,o){return this.request(e,{...o,method:"PATCH",body:t})}},exports.RestTransportError=a,exports.SDKError=s,exports.SESSION_LIST_SYNC_OVERLAP_MS=2e4,exports.SYNC_WEBSOCKET_COMPLETE_CLOSE_DELAY=0,exports.SYNC_WEBSOCKET_CONNECT_TIMEOUT=5e3,exports.SYNC_WEBSOCKET_IDLE_TIMEOUT=1e4,exports.SYNC_WEBSOCKET_RETRY_BACKOFF_MULTIPLIER=2,exports.SYNC_WEBSOCKET_RETRY_INITIAL_DELAY=1e3,exports.SYNC_WEBSOCKET_RETRY_MAX_DELAY=5e3,exports.StorageError=class extends s{constructor(t,o){super(t,o?.code??e.STORAGE_OPERATION_FAILED,o),this.name="StorageError"}},exports.UPLOAD_TIMEOUT=3e5,exports.USER_INFO_HYDRATION_BATCH_SIZE=20,exports.USER_INFO_HYDRATION_MAX_CONCURRENCY=3,exports.USER_INFO_HYDRATION_MAX_RETRIES=1,exports.USER_INFO_HYDRATION_WINDOW_MS=7e3,exports.UploadError=E,exports.ValidationError=n,exports.appendAttachUrlParams=(e,t)=>{if(!e)return"";const o={};return e.includes("em-redirect")||(o["em-redirect"]="true"),t&&!e.includes("share-secret=")&&(o["share-secret"]=t),0===Object.keys(o).length?e:D(e,o)},exports.appendUrlQueryParams=D,exports.applyDataReportDnsSwitch=e=>{X?.applyDnsSwitch(e)},exports.buildAttachmentPrecheckDecision=e=>{const t=(o=e.messageType,r=e.imageType,"image"!==o?"attachment":r===A?"image-origin":"image-big");var o,r;const s=(e=>"image-origin"===e?204800:1048576)(t),i=e.fileSize>s;return{shouldPrecheck:i,thresholdType:t,thresholdBytes:s,actualBytes:e.fileSize,reason:i?"threshold-exceeded":"below-threshold"}},exports.buildUploadResult=t=>{const o=t.response.entities?.[0];if(!o?.uuid)throw new E("Upload response missing uuid",{code:e.UPLOAD_REQUEST_FAILED,details:{response:t.response}});const r=o["share-secret"],s=o["file-metadata"]??{},i="number"==typeof s["content-length"]?s["content-length"]:t.fallbackSize,n="string"==typeof s["content-type"]?s["content-type"]:t.fileType,a=`${t.restBaseUrl}/${t.orgName}/${t.appName}/chatfiles/${o.uuid}`;if("image"===t.messageType){const e=(t.imageType??I)===A;return{...M(a,{deriveVariants:!t.useCustomAttachmentUpload}),isOriginalImage:e,secret:r,fileLength:i,filetype:n,filename:t.fileName,width:t.width,height:t.height}}const p="video"===t.messageType?`${a}?vframe=true`:void 0;return{url:a,secret:r,fileLength:i,filetype:n,filename:t.fileName,thumbnailUrl:p}},exports.createRestBusinessError=Z,exports.createTraceId=K,exports.deriveImageUrls=M,exports.fromProtocolImageType=e=>2===e?I:A,exports.getRuntimeGlobal=k,exports.installDataReporter=e=>(X?.reset(),X=new Y(e),X),exports.isRemoteUrl=S,exports.isSDKError=function(e){if(e instanceof s)return!0;if("object"!=typeof e||null===e)return!1;const t=e;return"string"==typeof t.name&&"string"==typeof t.message&&"number"==typeof t.code&&"function"==typeof t.toJSON},exports.logger=F,exports.mergeRuntimeErrorMaps=(...e)=>{const t={},o={};for(const r of e)Object.assign(t,r.common),Object.assign(o,r.apis);return{common:t,apis:o}},exports.normalizeAttachmentFile=(t,o)=>{if(!t)throw new E("Attachment file is required",{code:e.UPLOAD_REQUIRED_FIELD_MISSING,details:{reason:"file missing"}});const r=("number"==typeof o.fileLength?o.fileLength:void 0)??("fileSize"in o&&"number"==typeof o.fileSize?o.fileSize:void 0),s=R({file:t,fallbackName:o.filename,fallbackMimeType:o.filetype,fallbackSize:r});if("web-file"===s.source.sourceType&&!s.webFile)throw new E("Attachment file is required",{code:e.UPLOAD_REQUIRED_FIELD_MISSING,details:{reason:"web file missing"}});return s},exports.normalizeUploadSource=R,exports.parseAppKey=f,exports.parseAttachmentPrecheckResult=t=>{const o=t.entities?.[0],r=!0===o?.exists,s="string"==typeof o?.uuid&&o.uuid.length>0?o.uuid:void 0,i=o,n=i?.["exists-type"]??i?.existsType,a="origin"===n?A:n===I||n===A?n:void 0,p="string"==typeof o?.["share-secret"]?o["share-secret"]:void 0;if(r&&!s)throw new E("Upload precheck response missing uuid",{code:e.UPLOAD_REQUEST_FAILED,details:{response:t}});return{uuid:s,exists:r,existsType:a,shareSecret:p,hit:(c={exists:r,uuid:s},c.exists&&"string"==typeof c.uuid&&c.uuid.length>0)};var c},exports.reportLogsNow=async function(){await g.reportNow()},exports.resetDataReporter=()=>{X?.reset(),X=void 0},exports.resolveImageSendPolicy=e=>e.isGif?{resolvedImageType:A,reason:"gif-force-origin"}:e.isOriginalImage?{resolvedImageType:A,reason:"explicit-original"}:{resolvedImageType:I,reason:"default-large"},exports.sanitizeErrorDetails=r,exports.sanitizeErrorUrl=o,exports.setLogLevel=function(e){v instanceof B&&v.setLevel(e)},exports.setLogReportInterval=function(e){g.updateReportInterval(e)},exports.setLogReportState=function(e){g.setState(e)},exports.shouldUploadByUrl=(e,t)=>!!t||(!e||!S(e)),exports.startDataReportOperation=J,exports.startDataReportSession=e=>X?.startSession(e),exports.stopLogReporter=function(){g.stop()},exports.toProtocolImageType=e=>e===A?1:2,exports.toUploadChatType=e=>"singleChat"===e?m:"groupChat"===e?h:N,exports.toUploadImageType=e=>e===A?"origin":"large",exports.updateDataReportNetworkType=e=>{X?.updateNetworkType(e)},exports.updateDataReportSession=e=>{X?.updateSession(e)},exports.updateLogReportContext=function(e){g.updateContext(e)};