@soyio/soyio-widget 1.0.11 → 1.0.12

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,2231 +1,76 @@
1
- var Bt = Object.defineProperty;
2
- var Gt = (y, S, O) => S in y ? Bt(y, S, { enumerable: !0, configurable: !0, writable: !0, value: O }) : y[S] = O;
3
- var ft = (y, S, O) => (Gt(y, typeof S != "symbol" ? S + "" : S, O), O), Jt = (y, S, O) => {
4
- if (!S.has(y))
5
- throw TypeError("Cannot " + O);
1
+ var T = Object.defineProperty;
2
+ var v = (t, e, n) => e in t ? T(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var u = (t, e, n) => (v(t, typeof e != "symbol" ? e + "" : e, n), n), _ = (t, e, n) => {
4
+ if (!e.has(t))
5
+ throw TypeError("Cannot " + n);
6
6
  };
7
- var lt = (y, S, O) => {
8
- if (S.has(y))
7
+ var a = (t, e, n) => {
8
+ if (e.has(t))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- S instanceof WeakSet ? S.add(y) : S.set(y, O);
10
+ e instanceof WeakSet ? e.add(t) : e.set(t, n);
11
11
  };
12
- var ht = (y, S, O) => (Jt(y, S, "access private method"), O);
13
- var Zt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
14
- function Vt(y) {
15
- return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
16
- }
17
- var wt = { exports: {} }, mt = { exports: {} };
18
- (function(y, S) {
19
- (function(O, x) {
20
- y.exports = x();
21
- })(typeof self < "u" ? self : Zt, function() {
22
- return function(O) {
23
- var x = {};
24
- function g(m) {
25
- if (x[m])
26
- return x[m].exports;
27
- var W = x[m] = {
28
- i: m,
29
- l: !1,
30
- exports: {}
31
- };
32
- return O[m].call(W.exports, W, W.exports, g), W.l = !0, W.exports;
33
- }
34
- return g.m = O, g.c = x, g.d = function(m, W, B) {
35
- g.o(m, W) || Object.defineProperty(m, W, {
36
- enumerable: !0,
37
- get: B
38
- });
39
- }, g.r = function(m) {
40
- typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(m, Symbol.toStringTag, {
41
- value: "Module"
42
- }), Object.defineProperty(m, "__esModule", {
43
- value: !0
44
- });
45
- }, g.t = function(m, W) {
46
- if (1 & W && (m = g(m)), 8 & W || 4 & W && typeof m == "object" && m && m.__esModule)
47
- return m;
48
- var B = /* @__PURE__ */ Object.create(null);
49
- if (g.r(B), Object.defineProperty(B, "default", {
50
- enumerable: !0,
51
- value: m
52
- }), 2 & W && typeof m != "string")
53
- for (var k in m)
54
- g.d(B, k, (function(sn) {
55
- return m[sn];
56
- }).bind(null, k));
57
- return B;
58
- }, g.n = function(m) {
59
- var W = m && m.__esModule ? function() {
60
- return m.default;
61
- } : function() {
62
- return m;
63
- };
64
- return g.d(W, "a", W), W;
65
- }, g.o = function(m, W) {
66
- return {}.hasOwnProperty.call(m, W);
67
- }, g.p = "", g(g.s = 0);
68
- }([function(O, x, g) {
69
- g.r(x), g.d(x, "Promise", function() {
70
- return b;
71
- }), g.d(x, "TYPES", function() {
72
- return Ht;
73
- }), g.d(x, "ProxyWindow", function() {
74
- return F;
75
- }), g.d(x, "setup", function() {
76
- return dt;
77
- }), g.d(x, "destroy", function() {
78
- return Ft;
79
- }), g.d(x, "serializeMessage", function() {
80
- return jt;
81
- }), g.d(x, "deserializeMessage", function() {
82
- return Ct;
83
- }), g.d(x, "createProxyWindow", function() {
84
- return Mt;
85
- }), g.d(x, "toProxyWindow", function() {
86
- return Lt;
87
- }), g.d(x, "on", function() {
88
- return Z;
89
- }), g.d(x, "once", function() {
90
- return Tt;
91
- }), g.d(x, "send", function() {
92
- return V;
93
- }), g.d(x, "markWindowKnown", function() {
94
- return Qn;
95
- }), g.d(x, "cleanUpWindow", function() {
96
- return Ut;
97
- }), g.d(x, "bridge", function() {
98
- });
99
- function m(n) {
100
- return {}.toString.call(n) === "[object RegExp]";
101
- }
102
- var W = `Call was rejected by callee.\r
103
- `;
104
- function B(n) {
105
- return n === void 0 && (n = window), n.location.protocol;
106
- }
107
- function k(n) {
108
- if (n === void 0 && (n = window), n.mockDomain) {
109
- var e = n.mockDomain.split("//")[0];
110
- if (e)
111
- return e;
112
- }
113
- return B(n);
114
- }
115
- function sn(n) {
116
- return n === void 0 && (n = window), k(n) === "about:";
117
- }
118
- function q(n) {
119
- if (n === void 0 && (n = window), n)
120
- try {
121
- if (n.parent && n.parent !== n)
122
- return n.parent;
123
- } catch {
124
- }
125
- }
126
- function Tn(n) {
127
- if (n === void 0 && (n = window), n && !q(n))
128
- try {
129
- return n.opener;
130
- } catch {
131
- }
132
- }
133
- function dn(n) {
134
- try {
135
- return !0;
136
- } catch {
137
- }
138
- return !1;
139
- }
140
- function fn(n) {
141
- n === void 0 && (n = window);
142
- var e = n.location;
143
- if (!e)
144
- throw new Error("Can not read window location");
145
- var t = B(n);
146
- if (!t)
147
- throw new Error("Can not read window protocol");
148
- if (t === "file:")
149
- return "file://";
150
- if (t === "about:") {
151
- var r = q(n);
152
- return r && dn() ? fn(r) : "about://";
153
- }
154
- var o = e.host;
155
- if (!o)
156
- throw new Error("Can not read window host");
157
- return t + "//" + o;
158
- }
159
- function j(n) {
160
- n === void 0 && (n = window);
161
- var e = fn(n);
162
- return e && n.mockDomain && n.mockDomain.indexOf("mock:") === 0 ? n.mockDomain : e;
163
- }
164
- function Y(n) {
165
- if (!function(e) {
166
- try {
167
- if (e === window)
168
- return !0;
169
- } catch {
170
- }
171
- try {
172
- var t = Object.getOwnPropertyDescriptor(e, "location");
173
- if (t && t.enumerable === !1)
174
- return !1;
175
- } catch {
176
- }
177
- try {
178
- if (sn(e) && dn())
179
- return !0;
180
- } catch {
181
- }
182
- try {
183
- if (function(r) {
184
- return r === void 0 && (r = window), k(r) === "mock:";
185
- }(e) && dn())
186
- return !0;
187
- } catch {
188
- }
189
- try {
190
- if (fn(e) === fn(window))
191
- return !0;
192
- } catch {
193
- }
194
- return !1;
195
- }(n))
196
- return !1;
197
- try {
198
- if (n === window || sn(n) && dn() || j(window) === j(n))
199
- return !0;
200
- } catch {
201
- }
202
- return !1;
203
- }
204
- function ln(n) {
205
- if (!Y(n))
206
- throw new Error("Expected window to be same domain");
207
- return n;
208
- }
209
- function jn(n, e) {
210
- if (!n || !e)
211
- return !1;
212
- var t = q(e);
213
- return t ? t === n : function(r) {
214
- var o = [];
215
- try {
216
- for (; r.parent !== r; )
217
- o.push(r.parent), r = r.parent;
218
- } catch {
219
- }
220
- return o;
221
- }(e).indexOf(n) !== -1;
222
- }
223
- function Cn(n) {
224
- var e = [], t;
225
- try {
226
- t = n.frames;
227
- } catch {
228
- t = n;
229
- }
230
- var r;
231
- try {
232
- r = t.length;
233
- } catch {
234
- }
235
- if (r === 0)
236
- return e;
237
- if (r) {
238
- for (var o = 0; o < r; o++) {
239
- var i = void 0;
240
- try {
241
- i = t[o];
242
- } catch {
243
- continue;
244
- }
245
- e.push(i);
246
- }
247
- return e;
248
- }
249
- for (var a = 0; a < 100; a++) {
250
- var s = void 0;
251
- try {
252
- s = t[a];
253
- } catch {
254
- return e;
255
- }
256
- if (!s)
257
- return e;
258
- e.push(s);
259
- }
260
- return e;
261
- }
262
- var gt = [], yt = [];
263
- function H(n, e) {
264
- e === void 0 && (e = !0);
265
- try {
266
- if (n === window)
267
- return !1;
268
- } catch {
269
- return !0;
270
- }
271
- try {
272
- if (!n)
273
- return !0;
274
- } catch {
275
- return !0;
276
- }
277
- try {
278
- if (n.closed)
279
- return !0;
280
- } catch (o) {
281
- return !o || o.message !== W;
282
- }
283
- if (e && Y(n))
284
- try {
285
- if (n.mockclosed)
286
- return !0;
287
- } catch {
288
- }
289
- try {
290
- if (!n.parent || !n.top)
291
- return !0;
292
- } catch {
293
- }
294
- var t = function(o, i) {
295
- for (var a = 0; a < o.length; a++)
296
- try {
297
- if (o[a] === i)
298
- return a;
299
- } catch {
300
- }
301
- return -1;
302
- }(gt, n);
303
- if (t !== -1) {
304
- var r = yt[t];
305
- if (r && function(o) {
306
- if (!o.contentWindow || !o.parentNode)
307
- return !0;
308
- var i = o.ownerDocument;
309
- if (i && i.documentElement && !i.documentElement.contains(o)) {
310
- for (var a = o; a.parentNode && a.parentNode !== a; )
311
- a = a.parentNode;
312
- if (!a.host || !i.documentElement.contains(a.host))
313
- return !0;
314
- }
315
- return !1;
316
- }(r))
317
- return !0;
318
- }
319
- return !1;
320
- }
321
- function Mn(n) {
322
- return n === void 0 && (n = window), Tn(n = n || window) || q(n) || void 0;
323
- }
324
- function Q(n, e) {
325
- if (typeof n == "string") {
326
- if (typeof e == "string")
327
- return n === "*" || e === n;
328
- if (m(e) || Array.isArray(e))
329
- return !1;
330
- }
331
- return m(n) ? m(e) ? n.toString() === e.toString() : !Array.isArray(e) && !!e.match(n) : !!Array.isArray(n) && (Array.isArray(e) ? JSON.stringify(n) === JSON.stringify(e) : !m(e) && n.some(function(t) {
332
- return Q(t, e);
333
- }));
334
- }
335
- function hn(n) {
336
- try {
337
- if (n === window)
338
- return !0;
339
- } catch (e) {
340
- if (e && e.message === W)
341
- return !0;
342
- }
343
- try {
344
- if ({}.toString.call(n) === "[object Window]")
345
- return !0;
346
- } catch (e) {
347
- if (e && e.message === W)
348
- return !0;
349
- }
350
- try {
351
- if (window.Window && n instanceof window.Window)
352
- return !0;
353
- } catch (e) {
354
- if (e && e.message === W)
355
- return !0;
356
- }
357
- try {
358
- if (n && n.self === n)
359
- return !0;
360
- } catch (e) {
361
- if (e && e.message === W)
362
- return !0;
363
- }
364
- try {
365
- if (n && n.parent === n)
366
- return !0;
367
- } catch (e) {
368
- if (e && e.message === W)
369
- return !0;
370
- }
371
- try {
372
- if (n && n.top === n)
373
- return !0;
374
- } catch (e) {
375
- if (e && e.message === W)
376
- return !0;
377
- }
378
- try {
379
- if (n && n.__cross_domain_utils_window_check__ === "__unlikely_value__")
380
- return !1;
381
- } catch {
382
- return !0;
383
- }
384
- try {
385
- if ("postMessage" in n && "self" in n && "location" in n)
386
- return !0;
387
- } catch {
388
- }
389
- return !1;
390
- }
391
- function Ln(n) {
392
- if (Y(n))
393
- return ln(n).frameElement;
394
- for (var e = 0, t = document.querySelectorAll("iframe"); e < t.length; e++) {
395
- var r = t[e];
396
- if (r && r.contentWindow && r.contentWindow === n)
397
- return r;
398
- }
399
- }
400
- function Et(n) {
401
- if (function(t) {
402
- return t === void 0 && (t = window), !!q(t);
403
- }(n)) {
404
- var e = Ln(n);
405
- if (e && e.parentElement) {
406
- e.parentElement.removeChild(e);
407
- return;
408
- }
409
- }
410
- try {
411
- n.close();
412
- } catch {
413
- }
414
- }
415
- function $(n) {
416
- try {
417
- if (!n)
418
- return !1;
419
- if (typeof Promise < "u" && n instanceof Promise)
420
- return !0;
421
- if (typeof window < "u" && typeof window.Window == "function" && n instanceof window.Window || typeof window < "u" && typeof window.constructor == "function" && n instanceof window.constructor)
422
- return !1;
423
- var e = {}.toString;
424
- if (e) {
425
- var t = e.call(n);
426
- if (t === "[object Window]" || t === "[object global]" || t === "[object DOMWindow]")
427
- return !1;
428
- }
429
- if (typeof n.then == "function")
430
- return !0;
431
- } catch {
432
- return !1;
433
- }
434
- return !1;
435
- }
436
- var Fn = [], _ = [], yn = 0, nn;
437
- function Hn() {
438
- if (!yn && nn) {
439
- var n = nn;
440
- nn = null, n.resolve();
441
- }
442
- }
443
- function En() {
444
- yn += 1;
445
- }
446
- function tn() {
447
- yn -= 1, Hn();
448
- }
449
- var b = function() {
450
- function n(t) {
451
- var r = this;
452
- if (this.resolved = void 0, this.rejected = void 0, this.errorHandled = void 0, this.value = void 0, this.error = void 0, this.handlers = void 0, this.dispatching = void 0, this.stack = void 0, this.resolved = !1, this.rejected = !1, this.errorHandled = !1, this.handlers = [], t) {
453
- var o, i, a = !1, s = !1, c = !1;
454
- En();
455
- try {
456
- t(function(u) {
457
- c ? r.resolve(u) : (a = !0, o = u);
458
- }, function(u) {
459
- c ? r.reject(u) : (s = !0, i = u);
460
- });
461
- } catch (u) {
462
- tn(), this.reject(u);
463
- return;
464
- }
465
- tn(), c = !0, a ? this.resolve(o) : s && this.reject(i);
466
- }
467
- }
468
- var e = n.prototype;
469
- return e.resolve = function(t) {
470
- if (this.resolved || this.rejected)
471
- return this;
472
- if ($(t))
473
- throw new Error("Can not resolve promise with another promise");
474
- return this.resolved = !0, this.value = t, this.dispatch(), this;
475
- }, e.reject = function(t) {
476
- var r = this;
477
- if (this.resolved || this.rejected)
478
- return this;
479
- if ($(t))
480
- throw new Error("Can not reject promise with another promise");
481
- if (!t) {
482
- var o = t && typeof t.toString == "function" ? t.toString() : {}.toString.call(t);
483
- t = new Error("Expected reject to be called with Error, got " + o);
484
- }
485
- return this.rejected = !0, this.error = t, this.errorHandled || setTimeout(function() {
486
- r.errorHandled || function(i, a) {
487
- if (Fn.indexOf(i) === -1) {
488
- Fn.push(i), setTimeout(function() {
489
- throw i;
490
- }, 1);
491
- for (var s = 0; s < _.length; s++)
492
- _[s](i, a);
493
- }
494
- }(t, r);
495
- }, 1), this.dispatch(), this;
496
- }, e.asyncReject = function(t) {
497
- return this.errorHandled = !0, this.reject(t), this;
498
- }, e.dispatch = function() {
499
- var t = this.resolved, r = this.rejected, o = this.handlers;
500
- if (!this.dispatching && (t || r)) {
501
- this.dispatching = !0, En();
502
- for (var i = function(h, p) {
503
- return h.then(function(v) {
504
- p.resolve(v);
505
- }, function(v) {
506
- p.reject(v);
507
- });
508
- }, a = 0; a < o.length; a++) {
509
- var s = o[a], c = s.onSuccess, u = s.onError, l = s.promise, d = void 0;
510
- if (t)
511
- try {
512
- d = c ? c(this.value) : this.value;
513
- } catch (h) {
514
- l.reject(h);
515
- continue;
516
- }
517
- else if (r) {
518
- if (!u) {
519
- l.reject(this.error);
520
- continue;
521
- }
522
- try {
523
- d = u(this.error);
524
- } catch (h) {
525
- l.reject(h);
526
- continue;
527
- }
528
- }
529
- if (d instanceof n && (d.resolved || d.rejected)) {
530
- var f = d;
531
- f.resolved ? l.resolve(f.value) : l.reject(f.error), f.errorHandled = !0;
532
- } else
533
- $(d) ? d instanceof n && (d.resolved || d.rejected) ? d.resolved ? l.resolve(d.value) : l.reject(d.error) : i(d, l) : l.resolve(d);
534
- }
535
- o.length = 0, this.dispatching = !1, tn();
536
- }
537
- }, e.then = function(t, r) {
538
- if (t && typeof t != "function" && !t.call)
539
- throw new Error("Promise.then expected a function for success handler");
540
- if (r && typeof r != "function" && !r.call)
541
- throw new Error("Promise.then expected a function for error handler");
542
- var o = new n();
543
- return this.handlers.push({
544
- promise: o,
545
- onSuccess: t,
546
- onError: r
547
- }), this.errorHandled = !0, this.dispatch(), o;
548
- }, e.catch = function(t) {
549
- return this.then(void 0, t);
550
- }, e.finally = function(t) {
551
- if (t && typeof t != "function" && !t.call)
552
- throw new Error("Promise.finally expected a function");
553
- return this.then(function(r) {
554
- return n.try(t).then(function() {
555
- return r;
556
- });
557
- }, function(r) {
558
- return n.try(t).then(function() {
559
- throw r;
560
- });
561
- });
562
- }, e.timeout = function(t, r) {
563
- var o = this;
564
- if (this.resolved || this.rejected)
565
- return this;
566
- var i = setTimeout(function() {
567
- o.resolved || o.rejected || o.reject(r || new Error("Promise timed out after " + t + "ms"));
568
- }, t);
569
- return this.then(function(a) {
570
- return clearTimeout(i), a;
571
- });
572
- }, e.toPromise = function() {
573
- if (typeof Promise > "u")
574
- throw new TypeError("Could not find Promise");
575
- return Promise.resolve(this);
576
- }, e.lazy = function() {
577
- return this.errorHandled = !0, this;
578
- }, n.resolve = function(t) {
579
- return t instanceof n ? t : $(t) ? new n(function(r, o) {
580
- return t.then(r, o);
581
- }) : new n().resolve(t);
582
- }, n.reject = function(t) {
583
- return new n().reject(t);
584
- }, n.asyncReject = function(t) {
585
- return new n().asyncReject(t);
586
- }, n.all = function(t) {
587
- var r = new n(), o = t.length, i = [].slice();
588
- if (!o)
589
- return r.resolve(i), r;
590
- for (var a = function(u, l, d) {
591
- return l.then(function(f) {
592
- i[u] = f, (o -= 1) == 0 && r.resolve(i);
593
- }, function(f) {
594
- d.reject(f);
595
- });
596
- }, s = 0; s < t.length; s++) {
597
- var c = t[s];
598
- if (c instanceof n) {
599
- if (c.resolved) {
600
- i[s] = c.value, o -= 1;
601
- continue;
602
- }
603
- } else if (!$(c)) {
604
- i[s] = c, o -= 1;
605
- continue;
606
- }
607
- a(s, n.resolve(c), r);
608
- }
609
- return o === 0 && r.resolve(i), r;
610
- }, n.hash = function(t) {
611
- var r = {}, o = [], i = function(s) {
612
- if (t.hasOwnProperty(s)) {
613
- var c = t[s];
614
- $(c) ? o.push(c.then(function(u) {
615
- r[s] = u;
616
- })) : r[s] = c;
617
- }
618
- };
619
- for (var a in t)
620
- i(a);
621
- return n.all(o).then(function() {
622
- return r;
623
- });
624
- }, n.map = function(t, r) {
625
- return n.all(t.map(r));
626
- }, n.onPossiblyUnhandledException = function(t) {
627
- return function(r) {
628
- return _.push(r), {
629
- cancel: function() {
630
- _.splice(_.indexOf(r), 1);
631
- }
632
- };
633
- }(t);
634
- }, n.try = function(t, r, o) {
635
- if (t && typeof t != "function" && !t.call)
636
- throw new Error("Promise.try expected a function");
637
- var i;
638
- En();
639
- try {
640
- i = t.apply(r, o || []);
641
- } catch (a) {
642
- return tn(), n.reject(a);
643
- }
644
- return tn(), n.resolve(i);
645
- }, n.delay = function(t) {
646
- return new n(function(r) {
647
- setTimeout(r, t);
648
- });
649
- }, n.isPromise = function(t) {
650
- return !!(t && t instanceof n) || $(t);
651
- }, n.flush = function() {
652
- return function(t) {
653
- var r = nn = nn || new t();
654
- return Hn(), r;
655
- }(n);
656
- }, n;
657
- }();
658
- function vn(n, e) {
659
- for (var t = 0; t < n.length; t++)
660
- try {
661
- if (n[t] === e)
662
- return t;
663
- } catch {
664
- }
665
- return -1;
666
- }
667
- var Wn = function() {
668
- function n() {
669
- if (this.name = void 0, this.weakmap = void 0, this.keys = void 0, this.values = void 0, this.name = "__weakmap_" + (1e9 * Math.random() >>> 0) + "__", function() {
670
- if (typeof WeakMap > "u" || Object.freeze === void 0)
671
- return !1;
672
- try {
673
- var t = /* @__PURE__ */ new WeakMap(), r = {};
674
- return Object.freeze(r), t.set(r, "__testvalue__"), t.get(r) === "__testvalue__";
675
- } catch {
676
- return !1;
677
- }
678
- }())
679
- try {
680
- this.weakmap = /* @__PURE__ */ new WeakMap();
681
- } catch {
682
- }
683
- this.keys = [], this.values = [];
684
- }
685
- var e = n.prototype;
686
- return e._cleanupClosedWindows = function() {
687
- for (var t = this.weakmap, r = this.keys, o = 0; o < r.length; o++) {
688
- var i = r[o];
689
- if (hn(i) && H(i)) {
690
- if (t)
691
- try {
692
- t.delete(i);
693
- } catch {
694
- }
695
- r.splice(o, 1), this.values.splice(o, 1), o -= 1;
696
- }
697
- }
698
- }, e.isSafeToReadWrite = function(t) {
699
- return !hn(t);
700
- }, e.set = function(t, r) {
701
- if (!t)
702
- throw new Error("WeakMap expected key");
703
- var o = this.weakmap;
704
- if (o)
705
- try {
706
- o.set(t, r);
707
- } catch {
708
- delete this.weakmap;
709
- }
710
- if (this.isSafeToReadWrite(t))
711
- try {
712
- var i = this.name, a = t[i];
713
- a && a[0] === t ? a[1] = r : Object.defineProperty(t, i, {
714
- value: [t, r],
715
- writable: !0
716
- });
717
- return;
718
- } catch {
719
- }
720
- this._cleanupClosedWindows();
721
- var s = this.keys, c = this.values, u = vn(s, t);
722
- u === -1 ? (s.push(t), c.push(r)) : c[u] = r;
723
- }, e.get = function(t) {
724
- if (!t)
725
- throw new Error("WeakMap expected key");
726
- var r = this.weakmap;
727
- if (r)
728
- try {
729
- if (r.has(t))
730
- return r.get(t);
731
- } catch {
732
- delete this.weakmap;
733
- }
734
- if (this.isSafeToReadWrite(t))
735
- try {
736
- var o = t[this.name];
737
- return o && o[0] === t ? o[1] : void 0;
738
- } catch {
739
- }
740
- this._cleanupClosedWindows();
741
- var i = vn(this.keys, t);
742
- if (i !== -1)
743
- return this.values[i];
744
- }, e.delete = function(t) {
745
- if (!t)
746
- throw new Error("WeakMap expected key");
747
- var r = this.weakmap;
748
- if (r)
749
- try {
750
- r.delete(t);
751
- } catch {
752
- delete this.weakmap;
753
- }
754
- if (this.isSafeToReadWrite(t))
755
- try {
756
- var o = t[this.name];
757
- o && o[0] === t && (o[0] = o[1] = void 0);
758
- } catch {
759
- }
760
- this._cleanupClosedWindows();
761
- var i = this.keys, a = vn(i, t);
762
- a !== -1 && (i.splice(a, 1), this.values.splice(a, 1));
763
- }, e.has = function(t) {
764
- if (!t)
765
- throw new Error("WeakMap expected key");
766
- var r = this.weakmap;
767
- if (r)
768
- try {
769
- if (r.has(t))
770
- return !0;
771
- } catch {
772
- delete this.weakmap;
773
- }
774
- if (this.isSafeToReadWrite(t))
775
- try {
776
- var o = t[this.name];
777
- return !(!o || o[0] !== t);
778
- } catch {
779
- }
780
- return this._cleanupClosedWindows(), vn(this.keys, t) !== -1;
781
- }, e.getOrSet = function(t, r) {
782
- if (this.has(t))
783
- return this.get(t);
784
- var o = r();
785
- return this.set(t, o), o;
786
- }, n;
787
- }();
788
- function Un(n) {
789
- return n.name || n.__name__ || n.displayName || "anonymous";
790
- }
791
- function Bn(n, e) {
792
- try {
793
- delete n.name, n.name = e;
794
- } catch {
795
- }
796
- return n.__name__ = n.displayName = e, n;
797
- }
798
- function G() {
799
- var n = "0123456789abcdef";
800
- return "uid_" + "xxxxxxxxxx".replace(/./g, function() {
801
- return n.charAt(Math.floor(Math.random() * n.length));
802
- }) + "_" + function(e) {
803
- if (typeof btoa == "function")
804
- return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(t, r) {
805
- return String.fromCharCode(parseInt(r, 16));
806
- })).replace(/[=]/g, "");
807
- if (typeof Buffer < "u")
808
- return Buffer.from(e, "utf8").toString("base64").replace(/[=]/g, "");
809
- throw new Error("Can not find window.btoa or Buffer");
810
- }((/* @__PURE__ */ new Date()).toISOString().slice(11, 19).replace("T", ".")).replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
811
- }
812
- var wn;
813
- function Gn(n) {
814
- try {
815
- return JSON.stringify([].slice.call(n), function(e, t) {
816
- return typeof t == "function" ? "memoize[" + function(r) {
817
- if (wn = wn || new Wn(), r == null || typeof r != "object" && typeof r != "function")
818
- throw new Error("Invalid object");
819
- var o = wn.get(r);
820
- return o || (o = typeof r + ":" + G(), wn.set(r, o)), o;
821
- }(t) + "]" : typeof window < "u" && t instanceof window.Element || t !== null && typeof t == "object" && t.nodeType === 1 && typeof t.style == "object" && typeof t.ownerDocument == "object" ? {} : t;
822
- });
823
- } catch {
824
- throw new Error("Arguments not serializable -- can not be used to memoize");
825
- }
826
- }
827
- function Wt() {
828
- return {};
829
- }
830
- var en = 0, Jn = 0;
831
- function rn(n, e) {
832
- e === void 0 && (e = {});
833
- var t = e.thisNamespace, r = t !== void 0 && t, o = e.time, i, a, s = en;
834
- en += 1;
835
- var c = function() {
836
- for (var u = arguments.length, l = new Array(u), d = 0; d < u; d++)
837
- l[d] = arguments[d];
838
- s < Jn && (i = null, a = null, s = en, en += 1);
839
- var f;
840
- f = r ? (a = a || new Wn()).getOrSet(this, Wt) : i = i || {};
841
- var h;
842
- try {
843
- h = Gn(l);
844
- } catch {
845
- return n.apply(this, arguments);
846
- }
847
- var p = f[h];
848
- if (p && o && Date.now() - p.time < o && (delete f[h], p = null), p)
849
- return p.value;
850
- var v = Date.now(), w = n.apply(this, arguments);
851
- return f[h] = {
852
- time: v,
853
- value: w
854
- }, w;
855
- };
856
- return c.reset = function() {
857
- i = null, a = null;
858
- }, Bn(c, (e.name || Un(n)) + "::memoized");
859
- }
860
- rn.clear = function() {
861
- Jn = en;
862
- };
863
- function St(n) {
864
- var e = {};
865
- function t() {
866
- for (var r = arguments, o = this, i = arguments.length, a = new Array(i), s = 0; s < i; s++)
867
- a[s] = arguments[s];
868
- var c = Gn(a);
869
- return e.hasOwnProperty(c) || (e[c] = b.try(function() {
870
- return n.apply(o, r);
871
- }).finally(function() {
872
- delete e[c];
873
- })), e[c];
874
- }
875
- return t.reset = function() {
876
- e = {};
877
- }, Bn(t, Un(n) + "::promiseMemoized");
878
- }
879
- function K() {
880
- }
881
- function on(n, e) {
882
- if (e === void 0 && (e = 1), e >= 3)
883
- return "stringifyError stack overflow";
884
- try {
885
- if (!n)
886
- return "<unknown error: " + {}.toString.call(n) + ">";
887
- if (typeof n == "string")
888
- return n;
889
- if (n instanceof Error) {
890
- var t = n && n.stack, r = n && n.message;
891
- if (t && r)
892
- return t.indexOf(r) !== -1 ? t : r + `
893
- ` + t;
894
- if (t)
895
- return t;
896
- if (r)
897
- return r;
898
- }
899
- return n && n.toString && typeof n.toString == "function" ? n.toString() : {}.toString.call(n);
900
- } catch (o) {
901
- return "Error while stringifying error: " + on(o, e + 1);
902
- }
903
- }
904
- function Zn(n) {
905
- return typeof n == "string" ? n : n && n.toString && typeof n.toString == "function" ? n.toString() : {}.toString.call(n);
906
- }
907
- rn(function(n) {
908
- if (Object.values)
909
- return Object.values(n);
910
- var e = [];
911
- for (var t in n)
912
- n.hasOwnProperty(t) && e.push(n[t]);
913
- return e;
914
- });
915
- function Sn(n) {
916
- return {}.toString.call(n) === "[object RegExp]";
917
- }
918
- function an(n, e, t) {
919
- if (n.hasOwnProperty(e))
920
- return n[e];
921
- var r = t();
922
- return n[e] = r, r;
923
- }
924
- function Vn() {
925
- var n = document.body;
926
- if (!n)
927
- throw new Error("Body element not found");
928
- return n;
929
- }
930
- function kn() {
931
- return !!document.body && document.readyState === "complete";
932
- }
933
- function qn() {
934
- return !!document.body && document.readyState === "interactive";
935
- }
936
- rn(function() {
937
- return new b(function(n) {
938
- if (kn() || qn())
939
- return n();
940
- var e = setInterval(function() {
941
- if (kn() || qn())
942
- return clearInterval(e), n();
943
- }, 10);
944
- });
945
- });
946
- var mn = typeof document < "u" ? document.currentScript : null, xt = rn(function() {
947
- if (mn || (mn = function() {
948
- try {
949
- var n = function() {
950
- try {
951
- throw new Error("_");
952
- } catch (a) {
953
- return a.stack || "";
954
- }
955
- }(), e = /.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n), t = e && e[1];
956
- if (!t)
957
- return;
958
- for (var r = 0, o = [].slice.call(document.getElementsByTagName("script")).reverse(); r < o.length; r++) {
959
- var i = o[r];
960
- if (i.src && i.src === t)
961
- return i;
962
- }
963
- } catch {
964
- }
965
- }()))
966
- return mn;
967
- throw new Error("Can not determine current script");
968
- }), bt = G();
969
- rn(function() {
970
- var n;
971
- try {
972
- n = xt();
973
- } catch {
974
- return bt;
975
- }
976
- var e = n.getAttribute("data-uid");
977
- if (e && typeof e == "string" || (e = n.getAttribute("data-uid-auto")) && typeof e == "string")
978
- return e;
979
- if (n.src) {
980
- var t = function(r) {
981
- for (var o = "", i = 0; i < r.length; i++) {
982
- var a = r[i].charCodeAt(0) * i;
983
- r[i + 1] && (a += r[i + 1].charCodeAt(0) * (i - 1)), o += String.fromCharCode(97 + Math.abs(a) % 26);
984
- }
985
- return o;
986
- }(JSON.stringify({
987
- src: n.src,
988
- dataset: n.dataset
989
- }));
990
- e = "uid_" + t.slice(t.length - 30);
991
- } else
992
- e = G();
993
- return n.setAttribute("data-uid-auto", e), e;
994
- });
995
- function un(n) {
996
- n === void 0 && (n = window);
997
- var e = "__post_robot_10_0_46__";
998
- return n !== window ? n[e] : n[e] = n[e] || {};
999
- }
1000
- var Yn = function() {
1001
- return {};
1002
- };
1003
- function z(n, e) {
1004
- return n === void 0 && (n = "store"), e === void 0 && (e = Yn), an(un(), n, function() {
1005
- var t = e();
1006
- return {
1007
- has: function(r) {
1008
- return t.hasOwnProperty(r);
1009
- },
1010
- get: function(r, o) {
1011
- return t.hasOwnProperty(r) ? t[r] : o;
1012
- },
1013
- set: function(r, o) {
1014
- return t[r] = o, o;
1015
- },
1016
- del: function(r) {
1017
- delete t[r];
1018
- },
1019
- getOrSet: function(r, o) {
1020
- return an(t, r, o);
1021
- },
1022
- reset: function() {
1023
- t = e();
1024
- },
1025
- keys: function() {
1026
- return Object.keys(t);
1027
- }
1028
- };
1029
- });
1030
- }
1031
- var Pt = function() {
1032
- };
1033
- function pn() {
1034
- var n = un();
1035
- return n.WINDOW_WILDCARD = n.WINDOW_WILDCARD || new Pt(), n.WINDOW_WILDCARD;
1036
- }
1037
- function C(n, e) {
1038
- return n === void 0 && (n = "store"), e === void 0 && (e = Yn), z("windowStore").getOrSet(n, function() {
1039
- var t = new Wn(), r = function(o) {
1040
- return t.getOrSet(o, e);
1041
- };
1042
- return {
1043
- has: function(o) {
1044
- return r(o).hasOwnProperty(n);
1045
- },
1046
- get: function(o, i) {
1047
- var a = r(o);
1048
- return a.hasOwnProperty(n) ? a[n] : i;
1049
- },
1050
- set: function(o, i) {
1051
- return r(o)[n] = i, i;
1052
- },
1053
- del: function(o) {
1054
- delete r(o)[n];
1055
- },
1056
- getOrSet: function(o, i) {
1057
- return an(r(o), n, i);
1058
- }
1059
- };
1060
- });
1061
- }
1062
- function $n() {
1063
- return z("instance").getOrSet("instanceID", G);
1064
- }
1065
- function Kn(n, e) {
1066
- var t = e.domain, r = C("helloPromises"), o = r.get(n);
1067
- o && o.resolve({
1068
- domain: t
1069
- });
1070
- var i = b.resolve({
1071
- domain: t
1072
- });
1073
- return r.set(n, i), i;
1074
- }
1075
- function xn(n, e) {
1076
- return (0, e.send)(n, "postrobot_hello", {
1077
- instanceID: $n()
1078
- }, {
1079
- domain: "*",
1080
- timeout: -1
1081
- }).then(function(t) {
1082
- var r = t.origin, o = t.data.instanceID;
1083
- return Kn(n, {
1084
- domain: r
1085
- }), {
1086
- win: n,
1087
- domain: r,
1088
- instanceID: o
1089
- };
1090
- });
1091
- }
1092
- function Xn(n, e) {
1093
- var t = e.send;
1094
- return C("windowInstanceIDPromises").getOrSet(n, function() {
1095
- return xn(n, {
1096
- send: t
1097
- }).then(function(r) {
1098
- return r.instanceID;
1099
- });
1100
- });
1101
- }
1102
- function Qn(n) {
1103
- C("knownWindows").set(n, !0);
1104
- }
1105
- function bn(n) {
1106
- return typeof n == "object" && n !== null && typeof n.__type__ == "string";
1107
- }
1108
- function _n(n) {
1109
- return n === void 0 ? "undefined" : n === null ? "null" : Array.isArray(n) ? "array" : typeof n == "function" ? "function" : typeof n == "object" ? n instanceof Error ? "error" : typeof n.then == "function" ? "promise" : {}.toString.call(n) === "[object RegExp]" ? "regex" : {}.toString.call(n) === "[object Date]" ? "date" : "object" : typeof n == "string" ? "string" : typeof n == "number" ? "number" : typeof n == "boolean" ? "boolean" : void 0;
1110
- }
1111
- function X(n, e) {
1112
- return {
1113
- __type__: n,
1114
- __val__: e
1115
- };
1116
- }
1117
- var M, It = ((M = {}).function = function() {
1118
- }, M.error = function(n) {
1119
- return X("error", {
1120
- message: n.message,
1121
- stack: n.stack,
1122
- code: n.code,
1123
- data: n.data
1124
- });
1125
- }, M.promise = function() {
1126
- }, M.regex = function(n) {
1127
- return X("regex", n.source);
1128
- }, M.date = function(n) {
1129
- return X("date", n.toJSON());
1130
- }, M.array = function(n) {
1131
- return n;
1132
- }, M.object = function(n) {
1133
- return n;
1134
- }, M.string = function(n) {
1135
- return n;
1136
- }, M.number = function(n) {
1137
- return n;
1138
- }, M.boolean = function(n) {
1139
- return n;
1140
- }, M.null = function(n) {
1141
- return n;
1142
- }, M[void 0] = function(n) {
1143
- return X("undefined", n);
1144
- }, M), Ot = {}, L, Dt = ((L = {}).function = function() {
1145
- throw new Error("Function serialization is not implemented; nothing to deserialize");
1146
- }, L.error = function(n) {
1147
- var e = n.stack, t = n.code, r = n.data, o = new Error(n.message);
1148
- return o.code = t, r && (o.data = r), o.stack = e + `
1149
-
1150
- ` + o.stack, o;
1151
- }, L.promise = function() {
1152
- throw new Error("Promise serialization is not implemented; nothing to deserialize");
1153
- }, L.regex = function(n) {
1154
- return new RegExp(n);
1155
- }, L.date = function(n) {
1156
- return new Date(n);
1157
- }, L.array = function(n) {
1158
- return n;
1159
- }, L.object = function(n) {
1160
- return n;
1161
- }, L.string = function(n) {
1162
- return n;
1163
- }, L.number = function(n) {
1164
- return n;
1165
- }, L.boolean = function(n) {
1166
- return n;
1167
- }, L.null = function(n) {
1168
- return n;
1169
- }, L[void 0] = function() {
1170
- }, L), At = {};
1171
- new b(function(n) {
1172
- if (window.document && window.document.body)
1173
- return n(window.document.body);
1174
- var e = setInterval(function() {
1175
- if (window.document && window.document.body)
1176
- return clearInterval(e), n(window.document.body);
1177
- }, 10);
1178
- });
1179
- function Pn() {
1180
- for (var n = z("idToProxyWindow"), e = 0, t = n.keys(); e < t.length; e++) {
1181
- var r = t[e];
1182
- n.get(r).shouldClean() && n.del(r);
1183
- }
1184
- }
1185
- function nt(n, e) {
1186
- var t = e.send, r = e.id, o = r === void 0 ? G() : r, i = n.then(function(c) {
1187
- if (Y(c))
1188
- return ln(c).name;
1189
- }), a = n.then(function(c) {
1190
- if (H(c))
1191
- throw new Error("Window is closed, can not determine type");
1192
- return Tn(c) ? "popup" : "iframe";
1193
- });
1194
- i.catch(K), a.catch(K);
1195
- var s = function() {
1196
- return n.then(function(c) {
1197
- if (!H(c))
1198
- return Y(c) ? ln(c).name : i;
1199
- });
1200
- };
1201
- return {
1202
- id: o,
1203
- getType: function() {
1204
- return a;
1205
- },
1206
- getInstanceID: St(function() {
1207
- return n.then(function(c) {
1208
- return Xn(c, {
1209
- send: t
1210
- });
1211
- });
1212
- }),
1213
- close: function() {
1214
- return n.then(Et);
1215
- },
1216
- getName: s,
1217
- focus: function() {
1218
- return n.then(function(c) {
1219
- c.focus();
1220
- });
1221
- },
1222
- isClosed: function() {
1223
- return n.then(function(c) {
1224
- return H(c);
1225
- });
1226
- },
1227
- setLocation: function(c, u) {
1228
- return u === void 0 && (u = {}), n.then(function(l) {
1229
- var d = window.location.protocol + "//" + window.location.host, f = u.method, h = f === void 0 ? "get" : f, p = u.body;
1230
- if (c.indexOf("/") === 0)
1231
- c = "" + d + c;
1232
- else if (!c.match(/^https?:\/\//) && c.indexOf(d) !== 0)
1233
- throw new Error("Expected url to be http or https url, or absolute path, got " + JSON.stringify(c));
1234
- if (h === "post")
1235
- return s().then(function(v) {
1236
- if (!v)
1237
- throw new Error("Can not post to window without target name");
1238
- (function(w) {
1239
- var P = w.url, R = w.target, D = w.body, I = w.method, T = I === void 0 ? "post" : I, E = document.createElement("form");
1240
- if (E.setAttribute("target", R), E.setAttribute("method", T), E.setAttribute("action", P), E.style.display = "none", D)
1241
- for (var A = 0, U = Object.keys(D); A < U.length; A++) {
1242
- var N, cn = U[A], An = document.createElement("input");
1243
- An.setAttribute("name", cn), An.setAttribute("value", (N = D[cn]) == null ? void 0 : N.toString()), E.appendChild(An);
1244
- }
1245
- Vn().appendChild(E), E.submit(), Vn().removeChild(E);
1246
- })({
1247
- url: c,
1248
- target: v,
1249
- method: h,
1250
- body: p
1251
- });
1252
- });
1253
- if (h !== "get")
1254
- throw new Error("Unsupported method: " + h);
1255
- if (Y(l))
1256
- try {
1257
- if (l.location && typeof l.location.replace == "function") {
1258
- l.location.replace(c);
1259
- return;
1260
- }
1261
- } catch {
1262
- }
1263
- l.location = c;
1264
- });
1265
- },
1266
- setName: function(c) {
1267
- return n.then(function(u) {
1268
- var l = Y(u), d = Ln(u);
1269
- if (!l)
1270
- throw new Error("Can not set name for cross-domain window: " + c);
1271
- ln(u).name = c, d && d.setAttribute("name", c), i = b.resolve(c);
1272
- });
1273
- }
1274
- };
1275
- }
1276
- var F = function() {
1277
- function n(t) {
1278
- var r = t.send, o = t.win, i = t.serializedWindow;
1279
- this.id = void 0, this.isProxyWindow = !0, this.serializedWindow = void 0, this.actualWindow = void 0, this.actualWindowPromise = void 0, this.send = void 0, this.name = void 0, this.actualWindowPromise = new b(), this.serializedWindow = i || nt(this.actualWindowPromise, {
1280
- send: r
1281
- }), z("idToProxyWindow").set(this.getID(), this), o && this.setWindow(o, {
1282
- send: r
1283
- });
1284
- }
1285
- var e = n.prototype;
1286
- return e.getID = function() {
1287
- return this.serializedWindow.id;
1288
- }, e.getType = function() {
1289
- return this.serializedWindow.getType();
1290
- }, e.isPopup = function() {
1291
- return this.getType().then(function(t) {
1292
- return t === "popup";
1293
- });
1294
- }, e.setLocation = function(t, r) {
1295
- var o = this;
1296
- return this.serializedWindow.setLocation(t, r).then(function() {
1297
- return o;
1298
- });
1299
- }, e.getName = function() {
1300
- return this.serializedWindow.getName();
1301
- }, e.setName = function(t) {
1302
- var r = this;
1303
- return this.serializedWindow.setName(t).then(function() {
1304
- return r;
1305
- });
1306
- }, e.close = function() {
1307
- var t = this;
1308
- return this.serializedWindow.close().then(function() {
1309
- return t;
1310
- });
1311
- }, e.focus = function() {
1312
- var t = this, r = this.isPopup(), o = this.getName(), i = b.hash({
1313
- isPopup: r,
1314
- name: o
1315
- }).then(function(s) {
1316
- var c = s.name;
1317
- s.isPopup && c && window.open("", c, "noopener");
1318
- }), a = this.serializedWindow.focus();
1319
- return b.all([i, a]).then(function() {
1320
- return t;
1321
- });
1322
- }, e.isClosed = function() {
1323
- return this.serializedWindow.isClosed();
1324
- }, e.getWindow = function() {
1325
- return this.actualWindow;
1326
- }, e.setWindow = function(t, r) {
1327
- var o = r.send;
1328
- this.actualWindow = t, this.actualWindowPromise.resolve(this.actualWindow), this.serializedWindow = nt(this.actualWindowPromise, {
1329
- send: o,
1330
- id: this.getID()
1331
- }), C("winToProxyWindow").set(t, this);
1332
- }, e.awaitWindow = function() {
1333
- return this.actualWindowPromise;
1334
- }, e.matchWindow = function(t, r) {
1335
- var o = this, i = r.send;
1336
- return b.try(function() {
1337
- return o.actualWindow ? t === o.actualWindow : b.hash({
1338
- proxyInstanceID: o.getInstanceID(),
1339
- knownWindowInstanceID: Xn(t, {
1340
- send: i
1341
- })
1342
- }).then(function(a) {
1343
- var s = a.proxyInstanceID === a.knownWindowInstanceID;
1344
- return s && o.setWindow(t, {
1345
- send: i
1346
- }), s;
1347
- });
1348
- });
1349
- }, e.unwrap = function() {
1350
- return this.actualWindow || this;
1351
- }, e.getInstanceID = function() {
1352
- return this.serializedWindow.getInstanceID();
1353
- }, e.shouldClean = function() {
1354
- return !!(this.actualWindow && H(this.actualWindow));
1355
- }, e.serialize = function() {
1356
- return this.serializedWindow;
1357
- }, n.unwrap = function(t) {
1358
- return n.isProxyWindow(t) ? t.unwrap() : t;
1359
- }, n.serialize = function(t, r) {
1360
- var o = r.send;
1361
- return Pn(), n.toProxyWindow(t, {
1362
- send: o
1363
- }).serialize();
1364
- }, n.deserialize = function(t, r) {
1365
- var o = r.send;
1366
- return Pn(), z("idToProxyWindow").get(t.id) || new n({
1367
- serializedWindow: t,
1368
- send: o
1369
- });
1370
- }, n.isProxyWindow = function(t) {
1371
- return !!(t && !hn(t) && t.isProxyWindow);
1372
- }, n.toProxyWindow = function(t, r) {
1373
- var o = r.send;
1374
- if (Pn(), n.isProxyWindow(t))
1375
- return t;
1376
- var i = t;
1377
- return C("winToProxyWindow").get(i) || new n({
1378
- win: i,
1379
- send: o
1380
- });
1381
- }, n;
1382
- }();
1383
- function In(n, e, t, r, o) {
1384
- var i = C("methodStore"), a = z("proxyWindowMethods");
1385
- F.isProxyWindow(r) ? a.set(n, {
1386
- val: e,
1387
- name: t,
1388
- domain: o,
1389
- source: r
1390
- }) : (a.del(n), i.getOrSet(r, function() {
1391
- return {};
1392
- })[n] = {
1393
- domain: o,
1394
- name: t,
1395
- val: e,
1396
- source: r
1397
- });
1398
- }
1399
- function tt(n, e) {
1400
- var t = C("methodStore"), r = z("proxyWindowMethods");
1401
- return t.getOrSet(n, function() {
1402
- return {};
1403
- })[e] || r.get(e);
1404
- }
1405
- function et(n, e, t, r, o) {
1406
- a = (i = {
1407
- on: o.on,
1408
- send: o.send
1409
- }).on, s = i.send, z("builtinListeners").getOrSet("functionCalls", function() {
1410
- return a("postrobot_method", {
1411
- domain: "*"
1412
- }, function(l) {
1413
- var d = l.source, f = l.origin, h = l.data, p = h.id, v = h.name, w = tt(d, p);
1414
- if (!w)
1415
- throw new Error("Could not find method '" + v + "' with id: " + h.id + " in " + j(window));
1416
- var P = w.source, R = w.domain, D = w.val;
1417
- return b.try(function() {
1418
- if (!Q(R, f))
1419
- throw new Error("Method '" + h.name + "' domain " + JSON.stringify(Sn(w.domain) ? w.domain.source : w.domain) + " does not match origin " + f + " in " + j(window));
1420
- if (F.isProxyWindow(P))
1421
- return P.matchWindow(d, {
1422
- send: s
1423
- }).then(function(I) {
1424
- if (!I)
1425
- throw new Error("Method call '" + h.name + "' failed - proxy window does not match source in " + j(window));
1426
- });
1427
- }).then(function() {
1428
- return D.apply({
1429
- source: d,
1430
- origin: f
1431
- }, h.args);
1432
- }, function(I) {
1433
- return b.try(function() {
1434
- if (D.onError)
1435
- return D.onError(I);
1436
- }).then(function() {
1437
- throw I.stack && (I.stack = "Remote call to " + v + "(" + function(T) {
1438
- return T === void 0 && (T = []), (E = T, [].slice.call(E)).map(function(A) {
1439
- return typeof A == "string" ? "'" + A + "'" : A === void 0 ? "undefined" : A === null ? "null" : typeof A == "boolean" ? A.toString() : Array.isArray(A) ? "[ ... ]" : typeof A == "object" ? "{ ... }" : typeof A == "function" ? "() => { ... }" : "<" + typeof A + ">";
1440
- }).join(", ");
1441
- var E;
1442
- }(h.args) + `) failed
1443
-
1444
- ` + I.stack), I;
1445
- });
1446
- }).then(function(I) {
1447
- return {
1448
- result: I,
1449
- id: p,
1450
- name: v
1451
- };
1452
- });
1453
- });
1454
- });
1455
- var i, a, s, c = t.__id__ || G();
1456
- n = F.unwrap(n);
1457
- var u = t.__name__ || t.name || r;
1458
- return typeof u == "string" && typeof u.indexOf == "function" && u.indexOf("anonymous::") === 0 && (u = u.replace("anonymous::", r + "::")), F.isProxyWindow(n) ? (In(c, t, u, n, e), n.awaitWindow().then(function(l) {
1459
- In(c, t, u, l, e);
1460
- })) : In(c, t, u, n, e), X("cross_domain_function", {
1461
- id: c,
1462
- name: u
1463
- });
1464
- }
1465
- function rt(n, e, t, r) {
1466
- var o, i = r.on, a = r.send;
1467
- return function(s, c) {
1468
- c === void 0 && (c = Ot);
1469
- var u = JSON.stringify(s, function(l) {
1470
- var d = this[l];
1471
- if (bn(this))
1472
- return d;
1473
- var f = _n(d);
1474
- if (!f)
1475
- return d;
1476
- var h = c[f] || It[f];
1477
- return h ? h(d, l) : d;
1478
- });
1479
- return u === void 0 ? "undefined" : u;
1480
- }(t, ((o = {}).promise = function(s, c) {
1481
- return function(u, l, d, f, h) {
1482
- return X("cross_domain_zalgo_promise", {
1483
- then: et(u, l, function(p, v) {
1484
- return d.then(p, v);
1485
- }, f, {
1486
- on: h.on,
1487
- send: h.send
1488
- })
1489
- });
1490
- }(n, e, s, c, {
1491
- on: i,
1492
- send: a
1493
- });
1494
- }, o.function = function(s, c) {
1495
- return et(n, e, s, c, {
1496
- on: i,
1497
- send: a
1498
- });
1499
- }, o.object = function(s) {
1500
- return hn(s) || F.isProxyWindow(s) ? X("cross_domain_window", F.serialize(s, {
1501
- send: a
1502
- })) : s;
1503
- }, o));
1504
- }
1505
- function ot(n, e, t, r) {
1506
- var o, i = r.send;
1507
- return function(a, s) {
1508
- if (s === void 0 && (s = At), a !== "undefined")
1509
- return JSON.parse(a, function(c, u) {
1510
- if (bn(this))
1511
- return u;
1512
- var l, d;
1513
- if (bn(u) ? (l = u.__type__, d = u.__val__) : (l = _n(u), d = u), !l)
1514
- return d;
1515
- var f = s[l] || Dt[l];
1516
- return f ? f(d, c) : d;
1517
- });
1518
- }(t, ((o = {}).cross_domain_zalgo_promise = function(a) {
1519
- return function(s, c, u) {
1520
- return new b(u.then);
1521
- }(0, 0, a);
1522
- }, o.cross_domain_function = function(a) {
1523
- return function(s, c, u, l) {
1524
- var d = u.id, f = u.name, h = l.send, p = function(w) {
1525
- w === void 0 && (w = {});
1526
- function P() {
1527
- var R = arguments;
1528
- return F.toProxyWindow(s, {
1529
- send: h
1530
- }).awaitWindow().then(function(D) {
1531
- var I = tt(D, d);
1532
- if (I && I.val !== P)
1533
- return I.val.apply({
1534
- source: window,
1535
- origin: j()
1536
- }, R);
1537
- var T = [].slice.call(R);
1538
- return w.fireAndForget ? h(D, "postrobot_method", {
1539
- id: d,
1540
- name: f,
1541
- args: T
1542
- }, {
1543
- domain: c,
1544
- fireAndForget: !0
1545
- }) : h(D, "postrobot_method", {
1546
- id: d,
1547
- name: f,
1548
- args: T
1549
- }, {
1550
- domain: c,
1551
- fireAndForget: !1
1552
- }).then(function(E) {
1553
- return E.data.result;
1554
- });
1555
- }).catch(function(D) {
1556
- throw D;
1557
- });
1558
- }
1559
- return P.__name__ = f, P.__origin__ = c, P.__source__ = s, P.__id__ = d, P.origin = c, P;
1560
- }, v = p();
1561
- return v.fireAndForget = p({
1562
- fireAndForget: !0
1563
- }), v;
1564
- }(n, e, a, {
1565
- send: i
1566
- });
1567
- }, o.cross_domain_window = function(a) {
1568
- return F.deserialize(a, {
1569
- send: i
1570
- });
1571
- }, o));
1572
- }
1573
- var On = {};
1574
- On.postrobot_post_message = function(n, e, t) {
1575
- t.indexOf("file:") === 0 && (t = "*"), n.postMessage(e, t);
1576
- };
1577
- function Dn(n, e, t, r) {
1578
- var o = r.on, i = r.send;
1579
- return b.try(function() {
1580
- var a = C().getOrSet(n, function() {
1581
- return {};
1582
- });
1583
- return a.buffer = a.buffer || [], a.buffer.push(t), a.flush = a.flush || b.flush().then(function() {
1584
- if (H(n))
1585
- throw new Error("Window is closed");
1586
- var s = rt(n, e, ((c = {}).__post_robot_10_0_46__ = a.buffer || [], c), {
1587
- on: o,
1588
- send: i
1589
- }), c;
1590
- delete a.buffer;
1591
- for (var u = Object.keys(On), l = [], d = 0; d < u.length; d++) {
1592
- var f = u[d];
1593
- try {
1594
- On[f](n, s, e);
1595
- } catch (h) {
1596
- l.push(h);
1597
- }
1598
- }
1599
- if (l.length === u.length)
1600
- throw new Error(`All post-robot messaging strategies failed:
1601
-
1602
- ` + l.map(function(h, p) {
1603
- return p + ". " + on(h);
1604
- }).join(`
1605
-
1606
- `));
1607
- }), a.flush.then(function() {
1608
- delete a.flush;
1609
- });
1610
- }).then(K);
1611
- }
1612
- function it(n) {
1613
- return z("responseListeners").get(n);
1614
- }
1615
- function at(n) {
1616
- z("responseListeners").del(n);
1617
- }
1618
- function ut(n) {
1619
- return z("erroredResponseListeners").has(n);
1620
- }
1621
- function ct(n) {
1622
- var e = n.name, t = n.win, r = n.domain, o = C("requestListeners");
1623
- if (t === "*" && (t = null), r === "*" && (r = null), !e)
1624
- throw new Error("Name required to get request listener");
1625
- for (var i = 0, a = [t, pn()]; i < a.length; i++) {
1626
- var s = a[i];
1627
- if (s) {
1628
- var c = o.get(s);
1629
- if (c) {
1630
- var u = c[e];
1631
- if (u) {
1632
- if (r && typeof r == "string") {
1633
- if (u[r])
1634
- return u[r];
1635
- if (u.__domain_regex__)
1636
- for (var l = 0, d = u.__domain_regex__; l < d.length; l++) {
1637
- var f = d[l], h = f.listener;
1638
- if (Q(f.regex, r))
1639
- return h;
1640
- }
1641
- }
1642
- if (u["*"])
1643
- return u["*"];
1644
- }
1645
- }
1646
- }
1647
- }
1648
- }
1649
- function Nt(n, e, t, r) {
1650
- var o = r.on, i = r.send, a = ct({
1651
- name: t.name,
1652
- win: n,
1653
- domain: e
1654
- }), s = t.name === "postrobot_method" && t.data && typeof t.data.name == "string" ? t.data.name + "()" : t.name;
1655
- function c(u, l, d) {
1656
- return b.flush().then(function() {
1657
- if (!t.fireAndForget && !H(n))
1658
- try {
1659
- return Dn(n, e, {
1660
- id: G(),
1661
- origin: j(window),
1662
- type: "postrobot_message_response",
1663
- hash: t.hash,
1664
- name: t.name,
1665
- ack: u,
1666
- data: l,
1667
- error: d
1668
- }, {
1669
- on: o,
1670
- send: i
1671
- });
1672
- } catch (f) {
1673
- throw new Error("Send response message failed for " + s + " in " + j() + `
1674
-
1675
- ` + on(f));
1676
- }
1677
- });
1678
- }
1679
- return b.all([b.flush().then(function() {
1680
- if (!t.fireAndForget && !H(n))
1681
- try {
1682
- return Dn(n, e, {
1683
- id: G(),
1684
- origin: j(window),
1685
- type: "postrobot_message_ack",
1686
- hash: t.hash,
1687
- name: t.name
1688
- }, {
1689
- on: o,
1690
- send: i
1691
- });
1692
- } catch (u) {
1693
- throw new Error("Send ack message failed for " + s + " in " + j() + `
1694
-
1695
- ` + on(u));
1696
- }
1697
- }), b.try(function() {
1698
- if (!a)
1699
- throw new Error("No handler found for post message: " + t.name + " from " + e + " in " + window.location.protocol + "//" + window.location.host + window.location.pathname);
1700
- return a.handler({
1701
- source: n,
1702
- origin: e,
1703
- data: t.data
1704
- });
1705
- }).then(function(u) {
1706
- return c("success", u);
1707
- }, function(u) {
1708
- return c("error", null, u);
1709
- })]).then(K).catch(function(u) {
1710
- if (a && a.handleError)
1711
- return a.handleError(u);
1712
- throw u;
1713
- });
1714
- }
1715
- function Rt(n, e, t) {
1716
- if (!ut(t.hash)) {
1717
- var r = it(t.hash);
1718
- if (!r)
1719
- throw new Error("No handler found for post message ack for message: " + t.name + " from " + e + " in " + window.location.protocol + "//" + window.location.host + window.location.pathname);
1720
- try {
1721
- if (!Q(r.domain, e))
1722
- throw new Error("Ack origin " + e + " does not match domain " + r.domain.toString());
1723
- if (n !== r.win)
1724
- throw new Error("Ack source does not match registered window");
1725
- } catch (o) {
1726
- r.promise.reject(o);
1727
- }
1728
- r.ack = !0;
1729
- }
1730
- }
1731
- function zt(n, e, t) {
1732
- if (!ut(t.hash)) {
1733
- var r = it(t.hash);
1734
- if (!r)
1735
- throw new Error("No handler found for post message response for message: " + t.name + " from " + e + " in " + window.location.protocol + "//" + window.location.host + window.location.pathname);
1736
- if (!Q(r.domain, e))
1737
- throw new Error("Response origin " + e + " does not match domain " + (o = r.domain, Array.isArray(o) ? "(" + o.join(" | ") + ")" : m(o) ? "RegExp(" + o.toString() + ")" : o.toString()));
1738
- var o;
1739
- if (n !== r.win)
1740
- throw new Error("Response source does not match registered window");
1741
- at(t.hash), t.ack === "error" ? r.promise.reject(t.error) : t.ack === "success" && r.promise.resolve({
1742
- source: n,
1743
- origin: e,
1744
- data: t.data
1745
- });
1746
- }
1747
- }
1748
- function st(n, e) {
1749
- var t = e.on, r = e.send, o = z("receivedMessages");
1750
- try {
1751
- if (!window || window.closed || !n.source)
1752
- return;
1753
- } catch {
1754
- return;
1755
- }
1756
- var i = n.source, a = n.origin, s = function(l, d, f, h) {
1757
- var p = h.on, v = h.send, w;
1758
- try {
1759
- w = ot(d, f, l, {
1760
- on: p,
1761
- send: v
1762
- });
1763
- } catch {
1764
- return;
1765
- }
1766
- if (w && typeof w == "object" && w !== null) {
1767
- var P = w.__post_robot_10_0_46__;
1768
- if (Array.isArray(P))
1769
- return P;
1770
- }
1771
- }(n.data, i, a, {
1772
- on: t,
1773
- send: r
1774
- });
1775
- if (s) {
1776
- Qn(i);
1777
- for (var c = 0; c < s.length; c++) {
1778
- var u = s[c];
1779
- if (o.has(u.id) || (o.set(u.id, !0), H(i) && !u.fireAndForget))
1780
- return;
1781
- u.origin.indexOf("file:") === 0 && (a = "file://");
1782
- try {
1783
- u.type === "postrobot_message_request" ? Nt(i, a, u, {
1784
- on: t,
1785
- send: r
1786
- }) : u.type === "postrobot_message_response" ? zt(i, a, u) : u.type === "postrobot_message_ack" && Rt(i, a, u);
1787
- } catch (l) {
1788
- setTimeout(function() {
1789
- throw l;
1790
- }, 0);
1791
- }
1792
- }
1793
- }
1794
- }
1795
- function Z(n, e, t) {
1796
- if (!n)
1797
- throw new Error("Expected name");
1798
- if (typeof (e = e || {}) == "function" && (t = e, e = {}), !t)
1799
- throw new Error("Expected handler");
1800
- var r = function o(i, a) {
1801
- var s = i.name, c = i.win, u = i.domain, l = C("requestListeners");
1802
- if (!s || typeof s != "string")
1803
- throw new Error("Name required to add request listener");
1804
- if (c && c !== "*" && F.isProxyWindow(c)) {
1805
- var d = c.awaitWindow().then(function(N) {
1806
- return o({
1807
- name: s,
1808
- win: N,
1809
- domain: u
1810
- }, a);
1811
- });
1812
- return {
1813
- cancel: function() {
1814
- d.then(function(N) {
1815
- return N.cancel();
1816
- }, K);
1817
- }
1818
- };
1819
- }
1820
- var f = c;
1821
- if (Array.isArray(f)) {
1822
- for (var h = [], p = 0, v = f; p < v.length; p++)
1823
- h.push(o({
1824
- name: s,
1825
- domain: u,
1826
- win: v[p]
1827
- }, a));
1828
- return {
1829
- cancel: function() {
1830
- for (var N = 0; N < h.length; N++)
1831
- h[N].cancel();
1832
- }
1833
- };
1834
- }
1835
- if (Array.isArray(u)) {
1836
- for (var w = [], P = 0, R = u; P < R.length; P++)
1837
- w.push(o({
1838
- name: s,
1839
- win: f,
1840
- domain: R[P]
1841
- }, a));
1842
- return {
1843
- cancel: function() {
1844
- for (var N = 0; N < w.length; N++)
1845
- w[N].cancel();
1846
- }
1847
- };
1848
- }
1849
- var D = ct({
1850
- name: s,
1851
- win: f,
1852
- domain: u
1853
- });
1854
- f && f !== "*" || (f = pn());
1855
- var I = (u = u || "*").toString();
1856
- if (D)
1857
- throw f && u ? new Error("Request listener already exists for " + s + " on domain " + u.toString() + " for " + (f === pn() ? "wildcard" : "specified") + " window") : f ? new Error("Request listener already exists for " + s + " for " + (f === pn() ? "wildcard" : "specified") + " window") : u ? new Error("Request listener already exists for " + s + " on domain " + u.toString()) : new Error("Request listener already exists for " + s);
1858
- var T = l.getOrSet(f, function() {
1859
- return {};
1860
- }), E = an(T, s, function() {
1861
- return {};
1862
- }), A, U;
1863
- return Sn(u) ? (A = an(E, "__domain_regex__", function() {
1864
- return [];
1865
- })).push(U = {
1866
- regex: u,
1867
- listener: a
1868
- }) : E[I] = a, {
1869
- cancel: function() {
1870
- delete E[I], U && (A.splice(A.indexOf(U, 1)), A.length || delete E.__domain_regex__), Object.keys(E).length || delete T[s], f && !Object.keys(T).length && l.del(f);
1871
- }
1872
- };
1873
- }({
1874
- name: n,
1875
- win: e.window,
1876
- domain: e.domain || "*"
1877
- }, {
1878
- handler: t || e.handler,
1879
- handleError: e.errorHandler || function(o) {
1880
- throw o;
1881
- }
1882
- });
1883
- return {
1884
- cancel: function() {
1885
- r.cancel();
1886
- }
1887
- };
1888
- }
1889
- function Tt(n, e, t) {
1890
- typeof (e = e || {}) == "function" && (t = e, e = {});
1891
- var r = new b(), o;
1892
- return e.errorHandler = function(i) {
1893
- o.cancel(), r.reject(i);
1894
- }, o = Z(n, e, function(i) {
1895
- if (o.cancel(), r.resolve(i), t)
1896
- return t(i);
1897
- }), r.cancel = o.cancel, r;
1898
- }
1899
- var V = function n(e, t, r, o) {
1900
- var i = (o = o || {}).domain || "*", a = o.timeout || -1, s = o.timeout || 5e3, c = o.fireAndForget || !1;
1901
- return F.toProxyWindow(e, {
1902
- send: n
1903
- }).awaitWindow().then(function(u) {
1904
- return b.try(function() {
1905
- if (function(l, d, f) {
1906
- if (!l)
1907
- throw new Error("Expected name");
1908
- if (f && typeof f != "string" && !Array.isArray(f) && !Sn(f))
1909
- throw new TypeError("Can not send " + l + ". Expected domain " + JSON.stringify(f) + " to be a string, array, or regex");
1910
- if (H(d))
1911
- throw new Error("Can not send " + l + ". Target window is closed");
1912
- }(t, u, i), function(l, d) {
1913
- var f = Mn(d);
1914
- if (f)
1915
- return f === l;
1916
- if (d === l || function(v) {
1917
- v === void 0 && (v = window);
1918
- try {
1919
- if (v.top)
1920
- return v.top;
1921
- } catch {
1922
- }
1923
- if (q(v) === v)
1924
- return v;
1925
- try {
1926
- if (jn(window, v) && window.top)
1927
- return window.top;
1928
- } catch {
1929
- }
1930
- try {
1931
- if (jn(v, window) && window.top)
1932
- return window.top;
1933
- } catch {
1934
- }
1935
- for (var w = 0, P = function D(I) {
1936
- for (var T = [], E = 0, A = Cn(I); E < A.length; E++) {
1937
- var U = A[E];
1938
- T.push(U);
1939
- for (var N = 0, cn = D(U); N < cn.length; N++)
1940
- T.push(cn[N]);
1941
- }
1942
- return T;
1943
- }(v); w < P.length; w++) {
1944
- var R = P[w];
1945
- try {
1946
- if (R.top)
1947
- return R.top;
1948
- } catch {
1949
- }
1950
- if (q(R) === R)
1951
- return R;
1952
- }
1953
- }(d) === d)
1954
- return !1;
1955
- for (var h = 0, p = Cn(l); h < p.length; h++)
1956
- if (p[h] === d)
1957
- return !0;
1958
- return !1;
1959
- }(window, u))
1960
- return function(l, d, f) {
1961
- d === void 0 && (d = 5e3), f === void 0 && (f = "Window");
1962
- var h = function(p) {
1963
- return C("helloPromises").getOrSet(p, function() {
1964
- return new b();
1965
- });
1966
- }(l);
1967
- return d !== -1 && (h = h.timeout(d, new Error(f + " did not load after " + d + "ms"))), h;
1968
- }(u, s);
1969
- }).then(function(l) {
1970
- return function(d, f, h, p) {
1971
- var v = p.send;
1972
- return b.try(function() {
1973
- return typeof f == "string" ? f : b.try(function() {
1974
- return h || xn(d, {
1975
- send: v
1976
- }).then(function(w) {
1977
- return w.domain;
1978
- });
1979
- }).then(function(w) {
1980
- if (!Q(f, f))
1981
- throw new Error("Domain " + Zn(f) + " does not match " + Zn(f));
1982
- return w;
1983
- });
1984
- });
1985
- }(u, i, (l === void 0 ? {} : l).domain, {
1986
- send: n
1987
- });
1988
- }).then(function(l) {
1989
- var d = l, f = t === "postrobot_method" && r && typeof r.name == "string" ? r.name + "()" : t, h = new b(), p = t + "_" + G();
1990
- if (!c) {
1991
- var v = {
1992
- name: t,
1993
- win: u,
1994
- domain: d,
1995
- promise: h
1996
- };
1997
- (function(E, A) {
1998
- z("responseListeners").set(E, A);
1999
- })(p, v);
2000
- var w = C("requestPromises").getOrSet(u, function() {
2001
- return [];
2002
- });
2003
- w.push(h), h.catch(function() {
2004
- (function(E) {
2005
- z("erroredResponseListeners").set(E, !0);
2006
- })(p), at(p);
2007
- });
2008
- var P = function(E) {
2009
- return C("knownWindows").get(E, !1);
2010
- }(u) ? 1e4 : 2e3, R = a, D = P, I = R, T = function(E, A) {
2011
- var U;
2012
- return function N() {
2013
- U = setTimeout(function() {
2014
- (function() {
2015
- if (H(u))
2016
- return h.reject(new Error("Window closed for " + t + " before " + (v.ack ? "response" : "ack")));
2017
- if (v.cancelled)
2018
- return h.reject(new Error("Response listener was cancelled for " + t));
2019
- D = Math.max(D - 500, 0), I !== -1 && (I = Math.max(I - 500, 0)), v.ack || D !== 0 ? I === 0 && h.reject(new Error("No response for postMessage " + f + " in " + j() + " in " + R + "ms")) : h.reject(new Error("No ack for postMessage " + f + " in " + j() + " in " + P + "ms"));
2020
- })(), N();
2021
- }, 500);
2022
- }(), {
2023
- cancel: function() {
2024
- clearTimeout(U);
2025
- }
2026
- };
2027
- }();
2028
- h.finally(function() {
2029
- T.cancel(), w.splice(w.indexOf(h, 1));
2030
- }).catch(K);
2031
- }
2032
- return Dn(u, d, {
2033
- id: G(),
2034
- origin: j(window),
2035
- type: "postrobot_message_request",
2036
- hash: p,
2037
- name: t,
2038
- data: r,
2039
- fireAndForget: c
2040
- }, {
2041
- on: Z,
2042
- send: n
2043
- }).then(function() {
2044
- return c ? h.resolve() : h;
2045
- }, function(E) {
2046
- throw new Error("Send request message failed for " + f + " in " + j() + `
2047
-
2048
- ` + on(E));
2049
- });
2050
- });
2051
- });
2052
- };
2053
- function jt(n, e, t) {
2054
- return rt(n, e, t, {
2055
- on: Z,
2056
- send: V
2057
- });
2058
- }
2059
- function Ct(n, e, t) {
2060
- return ot(n, e, t, {
2061
- on: Z,
2062
- send: V
2063
- });
2064
- }
2065
- function Mt(n) {
2066
- return new F({
2067
- send: V,
2068
- win: n
2069
- });
2070
- }
2071
- function Lt(n) {
2072
- return F.toProxyWindow(n, {
2073
- send: V
2074
- });
2075
- }
2076
- function dt() {
2077
- un().initialized || (un().initialized = !0, e = (n = {
2078
- on: Z,
2079
- send: V
2080
- }).on, t = n.send, (r = un()).receiveMessage = r.receiveMessage || function(o) {
2081
- return st(o, {
2082
- on: e,
2083
- send: t
2084
- });
2085
- }, function(o) {
2086
- var i = o.on, a = o.send;
2087
- z().getOrSet("postMessageListener", function() {
2088
- return function(s, c, u) {
2089
- return s.addEventListener("message", u), {
2090
- cancel: function() {
2091
- s.removeEventListener("message", u);
2092
- }
2093
- };
2094
- }(window, 0, function(s) {
2095
- (function(c, u) {
2096
- var l = u.on, d = u.send;
2097
- b.try(function() {
2098
- var f = c.source || c.sourceElement, h = c.origin || c.originalEvent && c.originalEvent.origin, p = c.data;
2099
- if (h === "null" && (h = "file://"), f) {
2100
- if (!h)
2101
- throw new Error("Post message did not have origin domain");
2102
- st({
2103
- source: f,
2104
- origin: h,
2105
- data: p
2106
- }, {
2107
- on: l,
2108
- send: d
2109
- });
2110
- }
2111
- });
2112
- })(s, {
2113
- on: i,
2114
- send: a
2115
- });
2116
- });
2117
- });
2118
- }({
2119
- on: Z,
2120
- send: V
2121
- }), function(o) {
2122
- var i = o.on, a = o.send;
2123
- z("builtinListeners").getOrSet("helloListener", function() {
2124
- var s = i("postrobot_hello", {
2125
- domain: "*"
2126
- }, function(u) {
2127
- return Kn(u.source, {
2128
- domain: u.origin
2129
- }), {
2130
- instanceID: $n()
2131
- };
2132
- }), c = Mn();
2133
- return c && xn(c, {
2134
- send: a
2135
- }).catch(function(u) {
2136
- }), s;
2137
- });
2138
- }({
2139
- on: Z,
2140
- send: V
2141
- }));
2142
- var n, e, t, r;
2143
- }
2144
- function Ft() {
2145
- (function() {
2146
- for (var e = z("responseListeners"), t = 0, r = e.keys(); t < r.length; t++) {
2147
- var o = r[t], i = e.get(o);
2148
- i && (i.cancelled = !0), e.del(o);
2149
- }
2150
- })(), (n = z().get("postMessageListener")) && n.cancel();
2151
- var n;
2152
- delete window.__post_robot_10_0_46__;
2153
- }
2154
- var Ht = !0;
2155
- function Ut(n) {
2156
- for (var e = 0, t = C("requestPromises").get(n, []); e < t.length; e++)
2157
- t[e].reject(new Error("Window " + (H(n) ? "closed" : "cleaned up") + " before response")).catch(K);
2158
- }
2159
- dt();
2160
- }]);
2161
- });
2162
- })(mt);
2163
- var kt = mt.exports;
2164
- (function(y) {
2165
- y.exports = kt, y.exports.default = y.exports;
2166
- })(wt);
2167
- var qt = wt.exports;
2168
- const Yt = /* @__PURE__ */ Vt(qt), $t = "WIDGET_EVENT", Kt = "https://app.soyio.id/widget", Xt = "https://sandbox.soyio.id/widget", Qt = [
12
+ var f = (t, e, n) => (_(t, e, "access private method"), n);
13
+ const N = "WIDGET_EVENT", S = "https://app.soyio.id/widget", b = "https://sandbox.soyio.id/widget", y = [
2169
14
  "IDENTITY_AUTHENTICATED",
2170
15
  "IDENTITY_REGISTERED",
2171
16
  "IDENTITY_SIGNATURE",
2172
17
  "DENIED_CAMERA_PERMISSION",
2173
18
  "REJECTED_SIGNATURE"
2174
- ], _t = "WIDGET_CLOSED";
2175
- function ne(y) {
2176
- const S = y.isSandbox ?? !1, O = y.developmentUrl || (S ? Xt : Kt), x = Object.entries(y.configProps).filter(([, g]) => g).map(([g, m]) => `${g}=${encodeURIComponent(m)}`).join("&");
2177
- return `${O}/${y.flow}?sdk=web&${x}`;
19
+ ], g = "WIDGET_CLOSED";
20
+ function D(t) {
21
+ const e = t.isSandbox ?? !1, n = t.developmentUrl || (e ? b : S), o = Object.entries(t.configProps).filter(([, c]) => c).map(([c, d]) => `${c}=${encodeURIComponent(d)}`).join("&");
22
+ return `${n}/${t.flow}?sdk=web&${o}`;
2178
23
  }
2179
- const te = 500;
2180
- let J = null, Nn = null;
2181
- function Rn() {
2182
- J && !J.closed && J.focus();
24
+ const R = !!(typeof window < "u" && window.document && window.document.createElement), U = 500;
25
+ let i = null, l = null;
26
+ function r() {
27
+ i && !i.closed && i.focus();
2183
28
  }
2184
- function zn() {
2185
- document.body.style.filter = "", document.body.removeEventListener("click", Rn);
29
+ function E() {
30
+ document.body.style.filter = "", document.body.removeEventListener("click", r);
2186
31
  }
2187
- function ee() {
2188
- Nn = setInterval(() => {
2189
- (!J || J.closed) && (Nn && clearInterval(Nn), zn());
2190
- }, te);
32
+ function P() {
33
+ l = setInterval(() => {
34
+ (!i || i.closed) && (l && clearInterval(l), E());
35
+ }, U);
2191
36
  }
2192
- function re(y) {
2193
- const S = ne(y), O = 510, x = 720, g = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : window.screen.width, m = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : window.screen.height, W = g / 2 - O / 2, B = m / 2 - x / 2;
2194
- document.body.style.filter = "blur(5px)", document.body.addEventListener("click", (k) => {
2195
- Rn(), k.preventDefault();
2196
- }), J = window.open(S, "Soyio", `scrollbars=yes, width=${O}, height=${x}, top=${B}, left=${W}`), Rn(), ee();
37
+ function C(t) {
38
+ const e = D(t), n = 510, o = 720, c = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : window.screen.width, d = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : window.screen.height, m = c / 2 - n / 2, h = d / 2 - o / 2;
39
+ document.body.style.filter = "blur(5px)", document.body.addEventListener("click", (I) => {
40
+ r(), I.preventDefault();
41
+ }), i = window.open(e, "Soyio", `scrollbars=yes, width=${n}, height=${o}, top=${h}, left=${m}`), r(), P();
2197
42
  }
2198
- function oe() {
2199
- J && (J.close(), J = null), zn();
43
+ function O() {
44
+ i && (i.close(), i = null), E();
2200
45
  }
2201
- let vt = !1;
2202
- function ie(y) {
2203
- const { onEvent: S } = y;
2204
- vt || (Yt.on($t, (O) => {
2205
- S(O.data), Qt.includes(O.data.eventName) ? oe() : O.data.eventName === _t && zn();
2206
- }), vt = !0);
46
+ let w = !1;
47
+ async function L(t) {
48
+ const { onEvent: e } = t, n = await import("./index-yZw-yxuV.js").then((o) => o.i);
49
+ w || (n.on(N, (o) => {
50
+ e(o.data), y.includes(o.data.eventName) ? O() : o.data.eventName === g && E();
51
+ }), w = !0);
2207
52
  }
2208
- function ae(y) {
2209
- ie(y);
53
+ function W(t) {
54
+ L(t);
2210
55
  }
2211
- const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
+ const A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2212
57
  __proto__: null
2213
58
  }, Symbol.toStringTag, { value: "Module" }));
2214
- var gn, pt;
2215
- class se {
2216
- constructor(S) {
2217
- lt(this, gn);
2218
- ft(this, "onEvent");
2219
- this.onEvent = S.onEvent, re(S), ae({
2220
- onEvent: ht(this, gn, pt).bind(this)
2221
- });
59
+ var s, p;
60
+ class G {
61
+ constructor(e) {
62
+ a(this, s);
63
+ u(this, "onEvent");
64
+ this.onEvent = e.onEvent, R && (C(e), W({
65
+ onEvent: f(this, s, p).bind(this)
66
+ }));
2222
67
  }
2223
68
  }
2224
- gn = new WeakSet(), pt = function(S) {
2225
- this.onEvent(S);
69
+ s = new WeakSet(), p = function(e) {
70
+ this.onEvent(e);
2226
71
  };
2227
72
  export {
2228
- ce as SoyioTypes,
2229
- se as SoyioWidget,
2230
- se as default
73
+ A as SoyioTypes,
74
+ G as SoyioWidget,
75
+ G as default
2231
76
  };