@iframe-resizer/child 5.5.8-beta.4 → 5.5.8

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