@iframe-resizer/child 6.0.0-beta.0 → 6.0.0-beta.2

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/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
- import Ln, { NORMAL as K, HIGHLIGHT as c, FOREGROUND as w, BOLD as ft, ITALIC as jn } from "auto-console-group";
2
- const D = "6.0.0-beta.0", Ve = "iframeResizer", Ee = ":", xn = "[iFrameResizerChild]Ready", _n = "autoResize", Dn = "beforeUnload", Bn = "close", Hn = "inPageLink", Se = "init", je = "message", Fn = "mouseenter", Wn = "mouseleave", Bt = "pageHide", Ht = "pageInfo", Ft = "parentInfo", Un = "pageInfoStop", Gn = "parentInfoStop", Vn = "scrollBy", qn = "scrollTo", Wt = "scrollToOffset", Zn = "title", W = 10, X = 1, Oe = "data-iframe-size", Ut = "data-iframe-overflowed", te = "data-iframe-ignore", ne = "height", Gt = "width", Ie = "offset", Ae = "offsetSize", Yn = "scroll", qe = `
3
- `, oe = "string", L = "number", Qn = "boolean", Jn = "object", re = "function", Kn = "undefined", Xn = "false", eo = "null", Me = "auto", Vt = "readystatechange", xe = "bottom", _e = "right", De = "autoResizeEnabled", mt = /* @__PURE__ */ Symbol("sizeChanged"), Ze = "manualResize", Ye = "parentResize", ht = {
4
- [Ze]: 1,
5
- [Ye]: 1
6
- }, qt = "setOffsetSize", Zt = "resizeObserver", Qe = "overflowObserver", Yt = "mutationObserver", Qt = "visibilityObserver", to = "font-weight: bold;", Je = "none", gt = "No change in content size detected", he = "[iFrameSizer]", Jt = he.length, Ke = Me, Kt = Yn, Xt = 128, en = /* @__PURE__ */ new Set([
1
+ import Pn, { NORMAL as Q, HIGHLIGHT as a, FOREGROUND as z, BOLD as lt, ITALIC as Cn } from "auto-console-group";
2
+ const x = "6.0.0-beta.2", Ve = "iframeResizer", ye = ":", Ln = "[iFrameResizerChild]Ready", jn = "autoResize", _n = "beforeUnload", Dn = "close", xn = "inPageLink", ve = "init", Le = "message", Bn = "mouseenter", Fn = "mouseleave", jt = "pageHide", _t = "pageInfo", Dt = "parentInfo", Hn = "pageInfoStop", Vn = "parentInfoStop", Wn = "scrollBy", Un = "scrollTo", xt = "scrollToOffset", Gn = "title", J = 1, be = "data-iframe-size", Bt = "data-iframe-overflowed", X = "data-iframe-ignore", ze = "height", Ft = "width", Me = "offset", ke = "offsetSize", We = `
3
+ `, ee = "string", L = "number", qn = "boolean", Zn = "object", we = "function", Yn = "undefined", Qn = "false", Jn = "null", P = "auto", Ht = "readystatechange", Vt = "bottom", Wt = "right", je = "autoResizeEnabled", dt = /* @__PURE__ */ Symbol("sizeChanged"), Ue = "manualResize", Ge = "parentResize", Te = {
4
+ [Ue]: 1,
5
+ [Ge]: 1
6
+ }, Ut = "setOffsetSize", Gt = "resizeObserver", qe = "overflowObserver", qt = "mutationObserver", Zt = "visibilityObserver", Kn = "font-weight: bold;", Ze = "none", ut = "No change in content size detected", de = "[iFrameSizer]", Yt = de.length, Xn = P, Qt = 128, Jt = /* @__PURE__ */ new Set([
7
7
  "head",
8
8
  "body",
9
9
  "meta",
@@ -20,38 +20,38 @@ const D = "6.0.0-beta.0", Ve = "iframeResizer", Ee = ":", xn = "[iFrameResizerCh
20
20
  "track",
21
21
  "wbr",
22
22
  "nobr"
23
- ]), no = (e) => (t, n = "renamed to") => (o, r, u = "", l = "") => e(
24
- l,
23
+ ]), eo = (e) => (t, n = "renamed to") => (o, r, d = "", c = "") => e(
24
+ c,
25
25
  `<rb>Deprecated ${t}(${o.replace("()", "")})</>
26
26
 
27
- The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${u}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`
28
- ), oo = (e) => typeof e === oe, Re = (e, ...t) => setTimeout(() => e(...t), 0), tn = (e) => {
27
+ The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${d}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`
28
+ ), to = (e) => typeof e === ee, Se = (e, ...t) => setTimeout(() => e(...t), 0), Kt = (e) => {
29
29
  let t = !1;
30
30
  return function(...n) {
31
31
  return t ? void 0 : (t = !0, e.apply(this, n));
32
32
  };
33
- }, ge = (e) => e, pt = 1e3, _ = (e) => Math.round(e * pt) / pt, nn = (e) => e.charAt(0).toUpperCase() + e.slice(1), U = (e) => `${e}` != "" && e !== void 0, ro = (e) => e(), so = (e) => e.toLowerCase();
34
- function io(e) {
33
+ }, ue = (e) => e, ft = 1e3, D = (e) => Math.round(e * ft) / ft, Xt = (e) => e.charAt(0).toUpperCase() + e.slice(1), N = (e) => `${e}` != "" && e !== void 0, no = (e) => e(), oo = (e) => e.toLowerCase();
34
+ function ro(e) {
35
35
  switch (!0) {
36
- case !U(e):
36
+ case !N(e):
37
37
  return "";
38
- case U(e.id):
38
+ case N(e.id):
39
39
  return `${e.nodeName}#${e.id}`;
40
- case U(e.name):
40
+ case N(e.name):
41
41
  return `${e.nodeName} (${e.name}`;
42
- case U(e.className):
42
+ case N(e.className):
43
43
  return `${e.nodeName}.${e.className}`;
44
44
  default:
45
45
  return e.nodeName;
46
46
  }
47
47
  }
