@trimjs/web-app 0.0.3 → 0.0.5
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 +7 -12
- package/dist/index.cjs +2 -2
- package/dist/index.iife.js +2 -2
- package/dist/index.js +307 -304
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/mobile/index.ts +6 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (
|
|
4
|
-
class
|
|
1
|
+
var we = Object.defineProperty;
|
|
2
|
+
var ve = (n, e, t) => e in n ? we(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var A = (n, e, t) => ve(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
class Ee {
|
|
5
5
|
constructor() {
|
|
6
6
|
A(this, "debug", !1);
|
|
7
7
|
}
|
|
@@ -47,25 +47,30 @@ class ve {
|
|
|
47
47
|
this.debug && console.info("[Trim App]", ...e);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const d = new
|
|
51
|
-
function
|
|
50
|
+
const d = new Ee();
|
|
51
|
+
function Se(n) {
|
|
52
52
|
const e = /FNOS\/([\d.]+)|FNAppType\/(\w+)|FNAppVer\/([\d.]+)/g, t = {};
|
|
53
|
-
let
|
|
54
|
-
for (; (
|
|
55
|
-
|
|
53
|
+
let r;
|
|
54
|
+
for (; (r = e.exec(n)) !== null; )
|
|
55
|
+
r[1] && (t.fnOSVersion = r[1]), r[2] && (t.fnAppType = r[2]), r[3] && (t.fnAppVersion = r[3]);
|
|
56
56
|
return t;
|
|
57
57
|
}
|
|
58
|
-
const ce = () =>
|
|
58
|
+
const ce = () => Se(navigator.userAgent).fnAppVersion;
|
|
59
|
+
let ae = !1;
|
|
60
|
+
window.addEventListener("flutterInAppWebViewPlatformReady", () => {
|
|
61
|
+
ae = !0;
|
|
62
|
+
});
|
|
63
|
+
const Ae = () => new Promise((n) => {
|
|
59
64
|
var e;
|
|
60
|
-
(e = window.flutter_inappwebview) != null && e._platformReady ? (d.log("flutter_inappwebview is ready"),
|
|
61
|
-
d.log("flutter_inappwebview is ready"),
|
|
65
|
+
ae || (e = window.flutter_inappwebview) != null && e._platformReady ? (d.log("flutter_inappwebview is ready"), n(window.flutter_inappwebview)) : window.addEventListener("flutterInAppWebViewPlatformReady", () => {
|
|
66
|
+
d.log("flutter_inappwebview is ready"), n(window.flutter_inappwebview);
|
|
62
67
|
});
|
|
63
|
-
}),
|
|
68
|
+
}), $e = async (n, e, t) => {
|
|
64
69
|
d.log(`callHandler: ${e}, params: ${t}`);
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
70
|
+
const r = await n.callHandler(e, t);
|
|
71
|
+
if (r)
|
|
67
72
|
try {
|
|
68
|
-
const o = JSON.parse(
|
|
73
|
+
const o = JSON.parse(r);
|
|
69
74
|
d.log(`messageData: ${JSON.stringify(o)}`);
|
|
70
75
|
const i = JSON.parse(o.result);
|
|
71
76
|
return d.log(`appMessage: ${JSON.stringify(i)}`), i;
|
|
@@ -74,71 +79,71 @@ const ce = () => Ee(navigator.userAgent).fnAppVersion, Se = () => new Promise((r
|
|
|
74
79
|
}
|
|
75
80
|
return null;
|
|
76
81
|
}, Q = /* @__PURE__ */ new Map();
|
|
77
|
-
function
|
|
78
|
-
window.fnAppMessage = (
|
|
79
|
-
d.log("app-message",
|
|
80
|
-
const e = JSON.parse(
|
|
82
|
+
function Pe() {
|
|
83
|
+
window.fnAppMessage = (n) => {
|
|
84
|
+
d.log("app-message", n);
|
|
85
|
+
const e = JSON.parse(n), t = Q.get(e.reqId);
|
|
81
86
|
t && (t(e), Q.delete(e.reqId));
|
|
82
87
|
};
|
|
83
88
|
}
|
|
84
|
-
ce() &&
|
|
85
|
-
var T = /* @__PURE__ */ ((
|
|
86
|
-
const
|
|
89
|
+
ce() && Pe();
|
|
90
|
+
var T = /* @__PURE__ */ ((n) => (n.Call = "call", n.Reply = "reply", n.Syn = "syn", n.SynAck = "synAck", n.Ack = "ack", n))(T || {}), k = /* @__PURE__ */ ((n) => (n.Fulfilled = "fulfilled", n.Rejected = "rejected", n))(k || {}), z = /* @__PURE__ */ ((n) => (n.ConnectionDestroyed = "ConnectionDestroyed", n.ConnectionTimeout = "ConnectionTimeout", n.NoIframeSrc = "NoIframeSrc", n))(z || {}), le = /* @__PURE__ */ ((n) => (n.DataCloneError = "DataCloneError", n))(le || {}), R = /* @__PURE__ */ ((n) => (n.Message = "message", n))(R || {});
|
|
91
|
+
const Me = (n, e) => {
|
|
87
92
|
const t = [];
|
|
88
|
-
let
|
|
93
|
+
let r = !1;
|
|
89
94
|
return {
|
|
90
95
|
destroy(o) {
|
|
91
|
-
|
|
96
|
+
r || (r = !0, e(`${n}: Destroying connection`), t.forEach((i) => {
|
|
92
97
|
i(o);
|
|
93
98
|
}));
|
|
94
99
|
},
|
|
95
100
|
onDestroy(o) {
|
|
96
|
-
|
|
101
|
+
r ? o() : t.push(o);
|
|
97
102
|
}
|
|
98
103
|
};
|
|
99
|
-
},
|
|
100
|
-
|
|
104
|
+
}, _e = (n) => (...e) => {
|
|
105
|
+
n && console.log("[Penpal]", ...e);
|
|
101
106
|
}, G = ({
|
|
102
|
-
name:
|
|
107
|
+
name: n,
|
|
103
108
|
message: e,
|
|
104
109
|
stack: t
|
|
105
110
|
}) => ({
|
|
106
|
-
name:
|
|
111
|
+
name: n,
|
|
107
112
|
message: e,
|
|
108
113
|
stack: t
|
|
109
|
-
}),
|
|
114
|
+
}), Ce = (n) => {
|
|
110
115
|
const e = new Error();
|
|
111
|
-
return Object.keys(
|
|
112
|
-
},
|
|
116
|
+
return Object.keys(n).forEach((t) => e[t] = n[t]), e;
|
|
117
|
+
}, Fe = (n, e, t) => {
|
|
113
118
|
const {
|
|
114
|
-
localName:
|
|
119
|
+
localName: r,
|
|
115
120
|
local: o,
|
|
116
121
|
remote: i,
|
|
117
122
|
originForSending: s,
|
|
118
123
|
originForReceiving: c
|
|
119
|
-
} =
|
|
124
|
+
} = n;
|
|
120
125
|
let f = !1;
|
|
121
|
-
const w = (
|
|
122
|
-
if (
|
|
126
|
+
const w = (m) => {
|
|
127
|
+
if (m.source !== i || m.data.penpal !== T.Call)
|
|
123
128
|
return;
|
|
124
|
-
if (c !== "*" &&
|
|
129
|
+
if (c !== "*" && m.origin !== c) {
|
|
125
130
|
t(
|
|
126
|
-
`${
|
|
131
|
+
`${r} received message from origin ${m.origin} which did not match expected origin ${c}`
|
|
127
132
|
);
|
|
128
133
|
return;
|
|
129
134
|
}
|
|
130
|
-
const v =
|
|
131
|
-
t(`${
|
|
135
|
+
const v = m.data, { methodName: g, args: p, id: b } = v;
|
|
136
|
+
t(`${r}: Received ${g}() call`);
|
|
132
137
|
const a = (y) => (S) => {
|
|
133
|
-
if (t(`${
|
|
138
|
+
if (t(`${r}: Sending ${g}() reply`), f) {
|
|
134
139
|
t(
|
|
135
|
-
`${
|
|
140
|
+
`${r}: Unable to send ${g}() reply due to destroyed connection`
|
|
136
141
|
);
|
|
137
142
|
return;
|
|
138
143
|
}
|
|
139
144
|
const $ = {
|
|
140
145
|
penpal: T.Reply,
|
|
141
|
-
id:
|
|
146
|
+
id: b,
|
|
142
147
|
resolution: y,
|
|
143
148
|
returnValue: S
|
|
144
149
|
};
|
|
@@ -146,10 +151,10 @@ const Pe = (r, e) => {
|
|
|
146
151
|
try {
|
|
147
152
|
i.postMessage($, s);
|
|
148
153
|
} catch (M) {
|
|
149
|
-
if (M.name ===
|
|
154
|
+
if (M.name === le.DataCloneError) {
|
|
150
155
|
const _ = {
|
|
151
156
|
penpal: T.Reply,
|
|
152
|
-
id:
|
|
157
|
+
id: b,
|
|
153
158
|
resolution: k.Rejected,
|
|
154
159
|
returnValue: G(M),
|
|
155
160
|
returnValueIsError: !0
|
|
@@ -170,25 +175,25 @@ const Pe = (r, e) => {
|
|
|
170
175
|
f = !0, o.removeEventListener(R.Message, w);
|
|
171
176
|
};
|
|
172
177
|
};
|
|
173
|
-
let
|
|
174
|
-
const
|
|
175
|
-
const t =
|
|
176
|
-
return t.push(
|
|
177
|
-
},
|
|
178
|
-
const
|
|
179
|
-
return
|
|
180
|
-
},
|
|
178
|
+
let Te = 0;
|
|
179
|
+
const Oe = () => ++Te, ue = ".", fe = (n) => n ? n.split(ue) : [], Re = (n) => n.join(ue), xe = (n, e) => {
|
|
180
|
+
const t = fe(e || "");
|
|
181
|
+
return t.push(n), Re(t);
|
|
182
|
+
}, De = (n, e, t) => {
|
|
183
|
+
const r = fe(e);
|
|
184
|
+
return r.reduce((o, i, s) => (typeof o[i] > "u" && (o[i] = {}), s === r.length - 1 && (o[i] = t), o[i]), n), n;
|
|
185
|
+
}, pe = (n, e) => {
|
|
181
186
|
const t = {};
|
|
182
|
-
return Object.keys(
|
|
183
|
-
const o = r
|
|
184
|
-
typeof o == "object" && Object.assign(t,
|
|
187
|
+
return Object.keys(n).forEach((r) => {
|
|
188
|
+
const o = n[r], i = xe(r, e);
|
|
189
|
+
typeof o == "object" && Object.assign(t, pe(o, i)), typeof o == "function" && (t[i] = o);
|
|
185
190
|
}), t;
|
|
186
|
-
},
|
|
191
|
+
}, Ie = (n) => {
|
|
187
192
|
const e = {};
|
|
188
|
-
for (const t in
|
|
189
|
-
|
|
193
|
+
for (const t in n)
|
|
194
|
+
De(e, t, n[t]);
|
|
190
195
|
return e;
|
|
191
|
-
},
|
|
196
|
+
}, ke = (n, e, t, r, o) => {
|
|
192
197
|
const {
|
|
193
198
|
localName: i,
|
|
194
199
|
local: s,
|
|
@@ -196,9 +201,9 @@ const Te = () => ++Fe, le = ".", ue = (r) => r ? r.split(le) : [], Oe = (r) => r
|
|
|
196
201
|
originForSending: f,
|
|
197
202
|
originForReceiving: w
|
|
198
203
|
} = e;
|
|
199
|
-
let
|
|
204
|
+
let m = !1;
|
|
200
205
|
o(`${i}: Connecting call sender`);
|
|
201
|
-
const v = (p) => (...
|
|
206
|
+
const v = (p) => (...b) => {
|
|
202
207
|
o(`${i}: Sending ${p}() call`);
|
|
203
208
|
let a;
|
|
204
209
|
try {
|
|
@@ -206,14 +211,14 @@ const Te = () => ++Fe, le = ".", ue = (r) => r ? r.split(le) : [], Oe = (r) => r
|
|
|
206
211
|
} catch {
|
|
207
212
|
a = !0;
|
|
208
213
|
}
|
|
209
|
-
if (a &&
|
|
214
|
+
if (a && r(), m) {
|
|
210
215
|
const y = new Error(
|
|
211
216
|
`Unable to send ${p}() call due to destroyed connection`
|
|
212
217
|
);
|
|
213
218
|
throw y.code = z.ConnectionDestroyed, y;
|
|
214
219
|
}
|
|
215
220
|
return new Promise((y, S) => {
|
|
216
|
-
const $ =
|
|
221
|
+
const $ = Oe(), M = (C) => {
|
|
217
222
|
if (C.source !== c || C.data.penpal !== T.Reply || C.data.id !== $)
|
|
218
223
|
return;
|
|
219
224
|
if (w !== "*" && C.origin !== w) {
|
|
@@ -222,14 +227,14 @@ const Te = () => ++Fe, le = ".", ue = (r) => r ? r.split(le) : [], Oe = (r) => r
|
|
|
222
227
|
);
|
|
223
228
|
return;
|
|
224
229
|
}
|
|
225
|
-
const
|
|
230
|
+
const V = C.data;
|
|
226
231
|
o(`${i}: Received ${p}() reply`), s.removeEventListener(
|
|
227
232
|
R.Message,
|
|
228
233
|
M
|
|
229
234
|
);
|
|
230
|
-
let
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
let j = V.returnValue;
|
|
236
|
+
V.returnValueIsError && (j = Ce(j)), (V.resolution === k.Fulfilled ? y : S)(
|
|
237
|
+
j
|
|
233
238
|
);
|
|
234
239
|
};
|
|
235
240
|
s.addEventListener(R.Message, M);
|
|
@@ -237,35 +242,35 @@ const Te = () => ++Fe, le = ".", ue = (r) => r ? r.split(le) : [], Oe = (r) => r
|
|
|
237
242
|
penpal: T.Call,
|
|
238
243
|
id: $,
|
|
239
244
|
methodName: p,
|
|
240
|
-
args:
|
|
245
|
+
args: b
|
|
241
246
|
};
|
|
242
247
|
c.postMessage(_, f);
|
|
243
248
|
});
|
|
244
|
-
}, g = t.reduce((p,
|
|
245
|
-
return Object.assign(
|
|
246
|
-
|
|
249
|
+
}, g = t.reduce((p, b) => (p[b] = v(b), p), {});
|
|
250
|
+
return Object.assign(n, Ie(g)), () => {
|
|
251
|
+
m = !0;
|
|
247
252
|
};
|
|
248
|
-
},
|
|
253
|
+
}, Ve = (n, e) => {
|
|
249
254
|
let t;
|
|
250
|
-
return
|
|
251
|
-
const
|
|
252
|
-
`Connection timed out after ${
|
|
255
|
+
return n !== void 0 && (t = window.setTimeout(() => {
|
|
256
|
+
const r = new Error(
|
|
257
|
+
`Connection timed out after ${n}ms`
|
|
253
258
|
);
|
|
254
|
-
|
|
255
|
-
},
|
|
259
|
+
r.code = z.ConnectionTimeout, e(r);
|
|
260
|
+
}, n)), () => {
|
|
256
261
|
clearTimeout(t);
|
|
257
262
|
};
|
|
258
|
-
}, je = "@fn/micro-app-postmate",
|
|
263
|
+
}, je = "@fn/micro-app-postmate", We = "0.1.2", qe = "module", Le = "src/index.ts", Ne = {
|
|
259
264
|
dev: "vite",
|
|
260
265
|
build: "tsc -b && vite build",
|
|
261
266
|
lint: "eslint ."
|
|
262
|
-
},
|
|
267
|
+
}, He = [
|
|
263
268
|
"src",
|
|
264
269
|
"dist"
|
|
265
|
-
],
|
|
270
|
+
], Ue = {
|
|
266
271
|
"@fn/micro-app-event": "^0.0.1",
|
|
267
272
|
rxjs: "^7.8.0"
|
|
268
|
-
},
|
|
273
|
+
}, Be = {
|
|
269
274
|
"@eslint/js": "^9.13.0",
|
|
270
275
|
"@fn/micro-app-event": "workspace:*",
|
|
271
276
|
eslint: "^9.13.0",
|
|
@@ -274,63 +279,63 @@ const Te = () => ++Fe, le = ".", ue = (r) => r ? r.split(le) : [], Oe = (r) => r
|
|
|
274
279
|
"typescript-eslint": "^8.11.0",
|
|
275
280
|
rxjs: "^7.8.0",
|
|
276
281
|
vite: "^5.4.10"
|
|
277
|
-
}, Be = {
|
|
278
|
-
registry: "http://verdaccio.teiron-inc.cn:4873"
|
|
279
282
|
}, Je = {
|
|
283
|
+
registry: "http://verdaccio.teiron-inc.cn:4873"
|
|
284
|
+
}, Ye = {
|
|
280
285
|
name: je,
|
|
281
|
-
version:
|
|
286
|
+
version: We,
|
|
282
287
|
type: qe,
|
|
283
|
-
main:
|
|
288
|
+
main: Le,
|
|
284
289
|
scripts: Ne,
|
|
285
|
-
files:
|
|
286
|
-
peerDependencies:
|
|
287
|
-
devDependencies:
|
|
288
|
-
publishConfig:
|
|
289
|
-
},
|
|
290
|
-
const { destroy: i, onDestroy: s } =
|
|
290
|
+
files: He,
|
|
291
|
+
peerDependencies: Ue,
|
|
292
|
+
devDependencies: Be,
|
|
293
|
+
publishConfig: Je
|
|
294
|
+
}, ze = (n, e, t, r, o) => {
|
|
295
|
+
const { destroy: i, onDestroy: s } = r;
|
|
291
296
|
return (c) => {
|
|
292
|
-
if (!(
|
|
297
|
+
if (!(n instanceof RegExp ? n.test(c.origin) : n === "*" || n === c.origin)) {
|
|
293
298
|
o(
|
|
294
|
-
`Child: Handshake - Received SYN-ACK from origin ${c.origin} which did not match expected origin ${
|
|
299
|
+
`Child: Handshake - Received SYN-ACK from origin ${c.origin} which did not match expected origin ${n}`
|
|
295
300
|
);
|
|
296
301
|
return;
|
|
297
302
|
}
|
|
298
303
|
o("Child: Handshake - Received SYN-ACK, responding with ACK");
|
|
299
|
-
const w = c.origin === "null" ? "*" : c.origin,
|
|
304
|
+
const w = c.origin === "null" ? "*" : c.origin, m = {
|
|
300
305
|
penpal: T.Ack,
|
|
301
306
|
methodNames: Object.keys(e),
|
|
302
307
|
config: t
|
|
303
308
|
};
|
|
304
|
-
window.parent.postMessage(
|
|
309
|
+
window.parent.postMessage(m, w);
|
|
305
310
|
const v = {
|
|
306
311
|
localName: "Child",
|
|
307
312
|
local: window,
|
|
308
313
|
remote: window.parent,
|
|
309
314
|
originForSending: w,
|
|
310
315
|
originForReceiving: c.origin
|
|
311
|
-
}, g =
|
|
316
|
+
}, g = Fe(
|
|
312
317
|
v,
|
|
313
318
|
e,
|
|
314
319
|
o
|
|
315
320
|
);
|
|
316
321
|
s(g);
|
|
317
|
-
const p = {},
|
|
322
|
+
const p = {}, b = ke(
|
|
318
323
|
p,
|
|
319
324
|
v,
|
|
320
325
|
c.data.methodNames,
|
|
321
326
|
i,
|
|
322
327
|
o
|
|
323
328
|
);
|
|
324
|
-
return s(
|
|
329
|
+
return s(b), p;
|
|
325
330
|
};
|
|
326
331
|
};
|
|
327
|
-
function X(
|
|
328
|
-
console == null || console.warn(`[fnApp warn]: ${
|
|
332
|
+
function X(n, e) {
|
|
333
|
+
console == null || console.warn(`[fnApp warn]: ${n}`, e);
|
|
329
334
|
}
|
|
330
|
-
function Z(
|
|
331
|
-
console == null || console.error(`[fnApp error]: ${
|
|
335
|
+
function Z(n, e) {
|
|
336
|
+
console == null || console.error(`[fnApp error]: ${n}`, e);
|
|
332
337
|
}
|
|
333
|
-
const I = "_fn_all_event", ee = "事件订阅数量为空",
|
|
338
|
+
const I = "_fn_all_event", ee = "事件订阅数量为空", W = window.__POWERED_BY_FNAPP__ ? window.__FNAPP.inject.appEventObjMap : /* @__PURE__ */ new Map();
|
|
334
339
|
class te {
|
|
335
340
|
constructor(e, t) {
|
|
336
341
|
A(this, "id");
|
|
@@ -340,12 +345,12 @@ class te {
|
|
|
340
345
|
var t;
|
|
341
346
|
return ((t = this.eventObj[e]) == null ? void 0 : t.length) || 0;
|
|
342
347
|
});
|
|
343
|
-
console.log("id", e, t), this.id = e, this.appName = t, this.$clear(),
|
|
348
|
+
console.log("id", e, t), this.id = e, this.appName = t, this.$clear(), W.get(this.id) || W.set(this.id, {}), this.eventObj = W.get(this.id);
|
|
344
349
|
}
|
|
345
350
|
// 监听事件
|
|
346
351
|
$on(e, t) {
|
|
347
|
-
const
|
|
348
|
-
return
|
|
352
|
+
const r = this.eventObj[e];
|
|
353
|
+
return r ? (r.includes(t) || r.push(t), this) : (this.eventObj[e] = [t], this);
|
|
349
354
|
}
|
|
350
355
|
/** 任何$emit都会导致监听函数触发,第一个参数为事件名,后续的参数为$emit的参数 */
|
|
351
356
|
$onAll(e) {
|
|
@@ -357,13 +362,13 @@ class te {
|
|
|
357
362
|
}
|
|
358
363
|
// 取消监听
|
|
359
364
|
$off(e, t) {
|
|
360
|
-
const
|
|
361
|
-
if (!e || !
|
|
365
|
+
const r = this.eventObj[e];
|
|
366
|
+
if (!e || !r || !r.length)
|
|
362
367
|
return X(`${e} ${ee}`), this;
|
|
363
|
-
let o, i =
|
|
368
|
+
let o, i = r.length;
|
|
364
369
|
for (; i--; )
|
|
365
|
-
if (o =
|
|
366
|
-
|
|
370
|
+
if (o = r[i], o === t) {
|
|
371
|
+
r.splice(i, 1);
|
|
367
372
|
break;
|
|
368
373
|
}
|
|
369
374
|
return this;
|
|
@@ -378,11 +383,11 @@ class te {
|
|
|
378
383
|
}
|
|
379
384
|
// 发送事件
|
|
380
385
|
$pureEmit(e, ...t) {
|
|
381
|
-
let
|
|
382
|
-
return
|
|
386
|
+
let r = 0, o = 0;
|
|
387
|
+
return W.forEach((i) => {
|
|
383
388
|
if (i[e])
|
|
384
389
|
for (let s = i[e].length - 1; s >= 0; s--) {
|
|
385
|
-
|
|
390
|
+
r++;
|
|
386
391
|
const c = i[e][s];
|
|
387
392
|
c.$__once && i[e].splice(s, 1);
|
|
388
393
|
try {
|
|
@@ -393,7 +398,7 @@ class te {
|
|
|
393
398
|
}
|
|
394
399
|
if (i[I])
|
|
395
400
|
for (let s = i[I].length - 1; s >= 0; s--) {
|
|
396
|
-
|
|
401
|
+
r++;
|
|
397
402
|
const c = i[I][s];
|
|
398
403
|
c.$__once && i[I].splice(s, 1);
|
|
399
404
|
try {
|
|
@@ -402,99 +407,99 @@ class te {
|
|
|
402
407
|
Z(f);
|
|
403
408
|
}
|
|
404
409
|
}
|
|
405
|
-
}), (!e ||
|
|
410
|
+
}), (!e || r === 0 && o === 0) && X(`${e} ${ee}`), this;
|
|
406
411
|
}
|
|
407
412
|
// 清空当前所有的监听事件
|
|
408
413
|
$clear() {
|
|
409
|
-
const e =
|
|
410
|
-
return Object.keys(e).forEach((
|
|
414
|
+
const e = W.get(this.id) ?? {};
|
|
415
|
+
return Object.keys(e).forEach((r) => delete e[r]), this;
|
|
411
416
|
}
|
|
412
417
|
}
|
|
413
|
-
var U = function(
|
|
414
|
-
return U = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t,
|
|
415
|
-
t.__proto__ =
|
|
416
|
-
} || function(t,
|
|
417
|
-
for (var o in
|
|
418
|
-
}, U(
|
|
418
|
+
var U = function(n, e) {
|
|
419
|
+
return U = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) {
|
|
420
|
+
t.__proto__ = r;
|
|
421
|
+
} || function(t, r) {
|
|
422
|
+
for (var o in r) Object.prototype.hasOwnProperty.call(r, o) && (t[o] = r[o]);
|
|
423
|
+
}, U(n, e);
|
|
419
424
|
};
|
|
420
|
-
function
|
|
425
|
+
function de(n, e) {
|
|
421
426
|
if (typeof e != "function" && e !== null)
|
|
422
427
|
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
423
|
-
U(
|
|
428
|
+
U(n, e);
|
|
424
429
|
function t() {
|
|
425
|
-
this.constructor =
|
|
430
|
+
this.constructor = n;
|
|
426
431
|
}
|
|
427
|
-
|
|
432
|
+
n.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
428
433
|
}
|
|
429
|
-
function
|
|
430
|
-
var e = typeof Symbol == "function" && Symbol.iterator, t = e &&
|
|
431
|
-
if (t) return t.call(
|
|
432
|
-
if (
|
|
434
|
+
function ne(n) {
|
|
435
|
+
var e = typeof Symbol == "function" && Symbol.iterator, t = e && n[e], r = 0;
|
|
436
|
+
if (t) return t.call(n);
|
|
437
|
+
if (n && typeof n.length == "number") return {
|
|
433
438
|
next: function() {
|
|
434
|
-
return
|
|
439
|
+
return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
|
|
435
440
|
}
|
|
436
441
|
};
|
|
437
442
|
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
438
443
|
}
|
|
439
|
-
function B(
|
|
440
|
-
var t = typeof Symbol == "function" &&
|
|
441
|
-
if (!t) return
|
|
442
|
-
var
|
|
444
|
+
function B(n, e) {
|
|
445
|
+
var t = typeof Symbol == "function" && n[Symbol.iterator];
|
|
446
|
+
if (!t) return n;
|
|
447
|
+
var r = t.call(n), o, i = [], s;
|
|
443
448
|
try {
|
|
444
|
-
for (; (e === void 0 || e-- > 0) && !(o =
|
|
449
|
+
for (; (e === void 0 || e-- > 0) && !(o = r.next()).done; ) i.push(o.value);
|
|
445
450
|
} catch (c) {
|
|
446
451
|
s = { error: c };
|
|
447
452
|
} finally {
|
|
448
453
|
try {
|
|
449
|
-
o && !o.done && (t =
|
|
454
|
+
o && !o.done && (t = r.return) && t.call(r);
|
|
450
455
|
} finally {
|
|
451
456
|
if (s) throw s.error;
|
|
452
457
|
}
|
|
453
458
|
}
|
|
454
459
|
return i;
|
|
455
460
|
}
|
|
456
|
-
function J(
|
|
457
|
-
if (t || arguments.length === 2) for (var
|
|
458
|
-
(i || !(
|
|
459
|
-
return
|
|
461
|
+
function J(n, e, t) {
|
|
462
|
+
if (t || arguments.length === 2) for (var r = 0, o = e.length, i; r < o; r++)
|
|
463
|
+
(i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
|
|
464
|
+
return n.concat(i || Array.prototype.slice.call(e));
|
|
460
465
|
}
|
|
461
|
-
function O(
|
|
462
|
-
return typeof
|
|
466
|
+
function O(n) {
|
|
467
|
+
return typeof n == "function";
|
|
463
468
|
}
|
|
464
|
-
function
|
|
465
|
-
var e = function(
|
|
466
|
-
Error.call(
|
|
467
|
-
}, t =
|
|
469
|
+
function Ke(n) {
|
|
470
|
+
var e = function(r) {
|
|
471
|
+
Error.call(r), r.stack = new Error().stack;
|
|
472
|
+
}, t = n(e);
|
|
468
473
|
return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
|
|
469
474
|
}
|
|
470
|
-
var
|
|
475
|
+
var N = Ke(function(n) {
|
|
471
476
|
return function(t) {
|
|
472
|
-
|
|
473
|
-
` + t.map(function(
|
|
474
|
-
return o + 1 + ") " +
|
|
477
|
+
n(this), this.message = t ? t.length + ` errors occurred during unsubscription:
|
|
478
|
+
` + t.map(function(r, o) {
|
|
479
|
+
return o + 1 + ") " + r.toString();
|
|
475
480
|
}).join(`
|
|
476
481
|
`) : "", this.name = "UnsubscriptionError", this.errors = t;
|
|
477
482
|
};
|
|
478
483
|
});
|
|
479
|
-
function
|
|
480
|
-
if (
|
|
481
|
-
var t =
|
|
482
|
-
0 <= t &&
|
|
484
|
+
function re(n, e) {
|
|
485
|
+
if (n) {
|
|
486
|
+
var t = n.indexOf(e);
|
|
487
|
+
0 <= t && n.splice(t, 1);
|
|
483
488
|
}
|
|
484
489
|
}
|
|
485
490
|
var K = function() {
|
|
486
|
-
function
|
|
491
|
+
function n(e) {
|
|
487
492
|
this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
488
493
|
}
|
|
489
|
-
return
|
|
490
|
-
var e, t,
|
|
494
|
+
return n.prototype.unsubscribe = function() {
|
|
495
|
+
var e, t, r, o, i;
|
|
491
496
|
if (!this.closed) {
|
|
492
497
|
this.closed = !0;
|
|
493
498
|
var s = this._parentage;
|
|
494
499
|
if (s)
|
|
495
500
|
if (this._parentage = null, Array.isArray(s))
|
|
496
501
|
try {
|
|
497
|
-
for (var c =
|
|
502
|
+
for (var c = ne(s), f = c.next(); !f.done; f = c.next()) {
|
|
498
503
|
var w = f.value;
|
|
499
504
|
w.remove(this);
|
|
500
505
|
}
|
|
@@ -509,110 +514,110 @@ var K = function() {
|
|
|
509
514
|
}
|
|
510
515
|
else
|
|
511
516
|
s.remove(this);
|
|
512
|
-
var
|
|
513
|
-
if (O(
|
|
517
|
+
var m = this.initialTeardown;
|
|
518
|
+
if (O(m))
|
|
514
519
|
try {
|
|
515
|
-
|
|
520
|
+
m();
|
|
516
521
|
} catch (a) {
|
|
517
|
-
i = a instanceof
|
|
522
|
+
i = a instanceof N ? a.errors : [a];
|
|
518
523
|
}
|
|
519
524
|
var v = this._finalizers;
|
|
520
525
|
if (v) {
|
|
521
526
|
this._finalizers = null;
|
|
522
527
|
try {
|
|
523
|
-
for (var g =
|
|
524
|
-
var
|
|
528
|
+
for (var g = ne(v), p = g.next(); !p.done; p = g.next()) {
|
|
529
|
+
var b = p.value;
|
|
525
530
|
try {
|
|
526
|
-
ie(
|
|
531
|
+
ie(b);
|
|
527
532
|
} catch (a) {
|
|
528
|
-
i = i ?? [], a instanceof
|
|
533
|
+
i = i ?? [], a instanceof N ? i = J(J([], B(i)), B(a.errors)) : i.push(a);
|
|
529
534
|
}
|
|
530
535
|
}
|
|
531
536
|
} catch (a) {
|
|
532
|
-
|
|
537
|
+
r = { error: a };
|
|
533
538
|
} finally {
|
|
534
539
|
try {
|
|
535
540
|
p && !p.done && (o = g.return) && o.call(g);
|
|
536
541
|
} finally {
|
|
537
|
-
if (
|
|
542
|
+
if (r) throw r.error;
|
|
538
543
|
}
|
|
539
544
|
}
|
|
540
545
|
}
|
|
541
546
|
if (i)
|
|
542
|
-
throw new
|
|
547
|
+
throw new N(i);
|
|
543
548
|
}
|
|
544
|
-
},
|
|
549
|
+
}, n.prototype.add = function(e) {
|
|
545
550
|
var t;
|
|
546
551
|
if (e && e !== this)
|
|
547
552
|
if (this.closed)
|
|
548
553
|
ie(e);
|
|
549
554
|
else {
|
|
550
|
-
if (e instanceof
|
|
555
|
+
if (e instanceof n) {
|
|
551
556
|
if (e.closed || e._hasParent(this))
|
|
552
557
|
return;
|
|
553
558
|
e._addParent(this);
|
|
554
559
|
}
|
|
555
560
|
(this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
|
|
556
561
|
}
|
|
557
|
-
},
|
|
562
|
+
}, n.prototype._hasParent = function(e) {
|
|
558
563
|
var t = this._parentage;
|
|
559
564
|
return t === e || Array.isArray(t) && t.includes(e);
|
|
560
|
-
},
|
|
565
|
+
}, n.prototype._addParent = function(e) {
|
|
561
566
|
var t = this._parentage;
|
|
562
567
|
this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
|
|
563
|
-
},
|
|
568
|
+
}, n.prototype._removeParent = function(e) {
|
|
564
569
|
var t = this._parentage;
|
|
565
|
-
t === e ? this._parentage = null : Array.isArray(t) &&
|
|
566
|
-
},
|
|
570
|
+
t === e ? this._parentage = null : Array.isArray(t) && re(t, e);
|
|
571
|
+
}, n.prototype.remove = function(e) {
|
|
567
572
|
var t = this._finalizers;
|
|
568
|
-
t &&
|
|
569
|
-
},
|
|
570
|
-
var e = new
|
|
573
|
+
t && re(t, e), e instanceof n && e._removeParent(this);
|
|
574
|
+
}, n.EMPTY = function() {
|
|
575
|
+
var e = new n();
|
|
571
576
|
return e.closed = !0, e;
|
|
572
|
-
}(),
|
|
577
|
+
}(), n;
|
|
573
578
|
}();
|
|
574
579
|
K.EMPTY;
|
|
575
|
-
function
|
|
576
|
-
return
|
|
580
|
+
function he(n) {
|
|
581
|
+
return n instanceof K || n && "closed" in n && O(n.remove) && O(n.add) && O(n.unsubscribe);
|
|
577
582
|
}
|
|
578
|
-
function ie(
|
|
579
|
-
O(
|
|
583
|
+
function ie(n) {
|
|
584
|
+
O(n) ? n() : n.unsubscribe();
|
|
580
585
|
}
|
|
581
|
-
var
|
|
586
|
+
var ge = {
|
|
582
587
|
onUnhandledError: null,
|
|
583
588
|
onStoppedNotification: null,
|
|
584
589
|
Promise: void 0,
|
|
585
590
|
useDeprecatedSynchronousErrorHandling: !1,
|
|
586
591
|
useDeprecatedNextContext: !1
|
|
587
|
-
},
|
|
588
|
-
setTimeout: function(
|
|
589
|
-
for (var t = [],
|
|
590
|
-
t[
|
|
591
|
-
return setTimeout.apply(void 0, J([
|
|
592
|
+
}, Qe = {
|
|
593
|
+
setTimeout: function(n, e) {
|
|
594
|
+
for (var t = [], r = 2; r < arguments.length; r++)
|
|
595
|
+
t[r - 2] = arguments[r];
|
|
596
|
+
return setTimeout.apply(void 0, J([n, e], B(t)));
|
|
592
597
|
},
|
|
593
|
-
clearTimeout: function(
|
|
594
|
-
return clearTimeout(
|
|
598
|
+
clearTimeout: function(n) {
|
|
599
|
+
return clearTimeout(n);
|
|
595
600
|
},
|
|
596
601
|
delegate: void 0
|
|
597
602
|
};
|
|
598
|
-
function
|
|
599
|
-
|
|
600
|
-
throw
|
|
603
|
+
function Ge(n) {
|
|
604
|
+
Qe.setTimeout(function() {
|
|
605
|
+
throw n;
|
|
601
606
|
});
|
|
602
607
|
}
|
|
603
608
|
function oe() {
|
|
604
609
|
}
|
|
605
|
-
function
|
|
606
|
-
|
|
610
|
+
function Xe(n) {
|
|
611
|
+
n();
|
|
607
612
|
}
|
|
608
|
-
var
|
|
609
|
-
|
|
613
|
+
var ye = function(n) {
|
|
614
|
+
de(e, n);
|
|
610
615
|
function e(t) {
|
|
611
|
-
var
|
|
612
|
-
return
|
|
616
|
+
var r = n.call(this) || this;
|
|
617
|
+
return r.isStopped = !1, t ? (r.destination = t, he(t) && t.add(r)) : r.destination = nt, r;
|
|
613
618
|
}
|
|
614
|
-
return e.create = function(t,
|
|
615
|
-
return new Y(t,
|
|
619
|
+
return e.create = function(t, r, o) {
|
|
620
|
+
return new Y(t, r, o);
|
|
616
621
|
}, e.prototype.next = function(t) {
|
|
617
622
|
this.isStopped || this._next(t);
|
|
618
623
|
}, e.prototype.error = function(t) {
|
|
@@ -620,7 +625,7 @@ var ge = function(r) {
|
|
|
620
625
|
}, e.prototype.complete = function() {
|
|
621
626
|
this.isStopped || (this.isStopped = !0, this._complete());
|
|
622
627
|
}, e.prototype.unsubscribe = function() {
|
|
623
|
-
this.closed || (this.isStopped = !0,
|
|
628
|
+
this.closed || (this.isStopped = !0, n.prototype.unsubscribe.call(this), this.destination = null);
|
|
624
629
|
}, e.prototype._next = function(t) {
|
|
625
630
|
this.destination.next(t);
|
|
626
631
|
}, e.prototype._error = function(t) {
|
|
@@ -636,54 +641,54 @@ var ge = function(r) {
|
|
|
636
641
|
this.unsubscribe();
|
|
637
642
|
}
|
|
638
643
|
}, e;
|
|
639
|
-
}(K),
|
|
640
|
-
function H(
|
|
641
|
-
return
|
|
644
|
+
}(K), Ze = Function.prototype.bind;
|
|
645
|
+
function H(n, e) {
|
|
646
|
+
return Ze.call(n, e);
|
|
642
647
|
}
|
|
643
|
-
var
|
|
644
|
-
function
|
|
648
|
+
var et = function() {
|
|
649
|
+
function n(e) {
|
|
645
650
|
this.partialObserver = e;
|
|
646
651
|
}
|
|
647
|
-
return
|
|
652
|
+
return n.prototype.next = function(e) {
|
|
648
653
|
var t = this.partialObserver;
|
|
649
654
|
if (t.next)
|
|
650
655
|
try {
|
|
651
656
|
t.next(e);
|
|
652
|
-
} catch (
|
|
653
|
-
|
|
657
|
+
} catch (r) {
|
|
658
|
+
L(r);
|
|
654
659
|
}
|
|
655
|
-
},
|
|
660
|
+
}, n.prototype.error = function(e) {
|
|
656
661
|
var t = this.partialObserver;
|
|
657
662
|
if (t.error)
|
|
658
663
|
try {
|
|
659
664
|
t.error(e);
|
|
660
|
-
} catch (
|
|
661
|
-
|
|
665
|
+
} catch (r) {
|
|
666
|
+
L(r);
|
|
662
667
|
}
|
|
663
668
|
else
|
|
664
|
-
|
|
665
|
-
},
|
|
669
|
+
L(e);
|
|
670
|
+
}, n.prototype.complete = function() {
|
|
666
671
|
var e = this.partialObserver;
|
|
667
672
|
if (e.complete)
|
|
668
673
|
try {
|
|
669
674
|
e.complete();
|
|
670
675
|
} catch (t) {
|
|
671
|
-
|
|
676
|
+
L(t);
|
|
672
677
|
}
|
|
673
|
-
},
|
|
674
|
-
}(), Y = function(
|
|
675
|
-
|
|
676
|
-
function e(t,
|
|
677
|
-
var i =
|
|
678
|
+
}, n;
|
|
679
|
+
}(), Y = function(n) {
|
|
680
|
+
de(e, n);
|
|
681
|
+
function e(t, r, o) {
|
|
682
|
+
var i = n.call(this) || this, s;
|
|
678
683
|
if (O(t) || !t)
|
|
679
684
|
s = {
|
|
680
685
|
next: t ?? void 0,
|
|
681
|
-
error:
|
|
686
|
+
error: r ?? void 0,
|
|
682
687
|
complete: o ?? void 0
|
|
683
688
|
};
|
|
684
689
|
else {
|
|
685
690
|
var c;
|
|
686
|
-
i &&
|
|
691
|
+
i && ge.useDeprecatedNextContext ? (c = Object.create(t), c.unsubscribe = function() {
|
|
687
692
|
return i.unsubscribe();
|
|
688
693
|
}, s = {
|
|
689
694
|
next: t.next && H(t.next, c),
|
|
@@ -691,55 +696,55 @@ var Ze = function() {
|
|
|
691
696
|
complete: t.complete && H(t.complete, c)
|
|
692
697
|
}) : s = t;
|
|
693
698
|
}
|
|
694
|
-
return i.destination = new
|
|
699
|
+
return i.destination = new et(s), i;
|
|
695
700
|
}
|
|
696
701
|
return e;
|
|
697
|
-
}(
|
|
698
|
-
function
|
|
699
|
-
|
|
702
|
+
}(ye);
|
|
703
|
+
function L(n) {
|
|
704
|
+
Ge(n);
|
|
700
705
|
}
|
|
701
|
-
function
|
|
702
|
-
throw
|
|
706
|
+
function tt(n) {
|
|
707
|
+
throw n;
|
|
703
708
|
}
|
|
704
|
-
var
|
|
709
|
+
var nt = {
|
|
705
710
|
closed: !0,
|
|
706
711
|
next: oe,
|
|
707
|
-
error:
|
|
712
|
+
error: tt,
|
|
708
713
|
complete: oe
|
|
709
714
|
}, rt = function() {
|
|
710
715
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
711
716
|
}();
|
|
712
|
-
function
|
|
713
|
-
return
|
|
717
|
+
function it(n) {
|
|
718
|
+
return n;
|
|
714
719
|
}
|
|
715
|
-
function
|
|
716
|
-
return
|
|
717
|
-
return
|
|
718
|
-
return o(
|
|
720
|
+
function ot(n) {
|
|
721
|
+
return n.length === 0 ? it : n.length === 1 ? n[0] : function(t) {
|
|
722
|
+
return n.reduce(function(r, o) {
|
|
723
|
+
return o(r);
|
|
719
724
|
}, t);
|
|
720
725
|
};
|
|
721
726
|
}
|
|
722
|
-
var
|
|
723
|
-
function
|
|
727
|
+
var st = function() {
|
|
728
|
+
function n(e) {
|
|
724
729
|
e && (this._subscribe = e);
|
|
725
730
|
}
|
|
726
|
-
return
|
|
727
|
-
var t = new
|
|
731
|
+
return n.prototype.lift = function(e) {
|
|
732
|
+
var t = new n();
|
|
728
733
|
return t.source = this, t.operator = e, t;
|
|
729
|
-
},
|
|
730
|
-
var o = this, i =
|
|
731
|
-
return
|
|
734
|
+
}, n.prototype.subscribe = function(e, t, r) {
|
|
735
|
+
var o = this, i = at(e) ? e : new Y(e, t, r);
|
|
736
|
+
return Xe(function() {
|
|
732
737
|
var s = o, c = s.operator, f = s.source;
|
|
733
738
|
i.add(c ? c.call(i, f) : f ? o._subscribe(i) : o._trySubscribe(i));
|
|
734
739
|
}), i;
|
|
735
|
-
},
|
|
740
|
+
}, n.prototype._trySubscribe = function(e) {
|
|
736
741
|
try {
|
|
737
742
|
return this._subscribe(e);
|
|
738
743
|
} catch (t) {
|
|
739
744
|
e.error(t);
|
|
740
745
|
}
|
|
741
|
-
},
|
|
742
|
-
var
|
|
746
|
+
}, n.prototype.forEach = function(e, t) {
|
|
747
|
+
var r = this;
|
|
743
748
|
return t = se(t), new t(function(o, i) {
|
|
744
749
|
var s = new Y({
|
|
745
750
|
next: function(c) {
|
|
@@ -752,52 +757,52 @@ var ot = function() {
|
|
|
752
757
|
error: i,
|
|
753
758
|
complete: o
|
|
754
759
|
});
|
|
755
|
-
|
|
760
|
+
r.subscribe(s);
|
|
756
761
|
});
|
|
757
|
-
},
|
|
762
|
+
}, n.prototype._subscribe = function(e) {
|
|
758
763
|
var t;
|
|
759
764
|
return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(e);
|
|
760
|
-
},
|
|
765
|
+
}, n.prototype[rt] = function() {
|
|
761
766
|
return this;
|
|
762
|
-
},
|
|
767
|
+
}, n.prototype.pipe = function() {
|
|
763
768
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
764
769
|
e[t] = arguments[t];
|
|
765
|
-
return
|
|
766
|
-
},
|
|
770
|
+
return ot(e)(this);
|
|
771
|
+
}, n.prototype.toPromise = function(e) {
|
|
767
772
|
var t = this;
|
|
768
|
-
return e = se(e), new e(function(
|
|
773
|
+
return e = se(e), new e(function(r, o) {
|
|
769
774
|
var i;
|
|
770
775
|
t.subscribe(function(s) {
|
|
771
776
|
return i = s;
|
|
772
777
|
}, function(s) {
|
|
773
778
|
return o(s);
|
|
774
779
|
}, function() {
|
|
775
|
-
return
|
|
780
|
+
return r(i);
|
|
776
781
|
});
|
|
777
782
|
});
|
|
778
|
-
},
|
|
779
|
-
return new
|
|
780
|
-
},
|
|
783
|
+
}, n.create = function(e) {
|
|
784
|
+
return new n(e);
|
|
785
|
+
}, n;
|
|
781
786
|
}();
|
|
782
|
-
function se(
|
|
787
|
+
function se(n) {
|
|
783
788
|
var e;
|
|
784
|
-
return (e =
|
|
789
|
+
return (e = n ?? ge.Promise) !== null && e !== void 0 ? e : Promise;
|
|
785
790
|
}
|
|
786
|
-
function
|
|
787
|
-
return
|
|
791
|
+
function ct(n) {
|
|
792
|
+
return n && O(n.next) && O(n.error) && O(n.complete);
|
|
788
793
|
}
|
|
789
|
-
function
|
|
790
|
-
return
|
|
794
|
+
function at(n) {
|
|
795
|
+
return n && n instanceof ye || ct(n) && he(n);
|
|
791
796
|
}
|
|
792
|
-
const
|
|
797
|
+
const lt = () => {
|
|
793
798
|
try {
|
|
794
799
|
clearTimeout(void 0);
|
|
795
800
|
} catch {
|
|
796
801
|
return !1;
|
|
797
802
|
}
|
|
798
803
|
return !0;
|
|
799
|
-
},
|
|
800
|
-
const { parentOrigin: e = "*", timeout: t, debug:
|
|
804
|
+
}, ut = (n = {}) => {
|
|
805
|
+
const { parentOrigin: e = "*", timeout: t, debug: r = !1, config: o = {} } = n, i = _e(r), s = Me("App", i), { destroy: c, onDestroy: f } = s, w = () => {
|
|
801
806
|
i("Child: Handshake - Sending SYN");
|
|
802
807
|
const v = { penpal: T.Syn }, g = e instanceof RegExp ? "*" : e;
|
|
803
808
|
window.parent.postMessage(v, g);
|
|
@@ -805,9 +810,9 @@ const at = () => {
|
|
|
805
810
|
return {
|
|
806
811
|
promise: new Promise(
|
|
807
812
|
(v, g) => {
|
|
808
|
-
const p =
|
|
809
|
-
if (
|
|
810
|
-
const y = a.data, S = new te(y.id, y.appName), $ = new te(y.id + "/api", y.appName), M = y.id, _ = {}, C = (l) => "api/" + l,
|
|
813
|
+
const p = Ve(t, c), b = (a) => {
|
|
814
|
+
if (lt() && !(a.source !== parent || !a.data) && a.data.penpal === T.SynAck) {
|
|
815
|
+
const y = a.data, S = new te(y.id, y.appName), $ = new te(y.id + "/api", y.appName), M = y.id, _ = {}, C = (l) => "api/" + l, V = {
|
|
811
816
|
$emit: (l, ...u) => {
|
|
812
817
|
S.getEventCallBackLength(l) > 0 ? S.$pureEmit(l, ...u) : _ == null || _.$off(l, () => {
|
|
813
818
|
}, !0);
|
|
@@ -817,28 +822,28 @@ const at = () => {
|
|
|
817
822
|
},
|
|
818
823
|
onOsNotify: (l) => {
|
|
819
824
|
}
|
|
820
|
-
},
|
|
825
|
+
}, j = (l) => function(h) {
|
|
821
826
|
const P = C(l);
|
|
822
827
|
$.$on(P, function D(E) {
|
|
823
828
|
h.next(E), E.reqid && E.result === "succ" && (h.complete(), $.$off(P, D));
|
|
824
829
|
});
|
|
825
|
-
},
|
|
830
|
+
}, be = pe(V), x = ze(
|
|
826
831
|
e,
|
|
827
|
-
|
|
832
|
+
be,
|
|
828
833
|
{
|
|
829
834
|
...o,
|
|
830
|
-
postmateVersion:
|
|
835
|
+
postmateVersion: Ye.version
|
|
831
836
|
},
|
|
832
837
|
s,
|
|
833
838
|
i
|
|
834
839
|
)(
|
|
835
840
|
a
|
|
836
|
-
), F = {},
|
|
837
|
-
if (
|
|
841
|
+
), F = {}, q = x.bus;
|
|
842
|
+
if (q) {
|
|
838
843
|
const l = (u, h, P) => {
|
|
839
|
-
P ? (h.$__once = !0, S.$once(u, h)) : S.$on(u, h), F[u] ? F[u].push(h) : (F[u] = [h],
|
|
844
|
+
P ? (h.$__once = !0, S.$once(u, h)) : S.$on(u, h), F[u] ? F[u].push(h) : (F[u] = [h], q.$on(u, M));
|
|
840
845
|
};
|
|
841
|
-
Object.assign(_,
|
|
846
|
+
Object.assign(_, q, {
|
|
842
847
|
$on: l,
|
|
843
848
|
$off: (u, h, P) => {
|
|
844
849
|
var D;
|
|
@@ -846,7 +851,7 @@ const at = () => {
|
|
|
846
851
|
const E = F[u].indexOf(h);
|
|
847
852
|
E > -1 && (F[u].splice(E, 1), S.$off(u, h));
|
|
848
853
|
}
|
|
849
|
-
P && delete F[u], (D = F[u]) != null && D.length || (
|
|
854
|
+
P && delete F[u], (D = F[u]) != null && D.length || (q.$off(u, M), delete F[u]);
|
|
850
855
|
},
|
|
851
856
|
$once: (u, h) => {
|
|
852
857
|
l(u, h, !0);
|
|
@@ -871,8 +876,8 @@ const at = () => {
|
|
|
871
876
|
});
|
|
872
877
|
},
|
|
873
878
|
createObservableQuery: async (l, u = {}) => {
|
|
874
|
-
const h = (l == null ? void 0 : l.reqid) || await x.genReqId(), P = new
|
|
875
|
-
|
|
879
|
+
const h = (l == null ? void 0 : l.reqid) || await x.genReqId(), P = new st(
|
|
880
|
+
j(h)
|
|
876
881
|
);
|
|
877
882
|
return x.query(
|
|
878
883
|
{
|
|
@@ -886,14 +891,14 @@ const at = () => {
|
|
|
886
891
|
), P;
|
|
887
892
|
}
|
|
888
893
|
};
|
|
889
|
-
x && (window.removeEventListener(R.Message,
|
|
894
|
+
x && (window.removeEventListener(R.Message, b), p(), v({
|
|
890
895
|
methods: me,
|
|
891
896
|
config: a.data.config
|
|
892
897
|
}));
|
|
893
898
|
}
|
|
894
899
|
};
|
|
895
|
-
window.addEventListener(R.Message,
|
|
896
|
-
window.removeEventListener(R.Message,
|
|
900
|
+
window.addEventListener(R.Message, b), w(), f((a) => {
|
|
901
|
+
window.removeEventListener(R.Message, b), a && g(a);
|
|
897
902
|
});
|
|
898
903
|
}
|
|
899
904
|
),
|
|
@@ -901,10 +906,10 @@ const at = () => {
|
|
|
901
906
|
c();
|
|
902
907
|
}
|
|
903
908
|
};
|
|
904
|
-
},
|
|
905
|
-
debug:
|
|
909
|
+
}, ft = (n) => ut({
|
|
910
|
+
debug: n == null ? void 0 : n.debug
|
|
906
911
|
}).promise;
|
|
907
|
-
class
|
|
912
|
+
class ht {
|
|
908
913
|
constructor(e = {}) {
|
|
909
914
|
A(this, "options");
|
|
910
915
|
A(this, "flutterInAppWebView", null);
|
|
@@ -915,15 +920,15 @@ class dt {
|
|
|
915
920
|
}
|
|
916
921
|
async init() {
|
|
917
922
|
return d.log("Starting initialization..."), new Promise((e) => {
|
|
918
|
-
ce() ? (this.isWeb = !1, d.log("Initializing mobile platform..."),
|
|
923
|
+
ce() ? (this.isWeb = !1, d.log("Initializing mobile platform..."), Ae().then((t) => {
|
|
919
924
|
this.flutterInAppWebView = t, d.log("Mobile platform initialized"), e();
|
|
920
|
-
})) : (this.isWeb = !0, d.log("Initializing web platform..."),
|
|
925
|
+
})) : (this.isWeb = !0, d.log("Initializing web platform..."), ft().then((t) => {
|
|
921
926
|
this.osConnector = t, d.log("Web platform initialized"), e();
|
|
922
927
|
}));
|
|
923
928
|
});
|
|
924
929
|
}
|
|
925
930
|
async callAppMethod(e, t) {
|
|
926
|
-
return this.flutterInAppWebView ?
|
|
931
|
+
return this.flutterInAppWebView ? $e(this.flutterInAppWebView, e, t) : null;
|
|
927
932
|
}
|
|
928
933
|
/**
|
|
929
934
|
* 等待初始化完成
|
|
@@ -1009,17 +1014,15 @@ class dt {
|
|
|
1009
1014
|
*/
|
|
1010
1015
|
async close() {
|
|
1011
1016
|
var e;
|
|
1012
|
-
|
|
1013
|
-
return (e = this.osConnector) == null ? void 0 : e.methods.close();
|
|
1014
|
-
throw new Error("close is not supported on mobile platform");
|
|
1017
|
+
return await this.initPromise, this.isWeb ? (e = this.osConnector) == null ? void 0 : e.methods.close() : this.callAppMethod("exitPage");
|
|
1015
1018
|
}
|
|
1016
1019
|
/**
|
|
1017
1020
|
* 请求接口
|
|
1018
1021
|
*/
|
|
1019
1022
|
async query(e, t) {
|
|
1020
|
-
var
|
|
1023
|
+
var r;
|
|
1021
1024
|
if (await this.initPromise, this.isWeb) {
|
|
1022
|
-
const o = await ((
|
|
1025
|
+
const o = await ((r = this.osConnector) == null ? void 0 : r.methods.query(e, t));
|
|
1023
1026
|
if (!o)
|
|
1024
1027
|
throw new Error("Failed to query");
|
|
1025
1028
|
return o;
|
|
@@ -1035,6 +1038,6 @@ class dt {
|
|
|
1035
1038
|
}
|
|
1036
1039
|
}
|
|
1037
1040
|
export {
|
|
1038
|
-
|
|
1039
|
-
|
|
1041
|
+
ht as TrimApp,
|
|
1042
|
+
ht as default
|
|
1040
1043
|
};
|