@iframe-resizer/child 6.0.0-beta.4 → 6.0.0-beta.5

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.umd.js CHANGED
@@ -1,28 +1,28 @@
1
- (function(o,D){typeof exports=="object"&&typeof module<"u"?D(require("@iframe-resizer/common/consts"),require("@iframe-resizer/common/deprecate"),require("@iframe-resizer/common/format-advise"),require("@iframe-resizer/common/utils"),require("auto-console-group"),require("@iframe-resizer/common/mode")):typeof define=="function"&&define.amd?define(["@iframe-resizer/common/consts","@iframe-resizer/common/deprecate","@iframe-resizer/common/format-advise","@iframe-resizer/common/utils","auto-console-group","@iframe-resizer/common/mode"],D):(o=typeof globalThis<"u"?globalThis:o||self,D(o.consts,o.deprecate,o.createFormatAdvise,o.utils,o.acg,o.setMode))})(this,(function(o,D,Rt,u,i,E){"use strict";let ie=!0,Le=o.LABEL;const P=u.esModuleInterop(i)({label:`${o.LABEL}(child)`,expand:!1});function vt(e){Le=e.id||o.LABEL,P.label(`${Le}`),P.expand(e.expand),ie=e.enabled}const Ge=e=>(...t)=>ie?P[e](...t):!0,d=Ge("log"),f=d,j=Ge("debug");function wt(e,t){console.info(`%ciframe-resizer ${e}`,ie||t<1?o.BOLD:i.NORMAL)}const{assert:bt,endAutoGroup:z,error:Me,errorBoundary:se,event:I,label:Rr,purge:vr,warn:_}=P,ze=Rt(u.id),R=(...e)=>P.warn(...e.map(ze)),yt=(...e)=>console.warn(...e.map(ze)),ae=D((e,t)=>R(t));ae("Method"),ae("Method","replaced with"),ae("Option");const ce=[];function $e(e,t){d(`${e} event listener: %c${t}`,i.HIGHLIGHT)}const _e=(e,t,n,r)=>{e.removeEventListener(t,n,r),$e("Removed",t)},L=(e,t,n,r=!1)=>{e.addEventListener(t,n,r),ce.push(()=>_e(e,t,n,r)),$e("Added",t)},a={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let ke=!1;function Ce(e){const t=window?.iframeResizer?.targetOrigin||"*",n=Array.isArray(t)?t:[t];for(const r of n)e.postMessage(o.CHILD_READY_MESSAGE,r)}function De(){if(document.readyState==="loading"||!a.firstRun||ke)return;const{parent:e,top:t}=window;I("ready"),d("Sending%c ready%c to parent from",i.HIGHLIGHT,i.FOREGROUND,window.location.href),Ce(e),e!==t&&Ce(t),ke=!0}const Pe="iframeResize",Ht=e=>o.MESSAGE_ID===`${e.data}`.slice(0,o.MESSAGE_ID_LENGTH),At=()=>Pe in window||window.jQuery!==void 0&&Pe in window.jQuery.prototype,Nt=e=>e.data.split(o.SEPARATOR)[2]in{true:1,false:1},Lt=()=>[document.documentElement,document.body],Gt=["min-height","min-width","max-height","max-width"],Be=new Set,Mt=e=>!!e&&e!=="0px"&&e!==o.AUTO&&e!==o.NONE,Fe=e=>e.tagName?e.tagName.toLowerCase():"unknown",Ue=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),zt=(e,t)=>Mt(Ue(e,t));function $t(e,t){const n=e.style.getPropertyValue(t);return n?{source:"an inline style attribute",value:n}:null}function _t({href:e}){Be.has(e)||(d("Unable to access stylesheet:",e),Be.add(e))}function kt(e,t){for(const n of document.styleSheets)try{for(const r of n.cssRules||[]){if(!("selectorText"in r))continue;const s=r;if(!e.matches(s.selectorText))continue;const m=s.style.getPropertyValue(t);if(!m)continue;const{ownerNode:l}=n;return{source:l instanceof Element&&l.tagName==="STYLE"?"an inline <style> block":`stylesheet (${n.href})`,value:m}}}catch{_t(n)}return{source:"cross-origin stylesheet",value:Ue(e,t)}}const Ct=(e,t)=>$t(e,t)||kt(e,t),Dt=(e,t)=>{const{source:n,value:r}=Ct(e,t),s=Fe(e);R(`The <b>${t}</> CSS property is set to <b>${r}</> on the <b><${s}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.
1
+ (function(n,i){typeof exports=="object"&&typeof module<"u"?i(require("@iframe-resizer/common"),require("auto-console-group")):typeof define=="function"&&define.amd?define(["@iframe-resizer/common","auto-console-group"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.common,n.acg))})(this,(function(n,i){"use strict";let ne=!0,Ae=n.LABEL;const C=n.esModuleInterop(i)({label:`${n.LABEL}(child)`,expand:!1});function St(e){Ae=e.id||n.LABEL,C.label(`${Ae}`),C.expand(e.expand),ne=e.enabled}const Ne=e=>(...t)=>ne?C[e](...t):!0,d=Ne("log"),f=d,W=Ne("debug");function Tt(e,t){console.info(`%ciframe-resizer ${e}`,ne||t<1?n.BOLD:i.NORMAL)}const{assert:Rt,endAutoGroup:G,error:Me,errorBoundary:re,event:E,label:ps,purge:Os,warn:$}=C,Le=n.createFormatAdvise(n.id),T=(...e)=>C.warn(...e.map(Le)),bt=(...e)=>console.warn(...e.map(Le)),se=n.deprecate((e,t)=>T(t));se("Method"),se("Method","replaced with"),se("Option");const ie=[];function Ge(e,t){d(`${e} event listener: %c${t}`,i.HIGHLIGHT)}const ze=(e,t,r,s)=>{e.removeEventListener(t,r,s),Ge("Removed",t)},N=(e,t,r,s=!1)=>{e.addEventListener(t,r,s),ie.push(()=>ze(e,t,r,s)),Ge("Added",t)},a={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let $e=!1;function _e(e){const t=window?.iframeResizer?.targetOrigin||"*",r=Array.isArray(t)?t:[t];for(const s of r)e.postMessage(n.CHILD_READY_MESSAGE,s)}function ke(){if(document.readyState==="loading"||!a.firstRun||$e)return;const{parent:e,top:t}=window;E("ready"),d("Sending%c ready%c to parent from",i.HIGHLIGHT,i.FOREGROUND,window.location.href),_e(e),e!==t&&_e(t),$e=!0}const Ce="iframeResize",wt=e=>n.MESSAGE_ID===`${e.data}`.slice(0,n.MESSAGE_ID_LENGTH),vt=()=>Ce in window||window.jQuery!==void 0&&Ce in window.jQuery.prototype,yt=e=>e.data.split(n.SEPARATOR)[2]in{true:1,false:1},Ht=()=>[document.documentElement,document.body],At=["min-height","min-width","max-height","max-width"],De=new Set,Nt=e=>!!e&&e!=="0px"&&e!==n.AUTO&&e!==n.NONE,Pe=e=>e.tagName?e.tagName.toLowerCase():"unknown",Be=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Mt=(e,t)=>Nt(Be(e,t));function Lt(e,t){const r=e.style.getPropertyValue(t);return r?{source:"an inline style attribute",value:r}:null}function Gt({href:e}){De.has(e)||(d("Unable to access stylesheet:",e),De.add(e))}function zt(e,t){for(const r of document.styleSheets)try{for(const s of r.cssRules||[]){if(!("selectorText"in s))continue;const o=s;if(!e.matches(o.selectorText))continue;const u=o.style.getPropertyValue(t);if(!u)continue;const{ownerNode:l}=r;return{source:l instanceof Element&&l.tagName==="STYLE"?"an inline <style> block":`stylesheet (${r.href})`,value:u}}}catch{Gt(r)}return{source:"cross-origin stylesheet",value:Be(e,t)}}const $t=(e,t)=>Lt(e,t)||zt(e,t),_t=(e,t)=>{const{source:r,value:s}=$t(e,t),o=Pe(e);T(`The <b>${t}</> CSS property is set to <b>${s}</> on the <b><${o}></> element via ${r}. This may cause issues with the correct operation of <i>iframe-resizer</>.
2
2
 
3
- 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.`)};function Pt(){for(const e of Lt())for(const t of Gt)d(`Checking <${Fe(e)}> for blocking CSS: ${t}`),zt(e,t)&&Dt(e,t)}const Bt=({calculateWidth:e,calculateHeight:t})=>e===t,c={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:o.AUTO,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:o.AUTO,onBeforeResize:void 0,onMessage:()=>{_("onMessage function not defined")},onReady:()=>{}};function Ft(){try{a.sameOrigin=c.mode===1||"iframeParentListener"in window.parent}catch{d("Cross domain iframe detected")}}let xe=0;function Ut(e){const t=e.length===1?"":"s";_(`%c[${o.IGNORE_ATTR}]%c found on %c${e.length}%c element${t}`,i.BOLD,i.NORMAL,i.BOLD,i.NORMAL)}function xt(){const e=document.querySelectorAll(`*[${o.IGNORE_ATTR}]`),t=e.length>0;return t&&e.length!==xe&&(Ut(e),xe=e.length),t}function Vt(e,t,n){(!u.isDef(n)||t>-1&&e>t)&&(wt(`v${o.VERSION} (${E.getModeLabel(e)})`,e),e===0&&yt(E.getModeData(3)))}function Wt({key:e,key2:t,mode:n,version:r}){const s=n,m=u.isDef(e)?E({key:e}):-1,l=u.isDef(t)?E({key:t}):-1;let g;switch(n=Math.max(m,l),n){case-2:case-1:g=`${E.getModeData(Math.min(m,l)+2)}${E.getModeData(2)}`,a.firstRun=!1;break;case 1:case 2:case 3:g=E.getModeData(6);break;case 4:g=E.getModeData(7);break;case 5:g=E.getModeData(8);break}if(n>=0&&Vt(n,s,r),(!u.isDef(r)||!a.firstRun)&&(g&&R(g),n<0))throw R(E.getModeData(9)),g.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");c.mode=n}const qt="BackCompat",Zt=`<rb>Quirks Mode Detected</>
3
+ 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.`)};function kt(){for(const e of Ht())for(const t of At)d(`Checking <${Pe(e)}> for blocking CSS: ${t}`),Mt(e,t)&&_t(e,t)}const Ct=({calculateWidth:e,calculateHeight:t})=>e===t,c={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:n.AUTO,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:n.AUTO,onBeforeResize:void 0,onMessage:()=>{$("onMessage function not defined")},onReady:()=>{}};function Dt(){try{a.sameOrigin=c.mode===1||"iframeParentListener"in window.parent}catch{d("Cross domain iframe detected")}}let Fe=0;function Pt(e){const t=e.length===1?"":"s";$(`%c[${n.IGNORE_ATTR}]%c found on %c${e.length}%c element${t}`,i.BOLD,i.NORMAL,i.BOLD,i.NORMAL)}function Bt(){const e=document.querySelectorAll(`*[${n.IGNORE_ATTR}]`),t=e.length>0;return t&&e.length!==Fe&&(Pt(e),Fe=e.length),t}function Ft(e,t,r){(!n.isDef(r)||t>-1&&e>t)&&(Tt(`v${n.VERSION} (${n.getModeLabel(e)})`,e),e===0&&bt(n.getModeData(3)))}function Ut({key:e,key2:t,mode:r,version:s}){const o=r,u=n.isDef(e)?n.setMode({key:e}):-1,l=n.isDef(t)?n.setMode({key:t}):-1;let g;switch(r=Math.max(u,l),r){case-2:case-1:g=`${n.getModeData(Math.min(u,l)+2)}${n.getModeData(2)}`,a.firstRun=!1;break;case 1:case 2:case 3:g=n.getModeData(6);break;case 4:g=n.getModeData(7);break;case 5:g=n.getModeData(8);break}if(r>=0&&Ft(r,o,s),(!n.isDef(s)||!a.firstRun)&&(g&&T(g),r<0))throw T(n.getModeData(9)),g.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");c.mode=r}const mt="BackCompat",xt=`<rb>Quirks Mode Detected</>
4
4
 
5
5
  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</>.
6
6
 
7
7
  For more information see <u>https://iframe-resizer.com/quirks-mode</>.
8
- `;function jt(){document.compatMode===qt&&R(Zt)}const Yt="complete";let Ve=!1;function We(e){document.readyState===Yt?u.isolateUserCode(e):Ve||L(document,o.READY_STATE_CHANGE,()=>We(e)),Ve=!0}const Qt=()=>{f(`Set targetOrigin for parent: %c${c.targetOrigin}`,i.HIGHLIGHT),c.autoResize!==!0&&d("Auto Resize disabled")};function qe(){a.taggedElements=document.querySelectorAll(`[${o.SIZE_ATTR}]`),a.hasTags=a.taggedElements.length>0,d(`Tagged elements found: %c${a.hasTags}`,i.HIGHLIGHT)}const Kt=`<rb>Legacy version detected on parent page</>
8
+ `;function Vt(){document.compatMode===mt&&T(xt)}const Wt="complete";let Ue=!1;function me(e){document.readyState===Wt?n.isolateUserCode(e):Ue||N(document,n.READY_STATE_CHANGE,()=>me(e)),Ue=!0}const Zt=()=>{f(`Set targetOrigin for parent: %c${c.targetOrigin}`,i.HIGHLIGHT),c.autoResize!==!0&&d("Auto Resize disabled")};function xe(){a.taggedElements=document.querySelectorAll(`[${n.SIZE_ATTR}]`),a.hasTags=a.taggedElements.length>0,d(`Tagged elements found: %c${a.hasTags}`,i.HIGHLIGHT)}const qt=`<rb>Legacy version detected on parent page</>
9
9
 
10
10
  Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
11
11
 
12
12
  See <u>https://iframe-resizer.com/setup/</> for more details.
13
- `,Jt=e=>`<b>Version mismatch</>
13
+ `,jt=e=>`<b>Version mismatch</>
14
14
 
15
15
  The parent and child pages are running different versions of <i>iframe resizer</>.
16
16
 
17
- Parent page: ${e} - Child page: ${o.VERSION}.
18
- `;function Xt({version:e}){!e||e===""||e===o.FALSE?R(Kt):e!==o.VERSION&&R(Jt(e))}const en=u.once(()=>R(E.getModeData(4)));function tn(e){if(!a.timerActive)return;const t=u.round(performance.now()-a.totalTime),n=e===o.INIT?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;d(n,i.HIGHLIGHT)}function nn(e){return e===void 0?e=c.targetOrigin:d(`Message targetOrigin: %c${e}`,i.HIGHLIGHT),e}function on(e,t){const{mode:n}=c,{sameOrigin:r,target:s}=a;if(r)try{window.parent.iframeParentListener(o.MESSAGE_ID+e)}catch(m){if(E.checkMode(n))en();else throw new Error(m);return!1}else{bt(s,"Internal error: postMessage target is undefined");const m=nn(t),l=Array.isArray(m)?m:[m];for(const g of l)s.postMessage(o.MESSAGE_ID+e,g)}return!0}function Ze(e,t,n,r,s){const{parentId:m}=c,{sameOrigin:l}=a,g=`${e}:${t}`,T=`${m}:${g}:${n}${r===void 0?"":`:${r}`}`;c.mode<-1||!on(T,s)||(tn(n),f(`Sending message to parent page via ${l?"sameOrigin":"postMessage"}: %c%c${T}`,i.ITALIC,i.HIGHLIGHT))}const S=se((e,t,n,r,s)=>{I(n),Ze(e,t,n,r,s),z()}),rn=e=>S(0,0,e.type,`${e.screenY}:${e.screenX}`);function je(e,t){d(`Add event listener: %c${t}`,i.HIGHLIGHT),L(window.document,e,rn)}function sn({mouseEvents:e}){e===!0&&(je(o.MOUSE_ENTER,"Mouse Enter"),je(o.MOUSE_LEAVE,"Mouse Leave"))}const an=()=>S(0,0,o.BEFORE_UNLOAD);function cn({persisted:e}){e||an(),I(o.PAGE_HIDE),f("Page persisted:",e),!e&&ce.forEach(u.invoke)}const dn=()=>L(window,u.lower(o.PAGE_HIDE),cn),Ye=(e,t)=>!(Math.abs(e-t)<=c.tolerance);function ln(e,t){const{calculateHeight:n,calculateWidth:r}=c,{height:s,width:m}=a;return n&&Ye(s,e)||r&&Ye(m,t)}const G=[i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT],Y={height:0,width:0},k={height:0,width:0};function C(e,t,n){return k[e]=t,Y[e]=n,t}function fn(e){const t=e.getOffset();return t!==0&&f(`Page offsetSize: %c${t}px`,i.HIGHLIGHT),t}const un=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function Qe(e){const{hasOverflow:t,hasTags:n,triggerLocked:r}=a,s=e.label,m=s===o.HEIGHT,l=e.boundingClientRect(),g=Math.ceil(l),T=Math.floor(l),h=un(e),v=`HTML: %c${l}px %cPage: %c${h}px`;let p;switch(!0){case!e.enabled():return Math.max(h,o.MIN_SIZE);case n:f("Found element with data-iframe-size attribute"),p=e.taggedElement();break;case(!t&&a.firstRun&&k[s]===0&&Y[s]===0):f(`Initial page size values: ${v}`,...G),p=C(s,l,h);break;case(r&&l===k[s]&&h===Y[s]):f(`Size unchanged: ${v}`,...G),p=Math.max(l,h);break;case(l===0&&h!==0):f(`Page is hidden: ${v}`,...G),p=h;break;case(!t&&l!==k[s]&&h<=Y[s]):f(`New <html> size: ${v} `,...G),f(`Previous <html> size: %c${k[s]}px`,i.HIGHLIGHT),p=C(s,l,h);break;case!m:p=e.taggedElement();break;case(!t&&l<k[s]):f(`<html> size decreased: ${v}`,...G),p=C(s,l,h);break;case(h===T||h===g):f(`<html> size equals page size: ${v}`,...G),p=C(s,l,h);break;case l>h:f(`Page size < <html> size: ${v}`,...G),p=C(s,l,h);break;case t:f("Found elements possibly overflowing <html> "),p=e.taggedElement();break;default:f(`Using <html> size: ${v}`,...G),p=C(s,l,h)}return f(`Content ${s}: %c${p}px`,i.HIGHLIGHT),p+=fn(e),Math.max(p,o.MIN_SIZE)}const mn=5*1e3,gn=4,hn=10,En=100,de="--ifr-start",Q="--ifr-end",Ke="--ifr-measure",O=[];let K={},Je=0,le;function Xe(){try{performance.clearMarks(de),performance.clearMarks(Q),performance.clearMeasures(Ke)}catch{}}function In(){le=setInterval(()=>{if(O.length<hn||K.hasTags&&K.len<25)return;O.sort();const e=Math.min(O.reduce((n,r)=>n+r,0)/O.length,O[Math.floor(O.length/2)]),t=u.round(e);t>Je&&(Je=t,I("performanceObserver"),d("Mean time:",u.round(O[Math.floor(O.length/2)])),d("Median time:",u.round(O.reduce((n,r)=>n+r,0)/O.length)),d("Average time:",t),d("Max time:",u.round(Math.max(...O)))),Xe(),!(e<=gn)&&(clearInterval(le),R(`<rb>Performance Warning</>
17
+ Parent page: ${e} - Child page: ${n.VERSION}.
18
+ `;function Yt({version:e}){!e||e===""||e===n.FALSE?T(qt):e!==n.VERSION&&T(jt(e))}const Qt=n.once(()=>T(n.getModeData(4)));function Kt(e){if(!a.timerActive)return;const t=n.round(performance.now()-a.totalTime),r=e===n.INIT?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;d(r,i.HIGHLIGHT)}function Jt(e){return e===void 0?e=c.targetOrigin:d(`Message targetOrigin: %c${e}`,i.HIGHLIGHT),e}function Xt(e,t){const{mode:r}=c,{sameOrigin:s,target:o}=a;if(s)try{window.parent.iframeParentListener(n.MESSAGE_ID+e)}catch(u){if(n.checkMode(r))Qt();else throw new Error(u);return!1}else{Rt(o,"Internal error: postMessage target is undefined");const u=Jt(t),l=Array.isArray(u)?u:[u];for(const g of l)o.postMessage(n.MESSAGE_ID+e,g)}return!0}function Ve(e,t,r,s,o){const{parentId:u}=c,{sameOrigin:l}=a,g=`${e}:${t}`,S=`${u}:${g}:${r}${s===void 0?"":`:${s}`}`;c.mode<-1||!Xt(S,o)||(Kt(r),f(`Sending message to parent page via ${l?"sameOrigin":"postMessage"}: %c%c${S}`,i.ITALIC,i.HIGHLIGHT))}const O=re((e,t,r,s,o)=>{E(r),Ve(e,t,r,s,o),G()}),en=e=>O(0,0,e.type,`${e.screenY}:${e.screenX}`);function We(e,t){d(`Add event listener: %c${t}`,i.HIGHLIGHT),N(window.document,e,en)}function tn({mouseEvents:e}){e===!0&&(We(n.MOUSE_ENTER,"Mouse Enter"),We(n.MOUSE_LEAVE,"Mouse Leave"))}const nn=()=>O(0,0,n.BEFORE_UNLOAD);function rn({persisted:e}){e||nn(),E(n.PAGE_HIDE),f("Page persisted:",e),!e&&ie.forEach(n.invoke)}const sn=()=>N(window,n.lower(n.PAGE_HIDE),rn),Ze=(e,t)=>!(Math.abs(e-t)<=c.tolerance);function on(e,t){const{calculateHeight:r,calculateWidth:s}=c,{height:o,width:u}=a;return r&&Ze(o,e)||s&&Ze(u,t)}const M=[i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT],Z={height:0,width:0},_={height:0,width:0};function k(e,t,r){return _[e]=t,Z[e]=r,t}function an(e){const t=e.getOffset();return t!==0&&f(`Page offsetSize: %c${t}px`,i.HIGHLIGHT),t}const cn=e=>e.documentElementScroll()+Math.max(0,e.getOffset());function qe(e){const{hasOverflow:t,hasTags:r,triggerLocked:s}=a,o=e.label,u=o===n.HEIGHT,l=e.boundingClientRect(),g=Math.ceil(l),S=Math.floor(l),h=cn(e),R=`HTML: %c${l}px %cPage: %c${h}px`;let I;switch(!0){case!e.enabled():return Math.max(h,n.MIN_SIZE);case r:f("Found element with data-iframe-size attribute"),I=e.taggedElement();break;case(!t&&a.firstRun&&_[o]===0&&Z[o]===0):f(`Initial page size values: ${R}`,...M),I=k(o,l,h);break;case(s&&l===_[o]&&h===Z[o]):f(`Size unchanged: ${R}`,...M),I=Math.max(l,h);break;case(l===0&&h!==0):f(`Page is hidden: ${R}`,...M),I=h;break;case(!t&&l!==_[o]&&h<=Z[o]):f(`New <html> size: ${R} `,...M),f(`Previous <html> size: %c${_[o]}px`,i.HIGHLIGHT),I=k(o,l,h);break;case!u:I=e.taggedElement();break;case(!t&&l<_[o]):f(`<html> size decreased: ${R}`,...M),I=k(o,l,h);break;case(h===S||h===g):f(`<html> size equals page size: ${R}`,...M),I=k(o,l,h);break;case l>h:f(`Page size < <html> size: ${R}`,...M),I=k(o,l,h);break;case t:f("Found elements possibly overflowing <html> "),I=e.taggedElement();break;default:f(`Using <html> size: ${R}`,...M),I=k(o,l,h)}return f(`Content ${o}: %c${I}px`,i.HIGHLIGHT),I+=an(e),Math.max(I,n.MIN_SIZE)}const dn=5*1e3,ln=4,fn=10,un=100,oe="--ifr-start",q="--ifr-end",je="--ifr-measure",p=[];let j={},Ye=0,ae;function Qe(){try{performance.clearMarks(oe),performance.clearMarks(q),performance.clearMeasures(je)}catch{}}function gn(){ae=setInterval(()=>{if(p.length<fn||j.hasTags&&j.len<25)return;p.sort();const e=Math.min(p.reduce((r,s)=>r+s,0)/p.length,p[Math.floor(p.length/2)]),t=n.round(e);t>Ye&&(Ye=t,E("performanceObserver"),d("Mean time:",n.round(p[Math.floor(p.length/2)])),d("Median time:",n.round(p.reduce((r,s)=>r+s,0)/p.length)),d("Average time:",t),d("Max time:",n.round(Math.max(...p)))),Qe(),!(e<=ln)&&(clearInterval(ae),T(`<rb>Performance Warning</>
19
19
 
20
- Calculating the page size is taking an excessive amount of time (${u.round(e)}ms).
20
+ Calculating the page size is taking an excessive amount of time (${n.round(e)}ms).
21
21
 
22
- To improve performance add the <b>data-iframe-size</> attribute to the ${K.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},mn)}function pn(e){e.getEntries().forEach(t=>{if(t.name===Q)try{const{duration:n}=performance.measure(Ke,de,Q);K=t.detail,O.push(n),O.length>En&&O.shift()}catch{}})}function On(){f("Attached%c PerformanceObserver%c to page",i.HIGHLIGHT,i.FOREGROUND);const e=new PerformanceObserver(pn);return e.observe({entryTypes:["mark"]}),In(),{disconnect:()=>{Xe(),clearInterval(le),e.disconnect(),f("Detached%c PerformanceObserver",i.HIGHLIGHT)}}}const Sn=e=>`:not(${e})`,Tn=`* ${Array.from(o.IGNORE_TAGS).map(Sn).join("")}`,fe=e=>e.querySelectorAll(Tn);function Rn(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:r}=a;return t?r:e?Array.from(n):fe(document.documentElement)}function vn(e,t){const n=`margin-${t}`;let r,s=document.documentElement,m=a.hasTags?o.MIN_SIZE:document.documentElement.getBoundingClientRect().bottom;for(const l of e)r=l.getBoundingClientRect()[t]+parseFloat(getComputedStyle(l).getPropertyValue(n)),r>m&&(m=r,s=l);return{maxEl:s,maxVal:m}}function et(e){performance.mark(de);const t=u.capitalizeFirstLetter(e),{logging:n}=c,{hasTags:r}=a,s=Rn(),{maxEl:m,maxVal:l}=vn(s,e);return f(`${t} position calculated from:`,m),f(`Checked %c${s.length}%c elements`,i.HIGHLIGHT,i.FOREGROUND),performance.mark(Q,{detail:{hasTags:r,len:s.length,logging:n,Side:t}}),l}const ue={label:o.HEIGHT,enabled:()=>c.calculateHeight,getOffset:()=>c.offsetHeight,auto:()=>Qe(ue),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>et(o.HEIGHT_EDGE)},me={label:o.WIDTH,enabled:()=>c.calculateWidth,getOffset:()=>c.offsetWidth,auto:()=>Qe(me),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>et(o.WIDTH_EDGE)};function wn(e,t,n){const r=c.onBeforeResize(e,t,n);if(r===void 0)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(r))throw new TypeError(`Invalid value returned from onBeforeResize(): ${r}, expected Number`);if(r<o.MIN_SIZE)throw new RangeError(`Out of range value returned from onBeforeResize(): ${r}, must be at least ${o.MIN_SIZE}`);return r}const tt=(e,t)=>(n,r)=>{const s=e[n]();return e.enabled()&&c.onBeforeResize!==void 0?wn(s,r,t):s},bn=tt(ue,o.HEIGHT),yn=tt(me,o.WIDTH);function Hn(){(window.scrollY!==0||window.scrollX!==0)&&(f("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0))}function An(e,t,n,r){const{heightCalcMode:s,widthCalcMode:m}=c;Hn();const l=n??bn(s,e),g=r??yn(m,e),T=ln(l,g)?o.SIZE_CHANGE_DETECTED:e;switch(d(`Resize event: %c${t}`,i.HIGHLIGHT),T){case o.INIT:case o.ENABLE:case o.SIZE_CHANGE_DETECTED:case o.MANUAL_RESIZE_REQUEST:case o.PARENT_RESIZE_REQUEST:a.height=l,a.width=g;case o.SET_OFFSET_SIZE:return a;case o.OVERFLOW_OBSERVER:case o.MUTATION_OBSERVER:case o.RESIZE_OBSERVER:case o.VISIBILITY_OBSERVER:{d(o.NO_CHANGE);break}default:f(o.NO_CHANGE)}return null}let J=!1,ge=!1,B=null;function Nn(e,t,n,r,s){const{autoResize:m}=c,{isHidden:l}=a;switch(I(e),!0){case(l===!0&&!(e in o.IGNORE_DISABLE_RESIZE)):{if(ge===!0)break;d("Iframe hidden - Ignored resize request"),ge=!0,J=!1,cancelAnimationFrame(B),B=null;break}case(J===!0&&e!==o.OVERFLOW_OBSERVER&&!(e in o.IGNORE_DISABLE_RESIZE)):{d("Resize already pending - Ignored resize request");break}case(!m&&!(e in o.IGNORE_DISABLE_RESIZE)):{f("Resizing disabled");break}default:{ge=!1,J=!0,a.totalTime=performance.now(),a.timerActive=!0;const g=An(e,t,n,r);g&&Ze(g.height,g.width,e,s),B||(B=requestAnimationFrame(()=>{J=!1,B=null,I("requestAnimationFrame"),j(`Reset sendPending: %c${e}`,i.HIGHLIGHT)})),a.timerActive=!1}}z()}const w=se(Nn);function nt({eventType:e,eventName:t}){L(window,t,()=>w(t,e),{passive:!0})}function Ln(){nt({eventType:"After Print",eventName:"afterprint"}),nt({eventType:"Before Print",eventName:"beforeprint"})}function Gn(){if(a.triggerLocked){d("TriggerLock blocked calculation");return}a.triggerLocked=!0,j("Trigger event lock on"),requestAnimationFrame(()=>{a.triggerLocked=!1,j("Trigger event lock off")})}function ot(e){const{heightCalcMode:t,widthCalcMode:n}=c,r=ue[t](),s=me[n]();d(`Reset trigger event: %c${e}`,i.HIGHLIGHT),S(r,s,e)}function Mn(e){const t=c.heightCalcMode;d(`Reset trigger event: %c${e}`,i.HIGHLIGHT),c.heightCalcMode=o.HEIGHT_CALC_MODE_DEFAULT,Gn(),ot("reset"),c.heightCalcMode=t}const zn=`Auto Resize can not be changed when <b>direction</> is set to '${o.NONE}'.`;function $n(e){u.typeAssert(e,o.BOOLEAN,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:r}=c;return r===!1&&n===!1?(I(o.ENABLE),R(zn),!1):(e===!0&&t===!1?(c.autoResize=!0,queueMicrotask(()=>w(o.ENABLE,"Auto Resize enabled"))):e===!1&&t===!0&&(c.autoResize=!1),S(0,0,o.AUTO_RESIZE,JSON.stringify(c.autoResize)),c.autoResize)}function _n(e){u.typeAssert(e,o.STRING,"parentIframe.moveToAnchor(anchor) anchor"),a.inPageLinks.findTarget(e)}function kn(e){u.typeAssert(e,o.NUMBER,"parentIframe.setOffsetSize(offset) offset"),c.offsetHeight=e,c.offsetWidth=e,w(o.SET_OFFSET_SIZE,`parentIframe.setOffsetSize(${e})`)}const Cn=()=>a.origin;function Dn(e){u.typeAssert(e,o.STRING,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),d(`Set targetOrigin: %c${e}`,i.HIGHLIGHT),c.targetOrigin=e}function Pn(e){return u.typeAssert(e,o.FUNCTION,"parentIframe.getParentProps(callback) callback"),a.onParentInfo=e,S(0,0,o.PARENT_INFO),()=>{a.onParentInfo=null,S(0,0,o.PARENT_INFO_STOP)}}function Bn(e,t){e!==void 0&&u.typeAssert(e,o.NUMBER,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&u.typeAssert(t,o.NUMBER,"parentIframe.resize(customHeight, customWidth) customWidth");const n=e===void 0?"":e,r=t===void 0?"":`,${t}`,s=`${n}${r}`;w(o.MANUAL_RESIZE_REQUEST,`parentIframe.resize(${s})`,e,t)}const he=e=>(t,n)=>{u.typeAssert(t,o.NUMBER,`parentIframe.${e}(x, y) x`),u.typeAssert(n,o.NUMBER,`parentIframe.${e}(x, y) y`),S(n,t,e)},Fn=he(o.SCROLL_BY),Un=he(o.SCROLL_TO),xn=he(o.SCROLL_TO_OFFSET);function Vn(e,t){t&&u.typeAssert(t,o.STRING,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),S(0,0,o.MESSAGE,JSON.stringify(e),t)}const Wn=()=>S(0,0,o.CLOSE),qn=()=>c.parentId,Zn=()=>Mn("parentIframe.reset");function jn(){const{win:e}=a;c.mode!==1&&(e.parentIframe=Object.freeze({autoResize:$n,close:Wn,getId:qn,getParentOrigin:Cn,getParentProps:Pn,moveToAnchor:_n,reset:Zn,setOffsetSize:kn,scrollBy:Fn,scrollTo:Un,scrollToOffset:xn,sendMessage:Vn,setTargetOrigin:Dn,resize:Bn}))}const F=(e="")=>t=>n=>{n.size>0&&j(`${t}Observer ${e}:`,...Array.from(n).flatMap(r=>[o.NEW_LINE,r]))},Yn=(e="")=>t=>n=>{n.size>0&&Me(`${t}Observer ${e}:`,...Array.from(n).flatMap(r=>[o.NEW_LINE,r]))},rt=F("attached to"),it=Yn("already attached"),Qn=F("detached from"),X=(e,t=!0)=>n=>{n>0&&f(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${n===1?"":"s"}`,i.HIGHLIGHT,i.NORMAL,i.HIGHLIGHT,i.NORMAL)},st=(e,t,n,r)=>{const s=Qn(e);return m=>{const l=new Set;let g=0;for(const T of m)n.has(T)&&(t.unobserve(T),n.delete(T),l.add(T),g+=1);s(l),r(g),l.clear()}},at=16,ct=2,Kn=200,Ee="Mutation",b=new Set,M=new Set,Ie=new Set,ee=[],Jn={attributes:!0,attributeFilter:[o.IGNORE_ATTR,o.SIZE_ATTR],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let pe=1,Oe,Se=!1,Te=0;const Xn=F("added")(Ee),eo=F("removed (page)")(Ee),to=F("removed (added)")(Ee),dt=e=>e.nodeType!==Node.ELEMENT_NODE||o.IGNORE_TAGS.has(e.tagName.toLowerCase());function no(e){const t=e.addedNodes;for(const n of t)dt(n)||b.add(n)}function oo(e){const t=e.removedNodes;for(const n of t)dt(n)||(b.has(n)?(b.delete(n),Ie.add(n)):M.add(n))}const ro=e=>{f("Mutations:",e);for(const t of e)no(t),oo(t);Xn(b),eo(M),to(Ie),Ie.clear()};function io(){M.size>0&&d(`Detected %c${M.size} %cremoved element${M.size>1?"s":""}`,i.HIGHLIGHT,i.FOREGROUND),b.size>0&&d(`Found %c${b.size} %cnew element${b.size>1?"s":""}`,i.HIGHLIGHT,i.FOREGROUND)}const so=e=>()=>{const t=performance.now(),n=t-Te,r=at*pe+++ct;if(n>r&&n<Kn){I("mutationThrottled"),f("Update delayed due to heavy workload on the callStack"),f(`EventLoop busy time: %c${u.round(n)}ms %c> Max wait: %c${r-ct}ms`,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT),setTimeout(Oe,at*pe),Te=t;return}pe=1,ee.forEach(ro),ee.length=0,Se=!1,io(),e({addedNodes:b,removedNodes:M}),b.clear(),M.clear()};function ao(e){ee.push(e),!Se&&(Te=performance.now(),Se=!0,requestAnimationFrame(Oe))}function co(e){const t=new window.MutationObserver(ao),n=document.body||document.documentElement;return Oe=so(e),t.observe(n,Jn),f("Attached%c MutationObserver%c to body",i.HIGHLIGHT,i.FOREGROUND),{disconnect:()=>{b.clear(),M.clear(),ee.length=0,t.disconnect(),f("Detached%c MutationObserver",i.HIGHLIGHT)}}}const lo={characterData:!0,childList:!0,subtree:!0};function fo(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,lo),f("Attached%c TitleObserver%c to head",i.HIGHLIGHT,i.FOREGROUND),setTimeout(e),{disconnect:()=>{n.disconnect(),f("Detached%c TitleObserver",i.HIGHLIGHT)}}}function uo(e){const t=new IntersectionObserver(r=>e(r.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),f("Attached%c VisibilityObserver%c to page",i.HIGHLIGHT,i.FOREGROUND),{disconnect:()=>{t.disconnect(),f("Detached%c VisibilityObserver",i.HIGHLIGHT)}}}let lt=new Set;function mo(e){const t=new Set,n=new Set;for(const r of e)r.closest(`[${o.IGNORE_ATTR}]`)?n.add(r):t.add(r);return n.size>0&&queueMicrotask(()=>{I("overflowIgnored"),f(`Ignoring elements with [data-iframe-ignore] > *:
23
- `,n),z()}),t}function ft(){const e=document.querySelectorAll(`[${o.OVERFLOW_ATTR}]`),t=mo(e);let n=!0;return typeof Set.prototype.symmetricDifference===o.FUNCTION&&(n=t.symmetricDifference(lt).size>0),lt=t,a.overflowedNodeSet=t,a.hasOverflow=t.size>0,{hasOverflowUpdated:n,overflowedNodeSet:t}}const y={},ut=e=>{const t=new Set;for(const n of e)if(n instanceof Element){t.add(n);for(const r of fe(n))t.add(r)}return f(`Inspecting:
24
- `,t),t},go=e=>{if(e.size===0)return;I("addObservers");const t=ut(e);y.overflow.attachObservers(t),y.resize.attachObserverToNonStaticElements(t),z()},ho=e=>{if(e.size===0)return;I("removeObservers");const t=ut(e);y.overflow.detachObservers(t),y.resize.detachObservers(t),z()};function Eo({addedNodes:e,removedNodes:t}){I("contentMutated"),a.applySelectors(),qe(),ft(),z(),ho(t),go(e)}function Io(e){Eo(e),w(o.MUTATION_OBSERVER,"Mutation Observed")}const U="Overflow",po=X(U),Oo=X(U,!1),So=rt(U),To=it(U),Ro=e=>e instanceof HTMLElement&&(!!e.hidden||e.offsetParent===null||e.style.display===o.NONE),vo=(e,t)=>{const n=t.side||o.HEIGHT_EDGE,r={root:t.root,rootMargin:"0px",threshold:1},s=window?.requestAnimationFrame||u.id,m=(H=!1)=>e(H),l=(H,N)=>H===0||H>N[n],g=(H,N)=>{H.toggleAttribute(o.OVERFLOW_ATTR,N)};function T(H){for(const N of H){const{boundingClientRect:q,rootBounds:Z,target:A}=N;if(!Z)continue;const Or=q[n],Sr=l(Or,Z)&&!(A instanceof HTMLElement&&Ro(A));g(A,Sr)}s(m)}const h=new IntersectionObserver(T,r),v=new WeakSet;function p(H){const N=new Set,q=new Set;let Z=0;for(const A of H)if(A instanceof Element){if(v.has(A)){N.add(A);continue}h.observe(A),v.add(A),q.add(A),Z+=1}To(N),So(q),po(Z),q.clear(),N.clear()}return{attachObservers:p,detachObservers:st(U,h,v,Oo),disconnect:()=>{h.disconnect(),f("Detached%c OverflowObserver",i.HIGHLIGHT)}}};function wo(){const{hasOverflow:e}=a,{hasOverflowUpdated:t,overflowedNodeSet:n}=ft();switch(!0){case!t:return;case n.size>1:f("Overflowed Elements:",n);break;case e:break;default:f("No overflow detected")}w(o.OVERFLOW_OBSERVER,"Overflow updated")}function bo(e){const t={root:document.documentElement,side:c.calculateHeight?o.HEIGHT_EDGE:o.WIDTH_EDGE};return y.overflow=vo(wo,t),y.overflow.attachObservers(e),y.overflow}const x="Resize",yo=X(x),Ho=X(x,!1),Ao=rt(x),No=it(x),te=new WeakSet,Re=new Set,ve=new Set;let V;function Lo(e){let t=0;for(const n of e){if(!(n instanceof Element))continue;const r=getComputedStyle(n)?.position;if(!(r===""||r==="static")){if(te.has(n)){Re.add(n);continue}V.observe(n),te.add(n),ve.add(n),t+=1}}No(Re),Ao(ve),yo(t),ve.clear(),Re.clear()}const Go=e=>(V=new ResizeObserver(e),V.observe(document.body),te.add(document.body),f("Attached%c ResizeObserver%c to body",i.HIGHLIGHT,i.FOREGROUND),{attachObserverToNonStaticElements:Lo,detachObservers:st(x,V,te,Ho),disconnect:()=>{V.disconnect(),f("Detached%c ResizeObserver",i.HIGHLIGHT)}});function Mo(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;w(o.RESIZE_OBSERVER,`Element resized <${u.getElementName(t)}>`)}function zo(e){return y.resize=Go(Mo),y.resize.attachObserverToNonStaticElements(e),y.resize}let mt;function $o(){const e=document.title;e!==mt&&(mt=e,d(`Title: %c${e}`,i.HIGHLIGHT),e&&S(0,0,o.TITLE,e))}function _o(e){d(`Visible: %c${e}`,i.HIGHLIGHT),a.isHidden=!e,w(o.VISIBILITY_OBSERVER,"Visibility changed")}function ko(e){ce.push(...e.map(t=>t.disconnect))}function Co(){I("attachObservers");const e=fe(document.documentElement),t=[co(Io),bo(e),On(),zo(e),fo($o),uo(_o)];ko(t)}const gt=(e,t,n)=>{if(n!==""){d(`${e}: %c${n}`,i.HIGHLIGHT);for(const r of document.querySelectorAll(n))d(`Applying ${t} to:`,r),r.toggleAttribute(t,!0)}};function Do({sizeSelector:e,ignoreSelector:t}){return()=>{gt("sizeSelector",o.SIZE_ATTR,e),gt("ignoreSelector",o.IGNORE_ATTR,t)}}function Po(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Bo(e,t){return t.includes("-")&&(_(`Negative CSS value ignored for ${e}`),t=""),t}function we(e,t){t===void 0||t===""||t===o.NULL||(document.body.style.setProperty(e,t),f(`Set body ${e}: %c${t}`,i.HIGHLIGHT))}function Fo({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),we("margin",Bo("margin",e))}const Uo=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function xo(e){const t=e.getBoundingClientRect(),n=Uo();return{x:Math.round(t.left+n.x),y:Math.round(t.top+n.y)}}function Vo(e,t){const n=xo(t);d(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT),S(n.y,n.x,o.SCROLL_TO_OFFSET)}function be(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),r=document.getElementById(n)||document.getElementsByName(n)[0];if(r!==void 0){Vo(t,r);return}d(`In page link (#${t}) not found in iframe, so sending to parent`),S(0,0,o.IN_PAGE_LINK,`#${t}`)}function ht(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&be(t)}function Wo(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&L(e,"click",t=>{t.preventDefault(),be(e.getAttribute("href"))})}function qo(){L(window,"hashchange",ht)}function Zo(){setTimeout(ht,o.EVENT_CANCEL_TIMER)}function jo(){d("Setting up location.hash handlers"),Wo(),qo(),Zo(),a.inPageLinks={findTarget:be}}function Yo(e){const{mode:t}=c;e?E.checkMode(t)?R(E.getModeData(5)):jo():d("In page linking not enabled")}const Qo="important";function Ko(){const e=t=>t.style.setProperty(o.HEIGHT,o.AUTO,Qo);e(document.documentElement),e(document.body),d("Set HTML & body height: %cauto !important",i.HIGHLIGHT)}const ye=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},He=ye(o.FUNCTION),Et=ye(o.NUMBER),ne=ye(o.STRING),Jo=e=>e!==null&&typeof e===o.OBJECT&&!Array.isArray(e);function Xo(e){const{calculateHeight:t,calculateWidth:n}=c;let r,s;return typeof e?.offsetSize===o.NUMBER&&(t&&(r=Et(e,o.OFFSET_SIZE)),n&&(s=Et(e,o.OFFSET_SIZE))),{offsetHeight:r,offsetWidth:s}}function er(e){d("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=Xo(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:ne(e,"ignoreSelector"),[E.getKey(3)]:ne(e,E.getKey(0)),sizeSelector:ne(e,"sizeSelector"),targetOrigin:ne(e,"targetOrigin"),onBeforeResize:He(e,"onBeforeResize"),onMessage:He(e,"onMessage"),onReady:He(e,"onReady")}}function tr(){const{mode:e}=c;if(E.checkMode(e))return{};const t=window.iframeResizer||window.iFrameResizer;return Jo(t)?er(t):{}}const nr=e=>e==="true",It=e=>t=>t===void 0?void 0:e(t),$=It(nr),W=It(Number),or=e=>({parentId:e[0],bodyMargin:W(e[1]),calculateWidth:$(e[2]),logging:$(e[3]),autoResize:$(e[6]),bodyMarginStr:e[7],bodyBackground:e[9],bodyPadding:e[10],tolerance:W(e[11]),inPageLinks:$(e[12]),mouseEvents:$(e[15]),offsetHeight:W(e[16]),offsetWidth:W(e[17]),calculateHeight:$(e[18]),key:e[19],version:e[20],mode:W(e[21]),logExpand:$(e[23])});function rr(e){const{mode:t}=c;e.forEach(n=>{try{n()}catch(r){if(t<0)throw r;R(`<rb>Error in setup function</>
22
+ To improve performance add the <b>data-iframe-size</> attribute to the ${j.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},dn)}function hn(e){e.getEntries().forEach(t=>{if(t.name===q)try{const{duration:r}=performance.measure(je,oe,q);j=t.detail,p.push(r),p.length>un&&p.shift()}catch{}})}function En(){f("Attached%c PerformanceObserver%c to page",i.HIGHLIGHT,i.FOREGROUND);const e=new PerformanceObserver(hn);return e.observe({entryTypes:["mark"]}),gn(),{disconnect:()=>{Qe(),clearInterval(ae),e.disconnect(),f("Detached%c PerformanceObserver",i.HIGHLIGHT)}}}const In=e=>`:not(${e})`,pn=`* ${Array.from(n.IGNORE_TAGS).map(In).join("")}`,ce=e=>e.querySelectorAll(pn);function On(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:r,taggedElements:s}=a;return t?s:e?Array.from(r):ce(document.documentElement)}function Sn(e,t){const r=`margin-${t}`;let s,o=document.documentElement,u=a.hasTags?n.MIN_SIZE:document.documentElement.getBoundingClientRect().bottom;for(const l of e)s=l.getBoundingClientRect()[t]+parseFloat(getComputedStyle(l).getPropertyValue(r)),s>u&&(u=s,o=l);return{maxEl:o,maxVal:u}}function Ke(e){performance.mark(oe);const t=n.capitalizeFirstLetter(e),{logging:r}=c,{hasTags:s}=a,o=On(),{maxEl:u,maxVal:l}=Sn(o,e);return f(`${t} position calculated from:`,u),f(`Checked %c${o.length}%c elements`,i.HIGHLIGHT,i.FOREGROUND),performance.mark(q,{detail:{hasTags:s,len:o.length,logging:r,Side:t}}),l}const de={label:n.HEIGHT,enabled:()=>c.calculateHeight,getOffset:()=>c.offsetHeight,auto:()=>qe(de),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>Ke(n.HEIGHT_EDGE)},le={label:n.WIDTH,enabled:()=>c.calculateWidth,getOffset:()=>c.offsetWidth,auto:()=>qe(le),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>Ke(n.WIDTH_EDGE)};function Tn(e,t,r){const s=c.onBeforeResize(e,t,r);if(s===void 0)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(s))throw new TypeError(`Invalid value returned from onBeforeResize(): ${s}, expected Number`);if(s<n.MIN_SIZE)throw new RangeError(`Out of range value returned from onBeforeResize(): ${s}, must be at least ${n.MIN_SIZE}`);return s}const Je=(e,t)=>(r,s)=>{const o=e[r]();return e.enabled()&&c.onBeforeResize!==void 0?Tn(o,s,t):o},Rn=Je(de,n.HEIGHT),bn=Je(le,n.WIDTH);function wn(){(window.scrollY!==0||window.scrollX!==0)&&(f("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0))}function vn(e,t,r,s){const{heightCalcMode:o,widthCalcMode:u}=c;wn();const l=r??Rn(o,e),g=s??bn(u,e),S=on(l,g)?n.SIZE_CHANGE_DETECTED:e;switch(d(`Resize event: %c${t}`,i.HIGHLIGHT),S){case n.INIT:case n.ENABLE:case n.SIZE_CHANGE_DETECTED:case n.MANUAL_RESIZE_REQUEST:case n.PARENT_RESIZE_REQUEST:a.height=l,a.width=g;case n.SET_OFFSET_SIZE:return a;case n.OVERFLOW_OBSERVER:case n.MUTATION_OBSERVER:case n.RESIZE_OBSERVER:case n.VISIBILITY_OBSERVER:{d(n.NO_CHANGE);break}default:f(n.NO_CHANGE)}return null}let Y=!1,fe=!1,D=null;function yn(e,t,r,s,o){const{autoResize:u}=c,{isHidden:l}=a;switch(E(e),!0){case(l===!0&&!(e in n.IGNORE_DISABLE_RESIZE)):{if(fe===!0)break;d("Iframe hidden - Ignored resize request"),fe=!0,Y=!1,cancelAnimationFrame(D),D=null;break}case(Y===!0&&e!==n.OVERFLOW_OBSERVER&&!(e in n.IGNORE_DISABLE_RESIZE)):{d("Resize already pending - Ignored resize request");break}case(!u&&!(e in n.IGNORE_DISABLE_RESIZE)):{f("Resizing disabled");break}default:{fe=!1,Y=!0,a.totalTime=performance.now(),a.timerActive=!0;const g=vn(e,t,r,s);g&&Ve(g.height,g.width,e,o),D||(D=requestAnimationFrame(()=>{Y=!1,D=null,E("requestAnimationFrame"),W(`Reset sendPending: %c${e}`,i.HIGHLIGHT)})),a.timerActive=!1}}G()}const b=re(yn);function Xe({eventType:e,eventName:t}){N(window,t,()=>b(t,e),{passive:!0})}function Hn(){Xe({eventType:"After Print",eventName:"afterprint"}),Xe({eventType:"Before Print",eventName:"beforeprint"})}function An(){if(a.triggerLocked){d("TriggerLock blocked calculation");return}a.triggerLocked=!0,W("Trigger event lock on"),requestAnimationFrame(()=>{a.triggerLocked=!1,W("Trigger event lock off")})}function et(e){const{heightCalcMode:t,widthCalcMode:r}=c,s=de[t](),o=le[r]();d(`Reset trigger event: %c${e}`,i.HIGHLIGHT),O(s,o,e)}function Nn(e){const t=c.heightCalcMode;d(`Reset trigger event: %c${e}`,i.HIGHLIGHT),c.heightCalcMode=n.HEIGHT_CALC_MODE_DEFAULT,An(),et("reset"),c.heightCalcMode=t}const Mn=`Auto Resize can not be changed when <b>direction</> is set to '${n.NONE}'.`;function Ln(e){n.typeAssert(e,n.BOOLEAN,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:r,calculateWidth:s}=c;return s===!1&&r===!1?(E(n.ENABLE),T(Mn),!1):(e===!0&&t===!1?(c.autoResize=!0,queueMicrotask(()=>b(n.ENABLE,"Auto Resize enabled"))):e===!1&&t===!0&&(c.autoResize=!1),O(0,0,n.AUTO_RESIZE,JSON.stringify(c.autoResize)),c.autoResize)}function Gn(e){n.typeAssert(e,n.STRING,"parentIframe.moveToAnchor(anchor) anchor"),a.inPageLinks.findTarget(e)}function zn(e){n.typeAssert(e,n.NUMBER,"parentIframe.setOffsetSize(offset) offset"),c.offsetHeight=e,c.offsetWidth=e,b(n.SET_OFFSET_SIZE,`parentIframe.setOffsetSize(${e})`)}const $n=()=>a.origin;function _n(e){n.typeAssert(e,n.STRING,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),d(`Set targetOrigin: %c${e}`,i.HIGHLIGHT),c.targetOrigin=e}function kn(e){return n.typeAssert(e,n.FUNCTION,"parentIframe.getParentProps(callback) callback"),a.onParentInfo=e,O(0,0,n.PARENT_INFO),()=>{a.onParentInfo=null,O(0,0,n.PARENT_INFO_STOP)}}function Cn(e,t){e!==void 0&&n.typeAssert(e,n.NUMBER,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&n.typeAssert(t,n.NUMBER,"parentIframe.resize(customHeight, customWidth) customWidth");const r=e===void 0?"":e,s=t===void 0?"":`,${t}`,o=`${r}${s}`;b(n.MANUAL_RESIZE_REQUEST,`parentIframe.resize(${o})`,e,t)}const ue=e=>(t,r)=>{n.typeAssert(t,n.NUMBER,`parentIframe.${e}(x, y) x`),n.typeAssert(r,n.NUMBER,`parentIframe.${e}(x, y) y`),O(r,t,e)},Dn=ue(n.SCROLL_BY),Pn=ue(n.SCROLL_TO),Bn=ue(n.SCROLL_TO_OFFSET);function Fn(e,t){t&&n.typeAssert(t,n.STRING,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),O(0,0,n.MESSAGE,JSON.stringify(e),t)}const Un=()=>O(0,0,n.CLOSE),mn=()=>c.parentId,xn=()=>Nn("parentIframe.reset");function Vn(){const{win:e}=a;c.mode!==1&&(e.parentIframe=Object.freeze({autoResize:Ln,close:Un,getId:mn,getParentOrigin:$n,getParentProps:kn,moveToAnchor:Gn,reset:xn,setOffsetSize:zn,scrollBy:Dn,scrollTo:Pn,scrollToOffset:Bn,sendMessage:Fn,setTargetOrigin:_n,resize:Cn}))}const P=(e="")=>t=>r=>{r.size>0&&W(`${t}Observer ${e}:`,...Array.from(r).flatMap(s=>[n.NEW_LINE,s]))},Wn=(e="")=>t=>r=>{r.size>0&&Me(`${t}Observer ${e}:`,...Array.from(r).flatMap(s=>[n.NEW_LINE,s]))},tt=P("attached to"),nt=Wn("already attached"),Zn=P("detached from"),Q=(e,t=!0)=>r=>{r>0&&f(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${r}%c element${r===1?"":"s"}`,i.HIGHLIGHT,i.NORMAL,i.HIGHLIGHT,i.NORMAL)},rt=(e,t,r,s)=>{const o=Zn(e);return u=>{const l=new Set;let g=0;for(const S of u)r.has(S)&&(t.unobserve(S),r.delete(S),l.add(S),g+=1);o(l),s(g),l.clear()}},st=16,it=2,qn=200,ge="Mutation",w=new Set,L=new Set,he=new Set,K=[],jn={attributes:!0,attributeFilter:[n.IGNORE_ATTR,n.SIZE_ATTR],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ee=1,Ie,pe=!1,Oe=0;const Yn=P("added")(ge),Qn=P("removed (page)")(ge),Kn=P("removed (added)")(ge),ot=e=>e.nodeType!==Node.ELEMENT_NODE||n.IGNORE_TAGS.has(e.tagName.toLowerCase());function Jn(e){const t=e.addedNodes;for(const r of t)ot(r)||w.add(r)}function Xn(e){const t=e.removedNodes;for(const r of t)ot(r)||(w.has(r)?(w.delete(r),he.add(r)):L.add(r))}const er=e=>{f("Mutations:",e);for(const t of e)Jn(t),Xn(t);Yn(w),Qn(L),Kn(he),he.clear()};function tr(){L.size>0&&d(`Detected %c${L.size} %cremoved element${L.size>1?"s":""}`,i.HIGHLIGHT,i.FOREGROUND),w.size>0&&d(`Found %c${w.size} %cnew element${w.size>1?"s":""}`,i.HIGHLIGHT,i.FOREGROUND)}const nr=e=>()=>{const t=performance.now(),r=t-Oe,s=st*Ee+++it;if(r>s&&r<qn){E("mutationThrottled"),f("Update delayed due to heavy workload on the callStack"),f(`EventLoop busy time: %c${n.round(r)}ms %c> Max wait: %c${s-it}ms`,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT),setTimeout(Ie,st*Ee),Oe=t;return}Ee=1,K.forEach(er),K.length=0,pe=!1,tr(),e({addedNodes:w,removedNodes:L}),w.clear(),L.clear()};function rr(e){K.push(e),!pe&&(Oe=performance.now(),pe=!0,requestAnimationFrame(Ie))}function sr(e){const t=new window.MutationObserver(rr),r=document.body||document.documentElement;return Ie=nr(e),t.observe(r,jn),f("Attached%c MutationObserver%c to body",i.HIGHLIGHT,i.FOREGROUND),{disconnect:()=>{w.clear(),L.clear(),K.length=0,t.disconnect(),f("Detached%c MutationObserver",i.HIGHLIGHT)}}}const ir={characterData:!0,childList:!0,subtree:!0};function or(e){const t=document.querySelector("title")??document.head??document.documentElement,r=new MutationObserver(e);return r.observe(t,ir),f("Attached%c TitleObserver%c to head",i.HIGHLIGHT,i.FOREGROUND),setTimeout(e),{disconnect:()=>{r.disconnect(),f("Detached%c TitleObserver",i.HIGHLIGHT)}}}function ar(e){const t=new IntersectionObserver(s=>e(s.at(-1)?.isIntersecting??!1),{threshold:0}),r=document.documentElement;return t.observe(r),f("Attached%c VisibilityObserver%c to page",i.HIGHLIGHT,i.FOREGROUND),{disconnect:()=>{t.disconnect(),f("Detached%c VisibilityObserver",i.HIGHLIGHT)}}}let at=new Set;function cr(e){const t=new Set,r=new Set;for(const s of e)s.closest(`[${n.IGNORE_ATTR}]`)?r.add(s):t.add(s);return r.size>0&&queueMicrotask(()=>{E("overflowIgnored"),f(`Ignoring elements with [data-iframe-ignore] > *:
23
+ `,r),G()}),t}function ct(){const e=document.querySelectorAll(`[${n.OVERFLOW_ATTR}]`),t=cr(e);let r=!0;return typeof Set.prototype.symmetricDifference===n.FUNCTION&&(r=t.symmetricDifference(at).size>0),at=t,a.overflowedNodeSet=t,a.hasOverflow=t.size>0,{hasOverflowUpdated:r,overflowedNodeSet:t}}const v={},dt=e=>{const t=new Set;for(const r of e)if(r instanceof Element){t.add(r);for(const s of ce(r))t.add(s)}return f(`Inspecting:
24
+ `,t),t},dr=e=>{if(e.size===0)return;E("addObservers");const t=dt(e);v.overflow.attachObservers(t),v.resize.attachObserverToNonStaticElements(t),G()},lr=e=>{if(e.size===0)return;E("removeObservers");const t=dt(e);v.overflow.detachObservers(t),v.resize.detachObservers(t),G()};function fr({addedNodes:e,removedNodes:t}){E("contentMutated"),a.applySelectors(),xe(),ct(),G(),lr(t),dr(e)}function ur(e){fr(e),b(n.MUTATION_OBSERVER,"Mutation Observed")}const B="Overflow",gr=Q(B),hr=Q(B,!1),Er=tt(B),Ir=nt(B),pr=e=>e instanceof HTMLElement&&(!!e.hidden||e.offsetParent===null||e.style.display===n.NONE),Or=(e,t)=>{const r=t.side||n.HEIGHT_EDGE,s={root:t.root,rootMargin:"0px",threshold:1},o=window?.requestAnimationFrame||n.id,u=(y=!1)=>e(y),l=(y,A)=>y===0||y>A[r],g=(y,A)=>{y.toggleAttribute(n.OVERFLOW_ATTR,A)};function S(y){for(const A of y){const{boundingClientRect:x,rootBounds:V,target:H}=A;if(!V)continue;const hs=x[r],Es=l(hs,V)&&!(H instanceof HTMLElement&&pr(H));g(H,Es)}o(u)}const h=new IntersectionObserver(S,s),R=new WeakSet;function I(y){const A=new Set,x=new Set;let V=0;for(const H of y)if(H instanceof Element){if(R.has(H)){A.add(H);continue}h.observe(H),R.add(H),x.add(H),V+=1}Ir(A),Er(x),gr(V),x.clear(),A.clear()}return{attachObservers:I,detachObservers:rt(B,h,R,hr),disconnect:()=>{h.disconnect(),f("Detached%c OverflowObserver",i.HIGHLIGHT)}}};function Sr(){const{hasOverflow:e}=a,{hasOverflowUpdated:t,overflowedNodeSet:r}=ct();switch(!0){case!t:return;case r.size>1:f("Overflowed Elements:",r);break;case e:break;default:f("No overflow detected")}b(n.OVERFLOW_OBSERVER,"Overflow updated")}function Tr(e){const t={root:document.documentElement,side:c.calculateHeight?n.HEIGHT_EDGE:n.WIDTH_EDGE};return v.overflow=Or(Sr,t),v.overflow.attachObservers(e),v.overflow}const F="Resize",Rr=Q(F),br=Q(F,!1),wr=tt(F),vr=nt(F),J=new WeakSet,Se=new Set,Te=new Set;let U;function yr(e){let t=0;for(const r of e){if(!(r instanceof Element))continue;const s=getComputedStyle(r)?.position;if(!(s===""||s==="static")){if(J.has(r)){Se.add(r);continue}U.observe(r),J.add(r),Te.add(r),t+=1}}vr(Se),wr(Te),Rr(t),Te.clear(),Se.clear()}const Hr=e=>(U=new ResizeObserver(e),U.observe(document.body),J.add(document.body),f("Attached%c ResizeObserver%c to body",i.HIGHLIGHT,i.FOREGROUND),{attachObserverToNonStaticElements:yr,detachObservers:rt(F,U,J,br),disconnect:()=>{U.disconnect(),f("Detached%c ResizeObserver",i.HIGHLIGHT)}});function Ar(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;b(n.RESIZE_OBSERVER,`Element resized <${n.getElementName(t)}>`)}function Nr(e){return v.resize=Hr(Ar),v.resize.attachObserverToNonStaticElements(e),v.resize}let lt;function Mr(){const e=document.title;e!==lt&&(lt=e,d(`Title: %c${e}`,i.HIGHLIGHT),e&&O(0,0,n.TITLE,e))}function Lr(e){d(`Visible: %c${e}`,i.HIGHLIGHT),a.isHidden=!e,b(n.VISIBILITY_OBSERVER,"Visibility changed")}function Gr(e){ie.push(...e.map(t=>t.disconnect))}function zr(){E("attachObservers");const e=ce(document.documentElement),t=[sr(ur),Tr(e),En(),Nr(e),or(Mr),ar(Lr)];Gr(t)}const ft=(e,t,r)=>{if(r!==""){d(`${e}: %c${r}`,i.HIGHLIGHT);for(const s of document.querySelectorAll(r))d(`Applying ${t} to:`,s),s.toggleAttribute(t,!0)}};function $r({sizeSelector:e,ignoreSelector:t}){return()=>{ft("sizeSelector",n.SIZE_ATTR,e),ft("ignoreSelector",n.IGNORE_ATTR,t)}}function _r(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function kr(e,t){return t.includes("-")&&($(`Negative CSS value ignored for ${e}`),t=""),t}function Re(e,t){t===void 0||t===""||t===n.NULL||(document.body.style.setProperty(e,t),f(`Set body ${e}: %c${t}`,i.HIGHLIGHT))}function Cr({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),Re("margin",kr("margin",e))}const Dr=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Pr(e){const t=e.getBoundingClientRect(),r=Dr();return{x:Math.round(t.left+r.x),y:Math.round(t.top+r.y)}}function Br(e,t){const r=Pr(t);d(`Moving to in page link (%c#${e}%c) at x: %c${r.x}%c y: %c${r.y}`,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT,i.FOREGROUND,i.HIGHLIGHT),O(r.y,r.x,n.SCROLL_TO_OFFSET)}function be(e){const t=e.split("#")[1]||e,r=decodeURIComponent(t),s=document.getElementById(r)||document.getElementsByName(r)[0];if(s!==void 0){Br(t,s);return}d(`In page link (#${t}) not found in iframe, so sending to parent`),O(0,0,n.IN_PAGE_LINK,`#${t}`)}function ut(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&be(t)}function Fr(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&N(e,"click",t=>{t.preventDefault(),be(e.getAttribute("href"))})}function Ur(){N(window,"hashchange",ut)}function mr(){setTimeout(ut,n.EVENT_CANCEL_TIMER)}function xr(){d("Setting up location.hash handlers"),Fr(),Ur(),mr(),a.inPageLinks={findTarget:be}}function Vr(e){const{mode:t}=c;e?n.checkMode(t)?T(n.getModeData(5)):xr():d("In page linking not enabled")}const Wr="important";function Zr(){const e=t=>t.style.setProperty(n.HEIGHT,n.AUTO,Wr);e(document.documentElement),e(document.body),d("Set HTML & body height: %cauto !important",i.HIGHLIGHT)}const we=e=>(t,r)=>{if(r in t){if(typeof t[r]===e)return t[r];throw new TypeError(`${r} is not a ${e}.`)}},ve=we(n.FUNCTION),gt=we(n.NUMBER),X=we(n.STRING),qr=e=>e!==null&&typeof e===n.OBJECT&&!Array.isArray(e);function jr(e){const{calculateHeight:t,calculateWidth:r}=c;let s,o;return typeof e?.offsetSize===n.NUMBER&&(t&&(s=gt(e,n.OFFSET_SIZE)),r&&(o=gt(e,n.OFFSET_SIZE))),{offsetHeight:s,offsetWidth:o}}function Yr(e){d("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:r}=jr(e);return{offsetHeight:t,offsetWidth:r,ignoreSelector:X(e,"ignoreSelector"),[n.getKey(3)]:X(e,n.getKey(0)),sizeSelector:X(e,"sizeSelector"),targetOrigin:X(e,"targetOrigin"),onBeforeResize:ve(e,"onBeforeResize"),onMessage:ve(e,"onMessage"),onReady:ve(e,"onReady")}}function Qr(){const{mode:e}=c;if(n.checkMode(e))return{};const t=window.iframeResizer||window.iFrameResizer;return qr(t)?Yr(t):{}}const Kr=e=>e==="true",ht=e=>t=>t===void 0?void 0:e(t),z=ht(Kr),m=ht(Number),Jr=e=>({parentId:e[0],bodyMargin:m(e[1]),calculateWidth:z(e[2]),logging:z(e[3]),autoResize:z(e[6]),bodyMarginStr:e[7],bodyBackground:e[9],bodyPadding:e[10],tolerance:m(e[11]),inPageLinks:z(e[12]),mouseEvents:z(e[15]),offsetHeight:m(e[16]),offsetWidth:m(e[17]),calculateHeight:z(e[18]),key:e[19],version:e[20],mode:m(e[21]),logExpand:z(e[23])});function Xr(e){const{mode:t}=c;e.forEach(r=>{try{r()}catch(s){if(t<0)throw s;T(`<rb>Error in setup function</>
25
25
  <i>iframe-resizer</> detected an error during setup.
26
26
 
27
- Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),Me(r)}})}function pt(e){for(const[t,n]of Object.entries(e))n!==void 0&&(c[t]=n)}function ir({logExpand:e,logging:t,parentId:n=""}){vt({id:n,enabled:t,expand:e}),I("initReceived"),d(`Initialising iframe v${o.VERSION} ${window.location.href}`)}function sr(e){I("ready"),We(u.once(e)),d("Initialization complete",(({key:t,key2:n,...r})=>r)(c))}function ar({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:r}){const s=Bt(c),m=[xt,Ft,jt,qe,Qt,s?u.id:Pt,()=>Fo(c),()=>we("background",e),()=>we("padding",t),s?u.id:Ko,Po,a.applySelectors,()=>Yo(n),Ln,()=>sn(c),dn,()=>jn(),()=>w(o.INIT,"Init message from host page",void 0,void 0,`${o.VERSION}:${c.mode}`),Co,z];Xt(c),Wt(c),rr(m),sr(r)}function cr(e){a.firstRun&&(pt(or(e)),ir(c),pt(tr()),a.applySelectors=Do(c),ar(c))}function dr(e){if(document.readyState==="loading"){d("Page not ready, ignoring init message");return}const t=e.data.slice(o.MESSAGE_ID_LENGTH).split(o.SEPARATOR);a.target=e.source,a.origin=e.origin,cr(t),a.firstRun=!1,setTimeout(()=>{a.initLock=!1},o.EVENT_CANCEL_TIMER)}const{freeze:lr}=Object,{parse:Ae}=JSON,Ne=e=>lr(Ae(e)),Ot=e=>S(0,0,`${e}Stop`),oe=e=>e.data.slice(e.data.indexOf(o.SEPARATOR)+1),fr=e=>Nt(e)?o.INIT:e.data.split("]")[1].split(o.SEPARATOR)[0];function ur(e){const t=oe(e);d("onMessage called from parent:%c",i.HIGHLIGHT,Ne(t)),u.isolateUserCode(c.onMessage,Ae(t))}function mr(e){const{onPageInfo:t}=a,n=oe(e);d("PageInfo received from parent:",Ne(n)),t?u.isolateUserCode(t,Ae(n)):Ot(o.PAGE_INFO)}function gr(e){const{onParentInfo:t}=a,n=Ne(oe(e));d("ParentInfo received from parent:",n),t?u.isolateUserCode(t,n):Ot(o.PARENT_INFO)}function hr(){if(a.initLock){d("Page reset ignored by init");return}d("Page size reset by host page"),ot("resetPage")}function Er(){d("Resize requested by host page"),w(o.PARENT_RESIZE_REQUEST,"Parent window requested size check")}const St=e=>a.inPageLinks.findTarget(oe(e)),Tt={init:dr,reset:hr,resize:Er,moveToAnchor:St,inPageLink:St,pageInfo:mr,parentInfo:gr,message:ur};function Ir(e){const{firstRun:t}=a,n=fr(e);switch(I(n),!0){case n in Tt:Tt[n](e);break;case(t&&At()):_(`Ignored message of type "${n}". Received before initialization.`);break;default:_(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const re=se(e=>{Ht(e)&&Ir(e)});function pr(){if("iframeChildListener"in window){_("Already setup");return}window.iframeChildListener=(t=>{setTimeout(()=>re({data:t,sameOrigin:!0}))}),I("listen"),L(window,o.MESSAGE,re),L(document,o.READY_STATE_CHANGE,De),De();function e(t){return re(t),a.win}try{top?.document?.getElementById("banner")&&(a.win={},window.mockMsgListener=e,_e(window,o.MESSAGE,re),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==o.UNDEFINED&&pr()}));
27
+ Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),Me(s)}})}function Et(e){for(const[t,r]of Object.entries(e))r!==void 0&&(c[t]=r)}function es({logExpand:e,logging:t,parentId:r=""}){St({id:r,enabled:t,expand:e}),E("initReceived"),d(`Initialising iframe v${n.VERSION} ${window.location.href}`)}function ts(e){E("ready"),me(n.once(e)),d("Initialization complete",(({key:t,key2:r,...s})=>s)(c))}function ns({bodyBackground:e,bodyPadding:t,inPageLinks:r,onReady:s}){const o=Ct(c),u=[Bt,Dt,Vt,xe,Zt,o?n.id:kt,()=>Cr(c),()=>Re("background",e),()=>Re("padding",t),o?n.id:Zr,_r,a.applySelectors,()=>Vr(r),Hn,()=>tn(c),sn,()=>Vn(),()=>b(n.INIT,"Init message from host page",void 0,void 0,`${n.VERSION}:${c.mode}`),zr,G];Yt(c),Ut(c),Xr(u),ts(s)}function rs(e){a.firstRun&&(Et(Jr(e)),es(c),Et(Qr()),a.applySelectors=$r(c),ns(c))}function ss(e){if(document.readyState==="loading"){d("Page not ready, ignoring init message");return}const t=e.data.slice(n.MESSAGE_ID_LENGTH).split(n.SEPARATOR);a.target=e.source,a.origin=e.origin,rs(t),a.firstRun=!1,setTimeout(()=>{a.initLock=!1},n.EVENT_CANCEL_TIMER)}const{freeze:is}=Object,{parse:ye}=JSON,He=e=>is(ye(e)),It=e=>O(0,0,`${e}Stop`),ee=e=>e.data.slice(e.data.indexOf(n.SEPARATOR)+1),os=e=>yt(e)?n.INIT:e.data.split("]")[1].split(n.SEPARATOR)[0];function as(e){const t=ee(e);d("onMessage called from parent:%c",i.HIGHLIGHT,He(t)),n.isolateUserCode(c.onMessage,ye(t))}function cs(e){const{onPageInfo:t}=a,r=ee(e);d("PageInfo received from parent:",He(r)),t?n.isolateUserCode(t,ye(r)):It(n.PAGE_INFO)}function ds(e){const{onParentInfo:t}=a,r=He(ee(e));d("ParentInfo received from parent:",r),t?n.isolateUserCode(t,r):It(n.PARENT_INFO)}function ls(){if(a.initLock){d("Page reset ignored by init");return}d("Page size reset by host page"),et("resetPage")}function fs(){d("Resize requested by host page"),b(n.PARENT_RESIZE_REQUEST,"Parent window requested size check")}const pt=e=>a.inPageLinks.findTarget(ee(e)),Ot={init:ss,reset:ls,resize:fs,moveToAnchor:pt,inPageLink:pt,pageInfo:cs,parentInfo:ds,message:as};function us(e){const{firstRun:t}=a,r=os(e);switch(E(r),!0){case r in Ot:Ot[r](e);break;case(t&&vt()):$(`Ignored message of type "${r}". Received before initialization.`);break;default:$(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const te=re(e=>{wt(e)&&us(e)});function gs(){if("iframeChildListener"in window){$("Already setup");return}window.iframeChildListener=(t=>{setTimeout(()=>te({data:t,sameOrigin:!0}))}),E("listen"),N(window,n.MESSAGE,te),N(document,n.READY_STATE_CHANGE,ke),ke();function e(t){return te(t),a.win}try{top?.document?.getElementById("banner")&&(a.win={},window.mockMsgListener=e,ze(window,n.MESSAGE,te),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==n.UNDEFINED&&gs()}));
28
28
  //# sourceMappingURL=index.umd.js.map