@docoi/mys-sdk 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +212 -0
- package/dist/api/basic.d.ts +208 -111
- package/dist/api/biz.d.ts +162 -25
- package/dist/api/router/index.d.ts +68 -0
- package/dist/api/router/launch.d.ts +3 -0
- package/dist/api/router/legacy.d.ts +22 -0
- package/dist/api/router/routes.d.ts +732 -0
- package/dist/bridge.d.ts +48 -9
- package/dist/constants/code.d.ts +10 -2
- package/dist/index.d.ts +21 -41
- package/dist/index.mjs +1241 -308
- package/dist/transport/legacy.d.ts +27 -0
- package/dist/types/base.d.ts +77 -5
- package/dist/types/enums.d.ts +39 -17
- package/dist/types/index.d.ts +2 -3
- package/dist/types/params.d.ts +135 -87
- package/dist/types/results.d.ts +205 -55
- package/dist/types/router.d.ts +231 -0
- package/dist/utils/app.d.ts +30 -0
- package/dist/utils/data.d.ts +39 -0
- package/package.json +9 -9
- package/LICENSE +0 -21
package/dist/index.mjs
CHANGED
|
@@ -1,392 +1,1325 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return {
|
|
6
|
-
code: S,
|
|
7
|
-
msg: "ok",
|
|
8
|
-
result: e
|
|
9
|
-
};
|
|
1
|
+
import Fe from "@docoi/jsbridge-sdk";
|
|
2
|
+
const we = 0, ne = -1, He = 1001, We = 1002, Xt = 2002, Qt = 3002, Zt = 4002, J = 5001, Ge = 5002, ve = 9002, er = 9101, nr = 9102;
|
|
3
|
+
function f(e) {
|
|
4
|
+
return typeof e == "string";
|
|
10
5
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
6
|
+
function Pe(e) {
|
|
7
|
+
return typeof e == "number";
|
|
8
|
+
}
|
|
9
|
+
function I(e) {
|
|
10
|
+
return typeof e == "object" && e !== null;
|
|
11
|
+
}
|
|
12
|
+
function O(e) {
|
|
13
|
+
if (!I(e) || Object.prototype.toString.call(e) !== "[object Object]") return !1;
|
|
14
|
+
const n = Object.getPrototypeOf(e);
|
|
15
|
+
return n === null || Object.getPrototypeOf(n) === null;
|
|
16
|
+
}
|
|
17
|
+
function Ve(e) {
|
|
18
|
+
return f(e) && /^\d+(\.\d+){1,3}$/.test(e);
|
|
19
|
+
}
|
|
20
|
+
const Je = /^data:image\/[\w.+-]+;base64,[A-Za-z0-9+/]/i, Ke = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
21
|
+
function ze(e) {
|
|
22
|
+
return f(e) && (Je.test(e) || Ke.test(e));
|
|
23
|
+
}
|
|
24
|
+
function Ie(e, n = null) {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(e);
|
|
27
|
+
} catch (t) {
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function ce(e) {
|
|
32
|
+
try {
|
|
33
|
+
return decodeURIComponent(e);
|
|
34
|
+
} catch (n) {
|
|
35
|
+
return e;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function m(e) {
|
|
39
|
+
if (f(e)) return e;
|
|
13
40
|
if (e instanceof Error) return e.message || "system error";
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
17
|
-
if (
|
|
41
|
+
if (I(e)) {
|
|
42
|
+
if (f(e.errMsg)) return e.errMsg;
|
|
43
|
+
if (f(e.msg)) return e.msg;
|
|
44
|
+
if (f(e.message)) return e.message;
|
|
18
45
|
}
|
|
19
46
|
return "system error";
|
|
20
47
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
48
|
+
class T extends Error {
|
|
49
|
+
}
|
|
50
|
+
function Ye(e, n) {
|
|
51
|
+
if (typeof e == "bigint") throw new T(`${n} 是 BigInt,不能传给 Native`);
|
|
52
|
+
if (e instanceof Map || e instanceof Set) throw new T(`${n} 是 ${e.constructor.name},不能传给 Native`);
|
|
53
|
+
if (typeof ArrayBuffer != "undefined" && (e instanceof ArrayBuffer || ArrayBuffer.isView(e)))
|
|
54
|
+
throw new T(`${n} 是二进制数据,不能传给 Native`);
|
|
55
|
+
if (typeof Blob != "undefined" && e instanceof Blob) throw new T(`${n} 是 Blob,不能传给 Native`);
|
|
56
|
+
}
|
|
57
|
+
function U(e) {
|
|
58
|
+
const n = JSON.stringify(e, (t, r) => (t && Ye(r, t), r));
|
|
59
|
+
return n === void 0 ? void 0 : JSON.parse(n);
|
|
60
|
+
}
|
|
61
|
+
const E = {
|
|
62
|
+
/** iOS 调用通道 */
|
|
63
|
+
iosInvoke: "jsbridge",
|
|
64
|
+
/** iOS 上 H5 异步回调的回传通道 */
|
|
65
|
+
iosCallback: "jsbridgeCallback",
|
|
66
|
+
/** Native → H5 的三个全局入口 */
|
|
67
|
+
globalCallback: "JSBridgeCallback",
|
|
68
|
+
globalEvent: "JSBridgeEvent",
|
|
69
|
+
globalInvoke: "JSBridgeInvoke",
|
|
70
|
+
/** 回调 ID 前缀,1.0.0 为 cb_ */
|
|
71
|
+
callbackIdPrefix: "cb"
|
|
72
|
+
}, Xe = "[jsbridge]";
|
|
73
|
+
class F extends Error {
|
|
74
|
+
constructor(n, t) {
|
|
75
|
+
super(t), this.kind = n;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const K = { error: 1, warn: 2, info: 3, debug: 4 };
|
|
79
|
+
let Ee = !1, Ce = "info", Ae = !0;
|
|
80
|
+
function g(e, ...n) {
|
|
81
|
+
!Ee || !Ae || K[e] > K[Ce] || console[e](`${Xe} [${e.toUpperCase()}]`, ...n);
|
|
82
|
+
}
|
|
83
|
+
let Qe = 1;
|
|
84
|
+
const H = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), de = /* @__PURE__ */ new Map();
|
|
85
|
+
function ke(e) {
|
|
86
|
+
var t, r;
|
|
87
|
+
const n = (r = (t = window.webkit) == null ? void 0 : t.messageHandlers) == null ? void 0 : r[e];
|
|
88
|
+
return typeof (n == null ? void 0 : n.postMessage) == "function" ? n : void 0;
|
|
89
|
+
}
|
|
90
|
+
function qe() {
|
|
91
|
+
return window.JSBridgeNative;
|
|
92
|
+
}
|
|
93
|
+
function Ze(e) {
|
|
94
|
+
const n = ke(E.iosInvoke);
|
|
95
|
+
if (n) {
|
|
96
|
+
n.postMessage(e);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const t = qe();
|
|
100
|
+
if (t && typeof t.call == "function") {
|
|
101
|
+
t.call(JSON.stringify(e));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
throw new F("communication", "当前环境不支持调用原生方法");
|
|
105
|
+
}
|
|
106
|
+
function en() {
|
|
107
|
+
return `${E.callbackIdPrefix}_${Date.now()}_${Qe++}`;
|
|
108
|
+
}
|
|
109
|
+
function nn(e) {
|
|
110
|
+
return I(e) && !!e.error;
|
|
27
111
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
112
|
+
function ae(e, n) {
|
|
113
|
+
return new Promise((t, r) => {
|
|
114
|
+
const i = en();
|
|
115
|
+
H.set(i, (o) => {
|
|
116
|
+
if (nn(o)) {
|
|
117
|
+
r(new F("native", m(o.error)));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
t(o);
|
|
121
|
+
}), g("debug", `调用原生方法: ${e}`, n);
|
|
34
122
|
try {
|
|
35
|
-
|
|
36
|
-
return N(o);
|
|
123
|
+
Ze({ method: e, params: n, callbackId: i });
|
|
37
124
|
} catch (o) {
|
|
38
|
-
|
|
125
|
+
H.delete(i), r(new F("communication", m(o)));
|
|
39
126
|
}
|
|
40
127
|
});
|
|
41
128
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
errMsg: `${e}:fail parameter error: ${t}`,
|
|
46
|
-
errCode: I
|
|
47
|
-
};
|
|
48
|
-
return (f = r == null ? void 0 : r.fail) == null || f.call(r, o), (s = r == null ? void 0 : r.complete) == null || s.call(r, o), Promise.reject(o);
|
|
129
|
+
function tn(e, n) {
|
|
130
|
+
const t = de.get(e), r = t ? t.then(n, n) : n();
|
|
131
|
+
return de.set(e, r.then(le, le)), r;
|
|
49
132
|
}
|
|
50
|
-
function
|
|
51
|
-
return Object.fromEntries(
|
|
52
|
-
Object.entries(e).filter(([, r]) => typeof r != "function")
|
|
53
|
-
);
|
|
133
|
+
function le() {
|
|
54
134
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
135
|
+
function rn(e, n, t) {
|
|
136
|
+
return Y(), (t == null ? void 0 : t.queue) === "serial" ? tn(e, () => ae(e, n)) : ae(e, n);
|
|
57
137
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
138
|
+
function on(e, n) {
|
|
139
|
+
if (!e) {
|
|
140
|
+
g("warn", "无效的回调ID");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
g("debug", `接收到回调: ${e}`, n);
|
|
144
|
+
const t = H.get(e);
|
|
145
|
+
if (!t) {
|
|
146
|
+
g("warn", `未找到回调: ${e}`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
t(n);
|
|
151
|
+
} catch (r) {
|
|
152
|
+
g("error", `回调执行错误: ${e}`, r);
|
|
153
|
+
} finally {
|
|
154
|
+
H.delete(e);
|
|
155
|
+
}
|
|
60
156
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
157
|
+
function un(e, n) {
|
|
158
|
+
g("debug", `接收到事件: ${e}`, n);
|
|
159
|
+
const t = M.get(e);
|
|
160
|
+
if (t != null && t.length)
|
|
161
|
+
for (const r of [...t])
|
|
162
|
+
try {
|
|
163
|
+
r(n);
|
|
164
|
+
} catch (i) {
|
|
165
|
+
g("warn", `事件处理器执行错误: ${e}`, i);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function sn(e) {
|
|
169
|
+
return JSON.stringify({ success: !0, data: e });
|
|
170
|
+
}
|
|
171
|
+
function fe(e) {
|
|
172
|
+
return JSON.stringify({ success: !1, error: e });
|
|
173
|
+
}
|
|
174
|
+
function ge(e, n) {
|
|
175
|
+
g("debug", `调用原生回调: ${e}`, n);
|
|
176
|
+
const t = ke(E.iosCallback);
|
|
177
|
+
if (t) {
|
|
178
|
+
t.postMessage({ callbackId: e, data: n });
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const r = qe();
|
|
182
|
+
r && typeof r.callback == "function" && r.callback(e, JSON.stringify(n));
|
|
183
|
+
}
|
|
184
|
+
function cn(e, n, t) {
|
|
185
|
+
g("debug", `接收到原生调用: ${e}`, n);
|
|
186
|
+
const r = z.get(e);
|
|
187
|
+
if (!r) {
|
|
188
|
+
const i = `方法 ${e} 未注册`;
|
|
189
|
+
return g("error", i), fe({ code: -1, message: i });
|
|
190
|
+
}
|
|
63
191
|
try {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
192
|
+
const i = r(n);
|
|
193
|
+
return i && typeof i.then == "function" ? t ? (i.then(
|
|
194
|
+
(o) => ge(t, { success: !0, data: o }),
|
|
195
|
+
(o) => ge(t, {
|
|
196
|
+
success: !1,
|
|
197
|
+
error: { message: m(o) }
|
|
198
|
+
})
|
|
199
|
+
), null) : (g("warn", `异步方法 ${e} 没有 callbackId,结果无法回传`), null) : sn(i);
|
|
200
|
+
} catch (i) {
|
|
201
|
+
const o = m(i);
|
|
202
|
+
return g("error", `方法执行错误: ${e}`, o), fe({ message: o });
|
|
67
203
|
}
|
|
68
204
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
205
|
+
function dn() {
|
|
206
|
+
if (typeof window == "undefined") return;
|
|
207
|
+
const e = window;
|
|
208
|
+
typeof e[E.globalEvent] != "function" && (e[E.globalEvent] = () => {
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
let ye = !1;
|
|
212
|
+
function Y() {
|
|
213
|
+
if (ye) return;
|
|
214
|
+
ye = !0;
|
|
215
|
+
const e = window;
|
|
216
|
+
e[E.globalCallback] = (n, t) => on(n, t), e[E.globalEvent] = (n, t) => un(n, t), e[E.globalInvoke] = (n, t, r) => cn(n, t, r), g("info", "初始化完成");
|
|
78
217
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
218
|
+
const _ = {
|
|
219
|
+
callAsync: rn,
|
|
220
|
+
on(e, n) {
|
|
221
|
+
Y();
|
|
222
|
+
const t = M.get(e);
|
|
223
|
+
if (!t) {
|
|
224
|
+
M.set(e, [n]);
|
|
225
|
+
return;
|
|
85
226
|
}
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
227
|
+
t.includes(n) || t.push(n);
|
|
228
|
+
},
|
|
229
|
+
off(e, n) {
|
|
230
|
+
const t = M.get(e);
|
|
231
|
+
if (!t) return;
|
|
232
|
+
const r = t.indexOf(n);
|
|
233
|
+
r !== -1 && (t.splice(r, 1), t.length || M.delete(e));
|
|
234
|
+
},
|
|
235
|
+
register(e, n) {
|
|
236
|
+
Y(), z.set(e, n);
|
|
237
|
+
},
|
|
238
|
+
unregister(e) {
|
|
239
|
+
z.delete(e);
|
|
240
|
+
},
|
|
241
|
+
setDebug(e, n) {
|
|
242
|
+
Ee = e, n != null && n.logLevel && n.logLevel in K && (Ce = n.logLevel), typeof (n == null ? void 0 : n.useConsole) == "boolean" && (Ae = n.useConsole);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
let C;
|
|
246
|
+
function he(e) {
|
|
247
|
+
return O(e) && Ve(e.app_version);
|
|
92
248
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return
|
|
96
|
-
"showToast",
|
|
97
|
-
{
|
|
98
|
-
text: e.text,
|
|
99
|
-
duration: e.duration ?? E.Short
|
|
100
|
-
},
|
|
101
|
-
e
|
|
102
|
-
) : i("showToast", "text is required", e);
|
|
249
|
+
function an(e) {
|
|
250
|
+
const n = /#webBaseInfo(.*?[^\\])#/.exec(e);
|
|
251
|
+
return n != null && n[1] ? Ie(n[1]) : null;
|
|
103
252
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
253
|
+
function B() {
|
|
254
|
+
if (C !== void 0) return C;
|
|
255
|
+
if (typeof window == "undefined") return null;
|
|
256
|
+
const e = window, n = e._appBaseInfo;
|
|
257
|
+
if (n !== void 0)
|
|
258
|
+
return C = he(n) ? n : null, C;
|
|
259
|
+
if (typeof navigator == "undefined") return null;
|
|
260
|
+
const t = navigator.userAgent.replace(/ +/g, "").replace(/[\r\n]/g, ""), r = an(t);
|
|
261
|
+
return C = he(r) ? r : null, e._appBaseInfo = C, C;
|
|
111
262
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
263
|
+
function Se() {
|
|
264
|
+
return !!B();
|
|
114
265
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
266
|
+
function _e(e) {
|
|
267
|
+
return !!e && ln(e) === -1;
|
|
117
268
|
}
|
|
118
|
-
function
|
|
119
|
-
return typeof window
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
|
|
269
|
+
function Oe() {
|
|
270
|
+
return typeof window == "undefined" ? 1 : window.devicePixelRatio || 1;
|
|
271
|
+
}
|
|
272
|
+
function ln(e, n = ((t) => (t = B()) == null ? void 0 : t.app_version)() || "") {
|
|
273
|
+
if (!e && !n) return 0;
|
|
274
|
+
if (!e) return 1;
|
|
275
|
+
if (!n) return -1;
|
|
276
|
+
const r = (d) => d.split(".").map((a) => {
|
|
277
|
+
const y = Number(a);
|
|
278
|
+
return Number.isFinite(y) ? y : 0;
|
|
279
|
+
}), i = r(e), o = r(n), s = Math.max(i.length, o.length);
|
|
280
|
+
for (let d = 0; d < s; d++) {
|
|
281
|
+
const a = d < i.length ? i[d] : 0, y = d < o.length ? o[d] : 0;
|
|
282
|
+
if (a > y) return -1;
|
|
283
|
+
if (a < y) return 1;
|
|
284
|
+
}
|
|
285
|
+
return 0;
|
|
286
|
+
}
|
|
287
|
+
const be = "docoi-web-community-frame";
|
|
288
|
+
function Re() {
|
|
289
|
+
if (typeof navigator == "undefined") return "unknown";
|
|
290
|
+
const e = navigator.userAgent;
|
|
291
|
+
return /\(i[^;]+;( U;)? CPU.+Mac OS X/.test(e) ? "ios" : e.includes("Android") || e.includes("Linux") ? "android" : "unknown";
|
|
292
|
+
}
|
|
293
|
+
function fn() {
|
|
294
|
+
if (typeof window == "undefined") return !1;
|
|
295
|
+
try {
|
|
296
|
+
return window.self !== window.top && window.name === be;
|
|
297
|
+
} catch (e) {
|
|
298
|
+
return window.name === be;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function pe() {
|
|
302
|
+
var n, t;
|
|
303
|
+
const e = typeof window == "undefined" ? void 0 : window;
|
|
304
|
+
return {
|
|
305
|
+
...B(),
|
|
306
|
+
pixelRatio: Oe(),
|
|
307
|
+
screenWidth: (n = e == null ? void 0 : e.screen) == null ? void 0 : n.width,
|
|
308
|
+
screenHeight: (t = e == null ? void 0 : e.screen) == null ? void 0 : t.height,
|
|
309
|
+
windowWidth: e == null ? void 0 : e.innerWidth,
|
|
310
|
+
windowHeight: e == null ? void 0 : e.innerHeight
|
|
128
311
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
312
|
+
}
|
|
313
|
+
const k = Fe.init({
|
|
314
|
+
debug: !1
|
|
315
|
+
});
|
|
316
|
+
dn();
|
|
317
|
+
const gn = (e, n) => {
|
|
318
|
+
_.setDebug(e, n), k.setDebug(e, n);
|
|
319
|
+
};
|
|
320
|
+
let A;
|
|
321
|
+
const tr = (e) => {
|
|
322
|
+
A = e;
|
|
323
|
+
};
|
|
324
|
+
function X(e) {
|
|
325
|
+
try {
|
|
326
|
+
A == null || A(e);
|
|
327
|
+
} catch (n) {
|
|
132
328
|
}
|
|
133
|
-
u.on("keyboardHeightChange", o);
|
|
134
329
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
330
|
+
function w(e) {
|
|
331
|
+
return Se() && _e(e);
|
|
332
|
+
}
|
|
333
|
+
const Q = /* @__PURE__ */ new Map();
|
|
334
|
+
function b(e, n, t = {}) {
|
|
335
|
+
const { since: r, once: i, transform: o } = t;
|
|
336
|
+
v(e, n);
|
|
337
|
+
const s = w(r) ? _ : k;
|
|
338
|
+
let d = Q.get(e);
|
|
339
|
+
d || (d = /* @__PURE__ */ new Map(), Q.set(e, d));
|
|
340
|
+
const a = (y) => {
|
|
341
|
+
i && v(e, n), n(o ? o(y) : y);
|
|
342
|
+
};
|
|
343
|
+
return d.set(n, { handler: a, target: s }), s.on(e, a), () => v(e, n);
|
|
344
|
+
}
|
|
345
|
+
function v(e, n) {
|
|
346
|
+
const t = Q.get(e);
|
|
347
|
+
if (t)
|
|
348
|
+
for (const r of n ? [n] : [...t.keys()]) {
|
|
349
|
+
const i = t.get(r);
|
|
350
|
+
i && (i.target.off(e, i.handler), t.delete(r));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function Te(e, n, t) {
|
|
354
|
+
const r = w(t);
|
|
355
|
+
return r ? _.register(e, async (i) => U(await n(i))) : Me(e, n), () => (r ? _ : k).unregister(e);
|
|
356
|
+
}
|
|
357
|
+
function yn(e, n) {
|
|
358
|
+
(w(n) ? _ : k).unregister(e);
|
|
359
|
+
}
|
|
360
|
+
function Me(e, n) {
|
|
361
|
+
return k.register(e, async (t) => {
|
|
362
|
+
try {
|
|
363
|
+
const r = await n(t);
|
|
364
|
+
return U(G(r));
|
|
365
|
+
} catch (r) {
|
|
366
|
+
const i = mn(e, r);
|
|
367
|
+
try {
|
|
368
|
+
return U(i);
|
|
369
|
+
} catch (o) {
|
|
370
|
+
return { code: i.code, msg: i.msg, result: {} };
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}), () => k.unregister(e);
|
|
374
|
+
}
|
|
375
|
+
function G(e) {
|
|
376
|
+
return { code: we, msg: "ok", result: e != null ? e : {} };
|
|
377
|
+
}
|
|
378
|
+
function hn(e) {
|
|
379
|
+
return O(e) && Pe(e.code);
|
|
380
|
+
}
|
|
381
|
+
function bn(e, n, t) {
|
|
382
|
+
const r = f(n) ? Ie(n, n) : n;
|
|
383
|
+
if (!hn(r)) throw P(e, ne, m(r));
|
|
384
|
+
if (r.code !== we) throw P(e, r.code, r.msg || `code ${r.code}`);
|
|
385
|
+
return G(Z(e, t, r.result));
|
|
386
|
+
}
|
|
387
|
+
function Z(e, n, t) {
|
|
388
|
+
try {
|
|
389
|
+
return n ? n(t) : t;
|
|
390
|
+
} catch (r) {
|
|
391
|
+
throw te(r) ? r : P(e, ve, m(r));
|
|
139
392
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
393
|
+
}
|
|
394
|
+
function te(e) {
|
|
395
|
+
return I(e) && f(e.errMsg) && Pe(e.errCode);
|
|
396
|
+
}
|
|
397
|
+
function P(e, n, t) {
|
|
398
|
+
return { errMsg: `${e}:fail ${t}`, errCode: n };
|
|
399
|
+
}
|
|
400
|
+
function pn(e, n) {
|
|
401
|
+
return n instanceof F ? P(e, n.kind === "native" ? He : J, n.message) : P(e, J, m(n));
|
|
402
|
+
}
|
|
403
|
+
function mn(e, n) {
|
|
404
|
+
return {
|
|
405
|
+
code: ne,
|
|
406
|
+
msg: `${e}:fail ${m(n)}`,
|
|
407
|
+
result: I(n) && "result" in n ? n.result : n
|
|
148
408
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
409
|
+
}
|
|
410
|
+
function W(e, n) {
|
|
411
|
+
try {
|
|
412
|
+
e == null || e(n);
|
|
413
|
+
} catch (t) {
|
|
414
|
+
console.error("[mys-sdk] 回调执行错误", t);
|
|
152
415
|
}
|
|
153
|
-
u.on("onCommentPanelChange", o);
|
|
154
416
|
}
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
417
|
+
function re(e, n) {
|
|
418
|
+
return W(n == null ? void 0 : n.fail, e), W(n == null ? void 0 : n.complete, e), Promise.reject(e);
|
|
419
|
+
}
|
|
420
|
+
function Le(e, n, t) {
|
|
421
|
+
return n.then(
|
|
422
|
+
(r) => {
|
|
423
|
+
const i = r;
|
|
424
|
+
return W(t == null ? void 0 : t.success, i), W(t == null ? void 0 : t.complete, i), i;
|
|
425
|
+
},
|
|
426
|
+
(r) => re(te(r) ? r : P(e, J, m(r)), t)
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
function c(e, n, t) {
|
|
430
|
+
return re(P(e, We, `parameter error: ${n}`), t);
|
|
431
|
+
}
|
|
432
|
+
function ie(e, n, t) {
|
|
433
|
+
return re(P(e, Ge, `unsupported: ${n}`), t);
|
|
434
|
+
}
|
|
435
|
+
function ee(e, n, t, r) {
|
|
436
|
+
var o;
|
|
437
|
+
A && X({ fnName: e, channel: "local", appVersion: (o = B()) == null ? void 0 : o.app_version, method: e, data: n });
|
|
438
|
+
let i;
|
|
439
|
+
try {
|
|
440
|
+
i = Promise.resolve(G(t()));
|
|
441
|
+
} catch (s) {
|
|
442
|
+
i = Promise.reject(te(s) ? s : P(e, ne, m(s)));
|
|
159
443
|
}
|
|
160
|
-
|
|
161
|
-
g.delete(e), u.off("onCommentPanelChange", t || e);
|
|
444
|
+
return Le(e, i, r);
|
|
162
445
|
}
|
|
163
|
-
function
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
446
|
+
function u(e, n = {}, t, r = {}) {
|
|
447
|
+
var se;
|
|
448
|
+
const { since: i, legacyOnly: o, jsbridge: s, transformResult: d, ...a } = r, y = o || w(i);
|
|
449
|
+
let q;
|
|
450
|
+
try {
|
|
451
|
+
const l = U(n);
|
|
452
|
+
q = O(l) ? l : {};
|
|
453
|
+
} catch (l) {
|
|
454
|
+
const R = l instanceof T || l instanceof TypeError ? l.message : "参数无法序列化";
|
|
455
|
+
return c(e, R, t);
|
|
456
|
+
}
|
|
457
|
+
const ue = (se = B()) == null ? void 0 : se.app_version;
|
|
458
|
+
let D;
|
|
459
|
+
try {
|
|
460
|
+
if (y) {
|
|
461
|
+
const l = Z(e, s == null ? void 0 : s.data, q);
|
|
462
|
+
A && X({ fnName: e, channel: "jsbridge", appVersion: ue, since: i, method: e, data: l }), D = _.callAsync(e, l, a).then(
|
|
463
|
+
(R) => G(Z(e, s == null ? void 0 : s.result, R)),
|
|
464
|
+
(R) => Promise.reject(pn(e, R))
|
|
465
|
+
);
|
|
466
|
+
} else
|
|
467
|
+
A && X({ fnName: e, channel: "mysJSBridge", appVersion: ue, since: i, method: e, data: q }), D = k.callAsync(e, q, a).then((l) => bn(e, l, d));
|
|
468
|
+
} catch (l) {
|
|
469
|
+
D = Promise.reject(l);
|
|
470
|
+
}
|
|
471
|
+
return Le(e, D, t);
|
|
472
|
+
}
|
|
473
|
+
const rr = u;
|
|
474
|
+
var Be = /* @__PURE__ */ ((e) => (e[e.Short = 0] = "Short", e[e.Long = 1] = "Long", e))(Be || {}), x = /* @__PURE__ */ ((e) => (e[e.RecentContacts = 1] = "RecentContacts", e[e.External = 2] = "External", e[e.Channel = 3] = "Channel", e))(x || {});
|
|
475
|
+
function wn(e) {
|
|
476
|
+
var n;
|
|
477
|
+
return e.text ? u(
|
|
478
|
+
"showToast",
|
|
170
479
|
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
current: t
|
|
480
|
+
text: e.text,
|
|
481
|
+
duration: (n = e.duration) != null ? n : Be.Short
|
|
174
482
|
},
|
|
175
|
-
e
|
|
176
|
-
|
|
483
|
+
e,
|
|
484
|
+
{
|
|
485
|
+
since: "4.4.0",
|
|
486
|
+
// 旧通道 jsbridge 的 showToast 只有 text,没有 duration
|
|
487
|
+
jsbridge: { data: ({ text: t }) => ({ text: t }) }
|
|
488
|
+
}
|
|
489
|
+
) : c("showToast", "text is required", e);
|
|
177
490
|
}
|
|
178
|
-
function
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const t = e.current ?? 0;
|
|
183
|
-
return !Number.isInteger(t) || t < 0 || t >= e.urls.length ? i("previewVideo", "current is out of range", e) : n(
|
|
184
|
-
"previewMedia",
|
|
491
|
+
function vn(e = {}) {
|
|
492
|
+
var n, t;
|
|
493
|
+
return u(
|
|
494
|
+
"triggerVibrate",
|
|
185
495
|
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
496
|
+
duration: e.duration,
|
|
497
|
+
intensity: (n = e.intensity) != null ? n : 1,
|
|
498
|
+
steps: e.steps,
|
|
499
|
+
repeat: (t = e.repeat) != null ? t : !1
|
|
189
500
|
},
|
|
190
|
-
e
|
|
501
|
+
e,
|
|
502
|
+
{
|
|
503
|
+
since: "4.4.0",
|
|
504
|
+
queue: "serial"
|
|
505
|
+
}
|
|
191
506
|
);
|
|
192
507
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
508
|
+
function Pn(e) {
|
|
509
|
+
return u("stopVibrate", {}, e, { since: "4.4.0", queue: "serial" });
|
|
510
|
+
}
|
|
511
|
+
function In(e) {
|
|
512
|
+
return u("hideKeyboard", {}, e);
|
|
513
|
+
}
|
|
514
|
+
function En(e, n) {
|
|
515
|
+
b("keyboardHeightChange", e, {
|
|
516
|
+
since: "4.4.0",
|
|
517
|
+
once: n == null ? void 0 : n.once,
|
|
518
|
+
transform: (t) => t ? t / Oe() : 0
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function Cn(e) {
|
|
522
|
+
v("keyboardHeightChange", e);
|
|
523
|
+
}
|
|
524
|
+
function An(e, n) {
|
|
525
|
+
b("onCommentPanelChange", e, { since: "4.4.0", once: n == null ? void 0 : n.once });
|
|
526
|
+
}
|
|
527
|
+
function kn(e) {
|
|
528
|
+
v("onCommentPanelChange", e);
|
|
529
|
+
}
|
|
530
|
+
function De(e, n) {
|
|
531
|
+
var i, o;
|
|
532
|
+
if (!((i = n.urls) != null && i.length))
|
|
533
|
+
return c(e, "urls is required", n);
|
|
534
|
+
const t = (o = n.current) != null ? o : 0;
|
|
535
|
+
if (!Number.isInteger(t) || t < 0 || t >= n.urls.length)
|
|
536
|
+
return c(e, "current is out of range", n);
|
|
537
|
+
const r = e === "previewImage";
|
|
538
|
+
return w("4.3.0") ? u(
|
|
539
|
+
"playMedia",
|
|
540
|
+
{
|
|
541
|
+
type: r ? 1 : 2,
|
|
542
|
+
url: n.urls[t],
|
|
543
|
+
urls: r ? n.urls : void 0
|
|
544
|
+
},
|
|
545
|
+
n,
|
|
546
|
+
{ legacyOnly: !0 }
|
|
547
|
+
) : u("previewMedia", { type: r ? "image" : "video", urls: n.urls, current: t }, n);
|
|
548
|
+
}
|
|
549
|
+
function qn(e) {
|
|
550
|
+
return De("previewImage", e);
|
|
551
|
+
}
|
|
552
|
+
function Sn(e) {
|
|
553
|
+
return De("previewVideo", e);
|
|
554
|
+
}
|
|
555
|
+
function _n(e = {}) {
|
|
556
|
+
var n, t, r, i, o;
|
|
557
|
+
return e.count !== void 0 && (!Number.isInteger(e.count) || e.count <= 0) ? c("chooseMedia", "可选择照片数量范围为1-9张", e) : u(
|
|
195
558
|
"chooseMedia",
|
|
196
559
|
{
|
|
197
|
-
count: e.count
|
|
198
|
-
mediaType: e.mediaType
|
|
199
|
-
compressed: e.compressed
|
|
200
|
-
maxDuration: e.maxDuration
|
|
201
|
-
camera: e.camera
|
|
560
|
+
count: (n = e.count) != null ? n : 9,
|
|
561
|
+
mediaType: (t = e.mediaType) != null ? t : "image",
|
|
562
|
+
compressed: (r = e.compressed) != null ? r : !0,
|
|
563
|
+
maxDuration: (i = e.maxDuration) != null ? i : 60,
|
|
564
|
+
camera: (o = e.camera) != null ? o : "back"
|
|
202
565
|
},
|
|
203
566
|
e,
|
|
204
|
-
{ queue: "serial"
|
|
567
|
+
{ queue: "serial" }
|
|
205
568
|
);
|
|
206
569
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
570
|
+
let V = !1;
|
|
571
|
+
function On(e) {
|
|
572
|
+
var t;
|
|
573
|
+
if (!Array.isArray(e.files) || e.files.length === 0)
|
|
574
|
+
return c("uploadFiles", "files is required", e);
|
|
575
|
+
if (e.files.some((r) => !r))
|
|
576
|
+
return c("uploadFiles", "files[] is required", e);
|
|
577
|
+
if (V)
|
|
578
|
+
return c("uploadFiles", "another uploadFiles request is in progress", e);
|
|
579
|
+
V = !0;
|
|
580
|
+
const n = e.onProgress ? b("uploadFilesProgress", e.onProgress) : void 0;
|
|
581
|
+
return u(
|
|
215
582
|
"uploadFiles",
|
|
216
583
|
{
|
|
217
584
|
files: e.files,
|
|
218
|
-
cosDirPath: e.cosDirPath
|
|
585
|
+
cosDirPath: (t = e.cosDirPath) != null ? t : "multipleSource/common/"
|
|
219
586
|
},
|
|
220
587
|
e,
|
|
221
|
-
{ queue: "serial"
|
|
588
|
+
{ queue: "serial" }
|
|
222
589
|
).finally(() => {
|
|
223
|
-
|
|
224
|
-
})
|
|
590
|
+
V = !1, n == null || n();
|
|
591
|
+
});
|
|
225
592
|
}
|
|
226
|
-
function
|
|
227
|
-
|
|
593
|
+
function Rn(e) {
|
|
594
|
+
const n = O(e) ? e : {};
|
|
595
|
+
if (n.status === "success" || n.result === "success") return;
|
|
596
|
+
throw { errMsg: `saveImageToPhotosAlbum:fail ${f(n.reason) && n.reason ? n.reason : "unknown reason"}`, errCode: ve, errDetail: e };
|
|
228
597
|
}
|
|
229
|
-
function
|
|
230
|
-
return e.filePath ?
|
|
598
|
+
function Tn(e) {
|
|
599
|
+
return ze(e == null ? void 0 : e.filePath) ? u("saveMediaToPhotosAlbum", { type: "image", file: e.filePath }, e, {
|
|
600
|
+
legacyOnly: !0,
|
|
601
|
+
jsbridge: { result: Rn }
|
|
602
|
+
}) : c("saveImageToPhotosAlbum", "filePath must be base64 data (data URL or plain base64)", e);
|
|
231
603
|
}
|
|
232
|
-
|
|
233
|
-
|
|
604
|
+
let p;
|
|
605
|
+
function Mn(e) {
|
|
606
|
+
p == null || p.release();
|
|
607
|
+
const { onEnd: n, onProgress: t } = e != null ? e : {};
|
|
608
|
+
let r, i;
|
|
609
|
+
const o = {
|
|
610
|
+
stopProgress: () => r == null ? void 0 : r(),
|
|
611
|
+
release: () => {
|
|
612
|
+
r == null || r(), i == null || i(), p === o && (p = void 0);
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
return r = t ? b("onRecordAudioProgress", t) : void 0, i = b("onRecordAudioEnd", (s) => {
|
|
616
|
+
o.release(), n == null || n({ ...s, duration: s.duration / 1e3, size: s.size / 1024 });
|
|
617
|
+
}), p = o, o;
|
|
234
618
|
}
|
|
235
|
-
function
|
|
236
|
-
|
|
619
|
+
function Ln(e) {
|
|
620
|
+
const n = e == null ? void 0 : e.maxDuration;
|
|
621
|
+
if (n !== void 0 && (!Number.isFinite(n) || n <= 0))
|
|
622
|
+
return c("startRecordAudio", "maxDuration must be a number greater than 0", e);
|
|
623
|
+
const { release: t } = Mn(e);
|
|
624
|
+
return u("startRecordAudio", { maxDuration: n }, e, { queue: "serial" }).catch((r) => {
|
|
625
|
+
throw t(), r;
|
|
626
|
+
});
|
|
237
627
|
}
|
|
238
|
-
function
|
|
239
|
-
|
|
628
|
+
function Bn(e) {
|
|
629
|
+
const n = p;
|
|
630
|
+
return u("stopRecordAudio", {}, e).then(
|
|
631
|
+
(t) => (n == null || n.stopProgress(), t),
|
|
632
|
+
(t) => {
|
|
633
|
+
throw n == null || n.release(), t;
|
|
634
|
+
}
|
|
635
|
+
);
|
|
240
636
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
637
|
+
function Dn(e) {
|
|
638
|
+
return p == null || p.release(), u("cancelRecordAudio", {}, e);
|
|
243
639
|
}
|
|
244
|
-
function
|
|
245
|
-
return
|
|
640
|
+
function jn(e) {
|
|
641
|
+
return w("4.4.0") ? ee("getSystemInfo", {}, pe, e) : u("getSystemInfo", {}, e, {
|
|
642
|
+
transformResult: (n) => ({ ...pe(), ...O(n) ? n : {} })
|
|
643
|
+
});
|
|
246
644
|
}
|
|
247
|
-
function
|
|
248
|
-
return
|
|
645
|
+
function $n(e) {
|
|
646
|
+
return e.data === void 0 ? c("setClipboardData", "data is required", e) : u("setClipboardData", { data: e.data }, e);
|
|
249
647
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
252
|
-
"checkPermission",
|
|
253
|
-
{
|
|
254
|
-
permission: e.permission
|
|
255
|
-
},
|
|
256
|
-
e
|
|
257
|
-
) : i("checkPermission", "permission is required", e);
|
|
648
|
+
function Nn(e) {
|
|
649
|
+
return u("getClipboardData", {}, e);
|
|
258
650
|
}
|
|
259
|
-
function
|
|
260
|
-
return e.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
651
|
+
function xn(e) {
|
|
652
|
+
return { permission: "notification", result: O(e) && e.isOpen === !0 ? "granted" : "denied" };
|
|
653
|
+
}
|
|
654
|
+
function Un(e) {
|
|
655
|
+
return e.permission ? w("4.4.0") ? e.permission !== "notification" ? ie("checkPermission", `permission ${e.permission} requires app >= 4.4.0`, e) : u("isNotificationEnabled", {}, e, {
|
|
656
|
+
legacyOnly: !0,
|
|
657
|
+
jsbridge: { result: xn }
|
|
658
|
+
}) : u("checkPermission", { permission: e.permission }, e) : c("checkPermission", "permission is required", e);
|
|
659
|
+
}
|
|
660
|
+
function Fn(e) {
|
|
661
|
+
return e.permission ? w("4.4.0") ? e.permission !== "notification" ? ie("openPhoneSetting", `permission ${e.permission} requires app >= 4.4.0`, e) : u("gotoSetPhoneNotify", {}, e, { legacyOnly: !0 }) : u("openPhoneSetting", { permission: e.permission }, e, { queue: "serial" }) : c("openPhoneSetting", "permission is required", e);
|
|
662
|
+
}
|
|
663
|
+
function Hn(e = {}) {
|
|
664
|
+
return u("openApp", { url: e.url, packageNames: e.packageNames }, e, { since: "4.4.0", queue: "serial" });
|
|
665
|
+
}
|
|
666
|
+
function Wn(e) {
|
|
667
|
+
return typeof (e == null ? void 0 : e.enable) != "boolean" ? c("swipeBack", "enable must be a boolean", e) : u("swipeBack", { enable: e.enable }, e);
|
|
668
|
+
}
|
|
669
|
+
function Gn(e) {
|
|
670
|
+
return e.nameType === void 0 ? c("showPageName", "nameType is required", e) : u("showPageName", { nameType: e.nameType }, e, { since: "4.4.0" });
|
|
671
|
+
}
|
|
672
|
+
function Vn(e) {
|
|
673
|
+
return u("H5Loaded", {}, e, { since: "4.4.0" });
|
|
674
|
+
}
|
|
675
|
+
function Jn(e) {
|
|
676
|
+
return u("getBeforeInfo", {}, e, { since: "4.4.0" });
|
|
677
|
+
}
|
|
678
|
+
function Kn(e = {}) {
|
|
679
|
+
return u("setH5BeforeInfo", e, e, { since: "4.4.0" });
|
|
680
|
+
}
|
|
681
|
+
function zn(e, n) {
|
|
682
|
+
b("h5PageShow", e, { since: "4.4.0", once: n == null ? void 0 : n.once });
|
|
683
|
+
}
|
|
684
|
+
function Yn(e) {
|
|
685
|
+
v("h5PageShow", e);
|
|
686
|
+
}
|
|
687
|
+
function Xn(e, n) {
|
|
688
|
+
b("h5PageVisible", e, { since: "4.4.0", once: n == null ? void 0 : n.once });
|
|
689
|
+
}
|
|
690
|
+
function Qn(e) {
|
|
691
|
+
v("h5PageVisible", e);
|
|
268
692
|
}
|
|
269
|
-
function
|
|
270
|
-
|
|
693
|
+
function Zn(e, n) {
|
|
694
|
+
b("h5PageInvisible", e, { since: "4.4.0", once: n == null ? void 0 : n.once });
|
|
271
695
|
}
|
|
272
|
-
function
|
|
273
|
-
|
|
696
|
+
function et(e) {
|
|
697
|
+
v("h5PageInvisible", e);
|
|
274
698
|
}
|
|
275
|
-
const
|
|
699
|
+
const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
276
700
|
__proto__: null,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
getSystemInfo:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
701
|
+
cancelRecordAudio: Dn,
|
|
702
|
+
checkPermission: Un,
|
|
703
|
+
chooseMedia: _n,
|
|
704
|
+
getBeforeInfo: Jn,
|
|
705
|
+
getClipboardData: Nn,
|
|
706
|
+
getSystemInfo: jn,
|
|
707
|
+
h5Loaded: Vn,
|
|
708
|
+
hideKeyboard: In,
|
|
709
|
+
offCommentPanelChange: kn,
|
|
710
|
+
offKeyboardHeightChange: Cn,
|
|
711
|
+
offPageInvisible: et,
|
|
712
|
+
offPageShow: Yn,
|
|
713
|
+
offPageVisible: Qn,
|
|
714
|
+
onCommentPanelChange: An,
|
|
715
|
+
onKeyboardHeightChange: En,
|
|
716
|
+
onPageInvisible: Zn,
|
|
717
|
+
onPageShow: zn,
|
|
718
|
+
onPageVisible: Xn,
|
|
719
|
+
openApp: Hn,
|
|
720
|
+
openPhoneSetting: Fn,
|
|
721
|
+
previewImage: qn,
|
|
722
|
+
previewVideo: Sn,
|
|
723
|
+
saveImageToPhotosAlbum: Tn,
|
|
724
|
+
setBeforeInfo: Kn,
|
|
725
|
+
setClipboardData: $n,
|
|
726
|
+
showPageName: Gn,
|
|
727
|
+
showToast: wn,
|
|
728
|
+
startRecordAudio: Ln,
|
|
729
|
+
stopRecordAudio: Bn,
|
|
730
|
+
stopVibrate: Pn,
|
|
731
|
+
swipeBack: Wn,
|
|
732
|
+
triggerVibrate: vn,
|
|
733
|
+
uploadFiles: On
|
|
301
734
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
302
|
-
function
|
|
303
|
-
return
|
|
735
|
+
function tt(e) {
|
|
736
|
+
return u("login", {}, e, { since: "4.4.0", queue: "serial" });
|
|
304
737
|
}
|
|
305
|
-
function
|
|
306
|
-
return
|
|
738
|
+
function rt(e) {
|
|
739
|
+
return u("getToken", {}, e, {
|
|
740
|
+
since: "4.4.0",
|
|
741
|
+
// 旧通道可能直接返回 token 字符串,统一成对象
|
|
742
|
+
jsbridge: { result: (n) => f(n) ? { token: n } : n }
|
|
743
|
+
});
|
|
307
744
|
}
|
|
308
|
-
function
|
|
309
|
-
return
|
|
745
|
+
function it(e) {
|
|
746
|
+
return u("getCurrentCircleInfo", {}, e, { since: "4.4.0" });
|
|
310
747
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
748
|
+
function ot(e) {
|
|
749
|
+
var r;
|
|
750
|
+
if (!e.title)
|
|
751
|
+
return c("shareWebCard", "title is required", e);
|
|
752
|
+
if (!e.daokeUrl)
|
|
753
|
+
return c("shareWebCard", "daokeUrl is required", e);
|
|
754
|
+
const { activityDetail: n } = e, t = ut(e);
|
|
755
|
+
return u(
|
|
313
756
|
"shareWebCard",
|
|
314
757
|
{
|
|
315
758
|
...e,
|
|
316
|
-
shareTypes: e.shareTypes
|
|
759
|
+
shareTypes: (r = e.shareTypes) != null ? r : [x.RecentContacts, x.External, x.Channel],
|
|
760
|
+
activityDetail: I(n) ? JSON.stringify(n) : n
|
|
317
761
|
},
|
|
318
762
|
e,
|
|
319
|
-
{ queue: "serial" }
|
|
320
|
-
)
|
|
763
|
+
{ since: "4.4.0", queue: "serial" }
|
|
764
|
+
).catch((i) => {
|
|
765
|
+
throw t(), i;
|
|
766
|
+
});
|
|
321
767
|
}
|
|
322
|
-
|
|
323
|
-
|
|
768
|
+
let j;
|
|
769
|
+
function ut(e) {
|
|
770
|
+
j == null || j();
|
|
771
|
+
const { onShared: n, getSharePictureUrl: t, isSharePic: r } = e, i = r ? t : void 0;
|
|
772
|
+
let o, s;
|
|
773
|
+
const d = () => {
|
|
774
|
+
o == null || o(), s == null || s();
|
|
775
|
+
};
|
|
776
|
+
return (n || i) && (o = b("onShared", (a) => {
|
|
777
|
+
d(), n == null || n(a);
|
|
778
|
+
}, { since: "4.4.0" })), i && (s = Te("getSharePictureUrl", i, "4.4.0")), j = d, d;
|
|
324
779
|
}
|
|
325
|
-
function
|
|
326
|
-
return e.
|
|
780
|
+
function st(e) {
|
|
781
|
+
return !e.url || !/^https?:\/\//i.test(e.url) ? c("shareImage", "url must be a valid http(s) url", e) : u("shareImage", { url: e.url }, e, { queue: "serial" });
|
|
327
782
|
}
|
|
328
|
-
function
|
|
329
|
-
return
|
|
783
|
+
function ct(e) {
|
|
784
|
+
return u("openAddCustomEmoji", {}, e, { since: "4.4.0", queue: "serial" });
|
|
785
|
+
}
|
|
786
|
+
function dt(e) {
|
|
787
|
+
return e.serverId ? e.dynamicId ? u(
|
|
788
|
+
"openCommentPanel",
|
|
789
|
+
{
|
|
790
|
+
serverId: e.serverId,
|
|
791
|
+
dynamicId: e.dynamicId,
|
|
792
|
+
commentId: e.commentId,
|
|
793
|
+
autoFocusInput: e.autoFocusInput
|
|
794
|
+
},
|
|
795
|
+
e,
|
|
796
|
+
{ since: "4.4.0", queue: "serial" }
|
|
797
|
+
) : c("openCommentPanel", "dynamicId is required", e) : c("openCommentPanel", "serverId is required", e);
|
|
798
|
+
}
|
|
799
|
+
function at(e) {
|
|
800
|
+
return u("showLongVipDesDialog", {}, e, { since: "4.4.0", queue: "serial" });
|
|
801
|
+
}
|
|
802
|
+
function lt(e) {
|
|
803
|
+
return e.index === void 0 ? c("voteAction", "index is required", e) : u("voteAction", e, e, { since: "4.4.0", queue: "serial" });
|
|
804
|
+
}
|
|
805
|
+
function ft(e) {
|
|
806
|
+
return Array.isArray(e.selectedUserIds) ? w("4.4.0") ? gt(e) : u("openFriendsList", { selectedUserIds: e.selectedUserIds }, e, {
|
|
807
|
+
queue: "serial",
|
|
808
|
+
transformResult: je
|
|
809
|
+
}) : c("openFriendsList", "selectedUserIds is required", e);
|
|
810
|
+
}
|
|
811
|
+
function je(e) {
|
|
812
|
+
const n = I(e) ? e.selectedList : void 0;
|
|
813
|
+
return { selectedList: Array.isArray(n) ? n : [] };
|
|
814
|
+
}
|
|
815
|
+
function gt(e) {
|
|
816
|
+
let n;
|
|
817
|
+
const t = b("submitFriendsList", (r) => {
|
|
818
|
+
n = r;
|
|
819
|
+
}, { since: "4.4.0" });
|
|
820
|
+
return u("openFriendsList", { selectedUserIds: e.selectedUserIds }, e, {
|
|
821
|
+
legacyOnly: !0,
|
|
822
|
+
jsbridge: { result: () => je(n) }
|
|
823
|
+
}).finally(() => t());
|
|
824
|
+
}
|
|
825
|
+
function yt(e) {
|
|
826
|
+
return e.gameName ? e.serverId ? u("pointsMallBindGame", e, e, { since: "4.4.0", queue: "serial" }) : c("toBindGameRole", "serverId is required", e) : c("toBindGameRole", "gameName is required", e);
|
|
827
|
+
}
|
|
828
|
+
function ht(e) {
|
|
829
|
+
return u("bindGameRoleSuccess", {}, e, { since: "4.4.0" });
|
|
830
|
+
}
|
|
831
|
+
function bt(e) {
|
|
832
|
+
return e.type === void 0 ? c("showAd", "type is required", e) : u("showAdVideo", { type: e.type, params: e.params }, e, { since: "4.4.0", queue: "serial" });
|
|
833
|
+
}
|
|
834
|
+
function pt(e, n) {
|
|
835
|
+
b("onAdFinished", e, { since: "4.4.0", once: n == null ? void 0 : n.once });
|
|
836
|
+
}
|
|
837
|
+
function mt(e) {
|
|
838
|
+
v("onAdFinished", e);
|
|
839
|
+
}
|
|
840
|
+
function wt(e) {
|
|
841
|
+
return e.type ? u("updateData", { type: e.type, params: e.params }, e, { since: "4.4.0" }) : c("updateData", "type is required", e);
|
|
842
|
+
}
|
|
843
|
+
function vt(e) {
|
|
844
|
+
return e.user_id ? e.server_id ? u(
|
|
845
|
+
"openGiftBag",
|
|
846
|
+
{ user_id: e.user_id, openBag: e.openBag, server_id: e.server_id },
|
|
847
|
+
e,
|
|
848
|
+
{ since: "4.4.0", queue: "serial" }
|
|
849
|
+
) : c("openGiftBag", "server_id is required", e) : c("openGiftBag", "user_id is required", e);
|
|
850
|
+
}
|
|
851
|
+
function Pt(e) {
|
|
852
|
+
Te("getMemberActivate", e, "4.4.0");
|
|
853
|
+
}
|
|
854
|
+
function It() {
|
|
855
|
+
yn("getMemberActivate", "4.4.0");
|
|
856
|
+
}
|
|
857
|
+
const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
858
|
+
__proto__: null,
|
|
859
|
+
bindGameRoleSuccess: ht,
|
|
860
|
+
getCurrentCircleInfo: it,
|
|
861
|
+
getToken: rt,
|
|
862
|
+
login: tt,
|
|
863
|
+
offAdFinished: mt,
|
|
864
|
+
offMemberActivate: It,
|
|
865
|
+
onAdFinished: pt,
|
|
866
|
+
onMemberActivate: Pt,
|
|
867
|
+
openAddCustomEmoji: ct,
|
|
868
|
+
openCommentPanel: dt,
|
|
869
|
+
openFriendsList: ft,
|
|
870
|
+
openGiftBag: vt,
|
|
871
|
+
shareImage: st,
|
|
872
|
+
shareWebCard: ot,
|
|
873
|
+
showAd: bt,
|
|
874
|
+
showLongVipDesDialog: at,
|
|
875
|
+
toBindGameRole: yt,
|
|
876
|
+
updateData: wt,
|
|
877
|
+
voteAction: lt
|
|
878
|
+
}, Symbol.toStringTag, { value: "Module" })), Ct = "community-open-app", At = "https://app.docoi.cc/open-app", kt = /quark|qqbrowser|ucbrowser/, qt = 2e3;
|
|
879
|
+
function St(e, n) {
|
|
880
|
+
if (window.location.href = e, !n) return;
|
|
881
|
+
let t = !1;
|
|
882
|
+
const r = () => {
|
|
883
|
+
t || (t = !0, window.removeEventListener("pagehide", r), document.removeEventListener("visibilitychange", i));
|
|
884
|
+
}, i = () => {
|
|
885
|
+
document.hidden && r();
|
|
886
|
+
};
|
|
887
|
+
window.addEventListener("pagehide", r), document.addEventListener("visibilitychange", i), setTimeout(() => {
|
|
888
|
+
t || (r(), n());
|
|
889
|
+
}, qt);
|
|
890
|
+
}
|
|
891
|
+
function _t(e, n) {
|
|
892
|
+
if (fn()) {
|
|
893
|
+
window.parent.postMessage({ type: Ct, params: e.query }, "*");
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
const t = navigator.userAgent.toLowerCase(), r = t.includes("micromessenger") || t.includes("qq/");
|
|
897
|
+
if (Re() === "ios" && !r && !kt.test(t)) {
|
|
898
|
+
const i = e.url.includes("?") ? e.url.slice(e.url.indexOf("?")) : "";
|
|
899
|
+
window.location.href = `${At}${i}`;
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
St(e.url, n);
|
|
903
|
+
}
|
|
904
|
+
const me = "daoke://", $e = {
|
|
905
|
+
joinCirclePage: {
|
|
906
|
+
type: 1,
|
|
907
|
+
name: "查询圈子并加入",
|
|
908
|
+
since: "2.0.0",
|
|
909
|
+
fields: {
|
|
910
|
+
serverId: { key: "cid", required: !0 },
|
|
911
|
+
inviteCode: { key: "inviteCode", required: !0 }
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
dynamicDetailPage: {
|
|
915
|
+
type: 2,
|
|
916
|
+
name: "动态详情",
|
|
917
|
+
fields: {
|
|
918
|
+
dynamicId: { key: "dynamicid", required: !0 },
|
|
919
|
+
commentId: { key: "commentid" }
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
circleHomePage: {
|
|
923
|
+
type: 3,
|
|
924
|
+
name: "圈子主页",
|
|
925
|
+
fields: {
|
|
926
|
+
serverId: { key: "cid", required: !0 },
|
|
927
|
+
action: { key: "actionType", enum: { publish: "1" } },
|
|
928
|
+
relationType: {
|
|
929
|
+
key: "relationType",
|
|
930
|
+
enum: { apprentice: "1", graduate: "2", intimacyShare: "3", takeApprentice: "4" }
|
|
931
|
+
},
|
|
932
|
+
imageUrl: { key: "imageUrl" }
|
|
933
|
+
}
|
|
934
|
+
},
|
|
935
|
+
topicPage: { type: 7, name: "动态话题", fields: { topicId: { key: "topicId", required: !0 } } },
|
|
936
|
+
guideCatalogPage: {
|
|
937
|
+
type: 10,
|
|
938
|
+
name: "攻略一级分类",
|
|
939
|
+
fields: {
|
|
940
|
+
serverId: { key: "server_id", required: !0 },
|
|
941
|
+
channelId: { key: "circle_channel_id", required: !0 },
|
|
942
|
+
catalogId: { key: "catalog_id", required: !0 }
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
userHomePage: {
|
|
946
|
+
type: 11,
|
|
947
|
+
name: "用户主页",
|
|
948
|
+
fields: {
|
|
949
|
+
userId: { key: "user_id", required: !0 },
|
|
950
|
+
giftId: { key: "selected_gift_id" }
|
|
951
|
+
}
|
|
952
|
+
},
|
|
953
|
+
groupChatPage: {
|
|
954
|
+
type: 12,
|
|
955
|
+
name: "群聊",
|
|
956
|
+
fields: {
|
|
957
|
+
serverId: { key: "server_id", required: !0 },
|
|
958
|
+
groupId: { key: "groupID", required: !0 },
|
|
959
|
+
groupName: { key: "group_name" }
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
joinGroupPage: { type: 13, name: "查询小群并加入", fields: { inviteCode: { key: "inviteCode", required: !0 } } },
|
|
963
|
+
homePage: {
|
|
964
|
+
type: 14,
|
|
965
|
+
name: "新版首页",
|
|
966
|
+
fields: {
|
|
967
|
+
// 三个字段表里均为选填;serverId / channelId 4.4.0 新增,旧版忽略;取代已弃用的 type 8
|
|
968
|
+
tab: { key: "tabIndex", enum: { official: "0", community: "1" } },
|
|
969
|
+
serverId: { key: "serverId" },
|
|
970
|
+
channelId: { key: "channelId" }
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
coinRechargePage: { type: 15, name: "金币充值", fields: {} },
|
|
974
|
+
myPublishPage: { type: 16, name: "我的-发布", fields: {} },
|
|
975
|
+
gamePushSettingPage: { type: 17, name: "游戏离线推送开关", fields: { serverId: { key: "serverId", required: !0 } } },
|
|
976
|
+
myFavoritePage: { type: 19, name: "我的-收藏", since: "3.8.0", fields: {} },
|
|
977
|
+
douyinMallPage: { type: 20, name: "抖音商城", since: "3.8.0", fields: {} },
|
|
978
|
+
activityCenterPage: {
|
|
979
|
+
type: 21,
|
|
980
|
+
name: "活动中心",
|
|
981
|
+
since: "3.9.0",
|
|
982
|
+
fields: { tab: { key: "tab", enum: { welfare: "0", activity: "1" } } }
|
|
983
|
+
},
|
|
984
|
+
gameSubscribePage: { type: 22, name: "游戏消息订阅", since: "3.8.0", fields: {} },
|
|
985
|
+
privateChatPage: {
|
|
986
|
+
type: 25,
|
|
987
|
+
name: "私聊",
|
|
988
|
+
since: "4.1.0",
|
|
989
|
+
fields: {
|
|
990
|
+
userId: { key: "userId", required: !0 },
|
|
991
|
+
nickName: { key: "nickName", required: !0 }
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
browseHistoryPage: { type: 26, name: "浏览记录", since: "4.4.0", fields: {} },
|
|
995
|
+
profileEditPage: { type: 27, name: "资料编辑", since: "4.4.0", fields: {} },
|
|
996
|
+
likeListPage: {
|
|
997
|
+
type: 28,
|
|
998
|
+
name: "点赞列表",
|
|
999
|
+
since: "4.4.0",
|
|
1000
|
+
fields: {
|
|
1001
|
+
dynamicId: { key: "dynamicId", required: !0 },
|
|
1002
|
+
publishType: { key: "publishType", required: !0 }
|
|
1003
|
+
}
|
|
1004
|
+
},
|
|
1005
|
+
adPage: {
|
|
1006
|
+
type: 29,
|
|
1007
|
+
name: "广告页",
|
|
1008
|
+
since: "4.4.0",
|
|
1009
|
+
fields: { url: { key: "url", required: !0 } }
|
|
1010
|
+
},
|
|
1011
|
+
coinDetailPage: { type: 30, name: "金币明细", fields: {} },
|
|
1012
|
+
miniGamesPage: { type: 31, name: "小游戏集合", fields: {} },
|
|
1013
|
+
bindGamePage: {
|
|
1014
|
+
type: 32,
|
|
1015
|
+
name: "绑定游戏",
|
|
1016
|
+
since: "4.4.0",
|
|
1017
|
+
fields: {
|
|
1018
|
+
serverId: { key: "serverId", required: !0 },
|
|
1019
|
+
gameName: { key: "gameName", required: !0 }
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
playerReportPage: {
|
|
1023
|
+
type: 33,
|
|
1024
|
+
name: "玩家举报",
|
|
1025
|
+
since: "4.4.0",
|
|
1026
|
+
fields: {
|
|
1027
|
+
objectId: { key: "objectId", required: !0 },
|
|
1028
|
+
objectType: {
|
|
1029
|
+
key: "objectType",
|
|
1030
|
+
required: !0,
|
|
1031
|
+
enum: { user: "user", circle: "circle", comment: "comment", trends: "trends", message: "message" }
|
|
1032
|
+
},
|
|
1033
|
+
// conversationId 举报会话时需要,serverId 举报服务器时需要,表里均为选填
|
|
1034
|
+
conversationId: { key: "conversationId" },
|
|
1035
|
+
serverId: { key: "serverId" }
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
addCustomEmojiPage: { type: 34, name: "添加自定义表情", since: "4.4.0", fields: {} }
|
|
1039
|
+
}, Ot = {
|
|
1040
|
+
type: 18,
|
|
1041
|
+
name: "底部 tab",
|
|
1042
|
+
since: "3.7.0",
|
|
1043
|
+
fields: {
|
|
1044
|
+
tab: { key: "tab", required: !0, enum: { home: "0", discover: "1", message: "2", mine: "3" } },
|
|
1045
|
+
// subTab / form_mbti_share 3.8.0 新增,旧版忽略
|
|
1046
|
+
subTab: { key: "subTab", enum: { friends: "1_0", square: "1_1", comic: "1_2" } },
|
|
1047
|
+
fromMbtiShare: { key: "form_mbti_share", bool: !0 }
|
|
1048
|
+
}
|
|
1049
|
+
}, Rt = {
|
|
1050
|
+
type: 5,
|
|
1051
|
+
name: "Webview",
|
|
1052
|
+
fields: {
|
|
1053
|
+
url: { key: "url", required: !0 },
|
|
1054
|
+
type: { key: "h5Type", required: !0, enum: { normal: "1", mini: "2", dynamic: "3", immersive: "4" } },
|
|
1055
|
+
isUpdateApp: { key: "isUpdateApp", bool: !0 }
|
|
1056
|
+
}
|
|
1057
|
+
}, Tt = {
|
|
1058
|
+
type: 23,
|
|
1059
|
+
name: "纯透明 H5",
|
|
1060
|
+
since: "3.8.0",
|
|
1061
|
+
fields: { url: { key: "url", required: !0 } }
|
|
1062
|
+
}, S = {
|
|
1063
|
+
...$e,
|
|
1064
|
+
tab: Ot,
|
|
1065
|
+
webview: Rt,
|
|
1066
|
+
transparentWebview: Tt
|
|
1067
|
+
}, Mt = Object.fromEntries(
|
|
1068
|
+
Object.keys(S).map((e) => [String(S[e].type), e])
|
|
1069
|
+
);
|
|
1070
|
+
function Lt(e) {
|
|
1071
|
+
const n = Mt[e];
|
|
1072
|
+
return n ? { key: n, route: S[n] } : void 0;
|
|
1073
|
+
}
|
|
1074
|
+
const Ne = "daoke://page";
|
|
1075
|
+
class h extends Error {
|
|
1076
|
+
}
|
|
1077
|
+
function $(e, n = {}) {
|
|
1078
|
+
const t = { type: String(e.type) };
|
|
1079
|
+
for (const [r, i] of Object.entries(e.fields)) {
|
|
1080
|
+
const o = n[r];
|
|
1081
|
+
if (o == null || o === "") {
|
|
1082
|
+
if (i.required) throw new h(`${r} is required`);
|
|
1083
|
+
continue;
|
|
1084
|
+
}
|
|
1085
|
+
if (i.enum) {
|
|
1086
|
+
const s = i.enum[String(o)];
|
|
1087
|
+
if (s === void 0) throw new h(`${r} must be one of ${Object.keys(i.enum).join(" / ")}`);
|
|
1088
|
+
t[i.key] = s;
|
|
1089
|
+
} else if (i.bool)
|
|
1090
|
+
t[i.key] = o ? "true" : "false";
|
|
1091
|
+
else {
|
|
1092
|
+
if (I(o))
|
|
1093
|
+
throw new h(`${r} must be a string or number`);
|
|
1094
|
+
t[i.key] = String(o);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
return t;
|
|
1098
|
+
}
|
|
1099
|
+
function N(e) {
|
|
1100
|
+
const n = Object.entries(e).map(([t, r]) => `${encodeURIComponent(t)}=${encodeURIComponent(r)}`).join("&");
|
|
1101
|
+
return { url: `${Ne}?${n}`, query: e };
|
|
1102
|
+
}
|
|
1103
|
+
function xe(e) {
|
|
1104
|
+
if (!f(e) || !e.startsWith(Ne)) return null;
|
|
1105
|
+
const n = e.indexOf("?");
|
|
1106
|
+
if (n < 0) return null;
|
|
1107
|
+
const t = {};
|
|
1108
|
+
for (const r of e.slice(n + 1).split("&")) {
|
|
1109
|
+
if (!r) continue;
|
|
1110
|
+
const i = r.indexOf("="), o = ce(i < 0 ? r : r.slice(0, i));
|
|
1111
|
+
o && !(o in t) && (t[o] = i < 0 ? "" : ce(r.slice(i + 1)));
|
|
1112
|
+
}
|
|
1113
|
+
return t.type && /^\d+$/.test(t.type) ? t : null;
|
|
1114
|
+
}
|
|
1115
|
+
function Bt(e) {
|
|
1116
|
+
return "type" in e && !("url" in e);
|
|
1117
|
+
}
|
|
1118
|
+
function Dt(e) {
|
|
1119
|
+
if (!I(e == null ? void 0 : e.params)) throw new h("params is required");
|
|
1120
|
+
switch (e.api) {
|
|
1121
|
+
case "switchTab":
|
|
1122
|
+
return N($(S.tab, { ...e.params.params, tab: e.params.tab }));
|
|
1123
|
+
case "openWebview": {
|
|
1124
|
+
const { url: n, type: t = "normal", params: r } = e.params;
|
|
1125
|
+
if (!n || !f(n)) throw new h("url is required");
|
|
1126
|
+
if (t !== "transparent") return N($(S.webview, { ...r, url: n, type: t }));
|
|
1127
|
+
if (!n.startsWith("https://")) throw new h("transparent webview url must be https");
|
|
1128
|
+
if (r && Object.keys(r).length) throw new h("transparent webview does not support params");
|
|
1129
|
+
return N($(S.transparentWebview, { url: n }));
|
|
1130
|
+
}
|
|
1131
|
+
case "navigateTo": {
|
|
1132
|
+
if (Bt(e.params)) {
|
|
1133
|
+
const t = $e[e.params.type];
|
|
1134
|
+
if (!t) throw new h(`unknown page type: ${String(e.params.type)}`);
|
|
1135
|
+
return N($(t, e.params.params));
|
|
1136
|
+
}
|
|
1137
|
+
const n = xe(e.params.url);
|
|
1138
|
+
if (!n) throw new h("url or type is required, url must be a daoke://page?type= link");
|
|
1139
|
+
return { url: e.params.url, query: n };
|
|
1140
|
+
}
|
|
1141
|
+
default:
|
|
1142
|
+
throw new h("unknown navigation api");
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
const L = "4.4.0", jt = 11, $t = {
|
|
1146
|
+
profileEditPage: { page: 10 },
|
|
1147
|
+
douyinMallPage: { page: 14 },
|
|
1148
|
+
likeListPage: { page: 15, params: (e) => ({ dynamicId: e.dynamicId, publishType: e.publishType }) },
|
|
1149
|
+
adPage: { page: 16, params: (e) => ({ url: e.url }) }
|
|
1150
|
+
}, Nt = {
|
|
1151
|
+
bindGamePage: { method: "pointsMallBindGame", data: (e) => ({ gameName: e.gameName, serverId: e.serverId }) },
|
|
1152
|
+
addCustomEmojiPage: { method: "openAddCustomEmoji", data: () => ({}) }
|
|
1153
|
+
};
|
|
1154
|
+
function xt(e, n) {
|
|
1155
|
+
var r, i, o;
|
|
1156
|
+
const t = Lt((r = n.type) != null ? r : "");
|
|
1157
|
+
if (t && _e(t.route.since)) {
|
|
1158
|
+
const s = Nt[t.key];
|
|
1159
|
+
if (s) return { via: "legacyMethod", method: s.method, data: s.data(n) };
|
|
1160
|
+
const d = $t[t.key];
|
|
1161
|
+
if (!d) {
|
|
1162
|
+
const { name: a, type: y, since: q } = t.route;
|
|
1163
|
+
return { via: "unsupported", reason: `${a}(type ${y})需要 App ${q}+` };
|
|
1164
|
+
}
|
|
1165
|
+
return { via: "redirectPage", page: d.page, params: (o = (i = d.params) == null ? void 0 : i.call(d, n)) != null ? o : {} };
|
|
1166
|
+
}
|
|
1167
|
+
return Re() === "ios" ? { via: "redirectPage", page: jt, params: { url: e } } : { via: "locationHref" };
|
|
1168
|
+
}
|
|
1169
|
+
function Ut(e, n) {
|
|
1170
|
+
return Se() ? w(L) ? xt(e.url, e.query) : { via: "openScheme", extra: n } : { via: "launchOutsideApp" };
|
|
1171
|
+
}
|
|
1172
|
+
function Ft(e, n, t, r) {
|
|
1173
|
+
switch (n.via) {
|
|
1174
|
+
case "launchOutsideApp":
|
|
1175
|
+
return ee(e, { url: t.url }, () => _t(t, r == null ? void 0 : r.onLaunchFail), r);
|
|
1176
|
+
case "openScheme":
|
|
1177
|
+
return u("openScheme", { url: t.url, ...n.extra }, r, { queue: "serial" });
|
|
1178
|
+
case "redirectPage":
|
|
1179
|
+
return u("redirectPage", { page: n.page, params: n.params }, r, {
|
|
1180
|
+
since: L,
|
|
1181
|
+
queue: "serial"
|
|
1182
|
+
});
|
|
1183
|
+
case "legacyMethod":
|
|
1184
|
+
return u(n.method, n.data, r, { since: L, queue: "serial" });
|
|
1185
|
+
case "locationHref":
|
|
1186
|
+
return ee(e, { url: t.url }, () => {
|
|
1187
|
+
window.location.href = t.url;
|
|
1188
|
+
}, r);
|
|
1189
|
+
case "unsupported":
|
|
1190
|
+
return ie(e, n.reason, r);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
function Ue(e, n, t, r = {}) {
|
|
1194
|
+
const i = Ut(n, r);
|
|
1195
|
+
return Ft(e, i, n, t);
|
|
1196
|
+
}
|
|
1197
|
+
function oe(e, n) {
|
|
1198
|
+
let t;
|
|
1199
|
+
try {
|
|
1200
|
+
t = Dt(e);
|
|
1201
|
+
} catch (r) {
|
|
1202
|
+
return c(e.api, r instanceof h ? r.message : String(r), n);
|
|
1203
|
+
}
|
|
1204
|
+
return Ue(e.api, t, n);
|
|
1205
|
+
}
|
|
1206
|
+
function Ht(e) {
|
|
1207
|
+
return oe({ api: "switchTab", params: e }, e);
|
|
1208
|
+
}
|
|
1209
|
+
function Wt(e) {
|
|
1210
|
+
return oe({ api: "navigateTo", params: e }, e);
|
|
1211
|
+
}
|
|
1212
|
+
function Gt(e) {
|
|
1213
|
+
return oe({ api: "openWebview", params: e }, e);
|
|
1214
|
+
}
|
|
1215
|
+
function Vt(e) {
|
|
1216
|
+
var r;
|
|
1217
|
+
const { url: n, params: t } = e != null ? e : {};
|
|
1218
|
+
return !f(n) || !n.startsWith(me) ? c("openScheme", `url must start with ${me}`, e) : Ue("openScheme", { url: n, query: (r = xe(n)) != null ? r : {} }, e, t ? { params: t } : {});
|
|
1219
|
+
}
|
|
1220
|
+
function Jt(e) {
|
|
1221
|
+
return e != null && e.url ? u("openInExternalBrowser", { url: e.url }, e, {
|
|
1222
|
+
since: L,
|
|
1223
|
+
queue: "serial"
|
|
1224
|
+
}) : c("openInExternalBrowser", "url is required", e);
|
|
1225
|
+
}
|
|
1226
|
+
function Kt(e) {
|
|
1227
|
+
return u("closeWebView", {}, e, { since: L, queue: "serial" });
|
|
330
1228
|
}
|
|
331
|
-
const
|
|
1229
|
+
const zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
332
1230
|
__proto__: null,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
...
|
|
342
|
-
...
|
|
343
|
-
setDebug:
|
|
344
|
-
registerNativeHandler:
|
|
1231
|
+
closeWebView: Kt,
|
|
1232
|
+
navigateTo: Wt,
|
|
1233
|
+
openInExternalBrowser: Jt,
|
|
1234
|
+
openScheme: Vt,
|
|
1235
|
+
openWebview: Gt,
|
|
1236
|
+
switchTab: Ht
|
|
1237
|
+
}, Symbol.toStringTag, { value: "Module" })), ir = {
|
|
1238
|
+
...nt,
|
|
1239
|
+
...zt,
|
|
1240
|
+
...Et,
|
|
1241
|
+
setDebug: gn,
|
|
1242
|
+
registerNativeHandler: Me
|
|
345
1243
|
};
|
|
346
1244
|
export {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
1245
|
+
J as BRIDGE_ERROR,
|
|
1246
|
+
ve as CUSTOM,
|
|
1247
|
+
Ge as ENV_UNSUPPORTED,
|
|
1248
|
+
He as METHOD_NOT_FOUND,
|
|
1249
|
+
Zt as NETWORK_ERROR,
|
|
1250
|
+
Xt as NOT_LOGGED_IN,
|
|
1251
|
+
We as PARAMS_ERROR,
|
|
1252
|
+
Qt as PERMISSION_DENIED,
|
|
1253
|
+
er as RECORD_BUSY,
|
|
1254
|
+
nr as RECORD_FAILED,
|
|
1255
|
+
we as SUCCESS,
|
|
1256
|
+
ne as SYSTEM_EXCEPTION,
|
|
1257
|
+
x as ShareType,
|
|
1258
|
+
Be as ToastDuration,
|
|
1259
|
+
ht as bindGameRoleSuccess,
|
|
1260
|
+
Dn as cancelRecordAudio,
|
|
1261
|
+
Un as checkPermission,
|
|
1262
|
+
_n as chooseMedia,
|
|
1263
|
+
Kt as closeWebView,
|
|
1264
|
+
ln as compareVersions,
|
|
1265
|
+
ir as default,
|
|
1266
|
+
B as getAppBaseInfo,
|
|
1267
|
+
Jn as getBeforeInfo,
|
|
1268
|
+
Nn as getClipboardData,
|
|
1269
|
+
it as getCurrentCircleInfo,
|
|
1270
|
+
jn as getSystemInfo,
|
|
1271
|
+
rt as getToken,
|
|
1272
|
+
Vn as h5Loaded,
|
|
1273
|
+
In as hideKeyboard,
|
|
1274
|
+
rr as invokeDebug,
|
|
1275
|
+
Se as isInApp,
|
|
1276
|
+
tt as login,
|
|
1277
|
+
Wt as navigateTo,
|
|
1278
|
+
mt as offAdFinished,
|
|
1279
|
+
kn as offCommentPanelChange,
|
|
1280
|
+
Cn as offKeyboardHeightChange,
|
|
1281
|
+
It as offMemberActivate,
|
|
1282
|
+
et as offPageInvisible,
|
|
1283
|
+
Yn as offPageShow,
|
|
1284
|
+
Qn as offPageVisible,
|
|
1285
|
+
pt as onAdFinished,
|
|
1286
|
+
An as onCommentPanelChange,
|
|
1287
|
+
En as onKeyboardHeightChange,
|
|
1288
|
+
Pt as onMemberActivate,
|
|
1289
|
+
Zn as onPageInvisible,
|
|
1290
|
+
zn as onPageShow,
|
|
1291
|
+
Xn as onPageVisible,
|
|
1292
|
+
tr as onRoute,
|
|
1293
|
+
ct as openAddCustomEmoji,
|
|
1294
|
+
Hn as openApp,
|
|
1295
|
+
dt as openCommentPanel,
|
|
1296
|
+
ft as openFriendsList,
|
|
1297
|
+
vt as openGiftBag,
|
|
1298
|
+
Jt as openInExternalBrowser,
|
|
1299
|
+
Fn as openPhoneSetting,
|
|
1300
|
+
Vt as openScheme,
|
|
1301
|
+
Gt as openWebview,
|
|
1302
|
+
qn as previewImage,
|
|
1303
|
+
Sn as previewVideo,
|
|
1304
|
+
Me as registerNativeHandler,
|
|
1305
|
+
Tn as saveImageToPhotosAlbum,
|
|
1306
|
+
Kn as setBeforeInfo,
|
|
1307
|
+
$n as setClipboardData,
|
|
1308
|
+
gn as setDebug,
|
|
1309
|
+
st as shareImage,
|
|
1310
|
+
ot as shareWebCard,
|
|
1311
|
+
bt as showAd,
|
|
1312
|
+
at as showLongVipDesDialog,
|
|
1313
|
+
Gn as showPageName,
|
|
1314
|
+
wn as showToast,
|
|
1315
|
+
Ln as startRecordAudio,
|
|
1316
|
+
Bn as stopRecordAudio,
|
|
1317
|
+
Pn as stopVibrate,
|
|
1318
|
+
Wn as swipeBack,
|
|
1319
|
+
Ht as switchTab,
|
|
1320
|
+
yt as toBindGameRole,
|
|
1321
|
+
vn as triggerVibrate,
|
|
1322
|
+
wt as updateData,
|
|
1323
|
+
On as uploadFiles,
|
|
1324
|
+
lt as voteAction
|
|
392
1325
|
};
|