@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/dist/index.js CHANGED
@@ -1,33 +1,33 @@
1
- var $e = Object.defineProperty, Pe = Object.defineProperties;
2
- var Me = Object.getOwnPropertyDescriptors;
3
- var ee = Object.getOwnPropertySymbols;
4
- var Ce = Object.prototype.hasOwnProperty, Fe = Object.prototype.propertyIsEnumerable;
5
- var B = (r, e, t) => e in r ? $e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, D = (r, e) => {
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
- Ce.call(e, t) && B(r, t, e[t]);
8
- if (ee)
9
- for (var t of ee(e))
10
- Fe.call(e, t) && B(r, t, e[t]);
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
- }, j = (r, e) => Pe(r, Me(e));
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, o) => {
15
- var i = (a) => {
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
- o(h);
19
+ i(h);
20
20
  }
21
21
  }, s = (a) => {
22
22
  try {
23
23
  c(t.throw(a));
24
24
  } catch (h) {
25
- o(h);
25
+ i(h);
26
26
  }
27
- }, c = (a) => a.done ? n(a.value) : Promise.resolve(a.value).then(i, s);
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 Te {
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 Te();
93
- function _e(r) {
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 pe = () => _e(navigator.userAgent).fnAppVersion;
101
- let de = !1;
100
+ const fe = () => Ce(navigator.userAgent).fnAppVersion;
101
+ let pe = !1;
102
102
  window.addEventListener("flutterInAppWebViewPlatformReady", () => {
103
- de = !0;
103
+ pe = !0;
104
104
  });
105
- const Oe = () => new Promise((r) => {
105
+ const _e = () => new Promise((r) => {
106
106
  var e;
107
- de || (e = window.flutter_inappwebview) != null && e._platformReady ? (d.log("flutter_inappwebview is ready"), r(window.flutter_inappwebview)) : window.addEventListener("flutterInAppWebViewPlatformReady", () => {
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
- }), Re = (r, e, t) => w(void 0, null, function* () {
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 o = JSON.parse(n);
116
- d.log(`messageData: ${JSON.stringify(o)}`);
117
- const i = JSON.parse(o.result);
118
- return d.log(`appMessage: ${JSON.stringify(i)}`), i;
119
- } catch (o) {
120
- return d.error(`error: ${o}`), null;
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
- }), te = /* @__PURE__ */ new Map();
124
- function xe() {
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 = te.get(e.reqId);
128
- t && (t(e), te.delete(e.reqId));
127
+ const e = JSON.parse(r), t = ee.get(e.reqId);
128
+ t && (t(e), ee.delete(e.reqId));
129
129
  };
130
130
  }
131
- pe() && xe();
132
- var O = /* @__PURE__ */ ((r) => (r.Call = "call", r.Reply = "reply", r.Syn = "syn", r.SynAck = "synAck", r.Ack = "ack", r))(O || {}), q = /* @__PURE__ */ ((r) => (r.Fulfilled = "fulfilled", r.Rejected = "rejected", r))(q || {}), X = /* @__PURE__ */ ((r) => (r.ConnectionDestroyed = "ConnectionDestroyed", r.ConnectionTimeout = "ConnectionTimeout", r.NoIframeSrc = "NoIframeSrc", r))(X || {}), he = /* @__PURE__ */ ((r) => (r.DataCloneError = "DataCloneError", r))(he || {}), I = /* @__PURE__ */ ((r) => (r.Message = "message", r))(I || {});
133
- const De = (r, e) => {
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(o) {
138
- n || (n = !0, e(`${r}: Destroying connection`), t.forEach((i) => {
139
- i(o);
137
+ destroy(i) {
138
+ n || (n = !0, e(`${r}: Destroying connection`), t.forEach((o) => {
139
+ o(i);
140
140
  }));
141
141
  },
142
- onDestroy(o) {
143
- n ? o() : t.push(o);
142
+ onDestroy(i) {
143
+ n ? i() : t.push(i);
144
144
  }
145
145
  };
146
- }, Ie = (r) => (...e) => {
146
+ }, xe = (r) => (...e) => {
147
147
  r && console.log("[Penpal]", ...e);
148
- }, re = ({
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
- }), Ve = (r) => {
156
+ }), Ie = (r) => {
157
157
  const e = new Error();
158
158
  return Object.keys(r).forEach((t) => e[t] = r[t]), e;
159
- }, je = (r, e, t) => {
159
+ }, Ne = (r, e, t) => {
160
160
  const {
161
161
  localName: n,
162
- local: o,
163
- remote: i,
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 !== i || v.data.penpal !== O.Call)
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: O.Reply,
187
+ penpal: F.Reply,
188
188
  id: m,
189
189
  resolution: y,
190
190
  returnValue: S
191
191
  };
192
- y === q.Rejected && S instanceof Error && (P.returnValue = re(S), P.returnValueIsError = !0);
192
+ y === D.Rejected && S instanceof Error && (P.returnValue = te(S), P.returnValueIsError = !0);
193
193
  try {
194
- i.postMessage(P, s);
194
+ o.postMessage(P, s);
195
195
  } catch (M) {
196
- if (M.name === he.DataCloneError) {
197
- const C = {
198
- penpal: O.Reply,
196
+ if (M.name === de.DataCloneError) {
197
+ const O = {
198
+ penpal: F.Reply,
199
199
  id: m,
200
- resolution: q.Rejected,
201
- returnValue: re(M),
200
+ resolution: D.Rejected,
201
+ returnValue: te(M),
202
202
  returnValueIsError: !0
203
203
  };
204
- i.postMessage(C, s);
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(q.Fulfilled),
213
- l(q.Rejected)
212
+ l(D.Fulfilled),
213
+ l(D.Rejected)
214
214
  );
215
215
  };
216
- return o.addEventListener(I.Message, h), () => {
217
- a = !0, o.removeEventListener(I.Message, h);
216
+ return i.addEventListener(N.Message, h), () => {
217
+ a = !0, i.removeEventListener(N.Message, h);
218
218
  };
219
219
  };
220
- let We = 0;
221
- const qe = () => ++We, ge = ".", ye = (r) => r ? r.split(ge) : [], Ne = (r) => r.join(ge), Le = (r, e) => {
222
- const t = ye(e || "");
223
- return t.push(r), Ne(t);
224
- }, He = (r, e, t) => {
225
- const n = ye(e);
226
- return n.reduce((o, i, s) => (typeof o[i] == "undefined" && (o[i] = {}), s === n.length - 1 && (o[i] = t), o[i]), r), r;
227
- }, me = (r, e) => {
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 o = r[n], i = Le(n, e);
231
- typeof o == "object" && Object.assign(t, me(o, i)), typeof o == "function" && (t[i] = o);
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
- }, ke = (r) => {
233
+ }, je = (r) => {
234
234
  const e = {};
235
235
  for (const t in r)
236
- He(e, t, r[t]);
236
+ Le(e, t, r[t]);
237
237
  return e;
238
- }, Ue = (r, e, t, n, o) => {
238
+ }, He = (r, e, t, n, i) => {
239
239
  const {
240
- localName: i,
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
- o(`${i}: Connecting call sender`);
247
+ i(`${o}: Connecting call sender`);
248
248
  const A = (p) => (...m) => {
249
- o(`${i}: Sending ${p}() call`);
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 = X.ConnectionDestroyed, y;
260
+ throw y.code = G.ConnectionDestroyed, y;
261
261
  }
262
262
  return new Promise((y, S) => {
263
- const P = qe(), M = (F) => {
264
- if (F.source !== c || F.data.penpal !== O.Reply || F.data.id !== P)
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 !== "*" && F.origin !== h) {
267
- o(
268
- `${i} received message from origin ${F.origin} which did not match expected origin ${h}`
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 N = F.data;
273
- o(`${i}: Received ${p}() reply`), s.removeEventListener(
274
- I.Message,
272
+ const L = C.data;
273
+ i(`${o}: Received ${p}() reply`), s.removeEventListener(
274
+ N.Message,
275
275
  M
276
276
  );
277
- let L = N.returnValue;
278
- N.returnValueIsError && (L = Ve(L)), (N.resolution === q.Fulfilled ? y : S)(
279
- L
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(I.Message, M);
283
- const C = {
284
- penpal: O.Call,
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(C, a);
289
+ c.postMessage(O, a);
290
290
  });
291
291
  }, g = t.reduce((p, m) => (p[m] = A(m), p), {});
292
- return Object.assign(r, ke(g)), () => {
292
+ return Object.assign(r, je(g)), () => {
293
293
  v = !0;
294
294
  };
295
- }, Be = (r, e) => {
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 = X.ConnectionTimeout, e(n);
301
+ n.code = G.ConnectionTimeout, e(n);
302
302
  }, r)), () => {
303
303
  clearTimeout(t);
304
304
  };
305
- }, Je = "@fn/micro-app-postmate", Ye = "0.1.2", ze = "module", Ke = "src/index.ts", Qe = {
306
- dev: "vite",
307
- build: "tsc -b && vite build",
308
- lint: "eslint ."
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
- o(
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
- o("Child: Handshake - Received SYN-ACK, responding with ACK");
316
+ i("Child: Handshake - Received SYN-ACK, responding with ACK");
346
317
  const h = c.origin === "null" ? "*" : c.origin, v = {
347
- penpal: O.Ack,
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 = je(
329
+ }, g = Ne(
359
330
  A,
360
331
  e,
361
- o
332
+ i
362
333
  );
363
334
  s(g);
364
- const p = {}, m = Ue(
335
+ const p = {}, m = He(
365
336
  p,
366
337
  A,
367
338
  c.data.methodNames,
368
- i,
369
- o
339
+ o,
340
+ i
370
341
  );
371
342
  return s(m), p;
372
343
  };
373
344
  };
374
- function ne(r, e) {
345
+ function re(r, e) {
375
346
  console == null || console.warn(`[fnApp warn]: ${r}`, e);
376
347
  }
377
- function ie(r, e) {
348
+ function ne(r, e) {
378
349
  console == null || console.error(`[fnApp error]: ${r}`, e);
379
350
  }
380
- const W = "_fn_all_event", oe = "事件订阅数量为空", H = window.__POWERED_BY_FNAPP__ ? window.__FNAPP.inject.appEventObjMap : /* @__PURE__ */ new Map();
381
- class se {
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(W, e);
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 ne(`${e} ${oe}`), this;
410
- let o, i = n.length;
411
- for (; i--; )
412
- if (o = n[i], o === t) {
413
- n.splice(i, 1);
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(W, e);
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, o = 0;
429
- return H.forEach((i) => {
430
- if (i[e])
431
- for (let s = i[e].length - 1; s >= 0; 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 = i[e][s];
434
- c.$__once && i[e].splice(s, 1);
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
- ie(a);
409
+ ne(a);
439
410
  }
440
411
  }
441
- if (i[W])
442
- for (let s = i[W].length - 1; s >= 0; s--) {
412
+ if (o[q])
413
+ for (let s = o[q].length - 1; s >= 0; s--) {
443
414
  n++;
444
- const c = i[W][s];
445
- c.$__once && i[W].splice(s, 1);
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
- ie(a);
420
+ ne(a);
450
421
  }
451
422
  }
452
- }), (!e || n === 0 && o === 0) && ne(`${e} ${oe}`), this;
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 z = function(r, e) {
461
- return z = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
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 o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
465
- }, z(r, e);
435
+ for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
436
+ }, Y(r, e);
466
437
  };
467
- function be(r, e) {
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
- z(r, e);
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 ce(r) {
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 K(r, e) {
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), o, i = [], s;
460
+ var n = t.call(r), i, o = [], s;
490
461
  try {
491
- for (; (e === void 0 || e-- > 0) && !(o = n.next()).done; ) i.push(o.value);
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
- o && !o.done && (t = n.return) && t.call(n);
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 i;
472
+ return o;
502
473
  }
503
- function Q(r, e, t) {
504
- if (t || arguments.length === 2) for (var n = 0, o = e.length, i; n < o; n++)
505
- (i || !(n in e)) && (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
506
- return r.concat(i || Array.prototype.slice.call(e));
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 nt(r) {
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 = nt(function(r) {
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, o) {
521
- return o + 1 + ") " + n.toString();
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 ae(r, e) {
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 Z = function() {
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, o, i;
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 = ce(s), a = c.next(); !a.done; a = c.next()) {
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
- i = l instanceof J ? l.errors : [l];
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 = ce(A), p = g.next(); !p.done; p = g.next()) {
541
+ for (var g = se(A), p = g.next(); !p.done; p = g.next()) {
571
542
  var m = p.value;
572
543
  try {
573
- le(m);
544
+ ae(m);
574
545
  } catch (l) {
575
- i = i != null ? i : [], l instanceof J ? i = Q(Q([], K(i)), K(l.errors)) : i.push(l);
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 && (o = g.return) && o.call(g);
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 (i)
589
- throw new J(i);
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
- le(e);
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) && ae(t, e);
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 && ae(t, e), e instanceof r && e._removeParent(this);
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
- Z.EMPTY;
622
- function we(r) {
623
- return r instanceof Z || r && "closed" in r && R(r.remove) && R(r.add) && R(r.unsubscribe);
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 le(r) {
596
+ function ae(r) {
626
597
  R(r) ? r() : r.unsubscribe();
627
598
  }
628
- var ve = {
629
- onUnhandledError: null,
630
- onStoppedNotification: null,
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, Q([r, e], K(t)));
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 ot(r) {
646
- it.setTimeout(function() {
612
+ function Qe(r) {
613
+ Ke.setTimeout(function() {
647
614
  throw r;
648
615
  });
649
616
  }
650
- function ue() {
617
+ function le() {
651
618
  }
652
- function st(r) {
619
+ function Ge(r) {
653
620
  r();
654
621
  }
655
- var Ee = function(r) {
656
- be(e, r);
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, we(t) && t.add(n)) : n.destination = ut, n;
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, o) {
662
- return new G(t, n, o);
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
- }(Z), ct = Function.prototype.bind;
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
- }(), G = function(r) {
722
- be(e, r);
723
- function e(t, n, o) {
724
- var i = r.call(this) || this, s;
725
- if (R(t) || !t)
726
- s = {
727
- next: t != null ? t : void 0,
728
- error: n != null ? n : void 0,
729
- complete: o != null ? o : void 0
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
- }(Ee);
695
+ })(we);
745
696
  function U(r) {
746
- ot(r);
697
+ Qe(r);
747
698
  }
748
- function lt(r) {
699
+ function Ze(r) {
749
700
  throw r;
750
701
  }
751
- var ut = {
702
+ var et = {
752
703
  closed: !0,
753
- next: ue,
754
- error: lt,
755
- complete: ue
756
- }, ft = function() {
704
+ next: le,
705
+ error: Ze,
706
+ complete: le
707
+ }, tt = (function() {
757
708
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
758
- }();
759
- function pt(r) {
709
+ })();
710
+ function rt(r) {
760
711
  return r;
761
712
  }
762
- function dt(r) {
763
- return r.length === 0 ? pt : r.length === 1 ? r[0] : function(t) {
764
- return r.reduce(function(n, o) {
765
- return o(n);
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 ht = function() {
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 o = this, i = yt(e) ? e : new G(e, t, n);
778
- return st(function() {
779
- var s = o, c = s.operator, a = s.source;
780
- i.add(c ? c.call(i, a) : a ? o._subscribe(i) : o._trySubscribe(i));
781
- }), i;
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 = fe(t), new t(function(o, i) {
791
- var s = new G({
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
- i(a), s.unsubscribe();
747
+ o(a), s.unsubscribe();
797
748
  }
798
749
  },
799
- error: i,
800
- complete: o
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[ft] = function() {
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 dt(e)(this);
763
+ return nt(e)(this);
813
764
  }, r.prototype.toPromise = function(e) {
814
765
  var t = this;
815
- return e = fe(e), new e(function(n, o) {
816
- var i;
766
+ return e = ue(e), new e(function(n, i) {
767
+ var o;
817
768
  t.subscribe(function(s) {
818
- return i = s;
769
+ return o = s;
819
770
  }, function(s) {
820
- return o(s);
771
+ return i(s);
821
772
  }, function() {
822
- return n(i);
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 fe(r) {
779
+ })();
780
+ function ue(r) {
830
781
  var e;
831
- return (e = r != null ? r : ve.Promise) !== null && e !== void 0 ? e : Promise;
782
+ return (e = r != null ? r : ze.Promise) !== null && e !== void 0 ? e : Promise;
832
783
  }
833
- function gt(r) {
784
+ function ot(r) {
834
785
  return r && R(r.next) && R(r.error) && R(r.complete);
835
786
  }
836
- function yt(r) {
837
- return r && r instanceof Ee || gt(r) && we(r);
787
+ function st(r) {
788
+ return r && r instanceof we || ot(r) && be(r);
838
789
  }
839
- const mt = () => {
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
- }, bt = (r = {}) => {
847
- const { parentOrigin: e = "*", timeout: t, debug: n = !1, config: o = {} } = r, i = Ie(n), s = De("App", i), { destroy: c, onDestroy: a } = s, h = () => {
848
- i("Child: Handshake - Sending SYN");
849
- const A = { penpal: O.Syn }, g = e instanceof RegExp ? "*" : e;
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 = Be(t, c), m = (l) => {
856
- if (mt() && !(l.source !== parent || !l.data) && l.data.penpal === O.SynAck) {
857
- const y = l.data, S = new se(y.id, y.appName), P = new se(y.id + "/api", y.appName), M = y.id, C = {}, F = (u) => "api/" + u, N = {
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) : C == null || C.$off(u, () => {
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(F(u.reqid), u);
814
+ P.$pureEmit(C(u.reqid), u);
864
815
  },
865
816
  onOsNotify: (u) => {
866
817
  }
867
- }, L = (u) => function(b) {
868
- const x = F(u);
869
- P.$on(x, function _(E) {
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
- }, Ae = me(N), V = rt(
823
+ }, ve = ye(L), V = Je(
873
824
  e,
874
- Ae,
875
- j(D({}, o), {
876
- postmateVersion: tt.version
825
+ ve,
826
+ W(I({}, i), {
827
+ postmateVersion: Be.version
877
828
  }),
878
829
  s,
879
- i
830
+ o
880
831
  )(
881
832
  l
882
- ), T = {}, k = V.bus;
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), T[f] ? T[f].push(b) : (T[f] = [b], k.$on(f, M));
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(C, k, {
838
+ Object.assign(O, k, {
888
839
  $on: u,
889
840
  $off: (f, b, x) => {
890
- var _;
891
- if (T[f]) {
892
- const E = T[f].indexOf(b);
893
- E > -1 && (T[f].splice(E, 1), S.$off(f, b));
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 T[f], (_ = T[f]) != null && _.length || (k.$off(f, M), delete T[f]);
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 Se = j(D({}, V), {
903
- bus: C,
904
- query: (u, f) => w(void 0, null, function* () {
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
- j(D({}, u), {
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) : _(E);
864
+ (E == null ? void 0 : E.result) === "succ" ? x(E) : T(E);
914
865
  });
915
866
  });
916
867
  }),
917
- createObservableQuery: (b, ...x) => w(void 0, [b, ...x], function* (u, f = {}) {
918
- const _ = (u == null ? void 0 : u.reqid) || (yield V.genReqId()), E = new ht(
919
- L(_)
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
- j(D({}, u), {
923
- reqid: _
873
+ W(I({}, u), {
874
+ reqid: T
924
875
  }),
925
- j(D({}, f), {
876
+ W(I({}, f), {
926
877
  observable: !0
927
878
  })
928
879
  ), E;
929
880
  })
930
881
  });
931
- V && (window.removeEventListener(I.Message, m), p(), A({
932
- methods: Se,
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(I.Message, m), h(), a((l) => {
938
- window.removeEventListener(I.Message, m), l && g(l);
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
- }, wt = (r) => bt({
897
+ }, lt = (r) => at({
947
898
  debug: r == null ? void 0 : r.debug
948
899
  }).promise;
949
- class At {
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
- pe() ? (this.isWeb = !1, d.log("Initializing mobile platform..."), Oe().then((t) => {
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..."), wt().then((t) => {
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 ? Re(this.flutterInAppWebView, e, t) : null;
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 = D(D({}, this.options), e), e.debug !== void 0 && d.setDebug(e.debug), d.log("Options updated:", 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 o = yield (n = this.osConnector) == null ? void 0 : n.methods.query(e, t);
1080
- if (!o)
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 o;
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
- At as TrimApp,
1099
- At as default
1049
+ pt as TrimApp,
1050
+ pt as default
1100
1051
  };