@iframe-resizer/child 5.5.3-beta.4 → 5.5.3-beta.6

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