openclaw-openagent 1.0.1 → 1.0.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 (187) hide show
  1. package/dist/index.d.ts +25 -0
  2. package/dist/index.js +105 -0
  3. package/dist/src/app/channel-tools.d.ts +28 -0
  4. package/dist/src/app/channel-tools.js +251 -0
  5. package/dist/src/app/discovery-tools.d.ts +35 -0
  6. package/dist/src/app/discovery-tools.js +243 -0
  7. package/dist/src/app/download-file-tool.d.ts +10 -0
  8. package/dist/src/app/download-file-tool.js +104 -0
  9. package/dist/src/app/hooks.d.ts +14 -0
  10. package/dist/src/app/hooks.js +118 -0
  11. package/dist/src/app/index.d.ts +13 -0
  12. package/dist/src/app/index.js +44 -0
  13. package/dist/src/app/messaging-tools.d.ts +11 -0
  14. package/dist/src/app/messaging-tools.js +79 -0
  15. package/dist/src/app/ops-tools.d.ts +21 -0
  16. package/dist/src/app/ops-tools.js +158 -0
  17. package/dist/src/app/remote-agent-tool.d.ts +27 -0
  18. package/dist/src/app/remote-agent-tool.js +461 -0
  19. package/dist/src/app/types.d.ts +61 -0
  20. package/dist/src/app/types.js +11 -0
  21. package/dist/src/app/upload-file-tool.d.ts +16 -0
  22. package/dist/src/app/upload-file-tool.js +353 -0
  23. package/dist/src/app/verbose-preflight.d.ts +2 -0
  24. package/dist/src/app/verbose-preflight.js +145 -0
  25. package/dist/src/auth/config.d.ts +79 -0
  26. package/dist/src/auth/config.js +133 -0
  27. package/dist/src/auth/credential-manager.d.ts +65 -0
  28. package/dist/src/auth/credential-manager.js +122 -0
  29. package/dist/src/auth/index.d.ts +6 -0
  30. package/dist/src/auth/index.js +6 -0
  31. package/dist/src/auth/verify.d.ts +42 -0
  32. package/dist/src/auth/verify.js +60 -0
  33. package/dist/src/channel.d.ts +269 -0
  34. package/dist/src/channel.js +488 -0
  35. package/dist/src/compat.d.ts +37 -0
  36. package/dist/src/compat.js +70 -0
  37. package/dist/src/config/config-schema.d.ts +56 -0
  38. package/dist/src/config/config-schema.js +34 -0
  39. package/dist/src/messaging/aggregator.d.ts +25 -0
  40. package/dist/src/messaging/aggregator.js +90 -0
  41. package/dist/src/messaging/collector.d.ts +27 -0
  42. package/dist/src/messaging/collector.js +76 -0
  43. package/dist/src/messaging/executor.d.ts +14 -0
  44. package/dist/src/messaging/executor.js +59 -0
  45. package/dist/src/messaging/inbound.d.ts +97 -0
  46. package/dist/src/messaging/inbound.js +63 -0
  47. package/dist/src/messaging/index.d.ts +10 -0
  48. package/dist/src/messaging/index.js +9 -0
  49. package/dist/src/messaging/mention-protocol.d.ts +42 -0
  50. package/dist/src/messaging/mention-protocol.js +74 -0
  51. package/dist/src/messaging/process-c2c-request.d.ts +55 -0
  52. package/dist/src/messaging/process-c2c-request.js +445 -0
  53. package/dist/src/messaging/process-message.d.ts +62 -0
  54. package/dist/src/messaging/process-message.js +282 -0
  55. package/dist/src/messaging/scheduler.d.ts +17 -0
  56. package/dist/src/messaging/scheduler.js +47 -0
  57. package/dist/src/messaging/types.d.ts +34 -0
  58. package/dist/src/messaging/types.js +4 -0
  59. package/dist/src/plugin-ui/assets/openagent-override.js +9267 -0
  60. package/dist/src/plugin-ui/index.d.ts +13 -0
  61. package/dist/src/plugin-ui/index.js +16 -0
  62. package/dist/src/plugin-ui/ui-extension-loader/backup.d.ts +23 -0
  63. package/dist/src/plugin-ui/ui-extension-loader/backup.js +82 -0
  64. package/dist/src/plugin-ui/ui-extension-loader/index.d.ts +28 -0
  65. package/dist/src/plugin-ui/ui-extension-loader/index.js +240 -0
  66. package/dist/src/plugin-ui/ui-extension-loader/locator.d.ts +35 -0
  67. package/dist/src/plugin-ui/ui-extension-loader/locator.js +129 -0
  68. package/dist/src/plugin-ui/ui-extension-loader/manifest.d.ts +26 -0
  69. package/dist/src/plugin-ui/ui-extension-loader/manifest.js +45 -0
  70. package/dist/src/plugin-ui/ui-extension-loader/registry-regex.d.ts +9 -0
  71. package/dist/src/plugin-ui/ui-extension-loader/registry-regex.js +701 -0
  72. package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.d.ts +8 -0
  73. package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.js +58 -0
  74. package/dist/src/plugin-ui/ui-extension-loader/types.d.ts +55 -0
  75. package/dist/src/plugin-ui/ui-extension-loader/types.js +23 -0
  76. package/dist/src/proxy/auth-proxy.d.ts +20 -0
  77. package/dist/src/proxy/auth-proxy.js +337 -0
  78. package/dist/src/runtime/account.d.ts +156 -0
  79. package/dist/src/runtime/account.js +491 -0
  80. package/dist/src/runtime/index.d.ts +5 -0
  81. package/dist/src/runtime/index.js +6 -0
  82. package/dist/src/runtime/plugin-runtime.d.ts +40 -0
  83. package/dist/src/runtime/plugin-runtime.js +72 -0
  84. package/dist/src/runtime/registry.d.ts +41 -0
  85. package/dist/src/runtime/registry.js +60 -0
  86. package/dist/src/sdk/CLASS_MAP.md +143 -0
  87. package/dist/src/sdk/index.d.ts +126 -0
  88. package/dist/src/sdk/index.js +23990 -0
  89. package/dist/src/sdk/modules/cloud-search-module.js +1117 -0
  90. package/dist/src/sdk/modules/follow-module.js +1069 -0
  91. package/dist/src/sdk/modules/group-module.js +7397 -0
  92. package/dist/src/sdk/modules/relationship-module.js +2269 -0
  93. package/dist/src/sdk/modules/signaling-module.js +1468 -0
  94. package/dist/src/sdk/modules/tim-upload-plugin.js +730 -0
  95. package/dist/src/sdk/node-env/http-request.js +90 -0
  96. package/dist/src/sdk/node-env/index.js +57 -0
  97. package/dist/src/sdk/node-env/storage.js +114 -0
  98. package/dist/src/sdk/package.json +10 -0
  99. package/dist/src/sdk/sdk/CLASS_MAP.md +143 -0
  100. package/dist/src/sdk/sdk/index.d.ts +126 -0
  101. package/dist/src/sdk/sdk/index.js +23990 -0
  102. package/dist/src/sdk/sdk/modules/cloud-search-module.js +1117 -0
  103. package/dist/src/sdk/sdk/modules/follow-module.js +1069 -0
  104. package/dist/src/sdk/sdk/modules/group-module.js +7397 -0
  105. package/dist/src/sdk/sdk/modules/relationship-module.js +2269 -0
  106. package/dist/src/sdk/sdk/modules/signaling-module.js +1468 -0
  107. package/dist/src/sdk/sdk/modules/tim-upload-plugin.js +730 -0
  108. package/dist/src/sdk/sdk/node-env/http-request.js +90 -0
  109. package/dist/src/sdk/sdk/node-env/index.js +57 -0
  110. package/dist/src/sdk/sdk/node-env/storage.js +114 -0
  111. package/dist/src/sdk/sdk/package.json +10 -0
  112. package/dist/src/sdk/sdk/tsconfig.json +16 -0
  113. package/dist/src/sdk/tsconfig.json +16 -0
  114. package/dist/src/state/pending-invocation-store.d.ts +26 -0
  115. package/dist/src/state/pending-invocation-store.js +39 -0
  116. package/dist/src/state/store.d.ts +165 -0
  117. package/dist/src/state/store.js +535 -0
  118. package/dist/src/tim/c2c.d.ts +83 -0
  119. package/dist/src/tim/c2c.js +318 -0
  120. package/dist/src/tim/channels.d.ts +95 -0
  121. package/dist/src/tim/channels.js +279 -0
  122. package/dist/src/tim/client.d.ts +54 -0
  123. package/dist/src/tim/client.js +268 -0
  124. package/dist/src/tim/index.d.ts +6 -0
  125. package/dist/src/tim/index.js +6 -0
  126. package/dist/src/tim/messages.d.ts +50 -0
  127. package/dist/src/tim/messages.js +104 -0
  128. package/dist/src/tim/sdk-logger-init.d.ts +13 -0
  129. package/dist/src/tim/sdk-logger-init.js +46 -0
  130. package/dist/src/tools.d.ts +9 -0
  131. package/dist/src/tools.js +8 -0
  132. package/dist/src/transport/factory.d.ts +63 -0
  133. package/dist/src/transport/factory.js +54 -0
  134. package/dist/src/transport/oasn/index.d.ts +12 -0
  135. package/dist/src/transport/oasn/index.js +9 -0
  136. package/dist/src/transport/oasn/oasn-agent-card.d.ts +38 -0
  137. package/dist/src/transport/oasn/oasn-agent-card.js +102 -0
  138. package/dist/src/transport/oasn/oasn-discovery.d.ts +33 -0
  139. package/dist/src/transport/oasn/oasn-discovery.js +97 -0
  140. package/dist/src/transport/oasn/oasn-files.d.ts +64 -0
  141. package/dist/src/transport/oasn/oasn-files.js +174 -0
  142. package/dist/src/transport/oasn/oasn-http.d.ts +98 -0
  143. package/dist/src/transport/oasn/oasn-http.js +362 -0
  144. package/dist/src/transport/oasn/oasn-invocation.d.ts +154 -0
  145. package/dist/src/transport/oasn/oasn-invocation.js +432 -0
  146. package/dist/src/transport/oasn/oasn-normalize.d.ts +6 -0
  147. package/dist/src/transport/oasn/oasn-normalize.js +112 -0
  148. package/dist/src/transport/oasn/oasn-register.d.ts +19 -0
  149. package/dist/src/transport/oasn/oasn-register.js +24 -0
  150. package/dist/src/transport/oasn/oasn-transport.d.ts +114 -0
  151. package/dist/src/transport/oasn/oasn-transport.js +230 -0
  152. package/dist/src/transport/oasn/oasn-types.d.ts +331 -0
  153. package/dist/src/transport/oasn/oasn-types.js +44 -0
  154. package/dist/src/transport/tim/index.d.ts +7 -0
  155. package/dist/src/transport/tim/index.js +6 -0
  156. package/dist/src/transport/tim/tim-transport.d.ts +122 -0
  157. package/dist/src/transport/tim/tim-transport.js +402 -0
  158. package/dist/src/transport/types.d.ts +450 -0
  159. package/dist/src/transport/types.js +38 -0
  160. package/dist/src/util/http.d.ts +21 -0
  161. package/dist/src/util/http.js +93 -0
  162. package/dist/src/util/logger.d.ts +20 -0
  163. package/dist/src/util/logger.js +100 -0
  164. package/dist/src/util/url-resolver.d.ts +7 -0
  165. package/dist/src/util/url-resolver.js +20 -0
  166. package/index.ts +11 -0
  167. package/openclaw.plugin.json +9 -0
  168. package/package.json +7 -4
  169. package/src/app/download-file-tool.ts +133 -0
  170. package/src/app/hooks.ts +89 -5
  171. package/src/app/index.ts +6 -0
  172. package/src/app/remote-agent-tool.ts +46 -0
  173. package/src/app/types.ts +1 -0
  174. package/src/app/upload-file-tool.ts +411 -0
  175. package/src/plugin-ui/assets/openagent-override.js +1 -63
  176. package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -61
  177. package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -1
  178. package/src/plugin-ui/ui-extension-loader/registry-regex.ts +30 -13
  179. package/src/runtime/account.ts +0 -23
  180. package/src/transport/oasn/oasn-files.ts +5 -5
  181. package/src/transport/oasn/oasn-invocation.ts +44 -2
  182. package/src/transport/oasn/oasn-normalize.ts +0 -26
  183. package/src/transport/oasn/oasn-register.ts +8 -81
  184. package/src/transport/oasn/oasn-transport.ts +9 -32
  185. package/src/transport/oasn/oasn-types.ts +53 -6
  186. package/src/transport/types.ts +33 -36
  187. package/src/util/url-resolver.ts +17 -0
