@iframe-resizer/child 5.5.4-beta.1 → 5.5.4-beta.2

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