@docoi/mys-sdk 1.2.1 → 1.2.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.
- package/README.md +213 -213
- package/dist/api/basic.d.ts +1 -28
- package/dist/api/biz.d.ts +12 -3
- package/dist/api/router/index.d.ts +1 -1
- package/dist/api/router/routes.d.ts +0 -2
- package/dist/bridge.d.ts +2 -1
- package/dist/index.mjs +516 -526
- package/dist/types/base.d.ts +18 -0
- package/dist/types/params.d.ts +3 -1
- package/dist/types/router.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
const Ae = 0,
|
|
1
|
+
import Qe from "@docoi/jsbridge-sdk";
|
|
2
|
+
const Ae = 0, qe = -1, Ze = 1001, et = 1002, Ir = 2002, mr = 3001, Sr = 3002, Er = 4002, K = 5001, tt = 5002, _e = 9002, kr = 9101, Cr = 9102;
|
|
3
3
|
function l(e) {
|
|
4
4
|
return typeof e == "string";
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function Re(e) {
|
|
7
7
|
return typeof e == "number";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function k(e) {
|
|
10
10
|
return typeof e == "object" && e !== null;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
if (!
|
|
12
|
+
function m(e) {
|
|
13
|
+
if (!k(e) || Object.prototype.toString.call(e) !== "[object Object]") return !1;
|
|
14
14
|
const t = Object.getPrototypeOf(e);
|
|
15
15
|
return t === null || Object.getPrototypeOf(t) === null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function nt(e) {
|
|
18
18
|
return l(e) && /^\d+(\.\d+){1,3}$/.test(e);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
function
|
|
22
|
-
return l(e) && (
|
|
20
|
+
const rt = /^data:image\/[\w.+-]+;base64,[A-Za-z0-9+/]/i, it = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
21
|
+
function ot(e) {
|
|
22
|
+
return l(e) && (rt.test(e) || it.test(e));
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function ie(e, t = null) {
|
|
25
25
|
try {
|
|
26
26
|
return JSON.parse(e);
|
|
27
27
|
} catch (n) {
|
|
@@ -38,7 +38,7 @@ function ye(e) {
|
|
|
38
38
|
function w(e) {
|
|
39
39
|
if (l(e)) return e;
|
|
40
40
|
if (e instanceof Error) return e.message || "system error";
|
|
41
|
-
if (
|
|
41
|
+
if (k(e)) {
|
|
42
42
|
if (l(e.errMsg)) return e.errMsg;
|
|
43
43
|
if (l(e.msg)) return e.msg;
|
|
44
44
|
if (l(e.message)) return e.message;
|
|
@@ -47,29 +47,29 @@ function w(e) {
|
|
|
47
47
|
}
|
|
48
48
|
function R(e) {
|
|
49
49
|
if (!l(e)) return e;
|
|
50
|
-
const t =
|
|
51
|
-
return
|
|
50
|
+
const t = ie(e);
|
|
51
|
+
return m(t) ? t : e;
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class N extends Error {
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
if (typeof e == "bigint") throw new
|
|
57
|
-
if (e instanceof Map || e instanceof Set) throw new
|
|
55
|
+
function Oe(e, t) {
|
|
56
|
+
if (typeof e == "bigint") throw new N(`${t} 是 BigInt,不能传给 Native`);
|
|
57
|
+
if (e instanceof Map || e instanceof Set) throw new N(`${t} 是 ${e.constructor.name},不能传给 Native`);
|
|
58
58
|
if (typeof ArrayBuffer != "undefined" && (e instanceof ArrayBuffer || ArrayBuffer.isView(e)))
|
|
59
|
-
throw new
|
|
60
|
-
if (typeof Blob != "undefined" && e instanceof Blob) throw new
|
|
59
|
+
throw new N(`${t} 是二进制数据,不能传给 Native`);
|
|
60
|
+
if (typeof Blob != "undefined" && e instanceof Blob) throw new N(`${t} 是 Blob,不能传给 Native`);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
return e &&
|
|
62
|
+
function Te(e, t) {
|
|
63
|
+
return e && Oe(t, e), t;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const t = JSON.stringify(e,
|
|
65
|
+
function oe(e) {
|
|
66
|
+
const t = JSON.stringify(e, Te);
|
|
67
67
|
return t === void 0 ? void 0 : JSON.parse(t);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function ut(e) {
|
|
70
|
+
return Oe(e, "value"), JSON.stringify(e, Te);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const S = {
|
|
73
73
|
/** iOS 调用通道 */
|
|
74
74
|
iosInvoke: "jsbridge",
|
|
75
75
|
/** iOS 上 H5 异步回调的回传通道 */
|
|
@@ -80,59 +80,59 @@ const C = {
|
|
|
80
80
|
globalInvoke: "JSBridgeInvoke",
|
|
81
81
|
/** 回调 ID 前缀,1.0.0 为 cb_ */
|
|
82
82
|
callbackIdPrefix: "cb"
|
|
83
|
-
},
|
|
83
|
+
}, st = "[jsbridge]";
|
|
84
84
|
class G extends Error {
|
|
85
85
|
constructor(t, n) {
|
|
86
86
|
super(n), this.kind = t;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
let
|
|
89
|
+
const Y = { error: 1, warn: 2, info: 3, debug: 4 };
|
|
90
|
+
let Be = !1, Ne = "info", De = !0;
|
|
91
91
|
function g(e, ...t) {
|
|
92
|
-
!
|
|
92
|
+
!Be || !De || Y[e] > Y[Ne] || console[e](`${st} [${e.toUpperCase()}]`, ...t);
|
|
93
93
|
}
|
|
94
|
-
let
|
|
95
|
-
const V = /* @__PURE__ */ new Map(),
|
|
96
|
-
function
|
|
94
|
+
let ct = 1;
|
|
95
|
+
const V = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Map();
|
|
96
|
+
function Me(e) {
|
|
97
97
|
var n, r;
|
|
98
98
|
const t = (r = (n = window.webkit) == null ? void 0 : n.messageHandlers) == null ? void 0 : r[e];
|
|
99
99
|
return typeof (t == null ? void 0 : t.postMessage) == "function" ? t : void 0;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Le() {
|
|
102
102
|
return window.JSBridgeNative;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
const t =
|
|
104
|
+
function dt(e) {
|
|
105
|
+
const t = Me(S.iosInvoke);
|
|
106
106
|
if (t) {
|
|
107
107
|
t.postMessage(e);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
const n =
|
|
110
|
+
const n = Le();
|
|
111
111
|
if (n && typeof n.call == "function") {
|
|
112
112
|
n.call(JSON.stringify(e));
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
throw new G("communication", "当前环境不支持调用原生方法");
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
return `${
|
|
117
|
+
function lt() {
|
|
118
|
+
return `${S.callbackIdPrefix}_${Date.now()}_${ct++}`;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
120
|
+
function at(e) {
|
|
121
|
+
return k(e) && !!e.error;
|
|
122
122
|
}
|
|
123
123
|
function be(e, t) {
|
|
124
124
|
return new Promise((n, r) => {
|
|
125
|
-
const i =
|
|
125
|
+
const i = lt();
|
|
126
126
|
V.set(i, (o) => {
|
|
127
127
|
const c = R(o);
|
|
128
|
-
if (
|
|
128
|
+
if (at(c)) {
|
|
129
129
|
r(new G("native", w(c.error)));
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
n(c);
|
|
133
133
|
}), g("debug", `调用原生方法: ${e}`, t);
|
|
134
134
|
try {
|
|
135
|
-
|
|
135
|
+
dt({ method: e, params: t, callbackId: i });
|
|
136
136
|
} catch (o) {
|
|
137
137
|
V.delete(i), r(new G("communication", w(o)));
|
|
138
138
|
}
|
|
@@ -144,10 +144,10 @@ function ft(e, t) {
|
|
|
144
144
|
}
|
|
145
145
|
function we() {
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
147
|
+
function gt(e, t, n) {
|
|
148
|
+
return Q(), (n == null ? void 0 : n.queue) === "serial" ? ft(e, () => be(e, t)) : be(e, t);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function yt(e, t) {
|
|
151
151
|
if (!e) {
|
|
152
152
|
g("warn", "无效的回调ID");
|
|
153
153
|
return;
|
|
@@ -166,9 +166,9 @@ function gt(e, t) {
|
|
|
166
166
|
V.delete(e);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function ht(e, t) {
|
|
170
170
|
g("debug", `接收到事件: ${e}`, t);
|
|
171
|
-
const n =
|
|
171
|
+
const n = D.get(e);
|
|
172
172
|
if (n != null && n.length)
|
|
173
173
|
for (const r of [...n])
|
|
174
174
|
try {
|
|
@@ -177,7 +177,7 @@ function yt(e, t) {
|
|
|
177
177
|
g("warn", `事件处理器执行错误: ${e}`, i);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function bt(e) {
|
|
181
181
|
return JSON.stringify({ success: !0, data: e });
|
|
182
182
|
}
|
|
183
183
|
function ve(e) {
|
|
@@ -185,17 +185,17 @@ function ve(e) {
|
|
|
185
185
|
}
|
|
186
186
|
function pe(e, t) {
|
|
187
187
|
g("debug", `调用原生回调: ${e}`, t);
|
|
188
|
-
const n =
|
|
188
|
+
const n = Me(S.iosCallback);
|
|
189
189
|
if (n) {
|
|
190
190
|
n.postMessage({ callbackId: e, data: t });
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
-
const r =
|
|
193
|
+
const r = Le();
|
|
194
194
|
r && typeof r.callback == "function" && r.callback(e, JSON.stringify(t));
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function wt(e, t, n) {
|
|
197
197
|
g("debug", `接收到原生调用: ${e}`, t);
|
|
198
|
-
const r =
|
|
198
|
+
const r = X.get(e);
|
|
199
199
|
if (!r) {
|
|
200
200
|
const i = `方法 ${e} 未注册`;
|
|
201
201
|
return g("error", i), ve({ code: -1, message: i });
|
|
@@ -208,222 +208,209 @@ function bt(e, t, n) {
|
|
|
208
208
|
success: !1,
|
|
209
209
|
error: { message: w(o) }
|
|
210
210
|
})
|
|
211
|
-
), null) : (g("warn", `异步方法 ${e} 没有 callbackId,结果无法回传`), null) :
|
|
211
|
+
), null) : (g("warn", `异步方法 ${e} 没有 callbackId,结果无法回传`), null) : bt(i);
|
|
212
212
|
} catch (i) {
|
|
213
213
|
const o = w(i);
|
|
214
214
|
return g("error", `方法执行错误: ${e}`, o), ve({ message: o });
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function vt() {
|
|
218
218
|
if (typeof window == "undefined") return;
|
|
219
219
|
const e = window;
|
|
220
|
-
typeof e[
|
|
220
|
+
typeof e[S.globalEvent] != "function" && (e[S.globalEvent] = () => {
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
let Pe = !1;
|
|
224
|
-
function
|
|
224
|
+
function Q() {
|
|
225
225
|
if (Pe) return;
|
|
226
226
|
Pe = !0;
|
|
227
227
|
const e = window;
|
|
228
|
-
e[
|
|
228
|
+
e[S.globalCallback] = (t, n) => yt(t, n), e[S.globalEvent] = (t, n) => ht(t, n), e[S.globalInvoke] = (t, n, r) => wt(t, n, r), g("info", "初始化完成");
|
|
229
229
|
}
|
|
230
230
|
const O = {
|
|
231
|
-
callAsync:
|
|
231
|
+
callAsync: gt,
|
|
232
232
|
on(e, t) {
|
|
233
|
-
|
|
234
|
-
const n =
|
|
233
|
+
Q();
|
|
234
|
+
const n = D.get(e);
|
|
235
235
|
if (!n) {
|
|
236
|
-
|
|
236
|
+
D.set(e, [t]);
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
239
|
n.includes(t) || n.push(t);
|
|
240
240
|
},
|
|
241
241
|
off(e, t) {
|
|
242
|
-
const n =
|
|
242
|
+
const n = D.get(e);
|
|
243
243
|
if (!n) return;
|
|
244
244
|
const r = n.indexOf(t);
|
|
245
|
-
r !== -1 && (n.splice(r, 1), n.length ||
|
|
245
|
+
r !== -1 && (n.splice(r, 1), n.length || D.delete(e));
|
|
246
246
|
},
|
|
247
247
|
register(e, t) {
|
|
248
|
-
|
|
248
|
+
Q(), X.set(e, t);
|
|
249
249
|
},
|
|
250
250
|
unregister(e) {
|
|
251
|
-
|
|
251
|
+
X.delete(e);
|
|
252
252
|
},
|
|
253
253
|
setDebug(e, t) {
|
|
254
|
-
|
|
254
|
+
Be = e, t != null && t.logLevel && t.logLevel in Y && (Ne = t.logLevel), typeof (t == null ? void 0 : t.useConsole) == "boolean" && (De = t.useConsole);
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
let
|
|
258
|
-
function
|
|
259
|
-
return
|
|
257
|
+
let C;
|
|
258
|
+
function Ie(e) {
|
|
259
|
+
return m(e) && nt(e.app_version);
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function pt(e) {
|
|
262
262
|
const t = /#webBaseInfo(.*?[^\\])#/.exec(e);
|
|
263
|
-
return t != null && t[1] ?
|
|
263
|
+
return t != null && t[1] ? ie(t[1]) : null;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
if (
|
|
265
|
+
function L() {
|
|
266
|
+
if (C !== void 0) return C;
|
|
267
267
|
if (typeof window == "undefined") return null;
|
|
268
268
|
const e = window, t = e._appBaseInfo;
|
|
269
269
|
if (t !== void 0)
|
|
270
|
-
return
|
|
270
|
+
return C = Ie(t) ? t : null, C;
|
|
271
271
|
if (typeof navigator == "undefined") return null;
|
|
272
|
-
const n = navigator.userAgent.replace(/ +/g, "").replace(/[\r\n]/g, ""), r =
|
|
273
|
-
return
|
|
272
|
+
const n = navigator.userAgent.replace(/ +/g, "").replace(/[\r\n]/g, ""), r = pt(n);
|
|
273
|
+
return C = Ie(r) ? r : null, e._appBaseInfo = C, C;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
return !!
|
|
275
|
+
function $e() {
|
|
276
|
+
return !!L();
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
return !!e &&
|
|
278
|
+
function je(e) {
|
|
279
|
+
return !!e && Pt(e) === -1;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function xe() {
|
|
282
282
|
return typeof window == "undefined" ? 1 : window.devicePixelRatio || 1;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function Pt(e, t = ((n) => (n = L()) == null ? void 0 : n.app_version)() || "") {
|
|
285
285
|
if (!e && !t) return 0;
|
|
286
286
|
if (!e) return 1;
|
|
287
287
|
if (!t) return -1;
|
|
288
|
-
const r = (d) => d.split(".").map((
|
|
289
|
-
const h = Number(
|
|
288
|
+
const r = (d) => d.split(".").map((a) => {
|
|
289
|
+
const h = Number(a);
|
|
290
290
|
return Number.isFinite(h) ? h : 0;
|
|
291
291
|
}), i = r(e), o = r(t), c = Math.max(i.length, o.length);
|
|
292
292
|
for (let d = 0; d < c; d++) {
|
|
293
|
-
const
|
|
294
|
-
if (
|
|
295
|
-
if (
|
|
293
|
+
const a = d < i.length ? i[d] : 0, h = d < o.length ? o[d] : 0;
|
|
294
|
+
if (a > h) return -1;
|
|
295
|
+
if (a < h) return 1;
|
|
296
296
|
}
|
|
297
297
|
return 0;
|
|
298
298
|
}
|
|
299
|
-
const
|
|
300
|
-
function
|
|
299
|
+
const me = "docoi-web-community-frame";
|
|
300
|
+
function Ue() {
|
|
301
301
|
if (typeof navigator == "undefined") return "unknown";
|
|
302
302
|
const e = navigator.userAgent;
|
|
303
303
|
return /\(i[^;]+;( U;)? CPU.+Mac OS X/.test(e) ? "ios" : e.includes("Android") || e.includes("Linux") ? "android" : "unknown";
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function It() {
|
|
306
306
|
if (typeof window == "undefined") return !1;
|
|
307
307
|
try {
|
|
308
|
-
return window.self !== window.top && window.name ===
|
|
308
|
+
return window.self !== window.top && window.name === me;
|
|
309
309
|
} catch (e) {
|
|
310
|
-
return window.name ===
|
|
310
|
+
return window.name === me;
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
function Se() {
|
|
314
314
|
var t, n;
|
|
315
315
|
const e = typeof window == "undefined" ? void 0 : window;
|
|
316
316
|
return {
|
|
317
|
-
...
|
|
318
|
-
pixelRatio:
|
|
317
|
+
...L(),
|
|
318
|
+
pixelRatio: xe(),
|
|
319
319
|
screenWidth: (t = e == null ? void 0 : e.screen) == null ? void 0 : t.width,
|
|
320
320
|
screenHeight: (n = e == null ? void 0 : e.screen) == null ? void 0 : n.height,
|
|
321
321
|
windowWidth: e == null ? void 0 : e.innerWidth,
|
|
322
322
|
windowHeight: e == null ? void 0 : e.innerHeight
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
|
-
const q =
|
|
325
|
+
const q = Qe.init({
|
|
326
326
|
debug: !1
|
|
327
327
|
});
|
|
328
|
-
|
|
328
|
+
vt();
|
|
329
329
|
const mt = (e, t) => {
|
|
330
330
|
O.setDebug(e, t), q.setDebug(e, t);
|
|
331
331
|
};
|
|
332
332
|
let A;
|
|
333
|
-
const
|
|
333
|
+
const Ar = (e) => {
|
|
334
334
|
A = e;
|
|
335
335
|
};
|
|
336
|
-
function
|
|
336
|
+
function Z(e) {
|
|
337
337
|
try {
|
|
338
338
|
A == null || A(e);
|
|
339
339
|
} catch (t) {
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
function p(e) {
|
|
343
|
-
return
|
|
343
|
+
return $e() && je(e);
|
|
344
344
|
}
|
|
345
|
-
const
|
|
345
|
+
const ee = /* @__PURE__ */ new Map();
|
|
346
346
|
function y(e, t, n = {}) {
|
|
347
347
|
const { since: r, once: i, transform: o } = n;
|
|
348
|
-
|
|
348
|
+
E(e, t);
|
|
349
349
|
const c = p(r) ? O : q;
|
|
350
|
-
let d =
|
|
351
|
-
d || (d = /* @__PURE__ */ new Map(),
|
|
352
|
-
const
|
|
353
|
-
i &&
|
|
350
|
+
let d = ee.get(e);
|
|
351
|
+
d || (d = /* @__PURE__ */ new Map(), ee.set(e, d));
|
|
352
|
+
const a = (h) => {
|
|
353
|
+
i && E(e, t);
|
|
354
354
|
const P = R(h);
|
|
355
355
|
t(o ? o(P) : P);
|
|
356
356
|
};
|
|
357
|
-
return d.set(t, { handler:
|
|
357
|
+
return d.set(t, { handler: a, target: c }), c.on(e, a), () => E(e, t);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
const n =
|
|
359
|
+
function E(e, t) {
|
|
360
|
+
const n = ee.get(e);
|
|
361
361
|
if (n)
|
|
362
362
|
for (const r of t ? [t] : [...n.keys()]) {
|
|
363
363
|
const i = n.get(r);
|
|
364
364
|
i && (i.target.off(e, i.handler), n.delete(r));
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
function
|
|
367
|
+
function He(e, t, n) {
|
|
368
368
|
const r = p(n);
|
|
369
|
-
return r ? O.register(e, async (i) =>
|
|
369
|
+
return r ? O.register(e, async (i) => oe(await t(R(i)))) : Fe(e, t), () => (r ? O : q).unregister(e);
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function St(e, t) {
|
|
372
372
|
(p(t) ? O : q).unregister(e);
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function Fe(e, t) {
|
|
375
375
|
return q.register(e, async (n) => {
|
|
376
376
|
try {
|
|
377
|
-
|
|
378
|
-
return W(z(r));
|
|
377
|
+
return { success: !0, data: oe(await t(R(n))) };
|
|
379
378
|
} catch (r) {
|
|
380
|
-
|
|
381
|
-
try {
|
|
382
|
-
return W(i);
|
|
383
|
-
} catch (o) {
|
|
384
|
-
return { code: i.code, msg: i.msg, result: {} };
|
|
385
|
-
}
|
|
379
|
+
return { success: !1, error: { message: w(r) } };
|
|
386
380
|
}
|
|
387
381
|
}), () => q.unregister(e);
|
|
388
382
|
}
|
|
389
|
-
function
|
|
383
|
+
function ue(e) {
|
|
390
384
|
return { code: Ae, msg: "ok", result: e != null ? e : {} };
|
|
391
385
|
}
|
|
392
|
-
function
|
|
393
|
-
if (!
|
|
386
|
+
function Et(e) {
|
|
387
|
+
if (!m(e)) return;
|
|
394
388
|
const t = l(e.code) && /^-?\d+$/.test(e.code) ? Number(e.code) : e.code;
|
|
395
|
-
if (
|
|
389
|
+
if (Re(t))
|
|
396
390
|
return { code: t, msg: l(e.msg) ? e.msg : "", result: e.result };
|
|
397
391
|
}
|
|
398
|
-
function
|
|
399
|
-
const r = R(t), i =
|
|
400
|
-
if (!i) throw I(e,
|
|
392
|
+
function kt(e, t, n) {
|
|
393
|
+
const r = R(t), i = Et(r);
|
|
394
|
+
if (!i) throw I(e, qe, w(r));
|
|
401
395
|
const { code: o, msg: c, result: d } = i;
|
|
402
396
|
if (o !== Ae) throw I(e, o, c || `code ${o}`);
|
|
403
|
-
return
|
|
397
|
+
return ue(te(e, n, R(d)));
|
|
404
398
|
}
|
|
405
|
-
function
|
|
399
|
+
function te(e, t, n) {
|
|
406
400
|
try {
|
|
407
401
|
return t ? t(n) : n;
|
|
408
402
|
} catch (r) {
|
|
409
|
-
throw se(r) ? r : I(e,
|
|
403
|
+
throw se(r) ? r : I(e, _e, w(r));
|
|
410
404
|
}
|
|
411
405
|
}
|
|
412
406
|
function se(e) {
|
|
413
|
-
return
|
|
407
|
+
return k(e) && l(e.errMsg) && Re(e.errCode);
|
|
414
408
|
}
|
|
415
409
|
function I(e, t, n) {
|
|
416
410
|
return { errMsg: `${e}:fail ${n}`, errCode: t };
|
|
417
411
|
}
|
|
418
412
|
function Ct(e, t) {
|
|
419
|
-
return t instanceof G ? I(e, t.kind === "native" ?
|
|
420
|
-
}
|
|
421
|
-
function kt(e, t) {
|
|
422
|
-
return {
|
|
423
|
-
code: oe,
|
|
424
|
-
msg: `${e}:fail ${w(t)}`,
|
|
425
|
-
result: S(t) && "result" in t ? t.result : t
|
|
426
|
-
};
|
|
413
|
+
return t instanceof G ? I(e, t.kind === "native" ? Ze : K, t.message) : I(e, K, w(t));
|
|
427
414
|
}
|
|
428
415
|
function J(e, t) {
|
|
429
416
|
try {
|
|
@@ -435,68 +422,68 @@ function J(e, t) {
|
|
|
435
422
|
function ce(e, t) {
|
|
436
423
|
return J(t == null ? void 0 : t.fail, e), J(t == null ? void 0 : t.complete, e), Promise.reject(e);
|
|
437
424
|
}
|
|
438
|
-
function
|
|
425
|
+
function We(e, t, n) {
|
|
439
426
|
return t.then(
|
|
440
427
|
(r) => {
|
|
441
428
|
const i = r;
|
|
442
429
|
return J(n == null ? void 0 : n.success, i), J(n == null ? void 0 : n.complete, i), i;
|
|
443
430
|
},
|
|
444
|
-
(r) => ce(se(r) ? r : I(e,
|
|
431
|
+
(r) => ce(se(r) ? r : I(e, K, w(r)), n)
|
|
445
432
|
);
|
|
446
433
|
}
|
|
447
434
|
function s(e, t, n) {
|
|
448
|
-
return ce(I(e,
|
|
435
|
+
return ce(I(e, et, `parameter error: ${t}`), n);
|
|
449
436
|
}
|
|
450
437
|
function de(e, t, n) {
|
|
451
|
-
return ce(I(e,
|
|
438
|
+
return ce(I(e, tt, `unsupported: ${t}`), n);
|
|
452
439
|
}
|
|
453
|
-
function
|
|
440
|
+
function ne(e, t, n, r) {
|
|
454
441
|
var o;
|
|
455
|
-
A &&
|
|
442
|
+
A && Z({ fnName: e, channel: "local", appVersion: (o = L()) == null ? void 0 : o.app_version, method: e, data: t });
|
|
456
443
|
let i;
|
|
457
444
|
try {
|
|
458
|
-
i = Promise.resolve(
|
|
445
|
+
i = Promise.resolve(ue(n()));
|
|
459
446
|
} catch (c) {
|
|
460
|
-
i = Promise.reject(se(c) ? c : I(e,
|
|
447
|
+
i = Promise.reject(se(c) ? c : I(e, qe, w(c)));
|
|
461
448
|
}
|
|
462
|
-
return
|
|
449
|
+
return We(e, i, r);
|
|
463
450
|
}
|
|
464
451
|
function u(e, t = {}, n, r = {}) {
|
|
465
452
|
var ge;
|
|
466
|
-
const { since: i, legacyOnly: o, jsbridge: c, transformResult: d, ...
|
|
453
|
+
const { since: i, legacyOnly: o, jsbridge: c, transformResult: d, ...a } = r, h = o || p(i);
|
|
467
454
|
let P;
|
|
468
455
|
try {
|
|
469
|
-
const
|
|
470
|
-
P =
|
|
471
|
-
} catch (
|
|
472
|
-
const T =
|
|
456
|
+
const f = oe(t);
|
|
457
|
+
P = m(f) ? f : {};
|
|
458
|
+
} catch (f) {
|
|
459
|
+
const T = f instanceof N || f instanceof TypeError ? f.message : "参数无法序列化";
|
|
473
460
|
return s(e, T, n);
|
|
474
461
|
}
|
|
475
|
-
const
|
|
476
|
-
let
|
|
462
|
+
const fe = (ge = L()) == null ? void 0 : ge.app_version;
|
|
463
|
+
let $;
|
|
477
464
|
try {
|
|
478
465
|
if (h) {
|
|
479
|
-
const
|
|
480
|
-
A &&
|
|
481
|
-
(T) =>
|
|
466
|
+
const f = te(e, c == null ? void 0 : c.data, P);
|
|
467
|
+
A && Z({ fnName: e, channel: "jsbridge", appVersion: fe, since: i, method: e, data: f }), $ = O.callAsync(e, f, a).then(
|
|
468
|
+
(T) => ue(te(e, c == null ? void 0 : c.result, T)),
|
|
482
469
|
(T) => Promise.reject(Ct(e, T))
|
|
483
470
|
);
|
|
484
471
|
} else
|
|
485
|
-
A &&
|
|
486
|
-
} catch (
|
|
487
|
-
|
|
472
|
+
A && Z({ fnName: e, channel: "mysJSBridge", appVersion: fe, since: i, method: e, data: P }), $ = q.callAsync(e, P, a).then((f) => kt(e, f, d));
|
|
473
|
+
} catch (f) {
|
|
474
|
+
$ = Promise.reject(f);
|
|
488
475
|
}
|
|
489
|
-
return
|
|
476
|
+
return We(e, $, n);
|
|
490
477
|
}
|
|
491
|
-
const
|
|
492
|
-
var
|
|
478
|
+
const qr = u;
|
|
479
|
+
var Ge = /* @__PURE__ */ ((e) => (e[e.Short = 0] = "Short", e[e.Long = 1] = "Long", e))(Ge || {}), W = /* @__PURE__ */ ((e) => (e[e.RecentContacts = 1] = "RecentContacts", e[e.External = 2] = "External", e[e.Channel = 3] = "Channel", e))(W || {});
|
|
493
480
|
function At(e) {
|
|
494
481
|
var t;
|
|
495
482
|
return e.text ? u(
|
|
496
483
|
"showToast",
|
|
497
484
|
{
|
|
498
485
|
text: e.text,
|
|
499
|
-
duration: (t = e.duration) != null ? t :
|
|
486
|
+
duration: (t = e.duration) != null ? t : Ge.Short
|
|
500
487
|
},
|
|
501
488
|
e,
|
|
502
489
|
{
|
|
@@ -533,19 +520,13 @@ function Ot(e, t) {
|
|
|
533
520
|
y("keyboardHeightChange", e, {
|
|
534
521
|
since: "4.4.0",
|
|
535
522
|
once: t == null ? void 0 : t.once,
|
|
536
|
-
transform: (n) => n ? n /
|
|
523
|
+
transform: (n) => n ? n / xe() : 0
|
|
537
524
|
});
|
|
538
525
|
}
|
|
539
526
|
function Tt(e) {
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
function Bt(e, t) {
|
|
543
|
-
y("onCommentPanelChange", e, { since: "4.4.0", once: t == null ? void 0 : t.once });
|
|
544
|
-
}
|
|
545
|
-
function Nt(e) {
|
|
546
|
-
m("onCommentPanelChange", e);
|
|
527
|
+
E("keyboardHeightChange", e);
|
|
547
528
|
}
|
|
548
|
-
function
|
|
529
|
+
function Ve(e, t) {
|
|
549
530
|
var i, o;
|
|
550
531
|
if (!((i = t.urls) != null && i.length))
|
|
551
532
|
return s(e, "urls is required", t);
|
|
@@ -564,13 +545,13 @@ function Ge(e, t) {
|
|
|
564
545
|
{ legacyOnly: !0 }
|
|
565
546
|
) : u("previewMedia", { type: r ? "image" : "video", urls: t.urls, current: n }, t);
|
|
566
547
|
}
|
|
567
|
-
function
|
|
568
|
-
return
|
|
548
|
+
function Bt(e) {
|
|
549
|
+
return Ve("previewImage", e);
|
|
569
550
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
551
|
+
function Nt(e) {
|
|
552
|
+
return Ve("previewVideo", e);
|
|
572
553
|
}
|
|
573
|
-
function
|
|
554
|
+
function Dt(e = {}) {
|
|
574
555
|
var t, n, r, i, o;
|
|
575
556
|
return e.count !== void 0 && (!Number.isInteger(e.count) || e.count <= 0) ? s("chooseMedia", "可选择照片数量范围为1-9张", e) : u(
|
|
576
557
|
"chooseMedia",
|
|
@@ -585,16 +566,16 @@ function Lt(e = {}) {
|
|
|
585
566
|
{ queue: "serial" }
|
|
586
567
|
);
|
|
587
568
|
}
|
|
588
|
-
let
|
|
589
|
-
function
|
|
569
|
+
let z = !1;
|
|
570
|
+
function Mt(e) {
|
|
590
571
|
var n;
|
|
591
572
|
if (!Array.isArray(e.files) || e.files.length === 0)
|
|
592
573
|
return s("uploadFiles", "files is required", e);
|
|
593
574
|
if (e.files.some((r) => !r))
|
|
594
575
|
return s("uploadFiles", "files[] is required", e);
|
|
595
|
-
if (
|
|
576
|
+
if (z)
|
|
596
577
|
return s("uploadFiles", "another uploadFiles request is in progress", e);
|
|
597
|
-
|
|
578
|
+
z = !0;
|
|
598
579
|
const t = e.onProgress ? y("uploadFilesProgress", e.onProgress) : void 0;
|
|
599
580
|
return u(
|
|
600
581
|
"uploadFiles",
|
|
@@ -605,22 +586,22 @@ function $t(e) {
|
|
|
605
586
|
e,
|
|
606
587
|
{ queue: "serial" }
|
|
607
588
|
).finally(() => {
|
|
608
|
-
|
|
589
|
+
z = !1, t == null || t();
|
|
609
590
|
});
|
|
610
591
|
}
|
|
611
|
-
function
|
|
612
|
-
const t =
|
|
592
|
+
function Lt(e) {
|
|
593
|
+
const t = m(e) ? e : {};
|
|
613
594
|
if (t.status === "success" || t.result === "success") return;
|
|
614
|
-
throw { errMsg: `saveImageToPhotosAlbum:fail ${l(t.reason) && t.reason ? t.reason : "unknown reason"}`, errCode:
|
|
595
|
+
throw { errMsg: `saveImageToPhotosAlbum:fail ${l(t.reason) && t.reason ? t.reason : "unknown reason"}`, errCode: _e, errDetail: e };
|
|
615
596
|
}
|
|
616
|
-
function
|
|
617
|
-
return
|
|
597
|
+
function $t(e) {
|
|
598
|
+
return ot(e == null ? void 0 : e.filePath) ? u("saveMediaToPhotosAlbum", { type: "image", file: e.filePath }, e, {
|
|
618
599
|
legacyOnly: !0,
|
|
619
|
-
jsbridge: { result:
|
|
600
|
+
jsbridge: { result: Lt }
|
|
620
601
|
}) : s("saveImageToPhotosAlbum", "filePath must be base64 data (data URL or plain base64)", e);
|
|
621
602
|
}
|
|
622
603
|
const Ee = ["qrCode", "barCode"];
|
|
623
|
-
function
|
|
604
|
+
function jt(e = {}) {
|
|
624
605
|
const { scanType: t, onlyFromCamera: n } = e;
|
|
625
606
|
return t !== void 0 && (!Array.isArray(t) || t.length === 0 || t.some((r) => !Ee.includes(r))) ? s("scanCode", "scanType must be a non-empty array of qrCode or barCode", e) : n !== void 0 && typeof n != "boolean" ? s("scanCode", "onlyFromCamera must be a boolean", e) : u(
|
|
626
607
|
"scanCode",
|
|
@@ -631,7 +612,7 @@ function Ut(e = {}) {
|
|
|
631
612
|
queue: "serial",
|
|
632
613
|
// 取消时 Native 可能不带 result 或只带 cancelled,补齐成约定结构
|
|
633
614
|
transformResult: (r) => {
|
|
634
|
-
const i =
|
|
615
|
+
const i = m(r) ? r : {}, o = i.cancelled === !0;
|
|
635
616
|
return {
|
|
636
617
|
result: o || !l(i.result) ? "" : i.result,
|
|
637
618
|
scanType: o ? void 0 : i.scanType,
|
|
@@ -642,7 +623,7 @@ function Ut(e = {}) {
|
|
|
642
623
|
);
|
|
643
624
|
}
|
|
644
625
|
let v;
|
|
645
|
-
function
|
|
626
|
+
function xt(e) {
|
|
646
627
|
v == null || v.release();
|
|
647
628
|
const { onEnd: t, onProgress: n } = e != null ? e : {};
|
|
648
629
|
let r, i;
|
|
@@ -656,16 +637,16 @@ function Ht(e) {
|
|
|
656
637
|
o.release(), t == null || t({ ...c, duration: c.duration / 1e3, size: c.size / 1024 });
|
|
657
638
|
}), v = o, o;
|
|
658
639
|
}
|
|
659
|
-
function
|
|
640
|
+
function Ut(e) {
|
|
660
641
|
const t = e == null ? void 0 : e.maxDuration;
|
|
661
642
|
if (t !== void 0 && (!Number.isFinite(t) || t <= 0))
|
|
662
643
|
return s("startRecordAudio", "maxDuration must be a number greater than 0", e);
|
|
663
|
-
const { release: n } =
|
|
644
|
+
const { release: n } = xt(e);
|
|
664
645
|
return u("startRecordAudio", { maxDuration: t }, e, { queue: "serial" }).catch((r) => {
|
|
665
646
|
throw n(), r;
|
|
666
647
|
});
|
|
667
648
|
}
|
|
668
|
-
function
|
|
649
|
+
function Ht(e) {
|
|
669
650
|
const t = v;
|
|
670
651
|
return u("stopRecordAudio", {}, e).then(
|
|
671
652
|
(n) => (t == null || t.stopProgress(), n),
|
|
@@ -674,208 +655,206 @@ function Wt(e) {
|
|
|
674
655
|
}
|
|
675
656
|
);
|
|
676
657
|
}
|
|
677
|
-
function
|
|
658
|
+
function Ft(e) {
|
|
678
659
|
return v == null || v.release(), u("cancelRecordAudio", {}, e);
|
|
679
660
|
}
|
|
680
|
-
function
|
|
681
|
-
return p("4.4.0") ?
|
|
682
|
-
transformResult: (t) => ({ ...Se(), ...
|
|
661
|
+
function Wt(e) {
|
|
662
|
+
return p("4.4.0") ? ne("getSystemInfo", {}, Se, e) : u("getSystemInfo", {}, e, {
|
|
663
|
+
transformResult: (t) => ({ ...Se(), ...m(t) ? t : {} })
|
|
683
664
|
});
|
|
684
665
|
}
|
|
685
|
-
function
|
|
666
|
+
function Gt(e) {
|
|
686
667
|
return e.data === void 0 ? s("setClipboardData", "data is required", e) : u("setClipboardData", { data: e.data }, e);
|
|
687
668
|
}
|
|
688
|
-
function
|
|
669
|
+
function Vt(e) {
|
|
689
670
|
return u("getClipboardData", {}, e);
|
|
690
671
|
}
|
|
691
|
-
function
|
|
692
|
-
return { permission: "notification", result:
|
|
672
|
+
function Jt(e) {
|
|
673
|
+
return { permission: "notification", result: m(e) && e.isOpen === !0 ? "granted" : "denied" };
|
|
693
674
|
}
|
|
694
|
-
function
|
|
675
|
+
function zt(e) {
|
|
695
676
|
return e.permission ? p("4.4.0") ? e.permission !== "notification" ? de("checkPermission", `permission ${e.permission} requires app >= 4.4.0`, e) : u("isNotificationEnabled", {}, e, {
|
|
696
677
|
legacyOnly: !0,
|
|
697
|
-
jsbridge: { result:
|
|
678
|
+
jsbridge: { result: Jt }
|
|
698
679
|
}) : u("checkPermission", { permission: e.permission }, e) : s("checkPermission", "permission is required", e);
|
|
699
680
|
}
|
|
700
|
-
function
|
|
681
|
+
function Kt(e) {
|
|
701
682
|
return e.permission ? p("4.4.0") ? e.permission !== "notification" ? de("openPhoneSetting", `permission ${e.permission} requires app >= 4.4.0`, e) : u("gotoSetPhoneNotify", {}, e, { legacyOnly: !0 }) : u("openPhoneSetting", { permission: e.permission }, e, { queue: "serial" }) : s("openPhoneSetting", "permission is required", e);
|
|
702
683
|
}
|
|
703
|
-
const
|
|
684
|
+
const re = "web_";
|
|
704
685
|
function le(e) {
|
|
705
|
-
return e.startsWith(
|
|
686
|
+
return e.startsWith(re) ? e : `${re}${e}`;
|
|
706
687
|
}
|
|
707
|
-
const
|
|
708
|
-
function
|
|
688
|
+
const ke = Symbol("invalid json");
|
|
689
|
+
function Yt(e) {
|
|
709
690
|
if (!l(e == null ? void 0 : e.key) || !e.key)
|
|
710
691
|
return s("setStorage", "key is required", e);
|
|
711
692
|
let t;
|
|
712
693
|
try {
|
|
713
|
-
t =
|
|
694
|
+
t = ut(e.value);
|
|
714
695
|
} catch (n) {
|
|
715
696
|
return s("setStorage", w(n), e);
|
|
716
697
|
}
|
|
717
698
|
return t === void 0 ? s("setStorage", "value cannot be serialized to JSON", e) : u("setStorage", { key: le(e.key), value: t }, e);
|
|
718
699
|
}
|
|
719
|
-
function
|
|
700
|
+
function Xt(e) {
|
|
720
701
|
return !l(e == null ? void 0 : e.key) || !e.key ? s("getStorage", "key is required", e) : u("getStorage", { key: le(e.key) }, e, {
|
|
721
702
|
// Native 约定 result 为 { data: string | null },data 是 setStorage 存入的 JSON 文本;抛错由钩子归一成失败
|
|
722
703
|
transformResult: (t) => {
|
|
723
|
-
const n =
|
|
704
|
+
const n = m(t) ? t.data : void 0;
|
|
724
705
|
if (n == null) return { data: null };
|
|
725
706
|
if (!l(n)) throw new Error("stored data is not a string");
|
|
726
|
-
const r =
|
|
727
|
-
if (r ===
|
|
707
|
+
const r = ie(n, ke);
|
|
708
|
+
if (r === ke) throw new Error("stored data is not valid JSON");
|
|
728
709
|
return { data: r };
|
|
729
710
|
}
|
|
730
711
|
});
|
|
731
712
|
}
|
|
732
|
-
function
|
|
713
|
+
function Qt(e) {
|
|
733
714
|
return !l(e == null ? void 0 : e.key) || !e.key ? s("removeStorage", "key is required", e) : u("removeStorage", { key: le(e.key) }, e);
|
|
734
715
|
}
|
|
735
|
-
function
|
|
736
|
-
return u("clearStorage", { prefix:
|
|
716
|
+
function Zt(e) {
|
|
717
|
+
return u("clearStorage", { prefix: re }, e);
|
|
737
718
|
}
|
|
738
|
-
function
|
|
719
|
+
function en(e = {}) {
|
|
739
720
|
return u("openApp", { url: e.url, packageNames: e.packageNames }, e, { since: "4.4.0", queue: "serial" });
|
|
740
721
|
}
|
|
741
|
-
function
|
|
722
|
+
function tn(e) {
|
|
742
723
|
return typeof (e == null ? void 0 : e.enable) != "boolean" ? s("swipeBack", "enable must be a boolean", e) : u("swipeBack", { enable: e.enable }, e);
|
|
743
724
|
}
|
|
744
|
-
function
|
|
725
|
+
function nn(e = {}) {
|
|
745
726
|
var t;
|
|
746
727
|
return e.enabled !== void 0 && typeof e.enabled != "boolean" ? s("setPullDownRefresh", "enabled must be a boolean", e) : u("setPullDownRefresh", { enabled: (t = e.enabled) != null ? t : !0 }, e);
|
|
747
728
|
}
|
|
748
|
-
function
|
|
729
|
+
function rn(e) {
|
|
749
730
|
return u("startPullDownRefresh", {}, e);
|
|
750
731
|
}
|
|
751
|
-
function
|
|
732
|
+
function on(e) {
|
|
752
733
|
return u("stopPullDownRefresh", {}, e);
|
|
753
734
|
}
|
|
754
|
-
function
|
|
735
|
+
function un(e, t) {
|
|
755
736
|
y("pullDownRefresh", e, { once: t == null ? void 0 : t.once });
|
|
756
737
|
}
|
|
757
|
-
function
|
|
758
|
-
|
|
738
|
+
function sn(e) {
|
|
739
|
+
E("pullDownRefresh", e);
|
|
759
740
|
}
|
|
760
|
-
function
|
|
741
|
+
function cn(e) {
|
|
761
742
|
return l(e == null ? void 0 : e.title) ? u("setNavigationBarTitle", { title: e.title }, e) : s("setNavigationBarTitle", "title must be a string", e);
|
|
762
743
|
}
|
|
763
|
-
const
|
|
764
|
-
function
|
|
765
|
-
return !l(e == null ? void 0 : e.backgroundColor) || !
|
|
744
|
+
const dn = /^#[0-9a-fA-F]{6}$/;
|
|
745
|
+
function ln(e) {
|
|
746
|
+
return !l(e == null ? void 0 : e.backgroundColor) || !dn.test(e.backgroundColor) ? s("setNavigationBarColor", "backgroundColor must be #RRGGBB", e) : e.frontColor !== "white" && e.frontColor !== "black" ? s("setNavigationBarColor", "frontColor must be white or black", e) : u("setNavigationBarColor", { backgroundColor: e.backgroundColor, frontColor: e.frontColor }, e);
|
|
766
747
|
}
|
|
767
|
-
function
|
|
748
|
+
function an(e) {
|
|
768
749
|
return u("showNavigationBar", {}, e);
|
|
769
750
|
}
|
|
770
|
-
function
|
|
751
|
+
function fn(e) {
|
|
771
752
|
return u("hideNavigationBar", {}, e);
|
|
772
753
|
}
|
|
773
|
-
function
|
|
754
|
+
function gn(e) {
|
|
774
755
|
return (e == null ? void 0 : e.style) !== "light" && (e == null ? void 0 : e.style) !== "dark" ? s("setStatusBarStyle", "style must be light or dark", e) : u("setStatusBarStyle", { style: e.style }, e);
|
|
775
756
|
}
|
|
776
|
-
function
|
|
757
|
+
function yn(e) {
|
|
777
758
|
return e.nameType === void 0 ? s("showPageName", "nameType is required", e) : u("showPageName", { nameType: e.nameType }, e, { since: "4.4.0" });
|
|
778
759
|
}
|
|
779
|
-
function
|
|
760
|
+
function hn(e) {
|
|
780
761
|
return u("H5Loaded", {}, e, { since: "4.4.0" });
|
|
781
762
|
}
|
|
782
|
-
function
|
|
763
|
+
function bn(e) {
|
|
783
764
|
return u("getBeforeInfo", {}, e, { since: "4.4.0" });
|
|
784
765
|
}
|
|
785
|
-
function
|
|
766
|
+
function wn(e = {}) {
|
|
786
767
|
return u("setH5BeforeInfo", e, e, { since: "4.4.0" });
|
|
787
768
|
}
|
|
788
|
-
function
|
|
769
|
+
function vn(e, t) {
|
|
789
770
|
y("h5PageShow", e, { since: "4.4.0", once: t == null ? void 0 : t.once });
|
|
790
771
|
}
|
|
791
|
-
function
|
|
792
|
-
|
|
772
|
+
function pn(e) {
|
|
773
|
+
E("h5PageShow", e);
|
|
793
774
|
}
|
|
794
|
-
function
|
|
775
|
+
function Pn(e, t) {
|
|
795
776
|
y("h5PageVisible", e, { since: "4.4.0", once: t == null ? void 0 : t.once });
|
|
796
777
|
}
|
|
797
|
-
function
|
|
798
|
-
|
|
778
|
+
function In(e) {
|
|
779
|
+
E("h5PageVisible", e);
|
|
799
780
|
}
|
|
800
|
-
function
|
|
781
|
+
function mn(e, t) {
|
|
801
782
|
y("h5PageInvisible", e, { since: "4.4.0", once: t == null ? void 0 : t.once });
|
|
802
783
|
}
|
|
803
|
-
function
|
|
804
|
-
|
|
784
|
+
function Sn(e) {
|
|
785
|
+
E("h5PageInvisible", e);
|
|
805
786
|
}
|
|
806
|
-
const
|
|
787
|
+
const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
807
788
|
__proto__: null,
|
|
808
|
-
cancelRecordAudio:
|
|
809
|
-
checkPermission:
|
|
810
|
-
chooseMedia:
|
|
811
|
-
clearStorage:
|
|
812
|
-
getBeforeInfo:
|
|
813
|
-
getClipboardData:
|
|
814
|
-
getStorage:
|
|
815
|
-
getSystemInfo:
|
|
816
|
-
h5Loaded:
|
|
789
|
+
cancelRecordAudio: Ft,
|
|
790
|
+
checkPermission: zt,
|
|
791
|
+
chooseMedia: Dt,
|
|
792
|
+
clearStorage: Zt,
|
|
793
|
+
getBeforeInfo: bn,
|
|
794
|
+
getClipboardData: Vt,
|
|
795
|
+
getStorage: Xt,
|
|
796
|
+
getSystemInfo: Wt,
|
|
797
|
+
h5Loaded: hn,
|
|
817
798
|
hideKeyboard: Rt,
|
|
818
|
-
hideNavigationBar:
|
|
819
|
-
offCommentPanelChange: Nt,
|
|
799
|
+
hideNavigationBar: fn,
|
|
820
800
|
offKeyboardHeightChange: Tt,
|
|
821
|
-
offPageInvisible:
|
|
822
|
-
offPageShow:
|
|
823
|
-
offPageVisible:
|
|
824
|
-
offPullDownRefresh:
|
|
825
|
-
onCommentPanelChange: Bt,
|
|
801
|
+
offPageInvisible: Sn,
|
|
802
|
+
offPageShow: pn,
|
|
803
|
+
offPageVisible: In,
|
|
804
|
+
offPullDownRefresh: sn,
|
|
826
805
|
onKeyboardHeightChange: Ot,
|
|
827
|
-
onPageInvisible:
|
|
828
|
-
onPageShow:
|
|
829
|
-
onPageVisible:
|
|
830
|
-
onPullDownRefresh:
|
|
831
|
-
openApp:
|
|
832
|
-
openPhoneSetting:
|
|
833
|
-
previewImage:
|
|
834
|
-
previewVideo:
|
|
835
|
-
removeStorage:
|
|
836
|
-
saveImageToPhotosAlbum:
|
|
837
|
-
scanCode:
|
|
838
|
-
setBeforeInfo:
|
|
839
|
-
setClipboardData:
|
|
840
|
-
setNavigationBarColor:
|
|
841
|
-
setNavigationBarTitle:
|
|
842
|
-
setPullDownRefresh:
|
|
843
|
-
setStatusBarStyle:
|
|
844
|
-
setStorage:
|
|
845
|
-
showNavigationBar:
|
|
846
|
-
showPageName:
|
|
806
|
+
onPageInvisible: mn,
|
|
807
|
+
onPageShow: vn,
|
|
808
|
+
onPageVisible: Pn,
|
|
809
|
+
onPullDownRefresh: un,
|
|
810
|
+
openApp: en,
|
|
811
|
+
openPhoneSetting: Kt,
|
|
812
|
+
previewImage: Bt,
|
|
813
|
+
previewVideo: Nt,
|
|
814
|
+
removeStorage: Qt,
|
|
815
|
+
saveImageToPhotosAlbum: $t,
|
|
816
|
+
scanCode: jt,
|
|
817
|
+
setBeforeInfo: wn,
|
|
818
|
+
setClipboardData: Gt,
|
|
819
|
+
setNavigationBarColor: ln,
|
|
820
|
+
setNavigationBarTitle: cn,
|
|
821
|
+
setPullDownRefresh: nn,
|
|
822
|
+
setStatusBarStyle: gn,
|
|
823
|
+
setStorage: Yt,
|
|
824
|
+
showNavigationBar: an,
|
|
825
|
+
showPageName: yn,
|
|
847
826
|
showToast: At,
|
|
848
|
-
startPullDownRefresh:
|
|
849
|
-
startRecordAudio:
|
|
850
|
-
stopPullDownRefresh:
|
|
851
|
-
stopRecordAudio:
|
|
827
|
+
startPullDownRefresh: rn,
|
|
828
|
+
startRecordAudio: Ut,
|
|
829
|
+
stopPullDownRefresh: on,
|
|
830
|
+
stopRecordAudio: Ht,
|
|
852
831
|
stopVibrate: _t,
|
|
853
|
-
swipeBack:
|
|
832
|
+
swipeBack: tn,
|
|
854
833
|
triggerVibrate: qt,
|
|
855
|
-
uploadFiles:
|
|
834
|
+
uploadFiles: Mt
|
|
856
835
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
857
|
-
function
|
|
836
|
+
function kn(e) {
|
|
858
837
|
return u("login", {}, e, { since: "4.4.0", queue: "serial" });
|
|
859
838
|
}
|
|
860
|
-
function
|
|
839
|
+
function Cn(e) {
|
|
861
840
|
return u("getToken", {}, e, { since: "4.4.0" });
|
|
862
841
|
}
|
|
863
|
-
function
|
|
842
|
+
function An(e) {
|
|
864
843
|
return u("getCurrentCircleInfo", {}, e, { since: "4.4.0" });
|
|
865
844
|
}
|
|
866
|
-
function
|
|
845
|
+
function qn(e) {
|
|
867
846
|
var r;
|
|
868
847
|
if (!e.title)
|
|
869
848
|
return s("shareWebCard", "title is required", e);
|
|
870
849
|
if (!e.daokeUrl)
|
|
871
850
|
return s("shareWebCard", "daokeUrl is required", e);
|
|
872
|
-
const { activityDetail: t } = e, n =
|
|
851
|
+
const { activityDetail: t } = e, n = _n(e);
|
|
873
852
|
return u(
|
|
874
853
|
"shareWebCard",
|
|
875
854
|
{
|
|
876
855
|
...e,
|
|
877
|
-
shareTypes: (r = e.shareTypes) != null ? r : [
|
|
878
|
-
activityDetail:
|
|
856
|
+
shareTypes: (r = e.shareTypes) != null ? r : [W.RecentContacts, W.External, W.Channel],
|
|
857
|
+
activityDetail: k(t) ? JSON.stringify(t) : t
|
|
879
858
|
},
|
|
880
859
|
e,
|
|
881
860
|
{ since: "4.4.0", queue: "serial" }
|
|
@@ -883,26 +862,29 @@ function Rn(e) {
|
|
|
883
862
|
throw n(), i;
|
|
884
863
|
});
|
|
885
864
|
}
|
|
886
|
-
let
|
|
887
|
-
function
|
|
888
|
-
|
|
865
|
+
let B;
|
|
866
|
+
function _n(e) {
|
|
867
|
+
B == null || B();
|
|
889
868
|
const { onShared: t, getSharePictureUrl: n, isSharePic: r } = e, i = r ? n : void 0;
|
|
890
869
|
let o, c;
|
|
891
870
|
const d = () => {
|
|
892
|
-
o == null || o(), c == null || c();
|
|
871
|
+
B === d && (o == null || o(), c == null || c());
|
|
893
872
|
};
|
|
894
|
-
return (t
|
|
895
|
-
d(), t == null || t(f);
|
|
896
|
-
}, { since: "4.4.0" })), i && (c = Ue("getSharePictureUrl", i, "4.4.0")), $ = d, d;
|
|
873
|
+
return t && (o = y("onShared", t, { since: "4.4.0", once: !0 })), i && (c = He("getSharePictureUrl", i, "4.4.0")), B = d, d;
|
|
897
874
|
}
|
|
898
|
-
function
|
|
875
|
+
function Rn(e) {
|
|
899
876
|
return !e.url || !/^https?:\/\//i.test(e.url) ? s("shareImage", "url must be a valid http(s) url", e) : u("shareImage", { url: e.url }, e, { queue: "serial" });
|
|
900
877
|
}
|
|
901
|
-
function
|
|
878
|
+
function On(e) {
|
|
902
879
|
return u("openAddCustomEmoji", {}, e, { since: "4.4.0", queue: "serial" });
|
|
903
880
|
}
|
|
904
|
-
function
|
|
905
|
-
|
|
881
|
+
function Tn(e) {
|
|
882
|
+
if (!e.serverId)
|
|
883
|
+
return s("openCommentPanel", "serverId is required", e);
|
|
884
|
+
if (!e.dynamicId)
|
|
885
|
+
return s("openCommentPanel", "dynamicId is required", e);
|
|
886
|
+
const t = Bn(e);
|
|
887
|
+
return u(
|
|
906
888
|
"openCommentPanel",
|
|
907
889
|
{
|
|
908
890
|
serverId: e.serverId,
|
|
@@ -912,70 +894,80 @@ function Nn(e) {
|
|
|
912
894
|
},
|
|
913
895
|
e,
|
|
914
896
|
{ since: "4.4.0", queue: "serial" }
|
|
915
|
-
)
|
|
897
|
+
).catch((n) => {
|
|
898
|
+
throw t(), n;
|
|
899
|
+
});
|
|
916
900
|
}
|
|
917
|
-
|
|
901
|
+
let j;
|
|
902
|
+
function Bn(e) {
|
|
903
|
+
j == null || j();
|
|
904
|
+
const { onChange: t } = e;
|
|
905
|
+
let n;
|
|
906
|
+
const r = () => n == null ? void 0 : n();
|
|
907
|
+
return t && (n = y("onCommentPanelChange", (i) => t(i), { since: "4.4.0" })), j = r, r;
|
|
908
|
+
}
|
|
909
|
+
function Nn(e) {
|
|
918
910
|
return u("showLongVipDesDialog", {}, e, { since: "4.4.0", queue: "serial" });
|
|
919
911
|
}
|
|
920
|
-
function
|
|
912
|
+
function Dn(e) {
|
|
921
913
|
return e.index === void 0 ? s("voteAction", "index is required", e) : u("voteAction", e, e, { since: "4.4.0", queue: "serial" });
|
|
922
914
|
}
|
|
923
|
-
function
|
|
924
|
-
return Array.isArray(e.selectedUserIds) ? p("4.4.0") ?
|
|
915
|
+
function Mn(e) {
|
|
916
|
+
return Array.isArray(e.selectedUserIds) ? p("4.4.0") ? Ln(e) : u("openFriendsList", { selectedUserIds: e.selectedUserIds }, e, {
|
|
925
917
|
queue: "serial",
|
|
926
|
-
transformResult:
|
|
918
|
+
transformResult: Je
|
|
927
919
|
}) : s("openFriendsList", "selectedUserIds is required", e);
|
|
928
920
|
}
|
|
929
|
-
function
|
|
930
|
-
const t =
|
|
921
|
+
function Je(e) {
|
|
922
|
+
const t = k(e) ? e.selectedList : void 0;
|
|
931
923
|
return { selectedList: Array.isArray(t) ? t : [] };
|
|
932
924
|
}
|
|
933
|
-
function
|
|
925
|
+
function Ln(e) {
|
|
934
926
|
let t;
|
|
935
927
|
const n = y("submitFriendsList", (r) => {
|
|
936
928
|
t = r;
|
|
937
929
|
}, { since: "4.4.0" });
|
|
938
930
|
return u("openFriendsList", { selectedUserIds: e.selectedUserIds }, e, {
|
|
939
931
|
legacyOnly: !0,
|
|
940
|
-
jsbridge: { result: () =>
|
|
932
|
+
jsbridge: { result: () => Je(t) }
|
|
941
933
|
}).finally(() => n());
|
|
942
934
|
}
|
|
943
|
-
function
|
|
935
|
+
function $n(e) {
|
|
944
936
|
return e.gameName ? e.serverId ? u("pointsMallBindGame", e, e, { since: "4.4.0", queue: "serial" }) : s("toBindGameRole", "serverId is required", e) : s("toBindGameRole", "gameName is required", e);
|
|
945
937
|
}
|
|
946
|
-
function
|
|
938
|
+
function jn(e) {
|
|
947
939
|
return u("bindGameRoleSuccess", {}, e, { since: "4.4.0" });
|
|
948
940
|
}
|
|
949
|
-
function
|
|
950
|
-
return e.type === void 0 ? s("showAd", "type is required", e) : (
|
|
941
|
+
function xn(e) {
|
|
942
|
+
return e.type === void 0 ? s("showAd", "type is required", e) : (Un(e), u("showAdVideo", { type: e.type, params: e.params }, e, {
|
|
951
943
|
since: "4.4.0",
|
|
952
944
|
queue: "serial"
|
|
953
945
|
}));
|
|
954
946
|
}
|
|
955
|
-
const
|
|
956
|
-
function
|
|
947
|
+
const x = /* @__PURE__ */ new Map();
|
|
948
|
+
function Un(e) {
|
|
957
949
|
var c, d;
|
|
958
950
|
const { onFinished: t } = e;
|
|
959
951
|
if (!t) return;
|
|
960
952
|
const n = (c = e.params) == null ? void 0 : c.module, r = n === void 0 ? void 0 : String(n);
|
|
961
|
-
(d =
|
|
953
|
+
(d = x.get(r)) == null || d();
|
|
962
954
|
let i;
|
|
963
955
|
const o = () => {
|
|
964
|
-
i == null || i(),
|
|
956
|
+
i == null || i(), x.get(r) === o && x.delete(r);
|
|
965
957
|
};
|
|
966
|
-
i = y("onAdFinished", (
|
|
967
|
-
r !== void 0 && String(
|
|
968
|
-
}, { since: "4.4.0" }),
|
|
958
|
+
i = y("onAdFinished", (a) => {
|
|
959
|
+
r !== void 0 && String(a == null ? void 0 : a.module) !== r || (o(), t(a));
|
|
960
|
+
}, { since: "4.4.0" }), x.set(r, o);
|
|
969
961
|
}
|
|
970
|
-
function
|
|
962
|
+
function Hn(e) {
|
|
971
963
|
return e.type ? u("updateData", { type: e.type, params: e.params }, e, { since: "4.4.0" }) : s("updateData", "type is required", e);
|
|
972
964
|
}
|
|
973
|
-
function
|
|
965
|
+
function Fn(e) {
|
|
974
966
|
if (!e.user_id)
|
|
975
967
|
return s("openGiftBag", "user_id is required", e);
|
|
976
968
|
if (!e.server_id)
|
|
977
969
|
return s("openGiftBag", "server_id is required", e);
|
|
978
|
-
const t =
|
|
970
|
+
const t = Wn(e);
|
|
979
971
|
return u(
|
|
980
972
|
"openGiftBag",
|
|
981
973
|
{ user_id: e.user_id, openBag: e.openBag, server_id: e.server_id },
|
|
@@ -985,41 +977,41 @@ function Wn(e) {
|
|
|
985
977
|
throw t(), n;
|
|
986
978
|
});
|
|
987
979
|
}
|
|
988
|
-
let
|
|
989
|
-
function
|
|
990
|
-
|
|
980
|
+
let U;
|
|
981
|
+
function Wn(e) {
|
|
982
|
+
U == null || U();
|
|
991
983
|
const { onSent: t } = e;
|
|
992
984
|
let n;
|
|
993
985
|
const r = () => n == null ? void 0 : n();
|
|
994
|
-
return t && (n = y("openGiftBag", (i) => t(i), { since: "4.4.0" })),
|
|
986
|
+
return t && (n = y("openGiftBag", (i) => t(i), { since: "4.4.0" })), U = r, r;
|
|
995
987
|
}
|
|
996
|
-
function
|
|
997
|
-
|
|
988
|
+
function Gn(e) {
|
|
989
|
+
He("getMemberActivate", e, "4.4.0");
|
|
998
990
|
}
|
|
999
|
-
function
|
|
1000
|
-
|
|
991
|
+
function Vn() {
|
|
992
|
+
St("getMemberActivate", "4.4.0");
|
|
1001
993
|
}
|
|
1002
|
-
const
|
|
994
|
+
const Jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1003
995
|
__proto__: null,
|
|
1004
|
-
bindGameRoleSuccess:
|
|
1005
|
-
getCurrentCircleInfo:
|
|
1006
|
-
getToken:
|
|
1007
|
-
login:
|
|
1008
|
-
offMemberActivate:
|
|
1009
|
-
onMemberActivate:
|
|
1010
|
-
openAddCustomEmoji:
|
|
1011
|
-
openCommentPanel:
|
|
1012
|
-
openFriendsList:
|
|
1013
|
-
openGiftBag:
|
|
1014
|
-
shareImage:
|
|
1015
|
-
shareWebCard:
|
|
1016
|
-
showAd:
|
|
1017
|
-
showLongVipDesDialog:
|
|
1018
|
-
toBindGameRole:
|
|
1019
|
-
updateData:
|
|
1020
|
-
voteAction:
|
|
1021
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1022
|
-
function
|
|
996
|
+
bindGameRoleSuccess: jn,
|
|
997
|
+
getCurrentCircleInfo: An,
|
|
998
|
+
getToken: Cn,
|
|
999
|
+
login: kn,
|
|
1000
|
+
offMemberActivate: Vn,
|
|
1001
|
+
onMemberActivate: Gn,
|
|
1002
|
+
openAddCustomEmoji: On,
|
|
1003
|
+
openCommentPanel: Tn,
|
|
1004
|
+
openFriendsList: Mn,
|
|
1005
|
+
openGiftBag: Fn,
|
|
1006
|
+
shareImage: Rn,
|
|
1007
|
+
shareWebCard: qn,
|
|
1008
|
+
showAd: xn,
|
|
1009
|
+
showLongVipDesDialog: Nn,
|
|
1010
|
+
toBindGameRole: $n,
|
|
1011
|
+
updateData: Hn,
|
|
1012
|
+
voteAction: Dn
|
|
1013
|
+
}, Symbol.toStringTag, { value: "Module" })), zn = "community-open-app", Kn = "https://app.docoi.cc/open-app", Yn = /quark|qqbrowser|ucbrowser/, Xn = 2e3;
|
|
1014
|
+
function Qn(e, t) {
|
|
1023
1015
|
if (window.location.href = e, !t) return;
|
|
1024
1016
|
let n = !1;
|
|
1025
1017
|
const r = () => {
|
|
@@ -1029,22 +1021,22 @@ function Zn(e, t) {
|
|
|
1029
1021
|
};
|
|
1030
1022
|
window.addEventListener("pagehide", r), document.addEventListener("visibilitychange", i), setTimeout(() => {
|
|
1031
1023
|
n || (r(), t());
|
|
1032
|
-
},
|
|
1024
|
+
}, Xn);
|
|
1033
1025
|
}
|
|
1034
|
-
function
|
|
1035
|
-
if (
|
|
1036
|
-
window.parent.postMessage({ type:
|
|
1026
|
+
function Zn(e, t) {
|
|
1027
|
+
if (It()) {
|
|
1028
|
+
window.parent.postMessage({ type: zn, params: e.query }, "*");
|
|
1037
1029
|
return;
|
|
1038
1030
|
}
|
|
1039
1031
|
const n = navigator.userAgent.toLowerCase(), r = n.includes("micromessenger") || n.includes("qq/");
|
|
1040
|
-
if (
|
|
1032
|
+
if (Ue() === "ios" && !r && !Yn.test(n)) {
|
|
1041
1033
|
const i = e.url.includes("?") ? e.url.slice(e.url.indexOf("?")) : "";
|
|
1042
|
-
window.location.href = `${
|
|
1034
|
+
window.location.href = `${Kn}${i}`;
|
|
1043
1035
|
return;
|
|
1044
1036
|
}
|
|
1045
|
-
|
|
1037
|
+
Qn(e.url, t);
|
|
1046
1038
|
}
|
|
1047
|
-
const
|
|
1039
|
+
const Ce = "daoke://", ze = {
|
|
1048
1040
|
joinCirclePage: {
|
|
1049
1041
|
type: 1,
|
|
1050
1042
|
name: "查询圈子并加入",
|
|
@@ -1132,7 +1124,7 @@ const ke = "daoke://", Je = {
|
|
|
1132
1124
|
since: "4.1.0",
|
|
1133
1125
|
fields: {
|
|
1134
1126
|
userId: { key: "userId", required: !0 },
|
|
1135
|
-
nickName: { key: "nickName"
|
|
1127
|
+
nickName: { key: "nickName" }
|
|
1136
1128
|
}
|
|
1137
1129
|
},
|
|
1138
1130
|
browseHistoryPage: { type: 26, name: "浏览记录", since: "4.4.0", fields: {} },
|
|
@@ -1190,7 +1182,7 @@ const ke = "daoke://", Je = {
|
|
|
1190
1182
|
publishType: { key: "publishType" }
|
|
1191
1183
|
}
|
|
1192
1184
|
}
|
|
1193
|
-
},
|
|
1185
|
+
}, er = {
|
|
1194
1186
|
type: 18,
|
|
1195
1187
|
name: "底部 tab",
|
|
1196
1188
|
since: "3.7.0",
|
|
@@ -1200,7 +1192,7 @@ const ke = "daoke://", Je = {
|
|
|
1200
1192
|
subTab: { key: "subTab", enum: { friends: "1_0", square: "1_1", comic: "1_2" } },
|
|
1201
1193
|
fromMbtiShare: { key: "form_mbti_share", bool: !0 }
|
|
1202
1194
|
}
|
|
1203
|
-
},
|
|
1195
|
+
}, tr = {
|
|
1204
1196
|
type: 5,
|
|
1205
1197
|
name: "Webview",
|
|
1206
1198
|
fields: {
|
|
@@ -1208,27 +1200,27 @@ const ke = "daoke://", Je = {
|
|
|
1208
1200
|
type: { key: "h5Type", required: !0, enum: { normal: "1", mini: "2", dynamic: "3", immersive: "4" } },
|
|
1209
1201
|
isUpdateApp: { key: "isUpdateApp", bool: !0 }
|
|
1210
1202
|
}
|
|
1211
|
-
},
|
|
1203
|
+
}, nr = {
|
|
1212
1204
|
type: 23,
|
|
1213
1205
|
name: "纯透明 H5",
|
|
1214
1206
|
since: "3.8.0",
|
|
1215
1207
|
fields: { url: { key: "url", required: !0 } }
|
|
1216
1208
|
}, _ = {
|
|
1217
|
-
...
|
|
1218
|
-
tab:
|
|
1219
|
-
webview:
|
|
1220
|
-
transparentWebview:
|
|
1221
|
-
},
|
|
1209
|
+
...ze,
|
|
1210
|
+
tab: er,
|
|
1211
|
+
webview: tr,
|
|
1212
|
+
transparentWebview: nr
|
|
1213
|
+
}, rr = Object.fromEntries(
|
|
1222
1214
|
Object.keys(_).map((e) => [String(_[e].type), e])
|
|
1223
1215
|
);
|
|
1224
|
-
function
|
|
1225
|
-
const t =
|
|
1216
|
+
function ir(e) {
|
|
1217
|
+
const t = rr[e];
|
|
1226
1218
|
return t ? { key: t, route: _[t] } : void 0;
|
|
1227
1219
|
}
|
|
1228
|
-
const
|
|
1220
|
+
const Ke = "daoke://page";
|
|
1229
1221
|
class b extends Error {
|
|
1230
1222
|
}
|
|
1231
|
-
function
|
|
1223
|
+
function H(e, t = {}) {
|
|
1232
1224
|
const n = { type: String(e.type) };
|
|
1233
1225
|
for (const [r, i] of Object.entries(e.fields)) {
|
|
1234
1226
|
const o = t[r];
|
|
@@ -1243,19 +1235,19 @@ function U(e, t = {}) {
|
|
|
1243
1235
|
} else if (i.bool)
|
|
1244
1236
|
n[i.key] = o ? "true" : "false";
|
|
1245
1237
|
else {
|
|
1246
|
-
if (
|
|
1238
|
+
if (k(o))
|
|
1247
1239
|
throw new b(`${r} must be a string or number`);
|
|
1248
1240
|
n[i.key] = String(o);
|
|
1249
1241
|
}
|
|
1250
1242
|
}
|
|
1251
1243
|
return n;
|
|
1252
1244
|
}
|
|
1253
|
-
function
|
|
1245
|
+
function F(e) {
|
|
1254
1246
|
const t = Object.entries(e).map(([n, r]) => `${encodeURIComponent(n)}=${encodeURIComponent(r)}`).join("&");
|
|
1255
|
-
return { url: `${
|
|
1247
|
+
return { url: `${Ke}?${t}`, query: e };
|
|
1256
1248
|
}
|
|
1257
|
-
function
|
|
1258
|
-
if (!l(e) || !e.startsWith(
|
|
1249
|
+
function Ye(e) {
|
|
1250
|
+
if (!l(e) || !e.startsWith(Ke)) return null;
|
|
1259
1251
|
const t = e.indexOf("?");
|
|
1260
1252
|
if (t < 0) return null;
|
|
1261
1253
|
const n = {};
|
|
@@ -1266,29 +1258,29 @@ function Ke(e) {
|
|
|
1266
1258
|
}
|
|
1267
1259
|
return n.type && /^\d+$/.test(n.type) ? n : null;
|
|
1268
1260
|
}
|
|
1269
|
-
function
|
|
1261
|
+
function or(e) {
|
|
1270
1262
|
return "type" in e && !("url" in e);
|
|
1271
1263
|
}
|
|
1272
|
-
function
|
|
1273
|
-
if (!
|
|
1264
|
+
function ur(e) {
|
|
1265
|
+
if (!k(e == null ? void 0 : e.params)) throw new b("params is required");
|
|
1274
1266
|
switch (e.api) {
|
|
1275
1267
|
case "switchTab":
|
|
1276
|
-
return H(
|
|
1268
|
+
return F(H(_.tab, { ...e.params.params, tab: e.params.tab }));
|
|
1277
1269
|
case "openWebview": {
|
|
1278
1270
|
const { url: t, type: n = "normal", params: r } = e.params;
|
|
1279
1271
|
if (!t || !l(t)) throw new b("url is required");
|
|
1280
|
-
if (n !== "transparent") return H(
|
|
1272
|
+
if (n !== "transparent") return F(H(_.webview, { ...r, url: t, type: n }));
|
|
1281
1273
|
if (!t.startsWith("https://")) throw new b("transparent webview url must be https");
|
|
1282
1274
|
if (r && Object.keys(r).length) throw new b("transparent webview does not support params");
|
|
1283
|
-
return H(
|
|
1275
|
+
return F(H(_.transparentWebview, { url: t }));
|
|
1284
1276
|
}
|
|
1285
1277
|
case "navigateTo": {
|
|
1286
|
-
if (
|
|
1287
|
-
const n =
|
|
1278
|
+
if (or(e.params)) {
|
|
1279
|
+
const n = ze[e.params.type];
|
|
1288
1280
|
if (!n) throw new b(`unknown page type: ${String(e.params.type)}`);
|
|
1289
|
-
return H(
|
|
1281
|
+
return F(H(n, e.params.params));
|
|
1290
1282
|
}
|
|
1291
|
-
const t =
|
|
1283
|
+
const t = Ye(e.params.url);
|
|
1292
1284
|
if (!t) throw new b("url or type is required, url must be a daoke://page?type= link");
|
|
1293
1285
|
return { url: e.params.url, query: t };
|
|
1294
1286
|
}
|
|
@@ -1296,199 +1288,197 @@ function sr(e) {
|
|
|
1296
1288
|
throw new b("unknown navigation api");
|
|
1297
1289
|
}
|
|
1298
1290
|
}
|
|
1299
|
-
const
|
|
1291
|
+
const M = "4.4.0", sr = 11, cr = {
|
|
1300
1292
|
dynamicPublishPage: { page: 7, params: (e) => ({ server_id: e.serverId, channel_id: e.channelId }) },
|
|
1301
1293
|
profileEditPage: { page: 10 },
|
|
1302
1294
|
douyinMallPage: { page: 14 },
|
|
1303
1295
|
likeListPage: { page: 15, params: (e) => ({ dynamicId: e.dynamicId, publishType: e.publishType }) },
|
|
1304
1296
|
adPage: { page: 16, params: (e) => ({ url: e.url }) }
|
|
1305
|
-
},
|
|
1297
|
+
}, dr = {
|
|
1306
1298
|
bindGamePage: { method: "pointsMallBindGame", data: (e) => ({ gameName: e.gameName, serverId: e.serverId }) },
|
|
1307
1299
|
addCustomEmojiPage: { method: "openAddCustomEmoji", data: () => ({}) }
|
|
1308
1300
|
};
|
|
1309
|
-
function
|
|
1301
|
+
function lr(e, t) {
|
|
1310
1302
|
var r, i, o;
|
|
1311
|
-
const n =
|
|
1312
|
-
if (n &&
|
|
1313
|
-
const c =
|
|
1303
|
+
const n = ir((r = t.type) != null ? r : "");
|
|
1304
|
+
if (n && je(n.route.since)) {
|
|
1305
|
+
const c = dr[n.key];
|
|
1314
1306
|
if (c) return { via: "legacyMethod", method: c.method, data: c.data(t) };
|
|
1315
|
-
const d =
|
|
1307
|
+
const d = cr[n.key];
|
|
1316
1308
|
if (!d) {
|
|
1317
|
-
const { name:
|
|
1318
|
-
return { via: "unsupported", reason: `${
|
|
1309
|
+
const { name: a, type: h, since: P } = n.route;
|
|
1310
|
+
return { via: "unsupported", reason: `${a}(type ${h})需要 App ${P}+` };
|
|
1319
1311
|
}
|
|
1320
1312
|
return { via: "redirectPage", page: d.page, params: (o = (i = d.params) == null ? void 0 : i.call(d, t)) != null ? o : {} };
|
|
1321
1313
|
}
|
|
1322
|
-
return
|
|
1314
|
+
return Ue() === "ios" ? { via: "redirectPage", page: sr, params: { url: e } } : { via: "locationHref" };
|
|
1323
1315
|
}
|
|
1324
1316
|
function ar(e, t) {
|
|
1325
|
-
return
|
|
1317
|
+
return $e() ? p(M) ? lr(e.url, e.query) : { via: "openScheme", extra: t } : { via: "launchOutsideApp" };
|
|
1326
1318
|
}
|
|
1327
|
-
function
|
|
1319
|
+
function fr(e, t, n, r) {
|
|
1328
1320
|
switch (t.via) {
|
|
1329
1321
|
case "launchOutsideApp":
|
|
1330
|
-
return
|
|
1322
|
+
return ne(e, { url: n.url }, () => Zn(n, r == null ? void 0 : r.onLaunchFail), r);
|
|
1331
1323
|
case "openScheme":
|
|
1332
1324
|
return u("openScheme", { url: n.url, ...t.extra }, r, { queue: "serial" });
|
|
1333
1325
|
case "redirectPage":
|
|
1334
1326
|
return u("redirectPage", { page: t.page, params: t.params }, r, {
|
|
1335
|
-
since:
|
|
1327
|
+
since: M,
|
|
1336
1328
|
queue: "serial"
|
|
1337
1329
|
});
|
|
1338
1330
|
case "legacyMethod":
|
|
1339
|
-
return u(t.method, t.data, r, { since:
|
|
1331
|
+
return u(t.method, t.data, r, { since: M, queue: "serial" });
|
|
1340
1332
|
case "locationHref":
|
|
1341
|
-
return
|
|
1333
|
+
return ne(e, { url: n.url }, () => {
|
|
1342
1334
|
window.location.href = n.url;
|
|
1343
1335
|
}, r);
|
|
1344
1336
|
case "unsupported":
|
|
1345
1337
|
return de(e, t.reason, r);
|
|
1346
1338
|
}
|
|
1347
1339
|
}
|
|
1348
|
-
function
|
|
1340
|
+
function Xe(e, t, n, r = {}) {
|
|
1349
1341
|
const i = ar(t, r);
|
|
1350
|
-
return
|
|
1342
|
+
return fr(e, i, t, n);
|
|
1351
1343
|
}
|
|
1352
|
-
function
|
|
1344
|
+
function ae(e, t) {
|
|
1353
1345
|
let n;
|
|
1354
1346
|
try {
|
|
1355
|
-
n =
|
|
1347
|
+
n = ur(e);
|
|
1356
1348
|
} catch (r) {
|
|
1357
1349
|
return s(e.api, r instanceof b ? r.message : String(r), t);
|
|
1358
1350
|
}
|
|
1359
|
-
return
|
|
1351
|
+
return Xe(e.api, n, t);
|
|
1352
|
+
}
|
|
1353
|
+
function gr(e) {
|
|
1354
|
+
return ae({ api: "switchTab", params: e }, e);
|
|
1360
1355
|
}
|
|
1361
1356
|
function yr(e) {
|
|
1362
|
-
return
|
|
1357
|
+
return ae({ api: "navigateTo", params: e }, e);
|
|
1363
1358
|
}
|
|
1364
1359
|
function hr(e) {
|
|
1365
|
-
return
|
|
1360
|
+
return ae({ api: "openWebview", params: e }, e);
|
|
1366
1361
|
}
|
|
1367
1362
|
function br(e) {
|
|
1368
|
-
return fe({ api: "openWebview", params: e }, e);
|
|
1369
|
-
}
|
|
1370
|
-
function wr(e) {
|
|
1371
1363
|
var r;
|
|
1372
1364
|
const { url: t, params: n } = e != null ? e : {};
|
|
1373
|
-
return !l(t) || !t.startsWith(
|
|
1365
|
+
return !l(t) || !t.startsWith(Ce) ? s("openScheme", `url must start with ${Ce}`, e) : Xe("openScheme", { url: t, query: (r = Ye(t)) != null ? r : {} }, e, n ? { params: n } : {});
|
|
1374
1366
|
}
|
|
1375
|
-
function
|
|
1367
|
+
function wr(e) {
|
|
1376
1368
|
return e != null && e.url ? u("openInExternalBrowser", { url: e.url }, e, {
|
|
1377
|
-
since:
|
|
1369
|
+
since: M,
|
|
1378
1370
|
queue: "serial"
|
|
1379
1371
|
}) : s("openInExternalBrowser", "url is required", e);
|
|
1380
1372
|
}
|
|
1381
|
-
function
|
|
1382
|
-
return u("closeWebView", {}, e, { since:
|
|
1373
|
+
function vr(e) {
|
|
1374
|
+
return u("closeWebView", {}, e, { since: M, queue: "serial" });
|
|
1383
1375
|
}
|
|
1384
|
-
const
|
|
1376
|
+
const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1385
1377
|
__proto__: null,
|
|
1386
|
-
closeWebView:
|
|
1387
|
-
navigateTo:
|
|
1388
|
-
openInExternalBrowser:
|
|
1389
|
-
openScheme:
|
|
1390
|
-
openWebview:
|
|
1391
|
-
switchTab:
|
|
1392
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1393
|
-
...
|
|
1394
|
-
...
|
|
1395
|
-
...
|
|
1378
|
+
closeWebView: vr,
|
|
1379
|
+
navigateTo: yr,
|
|
1380
|
+
openInExternalBrowser: wr,
|
|
1381
|
+
openScheme: br,
|
|
1382
|
+
openWebview: hr,
|
|
1383
|
+
switchTab: gr
|
|
1384
|
+
}, Symbol.toStringTag, { value: "Module" })), _r = {
|
|
1385
|
+
...En,
|
|
1386
|
+
...pr,
|
|
1387
|
+
...Jn,
|
|
1396
1388
|
setDebug: mt,
|
|
1397
|
-
registerNativeHandler:
|
|
1389
|
+
registerNativeHandler: Fe
|
|
1398
1390
|
};
|
|
1399
1391
|
export {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1392
|
+
K as BRIDGE_ERROR,
|
|
1393
|
+
_e as CUSTOM,
|
|
1394
|
+
tt as ENV_UNSUPPORTED,
|
|
1395
|
+
Ze as METHOD_NOT_FOUND,
|
|
1396
|
+
Er as NETWORK_ERROR,
|
|
1405
1397
|
Ir as NOT_LOGGED_IN,
|
|
1406
|
-
|
|
1407
|
-
|
|
1398
|
+
et as PARAMS_ERROR,
|
|
1399
|
+
Sr as PERMISSION_DENIED,
|
|
1408
1400
|
kr as RECORD_BUSY,
|
|
1409
|
-
|
|
1401
|
+
Cr as RECORD_FAILED,
|
|
1410
1402
|
Ae as SUCCESS,
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1403
|
+
qe as SYSTEM_EXCEPTION,
|
|
1404
|
+
W as ShareType,
|
|
1405
|
+
Ge as ToastDuration,
|
|
1406
|
+
mr as UNAUTHORIZED,
|
|
1407
|
+
jn as bindGameRoleSuccess,
|
|
1408
|
+
Ft as cancelRecordAudio,
|
|
1409
|
+
zt as checkPermission,
|
|
1410
|
+
Dt as chooseMedia,
|
|
1411
|
+
Zt as clearStorage,
|
|
1412
|
+
vr as closeWebView,
|
|
1413
|
+
Pt as compareVersions,
|
|
1414
|
+
_r as default,
|
|
1415
|
+
L as getAppBaseInfo,
|
|
1416
|
+
bn as getBeforeInfo,
|
|
1417
|
+
Vt as getClipboardData,
|
|
1418
|
+
An as getCurrentCircleInfo,
|
|
1419
|
+
Xt as getStorage,
|
|
1420
|
+
Wt as getSystemInfo,
|
|
1421
|
+
Cn as getToken,
|
|
1422
|
+
hn as h5Loaded,
|
|
1431
1423
|
Rt as hideKeyboard,
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
Nt as offCommentPanelChange,
|
|
1424
|
+
fn as hideNavigationBar,
|
|
1425
|
+
qr as invokeDebug,
|
|
1426
|
+
$e as isInApp,
|
|
1427
|
+
kn as login,
|
|
1428
|
+
yr as navigateTo,
|
|
1438
1429
|
Tt as offKeyboardHeightChange,
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
Bt as onCommentPanelChange,
|
|
1430
|
+
Vn as offMemberActivate,
|
|
1431
|
+
Sn as offPageInvisible,
|
|
1432
|
+
pn as offPageShow,
|
|
1433
|
+
In as offPageVisible,
|
|
1434
|
+
sn as offPullDownRefresh,
|
|
1445
1435
|
Ot as onKeyboardHeightChange,
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1436
|
+
Gn as onMemberActivate,
|
|
1437
|
+
mn as onPageInvisible,
|
|
1438
|
+
vn as onPageShow,
|
|
1439
|
+
Pn as onPageVisible,
|
|
1440
|
+
un as onPullDownRefresh,
|
|
1441
|
+
Ar as onRoute,
|
|
1442
|
+
On as openAddCustomEmoji,
|
|
1443
|
+
en as openApp,
|
|
1444
|
+
Tn as openCommentPanel,
|
|
1445
|
+
Mn as openFriendsList,
|
|
1446
|
+
Fn as openGiftBag,
|
|
1447
|
+
wr as openInExternalBrowser,
|
|
1448
|
+
Kt as openPhoneSetting,
|
|
1449
|
+
br as openScheme,
|
|
1450
|
+
hr as openWebview,
|
|
1451
|
+
Bt as previewImage,
|
|
1452
|
+
Nt as previewVideo,
|
|
1453
|
+
Fe as registerNativeHandler,
|
|
1454
|
+
Qt as removeStorage,
|
|
1455
|
+
$t as saveImageToPhotosAlbum,
|
|
1456
|
+
jt as scanCode,
|
|
1457
|
+
wn as setBeforeInfo,
|
|
1458
|
+
Gt as setClipboardData,
|
|
1469
1459
|
mt as setDebug,
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1460
|
+
ln as setNavigationBarColor,
|
|
1461
|
+
cn as setNavigationBarTitle,
|
|
1462
|
+
nn as setPullDownRefresh,
|
|
1463
|
+
gn as setStatusBarStyle,
|
|
1464
|
+
Yt as setStorage,
|
|
1465
|
+
Rn as shareImage,
|
|
1466
|
+
qn as shareWebCard,
|
|
1467
|
+
xn as showAd,
|
|
1468
|
+
Nn as showLongVipDesDialog,
|
|
1469
|
+
an as showNavigationBar,
|
|
1470
|
+
yn as showPageName,
|
|
1481
1471
|
At as showToast,
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1472
|
+
rn as startPullDownRefresh,
|
|
1473
|
+
Ut as startRecordAudio,
|
|
1474
|
+
on as stopPullDownRefresh,
|
|
1475
|
+
Ht as stopRecordAudio,
|
|
1486
1476
|
_t as stopVibrate,
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1477
|
+
tn as swipeBack,
|
|
1478
|
+
gr as switchTab,
|
|
1479
|
+
$n as toBindGameRole,
|
|
1490
1480
|
qt as triggerVibrate,
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1481
|
+
Hn as updateData,
|
|
1482
|
+
Mt as uploadFiles,
|
|
1483
|
+
Dn as voteAction
|
|
1494
1484
|
};
|