48
- const co = (e) => (
48
+ const so = (e) => (
49
49
  // eslint-disable-next-line no-underscore-dangle
50
50
  e?.__esModule ? e.default : e
51
- ), $ = (e, t, n) => {
51
+ ), R = (e, t, n) => {
52
52
  if (typeof e !== t)
53
- throw new TypeError(`${n} is not a ${nn(t)}`);
54
- }, on = {
53
+ throw new TypeError(`${n} is not a ${Xt(t)}`);
54
+ }, en = {
55
55
  br: `
56
56
  `,
57
57
  rb: "\x1B[31;1m",
@@ -66,42 +66,42 @@ const co = (e) => (
66
66
  // underline
67
67
  "/": "\x1B[m"
68
68
  // reset
69
- }, ao = Object.keys(on), lo = new RegExp(`<(${ao.join("|")})>`, "gi"), uo = (e, t) => on[t] ?? "", fo = (e) => e.replace(lo, uo), mo = (e) => e.replaceAll("<br>", qe).replaceAll(/<\/?[^>]+>/gi, ""), ho = (e) => (t) => e(
70
- oo(t) ? window.chrome ? fo(t) : mo(t) : t
69
+ }, io = Object.keys(en), co = new RegExp(`<(${io.join("|")})>`, "gi"), ao = (e, t) => en[t] ?? "", lo = (e) => e.replace(co, ao), uo = (e) => e.replaceAll("<br>", We).replaceAll(/<\/?[^>]+>/gi, ""), fo = (e) => (t) => e(
70
+ to(t) ? window.chrome ? lo(t) : uo(t) : t
71
71
  );
72
- let Xe = !0, Be = Ve;
73
- const go = co(Ln), ee = go({
72
+ let Ye = !0, _e = Ve;
73
+ const mo = so(Pn), K = mo({
74
74
  label: `${Ve}(child)`,
75
75
  expand: !1
76
76
  });
77
- function po(e) {
78
- Be = e.id || Ve, ee.label(`${Be}`), ee.expand(e.expand), Xe = e.enabled;
77
+ function ho(e) {
78
+ _e = e.id || Ve, K.label(`${_e}`), K.expand(e.expand), Ye = e.enabled;
79
79
  }
80
- const rn = (e) => (...t) => Xe ? ee[e](...t) : !0, a = rn("log"), d = a, pe = rn("debug");
81
- function yo(e, t) {
80
+ const tn = (e) => (...t) => Ye ? K[e](...t) : !0, l = tn("log"), u = l, fe = tn("debug");
81
+ function go(e, t) {
82
82
  console.info(
83
- `${Be} %ciframe-resizer ${e}`,
84
- Xe || t < 1 ? to : K
83
+ `${_e} %ciframe-resizer ${e}`,
84
+ Ye || t < 1 ? Kn : Q
85
85
  );
86
86
  }
87
87
  const {
88
- assert: Ai,
89
- endAutoGroup: B,
90
- error: sn,
91
- errorBoundary: et,
92
- event: m,
93
- label: Ci,
94
- purge: ki,
95
- warn: T
96
- } = ee, bo = ho(ge), g = (...e) => ee.warn(...e.map(bo)), tt = no((e, t) => g(t)), cn = tt("Method"), vo = tt("Method", "replaced with"), wo = tt("Option"), nt = [];
97
- function an(e, t) {
98
- a(`${e} event listener: %c${t}`, c);
99
- }
100
- const ln = (e, t, n, o) => {
101
- e.removeEventListener(t, n, o), an("Removed", t);
88
+ assert: po,
89
+ endAutoGroup: F,
90
+ error: nn,
91
+ errorBoundary: Qe,
92
+ event: h,
93
+ label: Ai,
94
+ purge: Ii,
95
+ warn: B
96
+ } = K, yo = fo(ue), p = (...e) => K.warn(...e.map(yo)), Je = eo((e, t) => p(t)), on = Je("Method"), vo = Je("Method", "replaced with"), bo = Je("Option"), Ke = [];
97
+ function rn(e, t) {
98
+ l(`${e} event listener: %c${t}`, a);
99
+ }
100
+ const sn = (e, t, n, o) => {
101
+ e.removeEventListener(t, n, o), rn("Removed", t);
102
102
  }, j = (e, t, n, o = !1) => {
103
- e.addEventListener(t, n, o), nt.push(() => ln(e, t, n, o)), an("Added", t);
104
- }, i = {
103
+ e.addEventListener(t, n, o), Ke.push(() => sn(e, t, n, o)), rn("Added", t);
104
+ }, s = {
105
105
  applySelectors: null,
106
106
  firstRun: !0,
107
107
  hasTags: !1,
@@ -124,63 +124,73 @@ const ln = (e, t, n, o) => {
124
124
  onPageInfo: null,
125
125
  onParentInfo: null
126
126
  };
127
- let yt = !1;
128
- const bt = (e) => e.postMessage(
129
- xn,
130
- window?.iframeResizer?.targetOrigin || "*"
131
- );
132
- function vt() {
133
- if (document.readyState === "loading" || !i.firstRun || yt) return;
127
+ let mt = !1;
128
+ function ht(e) {
129
+ const t = window?.iframeResizer?.targetOrigin || "*", n = Array.isArray(t) ? t : [t];
130
+ for (const o of n)
131
+ e.postMessage(Ln, o);
132
+ }
133
+ function gt() {
134
+ if (document.readyState === "loading" || !s.firstRun || mt) return;
134
135
  const { parent: e, top: t } = window;
135
- m("ready"), a(
136
+ h("ready"), l(
136
137
  "Sending%c ready%c to parent from",
137
- c,
138
- w,
138
+ a,
139
+ z,
139
140
  window.location.href
140
- ), bt(e), e !== t && bt(t), yt = !0;
141
+ ), ht(e), e !== t && ht(t), mt = !0;
141
142
  }
142
- const wt = "iframeResize", zo = (e) => he === `${e.data}`.slice(0, Jt), Eo = () => wt in window || window.jQuery !== void 0 && wt in window.jQuery.prototype, So = (e) => e.data.split(Ee)[2] in { true: 1, false: 1 }, Oo = () => [document.documentElement, document.body], Mo = ["min-height", "min-width", "max-height", "max-width"], zt = /* @__PURE__ */ new Set(), Ro = (e) => !!e && e !== "0px" && e !== Me && e !== Je, dn = (e) => e.tagName ? e.tagName.toLowerCase() : "unknown", un = (e, t) => window.getComputedStyle(e).getPropertyValue(t), $o = (e, t) => Ro(un(e, t));
143
- function To(e, t) {
144
- const n = e.style[t];
143
+ const pt = "iframeResize", zo = (e) => de === `${e.data}`.slice(0, Yt), wo = () => pt in window || // @ts-ignore
144
+ window.jQuery !== void 0 && pt in window.jQuery.prototype, So = (e) => e.data.split(ye)[2] in { true: 1, false: 1 }, Eo = () => [document.documentElement, document.body], Oo = ["min-height", "min-width", "max-height", "max-width"], yt = /* @__PURE__ */ new Set(), $o = (e) => !!e && e !== "0px" && e !== P && e !== Ze, cn = (e) => e.tagName ? e.tagName.toLowerCase() : "unknown", an = (e, t) => window.getComputedStyle(e).getPropertyValue(t), Ro = (e, t) => $o(an(e, t));
145
+ function Mo(e, t) {
146
+ const n = e.style.getPropertyValue(t);
145
147
  return n ? { source: "an inline style attribute", value: n } : null;
146
148
  }
147
- function Io({ href: e }) {
148
- zt.has(e) || (a("Unable to access stylesheet:", e), zt.add(e));
149
+ function ko({
150
+ href: e
151
+ }) {
152
+ yt.has(e) || (l("Unable to access stylesheet:", e), yt.add(e));
149
153
  }
150
- function Ao(e, t) {
154
+ function To(e, t) {
151
155
  for (const n of document.styleSheets)
152
156
  try {
153
- for (const o of n.cssRules || [])
154
- if (o.selectorText && e.matches(o.selectorText)) {
155
- const r = o.style[t];
156
- if (r)
157
- return {
158
- source: n.ownerNode.tagName === "STYLE" ? "an inline <style> block" : `stylesheet (${n.href})`,
159
- value: r
160
- };
161
- }
157
+ for (const o of n.cssRules || []) {
158
+ if (!("selectorText" in o)) continue;
159
+ const r = o;
160
+ if (!e.matches(r.selectorText)) continue;
161
+ const d = r.style.getPropertyValue(t);
162
+ if (!d) continue;
163
+ const { ownerNode: c } = n;
164
+ return {
165
+ source: c instanceof Element && c.tagName === "STYLE" ? "an inline <style> block" : `stylesheet (${n.href})`,
166
+ value: d
167
+ };
168
+ }
162
169
  } catch {
163
- Io(n);
170
+ ko(n);
164
171
  }
165
172
  return {
166
173
  source: "cross-origin stylesheet",
167
- value: un(e, t)
174
+ value: an(e, t)
168
175
  };
169
176
  }
170
- const Co = (e, t) => To(e, t) || Ao(e, t), ko = (e, t) => {
171
- const { source: n, value: o } = Co(e, t), r = dn(e);
172
- g(
177
+ const Ao = (e, t) => Mo(e, t) || To(e, t), Io = (e, t) => {
178
+ const { source: n, value: o } = Ao(e, t), r = cn(e);
179
+ p(
173
180
  `The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${r}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.
174
181
 
175
182
  If you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`
176
183
  );
177
184
  };
178
185
  function No() {
179
- for (const e of Oo())
180
- for (const t of Mo)
181
- a(`Checking <${dn(e)}> for blocking CSS: ${t}`), $o(e, t) && ko(e, t);
182
- }
183
- const Po = ({ calculateWidth: e, calculateHeight: t }) => e === t, s = {
186
+ for (const e of Eo())
187
+ for (const t of Oo)
188
+ l(`Checking <${cn(e)}> for blocking CSS: ${t}`), Ro(e, t) && Io(e, t);
189
+ }
190
+ const Po = ({
191
+ calculateWidth: e,
192
+ calculateHeight: t
193
+ }) => e === t, i = {
184
194
  autoResize: !0,
185
195
  bodyBackground: "",
186
196
  bodyMargin: 0,
@@ -189,7 +199,7 @@ const Po = ({ calculateWidth: e, calculateHeight: t }) => e === t, s = {
189
199
  bodyPadding: "",
190
200
  calculateHeight: !0,
191
201
  calculateWidth: !1,
192
- heightCalcMode: Ke,
202
+ heightCalcMode: P,
193
203
  ignoreSelector: "",
194
204
  inPageLinks: !1,
195
205
  logging: !1,
@@ -198,318 +208,274 @@ const Po = ({ calculateWidth: e, calculateHeight: t }) => e === t, s = {
198
208
  mouseEvents: !1,
199
209
  offsetHeight: 0,
200
210
  offsetWidth: 0,
211
+ parentId: void 0,
201
212
  sizeSelector: "",
202
213
  targetOrigin: "*",
203
214
  tolerance: 0,
204
- widthCalcMode: Kt,
215
+ widthCalcMode: P,
205
216
  onBeforeResize: void 0,
206
217
  onMessage: () => {
207
- T("onMessage function not defined");
218
+ B("onMessage function not defined");
208
219
  },
209
220
  onReady: () => {
210
221
  }
211
- }, Lo = (e) => `:not(${e})`, jo = `* ${Array.from(en).map(Lo).join("")}`, ot = (e) => e.querySelectorAll(jo), ye = (e) => [
212
- e.bodyOffset(),
213
- e.bodyScroll(),
214
- e.documentElementOffset(),
215
- e.documentElementScroll(),
216
- e.boundingClientRect()
217
- ], k = [c, w, c], fe = {
222
+ }, A = [a, z, a], ae = {
218
223
  height: 0,
219
224
  width: 0
220
- }, F = {
225
+ }, V = {
221
226
  height: 0,
222
227
  width: 0
223
228
  };
224
229
  function H(e, t, n) {
225
- return F[e] = t, fe[e] = n, t;
230
+ return V[e] = t, ae[e] = n, t;
226
231
  }
227
- function xo(e) {
232
+ function Co(e) {
228
233
  const t = e.getOffset();
229
- return t !== 0 && d(`Page offsetSize: %c${t}px`, c), t;
234
+ return t !== 0 && u(`Page offsetSize: %c${t}px`, a), t;
230
235
  }
231
- const _o = (e) => e.documentElementScroll() + Math.max(0, e.getOffset());
232
- function fn(e) {
233
- const { hasOverflow: t, hasTags: n, triggerLocked: o } = i, r = e.label, u = r === ne, l = e.boundingClientRect(), p = Math.ceil(l), v = Math.floor(l), f = _o(e), z = `HTML: %c${l}px %cPage: %c${f}px`;
234
- let h;
236
+ const Lo = (e) => e.documentElementScroll() + Math.max(0, e.getOffset());
237
+ function ln(e) {
238
+ const { hasOverflow: t, hasTags: n, triggerLocked: o } = s, r = e.label, d = r === ze, c = e.boundingClientRect(), f = Math.ceil(c), b = Math.floor(c), m = Lo(e), w = `HTML: %c${c}px %cPage: %c${m}px`;
239
+ let g;
235
240
  switch (!0) {
236
241
  case !e.enabled():
237
- return Math.max(f, X);
242
+ return Math.max(m, J);
238
243
  case n:
239
- d("Found element with data-iframe-size attribute"), h = e.taggedElement();
244
+ u("Found element with data-iframe-size attribute"), g = e.taggedElement();
240
245
  break;
241
- case (!t && i.firstRun && F[r] === 0 && fe[r] === 0):
242
- d(`Initial page size values: ${z}`, ...k), h = H(
246
+ case (!t && s.firstRun && V[r] === 0 && ae[r] === 0):
247
+ u(`Initial page size values: ${w}`, ...A), g = H(
243
248
  r,
244
- l,
245
- f
249
+ c,
250
+ m
246
251
  );
247
252
  break;
248
- case (o && l === F[r] && f === fe[r]):
249
- d(`Size unchanged: ${z}`, ...k), h = Math.max(l, f);
253
+ case (o && c === V[r] && m === ae[r]):
254
+ u(`Size unchanged: ${w}`, ...A), g = Math.max(c, m);
250
255
  break;
251
- case (l === 0 && f !== 0):
252
- d(`Page is hidden: ${z}`, ...k), h = f;
256
+ case (c === 0 && m !== 0):
257
+ u(`Page is hidden: ${w}`, ...A), g = m;
253
258
  break;
254
- case (!t && l !== F[r] && f <= fe[r]):
255
- d(`New <html> size: ${z} `, ...k), d(
256
- `Previous <html> size: %c${F[r]}px`,
257
- c
258
- ), h = H(
259
+ case (!t && c !== V[r] && m <= ae[r]):
260
+ u(`New <html> size: ${w} `, ...A), u(
261
+ `Previous <html> size: %c${V[r]}px`,
262
+ a
263
+ ), g = H(
259
264
  r,
260
- l,
261
- f
265
+ c,
266
+ m
262
267
  );
263
268
  break;
264
- case !u:
265
- h = e.taggedElement();
269
+ case !d:
270
+ g = e.taggedElement();
266
271
  break;
267
- case (!t && l < F[r]):
268
- d(`<html> size decreased: ${z}`, ...k), h = H(
272
+ case (!t && c < V[r]):
273
+ u(`<html> size decreased: ${w}`, ...A), g = H(
269
274
  r,
270
- l,
271
- f
275
+ c,
276
+ m
272
277
  );
273
278
  break;
274
- case (f === v || f === p):
275
- d(`<html> size equals page size: ${z}`, ...k), h = H(
279
+ case (m === b || m === f):
280
+ u(`<html> size equals page size: ${w}`, ...A), g = H(
276
281
  r,
277
- l,
278
- f
282
+ c,
283
+ m
279
284
  );
280
285
  break;
281
- case l > f:
282
- d(`Page size < <html> size: ${z}`, ...k), h = H(
286
+ case c > m:
287
+ u(`Page size < <html> size: ${w}`, ...A), g = H(
283
288
  r,
284
- l,
285
- f
289
+ c,
290
+ m
286
291
  );
287
292
  break;
288
293
  case t:
289
- d("Found elements possibly overflowing <html> "), h = e.taggedElement();
294
+ u("Found elements possibly overflowing <html> "), g = e.taggedElement();
290
295
  break;
291
296
  default:
292
- d(`Using <html> size: ${z}`, ...k), h = H(
297
+ u(`Using <html> size: ${w}`, ...A), g = H(
293
298
  r,
294
- l,
295
- f
299
+ c,
300
+ m
296
301
  );
297
302
  }
298
- return d(`Content ${r}: %c${h}px`, c), h += xo(e), Math.max(h, X);
299
- }
300
- const Do = () => {
301
- const { body: e } = document, t = getComputedStyle(e);
302
- return e.offsetHeight + parseInt(t.marginTop, W) + parseInt(t.marginBottom, W);
303
- }, Bo = 1e3, Ho = 5 * Bo, Fo = 4, Wo = 10, Uo = 100, rt = "--ifr-start", be = "--ifr-end", mn = "--ifr-measure", b = [];
304
- let me = {}, Et = 0, He;
305
- function hn() {
303
+ return u(`Content ${r}: %c${g}px`, a), g += Co(e), Math.max(g, J);
304
+ }
305
+ const jo = 1e3, _o = 5 * jo, Do = 4, xo = 10, Bo = 100, Xe = "--ifr-start", me = "--ifr-end", dn = "--ifr-measure", v = [];
306
+ let le = {}, vt = 0, De;
307
+ function un() {
306
308
  try {
307
- performance.clearMarks(rt), performance.clearMarks(be), performance.clearMeasures(mn);
309
+ performance.clearMarks(Xe), performance.clearMarks(me), performance.clearMeasures(dn);
308
310
  } catch {
309
311
  }
310
312
  }
311
- function Go() {
312
- He = setInterval(() => {
313
- if (b.length < Wo || me.hasTags && me.len < 25) return;
314
- b.sort();
313
+ function Fo() {
314
+ De = setInterval(() => {
315
+ if (v.length < xo || le.hasTags && le.len < 25) return;
316
+ v.sort();
315
317
  const e = Math.min(
316
- b.reduce((n, o) => n + o, 0) / b.length,
317
- b[Math.floor(b.length / 2)]
318
- ), t = _(e);
319
- t > Et && (Et = t, m("performanceObserver"), a("Mean time:", _(b[Math.floor(b.length / 2)])), a(
318
+ v.reduce((n, o) => n + o, 0) / v.length,
319
+ v[Math.floor(v.length / 2)]
320
+ ), t = D(e);
321
+ t > vt && (vt = t, h("performanceObserver"), l("Mean time:", D(v[Math.floor(v.length / 2)])), l(
320
322
  "Median time:",
321
- _(b.reduce((n, o) => n + o, 0) / b.length)
322
- ), a("Average time:", t), a("Max time:", _(Math.max(...b)))), hn(), !(e <= Fo) && (clearInterval(He), g(
323
+ D(v.reduce((n, o) => n + o, 0) / v.length)
324
+ ), l("Average time:", t), l("Max time:", D(Math.max(...v)))), un(), !(e <= Do) && (clearInterval(De), p(
323
325
  `<rb>Performance Warning</>
324
326
 
325
- Calculating the page size is taking an excessive amount of time (${_(e)}ms).
327
+ Calculating the page size is taking an excessive amount of time (${D(e)}ms).
326
328
 
327
- To improve performance add the <b>data-iframe-size</> attribute to the ${me.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`
329
+ To improve performance add the <b>data-iframe-size</> attribute to the ${le.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`
328
330
  ));
329
- }, Ho);
331
+ }, _o);
330
332
  }
331
- function Vo(e) {
333
+ function Ho(e) {
332
334
  e.getEntries().forEach((t) => {
333
- if (t.name === be)
335
+ if (t.name === me)
334
336
  try {
335
337
  const { duration: n } = performance.measure(
336
- mn,
337
- rt,
338
- be
338
+ dn,
339
+ Xe,
340
+ me
339
341
  );
340
- me = t.detail, b.push(n), b.length > Uo && b.shift();
342
+ le = t.detail, v.push(n), v.length > Bo && v.shift();
341
343
  } catch {
342
344
  }
343
345
  });
344
346
  }
345
- function qo() {
346
- d("Attached%c PerformanceObserver%c to page", c, w);
347
- const e = new PerformanceObserver(Vo);
348
- return e.observe({ entryTypes: ["mark"] }), Go(), {
347
+ function Vo() {
348
+ u("Attached%c PerformanceObserver%c to page", a, z);
349
+ const e = new PerformanceObserver(Ho);
350
+ return e.observe({ entryTypes: ["mark"] }), Fo(), {
349
351
  disconnect: () => {
350
- hn(), clearInterval(He), e.disconnect(), d("Detached%c PerformanceObserver", c);
352
+ un(), clearInterval(De), e.disconnect(), u("Detached%c PerformanceObserver", a);
351
353
  }
352
354
  };
353
355
  }
354
- function Zo() {
355
- const { hasOverflow: e, hasTags: t, overflowedNodeSet: n, taggedElements: o } = i;
356
- return t ? o : e ? Array.from(n) : ot(document.documentElement);
356
+ const Wo = (e) => `:not(${e})`, Uo = `* ${Array.from(Jt).map(Wo).join("")}`, et = (e) => e.querySelectorAll(Uo);
357
+ function Go() {
358
+ const { hasOverflow: e, hasTags: t, overflowedNodeSet: n, taggedElements: o } = s;
359
+ return t ? o : e ? Array.from(n) : et(document.documentElement);
357
360
  }
358
- function Yo(e, t) {
361
+ function qo(e, t) {
359
362
  const n = `margin-${t}`;
360
- let o, r = document.documentElement, u = i.hasTags ? X : document.documentElement.getBoundingClientRect().bottom;
361
- for (const l of e)
362
- o = l.getBoundingClientRect()[t] + parseFloat(getComputedStyle(l).getPropertyValue(n)), o > u && (u = o, r = l);
363
- return { maxEl: r, maxVal: u };
364
- }
365
- function ve(e) {
366
- performance.mark(rt);
367
- const t = nn(e), { logging: n } = s, { hasTags: o } = i, r = Zo(), { maxEl: u, maxVal: l } = Yo(r, e);
368
- return d(`${t} position calculated from:`, u), d(`Checked %c${r.length}%c elements`, c, w), performance.mark(be, {
363
+ let o, r = document.documentElement, d = s.hasTags ? J : document.documentElement.getBoundingClientRect().bottom;
364
+ for (const c of e)
365
+ o = c.getBoundingClientRect()[t] + parseFloat(getComputedStyle(c).getPropertyValue(n)), o > d && (d = o, r = c);
366
+ return { maxEl: r, maxVal: d };
367
+ }
368
+ function fn(e) {
369
+ performance.mark(Xe);
370
+ const t = Xt(e), { logging: n } = i, { hasTags: o } = s, r = Go(), { maxEl: d, maxVal: c } = qo(r, e);
371
+ return u(`${t} position calculated from:`, d), u(`Checked %c${r.length}%c elements`, a, z), performance.mark(me, {
369
372
  detail: {
370
373
  hasTags: o,
371
374
  len: r.length,
372
375
  logging: n,
373
376
  Side: t
374
377
  }
375
- }), l;
376
- }
377
- const S = {
378
- label: ne,
379
- enabled: () => s.calculateHeight,
380
- getOffset: () => s.offsetHeight,
381
- auto: () => fn(S),
382
- bodyOffset: Do,
383
- bodyScroll: () => document.body.scrollHeight,
384
- offset: () => S.bodyOffset(),
385
- // Backwards compatibility
386
- documentElementOffset: () => document.documentElement.offsetHeight,
387
- documentElementScroll: () => document.documentElement.scrollHeight,
378
+ }), c;
379
+ }
380
+ const Ee = {
381
+ label: ze,
382
+ enabled: () => i.calculateHeight,
383
+ getOffset: () => i.offsetHeight,
384
+ auto: () => ln(Ee),
388
385
  boundingClientRect: () => Math.max(
389
386
  document.documentElement.getBoundingClientRect().bottom,
390
387
  document.body.getBoundingClientRect().bottom
391
388
  ),
392
- max: () => Math.max(...ye(S)),
393
- min: () => Math.min(...ye(S)),
394
- grow: () => S.max(),
395
- lowestElement: () => ve(xe),
396
- taggedElement: () => ve(xe),
397
- custom: () => (T("Custom height calculation function not defined"), S.auto())
398
- }, O = {
399
- label: Gt,
400
- enabled: () => s.calculateWidth,
401
- getOffset: () => s.offsetWidth,
402
- auto: () => fn(O),
403
- bodyScroll: () => document.body.scrollWidth,
404
- bodyOffset: () => document.body.offsetWidth,
405
- documentElementScroll: () => document.documentElement.scrollWidth,
406
- documentElementOffset: () => document.documentElement.offsetWidth,
389
+ documentElementScroll: () => document.documentElement.scrollHeight,
390
+ taggedElement: () => fn(Vt)
391
+ }, Oe = {
392
+ label: Ft,
393
+ enabled: () => i.calculateWidth,
394
+ getOffset: () => i.offsetWidth,
395
+ auto: () => ln(Oe),
407
396
  boundingClientRect: () => Math.max(
408
397
  document.documentElement.getBoundingClientRect().right,
409
398
  document.body.getBoundingClientRect().right
410
399
  ),
411
- max: () => Math.max(...ye(O)),
412
- min: () => Math.min(...ye(O)),
413
- rightMostElement: () => ve(_e),
414
- scroll: () => Math.max(O.bodyScroll(), O.documentElementScroll()),
415
- taggedElement: () => ve(_e),
416
- custom: () => (T("Custom width calculation function not defined"), O.auto())
417
- }, Qo = {
418
- bodyOffset: 1,
419
- bodyScroll: 1,
420
- offset: 1,
421
- documentElementOffset: 1,
422
- documentElementScroll: 1,
423
- boundingClientRect: 1,
424
- max: 1,
425
- min: 1,
426
- grow: 1,
427
- lowestElement: 1
428
- }, Jo = (e) => `set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page. This can be done on the child page by adding the following code:
400
+ documentElementScroll: () => document.documentElement.scrollWidth,
401
+ taggedElement: () => fn(Wt)
402
+ };
403
+ function mn(e, t) {
404
+ const { label: n } = t;
405
+ return e && e !== P && p(
406
+ `<rb>Ignored ${n}CalculationMethod (${e})</>
429
407
 
430
- window.iframeResizer = {
431
- license: 'xxxx',
432
- ${e}CalculationMethod: '${Me}',
433
- }
434
- `;
435
- function Ko(e, t) {
436
- const n = s.version ? "remove this option." : Jo(e);
437
- g(
438
- `<rb>Deprecated ${e}CalculationMethod (${t})</>
408
+ This version of <i>iframe-resizer</> auto detects the most suitable ${n} calculation method. The <b>${n}CalculationMethod</> option is no longer supported and has been ignored.
439
409
 
440
- This version of <i>iframe-resizer</> can auto detect the most suitable ${e} calculation method. It is recommended that you ${n}
410
+ To remove this warning, delete the <b>${n}CalculationMethod</> option from your parent page config and/or the <i>window.iframeResizer</> config on the child page.
441
411
  `
442
- );
443
- }
444
- function gn(e, t, n) {
445
- const { label: o } = n;
446
- return t !== e && (e in n || (T(`${e} is not a valid option for ${o}CalculationMethod.`), e = t), e in Qo && Ko(o, e)), a(`Set ${o} calculation method: %c${e}`, c), e;
412
+ ), l(`Set ${n} calculation method: %c${P}`, a), P;
447
413
  }
448
- function pn() {
449
- s.heightCalcMode = gn(
450
- s.heightCalcMode,
451
- Ke,
452
- S
453
- );
414
+ function Zo() {
415
+ i.heightCalcMode = mn(i.heightCalcMode, Ee);
454
416
  }
455
- function yn() {
456
- s.widthCalcMode = gn(
457
- s.widthCalcMode,
458
- Kt,
459
- O
460
- );
417
+ function Yo() {
418
+ i.widthCalcMode = mn(i.widthCalcMode, Oe);
461
419
  }
462
- function Xo() {
420
+ function Qo() {
463
421
  try {
464
- i.sameOrigin = s.mode === 1 || "iframeParentListener" in window.parent;
422
+ s.sameOrigin = i.mode === 1 || "iframeParentListener" in window.parent;
465
423
  } catch {
466
- a("Cross domain iframe detected");
424
+ l("Cross domain iframe detected");
467
425
  }
468
426
  }
469
- const er = `<rb>Deprecated Attributes</>
427
+ const Jo = `<rb>Deprecated Attributes</>
470
428
 
471
429
  The <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.`;
472
- function tr() {
430
+ function Ko() {
473
431
  let e = !1;
474
432
  const t = (n) => document.querySelectorAll(`[${n}]`).forEach((o) => {
475
- o.toggleAttribute(Oe, !0), o.removeAttribute(n), e = !0;
433
+ o.toggleAttribute(be, !0), o.removeAttribute(n), e = !0;
476
434
  });
477
- t("data-iframe-height"), t("data-iframe-width"), e && g(er);
435
+ t("data-iframe-height"), t("data-iframe-width"), e && p(Jo);
478
436
  }
479
- let St = 0;
480
- function nr(e) {
437
+ let bt = 0;
438
+ function Xo(e) {
481
439
  const t = e.length === 1 ? "" : "s";
482
- T(
483
- `%c[${te}]%c found on %c${e.length}%c element${t}`,
484
- ft,
485
- K,
486
- ft,
487
- K
440
+ B(
441
+ `%c[${X}]%c found on %c${e.length}%c element${t}`,
442
+ lt,
443
+ Q,
444
+ lt,
445
+ Q
488
446
  );
489
447
  }
490
- function or() {
491
- const e = document.querySelectorAll(`*[${te}]`), t = e.length > 0;
492
- return t && e.length !== St && (nr(e), St = e.length), t;
448
+ function er() {
449
+ const e = document.querySelectorAll(`*[${X}]`), t = e.length > 0;
450
+ return t && e.length !== bt && (Xo(e), bt = e.length), t;
493
451
  }
494
- const Ot = (e) => {
452
+ const he = (e) => {
495
453
  if (!e) return "";
496
454
  let t = -559038744, n = 1103547984;
497
455
  for (let o, r = 0; r < e.length; r++)
498
456
  o = e.codePointAt(r), t = Math.imul(t ^ o, 2246822519), n = Math.imul(n ^ o, 3266489917);
499
457
  return t ^= Math.imul(t ^ n >>> 15, 1935289751), n ^= Math.imul(n ^ t >>> 15, 3405138345), t ^= n >>> 16, n ^= t >>> 16, (2097152 * (n >>> 0) + (t >>> 11)).toString(36);
500
- }, N = (e) => e.replace(
458
+ }, T = (e) => e.replace(
501
459
  /[A-Za-z]/g,
502
460
  (t) => String.fromCodePoint(
503
461
  (t <= "Z" ? 90 : 122) >= (t = t.codePointAt(0) + 19) ? t : t - 26
504
462
  )
505
- ), Q = ["spjluzl", "rlf", "clyzpvu", "rlf2"], rr = [
463
+ ), tr = /* @__PURE__ */ new Date(), hn = (e) => new Set(Array.from({ length: 9 }, e)), zt = " - lewpylk", W = ["spjluzl", "rlf", "clyzpvu", "rlf2", "nlaMbssFlhy"], nr = [
506
464
  "<yi>Puchspk Spjluzl Rlf</><iy><iy>",
507
465
  "<yi>Tpzzpun Spjluzl Rlf</><iy><iy>",
508
466
  "Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>",
509
467
  "<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.",
510
468
  "<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.",
511
- "Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."
512
- ], sr = ["NWSc3", "zvsv", "wyv", "ibzpulzz", "vlt"], Mt = Object.fromEntries(
469
+ "Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz.",
470
+ "<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> fvb jhu bzl aol <i>mpyza 11 johyhjalyz vm fvb spjluzl rlf</> av nla h 60% kpzjvbua ha oaawz://pmyhtl-ylzpgly.jvt/wypjpun.",
471
+ "<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.<iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz.",
472
+ "<yi> VLT rlf lewpylk</><iy><iy>Aol spjluzl rlf fvb hyl bzpun mvy <p>pmyhtl-ylzpgly</> pz myvt h wypvy flhy huk ohz lewpylk. Hu bwkhalk rlf pz ylslhzlk vu aol mpyza vm Uvcltily lhjo flhy.<iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz."
473
+ ], or = (e) => [
474
+ e[0],
475
+ ...e.slice(1).map((t) => `${t}${zt}`),
476
+ `${e[4]}${zt}`,
477
+ ...e.slice(1)
478
+ ], rr = or(["NWSc3", "zvsv", "wyv", "ibzpulzz", "VLT"]), wt = Object.fromEntries(
513
479
  [
514
480
  "2cgs7fdf4xb",
515
481
  "1c9ctcccr4z",
@@ -517,816 +483,863 @@ const Ot = (e) => {
517
483
  "ueokt0969w",
518
484
  "w2zxchhgqz",
519
485
  "1umuxblj2e5",
486
+ "1foobarqaz",
520
487
  "2b5sdlfhbev",
521
488
  "zo4ui3arjo",
522
- "oclbb4thgl"
489
+ "oclbb4thgl",
490
+ "igb1wzrjqr"
523
491
  ].map((e, t) => [e, Math.max(0, t - 1)])
524
- ), G = (e) => N(rr[e]), ir = (e) => N(sr[e]), cr = (e) => N(Q[e]), Rt = (e) => {
525
- const t = e[N(Q[0])] || e[N(Q[1])] || e[N(Q[2])] || e[N(Q[3])];
492
+ ), sr = /* @__PURE__ */ new Set([1, 6]), gn = tr[T(W[4])](), ir = hn((e, t) => he(`${gn + t}`)), cr = hn((e, t) => he(`${gn - ++t}`)), ar = (e) => ir.has(e) ? 9 : cr.has(e) ? 5 : -2, tt = (e) => sr.has(e), I = (e) => T(nr[e]), lr = (e) => T(rr[e]), St = (e) => T(W[e]), Et = (e) => {
493
+ const t = e[T(W[0])] || e[T(W[1])] || e[T(W[2])] || e[T(W[3])];
526
494
  if (!t) return -1;
527
495
  const n = t.split("-");
528
- let o = (function(r = "") {
529
- let u = -2;
530
- const l = Ot(N(r));
531
- return l in Mt && (u = Mt[l]), u > 4 ? u - 4 : u;
532
- })(n[0]);
533
- return o === 0 || ((r) => r[2] === Ot(r[0] + r[1]))(n) || (o = -2), o;
496
+ let o = (function(r = "", d = "") {
497
+ let c = -2;
498
+ const f = he(T(r));
499
+ return f in wt && (c = wt[f]), c === 9 ? ar(d) : c;
500
+ })(...n);
501
+ return o === 0 || ((r) => r[2] === he(r[0] + r[1]))(n) || (o = -2), o;
534
502
  };
535
- function ar({ key: e, key2: t, mode: n, version: o }) {
536
- const r = n, u = Rt({ key: e }), l = Rt({ key2: t });
537
- if (s.mode = n = Math.max(u, l), n < 0) {
538
- if (n = Math.min(u, l), g(`${G(n + 2)}${G(2)}`), U(o))
539
- throw i.firstRun = !1, G(n + 2).replace(/<\/?[a-z][^>]*>|<\/>/gi, "");
540
- } else (!U(o) || r > -1 && n > r) && (sessionStorage.getItem("ifr") !== D && yo(`v${D} (${ir(n)})`, n), n < 2 && g(G(3)), sessionStorage.setItem("ifr", D));
541
- }
542
- const lr = "BackCompat", dr = `<rb>Quirks Mode Detected</>
503
+ function dr(e, t, n) {
504
+ if (!N(n) || t > -1 && e > t) {
505
+ try {
506
+ if (sessionStorage.getItem("ifr") === x) return;
507
+ } catch {
508
+ }
509
+ go(`v${x} (${lr(e)})`, e), e < 2 && p(I(3));
510
+ try {
511
+ sessionStorage.setItem("ifr", x);
512
+ } catch {
513
+ }
514
+ }
515
+ }
516
+ function ur({
517
+ key: e,
518
+ key2: t,
519
+ mode: n,
520
+ version: o
521
+ }) {
522
+ const r = n, d = N(e) ? Et({ key: e }) : -1, c = N(t) ? Et({ key: t }) : -1;
523
+ let f;
524
+ switch (n = Math.max(d, c), n) {
525
+ case -2:
526
+ case -1:
527
+ f = `${I(Math.min(d, c) + 2)}${I(2)}`, s.firstRun = !1;
528
+ break;
529
+ case 1:
530
+ case 2:
531
+ case 3:
532
+ f = I(6);
533
+ break;
534
+ case 4:
535
+ f = I(7);
536
+ break;
537
+ case 5:
538
+ f = I(8);
539
+ break;
540
+ }
541
+ if (dr(n, r, o), (!N(o) || !s.firstRun) && (f && p(f), n < 0))
542
+ throw f.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi, "");
543
+ i.mode = n;
544
+ }
545
+ const fr = "BackCompat", mr = `<rb>Quirks Mode Detected</>
543
546
 
544
547
  This iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.
545
548
 
546
549
  For more information see <u>https://iframe-resizer.com/quirks-mode</>.
547
550
  `;
548
- function ur() {
549
- document.compatMode === lr && g(dr);
551
+ function hr() {
552
+ document.compatMode === fr && p(mr);
550
553
  }
551
- const fr = "complete";
552
- let $t = !1;
553
- function bn(e) {
554
- document.readyState === fr ? Re(e) : $t || j(
554
+ const gr = "complete";
555
+ let Ot = !1;
556
+ function pn(e) {
557
+ document.readyState === gr ? Se(e) : Ot || j(
555
558
  document,
556
- Vt,
557
- () => bn(e)
558
- ), $t = !0;
559
+ Ht,
560
+ () => pn(e)
561
+ ), Ot = !0;
559
562
  }
560
- const mr = () => {
561
- d(`Set targetOrigin for parent: %c${s.targetOrigin}`, c), s.autoResize !== !0 && a("Auto Resize disabled");
563
+ const pr = () => {
564
+ u(`Set targetOrigin for parent: %c${i.targetOrigin}`, a), i.autoResize !== !0 && l("Auto Resize disabled");
562
565
  };
563
- function vn() {
564
- i.taggedElements = document.querySelectorAll(`[${Oe}]`), i.hasTags = i.taggedElements.length > 0, a(`Tagged elements found: %c${i.hasTags}`, c);
566
+ function yn() {
567
+ s.taggedElements = document.querySelectorAll(`[${be}]`), s.hasTags = s.taggedElements.length > 0, l(`Tagged elements found: %c${s.hasTags}`, a);
565
568
  }
566
- const hr = `<rb>Legacy version detected on parent page</>
569
+ const yr = `<rb>Legacy version detected on parent page</>
567
570
 
568
571
  Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
569
572
 
570
573
  See <u>https://iframe-resizer.com/setup/</> for more details.
571
- `, gr = (e) => `<b>Version mismatch</>
574
+ `, vr = (e) => `<b>Version mismatch</>
572
575
 
573
576
  The parent and child pages are running different versions of <i>iframe resizer</>.
574
577
 
575
- Parent page: ${e} - Child page: ${D}.
578
+ Parent page: ${e} - Child page: ${x}.
576
579
  `;
577
- function pr({ version: e }) {
578
- !e || e === "" || e === Xn ? g(hr) : e !== D && g(gr(e));
580
+ function br({ version: e }) {
581
+ !e || e === "" || e === Qn ? p(yr) : e !== x && p(vr(e));
579
582
  }
580
- const yr = tn(() => g(G(4)));
581
- function br(e) {
582
- if (!i.timerActive) return;
583
- const t = _(performance.now() - i.totalTime), n = e === Se ? `Initialised iframe in %c${t}ms` : `Size calculated in %c${t}ms`;
584
- a(n, c);
583
+ const zr = Kt(() => p(I(4)));
584
+ function wr(e) {
585
+ if (!s.timerActive) return;
586
+ const t = D(performance.now() - s.totalTime), n = e === ve ? `Initialised iframe in %c${t}ms` : `Size calculated in %c${t}ms`;
587
+ l(n, a);
585
588
  }
586
- function vr(e) {
587
- return e === void 0 ? e = s.targetOrigin : a(`Message targetOrigin: %c${e}`, c), e;
589
+ function Sr(e) {
590
+ return e === void 0 ? e = i.targetOrigin : l(`Message targetOrigin: %c${e}`, a), e;
588
591
  }
589
- function wr(e, t) {
590
- const { mode: n } = s, { sameOrigin: o, target: r } = i;
592
+ function Er(e, t) {
593
+ const { mode: n } = i, { sameOrigin: o, target: r } = s;
591
594
  if (o)
592
595
  try {
593
- window.parent.iframeParentListener(he + e);
594
- } catch (u) {
595
- if (n === 1) yr();
596
- else throw u;
596
+ window.parent.iframeParentListener(de + e);
597
+ } catch (d) {
598
+ if (tt(n)) zr();
599
+ else throw d;
597
600
  return !1;
598
601
  }
599
- else r.postMessage(he + e, vr(t));
602
+ else {
603
+ po(r, "Internal error: postMessage target is undefined");
604
+ const d = Sr(t), c = Array.isArray(d) ? d : [d];
605
+ for (const f of c)
606
+ r.postMessage(de + e, f);
607
+ }
600
608
  return !0;
601
609
  }
602
- function wn(e, t, n, o, r) {
603
- const { parentId: u } = s, { sameOrigin: l } = i, p = `${e}:${t}`, v = `${u}:${p}:${n}${o === void 0 ? "" : `:${o}`}`;
604
- s.mode < -1 || !wr(v, r) || (br(n), d(
605
- `Sending message to parent page via ${l ? "sameOrigin" : "postMessage"}: %c%c${v}`,
606
- jn,
607
- c
610
+ function vn(e, t, n, o, r) {
611
+ const { parentId: d } = i, { sameOrigin: c } = s, f = `${e}:${t}`, b = `${d}:${f}:${n}${o === void 0 ? "" : `:${o}`}`;
612
+ i.mode < -1 || !Er(b, r) || (wr(n), u(
613
+ `Sending message to parent page via ${c ? "sameOrigin" : "postMessage"}: %c%c${b}`,
614
+ Cn,
615
+ a
608
616
  ));
609
617
  }
610
- const y = et(
618
+ const y = Qe(
611
619
  (e, t, n, o, r) => {
612
- m(n), wn(e, t, n, o, r), B();
620
+ h(n), vn(e, t, n, o, r), F();
613
621
  }
614
- ), zr = (e) => y(0, 0, e.type, `${e.screenY}:${e.screenX}`);
615
- function Tt(e, t) {
616
- a(`Add event listener: %c${t}`, c), j(window.document, e, zr);
622
+ ), Or = (e) => y(0, 0, e.type, `${e.screenY}:${e.screenX}`);
623
+ function $t(e, t) {
624
+ l(`Add event listener: %c${t}`, a), j(window.document, e, Or);
617
625
  }
618
- function Er({ mouseEvents: e }) {
619
- e === !0 && (Tt(Fn, "Mouse Enter"), Tt(Wn, "Mouse Leave"));
626
+ function $r({
627
+ mouseEvents: e
628
+ }) {
629
+ e === !0 && ($t(Bn, "Mouse Enter"), $t(Fn, "Mouse Leave"));
620
630
  }
621
- const Sr = () => y(0, 0, Dn);
622
- function Or({ persisted: e }) {
623
- e || Sr(), m(Bt), d("Page persisted:", e), !e && nt.forEach(ro);
631
+ const Rr = () => y(0, 0, _n);
632
+ function Mr({ persisted: e }) {
633
+ e || Rr(), h(jt), u("Page persisted:", e), !e && Ke.forEach(no);
624
634
  }
625
- const Mr = () => j(window, so(Bt), Or), It = (e, t) => !(Math.abs(e - t) <= s.tolerance);
626
- function Rr(e, t) {
627
- const { calculateHeight: n, calculateWidth: o } = s, { height: r, width: u } = i;
628
- return n && It(r, e) || o && It(u, t);
635
+ const kr = () => j(window, oo(jt), Mr), Rt = (e, t) => !(Math.abs(e - t) <= i.tolerance);
636
+ function Tr(e, t) {
637
+ const { calculateHeight: n, calculateWidth: o } = i, { height: r, width: d } = s;
638
+ return n && Rt(r, e) || o && Rt(d, t);
629
639
  }
630
- function $r(e) {
631
- const t = s.onBeforeResize(e);
632
- if (t === void 0)
640
+ function Ar(e, t, n) {
641
+ const o = i.onBeforeResize(e, t, n);
642
+ if (o === void 0)
633
643
  throw new TypeError(
634
644
  "No value returned from onBeforeResize(), expected a numeric value"
635
645
  );
636
- if (Number.isNaN(t))
646
+ if (Number.isNaN(o))
637
647
  throw new TypeError(
638
- `Invalid value returned from onBeforeResize(): ${t}, expected Number`
648
+ `Invalid value returned from onBeforeResize(): ${o}, expected Number`
639
649
  );
640
- if (t < X)
650
+ if (o < J)
641
651
  throw new RangeError(
642
- `Out of range value returned from onBeforeResize(): ${t}, must be at least ${X}`
652
+ `Out of range value returned from onBeforeResize(): ${o}, must be at least ${J}`
643
653
  );
644
- return t;
645
- }
646
- const zn = (e) => (t) => {
647
- const n = e[t]();
648
- return e.enabled() && s.onBeforeResize !== void 0 ? $r(n) : n;
649
- }, Tr = zn(S), Ir = zn(O);
650
- function Ar(e, t, n, o) {
651
- const { heightCalcMode: r, widthCalcMode: u } = s, l = n ?? Tr(r), p = o ?? Ir(u), v = Rr(l, p) ? mt : e;
652
- switch (a(`Resize event: %c${t}`, c), v) {
653
- case Se:
654
- case De:
655
- case mt:
656
- case Ze:
657
- case Ye:
658
- i.height = l, i.width = p;
654
+ return o;
655
+ }
656
+ const bn = (e, t) => (n, o) => {
657
+ const r = e[n]();
658
+ return e.enabled() && i.onBeforeResize !== void 0 ? Ar(r, o, t) : r;
659
+ }, Ir = bn(Ee, ze), Nr = bn(Oe, Ft);
660
+ function Pr() {
661
+ (window.scrollY !== 0 || window.scrollX !== 0) && (u("Reset iframe scroll position to (0, 0)"), window.scrollTo(0, 0));
662
+ }
663
+ function Cr(e, t, n, o) {
664
+ const { heightCalcMode: r, widthCalcMode: d } = i;
665
+ Pr();
666
+ const c = n ?? Ir(r, e), f = o ?? Nr(d, e), b = Tr(c, f) ? dt : e;
667
+ switch (l(`Resize event: %c${t}`, a), b) {
668
+ case ve:
669
+ case je:
670
+ case dt:
671
+ case Ue:
672
+ case Ge:
673
+ s.height = c, s.width = f;
659
674
  // eslint-disable-next-line no-fallthrough
660
- case qt:
661
- return i;
675
+ case Ut:
676
+ return s;
662
677
  // the following case needs {} to prevent a compile error on Next.js
663
- case Qe:
664
- case Yt:
665
- case Zt:
666
- case Qt: {
667
- a(gt);
678
+ case qe:
679
+ case qt:
680
+ case Gt:
681
+ case Zt: {
682
+ l(ut);
668
683
  break;
669
684
  }
670
685
  default:
671
- d(gt);
686
+ u(ut);
672
687
  }
673
688
  return null;
674
689
  }
675
- let ae = !1, Ce = !1, Z = null;
676
- function Cr(e, t, n, o, r) {
677
- const { autoResize: u } = s, { isHidden: l } = i;
678
- switch (m(e), !0) {
679
- case l === !0: {
680
- if (Ce === !0) break;
681
- a("Iframe hidden - Ignored resize request"), Ce = !0, ae = !1, cancelAnimationFrame(Z), Z = null;
690
+ let re = !1, Ae = !1, q = null;
691
+ function Lr(e, t, n, o, r) {
692
+ const { autoResize: d } = i, { isHidden: c } = s;
693
+ switch (h(e), !0) {
694
+ // Allow manual and parent resize requests to bypass the hidden check
695
+ case (c === !0 && !(e in Te)): {
696
+ if (Ae === !0) break;
697
+ l("Iframe hidden - Ignored resize request"), Ae = !0, re = !1, cancelAnimationFrame(q), q = null;
682
698
  break;
683
699
  }
684
700
  // Ignore overflowObserver here, as more efficient than using
685
701
  // mutationObserver to detect OVERFLOW_ATTR changes
686
702
  // Also allow manual and parent resize requests to bypass the pending check
687
- case (ae === !0 && e !== Qe && !(e in ht)): {
688
- a("Resize already pending - Ignored resize request");
703
+ case (re === !0 && e !== qe && !(e in Te)): {
704
+ l("Resize already pending - Ignored resize request");
689
705
  break;
690
706
  }
691
- case (!u && !(e in ht)): {
692
- d("Resizing disabled");
707
+ case (!d && !(e in Te)): {
708
+ u("Resizing disabled");
693
709
  break;
694
710
  }
695
711
  default: {
696
- Ce = !1, ae = !0, i.totalTime = performance.now(), i.timerActive = !0;
697
- const p = Ar(
712
+ Ae = !1, re = !0, s.totalTime = performance.now(), s.timerActive = !0;
713
+ const f = Cr(
698
714
  e,
699
715
  t,
700
716
  n,
701
717
  o
702
718
  );
703
- p && wn(p.height, p.width, e, r), Z || (Z = requestAnimationFrame(() => {
704
- ae = !1, Z = null, m("requestAnimationFrame"), pe(`Reset sendPending: %c${e}`, c);
705
- })), i.timerActive = !1;
719
+ f && vn(f.height, f.width, e, r), q || (q = requestAnimationFrame(() => {
720
+ re = !1, q = null, h("requestAnimationFrame"), fe(`Reset sendPending: %c${e}`, a);
721
+ })), s.timerActive = !1;
706
722
  }
707
723
  }
708
- B();
724
+ F();
709
725
  }
710
- const I = et(Cr);
711
- function At({ eventType: e, eventName: t }) {
712
- j(window, t, () => I(t, e), { passive: !0 });
726
+ const M = Qe(Lr);
727
+ function Mt({
728
+ eventType: e,
729
+ eventName: t
730
+ }) {
731
+ j(window, t, () => M(t, e), { passive: !0 });
713
732
  }
714
- function kr() {
715
- At({
733
+ function jr() {
734
+ Mt({
716
735
  eventType: "After Print",
717
736
  eventName: "afterprint"
718
- }), At({
737
+ }), Mt({
719
738
  eventType: "Before Print",
720
739
  eventName: "beforeprint"
721
740
  });
722
741
  }
723
- function Nr() {
724
- if (i.triggerLocked) {
725
- a("TriggerLock blocked calculation");
742
+ function _r() {
743
+ if (s.triggerLocked) {
744
+ l("TriggerLock blocked calculation");
726
745
  return;
727
746
  }
728
- i.triggerLocked = !0, pe("Trigger event lock on"), requestAnimationFrame(() => {
729
- i.triggerLocked = !1, pe("Trigger event lock off");
747
+ s.triggerLocked = !0, fe("Trigger event lock on"), requestAnimationFrame(() => {
748
+ s.triggerLocked = !1, fe("Trigger event lock off");
730
749
  });
731
750
  }
732
- function En(e) {
733
- const { heightCalcMode: t, widthCalcMode: n } = s, o = S[t](), r = O[n]();
734
- a(`Reset trigger event: %c${e}`, c), y(o, r, e);
735
- }
736
- function Pr(e) {
737
- const t = s.heightCalcMode;
738
- a(`Reset trigger event: %c${e}`, c), s.heightCalcMode = Ke, Nr(), En("reset"), s.heightCalcMode = t;
739
- }
740
- const Lr = `Auto Resize can not be changed when <b>direction</> is set to '${Je}'.`;
741
- function jr(e) {
742
- $(e, Qn, "parentIframe.autoResize(enable) enable");
743
- const { autoResize: t, calculateHeight: n, calculateWidth: o } = s;
744
- return o === !1 && n === !1 ? (m(De), g(Lr), !1) : (e === !0 && t === !1 ? (s.autoResize = !0, queueMicrotask(() => I(De, "Auto Resize enabled"))) : e === !1 && t === !0 && (s.autoResize = !1), y(0, 0, _n, JSON.stringify(s.autoResize)), s.autoResize);
745
- }
746
- function xr(e) {
747
- s.heightCalcMode = e, pn();
748
- }
749
- function _r(e) {
750
- s.widthCalcMode = e, yn();
751
+ function zn(e) {
752
+ const { heightCalcMode: t, widthCalcMode: n } = i, o = Ee[t](), r = Oe[n]();
753
+ l(`Reset trigger event: %c${e}`, a), y(o, r, e);
751
754
  }
752
755
  function Dr(e) {
753
- $(e, oe, "parentIframe.moveToAnchor(anchor) anchor"), i.inPageLinks.findTarget(e);
756
+ const t = i.heightCalcMode;
757
+ l(`Reset trigger event: %c${e}`, a), i.heightCalcMode = Xn, _r(), zn("reset"), i.heightCalcMode = t;
754
758
  }
759
+ const xr = `Auto Resize can not be changed when <b>direction</> is set to '${Ze}'.`;
755
760
  function Br(e) {
756
- $(e, L, "parentIframe.setOffsetSize(offset) offset"), s.offsetHeight = e, s.offsetWidth = e, I(qt, `parentIframe.setOffsetSize(${e})`);
761
+ R(e, qn, "parentIframe.autoResize(enable) enable");
762
+ const {
763
+ autoResize: t,
764
+ calculateHeight: n,
765
+ calculateWidth: o
766
+ } = i;
767
+ return o === !1 && n === !1 ? (h(je), p(xr), !1) : (e === !0 && t === !1 ? (i.autoResize = !0, queueMicrotask(() => M(je, "Auto Resize enabled"))) : e === !1 && t === !0 && (i.autoResize = !1), y(0, 0, jn, JSON.stringify(i.autoResize)), i.autoResize);
768
+ }
769
+ function Fr(e) {
770
+ R(e, ee, "parentIframe.moveToAnchor(anchor) anchor"), s.inPageLinks.findTarget(e);
757
771
  }
758
- function Hr() {
759
- return m("getOrigin"), cn("getOrigin()", "getParentOrigin()"), i.origin;
772
+ function Hr(e) {
773
+ R(e, L, "parentIframe.setOffsetSize(offset) offset"), i.offsetHeight = e, i.offsetWidth = e, M(Ut, `parentIframe.setOffsetSize(${e})`);
760
774
  }
761
- const Fr = () => i.origin;
762
- function Wr(e) {
763
- $(
775
+ function Vr() {
776
+ return h("getOrigin"), on("getOrigin()", "getParentOrigin()"), s.origin;
777
+ }
778
+ const Wr = () => s.origin;
779
+ function Ur(e) {
780
+ R(
764
781
  e,
765
- oe,
782
+ ee,
766
783
  "parentIframe.setTargetOrigin(targetOrigin) targetOrigin"
767
- ), a(`Set targetOrigin: %c${e}`, c), s.targetOrigin = e;
784
+ ), l(`Set targetOrigin: %c${e}`, a), i.targetOrigin = e;
768
785
  }
769
- function Ur(e) {
770
- if (typeof e === re) {
771
- i.onPageInfo = e, y(0, 0, Ht), vo(
786
+ function Gr(e) {
787
+ if (typeof e === we) {
788
+ s.onPageInfo = e, y(0, 0, _t), vo(
772
789
  "getPageInfo()",
773
790
  "getParentProps()",
774
791
  "See <u>https://iframe-resizer.com/upgrade</> for details. "
775
792
  );
776
793
  return;
777
794
  }
778
- i.onPageInfo = null, y(0, 0, Un);
795
+ s.onPageInfo = null, y(0, 0, Hn);
779
796
  }
780
- function Sn(e) {
781
- return $(
797
+ function wn(e) {
798
+ return R(
782
799
  e,
783
- re,
800
+ we,
784
801
  "parentIframe.getParentProps(callback) callback"
785
- ), i.onParentInfo = e, y(0, 0, Ft), () => {
786
- i.onParentInfo = null, y(0, 0, Gn);
802
+ ), s.onParentInfo = e, y(0, 0, Dt), () => {
803
+ s.onParentInfo = null, y(0, 0, Vn);
787
804
  };
788
805
  }
789
- function Gr(e) {
790
- cn("getParentProperties()", "getParentProps()"), Sn(e);
806
+ function qr(e) {
807
+ return on("getParentProperties()", "getParentProps()"), wn(e);
791
808
  }
792
- const Vr = (e) => `<rb>Deprecated API object name</>
809
+ const Zr = (e) => `<rb>Deprecated API object name</>
793
810
  The <b>window.parentIFrame</> object has been renamed to <b>window.parentIframe</>. Please update your code as the old object will be removed in a future version.
794
811
 
795
812
  Called property: '${String(e)}'
796
813
  `;
797
- function qr(e) {
814
+ function Yr(e) {
798
815
  const t = /* @__PURE__ */ new Set();
799
816
  return new Proxy(e, {
800
- get(n, o) {
801
- t.has(o) || (g(Vr(o)), t.add(o));
802
- const r = n[o], u = Object.getOwnPropertyDescriptor(n, o);
803
- return u && !u.configurable && !u.writable ? r : typeof r == "function" ? r.bind(n) : r;
817
+ // eslint-disable-next-line @typescript-eslint/no-shadow
818
+ get(n, o, r) {
819
+ t.has(o) || (p(Zr(o)), t.add(o));
820
+ const d = Reflect.get(n, o, r), c = Object.getOwnPropertyDescriptor(n, o);
821
+ return c && !c.configurable && !c.writable ? d : typeof d == "function" ? d.bind(n) : d;
804
822
  }
805
823
  });
806
824
  }
807
- function Zr(e, t) {
808
- e !== void 0 && $(
825
+ function Qr(e, t) {
826
+ e !== void 0 && R(
809
827
  e,
810
828
  L,
811
829
  "parentIframe.resize(customHeight, customWidth) customHeight"
812
- ), t !== void 0 && $(
830
+ ), t !== void 0 && R(
813
831
  t,
814
832
  L,
815
833
  "parentIframe.resize(customHeight, customWidth) customWidth"
816
834
  );
817
- const n = `${e || ""}${t ? `,${t}` : ""}`;
818
- I(
819
- Ze,
820
- `parentIframe.resize(${n})`,
835
+ const n = e === void 0 ? "" : e, o = t === void 0 ? "" : `,${t}`, r = `${n}${o}`;
836
+ M(
837
+ Ue,
838
+ `parentIframe.resize(${r})`,
821
839
  e,
822
840
  t
823
841
  );
824
842
  }
825
- const st = (e) => (t, n) => {
826
- $(t, L, `parentIframe.${e}(x, y) x`), $(n, L, `parentIframe.${e}(x, y) y`), y(n, t, e);
827
- }, Yr = st(Vn), Qr = st(qn), Jr = st(Wt);
828
- function Kr(e, t) {
829
- t && $(
843
+ const nt = (e) => (t, n) => {
844
+ R(t, L, `parentIframe.${e}(x, y) x`), R(n, L, `parentIframe.${e}(x, y) y`), y(n, t, e);
845
+ }, Jr = nt(Wn), Kr = nt(Un), Xr = nt(xt);
846
+ function es(e, t) {
847
+ t && R(
830
848
  t,
831
- oe,
849
+ ee,
832
850
  "parentIframe.sendMessage(msg, targetOrigin) targetOrigin"
833
- ), y(0, 0, je, JSON.stringify(e), t);
834
- }
835
- const Xr = () => y(0, 0, Bn), es = () => s.parentId, ts = () => Pr("parentIframe.reset"), ns = () => T("parentIframe.size() has been renamed parentIframe.resize()");
836
- function os() {
837
- const { win: e } = i;
838
- s.mode !== 1 && (e.parentIframe = Object.freeze({
839
- autoResize: jr,
840
- close: Xr,
841
- getId: es,
842
- getOrigin: Hr,
851
+ ), y(0, 0, Le, JSON.stringify(e), t);
852
+ }
853
+ const ts = () => y(0, 0, Dn), ns = () => i.parentId, os = () => Dr("parentIframe.reset"), rs = () => B("parentIframe.size() has been renamed parentIframe.resize()");
854
+ function ss() {
855
+ const { win: e } = s;
856
+ i.mode !== 1 && (e.parentIframe = Object.freeze({
857
+ autoResize: Br,
858
+ close: ts,
859
+ getId: ns,
860
+ getOrigin: Vr,
843
861
  // TODO Remove in V6
844
- getParentOrigin: Fr,
845
- getPageInfo: Ur,
862
+ getParentOrigin: Wr,
863
+ getPageInfo: Gr,
846
864
  // TODO Remove in V6
847
- getParentProps: Sn,
848
- getParentProperties: Gr,
865
+ getParentProps: wn,
866
+ getParentProperties: qr,
849
867
  // TODO Remove in V6
850
- moveToAnchor: Dr,
851
- reset: ts,
852
- setOffsetSize: Br,
853
- scrollBy: Yr,
854
- scrollTo: Qr,
855
- scrollToOffset: Jr,
856
- sendMessage: Kr,
857
- setHeightCalculationMethod: xr,
858
- setWidthCalculationMethod: _r,
859
- setTargetOrigin: Wr,
860
- resize: Zr,
861
- size: ns
868
+ moveToAnchor: Fr,
869
+ reset: os,
870
+ setOffsetSize: Hr,
871
+ scrollBy: Jr,
872
+ scrollTo: Kr,
873
+ scrollToOffset: Xr,
874
+ sendMessage: es,
875
+ setTargetOrigin: Ur,
876
+ resize: Qr,
877
+ size: rs
862
878
  // TODO Remove in V6
863
- }), e.parentIFrame = qr(e.parentIframe));
879
+ }), e.parentIFrame = Yr(e.parentIframe));
864
880
  }
865
- const se = (e = "") => (t) => (n) => {
866
- n.size > 0 && pe(
881
+ const te = (e = "") => (t) => (n) => {
882
+ n.size > 0 && fe(
867
883
  `${t}Observer ${e}:`,
868
- ...Array.from(n).flatMap((o) => [qe, o])
884
+ ...Array.from(n).flatMap((o) => [We, o])
869
885
  );
870
- }, rs = (e = "") => (t) => (n) => {
871
- n.size > 0 && sn(
886
+ }, is = (e = "") => (t) => (n) => {
887
+ n.size > 0 && nn(
872
888
  `${t}Observer ${e}:`,
873
- ...Array.from(n).flatMap((o) => [qe, o])
889
+ ...Array.from(n).flatMap((o) => [We, o])
874
890
  );
875
- }, On = se("attached to"), Mn = rs("already attached"), ss = se("detached from"), $e = (e, t = !0) => (n) => {
876
- n > 0 && d(
891
+ }, Sn = te("attached to"), En = is("already attached"), cs = te("detached from"), $e = (e, t = !0) => (n) => {
892
+ n > 0 && u(
877
893
  `${t ? "At" : "De"}tached %c${e}Observer%c ${t ? "to" : "from"} %c${n}%c element${n === 1 ? "" : "s"}`,
878
- c,
879
- K,
880
- c,
881
- K
894
+ a,
895
+ Q,
896
+ a,
897
+ Q
882
898
  );
883
- }, Rn = (e, t, n, o) => {
884
- const r = ss(e);
885
- return (u) => {
886
- const l = /* @__PURE__ */ new Set();
887
- let p = 0;
888
- for (const v of u)
889
- n.has(v) && (t.unobserve(v), n.delete(v), l.add(v), p += 1);
890
- r(l), o(p), l.clear();
899
+ }, On = (e, t, n, o) => {
900
+ const r = cs(e);
901
+ return (d) => {
902
+ const c = /* @__PURE__ */ new Set();
903
+ let f = 0;
904
+ for (const b of d)
905
+ n.has(b) && (t.unobserve(b), n.delete(b), c.add(b), f += 1);
906
+ r(c), o(f), c.clear();
891
907
  };
892
- }, Ct = 16, kt = 2, is = 200, it = "Mutation", M = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set(), Fe = /* @__PURE__ */ new Set(), we = [], cs = {
908
+ }, kt = 16, Tt = 2, as = 200, ot = "Mutation", O = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), xe = /* @__PURE__ */ new Set(), ge = [], ls = {
893
909
  attributes: !0,
894
- attributeFilter: [te, Oe],
910
+ attributeFilter: [X, be],
895
911
  attributeOldValue: !1,
896
912
  characterData: !1,
897
913
  characterDataOldValue: !1,
898
914
  childList: !0,
899
915
  subtree: !0
900
916
  };
901
- let ke = 1, ct, We = !1, Ue = 0;
902
- const as = se("added")(it), ls = se("removed (page)")(it), ds = se("removed (added)")(it), $n = (e) => e.nodeType !== Node.ELEMENT_NODE || en.has(e.tagName.toLowerCase());
903
- function us(e) {
917
+ let Ie = 1, rt, Be = !1, Fe = 0;
918
+ const ds = te("added")(ot), us = te("removed (page)")(ot), fs = te("removed (added)")(ot), $n = (e) => e.nodeType !== Node.ELEMENT_NODE || Jt.has(e.tagName.toLowerCase());
919
+ function ms(e) {
904
920
  const t = e.addedNodes;
905
921
  for (const n of t)
906
- $n(n) || M.add(n);
922
+ $n(n) || O.add(n);
907
923
  }
908
- function fs(e) {
924
+ function hs(e) {
909
925
  const t = e.removedNodes;
910
926
  for (const n of t)
911
- $n(n) || (M.has(n) ? (M.delete(n), Fe.add(n)) : P.add(n));
927
+ $n(n) || (O.has(n) ? (O.delete(n), xe.add(n)) : C.add(n));
912
928
  }
913
- const ms = (e) => {
914
- d("Mutations:", e);
929
+ const gs = (e) => {
930
+ u("Mutations:", e);
915
931
  for (const t of e)
916
- us(t), fs(t);
917
- as(M), ls(P), ds(Fe), Fe.clear();
932
+ ms(t), hs(t);
933
+ ds(O), us(C), fs(xe), xe.clear();
918
934
  };
919
- function hs() {
920
- P.size > 0 && a(
921
- `Detected %c${P.size} %cremoved element${P.size > 1 ? "s" : ""}`,
922
- c,
923
- w
924
- ), M.size > 0 && a(
925
- `Found %c${M.size} %cnew element${M.size > 1 ? "s" : ""}`,
926
- c,
927
- w
935
+ function ps() {
936
+ C.size > 0 && l(
937
+ `Detected %c${C.size} %cremoved element${C.size > 1 ? "s" : ""}`,
938
+ a,
939
+ z
940
+ ), O.size > 0 && l(
941
+ `Found %c${O.size} %cnew element${O.size > 1 ? "s" : ""}`,
942
+ a,
943
+ z
928
944
  );
929
945
  }
930
- const gs = (e) => () => {
931
- const t = performance.now(), n = t - Ue, o = Ct * ke++ + kt;
932
- if (n > o && n < is) {
933
- m("mutationThrottled"), d("Update delayed due to heavy workload on the callStack"), d(
934
- `EventLoop busy time: %c${_(n)}ms %c> Max wait: %c${o - kt}ms`,
935
- c,
936
- w,
937
- c
938
- ), setTimeout(ct, Ct * ke), Ue = t;
946
+ const ys = (e) => () => {
947
+ const t = performance.now(), n = t - Fe, o = kt * Ie++ + Tt;
948
+ if (n > o && n < as) {
949
+ h("mutationThrottled"), u("Update delayed due to heavy workload on the callStack"), u(
950
+ `EventLoop busy time: %c${D(n)}ms %c> Max wait: %c${o - Tt}ms`,
951
+ a,
952
+ z,
953
+ a
954
+ ), setTimeout(rt, kt * Ie), Fe = t;
939
955
  return;
940
956
  }
941
- ke = 1, we.forEach(ms), we.length = 0, We = !1, hs(), e({ addedNodes: M, removedNodes: P }), M.clear(), P.clear();
957
+ Ie = 1, ge.forEach(gs), ge.length = 0, Be = !1, ps(), e({ addedNodes: O, removedNodes: C }), O.clear(), C.clear();
942
958
  };
943
- function ps(e) {
944
- we.push(e), !We && (Ue = performance.now(), We = !0, requestAnimationFrame(ct));
959
+ function vs(e) {
960
+ ge.push(e), !Be && (Fe = performance.now(), Be = !0, requestAnimationFrame(rt));
945
961
  }
946
- function ys(e) {
947
- const t = new window.MutationObserver(ps), n = document.body || document.documentElement;
948
- return ct = gs(e), t.observe(n, cs), d("Attached%c MutationObserver%c to body", c, w), {
949
- ...t,
962
+ function bs(e) {
963
+ const t = new window.MutationObserver(vs), n = document.body || document.documentElement;
964
+ return rt = ys(e), t.observe(n, ls), u("Attached%c MutationObserver%c to body", a, z), {
950
965
  disconnect: () => {
951
- M.clear(), P.clear(), we.length = 0, t.disconnect(), d("Detached%c MutationObserver", c);
966
+ O.clear(), C.clear(), ge.length = 0, t.disconnect(), u("Detached%c MutationObserver", a);
952
967
  }
953
968
  };
954
969
  }
955
- const bs = {
970
+ const zs = {
956
971
  characterData: !0,
957
972
  childList: !0,
958
973
  subtree: !0
959
974
  };
960
- function vs(e) {
975
+ function ws(e) {
961
976
  const t = document.querySelector("title") ?? document.head ?? document.documentElement, n = new MutationObserver(e);
962
- return n.observe(t, bs), d("Attached%c TitleObserver%c to head", c, w), setTimeout(e), {
977
+ return n.observe(t, zs), u("Attached%c TitleObserver%c to head", a, z), setTimeout(e), {
963
978
  disconnect: () => {
964
- n.disconnect(), d("Detached%c TitleObserver", c);
979
+ n.disconnect(), u("Detached%c TitleObserver", a);
965
980
  }
966
981
  };
967
982
  }
968
- function ws(e) {
983
+ function Ss(e) {
969
984
  const t = new IntersectionObserver(
970
985
  (o) => e(o.at(-1)?.isIntersecting ?? !1),
971
986
  {
972
987
  threshold: 0
973
988
  }
974
989
  ), n = document.documentElement;
975
- return t.observe(n), d("Attached%c VisibilityObserver%c to page", c, w), {
990
+ return t.observe(n), u("Attached%c VisibilityObserver%c to page", a, z), {
976
991
  disconnect: () => {
977
- t.disconnect(), d("Detached%c VisibilityObserver", c);
992
+ t.disconnect(), u("Detached%c VisibilityObserver", a);
978
993
  }
979
994
  };
980
995
  }
981
- let Nt = /* @__PURE__ */ new Set();
982
- function zs(e) {
996
+ let At = /* @__PURE__ */ new Set();
997
+ function Es(e) {
983
998
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
984
999
  for (const o of e)
985
- o.closest(`[${te}]`) ? n.add(o) : t.add(o);
1000
+ o.closest(`[${X}]`) ? n.add(o) : t.add(o);
986
1001
  return n.size > 0 && queueMicrotask(() => {
987
- m("overflowIgnored"), d(`Ignoring elements with [data-iframe-ignore] > *:
988
- `, n), B();
1002
+ h("overflowIgnored"), u(`Ignoring elements with [data-iframe-ignore] > *:
1003
+ `, n), F();
989
1004
  }), t;
990
1005
  }
991
- function Tn() {
992
- const e = document.querySelectorAll(`[${Ut}]`), t = zs(e);
993
- let n = !1;
994
- return typeof Set.prototype.symmetricDifference === re && (n = t.symmetricDifference(Nt).size > 0), Nt = t, i.overflowedNodeSet = t, i.hasOverflow = t.size > 0, { hasOverflowUpdated: n, overflowedNodeSet: t };
1006
+ function Rn() {
1007
+ const e = document.querySelectorAll(`[${Bt}]`), t = Es(e);
1008
+ let n = !0;
1009
+ return typeof Set.prototype.symmetricDifference === we && (n = t.symmetricDifference(At).size > 0), At = t, s.overflowedNodeSet = t, s.hasOverflow = t.size > 0, { hasOverflowUpdated: n, overflowedNodeSet: t };
995
1010
  }
996
- const R = {}, In = (e) => {
1011
+ const $ = {}, Mn = (e) => {
997
1012
  const t = /* @__PURE__ */ new Set();
998
- for (const n of e) {
999
- t.add(n);
1000
- for (const o of ot(n)) t.add(o);
1001
- }
1002
- return d(`Inspecting:
1013
+ for (const n of e)
1014
+ if (n instanceof Element) {
1015
+ t.add(n);
1016
+ for (const o of et(n)) t.add(o);
1017
+ }
1018
+ return u(`Inspecting:
1003
1019
  `, t), t;
1004
- }, Es = (e) => {
1020
+ }, Os = (e) => {
1005
1021
  if (e.size === 0) return;
1006
- m("addObservers");
1007
- const t = In(e);
1008
- R.overflow.attachObservers(t), R.resize.attachObserverToNonStaticElements(t), B();
1009
- }, Ss = (e) => {
1022
+ h("addObservers");
1023
+ const t = Mn(e);
1024
+ $.overflow.attachObservers(t), $.resize.attachObserverToNonStaticElements(t), F();
1025
+ }, $s = (e) => {
1010
1026
  if (e.size === 0) return;
1011
- m("removeObservers");
1012
- const t = In(e);
1013
- R.overflow.detachObservers(t), R.resize.detachObservers(t), B();
1027
+ h("removeObservers");
1028
+ const t = Mn(e);
1029
+ $.overflow.detachObservers(t), $.resize.detachObservers(t), F();
1014
1030
  };
1015
- function Os({ addedNodes: e, removedNodes: t }) {
1016
- m("contentMutated"), i.applySelectors(), vn(), Tn(), B(), Ss(t), Es(e);
1031
+ function Rs({
1032
+ addedNodes: e,
1033
+ removedNodes: t
1034
+ }) {
1035
+ h("contentMutated"), s.applySelectors(), yn(), Rn(), F(), $s(t), Os(e);
1017
1036
  }
1018
1037
  function Ms(e) {
1019
- Os(e), I(Yt, "Mutation Observed");
1038
+ Rs(e), M(qt, "Mutation Observed");
1020
1039
  }
1021
- const ie = "Overflow", Rs = $e(ie), $s = $e(ie, !1), Ts = On(ie), Is = Mn(ie), As = (e) => e.hidden || e.offsetParent === null || e.style.display === Je, Cs = (e, t) => {
1040
+ const ne = "Overflow", ks = $e(ne), Ts = $e(ne, !1), As = Sn(ne), Is = En(ne), Ns = (e) => e instanceof HTMLElement && (!!e.hidden || e.offsetParent === null || e.style.display === Ze), Ps = (e, t) => {
1022
1041
  const n = t.side, o = {
1023
1042
  root: t.root,
1024
1043
  rootMargin: "0px",
1025
1044
  threshold: 1
1026
- }, r = window?.requestAnimationFrame || ge, u = (E = !1) => e(E), l = (E, A) => E === 0 || E > A[n], p = (E, A) => E.toggleAttribute(Ut, A);
1027
- function v(E) {
1028
- for (const A of E) {
1029
- const { boundingClientRect: V, rootBounds: q, target: C } = A;
1030
- if (!q) continue;
1031
- const Nn = V[n], Pn = l(Nn, q) && !As(C);
1032
- p(C, Pn);
1045
+ }, r = window?.requestAnimationFrame || ue, d = (S = !1) => e(S), c = (S, k) => S === 0 || S > k[n], f = (S, k) => {
1046
+ S.toggleAttribute(Bt, k);
1047
+ };
1048
+ function b(S) {
1049
+ for (const k of S) {
1050
+ const { boundingClientRect: U, rootBounds: G, target: E } = k;
1051
+ if (!G) continue;
1052
+ const In = U[n], Nn = c(In, G) && !(E instanceof HTMLElement && Ns(E));
1053
+ f(E, Nn);
1033
1054
  }
1034
- r(u);
1055
+ r(d);
1035
1056
  }
1036
- const f = new IntersectionObserver(v, o), z = /* @__PURE__ */ new WeakSet();
1037
- function h(E) {
1038
- const A = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set();
1039
- let q = 0;
1040
- for (const C of E)
1041
- if (C.nodeType === Node.ELEMENT_NODE) {
1042
- if (z.has(C)) {
1043
- A.add(C);
1057
+ const m = new IntersectionObserver(b, o), w = /* @__PURE__ */ new WeakSet();
1058
+ function g(S) {
1059
+ const k = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Set();
1060
+ let G = 0;
1061
+ for (const E of S)
1062
+ if (E instanceof Element) {
1063
+ if (w.has(E)) {
1064
+ k.add(E);
1044
1065
  continue;
1045
1066
  }
1046
- f.observe(C), z.add(C), V.add(C), q += 1;
1067
+ m.observe(E), w.add(E), U.add(E), G += 1;
1047
1068
  }
1048
- Is(A), Ts(V), Rs(q), V.clear(), A.clear();
1069
+ Is(k), As(U), ks(G), U.clear(), k.clear();
1049
1070
  }
1050
1071
  return {
1051
- attachObservers: h,
1052
- detachObservers: Rn(
1053
- ie,
1054
- f,
1055
- z,
1056
- $s
1072
+ attachObservers: g,
1073
+ detachObservers: On(
1074
+ ne,
1075
+ m,
1076
+ w,
1077
+ Ts
1057
1078
  ),
1058
1079
  disconnect: () => {
1059
- f.disconnect(), d("Detached%c OverflowObserver", c);
1080
+ m.disconnect(), u("Detached%c OverflowObserver", a);
1060
1081
  }
1061
1082
  };
1062
1083
  };
1063
- function ks() {
1064
- const { hasOverflow: e } = i, { hasOverflowUpdated: t, overflowedNodeSet: n } = Tn();
1084
+ function Cs() {
1085
+ const { hasOverflow: e } = s, { hasOverflowUpdated: t, overflowedNodeSet: n } = Rn();
1065
1086
  switch (!0) {
1066
1087
  case !t:
1067
1088
  return;
1068
1089
  case n.size > 1:
1069
- d("Overflowed Elements:", n);
1090
+ u("Overflowed Elements:", n);
1070
1091
  break;
1071
1092
  case e:
1072
1093
  break;
1073
1094
  default:
1074
- d("No overflow detected");
1095
+ u("No overflow detected");
1075
1096
  }
1076
- I(Qe, "Overflow updated");
1097
+ M(qe, "Overflow updated");
1077
1098
  }
1078
- function Ns(e) {
1099
+ function Ls(e) {
1079
1100
  const t = {
1080
1101
  root: document.documentElement,
1081
- side: s.calculateHeight ? xe : _e
1102
+ side: i.calculateHeight ? Vt : Wt
1082
1103
  };
1083
- return R.overflow = Cs(ks, t), R.overflow.attachObservers(e), R.overflow;
1104
+ return $.overflow = Ps(Cs, t), $.overflow.attachObservers(e), $.overflow;
1084
1105
  }
1085
- const ce = "Resize", Ps = $e(ce), Ls = $e(ce, !1), js = On(ce), xs = Mn(ce), ze = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new Set(), Pe = /* @__PURE__ */ new Set();
1086
- let J;
1087
- function _s(e) {
1106
+ const oe = "Resize", js = $e(oe), _s = $e(oe, !1), Ds = Sn(oe), xs = En(oe), pe = /* @__PURE__ */ new WeakSet(), Ne = /* @__PURE__ */ new Set(), Pe = /* @__PURE__ */ new Set();
1107
+ let Y;
1108
+ function Bs(e) {
1088
1109
  let t = 0;
1089
1110
  for (const n of e) {
1090
- if (n.nodeType !== Node.ELEMENT_NODE) continue;
1111
+ if (!(n instanceof Element)) continue;
1091
1112
  const o = getComputedStyle(n)?.position;
1092
1113
  if (!(o === "" || o === "static")) {
1093
- if (ze.has(n)) {
1114
+ if (pe.has(n)) {
1094
1115
  Ne.add(n);
1095
1116
  continue;
1096
1117
  }
1097
- J.observe(n), ze.add(n), Pe.add(n), t += 1;
1118
+ Y.observe(n), pe.add(n), Pe.add(n), t += 1;
1098
1119
  }
1099
1120
  }
1100
- xs(Ne), js(Pe), Ps(t), Pe.clear(), Ne.clear();
1101
- }
1102
- const Ds = (e) => (J = new ResizeObserver(e), J.observe(document.body), ze.add(document.body), d("Attached%c ResizeObserver%c to body", c, w), {
1103
- attachObserverToNonStaticElements: _s,
1104
- detachObservers: Rn(
1105
- ce,
1106
- J,
1107
- ze,
1108
- Ls
1121
+ xs(Ne), Ds(Pe), js(t), Pe.clear(), Ne.clear();
1122
+ }
1123
+ const Fs = (e) => (Y = new ResizeObserver(e), Y.observe(document.body), pe.add(document.body), u("Attached%c ResizeObserver%c to body", a, z), {
1124
+ attachObserverToNonStaticElements: Bs,
1125
+ detachObservers: On(
1126
+ oe,
1127
+ Y,
1128
+ pe,
1129
+ _s
1109
1130
  ),
1110
1131
  disconnect: () => {
1111
- J.disconnect(), d("Detached%c ResizeObserver", c);
1132
+ Y.disconnect(), u("Detached%c ResizeObserver", a);
1112
1133
  }
1113
1134
  });
1114
- function Bs(e) {
1135
+ function Hs(e) {
1115
1136
  if (!Array.isArray(e) || e.length === 0) return;
1116
1137
  const t = e[0].target;
1117
- I(Zt, `Element resized <${io(t)}>`);
1138
+ M(Gt, `Element resized <${ro(t)}>`);
1118
1139
  }
1119
- function Hs(e) {
1120
- return R.resize = Ds(Bs), R.resize.attachObserverToNonStaticElements(e), R.resize;
1140
+ function Vs(e) {
1141
+ return $.resize = Fs(Hs), $.resize.attachObserverToNonStaticElements(e), $.resize;
1121
1142
  }
1122
- let Pt;
1123
- function Fs() {
1143
+ let It;
1144
+ function Ws() {
1124
1145
  const e = document.title;
1125
- e !== Pt && (Pt = e, a(`Title: %c${e}`, c), e && y(0, 0, Zn, e));
1126
- }
1127
- function Ws(e) {
1128
- a(`Visible: %c${e}`, c), i.isHidden = !e, I(Qt, "Visibility changed");
1146
+ e !== It && (It = e, l(`Title: %c${e}`, a), e && y(0, 0, Gn, e));
1129
1147
  }
1130
1148
  function Us(e) {
1131
- nt.push(...e.map((t) => t.disconnect));
1132
- }
1133
- function Gs() {
1134
- m("attachObservers");
1135
- const e = ot(document.documentElement), t = [
1136
- ys(Ms),
1137
- Ns(e),
1138
- qo(),
1139
- Hs(e),
1140
- vs(Fs),
1141
- ws(Ws)
1149
+ l(`Visible: %c${e}`, a), s.isHidden = !e, M(Zt, "Visibility changed");
1150
+ }
1151
+ function Gs(e) {
1152
+ Ke.push(...e.map((t) => t.disconnect));
1153
+ }
1154
+ function qs() {
1155
+ h("attachObservers");
1156
+ const e = et(document.documentElement), t = [
1157
+ bs(Ms),
1158
+ Ls(e),
1159
+ Vo(),
1160
+ Vs(e),
1161
+ ws(Ws),
1162
+ Ss(Us)
1142
1163
  ];
1143
- Us(t);
1164
+ Gs(t);
1144
1165
  }
1145
- const Lt = (e, t, n) => {
1166
+ const Nt = (e, t, n) => {
1146
1167
  if (n !== "") {
1147
- a(`${e}: %c${n}`, c);
1168
+ l(`${e}: %c${n}`, a);
1148
1169
  for (const o of document.querySelectorAll(n))
1149
- a(`Applying ${t} to:`, o), o.toggleAttribute(t, !0);
1170
+ l(`Applying ${t} to:`, o), o.toggleAttribute(t, !0);
1150
1171
  }
1151
1172
  };
1152
- function Vs({ sizeSelector: e, ignoreSelector: t }) {
1173
+ function Zs({
1174
+ sizeSelector: e,
1175
+ ignoreSelector: t
1176
+ }) {
1153
1177
  return () => {
1154
- Lt("sizeSelector", Oe, e), Lt("ignoreSelector", te, t);
1178
+ Nt("sizeSelector", be, e), Nt("ignoreSelector", X, t);
1155
1179
  };
1156
1180
  }
1157
- function qs() {
1181
+ function Ys() {
1158
1182
  const e = document.createElement("div");
1159
1183
  e.style.clear = "both", e.style.display = "block", e.style.height = "0", document.body.append(e);
1160
1184
  }
1161
- function Zs(e, t) {
1162
- return t.includes("-") && (T(`Negative CSS value ignored for ${e}`), t = ""), t;
1185
+ function Qs(e, t) {
1186
+ return t.includes("-") && (B(`Negative CSS value ignored for ${e}`), t = ""), t;
1163
1187
  }
1164
- function Ge(e, t) {
1165
- t === void 0 || t === "" || t === eo || (document.body.style.setProperty(e, t), d(`Set body ${e}: %c${t}`, c));
1188
+ function He(e, t) {
1189
+ t === void 0 || t === "" || t === Jn || (document.body.style.setProperty(e, t), u(`Set body ${e}: %c${t}`, a));
1166
1190
  }
1167
- function Ys({ bodyMarginStr: e, bodyMargin: t }) {
1168
- e === void 0 && (e = `${t}px`), Ge("margin", Zs("margin", e));
1191
+ function Js({
1192
+ bodyMarginStr: e,
1193
+ bodyMargin: t
1194
+ }) {
1195
+ e === void 0 && (e = `${t}px`), He("margin", Qs("margin", e));
1169
1196
  }
1170
- const Qs = () => ({
1197
+ const Ks = () => ({
1171
1198
  x: document.documentElement.scrollLeft,
1172
1199
  y: document.documentElement.scrollTop
1173
1200
  });
1174
- function Js(e) {
1175
- const t = e.getBoundingClientRect(), n = Qs();
1201
+ function Xs(e) {
1202
+ const t = e.getBoundingClientRect(), n = Ks();
1176
1203
  return {
1177
- x: parseInt(t.left, W) + parseInt(n.x, W),
1178
- y: parseInt(t.top, W) + parseInt(n.y, W)
1204
+ x: Math.round(t.left + n.x),
1205
+ y: Math.round(t.top + n.y)
1179
1206
  };
1180
1207
  }
1181
- function Ks(e, t) {
1182
- const n = Js(t);
1183
- a(
1208
+ function ei(e, t) {
1209
+ const n = Xs(t);
1210
+ l(
1184
1211
  `Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,
1185
- c,
1186
- w,
1187
- c,
1188
- w,
1189
- c
1190
- ), y(n.y, n.x, Wt);
1191
- }
1192
- function at(e) {
1212
+ a,
1213
+ z,
1214
+ a,
1215
+ z,
1216
+ a
1217
+ ), y(n.y, n.x, xt);
1218
+ }
1219
+ function st(e) {
1193
1220
  const t = e.split("#")[1] || e, n = decodeURIComponent(t), o = document.getElementById(n) || document.getElementsByName(n)[0];
1194
1221
  if (o !== void 0) {
1195
- Ks(t, o);
1222
+ ei(t, o);
1196
1223
  return;
1197
1224
  }
1198
- a(`In page link (#${t}) not found in iframe, so sending to parent`), y(0, 0, Hn, `#${t}`);
1225
+ l(`In page link (#${t}) not found in iframe, so sending to parent`), y(0, 0, xn, `#${t}`);
1199
1226
  }
1200
- function An() {
1227
+ function kn() {
1201
1228
  const { hash: e, href: t } = window.location;
1202
- e !== "" && e !== "#" && at(t);
1229
+ e !== "" && e !== "#" && st(t);
1203
1230
  }
1204
- function Xs() {
1231
+ function ti() {
1205
1232
  for (const e of document.querySelectorAll('a[href^="#"]'))
1206
1233
  e.getAttribute("href") !== "#" && j(e, "click", (t) => {
1207
- t.preventDefault(), at(e.getAttribute("href"));
1234
+ t.preventDefault(), st(e.getAttribute("href"));
1208
1235
  });
1209
1236
  }
1210
- function ei() {
1211
- j(window, "hashchange", An);
1237
+ function ni() {
1238
+ j(window, "hashchange", kn);
1212
1239
  }
1213
- function ti() {
1214
- setTimeout(An, Xt);
1240
+ function oi() {
1241
+ setTimeout(kn, Qt);
1215
1242
  }
1216
- function ni() {
1217
- a("Setting up location.hash handlers"), Xs(), ei(), ti(), i.inPageLinks = {
1218
- findTarget: at
1243
+ function ri() {
1244
+ l("Setting up location.hash handlers"), ti(), ni(), oi(), s.inPageLinks = {
1245
+ findTarget: st
1219
1246
  };
1220
1247
  }
1221
- function oi(e) {
1222
- const { mode: t } = s;
1223
- e ? t === 1 ? g(G(5)) : ni() : a("In page linking not enabled");
1248
+ function si(e) {
1249
+ const { mode: t } = i;
1250
+ e ? tt(t) ? p(I(5)) : ri() : l("In page linking not enabled");
1224
1251
  }
1225
- const ri = "important";
1226
- function si() {
1227
- const e = (t) => t.style.setProperty(ne, Me, ri);
1228
- e(document.documentElement), e(document.body), a("Set HTML & body height: %cauto !important", c);
1252
+ const ii = "important";
1253
+ function ci() {
1254
+ const e = (t) => t.style.setProperty(ze, P, ii);
1255
+ e(document.documentElement), e(document.body), l("Set HTML & body height: %cauto !important", a);
1229
1256
  }
1230
- const ii = "custom", ci = (e) => `<rb>Deprecated Option(${e}CalculationMethod)</>
1231
-
1232
- The use of <b>${e}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.
1233
-
1234
- See <u>https://iframe-resizer.com/api/child</> for more details.
1235
- `;
1236
- function jt(e, t) {
1237
- return typeof e !== re ? e : (g(ci(t)), t === ne ? S.custom = e : O.custom = e, ii);
1238
- }
1239
- const lt = (e) => (t, n) => {
1257
+ const it = (e) => (t, n) => {
1240
1258
  if (n in t) {
1241
1259
  if (typeof t[n] === e) return t[n];
1242
1260
  throw new TypeError(`${n} is not a ${e}.`);
1243
1261
  }
1244
- }, Le = lt(re), le = lt(L), de = lt(oe), ai = (e) => e !== null && typeof e === Jn && !Array.isArray(e);
1262
+ }, Ce = it(we), se = it(L), ie = it(ee), ai = (e) => e !== null && typeof e === Zn && !Array.isArray(e);
1245
1263
  function li(e) {
1246
- const { calculateHeight: t, calculateWidth: n } = s;
1264
+ const { calculateHeight: t, calculateWidth: n } = i;
1247
1265
  let o, r;
1248
- return typeof e?.offset === L && (wo(Ie, Ae), t && (o = le(e, Ie)), n && (r = le(e, Ie))), typeof e?.offsetSize === L && (t && (o = le(e, Ae)), n && (r = le(e, Ae))), { offsetHeight: o, offsetWidth: r };
1266
+ return typeof e?.offset === L && (bo(Me, ke), t && (o = se(e, Me)), n && (r = se(e, Me))), typeof e?.offsetSize === L && (t && (o = se(e, ke)), n && (r = se(e, ke))), { offsetHeight: o, offsetWidth: r };
1249
1267
  }
1250
1268
  function di(e) {
1251
- a("Reading data from page:", Object.keys(e));
1269
+ l("Reading data from page:", Object.keys(e));
1252
1270
  const { offsetHeight: t, offsetWidth: n } = li(e);
1253
1271
  return {
1254
1272
  offsetHeight: t,
1255
1273
  offsetWidth: n,
1256
- ignoreSelector: de(e, "ignoreSelector"),
1257
- key2: de(e, cr(0)),
1258
- sizeSelector: de(e, "sizeSelector"),
1259
- targetOrigin: de(e, "targetOrigin"),
1260
- heightCalcMode: jt(
1261
- e?.heightCalculationMethod,
1262
- ne
1263
- ),
1264
- widthCalcMode: jt(e?.widthCalculationMethod, Gt),
1265
- onBeforeResize: Le(e, "onBeforeResize"),
1266
- onMessage: Le(e, "onMessage"),
1267
- onReady: Le(e, "onReady")
1274
+ ignoreSelector: ie(e, "ignoreSelector"),
1275
+ [St(3)]: ie(e, St(0)),
1276
+ sizeSelector: ie(e, "sizeSelector"),
1277
+ targetOrigin: ie(e, "targetOrigin"),
1278
+ onBeforeResize: Ce(e, "onBeforeResize"),
1279
+ onMessage: Ce(e, "onMessage"),
1280
+ onReady: Ce(e, "onReady")
1268
1281
  };
1269
1282
  }
1270
1283
  function ui() {
1271
- const { mode: e } = s;
1272
- if (e === 1) return {};
1284
+ const { mode: e } = i;
1285
+ if (tt(e)) return {};
1273
1286
  const t = window.iframeResizer || window.iFrameResizer;
1274
1287
  return ai(t) ? di(t) : {};
1275
1288
  }
1276
- const fi = (e) => e === "true", Cn = (e) => (t) => t === void 0 ? void 0 : e(t), x = Cn(fi), Y = Cn(Number), mi = (e) => ({
1289
+ const fi = (e) => e === "true", Tn = (e) => (t) => t === void 0 ? void 0 : e(t), _ = Tn(fi), Z = Tn(Number), mi = (e) => ({
1277
1290
  parentId: e[0],
1278
- bodyMargin: Y(e[1]),
1279
- calculateWidth: x(e[2]),
1280
- logging: x(e[3]),
1291
+ bodyMargin: Z(e[1]),
1292
+ calculateWidth: _(e[2]),
1293
+ logging: _(e[3]),
1281
1294
  // data[4] no longer used (was intervalTimer)
1282
- autoResize: x(e[6]),
1295
+ autoResize: _(e[6]),
1283
1296
  bodyMarginStr: e[7],
1284
1297
  heightCalcMode: e[8],
1285
1298
  bodyBackground: e[9],
1286
1299
  bodyPadding: e[10],
1287
- tolerance: Y(e[11]),
1288
- inPageLinks: x(e[12]),
1300
+ tolerance: Z(e[11]),
1301
+ inPageLinks: _(e[12]),
1289
1302
  // data[13] no longer used (was resizeFrom)
1290
1303
  widthCalcMode: e[14],
1291
- mouseEvents: x(e[15]),
1292
- offsetHeight: Y(e[16]),
1293
- offsetWidth: Y(e[17]),
1294
- calculateHeight: x(e[18]),
1304
+ mouseEvents: _(e[15]),
1305
+ offsetHeight: Z(e[16]),
1306
+ offsetWidth: Z(e[17]),
1307
+ calculateHeight: _(e[18]),
1295
1308
  key: e[19],
1296
1309
  version: e[20],
1297
- mode: Y(e[21]),
1310
+ mode: Z(e[21]),
1298
1311
  // sizeSelector: data[22] // Now only available via page settings
1299
- logExpand: x(e[23])
1312
+ logExpand: _(e[23])
1300
1313
  });
1301
1314
  function hi(e) {
1302
- const { mode: t } = s;
1315
+ const { mode: t } = i;
1303
1316
  e.forEach((n) => {
1304
1317
  try {
1305
1318
  n();
1306
1319
  } catch (o) {
1307
1320
  if (t < 0) throw o;
1308
- g(
1321
+ p(
1309
1322
  `<rb>Error in setup function</>
1310
1323
  <i>iframe-resizer</> detected an error during setup.
1311
1324
 
1312
1325
  Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`
1313
- ), sn(o);
1326
+ ), nn(o);
1314
1327
  }
1315
1328
  });
1316
1329
  }
1317
- function xt(e) {
1330
+ function Pt(e) {
1318
1331
  for (const [t, n] of Object.entries(e))
1319
- n !== void 0 && (s[t] = n);
1332
+ n !== void 0 && (i[t] = n);
1320
1333
  }
1321
1334
  function gi({
1322
1335
  logExpand: e,
1323
1336
  logging: t,
1324
- parentId: n
1337
+ parentId: n = ""
1325
1338
  }) {
1326
- po({ id: n, enabled: t, expand: e }), m("initReceived"), a(`Initialising iframe v${D} ${window.location.href}`);
1339
+ ho({ id: n, enabled: t, expand: e }), h("initReceived"), l(`Initialising iframe v${x} ${window.location.href}`);
1327
1340
  }
1328
1341
  function pi(e) {
1329
- m("ready"), bn(tn(e)), a("Initialization complete", (({ key: t, key2: n, ...o }) => o)(s));
1342
+ h("ready"), pn(Kt(e)), l("Initialization complete", (({ key: t, key2: n, ...o }) => o)(i));
1330
1343
  }
1331
1344
  function yi({
1332
1345
  bodyBackground: e,
@@ -1334,121 +1347,121 @@ function yi({
1334
1347
  inPageLinks: n,
1335
1348
  onReady: o
1336
1349
  }) {
1337
- const r = Po(s), u = [
1338
- () => pr(s),
1339
- () => ar(s),
1340
- or,
1341
- Xo,
1342
- pn,
1350
+ const r = Po(i), d = [
1351
+ er,
1352
+ Qo,
1353
+ Zo,
1354
+ Yo,
1355
+ Ko,
1356
+ hr,
1343
1357
  yn,
1344
- tr,
1345
- ur,
1346
- vn,
1347
- mr,
1348
- r ? ge : No,
1349
- () => Ys(s),
1350
- () => Ge("background", e),
1351
- () => Ge("padding", t),
1352
- r ? ge : si,
1353
- qs,
1354
- i.applySelectors,
1355
- () => oi(n),
1358
+ pr,
1359
+ r ? ue : No,
1360
+ () => Js(i),
1361
+ () => He("background", e),
1362
+ () => He("padding", t),
1363
+ r ? ue : ci,
1364
+ Ys,
1365
+ s.applySelectors,
1366
+ () => si(n),
1367
+ jr,
1368
+ () => $r(i),
1356
1369
  kr,
1357
- () => Er(s),
1358
- Mr,
1359
- () => os(),
1360
- () => I(
1361
- Se,
1370
+ () => ss(),
1371
+ () => M(
1372
+ ve,
1362
1373
  "Init message from host page",
1363
1374
  void 0,
1364
1375
  void 0,
1365
- `${D}:${s.mode}`
1376
+ `${x}:${i.mode}`
1366
1377
  ),
1367
- Gs,
1368
- B
1378
+ qs,
1379
+ F
1369
1380
  ];
1370
- hi(u), pi(o);
1371
- }
1372
- function bi(e) {
1373
- i.firstRun && (xt(mi(e)), gi(s), xt(ui()), i.applySelectors = Vs(s), yi(s));
1381
+ br(i), ur(i), hi(d), pi(o);
1374
1382
  }
1375
1383
  function vi(e) {
1384
+ s.firstRun && (Pt(mi(e)), gi(i), Pt(ui()), s.applySelectors = Zs(i), yi(i));
1385
+ }
1386
+ function bi(e) {
1376
1387
  if (document.readyState === "loading") {
1377
- a("Page not ready, ignoring init message");
1388
+ l("Page not ready, ignoring init message");
1378
1389
  return;
1379
1390
  }
1380
- const t = e.data.slice(Jt).split(Ee);
1381
- i.target = e.source, i.origin = e.origin, bi(t), i.firstRun = !1, setTimeout(() => {
1382
- i.initLock = !1;
1383
- }, Xt);
1384
- }
1385
- const { freeze: wi } = Object, { parse: dt } = JSON, ut = (e) => wi(dt(e)), kn = (e) => y(0, 0, `${e}Stop`), Te = (e) => e.data.slice(e.data.indexOf(Ee) + 1), zi = (e) => So(e) ? Se : e.data.split("]")[1].split(Ee)[0];
1386
- function Ei(e) {
1387
- const t = Te(e);
1388
- a("onMessage called from parent:%c", c, ut(t)), Re(s.onMessage, dt(t));
1391
+ const t = e.data.slice(Yt).split(ye);
1392
+ s.target = e.source, s.origin = e.origin, vi(t), s.firstRun = !1, setTimeout(() => {
1393
+ s.initLock = !1;
1394
+ }, Qt);
1389
1395
  }
1396
+ const { freeze: zi } = Object, { parse: ct } = JSON, at = (e) => zi(ct(e)), An = (e) => y(0, 0, `${e}Stop`), Re = (e) => e.data.slice(e.data.indexOf(ye) + 1), wi = (e) => So(e) ? ve : e.data.split("]")[1].split(ye)[0];
1390
1397
  function Si(e) {
1391
- const { onPageInfo: t } = i, n = Te(e);
1392
- a("PageInfo received from parent:", ut(n)), t ? Re(t, dt(n)) : kn(Ht);
1398
+ const t = Re(e);
1399
+ l("onMessage called from parent:%c", a, at(t)), Se(i.onMessage, ct(t));
1400
+ }
1401
+ function Ei(e) {
1402
+ const { onPageInfo: t } = s, n = Re(e);
1403
+ l("PageInfo received from parent:", at(n)), t ? Se(t, ct(n)) : An(_t);
1393
1404
  }
1394
1405
  function Oi(e) {
1395
- const { onParentInfo: t } = i, n = ut(Te(e));
1396
- a("ParentInfo received from parent:", n), t ? Re(t, n) : kn(Ft);
1406
+ const { onParentInfo: t } = s, n = at(Re(e));
1407
+ l("ParentInfo received from parent:", n), t ? Se(t, n) : An(Dt);
1397
1408
  }
1398
- function Mi() {
1399
- if (i.initLock) {
1400
- a("Page reset ignored by init");
1409
+ function $i() {
1410
+ if (s.initLock) {
1411
+ l("Page reset ignored by init");
1401
1412
  return;
1402
1413
  }
1403
- a("Page size reset by host page"), En("resetPage");
1414
+ l("Page size reset by host page"), zn("resetPage");
1404
1415
  }
1405
1416
  function Ri() {
1406
- a("Resize requested by host page"), I(Ye, "Parent window requested size check");
1417
+ l("Resize requested by host page"), M(Ge, "Parent window requested size check");
1407
1418
  }
1408
- const _t = (e) => i.inPageLinks.findTarget(Te(e)), Dt = {
1409
- init: vi,
1410
- reset: Mi,
1419
+ const Ct = (e) => s.inPageLinks.findTarget(Re(e)), Lt = {
1420
+ init: bi,
1421
+ reset: $i,
1411
1422
  resize: Ri,
1412
- moveToAnchor: _t,
1413
- inPageLink: _t,
1423
+ moveToAnchor: Ct,
1424
+ inPageLink: Ct,
1414
1425
  // Backward compatibility
1415
- pageInfo: Si,
1426
+ pageInfo: Ei,
1416
1427
  parentInfo: Oi,
1417
- message: Ei
1428
+ message: Si
1418
1429
  };
1419
- function $i(e) {
1420
- const { firstRun: t } = i, n = zi(e);
1421
- switch (m(n), !0) {
1422
- case n in Dt:
1423
- Dt[n](e);
1430
+ function Mi(e) {
1431
+ const { firstRun: t } = s, n = wi(e);
1432
+ switch (h(n), !0) {
1433
+ case n in Lt:
1434
+ Lt[n](e);
1424
1435
  break;
1425
- case (t && Eo()):
1426
- T(
1436
+ case (t && wo()):
1437
+ B(
1427
1438
  `Ignored message of type "${n}". Received before initialization.`
1428
1439
  );
1429
1440
  break;
1430
1441
  default:
1431
- T(
1442
+ B(
1432
1443
  `Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`
1433
1444
  );
1434
1445
  }
1435
1446
  }
1436
- const ue = et((e) => {
1437
- zo(e) && $i(e);
1447
+ const ce = Qe((e) => {
1448
+ zo(e) && Mi(e);
1438
1449
  });
1439
- function Ti() {
1450
+ function ki() {
1440
1451
  if ("iframeChildListener" in window) {
1441
- T("Already setup");
1452
+ B("Already setup");
1442
1453
  return;
1443
1454
  }
1444
- window.iframeChildListener = (t) => setTimeout(() => ue({ data: t, sameOrigin: !0 })), m("listen"), j(window, je, ue), j(document, Vt, vt), vt();
1455
+ window.iframeChildListener = ((t) => setTimeout(
1456
+ () => ce({ data: t, sameOrigin: !0 })
1457
+ )), h("listen"), j(window, Le, ce), j(document, Ht, gt), gt();
1445
1458
  function e(t) {
1446
- return ue(t), i.win;
1459
+ return ce(t), s.win;
1447
1460
  }
1448
1461
  try {
1449
- top?.document?.getElementById("banner") && (i.win = {}, window.mockMsgListener = e, ln(window, je, ue), typeof window.define == "function" && window.define([], () => e));
1462
+ top?.document?.getElementById("banner") && (s.win = {}, window.mockMsgListener = e, sn(window, Le, ce), typeof window.define == "function" && window.define([], () => e));
1450
1463
  } catch {
1451
1464
  }
1452
1465
  }
1453
- typeof window !== Kn && Ti();
1466
+ typeof window !== Yn && ki();
1454
1467
  //# sourceMappingURL=index.esm.js.map