@soyio/soyio-widget 2.4.6 → 2.5.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 +5 -2
- package/dist/index.js +147 -121
- package/dist/index.umd.cjs +16 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -300,14 +300,16 @@ The **`ConsentBox`** is a component that allows you to embed a consent request d
|
|
|
300
300
|
const consentOptions = {
|
|
301
301
|
consentTemplateId: "<consent template id>",
|
|
302
302
|
onEvent: (data) => console.log(data),
|
|
303
|
-
isSandbox: true, // Optional
|
|
303
|
+
isSandbox: true, // Optional
|
|
304
304
|
appearance: {}, // Optional
|
|
305
|
+
actionToken: "<action token>", // Optional
|
|
305
306
|
};
|
|
306
307
|
|
|
307
308
|
// Wait for DOM to be fully loaded
|
|
308
309
|
document.addEventListener("DOMContentLoaded", () => {
|
|
309
310
|
// Create and mount the consent request box
|
|
310
|
-
new ConsentBox(consentOptions)
|
|
311
|
+
const consentBox = new ConsentBox(consentOptions);
|
|
312
|
+
consentBox.mount("#consent-request-box");
|
|
311
313
|
});
|
|
312
314
|
</script>
|
|
313
315
|
```
|
|
@@ -342,6 +344,7 @@ The `onEvent` follows the following format:
|
|
|
342
344
|
- **`isSelected`**: Boolean value indicating whether the consent checkbox is selected or not.
|
|
343
345
|
- **`actionToken`**: token containing necessary information for creation of the consent commit. [Learn more](https://docs.soyio.id/docs/api/resources/create-consent-request).
|
|
344
346
|
- **`appearance`**: Customize the appearance of the iframe. [Learn more](https://docs.soyio.id/docs/integration-guide/modules/consent).
|
|
347
|
+
- **`actionToken`**: In case of losing the state of the consent (i.e. page reload), you can use a previously generated `actionToken` to restore the state of the consent.
|
|
345
348
|
|
|
346
349
|
# Appearance
|
|
347
350
|
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
var b = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var c = (
|
|
4
|
-
if (!
|
|
2
|
+
var N = (e, t, n) => t in e ? b(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var c = (e, t, n) => (N(e, typeof t != "symbol" ? t + "" : t, n), n), H = (e, t, n) => {
|
|
4
|
+
if (!t.has(e))
|
|
5
5
|
throw TypeError("Cannot " + n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
7
|
+
var E = (e, t, n) => {
|
|
8
|
+
if (t.has(e))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
|
|
10
|
+
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
async function P(t,
|
|
14
|
-
if (!
|
|
12
|
+
var g = (e, t, n) => (H(e, t, "access private method"), n);
|
|
13
|
+
async function P(e, t, n) {
|
|
14
|
+
if (!e.contentWindow)
|
|
15
15
|
throw new Error("Invalid iframe: contentWindow is null");
|
|
16
|
-
const
|
|
16
|
+
const i = await import("./index-yZw-yxuV.js").then((o) => o.i);
|
|
17
17
|
try {
|
|
18
|
-
await
|
|
18
|
+
await i.send(e.contentWindow, "SET_APPEARANCE", { appearance: t, identifier: n });
|
|
19
19
|
} catch (o) {
|
|
20
20
|
console.error("Failed to send appearance config:", o);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const S = "https://app.soyio.id", C = "https://sandbox.soyio.id", D = [
|
|
24
24
|
"DISCLOSURE_REQUEST_SUCCESSFUL",
|
|
25
25
|
"IDENTITY_REGISTERED",
|
|
26
26
|
"IDENTITY_SIGNATURE",
|
|
27
27
|
"UNEXPECTED_ERROR",
|
|
28
28
|
"DENIED_CAMERA_PERMISSION",
|
|
29
29
|
"REJECTED_SIGNATURE"
|
|
30
|
-
],
|
|
31
|
-
function
|
|
32
|
-
const t = document.getElementById(
|
|
30
|
+
], L = "WIDGET_CLOSED", A = 420, U = 720, $ = 500;
|
|
31
|
+
function x(e) {
|
|
32
|
+
const t = document.getElementById(e);
|
|
33
33
|
t && (console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."), t.remove());
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
throw new Error(`Iframe div container with id '${
|
|
39
|
-
if (
|
|
40
|
-
throw new Error(`Iframe container with id '${
|
|
41
|
-
const n =
|
|
35
|
+
function O(e) {
|
|
36
|
+
const t = document.querySelector(e);
|
|
37
|
+
if (!t)
|
|
38
|
+
throw new Error(`Iframe div container with id '${e}' not found`);
|
|
39
|
+
if (t.tagName.toLowerCase() !== "div")
|
|
40
|
+
throw new Error(`Iframe container with id '${e}' must be a <div> element`);
|
|
41
|
+
const n = t;
|
|
42
42
|
return n.style.position = "relative", n.style.cssText += `
|
|
43
43
|
padding: 0 !important;
|
|
44
44
|
margin: 0 !important;
|
|
@@ -50,9 +50,9 @@ function $(t) {
|
|
|
50
50
|
opacity: 1 !important;
|
|
51
51
|
`, n;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
return
|
|
53
|
+
function G(e, t) {
|
|
54
|
+
const n = document.createElement("iframe");
|
|
55
|
+
return n.id = t, n.src = e, n.style.cssText += `
|
|
56
56
|
width: 100% !important;
|
|
57
57
|
min-width: 25rem !important;
|
|
58
58
|
max-width: 36rem !important;
|
|
@@ -62,31 +62,48 @@ function W(t) {
|
|
|
62
62
|
opacity: 1;
|
|
63
63
|
transition: height 0.35s,
|
|
64
64
|
opacity 0.4s 0.1s;
|
|
65
|
-
`,
|
|
66
|
-
}
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
n
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
})
|
|
65
|
+
`, n;
|
|
66
|
+
}
|
|
67
|
+
function W(e) {
|
|
68
|
+
const t = e.isSandbox ?? !1, n = e.developmentUrl || (t ? C : S), i = new URLSearchParams();
|
|
69
|
+
e.actionToken && i.set("actionToken", e.actionToken);
|
|
70
|
+
const o = i.toString();
|
|
71
|
+
return `${n}/embed/consents/${e.consentTemplateId}${o ? `?${o}` : ""}`;
|
|
72
|
+
}
|
|
73
|
+
const q = "IFRAME_READY", k = "CONSENT_STATE_CHANGE", F = "IFRAME_HEIGHT_CHANGE", a = {
|
|
74
|
+
onHeightChange: {},
|
|
75
|
+
onIframeReady: {},
|
|
76
|
+
onStateChange: {}
|
|
77
|
+
};
|
|
78
|
+
let w, I, y;
|
|
79
|
+
async function M() {
|
|
80
|
+
const e = await import("./index-yZw-yxuV.js").then((t) => t.i);
|
|
81
|
+
w || I || y || (w = e.on(F, async (t) => {
|
|
82
|
+
const n = t.data, i = a.onHeightChange[n.identifier];
|
|
83
|
+
if (!i)
|
|
84
|
+
throw new Error(`No height change listener found for identifier: ${n.identifier}`);
|
|
85
|
+
i(n.height);
|
|
86
|
+
}), I = e.on(q, async (t) => {
|
|
87
|
+
const n = t.data, i = a.onIframeReady[n.identifier];
|
|
88
|
+
if (!i)
|
|
89
|
+
throw new Error(`No iframe ready listener found for identifier: ${n.identifier}`);
|
|
90
|
+
i();
|
|
91
|
+
}), y = e.on(k, async (t) => {
|
|
92
|
+
const n = t.data, i = a.onStateChange[n.identifier];
|
|
93
|
+
if (!i)
|
|
94
|
+
throw new Error(`No state change listener found for identifier: ${n.identifier}`);
|
|
95
|
+
i(n);
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
function j(e, t) {
|
|
99
|
+
const { onHeightChange: n, onIframeReady: i, onStateChange: o } = t;
|
|
100
|
+
a.onHeightChange[e] = n, a.onIframeReady[e] = i, a.onStateChange[e] = o;
|
|
101
|
+
}
|
|
102
|
+
function B(e) {
|
|
103
|
+
delete a.onHeightChange[e], delete a.onIframeReady[e], delete a.onStateChange[e];
|
|
87
104
|
}
|
|
88
|
-
class
|
|
89
|
-
constructor(
|
|
105
|
+
class ie {
|
|
106
|
+
constructor(t) {
|
|
90
107
|
c(this, "appearance");
|
|
91
108
|
c(this, "options");
|
|
92
109
|
c(this, "iframe", null);
|
|
@@ -94,107 +111,116 @@ class ne {
|
|
|
94
111
|
isSelected: !1,
|
|
95
112
|
actionToken: null
|
|
96
113
|
});
|
|
97
|
-
this.options =
|
|
98
|
-
onHeightChange: this.handleHeightChange.bind(this),
|
|
99
|
-
onIframeReady: this.handleIframeReady.bind(this),
|
|
100
|
-
onStateChange: this.handleStateChange.bind(this)
|
|
101
|
-
});
|
|
114
|
+
this.options = t, this.appearance = t.appearance || null, this.setup();
|
|
102
115
|
}
|
|
103
|
-
handleHeightChange(
|
|
104
|
-
this.iframe && (this.iframe.style.height = `${
|
|
116
|
+
handleHeightChange(t) {
|
|
117
|
+
this.iframe && (this.iframe.style.height = `${t}px`);
|
|
105
118
|
}
|
|
106
119
|
async handleIframeReady() {
|
|
107
|
-
!this.iframe || !this.appearance || await P(this.iframe, this.appearance);
|
|
120
|
+
!this.iframe || !this.appearance || await P(this.iframe, this.appearance, this.uniqueIdentifier);
|
|
108
121
|
}
|
|
109
|
-
handleStateChange(
|
|
110
|
-
const { isSelected: n, actionToken:
|
|
111
|
-
this.state = { isSelected: n, actionToken:
|
|
122
|
+
handleStateChange(t) {
|
|
123
|
+
const { isSelected: n, actionToken: i } = t;
|
|
124
|
+
this.state = { isSelected: n, actionToken: i }, this.options.onEvent({
|
|
112
125
|
eventName: "CONSENT_CHECKBOX_CHANGE",
|
|
113
126
|
isSelected: n,
|
|
114
|
-
actionToken:
|
|
127
|
+
actionToken: i
|
|
115
128
|
});
|
|
116
129
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
130
|
+
async setup() {
|
|
131
|
+
await M(), j(this.uniqueIdentifier, {
|
|
132
|
+
onHeightChange: this.handleHeightChange.bind(this),
|
|
133
|
+
onIframeReady: this.handleIframeReady.bind(this),
|
|
134
|
+
onStateChange: this.handleStateChange.bind(this)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
mount(t) {
|
|
138
|
+
x(this.iframeIdentifier);
|
|
139
|
+
const n = O(t), i = W(this.options);
|
|
140
|
+
return this.iframe = G(i, this.iframeIdentifier), n.appendChild(this.iframe), this;
|
|
121
141
|
}
|
|
122
142
|
unmount() {
|
|
123
|
-
|
|
143
|
+
B(this.uniqueIdentifier), this.iframe && (this.iframe.remove(), this.iframe = null);
|
|
124
144
|
}
|
|
125
145
|
getState() {
|
|
126
146
|
return { ...this.state };
|
|
127
147
|
}
|
|
148
|
+
get iframeIdentifier() {
|
|
149
|
+
return `consent-box-${this.uniqueIdentifier}`;
|
|
150
|
+
}
|
|
151
|
+
get uniqueIdentifier() {
|
|
152
|
+
return this.options.consentTemplateId;
|
|
153
|
+
}
|
|
128
154
|
}
|
|
129
155
|
const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
130
156
|
__proto__: null
|
|
131
157
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
132
|
-
function
|
|
133
|
-
let
|
|
134
|
-
return "disclosureRequestId" in
|
|
135
|
-
}
|
|
136
|
-
function
|
|
137
|
-
const
|
|
138
|
-
return `${n}/${
|
|
139
|
-
}
|
|
140
|
-
const
|
|
141
|
-
let
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
function
|
|
146
|
-
document.body.style.filter = "", document.body.removeEventListener("click",
|
|
147
|
-
}
|
|
148
|
-
function
|
|
149
|
-
|
|
150
|
-
(!
|
|
151
|
-
},
|
|
152
|
-
}
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
document.body.style.filter = "blur(5px)", document.body.addEventListener("click",
|
|
156
|
-
|
|
158
|
+
function V(e) {
|
|
159
|
+
let t = "widget/";
|
|
160
|
+
return "disclosureRequestId" in e.configProps ? t += ["disclosures", e.configProps.disclosureRequestId].join("/") : t += e.request, t;
|
|
161
|
+
}
|
|
162
|
+
function Y(e) {
|
|
163
|
+
const t = e.isSandbox ?? !1, n = e.developmentUrl || (t ? C : S), i = Object.entries(e.configProps).filter(([d, s]) => s || d === "disclosureRequestId").map(([d, s]) => `${d}=${encodeURIComponent(s)}`).join("&"), o = V(e);
|
|
164
|
+
return `${n}/${o}?sdk=web&${i}`;
|
|
165
|
+
}
|
|
166
|
+
const X = !!(typeof window < "u" && window.document && window.document.createElement);
|
|
167
|
+
let r = null, f = null;
|
|
168
|
+
function u(e = null) {
|
|
169
|
+
r && !r.closed && r.focus(), e == null || e.preventDefault();
|
|
170
|
+
}
|
|
171
|
+
function m() {
|
|
172
|
+
document.body.style.filter = "", document.body.removeEventListener("click", u);
|
|
173
|
+
}
|
|
174
|
+
function K() {
|
|
175
|
+
f = setInterval(() => {
|
|
176
|
+
(!r || r.closed) && (f && clearInterval(f), m());
|
|
177
|
+
}, $);
|
|
178
|
+
}
|
|
179
|
+
function z(e) {
|
|
180
|
+
const t = Y(e), n = A, i = U, o = window.screenLeft !== void 0 ? window.screenLeft : window.screenX, d = window.screenTop !== void 0 ? window.screenTop : window.screenY, s = window.innerWidth || document.documentElement.clientWidth || window.screen.width, R = window.innerHeight || document.documentElement.clientHeight || window.screen.height, p = s / window.screen.availWidth, v = (s - n) / 2 / p + o, _ = (R - i) / 2 / p + d;
|
|
181
|
+
document.body.style.filter = "blur(5px)", document.body.addEventListener("click", u), r = window.open(
|
|
182
|
+
t,
|
|
157
183
|
"Soyio",
|
|
158
184
|
`scrollbars=yes,
|
|
159
185
|
width=${n},
|
|
160
|
-
height=${
|
|
161
|
-
top=${
|
|
162
|
-
left=${
|
|
163
|
-
),
|
|
164
|
-
}
|
|
165
|
-
function
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
const
|
|
169
|
-
let
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
async function
|
|
174
|
-
const { onEvent:
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
height=${i},
|
|
187
|
+
top=${_},
|
|
188
|
+
left=${v}`
|
|
189
|
+
), u(), K();
|
|
190
|
+
}
|
|
191
|
+
function J() {
|
|
192
|
+
r && (r.close(), r = null), m();
|
|
193
|
+
}
|
|
194
|
+
const Q = "WIDGET_EVENT";
|
|
195
|
+
let l = null;
|
|
196
|
+
function Z() {
|
|
197
|
+
l && (l.cancel(), l = null);
|
|
198
|
+
}
|
|
199
|
+
async function ee(e) {
|
|
200
|
+
const { onEvent: t } = e, n = await import("./index-yZw-yxuV.js").then((i) => i.i);
|
|
201
|
+
l && Z(), l = n.on(Q, async (i) => {
|
|
202
|
+
t(i.data), D.includes(i.data.eventName) ? J() : i.data.eventName === L && m();
|
|
177
203
|
});
|
|
178
204
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
205
|
+
function te(e) {
|
|
206
|
+
ee(e);
|
|
181
207
|
}
|
|
182
|
-
var
|
|
183
|
-
class
|
|
184
|
-
constructor(
|
|
185
|
-
|
|
208
|
+
var h, T;
|
|
209
|
+
class ae {
|
|
210
|
+
constructor(t) {
|
|
211
|
+
E(this, h);
|
|
186
212
|
c(this, "onEvent");
|
|
187
|
-
this.onEvent =
|
|
188
|
-
onEvent:
|
|
213
|
+
this.onEvent = t.onEvent, X && (z(t), te({
|
|
214
|
+
onEvent: g(this, h, T).bind(this)
|
|
189
215
|
}));
|
|
190
216
|
}
|
|
191
217
|
}
|
|
192
|
-
|
|
193
|
-
this.onEvent(
|
|
218
|
+
h = new WeakSet(), T = function(t) {
|
|
219
|
+
this.onEvent(t);
|
|
194
220
|
};
|
|
195
221
|
export {
|
|
196
|
-
|
|
222
|
+
ie as ConsentBox,
|
|
197
223
|
oe as SoyioTypes,
|
|
198
|
-
|
|
199
|
-
|
|
224
|
+
ae as SoyioWidget,
|
|
225
|
+
ae as default
|
|
200
226
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(D
|
|
1
|
+
(function(A,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(A=typeof globalThis<"u"?globalThis:A||self,D(A["soyio-widget"]={}))})(this,function(A){"use strict";var Rt=Object.defineProperty;var At=(A,D,H)=>D in A?Rt(A,D,{enumerable:!0,configurable:!0,writable:!0,value:H}):A[D]=H;var on=(A,D,H)=>(At(A,typeof D!="symbol"?D+"":D,H),H),Dt=(A,D,H)=>{if(!D.has(A))throw TypeError("Cannot "+H)};var Oe=(A,D,H)=>{if(D.has(A))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(A):D.set(A,H)};var Ce=(A,D,H)=>(Dt(A,D,"access private method"),H);var mn,Re;function D(v,p){for(var g=0;g<p.length;g++){const w=p[g];if(typeof w!="string"&&!Array.isArray(w)){for(const m in w)if(m!=="default"&&!(m in v)){const y=Object.getOwnPropertyDescriptor(w,m);y&&Object.defineProperty(v,m,y.get?y:{enumerable:!0,get:()=>w[m]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}async function H(v,p,g){if(!v.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const w=await Promise.resolve().then(()=>Cn);try{await w.send(v.contentWindow,"SET_APPEARANCE",{appearance:p,identifier:g})}catch(m){console.error("Failed to send appearance config:",m)}}const Un="https://app.soyio.id",Gn="https://sandbox.soyio.id",Ae=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],De="WIDGET_CLOSED",Ne=420,Te=720,je=500;function ze(v){const p=document.getElementById(v);p&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),p.remove())}function Me(v){const p=document.querySelector(v);if(!p)throw new Error(`Iframe div container with id '${v}' not found`);if(p.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${v}' must be a <div> element`);const g=p;return g.style.position="relative",g.style.cssText+=`
|
|
2
2
|
padding: 0 !important;
|
|
3
3
|
margin: 0 !important;
|
|
4
4
|
display: flex !important;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
border: none !important;
|
|
8
8
|
transition: height 0.35s !important;
|
|
9
9
|
opacity: 1 !important;
|
|
10
|
-
`,
|
|
10
|
+
`,g}function Le(v,p){const g=document.createElement("iframe");return g.id=p,g.src=v,g.style.cssText+=`
|
|
11
11
|
width: 100% !important;
|
|
12
12
|
min-width: 25rem !important;
|
|
13
13
|
max-width: 36rem !important;
|
|
@@ -17,24 +17,24 @@
|
|
|
17
17
|
opacity: 1;
|
|
18
18
|
transition: height 0.35s,
|
|
19
19
|
opacity 0.4s 0.1s;
|
|
20
|
-
`,g}function
|
|
21
|
-
width=${
|
|
22
|
-
height=${
|
|
23
|
-
top=${
|
|
24
|
-
left=${
|
|
25
|
-
`;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 k(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Vn(n){if(n===void 0&&(n=window),n&&!k(n))try{return n.opener}catch{}}function yn(n){try{return!0}catch{}return!1}function En(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=k(n);return r&&yn()?En(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return e+"//"+o}function M(n){n===void 0&&(n=window);var t=En(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)&&yn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),Z(r)==="mock:"}(t)&&yn())return!0}catch{}try{if(En(t)===En(window))return!0}catch{}return!1}(n))return!1;try{if(n===window||en(n)&&yn()||M(window)===M(n))return!0}catch{}return!1}function Wn(n){if(!X(n))throw new Error("Expected window to be same domain");return n}function Xn(n,t){if(!n||!t)return!1;var e=k(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 Kn(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 it=[],at=[];function B(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}(it,n);if(e!==-1){var r=at[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 Qn(n){return n===void 0&&(n=window),Vn(n=n||window)||k(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 Sn(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 ne(n){if(X(n))return Wn(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 ut(n){if(function(e){return e===void 0&&(e=window),!!k(e)}(n)){var t=ne(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 ee=[],sn=[],Cn=0,dn;function te(){if(!Cn&&dn){var n=dn;dn=null,n.resolve()}}function Nn(){Cn+=1}function fn(){Cn-=1,te()}var P=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;Nn();try{e(function(u){c?r.resolve(u):(a=!0,o=u)},function(u){c?r.reject(u):(s=!0,i=u)})}catch(u){fn(),this.reject(u);return}fn(),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(ee.indexOf(i)===-1){ee.push(i),setTimeout(function(){throw i},1);for(var s=0;s<sn.length;s++)sn[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,Nn();for(var i=function(h,W){return h.then(function(y){W.resolve(y)},function(y){W.reject(y)})},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,fn()}},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 sn.push(r),{cancel:function(){sn.splice(sn.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;Nn();try{i=e.apply(r,o||[])}catch(a){return fn(),n.reject(a)}return fn(),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=dn=dn||new e;return te(),r}(n)},n}();function bn(n,t){for(var e=0;e<n.length;e++)try{if(n[e]===t)return e}catch{}return-1}var Tn=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(Sn(i)&&B(i)){if(e)try{e.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},t.isSafeToReadWrite=function(e){return!Sn(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=bn(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=bn(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=bn(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(),bn(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 re(n){return n.name||n.__name__||n.displayName||"anonymous"}function oe(n,t){try{delete n.name,n.name=t}catch{}return n.__name__=n.displayName=t,n}function $(){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 xn;function ie(n){try{return JSON.stringify([].slice.call(n),function(t,e){return typeof e=="function"?"memoize["+function(r){if(xn=xn||new Tn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=xn.get(r);return o||(o=typeof r+":"+$(),xn.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 ct(){return{}}var ln=0,ae=0;function hn(n,t){t===void 0&&(t={});var e=t.thisNamespace,r=e!==void 0&&e,o=t.time,i,a,s=ln;ln+=1;var c=function(){for(var u=arguments.length,l=new Array(u),d=0;d<u;d++)l[d]=arguments[d];s<ae&&(i=null,a=null,s=ln,ln+=1);var f;f=r?(a=a||new Tn).getOrSet(this,ct):i=i||{};var h;try{h=ie(l)}catch{return n.apply(this,arguments)}var W=f[h];if(W&&o&&Date.now()-W.time<o&&(delete f[h],W=null),W)return W.value;var y=Date.now(),E=n.apply(this,arguments);return f[h]={time:y,value:E},E};return c.reset=function(){i=null,a=null},oe(c,(t.name||re(n))+"::memoized")}hn.clear=function(){ae=ln};function st(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=ie(a);return t.hasOwnProperty(c)||(t[c]=P.try(function(){return n.apply(o,r)}).finally(function(){delete t[c]})),t[c]}return e.reset=function(){t={}},oe(e,re(n)+"::promiseMemoized")}function Q(){}function vn(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+`
|
|
26
|
-
`+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: "+
|
|
20
|
+
`,g}function He(v){const p=v.isSandbox??!1,g=v.developmentUrl||(p?Gn:Un),w=new URLSearchParams;v.actionToken&&w.set("actionToken",v.actionToken);const m=w.toString();return`${g}/embed/consents/${v.consentTemplateId}${m?`?${m}`:""}`}const Fe="IFRAME_READY",Ue="CONSENT_STATE_CHANGE",Ge="IFRAME_HEIGHT_CHANGE",k={onHeightChange:{},onIframeReady:{},onStateChange:{}};let Bn,_n,$n;async function Be(){const v=await Promise.resolve().then(()=>Cn);Bn||_n||$n||(Bn=v.on(Ge,async p=>{const g=p.data,w=k.onHeightChange[g.identifier];if(!w)throw new Error(`No height change listener found for identifier: ${g.identifier}`);w(g.height)}),_n=v.on(Fe,async p=>{const g=p.data,w=k.onIframeReady[g.identifier];if(!w)throw new Error(`No iframe ready listener found for identifier: ${g.identifier}`);w()}),$n=v.on(Ue,async p=>{const g=p.data,w=k.onStateChange[g.identifier];if(!w)throw new Error(`No state change listener found for identifier: ${g.identifier}`);w(g)}))}function _e(v,p){const{onHeightChange:g,onIframeReady:w,onStateChange:m}=p;k.onHeightChange[v]=g,k.onIframeReady[v]=w,k.onStateChange[v]=m}function $e(v){delete k.onHeightChange[v],delete k.onIframeReady[v],delete k.onStateChange[v]}class qe{constructor(p){on(this,"appearance");on(this,"options");on(this,"iframe",null);on(this,"state",{isSelected:!1,actionToken:null});this.options=p,this.appearance=p.appearance||null,this.setup()}handleHeightChange(p){this.iframe&&(this.iframe.style.height=`${p}px`)}async handleIframeReady(){!this.iframe||!this.appearance||await H(this.iframe,this.appearance,this.uniqueIdentifier)}handleStateChange(p){const{isSelected:g,actionToken:w}=p;this.state={isSelected:g,actionToken:w},this.options.onEvent({eventName:"CONSENT_CHECKBOX_CHANGE",isSelected:g,actionToken:w})}async setup(){await Be(),_e(this.uniqueIdentifier,{onHeightChange:this.handleHeightChange.bind(this),onIframeReady:this.handleIframeReady.bind(this),onStateChange:this.handleStateChange.bind(this)})}mount(p){ze(this.iframeIdentifier);const g=Me(p),w=He(this.options);return this.iframe=Le(w,this.iframeIdentifier),g.appendChild(this.iframe),this}unmount(){$e(this.uniqueIdentifier),this.iframe&&(this.iframe.remove(),this.iframe=null)}getState(){return{...this.state}}get iframeIdentifier(){return`consent-box-${this.uniqueIdentifier}`}get uniqueIdentifier(){return this.options.consentTemplateId}}const ke=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Je(v){let p="widget/";return"disclosureRequestId"in v.configProps?p+=["disclosures",v.configProps.disclosureRequestId].join("/"):p+=v.request,p}function Ze(v){const p=v.isSandbox??!1,g=v.developmentUrl||(p?Gn:Un),w=Object.entries(v.configProps).filter(([y,b])=>b||y==="disclosureRequestId").map(([y,b])=>`${y}=${encodeURIComponent(b)}`).join("&"),m=Je(v);return`${g}/${m}?sdk=web&${w}`}const Ye=!!(typeof window<"u"&&window.document&&window.document.createElement);let J=null,In=null;function Pn(v=null){J&&!J.closed&&J.focus(),v==null||v.preventDefault()}function On(){document.body.style.filter="",document.body.removeEventListener("click",Pn)}function Ve(){In=setInterval(()=>{(!J||J.closed)&&(In&&clearInterval(In),On())},je)}function Xe(v){const p=Ze(v),g=Ne,w=Te,m=window.screenLeft!==void 0?window.screenLeft:window.screenX,y=window.screenTop!==void 0?window.screenTop:window.screenY,b=window.innerWidth||document.documentElement.clientWidth||window.screen.width,$=window.innerHeight||document.documentElement.clientHeight||window.screen.height,Y=b/window.screen.availWidth,tn=(b-g)/2/Y+m,Z=($-w)/2/Y+y;document.body.style.filter="blur(5px)",document.body.addEventListener("click",Pn),J=window.open(p,"Soyio",`scrollbars=yes,
|
|
21
|
+
width=${g},
|
|
22
|
+
height=${w},
|
|
23
|
+
top=${Z},
|
|
24
|
+
left=${tn}`),Pn(),Ve()}function Ke(){J&&(J.close(),J=null),On()}const Qe="WIDGET_EVENT";let an=null;function nt(){an&&(an.cancel(),an=null)}async function et(v){const{onEvent:p}=v,g=await Promise.resolve().then(()=>Cn);an&&nt(),an=g.on(Qe,async w=>{p(w.data),Ae.includes(w.data.eventName)?Ke():w.data.eventName===De&&On()})}function tt(v){et(v)}class qn{constructor(p){Oe(this,mn);on(this,"onEvent");this.onEvent=p.onEvent,Ye&&(Xe(p),tt({onEvent:Ce(this,mn,Re).bind(this)}))}}mn=new WeakSet,Re=function(p){this.onEvent(p)};var rt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ot(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var kn={exports:{}},Jn={exports:{}};(function(v,p){(function(g,w){v.exports=w()})(typeof self<"u"?self:rt,function(){return function(g){var w={};function m(y){if(w[y])return w[y].exports;var b=w[y]={i:y,l:!1,exports:{}};return g[y].call(b.exports,b,b.exports,m),b.l=!0,b.exports}return m.m=g,m.c=w,m.d=function(y,b,$){m.o(y,b)||Object.defineProperty(y,b,{enumerable:!0,get:$})},m.r=function(y){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(y,"__esModule",{value:!0})},m.t=function(y,b){if(1&b&&(y=m(y)),8&b||4&b&&typeof y=="object"&&y&&y.__esModule)return y;var $=Object.create(null);if(m.r($),Object.defineProperty($,"default",{enumerable:!0,value:y}),2&b&&typeof y!="string")for(var Y in y)m.d($,Y,(function(tn){return y[tn]}).bind(null,Y));return $},m.n=function(y){var b=y&&y.__esModule?function(){return y.default}:function(){return y};return m.d(b,"a",b),b},m.o=function(y,b){return{}.hasOwnProperty.call(y,b)},m.p="",m(m.s=0)}([function(g,w,m){m.r(w),m.d(w,"Promise",function(){return I}),m.d(w,"TYPES",function(){return Ot}),m.d(w,"ProxyWindow",function(){return G}),m.d(w,"setup",function(){return Pe}),m.d(w,"destroy",function(){return Pt}),m.d(w,"serializeMessage",function(){return Wt}),m.d(w,"deserializeMessage",function(){return bt}),m.d(w,"createProxyWindow",function(){return xt}),m.d(w,"toProxyWindow",function(){return It}),m.d(w,"on",function(){return V}),m.d(w,"once",function(){return St}),m.d(w,"send",function(){return X}),m.d(w,"markWindowKnown",function(){return ve}),m.d(w,"cleanUpWindow",function(){return Ct}),m.d(w,"bridge",function(){});function y(n){return{}.toString.call(n)==="[object RegExp]"}var b=`Call was rejected by callee.\r
|
|
25
|
+
`;function $(n){return n===void 0&&(n=window),n.location.protocol}function Y(n){if(n===void 0&&(n=window),n.mockDomain){var t=n.mockDomain.split("//")[0];if(t)return t}return $(n)}function tn(n){return n===void 0&&(n=window),Y(n)==="about:"}function Z(n){if(n===void 0&&(n=window),n)try{if(n.parent&&n.parent!==n)return n.parent}catch{}}function Yn(n){if(n===void 0&&(n=window),n&&!Z(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=Z(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 M(n){n===void 0&&(n=window);var t=gn(n);return t&&n.mockDomain&&n.mockDomain.indexOf("mock:")===0?n.mockDomain:t}function K(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(tn(t)&&pn())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),Y(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||tn(n)&&pn()||M(window)===M(n))return!0}catch{}return!1}function yn(n){if(!K(n))throw new Error("Expected window to be same domain");return n}function Vn(n,t){if(!n||!t)return!1;var e=Z(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 Xn(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 c=void 0;try{c=e[a]}catch{return t}if(!c)return t;t.push(c)}return t}var at=[],ut=[];function B(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!==b}if(t&&K(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}(at,n);if(e!==-1){var r=ut[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 Kn(n){return n===void 0&&(n=window),Yn(n=n||window)||Z(n)||void 0}function rn(n,t){if(typeof n=="string"){if(typeof t=="string")return n==="*"||t===n;if(y(t)||Array.isArray(t))return!1}return y(n)?y(t)?n.toString()===t.toString():!Array.isArray(t)&&!!t.match(n):!!Array.isArray(n)&&(Array.isArray(t)?JSON.stringify(n)===JSON.stringify(t):!y(t)&&n.some(function(e){return rn(e,t)}))}function En(n){try{if(n===window)return!0}catch(t){if(t&&t.message===b)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(t){if(t&&t.message===b)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(t){if(t&&t.message===b)return!0}try{if(n&&n.self===n)return!0}catch(t){if(t&&t.message===b)return!0}try{if(n&&n.parent===n)return!0}catch(t){if(t&&t.message===b)return!0}try{if(n&&n.top===n)return!0}catch(t){if(t&&t.message===b)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 Qn(n){if(K(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 st(n){if(function(e){return e===void 0&&(e=window),!!Z(e)}(n)){var t=Qn(n);if(t&&t.parentElement){t.parentElement.removeChild(t);return}}try{n.close()}catch{}}function Q(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 ne=[],un=[],Rn=0,sn;function ee(){if(!Rn&&sn){var n=sn;sn=null,n.resolve()}}function An(){Rn+=1}function cn(){Rn-=1,ee()}var I=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,c=!1,s=!1;An();try{e(function(u){s?r.resolve(u):(a=!0,o=u)},function(u){s?r.reject(u):(c=!0,i=u)})}catch(u){cn(),this.reject(u);return}cn(),s=!0,a?this.resolve(o):c&&this.reject(i)}}var t=n.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(Q(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(Q(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(ne.indexOf(i)===-1){ne.push(i),setTimeout(function(){throw i},1);for(var c=0;c<un.length;c++)un[c](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,W){return h.then(function(E){W.resolve(E)},function(E){W.reject(E)})},a=0;a<o.length;a++){var c=o[a],s=c.onSuccess,u=c.onError,l=c.promise,d=void 0;if(e)try{d=s?s(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 Q(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,cn()}},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:Q(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)})},c=0;c<e.length;c++){var s=e[c];if(s instanceof n){if(s.resolved){i[c]=s.value,o-=1;continue}}else if(!Q(s)){i[c]=s,o-=1;continue}a(c,n.resolve(s),r)}return o===0&&r.resolve(i),r},n.hash=function(e){var r={},o=[],i=function(c){if(e.hasOwnProperty(c)){var s=e[c];Q(s)?o.push(s.then(function(u){r[c]=u})):r[c]=s}};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 cn(),n.reject(a)}return cn(),n.resolve(i)},n.delay=function(e){return new n(function(r){setTimeout(r,e)})},n.isPromise=function(e){return!!(e&&e instanceof n)||Q(e)},n.flush=function(){return function(e){var r=sn=sn||new e;return ee(),r}(n)},n}();function Sn(n,t){for(var e=0;e<n.length;e++)try{if(n[e]===t)return e}catch{}return-1}var Dn=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)&&B(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 c=this.keys,s=this.values,u=Sn(c,e);u===-1?(c.push(e),s.push(r)):s[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=Sn(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=Sn(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(),Sn(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 te(n){return n.name||n.__name__||n.displayName||"anonymous"}function re(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 Wn;function oe(n){try{return JSON.stringify([].slice.call(n),function(t,e){return typeof e=="function"?"memoize["+function(r){if(Wn=Wn||new Dn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Wn.get(r);return o||(o=typeof r+":"+q(),Wn.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 ct(){return{}}var dn=0,ie=0;function fn(n,t){t===void 0&&(t={});var e=t.thisNamespace,r=e!==void 0&&e,o=t.time,i,a,c=dn;dn+=1;var s=function(){for(var u=arguments.length,l=new Array(u),d=0;d<u;d++)l[d]=arguments[d];c<ie&&(i=null,a=null,c=dn,dn+=1);var f;f=r?(a=a||new Dn).getOrSet(this,ct):i=i||{};var h;try{h=oe(l)}catch{return n.apply(this,arguments)}var W=f[h];if(W&&o&&Date.now()-W.time<o&&(delete f[h],W=null),W)return W.value;var E=Date.now(),S=n.apply(this,arguments);return f[h]={time:E,value:S},S};return s.reset=function(){i=null,a=null},re(s,(t.name||te(n))+"::memoized")}fn.clear=function(){ie=dn};function dt(n){var t={};function e(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),c=0;c<i;c++)a[c]=arguments[c];var s=oe(a);return t.hasOwnProperty(s)||(t[s]=I.try(function(){return n.apply(o,r)}).finally(function(){delete t[s]})),t[s]}return e.reset=function(){t={}},re(e,te(n)+"::promiseMemoized")}function nn(){}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+`
|
|
26
|
+
`+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 ae(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 Nn(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 ue(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function se(){return!!document.body&&document.readyState==="complete"}function ce(){return!!document.body&&document.readyState==="interactive"}fn(function(){return new I(function(n){if(se()||ce())return n();var t=setInterval(function(){if(se()||ce())return clearInterval(t),n()},10)})});var bn=typeof document<"u"?document.currentScript:null,ft=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")}),lt=q();fn(function(){var n;try{n=ft()}catch{return lt}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 de=function(){return{}};function j(n,t){return n===void 0&&(n="store"),t===void 0&&(t=de),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 ht=function(){};function xn(){var n=vn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new ht,n.WINDOW_WILDCARD}function L(n,t){return n===void 0&&(n="store"),t===void 0&&(t=de),j("windowStore").getOrSet(n,function(){var e=new Dn,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 fe(){return j("instance").getOrSet("instanceID",q)}function le(n,t){var e=t.domain,r=L("helloPromises"),o=r.get(n);o&&o.resolve({domain:e});var i=I.resolve({domain:e});return r.set(n,i),i}function Tn(n,t){return(0,t.send)(n,"postrobot_hello",{instanceID:fe()},{domain:"*",timeout:-1}).then(function(e){var r=e.origin,o=e.data.instanceID;return le(n,{domain:r}),{win:n,domain:r,instanceID:o}})}function he(n,t){var e=t.send;return L("windowInstanceIDPromises").getOrSet(n,function(){return Tn(n,{send:e}).then(function(r){return r.instanceID})})}function ve(n){L("knownWindows").set(n,!0)}function jn(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function we(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 en(n,t){return{__type__:n,__val__:t}}var F,vt=((F={}).function=function(){},F.error=function(n){return en("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},F.promise=function(){},F.regex=function(n){return en("regex",n.source)},F.date=function(n){return en("date",n.toJSON())},F.array=function(n){return n},F.object=function(n){return n},F.string=function(n){return n},F.number=function(n){return n},F.boolean=function(n){return n},F.null=function(n){return n},F[void 0]=function(n){return en("undefined",n)},F),wt={},U,mt=((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+`
|
|
27
27
|
|
|
28
|
-
`+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),
|
|
28
|
+
`+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),pt={};new I(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 me(n,t){var e=t.send,r=t.id,o=r===void 0?q():r,i=n.then(function(s){if(K(s))return yn(s).name}),a=n.then(function(s){if(B(s))throw new Error("Window is closed, can not determine type");return Yn(s)?"popup":"iframe"});i.catch(nn),a.catch(nn);var c=function(){return n.then(function(s){if(!B(s))return K(s)?yn(s).name:i})};return{id:o,getType:function(){return a},getInstanceID:dt(function(){return n.then(function(s){return he(s,{send:e})})}),close:function(){return n.then(st)},getName:c,focus:function(){return n.then(function(s){s.focus()})},isClosed:function(){return n.then(function(s){return B(s)})},setLocation:function(s,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,W=u.body;if(s.indexOf("/")===0)s=""+d+s;else if(!s.match(/^https?:\/\//)&&s.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(s));if(h==="post")return c().then(function(E){if(!E)throw new Error("Can not post to window without target name");(function(S){var P=S.url,T=S.target,C=S.body,O=S.method,z=O===void 0?"post":O,x=document.createElement("form");if(x.setAttribute("target",T),x.setAttribute("method",z),x.setAttribute("action",P),x.style.display="none",C)for(var R=0,_=Object.keys(C);R<_.length;R++){var N,wn=_[R],Fn=document.createElement("input");Fn.setAttribute("name",wn),Fn.setAttribute("value",(N=C[wn])==null?void 0:N.toString()),x.appendChild(Fn)}ue().appendChild(x),x.submit(),ue().removeChild(x)})({url:s,target:E,method:h,body:W})});if(h!=="get")throw new Error("Unsupported method: "+h);if(K(l))try{if(l.location&&typeof l.location.replace=="function"){l.location.replace(s);return}}catch{}l.location=s})},setName:function(s){return n.then(function(u){var l=K(u),d=Qn(u);if(!l)throw new Error("Can not set name for cross-domain window: "+s);yn(u).name=s,d&&d.setAttribute("name",s),i=I.resolve(s)})}}}var G=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 I,this.serializedWindow=i||me(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=I.hash({isPopup:r,name:o}).then(function(c){var s=c.name;c.isPopup&&s&&window.open("",s,"noopener")}),a=this.serializedWindow.focus();return I.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=me(this.actualWindowPromise,{send:o,id:this.getID()}),L("winToProxyWindow").set(e,this)},t.awaitWindow=function(){return this.actualWindowPromise},t.matchWindow=function(e,r){var o=this,i=r.send;return I.try(function(){return o.actualWindow?e===o.actualWindow:I.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:he(e,{send:i})}).then(function(a){var c=a.proxyInstanceID===a.knownWindowInstanceID;return c&&o.setWindow(e,{send:i}),c})})},t.unwrap=function(){return this.actualWindow||this},t.getInstanceID=function(){return this.serializedWindow.getInstanceID()},t.shouldClean=function(){return!!(this.actualWindow&&B(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 L("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function Mn(n,t,e,r,o){var i=L("methodStore"),a=j("proxyWindowMethods");G.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 pe(n,t){var e=L("methodStore"),r=j("proxyWindowMethods");return e.getOrSet(n,function(){return{}})[t]||r.get(t)}function ge(n,t,e,r,o){a=(i={on:o.on,send:o.send}).on,c=i.send,j("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(l){var d=l.source,f=l.origin,h=l.data,W=h.id,E=h.name,S=pe(d,W);if(!S)throw new Error("Could not find method '"+E+"' with id: "+h.id+" in "+M(window));var P=S.source,T=S.domain,C=S.val;return I.try(function(){if(!rn(T,f))throw new Error("Method '"+h.name+"' domain "+JSON.stringify(Nn(S.domain)?S.domain.source:S.domain)+" does not match origin "+f+" in "+M(window));if(G.isProxyWindow(P))return P.matchWindow(d,{send:c}).then(function(O){if(!O)throw new Error("Method call '"+h.name+"' failed - proxy window does not match source in "+M(window))})}).then(function(){return C.apply({source:d,origin:f},h.args)},function(O){return I.try(function(){if(C.onError)return C.onError(O)}).then(function(){throw O.stack&&(O.stack="Remote call to "+E+"("+function(z){return z===void 0&&(z=[]),(x=z,[].slice.call(x)).map(function(R){return typeof R=="string"?"'"+R+"'":R===void 0?"undefined":R===null?"null":typeof R=="boolean"?R.toString():Array.isArray(R)?"[ ... ]":typeof R=="object"?"{ ... }":typeof R=="function"?"() => { ... }":"<"+typeof R+">"}).join(", ");var x}(h.args)+`) failed
|
|
29
29
|
|
|
30
|
-
`+O.stack),O})}).then(function(O){return{result:O,id:W,name:
|
|
30
|
+
`+O.stack),O})}).then(function(O){return{result:O,id:W,name:E}})})});var i,a,c,s=e.__id__||q();n=G.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+"::")),G.isProxyWindow(n)?(Mn(s,e,u,n,t),n.awaitWindow().then(function(l){Mn(s,e,u,l,t)})):Mn(s,e,u,n,t),en("cross_domain_function",{id:s,name:u})}function ye(n,t,e,r){var o,i=r.on,a=r.send;return function(c,s){s===void 0&&(s=wt);var u=JSON.stringify(c,function(l){var d=this[l];if(jn(this))return d;var f=we(d);if(!f)return d;var h=s[f]||vt[f];return h?h(d,l):d});return u===void 0?"undefined":u}(e,((o={}).promise=function(c,s){return function(u,l,d,f,h){return en("cross_domain_zalgo_promise",{then:ge(u,l,function(W,E){return d.then(W,E)},f,{on:h.on,send:h.send})})}(n,t,c,s,{on:i,send:a})},o.function=function(c,s){return ge(n,t,c,s,{on:i,send:a})},o.object=function(c){return En(c)||G.isProxyWindow(c)?en("cross_domain_window",G.serialize(c,{send:a})):c},o))}function Ee(n,t,e,r){var o,i=r.send;return function(a,c){if(c===void 0&&(c=pt),a!=="undefined")return JSON.parse(a,function(s,u){if(jn(this))return u;var l,d;if(jn(u)?(l=u.__type__,d=u.__val__):(l=we(u),d=u),!l)return d;var f=c[l]||mt[l];return f?f(d,s):d})}(e,((o={}).cross_domain_zalgo_promise=function(a){return function(c,s,u){return new I(u.then)}(0,0,a)},o.cross_domain_function=function(a){return function(c,s,u,l){var d=u.id,f=u.name,h=l.send,W=function(S){S===void 0&&(S={});function P(){var T=arguments;return G.toProxyWindow(c,{send:h}).awaitWindow().then(function(C){var O=pe(C,d);if(O&&O.val!==P)return O.val.apply({source:window,origin:M()},T);var z=[].slice.call(T);return S.fireAndForget?h(C,"postrobot_method",{id:d,name:f,args:z},{domain:s,fireAndForget:!0}):h(C,"postrobot_method",{id:d,name:f,args:z},{domain:s,fireAndForget:!1}).then(function(x){return x.data.result})}).catch(function(C){throw C})}return P.__name__=f,P.__origin__=s,P.__source__=c,P.__id__=d,P.origin=s,P},E=W();return E.fireAndForget=W({fireAndForget:!0}),E}(n,t,a,{send:i})},o.cross_domain_window=function(a){return G.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 Hn(n,t,e,r){var o=r.on,i=r.send;return I.try(function(){var a=L().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(e),a.flush=a.flush||I.flush().then(function(){if(B(n))throw new Error("Window is closed");var c=ye(n,t,((s={}).__post_robot_10_0_46__=a.buffer||[],s),{on:o,send:i}),s;delete a.buffer;for(var u=Object.keys(Ln),l=[],d=0;d<u.length;d++){var f=u[d];try{Ln[f](n,c,t)}catch(h){l.push(h)}}if(l.length===u.length)throw new Error(`All post-robot messaging strategies failed:
|
|
31
31
|
|
|
32
|
-
`+l.map(function(h,W){return W+". "+
|
|
32
|
+
`+l.map(function(h,W){return W+". "+ln(h)}).join(`
|
|
33
33
|
|
|
34
|
-
`))}),a.flush.then(function(){delete a.flush})}).then(
|
|
34
|
+
`))}),a.flush.then(function(){delete a.flush})}).then(nn)}function Se(n){return j("responseListeners").get(n)}function We(n){j("responseListeners").del(n)}function be(n){return j("erroredResponseListeners").has(n)}function xe(n){var t=n.name,e=n.win,r=n.domain,o=L("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 c=a[i];if(c){var s=o.get(c);if(s){var u=s[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(rn(f.regex,r))return h}}if(u["*"])return u["*"]}}}}}function gt(n,t,e,r){var o=r.on,i=r.send,a=xe({name:e.name,win:n,domain:t}),c=e.name==="postrobot_method"&&e.data&&typeof e.data.name=="string"?e.data.name+"()":e.name;function s(u,l,d){return I.flush().then(function(){if(!e.fireAndForget&&!B(n))try{return Hn(n,t,{id:q(),origin:M(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 "+c+" in "+M()+`
|
|
35
35
|
|
|
36
|
-
`+
|
|
36
|
+
`+ln(f))}})}return I.all([I.flush().then(function(){if(!e.fireAndForget&&!B(n))try{return Hn(n,t,{id:q(),origin:M(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 "+c+" in "+M()+`
|
|
37
37
|
|
|
38
|
-
`+
|
|
38
|
+
`+ln(u))}}),I.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 s("success",u)},function(u){return s("error",null,u)})]).then(nn).catch(function(u){if(a&&a.handleError)return a.handleError(u);throw u})}function yt(n,t,e){if(!be(e.hash)){var r=Se(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(!rn(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 Et(n,t,e){if(!be(e.hash)){var r=Se(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(!rn(r.domain,t))throw new Error("Response origin "+t+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":y(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 Ie(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,c=function(l,d,f,h){var W=h.on,E=h.send,S;try{S=Ee(d,f,l,{on:W,send:E})}catch{return}if(S&&typeof S=="object"&&S!==null){var P=S.__post_robot_10_0_46__;if(Array.isArray(P))return P}}(n.data,i,a,{on:e,send:r});if(c){ve(i);for(var s=0;s<c.length;s++){var u=c[s];if(o.has(u.id)||(o.set(u.id,!0),B(i)&&!u.fireAndForget))return;u.origin.indexOf("file:")===0&&(a="file://");try{u.type==="postrobot_message_request"?gt(i,a,u,{on:e,send:r}):u.type==="postrobot_message_response"?Et(i,a,u):u.type==="postrobot_message_ack"&&yt(i,a,u)}catch(l){setTimeout(function(){throw l},0)}}}}function V(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 c=i.name,s=i.win,u=i.domain,l=L("requestListeners");if(!c||typeof c!="string")throw new Error("Name required to add request listener");if(s&&s!=="*"&&G.isProxyWindow(s)){var d=s.awaitWindow().then(function(N){return o({name:c,win:N,domain:u},a)});return{cancel:function(){d.then(function(N){return N.cancel()},nn)}}}var f=s;if(Array.isArray(f)){for(var h=[],W=0,E=f;W<E.length;W++)h.push(o({name:c,domain:u,win:E[W]},a));return{cancel:function(){for(var N=0;N<h.length;N++)h[N].cancel()}}}if(Array.isArray(u)){for(var S=[],P=0,T=u;P<T.length;P++)S.push(o({name:c,win:f,domain:T[P]},a));return{cancel:function(){for(var N=0;N<S.length;N++)S[N].cancel()}}}var C=xe({name:c,win:f,domain:u});f&&f!=="*"||(f=xn());var O=(u=u||"*").toString();if(C)throw f&&u?new Error("Request listener already exists for "+c+" on domain "+u.toString()+" for "+(f===xn()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+c+" for "+(f===xn()?"wildcard":"specified")+" window"):u?new Error("Request listener already exists for "+c+" on domain "+u.toString()):new Error("Request listener already exists for "+c);var z=l.getOrSet(f,function(){return{}}),x=hn(z,c,function(){return{}}),R,_;return Nn(u)?(R=hn(x,"__domain_regex__",function(){return[]})).push(_={regex:u,listener:a}):x[O]=a,{cancel:function(){delete x[O],_&&(R.splice(R.indexOf(_,1)),R.length||delete x.__domain_regex__),Object.keys(x).length||delete z[c],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 St(n,t,e){typeof(t=t||{})=="function"&&(e=t,t={});var r=new I,o;return t.errorHandler=function(i){o.cancel(),r.reject(i)},o=V(n,t,function(i){if(o.cancel(),r.resolve(i),e)return e(i)}),r.cancel=o.cancel,r}var X=function n(t,e,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,c=o.timeout||5e3,s=o.fireAndForget||!1;return G.toProxyWindow(t,{send:n}).awaitWindow().then(function(u){return I.try(function(){if(function(l,d,f){if(!l)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!Nn(f))throw new TypeError("Can not send "+l+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if(B(d))throw new Error("Can not send "+l+". Target window is closed")}(e,u,i),function(l,d){var f=Kn(d);if(f)return f===l;if(d===l||function(E){E===void 0&&(E=window);try{if(E.top)return E.top}catch{}if(Z(E)===E)return E;try{if(Vn(window,E)&&window.top)return window.top}catch{}try{if(Vn(E,window)&&window.top)return window.top}catch{}for(var S=0,P=function C(O){for(var z=[],x=0,R=Xn(O);x<R.length;x++){var _=R[x];z.push(_);for(var N=0,wn=C(_);N<wn.length;N++)z.push(wn[N])}return z}(E);S<P.length;S++){var T=P[S];try{if(T.top)return T.top}catch{}if(Z(T)===T)return T}}(d)===d)return!1;for(var h=0,W=Xn(l);h<W.length;h++)if(W[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(W){return L("helloPromises").getOrSet(W,function(){return new I})}(l);return d!==-1&&(h=h.timeout(d,new Error(f+" did not load after "+d+"ms"))),h}(u,c)}).then(function(l){return function(d,f,h,W){var E=W.send;return I.try(function(){return typeof f=="string"?f:I.try(function(){return h||Tn(d,{send:E}).then(function(S){return S.domain})}).then(function(S){if(!rn(f,f))throw new Error("Domain "+ae(f)+" does not match "+ae(f));return S})})}(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 I,W=e+"_"+q();if(!s){var E={name:e,win:u,domain:d,promise:h};(function(x,R){j("responseListeners").set(x,R)})(W,E);var S=L("requestPromises").getOrSet(u,function(){return[]});S.push(h),h.catch(function(){(function(x){j("erroredResponseListeners").set(x,!0)})(W),We(W)});var P=function(x){return L("knownWindows").get(x,!1)}(u)?1e4:2e3,T=a,C=P,O=T,z=function(x,R){var _;return function N(){_=setTimeout(function(){(function(){if(B(u))return h.reject(new Error("Window closed for "+e+" before "+(E.ack?"response":"ack")));if(E.cancelled)return h.reject(new Error("Response listener was cancelled for "+e));C=Math.max(C-500,0),O!==-1&&(O=Math.max(O-500,0)),E.ack||C!==0?O===0&&h.reject(new Error("No response for postMessage "+f+" in "+M()+" in "+T+"ms")):h.reject(new Error("No ack for postMessage "+f+" in "+M()+" in "+P+"ms"))})(),N()},500)}(),{cancel:function(){clearTimeout(_)}}}();h.finally(function(){z.cancel(),S.splice(S.indexOf(h,1))}).catch(nn)}return Hn(u,d,{id:q(),origin:M(window),type:"postrobot_message_request",hash:W,name:e,data:r,fireAndForget:s},{on:V,send:n}).then(function(){return s?h.resolve():h},function(x){throw new Error("Send request message failed for "+f+" in "+M()+`
|
|
39
39
|
|
|
40
|
-
`+
|
|
40
|
+
`+ln(x))})})})};function Wt(n,t,e){return ye(n,t,e,{on:V,send:X})}function bt(n,t,e){return Ee(n,t,e,{on:V,send:X})}function xt(n){return new G({send:X,win:n})}function It(n){return G.toProxyWindow(n,{send:X})}function Pe(){vn().initialized||(vn().initialized=!0,t=(n={on:V,send:X}).on,e=n.send,(r=vn()).receiveMessage=r.receiveMessage||function(o){return Ie(o,{on:t,send:e})},function(o){var i=o.on,a=o.send;j().getOrSet("postMessageListener",function(){return function(c,s,u){return c.addEventListener("message",u),{cancel:function(){c.removeEventListener("message",u)}}}(window,0,function(c){(function(s,u){var l=u.on,d=u.send;I.try(function(){var f=s.source||s.sourceElement,h=s.origin||s.originalEvent&&s.originalEvent.origin,W=s.data;if(h==="null"&&(h="file://"),f){if(!h)throw new Error("Post message did not have origin domain");Ie({source:f,origin:h,data:W},{on:l,send:d})}})})(c,{on:i,send:a})})})}({on:V,send:X}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var c=i("postrobot_hello",{domain:"*"},function(u){return le(u.source,{domain:u.origin}),{instanceID:fe()}}),s=Kn();return s&&Tn(s,{send:a}).catch(function(u){}),c})}({on:V,send:X}));var n,t,e,r}function Pt(){(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 Ot=!0;function Ct(n){for(var t=0,e=L("requestPromises").get(n,[]);t<e.length;t++)e[t].reject(new Error("Window "+(B(n)?"closed":"cleaned up")+" before response")).catch(nn)}Pe()}])})})(Jn);var it=Jn.exports;(function(v){v.exports=it,v.exports.default=v.exports})(kn);var Zn=kn.exports;const Cn=D({__proto__:null,default:ot(Zn)},[Zn]);A.ConsentBox=qe,A.SoyioTypes=ke,A.SoyioWidget=qn,A.default=qn,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|