@@ -0,0 +1,1117 @@
1
+ let e = 4,
2
+ t = 11,
3
+ s = 12,
4
+ o = 20,
5
+ n = 23,
6
+ i = 27;
7
+ class r {
8
+ constructor(e = 0, t = 0) {
9
+ ((this.high = e), (this.low = t));
10
+ }
11
+ equal(e) {
12
+ return null !== e && this.low === e.low && this.high === e.high;
13
+ }
14
+ toString() {
15
+ var e = Number(this.high).toString(16);
16
+ let t = Number(this.low).toString(16);
17
+ if (t.length < 8) {
18
+ let e = 8 - t.length;
19
+ for (; e; ) ((t = "0" + t), e--);
20
+ }
21
+ return e + t;
22
+ }
23
+ }
24
+ let c = {
25
+ TEST: {
26
+ CHINA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
27
+ OVERSEA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
28
+ SINGAPORE: { DEFAULT: "wss://wsssgp-dev.im.qcloud.com" },
29
+ KOREA: { DEFAULT: "wss://wsskr-dev.im.qcloud.com" },
30
+ GERMANY: { DEFAULT: "wss://wssger-dev.im.qcloud.com" },
31
+ IND: { DEFAULT: "wss://wssind-dev.im.qcloud.com" },
32
+ JPN: { DEFAULT: "wss://wssjpn-dev.im.qcloud.com" },
33
+ USA: { DEFAULT: "wss://wssusa-dev.im.qcloud.com" },
34
+ INDONESIA: { DEFAULT: "wss://wssidn-dev.im.qcloud.com" },
35
+ },
36
+ PRODUCTION: {
37
+ CHINA: {
38
+ DEFAULT0: "wss://*w4c.my-imcloud.com",
39
+ DEFAULT: "wss://wss.im.qcloud.com",
40
+ IPV6: "wss://wssv6.im.qcloud.com",
41
+ BACKUP: "wss://wss.tim.qq.com",
42
+ BACKUP_WEB: "wss://*w4c.my-cpaas.com",
43
+ BACKUP_CN: "wss://wss.im.tencent.cn",
44
+ STAT: "https://events.im.qcloud.com",
45
+ ANYCAST: "wss://162.14.13.203",
46
+ },
47
+ OVERSEA: {
48
+ DEFAULT0: "wss://*w4c.my-imcloud.com",
49
+ DEFAULT: "wss://wss.im.qcloud.com",
50
+ IPV6: "wss://wssv6.im.qcloud.com",
51
+ BACKUP: "wss://wss.my-imcloud.com",
52
+ BACKUP_WEB: "wss://*w4c.my-cpaas.com",
53
+ BACKUP_CN: "wss://wss.im.tencent.cn",
54
+ STAT: "https://api.my-imcloud.com",
55
+ },
56
+ SINGAPORE: {
57
+ DEFAULT0: "wss://*w4s.my-imcloud.com",
58
+ DEFAULT: "wss://wsssgp.im.qcloud.com",
59
+ IPV6: "wss://wsssgpv6.im.qcloud.com",
60
+ BACKUP: "wss://wsssgp.my-imcloud.com",
61
+ BACKUP_WEB: "wss://*w4s.my-cpaas.com",
62
+ STAT: "https://apisgp.my-imcloud.com",
63
+ ANYCAST: "wss://162.14.19.159",
64
+ },
65
+ KOREA: {
66
+ DEFAULT0: "wss://*w4k.my-imcloud.com",
67
+ DEFAULT: "wss://wsskr.im.qcloud.com",
68
+ IPV6: "wss://wsskrv6.im.qcloud.com",
69
+ BACKUP: "wss://wsskr.my-imcloud.com",
70
+ BACKUP_WEB: "wss://*w4k.my-cpaas.com",
71
+ STAT: "https://apikr.my-imcloud.com",
72
+ ANYCAST: "wss://162.14.13.104",
73
+ },
74
+ GERMANY: {
75
+ DEFAULT0: "wss://*w4g.my-imcloud.com",
76
+ DEFAULT: "wss://wssger.im.qcloud.com",
77
+ IPV6: "wss://wssgerv6.im.qcloud.com",
78
+ BACKUP: "wss://wssger.my-imcloud.com",
79
+ BACKUP_WEB: "wss://*w4g.my-cpaas.com",
80
+ STAT: "https://apiger.my-imcloud.com",
81
+ ANYCAST: "wss://162.14.3.17",
82
+ },
83
+ IND: {
84
+ DEFAULT0: "wss://*w4i.my-imcloud.com",
85
+ DEFAULT: "wss://wssind.my-imcloud.com",
86
+ IPV6: "wss://wssindv6.im.qcloud.com",
87
+ BACKUP: "wss://wssind.im.qcloud.com",
88
+ BACKUP_WEB: "wss://*w4i.my-cpaas.com",
89
+ STAT: "https://apiind.my-imcloud.com",
90
+ ANYCAST: "wss://162.14.19.46",
91
+ },
92
+ JPN: {
93
+ DEFAULT0: "wss://*w4j.my-imcloud.com",
94
+ DEFAULT: "wss://wssjpn.im.qcloud.com",
95
+ IPV6: "wss://wssjpnv6.im.qcloud.com",
96
+ BACKUP: "wss://wssjpn.my-imcloud.com",
97
+ BACKUP_WEB: "wss://*w4j.my-cpaas.com",
98
+ STAT: "https://apijpn.my-imcloud.com",
99
+ ANYCAST: "wss://162.14.13.254",
100
+ },
101
+ USA: {
102
+ DEFAULT0: "wss://*w4u.my-imcloud.com",
103
+ DEFAULT: "wss://wssusa.im.qcloud.com",
104
+ IPV6: "wss://wssusav6.im.qcloud.com",
105
+ BACKUP: "wss://wssusa.my-imcloud.com",
106
+ BACKUP_WEB: "wss://*w4u.my-cpaas.com",
107
+ STAT: "https://apiusa.my-imcloud.com",
108
+ ANYCAST: "wss://162.14.10.42",
109
+ },
110
+ INDONESIA: {
111
+ DEFAULT0: "wss://*w4y.my-imcloud.com",
112
+ DEFAULT: "wss://wssidn.im.qcloud.com",
113
+ IPV6: "wss://wssidnv6.im.qcloud.com",
114
+ BACKUP: "wss://wssidn.my-imcloud.com",
115
+ BACKUP_WEB: "wss://*w4y.my-cpaas.com",
116
+ STAT: "https://apiidn.my-imcloud.com",
117
+ ANYCAST: "wss://43.129.34.169",
118
+ },
119
+ },
120
+ },
121
+ u = {
122
+ ANDROID: 2,
123
+ IOS: 3,
124
+ MAC: 4,
125
+ WEB: 7,
126
+ WX_MP: 8,
127
+ QQ_MP: 9,
128
+ TT_MP: 10,
129
+ BAIDU_MP: 11,
130
+ ALI_MP: 12,
131
+ IPAD: 13,
132
+ UNI_NATIVE_APP: 15,
133
+ DONUT_NATIVE_APP: 19,
134
+ NS_NATIVE_APP: 20,
135
+ RN_NATIVE_APP: 21,
136
+ },
137
+ m = "CHINA",
138
+ a = {
139
+ HOST: {
140
+ CURRENT: {
141
+ DEFAULT: "wss://wss.im.qcloud.com",
142
+ STAT: "https://events.im.qcloud.com",
143
+ },
144
+ setCurrent(e = m) {
145
+ this.CURRENT = c.PRODUCTION[e];
146
+ },
147
+ },
148
+ NAME: {
149
+ OPEN_IM: "openim",
150
+ OPEN_IM_MSG_EXT: "openim_msg_ext_http_svc",
151
+ GRP: "group_open_http_svc",
152
+ GRP_AV: "group_open_avchatroom_http_svc",
153
+ GRP_COMMUNITY: "million_group_open_http_svc",
154
+ GRP_ATTR: "group_open_attr_http_svc",
155
+ FD: "sns",
156
+ PROFILE: "profile",
157
+ RECENT_CONTACT: "recentcontact",
158
+ PIC: "openpic",
159
+ BIG_GRP_NO_AUTH: "group_open_http_noauth_svc",
160
+ BIG_GRP_POLLING: "group_open_long_polling_http_svc",
161
+ BIG_GRP_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc",
162
+ IM_OPEN_STAT: "imopenstat",
163
+ WEB_IM: "webim",
164
+ IM_COS_SIGN: "im_cos_sign_svr",
165
+ CUSTOM_UPLOAD: "im_cos_msg",
166
+ HEARTBEAT: "heartbeat",
167
+ IM_OPEN_PUSH: "im_open_push",
168
+ IM_OPEN_STATUS: "im_open_status",
169
+ IM_LONG_MSG: "im_long_msg",
170
+ IM_CONFIG_MANAGER: "im_sdk_config_mgr",
171
+ STAT_SERVICE: "StatSvc",
172
+ OVERLOAD_PUSH: "OverLoadPush",
173
+ IM_MSG_AUDIT_MGR: "im_msg_audit_mgr",
174
+ TUIROOM_SVR: "tui_room_svr",
175
+ IM_OPEN_TRANSLATE: "im_open_translate",
176
+ IM_OPEN_SPEECH: "im_open_speech",
177
+ MSG_SEARCH: "message_search",
178
+ GRP_SEARCH: "group_search",
179
+ GRP_MEMBER_SEARCH: "group_member_search",
180
+ USER_SEARCH: "user_search",
181
+ FOLLOW: "follow",
182
+ OFFLINE_PUSH_REPORT: "offline_push_report",
183
+ IM_MSG_LOGIC: "im_msg_db_logic",
184
+ },
185
+ },
186
+ l =
187
+ (new r(0, Math.pow(2, 1)).toString(),
188
+ new r(0, Math.pow(2, 2)).toString(),
189
+ new r(0, Math.pow(2, 3)).toString(),
190
+ new r(0, Math.pow(2, 4)).toString(),
191
+ new r(0, Math.pow(2, 6)).toString(),
192
+ new r(0, Math.pow(2, 7)).toString(),
193
+ new r(0, Math.pow(2, 9)).toString(),
194
+ new r(0, Math.pow(2, 10)).toString(),
195
+ new r(0, Math.pow(2, 11)).toString(),
196
+ new r(0, Math.pow(2, 13)).toString(),
197
+ new r(0, Math.pow(2, 15)).toString(),
198
+ new r(Math.pow(2, 6)).toString(),
199
+ new r(Math.pow(2, 7)).toString(),
200
+ new r(Math.pow(2, 8)).toString(),
201
+ new r(Math.pow(2, 9)).toString(),
202
+ new r(Math.pow(2, 10)).toString(),
203
+ new r(Math.pow(2, 16)).toString(),
204
+ new r(Math.pow(2, 20)).toString(),
205
+ a.HOST.setCurrent(m),
206
+ "undefined" != typeof wx &&
207
+ "function" == typeof wx.getSystemInfoSync &&
208
+ ("mac" === wx.getSystemInfoSync().platform ||
209
+ "windows" === wx.getSystemInfoSync().platform) &&
210
+ void 0 === wx.getSystemInfoSync().uniPlatform),
211
+ g =
212
+ ("undefined" != typeof wx &&
213
+ "function" == typeof wx.getSystemInfoSync &&
214
+ Boolean(wx.getSystemInfoSync().fontSizeSetting)) ||
215
+ l,
216
+ h =
217
+ (g && wx.createGamePortal,
218
+ "undefined" != typeof qq &&
219
+ "function" == typeof qq.getSystemInfoSync &&
220
+ Boolean(qq.getSystemInfoSync().fontSizeSetting)),
221
+ d =
222
+ "undefined" != typeof tt &&
223
+ "function" == typeof tt.getSystemInfoSync &&
224
+ Boolean(tt.getSystemInfoSync().fontSizeSetting),
225
+ p =
226
+ "undefined" != typeof swan &&
227
+ "function" == typeof swan.getSystemInfoSync &&
228
+ Boolean(swan.getSystemInfoSync().fontSizeSetting),
229
+ f =
230
+ "undefined" != typeof my &&
231
+ "function" == typeof my.getSystemInfoSync &&
232
+ Boolean(my.getSystemInfoSync().fontSizeSetting),
233
+ w = "undefined" != typeof jd && "function" == typeof jd.getSystemInfoSync,
234
+ _ =
235
+ "undefined" != typeof uni &&
236
+ "undefined" == typeof window &&
237
+ "function" == typeof uni.requireNativePlugin,
238
+ S = g && "object" == typeof wx.miniapp,
239
+ y = (d && tt.enterChat, g || h || d || p || f || _ || w),
240
+ T =
241
+ "undefined" == typeof window &&
242
+ !y &&
243
+ "undefined" != typeof global &&
244
+ void 0 !== global.NativeScriptGlobals,
245
+ A =
246
+ "undefined" != typeof global &&
247
+ (void 0 !== global.nativeModuleProxy || void 0 !== global.ReactNative),
248
+ M = "undefined" != typeof uni ? !y : "undefined" != typeof window && !y && !A,
249
+ I =
250
+ (h ? qq : d ? tt : p ? swan : f ? my : g ? wx : _ ? uni : w && jd,
251
+ (M && window && window.navigator && window.navigator.userAgent) || ""),
252
+ E = /(micromessenger|webbrowser)/i.test(I),
253
+ P = (function () {
254
+ let e = "WEB";
255
+ return (
256
+ E
257
+ ? (e = "WEB")
258
+ : h
259
+ ? (e = "QQ_MP")
260
+ : d
261
+ ? (e = "TT_MP")
262
+ : p
263
+ ? (e = "BAIDU_MP")
264
+ : f
265
+ ? (e = "ALI_MP")
266
+ : g
267
+ ? (e = S ? "DONUT_NATIVE_APP" : "WX_MP")
268
+ : _
269
+ ? (e = "UNI_NATIVE_APP")
270
+ : T
271
+ ? (e = "NS_NATIVE_APP")
272
+ : A && (e = "RN_NATIVE_APP"),
273
+ u[e]
274
+ );
275
+ })(),
276
+ C =
277
+ (!(function () {
278
+ var e = I.match(/OS (\d+)_/i);
279
+ e && e[1] && e[1];
280
+ })(),
281
+ (function () {
282
+ var e,
283
+ t,
284
+ s = I.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
285
+ s &&
286
+ ((e = s[1] && parseFloat(s[1])), (t = s[2] && parseFloat(s[2])), e) &&
287
+ t &&
288
+ parseFloat(s[1] + "." + s[2]);
289
+ })(),
290
+ /MSIE/.test(I) || (-1 < I.indexOf("Trident") && -1 < I.indexOf("rv:11.0"))),
291
+ N,
292
+ v,
293
+ b =
294
+ (!(function () {
295
+ var e = /MSIE\s(\d+)\.\d/.exec(I),
296
+ e = e && parseFloat(e[1]);
297
+ !e && /Trident\/7.0/i.test(I) && /rv:11.0/.test(I);
298
+ })(),
299
+ (N =
300
+ "undefined" != typeof console
301
+ ? console
302
+ : "undefined" != typeof global && global.console
303
+ ? global.console
304
+ : "undefined" != typeof window && window.console
305
+ ? window.console
306
+ : {}),
307
+ function () {}),
308
+ U = [
309
+ "assert",
310
+ "clear",
311
+ "count",
312
+ "debug",
313
+ "dir",
314
+ "dirxml",
315
+ "error",
316
+ "group",
317
+ "groupCollapsed",
318
+ "groupEnd",
319
+ "info",
320
+ "log",
321
+ "profile",
322
+ "profileEnd",
323
+ "table",
324
+ "time",
325
+ "timeEnd",
326
+ "timeStamp",
327
+ "trace",
328
+ "warn",
329
+ ],
330
+ D = U.length;
331
+ for (; D--; ) ((v = U[D]), console[v] || (N[v] = b));
332
+ var O = N;
333
+ let L = "C2C",
334
+ R = "GROUP",
335
+ q = function () {
336
+ return new Date().getTime() + 0;
337
+ },
338
+ F = Object.prototype.hasOwnProperty,
339
+ x = function (e) {
340
+ return "map" === Y(e);
341
+ },
342
+ B = function (e) {
343
+ return "set" === Y(e);
344
+ },
345
+ k = function (e) {
346
+ return "file" === Y(e);
347
+ },
348
+ G = function (e) {
349
+ return (
350
+ null !== e &&
351
+ (("number" == typeof e && !isNaN(+e)) ||
352
+ ("object" == typeof e && e.constructor === Number))
353
+ );
354
+ },
355
+ j = function (e) {
356
+ return "string" == typeof e;
357
+ },
358
+ $ = function (e) {
359
+ if ("object" != typeof e || null === e) return !1;
360
+ e = Object.getPrototypeOf(e);
361
+ if (null === e) return !0;
362
+ let t = e;
363
+ for (; null !== Object.getPrototypeOf(t); ) t = Object.getPrototypeOf(t);
364
+ return e === t;
365
+ },
366
+ K = function (e) {
367
+ return "function" == typeof Array.isArray
368
+ ? Array.isArray(e)
369
+ : "array" === Y(e);
370
+ },
371
+ V = function (e) {
372
+ return K(e) && 0 < e.length;
373
+ },
374
+ W = function (e) {
375
+ return void 0 === e;
376
+ },
377
+ H = function (e) {
378
+ return K(e) || (null !== e && "object" == typeof e);
379
+ },
380
+ Y = function (e) {
381
+ return Object.prototype.toString
382
+ .call(e)
383
+ .match(/^\[object (.*)\]$/)[1]
384
+ .toLowerCase();
385
+ },
386
+ z =
387
+ (Date.now ||
388
+ (Date.now = function () {
389
+ return new Date().getTime();
390
+ }),
391
+ function (s, r, o, i) {
392
+ if (!H(s) || !H(r)) return 0;
393
+ let n = 0;
394
+ var a,
395
+ m = Object.keys(r);
396
+ for (let e = 0, t = m.length; e < t; e++)
397
+ if (((a = m[e]), !(W(r[a]) || (o && o.includes(a)))))
398
+ if (H(s[a]) && H(r[a])) n += z(s[a], r[a], o, i);
399
+ else {
400
+ if (i && i.includes(r[a])) continue;
401
+ s[a] !== r[a] && ((s[a] = r[a]), (n += 1));
402
+ }
403
+ return n;
404
+ });
405
+ function J() {
406
+ return !C && !y;
407
+ }
408
+ let Q = 0;
409
+ function X() {
410
+ return J() ? "%c Chat %c" : "Chat";
411
+ }
412
+ function Z() {
413
+ (e = new Date()).setTime(q());
414
+ var e;
415
+ return (
416
+ e.toLocaleTimeString("en-US", { hour12: !1 }) +
417
+ "." +
418
+ (function (e) {
419
+ let t;
420
+ switch (e.toString().length) {
421
+ case 1:
422
+ t = "00" + e;
423
+ break;
424
+ case 2:
425
+ t = "0" + e;
426
+ break;
427
+ default:
428
+ t = e;
429
+ }
430
+ return t;
431
+ })(e.getMilliseconds())
432
+ );
433
+ }
434
+ let ee = {
435
+ arguments2String(s) {
436
+ let r = "";
437
+ if (1 === s.length) r = s[0];
438
+ else
439
+ for (let e = 0, t = s.length; e < t; e++) {
440
+ if (H(s[e]))
441
+ try {
442
+ r +=
443
+ s[e] instanceof Error
444
+ ? JSON.stringify(s[e], ["message", "code"])
445
+ : JSON.stringify(s[e]);
446
+ } catch (e) {
447
+ r += e ? e.message : "";
448
+ break;
449
+ }
450
+ else r += s[e];
451
+ r += " ";
452
+ }
453
+ return r;
454
+ },
455
+ _exec(e, t) {
456
+ J()
457
+ ? O[e](
458
+ X(),
459
+ "background:#0abf5b; padding:1px; border-radius:3px; color: #fff",
460
+ "background:transparent",
461
+ Z(),
462
+ t,
463
+ )
464
+ : O[e](`${X()} ${Z()} ` + t);
465
+ },
466
+ d: function () {
467
+ var e;
468
+ Q <= -1 &&
469
+ ((e = this.arguments2String(arguments)), this._exec("debug", e));
470
+ },
471
+ l: function () {
472
+ var e;
473
+ Q <= 0 && ((e = this.arguments2String(arguments)), this._exec("log", e));
474
+ },
475
+ log: function () {
476
+ var e;
477
+ Q <= 0 && ((e = this.arguments2String(arguments)), this._exec("log", e));
478
+ },
479
+ i: function () {
480
+ var e;
481
+ Q <= 1 && ((e = this.arguments2String(arguments)), this._exec("info", e));
482
+ },
483
+ w: function () {
484
+ var e;
485
+ Q <= 2 && ((e = this.arguments2String(arguments)), this._exec("warn", e));
486
+ },
487
+ e: function () {
488
+ var e;
489
+ Q <= 3 &&
490
+ ((e = this.arguments2String(arguments)), this._exec("error", e));
491
+ },
492
+ setLevel: function (e) {
493
+ (e < 4 && this._exec("log", "set level from " + Q + " to " + e), (Q = e));
494
+ },
495
+ getLevel: function () {
496
+ return Q;
497
+ },
498
+ },
499
+ te = function (e) {
500
+ return { code: 0, data: e || {} };
501
+ };
502
+ class se extends Error {
503
+ constructor(e) {
504
+ super();
505
+ var { code: e, message: t, data: s } = e;
506
+ ((this.code = e),
507
+ t
508
+ ? (this.message = t)
509
+ : this._getErrMsg && (this.message = this._getErrMsg(this.code)),
510
+ (this.data = s || {}));
511
+ }
512
+ }
513
+ let oe = 2805,
514
+ ne = 2903,
515
+ ie = 3122,
516
+ re = 3153,
517
+ ce = "error",
518
+ ue = null,
519
+ me = function (e, t = !1) {
520
+ if (e instanceof se)
521
+ return (t && null !== ue && ue.emit(ce, e), Promise.reject(e));
522
+ if (e instanceof Error) {
523
+ let e = new se({ code: ne });
524
+ return (t && null !== ue && ue.emit(ce, e), Promise.reject(e));
525
+ }
526
+ return W(e) || W(e.code)
527
+ ? Promise.reject(new se({ code: ne }))
528
+ : ((e = new se(e)),
529
+ t && null !== ue && ue.emit(ce, e),
530
+ Promise.reject(e));
531
+ },
532
+ ae = "query",
533
+ le = "query_grp",
534
+ ge = "query_grp_member",
535
+ he = "query_user",
536
+ de = { info: 4, warning: 5, error: 6 },
537
+ pe = {
538
+ wifi: 1,
539
+ "2g": 2,
540
+ "3g": 3,
541
+ "4g": 4,
542
+ "5g": 5,
543
+ unknown: 6,
544
+ none: 7,
545
+ online: 8,
546
+ },
547
+ fe = {
548
+ login: 4,
549
+ plugin_search: 16,
550
+ plugin_translate: 16,
551
+ plugin_voice_to_text: 16,
552
+ plugin_cs: 16,
553
+ plugin_push: 16,
554
+ plugin_bot: 16,
555
+ plugin_emoji_reaction: 16,
556
+ tui_key_features: 16,
557
+ };
558
+ class we {
559
+ constructor(e) {
560
+ ((this._n = "SSOLogData"),
561
+ (this.eventType = fe[e] || 0),
562
+ (this.timestamp = 0),
563
+ (this.networkType = 8),
564
+ (this.code = 0),
565
+ (this.message = ""),
566
+ (this.moreMessage = ""),
567
+ (this.extension = e),
568
+ (this.costTime = 0),
569
+ (this.duplicate = !1),
570
+ (this.level = 4),
571
+ (this.uiPlatform = void 0),
572
+ (this._sentFlag = !1),
573
+ (this._startts = q()));
574
+ }
575
+ static bindEventStatModule(e) {
576
+ we.prototype._eventStatModule = e;
577
+ }
578
+ static bindNetMonitorModule(e) {
579
+ we.prototype._netMonitorModule = e;
580
+ }
581
+ updateTimeStamp() {
582
+ this.timestamp = q();
583
+ }
584
+ start(e) {
585
+ return ((this._startts = e), this);
586
+ }
587
+ end(e = !1) {
588
+ if (!this._sentFlag) {
589
+ if (this._netMonitorModule) {
590
+ let e = this._netMonitorModule.getNetworkType();
591
+ this.setNetworkType(e);
592
+ }
593
+ var t = q();
594
+ (0 === this.costTime && (this.costTime = t - this._startts),
595
+ this.setMoreMessage(`startts:${this._startts} endts:` + t),
596
+ e
597
+ ? ((this._sentFlag = !0),
598
+ this._eventStatModule && this._eventStatModule.pushIn(this))
599
+ : setTimeout(() => {
600
+ ((this._sentFlag = !0),
601
+ this._eventStatModule && this._eventStatModule.pushIn(this));
602
+ }, 0));
603
+ }
604
+ }
605
+ setError(t) {
606
+ if (t instanceof Error) {
607
+ if (!this._sentFlag) {
608
+ let e = !0;
609
+ if (
610
+ (e = this._netMonitorModule ? this._netMonitorModule.isOnline() : e)
611
+ )
612
+ (t.code && this.setCode(t.code),
613
+ t.message && this.setMoreMessage(t.message));
614
+ else {
615
+ let e = oe;
616
+ this.setCode(e);
617
+ }
618
+ this.setLevel("error");
619
+ }
620
+ } else
621
+ ee.w(this._n + ".setError value not instanceof Error, please check!");
622
+ return this;
623
+ }
624
+ setCode(e) {
625
+ return (
626
+ W(e) ||
627
+ this._sentFlag ||
628
+ ("ECONNABORTED" === e && (this.code = 103),
629
+ G(e)
630
+ ? (this.code = e)
631
+ : ee.w(
632
+ this._n + ".setCode value not a number, please check!",
633
+ e,
634
+ typeof e,
635
+ )),
636
+ this
637
+ );
638
+ }
639
+ setMessage(e) {
640
+ return (
641
+ W(e) ||
642
+ this._sentFlag ||
643
+ (G(e) && (this.message = e.toString()), j(e) && (this.message = e)),
644
+ this
645
+ );
646
+ }
647
+ setCostTime(e) {
648
+ return ((this.costTime = e), this);
649
+ }
650
+ setLevel(e) {
651
+ return (W(e) || this._sentFlag || (this.level = de[e]), this);
652
+ }
653
+ setMoreMessage(e) {
654
+ return (
655
+ (function (e) {
656
+ if (null == e) return 1;
657
+ if ("boolean" != typeof e) {
658
+ if ("number" == typeof e) return 0 === e;
659
+ if ("string" == typeof e) return 0 === e.length;
660
+ if ("function" == typeof e) return 0 === e.length;
661
+ if (Array.isArray(e)) return 0 === e.length;
662
+ if (e instanceof Error) return "" === e.message;
663
+ if ($(e)) {
664
+ for (var t in e) if (F.call(e, t)) return;
665
+ return 1;
666
+ }
667
+ return (x(e) || B(e) || k(e)) && 0 === e.size;
668
+ }
669
+ })(this.moreMessage)
670
+ ? (this.moreMessage = "" + e)
671
+ : (this.moreMessage += " " + e),
672
+ this
673
+ );
674
+ }
675
+ setNetworkType(e) {
676
+ return (
677
+ W(e)
678
+ ? ee.w(this._n + ".setNetworkType value is undefined, please check!")
679
+ : ((e = pe[e.toLowerCase()]), W(e) || (this.networkType = e)),
680
+ this
681
+ );
682
+ }
683
+ getStartTs() {
684
+ return this._startts;
685
+ }
686
+ setUIPlatform(e) {
687
+ return ((this.uiPlatform = e), this);
688
+ }
689
+ setExtension(e) {
690
+ return ((this.extension = e), this);
691
+ }
692
+ setEventType(e) {
693
+ return ((this.eventType = e), this);
694
+ }
695
+ }
696
+ let _e = [
697
+ "groupID",
698
+ "name",
699
+ "avatar",
700
+ "type",
701
+ "introduction",
702
+ "notification",
703
+ "ownerID",
704
+ "selfInfo",
705
+ "createTime",
706
+ "infoSequence",
707
+ "lastInfoTime",
708
+ "lastMessage",
709
+ "nextMessageSeq",
710
+ "memberNum",
711
+ "maxMemberNum",
712
+ "memberList",
713
+ "joinOption",
714
+ "groupCustomField",
715
+ "muteAllMembers",
716
+ "isSupportTopic",
717
+ "inviteOption",
718
+ "_lastRevokedTime",
719
+ ];
720
+ class Se {
721
+ constructor(e) {
722
+ ((this.groupID = ""),
723
+ (this.name = ""),
724
+ (this.avatar = ""),
725
+ (this.type = ""),
726
+ (this.introduction = ""),
727
+ (this.notification = ""),
728
+ (this.ownerID = ""),
729
+ (this.createTime = ""),
730
+ (this.infoSequence = ""),
731
+ (this.lastInfoTime = ""),
732
+ (this.selfInfo = {
733
+ messageRemindType: "",
734
+ joinTime: "",
735
+ nameCard: "",
736
+ role: "",
737
+ userID: "",
738
+ memberCustomField: void 0,
739
+ readedSequence: 0,
740
+ excludedUnreadSequenceList: void 0,
741
+ }),
742
+ (this.lastMessage = {
743
+ lastTime: "",
744
+ lastSequence: "",
745
+ fromAccount: "",
746
+ messageForShow: "",
747
+ }),
748
+ (this.nextMessageSeq = ""),
749
+ (this.memberNum = ""),
750
+ (this.memberCount = ""),
751
+ (this.maxMemberNum = ""),
752
+ (this.maxMemberCount = ""),
753
+ (this.joinOption = ""),
754
+ (this.inviteOption = ""),
755
+ (this.groupCustomField = []),
756
+ (this.muteAllMembers = !1),
757
+ (this.isSupportTopic = !1),
758
+ (this._lastRevokedTime = 0),
759
+ this._initGroup(e));
760
+ }
761
+ set memberNum(e) {}
762
+ set maxMemberNum(e) {}
763
+ get memberNum() {
764
+ return this.memberCount;
765
+ }
766
+ get maxMemberNum() {
767
+ return this.maxMemberCount;
768
+ }
769
+ _initGroup(e) {
770
+ for (var t in e)
771
+ _e.indexOf(t) < 0 ||
772
+ ("selfInfo" !== t
773
+ ? ("memberNum" === t && (this.memberCount = e[t]),
774
+ "maxMemberNum" === t && (this.maxMemberCount = e[t]),
775
+ "isSupportTopic" !== t
776
+ ? "muteAllMembers" === t && j(e[t])
777
+ ? (this.muteAllMembers = "On" === e[t])
778
+ : (this[t] = e[t])
779
+ : (this.isSupportTopic = 1 === e[t]))
780
+ : this.updateSelfInfo(e[t]));
781
+ }
782
+ updateGroup(e) {
783
+ ((e.appid = void 0),
784
+ (e.grossTopicNextMsgSeq = void 0),
785
+ e.selfInfo && (e.selfInfo.grossTopicReadSeq = void 0));
786
+ e = JSON.parse(JSON.stringify(e));
787
+ if (
788
+ (e.lastMsgTime && (this.lastMessage.lastTime = e.lastMsgTime),
789
+ W(e.muteAllMembers) ||
790
+ ("On" === e.muteAllMembers
791
+ ? (e.muteAllMembers = !0)
792
+ : (e.muteAllMembers = !1)),
793
+ e.groupCustomField)
794
+ ) {
795
+ var o = this.groupCustomField,
796
+ t = e.groupCustomField;
797
+ if (K(o) && K(t)) {
798
+ let r = !1;
799
+ t.forEach(({ key: t, value: e }) => {
800
+ var s = o.find((e) => e.key === t);
801
+ s
802
+ ? s.value !== e && ((s.value = e), (r = !0))
803
+ : (o.push({ key: t, value: e }), (r = !0));
804
+ });
805
+ }
806
+ }
807
+ (W(e.memberNum) || (this.memberCount = e.memberNum),
808
+ W(e.maxMemberNum) || (this.maxMemberCount = e.maxMemberNum),
809
+ W(e.isSupportTopic) ||
810
+ (this.isSupportTopic = G(e.isSupportTopic)
811
+ ? 1 === e.isSupportTopic
812
+ : e.isSupportTopic),
813
+ z(this, e, [
814
+ "members",
815
+ "errorCode",
816
+ "lastMsgTime",
817
+ "groupCustomField",
818
+ "memberNum",
819
+ "maxMemberNum",
820
+ "isSupportTopic",
821
+ ]),
822
+ K(e.members) &&
823
+ 0 < e.members.length &&
824
+ e.members.forEach((e) => {
825
+ e.userID === this.selfInfo.userID &&
826
+ z(this.selfInfo, e, ["sequence"]);
827
+ }));
828
+ }
829
+ updateSelfInfo({
830
+ nameCard: e,
831
+ joinTime: t,
832
+ role: s,
833
+ messageRemindType: r,
834
+ readedSequence: o,
835
+ excludedUnreadSequenceList: i,
836
+ }) {
837
+ e = {
838
+ nameCard: e,
839
+ joinTime: t,
840
+ role: s,
841
+ messageRemindType: r,
842
+ readedSequence: o,
843
+ excludedUnreadSequenceList: i,
844
+ };
845
+ z(this.selfInfo, { ...e }, [], ["", null, void 0, 0, NaN]);
846
+ }
847
+ setSelfNameCard(e) {
848
+ this.selfInfo.nameCard = e;
849
+ }
850
+ }
851
+ let ye = "Message",
852
+ Te = "User",
853
+ Ae = "Group",
854
+ Me = "GroupMember",
855
+ Ie = { [ye]: ae, [Te]: he, [Ae]: le, [Me]: ge };
856
+ class Ee extends class {
857
+ constructor(e) {
858
+ ((this._m = e), (this._n = ""));
859
+ }
860
+ isLoggedIn() {
861
+ return this._m.get(s).isLoggedIn();
862
+ }
863
+ isOversea() {
864
+ return this._m.get(s).isOversea();
865
+ }
866
+ isPrivateNetWork() {
867
+ var e = this._m.get(s);
868
+ return e.isPrivateNetWork() && !e.getFileDownloadProxy();
869
+ }
870
+ getFileDownloadProxy() {
871
+ return this._m.get(s).getFileDownloadProxy();
872
+ }
873
+ getDownloadFileAuthKey() {
874
+ return this._m.get(s).getDownloadFileAuthKey();
875
+ }
876
+ getMyUserID() {
877
+ return this._m.get(s).getUserID();
878
+ }
879
+ getMyTinyID() {
880
+ return this._m.get(s).getTinyID();
881
+ }
882
+ getSDKAppID() {
883
+ return this._m.get(s).getSDKAppID();
884
+ }
885
+ isIntl() {
886
+ return this._m.get(s).isIntl();
887
+ }
888
+ isUsingChatCore() {
889
+ return this._m.get(s).isUsingChatCore();
890
+ }
891
+ isDevMode() {
892
+ return this._m.get(s).isDevMode();
893
+ }
894
+ get(e) {
895
+ return this._m.get(e);
896
+ }
897
+ getPlatform() {
898
+ return P;
899
+ }
900
+ getCloudConfig(e) {
901
+ return this._m.get(n).getCloudConfig(e);
902
+ }
903
+ emitOEvt(e, t) {
904
+ this._m.getOEmitInst().emit(e, t);
905
+ }
906
+ emitIEvt(e, t) {
907
+ this._m.getIEmitInst().emit(e, t);
908
+ }
909
+ getIEmitInst() {
910
+ return this._m.getIEmitInst();
911
+ }
912
+ req(e) {
913
+ return this._m.get(o).req(e);
914
+ }
915
+ canIUse(e) {
916
+ return this._m.get(i).canIUse(e);
917
+ }
918
+ getErrMsg(e, t, s) {
919
+ return this._m.getErrMsg(e, t, s);
920
+ }
921
+ warn(e, t, s) {
922
+ e = this.getErrMsg(e, t, s);
923
+ e && ee.w(e);
924
+ }
925
+ noUse(e) {
926
+ var t = ie;
927
+ return me({ code: t, message: this.getErrMsg(t, e) });
928
+ }
929
+ } {
930
+ constructor(e) {
931
+ (super(e), (this._n = "CSModule"));
932
+ }
933
+ searchCloudMessages(e) {
934
+ return this.search(ye, e);
935
+ }
936
+ searchCloudUsers(e) {
937
+ return this.search(Te, e);
938
+ }
939
+ searchCloudGroups(e) {
940
+ return this.search(Ae, e);
941
+ }
942
+ searchCloudGroupMembers(e) {
943
+ return this.search(Me, e);
944
+ }
945
+ search(n, s) {
946
+ let e = `searchCloud${n}s`,
947
+ a = this._n + "." + e;
948
+ if (!s) return me({ code: re, message: this.getErrMsg(re, e) });
949
+ var t = s["keywordList"],
950
+ r = V(t);
951
+ let o = s.count;
952
+ if (
953
+ (s.count && (o = parseInt(o)),
954
+ (n === ye && !r && !V(s.senderUserIDList) && !V(s.messageTypeList)) ||
955
+ (n !== ye && !r))
956
+ )
957
+ throw (
958
+ ee.e(`[${e}] Missing required params: "keywordList".`),
959
+ new Error("Params validate failed.")
960
+ );
961
+ let m = Date.now(),
962
+ u = new we(e),
963
+ c =
964
+ `keywordList:${t} keywordListMatchType:${s.keywordListMatchType} cursor:${s.cursor} count:` +
965
+ o;
966
+ return (
967
+ ee.l(a + " " + c),
968
+ this.req({ P: Ie[n], data: this._genParams(n, s) })
969
+ .then((e) => {
970
+ var { code: r, message: o } = e.data;
971
+ if (0 !== r) {
972
+ let e = r,
973
+ t =
974
+ (60020 === r
975
+ ? (e = "SearchUnable")
976
+ : n !== ye && 27003 === r
977
+ ? (e = "SearchParamsError")
978
+ : n !== ye && 60018 === r && (e = "SearchOverLimit"),
979
+ this.getErrMsg(e) || o),
980
+ s = new se({ code: r, message: t });
981
+ return (u.setMessage(c).setError(s).end(), me(s));
982
+ }
983
+ this.get(i).isCSPluginEnabled();
984
+ var { cursor: o = "", totalCount: r } = e.data,
985
+ t = `totalCount:${r} cost:` + ((t = m), Date.now() - t) + " ms",
986
+ t =
987
+ (ee.l(a + ` ok. cursor:${o} ` + t),
988
+ u.setMessage(c + " " + t).end(),
989
+ this._genRes(n, s, e.data));
990
+ return te({ searchResultList: t, cursor: o, totalCount: r });
991
+ })
992
+ .catch((e) => (u.setMessage(c).setError(e).end(), me(e)))
993
+ );
994
+ }
995
+ _genParams(e, t) {
996
+ let { count: s, ...r } = t;
997
+ var o;
998
+ return (
999
+ s && (r.count = parseInt(s)),
1000
+ e === ye
1001
+ ? this._genMsgParams(r)
1002
+ : (({ keywordList: t, keywordListMatchType: o } = t),
1003
+ (r.keywords = t),
1004
+ (r.keywordMatchType = "and" === o ? 1 : 0),
1005
+ e === Te ? this._genUserParams(r) : r)
1006
+ );
1007
+ }
1008
+ _genMsgParams(e) {
1009
+ let { conversationID: t, timePosition: s, timePeriod: r, ...o } = e;
1010
+ return (
1011
+ W(t) ||
1012
+ ((e = t),
1013
+ j(e) && e.slice(0, 3) === L && (o.account = t.replace(L, "")),
1014
+ (e = t),
1015
+ j(e) && e.slice(0, 5) === R && (o.groupID = t.replace(R, ""))),
1016
+ G(r) &&
1017
+ 0 < r &&
1018
+ (G(s) && 0 < s
1019
+ ? (o.startTime = s - r)
1020
+ : (o.startTime = Math.floor(q() / 1e3) - r)),
1021
+ o.startTime && o.startTime < 0 && (o.startTime = void 0),
1022
+ G(s) && 0 < s && (o.endTime = s),
1023
+ o
1024
+ );
1025
+ }
1026
+ _genUserParams(e) {
1027
+ let { miniBirthday: t, maxBirthday: s, ...r } = e;
1028
+ return (
1029
+ G(t) &&
1030
+ ((r.miniBirthday = parseInt(t)), G(s) || (r.maxBirthday = 4294967295)),
1031
+ G(s) && (r.maxBirthday = parseInt(s)),
1032
+ r
1033
+ );
1034
+ }
1035
+ _genRes(e, t, s) {
1036
+ switch (e) {
1037
+ case ye:
1038
+ return this._genMsgRes(s.searchResult, !t.conversationID);
1039
+ case Te:
1040
+ return this._genUserRes(s.userList);
1041
+ case Ae:
1042
+ return this._genGrpRes(s.groupList);
1043
+ case Me:
1044
+ return this._genMemberRes(s.groupMemberList);
1045
+ default:
1046
+ return [];
1047
+ }
1048
+ }
1049
+ _genMsgRes(e, n) {
1050
+ let a = this.get(t);
1051
+ return K(e) && 0 !== e.length
1052
+ ? e.map(
1053
+ ({ groupID: t, userID: e, messageCount: s, messageList: r = [] }) => {
1054
+ var o = t ? "" + R + t : "" + L + e,
1055
+ i = { conversationID: o, messageCount: s, messageList: [] };
1056
+ if (!(n && 1 < s)) {
1057
+ s = r.filter((e) => !!e);
1058
+ if (0 < s.length) {
1059
+ let e = a.onRoamingMessage(s, o, !1);
1060
+ (t && e.reverse(),
1061
+ (i.messageList = e),
1062
+ (i.messageCount = e.length));
1063
+ }
1064
+ }
1065
+ return i;
1066
+ },
1067
+ )
1068
+ : [];
1069
+ }
1070
+ _genUserRes(s) {
1071
+ var r = this.get(e)._profileHandler;
1072
+ if (!K(s)) return [];
1073
+ var o = [];
1074
+ for (let e = 0, t = s.length; e < t; e++) {
1075
+ var { userID: i, profileItems: n } = s[e];
1076
+ "@TLS#NOT_FOUND" !== i &&
1077
+ "" !== i &&
1078
+ ((i = r._update(i, r._getLatestProfileFromResponse(i, n))[
1079
+ "latestProfile"
1080
+ ]),
1081
+ o.push(i));
1082
+ }
1083
+ return o;
1084
+ }
1085
+ _genGrpRes(s) {
1086
+ if (!K(s)) return [];
1087
+ var r = [];
1088
+ for (let e = 0, t = s.length; e < t; e++)
1089
+ s[e] && s[e].groupID && r.push(new Se(s[e]));
1090
+ return r;
1091
+ }
1092
+ _genMemberRes(s) {
1093
+ if (!K(s)) return [];
1094
+ var r = new Map();
1095
+ for (let e = 0, t = s.length; e < t; e++)
1096
+ if (s[e] && s[e].userID && s[e].groupID) {
1097
+ var {
1098
+ groupID: o,
1099
+ name: i,
1100
+ type: n,
1101
+ avatar: a,
1102
+ nick: m,
1103
+ userID: u,
1104
+ nameCard: c,
1105
+ memberAvatar: l = "",
1106
+ } = s[e],
1107
+ i = { groupID: o, name: i, type: n, avatar: a },
1108
+ n = { userID: u, nick: m, nameCard: c, avatar: l };
1109
+ if (r.has(o)) {
1110
+ let e = r.get(o);
1111
+ (e.memberList.push(n), r.set(o, e));
1112
+ } else r.set(o, { groupInfo: i, memberList: [n] });
1113
+ }
1114
+ return [...r.values()];
1115
+ }
1116
+ }
1117
+ export { Ee as default };