@soyio/soyio-widget 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,44 +1,44 @@
1
- var b = Object.defineProperty;
2
- var P = (t, e, n) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var c = (t, e, n) => (P(t, typeof e != "symbol" ? e + "" : e, n), n), D = (t, e, n) => {
4
- if (!e.has(t))
1
+ var _ = Object.defineProperty;
2
+ var N = (e, t, n) => t in e ? _(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var a = (e, t, n) => (N(e, typeof t != "symbol" ? t + "" : t, n), n), L = (e, t, n) => {
4
+ if (!t.has(e))
5
5
  throw TypeError("Cannot " + n);
6
6
  };
7
- var I = (t, e, n) => {
8
- if (e.has(t))
7
+ var g = (e, t, n) => {
8
+ if (t.has(e))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- e instanceof WeakSet ? e.add(t) : e.set(t, n);
10
+ t instanceof WeakSet ? t.add(e) : t.set(e, n);
11
11
  };
12
- var S = (t, e, n) => (D(t, e, "access private method"), n);
13
- async function A(t, e) {
14
- if (!t.contentWindow)
12
+ var w = (e, t, n) => (L(e, t, "access private method"), n);
13
+ async function H(e, t, n) {
14
+ if (!e.contentWindow)
15
15
  throw new Error("Invalid iframe: contentWindow is null");
16
- const n = await import("./index-yZw-yxuV.js").then((o) => o.i);
16
+ const o = await import("./index-yZw-yxuV.js").then((i) => i.i);
17
17
  try {
18
- await n.send(t.contentWindow, "SET_APPEARANCE", { appearance: e });
19
- } catch (o) {
20
- console.error("Failed to send appearance config:", o);
18
+ await o.send(e.contentWindow, "SET_APPEARANCE", { appearance: t, identifier: n });
19
+ } catch (i) {
20
+ console.error("Failed to send appearance config:", i);
21
21
  }
22
22
  }
23
- const y = "soyio-consent-iframe", T = "https://app.soyio.id", g = "https://sandbox.soyio.id", U = [
23
+ const b = "https://app.soyio.id", S = "https://sandbox.soyio.id", P = [
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
- ], H = "WIDGET_CLOSED", O = 420, x = 720, L = 500;
31
- function $() {
32
- const t = document.getElementById(y);
30
+ ], A = "WIDGET_CLOSED", D = 420, $ = 720, O = 500;
31
+ function U(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 G(t) {
36
- const e = document.querySelector(t);
37
- if (!e)
38
- throw new Error(`Iframe div container with id '${t}' not found`);
39
- if (e.tagName.toLowerCase() !== "div")
40
- throw new Error(`Iframe container with id '${t}' must be a <div> element`);
41
- const n = e;
35
+ function G(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 G(t) {
50
50
  opacity: 1 !important;
51
51
  `, n;
52
52
  }
53
- function W(t) {
54
- const e = document.createElement("iframe");
55
- return e.id = y, e.src = t, e.style.cssText += `
53
+ function k(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,141 +62,236 @@ function W(t) {
62
62
  opacity: 1;
63
63
  transition: height 0.35s,
64
64
  opacity 0.4s 0.1s;
65
- `, e;
66
- }
67
- function k(t) {
68
- const e = t.isSandbox ?? !1, n = t.developmentUrl || (e ? g : T), o = new URLSearchParams();
69
- t.actionToken && o.set("actionToken", t.actionToken);
70
- const s = o.toString();
71
- return `${n}/embed/consents/${t.consentTemplateId}${s ? `?${s}` : ""}`;
72
- }
73
- const F = "IFRAME_READY", M = "CONSENT_STATE_CHANGE", j = "IFRAME_HEIGHT_CHANGE";
74
- let l = null, d = null, u = null;
75
- function v() {
76
- l == null || l.cancel(), l = null, d == null || d.cancel(), d = null, u == null || u.cancel(), u = null;
77
- }
78
- async function q(t) {
79
- const { onHeightChange: e, onIframeReady: n, onStateChange: o } = t, s = await import("./index-yZw-yxuV.js").then((i) => i.i);
80
- v(), l = s.on(j, async (i) => {
81
- const a = i.data;
82
- e(a.height);
83
- }), d = s.on(F, async () => {
84
- n();
85
- }), u = s.on(M, async (i) => {
86
- const a = i.data;
87
- o(a);
88
- });
65
+ `, n;
66
+ }
67
+ function M(e) {
68
+ const t = e.isSandbox ?? !1, n = e.developmentUrl || (t ? S : b), o = new URLSearchParams();
69
+ e.actionToken && o.set("actionToken", e.actionToken);
70
+ const i = o.toString();
71
+ return `${n}/embed/consents/${e.consentTemplateId}${i ? `?${i}` : ""}`;
72
+ }
73
+ const q = "IFRAME_READY", W = "CONSENT_STATE_CHANGE", F = "IFRAME_HEIGHT_CHANGE", B = "TOOLTIP_STATE_CHANGE", s = {
74
+ onHeightChange: {},
75
+ onIframeReady: {},
76
+ onStateChange: {},
77
+ onTooltipChange: {}
78
+ };
79
+ let T, C, y, I;
80
+ async function X() {
81
+ const e = await import("./index-yZw-yxuV.js").then((t) => t.i);
82
+ T || C || y || I || (T = e.on(F, async (t) => {
83
+ const n = t.data, o = s.onHeightChange[n.identifier];
84
+ if (!o)
85
+ throw new Error(`No height change listener found for identifier: ${n.identifier}`);
86
+ o(n.height);
87
+ }), C = e.on(q, async (t) => {
88
+ const n = t.data, o = s.onIframeReady[n.identifier];
89
+ if (!o)
90
+ throw new Error(`No iframe ready listener found for identifier: ${n.identifier}`);
91
+ o();
92
+ }), y = e.on(W, async (t) => {
93
+ const n = t.data, o = s.onStateChange[n.identifier];
94
+ if (!o)
95
+ throw new Error(`No state change listener found for identifier: ${n.identifier}`);
96
+ o(n);
97
+ }), I = e.on(B, async (t) => {
98
+ const n = t.data, o = s.onTooltipChange[n.identifier];
99
+ if (!o)
100
+ throw new Error(`No tooltip change listener found for identifier: ${n.identifier}`);
101
+ o(n);
102
+ }));
103
+ }
104
+ function Y(e, t) {
105
+ const {
106
+ onHeightChange: n,
107
+ onIframeReady: o,
108
+ onStateChange: i,
109
+ onTooltipChange: r
110
+ } = t;
111
+ s.onHeightChange[e] = n, s.onIframeReady[e] = o, s.onStateChange[e] = i, s.onTooltipChange[e] = r;
112
+ }
113
+ function j(e) {
114
+ delete s.onHeightChange[e], delete s.onIframeReady[e], delete s.onStateChange[e], delete s.onTooltipChange[e];
115
+ }
116
+ class V {
117
+ constructor() {
118
+ a(this, "tooltipElement", null);
119
+ a(this, "tooltipContent", null);
120
+ a(this, "tooltipClass", "soyio-tooltip");
121
+ a(this, "hideTimeout", null);
122
+ this.createTooltipElement(), this.setupGlobalListeners();
123
+ }
124
+ createTooltipElement() {
125
+ const t = document.querySelector(`.${this.tooltipClass}`);
126
+ t == null || t.remove(), this.tooltipElement = document.createElement("div"), this.tooltipElement.className = this.tooltipClass, this.tooltipElement.style.cssText = `
127
+ position: fixed;
128
+ z-index: 99999;
129
+ background: white;
130
+ padding: 8px 12px;
131
+ border-radius: 4px;
132
+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);
133
+ font-size: 14px;
134
+ max-width: 300px;
135
+ word-wrap: break-word;
136
+ pointer-events: none;
137
+ opacity: 0;
138
+ transition: opacity 0.2s ease-in-out;
139
+ transform: translateX(-50%) translateY(-100%);
140
+ margin-top: -8px;
141
+ `, this.tooltipContent = document.createElement("div"), this.tooltipElement.appendChild(this.tooltipContent);
142
+ const n = document.createElement("div");
143
+ n.style.cssText = `
144
+ position: absolute;
145
+ bottom: -4px;
146
+ left: 50%;
147
+ transform: translateX(-50%) rotate(45deg);
148
+ width: 8px;
149
+ height: 8px;
150
+ background: white;
151
+ box-shadow: 2px 2px 2px rgba(0,0,0,0.1);
152
+ `, this.tooltipElement.appendChild(n), document.body.appendChild(this.tooltipElement);
153
+ }
154
+ setupGlobalListeners() {
155
+ window.addEventListener("scroll", () => this.hide(), !0), window.addEventListener("resize", () => this.hide()), window.addEventListener("orientationchange", () => this.hide());
156
+ }
157
+ show(t, n, o) {
158
+ !this.tooltipElement || !this.tooltipContent || (this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null), this.tooltipContent.textContent = t, this.tooltipElement.style.left = `${n}px`, this.tooltipElement.style.top = `${o}px`, this.tooltipElement.style.opacity = "1");
159
+ }
160
+ hide() {
161
+ this.tooltipElement && (this.tooltipElement.style.opacity = "0");
162
+ }
163
+ destroy() {
164
+ var t;
165
+ (t = this.tooltipElement) == null || t.remove(), this.tooltipElement = null, this.tooltipContent = null, this.hideTimeout && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
166
+ }
89
167
  }
90
- class ne {
91
- constructor(e) {
92
- c(this, "appearance");
93
- c(this, "options");
94
- c(this, "iframe", null);
95
- c(this, "state", {
168
+ class at {
169
+ constructor(t) {
170
+ a(this, "appearance");
171
+ a(this, "options");
172
+ a(this, "tooltipManager");
173
+ a(this, "iframe", null);
174
+ a(this, "state", {
96
175
  isSelected: !1,
97
176
  actionToken: null
98
177
  });
99
- this.options = e, this.appearance = e.appearance || null, q({
100
- onHeightChange: this.handleHeightChange.bind(this),
101
- onIframeReady: this.handleIframeReady.bind(this),
102
- onStateChange: this.handleStateChange.bind(this)
103
- });
178
+ this.options = t, this.appearance = t.appearance || null, this.tooltipManager = new V(), this.setup();
104
179
  }
105
- handleHeightChange(e) {
106
- this.iframe && (this.iframe.style.height = `${e}px`);
180
+ handleHeightChange(t) {
181
+ this.iframe && (this.iframe.style.height = `${t}px`);
107
182
  }
108
183
  async handleIframeReady() {
109
- !this.iframe || !this.appearance || await A(this.iframe, this.appearance);
184
+ !this.iframe || !this.appearance || await H(this.iframe, this.appearance, this.uniqueIdentifier);
110
185
  }
111
- handleStateChange(e) {
112
- const { isSelected: n, actionToken: o } = e;
186
+ handleStateChange(t) {
187
+ const { isSelected: n, actionToken: o } = t;
113
188
  this.state = { isSelected: n, actionToken: o }, this.options.onEvent({
114
189
  eventName: "CONSENT_CHECKBOX_CHANGE",
115
190
  isSelected: n,
116
191
  actionToken: o
117
192
  });
118
193
  }
119
- mount(e) {
120
- $();
121
- const n = G(e), o = k(this.options);
122
- return this.iframe = W(o), n.appendChild(this.iframe), this;
194
+ async setup() {
195
+ await X(), Y(this.uniqueIdentifier, {
196
+ onHeightChange: this.handleHeightChange.bind(this),
197
+ onIframeReady: this.handleIframeReady.bind(this),
198
+ onStateChange: this.handleStateChange.bind(this),
199
+ onTooltipChange: this.handleTooltipChange.bind(this)
200
+ });
201
+ }
202
+ handleTooltipChange(t) {
203
+ if (!this.iframe)
204
+ return;
205
+ const n = this.iframe.getBoundingClientRect(), { text: o, coordinates: i, isVisible: r } = t, c = i.x + n.left, p = i.y + n.top;
206
+ r ? this.tooltipManager.show(o, c, p) : this.tooltipManager.hide();
207
+ }
208
+ mount(t) {
209
+ U(this.iframeIdentifier);
210
+ const n = G(t), o = M(this.options);
211
+ return this.iframe = k(o, this.iframeIdentifier), n.appendChild(this.iframe), this;
123
212
  }
124
213
  unmount() {
125
- v(), this.iframe && (this.iframe.remove(), this.iframe = null);
214
+ j(this.uniqueIdentifier), this.iframe && (this.iframe.remove(), this.iframe = null);
126
215
  }
127
216
  getState() {
128
217
  return { ...this.state };
129
218
  }
219
+ get iframeIdentifier() {
220
+ return `consent-box-${this.uniqueIdentifier}`;
221
+ }
222
+ get uniqueIdentifier() {
223
+ return this.options.consentTemplateId;
224
+ }
130
225
  }
131
- const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
226
+ const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
132
227
  __proto__: null
133
228
  }, Symbol.toStringTag, { value: "Module" }));
134
- function B(t) {
135
- let e = "widget/";
136
- return "disclosureRequestId" in t.configProps ? e += ["disclosures", t.configProps.disclosureRequestId].join("/") : e += t.request, e;
137
- }
138
- function V(t) {
139
- const e = t.isSandbox ?? !1, n = t.developmentUrl || (e ? g : T), o = Object.entries(t.configProps).filter(([i, a]) => a || i === "disclosureRequestId").map(([i, a]) => `${i}=${encodeURIComponent(a)}`).join("&"), s = B(t);
140
- return `${n}/${s}?sdk=web&${o}`;
141
- }
142
- const Y = !!(typeof window < "u" && window.document && window.document.createElement);
143
- let r = null, f = null;
144
- function p(t = null) {
145
- r && !r.closed && r.focus(), t == null || t.preventDefault();
146
- }
147
- function E() {
148
- document.body.style.filter = "", document.body.removeEventListener("click", p);
149
- }
150
- function X() {
151
- f = setInterval(() => {
152
- (!r || r.closed) && (f && clearInterval(f), E());
153
- }, L);
154
- }
155
- function K(t) {
156
- const e = V(t), n = O, o = x, s = window.screenLeft !== void 0 ? window.screenLeft : window.screenX, i = window.screenTop !== void 0 ? window.screenTop : window.screenY, a = window.innerWidth || document.documentElement.clientWidth || window.screen.width, R = window.innerHeight || document.documentElement.clientHeight || window.screen.height, w = a / window.screen.availWidth, C = (a - n) / 2 / w + s, N = (R - o) / 2 / w + i;
157
- document.body.style.filter = "blur(5px)", document.body.addEventListener("click", p), r = window.open(
158
- e,
229
+ function z(e) {
230
+ let t = "widget/";
231
+ return "disclosureRequestId" in e.configProps ? t += ["disclosures", e.configProps.disclosureRequestId].join("/") : t += e.request, t;
232
+ }
233
+ function K(e) {
234
+ const t = e.isSandbox ?? !1, n = e.developmentUrl || (t ? S : b), o = Object.entries(e.configProps).filter(([r, c]) => c || r === "disclosureRequestId").map(([r, c]) => `${r}=${encodeURIComponent(c)}`).join("&"), i = z(e);
235
+ return `${n}/${i}?sdk=web&${o}`;
236
+ }
237
+ const J = !!(typeof window < "u" && window.document && window.document.createElement);
238
+ let l = null, u = null;
239
+ function m(e = null) {
240
+ l && !l.closed && l.focus(), e == null || e.preventDefault();
241
+ }
242
+ function f() {
243
+ document.body.style.filter = "", document.body.removeEventListener("click", m);
244
+ }
245
+ function Q() {
246
+ u = setInterval(() => {
247
+ (!l || l.closed) && (u && clearInterval(u), f());
248
+ }, O);
249
+ }
250
+ function Z(e) {
251
+ const t = K(e), n = D, o = $, i = window.screenLeft !== void 0 ? window.screenLeft : window.screenX, r = window.screenTop !== void 0 ? window.screenTop : window.screenY, c = window.innerWidth || document.documentElement.clientWidth || window.screen.width, p = window.innerHeight || document.documentElement.clientHeight || window.screen.height, E = c / window.screen.availWidth, x = (c - n) / 2 / E + i, R = (p - o) / 2 / E + r;
252
+ document.body.style.filter = "blur(5px)", document.body.addEventListener("click", m), l = window.open(
253
+ t,
159
254
  "Soyio",
160
255
  `scrollbars=yes,
161
256
  width=${n},
162
257
  height=${o},
163
- top=${N},
164
- left=${C}`
165
- ), p(), X();
258
+ top=${R},
259
+ left=${x}`
260
+ ), m(), Q();
166
261
  }
167
- function z() {
168
- r && (r.close(), r = null), E();
262
+ function tt() {
263
+ l && (l.close(), l = null), f();
169
264
  }
170
- const J = "WIDGET_EVENT";
171
- let m = null;
172
- function Q() {
173
- m && (m.cancel(), m = null);
265
+ const et = "WIDGET_EVENT";
266
+ let d = null;
267
+ function nt() {
268
+ d && (d.cancel(), d = null);
174
269
  }
175
- async function Z(t) {
176
- const { onEvent: e } = t, n = await import("./index-yZw-yxuV.js").then((o) => o.i);
177
- m && Q(), m = n.on(J, async (o) => {
178
- e(o.data), U.includes(o.data.eventName) ? z() : o.data.eventName === H && E();
270
+ async function ot(e) {
271
+ const { onEvent: t } = e, n = await import("./index-yZw-yxuV.js").then((o) => o.i);
272
+ d && nt(), d = n.on(et, async (o) => {
273
+ t(o.data), P.includes(o.data.eventName) ? tt() : o.data.eventName === A && f();
179
274
  });
180
275
  }
181
- function ee(t) {
182
- Z(t);
276
+ function it(e) {
277
+ ot(e);
183
278
  }
184
- var h, _;
185
- class ie {
186
- constructor(e) {
187
- I(this, h);
188
- c(this, "onEvent");
189
- this.onEvent = e.onEvent, Y && (K(e), ee({
190
- onEvent: S(this, h, _).bind(this)
279
+ var h, v;
280
+ class lt {
281
+ constructor(t) {
282
+ g(this, h);
283
+ a(this, "onEvent");
284
+ this.onEvent = t.onEvent, J && (Z(t), it({
285
+ onEvent: w(this, h, v).bind(this)
191
286
  }));
192
287
  }
193
288
  }
194
- h = new WeakSet(), _ = function(e) {
195
- this.onEvent(e);
289
+ h = new WeakSet(), v = function(t) {
290
+ this.onEvent(t);
196
291
  };
197
292
  export {
198
- ne as ConsentBox,
199
- oe as SoyioTypes,
200
- ie as SoyioWidget,
201
- ie as default
293
+ at as ConsentBox,
294
+ rt as SoyioTypes,
295
+ lt as SoyioWidget,
296
+ lt as default
202
297
  };
@@ -1,4 +1,4 @@
1
- (function(D,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(D=typeof globalThis<"u"?globalThis:D||self,N(D["soyio-widget"]={}))})(this,function(D){"use strict";var At=Object.defineProperty;var Rt=(D,N,H)=>N in D?At(D,N,{enumerable:!0,configurable:!0,writable:!0,value:H}):D[N]=H;var rn=(D,N,H)=>(Rt(D,typeof N!="symbol"?N+"":N,H),H),Dt=(D,N,H)=>{if(!N.has(D))throw TypeError("Cannot "+H)};var Ae=(D,N,H)=>{if(N.has(D))throw TypeError("Cannot add the same private member more than once");N instanceof WeakSet?N.add(D):N.set(D,H)};var Re=(D,N,H)=>(Dt(D,N,"access private method"),H);var gn,De;function N(v,g){for(var x=0;x<g.length;x++){const w=g[x];if(typeof w!="string"&&!Array.isArray(w)){for(const m in w)if(m!=="default"&&!(m in v)){const p=Object.getOwnPropertyDescriptor(w,m);p&&Object.defineProperty(v,m,p.get?p:{enumerable:!0,get:()=>w[m]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}async function H(v,g){if(!v.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const x=await Promise.resolve().then(()=>Dn);try{await x.send(v.contentWindow,"SET_APPEARANCE",{appearance:g})}catch(w){console.error("Failed to send appearance config:",w)}}const Bn="soyio-consent-iframe",_n="https://app.soyio.id",$n="https://sandbox.soyio.id",Ne=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],Te="WIDGET_CLOSED",Ce=420,je=720,ze=500;function Me(){const v=document.getElementById(Bn);v&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),v.remove())}function Le(v){const g=document.querySelector(v);if(!g)throw new Error(`Iframe div container with id '${v}' not found`);if(g.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${v}' must be a <div> element`);const x=g;return x.style.position="relative",x.style.cssText+=`
1
+ (function(A,R){typeof exports=="object"&&typeof module<"u"?R(exports):typeof define=="function"&&define.amd?define(["exports"],R):(A=typeof globalThis<"u"?globalThis:A||self,R(A["soyio-widget"]={}))})(this,function(A){"use strict";var Nn=Object.defineProperty;var Dn=(A,R,H)=>R in A?Nn(A,R,{enumerable:!0,configurable:!0,writable:!0,value:H}):A[R]=H;var k=(A,R,H)=>(Dn(A,typeof R!="symbol"?R+"":R,H),H),jn=(A,R,H)=>{if(!R.has(A))throw TypeError("Cannot "+H)};var Ct=(A,R,H)=>{if(R.has(A))throw TypeError("Cannot add the same private member more than once");R instanceof WeakSet?R.add(A):R.set(A,H)};var Tt=(A,R,H)=>(jn(A,R,"access private method"),H);var me,Ot;function R(p,v){for(var w=0;w<v.length;w++){const m=v[w];if(typeof m!="string"&&!Array.isArray(m)){for(const g in m)if(g!=="default"&&!(g in p)){const y=Object.getOwnPropertyDescriptor(m,g);y&&Object.defineProperty(p,g,y.get?y:{enumerable:!0,get:()=>m[g]})}}}return Object.freeze(Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}))}async function H(p,v,w){if(!p.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const m=await Promise.resolve().then(()=>Ce);try{await m.send(p.contentWindow,"SET_APPEARANCE",{appearance:v,identifier:w})}catch(g){console.error("Failed to send appearance config:",g)}}const Fe="https://app.soyio.id",Ue="https://sandbox.soyio.id",At=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE"],Rt="WIDGET_CLOSED",Nt=420,Dt=720,jt=500;function zt(p){const v=document.getElementById(p);v&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),v.remove())}function Mt(p){const v=document.querySelector(p);if(!v)throw new Error(`Iframe div container with id '${p}' not found`);if(v.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${p}' must be a <div> element`);const w=v;return w.style.position="relative",w.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
- `,x}function He(v){const g=document.createElement("iframe");return g.id=Bn,g.src=v,g.style.cssText+=`
10
+ `,w}function Lt(p,v){const w=document.createElement("iframe");return w.id=v,w.src=p,w.style.cssText+=`
11
11
  width: 100% !important;
12
12
  min-width: 25rem !important;
13
13
  max-width: 36rem !important;
@@ -17,24 +17,48 @@
17
17
  opacity: 1;
18
18
  transition: height 0.35s,
19
19
  opacity 0.4s 0.1s;
20
- `,g}function Fe(v){const g=v.isSandbox??!1,x=v.developmentUrl||(g?$n:_n),w=new URLSearchParams;v.actionToken&&w.set("actionToken",v.actionToken);const m=w.toString();return`${x}/embed/consents/${v.consentTemplateId}${m?`?${m}`:""}`}const Ue="IFRAME_READY",Ge="CONSENT_STATE_CHANGE",Be="IFRAME_HEIGHT_CHANGE";let on=null,an=null,un=null;function kn(){on==null||on.cancel(),on=null,an==null||an.cancel(),an=null,un==null||un.cancel(),un=null}async function _e(v){const{onHeightChange:g,onIframeReady:x,onStateChange:w}=v,m=await Promise.resolve().then(()=>Dn);kn(),on=m.on(Be,async p=>{const W=p.data;g(W.height)}),an=m.on(Ue,async()=>{x()}),un=m.on(Ge,async p=>{const W=p.data;w(W)})}class $e{constructor(g){rn(this,"appearance");rn(this,"options");rn(this,"iframe",null);rn(this,"state",{isSelected:!1,actionToken:null});this.options=g,this.appearance=g.appearance||null,_e({onHeightChange:this.handleHeightChange.bind(this),onIframeReady:this.handleIframeReady.bind(this),onStateChange:this.handleStateChange.bind(this)})}handleHeightChange(g){this.iframe&&(this.iframe.style.height=`${g}px`)}async handleIframeReady(){!this.iframe||!this.appearance||await H(this.iframe,this.appearance)}handleStateChange(g){const{isSelected:x,actionToken:w}=g;this.state={isSelected:x,actionToken:w},this.options.onEvent({eventName:"CONSENT_CHECKBOX_CHANGE",isSelected:x,actionToken:w})}mount(g){Me();const x=Le(g),w=Fe(this.options);return this.iframe=He(w),x.appendChild(this.iframe),this}unmount(){kn(),this.iframe&&(this.iframe.remove(),this.iframe=null)}getState(){return{...this.state}}}const ke=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function qe(v){let g="widget/";return"disclosureRequestId"in v.configProps?g+=["disclosures",v.configProps.disclosureRequestId].join("/"):g+=v.request,g}function Je(v){const g=v.isSandbox??!1,x=v.developmentUrl||(g?$n:_n),w=Object.entries(v.configProps).filter(([p,W])=>W||p==="disclosureRequestId").map(([p,W])=>`${p}=${encodeURIComponent(W)}`).join("&"),m=qe(v);return`${x}/${m}?sdk=web&${w}`}const Ze=!!(typeof window<"u"&&window.document&&window.document.createElement);let q=null,On=null;function An(v=null){q&&!q.closed&&q.focus(),v==null||v.preventDefault()}function Rn(){document.body.style.filter="",document.body.removeEventListener("click",An)}function Ye(){On=setInterval(()=>{(!q||q.closed)&&(On&&clearInterval(On),Rn())},ze)}function Ve(v){const g=Je(v),x=Ce,w=je,m=window.screenLeft!==void 0?window.screenLeft:window.screenX,p=window.screenTop!==void 0?window.screenTop:window.screenY,W=window.innerWidth||document.documentElement.clientWidth||window.screen.width,$=window.innerHeight||document.documentElement.clientHeight||window.screen.height,Z=W/window.screen.availWidth,en=(W-x)/2/Z+m,J=($-w)/2/Z+p;document.body.style.filter="blur(5px)",document.body.addEventListener("click",An),q=window.open(g,"Soyio",`scrollbars=yes,
21
- width=${x},
22
- height=${w},
23
- top=${J},
24
- left=${en}`),An(),Ye()}function Xe(){q&&(q.close(),q=null),Rn()}const Ke="WIDGET_EVENT";let cn=null;function Qe(){cn&&(cn.cancel(),cn=null)}async function nt(v){const{onEvent:g}=v,x=await Promise.resolve().then(()=>Dn);cn&&Qe(),cn=x.on(Ke,async w=>{g(w.data),Ne.includes(w.data.eventName)?Xe():w.data.eventName===Te&&Rn()})}function et(v){nt(v)}class qn{constructor(g){Ae(this,gn);rn(this,"onEvent");this.onEvent=g.onEvent,Ze&&(Ve(g),et({onEvent:Re(this,gn,De).bind(this)}))}}gn=new WeakSet,De=function(g){this.onEvent(g)};var tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rt(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var Jn={exports:{}},Zn={exports:{}};(function(v,g){(function(x,w){v.exports=w()})(typeof self<"u"?self:tt,function(){return function(x){var w={};function m(p){if(w[p])return w[p].exports;var W=w[p]={i:p,l:!1,exports:{}};return x[p].call(W.exports,W,W.exports,m),W.l=!0,W.exports}return m.m=x,m.c=w,m.d=function(p,W,$){m.o(p,W)||Object.defineProperty(p,W,{enumerable:!0,get:$})},m.r=function(p){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(p,"__esModule",{value:!0})},m.t=function(p,W){if(1&W&&(p=m(p)),8&W||4&W&&typeof p=="object"&&p&&p.__esModule)return p;var $=Object.create(null);if(m.r($),Object.defineProperty($,"default",{enumerable:!0,value:p}),2&W&&typeof p!="string")for(var Z in p)m.d($,Z,(function(en){return p[en]}).bind(null,Z));return $},m.n=function(p){var W=p&&p.__esModule?function(){return p.default}:function(){return p};return m.d(W,"a",W),W},m.o=function(p,W){return{}.hasOwnProperty.call(p,W)},m.p="",m(m.s=0)}([function(x,w,m){m.r(w),m.d(w,"Promise",function(){return P}),m.d(w,"TYPES",function(){return It}),m.d(w,"ProxyWindow",function(){return G}),m.d(w,"setup",function(){return Oe}),m.d(w,"destroy",function(){return Pt}),m.d(w,"serializeMessage",function(){return St}),m.d(w,"deserializeMessage",function(){return Wt}),m.d(w,"createProxyWindow",function(){return bt}),m.d(w,"toProxyWindow",function(){return xt}),m.d(w,"on",function(){return Y}),m.d(w,"once",function(){return Et}),m.d(w,"send",function(){return V}),m.d(w,"markWindowKnown",function(){return we}),m.d(w,"cleanUpWindow",function(){return Ot}),m.d(w,"bridge",function(){});function p(n){return{}.toString.call(n)==="[object RegExp]"}var W=`Call was rejected by callee.\r
25
- `;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 J(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&&!J(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=$(n);if(!e)throw new Error("Can not read window protocol");if(e==="file:")return"file://";if(e==="about:"){var r=J(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 Sn(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=J(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!==W}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)||J(n)||void 0}function tn(n,t){if(typeof n=="string"){if(typeof t=="string")return n==="*"||t===n;if(p(t)||Array.isArray(t))return!1}return p(n)?p(t)?n.toString()===t.toString():!Array.isArray(t)&&!!t.match(n):!!Array.isArray(n)&&(Array.isArray(t)?JSON.stringify(n)===JSON.stringify(t):!p(t)&&n.some(function(e){return tn(e,t)}))}function Wn(n){try{if(n===window)return!0}catch(t){if(t&&t.message===W)return!0}try{if({}.toString.call(n)==="[object Window]")return!0}catch(t){if(t&&t.message===W)return!0}try{if(window.Window&&n instanceof window.Window)return!0}catch(t){if(t&&t.message===W)return!0}try{if(n&&n.self===n)return!0}catch(t){if(t&&t.message===W)return!0}try{if(n&&n.parent===n)return!0}catch(t){if(t&&t.message===W)return!0}try{if(n&&n.top===n)return!0}catch(t){if(t&&t.message===W)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 Sn(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),!!J(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=[],Nn=0,dn;function te(){if(!Nn&&dn){var n=dn;dn=null,n.resolve()}}function Tn(){Nn+=1}function fn(){Nn-=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;Tn();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,Tn();for(var i=function(h,S){return h.then(function(y){S.resolve(y)},function(y){S.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;Tn();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 Cn=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(Wn(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!Wn(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 k(){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 Cn,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=xn.get(r);return o||(o=typeof r+":"+k(),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 Cn).getOrSet(this,ct):i=i||{};var h;try{h=ie(l)}catch{return n.apply(this,arguments)}var S=f[h];if(S&&o&&Date.now()-S.time<o&&(delete f[h],S=null),S)return S.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: "+vn(o,t+1)}}function ue(n){return typeof n=="string"?n:n&&n.toString&&typeof n.toString=="function"?n.toString():{}.toString.call(n)}hn(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 jn(n){return{}.toString.call(n)==="[object RegExp]"}function wn(n,t,e){if(n.hasOwnProperty(t))return n[t];var r=e();return n[t]=r,r}function ce(){var n=document.body;if(!n)throw new Error("Body element not found");return n}function se(){return!!document.body&&document.readyState==="complete"}function de(){return!!document.body&&document.readyState==="interactive"}hn(function(){return new P(function(n){if(se()||de())return n();var t=setInterval(function(){if(se()||de())return clearInterval(t),n()},10)})});var Pn=typeof document<"u"?document.currentScript:null,dt=hn(function(){if(Pn||(Pn=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 Pn;throw new Error("Can not determine current script")}),ft=k();hn(function(){var n;try{n=dt()}catch{return ft}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=k();return n.setAttribute("data-uid-auto",t),t});function mn(n){n===void 0&&(n=window);var t="__post_robot_10_0_46__";return n!==window?n[t]:n[t]=n[t]||{}}var fe=function(){return{}};function j(n,t){return n===void 0&&(n="store"),t===void 0&&(t=fe),wn(mn(),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 wn(e,r,o)},reset:function(){e=t()},keys:function(){return Object.keys(e)}}})}var lt=function(){};function In(){var n=mn();return n.WINDOW_WILDCARD=n.WINDOW_WILDCARD||new lt,n.WINDOW_WILDCARD}function L(n,t){return n===void 0&&(n="store"),t===void 0&&(t=fe),j("windowStore").getOrSet(n,function(){var e=new Cn,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 wn(r(o),n,i)}}})}function le(){return j("instance").getOrSet("instanceID",k)}function he(n,t){var e=t.domain,r=L("helloPromises"),o=r.get(n);o&&o.resolve({domain:e});var i=P.resolve({domain:e});return r.set(n,i),i}function zn(n,t){return(0,t.send)(n,"postrobot_hello",{instanceID:le()},{domain:"*",timeout:-1}).then(function(e){var r=e.origin,o=e.data.instanceID;return he(n,{domain:r}),{win:n,domain:r,instanceID:o}})}function ve(n,t){var e=t.send;return L("windowInstanceIDPromises").getOrSet(n,function(){return zn(n,{send:e}).then(function(r){return r.instanceID})})}function we(n){L("knownWindows").set(n,!0)}function Mn(n){return typeof n=="object"&&n!==null&&typeof n.__type__=="string"}function me(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 F,ht=((F={}).function=function(){},F.error=function(n){return nn("error",{message:n.message,stack:n.stack,code:n.code,data:n.data})},F.promise=function(){},F.regex=function(n){return nn("regex",n.source)},F.date=function(n){return nn("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 nn("undefined",n)},F),vt={},U,wt=((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+`
20
+ `,w}function Ht(p){const v=p.isSandbox??!1,w=p.developmentUrl||(v?Ue:Fe),m=new URLSearchParams;p.actionToken&&m.set("actionToken",p.actionToken);const g=m.toString();return`${w}/embed/consents/${p.consentTemplateId}${g?`?${g}`:""}`}const Ft="IFRAME_READY",Ut="CONSENT_STATE_CHANGE",Gt="IFRAME_HEIGHT_CHANGE",Bt="TOOLTIP_STATE_CHANGE",_={onHeightChange:{},onIframeReady:{},onStateChange:{},onTooltipChange:{}};let Ge,Be,_e,$e;async function _t(){const p=await Promise.resolve().then(()=>Ce);Ge||Be||_e||$e||(Ge=p.on(Gt,async v=>{const w=v.data,m=_.onHeightChange[w.identifier];if(!m)throw new Error(`No height change listener found for identifier: ${w.identifier}`);m(w.height)}),Be=p.on(Ft,async v=>{const w=v.data,m=_.onIframeReady[w.identifier];if(!m)throw new Error(`No iframe ready listener found for identifier: ${w.identifier}`);m()}),_e=p.on(Ut,async v=>{const w=v.data,m=_.onStateChange[w.identifier];if(!m)throw new Error(`No state change listener found for identifier: ${w.identifier}`);m(w)}),$e=p.on(Bt,async v=>{const w=v.data,m=_.onTooltipChange[w.identifier];if(!m)throw new Error(`No tooltip change listener found for identifier: ${w.identifier}`);m(w)}))}function $t(p,v){const{onHeightChange:w,onIframeReady:m,onStateChange:g,onTooltipChange:y}=v;_.onHeightChange[p]=w,_.onIframeReady[p]=m,_.onStateChange[p]=g,_.onTooltipChange[p]=y}function qt(p){delete _.onHeightChange[p],delete _.onIframeReady[p],delete _.onStateChange[p],delete _.onTooltipChange[p]}class kt{constructor(){k(this,"tooltipElement",null);k(this,"tooltipContent",null);k(this,"tooltipClass","soyio-tooltip");k(this,"hideTimeout",null);this.createTooltipElement(),this.setupGlobalListeners()}createTooltipElement(){const v=document.querySelector(`.${this.tooltipClass}`);v==null||v.remove(),this.tooltipElement=document.createElement("div"),this.tooltipElement.className=this.tooltipClass,this.tooltipElement.style.cssText=`
21
+ position: fixed;
22
+ z-index: 99999;
23
+ background: white;
24
+ padding: 8px 12px;
25
+ border-radius: 4px;
26
+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);
27
+ font-size: 14px;
28
+ max-width: 300px;
29
+ word-wrap: break-word;
30
+ pointer-events: none;
31
+ opacity: 0;
32
+ transition: opacity 0.2s ease-in-out;
33
+ transform: translateX(-50%) translateY(-100%);
34
+ margin-top: -8px;
35
+ `,this.tooltipContent=document.createElement("div"),this.tooltipElement.appendChild(this.tooltipContent);const w=document.createElement("div");w.style.cssText=`
36
+ position: absolute;
37
+ bottom: -4px;
38
+ left: 50%;
39
+ transform: translateX(-50%) rotate(45deg);
40
+ width: 8px;
41
+ height: 8px;
42
+ background: white;
43
+ box-shadow: 2px 2px 2px rgba(0,0,0,0.1);
44
+ `,this.tooltipElement.appendChild(w),document.body.appendChild(this.tooltipElement)}setupGlobalListeners(){window.addEventListener("scroll",()=>this.hide(),!0),window.addEventListener("resize",()=>this.hide()),window.addEventListener("orientationchange",()=>this.hide())}show(v,w,m){!this.tooltipElement||!this.tooltipContent||(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipContent.textContent=v,this.tooltipElement.style.left=`${w}px`,this.tooltipElement.style.top=`${m}px`,this.tooltipElement.style.opacity="1")}hide(){this.tooltipElement&&(this.tooltipElement.style.opacity="0")}destroy(){var v;(v=this.tooltipElement)==null||v.remove(),this.tooltipElement=null,this.tooltipContent=null,this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}}class Jt{constructor(v){k(this,"appearance");k(this,"options");k(this,"tooltipManager");k(this,"iframe",null);k(this,"state",{isSelected:!1,actionToken:null});this.options=v,this.appearance=v.appearance||null,this.tooltipManager=new kt,this.setup()}handleHeightChange(v){this.iframe&&(this.iframe.style.height=`${v}px`)}async handleIframeReady(){!this.iframe||!this.appearance||await H(this.iframe,this.appearance,this.uniqueIdentifier)}handleStateChange(v){const{isSelected:w,actionToken:m}=v;this.state={isSelected:w,actionToken:m},this.options.onEvent({eventName:"CONSENT_CHECKBOX_CHANGE",isSelected:w,actionToken:m})}async setup(){await _t(),$t(this.uniqueIdentifier,{onHeightChange:this.handleHeightChange.bind(this),onIframeReady:this.handleIframeReady.bind(this),onStateChange:this.handleStateChange.bind(this),onTooltipChange:this.handleTooltipChange.bind(this)})}handleTooltipChange(v){if(!this.iframe)return;const w=this.iframe.getBoundingClientRect(),{text:m,coordinates:g,isVisible:y}=v,b=g.x+w.left,F=g.y+w.top;y?this.tooltipManager.show(m,b,F):this.tooltipManager.hide()}mount(v){zt(this.iframeIdentifier);const w=Mt(v),m=Ht(this.options);return this.iframe=Lt(m,this.iframeIdentifier),w.appendChild(this.iframe),this}unmount(){qt(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 Yt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Zt(p){let v="widget/";return"disclosureRequestId"in p.configProps?v+=["disclosures",p.configProps.disclosureRequestId].join("/"):v+=p.request,v}function Vt(p){const v=p.isSandbox??!1,w=p.developmentUrl||(v?Ue:Fe),m=Object.entries(p.configProps).filter(([y,b])=>b||y==="disclosureRequestId").map(([y,b])=>`${y}=${encodeURIComponent(b)}`).join("&"),g=Zt(p);return`${w}/${g}?sdk=web&${m}`}const Xt=!!(typeof window<"u"&&window.document&&window.document.createElement);let Y=null,We=null;function Ie(p=null){Y&&!Y.closed&&Y.focus(),p==null||p.preventDefault()}function Pe(){document.body.style.filter="",document.body.removeEventListener("click",Ie)}function Kt(){We=setInterval(()=>{(!Y||Y.closed)&&(We&&clearInterval(We),Pe())},jt)}function Qt(p){const v=Vt(p),w=Nt,m=Dt,g=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,F=window.innerHeight||document.documentElement.clientHeight||window.screen.height,V=b/window.screen.availWidth,re=(b-w)/2/V+g,Z=(F-m)/2/V+y;document.body.style.filter="blur(5px)",document.body.addEventListener("click",Ie),Y=window.open(v,"Soyio",`scrollbars=yes,
45
+ width=${w},
46
+ height=${m},
47
+ top=${Z},
48
+ left=${re}`),Ie(),Kt()}function en(){Y&&(Y.close(),Y=null),Pe()}const tn="WIDGET_EVENT";let ie=null;function nn(){ie&&(ie.cancel(),ie=null)}async function rn(p){const{onEvent:v}=p,w=await Promise.resolve().then(()=>Ce);ie&&nn(),ie=w.on(tn,async m=>{v(m.data),At.includes(m.data.eventName)?en():m.data.eventName===Rt&&Pe()})}function on(p){rn(p)}class qe{constructor(v){Ct(this,me);k(this,"onEvent");this.onEvent=v.onEvent,Xt&&(Qt(v),on({onEvent:Tt(this,me,Ot).bind(this)}))}}me=new WeakSet,Ot=function(v){this.onEvent(v)};var an=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sn(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}var ke={exports:{}},Je={exports:{}};(function(p,v){(function(w,m){p.exports=m()})(typeof self<"u"?self:an,function(){return function(w){var m={};function g(y){if(m[y])return m[y].exports;var b=m[y]={i:y,l:!1,exports:{}};return w[y].call(b.exports,b,b.exports,g),b.l=!0,b.exports}return g.m=w,g.c=m,g.d=function(y,b,F){g.o(y,b)||Object.defineProperty(y,b,{enumerable:!0,get:F})},g.r=function(y){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(y,"__esModule",{value:!0})},g.t=function(y,b){if(1&b&&(y=g(y)),8&b||4&b&&typeof y=="object"&&y&&y.__esModule)return y;var F=Object.create(null);if(g.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:y}),2&b&&typeof y!="string")for(var V in y)g.d(F,V,(function(re){return y[re]}).bind(null,V));return F},g.n=function(y){var b=y&&y.__esModule?function(){return y.default}:function(){return y};return g.d(b,"a",b),b},g.o=function(y,b){return{}.hasOwnProperty.call(y,b)},g.p="",g(g.s=0)}([function(w,m,g){g.r(m),g.d(m,"Promise",function(){return I}),g.d(m,"TYPES",function(){return An}),g.d(m,"ProxyWindow",function(){return B}),g.d(m,"setup",function(){return Pt}),g.d(m,"destroy",function(){return On}),g.d(m,"serializeMessage",function(){return In}),g.d(m,"deserializeMessage",function(){return Pn}),g.d(m,"createProxyWindow",function(){return Cn}),g.d(m,"toProxyWindow",function(){return Tn}),g.d(m,"on",function(){return X}),g.d(m,"once",function(){return Wn}),g.d(m,"send",function(){return K}),g.d(m,"markWindowKnown",function(){return pt}),g.d(m,"cleanUpWindow",function(){return Rn}),g.d(m,"bridge",function(){});function y(e){return{}.toString.call(e)==="[object RegExp]"}var b=`Call was rejected by callee.\r
49
+ `;function F(e){return e===void 0&&(e=window),e.location.protocol}function V(e){if(e===void 0&&(e=window),e.mockDomain){var n=e.mockDomain.split("//")[0];if(n)return n}return F(e)}function re(e){return e===void 0&&(e=window),V(e)==="about:"}function Z(e){if(e===void 0&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch{}}function Ze(e){if(e===void 0&&(e=window),e&&!Z(e))try{return e.opener}catch{}}function ve(e){try{return!0}catch{}return!1}function we(e){e===void 0&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var t=F(e);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=Z(e);return r&&ve()?we(r):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function M(e){e===void 0&&(e=window);var n=we(e);return n&&e.mockDomain&&e.mockDomain.indexOf("mock:")===0?e.mockDomain:n}function Q(e){if(!function(n){try{if(n===window)return!0}catch{}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&t.enumerable===!1)return!1}catch{}try{if(re(n)&&ve())return!0}catch{}try{if(function(r){return r===void 0&&(r=window),V(r)==="mock:"}(n)&&ve())return!0}catch{}try{if(we(n)===we(window))return!0}catch{}return!1}(e))return!1;try{if(e===window||re(e)&&ve()||M(window)===M(e))return!0}catch{}return!1}function ge(e){if(!Q(e))throw new Error("Expected window to be same domain");return e}function Ve(e,n){if(!e||!n)return!1;var t=Z(n);return t?t===e:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch{}return o}(n).indexOf(e)!==-1}function Xe(e){var n=[],t;try{t=e.frames}catch{t=e}var r;try{r=t.length}catch{}if(r===0)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch{continue}n.push(i)}return n}for(var a=0;a<100;a++){var c=void 0;try{c=t[a]}catch{return n}if(!c)return n;n.push(c)}return n}var cn=[],dn=[];function $(e,n){n===void 0&&(n=!0);try{if(e===window)return!1}catch{return!0}try{if(!e)return!0}catch{return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==b}if(n&&Q(e))try{if(e.mockclosed)return!0}catch{}try{if(!e.parent||!e.top)return!0}catch{}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch{}return-1}(cn,e);if(t!==-1){var r=dn[t];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 Ke(e){return e===void 0&&(e=window),Ze(e=e||window)||Z(e)||void 0}function oe(e,n){if(typeof e=="string"){if(typeof n=="string")return e==="*"||n===e;if(y(n)||Array.isArray(n))return!1}return y(e)?y(n)?e.toString()===n.toString():!Array.isArray(n)&&!!n.match(e):!!Array.isArray(e)&&(Array.isArray(n)?JSON.stringify(e)===JSON.stringify(n):!y(n)&&e.some(function(t){return oe(t,n)}))}function ye(e){try{if(e===window)return!0}catch(n){if(n&&n.message===b)return!0}try{if({}.toString.call(e)==="[object Window]")return!0}catch(n){if(n&&n.message===b)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(n){if(n&&n.message===b)return!0}try{if(e&&e.self===e)return!0}catch(n){if(n&&n.message===b)return!0}try{if(e&&e.parent===e)return!0}catch(n){if(n&&n.message===b)return!0}try{if(e&&e.top===e)return!0}catch(n){if(n&&n.message===b)return!0}try{if(e&&e.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch{}return!1}function Qe(e){if(Q(e))return ge(e).frameElement;for(var n=0,t=document.querySelectorAll("iframe");n<t.length;n++){var r=t[n];if(r&&r.contentWindow&&r.contentWindow===e)return r}}function fn(e){if(function(t){return t===void 0&&(t=window),!!Z(t)}(e)){var n=Qe(e);if(n&&n.parentElement){n.parentElement.removeChild(n);return}}try{e.close()}catch{}}function ee(e){try{if(!e)return!1;if(typeof Promise<"u"&&e instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&e instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var t=n.call(e);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof e.then=="function")return!0}catch{return!1}return!1}var et=[],ae=[],Te=0,se;function tt(){if(!Te&&se){var e=se;se=null,e.resolve()}}function Oe(){Te+=1}function ue(){Te-=1,tt()}var I=function(){function e(t){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=[],t){var o,i,a=!1,c=!1,u=!1;Oe();try{t(function(s){u?r.resolve(s):(a=!0,o=s)},function(s){u?r.reject(s):(c=!0,i=s)})}catch(s){ue(),this.reject(s);return}ue(),u=!0,a?this.resolve(o):c&&this.reject(i)}}var n=e.prototype;return n.resolve=function(t){if(this.resolved||this.rejected)return this;if(ee(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},n.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(ee(t))throw new Error("Can not reject promise with another promise");if(!t){var o=t&&typeof t.toString=="function"?t.toString():{}.toString.call(t);t=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=t,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(et.indexOf(i)===-1){et.push(i),setTimeout(function(){throw i},1);for(var c=0;c<ae.length;c++)ae[c](i,a)}}(t,r)},1),this.dispatch(),this},n.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},n.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,Oe();for(var i=function(h,x){return h.then(function(E){x.resolve(E)},function(E){x.reject(E)})},a=0;a<o.length;a++){var c=o[a],u=c.onSuccess,s=c.onError,l=c.promise,d=void 0;if(t)try{d=u?u(this.value):this.value}catch(h){l.reject(h);continue}else if(r){if(!s){l.reject(this.error);continue}try{d=s(this.error)}catch(h){l.reject(h);continue}}if(d instanceof e&&(d.resolved||d.rejected)){var f=d;f.resolved?l.resolve(f.value):l.reject(f.error),f.errorHandled=!0}else ee(d)?d instanceof e&&(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,ue()}},n.then=function(t,r){if(t&&typeof t!="function"&&!t.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 e;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},n.catch=function(t){return this.then(void 0,t)},n.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(t).then(function(){return r})},function(r){return e.try(t).then(function(){throw r})})},n.timeout=function(t,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 "+t+"ms"))},t);return this.then(function(a){return clearTimeout(i),a})},n.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:ee(t)?new e(function(r,o){return t.then(r,o)}):new e().resolve(t)},e.reject=function(t){return new e().reject(t)},e.asyncReject=function(t){return new e().asyncReject(t)},e.all=function(t){var r=new e,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(s,l,d){return l.then(function(f){i[s]=f,(o-=1)==0&&r.resolve(i)},function(f){d.reject(f)})},c=0;c<t.length;c++){var u=t[c];if(u instanceof e){if(u.resolved){i[c]=u.value,o-=1;continue}}else if(!ee(u)){i[c]=u,o-=1;continue}a(c,e.resolve(u),r)}return o===0&&r.resolve(i),r},e.hash=function(t){var r={},o=[],i=function(c){if(t.hasOwnProperty(c)){var u=t[c];ee(u)?o.push(u.then(function(s){r[c]=s})):r[c]=u}};for(var a in t)i(a);return e.all(o).then(function(){return r})},e.map=function(t,r){return e.all(t.map(r))},e.onPossiblyUnhandledException=function(t){return function(r){return ae.push(r),{cancel:function(){ae.splice(ae.indexOf(r),1)}}}(t)},e.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;Oe();try{i=t.apply(r,o||[])}catch(a){return ue(),e.reject(a)}return ue(),e.resolve(i)},e.delay=function(t){return new e(function(r){setTimeout(r,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||ee(t)},e.flush=function(){return function(t){var r=se=se||new t;return tt(),r}(e)},e}();function Ee(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch{}return-1}var Ae=function(){function e(){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 t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var n=e.prototype;return n._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(ye(i)&&$(i)){if(t)try{t.delete(i)}catch{}r.splice(o,1),this.values.splice(o,1),o-=1}}},n.isSafeToReadWrite=function(t){return!ye(t)},n.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch{}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=Ee(c,t);s===-1?(c.push(t),u.push(r)):u[s]=r},n.get=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return r.get(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch{}this._cleanupClosedWindows();var i=Ee(this.keys,t);if(i!==-1)return this.values[i]},n.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch{}this._cleanupClosedWindows();var i=this.keys,a=Ee(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},n.has=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch{}return this._cleanupClosedWindows(),Ee(this.keys,t)!==-1},n.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},e}();function nt(e){return e.name||e.__name__||e.displayName||"anonymous"}function rt(e,n){try{delete e.name,e.name=n}catch{}return e.__name__=e.displayName=n,e}function J(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+function(n){if(typeof btoa=="function")return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(n,"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 Se;function ot(e){try{return JSON.stringify([].slice.call(e),function(n,t){return typeof t=="function"?"memoize["+function(r){if(Se=Se||new Ae,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Se.get(r);return o||(o=typeof r+":"+J(),Se.set(r,o)),o}(t)+"]":typeof window<"u"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function ln(){return{}}var ce=0,it=0;function de(e,n){n===void 0&&(n={});var t=n.thisNamespace,r=t!==void 0&&t,o=n.time,i,a,c=ce;ce+=1;var u=function(){for(var s=arguments.length,l=new Array(s),d=0;d<s;d++)l[d]=arguments[d];c<it&&(i=null,a=null,c=ce,ce+=1);var f;f=r?(a=a||new Ae).getOrSet(this,ln):i=i||{};var h;try{h=ot(l)}catch{return e.apply(this,arguments)}var x=f[h];if(x&&o&&Date.now()-x.time<o&&(delete f[h],x=null),x)return x.value;var E=Date.now(),S=e.apply(this,arguments);return f[h]={time:E,value:S},S};return u.reset=function(){i=null,a=null},rt(u,(n.name||nt(e))+"::memoized")}de.clear=function(){it=ce};function hn(e){var n={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),c=0;c<i;c++)a[c]=arguments[c];var u=ot(a);return n.hasOwnProperty(u)||(n[u]=I.try(function(){return e.apply(o,r)}).finally(function(){delete n[u]})),n[u]}return t.reset=function(){n={}},rt(t,nt(e)+"::promiseMemoized")}function te(){}function fe(e,n){if(n===void 0&&(n=1),n>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if(typeof e=="string")return e;if(e instanceof Error){var t=e&&e.stack,r=e&&e.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
50
+ `+t;if(t)return t;if(r)return r}return e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}catch(o){return"Error while stringifying error: "+fe(o,n+1)}}function at(e){return typeof e=="string"?e:e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}de(function(e){if(Object.values)return Object.values(e);var n=[];for(var t in e)e.hasOwnProperty(t)&&n.push(e[t]);return n});function Re(e){return{}.toString.call(e)==="[object RegExp]"}function le(e,n,t){if(e.hasOwnProperty(n))return e[n];var r=t();return e[n]=r,r}function st(){var e=document.body;if(!e)throw new Error("Body element not found");return e}function ut(){return!!document.body&&document.readyState==="complete"}function ct(){return!!document.body&&document.readyState==="interactive"}de(function(){return new I(function(e){if(ut()||ct())return e();var n=setInterval(function(){if(ut()||ct())return clearInterval(n),e()},10)})});var xe=typeof document<"u"?document.currentScript:null,pn=de(function(){if(xe||(xe=function(){try{var e=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),n=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),t=n&&n[1];if(!t)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===t)return i}}catch{}}()))return xe;throw new Error("Can not determine current script")}),mn=J();de(function(){var e;try{e=pn()}catch{return mn}var n=e.getAttribute("data-uid");if(n&&typeof n=="string"||(n=e.getAttribute("data-uid-auto"))&&typeof n=="string")return n;if(e.src){var t=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:e.src,dataset:e.dataset}));n="uid_"+t.slice(t.length-30)}else n=J();return e.setAttribute("data-uid-auto",n),n});function he(e){e===void 0&&(e=window);var n="__post_robot_10_0_46__";return e!==window?e[n]:e[n]=e[n]||{}}var dt=function(){return{}};function j(e,n){return e===void 0&&(e="store"),n===void 0&&(n=dt),le(he(),e,function(){var t=n();return{has:function(r){return t.hasOwnProperty(r)},get:function(r,o){return t.hasOwnProperty(r)?t[r]:o},set:function(r,o){return t[r]=o,o},del:function(r){delete t[r]},getOrSet:function(r,o){return le(t,r,o)},reset:function(){t=n()},keys:function(){return Object.keys(t)}}})}var vn=function(){};function be(){var e=he();return e.WINDOW_WILDCARD=e.WINDOW_WILDCARD||new vn,e.WINDOW_WILDCARD}function L(e,n){return e===void 0&&(e="store"),n===void 0&&(n=dt),j("windowStore").getOrSet(e,function(){var t=new Ae,r=function(o){return t.getOrSet(o,n)};return{has:function(o){return r(o).hasOwnProperty(e)},get:function(o,i){var a=r(o);return a.hasOwnProperty(e)?a[e]:i},set:function(o,i){return r(o)[e]=i,i},del:function(o){delete r(o)[e]},getOrSet:function(o,i){return le(r(o),e,i)}}})}function ft(){return j("instance").getOrSet("instanceID",J)}function lt(e,n){var t=n.domain,r=L("helloPromises"),o=r.get(e);o&&o.resolve({domain:t});var i=I.resolve({domain:t});return r.set(e,i),i}function Ne(e,n){return(0,n.send)(e,"postrobot_hello",{instanceID:ft()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,o=t.data.instanceID;return lt(e,{domain:r}),{win:e,domain:r,instanceID:o}})}function ht(e,n){var t=n.send;return L("windowInstanceIDPromises").getOrSet(e,function(){return Ne(e,{send:t}).then(function(r){return r.instanceID})})}function pt(e){L("knownWindows").set(e,!0)}function De(e){return typeof e=="object"&&e!==null&&typeof e.__type__=="string"}function mt(e){return e===void 0?"undefined":e===null?"null":Array.isArray(e)?"array":typeof e=="function"?"function":typeof e=="object"?e instanceof Error?"error":typeof e.then=="function"?"promise":{}.toString.call(e)==="[object RegExp]"?"regex":{}.toString.call(e)==="[object Date]"?"date":"object":typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":void 0}function ne(e,n){return{__type__:e,__val__:n}}var U,wn=((U={}).function=function(){},U.error=function(e){return ne("error",{message:e.message,stack:e.stack,code:e.code,data:e.data})},U.promise=function(){},U.regex=function(e){return ne("regex",e.source)},U.date=function(e){return ne("date",e.toJSON())},U.array=function(e){return e},U.object=function(e){return e},U.string=function(e){return e},U.number=function(e){return e},U.boolean=function(e){return e},U.null=function(e){return e},U[void 0]=function(e){return ne("undefined",e)},U),gn={},G,yn=((G={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},G.error=function(e){var n=e.stack,t=e.code,r=e.data,o=new Error(e.message);return o.code=t,r&&(o.data=r),o.stack=n+`
27
51
 
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),mt={};new P(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 Ln(){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 pe(n,t){var e=t.send,r=t.id,o=r===void 0?k():r,i=n.then(function(c){if(X(c))return Sn(c).name}),a=n.then(function(c){if(B(c))throw new Error("Window is closed, can not determine type");return Vn(c)?"popup":"iframe"});i.catch(Q),a.catch(Q);var s=function(){return n.then(function(c){if(!B(c))return X(c)?Sn(c).name:i})};return{id:o,getType:function(){return a},getInstanceID:st(function(){return n.then(function(c){return ve(c,{send:e})})}),close:function(){return n.then(ut)},getName:s,focus:function(){return n.then(function(c){c.focus()})},isClosed:function(){return n.then(function(c){return B(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,S=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(y){if(!y)throw new Error("Can not post to window without target name");(function(E){var I=E.url,C=E.target,A=E.body,O=E.method,z=O===void 0?"post":O,b=document.createElement("form");if(b.setAttribute("target",C),b.setAttribute("method",z),b.setAttribute("action",I),b.style.display="none",A)for(var R=0,_=Object.keys(A);R<_.length;R++){var T,pn=_[R],Gn=document.createElement("input");Gn.setAttribute("name",pn),Gn.setAttribute("value",(T=A[pn])==null?void 0:T.toString()),b.appendChild(Gn)}ce().appendChild(b),b.submit(),ce().removeChild(b)})({url:c,target:y,method:h,body:S})});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=ne(u);if(!l)throw new Error("Can not set name for cross-domain window: "+c);Sn(u).name=c,d&&d.setAttribute("name",c),i=P.resolve(c)})}}}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 P,this.serializedWindow=i||pe(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=P.hash({isPopup:r,name:o}).then(function(s){var c=s.name;s.isPopup&&c&&window.open("",c,"noopener")}),a=this.serializedWindow.focus();return P.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=pe(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 P.try(function(){return o.actualWindow?e===o.actualWindow:P.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:ve(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&&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 Ln(),n.toProxyWindow(e,{send:o}).serialize()},n.deserialize=function(e,r){var o=r.send;return Ln(),j("idToProxyWindow").get(e.id)||new n({serializedWindow:e,send:o})},n.isProxyWindow=function(e){return!!(e&&!Wn(e)&&e.isProxyWindow)},n.toProxyWindow=function(e,r){var o=r.send;if(Ln(),n.isProxyWindow(e))return e;var i=e;return L("winToProxyWindow").get(i)||new n({win:i,send:o})},n}();function Hn(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 ge(n,t){var e=L("methodStore"),r=j("proxyWindowMethods");return e.getOrSet(n,function(){return{}})[t]||r.get(t)}function ye(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,S=h.id,y=h.name,E=ge(d,S);if(!E)throw new Error("Could not find method '"+y+"' with id: "+h.id+" in "+M(window));var I=E.source,C=E.domain,A=E.val;return P.try(function(){if(!tn(C,f))throw new Error("Method '"+h.name+"' domain "+JSON.stringify(jn(E.domain)?E.domain.source:E.domain)+" does not match origin "+f+" in "+M(window));if(G.isProxyWindow(I))return I.matchWindow(d,{send:s}).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 A.apply({source:d,origin:f},h.args)},function(O){return P.try(function(){if(A.onError)return A.onError(O)}).then(function(){throw O.stack&&(O.stack="Remote call to "+y+"("+function(z){return z===void 0&&(z=[]),(b=z,[].slice.call(b)).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 b}(h.args)+`) failed
52
+ `+o.stack,o},G.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},G.regex=function(e){return new RegExp(e)},G.date=function(e){return new Date(e)},G.array=function(e){return e},G.object=function(e){return e},G.string=function(e){return e},G.number=function(e){return e},G.boolean=function(e){return e},G.null=function(e){return e},G[void 0]=function(){},G),En={};new I(function(e){if(window.document&&window.document.body)return e(window.document.body);var n=setInterval(function(){if(window.document&&window.document.body)return clearInterval(n),e(window.document.body)},10)});function je(){for(var e=j("idToProxyWindow"),n=0,t=e.keys();n<t.length;n++){var r=t[n];e.get(r).shouldClean()&&e.del(r)}}function vt(e,n){var t=n.send,r=n.id,o=r===void 0?J():r,i=e.then(function(u){if(Q(u))return ge(u).name}),a=e.then(function(u){if($(u))throw new Error("Window is closed, can not determine type");return Ze(u)?"popup":"iframe"});i.catch(te),a.catch(te);var c=function(){return e.then(function(u){if(!$(u))return Q(u)?ge(u).name:i})};return{id:o,getType:function(){return a},getInstanceID:hn(function(){return e.then(function(u){return ht(u,{send:t})})}),close:function(){return e.then(fn)},getName:c,focus:function(){return e.then(function(u){u.focus()})},isClosed:function(){return e.then(function(u){return $(u)})},setLocation:function(u,s){return s===void 0&&(s={}),e.then(function(l){var d=window.location.protocol+"//"+window.location.host,f=s.method,h=f===void 0?"get":f,x=s.body;if(u.indexOf("/")===0)u=""+d+u;else if(!u.match(/^https?:\/\//)&&u.indexOf(d)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(u));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,D=S.target,T=S.body,C=S.method,z=C===void 0?"post":C,W=document.createElement("form");if(W.setAttribute("target",D),W.setAttribute("method",z),W.setAttribute("action",P),W.style.display="none",T)for(var O=0,q=Object.keys(T);O<q.length;O++){var N,pe=q[O],He=document.createElement("input");He.setAttribute("name",pe),He.setAttribute("value",(N=T[pe])==null?void 0:N.toString()),W.appendChild(He)}st().appendChild(W),W.submit(),st().removeChild(W)})({url:u,target:E,method:h,body:x})});if(h!=="get")throw new Error("Unsupported method: "+h);if(Q(l))try{if(l.location&&typeof l.location.replace=="function"){l.location.replace(u);return}}catch{}l.location=u})},setName:function(u){return e.then(function(s){var l=Q(s),d=Qe(s);if(!l)throw new Error("Can not set name for cross-domain window: "+u);ge(s).name=u,d&&d.setAttribute("name",u),i=I.resolve(u)})}}}var B=function(){function e(t){var r=t.send,o=t.win,i=t.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||vt(this.actualWindowPromise,{send:r}),j("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:r})}var n=e.prototype;return n.getID=function(){return this.serializedWindow.id},n.getType=function(){return this.serializedWindow.getType()},n.isPopup=function(){return this.getType().then(function(t){return t==="popup"})},n.setLocation=function(t,r){var o=this;return this.serializedWindow.setLocation(t,r).then(function(){return o})},n.getName=function(){return this.serializedWindow.getName()},n.setName=function(t){var r=this;return this.serializedWindow.setName(t).then(function(){return r})},n.close=function(){var t=this;return this.serializedWindow.close().then(function(){return t})},n.focus=function(){var t=this,r=this.isPopup(),o=this.getName(),i=I.hash({isPopup:r,name:o}).then(function(c){var u=c.name;c.isPopup&&u&&window.open("",u,"noopener")}),a=this.serializedWindow.focus();return I.all([i,a]).then(function(){return t})},n.isClosed=function(){return this.serializedWindow.isClosed()},n.getWindow=function(){return this.actualWindow},n.setWindow=function(t,r){var o=r.send;this.actualWindow=t,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=vt(this.actualWindowPromise,{send:o,id:this.getID()}),L("winToProxyWindow").set(t,this)},n.awaitWindow=function(){return this.actualWindowPromise},n.matchWindow=function(t,r){var o=this,i=r.send;return I.try(function(){return o.actualWindow?t===o.actualWindow:I.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:ht(t,{send:i})}).then(function(a){var c=a.proxyInstanceID===a.knownWindowInstanceID;return c&&o.setWindow(t,{send:i}),c})})},n.unwrap=function(){return this.actualWindow||this},n.getInstanceID=function(){return this.serializedWindow.getInstanceID()},n.shouldClean=function(){return!!(this.actualWindow&&$(this.actualWindow))},n.serialize=function(){return this.serializedWindow},e.unwrap=function(t){return e.isProxyWindow(t)?t.unwrap():t},e.serialize=function(t,r){var o=r.send;return je(),e.toProxyWindow(t,{send:o}).serialize()},e.deserialize=function(t,r){var o=r.send;return je(),j("idToProxyWindow").get(t.id)||new e({serializedWindow:t,send:o})},e.isProxyWindow=function(t){return!!(t&&!ye(t)&&t.isProxyWindow)},e.toProxyWindow=function(t,r){var o=r.send;if(je(),e.isProxyWindow(t))return t;var i=t;return L("winToProxyWindow").get(i)||new e({win:i,send:o})},e}();function ze(e,n,t,r,o){var i=L("methodStore"),a=j("proxyWindowMethods");B.isProxyWindow(r)?a.set(e,{val:n,name:t,domain:o,source:r}):(a.del(e),i.getOrSet(r,function(){return{}})[e]={domain:o,name:t,val:n,source:r})}function wt(e,n){var t=L("methodStore"),r=j("proxyWindowMethods");return t.getOrSet(e,function(){return{}})[n]||r.get(n)}function gt(e,n,t,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,x=h.id,E=h.name,S=wt(d,x);if(!S)throw new Error("Could not find method '"+E+"' with id: "+h.id+" in "+M(window));var P=S.source,D=S.domain,T=S.val;return I.try(function(){if(!oe(D,f))throw new Error("Method '"+h.name+"' domain "+JSON.stringify(Re(S.domain)?S.domain.source:S.domain)+" does not match origin "+f+" in "+M(window));if(B.isProxyWindow(P))return P.matchWindow(d,{send:c}).then(function(C){if(!C)throw new Error("Method call '"+h.name+"' failed - proxy window does not match source in "+M(window))})}).then(function(){return T.apply({source:d,origin:f},h.args)},function(C){return I.try(function(){if(T.onError)return T.onError(C)}).then(function(){throw C.stack&&(C.stack="Remote call to "+E+"("+function(z){return z===void 0&&(z=[]),(W=z,[].slice.call(W)).map(function(O){return typeof O=="string"?"'"+O+"'":O===void 0?"undefined":O===null?"null":typeof O=="boolean"?O.toString():Array.isArray(O)?"[ ... ]":typeof O=="object"?"{ ... }":typeof O=="function"?"() => { ... }":"<"+typeof O+">"}).join(", ");var W}(h.args)+`) failed
29
53
 
30
- `+O.stack),O})}).then(function(O){return{result:O,id:S,name:y}})})});var i,a,s,c=e.__id__||k();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)?(Hn(c,e,u,n,t),n.awaitWindow().then(function(l){Hn(c,e,u,l,t)})):Hn(c,e,u,n,t),nn("cross_domain_function",{id:c,name:u})}function Ee(n,t,e,r){var o,i=r.on,a=r.send;return function(s,c){c===void 0&&(c=vt);var u=JSON.stringify(s,function(l){var d=this[l];if(Mn(this))return d;var f=me(d);if(!f)return d;var h=c[f]||ht[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:ye(u,l,function(S,y){return d.then(S,y)},f,{on:h.on,send:h.send})})}(n,t,s,c,{on:i,send:a})},o.function=function(s,c){return ye(n,t,s,c,{on:i,send:a})},o.object=function(s){return Wn(s)||G.isProxyWindow(s)?nn("cross_domain_window",G.serialize(s,{send:a})):s},o))}function Se(n,t,e,r){var o,i=r.send;return function(a,s){if(s===void 0&&(s=mt),a!=="undefined")return JSON.parse(a,function(c,u){if(Mn(this))return u;var l,d;if(Mn(u)?(l=u.__type__,d=u.__val__):(l=me(u),d=u),!l)return d;var f=s[l]||wt[l];return f?f(d,c):d})}(e,((o={}).cross_domain_zalgo_promise=function(a){return function(s,c,u){return new P(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,S=function(E){E===void 0&&(E={});function I(){var C=arguments;return G.toProxyWindow(s,{send:h}).awaitWindow().then(function(A){var O=ge(A,d);if(O&&O.val!==I)return O.val.apply({source:window,origin:M()},C);var z=[].slice.call(C);return E.fireAndForget?h(A,"postrobot_method",{id:d,name:f,args:z},{domain:c,fireAndForget:!0}):h(A,"postrobot_method",{id:d,name:f,args:z},{domain:c,fireAndForget:!1}).then(function(b){return b.data.result})}).catch(function(A){throw A})}return I.__name__=f,I.__origin__=c,I.__source__=s,I.__id__=d,I.origin=c,I},y=S();return y.fireAndForget=S({fireAndForget:!0}),y}(n,t,a,{send:i})},o.cross_domain_window=function(a){return G.deserialize(a,{send:i})},o))}var Fn={};Fn.postrobot_post_message=function(n,t,e){e.indexOf("file:")===0&&(e="*"),n.postMessage(t,e)};function Un(n,t,e,r){var o=r.on,i=r.send;return P.try(function(){var a=L().getOrSet(n,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(e),a.flush=a.flush||P.flush().then(function(){if(B(n))throw new Error("Window is closed");var s=Ee(n,t,((c={}).__post_robot_10_0_46__=a.buffer||[],c),{on:o,send:i}),c;delete a.buffer;for(var u=Object.keys(Fn),l=[],d=0;d<u.length;d++){var f=u[d];try{Fn[f](n,s,t)}catch(h){l.push(h)}}if(l.length===u.length)throw new Error(`All post-robot messaging strategies failed:
54
+ `+C.stack),C})}).then(function(C){return{result:C,id:x,name:E}})})});var i,a,c,u=t.__id__||J();e=B.unwrap(e);var s=t.__name__||t.name||r;return typeof s=="string"&&typeof s.indexOf=="function"&&s.indexOf("anonymous::")===0&&(s=s.replace("anonymous::",r+"::")),B.isProxyWindow(e)?(ze(u,t,s,e,n),e.awaitWindow().then(function(l){ze(u,t,s,l,n)})):ze(u,t,s,e,n),ne("cross_domain_function",{id:u,name:s})}function yt(e,n,t,r){var o,i=r.on,a=r.send;return function(c,u){u===void 0&&(u=gn);var s=JSON.stringify(c,function(l){var d=this[l];if(De(this))return d;var f=mt(d);if(!f)return d;var h=u[f]||wn[f];return h?h(d,l):d});return s===void 0?"undefined":s}(t,((o={}).promise=function(c,u){return function(s,l,d,f,h){return ne("cross_domain_zalgo_promise",{then:gt(s,l,function(x,E){return d.then(x,E)},f,{on:h.on,send:h.send})})}(e,n,c,u,{on:i,send:a})},o.function=function(c,u){return gt(e,n,c,u,{on:i,send:a})},o.object=function(c){return ye(c)||B.isProxyWindow(c)?ne("cross_domain_window",B.serialize(c,{send:a})):c},o))}function Et(e,n,t,r){var o,i=r.send;return function(a,c){if(c===void 0&&(c=En),a!=="undefined")return JSON.parse(a,function(u,s){if(De(this))return s;var l,d;if(De(s)?(l=s.__type__,d=s.__val__):(l=mt(s),d=s),!l)return d;var f=c[l]||yn[l];return f?f(d,u):d})}(t,((o={}).cross_domain_zalgo_promise=function(a){return function(c,u,s){return new I(s.then)}(0,0,a)},o.cross_domain_function=function(a){return function(c,u,s,l){var d=s.id,f=s.name,h=l.send,x=function(S){S===void 0&&(S={});function P(){var D=arguments;return B.toProxyWindow(c,{send:h}).awaitWindow().then(function(T){var C=wt(T,d);if(C&&C.val!==P)return C.val.apply({source:window,origin:M()},D);var z=[].slice.call(D);return S.fireAndForget?h(T,"postrobot_method",{id:d,name:f,args:z},{domain:u,fireAndForget:!0}):h(T,"postrobot_method",{id:d,name:f,args:z},{domain:u,fireAndForget:!1}).then(function(W){return W.data.result})}).catch(function(T){throw T})}return P.__name__=f,P.__origin__=u,P.__source__=c,P.__id__=d,P.origin=u,P},E=x();return E.fireAndForget=x({fireAndForget:!0}),E}(e,n,a,{send:i})},o.cross_domain_window=function(a){return B.deserialize(a,{send:i})},o))}var Me={};Me.postrobot_post_message=function(e,n,t){t.indexOf("file:")===0&&(t="*"),e.postMessage(n,t)};function Le(e,n,t,r){var o=r.on,i=r.send;return I.try(function(){var a=L().getOrSet(e,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(t),a.flush=a.flush||I.flush().then(function(){if($(e))throw new Error("Window is closed");var c=yt(e,n,((u={}).__post_robot_10_0_46__=a.buffer||[],u),{on:o,send:i}),u;delete a.buffer;for(var s=Object.keys(Me),l=[],d=0;d<s.length;d++){var f=s[d];try{Me[f](e,c,n)}catch(h){l.push(h)}}if(l.length===s.length)throw new Error(`All post-robot messaging strategies failed:
31
55
 
32
- `+l.map(function(h,S){return S+". "+vn(h)}).join(`
56
+ `+l.map(function(h,x){return x+". "+fe(h)}).join(`
33
57
 
34
- `))}),a.flush.then(function(){delete a.flush})}).then(Q)}function We(n){return j("responseListeners").get(n)}function be(n){j("responseListeners").del(n)}function xe(n){return j("erroredResponseListeners").has(n)}function Pe(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,In()];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 pt(n,t,e,r){var o=r.on,i=r.send,a=Pe({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 P.flush().then(function(){if(!e.fireAndForget&&!B(n))try{return Un(n,t,{id:k(),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 "+s+" in "+M()+`
58
+ `))}),a.flush.then(function(){delete a.flush})}).then(te)}function St(e){return j("responseListeners").get(e)}function xt(e){j("responseListeners").del(e)}function bt(e){return j("erroredResponseListeners").has(e)}function Wt(e){var n=e.name,t=e.win,r=e.domain,o=L("requestListeners");if(t==="*"&&(t=null),r==="*"&&(r=null),!n)throw new Error("Name required to get request listener");for(var i=0,a=[t,be()];i<a.length;i++){var c=a[i];if(c){var u=o.get(c);if(u){var s=u[n];if(s){if(r&&typeof r=="string"){if(s[r])return s[r];if(s.__domain_regex__)for(var l=0,d=s.__domain_regex__;l<d.length;l++){var f=d[l],h=f.listener;if(oe(f.regex,r))return h}}if(s["*"])return s["*"]}}}}}function Sn(e,n,t,r){var o=r.on,i=r.send,a=Wt({name:t.name,win:e,domain:n}),c=t.name==="postrobot_method"&&t.data&&typeof t.data.name=="string"?t.data.name+"()":t.name;function u(s,l,d){return I.flush().then(function(){if(!t.fireAndForget&&!$(e))try{return Le(e,n,{id:J(),origin:M(window),type:"postrobot_message_response",hash:t.hash,name:t.name,ack:s,data:l,error:d},{on:o,send:i})}catch(f){throw new Error("Send response message failed for "+c+" in "+M()+`
35
59
 
36
- `+vn(f))}})}return P.all([P.flush().then(function(){if(!e.fireAndForget&&!B(n))try{return Un(n,t,{id:k(),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 "+s+" in "+M()+`
60
+ `+fe(f))}})}return I.all([I.flush().then(function(){if(!t.fireAndForget&&!$(e))try{return Le(e,n,{id:J(),origin:M(window),type:"postrobot_message_ack",hash:t.hash,name:t.name},{on:o,send:i})}catch(s){throw new Error("Send ack message failed for "+c+" in "+M()+`
37
61
 
38
- `+vn(u))}}),P.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 gt(n,t,e){if(!xe(e.hash)){var r=We(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 yt(n,t,e){if(!xe(e.hash)){var r=We(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(" | ")+")":p(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(n!==r.win)throw new Error("Response source does not match registered window");be(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,s=function(l,d,f,h){var S=h.on,y=h.send,E;try{E=Se(d,f,l,{on:S,send:y})}catch{return}if(E&&typeof E=="object"&&E!==null){var I=E.__post_robot_10_0_46__;if(Array.isArray(I))return I}}(n.data,i,a,{on:e,send:r});if(s){we(i);for(var c=0;c<s.length;c++){var u=s[c];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"?pt(i,a,u,{on:e,send:r}):u.type==="postrobot_message_response"?yt(i,a,u):u.type==="postrobot_message_ack"&&gt(i,a,u)}catch(l){setTimeout(function(){throw l},0)}}}}function Y(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=L("requestListeners");if(!s||typeof s!="string")throw new Error("Name required to add request listener");if(c&&c!=="*"&&G.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=[],S=0,y=f;S<y.length;S++)h.push(o({name:s,domain:u,win:y[S]},a));return{cancel:function(){for(var T=0;T<h.length;T++)h[T].cancel()}}}if(Array.isArray(u)){for(var E=[],I=0,C=u;I<C.length;I++)E.push(o({name:s,win:f,domain:C[I]},a));return{cancel:function(){for(var T=0;T<E.length;T++)E[T].cancel()}}}var A=Pe({name:s,win:f,domain:u});f&&f!=="*"||(f=In());var O=(u=u||"*").toString();if(A)throw f&&u?new Error("Request listener already exists for "+s+" on domain "+u.toString()+" for "+(f===In()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+s+" for "+(f===In()?"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=wn(z,s,function(){return{}}),R,_;return jn(u)?(R=wn(b,"__domain_regex__",function(){return[]})).push(_={regex:u,listener:a}):b[O]=a,{cancel:function(){delete b[O],_&&(R.splice(R.indexOf(_,1)),R.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 Et(n,t,e){typeof(t=t||{})=="function"&&(e=t,t={});var r=new P,o;return t.errorHandler=function(i){o.cancel(),r.reject(i)},o=Y(n,t,function(i){if(o.cancel(),r.resolve(i),e)return e(i)}),r.cancel=o.cancel,r}var V=function n(t,e,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,s=o.timeout||5e3,c=o.fireAndForget||!1;return G.toProxyWindow(t,{send:n}).awaitWindow().then(function(u){return P.try(function(){if(function(l,d,f){if(!l)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!jn(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=Qn(d);if(f)return f===l;if(d===l||function(y){y===void 0&&(y=window);try{if(y.top)return y.top}catch{}if(J(y)===y)return y;try{if(Xn(window,y)&&window.top)return window.top}catch{}try{if(Xn(y,window)&&window.top)return window.top}catch{}for(var E=0,I=function A(O){for(var z=[],b=0,R=Kn(O);b<R.length;b++){var _=R[b];z.push(_);for(var T=0,pn=A(_);T<pn.length;T++)z.push(pn[T])}return z}(y);E<I.length;E++){var C=I[E];try{if(C.top)return C.top}catch{}if(J(C)===C)return C}}(d)===d)return!1;for(var h=0,S=Kn(l);h<S.length;h++)if(S[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(S){return L("helloPromises").getOrSet(S,function(){return new P})}(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,S){var y=S.send;return P.try(function(){return typeof f=="string"?f:P.try(function(){return h||zn(d,{send:y}).then(function(E){return E.domain})}).then(function(E){if(!tn(f,f))throw new Error("Domain "+ue(f)+" does not match "+ue(f));return E})})}(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 P,S=e+"_"+k();if(!c){var y={name:e,win:u,domain:d,promise:h};(function(b,R){j("responseListeners").set(b,R)})(S,y);var E=L("requestPromises").getOrSet(u,function(){return[]});E.push(h),h.catch(function(){(function(b){j("erroredResponseListeners").set(b,!0)})(S),be(S)});var I=function(b){return L("knownWindows").get(b,!1)}(u)?1e4:2e3,C=a,A=I,O=C,z=function(b,R){var _;return function T(){_=setTimeout(function(){(function(){if(B(u))return h.reject(new Error("Window closed for "+e+" before "+(y.ack?"response":"ack")));if(y.cancelled)return h.reject(new Error("Response listener was cancelled for "+e));A=Math.max(A-500,0),O!==-1&&(O=Math.max(O-500,0)),y.ack||A!==0?O===0&&h.reject(new Error("No response for postMessage "+f+" in "+M()+" in "+C+"ms")):h.reject(new Error("No ack for postMessage "+f+" in "+M()+" in "+I+"ms"))})(),T()},500)}(),{cancel:function(){clearTimeout(_)}}}();h.finally(function(){z.cancel(),E.splice(E.indexOf(h,1))}).catch(Q)}return Un(u,d,{id:k(),origin:M(window),type:"postrobot_message_request",hash:S,name:e,data:r,fireAndForget:c},{on:Y,send:n}).then(function(){return c?h.resolve():h},function(b){throw new Error("Send request message failed for "+f+" in "+M()+`
62
+ `+fe(s))}}),I.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:e,origin:n,data:t.data})}).then(function(s){return u("success",s)},function(s){return u("error",null,s)})]).then(te).catch(function(s){if(a&&a.handleError)return a.handleError(s);throw s})}function xn(e,n,t){if(!bt(t.hash)){var r=St(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!oe(r.domain,n))throw new Error("Ack origin "+n+" does not match domain "+r.domain.toString());if(e!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function bn(e,n,t){if(!bt(t.hash)){var r=St(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!oe(r.domain,n))throw new Error("Response origin "+n+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":y(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(e!==r.win)throw new Error("Response source does not match registered window");xt(t.hash),t.ack==="error"?r.promise.reject(t.error):t.ack==="success"&&r.promise.resolve({source:e,origin:n,data:t.data})}}function It(e,n){var t=n.on,r=n.send,o=j("receivedMessages");try{if(!window||window.closed||!e.source)return}catch{return}var i=e.source,a=e.origin,c=function(l,d,f,h){var x=h.on,E=h.send,S;try{S=Et(d,f,l,{on:x,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}}(e.data,i,a,{on:t,send:r});if(c){pt(i);for(var u=0;u<c.length;u++){var s=c[u];if(o.has(s.id)||(o.set(s.id,!0),$(i)&&!s.fireAndForget))return;s.origin.indexOf("file:")===0&&(a="file://");try{s.type==="postrobot_message_request"?Sn(i,a,s,{on:t,send:r}):s.type==="postrobot_message_response"?bn(i,a,s):s.type==="postrobot_message_ack"&&xn(i,a,s)}catch(l){setTimeout(function(){throw l},0)}}}}function X(e,n,t){if(!e)throw new Error("Expected name");if(typeof(n=n||{})=="function"&&(t=n,n={}),!t)throw new Error("Expected handler");var r=function o(i,a){var c=i.name,u=i.win,s=i.domain,l=L("requestListeners");if(!c||typeof c!="string")throw new Error("Name required to add request listener");if(u&&u!=="*"&&B.isProxyWindow(u)){var d=u.awaitWindow().then(function(N){return o({name:c,win:N,domain:s},a)});return{cancel:function(){d.then(function(N){return N.cancel()},te)}}}var f=u;if(Array.isArray(f)){for(var h=[],x=0,E=f;x<E.length;x++)h.push(o({name:c,domain:s,win:E[x]},a));return{cancel:function(){for(var N=0;N<h.length;N++)h[N].cancel()}}}if(Array.isArray(s)){for(var S=[],P=0,D=s;P<D.length;P++)S.push(o({name:c,win:f,domain:D[P]},a));return{cancel:function(){for(var N=0;N<S.length;N++)S[N].cancel()}}}var T=Wt({name:c,win:f,domain:s});f&&f!=="*"||(f=be());var C=(s=s||"*").toString();if(T)throw f&&s?new Error("Request listener already exists for "+c+" on domain "+s.toString()+" for "+(f===be()?"wildcard":"specified")+" window"):f?new Error("Request listener already exists for "+c+" for "+(f===be()?"wildcard":"specified")+" window"):s?new Error("Request listener already exists for "+c+" on domain "+s.toString()):new Error("Request listener already exists for "+c);var z=l.getOrSet(f,function(){return{}}),W=le(z,c,function(){return{}}),O,q;return Re(s)?(O=le(W,"__domain_regex__",function(){return[]})).push(q={regex:s,listener:a}):W[C]=a,{cancel:function(){delete W[C],q&&(O.splice(O.indexOf(q,1)),O.length||delete W.__domain_regex__),Object.keys(W).length||delete z[c],f&&!Object.keys(z).length&&l.del(f)}}}({name:e,win:n.window,domain:n.domain||"*"},{handler:t||n.handler,handleError:n.errorHandler||function(o){throw o}});return{cancel:function(){r.cancel()}}}function Wn(e,n,t){typeof(n=n||{})=="function"&&(t=n,n={});var r=new I,o;return n.errorHandler=function(i){o.cancel(),r.reject(i)},o=X(e,n,function(i){if(o.cancel(),r.resolve(i),t)return t(i)}),r.cancel=o.cancel,r}var K=function e(n,t,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,c=o.timeout||5e3,u=o.fireAndForget||!1;return B.toProxyWindow(n,{send:e}).awaitWindow().then(function(s){return I.try(function(){if(function(l,d,f){if(!l)throw new Error("Expected name");if(f&&typeof f!="string"&&!Array.isArray(f)&&!Re(f))throw new TypeError("Can not send "+l+". Expected domain "+JSON.stringify(f)+" to be a string, array, or regex");if($(d))throw new Error("Can not send "+l+". Target window is closed")}(t,s,i),function(l,d){var f=Ke(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(Ve(window,E)&&window.top)return window.top}catch{}try{if(Ve(E,window)&&window.top)return window.top}catch{}for(var S=0,P=function T(C){for(var z=[],W=0,O=Xe(C);W<O.length;W++){var q=O[W];z.push(q);for(var N=0,pe=T(q);N<pe.length;N++)z.push(pe[N])}return z}(E);S<P.length;S++){var D=P[S];try{if(D.top)return D.top}catch{}if(Z(D)===D)return D}}(d)===d)return!1;for(var h=0,x=Xe(l);h<x.length;h++)if(x[h]===d)return!0;return!1}(window,s))return function(l,d,f){d===void 0&&(d=5e3),f===void 0&&(f="Window");var h=function(x){return L("helloPromises").getOrSet(x,function(){return new I})}(l);return d!==-1&&(h=h.timeout(d,new Error(f+" did not load after "+d+"ms"))),h}(s,c)}).then(function(l){return function(d,f,h,x){var E=x.send;return I.try(function(){return typeof f=="string"?f:I.try(function(){return h||Ne(d,{send:E}).then(function(S){return S.domain})}).then(function(S){if(!oe(f,f))throw new Error("Domain "+at(f)+" does not match "+at(f));return S})})}(s,i,(l===void 0?{}:l).domain,{send:e})}).then(function(l){var d=l,f=t==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":t,h=new I,x=t+"_"+J();if(!u){var E={name:t,win:s,domain:d,promise:h};(function(W,O){j("responseListeners").set(W,O)})(x,E);var S=L("requestPromises").getOrSet(s,function(){return[]});S.push(h),h.catch(function(){(function(W){j("erroredResponseListeners").set(W,!0)})(x),xt(x)});var P=function(W){return L("knownWindows").get(W,!1)}(s)?1e4:2e3,D=a,T=P,C=D,z=function(W,O){var q;return function N(){q=setTimeout(function(){(function(){if($(s))return h.reject(new Error("Window closed for "+t+" before "+(E.ack?"response":"ack")));if(E.cancelled)return h.reject(new Error("Response listener was cancelled for "+t));T=Math.max(T-500,0),C!==-1&&(C=Math.max(C-500,0)),E.ack||T!==0?C===0&&h.reject(new Error("No response for postMessage "+f+" in "+M()+" in "+D+"ms")):h.reject(new Error("No ack for postMessage "+f+" in "+M()+" in "+P+"ms"))})(),N()},500)}(),{cancel:function(){clearTimeout(q)}}}();h.finally(function(){z.cancel(),S.splice(S.indexOf(h,1))}).catch(te)}return Le(s,d,{id:J(),origin:M(window),type:"postrobot_message_request",hash:x,name:t,data:r,fireAndForget:u},{on:X,send:e}).then(function(){return u?h.resolve():h},function(W){throw new Error("Send request message failed for "+f+" in "+M()+`
39
63
 
40
- `+vn(b))})})})};function St(n,t,e){return Ee(n,t,e,{on:Y,send:V})}function Wt(n,t,e){return Se(n,t,e,{on:Y,send:V})}function bt(n){return new G({send:V,win:n})}function xt(n){return G.toProxyWindow(n,{send:V})}function Oe(){mn().initialized||(mn().initialized=!0,t=(n={on:Y,send:V}).on,e=n.send,(r=mn()).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(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;P.try(function(){var f=c.source||c.sourceElement,h=c.origin||c.originalEvent&&c.originalEvent.origin,S=c.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:S},{on:l,send:d})}})})(s,{on:i,send:a})})})}({on:Y,send:V}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var s=i("postrobot_hello",{domain:"*"},function(u){return he(u.source,{domain:u.origin}),{instanceID:le()}}),c=Qn();return c&&zn(c,{send:a}).catch(function(u){}),s})}({on:Y,send:V}));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 It=!0;function Ot(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(Q)}Oe()}])})})(Zn);var ot=Zn.exports;(function(v){v.exports=ot,v.exports.default=v.exports})(Jn);var Yn=Jn.exports;const Dn=N({__proto__:null,default:rt(Yn)},[Yn]);D.ConsentBox=$e,D.SoyioTypes=ke,D.SoyioWidget=qn,D.default=qn,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
64
+ `+fe(W))})})})};function In(e,n,t){return yt(e,n,t,{on:X,send:K})}function Pn(e,n,t){return Et(e,n,t,{on:X,send:K})}function Cn(e){return new B({send:K,win:e})}function Tn(e){return B.toProxyWindow(e,{send:K})}function Pt(){he().initialized||(he().initialized=!0,n=(e={on:X,send:K}).on,t=e.send,(r=he()).receiveMessage=r.receiveMessage||function(o){return It(o,{on:n,send:t})},function(o){var i=o.on,a=o.send;j().getOrSet("postMessageListener",function(){return function(c,u,s){return c.addEventListener("message",s),{cancel:function(){c.removeEventListener("message",s)}}}(window,0,function(c){(function(u,s){var l=s.on,d=s.send;I.try(function(){var f=u.source||u.sourceElement,h=u.origin||u.originalEvent&&u.originalEvent.origin,x=u.data;if(h==="null"&&(h="file://"),f){if(!h)throw new Error("Post message did not have origin domain");It({source:f,origin:h,data:x},{on:l,send:d})}})})(c,{on:i,send:a})})})}({on:X,send:K}),function(o){var i=o.on,a=o.send;j("builtinListeners").getOrSet("helloListener",function(){var c=i("postrobot_hello",{domain:"*"},function(s){return lt(s.source,{domain:s.origin}),{instanceID:ft()}}),u=Ke();return u&&Ne(u,{send:a}).catch(function(s){}),c})}({on:X,send:K}));var e,n,t,r}function On(){(function(){for(var n=j("responseListeners"),t=0,r=n.keys();t<r.length;t++){var o=r[t],i=n.get(o);i&&(i.cancelled=!0),n.del(o)}})(),(e=j().get("postMessageListener"))&&e.cancel();var e;delete window.__post_robot_10_0_46__}var An=!0;function Rn(e){for(var n=0,t=L("requestPromises").get(e,[]);n<t.length;n++)t[n].reject(new Error("Window "+($(e)?"closed":"cleaned up")+" before response")).catch(te)}Pt()}])})})(Je);var un=Je.exports;(function(p){p.exports=un,p.exports.default=p.exports})(ke);var Ye=ke.exports;const Ce=R({__proto__:null,default:sn(Ye)},[Ye]);A.ConsentBox=Jt,A.SoyioTypes=Yt,A.SoyioWidget=qe,A.default=qe,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soyio/soyio-widget",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",