@soyio/soyio-widget 2.3.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/index.d.ts +6 -6
- package/dist/index.js +29 -29
- package/dist/index.umd.cjs +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -287,18 +287,18 @@ Optional props:
|
|
|
287
287
|
|
|
288
288
|
## Consent Request Box
|
|
289
289
|
|
|
290
|
-
The **`
|
|
290
|
+
The **`ConsentBox`** is a component that allows you to embed a consent request directly within your webpage, rather than opening it in a popup window. This is particularly useful when you want to integrate the consent flow seamlessly into your application's interface.
|
|
291
291
|
|
|
292
292
|
```html
|
|
293
293
|
<!-- Add a container div where the consent request will be mounted -->
|
|
294
294
|
<div id="consent-request-box"></div>
|
|
295
295
|
|
|
296
296
|
<script>
|
|
297
|
-
import {
|
|
297
|
+
import { ConsentBox } from "@soyio/soyio-widget";
|
|
298
298
|
|
|
299
299
|
// Configuration for the consent request
|
|
300
|
-
const
|
|
301
|
-
|
|
300
|
+
const consentOptions = {
|
|
301
|
+
consentTemplateId: "<consent template id>",
|
|
302
302
|
onEvent: (data) => console.log(data),
|
|
303
303
|
isSandbox: true, // Optional, defaults to false
|
|
304
304
|
};
|
|
@@ -306,7 +306,7 @@ The **`ConsentRequestBox`** is a component that allows you to embed a consent re
|
|
|
306
306
|
// Wait for DOM to be fully loaded
|
|
307
307
|
document.addEventListener("DOMContentLoaded", () => {
|
|
308
308
|
// Create and mount the consent request box
|
|
309
|
-
new
|
|
309
|
+
new ConsentBox(consentOptions).mount("#consent-request-box");
|
|
310
310
|
});
|
|
311
311
|
</script>
|
|
312
312
|
```
|
|
@@ -318,16 +318,16 @@ The `onEvent` follows the following format:
|
|
|
318
318
|
```typescript
|
|
319
319
|
{
|
|
320
320
|
eventName: 'CONSENT_CHECKBOX_CHANGE',
|
|
321
|
-
entityId: `ent_${string}`,
|
|
322
321
|
isSelected: boolean
|
|
322
|
+
jwt: string,
|
|
323
323
|
}
|
|
324
324
|
```
|
|
325
325
|
|
|
326
326
|
### Attribute Descriptions
|
|
327
327
|
|
|
328
|
-
- **`
|
|
329
|
-
- **`entityId`**: Identifier of entity obtained when creating the `ConsentRequest`. It must start with `'ent_'`.
|
|
328
|
+
- **`consentTemplateId`**: Identifier of consent template. It must start with `'constpl_'`.
|
|
330
329
|
- **`isSelected`**: Boolean value indicating whether the consent checkbox is selected or not.
|
|
330
|
+
- **`jwt`**: JWT token containing necessary information for creation of the consent record. [Learn more](https://docs.soyio.id/docs/api/resources/create-consent-request).
|
|
331
331
|
|
|
332
332
|
## TypeScript
|
|
333
333
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuthRequestConfig } from './widget/types';
|
|
2
2
|
import { AuthRequestProps } from './widget/types';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { ConsentBox } from './embeds';
|
|
4
|
+
import { ConsentConfig } from './embeds/types';
|
|
5
|
+
import { ConsentEvent } from './embeds/types';
|
|
6
6
|
import { DisclosureRequestConfig } from './widget/types';
|
|
7
7
|
import { DisclosureRequestProps } from './widget/types';
|
|
8
8
|
import { EventData } from './widget/types';
|
|
@@ -15,12 +15,12 @@ import { SignatureAttemptProps } from './widget/types';
|
|
|
15
15
|
import { SignatureRequestConfig } from './widget/types';
|
|
16
16
|
import { SoyioWidget } from './widget';
|
|
17
17
|
|
|
18
|
-
export {
|
|
18
|
+
export { ConsentBox }
|
|
19
19
|
|
|
20
20
|
declare namespace SoyioTypes {
|
|
21
21
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
ConsentEvent,
|
|
23
|
+
ConsentConfig,
|
|
24
24
|
ForceErrors,
|
|
25
25
|
Request_2 as Request,
|
|
26
26
|
NewDisclosureRequestProps,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var R = Object.defineProperty;
|
|
2
2
|
var C = (t, e, n) => e in t ? R(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var u = (t, e, n) => (C(t, typeof e != "symbol" ? e + "" : e, n), n),
|
|
3
|
+
var u = (t, e, n) => (C(t, typeof e != "symbol" ? e + "" : e, n), n), N = (t, e, n) => {
|
|
4
4
|
if (!e.has(t))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
@@ -9,8 +9,8 @@ var w = (t, e, n) => {
|
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(t) : e.set(t, n);
|
|
11
11
|
};
|
|
12
|
-
var I = (t, e, n) => (
|
|
13
|
-
const v = "soyio-consent-
|
|
12
|
+
var I = (t, e, n) => (N(t, e, "access private method"), n);
|
|
13
|
+
const v = "soyio-consent-iframe", T = "https://app.soyio.id", _ = "https://sandbox.soyio.id", U = [
|
|
14
14
|
"DISCLOSURE_REQUEST_SUCCESSFUL",
|
|
15
15
|
"IDENTITY_REGISTERED",
|
|
16
16
|
"IDENTITY_SIGNATURE",
|
|
@@ -20,7 +20,7 @@ const v = "soyio-consent-request-iframe", _ = "https://app.soyio.id", T = "https
|
|
|
20
20
|
], D = "WIDGET_CLOSED";
|
|
21
21
|
function H() {
|
|
22
22
|
const t = document.getElementById(v);
|
|
23
|
-
t && (console.warn("
|
|
23
|
+
t && (console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."), t.remove());
|
|
24
24
|
}
|
|
25
25
|
function O(t) {
|
|
26
26
|
const e = document.querySelector(t);
|
|
@@ -52,7 +52,7 @@ function L(t) {
|
|
|
52
52
|
}
|
|
53
53
|
function x(t) {
|
|
54
54
|
const e = t.isSandbox ?? !1;
|
|
55
|
-
return `${t.developmentUrl || (e ?
|
|
55
|
+
return `${t.developmentUrl || (e ? _ : T)}/embed/consents/${t.consentTemplateId}`;
|
|
56
56
|
}
|
|
57
57
|
const A = "IFRAME_EVENT", $ = "IFRAME_HEIGHT_CHANGE";
|
|
58
58
|
let a = null, l = null;
|
|
@@ -69,7 +69,7 @@ async function G(t) {
|
|
|
69
69
|
n(s.height);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class z {
|
|
73
73
|
constructor(e) {
|
|
74
74
|
u(this, "options");
|
|
75
75
|
u(this, "iframe", null);
|
|
@@ -90,7 +90,7 @@ class Q {
|
|
|
90
90
|
g(), this.iframe && (this.iframe.remove(), this.iframe = null);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
const
|
|
93
|
+
const J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
94
94
|
__proto__: null
|
|
95
95
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
96
96
|
function M(t) {
|
|
@@ -98,57 +98,57 @@ function M(t) {
|
|
|
98
98
|
return "disclosureRequestId" in t.configProps ? e += ["disclosures", t.configProps.disclosureRequestId].join("/") : e += t.request, e;
|
|
99
99
|
}
|
|
100
100
|
function W(t) {
|
|
101
|
-
const e = t.isSandbox ?? !1, n = t.developmentUrl || (e ?
|
|
101
|
+
const e = t.isSandbox ?? !1, n = t.developmentUrl || (e ? _ : T), o = Object.entries(t.configProps).filter(([s, c]) => c || s === "disclosureRequestId").map(([s, c]) => `${s}=${encodeURIComponent(c)}`).join("&"), i = M(t);
|
|
102
102
|
return `${n}/${i}?sdk=web&${o}`;
|
|
103
103
|
}
|
|
104
104
|
const F = !!(typeof window < "u" && window.document && window.document.createElement);
|
|
105
|
-
let r = null,
|
|
106
|
-
function
|
|
105
|
+
let r = null, m = null;
|
|
106
|
+
function f(t = null) {
|
|
107
107
|
r && !r.closed && r.focus(), t == null || t.preventDefault();
|
|
108
108
|
}
|
|
109
109
|
function h() {
|
|
110
|
-
document.body.style.filter = "", document.body.removeEventListener("click",
|
|
110
|
+
document.body.style.filter = "", document.body.removeEventListener("click", f);
|
|
111
111
|
}
|
|
112
112
|
function V() {
|
|
113
|
-
|
|
114
|
-
(!r || r.closed) && (
|
|
113
|
+
m = setInterval(() => {
|
|
114
|
+
(!r || r.closed) && (m && clearInterval(m), h());
|
|
115
115
|
}, 500);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
const e = W(t), n = 420, o = 720, i = window.screenLeft !== void 0 ? window.screenLeft : window.screenX, s = window.screenTop !== void 0 ? window.screenTop : window.screenY, c = window.innerWidth || document.documentElement.clientWidth || window.screen.width,
|
|
119
|
-
document.body.style.filter = "blur(5px)", document.body.addEventListener("click",
|
|
117
|
+
function k(t) {
|
|
118
|
+
const e = W(t), n = 420, o = 720, i = window.screenLeft !== void 0 ? window.screenLeft : window.screenX, s = window.screenTop !== void 0 ? window.screenTop : window.screenY, c = window.innerWidth || document.documentElement.clientWidth || window.screen.width, b = window.innerHeight || document.documentElement.clientHeight || window.screen.height, p = c / window.screen.availWidth, P = (c - n) / 2 / p + i, S = (b - o) / 2 / p + s;
|
|
119
|
+
document.body.style.filter = "blur(5px)", document.body.addEventListener("click", f), r = window.open(
|
|
120
120
|
e,
|
|
121
121
|
"Soyio",
|
|
122
122
|
`scrollbars=yes,
|
|
123
123
|
width=${n},
|
|
124
124
|
height=${o},
|
|
125
|
-
top=${
|
|
126
|
-
left=${
|
|
127
|
-
),
|
|
125
|
+
top=${S},
|
|
126
|
+
left=${P}`
|
|
127
|
+
), f(), V();
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function j() {
|
|
130
130
|
r && (r.close(), r = null), h();
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const q = "WIDGET_EVENT";
|
|
133
133
|
let d = null;
|
|
134
134
|
function B() {
|
|
135
135
|
d && (d.cancel(), d = null);
|
|
136
136
|
}
|
|
137
137
|
async function X(t) {
|
|
138
138
|
const { onEvent: e } = t, n = await import("./index-yZw-yxuV.js").then((o) => o.i);
|
|
139
|
-
d && B(), d = n.on(
|
|
140
|
-
e(o.data),
|
|
139
|
+
d && B(), d = n.on(q, async (o) => {
|
|
140
|
+
e(o.data), U.includes(o.data.eventName) ? j() : o.data.eventName === D && h();
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
function Y(t) {
|
|
144
144
|
X(t);
|
|
145
145
|
}
|
|
146
146
|
var E, y;
|
|
147
|
-
class
|
|
147
|
+
class Q {
|
|
148
148
|
constructor(e) {
|
|
149
149
|
w(this, E);
|
|
150
150
|
u(this, "onEvent");
|
|
151
|
-
this.onEvent = e.onEvent, F && (
|
|
151
|
+
this.onEvent = e.onEvent, F && (k(e), Y({
|
|
152
152
|
onEvent: I(this, E, y).bind(this)
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
@@ -157,8 +157,8 @@ E = new WeakSet(), y = function(e) {
|
|
|
157
157
|
this.onEvent(e);
|
|
158
158
|
};
|
|
159
159
|
export {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
z as ConsentBox,
|
|
161
|
+
J as SoyioTypes,
|
|
162
|
+
Q as SoyioWidget,
|
|
163
|
+
Q as default
|
|
164
164
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(R,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(R=typeof globalThis<"u"?globalThis:R||self,N(R["soyio-widget"]={}))})(this,function(R){"use strict";var Pt=Object.defineProperty;var It=(R,N,M)=>N in R?Pt(R,N,{enumerable:!0,configurable:!0,writable:!0,value:M}):R[N]=M;var Pn=(R,N,M)=>(It(R,typeof N!="symbol"?N+"":N,M),M),Ot=(R,N,M)=>{if(!N.has(R))throw TypeError("Cannot "+M)};var Ie=(R,N,M)=>{if(N.has(R))throw TypeError("Cannot add the same private member more than once");N instanceof WeakSet?N.add(R):N.set(R,M)};var Oe=(R,N,M)=>(Ot(R,N,"access private method"),M);var mn,De;function N(v,W){for(var A=0;A<W.length;A++){const p=W[A];if(typeof p!="string"&&!Array.isArray(p)){for(const m in p)if(m!=="default"&&!(m in v)){const w=Object.getOwnPropertyDescriptor(p,m);w&&Object.defineProperty(v,m,w.get?w:{enumerable:!0,get:()=>p[m]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}const M="soyio-consent-iframe",Un="https://app.soyio.id",Bn="https://sandbox.soyio.id",Ae=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],Re="WIDGET_CLOSED",Ne=420,Te=720,Ce=500;function je(){const v=document.getElementById(M);v&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),v.remove())}function ze(v){const W=document.querySelector(v);if(!W)throw new Error(`Iframe div container with id '${v}' not found`);if(W.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${v}' must be a <div> element`);const A=W;return A.style.position="relative",A.style.cssText+=`
|
|
2
2
|
padding: 0 !important;
|
|
3
3
|
margin: 0 !important;
|
|
4
4
|
display: block !important;
|
|
5
5
|
border: none !important;
|
|
6
6
|
transition: height 0.35s !important;
|
|
7
7
|
opacity: 1 !important;
|
|
8
|
-
`,
|
|
8
|
+
`,A}function Me(v){const W=document.createElement("iframe");return W.id=M,W.src=v,W.style.cssText+=`
|
|
9
9
|
width: 100% !important;
|
|
10
10
|
border: none !important;
|
|
11
11
|
height: 110px !important;
|
|
@@ -13,24 +13,24 @@
|
|
|
13
13
|
opacity: 1;
|
|
14
14
|
transition: height 0.35s,
|
|
15
15
|
opacity 0.4s 0.1s;
|
|
16
|
-
`,W}function Le(v){const W=v.isSandbox??!1;return`${v.developmentUrl||(W?Bn:
|
|
17
|
-
width=${
|
|
16
|
+
`,W}function Le(v){const W=v.isSandbox??!1;return`${v.developmentUrl||(W?Bn:Un)}/embed/consents/${v.consentTemplateId}`}const Fe="IFRAME_EVENT",He="IFRAME_HEIGHT_CHANGE";let rn=null,on=null;function Gn(){rn==null||rn.cancel(),rn=null,on==null||on.cancel(),on=null}async function Ue(v){const{onEvent:W,onHeightChange:A}=v,p=await Promise.resolve().then(()=>Vn);Gn(),rn=p.on(Fe,async m=>{const w=m.data;W(w)}),on=p.on(He,async m=>{const w=m.data;A(w.height)})}class Be{constructor(W){Pn(this,"options");Pn(this,"iframe",null);this.options=W,Ue({onEvent:this.options.onEvent.bind(this),onHeightChange:this.handleHeightChange.bind(this)})}handleHeightChange(W){this.iframe&&(this.iframe.style.height=`${W}px`)}mount(W){je();const A=ze(W),p=Le(this.options);return this.iframe=Me(p),A.appendChild(this.iframe),this}unmount(){Gn(),this.iframe&&(this.iframe.remove(),this.iframe=null)}}const Ge=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function _e(v){let W="widget/";return"disclosureRequestId"in v.configProps?W+=["disclosures",v.configProps.disclosureRequestId].join("/"):W+=v.request,W}function Je(v){const W=v.isSandbox??!1,A=v.developmentUrl||(W?Bn:Un),p=Object.entries(v.configProps).filter(([w,S])=>S||w==="disclosureRequestId").map(([w,S])=>`${w}=${encodeURIComponent(S)}`).join("&"),m=_e(v);return`${A}/${m}?sdk=web&${p}`}const qe=!!(typeof window<"u"&&window.document&&window.document.createElement);let $=null,In=null;function On(v=null){$&&!$.closed&&$.focus(),v==null||v.preventDefault()}function Dn(){document.body.style.filter="",document.body.removeEventListener("click",On)}function $e(){In=setInterval(()=>{(!$||$.closed)&&(In&&clearInterval(In),Dn())},Ce)}function Ve(v){const W=Je(v),A=Ne,p=Te,m=window.screenLeft!==void 0?window.screenLeft:window.screenX,w=window.screenTop!==void 0?window.screenTop:window.screenY,S=window.innerWidth||document.documentElement.clientWidth||window.screen.width,J=window.innerHeight||document.documentElement.clientHeight||window.screen.height,Z=S/window.screen.availWidth,en=(S-A)/2/Z+m,V=(J-p)/2/Z+w;document.body.style.filter="blur(5px)",document.body.addEventListener("click",On),$=window.open(W,"Soyio",`scrollbars=yes,
|
|
17
|
+
width=${A},
|
|
18
18
|
height=${p},
|
|
19
19
|
top=${V},
|
|
20
|
-
left=${en}`),On(),$e()}function Ze(){$&&($.close(),$=null),Dn()}const ke="WIDGET_EVENT";let an=null;function Ye(){an&&(an.cancel(),an=null)}async function Xe(v){const{onEvent:W}=v,
|
|
21
|
-
`;function _(n){return n===void 0&&(n=window),n.location.protocol}function Z(n){if(n===void 0&&(n=window),n.mockDomain){var t=n.mockDomain.split("//")[0];if(t)return t}return _(n)}function en(n){return n===void 0&&(n=window),Z(n)==="about:"}function V(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Zn(n){if(n===void 0&&(n=window),n&&!V(n))try{return n.opener}catch{}}function pn(n){try{return!0}catch{}return!1}function gn(n){n===void 0&&(n=window);var t=n.location;if(!t)throw new Error("Can not read window location");var e=_(n);if(!e)throw new Error("Can not read window protocol");if(e==="file:")return"file://";if(e==="about:"){var r=V(n);return r&&pn()?gn(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return e+"//"+o}function L(n){n===void 0&&(n=window);var t=gn(n);return t&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:t}function X(n){if(!function(t){try{if(t===window)return!0}catch{}try{var e=Object.getOwnPropertyDescriptor(t,"location");if(e&&e.enumerable===!1)return!1}catch{}try{if(en(t)&&pn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),Z(r)==="mock:"}(t)&&pn())return!0}catch{}try{if(gn(t)===gn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||en(n)&&pn()||L(window)===L(n))return!0}catch{}return!1}function yn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function kn(n,t){if(!n||!t)return!1;var e=V(t);return e?e===n:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(t).indexOf(n)!==-1}function Yn(n){var t=[],e;try{e=n.frames}catch{e=n}var r;try{r=e.length}catch{}if(r===0)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch{continue}t.push(i)}return t}for(var a=0;a<100;a++){var s=void 0;try{s=e[a]}catch{return t}if(!s)return t;t.push(s)}return t}var tt=[],rt=[];function G(n,t){t===void 0&&(t=!0);try{if(n===window)return!1}catch{return!0}try{if(!n)return!0}catch{return!0}try{if(n.closed)return!0}catch(o){return!o||o.message!==S}if(t&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var e=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(tt,n);if(e!==-1){var r=rt[e];if(r&&function(o){if(!o.contentWindow||!o.parentNode)return!0;var i=o.ownerDocument;if(i&&i.documentElement&&!i.documentElement.contains(o)){for(var a=o;a.parentNode&&a.parentNode!==a;)a=a.parentNode;if(!a.host||!i.documentElement.contains(a.host))return!0}return!1}(r))return!0}return!1}function Xn(n){return n===void 0&&(n=window),Zn(n=n||window)||V(n)||void 0}function tn(n,t){if(typeof n=="string"){if(typeof t=="string")return n==="*"||t===n;if(w(t)||Array.isArray(t))return!1}return w(n)?w(t)?n.toString()===t.toString():!Array.isArray(t)&&!!t.match(n):!!Array.isArray(n)&&(Array.isArray(t)?JSON.stringify(n)===JSON.stringify(t):!w(t)&&n.some(function(e){return tn(e,t)}))}function En(n){try{if(n===window)return!0}catch(t){if(t&&t.message===S)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(t){if(t&&t.message===S)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.self===n)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.parent===n)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.top===n)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch{}return!1}function Kn(n){if(X(n))return yn(n).frameElement;for(var t=0,e=document.querySelectorAll("iframe");t<e.length;t++){var r=e[t];if(r&&r.contentWindow&&r.contentWindow===n)return r}}function ot(n){if(function(e){return e===void 0&&(e=window),!!V(e)}(n)){var t=Kn(n);if(t&&t.parentElement){t.parentElement.removeChild(t);return}}try{n.close()}catch{}}function K(n){try{if(!n)return!1;if(typeof Promise<"u"&&n instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&n instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&n instanceof window.constructor)return!1;var t={}.toString;if(t){var e=t.call(n);if(e==="[object Window]"||e==="[object global]"||e==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Qn=[],un=[],Rn=0,cn;function ne(){if(!Rn&&cn){var n=cn;cn=null,n.resolve()}}function An(){Rn+=1}function sn(){Rn-=1,ne()}var x=function(){function n(e){var r=this;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=[],e){var o,i,a=!1,s=!1,c=!1;An();try{e(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){sn(),this.reject(u);return}sn(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var t=n.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(K(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var r=this;if(this.resolved||this.rejected)return this;if(K(e))throw new Error("Can not reject promise with another promise");if(!e){var o=e&&typeof e.toString=="function"?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(Qn.indexOf(i)===-1){Qn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<un.length;s++)un[s](i,a)}}(e,r)},1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var e=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(e||r)){this.dispatching=!0,An();for(var i=function(h,E){return h.then(function(g){E.resolve(g)},function(g){E.reject(g)})},a=0;a<o.length;a++){var s=o[a],c=s.onSuccess,u=s.onError,l=s.promise,d=void 0;if(e)try{d=c?c(this.value):this.value}catch(h){l.reject(h);continue}else if(r){if(!u){l.reject(this.error);continue}try{d=u(this.error)}catch(h){l.reject(h);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var f=d;f.resolved?l.resolve(f.value):l.reject(f.error),f.errorHandled=!0}else K(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?l.resolve(d.value):l.reject(d.error):i(d,l):l.resolve(d)}o.length=0,this.dispatching=!1,sn()}},t.then=function(e,r){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new n;return this.handlers.push({promise:o,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),o},t.catch=function(e){return this.then(void 0,e)},t.finally=function(e){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(e).then(function(){return r})},function(r){return n.try(e).then(function(){throw r})})},t.timeout=function(e,r){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(r||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(a){return clearTimeout(i),a})},t.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(e){return e instanceof n?e:K(e)?new n(function(r,o){return e.then(r,o)}):new n().resolve(e)},n.reject=function(e){return new n().reject(e)},n.asyncReject=function(e){return new n().asyncReject(e)},n.all=function(e){var r=new n,o=e.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(u,l,d){return l.then(function(f){i[u]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},s=0;s<e.length;s++){var c=e[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!K(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),r)}return o===0&&r.resolve(i),r},n.hash=function(e){var r={},o=[],i=function(s){if(e.hasOwnProperty(s)){var c=e[s];K(c)?o.push(c.then(function(u){r[s]=u})):r[s]=c}};for(var a in e)i(a);return n.all(o).then(function(){return r})},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(e){return function(r){return un.push(r),{cancel:function(){un.splice(un.indexOf(r),1)}}}(e)},n.try=function(e,r,o){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.try expected a function");var i;An();try{i=e.apply(r,o||[])}catch(a){return sn(),n.reject(a)}return sn(),n.resolve(i)},n.delay=function(e){return new n(function(r){setTimeout(r,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||K(e)},n.flush=function(){return function(e){var r=cn=cn||new e;return ne(),r}(n)},n}();function Wn(n,t){for(var e=0;e<n.length;e++)try{if(n[e]===t)return e}catch{}return-1}var Nn=function(){function n(){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(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var e=new WeakMap,r={};return Object.freeze(r),e.set(r,"__testvalue__"),e.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var t=n.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(En(i)&&G(i)){if(e)try{e.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},t.isSafeToReadWrite=function(e){return!En(e)},t.set=function(e,r){if(!e)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(e,r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var i=this.name,a=e[i];a&&a[0]===e?a[1]=r:Object.defineProperty(e,i,{value:[e,r],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=Wn(s,e);u===-1?(s.push(e),c.push(r)):c[u]=r},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(e))return r.get(e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];return o&&o[0]===e?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=Wn(this.keys,e);if(i!==-1)return this.values[i]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];o&&o[0]===e&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=Wn(i,e);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(e))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];return!(!o||o[0]!==e)}catch{}return this._cleanupClosedWindows(),Wn(this.keys,e)!==-1},t.getOrSet=function(e,r){if(this.has(e))return this.get(e);var o=r();return this.set(e,o),o},n}();function ee(n){return n.name||n.__name__||n.displayName||"anonymous"}function te(n,t){try{delete n.name,n.name=t}catch{}return n.__name__=n.displayName=t,n}function J(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(t){if(typeof btoa=="function")return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(t,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var Sn;function re(n){try{return JSON.stringify([].slice.call(n),function(t,e){return typeof e=="function"?"memoize["+function(r){if(Sn=Sn||new Nn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Sn.get(r);return o||(o=typeof r+":"+J(),Sn.set(r,o)),o}(e)+"]":typeof window<"u"&&e instanceof window.Element||e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"?{}:e})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function it(){return{}}var dn=0,oe=0;function fn(n,t){t===void 0&&(t={});var e=t.thisNamespace,r=e!==void 0&&e,o=t.time,i,a,s=dn;dn+=1;var c=function(){for(var u=arguments.length,l=new Array(u),d=0;d<u;d++)l[d]=arguments[d];s<oe&&(i=null,a=null,s=dn,dn+=1);var f;f=r?(a=a||new Nn).getOrSet(this,it):i=i||{};var h;try{h=re(l)}catch{return n.apply(this,arguments)}var E=f[h];if(E&&o&&Date.now()-E.time<o&&(delete f[h],E=null),E)return E.value;var g=Date.now(),y=n.apply(this,arguments);return f[h]={time:g,value:y},y};return c.reset=function(){i=null,a=null},te(c,(t.name||ee(n))+"::memoized")}fn.clear=function(){oe=dn};function at(n){var t={};function e(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var c=re(a);return t.hasOwnProperty(c)||(t[c]=x.try(function(){return n.apply(o,r)}).finally(function(){delete t[c]})),t[c]}return e.reset=function(){t={}},te(e,ee(n)+"::promiseMemoized")}function Q(){}function ln(n,t){if(t===void 0&&(t=1),t>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if(typeof n=="string")return n;if(n instanceof Error){var e=n&&n.stack,r=n&&n.message;if(e&&r)return e.indexOf(r)!==-1?e:r+`
|
|
22
|
-
`+e;if(e)return e;if(r)return r}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+ln(o,t+1)}}function ie(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}fn(function(n){if(Object.values)return Object.values(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(n[e]);return t});function Tn(n){return{}.toString.call(n)==="[object RegExp]"}function hn(n,t,e){if(n.hasOwnProperty(t))return n[t];var r=e();return n[t]=r,r}function ae(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function ue(){return!!document.body&&document.readyState==="complete"}function ce(){return!!document.body&&document.readyState==="interactive"}fn(function(){return new x(function(n){if(ue()||ce())return n();var t=setInterval(function(){if(ue()||ce())return clearInterval(t),n()},10)})});var bn=typeof document<"u"?document.currentScript:null,ut=fn(function(){if(bn||(bn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),e=t&&t[1];if(!e)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===e)return i}}catch{}}()))return bn;throw new Error("Can not determine current script")}),ct=
|
|
20
|
+
left=${en}`),On(),$e()}function Ze(){$&&($.close(),$=null),Dn()}const ke="WIDGET_EVENT";let an=null;function Ye(){an&&(an.cancel(),an=null)}async function Xe(v){const{onEvent:W}=v,A=await Promise.resolve().then(()=>Vn);an&&Ye(),an=A.on(ke,async p=>{W(p.data),Ae.includes(p.data.eventName)?Ze():p.data.eventName===Re&&Dn()})}function Ke(v){Xe(v)}class _n{constructor(W){Ie(this,mn);Pn(this,"onEvent");this.onEvent=W.onEvent,qe&&(Ve(W),Ke({onEvent:Oe(this,mn,De).bind(this)}))}}mn=new WeakSet,De=function(W){this.onEvent(W)};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nt(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var Jn={exports:{}},qn={exports:{}};(function(v,W){(function(A,p){v.exports=p()})(typeof self<"u"?self:Qe,function(){return function(A){var p={};function m(w){if(p[w])return p[w].exports;var S=p[w]={i:w,l:!1,exports:{}};return A[w].call(S.exports,S,S.exports,m),S.l=!0,S.exports}return m.m=A,m.c=p,m.d=function(w,S,J){m.o(w,S)||Object.defineProperty(w,S,{enumerable:!0,get:J})},m.r=function(w){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(w,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(w,"__esModule",{value:!0})},m.t=function(w,S){if(1&S&&(w=m(w)),8&S||4&S&&typeof w=="object"&&w&&w.__esModule)return w;var J=Object.create(null);if(m.r(J),Object.defineProperty(J,"default",{enumerable:!0,value:w}),2&S&&typeof w!="string")for(var Z in w)m.d(J,Z,(function(en){return w[en]}).bind(null,Z));return J},m.n=function(w){var S=w&&w.__esModule?function(){return w.default}:function(){return w};return m.d(S,"a",S),S},m.o=function(w,S){return{}.hasOwnProperty.call(w,S)},m.p="",m(m.s=0)}([function(A,p,m){m.r(p),m.d(p,"Promise",function(){return x}),m.d(p,"TYPES",function(){return bt}),m.d(p,"ProxyWindow",function(){return B}),m.d(p,"setup",function(){return Pe}),m.d(p,"destroy",function(){return St}),m.d(p,"serializeMessage",function(){return gt}),m.d(p,"deserializeMessage",function(){return yt}),m.d(p,"createProxyWindow",function(){return Et}),m.d(p,"toProxyWindow",function(){return Wt}),m.d(p,"on",function(){return k}),m.d(p,"once",function(){return pt}),m.d(p,"send",function(){return Y}),m.d(p,"markWindowKnown",function(){return he}),m.d(p,"cleanUpWindow",function(){return xt}),m.d(p,"bridge",function(){});function w(n){return{}.toString.call(n)==="[object RegExp]"}var S=`Call was rejected by callee.\r
|
|
21
|
+
`;function J(n){return n===void 0&&(n=window),n.location.protocol}function Z(n){if(n===void 0&&(n=window),n.mockDomain){var t=n.mockDomain.split("//")[0];if(t)return t}return J(n)}function en(n){return n===void 0&&(n=window),Z(n)==="about:"}function V(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Zn(n){if(n===void 0&&(n=window),n&&!V(n))try{return n.opener}catch{}}function pn(n){try{return!0}catch{}return!1}function gn(n){n===void 0&&(n=window);var t=n.location;if(!t)throw new Error("Can not read window location");var e=J(n);if(!e)throw new Error("Can not read window protocol");if(e==="file:")return"file://";if(e==="about:"){var r=V(n);return r&&pn()?gn(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return e+"//"+o}function L(n){n===void 0&&(n=window);var t=gn(n);return t&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:t}function X(n){if(!function(t){try{if(t===window)return!0}catch{}try{var e=Object.getOwnPropertyDescriptor(t,"location");if(e&&e.enumerable===!1)return!1}catch{}try{if(en(t)&&pn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),Z(r)==="mock:"}(t)&&pn())return!0}catch{}try{if(gn(t)===gn(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||en(n)&&pn()||L(window)===L(n))return!0}catch{}return!1}function yn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function kn(n,t){if(!n||!t)return!1;var e=V(t);return e?e===n:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(t).indexOf(n)!==-1}function Yn(n){var t=[],e;try{e=n.frames}catch{e=n}var r;try{r=e.length}catch{}if(r===0)return t;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=e[o]}catch{continue}t.push(i)}return t}for(var a=0;a<100;a++){var s=void 0;try{s=e[a]}catch{return t}if(!s)return t;t.push(s)}return t}var tt=[],rt=[];function G(n,t){t===void 0&&(t=!0);try{if(n===window)return!1}catch{return!0}try{if(!n)return!0}catch{return!0}try{if(n.closed)return!0}catch(o){return!o||o.message!==S}if(t&&X(n))try{if(n.mockclosed)return!0}catch{}try{if(!n.parent||!n.top)return!0}catch{}var e=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(tt,n);if(e!==-1){var r=rt[e];if(r&&function(o){if(!o.contentWindow||!o.parentNode)return!0;var i=o.ownerDocument;if(i&&i.documentElement&&!i.documentElement.contains(o)){for(var a=o;a.parentNode&&a.parentNode!==a;)a=a.parentNode;if(!a.host||!i.documentElement.contains(a.host))return!0}return!1}(r))return!0}return!1}function Xn(n){return n===void 0&&(n=window),Zn(n=n||window)||V(n)||void 0}function tn(n,t){if(typeof n=="string"){if(typeof t=="string")return n==="*"||t===n;if(w(t)||Array.isArray(t))return!1}return w(n)?w(t)?n.toString()===t.toString():!Array.isArray(t)&&!!t.match(n):!!Array.isArray(n)&&(Array.isArray(t)?JSON.stringify(n)===JSON.stringify(t):!w(t)&&n.some(function(e){return tn(e,t)}))}function En(n){try{if(n===window)return!0}catch(t){if(t&&t.message===S)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(t){if(t&&t.message===S)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.self===n)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.parent===n)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.top===n)return!0}catch(t){if(t&&t.message===S)return!0}try{if(n&&n.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in n&&"self"in n&&"location"in n)return!0}catch{}return!1}function Kn(n){if(X(n))return yn(n).frameElement;for(var t=0,e=document.querySelectorAll("iframe");t<e.length;t++){var r=e[t];if(r&&r.contentWindow&&r.contentWindow===n)return r}}function ot(n){if(function(e){return e===void 0&&(e=window),!!V(e)}(n)){var t=Kn(n);if(t&&t.parentElement){t.parentElement.removeChild(t);return}}try{n.close()}catch{}}function K(n){try{if(!n)return!1;if(typeof Promise<"u"&&n instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&n instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&n instanceof window.constructor)return!1;var t={}.toString;if(t){var e=t.call(n);if(e==="[object Window]"||e==="[object global]"||e==="[object DOMWindow]")return!1}if(typeof n.then=="function")return!0}catch{return!1}return!1}var Qn=[],un=[],An=0,cn;function ne(){if(!An&&cn){var n=cn;cn=null,n.resolve()}}function Rn(){An+=1}function sn(){An-=1,ne()}var x=function(){function n(e){var r=this;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=[],e){var o,i,a=!1,s=!1,c=!1;Rn();try{e(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){sn(),this.reject(u);return}sn(),c=!0,a?this.resolve(o):s&&this.reject(i)}}var t=n.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(K(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var r=this;if(this.resolved||this.rejected)return this;if(K(e))throw new Error("Can not reject promise with another promise");if(!e){var o=e&&typeof e.toString=="function"?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(Qn.indexOf(i)===-1){Qn.push(i),setTimeout(function(){throw i},1);for(var s=0;s<un.length;s++)un[s](i,a)}}(e,r)},1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var e=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(e||r)){this.dispatching=!0,Rn();for(var i=function(h,E){return h.then(function(g){E.resolve(g)},function(g){E.reject(g)})},a=0;a<o.length;a++){var s=o[a],c=s.onSuccess,u=s.onError,l=s.promise,d=void 0;if(e)try{d=c?c(this.value):this.value}catch(h){l.reject(h);continue}else if(r){if(!u){l.reject(this.error);continue}try{d=u(this.error)}catch(h){l.reject(h);continue}}if(d instanceof n&&(d.resolved||d.rejected)){var f=d;f.resolved?l.resolve(f.value):l.reject(f.error),f.errorHandled=!0}else K(d)?d instanceof n&&(d.resolved||d.rejected)?d.resolved?l.resolve(d.value):l.reject(d.error):i(d,l):l.resolve(d)}o.length=0,this.dispatching=!1,sn()}},t.then=function(e,r){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new n;return this.handlers.push({promise:o,onSuccess:e,onError:r}),this.errorHandled=!0,this.dispatch(),o},t.catch=function(e){return this.then(void 0,e)},t.finally=function(e){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return n.try(e).then(function(){return r})},function(r){return n.try(e).then(function(){throw r})})},t.timeout=function(e,r){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(r||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(a){return clearTimeout(i),a})},t.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},n.resolve=function(e){return e instanceof n?e:K(e)?new n(function(r,o){return e.then(r,o)}):new n().resolve(e)},n.reject=function(e){return new n().reject(e)},n.asyncReject=function(e){return new n().asyncReject(e)},n.all=function(e){var r=new n,o=e.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(u,l,d){return l.then(function(f){i[u]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},s=0;s<e.length;s++){var c=e[s];if(c instanceof n){if(c.resolved){i[s]=c.value,o-=1;continue}}else if(!K(c)){i[s]=c,o-=1;continue}a(s,n.resolve(c),r)}return o===0&&r.resolve(i),r},n.hash=function(e){var r={},o=[],i=function(s){if(e.hasOwnProperty(s)){var c=e[s];K(c)?o.push(c.then(function(u){r[s]=u})):r[s]=c}};for(var a in e)i(a);return n.all(o).then(function(){return r})},n.map=function(e,r){return n.all(e.map(r))},n.onPossiblyUnhandledException=function(e){return function(r){return un.push(r),{cancel:function(){un.splice(un.indexOf(r),1)}}}(e)},n.try=function(e,r,o){if(e&&typeof e!="function"&&!e.call)throw new Error("Promise.try expected a function");var i;Rn();try{i=e.apply(r,o||[])}catch(a){return sn(),n.reject(a)}return sn(),n.resolve(i)},n.delay=function(e){return new n(function(r){setTimeout(r,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||K(e)},n.flush=function(){return function(e){var r=cn=cn||new e;return ne(),r}(n)},n}();function Wn(n,t){for(var e=0;e<n.length;e++)try{if(n[e]===t)return e}catch{}return-1}var Nn=function(){function n(){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(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var e=new WeakMap,r={};return Object.freeze(r),e.set(r,"__testvalue__"),e.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var t=n.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(En(i)&&G(i)){if(e)try{e.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},t.isSafeToReadWrite=function(e){return!En(e)},t.set=function(e,r){if(!e)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(e,r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var i=this.name,a=e[i];a&&a[0]===e?a[1]=r:Object.defineProperty(e,i,{value:[e,r],writable:!0});return}catch{}this._cleanupClosedWindows();var s=this.keys,c=this.values,u=Wn(s,e);u===-1?(s.push(e),c.push(r)):c[u]=r},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(e))return r.get(e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];return o&&o[0]===e?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=Wn(this.keys,e);if(i!==-1)return this.values[i]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(e)}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];o&&o[0]===e&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=Wn(i,e);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(e))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(e))try{var o=e[this.name];return!(!o||o[0]!==e)}catch{}return this._cleanupClosedWindows(),Wn(this.keys,e)!==-1},t.getOrSet=function(e,r){if(this.has(e))return this.get(e);var o=r();return this.set(e,o),o},n}();function ee(n){return n.name||n.__name__||n.displayName||"anonymous"}function te(n,t){try{delete n.name,n.name=t}catch{}return n.__name__=n.displayName=t,n}function q(){var n="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return n.charAt(Math.floor(Math.random()*n.length))})+"_"+function(t){if(typeof btoa=="function")return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(t,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var Sn;function re(n){try{return JSON.stringify([].slice.call(n),function(t,e){return typeof e=="function"?"memoize["+function(r){if(Sn=Sn||new Nn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Sn.get(r);return o||(o=typeof r+":"+q(),Sn.set(r,o)),o}(e)+"]":typeof window<"u"&&e instanceof window.Element||e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"?{}:e})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function it(){return{}}var dn=0,oe=0;function fn(n,t){t===void 0&&(t={});var e=t.thisNamespace,r=e!==void 0&&e,o=t.time,i,a,s=dn;dn+=1;var c=function(){for(var u=arguments.length,l=new Array(u),d=0;d<u;d++)l[d]=arguments[d];s<oe&&(i=null,a=null,s=dn,dn+=1);var f;f=r?(a=a||new Nn).getOrSet(this,it):i=i||{};var h;try{h=re(l)}catch{return n.apply(this,arguments)}var E=f[h];if(E&&o&&Date.now()-E.time<o&&(delete f[h],E=null),E)return E.value;var g=Date.now(),y=n.apply(this,arguments);return f[h]={time:g,value:y},y};return c.reset=function(){i=null,a=null},te(c,(t.name||ee(n))+"::memoized")}fn.clear=function(){oe=dn};function at(n){var t={};function e(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var c=re(a);return t.hasOwnProperty(c)||(t[c]=x.try(function(){return n.apply(o,r)}).finally(function(){delete t[c]})),t[c]}return e.reset=function(){t={}},te(e,ee(n)+"::promiseMemoized")}function Q(){}function ln(n,t){if(t===void 0&&(t=1),t>=3)return"stringifyError stack overflow";try{if(!n)return"<unknown error: "+{}.toString.call(n)+">";if(typeof n=="string")return n;if(n instanceof Error){var e=n&&n.stack,r=n&&n.message;if(e&&r)return e.indexOf(r)!==-1?e:r+`
|
|
22
|
+
`+e;if(e)return e;if(r)return r}return n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}catch(o){return"Error while stringifying error: "+ln(o,t+1)}}function ie(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}fn(function(n){if(Object.values)return Object.values(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(n[e]);return t});function Tn(n){return{}.toString.call(n)==="[object RegExp]"}function hn(n,t,e){if(n.hasOwnProperty(t))return n[t];var r=e();return n[t]=r,r}function ae(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function ue(){return!!document.body&&document.readyState==="complete"}function ce(){return!!document.body&&document.readyState==="interactive"}fn(function(){return new x(function(n){if(ue()||ce())return n();var t=setInterval(function(){if(ue()||ce())return clearInterval(t),n()},10)})});var bn=typeof document<"u"?document.currentScript:null,ut=fn(function(){if(bn||(bn=function(){try{var n=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(n),e=t&&t[1];if(!e)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===e)return i}}catch{}}()))return bn;throw new Error("Can not determine current script")}),ct=q();fn(function(){var n;try{n=ut()}catch{return ct}var t=n.getAttribute("data-uid");if(t&&typeof t=="string"||(t=n.getAttribute("data-uid-auto"))&&typeof t=="string")return t;if(n.src){var e=function(r){for(var o="",i=0;i<r.length;i++){var a=r[i].charCodeAt(0)*i;r[i+1]&&(a+=r[i+1].charCodeAt(0)*(i-1)),o+=String.fromCharCode(97+Math.abs(a)%26)}return o}(JSON.stringify({src:n.src,dataset:n.dataset}));t="uid_"+e.slice(e.length-30)}else t=q();return n.setAttribute("data-uid-auto",t),t});function vn(n){n===void 0&&(n=window);var t="__post_robot_10_0_46__";return n!==window?n[t]:n[t]=n[t]||{}}var se=function(){return{}};function j(n,t){return n===void 0&&(n="store"),t===void 0&&(t=se),hn(vn(),n,function(){var e=t();return{has:function(r){return e.hasOwnProperty(r)},get:function(r,o){return e.hasOwnProperty(r)?e[r]:o},set:function(r,o){return e[r]=o,o},del:function(r){delete e[r]},getOrSet:function(r,o){return hn(e,r,o)},reset:function(){e=t()},keys:function(){return Object.keys(e)}}})}var st=function(){};function xn(){var n=vn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new st,n.WINDOW_WILDCARD}function F(n,t){return n===void 0&&(n="store"),t===void 0&&(t=se),j("windowStore").getOrSet(n,function(){var e=new Nn,r=function(o){return e.getOrSet(o,t)};return{has:function(o){return r(o).hasOwnProperty(n)},get:function(o,i){var a=r(o);return a.hasOwnProperty(n)?a[n]:i},set:function(o,i){return r(o)[n]=i,i},del:function(o){delete r(o)[n]},getOrSet:function(o,i){return hn(r(o),n,i)}}})}function de(){return j("instance").getOrSet("instanceID",q)}function fe(n,t){var e=t.domain,r=F("helloPromises"),o=r.get(n);o&&o.resolve({domain:e});var i=x.resolve({domain:e});return r.set(n,i),i}function Cn(n,t){return(0,t.send)(n,"postrobot_hello",{instanceID:de()},{domain:"*",timeout:-1}).then(function(e){var r=e.origin,o=e.data.instanceID;return fe(n,{domain:r}),{win:n,domain:r,instanceID:o}})}function le(n,t){var e=t.send;return F("windowInstanceIDPromises").getOrSet(n,function(){return Cn(n,{send:e}).then(function(r){return r.instanceID})})}function he(n){F("knownWindows").set(n,!0)}function jn(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function ve(n){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}function nn(n,t){return{__type__:n,__val__:t}}var H,dt=((H={}).function=function(){},H.error=function(n){return nn("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},H.promise=function(){},H.regex=function(n){return nn("regex",n.source)},H.date=function(n){return nn("date",n.toJSON())},H.array=function(n){return n},H.object=function(n){return n},H.string=function(n){return n},H.number=function(n){return n},H.boolean=function(n){return n},H.null=function(n){return n},H[void 0]=function(n){return nn("undefined",n)},H),ft={},U,lt=((U={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},U.error=function(n){var t=n.stack,e=n.code,r=n.data,o=new Error(n.message);return o.code=e,r&&(o.data=r),o.stack=t+`
|
|
23
23
|
|
|
24
|
-
`+o.stack,o},
|
|
24
|
+
`+o.stack,o},U.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},U.regex=function(n){return new RegExp(n)},U.date=function(n){return new Date(n)},U.array=function(n){return n},U.object=function(n){return n},U.string=function(n){return n},U.number=function(n){return n},U.boolean=function(n){return n},U.null=function(n){return n},U[void 0]=function(){},U),ht={};new x(function(n){if(window.document&&window.document.body)return n(window.document.body);var t=setInterval(function(){if(window.document&&window.document.body)return clearInterval(t),n(window.document.body)},10)});function zn(){for(var n=j("idToProxyWindow"),t=0,e=n.keys();t<e.length;t++){var r=e[t];n.get(r).shouldClean()&&n.del(r)}}function we(n,t){var e=t.send,r=t.id,o=r===void 0?q():r,i=n.then(function(c){if(X(c))return yn(c).name}),a=n.then(function(c){if(G(c))throw new Error("Window is closed, can not determine type");return Zn(c)?"popup":"iframe"});i.catch(Q),a.catch(Q);var s=function(){return n.then(function(c){if(!G(c))return X(c)?yn(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:at(function(){return n.then(function(c){return le(c,{send:e})})}),close:function(){return n.then(ot)},getName:s,focus:function(){return n.then(function(c){c.focus()})},isClosed:function(){return n.then(function(c){return G(c)})},setLocation:function(c,u){return u===void 0&&(u={}),n.then(function(l){var d=window.location.protocol+"//"+window.location.host,f=u.method,h=f===void 0?"get":f,E=u.body;if(c.indexOf("/")===0)c=""+d+c;else if(!c.match(/^https?:\/\//)&&c.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(c));if(h==="post")return s().then(function(g){if(!g)throw new Error("Can not post to window without target name");(function(y){var P=y.url,C=y.target,O=y.body,I=y.method,z=I===void 0?"post":I,b=document.createElement("form");if(b.setAttribute("target",C),b.setAttribute("method",z),b.setAttribute("action",P),b.style.display="none",O)for(var D=0,_=Object.keys(O);D<_.length;D++){var T,wn=_[D],Hn=document.createElement("input");Hn.setAttribute("name",wn),Hn.setAttribute("value",(T=O[wn])==null?void 0:T.toString()),b.appendChild(Hn)}ae().appendChild(b),b.submit(),ae().removeChild(b)})({url:c,target:g,method:h,body:E})});if(h!=="get")throw new Error("Unsupported method: "+h);if(X(l))try{if(l.location&&typeof l.location.replace=="function"){l.location.replace(c);return}}catch{}l.location=c})},setName:function(c){return n.then(function(u){var l=X(u),d=Kn(u);if(!l)throw new Error("Can not set name for cross-domain window: "+c);yn(u).name=c,d&&d.setAttribute("name",c),i=x.resolve(c)})}}}var B=function(){function n(e){var r=e.send,o=e.win,i=e.serializedWindow;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 x,this.serializedWindow=i||we(this.actualWindowPromise,{send:r}),j("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:r})}var t=n.prototype;return t.getID=function(){return this.serializedWindow.id},t.getType=function(){return this.serializedWindow.getType()},t.isPopup=function(){return this.getType().then(function(e){return e==="popup"})},t.setLocation=function(e,r){var o=this;return this.serializedWindow.setLocation(e,r).then(function(){return o})},t.getName=function(){return this.serializedWindow.getName()},t.setName=function(e){var r=this;return this.serializedWindow.setName(e).then(function(){return r})},t.close=function(){var e=this;return this.serializedWindow.close().then(function(){return e})},t.focus=function(){var e=this,r=this.isPopup(),o=this.getName(),i=x.hash({isPopup:r,name:o}).then(function(s){var c=s.name;s.isPopup&&c&&window.open("",c,"noopener")}),a=this.serializedWindow.focus();return x.all([i,a]).then(function(){return e})},t.isClosed=function(){return this.serializedWindow.isClosed()},t.getWindow=function(){return this.actualWindow},t.setWindow=function(e,r){var o=r.send;this.actualWindow=e,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=we(this.actualWindowPromise,{send:o,id:this.getID()}),F("winToProxyWindow").set(e,this)},t.awaitWindow=function(){return this.actualWindowPromise},t.matchWindow=function(e,r){var o=this,i=r.send;return x.try(function(){return o.actualWindow?e===o.actualWindow:x.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:le(e,{send:i})}).then(function(a){var s=a.proxyInstanceID===a.knownWindowInstanceID;return s&&o.setWindow(e,{send:i}),s})})},t.unwrap=function(){return this.actualWindow||this},t.getInstanceID=function(){return this.serializedWindow.getInstanceID()},t.shouldClean=function(){return!!(this.actualWindow&&G(this.actualWindow))},t.serialize=function(){return this.serializedWindow},n.unwrap=function(e){return n.isProxyWindow(e)?e.unwrap():e},n.serialize=function(e,r){var o=r.send;return zn(),n.toProxyWindow(e,{send:o}).serialize()},n.deserialize=function(e,r){var o=r.send;return zn(),j("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:o})},n.isProxyWindow=function(e){return!!(e&&!En(e)&&e.isProxyWindow)},n.toProxyWindow=function(e,r){var o=r.send;if(zn(),n.isProxyWindow(e))return e;var i=e;return F("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function Mn(n,t,e,r,o){var i=F("methodStore"),a=j("proxyWindowMethods");B.isProxyWindow(r)?a.set(n,{val:t,name:e,domain:o,source:r}):(a.del(n),i.getOrSet(r,function(){return{}})[n]={domain:o,name:e,val:t,source:r})}function me(n,t){var e=F("methodStore"),r=j("proxyWindowMethods");return e.getOrSet(n,function(){return{}})[t]||r.get(t)}function pe(n,t,e,r,o){a=(i={on:o.on,send:o.send}).on,s=i.send,j("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(l){var d=l.source,f=l.origin,h=l.data,E=h.id,g=h.name,y=me(d,E);if(!y)throw new Error("Could not find method '"+g+"' with id: "+h.id+" in "+L(window));var P=y.source,C=y.domain,O=y.val;return x.try(function(){if(!tn(C,f))throw new Error("Method '"+h.name+"' domain "+JSON.stringify(Tn(y.domain)?y.domain.source:y.domain)+" does not match origin "+f+" in "+L(window));if(B.isProxyWindow(P))return P.matchWindow(d,{send:s}).then(function(I){if(!I)throw new Error("Method call '"+h.name+"' failed - proxy window does not match source in "+L(window))})}).then(function(){return O.apply({source:d,origin:f},h.args)},function(I){return x.try(function(){if(O.onError)return O.onError(I)}).then(function(){throw I.stack&&(I.stack="Remote call to "+g+"("+function(z){return z===void 0&&(z=[]),(b=z,[].slice.call(b)).map(function(D){return typeof D=="string"?"'"+D+"'":D===void 0?"undefined":D===null?"null":typeof D=="boolean"?D.toString():Array.isArray(D)?"[ ... ]":typeof D=="object"?"{ ... }":typeof D=="function"?"() => { ... }":"<"+typeof D+">"}).join(", ");var b}(h.args)+`) failed
|
|
25
25
|
|
|
26
|
-
`+I.stack),I})}).then(function(I){return{result:I,id:E,name:g}})})});var i,a,s,c=e.__id__||
|
|
26
|
+
`+I.stack),I})}).then(function(I){return{result:I,id:E,name:g}})})});var i,a,s,c=e.__id__||q();n=B.unwrap(n);var u=e.__name__||e.name||r;return typeof u=="string"&&typeof u.indexOf=="function"&&u.indexOf("anonymous::")===0&&(u=u.replace("anonymous::",r+"::")),B.isProxyWindow(n)?(Mn(c,e,u,n,t),n.awaitWindow().then(function(l){Mn(c,e,u,l,t)})):Mn(c,e,u,n,t),nn("cross_domain_function",{id:c,name:u})}function ge(n,t,e,r){var o,i=r.on,a=r.send;return function(s,c){c===void 0&&(c=ft);var u=JSON.stringify(s,function(l){var d=this[l];if(jn(this))return d;var f=ve(d);if(!f)return d;var h=c[f]||dt[f];return h?h(d,l):d});return u===void 0?"undefined":u}(e,((o={}).promise=function(s,c){return function(u,l,d,f,h){return nn("cross_domain_zalgo_promise",{then:pe(u,l,function(E,g){return d.then(E,g)},f,{on:h.on,send:h.send})})}(n,t,s,c,{on:i,send:a})},o.function=function(s,c){return pe(n,t,s,c,{on:i,send:a})},o.object=function(s){return En(s)||B.isProxyWindow(s)?nn("cross_domain_window",B.serialize(s,{send:a})):s},o))}function ye(n,t,e,r){var o,i=r.send;return function(a,s){if(s===void 0&&(s=ht),a!=="undefined")return JSON.parse(a,function(c,u){if(jn(this))return u;var l,d;if(jn(u)?(l=u.__type__,d=u.__val__):(l=ve(u),d=u),!l)return d;var f=s[l]||lt[l];return f?f(d,c):d})}(e,((o={}).cross_domain_zalgo_promise=function(a){return function(s,c,u){return new x(u.then)}(0,0,a)},o.cross_domain_function=function(a){return function(s,c,u,l){var d=u.id,f=u.name,h=l.send,E=function(y){y===void 0&&(y={});function P(){var C=arguments;return B.toProxyWindow(s,{send:h}).awaitWindow().then(function(O){var I=me(O,d);if(I&&I.val!==P)return I.val.apply({source:window,origin:L()},C);var z=[].slice.call(C);return y.fireAndForget?h(O,"postrobot_method",{id:d,name:f,args:z},{domain:c,fireAndForget:!0}):h(O,"postrobot_method",{id:d,name:f,args:z},{domain:c,fireAndForget:!1}).then(function(b){return b.data.result})}).catch(function(O){throw O})}return P.__name__=f,P.__origin__=c,P.__source__=s,P.__id__=d,P.origin=c,P},g=E();return g.fireAndForget=E({fireAndForget:!0}),g}(n,t,a,{send:i})},o.cross_domain_window=function(a){return B.deserialize(a,{send:i})},o))}var Ln={};Ln.postrobot_post_message=function(n,t,e){e.indexOf("file:")===0&&(e="*"),n.postMessage(t,e)};function Fn(n,t,e,r){var o=r.on,i=r.send;return x.try(function(){var a=F().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(e),a.flush=a.flush||x.flush().then(function(){if(G(n))throw new Error("Window is closed");var s=ge(n,t,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var u=Object.keys(Ln),l=[],d=0;d<u.length;d++){var f=u[d];try{Ln[f](n,s,t)}catch(h){l.push(h)}}if(l.length===u.length)throw new Error(`All post-robot messaging strategies failed:
|
|
27
27
|
|
|
28
28
|
`+l.map(function(h,E){return E+". "+ln(h)}).join(`
|
|
29
29
|
|
|
30
|
-
`))}),a.flush.then(function(){delete a.flush})}).then(Q)}function Ee(n){return j("responseListeners").get(n)}function We(n){j("responseListeners").del(n)}function Se(n){return j("erroredResponseListeners").has(n)}function be(n){var t=n.name,e=n.win,r=n.domain,o=
|
|
30
|
+
`))}),a.flush.then(function(){delete a.flush})}).then(Q)}function Ee(n){return j("responseListeners").get(n)}function We(n){j("responseListeners").del(n)}function Se(n){return j("erroredResponseListeners").has(n)}function be(n){var t=n.name,e=n.win,r=n.domain,o=F("requestListeners");if(e==="*"&&(e=null),r==="*"&&(r=null),!t)throw new Error("Name required to get request listener");for(var i=0,a=[e,xn()];i<a.length;i++){var s=a[i];if(s){var c=o.get(s);if(c){var u=c[t];if(u){if(r&&typeof r=="string"){if(u[r])return u[r];if(u.__domain_regex__)for(var l=0,d=u.__domain_regex__;l<d.length;l++){var f=d[l],h=f.listener;if(tn(f.regex,r))return h}}if(u["*"])return u["*"]}}}}}function vt(n,t,e,r){var o=r.on,i=r.send,a=be({name:e.name,win:n,domain:t}),s=e.name==="postrobot_method"&&e.data&&typeof e.data.name=="string"?e.data.name+"()":e.name;function c(u,l,d){return x.flush().then(function(){if(!e.fireAndForget&&!G(n))try{return Fn(n,t,{id:q(),origin:L(window),type:"postrobot_message_response",hash:e.hash,name:e.name,ack:u,data:l,error:d},{on:o,send:i})}catch(f){throw new Error("Send response message failed for "+s+" in "+L()+`
|
|
31
31
|
|
|
32
|
-
`+ln(f))}})}return x.all([x.flush().then(function(){if(!e.fireAndForget&&!G(n))try{return
|
|
32
|
+
`+ln(f))}})}return x.all([x.flush().then(function(){if(!e.fireAndForget&&!G(n))try{return Fn(n,t,{id:q(),origin:L(window),type:"postrobot_message_ack",hash:e.hash,name:e.name},{on:o,send:i})}catch(u){throw new Error("Send ack message failed for "+s+" in "+L()+`
|
|
33
33
|
|
|
34
|
-
`+ln(u))}}),x.try(function(){if(!a)throw new Error("No handler found for post message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:n,origin:t,data:e.data})}).then(function(u){return c("success",u)},function(u){return c("error",null,u)})]).then(Q).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function wt(n,t,e){if(!Se(e.hash)){var r=Ee(e.hash);if(!r)throw new Error("No handler found for post message ack for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!tn(r.domain,t))throw new Error("Ack origin "+t+" does not match domain "+r.domain.toString());if(n!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function mt(n,t,e){if(!Se(e.hash)){var r=Ee(e.hash);if(!r)throw new Error("No handler found for post message response for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!tn(r.domain,t))throw new Error("Response origin "+t+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":w(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==r.win)throw new Error("Response source does not match registered window");We(e.hash),e.ack==="error"?r.promise.reject(e.error):e.ack==="success"&&r.promise.resolve({source:n,origin:t,data:e.data})}}function xe(n,t){var e=t.on,r=t.send,o=j("receivedMessages");try{if(!window||window.closed||!n.source)return}catch{return}var i=n.source,a=n.origin,s=function(l,d,f,h){var E=h.on,g=h.send,y;try{y=ye(d,f,l,{on:E,send:g})}catch{return}if(y&&typeof y=="object"&&y!==null){var P=y.__post_robot_10_0_46__;if(Array.isArray(P))return P}}(n.data,i,a,{on:e,send:r});if(s){he(i);for(var c=0;c<s.length;c++){var u=s[c];if(o.has(u.id)||(o.set(u.id,!0),G(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?vt(i,a,u,{on:e,send:r}):u.type==="postrobot_message_response"?mt(i,a,u):u.type==="postrobot_message_ack"&&wt(i,a,u)}catch(l){setTimeout(function(){throw l},0)}}}}function k(n,t,e){if(!n)throw new Error("Expected name");if(typeof(t=t||{})=="function"&&(e=t,t={}),!e)throw new Error("Expected handler");var r=function o(i,a){var s=i.name,c=i.win,u=i.domain,l=
|
|
34
|
+
`+ln(u))}}),x.try(function(){if(!a)throw new Error("No handler found for post message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:n,origin:t,data:e.data})}).then(function(u){return c("success",u)},function(u){return c("error",null,u)})]).then(Q).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function wt(n,t,e){if(!Se(e.hash)){var r=Ee(e.hash);if(!r)throw new Error("No handler found for post message ack for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!tn(r.domain,t))throw new Error("Ack origin "+t+" does not match domain "+r.domain.toString());if(n!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function mt(n,t,e){if(!Se(e.hash)){var r=Ee(e.hash);if(!r)throw new Error("No handler found for post message response for message: "+e.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!tn(r.domain,t))throw new Error("Response origin "+t+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":w(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==r.win)throw new Error("Response source does not match registered window");We(e.hash),e.ack==="error"?r.promise.reject(e.error):e.ack==="success"&&r.promise.resolve({source:n,origin:t,data:e.data})}}function xe(n,t){var e=t.on,r=t.send,o=j("receivedMessages");try{if(!window||window.closed||!n.source)return}catch{return}var i=n.source,a=n.origin,s=function(l,d,f,h){var E=h.on,g=h.send,y;try{y=ye(d,f,l,{on:E,send:g})}catch{return}if(y&&typeof y=="object"&&y!==null){var P=y.__post_robot_10_0_46__;if(Array.isArray(P))return P}}(n.data,i,a,{on:e,send:r});if(s){he(i);for(var c=0;c<s.length;c++){var u=s[c];if(o.has(u.id)||(o.set(u.id,!0),G(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?vt(i,a,u,{on:e,send:r}):u.type==="postrobot_message_response"?mt(i,a,u):u.type==="postrobot_message_ack"&&wt(i,a,u)}catch(l){setTimeout(function(){throw l},0)}}}}function k(n,t,e){if(!n)throw new Error("Expected name");if(typeof(t=t||{})=="function"&&(e=t,t={}),!e)throw new Error("Expected handler");var r=function o(i,a){var s=i.name,c=i.win,u=i.domain,l=F("requestListeners");if(!s||typeof s!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&B.isProxyWindow(c)){var d=c.awaitWindow().then(function(T){return o({name:s,win:T,domain:u},a)});return{cancel:function(){d.then(function(T){return T.cancel()},Q)}}}var f=c;if(Array.isArray(f)){for(var h=[],E=0,g=f;E<g.length;E++)h.push(o({name:s,domain:u,win:g[E]},a));return{cancel:function(){for(var T=0;T<h.length;T++)h[T].cancel()}}}if(Array.isArray(u)){for(var y=[],P=0,C=u;P<C.length;P++)y.push(o({name:s,win:f,domain:C[P]},a));return{cancel:function(){for(var T=0;T<y.length;T++)y[T].cancel()}}}var O=be({name:s,win:f,domain:u});f&&f!=="*"||(f=xn());var I=(u=u||"*").toString();if(O)throw f&&u?new Error("Request listener already exists for "+s+" on domain "+u.toString()+" for "+(f===xn()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+s+" for "+(f===xn()?"wildcard":"specified")+" window"):u?new Error("Request listener already exists for "+s+" on domain "+u.toString()):new Error("Request listener already exists for "+s);var z=l.getOrSet(f,function(){return{}}),b=hn(z,s,function(){return{}}),D,_;return Tn(u)?(D=hn(b,"__domain_regex__",function(){return[]})).push(_={regex:u,listener:a}):b[I]=a,{cancel:function(){delete b[I],_&&(D.splice(D.indexOf(_,1)),D.length||delete b.__domain_regex__),Object.keys(b).length||delete z[s],f&&!Object.keys(z).length&&l.del(f)}}}({name:n,win:t.window,domain:t.domain||"*"},{handler:e||t.handler,handleError:t.errorHandler||function(o){throw o}});return{cancel:function(){r.cancel()}}}function pt(n,t,e){typeof(t=t||{})=="function"&&(e=t,t={});var r=new x,o;return t.errorHandler=function(i){o.cancel(),r.reject(i)},o=k(n,t,function(i){if(o.cancel(),r.resolve(i),e)return e(i)}),r.cancel=o.cancel,r}var Y=function n(t,e,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,s=o.timeout||5e3,c=o.fireAndForget||!1;return B.toProxyWindow(t,{send:n}).awaitWindow().then(function(u){return x.try(function(){if(function(l,d,f){if(!l)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!Tn(f))throw new TypeError("Can not send "+l+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if(G(d))throw new Error("Can not send "+l+". Target window is closed")}(e,u,i),function(l,d){var f=Xn(d);if(f)return f===l;if(d===l||function(g){g===void 0&&(g=window);try{if(g.top)return g.top}catch{}if(V(g)===g)return g;try{if(kn(window,g)&&window.top)return window.top}catch{}try{if(kn(g,window)&&window.top)return window.top}catch{}for(var y=0,P=function O(I){for(var z=[],b=0,D=Yn(I);b<D.length;b++){var _=D[b];z.push(_);for(var T=0,wn=O(_);T<wn.length;T++)z.push(wn[T])}return z}(g);y<P.length;y++){var C=P[y];try{if(C.top)return C.top}catch{}if(V(C)===C)return C}}(d)===d)return!1;for(var h=0,E=Yn(l);h<E.length;h++)if(E[h]===d)return!0;return!1}(window,u))return function(l,d,f){d===void 0&&(d=5e3),f===void 0&&(f="Window");var h=function(E){return F("helloPromises").getOrSet(E,function(){return new x})}(l);return d!==-1&&(h=h.timeout(d,new Error(f+" did not load after "+d+"ms"))),h}(u,s)}).then(function(l){return function(d,f,h,E){var g=E.send;return x.try(function(){return typeof f=="string"?f:x.try(function(){return h||Cn(d,{send:g}).then(function(y){return y.domain})}).then(function(y){if(!tn(f,f))throw new Error("Domain "+ie(f)+" does not match "+ie(f));return y})})}(u,i,(l===void 0?{}:l).domain,{send:n})}).then(function(l){var d=l,f=e==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":e,h=new x,E=e+"_"+q();if(!c){var g={name:e,win:u,domain:d,promise:h};(function(b,D){j("responseListeners").set(b,D)})(E,g);var y=F("requestPromises").getOrSet(u,function(){return[]});y.push(h),h.catch(function(){(function(b){j("erroredResponseListeners").set(b,!0)})(E),We(E)});var P=function(b){return F("knownWindows").get(b,!1)}(u)?1e4:2e3,C=a,O=P,I=C,z=function(b,D){var _;return function T(){_=setTimeout(function(){(function(){if(G(u))return h.reject(new Error("Window closed for "+e+" before "+(g.ack?"response":"ack")));if(g.cancelled)return h.reject(new Error("Response listener was cancelled for "+e));O=Math.max(O-500,0),I!==-1&&(I=Math.max(I-500,0)),g.ack||O!==0?I===0&&h.reject(new Error("No response for postMessage "+f+" in "+L()+" in "+C+"ms")):h.reject(new Error("No ack for postMessage "+f+" in "+L()+" in "+P+"ms"))})(),T()},500)}(),{cancel:function(){clearTimeout(_)}}}();h.finally(function(){z.cancel(),y.splice(y.indexOf(h,1))}).catch(Q)}return Fn(u,d,{id:q(),origin:L(window),type:"postrobot_message_request",hash:E,name:e,data:r,fireAndForget:c},{on:k,send:n}).then(function(){return c?h.resolve():h},function(b){throw new Error("Send request message failed for "+f+" in "+L()+`
|
|
35
35
|
|
|
36
|
-
`+ln(b))})})})};function gt(n,t,e){return ge(n,t,e,{on:k,send:Y})}function yt(n,t,e){return ye(n,t,e,{on:k,send:Y})}function Et(n){return new B({send:Y,win:n})}function Wt(n){return B.toProxyWindow(n,{send:Y})}function Pe(){vn().initialized||(vn().initialized=!0,t=(n={on:k,send:Y}).on,e=n.send,(r=vn()).receiveMessage=r.receiveMessage||function(o){return xe(o,{on:t,send:e})},function(o){var i=o.on,a=o.send;j().getOrSet("postMessageListener",function(){return function(s,c,u){return s.addEventListener("message",u),{cancel:function(){s.removeEventListener("message",u)}}}(window,0,function(s){(function(c,u){var l=u.on,d=u.send;x.try(function(){var f=c.source||c.sourceElement,h=c.origin||c.originalEvent&&c.originalEvent.origin,E=c.data;if(h==="null"&&(h="file://"),f){if(!h)throw new Error("Post message did not have origin domain");xe({source:f,origin:h,data:E},{on:l,send:d})}})})(s,{on:i,send:a})})})}({on:k,send:Y}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var s=i("postrobot_hello",{domain:"*"},function(u){return fe(u.source,{domain:u.origin}),{instanceID:de()}}),c=Xn();return c&&Cn(c,{send:a}).catch(function(u){}),s})}({on:k,send:Y}));var n,t,e,r}function St(){(function(){for(var t=j("responseListeners"),e=0,r=t.keys();e<r.length;e++){var o=r[e],i=t.get(o);i&&(i.cancelled=!0),t.del(o)}})(),(n=j().get("postMessageListener"))&&n.cancel();var n;delete window.__post_robot_10_0_46__}var bt=!0;function xt(n){for(var t=0,e=
|
|
36
|
+
`+ln(b))})})})};function gt(n,t,e){return ge(n,t,e,{on:k,send:Y})}function yt(n,t,e){return ye(n,t,e,{on:k,send:Y})}function Et(n){return new B({send:Y,win:n})}function Wt(n){return B.toProxyWindow(n,{send:Y})}function Pe(){vn().initialized||(vn().initialized=!0,t=(n={on:k,send:Y}).on,e=n.send,(r=vn()).receiveMessage=r.receiveMessage||function(o){return xe(o,{on:t,send:e})},function(o){var i=o.on,a=o.send;j().getOrSet("postMessageListener",function(){return function(s,c,u){return s.addEventListener("message",u),{cancel:function(){s.removeEventListener("message",u)}}}(window,0,function(s){(function(c,u){var l=u.on,d=u.send;x.try(function(){var f=c.source||c.sourceElement,h=c.origin||c.originalEvent&&c.originalEvent.origin,E=c.data;if(h==="null"&&(h="file://"),f){if(!h)throw new Error("Post message did not have origin domain");xe({source:f,origin:h,data:E},{on:l,send:d})}})})(s,{on:i,send:a})})})}({on:k,send:Y}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var s=i("postrobot_hello",{domain:"*"},function(u){return fe(u.source,{domain:u.origin}),{instanceID:de()}}),c=Xn();return c&&Cn(c,{send:a}).catch(function(u){}),s})}({on:k,send:Y}));var n,t,e,r}function St(){(function(){for(var t=j("responseListeners"),e=0,r=t.keys();e<r.length;e++){var o=r[e],i=t.get(o);i&&(i.cancelled=!0),t.del(o)}})(),(n=j().get("postMessageListener"))&&n.cancel();var n;delete window.__post_robot_10_0_46__}var bt=!0;function xt(n){for(var t=0,e=F("requestPromises").get(n,[]);t<e.length;t++)e[t].reject(new Error("Window "+(G(n)?"closed":"cleaned up")+" before response")).catch(Q)}Pe()}])})})(qn);var et=qn.exports;(function(v){v.exports=et,v.exports.default=v.exports})(Jn);var $n=Jn.exports;const Vn=N({__proto__:null,default:nt($n)},[$n]);R.ConsentBox=Be,R.SoyioTypes=Ge,R.SoyioWidget=_n,R.default=_n,Object.defineProperties(R,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|