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