@iframe-resizer/child 5.5.4-beta.3 → 5.5.4

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