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

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