@iframe-resizer/child 5.5.5-beta.1 → 5.5.6-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,4 +25,4 @@ yarn add @iframe-resizer/child
25
25
 
26
26
  ---
27
27
 
28
- _iframe-resizer version 5.5.5-beta.1 2025-09-01 - 10:18:24.855Z_
28
+ _iframe-resizer version 5.5.6-beta.1 2025-09-04 - 10:55:49.979Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.5.5-beta.1 (cjs) - 2025-09-01
4
+ * @module iframe-resizer/child 5.5.6-beta.1 (cjs) - 2025-09-04
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- "use strict";const e=require("auto-console-group"),t="5.5.5-beta.1",n="iframeResizer",o="beforeUnload",r="init",i="message",a="pageInfo",s="parentInfo",c="scrollToOffset",l="title",d=10,u="data-iframe-size",m="data-iframe-overflowed",f="data-iframe-ignore",p="height",h="width",g="readystatechange",y="bottom",b="right",v="autoResizeEnabled",z=Symbol("sizeChanged"),w="manualResize",$="parentResize",I={[w]:1,[$]:1},O="setOffsetSize",S="resizeObserver",H="overflowObserver",T="mutationObserver",M="visibilityObserver",E="No change in content size detected",k="[iFrameSizer]",R=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),G=(e,t,n,o)=>e.addEventListener(t,n,o||!1),N=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);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)},A=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),L=["spjluzl","rlf","clyzpvu"],j=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","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</>","<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</>.","<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."],x=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],P=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),C=e=>A(j[e]),D=e=>{const t=e[A(L[0])]||e[A(L[1])]||e[A(L[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=N(A(e));return n in P&&(t=P[n]),t}(n[0]);return 0===o||(e=>e[2]===N(e[0]+e[1]))(n)||(o=-2),o},q=(e,...t)=>setTimeout(()=>e(...t),0),B=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},F=e=>e,U=e=>Math.round(1e3*e)/1e3,W=e=>e.charAt(0).toUpperCase()+e.slice(1),V=e=>""!=`${e}`&&void 0!==e;const Z=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${W(t)}`)};let J=!0,_=n;var Q;const Y=(Q=e,Q?.__esModule?Q.default:Q)({label:`${n}(child)`,expand:!1});const X=e=>(...t)=>!J||Y[e](...t),K=X("log"),ee=K,te=X("debug");const{assert:ne,endAutoGroup:oe,error:re,errorBoundary:ie,event:ae,label:se,purge:ce,warn:le}=Y,de=e=>{return Y.warn((t=F,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},ue=de,me=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>de(t)),fe=me("Method"),pe=me("Method","replaced with"),he=me("Option"),ge=["min-height","min-width","max-height","max-width"],ye=new Set,be=e=>e.tagName?e.tagName.toLowerCase():"unknown",ve=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),ze=(e,t)=>{return(n=ve(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function we({href:e}){ye.has(e)||(K("Unable to access stylesheet:",e),ye.add(e))}const $e=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){we(n)}return{source:"cross-origin stylesheet",value:ve(e,t)}}(e,t),Ie=(e,t)=>{const{source:n,value:o}=$e(e,t),r=be(e);de(`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</>.\n\nIf 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 Oe(){for(const e of[document.documentElement,document.body])for(const t of ge)K(`Checking <${be(e)}> for blocking CSS: ${t}`),ze(e,t)&&Ie(e,t)}const Se=e=>t=>void 0===t?void 0:e(t),He=Se(e=>"true"===e),Te=Se(Number),Me=(e="")=>t=>n=>{n.size>0&&te(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Ee=Me("attached to"),ke=((e="")=>t=>n=>{n.size>0&&re(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Re=Me("detached from"),Ge=(t,n=!0)=>o=>{o>0&&ee(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,e.HIGHLIGHT,e.NORMAL)},Ne=(e,t,n,o)=>{const r=Re(e);return e=>{const i=new Set;let a=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),i.add(o),a+=1);r(i),o(a),i.clear()}},Ae="Mutation",Le=new Set,je=new Set,xe=new Set,Pe=[],Ce={attributes:!0,attributeFilter:[f,u],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let De,qe=1,Be=!1,Fe=0;const Ue=Me("added")(Ae),We=Me("removed (page)")(Ae),Ve=Me("removed (added)")(Ae),Ze=e=>e.nodeType!==Node.ELEMENT_NODE||R.has(e.tagName.toLowerCase());function Je(e){const t=e.addedNodes;for(const e of t)Ze(e)||Le.add(e)}function _e(e){const t=e.removedNodes;for(const e of t)Ze(e)||(Le.has(e)?(Le.delete(e),xe.add(e)):je.add(e))}const Qe=e=>{ee("Mutations:",e);for(const t of e)Je(t),_e(t);Ue(Le),We(je),Ve(xe),xe.clear()};const Ye=t=>()=>{const n=performance.now(),o=n-Fe,r=16*qe+++2;if(o>r&&o<200)return ae("mutationThrottled"),ee("Update delayed due to heavy workload on the callStack"),ee(`EventLoop busy time: %c${U(o)}ms %c> Max wait: %c${r-2}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(De,16*qe),void(Fe=n);qe=1,Pe.forEach(Qe),Pe.length=0,Be=!1,je.size>0&&K(`Detected %c${je.size} %cremoved element${je.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),Le.size>0&&K(`Found %c${Le.size} %cnew element${Le.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),t({addedNodes:Le,removedNodes:je}),Le.clear(),je.clear()};function Xe(e){Pe.push(e),Be||(Fe=performance.now(),Be=!0,requestAnimationFrame(De))}function Ke(e){const t=new window.MutationObserver(Xe),n=document.body||document.documentElement;return De=Ye(e),t.observe(n,Ce),ee("Attached MutationObserver to body"),{...t,disconnect:()=>{Le.clear(),je.clear(),Pe.length=0,t.disconnect(),ee("Detached MutationObserver")}}}const et="Overflow",tt=Ge(et),nt=Ge(et,!1),ot=Ee(et),rt=ke(et),it=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,at=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||F,i=(t=!1)=>e(t),a=(e,t)=>0===e||e>t[n],s=(e,t)=>e.toggleAttribute(m,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t;if(!o)continue;const i=e[n],c=a(i,o)&&!it(r);s(r,c)}r(i)},o),l=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r.nodeType===Node.ELEMENT_NODE&&(l.has(r)?t.add(r):(c.observe(r),l.add(r),n.add(r),o+=1));rt(t),ot(n),tt(o),n.clear(),t.clear()},detachObservers:Ne(et,c,l,nt),disconnect:()=>{c.disconnect(),ee("Detached OverflowObserver")}}},st="--ifr-start",ct="--ifr-end",lt="--ifr-measure",dt=[];let ut,mt={},ft=0;function pt(){try{performance.clearMarks(st),performance.clearMarks(ct),performance.clearMeasures(lt)}catch{}}function ht(e){e.getEntries().forEach(e=>{if(e.name===ct)try{const{duration:t}=performance.measure(lt,st,ct);mt=e.detail,dt.push(t),dt.length>100&&dt.shift()}catch{}})}function gt(){ee("Attached PerformanceObserver to page");const e=new PerformanceObserver(ht);return e.observe({entryTypes:["mark"]}),ut=setInterval(()=>{if(dt.length<10)return;if(mt.hasTags&&mt.len<25)return;dt.sort();const e=Math.min(dt.reduce((e,t)=>e+t,0)/dt.length,dt[Math.floor(dt.length/2)]),t=U(e);t>ft&&(ft=t,ae("performanceObserver"),K("Mean time:",U(dt[Math.floor(dt.length/2)])),K("Median time:",U(dt.reduce((e,t)=>e+t,0)/dt.length)),K("Average time:",t),K("Max time:",U(Math.max(...dt)))),pt(),e<=4||(clearInterval(ut),de(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${U(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${mt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{pt(),clearInterval(ut),e.disconnect(),ee("Detached PerformanceObserver")}}}const yt="Resize",bt=Ge(yt),vt=Ge(yt,!1),zt=Ee(yt),wt=ke(yt),$t=new WeakSet,It=new Set,Ot=new Set;let St;function Ht(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&($t.has(n)?It.add(n):(St.observe(n),$t.add(n),Ot.add(n),t+=1))}wt(It),zt(Ot),bt(t),Ot.clear(),It.clear()}function Tt(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;return t.observe(n),ee("Attached VisibilityObserver to page"),{disconnect:()=>{t.disconnect(),ee("Detached VisibilityObserver")}}}const Mt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Et=Mt("function"),kt=Mt("number"),Rt=Mt("string");"undefined"!=typeof window&&function(){const N={height:()=>(le("Custom height calculation function not defined"),On.auto()),width:()=>(le("Custom width calculation function not defined"),Sn.auto())},j={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},P={},Q="auto",X=[],ce="scroll";let me,ge,ye,be,ve,ze,we,$e,Ie,Se=!0,Me="",Ee=0,ke="",Re="",Ge=!1,Ae=!0,Le=!1,je=!0,xe=!1,Pe=!1,Ce=!0,De=!1,qe=1,Be=Q,Fe="",Ue=!0,We={},Ve=!1,Ze=!1,Je=!1,_e=0,Qe=!1,Ye=0,Xe=0,et=new Set,tt="",nt="child",ot=!1,rt="",it=[],lt=window.parent,dt="*",ut=0,mt=!1,ft=1,pt=ce,ht=window,bt=()=>{le("onMessage function not defined")},zt=()=>{},wt=null,It=null;function Ot(o){var i;!function(e){tt=e[0]??tt,Ee=Te(e[1])??Ee,Le=He(e[2])??Le,Je=He(e[3])??Je,Se=He(e[6])??Se,ke=e[7]??ke,Be=e[8]??Be,Me=e[9]??Me,Re=e[10]??Re,ut=Te(e[11])??ut,We.enable=He(e[12])??!1,nt=e[13]??nt,pt=e[14]??pt,Qe=He(e[15])??Qe,Ye=Te(e[16])??Ye,Xe=Te(e[17])??Xe,Ae=He(e[18])??Ae,me=e[19]??me,$e=e[20]??$e,_e=Te(e[21])??_e,Ze=He(e[23])??Ze}(o),_=(i={id:tt,enabled:Je,expand:Ze}).id||n,Y.label(`${_}`),Y.expand(i.expand),J=i.enabled,K(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){K("Reading data from page:",Object.keys(e)),Ie=Et(e,"onBeforeResize")??Ie,bt=Et(e,"onMessage")??bt,zt=Et(e,"onReady")??zt,"number"==typeof e?.offset&&(he("offset","offsetSize"),Ae&&(Ye=kt(e,"offset")??Ye),Le&&(Xe=kt(e,"offset")??Xe)),"number"==typeof e?.offsetSize&&(Ae&&(Ye=kt(e,"offsetSize")??Ye),Le&&(Xe=kt(e,"offsetSize")??Xe)),ge=Rt(e,A(L[0]))??ge,Fe=Rt(e,"ignoreSelector")??Fe,rt=Rt(e,"sizeSelector")??rt,dt=Rt(e,"targetOrigin")??dt,Be=e?.heightCalculationMethod||Be,pt=e?.widthCalculationMethod||pt}function n(e,t){return"function"==typeof e&&(de(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}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.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),N[t]=e,e="custom"),e}if(1===_e)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),Be=n(Be,p),pt=n(pt,h),ee(`Set targetOrigin for parent: %c${dt}`,e.HIGHLIGHT))}(),[xt,Ct,Yt,Lt,Pt,_t,Qt,Zt,jt,Nt,Ge?F:Oe,Bt,nn,tn,en,Ft,()=>Dt("background",Me),()=>Dt("padding",Re),Ge?F:Ut,Kt,Xt,hn,Mt].forEach(e=>{try{e()}catch(e){if(_e<0)throw e;de("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),re(e)}}),Gt(B(zt)),K("Initialization complete"),Gn(r,"Init message from host page",void 0,void 0,`${t}:${_e}`),document.title&&""!==document.title&&Ln(0,0,l,document.title)}function Mt(){G(window,o.toLowerCase(),()=>{X.forEach(e=>e()),Ln(0,0,o)})}function Gt(e){"complete"===document.readyState?q(e):G(document,g,()=>Gt(e))}function Nt(){it=document.querySelectorAll(`[${u}]`),De=it.length>0,K(`Tagged elements found: %c${De}`,e.HIGHLIGHT)}let At=0;function Lt(){const t=document.querySelectorAll(`*[${f}]`);return xe=t.length>0,xe&&t.length!==At&&(function(t){const n=1===t.length?"":"s";le(`%c[${f}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),At=t.length),xe}function jt(){"BackCompat"===document.compatMode&&de("<rb>Quirks Mode Detected</>\n\nThis 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</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n")}function xt(){$e&&""!==$e&&"false"!==$e?$e!==t&&de(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${$e} - Child page: ${t}.\n`):de("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n")}function Pt(){try{ot=1===_e||"iframeParentListener"in window.parent}catch(e){K("Cross domain iframe detected")}}function Ct(){Le===Ae&&(Ge=!0)}function Dt(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),ee(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function qt(t,n,o){if(""!==o){K(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))K(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function Bt(){qt("sizeSelector",u,rt),qt("ignoreSelector",f,Fe)}function Ft(){var e,t;void 0===ke&&(ke=`${Ee}px`),Dt("margin",(e="margin",(t=ke).includes("-")&&(le(`Negative CSS value ignored for ${e}`),t=""),t))}function Ut(){const t=e=>e.style.setProperty(p,"auto","important");t(document.documentElement),t(document.body),K("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}function Wt(t){({add(e){function n(){Gn(t.eventName,t.eventType)}P[e]=n,G(window,e,n,{passive:!0})},remove(e){const t=P[e];var n,o;delete P[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),K(`${W(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Vt(e){Wt({method:e,eventType:"After Print",eventName:"afterprint"}),Wt({method:e,eventType:"Before Print",eventName:"beforeprint"}),Wt({method:e,eventType:"Ready State Change",eventName:g})}function Zt(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(u,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&de("<rb>Deprecated Attributes</>\n \nThe <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</>.")}function Jt(t,n,o){const{label:r}=o;return n!==t&&(t in o||(le(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in j)&&de(`<rb>Deprecated ${r}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${$e?"remove this option.":`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:\n \nwindow.iframeResizer = {\n license: 'xxxx',\n ${r}CalculationMethod: 'auto',\n}\n`}\n`),K(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function _t(){Be=Jt(Be,Q,On)}function Qt(){pt=Jt(pt,ce,Sn)}function Yt(){const n=_e,o=D({key:me}),r=D({key:ge});if(_e=Math.max(o,r),_e<0){if(_e=Math.min(o,r),de(`${C(_e+2)}${C(2)}`),V($e))throw C(_e+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!V($e)||n>-1&&_e>n)&&(sessionStorage.getItem("ifr")!==t&&function(t,n){console.info(`${_} %ciframe-resizer ${t}`,J||n<1?"font-weight: bold;":e.NORMAL)}(`v${t} (${(e=>A(x[e]))(_e)})`,_e),_e<2&&ue(C(3)),sessionStorage.setItem("ifr",t))}function Xt(){!0!==Se&&K("Auto Resize disabled"),Vt("add"),X.push(()=>Vt("remove"))}function Kt(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function en(){function t(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,d)+parseInt(n.x,d),y:parseInt(t.top,d)+parseInt(n.y,d)}}function n(n){const o=n.split("#")[1]||n,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(K(`In page link (#${o}) not found in iframe, so sending to parent`),Ln(0,0,"inPageLink",`#${o}`)):function(n){const r=t(n);K(`Moving to in page link (%c#${o}%c) at x: %c${r.x}%c y: %c${r.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Ln(r.y,r.x,c)}(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}We.enable?1===_e?de("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):(K("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&G(e,"click",t=>{t.preventDefault(),n(e.getAttribute("href"))})}(),G(window,"hashchange",o),setTimeout(o,128)):K("In page linking not enabled"),We={findTarget:n}}function tn(){function t(e){Ln(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){K(`Add event listener: %c${o}`,e.HIGHLIGHT),G(window.document,n,t)}!0===Qe&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}function nn(){1!==_e&&(ht.parentIframe=Object.freeze({autoResize:e=>(Z(e,"boolean","parentIframe.autoResize(enable) enable"),!1===Le&&!1===Ae?(ae(v),de("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Se?(Se=!0,queueMicrotask(()=>Gn(v,"Auto Resize enabled"))):!1===e&&!0===Se&&(Se=!1),Ln(0,0,"autoResize",JSON.stringify(Se)),Se)),close(){Ln(0,0,"close")},getId:()=>tt,getOrigin:()=>(ae("getOrigin"),fe("getOrigin()","getParentOrigin()"),ye),getParentOrigin:()=>ye,getPageInfo(e){if("function"==typeof e)return wt=e,Ln(0,0,a),void pe("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");wt=null,Ln(0,0,"pageInfoStop")},getParentProps:e=>(Z(e,"function","parentIframe.getParentProps(callback) callback"),It=e,Ln(0,0,s),()=>{It=null,Ln(0,0,"parentInfoStop")}),getParentProperties(e){fe("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){Z(e,"string","parentIframe.moveToAnchor(anchor) anchor"),We.findTarget(e)},reset(){!function(){const t=Be;Be=Q,K(`Reset trigger event: %c${"parentIframe.reset"}`,e.HIGHLIGHT),mt?K("TriggerLock blocked calculation"):(mt=!0,te("Trigger event lock on"),requestAnimationFrame(()=>{mt=!1,te("Trigger event lock off")})),Nn("reset"),Be=t}()},setOffsetSize(e){Z(e,"number","parentIframe.setOffsetSize(offset) offset"),Ye=e,Xe=e,Gn(O,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){Z(e,"number","parentIframe.scrollBy(x, y) x"),Z(t,"number","parentIframe.scrollBy(x, y) y"),Ln(t,e,"scrollBy")},scrollTo(e,t){Z(e,"number","parentIframe.scrollTo(x, y) x"),Z(t,"number","parentIframe.scrollTo(x, y) y"),Ln(t,e,"scrollTo")},scrollToOffset(e,t){Z(e,"number","parentIframe.scrollToOffset(x, y) x"),Z(t,"number","parentIframe.scrollToOffset(x, y) y"),Ln(t,e,c)},sendMessage(e,t){t&&Z(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Ln(0,0,i,JSON.stringify(e),t)},setHeightCalculationMethod(e){Be=e,_t()},setWidthCalculationMethod(e){pt=e,Qt()},setTargetOrigin(t){Z(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),K(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),dt=t},resize(e,t){void 0!==e&&Z(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&Z(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Gn(w,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){fe("size()","resize()"),this.resize(e,t)}}),ht.parentIFrame=ht.parentIframe)}let on=new Set;function rn(){const e=document.querySelectorAll(`[${m}]`);et=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${f}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{ae("overflowIgnored"),ee("Ignoring elements with [data-iframe-ignore] > *:\n",n),oe()}),t}(e),Pe=et.size>0,"function"==typeof Set.prototype.symmetricDifference&&(Ce=et.symmetricDifference(on).size>0),on=et}function an(){switch(rn(),!0){case!Ce:return;case et.size>1:ee("Overflowed Elements:",et);break;case Pe:break;default:ee("No overflow detected")}Gn(H,"Overflow updated")}function sn(e){const t={root:document.documentElement,side:Ae?y:b};return be=at(an,t),be.attachObservers(e),be}function cn(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Gn(S,`Element resized <${function(e){switch(!0){case!V(e):return"";case V(e.id):return`${e.nodeName}#${e.id}`;case V(e.name):return`${e.nodeName} (${e.name}`;case V(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function ln(e){return St=new ResizeObserver(cn),St.observe(document.body),$t.add(document.body),ee("Attached ResizeObserver to body"),ve={attachObserverToNonStaticElements:Ht,detachObservers:Ne(yt,St,$t,vt),disconnect:()=>{St.disconnect(),ee("Detached ResizeObserver")}},ve.attachObserverToNonStaticElements(e),ve}function dn(t){K(`Visible: %c${t}`,e.HIGHLIGHT),Ve=!t,Gn(M,"Visibility changed")}const un=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of vn(n))t.add(e)}return ee("Inspecting:\n",t),t},mn=e=>{if(0===e.size)return;ae("addObservers");const t=un(e);be.attachObservers(t),ve.attachObserverToNonStaticElements(t),oe()},fn=e=>{if(0===e.size)return;ae("removeObservers");const t=un(e);be.detachObservers(t),ve.detachObservers(t),oe()};function pn(e){!function({addedNodes:e,removedNodes:t}){ae("contentMutated"),Bt(),Nt(),rn(),oe(),fn(t),mn(e)}(e),Gn(T,"Mutation Observed")}function hn(){const e=vn(document.documentElement);var t;K("Attaching Observers"),t=[Ke(pn),sn(e),gt(),ln(e),Tt(dn)],X.push(...t.map(e=>e.disconnect))}function gn(t){performance.mark(st);const n=W(t);let o=1,r=document.documentElement,i=De?0:document.documentElement.getBoundingClientRect().bottom;const a=De?it:Pe?Array.from(et):vn(document.documentElement);for(const e of a)o=e.getBoundingClientRect()[t]+parseFloat(getComputedStyle(e).getPropertyValue(`margin-${t}`)),o>i&&(i=o,r=e);return ee(`${n} position calculated from:`,r),ee(`Checked %c${a.length}%c elements`,e.HIGHLIGHT,e.FOREGROUND),performance.mark(ct,{detail:{hasTags:De,len:a.length,logging:Je,Side:n}}),i}const yn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],bn=`* ${Array.from(R).map(e=>`:not(${e})`).join("")}`,vn=e=>e.querySelectorAll(bn),zn={height:0,width:0},wn={height:0,width:0},$n=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function In(t){function n(){return wn[r]=i,zn[r]=c,Math.max(i,1)}const o=t===On,r=t.label,i=t.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),l=`HTML: %c${i}px %cPage: %c${c}px`;let d=0;switch(!0){case!t.enabled():return Math.max(c,1);case De:ee("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!Pe&&je&&0===wn[r]&&0===zn[r]:ee(`Initial page size values: ${l}`,...$n),d=n();break;case mt&&i===wn[r]&&c===zn[r]:ee(`Size unchanged: ${l}`,...$n),d=Math.max(i,c);break;case 0===i&&0!==c:ee(`Page is hidden: ${l}`,...$n),d=c;break;case!Pe&&i!==wn[r]&&c<=zn[r]:ee(`New <html> size: ${l} `,...$n),ee(`Previous <html> size: %c${wn[r]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!Pe&&i<wn[r]:ee(`<html> size decreased: ${l}`,...$n),d=n();break;case c===s||c===a:ee(`<html> size equals page size: ${l}`,...$n),d=n();break;case i>c:ee(`Page size < <html> size: ${l}`,...$n),d=n();break;case Pe:ee("Found elements possibly overflowing <html> "),d=t.taggedElement();break;default:ee(`Using <html> size: ${l}`,...$n),d=n()}return ee(`Content ${r}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&ee(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const On={label:p,enabled:()=>Ae,getOffset:()=>Ye,auto:()=>In(On),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,d)+parseInt(t.marginBottom,d)},bodyScroll:()=>document.body.scrollHeight,offset:()=>On.bodyOffset(),custom:()=>N.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...yn(On)),min:()=>Math.min(...yn(On)),grow:()=>On.max(),lowestElement:()=>gn(y),taggedElement:()=>gn(y)},Sn={label:h,enabled:()=>Le,getOffset:()=>Xe,auto:()=>In(Sn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>N.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...yn(Sn)),min:()=>Math.min(...yn(Sn)),rightMostElement:()=>gn(b),scroll:()=>Math.max(Sn.bodyScroll(),Sn.documentElementScroll()),taggedElement:()=>gn(b)},Hn=(e,t)=>!(Math.abs(e-t)<=ut);function Tn(e,t){const n=e[t](),o=e.enabled()&&void 0!==Ie?function(e){const t=Ie(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);if(t<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${t}, must be at least 1`);return t}(n):n;return ne(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let Mn=!1;const En=B(()=>ue(C(4)));let kn,Rn=!1;const Gn=ie((t,n,o,i,a)=>{switch(ae(t),!0){case!0===Ve:if(!0===Rn)break;K("Iframe hidden - Ignored resize request"),Rn=!0,Mn=!1,cancelAnimationFrame(kn);break;case!0===Mn&&t!==H:K("Resize already pending - Ignored resize request");break;case!Se&&!(t in I):ee("Resizing disabled");break;default:Rn=!1,Mn=!0,we=performance.now(),ze=!0,kn=requestAnimationFrame(()=>{Mn=!1,ae("requestAnimationFrame"),te(`Reset sendPending: %c${t}`,e.HIGHLIGHT)}),function(t,n,o,i,a){const s=o??Tn(On,Be),c=i??Tn(Sn,pt),l=Ae&&Hn(qe,s)||Le&&Hn(ft,c)?z:t;switch(K(`Resize event: %c${n}`,e.HIGHLIGHT),l){case r:case v:case z:qe=s,ft=c;case O:An(qe,ft,t,a);break;case H:case T:case S:case M:K(E);break;default:ee(E)}ze=!1}(t,n,o,i,a)}oe()});function Nn(e){qe=On[Be](),ft=Sn[pt](),Ln(qe,ft,e)}function An(t,n,o,i,a){_e<-1||(void 0!==a?K(`Message targetOrigin: %c${a}`,e.HIGHLIGHT):a=dt,function(){const s=`${tt}:${t}:${n}:${o}${void 0===i?"":`:${i}`}`;if(ot)try{window.parent.iframeParentListener(k+s)}catch(e){if(1!==_e)throw e;return void En()}else lt.postMessage(k+s,a);ze&&K(function(){const e=U(performance.now()-we);return o===r?`Initialised iframe in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),ee(`Sending message to parent page via ${ot?"sameOrigin":"postMessage"}: %c%c${s}`,e.ITALIC,e.HIGHLIGHT)}())}const Ln=ie((e,t,n,o,r)=>{ae(n),An(e,t,n,o,r),oe()}),jn=ie(function(t){ae("onMessage");const{freeze:n}=Object,{parse:o}=JSON,i=e=>n(o(e)),c=e=>Ln(0,0,`${e}Stop`),l={init:function(){if("loading"===document.readyState)return void K("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");lt=t.source,ye=t.origin,Ot(e),je=!1,setTimeout(()=>{Ue=!1},128)},reset(){Ue?K("Page reset ignored by init"):(K("Page size reset by host page"),Nn("resetPage"))},resize(){K("Resize requested by host page"),Gn($,"Parent window requested size check")},moveToAnchor(){We.findTarget(u())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=u();K("PageInfo received from parent:",i(e)),wt?q(wt,o(e)):c(a)},parentInfo(){const e=i(u());K("ParentInfo received from parent:",e),It?q(It,e):c(s)},message(){const t=u();K("onMessage called from parent:%c",e.HIGHLIGHT,i(t)),q(bt,o(t))}},d=()=>t.data.split("]")[1].split(":")[0],u=()=>t.data.slice(t.data.indexOf(":")+1),m=()=>t.data.split(":")[2]in{true:1,false:1};function f(){const e=d();ae(e),e in l?l[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||m()||le(`Unexpected message (${t.data})`)}k===`${t.data}`.slice(0,13)&&function(){if(!1!==je)return m()?(se(d()),ae(r),void l.init()):void K(`Ignored message of type "${d()}". Received before initialization.`);f()}()});let xn=!1;const Pn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function Cn(){if("loading"===document.readyState||!je||xn)return;const{parent:t,top:n}=window;ae("ready"),K("Sending%c ready%c to parent from",e.HIGHLIGHT,e.FOREGROUND,window.location.href),Pn(t),t!==n&&Pn(n),xn=!0}"iframeChildListener"in window?le("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>jn({data:e,sameOrigin:!0})),G(window,i,jn),G(document,g,Cn),setTimeout(Cn))}();
20
+ "use strict";const e=require("auto-console-group"),t="5.5.6-beta.1",n="iframeResizer",o="beforeUnload",r="init",i="message",a="pageInfo",s="parentInfo",c="scrollToOffset",l="title",d=10,u="data-iframe-size",m="data-iframe-overflowed",f="data-iframe-ignore",h="height",p="width",g="readystatechange",y="bottom",b="right",v="autoResizeEnabled",z=Symbol("sizeChanged"),w="manualResize",$="parentResize",I={[w]:1,[$]:1},O="setOffsetSize",S="resizeObserver",H="overflowObserver",T="mutationObserver",M="visibilityObserver",E="No change in content size detected",k="[iFrameSizer]",R=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),G=(e,t,n,o)=>e.addEventListener(t,n,o||!1),N=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);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)},A=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),x=["spjluzl","rlf","clyzpvu"],L=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","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</>","<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</>.","<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."],j=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],P=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),C=e=>A(L[e]),D=e=>{const t=e[A(x[0])]||e[A(x[1])]||e[A(x[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=N(A(e));return n in P&&(t=P[n]),t}(n[0]);return 0===o||(e=>e[2]===N(e[0]+e[1]))(n)||(o=-2),o},q=(e,...t)=>setTimeout(()=>e(...t),0),B=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},F=e=>e,U=e=>Math.round(1e3*e)/1e3,W=e=>e.charAt(0).toUpperCase()+e.slice(1),V=e=>""!=`${e}`&&void 0!==e;const Z=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${W(t)}`)};let J=!0,_=n;var Q;const Y=(Q=e,Q?.__esModule?Q.default:Q)({label:`${n}(child)`,expand:!1});const X=e=>(...t)=>!J||Y[e](...t),K=X("log"),ee=K,te=X("debug");const{assert:ne,endAutoGroup:oe,error:re,errorBoundary:ie,event:ae,label:se,purge:ce,warn:le}=Y,de=e=>{return Y.warn((t=F,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},ue=de,me=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>de(t)),fe=me("Method"),he=me("Method","replaced with"),pe=me("Option"),ge=["min-height","min-width","max-height","max-width"],ye=new Set,be=e=>e.tagName?e.tagName.toLowerCase():"unknown",ve=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),ze=(e,t)=>{return(n=ve(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function we({href:e}){ye.has(e)||(K("Unable to access stylesheet:",e),ye.add(e))}const $e=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){we(n)}return{source:"cross-origin stylesheet",value:ve(e,t)}}(e,t),Ie=(e,t)=>{const{source:n,value:o}=$e(e,t),r=be(e);de(`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</>.\n\nIf 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 Oe(){for(const e of[document.documentElement,document.body])for(const t of ge)K(`Checking <${be(e)}> for blocking CSS: ${t}`),ze(e,t)&&Ie(e,t)}const Se=e=>t=>void 0===t?void 0:e(t),He=Se(e=>"true"===e),Te=Se(Number),Me=(e="")=>t=>n=>{n.size>0&&te(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Ee=Me("attached to"),ke=((e="")=>t=>n=>{n.size>0&&re(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Re=Me("detached from"),Ge=(t,n=!0)=>o=>{o>0&&ee(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,e.HIGHLIGHT,e.NORMAL)},Ne=(e,t,n,o)=>{const r=Re(e);return e=>{const i=new Set;let a=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),i.add(o),a+=1);r(i),o(a),i.clear()}},Ae="Mutation",xe=new Set,Le=new Set,je=new Set,Pe=[],Ce={attributes:!0,attributeFilter:[f,u],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let De,qe=1,Be=!1,Fe=0;const Ue=Me("added")(Ae),We=Me("removed (page)")(Ae),Ve=Me("removed (added)")(Ae),Ze=e=>e.nodeType!==Node.ELEMENT_NODE||R.has(e.tagName.toLowerCase());function Je(e){const t=e.addedNodes;for(const e of t)Ze(e)||xe.add(e)}function _e(e){const t=e.removedNodes;for(const e of t)Ze(e)||(xe.has(e)?(xe.delete(e),je.add(e)):Le.add(e))}const Qe=e=>{ee("Mutations:",e);for(const t of e)Je(t),_e(t);Ue(xe),We(Le),Ve(je),je.clear()};const Ye=t=>()=>{const n=performance.now(),o=n-Fe,r=16*qe+++2;if(o>r&&o<200)return ae("mutationThrottled"),ee("Update delayed due to heavy workload on the callStack"),ee(`EventLoop busy time: %c${U(o)}ms %c> Max wait: %c${r-2}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(De,16*qe),void(Fe=n);qe=1,Pe.forEach(Qe),Pe.length=0,Be=!1,Le.size>0&&K(`Detected %c${Le.size} %cremoved element${Le.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),xe.size>0&&K(`Found %c${xe.size} %cnew element${xe.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),t({addedNodes:xe,removedNodes:Le}),xe.clear(),Le.clear()};function Xe(e){Pe.push(e),Be||(Fe=performance.now(),Be=!0,requestAnimationFrame(De))}function Ke(e){const t=new window.MutationObserver(Xe),n=document.body||document.documentElement;return De=Ye(e),t.observe(n,Ce),ee("Attached MutationObserver to body"),{...t,disconnect:()=>{xe.clear(),Le.clear(),Pe.length=0,t.disconnect(),ee("Detached MutationObserver")}}}const et="Overflow",tt=Ge(et),nt=Ge(et,!1),ot=Ee(et),rt=ke(et),it=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,at=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||F,i=(t=!1)=>e(t),a=(e,t)=>0===e||e>t[n],s=(e,t)=>e.toggleAttribute(m,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t;if(!o)continue;const i=e[n],c=a(i,o)&&!it(r);s(r,c)}r(i)},o),l=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r.nodeType===Node.ELEMENT_NODE&&(l.has(r)?t.add(r):(c.observe(r),l.add(r),n.add(r),o+=1));rt(t),ot(n),tt(o),n.clear(),t.clear()},detachObservers:Ne(et,c,l,nt),disconnect:()=>{c.disconnect(),ee("Detached OverflowObserver")}}},st="--ifr-start",ct="--ifr-end",lt="--ifr-measure",dt=[];let ut,mt={},ft=0;function ht(){try{performance.clearMarks(st),performance.clearMarks(ct),performance.clearMeasures(lt)}catch{}}function pt(e){e.getEntries().forEach(e=>{if(e.name===ct)try{const{duration:t}=performance.measure(lt,st,ct);mt=e.detail,dt.push(t),dt.length>100&&dt.shift()}catch{}})}function gt(){ee("Attached PerformanceObserver to page");const e=new PerformanceObserver(pt);return e.observe({entryTypes:["mark"]}),ut=setInterval(()=>{if(dt.length<10)return;if(mt.hasTags&&mt.len<25)return;dt.sort();const e=Math.min(dt.reduce((e,t)=>e+t,0)/dt.length,dt[Math.floor(dt.length/2)]),t=U(e);t>ft&&(ft=t,ae("performanceObserver"),K("Mean time:",U(dt[Math.floor(dt.length/2)])),K("Median time:",U(dt.reduce((e,t)=>e+t,0)/dt.length)),K("Average time:",t),K("Max time:",U(Math.max(...dt)))),ht(),e<=4||(clearInterval(ut),de(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${U(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${mt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{ht(),clearInterval(ut),e.disconnect(),ee("Detached PerformanceObserver")}}}const yt="Resize",bt=Ge(yt),vt=Ge(yt,!1),zt=Ee(yt),wt=ke(yt),$t=new WeakSet,It=new Set,Ot=new Set;let St;function Ht(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&($t.has(n)?It.add(n):(St.observe(n),$t.add(n),Ot.add(n),t+=1))}wt(It),zt(Ot),bt(t),Ot.clear(),It.clear()}function Tt(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;return t.observe(n),ee("Attached VisibilityObserver to page"),{disconnect:()=>{t.disconnect(),ee("Detached VisibilityObserver")}}}const Mt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Et=Mt("function"),kt=Mt("number"),Rt=Mt("string");"undefined"!=typeof window&&function(){const N={height:()=>(le("Custom height calculation function not defined"),On.auto()),width:()=>(le("Custom width calculation function not defined"),Sn.auto())},L={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},P={},Q="auto",X=[],ce="scroll";let me,ge,ye,be,ve,ze,we,$e,Ie,Se=!0,Me="",Ee=0,ke="",Re="",Ge=!1,Ae=!0,xe=!1,Le=!0,je=!1,Pe=!1,Ce=!0,De=!1,qe=1,Be=Q,Fe="",Ue=!0,We={},Ve=!1,Ze=!1,Je=!1,_e=0,Qe=!1,Ye=0,Xe=0,et=new Set,tt="",nt="child",ot=!1,rt="",it=[],lt=window.parent,dt="*",ut=0,mt=!1,ft=1,ht=ce,pt=window,bt=()=>{le("onMessage function not defined")},zt=()=>{},wt=null,It=null;function Ot(o){var i;!function(e){tt=e[0]??tt,Ee=Te(e[1])??Ee,xe=He(e[2])??xe,Je=He(e[3])??Je,Se=He(e[6])??Se,ke=e[7]??ke,Be=e[8]??Be,Me=e[9]??Me,Re=e[10]??Re,ut=Te(e[11])??ut,We.enable=He(e[12])??!1,nt=e[13]??nt,ht=e[14]??ht,Qe=He(e[15])??Qe,Ye=Te(e[16])??Ye,Xe=Te(e[17])??Xe,Ae=He(e[18])??Ae,me=e[19]??me,$e=e[20]??$e,_e=Te(e[21])??_e,Ze=He(e[23])??Ze}(o),_=(i={id:tt,enabled:Je,expand:Ze}).id||n,Y.label(`${_}`),Y.expand(i.expand),J=i.enabled,K(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){K("Reading data from page:",Object.keys(e)),Ie=Et(e,"onBeforeResize")??Ie,bt=Et(e,"onMessage")??bt,zt=Et(e,"onReady")??zt,"number"==typeof e?.offset&&(pe("offset","offsetSize"),Ae&&(Ye=kt(e,"offset")??Ye),xe&&(Xe=kt(e,"offset")??Xe)),"number"==typeof e?.offsetSize&&(Ae&&(Ye=kt(e,"offsetSize")??Ye),xe&&(Xe=kt(e,"offsetSize")??Xe)),ge=Rt(e,A(x[0]))??ge,Fe=Rt(e,"ignoreSelector")??Fe,rt=Rt(e,"sizeSelector")??rt,dt=Rt(e,"targetOrigin")??dt,Be=e?.heightCalculationMethod||Be,ht=e?.widthCalculationMethod||ht}function n(e,t){return"function"==typeof e&&(de(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}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.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),N[t]=e,e="custom"),e}if(1===_e)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),Be=n(Be,h),ht=n(ht,p),ee(`Set targetOrigin for parent: %c${dt}`,e.HIGHLIGHT))}(),[jt,Ct,Yt,xt,Pt,_t,Qt,Zt,Lt,Nt,Ge?F:Oe,Bt,nn,tn,en,Ft,()=>Dt("background",Me),()=>Dt("padding",Re),()=>Dt("min-height","1px"),()=>Dt("min-width","1px"),Ge?F:Ut,Kt,Xt,pn,Mt].forEach(e=>{try{e()}catch(e){if(_e<0)throw e;de("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),re(e)}}),Gt(B(zt)),K("Initialization complete"),Gn(r,"Init message from host page",void 0,void 0,`${t}:${_e}`),document.title&&""!==document.title&&xn(0,0,l,document.title)}function Mt(){G(window,o.toLowerCase(),()=>{X.forEach(e=>e()),xn(0,0,o)})}function Gt(e){"complete"===document.readyState?q(e):G(document,g,()=>Gt(e))}function Nt(){it=document.querySelectorAll(`[${u}]`),De=it.length>0,K(`Tagged elements found: %c${De}`,e.HIGHLIGHT)}let At=0;function xt(){const t=document.querySelectorAll(`*[${f}]`);return je=t.length>0,je&&t.length!==At&&(function(t){const n=1===t.length?"":"s";le(`%c[${f}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),At=t.length),je}function Lt(){"BackCompat"===document.compatMode&&de("<rb>Quirks Mode Detected</>\n\nThis 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</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n")}function jt(){$e&&""!==$e&&"false"!==$e?$e!==t&&de(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${$e} - Child page: ${t}.\n`):de("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n")}function Pt(){try{ot=1===_e||"iframeParentListener"in window.parent}catch(e){K("Cross domain iframe detected")}}function Ct(){xe===Ae&&(Ge=!0)}function Dt(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),ee(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function qt(t,n,o){if(""!==o){K(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))K(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function Bt(){qt("sizeSelector",u,rt),qt("ignoreSelector",f,Fe)}function Ft(){var e,t;void 0===ke&&(ke=`${Ee}px`),Dt("margin",(e="margin",(t=ke).includes("-")&&(le(`Negative CSS value ignored for ${e}`),t=""),t))}function Ut(){const t=e=>e.style.setProperty(h,"auto","important");t(document.documentElement),t(document.body),K("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}function Wt(t){({add(e){function n(){Gn(t.eventName,t.eventType)}P[e]=n,G(window,e,n,{passive:!0})},remove(e){const t=P[e];var n,o;delete P[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),K(`${W(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Vt(e){Wt({method:e,eventType:"After Print",eventName:"afterprint"}),Wt({method:e,eventType:"Before Print",eventName:"beforeprint"}),Wt({method:e,eventType:"Ready State Change",eventName:g})}function Zt(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(u,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&de("<rb>Deprecated Attributes</>\n \nThe <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</>.")}function Jt(t,n,o){const{label:r}=o;return n!==t&&(t in o||(le(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in L)&&de(`<rb>Deprecated ${r}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${$e?"remove this option.":`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:\n \nwindow.iframeResizer = {\n license: 'xxxx',\n ${r}CalculationMethod: 'auto',\n}\n`}\n`),K(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function _t(){Be=Jt(Be,Q,On)}function Qt(){ht=Jt(ht,ce,Sn)}function Yt(){const n=_e,o=D({key:me}),r=D({key:ge});if(_e=Math.max(o,r),_e<0){if(_e=Math.min(o,r),de(`${C(_e+2)}${C(2)}`),V($e))throw C(_e+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!V($e)||n>-1&&_e>n)&&(sessionStorage.getItem("ifr")!==t&&function(t,n){console.info(`${_} %ciframe-resizer ${t}`,J||n<1?"font-weight: bold;":e.NORMAL)}(`v${t} (${(e=>A(j[e]))(_e)})`,_e),_e<2&&ue(C(3)),sessionStorage.setItem("ifr",t))}function Xt(){!0!==Se&&K("Auto Resize disabled"),Vt("add"),X.push(()=>Vt("remove"))}function Kt(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function en(){function t(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,d)+parseInt(n.x,d),y:parseInt(t.top,d)+parseInt(n.y,d)}}function n(n){const o=n.split("#")[1]||n,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(K(`In page link (#${o}) not found in iframe, so sending to parent`),xn(0,0,"inPageLink",`#${o}`)):function(n){const r=t(n);K(`Moving to in page link (%c#${o}%c) at x: %c${r.x}%c y: %c${r.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),xn(r.y,r.x,c)}(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}We.enable?1===_e?de("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):(K("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&G(e,"click",t=>{t.preventDefault(),n(e.getAttribute("href"))})}(),G(window,"hashchange",o),setTimeout(o,128)):K("In page linking not enabled"),We={findTarget:n}}function tn(){function t(e){xn(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){K(`Add event listener: %c${o}`,e.HIGHLIGHT),G(window.document,n,t)}!0===Qe&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}function nn(){1!==_e&&(pt.parentIframe=Object.freeze({autoResize:e=>(Z(e,"boolean","parentIframe.autoResize(enable) enable"),!1===xe&&!1===Ae?(ae(v),de("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Se?(Se=!0,queueMicrotask(()=>Gn(v,"Auto Resize enabled"))):!1===e&&!0===Se&&(Se=!1),xn(0,0,"autoResize",JSON.stringify(Se)),Se)),close(){xn(0,0,"close")},getId:()=>tt,getOrigin:()=>(ae("getOrigin"),fe("getOrigin()","getParentOrigin()"),ye),getParentOrigin:()=>ye,getPageInfo(e){if("function"==typeof e)return wt=e,xn(0,0,a),void he("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");wt=null,xn(0,0,"pageInfoStop")},getParentProps:e=>(Z(e,"function","parentIframe.getParentProps(callback) callback"),It=e,xn(0,0,s),()=>{It=null,xn(0,0,"parentInfoStop")}),getParentProperties(e){fe("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){Z(e,"string","parentIframe.moveToAnchor(anchor) anchor"),We.findTarget(e)},reset(){!function(){const t=Be;Be=Q,K(`Reset trigger event: %c${"parentIframe.reset"}`,e.HIGHLIGHT),mt?K("TriggerLock blocked calculation"):(mt=!0,te("Trigger event lock on"),requestAnimationFrame(()=>{mt=!1,te("Trigger event lock off")})),Nn("reset"),Be=t}()},setOffsetSize(e){Z(e,"number","parentIframe.setOffsetSize(offset) offset"),Ye=e,Xe=e,Gn(O,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){Z(e,"number","parentIframe.scrollBy(x, y) x"),Z(t,"number","parentIframe.scrollBy(x, y) y"),xn(t,e,"scrollBy")},scrollTo(e,t){Z(e,"number","parentIframe.scrollTo(x, y) x"),Z(t,"number","parentIframe.scrollTo(x, y) y"),xn(t,e,"scrollTo")},scrollToOffset(e,t){Z(e,"number","parentIframe.scrollToOffset(x, y) x"),Z(t,"number","parentIframe.scrollToOffset(x, y) y"),xn(t,e,c)},sendMessage(e,t){t&&Z(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),xn(0,0,i,JSON.stringify(e),t)},setHeightCalculationMethod(e){Be=e,_t()},setWidthCalculationMethod(e){ht=e,Qt()},setTargetOrigin(t){Z(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),K(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),dt=t},resize(e,t){void 0!==e&&Z(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&Z(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Gn(w,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){fe("size()","resize()"),this.resize(e,t)}}),pt.parentIFrame=pt.parentIframe)}let on=new Set;function rn(){const e=document.querySelectorAll(`[${m}]`);et=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${f}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{ae("overflowIgnored"),ee("Ignoring elements with [data-iframe-ignore] > *:\n",n),oe()}),t}(e),Pe=et.size>0,"function"==typeof Set.prototype.symmetricDifference&&(Ce=et.symmetricDifference(on).size>0),on=et}function an(){switch(rn(),!0){case!Ce:return;case et.size>1:ee("Overflowed Elements:",et);break;case Pe:break;default:ee("No overflow detected")}Gn(H,"Overflow updated")}function sn(e){const t={root:document.documentElement,side:Ae?y:b};return be=at(an,t),be.attachObservers(e),be}function cn(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Gn(S,`Element resized <${function(e){switch(!0){case!V(e):return"";case V(e.id):return`${e.nodeName}#${e.id}`;case V(e.name):return`${e.nodeName} (${e.name}`;case V(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function ln(e){return St=new ResizeObserver(cn),St.observe(document.body),$t.add(document.body),ee("Attached ResizeObserver to body"),ve={attachObserverToNonStaticElements:Ht,detachObservers:Ne(yt,St,$t,vt),disconnect:()=>{St.disconnect(),ee("Detached ResizeObserver")}},ve.attachObserverToNonStaticElements(e),ve}function dn(t){K(`Visible: %c${t}`,e.HIGHLIGHT),Ve=!t,Gn(M,"Visibility changed")}const un=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of vn(n))t.add(e)}return ee("Inspecting:\n",t),t},mn=e=>{if(0===e.size)return;ae("addObservers");const t=un(e);be.attachObservers(t),ve.attachObserverToNonStaticElements(t),oe()},fn=e=>{if(0===e.size)return;ae("removeObservers");const t=un(e);be.detachObservers(t),ve.detachObservers(t),oe()};function hn(e){!function({addedNodes:e,removedNodes:t}){ae("contentMutated"),Bt(),Nt(),rn(),oe(),fn(t),mn(e)}(e),Gn(T,"Mutation Observed")}function pn(){const e=vn(document.documentElement);var t;K("Attaching Observers"),t=[Ke(hn),sn(e),gt(),ln(e),Tt(dn)],X.push(...t.map(e=>e.disconnect))}function gn(t){performance.mark(st);const n=W(t);let o=1,r=document.documentElement,i=De?0:document.documentElement.getBoundingClientRect().bottom;const a=De?it:Pe?Array.from(et):vn(document.documentElement);for(const e of a)o=e.getBoundingClientRect()[t]+parseFloat(getComputedStyle(e).getPropertyValue(`margin-${t}`)),o>i&&(i=o,r=e);return ee(`${n} position calculated from:`,r),ee(`Checked %c${a.length}%c elements`,e.HIGHLIGHT,e.FOREGROUND),performance.mark(ct,{detail:{hasTags:De,len:a.length,logging:Je,Side:n}}),i}const yn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],bn=`* ${Array.from(R).map(e=>`:not(${e})`).join("")}`,vn=e=>e.querySelectorAll(bn),zn={height:0,width:0},wn={height:0,width:0},$n=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function In(t){function n(){return wn[r]=i,zn[r]=c,Math.max(i,1)}const o=t===On,r=t.label,i=t.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),l=`HTML: %c${i}px %cPage: %c${c}px`;let d=0;switch(!0){case!t.enabled():return Math.max(c,1);case De:ee("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!Pe&&Le&&0===wn[r]&&0===zn[r]:ee(`Initial page size values: ${l}`,...$n),d=n();break;case mt&&i===wn[r]&&c===zn[r]:ee(`Size unchanged: ${l}`,...$n),d=Math.max(i,c);break;case 0===i&&0!==c:ee(`Page is hidden: ${l}`,...$n),d=c;break;case!Pe&&i!==wn[r]&&c<=zn[r]:ee(`New <html> size: ${l} `,...$n),ee(`Previous <html> size: %c${wn[r]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!Pe&&i<wn[r]:ee(`<html> size decreased: ${l}`,...$n),d=n();break;case c===s||c===a:ee(`<html> size equals page size: ${l}`,...$n),d=n();break;case i>c:ee(`Page size < <html> size: ${l}`,...$n),d=n();break;case Pe:ee("Found elements possibly overflowing <html> "),d=t.taggedElement();break;default:ee(`Using <html> size: ${l}`,...$n),d=n()}return ee(`Content ${r}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&ee(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const On={label:h,enabled:()=>Ae,getOffset:()=>Ye,auto:()=>In(On),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,d)+parseInt(t.marginBottom,d)},bodyScroll:()=>document.body.scrollHeight,offset:()=>On.bodyOffset(),custom:()=>N.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...yn(On)),min:()=>Math.min(...yn(On)),grow:()=>On.max(),lowestElement:()=>gn(y),taggedElement:()=>gn(y)},Sn={label:p,enabled:()=>xe,getOffset:()=>Xe,auto:()=>In(Sn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>N.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...yn(Sn)),min:()=>Math.min(...yn(Sn)),rightMostElement:()=>gn(b),scroll:()=>Math.max(Sn.bodyScroll(),Sn.documentElementScroll()),taggedElement:()=>gn(b)},Hn=(e,t)=>!(Math.abs(e-t)<=ut);function Tn(e,t){const n=e[t](),o=e.enabled()&&void 0!==Ie?function(e){const t=Ie(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);if(t<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${t}, must be at least 1`);return t}(n):n;return ne(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let Mn=!1;const En=B(()=>ue(C(4)));let kn,Rn=!1;const Gn=ie((t,n,o,i,a)=>{switch(ae(t),!0){case!0===Ve:if(!0===Rn)break;K("Iframe hidden - Ignored resize request"),Rn=!0,Mn=!1,cancelAnimationFrame(kn);break;case!0===Mn&&t!==H:K("Resize already pending - Ignored resize request");break;case!Se&&!(t in I):ee("Resizing disabled");break;default:Rn=!1,Mn=!0,we=performance.now(),ze=!0,kn=requestAnimationFrame(()=>{Mn=!1,ae("requestAnimationFrame"),te(`Reset sendPending: %c${t}`,e.HIGHLIGHT)}),function(t,n,o,i,a){const s=o??Tn(On,Be),c=i??Tn(Sn,ht),l=Ae&&Hn(qe,s)||xe&&Hn(ft,c)?z:t;switch(K(`Resize event: %c${n}`,e.HIGHLIGHT),l){case r:case v:case z:qe=s,ft=c;case O:An(qe,ft,t,a);break;case H:case T:case S:case M:K(E);break;default:ee(E)}ze=!1}(t,n,o,i,a)}oe()});function Nn(e){qe=On[Be](),ft=Sn[ht](),xn(qe,ft,e)}function An(t,n,o,i,a){_e<-1||(void 0!==a?K(`Message targetOrigin: %c${a}`,e.HIGHLIGHT):a=dt,function(){const s=`${tt}:${t}:${n}:${o}${void 0===i?"":`:${i}`}`;if(ot)try{window.parent.iframeParentListener(k+s)}catch(e){if(1!==_e)throw e;return void En()}else lt.postMessage(k+s,a);ze&&K(function(){const e=U(performance.now()-we);return o===r?`Initialised iframe in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),ee(`Sending message to parent page via ${ot?"sameOrigin":"postMessage"}: %c%c${s}`,e.ITALIC,e.HIGHLIGHT)}())}const xn=ie((e,t,n,o,r)=>{ae(n),An(e,t,n,o,r),oe()}),Ln=ie(function(t){ae("onMessage");const{freeze:n}=Object,{parse:o}=JSON,i=e=>n(o(e)),c=e=>xn(0,0,`${e}Stop`),l={init:function(){if("loading"===document.readyState)return void K("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");lt=t.source,ye=t.origin,Ot(e),Le=!1,setTimeout(()=>{Ue=!1},128)},reset(){Ue?K("Page reset ignored by init"):(K("Page size reset by host page"),Nn("resetPage"))},resize(){K("Resize requested by host page"),Gn($,"Parent window requested size check")},moveToAnchor(){We.findTarget(u())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=u();K("PageInfo received from parent:",i(e)),wt?q(wt,o(e)):c(a)},parentInfo(){const e=i(u());K("ParentInfo received from parent:",e),It?q(It,e):c(s)},message(){const t=u();K("onMessage called from parent:%c",e.HIGHLIGHT,i(t)),q(bt,o(t))}},d=()=>t.data.split("]")[1].split(":")[0],u=()=>t.data.slice(t.data.indexOf(":")+1),m=()=>t.data.split(":")[2]in{true:1,false:1};function f(){const e=d();ae(e),e in l?l[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||m()||le(`Unexpected message (${t.data})`)}k===`${t.data}`.slice(0,13)&&function(){if(!1!==Le)return m()?(se(d()),ae(r),void l.init()):void K(`Ignored message of type "${d()}". Received before initialization.`);f()}()});let jn=!1;const Pn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function Cn(){if("loading"===document.readyState||!Le||jn)return;const{parent:t,top:n}=window;ae("ready"),K("Sending%c ready%c to parent from",e.HIGHLIGHT,e.FOREGROUND,window.location.href),Pn(t),t!==n&&Pn(n),jn=!0}"iframeChildListener"in window?le("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Ln({data:e,sameOrigin:!0})),G(window,i,Ln),G(document,g,Cn),setTimeout(Cn))}();
21
21
  //# sourceMappingURL=index.cjs.js.map