@iframe-resizer/child 5.2.2-beta.4 → 5.2.3

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/LICENSE CHANGED
@@ -2,7 +2,7 @@ Iframe Resizer Version 5
2
2
 
3
3
  This JavaScript library is Copyright © 2013-2024 David J. Bradshaw and is distributed under the GPL V3 for non-commercial use. A commercial license is available upon request.
4
4
 
5
- For more information on commercial licensing contact dave@bradshaw.net
5
+ For more information on commercial licensing see https://iframe-resizer.com/pricing/
6
6
 
7
7
  --
8
8
 
package/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/child
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.2.2-beta.4 2024-07-27 - 10:58:26.764Z_
25
+ _iframe-resizer version 5.2.3 2024-08-05 - 15:01:03.526Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.2.2-beta.4 (cjs) - 2024-07-27
4
+ * @module iframe-resizer/child 5.2.3 (cjs) - 2024-08-05
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,4 @@
17
17
  */
18
18
 
19
19
 
20
- "use strict";const e="5.2.2-beta.4",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),c=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="",m=!1;const f=e=>{u=e.id,m=e.logging},p=e=>e.charAt(0).toUpperCase()+e.slice(1),h=e=>""!=`${e}`&&void 0!==e;function g(e){switch(!0){case!h(e):return"";case h(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case h(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(h(e.className)?`.${e.className}`:"")}}const y=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),v=(...e)=>m&&console?.log(y(...e)),b=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),z=(...e)=>console?.warn(y(...e)),w=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(y)(...e)),$=e=>w(e);let S=[];const E=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),S=document.querySelectorAll(`[${o}]`),v("overflowedElements:",S.length),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},M=()=>S.length>0,j=1e5,P="--ifr-start",T="--ifr-end",O="--ifr-measure",C=[],A=new WeakSet,I=e=>"object"==typeof e&&A.add(e),k=e=>Math.floor(e*j)/j;let R=null,N=null,x={};const L=setInterval((()=>{if(C.length<10)return;if(x.hasTags&&x.len<25)return;C.sort();const e=Math.min(C.reduce(((e,t)=>e+t),0)/C.length,C[Math.floor(C.length/2)]);v("Max time:",Math.max(...C)),e<=4||(clearInterval(L),w(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${k(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===T){const{duration:t}=performance.measure(O,P,T);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,A.has(N)||R===N||i&&o<=1||(r||I(N),R=N,b(`\n${n} position calculated from:\n`,N,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${k(t)}ms`))}(e.detail,t),C.push(t),C.length>100&&C.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),I(document.documentElement),I(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(z("Custom height calculation function not defined"),Ve.auto()),width:()=>(z("Custom width calculation function not defined"),Je.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},m=128,h={},y="checkVisibility"in window,b="auto",j={reset:1,resetPage:1,init:1},O="[iFrameSizer]",C=O.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I=["body"],k="scroll";let R,x,L=!0,q="",B=0,F="",W=null,D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=b,X=!0,Y="",G={},K=!1,_=0,ee=!1,te="",ne=d,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,ce="*",de=0,ue=!1,me="",fe=1,pe=k,he=window,ge=()=>{z("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,d;!function(){const e=e=>"true"===e,t=Y.slice(C).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),U=void 0===t[2]?U:e(t[2]),K=void 0===t[3]?K:e(t[3]),L=void 0===t[6]?L:e(t[6]),F=t[7],Q=void 0===t[8]?Q:t[8],q=t[9],D=t[10],de=void 0===t[11]?de:Number(t[11]),G.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),R=void 0===t[16]?R:Number(t[16]),x=void 0===t[17]?x:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,_=void 0===t[21]?_:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;v(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&(w("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(R=e?.offset),U&&(x=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(R=e?.offsetSize),U&&(x=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),ce=e?.targetOrigin||ce,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(v(`Setup custom ${t}CalcMethod`),l[t]=e,e="custom"),e}1!==_&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),v(`TargetOrigin for parent set to: ${ce}`))}(),v(`Initialising iFrame v${e} (${window.location.href})`),f({id:te,logging:K}),function(){try{re="iframeParentListener"in window.parent}catch(e){v("Cross domain iframe detected.")}}(),_<0?$(`${s(_+2)}${s(2)}`):me.codePointAt(0)>4||_<2&&$(s(3)),me&&""!==me&&"false"!==me?me!==e&&w(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):w("<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"),Oe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&w("<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</>.")}(),$e(),H!==U&&(ne=E({onChange:c(we),side:H?i:r})),1!==_&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,Ae()):!1===e&&!0===L&&(L=!1,Pe("remove"),ie?.disconnect(),W?.disconnect()),Ke(0,0,"autoResize",JSON.stringify(L)),L),close(){Ke(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ke(0,0,"pageInfo"),void w("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ve=null,Ke(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ke(0,0,"parentInfo"),()=>{be=null,Ke(0,0,"parentInfoStop")}},getParentProperties(e){w("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){G.findTarget(e)},reset(){Ge("parentIFrame.reset")},scrollBy(e,t){Ke(t,e,"scrollBy")},scrollTo(e,t){Ke(t,e,"scrollTo")},scrollToOffset(e,t){Ke(t,e,"scrollToOffset")},sendMessage(e,t){Ke(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Oe()},setWidthCalculationMethod(e){pe=e,Ce()},setTargetOrigin(e){v(`Set targetOrigin: ${e}`),ce=e},resize(e,t){Qe("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){w("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ke(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){v(`Add event listener: ${n}`),a(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),G=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);v(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ke(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(v(`In page link (#${o}) not found in iFrame, so sending to parent`),Ke(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,m)}function c(){v("Setting up location.hash handlers"),r(),l(),s()}return G.enable?1===_?w("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c():v("In page linking not enabled"),{findTarget:o}}(),Se(We(document)()),void 0===F&&(F=`${B}px`),Ee("margin",(o="margin",(d=F).includes("-")&&(z(`Negative CSS value ignored for ${o}`),d=""),d)),Ee("background",q),Ee("padding",D),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),v('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{Qe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ke(0,0,"title",document.title),Ae(),ye(),v("Initialization complete"),v("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,v(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),v(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(v(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{v(`Applying data-iframe-size to: ${g(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Qe(e.eventName,e.eventType)}h[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=h[e];var n,o;delete h[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),v(`${p(e.method)} event listener: ${e.eventType}`)}function Pe(e){je({method:e,eventType:"After Print",eventName:"afterprint"}),je({method:e,eventType:"Before Print",eventName:"beforeprint"}),je({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function Te(e,t,n,o){return t!==e&&(e in n||(z(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&w(`<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 remove this option.`),v(`${o} calculation method set to "${e}"`)),e}function Oe(){Q=Te(Q,b,Ve,"height")}function Ce(){pe=Te(pe,k,Je,"width")}function Ae(){!0===L?(Pe("add"),W=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&v("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n,m=r*s+++a;if(u>m&&u<l)return v(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(qe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return v("Create <body/> MutationObserver"),e.observe(t,n),e}const m=u();return{disconnect(){v("Disconnect MutationObserver"),m.disconnect()}}}(),ie=new ResizeObserver(ke),qe(window.document)):v("Auto Resize disabled")}let Ie;function ke(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ie=()=>Qe("resizeObserver",`Resize Observed: ${g(t)}`),setTimeout((()=>{Ie&&Ie(),Ie=void 0}),0)}const Re=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Ne=()=>[...We(document)()].filter(Re),xe=new WeakSet;function Le(e){e&&(xe.has(e)||(ie.observe(e),xe.add(e),v(`Attached resizeObserver: ${g(e)}`)))}function qe(e){[...Ne(),...I.flatMap((t=>e.querySelector(t)))].forEach(Le)}function Be(e){performance.mark(P);const t=p(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:M()?S:We(document)();let l=a.length;return a.forEach((t=>{J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),N=i,performance.mark(T,{detail:{Side:t,len:l,hasTags:J,logging:K}}),r}const Fe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],We=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),De={height:0,width:0},He={height:0,width:0};function Ue(e){function t(){return He[i]=r,De[i]=s,r}const n=M(),o=e===Ve,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===He[i]&&0===De[i]:return v(`Initial page size values: ${c}`),t();case ue&&r===He[i]&&s===De[i]:return v(`Size unchanged: ${c}`),Math.max(r,s);case 0===r:return v(`Page is hidden: ${c}`),s;case!n&&r!==He[i]&&s<=De[i]:return v(`New HTML bounding size: ${c}`,"Previous bounding size:",He[i]),t();case!o:return e.taggedElement();case!n&&r<He[i]:return v("HTML bounding size decreased:",c),t();case s===l||s===a:return v("HTML bounding size equals page size:",c),t();case r>s:return v(`Page size < HTML bounding size: ${c}`),t();default:v(`Content overflowing HTML element: ${c}`)}return Math.max(e.taggedElement(),t())}const Ve={enabled:()=>H,getOffset:()=>R,auto:()=>Ue(Ve),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ve.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Fe(Ve)),min:()=>Math.min(...Fe(Ve)),grow:()=>Ve.max(),lowestElement:()=>Be(i),taggedElement:()=>Be(i)},Je={enabled:()=>U,getOffset:()=>x,auto:()=>Ue(Je),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Fe(Je)),min:()=>Math.min(...Fe(Je)),rightMostElement:()=>Be(r),scroll:()=>Math.max(Je.bodyScroll(),Je.documentElementScroll()),taggedElement:()=>Be(r)};function Ze(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=de);return r=void 0===n?Ve[Q]():n,a=void 0===o?Je[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in A||U&&pe in A)&&Ge(t):(Xe(),Z=r,fe=a,Ke(Z,fe,e,i))}function Qe(e,t,n,o,i){document.hidden?v("Page hidden - Ignored resize request"):(e in j||v(`Trigger event: ${t}`),Ze(e,t,n,o,i))}function Xe(){ue||(ue=!0,v("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,v("Trigger event lock off"),v("--")})))}function Ye(e){Z=Ve[Q](),fe=Je[pe](),Ke(Z,fe,e)}function Ge(e){const t=Q;Q=b,v(`Reset trigger event: ${e}`),Xe(),Ye("reset"),Q=t}function Ke(e,t,n,o,i){_<-1||(void 0!==i?v(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(R||0)}:${t+(x||0)}:${n}${void 0===o?"":`:${o}`}`;v(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(O+r):se.postMessage(O+r,i)}())}function _e(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),m)},reset(){X?v("Page reset ignored by init"):(v("Page size reset by host page"),Ye("resetPage"))},resize(){Qe("resizeParent","Parent window requested size check")},moveToAnchor(){G.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();v(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ke(0,0,"pageInfoStop"),v(" --")},parentInfo(){const e=o();v(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ke(0,0,"parentInfoStop"),v(" --")},message(){const e=o();v(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),v(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};O===`${e.data}`.slice(0,C)&&(!1!==V?r()?t.init():v(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||z(`Unexpected message (${e.data})`)}())}function et(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>_e({data:e,sameDomain:!0}),a(window,"message",_e),a(window,"readystatechange",et),et()}();
21
- //# sourceMappingURL=index.cjs.js.map
20
+ "use strict";const e="5.2.3",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),c=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="";const m=e=>""!=`${e}`&&void 0!==e;const f=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),p=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),h=(...e)=>console?.warn(f(...e)),y=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(f)(...e)),g=e=>y(e);let v=[];const b=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),v=document.querySelectorAll(`[${o}]`),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},w=()=>v.length>0,z=1e5,S="--ifr-start",E="--ifr-end",j="--ifr-measure",$=[],P=new WeakSet,C=e=>"object"==typeof e&&P.add(e),O=e=>Math.floor(e*z)/z;let A=null,M=null,T={};const k=setInterval((()=>{if($.length<10)return;if(T.hasTags&&T.len<25)return;$.sort();const e=Math.min($.reduce(((e,t)=>e+t),0)/$.length,$[Math.floor($.length/2)]);e<=4||(clearInterval(k),y(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${O(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${T.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function I(e){e.getEntries().forEach((e=>{if(e.name===E){const{duration:t}=performance.measure(j,S,E);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;T=e,P.has(M)||A===M||i&&o<=1||(r||C(M),A=M,p(`\n${n} position calculated from:`,M,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${O(t)}ms`))}(e.detail,t),$.push(t),$.length>100&&$.shift()}}))}function N(){new PerformanceObserver(I).observe({entryTypes:["mark"]}),C(document.documentElement),C(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",N):N()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(h("Custom height calculation function not defined"),Ue.auto()),width:()=>(h("Custom width calculation function not defined"),De.auto())},f={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},p=128,z={},j="checkVisibility"in window,$="auto",P="[iFrameSizer]",C=P.length,O={max:1,min:1,bodyScroll:1,documentElementScroll:1},A=["body"],T="scroll";let k,I,N=!0,R="",x=0,B="",q=null,W="",L=!0,F=!1,U=!0,D=!1,V=1,J=$,H=!0,Z="",Q={},X=!1,Y=0,G=!1,K="",_=d,ee="child",te=null,ne=!1,oe="",ie=[],re=window.parent,ae="*",le=0,se=!1,ce="",de=1,ue=T,me=window,fe=()=>{h("onMessage function not defined")},pe=()=>{},he=null,ye=null;function ge(){var o,d;!function(){const e=e=>"true"===e,t=Z.slice(C).split(":");K=t[0],x=void 0===t[1]?x:Number(t[1]),F=void 0===t[2]?F:e(t[2]),X=void 0===t[3]?X:e(t[3]),N=void 0===t[6]?N:e(t[6]),B=t[7],J=void 0===t[8]?J:t[8],R=t[9],W=t[10],le=void 0===t[11]?le:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ee=void 0===t[13]?ee:t[13],ue=void 0===t[14]?ue:t[14],G=void 0===t[15]?G:e(t[15]),k=void 0===t[16]?k:Number(t[16]),I=void 0===t[17]?I:Number(t[17]),L=void 0===t[18]?L:e(t[18]),t[19],ce=t[20]||ce,Y=void 0===t[21]?Y:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;fe=e?.onMessage||fe,pe=e?.onReady||pe,"number"==typeof e?.offset&&(y("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),L&&(k=e?.offset),F&&(I=e?.offset)),"number"==typeof e?.offsetSize&&(L&&(k=e?.offsetSize),F&&(I=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(oe=e.sizeSelector),ae=e?.targetOrigin||ae,J=e?.heightCalculationMethod||J,ue=e?.widthCalculationMethod||ue}function t(e,t){return"function"==typeof e&&(l[t]=e,e="custom"),e}1!==Y&&"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),J=t(J,"height"),ue=t(ue,"width"))}(),u={id:K,logging:X}.id,function(){try{ne="iframeParentListener"in window.parent}catch(e){}}(),Y<0?g(`${s(Y+2)}${s(2)}`):ce.codePointAt(0)>4||Y<2&&g(s(3)),ce&&""!==ce&&"false"!==ce?ce!==e&&y(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ce} - Child page: ${e}.\n`):y("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&y("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),be(),L!==F&&(_=b({onChange:c(ve),side:L?i:r})),1!==Y&&(me.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===N?(N=!0,Oe()):!1===e&&!0===N&&(N=!1,je("remove"),te?.disconnect(),q?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(N)),N),close(){Xe(0,0,"close")},getId:()=>K,getPageInfo(e){if("function"==typeof e)return he=e,Xe(0,0,"pageInfo"),void y("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");he=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return ye=e,Xe(0,0,"parentInfo"),()=>{ye=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){y("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Q.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){J=e,Pe()},setWidthCalculationMethod(e){ue=e,Ce()},setTargetOrigin(e){ae=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){y("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),me.parentIFrame=me.parentIframe),function(){function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){a(window.document,t,e)}!0===G&&(t("mouseenter"),t("mouseleave"))}(),Q=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,p)}function c(){r(),l(),s()}return Q.enable&&(1===Y?y("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),we(qe(document)()),void 0===B&&(B=`${x}px`),ze("margin",(o="margin",(d=B).includes("-")&&(h(`Negative CSS value ignored for ${o}`),d=""),d)),ze("background",R),ze("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),Se()}const ve=()=>{Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),Oe(),pe()};function be(){ie=document.querySelectorAll(`[${n}]`),D=ie.length>0}function we(e){D?setTimeout(ve):_(e)}function ze(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function Se(){""!==oe&&document.querySelectorAll(oe).forEach((e=>{e.dataset.iframeSize=!0}))}function Ee(e){({add(t){function n(){Je(e.eventName,e.eventType)}z[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=z[e];var n,o;delete z[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function je(e){Ee({method:e,eventType:"After Print",eventName:"afterprint"}),Ee({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ee({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function $e(e,t,n,o){return t!==e&&(e in n||(h(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in f&&y(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function Pe(){J=$e(J,$,Ue,"height")}function Ce(){ue=$e(ue,T,De,"width")}function Oe(){!0===N&&(je("add"),q=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n;if(u>r*s+++a&&u<l)return setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Se(),be(),we(e),e.forEach(Re),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}const m=u();return{disconnect(){m.disconnect()}}}(),te=new ResizeObserver(Me),Re(window.document))}let Ae;function Me(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ae=()=>Je("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!m(e):return"";case m(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case m(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(m(e.className)?`.${e.className}`:"")}}(t)}`),setTimeout((()=>{Ae&&Ae(),Ae=void 0}),0)}const Te=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...qe(document)()].filter(Te),Ie=new WeakSet;function Ne(e){e&&(Ie.has(e)||(te.observe(e),Ie.add(e)))}function Re(e){[...ke(),...A.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function xe(e){performance.mark(S);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=D?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(S);const l=D?ie:w()?v:qe(document)();let s=l.length;return l.forEach((t=>{D||!j||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1})),M=r,performance.mark(E,{detail:{Side:t,len:s,hasTags:D,logging:X}}),a}const Be=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],qe=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),We={height:0,width:0},Le={height:0,width:0};function Fe(e){function t(){return Le[i]=r,We[i]=s,r}const n=w(),o=e===Ue,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case D:return e.taggedElement();case!n&&0===Le[i]&&0===We[i]:return t();case se&&r===Le[i]&&s===We[i]:return Math.max(r,s);case 0===r:return s;case!n&&r!==Le[i]&&s<=We[i]:return t();case!o:return e.taggedElement();case!n&&r<Le[i]:case s===l||s===a:case r>s:return t()}return Math.max(e.taggedElement(),t())}const Ue={enabled:()=>L,getOffset:()=>k,auto:()=>Fe(Ue),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ue.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Be(Ue)),min:()=>Math.min(...Be(Ue)),grow:()=>Ue.max(),lowestElement:()=>xe(i),taggedElement:()=>xe(i)},De={enabled:()=>F,getOffset:()=>I,auto:()=>Fe(De),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Be(De)),min:()=>Math.min(...Be(De)),rightMostElement:()=>xe(r),scroll:()=>Math.max(De.bodyScroll(),De.documentElementScroll()),taggedElement:()=>xe(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=le);return r=void 0===n?Ue[J]():n,a=void 0===o?De[ue]():o,L&&e(V,r)||F&&e(de,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(L&&J in O||F&&ue in O)&&Qe():(He(),V=r,de=a,Xe(V,de,e,i))}function Je(e,t,n,o,i){document.hidden||Ve(e,0,n,o,i)}function He(){se||(se=!0,requestAnimationFrame((()=>{se=!1})))}function Ze(e){V=Ue[J](),de=De[ue](),Xe(V,de,e)}function Qe(e){const t=J;J=$,He(),Ze("reset"),J=t}function Xe(e,t,n,o,i){Y<-1||(void 0!==i||(i=ae),function(){const r=`${K}:${e+(k||0)}:${t+(I||0)}:${n}${void 0===o?"":`:${o}`}`;ne?window.parent.iframeParentListener(P+r):re.postMessage(P+r,i)}())}function Ye(e){const t={init:function(){Z=e.data,re=e.source,ge(),U=!1,setTimeout((()=>{H=!1}),p)},reset(){H||Ze("resetPage")},resize(){Je("resizeParent")},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();he?he(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();ye?ye(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();fe(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};P===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||h(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),a(window,"message",Ye),a(window,"readystatechange",Ge),Ge()}();
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.2.2-beta.4 (esm) - 2024-07-27
4
+ * @module iframe-resizer/child 5.2.3 (esm) - 2024-08-05
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,4 @@
17
17
  */
18
18
 
19
19
 
20
- const e="5.2.2-beta.4",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),c=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="",m=!1;const f=e=>{u=e.id,m=e.logging},p=e=>e.charAt(0).toUpperCase()+e.slice(1),h=e=>""!=`${e}`&&void 0!==e;function g(e){switch(!0){case!h(e):return"";case h(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case h(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(h(e.className)?`.${e.className}`:"")}}const y=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),v=(...e)=>m&&console?.log(y(...e)),b=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),z=(...e)=>console?.warn(y(...e)),w=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(y)(...e)),$=e=>w(e);let S=[];const E=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),S=document.querySelectorAll(`[${o}]`),v("overflowedElements:",S.length),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},M=()=>S.length>0,j=1e5,P="--ifr-start",T="--ifr-end",O="--ifr-measure",C=[],A=new WeakSet,I=e=>"object"==typeof e&&A.add(e),k=e=>Math.floor(e*j)/j;let R=null,N=null,x={};const L=setInterval((()=>{if(C.length<10)return;if(x.hasTags&&x.len<25)return;C.sort();const e=Math.min(C.reduce(((e,t)=>e+t),0)/C.length,C[Math.floor(C.length/2)]);v("Max time:",Math.max(...C)),e<=4||(clearInterval(L),w(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${k(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===T){const{duration:t}=performance.measure(O,P,T);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,A.has(N)||R===N||i&&o<=1||(r||I(N),R=N,b(`\n${n} position calculated from:\n`,N,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${k(t)}ms`))}(e.detail,t),C.push(t),C.length>100&&C.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),I(document.documentElement),I(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(z("Custom height calculation function not defined"),Ve.auto()),width:()=>(z("Custom width calculation function not defined"),Je.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},m=128,h={},y="checkVisibility"in window,b="auto",j={reset:1,resetPage:1,init:1},O="[iFrameSizer]",C=O.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I=["body"],k="scroll";let R,x,L=!0,q="",B=0,F="",W=null,D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=b,X=!0,Y="",G={},K=!1,_=0,ee=!1,te="",ne=d,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,ce="*",de=0,ue=!1,me="",fe=1,pe=k,he=window,ge=()=>{z("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,d;!function(){const e=e=>"true"===e,t=Y.slice(C).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),U=void 0===t[2]?U:e(t[2]),K=void 0===t[3]?K:e(t[3]),L=void 0===t[6]?L:e(t[6]),F=t[7],Q=void 0===t[8]?Q:t[8],q=t[9],D=t[10],de=void 0===t[11]?de:Number(t[11]),G.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),R=void 0===t[16]?R:Number(t[16]),x=void 0===t[17]?x:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,_=void 0===t[21]?_:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;v(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&(w("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(R=e?.offset),U&&(x=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(R=e?.offsetSize),U&&(x=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),ce=e?.targetOrigin||ce,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(v(`Setup custom ${t}CalcMethod`),l[t]=e,e="custom"),e}1!==_&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),v(`TargetOrigin for parent set to: ${ce}`))}(),v(`Initialising iFrame v${e} (${window.location.href})`),f({id:te,logging:K}),function(){try{re="iframeParentListener"in window.parent}catch(e){v("Cross domain iframe detected.")}}(),_<0?$(`${s(_+2)}${s(2)}`):me.codePointAt(0)>4||_<2&&$(s(3)),me&&""!==me&&"false"!==me?me!==e&&w(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):w("<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"),Oe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&w("<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</>.")}(),$e(),H!==U&&(ne=E({onChange:c(we),side:H?i:r})),1!==_&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,Ae()):!1===e&&!0===L&&(L=!1,Pe("remove"),ie?.disconnect(),W?.disconnect()),Ke(0,0,"autoResize",JSON.stringify(L)),L),close(){Ke(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ke(0,0,"pageInfo"),void w("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ve=null,Ke(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ke(0,0,"parentInfo"),()=>{be=null,Ke(0,0,"parentInfoStop")}},getParentProperties(e){w("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){G.findTarget(e)},reset(){Ge("parentIFrame.reset")},scrollBy(e,t){Ke(t,e,"scrollBy")},scrollTo(e,t){Ke(t,e,"scrollTo")},scrollToOffset(e,t){Ke(t,e,"scrollToOffset")},sendMessage(e,t){Ke(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Oe()},setWidthCalculationMethod(e){pe=e,Ce()},setTargetOrigin(e){v(`Set targetOrigin: ${e}`),ce=e},resize(e,t){Qe("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){w("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ke(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){v(`Add event listener: ${n}`),a(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),G=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);v(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ke(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(v(`In page link (#${o}) not found in iFrame, so sending to parent`),Ke(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,m)}function c(){v("Setting up location.hash handlers"),r(),l(),s()}return G.enable?1===_?w("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c():v("In page linking not enabled"),{findTarget:o}}(),Se(We(document)()),void 0===F&&(F=`${B}px`),Ee("margin",(o="margin",(d=F).includes("-")&&(z(`Negative CSS value ignored for ${o}`),d=""),d)),Ee("background",q),Ee("padding",D),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),v('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{Qe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ke(0,0,"title",document.title),Ae(),ye(),v("Initialization complete"),v("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,v(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),v(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(v(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{v(`Applying data-iframe-size to: ${g(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Qe(e.eventName,e.eventType)}h[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=h[e];var n,o;delete h[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),v(`${p(e.method)} event listener: ${e.eventType}`)}function Pe(e){je({method:e,eventType:"After Print",eventName:"afterprint"}),je({method:e,eventType:"Before Print",eventName:"beforeprint"}),je({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function Te(e,t,n,o){return t!==e&&(e in n||(z(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&w(`<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 remove this option.`),v(`${o} calculation method set to "${e}"`)),e}function Oe(){Q=Te(Q,b,Ve,"height")}function Ce(){pe=Te(pe,k,Je,"width")}function Ae(){!0===L?(Pe("add"),W=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&v("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n,m=r*s+++a;if(u>m&&u<l)return v(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(qe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return v("Create <body/> MutationObserver"),e.observe(t,n),e}const m=u();return{disconnect(){v("Disconnect MutationObserver"),m.disconnect()}}}(),ie=new ResizeObserver(ke),qe(window.document)):v("Auto Resize disabled")}let Ie;function ke(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ie=()=>Qe("resizeObserver",`Resize Observed: ${g(t)}`),setTimeout((()=>{Ie&&Ie(),Ie=void 0}),0)}const Re=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Ne=()=>[...We(document)()].filter(Re),xe=new WeakSet;function Le(e){e&&(xe.has(e)||(ie.observe(e),xe.add(e),v(`Attached resizeObserver: ${g(e)}`)))}function qe(e){[...Ne(),...I.flatMap((t=>e.querySelector(t)))].forEach(Le)}function Be(e){performance.mark(P);const t=p(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:M()?S:We(document)();let l=a.length;return a.forEach((t=>{J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),N=i,performance.mark(T,{detail:{Side:t,len:l,hasTags:J,logging:K}}),r}const Fe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],We=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),De={height:0,width:0},He={height:0,width:0};function Ue(e){function t(){return He[i]=r,De[i]=s,r}const n=M(),o=e===Ve,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===He[i]&&0===De[i]:return v(`Initial page size values: ${c}`),t();case ue&&r===He[i]&&s===De[i]:return v(`Size unchanged: ${c}`),Math.max(r,s);case 0===r:return v(`Page is hidden: ${c}`),s;case!n&&r!==He[i]&&s<=De[i]:return v(`New HTML bounding size: ${c}`,"Previous bounding size:",He[i]),t();case!o:return e.taggedElement();case!n&&r<He[i]:return v("HTML bounding size decreased:",c),t();case s===l||s===a:return v("HTML bounding size equals page size:",c),t();case r>s:return v(`Page size < HTML bounding size: ${c}`),t();default:v(`Content overflowing HTML element: ${c}`)}return Math.max(e.taggedElement(),t())}const Ve={enabled:()=>H,getOffset:()=>R,auto:()=>Ue(Ve),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ve.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Fe(Ve)),min:()=>Math.min(...Fe(Ve)),grow:()=>Ve.max(),lowestElement:()=>Be(i),taggedElement:()=>Be(i)},Je={enabled:()=>U,getOffset:()=>x,auto:()=>Ue(Je),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Fe(Je)),min:()=>Math.min(...Fe(Je)),rightMostElement:()=>Be(r),scroll:()=>Math.max(Je.bodyScroll(),Je.documentElementScroll()),taggedElement:()=>Be(r)};function Ze(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=de);return r=void 0===n?Ve[Q]():n,a=void 0===o?Je[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in A||U&&pe in A)&&Ge(t):(Xe(),Z=r,fe=a,Ke(Z,fe,e,i))}function Qe(e,t,n,o,i){document.hidden?v("Page hidden - Ignored resize request"):(e in j||v(`Trigger event: ${t}`),Ze(e,t,n,o,i))}function Xe(){ue||(ue=!0,v("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,v("Trigger event lock off"),v("--")})))}function Ye(e){Z=Ve[Q](),fe=Je[pe](),Ke(Z,fe,e)}function Ge(e){const t=Q;Q=b,v(`Reset trigger event: ${e}`),Xe(),Ye("reset"),Q=t}function Ke(e,t,n,o,i){_<-1||(void 0!==i?v(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(R||0)}:${t+(x||0)}:${n}${void 0===o?"":`:${o}`}`;v(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(O+r):se.postMessage(O+r,i)}())}function _e(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),m)},reset(){X?v("Page reset ignored by init"):(v("Page size reset by host page"),Ye("resetPage"))},resize(){Qe("resizeParent","Parent window requested size check")},moveToAnchor(){G.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();v(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ke(0,0,"pageInfoStop"),v(" --")},parentInfo(){const e=o();v(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ke(0,0,"parentInfoStop"),v(" --")},message(){const e=o();v(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),v(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};O===`${e.data}`.slice(0,C)&&(!1!==V?r()?t.init():v(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||z(`Unexpected message (${e.data})`)}())}function et(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>_e({data:e,sameDomain:!0}),a(window,"message",_e),a(window,"readystatechange",et),et()}();
21
- //# sourceMappingURL=index.esm.js.map
20
+ const e="5.2.3",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),c=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="";const m=e=>""!=`${e}`&&void 0!==e;const f=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),p=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),h=(...e)=>console?.warn(f(...e)),y=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(f)(...e)),g=e=>y(e);let v=[];const b=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),v=document.querySelectorAll(`[${o}]`),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},w=()=>v.length>0,z=1e5,S="--ifr-start",E="--ifr-end",j="--ifr-measure",$=[],P=new WeakSet,C=e=>"object"==typeof e&&P.add(e),O=e=>Math.floor(e*z)/z;let A=null,M=null,T={};const k=setInterval((()=>{if($.length<10)return;if(T.hasTags&&T.len<25)return;$.sort();const e=Math.min($.reduce(((e,t)=>e+t),0)/$.length,$[Math.floor($.length/2)]);e<=4||(clearInterval(k),y(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${O(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${T.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function I(e){e.getEntries().forEach((e=>{if(e.name===E){const{duration:t}=performance.measure(j,S,E);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;T=e,P.has(M)||A===M||i&&o<=1||(r||C(M),A=M,p(`\n${n} position calculated from:`,M,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${O(t)}ms`))}(e.detail,t),$.push(t),$.length>100&&$.shift()}}))}function N(){new PerformanceObserver(I).observe({entryTypes:["mark"]}),C(document.documentElement),C(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",N):N()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(h("Custom height calculation function not defined"),Ue.auto()),width:()=>(h("Custom width calculation function not defined"),De.auto())},f={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},p=128,z={},j="checkVisibility"in window,$="auto",P="[iFrameSizer]",C=P.length,O={max:1,min:1,bodyScroll:1,documentElementScroll:1},A=["body"],T="scroll";let k,I,N=!0,R="",x=0,B="",q=null,W="",L=!0,F=!1,U=!0,D=!1,V=1,J=$,H=!0,Z="",Q={},X=!1,Y=0,G=!1,K="",_=d,ee="child",te=null,ne=!1,oe="",ie=[],re=window.parent,ae="*",le=0,se=!1,ce="",de=1,ue=T,me=window,fe=()=>{h("onMessage function not defined")},pe=()=>{},he=null,ye=null;function ge(){var o,d;!function(){const e=e=>"true"===e,t=Z.slice(C).split(":");K=t[0],x=void 0===t[1]?x:Number(t[1]),F=void 0===t[2]?F:e(t[2]),X=void 0===t[3]?X:e(t[3]),N=void 0===t[6]?N:e(t[6]),B=t[7],J=void 0===t[8]?J:t[8],R=t[9],W=t[10],le=void 0===t[11]?le:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ee=void 0===t[13]?ee:t[13],ue=void 0===t[14]?ue:t[14],G=void 0===t[15]?G:e(t[15]),k=void 0===t[16]?k:Number(t[16]),I=void 0===t[17]?I:Number(t[17]),L=void 0===t[18]?L:e(t[18]),t[19],ce=t[20]||ce,Y=void 0===t[21]?Y:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;fe=e?.onMessage||fe,pe=e?.onReady||pe,"number"==typeof e?.offset&&(y("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),L&&(k=e?.offset),F&&(I=e?.offset)),"number"==typeof e?.offsetSize&&(L&&(k=e?.offsetSize),F&&(I=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(oe=e.sizeSelector),ae=e?.targetOrigin||ae,J=e?.heightCalculationMethod||J,ue=e?.widthCalculationMethod||ue}function t(e,t){return"function"==typeof e&&(l[t]=e,e="custom"),e}1!==Y&&"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),J=t(J,"height"),ue=t(ue,"width"))}(),u={id:K,logging:X}.id,function(){try{ne="iframeParentListener"in window.parent}catch(e){}}(),Y<0?g(`${s(Y+2)}${s(2)}`):ce.codePointAt(0)>4||Y<2&&g(s(3)),ce&&""!==ce&&"false"!==ce?ce!==e&&y(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ce} - Child page: ${e}.\n`):y("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&y("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),be(),L!==F&&(_=b({onChange:c(ve),side:L?i:r})),1!==Y&&(me.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===N?(N=!0,Oe()):!1===e&&!0===N&&(N=!1,je("remove"),te?.disconnect(),q?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(N)),N),close(){Xe(0,0,"close")},getId:()=>K,getPageInfo(e){if("function"==typeof e)return he=e,Xe(0,0,"pageInfo"),void y("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");he=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return ye=e,Xe(0,0,"parentInfo"),()=>{ye=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){y("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Q.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){J=e,Pe()},setWidthCalculationMethod(e){ue=e,Ce()},setTargetOrigin(e){ae=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){y("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),me.parentIFrame=me.parentIframe),function(){function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){a(window.document,t,e)}!0===G&&(t("mouseenter"),t("mouseleave"))}(),Q=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,p)}function c(){r(),l(),s()}return Q.enable&&(1===Y?y("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),we(qe(document)()),void 0===B&&(B=`${x}px`),ze("margin",(o="margin",(d=B).includes("-")&&(h(`Negative CSS value ignored for ${o}`),d=""),d)),ze("background",R),ze("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),Se()}const ve=()=>{Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),Oe(),pe()};function be(){ie=document.querySelectorAll(`[${n}]`),D=ie.length>0}function we(e){D?setTimeout(ve):_(e)}function ze(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function Se(){""!==oe&&document.querySelectorAll(oe).forEach((e=>{e.dataset.iframeSize=!0}))}function Ee(e){({add(t){function n(){Je(e.eventName,e.eventType)}z[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=z[e];var n,o;delete z[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function je(e){Ee({method:e,eventType:"After Print",eventName:"afterprint"}),Ee({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ee({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function $e(e,t,n,o){return t!==e&&(e in n||(h(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in f&&y(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function Pe(){J=$e(J,$,Ue,"height")}function Ce(){ue=$e(ue,T,De,"width")}function Oe(){!0===N&&(je("add"),q=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n;if(u>r*s+++a&&u<l)return setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Se(),be(),we(e),e.forEach(Re),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}const m=u();return{disconnect(){m.disconnect()}}}(),te=new ResizeObserver(Me),Re(window.document))}let Ae;function Me(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ae=()=>Je("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!m(e):return"";case m(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case m(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(m(e.className)?`.${e.className}`:"")}}(t)}`),setTimeout((()=>{Ae&&Ae(),Ae=void 0}),0)}const Te=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...qe(document)()].filter(Te),Ie=new WeakSet;function Ne(e){e&&(Ie.has(e)||(te.observe(e),Ie.add(e)))}function Re(e){[...ke(),...A.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function xe(e){performance.mark(S);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=D?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(S);const l=D?ie:w()?v:qe(document)();let s=l.length;return l.forEach((t=>{D||!j||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1})),M=r,performance.mark(E,{detail:{Side:t,len:s,hasTags:D,logging:X}}),a}const Be=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],qe=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),We={height:0,width:0},Le={height:0,width:0};function Fe(e){function t(){return Le[i]=r,We[i]=s,r}const n=w(),o=e===Ue,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case D:return e.taggedElement();case!n&&0===Le[i]&&0===We[i]:return t();case se&&r===Le[i]&&s===We[i]:return Math.max(r,s);case 0===r:return s;case!n&&r!==Le[i]&&s<=We[i]:return t();case!o:return e.taggedElement();case!n&&r<Le[i]:case s===l||s===a:case r>s:return t()}return Math.max(e.taggedElement(),t())}const Ue={enabled:()=>L,getOffset:()=>k,auto:()=>Fe(Ue),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ue.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Be(Ue)),min:()=>Math.min(...Be(Ue)),grow:()=>Ue.max(),lowestElement:()=>xe(i),taggedElement:()=>xe(i)},De={enabled:()=>F,getOffset:()=>I,auto:()=>Fe(De),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Be(De)),min:()=>Math.min(...Be(De)),rightMostElement:()=>xe(r),scroll:()=>Math.max(De.bodyScroll(),De.documentElementScroll()),taggedElement:()=>xe(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=le);return r=void 0===n?Ue[J]():n,a=void 0===o?De[ue]():o,L&&e(V,r)||F&&e(de,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(L&&J in O||F&&ue in O)&&Qe():(He(),V=r,de=a,Xe(V,de,e,i))}function Je(e,t,n,o,i){document.hidden||Ve(e,0,n,o,i)}function He(){se||(se=!0,requestAnimationFrame((()=>{se=!1})))}function Ze(e){V=Ue[J](),de=De[ue](),Xe(V,de,e)}function Qe(e){const t=J;J=$,He(),Ze("reset"),J=t}function Xe(e,t,n,o,i){Y<-1||(void 0!==i||(i=ae),function(){const r=`${K}:${e+(k||0)}:${t+(I||0)}:${n}${void 0===o?"":`:${o}`}`;ne?window.parent.iframeParentListener(P+r):re.postMessage(P+r,i)}())}function Ye(e){const t={init:function(){Z=e.data,re=e.source,ge(),U=!1,setTimeout((()=>{H=!1}),p)},reset(){H||Ze("resetPage")},resize(){Je("resizeParent")},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();he?he(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();ye?ye(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();fe(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};P===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||h(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),a(window,"message",Ye),a(window,"readystatechange",Ge),Ge()}();
package/index.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.2.2-beta.4 (umd) - 2024-07-27
4
+ * @module iframe-resizer/child 5.2.3 (umd) - 2024-08-05
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,4 @@
17
17
  */
18
18
 
19
19
 
20
- !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.2.2-beta.4",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),c=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="",m=!1;const f=e=>{u=e.id,m=e.logging},p=e=>e.charAt(0).toUpperCase()+e.slice(1),h=e=>""!=`${e}`&&void 0!==e;function g(e){switch(!0){case!h(e):return"";case h(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case h(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(h(e.className)?`.${e.className}`:"")}}const y=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),v=(...e)=>m&&console?.log(y(...e)),b=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),z=(...e)=>console?.warn(y(...e)),w=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(y)(...e)),$=e=>w(e);let S=[];const E=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),S=document.querySelectorAll(`[${o}]`),v("overflowedElements:",S.length),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},M=()=>S.length>0,j=1e5,P="--ifr-start",T="--ifr-end",O="--ifr-measure",C=[],A=new WeakSet,I=e=>"object"==typeof e&&A.add(e),k=e=>Math.floor(e*j)/j;let R=null,N=null,x={};const L=setInterval((()=>{if(C.length<10)return;if(x.hasTags&&x.len<25)return;C.sort();const e=Math.min(C.reduce(((e,t)=>e+t),0)/C.length,C[Math.floor(C.length/2)]);v("Max time:",Math.max(...C)),e<=4||(clearInterval(L),w(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${k(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${x.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function q(e){e.getEntries().forEach((e=>{if(e.name===T){const{duration:t}=performance.measure(O,P,T);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;x=e,A.has(N)||R===N||i&&o<=1||(r||I(N),R=N,b(`\n${n} position calculated from:\n`,N,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${k(t)}ms`))}(e.detail,t),C.push(t),C.length>100&&C.shift()}}))}function B(){new PerformanceObserver(q).observe({entryTypes:["mark"]}),I(document.documentElement),I(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",B):B()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(z("Custom height calculation function not defined"),Ve.auto()),width:()=>(z("Custom width calculation function not defined"),Je.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},m=128,h={},y="checkVisibility"in window,b="auto",j={reset:1,resetPage:1,init:1},O="[iFrameSizer]",C=O.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},I=["body"],k="scroll";let R,x,L=!0,q="",B=0,F="",W=null,D="",H=!0,U=!1,V=!0,J=!1,Z=1,Q=b,X=!0,Y="",G={},K=!1,_=0,ee=!1,te="",ne=d,oe="child",ie=null,re=!1,ae="",le=[],se=window.parent,ce="*",de=0,ue=!1,me="",fe=1,pe=k,he=window,ge=()=>{z("onMessage function not defined")},ye=()=>{},ve=null,be=null;function ze(){var o,d;!function(){const e=e=>"true"===e,t=Y.slice(C).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),U=void 0===t[2]?U:e(t[2]),K=void 0===t[3]?K:e(t[3]),L=void 0===t[6]?L:e(t[6]),F=t[7],Q=void 0===t[8]?Q:t[8],q=t[9],D=t[10],de=void 0===t[11]?de:Number(t[11]),G.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],pe=void 0===t[14]?pe:t[14],ee=void 0===t[15]?ee:e(t[15]),R=void 0===t[16]?R:Number(t[16]),x=void 0===t[17]?x:Number(t[17]),H=void 0===t[18]?H:e(t[18]),t[19],me=t[20]||me,_=void 0===t[21]?_:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;v(`Reading data from page: ${JSON.stringify(e)}`),ge=e?.onMessage||ge,ye=e?.onReady||ye,"number"==typeof e?.offset&&(w("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),H&&(R=e?.offset),U&&(x=e?.offset)),"number"==typeof e?.offsetSize&&(H&&(R=e?.offsetSize),U&&(x=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),ce=e?.targetOrigin||ce,Q=e?.heightCalculationMethod||Q,pe=e?.widthCalculationMethod||pe}function t(e,t){return"function"==typeof e&&(v(`Setup custom ${t}CalcMethod`),l[t]=e,e="custom"),e}1!==_&&("iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Q=t(Q,"height"),pe=t(pe,"width")),v(`TargetOrigin for parent set to: ${ce}`))}(),v(`Initialising iFrame v${e} (${window.location.href})`),f({id:te,logging:K}),function(){try{re="iframeParentListener"in window.parent}catch(e){v("Cross domain iframe detected.")}}(),_<0?$(`${s(_+2)}${s(2)}`):me.codePointAt(0)>4||_<2&&$(s(3)),me&&""!==me&&"false"!==me?me!==e&&w(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${me} - Child page: ${e}.\n`):w("<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"),Oe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&w("<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</>.")}(),$e(),H!==U&&(ne=E({onChange:c(we),side:H?i:r})),1!==_&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,Ae()):!1===e&&!0===L&&(L=!1,Pe("remove"),ie?.disconnect(),W?.disconnect()),Ke(0,0,"autoResize",JSON.stringify(L)),L),close(){Ke(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ve=e,Ke(0,0,"pageInfo"),void w("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ve=null,Ke(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return be=e,Ke(0,0,"parentInfo"),()=>{be=null,Ke(0,0,"parentInfoStop")}},getParentProperties(e){w("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){G.findTarget(e)},reset(){Ge("parentIFrame.reset")},scrollBy(e,t){Ke(t,e,"scrollBy")},scrollTo(e,t){Ke(t,e,"scrollTo")},scrollToOffset(e,t){Ke(t,e,"scrollToOffset")},sendMessage(e,t){Ke(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Q=e,Oe()},setWidthCalculationMethod(e){pe=e,Ce()},setTargetOrigin(e){v(`Set targetOrigin: ${e}`),ce=e},resize(e,t){Qe("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){w("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),he.parentIFrame=he.parentIframe),function(){function e(e){Ke(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){v(`Add event listener: ${n}`),a(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),G=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);v(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),Ke(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(v(`In page link (#${o}) not found in iFrame, so sending to parent`),Ke(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,m)}function c(){v("Setting up location.hash handlers"),r(),l(),s()}return G.enable?1===_?w("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c():v("In page linking not enabled"),{findTarget:o}}(),Se(We(document)()),void 0===F&&(F=`${B}px`),Ee("margin",(o="margin",(d=F).includes("-")&&(z(`Negative CSS value ignored for ${o}`),d=""),d)),Ee("background",q),Ee("padding",D),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),v('HTML & body height set to "auto !important"')}(),Me()}const we=()=>{Qe("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ke(0,0,"title",document.title),Ae(),ye(),v("Initialization complete"),v("---")};function $e(){le=document.querySelectorAll(`[${n}]`),J=le.length>0,v(`Tagged elements found: ${J}`)}function Se(e){J?setTimeout(we):ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),v(`Body ${e} set to "${t}"`))}function Me(){""!==ae&&(v(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{v(`Applying data-iframe-size to: ${g(e)}`),e.dataset.iframeSize=!0})))}function je(e){({add(t){function n(){Qe(e.eventName,e.eventType)}h[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=h[e];var n,o;delete h[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),v(`${p(e.method)} event listener: ${e.eventType}`)}function Pe(e){je({method:e,eventType:"After Print",eventName:"afterprint"}),je({method:e,eventType:"Before Print",eventName:"beforeprint"}),je({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function Te(e,t,n,o){return t!==e&&(e in n||(z(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&w(`<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 remove this option.`),v(`${o} calculation method set to "${e}"`)),e}function Oe(){Q=Te(Q,b,Ve,"height")}function Ce(){pe=Te(pe,k,Je,"width")}function Ae(){!0===L?(Pe("add"),W=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r>2&&v("MutationObserver: addedNodes",n),r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n,m=r*s+++a;if(u>m&&u<l)return v(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Me(),$e(),Se(e),e.forEach(qe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return v("Create <body/> MutationObserver"),e.observe(t,n),e}const m=u();return{disconnect(){v("Disconnect MutationObserver"),m.disconnect()}}}(),ie=new ResizeObserver(ke),qe(window.document)):v("Auto Resize disabled")}let Ie;function ke(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ie=()=>Qe("resizeObserver",`Resize Observed: ${g(t)}`),setTimeout((()=>{Ie&&Ie(),Ie=void 0}),0)}const Re=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Ne=()=>[...We(document)()].filter(Re),xe=new WeakSet;function Le(e){e&&(xe.has(e)||(ie.observe(e),xe.add(e),v(`Attached resizeObserver: ${g(e)}`)))}function qe(e){[...Ne(),...I.flatMap((t=>e.querySelector(t)))].forEach(Le)}function Be(e){performance.mark(P);const t=p(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(P);const a=J?le:M()?S:We(document)();let l=a.length;return a.forEach((t=>{J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1})),N=i,performance.mark(T,{detail:{Side:t,len:l,hasTags:J,logging:K}}),r}const Fe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],We=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),De={height:0,width:0},He={height:0,width:0};function Ue(e){function t(){return He[i]=r,De[i]=s,r}const n=M(),o=e===Ve,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case J:return e.taggedElement();case!n&&0===He[i]&&0===De[i]:return v(`Initial page size values: ${c}`),t();case ue&&r===He[i]&&s===De[i]:return v(`Size unchanged: ${c}`),Math.max(r,s);case 0===r:return v(`Page is hidden: ${c}`),s;case!n&&r!==He[i]&&s<=De[i]:return v(`New HTML bounding size: ${c}`,"Previous bounding size:",He[i]),t();case!o:return e.taggedElement();case!n&&r<He[i]:return v("HTML bounding size decreased:",c),t();case s===l||s===a:return v("HTML bounding size equals page size:",c),t();case r>s:return v(`Page size < HTML bounding size: ${c}`),t();default:v(`Content overflowing HTML element: ${c}`)}return Math.max(e.taggedElement(),t())}const Ve={enabled:()=>H,getOffset:()=>R,auto:()=>Ue(Ve),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ve.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Fe(Ve)),min:()=>Math.min(...Fe(Ve)),grow:()=>Ve.max(),lowestElement:()=>Be(i),taggedElement:()=>Be(i)},Je={enabled:()=>U,getOffset:()=>x,auto:()=>Ue(Je),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Fe(Je)),min:()=>Math.min(...Fe(Je)),rightMostElement:()=>Be(r),scroll:()=>Math.max(Je.bodyScroll(),Je.documentElementScroll()),taggedElement:()=>Be(r)};function Ze(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=de);return r=void 0===n?Ve[Q]():n,a=void 0===o?Je[pe]():o,H&&e(Z,r)||U&&e(fe,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(H&&Q in A||U&&pe in A)&&Ge(t):(Xe(),Z=r,fe=a,Ke(Z,fe,e,i))}function Qe(e,t,n,o,i){document.hidden?v("Page hidden - Ignored resize request"):(e in j||v(`Trigger event: ${t}`),Ze(e,t,n,o,i))}function Xe(){ue||(ue=!0,v("Trigger event lock on"),requestAnimationFrame((()=>{ue=!1,v("Trigger event lock off"),v("--")})))}function Ye(e){Z=Ve[Q](),fe=Je[pe](),Ke(Z,fe,e)}function Ge(e){const t=Q;Q=b,v(`Reset trigger event: ${e}`),Xe(),Ye("reset"),Q=t}function Ke(e,t,n,o,i){_<-1||(void 0!==i?v(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(R||0)}:${t+(x||0)}:${n}${void 0===o?"":`:${o}`}`;v(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(O+r):se.postMessage(O+r,i)}())}function _e(e){const t={init:function(){Y=e.data,se=e.source,ze(),V=!1,setTimeout((()=>{X=!1}),m)},reset(){X?v("Page reset ignored by init"):(v("Page size reset by host page"),Ye("resetPage"))},resize(){Qe("resizeParent","Parent window requested size check")},moveToAnchor(){G.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();v(`PageInfo received from parent: ${e}`),ve?ve(JSON.parse(e)):Ke(0,0,"pageInfoStop"),v(" --")},parentInfo(){const e=o();v(`ParentInfo received from parent: ${e}`),be?be(Object.freeze(JSON.parse(e))):Ke(0,0,"parentInfoStop"),v(" --")},message(){const e=o();v(`onMessage called from parent: ${e}`),ge(JSON.parse(e)),v(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};O===`${e.data}`.slice(0,C)&&(!1!==V?r()?t.init():v(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||z(`Unexpected message (${e.data})`)}())}function et(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>_e({data:e,sameDomain:!0}),a(window,"message",_e),a(window,"readystatechange",et),et()}()}));
21
- //# sourceMappingURL=index.umd.js.map
20
+ !function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.2.3",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=["<iy><yi>Puchspk Spjluzl Rlf</><iy><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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const c=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(l[e]),s=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let u="";const m=e=>""!=`${e}`&&void 0!==e;const f=(...e)=>[`[iframe-resizer][${u}]`,...e].join(" "),p=(...e)=>console?.info(`[iframe-resizer][${u}]`,...e),h=(...e)=>console?.warn(f(...e)),y=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(f)(...e)),g=e=>y(e);let v=[];const b=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet,l=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),v=document.querySelectorAll(`[${o}]`),n()}),r);return e=>e.forEach((e=>{a.has(e)||(l.observe(e),a.add(e))}))},w=()=>v.length>0,z=1e5,S="--ifr-start",E="--ifr-end",j="--ifr-measure",$=[],P=new WeakSet,C=e=>"object"==typeof e&&P.add(e),O=e=>Math.floor(e*z)/z;let A=null,M=null,T={};const k=setInterval((()=>{if($.length<10)return;if(T.hasTags&&T.len<25)return;$.sort();const e=Math.min($.reduce(((e,t)=>e+t),0)/$.length,$[Math.floor($.length/2)]);e<=4||(clearInterval(k),y(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${O(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${T.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function I(e){e.getEntries().forEach((e=>{if(e.name===E){const{duration:t}=performance.measure(j,S,E);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;T=e,P.has(M)||A===M||i&&o<=1||(r||C(M),A=M,p(`\n${n} position calculated from:`,M,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${O(t)}ms`))}(e.detail,t),$.push(t),$.length>100&&$.shift()}}))}function N(){new PerformanceObserver(I).observe({entryTypes:["mark"]}),C(document.documentElement),C(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",N):N()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},l={height:()=>(h("Custom height calculation function not defined"),Ue.auto()),width:()=>(h("Custom width calculation function not defined"),De.auto())},f={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},p=128,z={},j="checkVisibility"in window,$="auto",P="[iFrameSizer]",C=P.length,O={max:1,min:1,bodyScroll:1,documentElementScroll:1},A=["body"],T="scroll";let k,I,N=!0,R="",x=0,B="",q=null,W="",L=!0,F=!1,U=!0,D=!1,V=1,J=$,H=!0,Z="",Q={},X=!1,Y=0,G=!1,K="",_=d,ee="child",te=null,ne=!1,oe="",ie=[],re=window.parent,ae="*",le=0,ce=!1,se="",de=1,ue=T,me=window,fe=()=>{h("onMessage function not defined")},pe=()=>{},he=null,ye=null;function ge(){var o,d;!function(){const e=e=>"true"===e,t=Z.slice(C).split(":");K=t[0],x=void 0===t[1]?x:Number(t[1]),F=void 0===t[2]?F:e(t[2]),X=void 0===t[3]?X:e(t[3]),N=void 0===t[6]?N:e(t[6]),B=t[7],J=void 0===t[8]?J:t[8],R=t[9],W=t[10],le=void 0===t[11]?le:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ee=void 0===t[13]?ee:t[13],ue=void 0===t[14]?ue:t[14],G=void 0===t[15]?G:e(t[15]),k=void 0===t[16]?k:Number(t[16]),I=void 0===t[17]?I:Number(t[17]),L=void 0===t[18]?L:e(t[18]),t[19],se=t[20]||se,Y=void 0===t[21]?Y:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;fe=e?.onMessage||fe,pe=e?.onReady||pe,"number"==typeof e?.offset&&(y("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),L&&(k=e?.offset),F&&(I=e?.offset)),"number"==typeof e?.offsetSize&&(L&&(k=e?.offsetSize),F&&(I=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(oe=e.sizeSelector),ae=e?.targetOrigin||ae,J=e?.heightCalculationMethod||J,ue=e?.widthCalculationMethod||ue}function t(e,t){return"function"==typeof e&&(l[t]=e,e="custom"),e}1!==Y&&"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),J=t(J,"height"),ue=t(ue,"width"))}(),u={id:K,logging:X}.id,function(){try{ne="iframeParentListener"in window.parent}catch(e){}}(),Y<0?g(`${c(Y+2)}${c(2)}`):se.codePointAt(0)>4||Y<2&&g(c(3)),se&&""!==se&&"false"!==se?se!==e&&y(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${se} - Child page: ${e}.\n`):y("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n"),Pe(),Ce(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&y("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),be(),L!==F&&(_=b({onChange:s(ve),side:L?i:r})),1!==Y&&(me.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===N?(N=!0,Oe()):!1===e&&!0===N&&(N=!1,je("remove"),te?.disconnect(),q?.disconnect()),Xe(0,0,"autoResize",JSON.stringify(N)),N),close(){Xe(0,0,"close")},getId:()=>K,getPageInfo(e){if("function"==typeof e)return he=e,Xe(0,0,"pageInfo"),void y("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");he=null,Xe(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return ye=e,Xe(0,0,"parentInfo"),()=>{ye=null,Xe(0,0,"parentInfoStop")}},getParentProperties(e){y("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Q.findTarget(e)},reset(){Qe()},scrollBy(e,t){Xe(t,e,"scrollBy")},scrollTo(e,t){Xe(t,e,"scrollTo")},scrollToOffset(e,t){Xe(t,e,"scrollToOffset")},sendMessage(e,t){Xe(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){J=e,Pe()},setWidthCalculationMethod(e){ue=e,Ce()},setTargetOrigin(e){ae=e},resize(e,t){Je("size",`parentIFrame.size(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){y("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),me.parentIFrame=me.parentIframe),function(){function e(e){Xe(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){a(window.document,t,e)}!0===G&&(t("mouseenter"),t("mouseleave"))}(),Q=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);Xe(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Xe(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function c(){setTimeout(i,p)}function s(){r(),l(),c()}return Q.enable&&(1===Y?y("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s()),{findTarget:o}}(),we(qe(document)()),void 0===B&&(B=`${x}px`),ze("margin",(o="margin",(d=B).includes("-")&&(h(`Negative CSS value ignored for ${o}`),d=""),d)),ze("background",R),ze("padding",W),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),Se()}const ve=()=>{Je("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Xe(0,0,"title",document.title),Oe(),pe()};function be(){ie=document.querySelectorAll(`[${n}]`),D=ie.length>0}function we(e){D?setTimeout(ve):_(e)}function ze(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function Se(){""!==oe&&document.querySelectorAll(oe).forEach((e=>{e.dataset.iframeSize=!0}))}function Ee(e){({add(t){function n(){Je(e.eventName,e.eventType)}z[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=z[e];var n,o;delete z[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function je(e){Ee({method:e,eventType:"After Print",eventName:"afterprint"}),Ee({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ee({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function $e(e,t,n,o){return t!==e&&(e in n||(h(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in f&&y(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function Pe(){J=$e(J,$,Ue,"height")}function Ce(){ue=$e(ue,T,De,"width")}function Oe(){!0===N&&(je("add"),q=function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{const{length:n}=t;for(let o=0;o<n;o++){const{addedNodes:n,removedNodes:i}=t[o],r=n.length,a=i.length;if(r)for(let t=0;t<r;t++)e.add(n[t]);if(a)for(let t=0;t<a;t++)e.delete(i[t])}},r=16,a=2,l=200;let c=1;function s(){const d=performance.now(),u=d-n;if(u>r*c+++a&&u<l)return setTimeout(s,r*c),void(n=d);c=1,o.forEach(i),o=[],0!==e.size?(Se(),be(),we(e),e.forEach(Re),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(s))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}const m=u();return{disconnect(){m.disconnect()}}}(),te=new ResizeObserver(Me),Re(window.document))}let Ae;function Me(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ae=()=>Je("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!m(e):return"";case m(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case m(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(m(e.className)?`.${e.className}`:"")}}(t)}`),setTimeout((()=>{Ae&&Ae(),Ae=void 0}),0)}const Te=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},ke=()=>[...qe(document)()].filter(Te),Ie=new WeakSet;function Ne(e){e&&(Ie.has(e)||(te.observe(e),Ie.add(e)))}function Re(e){[...ke(),...A.flatMap((t=>e.querySelector(t)))].forEach(Ne)}function xe(e){performance.mark(S);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=D?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(S);const l=D?ie:w()?v:qe(document)();let c=l.length;return l.forEach((t=>{D||!j||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):c-=1})),M=r,performance.mark(E,{detail:{Side:t,len:c,hasTags:D,logging:X}}),a}const Be=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],qe=e=>()=>e.querySelectorAll("* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)"),We={height:0,width:0},Le={height:0,width:0};function Fe(e){function t(){return Le[i]=r,We[i]=c,r}const n=w(),o=e===Ue,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case D:return e.taggedElement();case!n&&0===Le[i]&&0===We[i]:return t();case ce&&r===Le[i]&&c===We[i]:return Math.max(r,c);case 0===r:return c;case!n&&r!==Le[i]&&c<=We[i]:return t();case!o:return e.taggedElement();case!n&&r<Le[i]:case c===l||c===a:case r>c:return t()}return Math.max(e.taggedElement(),t())}const Ue={enabled:()=>L,getOffset:()=>k,auto:()=>Fe(Ue),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ue.bodyOffset(),custom:()=>l.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Be(Ue)),min:()=>Math.min(...Be(Ue)),grow:()=>Ue.max(),lowestElement:()=>xe(i),taggedElement:()=>xe(i)},De={enabled:()=>F,getOffset:()=>I,auto:()=>Fe(De),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>l.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Be(De)),min:()=>Math.min(...Be(De)),rightMostElement:()=>xe(r),scroll:()=>Math.max(De.bodyScroll(),De.documentElementScroll()),taggedElement:()=>xe(r)};function Ve(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=le);return r=void 0===n?Ue[J]():n,a=void 0===o?De[ue]():o,L&&e(V,r)||F&&e(de,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(L&&J in O||F&&ue in O)&&Qe():(He(),V=r,de=a,Xe(V,de,e,i))}function Je(e,t,n,o,i){document.hidden||Ve(e,0,n,o,i)}function He(){ce||(ce=!0,requestAnimationFrame((()=>{ce=!1})))}function Ze(e){V=Ue[J](),de=De[ue](),Xe(V,de,e)}function Qe(e){const t=J;J=$,He(),Ze("reset"),J=t}function Xe(e,t,n,o,i){Y<-1||(void 0!==i||(i=ae),function(){const r=`${K}:${e+(k||0)}:${t+(I||0)}:${n}${void 0===o?"":`:${o}`}`;ne?window.parent.iframeParentListener(P+r):re.postMessage(P+r,i)}())}function Ye(e){const t={init:function(){Z=e.data,re=e.source,ge(),U=!1,setTimeout((()=>{H=!1}),p)},reset(){H||Ze("resetPage")},resize(){Je("resizeParent")},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();he?he(JSON.parse(e)):Xe(0,0,"pageInfoStop")},parentInfo(){const e=o();ye?ye(Object.freeze(JSON.parse(e))):Xe(0,0,"parentInfoStop")},message(){const e=o();fe(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};P===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||h(`Unexpected message (${e.data})`)}())}function Ge(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}window.iframeChildListener=e=>Ye({data:e,sameDomain:!0}),a(window,"message",Ye),a(window,"readystatechange",Ge),Ge()}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iframe-resizer/child",
3
- "version": "5.2.2-beta.4",
3
+ "version": "5.2.3",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {
package/index.cjs.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../packages/common/consts.js","../../packages/common/listeners.js","../../packages/common/mode.js","../../packages/common/utils.js","../../packages/child/log.js","../../packages/common/format-advise.js","../../packages/child/overflow.js","../../packages/child/perf.js","../../packages/child/index.js"],"sourcesContent":["export const VERSION = '[VI]{version}[/VI]'\n\nexport const BASE = 10\nexport const SINGLE = 1\n\nexport const SIZE_ATTR = 'data-iframe-size'\nexport const OVERFLOW_ATTR = 'data-iframe-overflow'\n\nexport const HEIGHT_EDGE = 'bottom'\nexport const WIDTH_EDGE = 'right'\n\nexport const msgHeader = 'message'\nexport const msgHeaderLen = msgHeader.length\nexport const msgId = '[iFrameSizer]' // Must match iframe msg ID\nexport const msgIdLen = msgId.length\nexport const resetRequiredMethods = Object.freeze({\n max: 1,\n scroll: 1,\n bodyScroll: 1,\n documentElementScroll: 1,\n})\n","export const addEventListener = (el, evt, func, options) =>\n el.addEventListener(evt, func, options || false)\n\nexport const removeEventListener = (el, evt, func) =>\n el.removeEventListener(evt, func, false)\n","const l = (l) => {\n if (!l) return ''\n let p = -559038744,\n y = 1103547984\n for (let z, t = 0; t < l.length; t++)\n (z = l.codePointAt(t)),\n (p = Math.imul(p ^ z, 2246822519)),\n (y = Math.imul(y ^ z, 3266489917))\n return (\n (p ^= Math.imul(p ^ (y >>> 15), 1935289751)),\n (y ^= Math.imul(y ^ (p >>> 15), 3405138345)),\n (p ^= y >>> 16),\n (y ^= p >>> 16),\n (2097152 * (y >>> 0) + (p >>> 11)).toString(36)\n )\n },\n p = (l) =>\n l.replaceAll(/[A-Za-z]/g, (l) =>\n String.fromCodePoint(\n (l <= 'Z' ? 90 : 122) >= (l = l.codePointAt(0) + 19) ? l : l - 26,\n ),\n ),\n y = [\n '<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>',\n '<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>',\n '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</>',\n '<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</>.',\n ],\n z = ['NWSc3', 'zvsv', 'wyv', 'ibzpulzz', 'vlt'],\n t = Object.fromEntries(\n [\n '2cgs7fdf4xb',\n '1c9ctcccr4z',\n '1q2pc4eebgb',\n 'ueokt0969w',\n 'w2zxchhgqz',\n '1umuxblj2e5',\n ].map((l, p) => [l, Math.max(0, p - 1)]),\n )\nexport const getModeData = (l) => p(y[l])\nexport const getModeLabel = (l) => p(z[l])\nexport default (y) => {\n const z = y[p('spjluzl')]\n if (!z) return -1\n const u = z.split('-')\n let v = (function (y = '') {\n let z = -2\n const u = l(p(y))\n return u in t && (z = t[u]), z\n })(u[0])\n return 0 === v || ((p) => p[2] === l(p[0] + p[1]))(u) || (v = -2), v\n}\n","export const isNumber = (value) => !Number.isNaN(value)\n\nexport const once = (fn) => {\n let done = false\n\n return function () {\n return done\n ? undefined\n : ((done = true), Reflect.apply(fn, this, arguments))\n }\n}\n\nexport const id = (x) => x\n","import formatAdvise from '../common/format-advise'\n\nlet id = ''\nlet logging = false\n\nexport const setLogOptions = (options) => {\n id = options.id\n logging = options.logging\n}\n\nexport const capitalizeFirstLetter = (string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nconst isDef = (value) => `${value}` !== '' && value !== undefined\n\nexport function getElementName(el) {\n switch (true) {\n case !isDef(el):\n return ''\n\n case isDef(el.id):\n return `${el.nodeName.toUpperCase()}#${el.id}`\n\n case isDef(el.name):\n return `${el.nodeName.toUpperCase()} (${el.name})`\n\n default:\n return (\n el.nodeName.toUpperCase() +\n (isDef(el.className) ? `.${el.className}` : '')\n )\n }\n}\n\n// function elementSnippet(el, maxChars = 30) {\n// const outer = el?.outerHTML?.toString()\n\n// if (!outer) return el\n\n// return outer.length < maxChars\n// ? outer\n// : `${outer.slice(0, maxChars).replaceAll('\\n', ' ')}...`\n// }\n\n// TODO: remove .join(' '), requires major test updates\nconst formatLogMsg = (...msg) => [`[iframe-resizer][${id}]`, ...msg].join(' ')\n\nexport const log = (...msg) =>\n // eslint-disable-next-line no-console\n logging && console?.log(formatLogMsg(...msg))\n\n// eslint-disable-next-line no-unused-vars\nexport const info = (...msg) =>\n // eslint-disable-next-line no-console\n console?.info(`[iframe-resizer][${id}]`, ...msg)\n\nexport const warn = (...msg) =>\n // eslint-disable-next-line no-console\n console?.warn(formatLogMsg(...msg))\n\nexport const advise = (...msg) =>\n // eslint-disable-next-line no-console\n console?.warn(formatAdvise(formatLogMsg)(...msg))\n\nexport const adviser = (msg) => advise(msg)\n","const encode = (s) =>\n s\n .replaceAll('<br>', '\\n')\n .replaceAll('<rb>', '\\u001B[31;1m')\n .replaceAll('</>', '\\u001B[m')\n .replaceAll('<b>', '\\u001B[1m')\n .replaceAll('<i>', '\\u001B[3m')\n .replaceAll('<u>', '\\u001B[4m')\n\nconst remove = (s) => s.replaceAll('<br>', '\\n').replaceAll(/<[/a-z]+>/gi, '')\n\nexport default (formatLogMsg) => (msg) =>\n window.chrome // Only show formatting in Chrome as not supported in other browsers\n ? formatLogMsg(encode(msg))\n : formatLogMsg(remove(msg))\n","import { HEIGHT_EDGE, OVERFLOW_ATTR } from '../common/consts'\nimport { id } from '../common/utils'\nimport { log } from './log'\n\nlet overflowedElements = []\n\nexport const overflowObserver = (options) => {\n const side = options.side || HEIGHT_EDGE\n const onChange = options.onChange || id\n\n const observerOptions = {\n root: document.documentElement,\n rootMargin: '0px',\n threshold: 1,\n }\n\n const observedElements = new WeakSet()\n\n const isTarget = (entry) =>\n entry.boundingClientRect[side] === 0 ||\n entry.boundingClientRect[side] > entry.rootBounds[side]\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n entry.target.toggleAttribute(OVERFLOW_ATTR, isTarget(entry))\n })\n\n overflowedElements = document.querySelectorAll(`[${OVERFLOW_ATTR}]`)\n log('overflowedElements:', overflowedElements.length)\n onChange()\n }\n\n const observer = new IntersectionObserver(callback, observerOptions)\n\n return (nodeList) =>\n nodeList.forEach((el) => {\n if (observedElements.has(el)) return\n observer.observe(el)\n observedElements.add(el)\n })\n}\n\nexport const isOverflowed = () => overflowedElements.length > 0\nexport const getOverflowedElements = () => overflowedElements\n","import { advise, info, log } from './log'\n\nconst SECOND = 1000\nconst DEC_PLACES = 100_000 // 5 decimal places\nconst PERF_CHECK_INTERVAL = 5 * SECOND\nconst THRESHOLD = 4 // ms\n\nexport const PREF_START = '--ifr-start'\nexport const PREF_END = '--ifr-end'\nconst PREF_MEASURE = '--ifr-measure'\n\nconst timings = []\nconst usedTags = new WeakSet()\n\nconst addUsedTag = (el) => typeof el === 'object' && usedTags.add(el)\nconst round = (num) => Math.floor(num * DEC_PLACES) / DEC_PLACES\n\nlet lastPerfEl = null\nlet perfEl = null\nlet details = {}\n\nexport const setPerfEl = (el) => {\n perfEl = el\n}\n\nfunction usedEl(detail, duration) {\n // eslint-disable-next-line no-unused-vars\n const { Side, len, hasTags, logging } = detail\n\n details = detail\n\n if (usedTags.has(perfEl) || lastPerfEl === perfEl || (hasTags && len <= 1)) {\n return\n }\n\n if (!logging) addUsedTag(perfEl)\n\n lastPerfEl = perfEl\n\n info(\n `\\n${Side} position calculated from:\\n`,\n perfEl,\n `\\nParsed ${len} ${hasTags ? 'tagged' : 'potentially overflowing'} elements in ${round(duration)}ms`,\n )\n}\n\nconst timingCheck = setInterval(() => {\n if (timings.length < 10) return\n if (details.hasTags && details.len < 25) return\n\n timings.sort()\n\n const average = Math.min(\n timings.reduce((a, b) => a + b, 0) / timings.length,\n timings[Math.floor(timings.length / 2)],\n )\n\n // console.info('Timings:', JSON.parse(JSON.stringify(timings)))\n // console.info('Mean time:', timings[Math.floor(timings.length / 2)])\n // console.info(\n // 'Median time:',\n // timings.reduce((a, b) => a + b, 0) / timings.length,\n // )\n // console.info('Average time:', round(average), average)\n\n log('Max time:', Math.max(...timings))\n\n if (average <= THRESHOLD) return\n\n clearInterval(timingCheck)\n\n advise(\n `<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${round(average)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${details.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`,\n )\n}, PERF_CHECK_INTERVAL)\n\nfunction perfObserver(list) {\n list.getEntries().forEach((entry) => {\n if (entry.name === PREF_END) {\n const { duration } = performance.measure(\n PREF_MEASURE,\n PREF_START,\n PREF_END,\n )\n usedEl(entry.detail, duration)\n timings.push(duration)\n if (timings.length > 100) timings.shift()\n }\n })\n}\n\nfunction setup() {\n const observer = new PerformanceObserver(perfObserver)\n observer.observe({ entryTypes: ['mark'] })\n\n addUsedTag(document.documentElement)\n addUsedTag(document.body)\n}\n\nif (\n // Guard against everything, as we don't control where and when we are loaded\n typeof document !== 'undefined' &&\n typeof PerformanceObserver !== 'undefined'\n) {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', setup)\n } else {\n setup()\n }\n}\n","import {\n BASE,\n HEIGHT_EDGE,\n SIZE_ATTR,\n VERSION,\n WIDTH_EDGE,\n} from '../common/consts'\nimport { addEventListener, removeEventListener } from '../common/listeners'\nimport { getModeData } from '../common/mode'\nimport { id, once } from '../common/utils'\nimport {\n advise,\n adviser,\n capitalizeFirstLetter,\n getElementName,\n // eslint-disable-next-line no-unused-vars\n info,\n log,\n setLogOptions,\n warn,\n} from './log'\nimport {\n getOverflowedElements,\n isOverflowed,\n overflowObserver,\n} from './overflow'\nimport { PREF_END, PREF_START, setPerfEl } from './perf'\n\nfunction iframeResizerChild() {\n const checkVisibilityOptions = {\n contentVisibilityAuto: true,\n opacityProperty: true,\n visibilityProperty: true,\n }\n const customCalcMethods = {\n height: () => {\n warn('Custom height calculation function not defined')\n return getHeight.auto()\n },\n width: () => {\n warn('Custom width calculation function not defined')\n return getWidth.auto()\n },\n }\n const deprecatedResizeMethods = {\n bodyOffset: 1,\n bodyScroll: 1,\n offset: 1,\n documentElementOffset: 1,\n documentElementScroll: 1,\n documentElementBoundingClientRect: 1,\n max: 1,\n min: 1,\n grow: 1,\n lowestElement: 1,\n }\n const eventCancelTimer = 128\n const eventHandlersByName = {}\n const hasCheckVisibility = 'checkVisibility' in window\n const heightCalcModeDefault = 'auto'\n // const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)\n const nonLoggableTriggerEvents = { reset: 1, resetPage: 1, init: 1 }\n const msgID = '[iFrameSizer]' // Must match host page msg ID\n const msgIdLen = msgID.length\n const resetRequiredMethods = {\n max: 1,\n min: 1,\n bodyScroll: 1,\n documentElementScroll: 1,\n }\n const resizeObserveTargets = ['body']\n const widthCalcModeDefault = 'scroll'\n\n let autoResize = true\n let bodyBackground = ''\n let bodyMargin = 0\n let bodyMarginStr = ''\n let bodyObserver = null\n let bodyPadding = ''\n let calculateHeight = true\n let calculateWidth = false\n let firstRun = true\n let hasTags = false\n let height = 1\n let heightCalcMode = heightCalcModeDefault // only applies if not provided by host page (V1 compatibility)\n let initLock = true\n let initMsg = ''\n let inPageLinks = {}\n let logging = false\n let licenseKey = '' // eslint-disable-line no-unused-vars\n let mode = 0\n let mouseEvents = false\n let myID = ''\n let offsetHeight\n let offsetWidth\n let observeOverflow = id\n let resizeFrom = 'child'\n let resizeObserver = null\n let sameDomain = false\n let sizeSelector = ''\n let taggedElements = []\n let target = window.parent\n let targetOriginDefault = '*'\n let tolerance = 0\n let triggerLocked = false\n let version = ''\n let width = 1\n let widthCalcMode = widthCalcModeDefault\n let win = window\n\n let onMessage = () => {\n warn('onMessage function not defined')\n }\n let onReady = () => {}\n let onPageInfo = null\n let onParentInfo = null\n\n function init() {\n readDataFromParent()\n readDataFromPage()\n\n log(`Initialising iFrame v${VERSION} (${window.location.href})`)\n\n setLogOptions({ id: myID, logging })\n\n checkCrossDomain()\n checkMode()\n checkVersion()\n checkHeightMode()\n checkWidthMode()\n checkDeprecatedAttrs()\n\n checkAndSetupTags()\n\n setupObserveOverflow()\n setupPublicMethods()\n setupMouseEvents()\n inPageLinks = setupInPageLinks()\n\n addOverflowObservers(getAllElements(document)())\n\n setMargin()\n setBodyStyle('background', bodyBackground)\n setBodyStyle('padding', bodyPadding)\n\n injectClearFixIntoBodyElement()\n stopInfiniteResizingOfIFrame()\n applySizeSelector()\n }\n\n // Continue init after intersection observer has been setup\n const initContinue = () => {\n sendSize(\n 'init',\n 'Init message from host page',\n undefined,\n undefined,\n VERSION,\n )\n sendTitle()\n initEventListeners()\n onReady()\n\n log('Initialization complete')\n log('---')\n }\n\n function setupObserveOverflow() {\n if (calculateHeight === calculateWidth) return\n observeOverflow = overflowObserver({\n onChange: once(initContinue),\n side: calculateHeight ? HEIGHT_EDGE : WIDTH_EDGE,\n })\n }\n\n function checkAndSetupTags() {\n taggedElements = document.querySelectorAll(`[${SIZE_ATTR}]`)\n hasTags = taggedElements.length > 0\n log(`Tagged elements found: ${hasTags}`)\n }\n\n function addOverflowObservers(nodeList) {\n if (hasTags) setTimeout(initContinue)\n else observeOverflow(nodeList)\n }\n\n function sendTitle() {\n if (document.title && document.title !== '') {\n sendMsg(0, 0, 'title', document.title)\n }\n }\n\n function checkVersion() {\n if (!version || version === '' || version === 'false') {\n advise(\n `<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`,\n )\n return\n }\n\n if (version !== VERSION) {\n advise(\n `<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${version} - Child page: ${VERSION}.\n`,\n )\n }\n }\n\n function checkCrossDomain() {\n try {\n sameDomain = 'iframeParentListener' in window.parent\n } catch (error) {\n log('Cross domain iframe detected.')\n }\n }\n\n // eslint-disable-next-line sonarjs/cognitive-complexity\n function readDataFromParent() {\n const strBool = (str) => str === 'true'\n const data = initMsg.slice(msgIdLen).split(':')\n\n myID = data[0] // eslint-disable-line prefer-destructuring\n bodyMargin = undefined === data[1] ? bodyMargin : Number(data[1]) // For V1 compatibility\n calculateWidth = undefined === data[2] ? calculateWidth : strBool(data[2])\n logging = undefined === data[3] ? logging : strBool(data[3])\n // data[4] no longer used (was intervalTimer)\n autoResize = undefined === data[6] ? autoResize : strBool(data[6])\n bodyMarginStr = data[7] // eslint-disable-line prefer-destructuring\n heightCalcMode = undefined === data[8] ? heightCalcMode : data[8]\n bodyBackground = data[9] // eslint-disable-line prefer-destructuring\n bodyPadding = data[10] // eslint-disable-line prefer-destructuring\n tolerance = undefined === data[11] ? tolerance : Number(data[11])\n inPageLinks.enable = undefined === data[12] ? false : strBool(data[12])\n resizeFrom = undefined === data[13] ? resizeFrom : data[13]\n widthCalcMode = undefined === data[14] ? widthCalcMode : data[14]\n mouseEvents = undefined === data[15] ? mouseEvents : strBool(data[15])\n offsetHeight = undefined === data[16] ? offsetHeight : Number(data[16])\n offsetWidth = undefined === data[17] ? offsetWidth : Number(data[17])\n calculateHeight =\n undefined === data[18] ? calculateHeight : strBool(data[18])\n licenseKey = data[19] // eslint-disable-line prefer-destructuring\n version = data[20] || version\n mode = undefined === data[21] ? mode : Number(data[21])\n // sizeSelector = data[22] || sizeSelector\n }\n\n function readDataFromPage() {\n // eslint-disable-next-line sonarjs/cognitive-complexity\n function readData() {\n const data = window.iframeResizer || window.iFrameResizer\n\n log(`Reading data from page: ${JSON.stringify(data)}`)\n\n onMessage = data?.onMessage || onMessage\n onReady = data?.onReady || onReady\n\n if (typeof data?.offset === 'number') {\n advise(\n `<rb>Deprecated option</>\\n\\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.`,\n )\n if (calculateHeight) offsetHeight = data?.offset\n if (calculateWidth) offsetWidth = data?.offset\n }\n\n if (typeof data?.offsetSize === 'number') {\n if (calculateHeight) offsetHeight = data?.offsetSize\n if (calculateWidth) offsetWidth = data?.offsetSize\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'sizeSelector')) {\n sizeSelector = data.sizeSelector\n }\n\n targetOriginDefault = data?.targetOrigin || targetOriginDefault\n heightCalcMode = data?.heightCalculationMethod || heightCalcMode\n widthCalcMode = data?.widthCalculationMethod || widthCalcMode\n }\n\n function setupCustomCalcMethods(calcMode, calcFunc) {\n if (typeof calcMode === 'function') {\n log(`Setup custom ${calcFunc}CalcMethod`)\n customCalcMethods[calcFunc] = calcMode\n calcMode = 'custom'\n }\n\n return calcMode\n }\n\n if (mode === 1) return\n\n if (\n 'iFrameResizer' in window &&\n Object === window.iFrameResizer.constructor\n ) {\n readData()\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\n }\n\n log(`TargetOrigin for parent set to: ${targetOriginDefault}`)\n }\n\n function chkCSS(attr, value) {\n if (value.includes('-')) {\n warn(`Negative CSS value ignored for ${attr}`)\n value = ''\n }\n\n return value\n }\n\n function setBodyStyle(attr, value) {\n if (undefined !== value && value !== '' && value !== 'null') {\n document.body.style.setProperty(attr, value)\n log(`Body ${attr} set to \"${value}\"`)\n }\n }\n\n function applySizeSelector() {\n if (sizeSelector === '') return\n\n log(`Applying sizeSelector: ${sizeSelector}`)\n\n document.querySelectorAll(sizeSelector).forEach((el) => {\n log(`Applying data-iframe-size to: ${getElementName(el)}`)\n el.dataset.iframeSize = true\n })\n }\n\n function setMargin() {\n // If called via V1 script, convert bodyMargin from int to str\n if (undefined === bodyMarginStr) {\n bodyMarginStr = `${bodyMargin}px`\n }\n\n setBodyStyle('margin', chkCSS('margin', bodyMarginStr))\n }\n\n function stopInfiniteResizingOfIFrame() {\n const setAutoHeight = (el) =>\n el.style.setProperty('height', 'auto', 'important')\n\n setAutoHeight(document.documentElement)\n setAutoHeight(document.body)\n\n log('HTML & body height set to \"auto !important\"')\n }\n\n function manageTriggerEvent(options) {\n const listener = {\n add(eventName) {\n function handleEvent() {\n sendSize(options.eventName, options.eventType)\n }\n\n eventHandlersByName[eventName] = handleEvent\n\n addEventListener(window, eventName, handleEvent, { passive: true })\n },\n remove(eventName) {\n const handleEvent = eventHandlersByName[eventName]\n delete eventHandlersByName[eventName]\n\n removeEventListener(window, eventName, handleEvent)\n },\n }\n\n listener[options.method](options.eventName)\n\n log(\n `${capitalizeFirstLetter(options.method)} event listener: ${\n options.eventType\n }`,\n )\n }\n\n function manageEventListeners(method) {\n manageTriggerEvent({\n method,\n eventType: 'After Print',\n eventName: 'afterprint',\n })\n\n manageTriggerEvent({\n method,\n eventType: 'Before Print',\n eventName: 'beforeprint',\n })\n\n manageTriggerEvent({\n method,\n eventType: 'Ready State Change',\n eventName: 'readystatechange',\n })\n }\n\n function checkDeprecatedAttrs() {\n let found = false\n\n const checkAttrs = (attr) =>\n document.querySelectorAll(`[${attr}]`).forEach((el) => {\n found = true\n el.removeAttribute(attr)\n el.toggleAttribute(SIZE_ATTR, true)\n })\n\n checkAttrs('data-iframe-height')\n checkAttrs('data-iframe-width')\n\n if (found) {\n advise(\n `<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</>.`,\n )\n }\n }\n\n function checkCalcMode(calcMode, calcModeDefault, modes, type) {\n if (calcModeDefault !== calcMode) {\n if (!(calcMode in modes)) {\n warn(`${calcMode} is not a valid option for ${type}CalculationMethod.`)\n calcMode = calcModeDefault\n }\n if (calcMode in deprecatedResizeMethods) {\n advise(\n `<rb>Deprecated ${type}CalculationMethod (${calcMode})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${type} calculation method. It is recommended that you remove this option.`,\n )\n }\n log(`${type} calculation method set to \"${calcMode}\"`)\n }\n\n return calcMode\n }\n\n function checkHeightMode() {\n heightCalcMode = checkCalcMode(\n heightCalcMode,\n heightCalcModeDefault,\n getHeight,\n 'height',\n )\n }\n\n function checkWidthMode() {\n widthCalcMode = checkCalcMode(\n widthCalcMode,\n widthCalcModeDefault,\n getWidth,\n 'width',\n )\n }\n\n function checkMode() {\n if (mode < 0) return adviser(`${getModeData(mode + 2)}${getModeData(2)}`)\n if (version.codePointAt(0) > 4) return mode\n if (mode < 2) return adviser(getModeData(3))\n return mode\n }\n\n function initEventListeners() {\n if (autoResize !== true) {\n log('Auto Resize disabled')\n return\n }\n\n manageEventListeners('add')\n setupMutationObserver()\n setupResizeObserver()\n }\n\n function stopEventListeners() {\n manageEventListeners('remove')\n resizeObserver?.disconnect()\n bodyObserver?.disconnect()\n }\n\n function injectClearFixIntoBodyElement() {\n const clearFix = document.createElement('div')\n\n clearFix.style.clear = 'both'\n // Guard against the following having been globally redefined in CSS.\n clearFix.style.display = 'block'\n clearFix.style.height = '0'\n document.body.append(clearFix)\n }\n\n function setupInPageLinks() {\n const getPagePosition = () => ({\n x: document.documentElement.scrollLeft,\n y: document.documentElement.scrollTop,\n })\n\n function getElementPosition(el) {\n const elPosition = el.getBoundingClientRect()\n const pagePosition = getPagePosition()\n\n return {\n x: parseInt(elPosition.left, BASE) + parseInt(pagePosition.x, BASE),\n y: parseInt(elPosition.top, BASE) + parseInt(pagePosition.y, BASE),\n }\n }\n\n function findTarget(location) {\n function jumpToTarget(target) {\n const jumpPosition = getElementPosition(target)\n\n log(\n `Moving to in page link (#${hash}) at x: ${jumpPosition.x}y: ${jumpPosition.y}`,\n )\n\n sendMsg(jumpPosition.y, jumpPosition.x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n }\n\n const hash = location.split('#')[1] || location // Remove # if present\n const hashData = decodeURIComponent(hash)\n const target =\n document.getElementById(hashData) ||\n document.getElementsByName(hashData)[0]\n\n if (target !== undefined) {\n jumpToTarget(target)\n return\n }\n\n log(`In page link (#${hash}) not found in iFrame, so sending to parent`)\n sendMsg(0, 0, 'inPageLink', `#${hash}`)\n }\n\n function checkLocationHash() {\n const { hash, href } = window.location\n\n if (hash !== '' && hash !== '#') {\n findTarget(href)\n }\n }\n\n function bindAnchors() {\n function setupLink(el) {\n function linkClicked(e) {\n e.preventDefault()\n\n findTarget(this.getAttribute('href'))\n }\n\n if (el.getAttribute('href') !== '#') {\n addEventListener(el, 'click', linkClicked)\n }\n }\n\n document.querySelectorAll('a[href^=\"#\"]').forEach(setupLink)\n }\n\n function bindLocationHash() {\n addEventListener(window, 'hashchange', checkLocationHash)\n }\n\n function initCheck() {\n // Check if page loaded with location hash after init resize\n setTimeout(checkLocationHash, eventCancelTimer)\n }\n\n function enableInPageLinks() {\n log('Setting up location.hash handlers')\n bindAnchors()\n bindLocationHash()\n initCheck()\n }\n\n if (inPageLinks.enable) {\n if (mode === 1) {\n advise(\n `In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details.`,\n )\n } else {\n enableInPageLinks()\n }\n } else {\n log('In page linking not enabled')\n }\n\n return {\n findTarget,\n }\n }\n\n function setupMouseEvents() {\n if (mouseEvents !== true) return\n\n function sendMouse(e) {\n sendMsg(0, 0, e.type, `${e.screenY}:${e.screenX}`)\n }\n\n function addMouseListener(evt, name) {\n log(`Add event listener: ${name}`)\n addEventListener(window.document, evt, sendMouse)\n }\n\n addMouseListener('mouseenter', 'Mouse Enter')\n addMouseListener('mouseleave', 'Mouse Leave')\n }\n\n function setupPublicMethods() {\n if (mode === 1) return\n\n win.parentIframe = Object.freeze({\n autoResize: (resize) => {\n if (resize === true && autoResize === false) {\n autoResize = true\n initEventListeners()\n } else if (resize === false && autoResize === true) {\n autoResize = false\n stopEventListeners()\n }\n\n sendMsg(0, 0, 'autoResize', JSON.stringify(autoResize))\n\n return autoResize\n },\n\n close() {\n sendMsg(0, 0, 'close')\n },\n\n getId: () => myID,\n\n getPageInfo(callback) {\n if (typeof callback === 'function') {\n onPageInfo = callback\n sendMsg(0, 0, 'pageInfo')\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n return\n }\n\n onPageInfo = null\n sendMsg(0, 0, 'pageInfoStop')\n },\n\n getParentProps(callback) {\n if (typeof callback !== 'function') {\n throw new TypeError(\n 'parentIFrame.getParentProps(callback) callback not a function',\n )\n }\n\n onParentInfo = callback\n sendMsg(0, 0, 'parentInfo')\n\n return () => {\n onParentInfo = null\n sendMsg(0, 0, 'parentInfoStop')\n }\n },\n\n getParentProperties(callback) {\n advise(\n `<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n this.getParentProps(callback)\n },\n\n moveToAnchor(hash) {\n inPageLinks.findTarget(hash)\n },\n\n reset() {\n resetIFrame('parentIFrame.reset')\n },\n\n scrollBy(x, y) {\n sendMsg(y, x, 'scrollBy') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollTo(x, y) {\n sendMsg(y, x, 'scrollTo') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollToOffset(x, y) {\n sendMsg(y, x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n },\n\n sendMessage(msg, targetOrigin) {\n sendMsg(0, 0, 'message', JSON.stringify(msg), targetOrigin)\n },\n\n setHeightCalculationMethod(heightCalculationMethod) {\n heightCalcMode = heightCalculationMethod\n checkHeightMode()\n },\n\n setWidthCalculationMethod(widthCalculationMethod) {\n widthCalcMode = widthCalculationMethod\n checkWidthMode()\n },\n\n setTargetOrigin(targetOrigin) {\n log(`Set targetOrigin: ${targetOrigin}`)\n targetOriginDefault = targetOrigin\n },\n\n resize(customHeight, customWidth) {\n const valString = `${customHeight || ''}${customWidth ? `,${customWidth}` : ''}`\n\n sendSize(\n 'size',\n `parentIFrame.size(${valString})`,\n customHeight,\n customWidth,\n )\n },\n\n size(customHeight, customWidth) {\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n this.resize(customHeight, customWidth)\n },\n })\n\n win.parentIFrame = win.parentIframe\n }\n\n let dispatchResized\n\n function resizeObserved(entries) {\n if (!Array.isArray(entries) || entries.length === 0) return\n\n const el = entries[0].target\n\n dispatchResized = () =>\n sendSize('resizeObserver', `Resize Observed: ${getElementName(el)}`)\n\n // Throttle event to once per current call stack (Safari issue)\n setTimeout(() => {\n if (dispatchResized) dispatchResized()\n dispatchResized = undefined\n }, 0)\n }\n\n const checkPositionType = (element) => {\n const style = getComputedStyle(element)\n return style?.position !== '' && style?.position !== 'static'\n }\n\n const getAllNonStaticElements = () =>\n [...getAllElements(document)()].filter(checkPositionType)\n\n const resizeSet = new WeakSet()\n\n function setupResizeObservers(el) {\n if (!el) return\n if (resizeSet.has(el)) return\n resizeObserver.observe(el)\n resizeSet.add(el)\n log(`Attached resizeObserver: ${getElementName(el)}`)\n }\n\n function createResizeObservers(el) {\n ;[\n ...getAllNonStaticElements(),\n ...resizeObserveTargets.flatMap((target) => el.querySelector(target)),\n ].forEach(setupResizeObservers)\n }\n\n function setupResizeObserver() {\n resizeObserver = new ResizeObserver(resizeObserved)\n createResizeObservers(window.document)\n }\n\n function setupBodyMutationObserver() {\n const observedMutations = new Set()\n let pending = false\n let perfMon = 0\n let newMutations = []\n\n const updateMutation = (mutations) => {\n const { length } = mutations\n\n for (let i = 0; i < length; i++) {\n const { addedNodes, removedNodes } = mutations[i]\n\n const aLen = addedNodes.length\n const rLen = removedNodes.length\n\n if (aLen > 2) {\n log('MutationObserver: addedNodes', addedNodes)\n }\n\n if (aLen) {\n for (let j = 0; j < aLen; j++) {\n observedMutations.add(addedNodes[j])\n }\n }\n\n if (rLen) {\n for (let j = 0; j < rLen; j++) {\n observedMutations.delete(removedNodes[j])\n }\n }\n }\n }\n\n const DELAY = 16 // Corresponds to 60fps\n const DELAY_MARGIN = 2\n const DELAY_MAX = 200\n\n let delayCount = 1\n\n function processMutations() {\n const now = performance.now()\n const delay = now - perfMon\n const delayLimit = DELAY * delayCount++ + DELAY_MARGIN\n\n // Back off if the callStack is busy with other stuff\n if (delay > delayLimit && delay < DELAY_MAX) {\n log(`MutationObserver delay: ${delay}ms > ${delayLimit}`)\n setTimeout(processMutations, DELAY * delayCount)\n perfMon = now\n return\n }\n\n delayCount = 1\n\n newMutations.forEach(updateMutation)\n newMutations = []\n\n if (observedMutations.size === 0) {\n pending = false\n return\n }\n\n // apply sizeSelector to new elements\n applySizeSelector()\n\n // Rebuild tagged elements list for size calculation\n checkAndSetupTags()\n\n // Add observers to new elements\n addOverflowObservers(observedMutations)\n observedMutations.forEach(createResizeObservers)\n\n observedMutations.clear()\n\n pending = false\n }\n\n function mutationObserved(mutations) {\n newMutations.push(mutations)\n if (pending) return\n\n perfMon = performance.now()\n pending = true\n requestAnimationFrame(processMutations)\n }\n\n function createMutationObserver() {\n const observer = new window.MutationObserver(mutationObserved)\n const target = document.querySelector('body')\n const config = {\n attributes: false,\n attributeOldValue: false,\n characterData: false,\n characterDataOldValue: false,\n childList: true,\n subtree: true,\n }\n\n log('Create <body/> MutationObserver')\n observer.observe(target, config)\n\n return observer\n }\n\n const observer = createMutationObserver()\n\n return {\n disconnect() {\n log('Disconnect MutationObserver')\n observer.disconnect()\n },\n }\n }\n\n function setupMutationObserver() {\n bodyObserver = setupBodyMutationObserver()\n }\n\n function getMaxElement(side) {\n performance.mark(PREF_START)\n\n const Side = capitalizeFirstLetter(side)\n\n let elVal = 0\n let maxEl = document.documentElement\n let maxVal = hasTags\n ? 0\n : document.documentElement.getBoundingClientRect().bottom\n\n performance.mark(PREF_START)\n\n const targetElements = hasTags\n ? taggedElements\n : isOverflowed()\n ? getOverflowedElements()\n : getAllElements(document)() // We should never get here, but just in case\n\n let len = targetElements.length\n\n targetElements.forEach((element) => {\n if (\n !hasTags &&\n hasCheckVisibility && // Safari missing checkVisibility\n !element.checkVisibility(checkVisibilityOptions)\n ) {\n len -= 1\n return\n }\n\n elVal =\n element.getBoundingClientRect()[side] +\n parseFloat(getComputedStyle(element).getPropertyValue(`margin-${side}`))\n\n if (elVal > maxVal) {\n maxVal = elVal\n maxEl = element\n }\n })\n\n setPerfEl(maxEl)\n performance.mark(PREF_END, {\n detail: {\n Side,\n len,\n hasTags,\n logging,\n },\n })\n\n return maxVal\n }\n\n const getAllMeasurements = (dimension) => [\n dimension.bodyOffset(),\n dimension.bodyScroll(),\n dimension.documentElementOffset(),\n dimension.documentElementScroll(),\n dimension.documentElementBoundingClientRect(),\n ]\n\n const getAllElements = (element) => () =>\n element.querySelectorAll(\n '* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)',\n )\n\n const prevScrollSize = {\n height: 0,\n width: 0,\n }\n\n const prevBoundingSize = {\n height: 0,\n width: 0,\n }\n\n const getAdjustedScroll = (getDimension) =>\n getDimension.documentElementScroll() + Math.max(0, getDimension.getOffset())\n\n function getAutoSize(getDimension) {\n function returnBoundingClientRect() {\n prevBoundingSize[dimension] = boundingSize\n prevScrollSize[dimension] = scrollSize\n return boundingSize\n }\n\n const hasOverflow = isOverflowed()\n const isHeight = getDimension === getHeight\n const dimension = isHeight ? 'height' : 'width'\n const boundingSize = getDimension.documentElementBoundingClientRect()\n const ceilBoundingSize = Math.ceil(boundingSize)\n const floorBoundingSize = Math.floor(boundingSize)\n const scrollSize = getAdjustedScroll(getDimension)\n const sizes = `HTML: ${boundingSize} Page: ${scrollSize}`\n\n switch (true) {\n case !getDimension.enabled():\n return scrollSize\n\n case hasTags:\n return getDimension.taggedElement()\n\n case !hasOverflow &&\n prevBoundingSize[dimension] === 0 &&\n prevScrollSize[dimension] === 0:\n log(`Initial page size values: ${sizes}`)\n return returnBoundingClientRect()\n\n case triggerLocked &&\n boundingSize === prevBoundingSize[dimension] &&\n scrollSize === prevScrollSize[dimension]:\n log(`Size unchanged: ${sizes}`)\n return Math.max(boundingSize, scrollSize)\n\n case boundingSize === 0:\n log(`Page is hidden: ${sizes}`)\n return scrollSize\n\n case !hasOverflow &&\n boundingSize !== prevBoundingSize[dimension] &&\n scrollSize <= prevScrollSize[dimension]:\n log(\n `New HTML bounding size: ${sizes}`,\n 'Previous bounding size:',\n prevBoundingSize[dimension],\n )\n return returnBoundingClientRect()\n\n case !isHeight:\n return getDimension.taggedElement()\n\n case !hasOverflow && boundingSize < prevBoundingSize[dimension]:\n log('HTML bounding size decreased:', sizes)\n return returnBoundingClientRect()\n\n case scrollSize === floorBoundingSize || scrollSize === ceilBoundingSize:\n log('HTML bounding size equals page size:', sizes)\n return returnBoundingClientRect()\n\n case boundingSize > scrollSize:\n log(`Page size < HTML bounding size: ${sizes}`)\n return returnBoundingClientRect()\n\n default:\n log(`Content overflowing HTML element: ${sizes}`)\n }\n\n return Math.max(getDimension.taggedElement(), returnBoundingClientRect())\n }\n\n const getBodyOffset = () => {\n const { body } = document\n const style = getComputedStyle(body)\n\n return (\n body.offsetHeight +\n parseInt(style.marginTop, BASE) +\n parseInt(style.marginBottom, BASE)\n )\n }\n\n const getHeight = {\n enabled: () => calculateHeight,\n getOffset: () => offsetHeight,\n auto: () => getAutoSize(getHeight),\n bodyOffset: getBodyOffset,\n bodyScroll: () => document.body.scrollHeight,\n offset: () => getHeight.bodyOffset(), // Backwards compatibility\n custom: () => customCalcMethods.height(),\n documentElementOffset: () => document.documentElement.offsetHeight,\n documentElementScroll: () => document.documentElement.scrollHeight,\n documentElementBoundingClientRect: () =>\n document.documentElement.getBoundingClientRect().bottom,\n max: () => Math.max(...getAllMeasurements(getHeight)),\n min: () => Math.min(...getAllMeasurements(getHeight)),\n grow: () => getHeight.max(),\n lowestElement: () => getMaxElement(HEIGHT_EDGE),\n taggedElement: () => getMaxElement(HEIGHT_EDGE),\n }\n\n const getWidth = {\n enabled: () => calculateWidth,\n getOffset: () => offsetWidth,\n auto: () => getAutoSize(getWidth),\n bodyScroll: () => document.body.scrollWidth,\n bodyOffset: () => document.body.offsetWidth,\n custom: () => customCalcMethods.width(),\n documentElementScroll: () => document.documentElement.scrollWidth,\n documentElementOffset: () => document.documentElement.offsetWidth,\n documentElementBoundingClientRect: () =>\n document.documentElement.getBoundingClientRect().right,\n max: () => Math.max(...getAllMeasurements(getWidth)),\n min: () => Math.min(...getAllMeasurements(getWidth)),\n rightMostElement: () => getMaxElement(WIDTH_EDGE),\n scroll: () =>\n Math.max(getWidth.bodyScroll(), getWidth.documentElementScroll()),\n taggedElement: () => getMaxElement(WIDTH_EDGE),\n }\n\n function sizeIFrame(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n function resizeIFrame() {\n height = currentHeight\n width = currentWidth\n sendMsg(height, width, triggerEvent, msg)\n }\n\n function isSizeChangeDetected() {\n const checkTolerance = (a, b) => !(Math.abs(a - b) <= tolerance)\n\n // currentHeight = Math.ceil(\n // undefined === customHeight ? getHeight[heightCalcMode]() : customHeight,\n // )\n\n // currentWidth = Math.ceil(\n // undefined === customWidth ? getWidth[widthCalcMode]() : customWidth,\n // )\n\n currentHeight =\n undefined === customHeight ? getHeight[heightCalcMode]() : customHeight\n currentWidth =\n undefined === customWidth ? getWidth[widthCalcMode]() : customWidth\n\n return (\n (calculateHeight && checkTolerance(height, currentHeight)) ||\n (calculateWidth && checkTolerance(width, currentWidth))\n )\n }\n\n const isForceResizableEvent = () => !(triggerEvent in { init: 1, size: 1 })\n\n const isForceResizableCalcMode = () =>\n (calculateHeight && heightCalcMode in resetRequiredMethods) ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n\n function checkDownSizing() {\n if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIFrame(triggerEventDesc)\n }\n }\n\n let currentHeight\n let currentWidth\n\n if (isSizeChangeDetected() || triggerEvent === 'init') {\n lockTrigger()\n resizeIFrame()\n } else {\n checkDownSizing()\n }\n }\n\n function sendSize(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n if (document.hidden) {\n // Currently only correctly supported in firefox\n // This is checked again on the parent page\n log('Page hidden - Ignored resize request')\n return\n }\n\n if (!(triggerEvent in nonLoggableTriggerEvents)) {\n log(`Trigger event: ${triggerEventDesc}`)\n }\n\n sizeIFrame(triggerEvent, triggerEventDesc, customHeight, customWidth, msg)\n }\n\n function lockTrigger() {\n if (triggerLocked) return\n\n triggerLocked = true\n log('Trigger event lock on')\n\n requestAnimationFrame(() => {\n triggerLocked = false\n log('Trigger event lock off')\n log('--')\n })\n }\n\n function triggerReset(triggerEvent) {\n height = getHeight[heightCalcMode]()\n width = getWidth[widthCalcMode]()\n\n sendMsg(height, width, triggerEvent)\n }\n\n function resetIFrame(triggerEventDesc) {\n const hcm = heightCalcMode\n heightCalcMode = heightCalcModeDefault\n\n log(`Reset trigger event: ${triggerEventDesc}`)\n lockTrigger()\n triggerReset('reset')\n\n heightCalcMode = hcm\n }\n\n function sendMsg(height, width, triggerEvent, msg, targetOrigin) {\n if (mode < -1) return\n\n function setTargetOrigin() {\n if (undefined === targetOrigin) {\n targetOrigin = targetOriginDefault\n return\n }\n\n log(`Message targetOrigin: ${targetOrigin}`)\n }\n\n function sendToParent() {\n const size = `${height + (offsetHeight || 0)}:${width + (offsetWidth || 0)}`\n const message = `${myID}:${size}:${triggerEvent}${undefined === msg ? '' : `:${msg}`}`\n\n log(\n `Sending message to host page (${message}) via ${sameDomain ? 'sameDomain' : 'postMessage'}`,\n )\n\n if (sameDomain) {\n window.parent.iframeParentListener(msgID + message)\n return\n }\n\n target.postMessage(msgID + message, targetOrigin)\n }\n\n setTargetOrigin()\n sendToParent()\n }\n\n function receiver(event) {\n const processRequestFromParent = {\n init: function initFromParent() {\n initMsg = event.data\n target = event.source\n\n init()\n firstRun = false\n setTimeout(() => {\n initLock = false\n }, eventCancelTimer)\n },\n\n reset() {\n if (initLock) {\n log('Page reset ignored by init')\n return\n }\n log('Page size reset by host page')\n triggerReset('resetPage')\n },\n\n resize() {\n sendSize('resizeParent', 'Parent window requested size check')\n },\n\n moveToAnchor() {\n inPageLinks.findTarget(getData())\n },\n\n inPageLink() {\n this.moveToAnchor()\n }, // Backward compatibility\n\n pageInfo() {\n const msgBody = getData()\n log(`PageInfo received from parent: ${msgBody}`)\n if (onPageInfo) {\n onPageInfo(JSON.parse(msgBody))\n } else {\n // not expected, so cancel more messages\n sendMsg(0, 0, 'pageInfoStop')\n }\n log(' --')\n },\n\n parentInfo() {\n const msgBody = getData()\n log(`ParentInfo received from parent: ${msgBody}`)\n if (onParentInfo) {\n onParentInfo(Object.freeze(JSON.parse(msgBody)))\n } else {\n // not expected, so cancel more messages\n sendMsg(0, 0, 'parentInfoStop')\n }\n log(' --')\n },\n\n message() {\n const msgBody = getData()\n log(`onMessage called from parent: ${msgBody}`)\n // eslint-disable-next-line sonarjs/no-extra-arguments\n onMessage(JSON.parse(msgBody))\n log(' --')\n },\n }\n\n const isMessageForUs = () => msgID === `${event.data}`.slice(0, msgIdLen)\n\n const getMessageType = () => event.data.split(']')[1].split(':')[0]\n\n const getData = () => event.data.slice(event.data.indexOf(':') + 1)\n\n const isMiddleTier = () =>\n 'iframeResize' in window ||\n (window.jQuery !== undefined && '' in window.jQuery.prototype)\n\n // Test if this message is from a child below us. This is an ugly test, however, updating\n // the message format would break backwards compatibility.\n const isInitMsg = () => event.data.split(':')[2] in { true: 1, false: 1 }\n\n function callFromParent() {\n const messageType = getMessageType()\n\n if (messageType in processRequestFromParent) {\n processRequestFromParent[messageType]()\n return\n }\n\n if (!isMiddleTier() && !isInitMsg()) {\n warn(`Unexpected message (${event.data})`)\n }\n }\n\n function processMessage() {\n if (firstRun === false) {\n callFromParent()\n return\n }\n\n if (isInitMsg()) {\n processRequestFromParent.init()\n return\n }\n\n log(\n `Ignored message of type \"${getMessageType()}\". Received before initialization.`,\n )\n }\n\n if (isMessageForUs()) {\n processMessage()\n }\n }\n\n // Normally the parent kicks things off when it detects the iFrame has loaded.\n // If this script is async-loaded, then tell parent page to retry init.\n function chkLateLoaded() {\n if (document.readyState !== 'loading') {\n window.parent.postMessage('[iFrameResizerChild]Ready', '*')\n }\n }\n\n window.iframeChildListener = (data) => receiver({ data, sameDomain: true })\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n chkLateLoaded()\n\n /* TEST CODE START */\n function mockMsgListener(msgObject) {\n receiver(msgObject)\n return win\n }\n\n try {\n // eslint-disable-next-line no-restricted-globals\n if (top?.document?.getElementById('banner')) {\n win = {}\n\n // Create test hooks\n window.mockMsgListener = mockMsgListener\n\n removeEventListener(window, 'message', receiver)\n\n define([], () => mockMsgListener)\n }\n } catch (error) {\n // do nothing\n }\n\n /* TEST CODE END */\n}\n\n// Don't run for server side render\nif (typeof window !== 'undefined') {\n iframeResizerChild()\n}\n"],"names":["VERSION","BASE","SIZE_ATTR","OVERFLOW_ATTR","HEIGHT_EDGE","WIDTH_EDGE","addEventListener","el","evt","func","options","y","Object","fromEntries","map","l","p","Math","max","getModeData","replaceAll","String","fromCodePoint","codePointAt","once","fn","done","undefined","Reflect","apply","this","arguments","id","x","logging","setLogOptions","capitalizeFirstLetter","string","charAt","toUpperCase","slice","isDef","value","getElementName","nodeName","name","className","formatLogMsg","msg","join","log","console","info","warn","advise","window","chrome","formatAdvise","adviser","overflowedElements","overflowObserver","side","onChange","observerOptions","root","document","documentElement","rootMargin","threshold","observedElements","WeakSet","observer","IntersectionObserver","entries","forEach","entry","target","toggleAttribute","boundingClientRect","rootBounds","isTarget","querySelectorAll","length","nodeList","has","observe","add","isOverflowed","DEC_PLACES","PREF_START","PREF_END","PREF_MEASURE","timings","usedTags","addUsedTag","round","num","floor","lastPerfEl","perfEl","details","timingCheck","setInterval","hasTags","len","sort","average","min","reduce","a","b","clearInterval","Side","toLowerCase","perfObserver","list","getEntries","duration","performance","measure","detail","usedEl","push","shift","setup","PerformanceObserver","entryTypes","body","readyState","checkVisibilityOptions","contentVisibilityAuto","opacityProperty","visibilityProperty","customCalcMethods","height","getHeight","auto","width","getWidth","deprecatedResizeMethods","bodyOffset","bodyScroll","offset","documentElementOffset","documentElementScroll","documentElementBoundingClientRect","grow","lowestElement","eventCancelTimer","eventHandlersByName","hasCheckVisibility","heightCalcModeDefault","nonLoggableTriggerEvents","reset","resetPage","init","msgID","msgIdLen","resetRequiredMethods","resizeObserveTargets","widthCalcModeDefault","offsetHeight","offsetWidth","autoResize","bodyBackground","bodyMargin","bodyMarginStr","bodyObserver","bodyPadding","calculateHeight","calculateWidth","firstRun","heightCalcMode","initLock","initMsg","inPageLinks","mode","mouseEvents","myID","observeOverflow","resizeFrom","resizeObserver","sameDomain","sizeSelector","taggedElements","parent","targetOriginDefault","tolerance","triggerLocked","version","widthCalcMode","win","onMessage","onReady","onPageInfo","onParentInfo","attr","strBool","str","data","split","Number","enable","readDataFromParent","readData","iframeResizer","iFrameResizer","JSON","stringify","offsetSize","prototype","hasOwnProperty","call","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","constructor","readDataFromPage","location","href","error","checkCrossDomain","checkHeightMode","checkWidthMode","found","checkAttrs","removeAttribute","checkDeprecatedAttrs","checkAndSetupTags","initContinue","parentIframe","freeze","resize","initEventListeners","manageEventListeners","disconnect","sendMsg","close","getId","getPageInfo","callback","getParentProps","TypeError","getParentProperties","moveToAnchor","hash","findTarget","resetIFrame","scrollBy","scrollTo","scrollToOffset","sendMessage","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","customHeight","customWidth","sendSize","size","parentIFrame","sendMouse","e","type","screenY","screenX","addMouseListener","setupMouseEvents","getPagePosition","scrollLeft","scrollTop","getElementPosition","elPosition","getBoundingClientRect","pagePosition","parseInt","left","top","jumpToTarget","jumpPosition","hashData","decodeURIComponent","getElementById","getElementsByName","checkLocationHash","bindAnchors","setupLink","linkClicked","preventDefault","getAttribute","bindLocationHash","initCheck","setTimeout","enableInPageLinks","setupInPageLinks","addOverflowObservers","getAllElements","setBodyStyle","includes","clearFix","createElement","style","clear","display","append","injectClearFixIntoBodyElement","setAutoHeight","setProperty","stopInfiniteResizingOfIFrame","applySizeSelector","title","dataset","iframeSize","manageTriggerEvent","eventName","handleEvent","eventType","passive","remove","removeEventListener","method","checkCalcMode","calcModeDefault","modes","observedMutations","Set","pending","perfMon","newMutations","updateMutation","mutations","i","addedNodes","removedNodes","aLen","rLen","j","delete","DELAY","DELAY_MARGIN","DELAY_MAX","delayCount","processMutations","now","delay","delayLimit","createResizeObservers","mutationObserved","requestAnimationFrame","createMutationObserver","MutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","setupBodyMutationObserver","ResizeObserver","resizeObserved","dispatchResized","Array","isArray","checkPositionType","element","getComputedStyle","position","getAllNonStaticElements","filter","resizeSet","setupResizeObservers","flatMap","getMaxElement","mark","elVal","maxEl","maxVal","bottom","targetElements","checkVisibility","parseFloat","getPropertyValue","getAllMeasurements","dimension","prevScrollSize","prevBoundingSize","getAutoSize","getDimension","returnBoundingClientRect","boundingSize","scrollSize","hasOverflow","isHeight","ceilBoundingSize","ceil","floorBoundingSize","getOffset","getAdjustedScroll","sizes","enabled","taggedElement","marginTop","marginBottom","scrollHeight","custom","scrollWidth","right","rightMostElement","scroll","sizeIFrame","triggerEvent","triggerEventDesc","currentHeight","currentWidth","checkTolerance","abs","isSizeChangeDetected","lockTrigger","hidden","triggerReset","hcm","message","iframeParentListener","postMessage","sendToParent","receiver","event","processRequestFromParent","source","getData","inPageLink","pageInfo","msgBody","parse","parentInfo","getMessageType","indexOf","isMiddleTier","jQuery","isInitMsg","true","false","messageType","callFromParent","chkLateLoaded","iframeChildListener","iframeResizerChild"],"mappings":";;;;;;;;;;;;;;;;;;;aAAO,MAAMA,EAAU,eAEVC,EAAO,GAGPC,EAAY,mBACZC,EAAgB,uBAEhBC,EAAc,SACdC,EAAa,QCTbC,EAAmB,CAACC,EAAIC,EAAKC,EAAMC,IAC9CH,EAAGD,iBAAiBE,EAAKC,EAAMC,IAAW,GCqB1CC,EAAI,CACF,yCACA,yCACA,qnBACA,0jBAGEC,OAAOC,YACT,CACE,cACA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H,IAChB/X,EAAI,iCAAiCkY,KAErCpP,GAAUe,KAAKsO,MAAMD,IACrBlY,EAAI,MACL,GAKGqY,EAAiB,IAAMT,EAAMvO,KAAKC,MAAM,KAAK,GAAGA,MAAM,KAAK,GAE3DyO,EAAU,IAAMH,EAAMvO,KAAK/J,MAAMsY,EAAMvO,KAAKiP,QAAQ,KAAO,GAE3DC,EAAe,IACnB,iBAAkBlY,aACC5B,IAAlB4B,OAAOmY,QAAwB,KAAMnY,OAAOmY,OAAOxO,UAIhDyO,EAAY,IAAMb,EAAMvO,KAAKC,MAAM,KAAK,IAAM,CAAEoP,KAAM,EAAGC,MAAO,GAZzCjS,IAAU,GAAGkR,EAAMvO,OAAO/J,MAAM,EAAGqH,MA4B7C,IAAbc,EAKAgR,IACFZ,EAAyBpR,OAI3BzG,EACE,4BAA4BqY,yCAzBhC,WACE,MAAMO,EAAcP,IAEhBO,KAAef,EACjBA,EAAyBe,KAItBL,KAAmBE,KACtBtY,EAAK,uBAAuByX,EAAMvO,QAErC,CAIGwP,GAiBL,CAID,SAASC,KACqB,YAAxB/X,SAAS+D,YACXzE,OAAOkI,OAAOkP,YAAY,4BAA6B,IAE1D,CAEDpX,OAAO0Y,oBAAuB1P,GAASsO,GAAS,CAAEtO,OAAMjB,YAAY,IACpEhL,EAAiBiD,OAAQ,UAAWsX,IACpCva,EAAiBiD,OAAQ,mBAAoByY,IAC7CA,IAEF,CAIEE"}
package/index.esm.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../packages/common/consts.js","../../packages/common/listeners.js","../../packages/common/mode.js","../../packages/common/utils.js","../../packages/child/log.js","../../packages/common/format-advise.js","../../packages/child/overflow.js","../../packages/child/perf.js","../../packages/child/index.js"],"sourcesContent":["export const VERSION = '[VI]{version}[/VI]'\n\nexport const BASE = 10\nexport const SINGLE = 1\n\nexport const SIZE_ATTR = 'data-iframe-size'\nexport const OVERFLOW_ATTR = 'data-iframe-overflow'\n\nexport const HEIGHT_EDGE = 'bottom'\nexport const WIDTH_EDGE = 'right'\n\nexport const msgHeader = 'message'\nexport const msgHeaderLen = msgHeader.length\nexport const msgId = '[iFrameSizer]' // Must match iframe msg ID\nexport const msgIdLen = msgId.length\nexport const resetRequiredMethods = Object.freeze({\n max: 1,\n scroll: 1,\n bodyScroll: 1,\n documentElementScroll: 1,\n})\n","export const addEventListener = (el, evt, func, options) =>\n el.addEventListener(evt, func, options || false)\n\nexport const removeEventListener = (el, evt, func) =>\n el.removeEventListener(evt, func, false)\n","const l = (l) => {\n if (!l) return ''\n let p = -559038744,\n y = 1103547984\n for (let z, t = 0; t < l.length; t++)\n (z = l.codePointAt(t)),\n (p = Math.imul(p ^ z, 2246822519)),\n (y = Math.imul(y ^ z, 3266489917))\n return (\n (p ^= Math.imul(p ^ (y >>> 15), 1935289751)),\n (y ^= Math.imul(y ^ (p >>> 15), 3405138345)),\n (p ^= y >>> 16),\n (y ^= p >>> 16),\n (2097152 * (y >>> 0) + (p >>> 11)).toString(36)\n )\n },\n p = (l) =>\n l.replaceAll(/[A-Za-z]/g, (l) =>\n String.fromCodePoint(\n (l <= 'Z' ? 90 : 122) >= (l = l.codePointAt(0) + 19) ? l : l - 26,\n ),\n ),\n y = [\n '<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>',\n '<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>',\n '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</>',\n '<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</>.',\n ],\n z = ['NWSc3', 'zvsv', 'wyv', 'ibzpulzz', 'vlt'],\n t = Object.fromEntries(\n [\n '2cgs7fdf4xb',\n '1c9ctcccr4z',\n '1q2pc4eebgb',\n 'ueokt0969w',\n 'w2zxchhgqz',\n '1umuxblj2e5',\n ].map((l, p) => [l, Math.max(0, p - 1)]),\n )\nexport const getModeData = (l) => p(y[l])\nexport const getModeLabel = (l) => p(z[l])\nexport default (y) => {\n const z = y[p('spjluzl')]\n if (!z) return -1\n const u = z.split('-')\n let v = (function (y = '') {\n let z = -2\n const u = l(p(y))\n return u in t && (z = t[u]), z\n })(u[0])\n return 0 === v || ((p) => p[2] === l(p[0] + p[1]))(u) || (v = -2), v\n}\n","export const isNumber = (value) => !Number.isNaN(value)\n\nexport const once = (fn) => {\n let done = false\n\n return function () {\n return done\n ? undefined\n : ((done = true), Reflect.apply(fn, this, arguments))\n }\n}\n\nexport const id = (x) => x\n","import formatAdvise from '../common/format-advise'\n\nlet id = ''\nlet logging = false\n\nexport const setLogOptions = (options) => {\n id = options.id\n logging = options.logging\n}\n\nexport const capitalizeFirstLetter = (string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nconst isDef = (value) => `${value}` !== '' && value !== undefined\n\nexport function getElementName(el) {\n switch (true) {\n case !isDef(el):\n return ''\n\n case isDef(el.id):\n return `${el.nodeName.toUpperCase()}#${el.id}`\n\n case isDef(el.name):\n return `${el.nodeName.toUpperCase()} (${el.name})`\n\n default:\n return (\n el.nodeName.toUpperCase() +\n (isDef(el.className) ? `.${el.className}` : '')\n )\n }\n}\n\n// function elementSnippet(el, maxChars = 30) {\n// const outer = el?.outerHTML?.toString()\n\n// if (!outer) return el\n\n// return outer.length < maxChars\n// ? outer\n// : `${outer.slice(0, maxChars).replaceAll('\\n', ' ')}...`\n// }\n\n// TODO: remove .join(' '), requires major test updates\nconst formatLogMsg = (...msg) => [`[iframe-resizer][${id}]`, ...msg].join(' ')\n\nexport const log = (...msg) =>\n // eslint-disable-next-line no-console\n logging && console?.log(formatLogMsg(...msg))\n\n// eslint-disable-next-line no-unused-vars\nexport const info = (...msg) =>\n // eslint-disable-next-line no-console\n console?.info(`[iframe-resizer][${id}]`, ...msg)\n\nexport const warn = (...msg) =>\n // eslint-disable-next-line no-console\n console?.warn(formatLogMsg(...msg))\n\nexport const advise = (...msg) =>\n // eslint-disable-next-line no-console\n console?.warn(formatAdvise(formatLogMsg)(...msg))\n\nexport const adviser = (msg) => advise(msg)\n","const encode = (s) =>\n s\n .replaceAll('<br>', '\\n')\n .replaceAll('<rb>', '\\u001B[31;1m')\n .replaceAll('</>', '\\u001B[m')\n .replaceAll('<b>', '\\u001B[1m')\n .replaceAll('<i>', '\\u001B[3m')\n .replaceAll('<u>', '\\u001B[4m')\n\nconst remove = (s) => s.replaceAll('<br>', '\\n').replaceAll(/<[/a-z]+>/gi, '')\n\nexport default (formatLogMsg) => (msg) =>\n window.chrome // Only show formatting in Chrome as not supported in other browsers\n ? formatLogMsg(encode(msg))\n : formatLogMsg(remove(msg))\n","import { HEIGHT_EDGE, OVERFLOW_ATTR } from '../common/consts'\nimport { id } from '../common/utils'\nimport { log } from './log'\n\nlet overflowedElements = []\n\nexport const overflowObserver = (options) => {\n const side = options.side || HEIGHT_EDGE\n const onChange = options.onChange || id\n\n const observerOptions = {\n root: document.documentElement,\n rootMargin: '0px',\n threshold: 1,\n }\n\n const observedElements = new WeakSet()\n\n const isTarget = (entry) =>\n entry.boundingClientRect[side] === 0 ||\n entry.boundingClientRect[side] > entry.rootBounds[side]\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n entry.target.toggleAttribute(OVERFLOW_ATTR, isTarget(entry))\n })\n\n overflowedElements = document.querySelectorAll(`[${OVERFLOW_ATTR}]`)\n log('overflowedElements:', overflowedElements.length)\n onChange()\n }\n\n const observer = new IntersectionObserver(callback, observerOptions)\n\n return (nodeList) =>\n nodeList.forEach((el) => {\n if (observedElements.has(el)) return\n observer.observe(el)\n observedElements.add(el)\n })\n}\n\nexport const isOverflowed = () => overflowedElements.length > 0\nexport const getOverflowedElements = () => overflowedElements\n","import { advise, info, log } from './log'\n\nconst SECOND = 1000\nconst DEC_PLACES = 100_000 // 5 decimal places\nconst PERF_CHECK_INTERVAL = 5 * SECOND\nconst THRESHOLD = 4 // ms\n\nexport const PREF_START = '--ifr-start'\nexport const PREF_END = '--ifr-end'\nconst PREF_MEASURE = '--ifr-measure'\n\nconst timings = []\nconst usedTags = new WeakSet()\n\nconst addUsedTag = (el) => typeof el === 'object' && usedTags.add(el)\nconst round = (num) => Math.floor(num * DEC_PLACES) / DEC_PLACES\n\nlet lastPerfEl = null\nlet perfEl = null\nlet details = {}\n\nexport const setPerfEl = (el) => {\n perfEl = el\n}\n\nfunction usedEl(detail, duration) {\n // eslint-disable-next-line no-unused-vars\n const { Side, len, hasTags, logging } = detail\n\n details = detail\n\n if (usedTags.has(perfEl) || lastPerfEl === perfEl || (hasTags && len <= 1)) {\n return\n }\n\n if (!logging) addUsedTag(perfEl)\n\n lastPerfEl = perfEl\n\n info(\n `\\n${Side} position calculated from:\\n`,\n perfEl,\n `\\nParsed ${len} ${hasTags ? 'tagged' : 'potentially overflowing'} elements in ${round(duration)}ms`,\n )\n}\n\nconst timingCheck = setInterval(() => {\n if (timings.length < 10) return\n if (details.hasTags && details.len < 25) return\n\n timings.sort()\n\n const average = Math.min(\n timings.reduce((a, b) => a + b, 0) / timings.length,\n timings[Math.floor(timings.length / 2)],\n )\n\n // console.info('Timings:', JSON.parse(JSON.stringify(timings)))\n // console.info('Mean time:', timings[Math.floor(timings.length / 2)])\n // console.info(\n // 'Median time:',\n // timings.reduce((a, b) => a + b, 0) / timings.length,\n // )\n // console.info('Average time:', round(average), average)\n\n log('Max time:', Math.max(...timings))\n\n if (average <= THRESHOLD) return\n\n clearInterval(timingCheck)\n\n advise(\n `<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${round(average)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${details.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`,\n )\n}, PERF_CHECK_INTERVAL)\n\nfunction perfObserver(list) {\n list.getEntries().forEach((entry) => {\n if (entry.name === PREF_END) {\n const { duration } = performance.measure(\n PREF_MEASURE,\n PREF_START,\n PREF_END,\n )\n usedEl(entry.detail, duration)\n timings.push(duration)\n if (timings.length > 100) timings.shift()\n }\n })\n}\n\nfunction setup() {\n const observer = new PerformanceObserver(perfObserver)\n observer.observe({ entryTypes: ['mark'] })\n\n addUsedTag(document.documentElement)\n addUsedTag(document.body)\n}\n\nif (\n // Guard against everything, as we don't control where and when we are loaded\n typeof document !== 'undefined' &&\n typeof PerformanceObserver !== 'undefined'\n) {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', setup)\n } else {\n setup()\n }\n}\n","import {\n BASE,\n HEIGHT_EDGE,\n SIZE_ATTR,\n VERSION,\n WIDTH_EDGE,\n} from '../common/consts'\nimport { addEventListener, removeEventListener } from '../common/listeners'\nimport { getModeData } from '../common/mode'\nimport { id, once } from '../common/utils'\nimport {\n advise,\n adviser,\n capitalizeFirstLetter,\n getElementName,\n // eslint-disable-next-line no-unused-vars\n info,\n log,\n setLogOptions,\n warn,\n} from './log'\nimport {\n getOverflowedElements,\n isOverflowed,\n overflowObserver,\n} from './overflow'\nimport { PREF_END, PREF_START, setPerfEl } from './perf'\n\nfunction iframeResizerChild() {\n const checkVisibilityOptions = {\n contentVisibilityAuto: true,\n opacityProperty: true,\n visibilityProperty: true,\n }\n const customCalcMethods = {\n height: () => {\n warn('Custom height calculation function not defined')\n return getHeight.auto()\n },\n width: () => {\n warn('Custom width calculation function not defined')\n return getWidth.auto()\n },\n }\n const deprecatedResizeMethods = {\n bodyOffset: 1,\n bodyScroll: 1,\n offset: 1,\n documentElementOffset: 1,\n documentElementScroll: 1,\n documentElementBoundingClientRect: 1,\n max: 1,\n min: 1,\n grow: 1,\n lowestElement: 1,\n }\n const eventCancelTimer = 128\n const eventHandlersByName = {}\n const hasCheckVisibility = 'checkVisibility' in window\n const heightCalcModeDefault = 'auto'\n // const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)\n const nonLoggableTriggerEvents = { reset: 1, resetPage: 1, init: 1 }\n const msgID = '[iFrameSizer]' // Must match host page msg ID\n const msgIdLen = msgID.length\n const resetRequiredMethods = {\n max: 1,\n min: 1,\n bodyScroll: 1,\n documentElementScroll: 1,\n }\n const resizeObserveTargets = ['body']\n const widthCalcModeDefault = 'scroll'\n\n let autoResize = true\n let bodyBackground = ''\n let bodyMargin = 0\n let bodyMarginStr = ''\n let bodyObserver = null\n let bodyPadding = ''\n let calculateHeight = true\n let calculateWidth = false\n let firstRun = true\n let hasTags = false\n let height = 1\n let heightCalcMode = heightCalcModeDefault // only applies if not provided by host page (V1 compatibility)\n let initLock = true\n let initMsg = ''\n let inPageLinks = {}\n let logging = false\n let licenseKey = '' // eslint-disable-line no-unused-vars\n let mode = 0\n let mouseEvents = false\n let myID = ''\n let offsetHeight\n let offsetWidth\n let observeOverflow = id\n let resizeFrom = 'child'\n let resizeObserver = null\n let sameDomain = false\n let sizeSelector = ''\n let taggedElements = []\n let target = window.parent\n let targetOriginDefault = '*'\n let tolerance = 0\n let triggerLocked = false\n let version = ''\n let width = 1\n let widthCalcMode = widthCalcModeDefault\n let win = window\n\n let onMessage = () => {\n warn('onMessage function not defined')\n }\n let onReady = () => {}\n let onPageInfo = null\n let onParentInfo = null\n\n function init() {\n readDataFromParent()\n readDataFromPage()\n\n log(`Initialising iFrame v${VERSION} (${window.location.href})`)\n\n setLogOptions({ id: myID, logging })\n\n checkCrossDomain()\n checkMode()\n checkVersion()\n checkHeightMode()\n checkWidthMode()\n checkDeprecatedAttrs()\n\n checkAndSetupTags()\n\n setupObserveOverflow()\n setupPublicMethods()\n setupMouseEvents()\n inPageLinks = setupInPageLinks()\n\n addOverflowObservers(getAllElements(document)())\n\n setMargin()\n setBodyStyle('background', bodyBackground)\n setBodyStyle('padding', bodyPadding)\n\n injectClearFixIntoBodyElement()\n stopInfiniteResizingOfIFrame()\n applySizeSelector()\n }\n\n // Continue init after intersection observer has been setup\n const initContinue = () => {\n sendSize(\n 'init',\n 'Init message from host page',\n undefined,\n undefined,\n VERSION,\n )\n sendTitle()\n initEventListeners()\n onReady()\n\n log('Initialization complete')\n log('---')\n }\n\n function setupObserveOverflow() {\n if (calculateHeight === calculateWidth) return\n observeOverflow = overflowObserver({\n onChange: once(initContinue),\n side: calculateHeight ? HEIGHT_EDGE : WIDTH_EDGE,\n })\n }\n\n function checkAndSetupTags() {\n taggedElements = document.querySelectorAll(`[${SIZE_ATTR}]`)\n hasTags = taggedElements.length > 0\n log(`Tagged elements found: ${hasTags}`)\n }\n\n function addOverflowObservers(nodeList) {\n if (hasTags) setTimeout(initContinue)\n else observeOverflow(nodeList)\n }\n\n function sendTitle() {\n if (document.title && document.title !== '') {\n sendMsg(0, 0, 'title', document.title)\n }\n }\n\n function checkVersion() {\n if (!version || version === '' || version === 'false') {\n advise(\n `<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`,\n )\n return\n }\n\n if (version !== VERSION) {\n advise(\n `<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${version} - Child page: ${VERSION}.\n`,\n )\n }\n }\n\n function checkCrossDomain() {\n try {\n sameDomain = 'iframeParentListener' in window.parent\n } catch (error) {\n log('Cross domain iframe detected.')\n }\n }\n\n // eslint-disable-next-line sonarjs/cognitive-complexity\n function readDataFromParent() {\n const strBool = (str) => str === 'true'\n const data = initMsg.slice(msgIdLen).split(':')\n\n myID = data[0] // eslint-disable-line prefer-destructuring\n bodyMargin = undefined === data[1] ? bodyMargin : Number(data[1]) // For V1 compatibility\n calculateWidth = undefined === data[2] ? calculateWidth : strBool(data[2])\n logging = undefined === data[3] ? logging : strBool(data[3])\n // data[4] no longer used (was intervalTimer)\n autoResize = undefined === data[6] ? autoResize : strBool(data[6])\n bodyMarginStr = data[7] // eslint-disable-line prefer-destructuring\n heightCalcMode = undefined === data[8] ? heightCalcMode : data[8]\n bodyBackground = data[9] // eslint-disable-line prefer-destructuring\n bodyPadding = data[10] // eslint-disable-line prefer-destructuring\n tolerance = undefined === data[11] ? tolerance : Number(data[11])\n inPageLinks.enable = undefined === data[12] ? false : strBool(data[12])\n resizeFrom = undefined === data[13] ? resizeFrom : data[13]\n widthCalcMode = undefined === data[14] ? widthCalcMode : data[14]\n mouseEvents = undefined === data[15] ? mouseEvents : strBool(data[15])\n offsetHeight = undefined === data[16] ? offsetHeight : Number(data[16])\n offsetWidth = undefined === data[17] ? offsetWidth : Number(data[17])\n calculateHeight =\n undefined === data[18] ? calculateHeight : strBool(data[18])\n licenseKey = data[19] // eslint-disable-line prefer-destructuring\n version = data[20] || version\n mode = undefined === data[21] ? mode : Number(data[21])\n // sizeSelector = data[22] || sizeSelector\n }\n\n function readDataFromPage() {\n // eslint-disable-next-line sonarjs/cognitive-complexity\n function readData() {\n const data = window.iframeResizer || window.iFrameResizer\n\n log(`Reading data from page: ${JSON.stringify(data)}`)\n\n onMessage = data?.onMessage || onMessage\n onReady = data?.onReady || onReady\n\n if (typeof data?.offset === 'number') {\n advise(\n `<rb>Deprecated option</>\\n\\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.`,\n )\n if (calculateHeight) offsetHeight = data?.offset\n if (calculateWidth) offsetWidth = data?.offset\n }\n\n if (typeof data?.offsetSize === 'number') {\n if (calculateHeight) offsetHeight = data?.offsetSize\n if (calculateWidth) offsetWidth = data?.offsetSize\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'sizeSelector')) {\n sizeSelector = data.sizeSelector\n }\n\n targetOriginDefault = data?.targetOrigin || targetOriginDefault\n heightCalcMode = data?.heightCalculationMethod || heightCalcMode\n widthCalcMode = data?.widthCalculationMethod || widthCalcMode\n }\n\n function setupCustomCalcMethods(calcMode, calcFunc) {\n if (typeof calcMode === 'function') {\n log(`Setup custom ${calcFunc}CalcMethod`)\n customCalcMethods[calcFunc] = calcMode\n calcMode = 'custom'\n }\n\n return calcMode\n }\n\n if (mode === 1) return\n\n if (\n 'iFrameResizer' in window &&\n Object === window.iFrameResizer.constructor\n ) {\n readData()\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\n }\n\n log(`TargetOrigin for parent set to: ${targetOriginDefault}`)\n }\n\n function chkCSS(attr, value) {\n if (value.includes('-')) {\n warn(`Negative CSS value ignored for ${attr}`)\n value = ''\n }\n\n return value\n }\n\n function setBodyStyle(attr, value) {\n if (undefined !== value && value !== '' && value !== 'null') {\n document.body.style.setProperty(attr, value)\n log(`Body ${attr} set to \"${value}\"`)\n }\n }\n\n function applySizeSelector() {\n if (sizeSelector === '') return\n\n log(`Applying sizeSelector: ${sizeSelector}`)\n\n document.querySelectorAll(sizeSelector).forEach((el) => {\n log(`Applying data-iframe-size to: ${getElementName(el)}`)\n el.dataset.iframeSize = true\n })\n }\n\n function setMargin() {\n // If called via V1 script, convert bodyMargin from int to str\n if (undefined === bodyMarginStr) {\n bodyMarginStr = `${bodyMargin}px`\n }\n\n setBodyStyle('margin', chkCSS('margin', bodyMarginStr))\n }\n\n function stopInfiniteResizingOfIFrame() {\n const setAutoHeight = (el) =>\n el.style.setProperty('height', 'auto', 'important')\n\n setAutoHeight(document.documentElement)\n setAutoHeight(document.body)\n\n log('HTML & body height set to \"auto !important\"')\n }\n\n function manageTriggerEvent(options) {\n const listener = {\n add(eventName) {\n function handleEvent() {\n sendSize(options.eventName, options.eventType)\n }\n\n eventHandlersByName[eventName] = handleEvent\n\n addEventListener(window, eventName, handleEvent, { passive: true })\n },\n remove(eventName) {\n const handleEvent = eventHandlersByName[eventName]\n delete eventHandlersByName[eventName]\n\n removeEventListener(window, eventName, handleEvent)\n },\n }\n\n listener[options.method](options.eventName)\n\n log(\n `${capitalizeFirstLetter(options.method)} event listener: ${\n options.eventType\n }`,\n )\n }\n\n function manageEventListeners(method) {\n manageTriggerEvent({\n method,\n eventType: 'After Print',\n eventName: 'afterprint',\n })\n\n manageTriggerEvent({\n method,\n eventType: 'Before Print',\n eventName: 'beforeprint',\n })\n\n manageTriggerEvent({\n method,\n eventType: 'Ready State Change',\n eventName: 'readystatechange',\n })\n }\n\n function checkDeprecatedAttrs() {\n let found = false\n\n const checkAttrs = (attr) =>\n document.querySelectorAll(`[${attr}]`).forEach((el) => {\n found = true\n el.removeAttribute(attr)\n el.toggleAttribute(SIZE_ATTR, true)\n })\n\n checkAttrs('data-iframe-height')\n checkAttrs('data-iframe-width')\n\n if (found) {\n advise(\n `<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</>.`,\n )\n }\n }\n\n function checkCalcMode(calcMode, calcModeDefault, modes, type) {\n if (calcModeDefault !== calcMode) {\n if (!(calcMode in modes)) {\n warn(`${calcMode} is not a valid option for ${type}CalculationMethod.`)\n calcMode = calcModeDefault\n }\n if (calcMode in deprecatedResizeMethods) {\n advise(\n `<rb>Deprecated ${type}CalculationMethod (${calcMode})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${type} calculation method. It is recommended that you remove this option.`,\n )\n }\n log(`${type} calculation method set to \"${calcMode}\"`)\n }\n\n return calcMode\n }\n\n function checkHeightMode() {\n heightCalcMode = checkCalcMode(\n heightCalcMode,\n heightCalcModeDefault,\n getHeight,\n 'height',\n )\n }\n\n function checkWidthMode() {\n widthCalcMode = checkCalcMode(\n widthCalcMode,\n widthCalcModeDefault,\n getWidth,\n 'width',\n )\n }\n\n function checkMode() {\n if (mode < 0) return adviser(`${getModeData(mode + 2)}${getModeData(2)}`)\n if (version.codePointAt(0) > 4) return mode\n if (mode < 2) return adviser(getModeData(3))\n return mode\n }\n\n function initEventListeners() {\n if (autoResize !== true) {\n log('Auto Resize disabled')\n return\n }\n\n manageEventListeners('add')\n setupMutationObserver()\n setupResizeObserver()\n }\n\n function stopEventListeners() {\n manageEventListeners('remove')\n resizeObserver?.disconnect()\n bodyObserver?.disconnect()\n }\n\n function injectClearFixIntoBodyElement() {\n const clearFix = document.createElement('div')\n\n clearFix.style.clear = 'both'\n // Guard against the following having been globally redefined in CSS.\n clearFix.style.display = 'block'\n clearFix.style.height = '0'\n document.body.append(clearFix)\n }\n\n function setupInPageLinks() {\n const getPagePosition = () => ({\n x: document.documentElement.scrollLeft,\n y: document.documentElement.scrollTop,\n })\n\n function getElementPosition(el) {\n const elPosition = el.getBoundingClientRect()\n const pagePosition = getPagePosition()\n\n return {\n x: parseInt(elPosition.left, BASE) + parseInt(pagePosition.x, BASE),\n y: parseInt(elPosition.top, BASE) + parseInt(pagePosition.y, BASE),\n }\n }\n\n function findTarget(location) {\n function jumpToTarget(target) {\n const jumpPosition = getElementPosition(target)\n\n log(\n `Moving to in page link (#${hash}) at x: ${jumpPosition.x}y: ${jumpPosition.y}`,\n )\n\n sendMsg(jumpPosition.y, jumpPosition.x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n }\n\n const hash = location.split('#')[1] || location // Remove # if present\n const hashData = decodeURIComponent(hash)\n const target =\n document.getElementById(hashData) ||\n document.getElementsByName(hashData)[0]\n\n if (target !== undefined) {\n jumpToTarget(target)\n return\n }\n\n log(`In page link (#${hash}) not found in iFrame, so sending to parent`)\n sendMsg(0, 0, 'inPageLink', `#${hash}`)\n }\n\n function checkLocationHash() {\n const { hash, href } = window.location\n\n if (hash !== '' && hash !== '#') {\n findTarget(href)\n }\n }\n\n function bindAnchors() {\n function setupLink(el) {\n function linkClicked(e) {\n e.preventDefault()\n\n findTarget(this.getAttribute('href'))\n }\n\n if (el.getAttribute('href') !== '#') {\n addEventListener(el, 'click', linkClicked)\n }\n }\n\n document.querySelectorAll('a[href^=\"#\"]').forEach(setupLink)\n }\n\n function bindLocationHash() {\n addEventListener(window, 'hashchange', checkLocationHash)\n }\n\n function initCheck() {\n // Check if page loaded with location hash after init resize\n setTimeout(checkLocationHash, eventCancelTimer)\n }\n\n function enableInPageLinks() {\n log('Setting up location.hash handlers')\n bindAnchors()\n bindLocationHash()\n initCheck()\n }\n\n if (inPageLinks.enable) {\n if (mode === 1) {\n advise(\n `In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details.`,\n )\n } else {\n enableInPageLinks()\n }\n } else {\n log('In page linking not enabled')\n }\n\n return {\n findTarget,\n }\n }\n\n function setupMouseEvents() {\n if (mouseEvents !== true) return\n\n function sendMouse(e) {\n sendMsg(0, 0, e.type, `${e.screenY}:${e.screenX}`)\n }\n\n function addMouseListener(evt, name) {\n log(`Add event listener: ${name}`)\n addEventListener(window.document, evt, sendMouse)\n }\n\n addMouseListener('mouseenter', 'Mouse Enter')\n addMouseListener('mouseleave', 'Mouse Leave')\n }\n\n function setupPublicMethods() {\n if (mode === 1) return\n\n win.parentIframe = Object.freeze({\n autoResize: (resize) => {\n if (resize === true && autoResize === false) {\n autoResize = true\n initEventListeners()\n } else if (resize === false && autoResize === true) {\n autoResize = false\n stopEventListeners()\n }\n\n sendMsg(0, 0, 'autoResize', JSON.stringify(autoResize))\n\n return autoResize\n },\n\n close() {\n sendMsg(0, 0, 'close')\n },\n\n getId: () => myID,\n\n getPageInfo(callback) {\n if (typeof callback === 'function') {\n onPageInfo = callback\n sendMsg(0, 0, 'pageInfo')\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n return\n }\n\n onPageInfo = null\n sendMsg(0, 0, 'pageInfoStop')\n },\n\n getParentProps(callback) {\n if (typeof callback !== 'function') {\n throw new TypeError(\n 'parentIFrame.getParentProps(callback) callback not a function',\n )\n }\n\n onParentInfo = callback\n sendMsg(0, 0, 'parentInfo')\n\n return () => {\n onParentInfo = null\n sendMsg(0, 0, 'parentInfoStop')\n }\n },\n\n getParentProperties(callback) {\n advise(\n `<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n this.getParentProps(callback)\n },\n\n moveToAnchor(hash) {\n inPageLinks.findTarget(hash)\n },\n\n reset() {\n resetIFrame('parentIFrame.reset')\n },\n\n scrollBy(x, y) {\n sendMsg(y, x, 'scrollBy') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollTo(x, y) {\n sendMsg(y, x, 'scrollTo') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollToOffset(x, y) {\n sendMsg(y, x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n },\n\n sendMessage(msg, targetOrigin) {\n sendMsg(0, 0, 'message', JSON.stringify(msg), targetOrigin)\n },\n\n setHeightCalculationMethod(heightCalculationMethod) {\n heightCalcMode = heightCalculationMethod\n checkHeightMode()\n },\n\n setWidthCalculationMethod(widthCalculationMethod) {\n widthCalcMode = widthCalculationMethod\n checkWidthMode()\n },\n\n setTargetOrigin(targetOrigin) {\n log(`Set targetOrigin: ${targetOrigin}`)\n targetOriginDefault = targetOrigin\n },\n\n resize(customHeight, customWidth) {\n const valString = `${customHeight || ''}${customWidth ? `,${customWidth}` : ''}`\n\n sendSize(\n 'size',\n `parentIFrame.size(${valString})`,\n customHeight,\n customWidth,\n )\n },\n\n size(customHeight, customWidth) {\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n this.resize(customHeight, customWidth)\n },\n })\n\n win.parentIFrame = win.parentIframe\n }\n\n let dispatchResized\n\n function resizeObserved(entries) {\n if (!Array.isArray(entries) || entries.length === 0) return\n\n const el = entries[0].target\n\n dispatchResized = () =>\n sendSize('resizeObserver', `Resize Observed: ${getElementName(el)}`)\n\n // Throttle event to once per current call stack (Safari issue)\n setTimeout(() => {\n if (dispatchResized) dispatchResized()\n dispatchResized = undefined\n }, 0)\n }\n\n const checkPositionType = (element) => {\n const style = getComputedStyle(element)\n return style?.position !== '' && style?.position !== 'static'\n }\n\n const getAllNonStaticElements = () =>\n [...getAllElements(document)()].filter(checkPositionType)\n\n const resizeSet = new WeakSet()\n\n function setupResizeObservers(el) {\n if (!el) return\n if (resizeSet.has(el)) return\n resizeObserver.observe(el)\n resizeSet.add(el)\n log(`Attached resizeObserver: ${getElementName(el)}`)\n }\n\n function createResizeObservers(el) {\n ;[\n ...getAllNonStaticElements(),\n ...resizeObserveTargets.flatMap((target) => el.querySelector(target)),\n ].forEach(setupResizeObservers)\n }\n\n function setupResizeObserver() {\n resizeObserver = new ResizeObserver(resizeObserved)\n createResizeObservers(window.document)\n }\n\n function setupBodyMutationObserver() {\n const observedMutations = new Set()\n let pending = false\n let perfMon = 0\n let newMutations = []\n\n const updateMutation = (mutations) => {\n const { length } = mutations\n\n for (let i = 0; i < length; i++) {\n const { addedNodes, removedNodes } = mutations[i]\n\n const aLen = addedNodes.length\n const rLen = removedNodes.length\n\n if (aLen > 2) {\n log('MutationObserver: addedNodes', addedNodes)\n }\n\n if (aLen) {\n for (let j = 0; j < aLen; j++) {\n observedMutations.add(addedNodes[j])\n }\n }\n\n if (rLen) {\n for (let j = 0; j < rLen; j++) {\n observedMutations.delete(removedNodes[j])\n }\n }\n }\n }\n\n const DELAY = 16 // Corresponds to 60fps\n const DELAY_MARGIN = 2\n const DELAY_MAX = 200\n\n let delayCount = 1\n\n function processMutations() {\n const now = performance.now()\n const delay = now - perfMon\n const delayLimit = DELAY * delayCount++ + DELAY_MARGIN\n\n // Back off if the callStack is busy with other stuff\n if (delay > delayLimit && delay < DELAY_MAX) {\n log(`MutationObserver delay: ${delay}ms > ${delayLimit}`)\n setTimeout(processMutations, DELAY * delayCount)\n perfMon = now\n return\n }\n\n delayCount = 1\n\n newMutations.forEach(updateMutation)\n newMutations = []\n\n if (observedMutations.size === 0) {\n pending = false\n return\n }\n\n // apply sizeSelector to new elements\n applySizeSelector()\n\n // Rebuild tagged elements list for size calculation\n checkAndSetupTags()\n\n // Add observers to new elements\n addOverflowObservers(observedMutations)\n observedMutations.forEach(createResizeObservers)\n\n observedMutations.clear()\n\n pending = false\n }\n\n function mutationObserved(mutations) {\n newMutations.push(mutations)\n if (pending) return\n\n perfMon = performance.now()\n pending = true\n requestAnimationFrame(processMutations)\n }\n\n function createMutationObserver() {\n const observer = new window.MutationObserver(mutationObserved)\n const target = document.querySelector('body')\n const config = {\n attributes: false,\n attributeOldValue: false,\n characterData: false,\n characterDataOldValue: false,\n childList: true,\n subtree: true,\n }\n\n log('Create <body/> MutationObserver')\n observer.observe(target, config)\n\n return observer\n }\n\n const observer = createMutationObserver()\n\n return {\n disconnect() {\n log('Disconnect MutationObserver')\n observer.disconnect()\n },\n }\n }\n\n function setupMutationObserver() {\n bodyObserver = setupBodyMutationObserver()\n }\n\n function getMaxElement(side) {\n performance.mark(PREF_START)\n\n const Side = capitalizeFirstLetter(side)\n\n let elVal = 0\n let maxEl = document.documentElement\n let maxVal = hasTags\n ? 0\n : document.documentElement.getBoundingClientRect().bottom\n\n performance.mark(PREF_START)\n\n const targetElements = hasTags\n ? taggedElements\n : isOverflowed()\n ? getOverflowedElements()\n : getAllElements(document)() // We should never get here, but just in case\n\n let len = targetElements.length\n\n targetElements.forEach((element) => {\n if (\n !hasTags &&\n hasCheckVisibility && // Safari missing checkVisibility\n !element.checkVisibility(checkVisibilityOptions)\n ) {\n len -= 1\n return\n }\n\n elVal =\n element.getBoundingClientRect()[side] +\n parseFloat(getComputedStyle(element).getPropertyValue(`margin-${side}`))\n\n if (elVal > maxVal) {\n maxVal = elVal\n maxEl = element\n }\n })\n\n setPerfEl(maxEl)\n performance.mark(PREF_END, {\n detail: {\n Side,\n len,\n hasTags,\n logging,\n },\n })\n\n return maxVal\n }\n\n const getAllMeasurements = (dimension) => [\n dimension.bodyOffset(),\n dimension.bodyScroll(),\n dimension.documentElementOffset(),\n dimension.documentElementScroll(),\n dimension.documentElementBoundingClientRect(),\n ]\n\n const getAllElements = (element) => () =>\n element.querySelectorAll(\n '* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)',\n )\n\n const prevScrollSize = {\n height: 0,\n width: 0,\n }\n\n const prevBoundingSize = {\n height: 0,\n width: 0,\n }\n\n const getAdjustedScroll = (getDimension) =>\n getDimension.documentElementScroll() + Math.max(0, getDimension.getOffset())\n\n function getAutoSize(getDimension) {\n function returnBoundingClientRect() {\n prevBoundingSize[dimension] = boundingSize\n prevScrollSize[dimension] = scrollSize\n return boundingSize\n }\n\n const hasOverflow = isOverflowed()\n const isHeight = getDimension === getHeight\n const dimension = isHeight ? 'height' : 'width'\n const boundingSize = getDimension.documentElementBoundingClientRect()\n const ceilBoundingSize = Math.ceil(boundingSize)\n const floorBoundingSize = Math.floor(boundingSize)\n const scrollSize = getAdjustedScroll(getDimension)\n const sizes = `HTML: ${boundingSize} Page: ${scrollSize}`\n\n switch (true) {\n case !getDimension.enabled():\n return scrollSize\n\n case hasTags:\n return getDimension.taggedElement()\n\n case !hasOverflow &&\n prevBoundingSize[dimension] === 0 &&\n prevScrollSize[dimension] === 0:\n log(`Initial page size values: ${sizes}`)\n return returnBoundingClientRect()\n\n case triggerLocked &&\n boundingSize === prevBoundingSize[dimension] &&\n scrollSize === prevScrollSize[dimension]:\n log(`Size unchanged: ${sizes}`)\n return Math.max(boundingSize, scrollSize)\n\n case boundingSize === 0:\n log(`Page is hidden: ${sizes}`)\n return scrollSize\n\n case !hasOverflow &&\n boundingSize !== prevBoundingSize[dimension] &&\n scrollSize <= prevScrollSize[dimension]:\n log(\n `New HTML bounding size: ${sizes}`,\n 'Previous bounding size:',\n prevBoundingSize[dimension],\n )\n return returnBoundingClientRect()\n\n case !isHeight:\n return getDimension.taggedElement()\n\n case !hasOverflow && boundingSize < prevBoundingSize[dimension]:\n log('HTML bounding size decreased:', sizes)\n return returnBoundingClientRect()\n\n case scrollSize === floorBoundingSize || scrollSize === ceilBoundingSize:\n log('HTML bounding size equals page size:', sizes)\n return returnBoundingClientRect()\n\n case boundingSize > scrollSize:\n log(`Page size < HTML bounding size: ${sizes}`)\n return returnBoundingClientRect()\n\n default:\n log(`Content overflowing HTML element: ${sizes}`)\n }\n\n return Math.max(getDimension.taggedElement(), returnBoundingClientRect())\n }\n\n const getBodyOffset = () => {\n const { body } = document\n const style = getComputedStyle(body)\n\n return (\n body.offsetHeight +\n parseInt(style.marginTop, BASE) +\n parseInt(style.marginBottom, BASE)\n )\n }\n\n const getHeight = {\n enabled: () => calculateHeight,\n getOffset: () => offsetHeight,\n auto: () => getAutoSize(getHeight),\n bodyOffset: getBodyOffset,\n bodyScroll: () => document.body.scrollHeight,\n offset: () => getHeight.bodyOffset(), // Backwards compatibility\n custom: () => customCalcMethods.height(),\n documentElementOffset: () => document.documentElement.offsetHeight,\n documentElementScroll: () => document.documentElement.scrollHeight,\n documentElementBoundingClientRect: () =>\n document.documentElement.getBoundingClientRect().bottom,\n max: () => Math.max(...getAllMeasurements(getHeight)),\n min: () => Math.min(...getAllMeasurements(getHeight)),\n grow: () => getHeight.max(),\n lowestElement: () => getMaxElement(HEIGHT_EDGE),\n taggedElement: () => getMaxElement(HEIGHT_EDGE),\n }\n\n const getWidth = {\n enabled: () => calculateWidth,\n getOffset: () => offsetWidth,\n auto: () => getAutoSize(getWidth),\n bodyScroll: () => document.body.scrollWidth,\n bodyOffset: () => document.body.offsetWidth,\n custom: () => customCalcMethods.width(),\n documentElementScroll: () => document.documentElement.scrollWidth,\n documentElementOffset: () => document.documentElement.offsetWidth,\n documentElementBoundingClientRect: () =>\n document.documentElement.getBoundingClientRect().right,\n max: () => Math.max(...getAllMeasurements(getWidth)),\n min: () => Math.min(...getAllMeasurements(getWidth)),\n rightMostElement: () => getMaxElement(WIDTH_EDGE),\n scroll: () =>\n Math.max(getWidth.bodyScroll(), getWidth.documentElementScroll()),\n taggedElement: () => getMaxElement(WIDTH_EDGE),\n }\n\n function sizeIFrame(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n function resizeIFrame() {\n height = currentHeight\n width = currentWidth\n sendMsg(height, width, triggerEvent, msg)\n }\n\n function isSizeChangeDetected() {\n const checkTolerance = (a, b) => !(Math.abs(a - b) <= tolerance)\n\n // currentHeight = Math.ceil(\n // undefined === customHeight ? getHeight[heightCalcMode]() : customHeight,\n // )\n\n // currentWidth = Math.ceil(\n // undefined === customWidth ? getWidth[widthCalcMode]() : customWidth,\n // )\n\n currentHeight =\n undefined === customHeight ? getHeight[heightCalcMode]() : customHeight\n currentWidth =\n undefined === customWidth ? getWidth[widthCalcMode]() : customWidth\n\n return (\n (calculateHeight && checkTolerance(height, currentHeight)) ||\n (calculateWidth && checkTolerance(width, currentWidth))\n )\n }\n\n const isForceResizableEvent = () => !(triggerEvent in { init: 1, size: 1 })\n\n const isForceResizableCalcMode = () =>\n (calculateHeight && heightCalcMode in resetRequiredMethods) ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n\n function checkDownSizing() {\n if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIFrame(triggerEventDesc)\n }\n }\n\n let currentHeight\n let currentWidth\n\n if (isSizeChangeDetected() || triggerEvent === 'init') {\n lockTrigger()\n resizeIFrame()\n } else {\n checkDownSizing()\n }\n }\n\n function sendSize(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n if (document.hidden) {\n // Currently only correctly supported in firefox\n // This is checked again on the parent page\n log('Page hidden - Ignored resize request')\n return\n }\n\n if (!(triggerEvent in nonLoggableTriggerEvents)) {\n log(`Trigger event: ${triggerEventDesc}`)\n }\n\n sizeIFrame(triggerEvent, triggerEventDesc, customHeight, customWidth, msg)\n }\n\n function lockTrigger() {\n if (triggerLocked) return\n\n triggerLocked = true\n log('Trigger event lock on')\n\n requestAnimationFrame(() => {\n triggerLocked = false\n log('Trigger event lock off')\n log('--')\n })\n }\n\n function triggerReset(triggerEvent) {\n height = getHeight[heightCalcMode]()\n width = getWidth[widthCalcMode]()\n\n sendMsg(height, width, triggerEvent)\n }\n\n function resetIFrame(triggerEventDesc) {\n const hcm = heightCalcMode\n heightCalcMode = heightCalcModeDefault\n\n log(`Reset trigger event: ${triggerEventDesc}`)\n lockTrigger()\n triggerReset('reset')\n\n heightCalcMode = hcm\n }\n\n function sendMsg(height, width, triggerEvent, msg, targetOrigin) {\n if (mode < -1) return\n\n function setTargetOrigin() {\n if (undefined === targetOrigin) {\n targetOrigin = targetOriginDefault\n return\n }\n\n log(`Message targetOrigin: ${targetOrigin}`)\n }\n\n function sendToParent() {\n const size = `${height + (offsetHeight || 0)}:${width + (offsetWidth || 0)}`\n const message = `${myID}:${size}:${triggerEvent}${undefined === msg ? '' : `:${msg}`}`\n\n log(\n `Sending message to host page (${message}) via ${sameDomain ? 'sameDomain' : 'postMessage'}`,\n )\n\n if (sameDomain) {\n window.parent.iframeParentListener(msgID + message)\n return\n }\n\n target.postMessage(msgID + message, targetOrigin)\n }\n\n setTargetOrigin()\n sendToParent()\n }\n\n function receiver(event) {\n const processRequestFromParent = {\n init: function initFromParent() {\n initMsg = event.data\n target = event.source\n\n init()\n firstRun = false\n setTimeout(() => {\n initLock = false\n }, eventCancelTimer)\n },\n\n reset() {\n if (initLock) {\n log('Page reset ignored by init')\n return\n }\n log('Page size reset by host page')\n triggerReset('resetPage')\n },\n\n resize() {\n sendSize('resizeParent', 'Parent window requested size check')\n },\n\n moveToAnchor() {\n inPageLinks.findTarget(getData())\n },\n\n inPageLink() {\n this.moveToAnchor()\n }, // Backward compatibility\n\n pageInfo() {\n const msgBody = getData()\n log(`PageInfo received from parent: ${msgBody}`)\n if (onPageInfo) {\n onPageInfo(JSON.parse(msgBody))\n } else {\n // not expected, so cancel more messages\n sendMsg(0, 0, 'pageInfoStop')\n }\n log(' --')\n },\n\n parentInfo() {\n const msgBody = getData()\n log(`ParentInfo received from parent: ${msgBody}`)\n if (onParentInfo) {\n onParentInfo(Object.freeze(JSON.parse(msgBody)))\n } else {\n // not expected, so cancel more messages\n sendMsg(0, 0, 'parentInfoStop')\n }\n log(' --')\n },\n\n message() {\n const msgBody = getData()\n log(`onMessage called from parent: ${msgBody}`)\n // eslint-disable-next-line sonarjs/no-extra-arguments\n onMessage(JSON.parse(msgBody))\n log(' --')\n },\n }\n\n const isMessageForUs = () => msgID === `${event.data}`.slice(0, msgIdLen)\n\n const getMessageType = () => event.data.split(']')[1].split(':')[0]\n\n const getData = () => event.data.slice(event.data.indexOf(':') + 1)\n\n const isMiddleTier = () =>\n 'iframeResize' in window ||\n (window.jQuery !== undefined && '' in window.jQuery.prototype)\n\n // Test if this message is from a child below us. This is an ugly test, however, updating\n // the message format would break backwards compatibility.\n const isInitMsg = () => event.data.split(':')[2] in { true: 1, false: 1 }\n\n function callFromParent() {\n const messageType = getMessageType()\n\n if (messageType in processRequestFromParent) {\n processRequestFromParent[messageType]()\n return\n }\n\n if (!isMiddleTier() && !isInitMsg()) {\n warn(`Unexpected message (${event.data})`)\n }\n }\n\n function processMessage() {\n if (firstRun === false) {\n callFromParent()\n return\n }\n\n if (isInitMsg()) {\n processRequestFromParent.init()\n return\n }\n\n log(\n `Ignored message of type \"${getMessageType()}\". Received before initialization.`,\n )\n }\n\n if (isMessageForUs()) {\n processMessage()\n }\n }\n\n // Normally the parent kicks things off when it detects the iFrame has loaded.\n // If this script is async-loaded, then tell parent page to retry init.\n function chkLateLoaded() {\n if (document.readyState !== 'loading') {\n window.parent.postMessage('[iFrameResizerChild]Ready', '*')\n }\n }\n\n window.iframeChildListener = (data) => receiver({ data, sameDomain: true })\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n chkLateLoaded()\n\n /* TEST CODE START */\n function mockMsgListener(msgObject) {\n receiver(msgObject)\n return win\n }\n\n try {\n // eslint-disable-next-line no-restricted-globals\n if (top?.document?.getElementById('banner')) {\n win = {}\n\n // Create test hooks\n window.mockMsgListener = mockMsgListener\n\n removeEventListener(window, 'message', receiver)\n\n define([], () => mockMsgListener)\n }\n } catch (error) {\n // do nothing\n }\n\n /* TEST CODE END */\n}\n\n// Don't run for server side render\nif (typeof window !== 'undefined') {\n iframeResizerChild()\n}\n"],"names":["VERSION","BASE","SIZE_ATTR","OVERFLOW_ATTR","HEIGHT_EDGE","WIDTH_EDGE","addEventListener","el","evt","func","options","y","Object","fromEntries","map","l","p","Math","max","getModeData","replaceAll","String","fromCodePoint","codePointAt","once","fn","done","undefined","Reflect","apply","this","arguments","id","x","logging","setLogOptions","capitalizeFirstLetter","string","charAt","toUpperCase","slice","isDef","value","getElementName","nodeName","name","className","formatLogMsg","msg","join","log","console","info","warn","advise","window","chrome","formatAdvise","adviser","overflowedElements","overflowObserver","side","onChange","observerOptions","root","document","documentElement","rootMargin","threshold","observedElements","WeakSet","observer","IntersectionObserver","entries","forEach","entry","target","toggleAttribute","boundingClientRect","rootBounds","isTarget","querySelectorAll","length","nodeList","has","observe","add","isOverflowed","DEC_PLACES","PREF_START","PREF_END","PREF_MEASURE","timings","usedTags","addUsedTag","round","num","floor","lastPerfEl","perfEl","details","timingCheck","setInterval","hasTags","len","sort","average","min","reduce","a","b","clearInterval","Side","toLowerCase","perfObserver","list","getEntries","duration","performance","measure","detail","usedEl","push","shift","setup","PerformanceObserver","entryTypes","body","readyState","checkVisibilityOptions","contentVisibilityAuto","opacityProperty","visibilityProperty","customCalcMethods","height","getHeight","auto","width","getWidth","deprecatedResizeMethods","bodyOffset","bodyScroll","offset","documentElementOffset","documentElementScroll","documentElementBoundingClientRect","grow","lowestElement","eventCancelTimer","eventHandlersByName","hasCheckVisibility","heightCalcModeDefault","nonLoggableTriggerEvents","reset","resetPage","init","msgID","msgIdLen","resetRequiredMethods","resizeObserveTargets","widthCalcModeDefault","offsetHeight","offsetWidth","autoResize","bodyBackground","bodyMargin","bodyMarginStr","bodyObserver","bodyPadding","calculateHeight","calculateWidth","firstRun","heightCalcMode","initLock","initMsg","inPageLinks","mode","mouseEvents","myID","observeOverflow","resizeFrom","resizeObserver","sameDomain","sizeSelector","taggedElements","parent","targetOriginDefault","tolerance","triggerLocked","version","widthCalcMode","win","onMessage","onReady","onPageInfo","onParentInfo","attr","strBool","str","data","split","Number","enable","readDataFromParent","readData","iframeResizer","iFrameResizer","JSON","stringify","offsetSize","prototype","hasOwnProperty","call","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","constructor","readDataFromPage","location","href","error","checkCrossDomain","checkHeightMode","checkWidthMode","found","checkAttrs","removeAttribute","checkDeprecatedAttrs","checkAndSetupTags","initContinue","parentIframe","freeze","resize","initEventListeners","manageEventListeners","disconnect","sendMsg","close","getId","getPageInfo","callback","getParentProps","TypeError","getParentProperties","moveToAnchor","hash","findTarget","resetIFrame","scrollBy","scrollTo","scrollToOffset","sendMessage","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","customHeight","customWidth","sendSize","size","parentIFrame","sendMouse","e","type","screenY","screenX","addMouseListener","setupMouseEvents","getPagePosition","scrollLeft","scrollTop","getElementPosition","elPosition","getBoundingClientRect","pagePosition","parseInt","left","top","jumpToTarget","jumpPosition","hashData","decodeURIComponent","getElementById","getElementsByName","checkLocationHash","bindAnchors","setupLink","linkClicked","preventDefault","getAttribute","bindLocationHash","initCheck","setTimeout","enableInPageLinks","setupInPageLinks","addOverflowObservers","getAllElements","setBodyStyle","includes","clearFix","createElement","style","clear","display","append","injectClearFixIntoBodyElement","setAutoHeight","setProperty","stopInfiniteResizingOfIFrame","applySizeSelector","title","dataset","iframeSize","manageTriggerEvent","eventName","handleEvent","eventType","passive","remove","removeEventListener","method","checkCalcMode","calcModeDefault","modes","observedMutations","Set","pending","perfMon","newMutations","updateMutation","mutations","i","addedNodes","removedNodes","aLen","rLen","j","delete","DELAY","DELAY_MARGIN","DELAY_MAX","delayCount","processMutations","now","delay","delayLimit","createResizeObservers","mutationObserved","requestAnimationFrame","createMutationObserver","MutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","setupBodyMutationObserver","ResizeObserver","resizeObserved","dispatchResized","Array","isArray","checkPositionType","element","getComputedStyle","position","getAllNonStaticElements","filter","resizeSet","setupResizeObservers","flatMap","getMaxElement","mark","elVal","maxEl","maxVal","bottom","targetElements","checkVisibility","parseFloat","getPropertyValue","getAllMeasurements","dimension","prevScrollSize","prevBoundingSize","getAutoSize","getDimension","returnBoundingClientRect","boundingSize","scrollSize","hasOverflow","isHeight","ceilBoundingSize","ceil","floorBoundingSize","getOffset","getAdjustedScroll","sizes","enabled","taggedElement","marginTop","marginBottom","scrollHeight","custom","scrollWidth","right","rightMostElement","scroll","sizeIFrame","triggerEvent","triggerEventDesc","currentHeight","currentWidth","checkTolerance","abs","isSizeChangeDetected","lockTrigger","hidden","triggerReset","hcm","message","iframeParentListener","postMessage","sendToParent","receiver","event","processRequestFromParent","source","getData","inPageLink","pageInfo","msgBody","parse","parentInfo","getMessageType","indexOf","isMiddleTier","jQuery","isInitMsg","true","false","messageType","callFromParent","chkLateLoaded","iframeChildListener","iframeResizerChild"],"mappings":";;;;;;;;;;;;;;;;;;;AAAO,MAAMA,EAAU,eAEVC,EAAO,GAGPC,EAAY,mBACZC,EAAgB,uBAEhBC,EAAc,SACdC,EAAa,QCTbC,EAAmB,CAACC,EAAIC,EAAKC,EAAMC,IAC9CH,EAAGD,iBAAiBE,EAAKC,EAAMC,IAAW,GCqB1CC,EAAI,CACF,yCACA,yCACA,qnBACA,0jBAGEC,OAAOC,YACT,CACE,cACA,cACA,cACA,aACA,aACA,eACAC,KAAI,CAACC,EAAGC,IAAM,CAACD,EAAGE,KAAKC,IAAI,EAAGF,EAAI,OAEjC,MAAMG,EAAeJ,GAvBtB,CAACA,GACHA,EAAEK,WAAW,aAAcL,GACzBM,OAAOC,eACJP,GAAK,IAAM,GAAK,OAASA,EAAIA,EAAEQ,YAAY,GAAK,IAAMR,EAAIA,EAAI,MAoBrCC,CAAEL,EAAEI,ICrCzBS,EAAQC,IACnB,IAAIC,GAAO,EAEX,OAAO,WACL,OAAOA,OACHC,GACED,GAAO,EAAOE,QAAQC,MAAMJ,EAAIK,KAAMC,WAC7C,GAGUC,EAAMC,GAAMA,ECVzB,IAAID,EAAK,GACLE,GAAU,EAEP,MAAMC,EAAiBzB,IAC5BsB,EAAKtB,EAAQsB,GACbE,EAAUxB,EAAQwB,OAAO,EAGdE,EAAyBC,GACpCA,EAAOC,OAAO,GAAGC,cAAgBF,EAAOG,MAAM,GAE1CC,EAASC,GAAyB,IAAf,GAAGA,UAA4Bf,IAAVe,EAEvC,SAASC,EAAepC,GAC7B,QAAQ,GACN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S+D,YACXzE,OAAOkI,OAAOkP,YAAY,4BAA6B,IAE1D,CAEDpX,OAAO0Y,oBAAuB1P,GAASsO,GAAS,CAAEtO,OAAMjB,YAAY,IACpEhL,EAAiBiD,OAAQ,UAAWsX,IACpCva,EAAiBiD,OAAQ,mBAAoByY,IAC7CA,IAEF,CAIEE"}
package/index.umd.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../packages/common/consts.js","../../packages/common/listeners.js","../../packages/common/mode.js","../../packages/common/utils.js","../../packages/child/log.js","../../packages/common/format-advise.js","../../packages/child/overflow.js","../../packages/child/perf.js","../../packages/child/index.js"],"sourcesContent":["export const VERSION = '[VI]{version}[/VI]'\n\nexport const BASE = 10\nexport const SINGLE = 1\n\nexport const SIZE_ATTR = 'data-iframe-size'\nexport const OVERFLOW_ATTR = 'data-iframe-overflow'\n\nexport const HEIGHT_EDGE = 'bottom'\nexport const WIDTH_EDGE = 'right'\n\nexport const msgHeader = 'message'\nexport const msgHeaderLen = msgHeader.length\nexport const msgId = '[iFrameSizer]' // Must match iframe msg ID\nexport const msgIdLen = msgId.length\nexport const resetRequiredMethods = Object.freeze({\n max: 1,\n scroll: 1,\n bodyScroll: 1,\n documentElementScroll: 1,\n})\n","export const addEventListener = (el, evt, func, options) =>\n el.addEventListener(evt, func, options || false)\n\nexport const removeEventListener = (el, evt, func) =>\n el.removeEventListener(evt, func, false)\n","const l = (l) => {\n if (!l) return ''\n let p = -559038744,\n y = 1103547984\n for (let z, t = 0; t < l.length; t++)\n (z = l.codePointAt(t)),\n (p = Math.imul(p ^ z, 2246822519)),\n (y = Math.imul(y ^ z, 3266489917))\n return (\n (p ^= Math.imul(p ^ (y >>> 15), 1935289751)),\n (y ^= Math.imul(y ^ (p >>> 15), 3405138345)),\n (p ^= y >>> 16),\n (y ^= p >>> 16),\n (2097152 * (y >>> 0) + (p >>> 11)).toString(36)\n )\n },\n p = (l) =>\n l.replaceAll(/[A-Za-z]/g, (l) =>\n String.fromCodePoint(\n (l <= 'Z' ? 90 : 122) >= (l = l.codePointAt(0) + 19) ? l : l - 26,\n ),\n ),\n y = [\n '<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>',\n '<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>',\n '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</>',\n '<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</>.',\n ],\n z = ['NWSc3', 'zvsv', 'wyv', 'ibzpulzz', 'vlt'],\n t = Object.fromEntries(\n [\n '2cgs7fdf4xb',\n '1c9ctcccr4z',\n '1q2pc4eebgb',\n 'ueokt0969w',\n 'w2zxchhgqz',\n '1umuxblj2e5',\n ].map((l, p) => [l, Math.max(0, p - 1)]),\n )\nexport const getModeData = (l) => p(y[l])\nexport const getModeLabel = (l) => p(z[l])\nexport default (y) => {\n const z = y[p('spjluzl')]\n if (!z) return -1\n const u = z.split('-')\n let v = (function (y = '') {\n let z = -2\n const u = l(p(y))\n return u in t && (z = t[u]), z\n })(u[0])\n return 0 === v || ((p) => p[2] === l(p[0] + p[1]))(u) || (v = -2), v\n}\n","export const isNumber = (value) => !Number.isNaN(value)\n\nexport const once = (fn) => {\n let done = false\n\n return function () {\n return done\n ? undefined\n : ((done = true), Reflect.apply(fn, this, arguments))\n }\n}\n\nexport const id = (x) => x\n","import formatAdvise from '../common/format-advise'\n\nlet id = ''\nlet logging = false\n\nexport const setLogOptions = (options) => {\n id = options.id\n logging = options.logging\n}\n\nexport const capitalizeFirstLetter = (string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nconst isDef = (value) => `${value}` !== '' && value !== undefined\n\nexport function getElementName(el) {\n switch (true) {\n case !isDef(el):\n return ''\n\n case isDef(el.id):\n return `${el.nodeName.toUpperCase()}#${el.id}`\n\n case isDef(el.name):\n return `${el.nodeName.toUpperCase()} (${el.name})`\n\n default:\n return (\n el.nodeName.toUpperCase() +\n (isDef(el.className) ? `.${el.className}` : '')\n )\n }\n}\n\n// function elementSnippet(el, maxChars = 30) {\n// const outer = el?.outerHTML?.toString()\n\n// if (!outer) return el\n\n// return outer.length < maxChars\n// ? outer\n// : `${outer.slice(0, maxChars).replaceAll('\\n', ' ')}...`\n// }\n\n// TODO: remove .join(' '), requires major test updates\nconst formatLogMsg = (...msg) => [`[iframe-resizer][${id}]`, ...msg].join(' ')\n\nexport const log = (...msg) =>\n // eslint-disable-next-line no-console\n logging && console?.log(formatLogMsg(...msg))\n\n// eslint-disable-next-line no-unused-vars\nexport const info = (...msg) =>\n // eslint-disable-next-line no-console\n console?.info(`[iframe-resizer][${id}]`, ...msg)\n\nexport const warn = (...msg) =>\n // eslint-disable-next-line no-console\n console?.warn(formatLogMsg(...msg))\n\nexport const advise = (...msg) =>\n // eslint-disable-next-line no-console\n console?.warn(formatAdvise(formatLogMsg)(...msg))\n\nexport const adviser = (msg) => advise(msg)\n","const encode = (s) =>\n s\n .replaceAll('<br>', '\\n')\n .replaceAll('<rb>', '\\u001B[31;1m')\n .replaceAll('</>', '\\u001B[m')\n .replaceAll('<b>', '\\u001B[1m')\n .replaceAll('<i>', '\\u001B[3m')\n .replaceAll('<u>', '\\u001B[4m')\n\nconst remove = (s) => s.replaceAll('<br>', '\\n').replaceAll(/<[/a-z]+>/gi, '')\n\nexport default (formatLogMsg) => (msg) =>\n window.chrome // Only show formatting in Chrome as not supported in other browsers\n ? formatLogMsg(encode(msg))\n : formatLogMsg(remove(msg))\n","import { HEIGHT_EDGE, OVERFLOW_ATTR } from '../common/consts'\nimport { id } from '../common/utils'\nimport { log } from './log'\n\nlet overflowedElements = []\n\nexport const overflowObserver = (options) => {\n const side = options.side || HEIGHT_EDGE\n const onChange = options.onChange || id\n\n const observerOptions = {\n root: document.documentElement,\n rootMargin: '0px',\n threshold: 1,\n }\n\n const observedElements = new WeakSet()\n\n const isTarget = (entry) =>\n entry.boundingClientRect[side] === 0 ||\n entry.boundingClientRect[side] > entry.rootBounds[side]\n\n const callback = (entries) => {\n entries.forEach((entry) => {\n entry.target.toggleAttribute(OVERFLOW_ATTR, isTarget(entry))\n })\n\n overflowedElements = document.querySelectorAll(`[${OVERFLOW_ATTR}]`)\n log('overflowedElements:', overflowedElements.length)\n onChange()\n }\n\n const observer = new IntersectionObserver(callback, observerOptions)\n\n return (nodeList) =>\n nodeList.forEach((el) => {\n if (observedElements.has(el)) return\n observer.observe(el)\n observedElements.add(el)\n })\n}\n\nexport const isOverflowed = () => overflowedElements.length > 0\nexport const getOverflowedElements = () => overflowedElements\n","import { advise, info, log } from './log'\n\nconst SECOND = 1000\nconst DEC_PLACES = 100_000 // 5 decimal places\nconst PERF_CHECK_INTERVAL = 5 * SECOND\nconst THRESHOLD = 4 // ms\n\nexport const PREF_START = '--ifr-start'\nexport const PREF_END = '--ifr-end'\nconst PREF_MEASURE = '--ifr-measure'\n\nconst timings = []\nconst usedTags = new WeakSet()\n\nconst addUsedTag = (el) => typeof el === 'object' && usedTags.add(el)\nconst round = (num) => Math.floor(num * DEC_PLACES) / DEC_PLACES\n\nlet lastPerfEl = null\nlet perfEl = null\nlet details = {}\n\nexport const setPerfEl = (el) => {\n perfEl = el\n}\n\nfunction usedEl(detail, duration) {\n // eslint-disable-next-line no-unused-vars\n const { Side, len, hasTags, logging } = detail\n\n details = detail\n\n if (usedTags.has(perfEl) || lastPerfEl === perfEl || (hasTags && len <= 1)) {\n return\n }\n\n if (!logging) addUsedTag(perfEl)\n\n lastPerfEl = perfEl\n\n info(\n `\\n${Side} position calculated from:\\n`,\n perfEl,\n `\\nParsed ${len} ${hasTags ? 'tagged' : 'potentially overflowing'} elements in ${round(duration)}ms`,\n )\n}\n\nconst timingCheck = setInterval(() => {\n if (timings.length < 10) return\n if (details.hasTags && details.len < 25) return\n\n timings.sort()\n\n const average = Math.min(\n timings.reduce((a, b) => a + b, 0) / timings.length,\n timings[Math.floor(timings.length / 2)],\n )\n\n // console.info('Timings:', JSON.parse(JSON.stringify(timings)))\n // console.info('Mean time:', timings[Math.floor(timings.length / 2)])\n // console.info(\n // 'Median time:',\n // timings.reduce((a, b) => a + b, 0) / timings.length,\n // )\n // console.info('Average time:', round(average), average)\n\n log('Max time:', Math.max(...timings))\n\n if (average <= THRESHOLD) return\n\n clearInterval(timingCheck)\n\n advise(\n `<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${round(average)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${details.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`,\n )\n}, PERF_CHECK_INTERVAL)\n\nfunction perfObserver(list) {\n list.getEntries().forEach((entry) => {\n if (entry.name === PREF_END) {\n const { duration } = performance.measure(\n PREF_MEASURE,\n PREF_START,\n PREF_END,\n )\n usedEl(entry.detail, duration)\n timings.push(duration)\n if (timings.length > 100) timings.shift()\n }\n })\n}\n\nfunction setup() {\n const observer = new PerformanceObserver(perfObserver)\n observer.observe({ entryTypes: ['mark'] })\n\n addUsedTag(document.documentElement)\n addUsedTag(document.body)\n}\n\nif (\n // Guard against everything, as we don't control where and when we are loaded\n typeof document !== 'undefined' &&\n typeof PerformanceObserver !== 'undefined'\n) {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', setup)\n } else {\n setup()\n }\n}\n","import {\n BASE,\n HEIGHT_EDGE,\n SIZE_ATTR,\n VERSION,\n WIDTH_EDGE,\n} from '../common/consts'\nimport { addEventListener, removeEventListener } from '../common/listeners'\nimport { getModeData } from '../common/mode'\nimport { id, once } from '../common/utils'\nimport {\n advise,\n adviser,\n capitalizeFirstLetter,\n getElementName,\n // eslint-disable-next-line no-unused-vars\n info,\n log,\n setLogOptions,\n warn,\n} from './log'\nimport {\n getOverflowedElements,\n isOverflowed,\n overflowObserver,\n} from './overflow'\nimport { PREF_END, PREF_START, setPerfEl } from './perf'\n\nfunction iframeResizerChild() {\n const checkVisibilityOptions = {\n contentVisibilityAuto: true,\n opacityProperty: true,\n visibilityProperty: true,\n }\n const customCalcMethods = {\n height: () => {\n warn('Custom height calculation function not defined')\n return getHeight.auto()\n },\n width: () => {\n warn('Custom width calculation function not defined')\n return getWidth.auto()\n },\n }\n const deprecatedResizeMethods = {\n bodyOffset: 1,\n bodyScroll: 1,\n offset: 1,\n documentElementOffset: 1,\n documentElementScroll: 1,\n documentElementBoundingClientRect: 1,\n max: 1,\n min: 1,\n grow: 1,\n lowestElement: 1,\n }\n const eventCancelTimer = 128\n const eventHandlersByName = {}\n const hasCheckVisibility = 'checkVisibility' in window\n const heightCalcModeDefault = 'auto'\n // const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)\n const nonLoggableTriggerEvents = { reset: 1, resetPage: 1, init: 1 }\n const msgID = '[iFrameSizer]' // Must match host page msg ID\n const msgIdLen = msgID.length\n const resetRequiredMethods = {\n max: 1,\n min: 1,\n bodyScroll: 1,\n documentElementScroll: 1,\n }\n const resizeObserveTargets = ['body']\n const widthCalcModeDefault = 'scroll'\n\n let autoResize = true\n let bodyBackground = ''\n let bodyMargin = 0\n let bodyMarginStr = ''\n let bodyObserver = null\n let bodyPadding = ''\n let calculateHeight = true\n let calculateWidth = false\n let firstRun = true\n let hasTags = false\n let height = 1\n let heightCalcMode = heightCalcModeDefault // only applies if not provided by host page (V1 compatibility)\n let initLock = true\n let initMsg = ''\n let inPageLinks = {}\n let logging = false\n let licenseKey = '' // eslint-disable-line no-unused-vars\n let mode = 0\n let mouseEvents = false\n let myID = ''\n let offsetHeight\n let offsetWidth\n let observeOverflow = id\n let resizeFrom = 'child'\n let resizeObserver = null\n let sameDomain = false\n let sizeSelector = ''\n let taggedElements = []\n let target = window.parent\n let targetOriginDefault = '*'\n let tolerance = 0\n let triggerLocked = false\n let version = ''\n let width = 1\n let widthCalcMode = widthCalcModeDefault\n let win = window\n\n let onMessage = () => {\n warn('onMessage function not defined')\n }\n let onReady = () => {}\n let onPageInfo = null\n let onParentInfo = null\n\n function init() {\n readDataFromParent()\n readDataFromPage()\n\n log(`Initialising iFrame v${VERSION} (${window.location.href})`)\n\n setLogOptions({ id: myID, logging })\n\n checkCrossDomain()\n checkMode()\n checkVersion()\n checkHeightMode()\n checkWidthMode()\n checkDeprecatedAttrs()\n\n checkAndSetupTags()\n\n setupObserveOverflow()\n setupPublicMethods()\n setupMouseEvents()\n inPageLinks = setupInPageLinks()\n\n addOverflowObservers(getAllElements(document)())\n\n setMargin()\n setBodyStyle('background', bodyBackground)\n setBodyStyle('padding', bodyPadding)\n\n injectClearFixIntoBodyElement()\n stopInfiniteResizingOfIFrame()\n applySizeSelector()\n }\n\n // Continue init after intersection observer has been setup\n const initContinue = () => {\n sendSize(\n 'init',\n 'Init message from host page',\n undefined,\n undefined,\n VERSION,\n )\n sendTitle()\n initEventListeners()\n onReady()\n\n log('Initialization complete')\n log('---')\n }\n\n function setupObserveOverflow() {\n if (calculateHeight === calculateWidth) return\n observeOverflow = overflowObserver({\n onChange: once(initContinue),\n side: calculateHeight ? HEIGHT_EDGE : WIDTH_EDGE,\n })\n }\n\n function checkAndSetupTags() {\n taggedElements = document.querySelectorAll(`[${SIZE_ATTR}]`)\n hasTags = taggedElements.length > 0\n log(`Tagged elements found: ${hasTags}`)\n }\n\n function addOverflowObservers(nodeList) {\n if (hasTags) setTimeout(initContinue)\n else observeOverflow(nodeList)\n }\n\n function sendTitle() {\n if (document.title && document.title !== '') {\n sendMsg(0, 0, 'title', document.title)\n }\n }\n\n function checkVersion() {\n if (!version || version === '' || version === 'false') {\n advise(\n `<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`,\n )\n return\n }\n\n if (version !== VERSION) {\n advise(\n `<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${version} - Child page: ${VERSION}.\n`,\n )\n }\n }\n\n function checkCrossDomain() {\n try {\n sameDomain = 'iframeParentListener' in window.parent\n } catch (error) {\n log('Cross domain iframe detected.')\n }\n }\n\n // eslint-disable-next-line sonarjs/cognitive-complexity\n function readDataFromParent() {\n const strBool = (str) => str === 'true'\n const data = initMsg.slice(msgIdLen).split(':')\n\n myID = data[0] // eslint-disable-line prefer-destructuring\n bodyMargin = undefined === data[1] ? bodyMargin : Number(data[1]) // For V1 compatibility\n calculateWidth = undefined === data[2] ? calculateWidth : strBool(data[2])\n logging = undefined === data[3] ? logging : strBool(data[3])\n // data[4] no longer used (was intervalTimer)\n autoResize = undefined === data[6] ? autoResize : strBool(data[6])\n bodyMarginStr = data[7] // eslint-disable-line prefer-destructuring\n heightCalcMode = undefined === data[8] ? heightCalcMode : data[8]\n bodyBackground = data[9] // eslint-disable-line prefer-destructuring\n bodyPadding = data[10] // eslint-disable-line prefer-destructuring\n tolerance = undefined === data[11] ? tolerance : Number(data[11])\n inPageLinks.enable = undefined === data[12] ? false : strBool(data[12])\n resizeFrom = undefined === data[13] ? resizeFrom : data[13]\n widthCalcMode = undefined === data[14] ? widthCalcMode : data[14]\n mouseEvents = undefined === data[15] ? mouseEvents : strBool(data[15])\n offsetHeight = undefined === data[16] ? offsetHeight : Number(data[16])\n offsetWidth = undefined === data[17] ? offsetWidth : Number(data[17])\n calculateHeight =\n undefined === data[18] ? calculateHeight : strBool(data[18])\n licenseKey = data[19] // eslint-disable-line prefer-destructuring\n version = data[20] || version\n mode = undefined === data[21] ? mode : Number(data[21])\n // sizeSelector = data[22] || sizeSelector\n }\n\n function readDataFromPage() {\n // eslint-disable-next-line sonarjs/cognitive-complexity\n function readData() {\n const data = window.iframeResizer || window.iFrameResizer\n\n log(`Reading data from page: ${JSON.stringify(data)}`)\n\n onMessage = data?.onMessage || onMessage\n onReady = data?.onReady || onReady\n\n if (typeof data?.offset === 'number') {\n advise(\n `<rb>Deprecated option</>\\n\\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.`,\n )\n if (calculateHeight) offsetHeight = data?.offset\n if (calculateWidth) offsetWidth = data?.offset\n }\n\n if (typeof data?.offsetSize === 'number') {\n if (calculateHeight) offsetHeight = data?.offsetSize\n if (calculateWidth) offsetWidth = data?.offsetSize\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'sizeSelector')) {\n sizeSelector = data.sizeSelector\n }\n\n targetOriginDefault = data?.targetOrigin || targetOriginDefault\n heightCalcMode = data?.heightCalculationMethod || heightCalcMode\n widthCalcMode = data?.widthCalculationMethod || widthCalcMode\n }\n\n function setupCustomCalcMethods(calcMode, calcFunc) {\n if (typeof calcMode === 'function') {\n log(`Setup custom ${calcFunc}CalcMethod`)\n customCalcMethods[calcFunc] = calcMode\n calcMode = 'custom'\n }\n\n return calcMode\n }\n\n if (mode === 1) return\n\n if (\n 'iFrameResizer' in window &&\n Object === window.iFrameResizer.constructor\n ) {\n readData()\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\n }\n\n log(`TargetOrigin for parent set to: ${targetOriginDefault}`)\n }\n\n function chkCSS(attr, value) {\n if (value.includes('-')) {\n warn(`Negative CSS value ignored for ${attr}`)\n value = ''\n }\n\n return value\n }\n\n function setBodyStyle(attr, value) {\n if (undefined !== value && value !== '' && value !== 'null') {\n document.body.style.setProperty(attr, value)\n log(`Body ${attr} set to \"${value}\"`)\n }\n }\n\n function applySizeSelector() {\n if (sizeSelector === '') return\n\n log(`Applying sizeSelector: ${sizeSelector}`)\n\n document.querySelectorAll(sizeSelector).forEach((el) => {\n log(`Applying data-iframe-size to: ${getElementName(el)}`)\n el.dataset.iframeSize = true\n })\n }\n\n function setMargin() {\n // If called via V1 script, convert bodyMargin from int to str\n if (undefined === bodyMarginStr) {\n bodyMarginStr = `${bodyMargin}px`\n }\n\n setBodyStyle('margin', chkCSS('margin', bodyMarginStr))\n }\n\n function stopInfiniteResizingOfIFrame() {\n const setAutoHeight = (el) =>\n el.style.setProperty('height', 'auto', 'important')\n\n setAutoHeight(document.documentElement)\n setAutoHeight(document.body)\n\n log('HTML & body height set to \"auto !important\"')\n }\n\n function manageTriggerEvent(options) {\n const listener = {\n add(eventName) {\n function handleEvent() {\n sendSize(options.eventName, options.eventType)\n }\n\n eventHandlersByName[eventName] = handleEvent\n\n addEventListener(window, eventName, handleEvent, { passive: true })\n },\n remove(eventName) {\n const handleEvent = eventHandlersByName[eventName]\n delete eventHandlersByName[eventName]\n\n removeEventListener(window, eventName, handleEvent)\n },\n }\n\n listener[options.method](options.eventName)\n\n log(\n `${capitalizeFirstLetter(options.method)} event listener: ${\n options.eventType\n }`,\n )\n }\n\n function manageEventListeners(method) {\n manageTriggerEvent({\n method,\n eventType: 'After Print',\n eventName: 'afterprint',\n })\n\n manageTriggerEvent({\n method,\n eventType: 'Before Print',\n eventName: 'beforeprint',\n })\n\n manageTriggerEvent({\n method,\n eventType: 'Ready State Change',\n eventName: 'readystatechange',\n })\n }\n\n function checkDeprecatedAttrs() {\n let found = false\n\n const checkAttrs = (attr) =>\n document.querySelectorAll(`[${attr}]`).forEach((el) => {\n found = true\n el.removeAttribute(attr)\n el.toggleAttribute(SIZE_ATTR, true)\n })\n\n checkAttrs('data-iframe-height')\n checkAttrs('data-iframe-width')\n\n if (found) {\n advise(\n `<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</>.`,\n )\n }\n }\n\n function checkCalcMode(calcMode, calcModeDefault, modes, type) {\n if (calcModeDefault !== calcMode) {\n if (!(calcMode in modes)) {\n warn(`${calcMode} is not a valid option for ${type}CalculationMethod.`)\n calcMode = calcModeDefault\n }\n if (calcMode in deprecatedResizeMethods) {\n advise(\n `<rb>Deprecated ${type}CalculationMethod (${calcMode})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${type} calculation method. It is recommended that you remove this option.`,\n )\n }\n log(`${type} calculation method set to \"${calcMode}\"`)\n }\n\n return calcMode\n }\n\n function checkHeightMode() {\n heightCalcMode = checkCalcMode(\n heightCalcMode,\n heightCalcModeDefault,\n getHeight,\n 'height',\n )\n }\n\n function checkWidthMode() {\n widthCalcMode = checkCalcMode(\n widthCalcMode,\n widthCalcModeDefault,\n getWidth,\n 'width',\n )\n }\n\n function checkMode() {\n if (mode < 0) return adviser(`${getModeData(mode + 2)}${getModeData(2)}`)\n if (version.codePointAt(0) > 4) return mode\n if (mode < 2) return adviser(getModeData(3))\n return mode\n }\n\n function initEventListeners() {\n if (autoResize !== true) {\n log('Auto Resize disabled')\n return\n }\n\n manageEventListeners('add')\n setupMutationObserver()\n setupResizeObserver()\n }\n\n function stopEventListeners() {\n manageEventListeners('remove')\n resizeObserver?.disconnect()\n bodyObserver?.disconnect()\n }\n\n function injectClearFixIntoBodyElement() {\n const clearFix = document.createElement('div')\n\n clearFix.style.clear = 'both'\n // Guard against the following having been globally redefined in CSS.\n clearFix.style.display = 'block'\n clearFix.style.height = '0'\n document.body.append(clearFix)\n }\n\n function setupInPageLinks() {\n const getPagePosition = () => ({\n x: document.documentElement.scrollLeft,\n y: document.documentElement.scrollTop,\n })\n\n function getElementPosition(el) {\n const elPosition = el.getBoundingClientRect()\n const pagePosition = getPagePosition()\n\n return {\n x: parseInt(elPosition.left, BASE) + parseInt(pagePosition.x, BASE),\n y: parseInt(elPosition.top, BASE) + parseInt(pagePosition.y, BASE),\n }\n }\n\n function findTarget(location) {\n function jumpToTarget(target) {\n const jumpPosition = getElementPosition(target)\n\n log(\n `Moving to in page link (#${hash}) at x: ${jumpPosition.x}y: ${jumpPosition.y}`,\n )\n\n sendMsg(jumpPosition.y, jumpPosition.x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n }\n\n const hash = location.split('#')[1] || location // Remove # if present\n const hashData = decodeURIComponent(hash)\n const target =\n document.getElementById(hashData) ||\n document.getElementsByName(hashData)[0]\n\n if (target !== undefined) {\n jumpToTarget(target)\n return\n }\n\n log(`In page link (#${hash}) not found in iFrame, so sending to parent`)\n sendMsg(0, 0, 'inPageLink', `#${hash}`)\n }\n\n function checkLocationHash() {\n const { hash, href } = window.location\n\n if (hash !== '' && hash !== '#') {\n findTarget(href)\n }\n }\n\n function bindAnchors() {\n function setupLink(el) {\n function linkClicked(e) {\n e.preventDefault()\n\n findTarget(this.getAttribute('href'))\n }\n\n if (el.getAttribute('href') !== '#') {\n addEventListener(el, 'click', linkClicked)\n }\n }\n\n document.querySelectorAll('a[href^=\"#\"]').forEach(setupLink)\n }\n\n function bindLocationHash() {\n addEventListener(window, 'hashchange', checkLocationHash)\n }\n\n function initCheck() {\n // Check if page loaded with location hash after init resize\n setTimeout(checkLocationHash, eventCancelTimer)\n }\n\n function enableInPageLinks() {\n log('Setting up location.hash handlers')\n bindAnchors()\n bindLocationHash()\n initCheck()\n }\n\n if (inPageLinks.enable) {\n if (mode === 1) {\n advise(\n `In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details.`,\n )\n } else {\n enableInPageLinks()\n }\n } else {\n log('In page linking not enabled')\n }\n\n return {\n findTarget,\n }\n }\n\n function setupMouseEvents() {\n if (mouseEvents !== true) return\n\n function sendMouse(e) {\n sendMsg(0, 0, e.type, `${e.screenY}:${e.screenX}`)\n }\n\n function addMouseListener(evt, name) {\n log(`Add event listener: ${name}`)\n addEventListener(window.document, evt, sendMouse)\n }\n\n addMouseListener('mouseenter', 'Mouse Enter')\n addMouseListener('mouseleave', 'Mouse Leave')\n }\n\n function setupPublicMethods() {\n if (mode === 1) return\n\n win.parentIframe = Object.freeze({\n autoResize: (resize) => {\n if (resize === true && autoResize === false) {\n autoResize = true\n initEventListeners()\n } else if (resize === false && autoResize === true) {\n autoResize = false\n stopEventListeners()\n }\n\n sendMsg(0, 0, 'autoResize', JSON.stringify(autoResize))\n\n return autoResize\n },\n\n close() {\n sendMsg(0, 0, 'close')\n },\n\n getId: () => myID,\n\n getPageInfo(callback) {\n if (typeof callback === 'function') {\n onPageInfo = callback\n sendMsg(0, 0, 'pageInfo')\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n return\n }\n\n onPageInfo = null\n sendMsg(0, 0, 'pageInfoStop')\n },\n\n getParentProps(callback) {\n if (typeof callback !== 'function') {\n throw new TypeError(\n 'parentIFrame.getParentProps(callback) callback not a function',\n )\n }\n\n onParentInfo = callback\n sendMsg(0, 0, 'parentInfo')\n\n return () => {\n onParentInfo = null\n sendMsg(0, 0, 'parentInfoStop')\n }\n },\n\n getParentProperties(callback) {\n advise(\n `<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n this.getParentProps(callback)\n },\n\n moveToAnchor(hash) {\n inPageLinks.findTarget(hash)\n },\n\n reset() {\n resetIFrame('parentIFrame.reset')\n },\n\n scrollBy(x, y) {\n sendMsg(y, x, 'scrollBy') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollTo(x, y) {\n sendMsg(y, x, 'scrollTo') // X&Y reversed at sendMsg uses height/width\n },\n\n scrollToOffset(x, y) {\n sendMsg(y, x, 'scrollToOffset') // X&Y reversed at sendMsg uses height/width\n },\n\n sendMessage(msg, targetOrigin) {\n sendMsg(0, 0, 'message', JSON.stringify(msg), targetOrigin)\n },\n\n setHeightCalculationMethod(heightCalculationMethod) {\n heightCalcMode = heightCalculationMethod\n checkHeightMode()\n },\n\n setWidthCalculationMethod(widthCalculationMethod) {\n widthCalcMode = widthCalculationMethod\n checkWidthMode()\n },\n\n setTargetOrigin(targetOrigin) {\n log(`Set targetOrigin: ${targetOrigin}`)\n targetOriginDefault = targetOrigin\n },\n\n resize(customHeight, customWidth) {\n const valString = `${customHeight || ''}${customWidth ? `,${customWidth}` : ''}`\n\n sendSize(\n 'size',\n `parentIFrame.size(${valString})`,\n customHeight,\n customWidth,\n )\n },\n\n size(customHeight, customWidth) {\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n this.resize(customHeight, customWidth)\n },\n })\n\n win.parentIFrame = win.parentIframe\n }\n\n let dispatchResized\n\n function resizeObserved(entries) {\n if (!Array.isArray(entries) || entries.length === 0) return\n\n const el = entries[0].target\n\n dispatchResized = () =>\n sendSize('resizeObserver', `Resize Observed: ${getElementName(el)}`)\n\n // Throttle event to once per current call stack (Safari issue)\n setTimeout(() => {\n if (dispatchResized) dispatchResized()\n dispatchResized = undefined\n }, 0)\n }\n\n const checkPositionType = (element) => {\n const style = getComputedStyle(element)\n return style?.position !== '' && style?.position !== 'static'\n }\n\n const getAllNonStaticElements = () =>\n [...getAllElements(document)()].filter(checkPositionType)\n\n const resizeSet = new WeakSet()\n\n function setupResizeObservers(el) {\n if (!el) return\n if (resizeSet.has(el)) return\n resizeObserver.observe(el)\n resizeSet.add(el)\n log(`Attached resizeObserver: ${getElementName(el)}`)\n }\n\n function createResizeObservers(el) {\n ;[\n ...getAllNonStaticElements(),\n ...resizeObserveTargets.flatMap((target) => el.querySelector(target)),\n ].forEach(setupResizeObservers)\n }\n\n function setupResizeObserver() {\n resizeObserver = new ResizeObserver(resizeObserved)\n createResizeObservers(window.document)\n }\n\n function setupBodyMutationObserver() {\n const observedMutations = new Set()\n let pending = false\n let perfMon = 0\n let newMutations = []\n\n const updateMutation = (mutations) => {\n const { length } = mutations\n\n for (let i = 0; i < length; i++) {\n const { addedNodes, removedNodes } = mutations[i]\n\n const aLen = addedNodes.length\n const rLen = removedNodes.length\n\n if (aLen > 2) {\n log('MutationObserver: addedNodes', addedNodes)\n }\n\n if (aLen) {\n for (let j = 0; j < aLen; j++) {\n observedMutations.add(addedNodes[j])\n }\n }\n\n if (rLen) {\n for (let j = 0; j < rLen; j++) {\n observedMutations.delete(removedNodes[j])\n }\n }\n }\n }\n\n const DELAY = 16 // Corresponds to 60fps\n const DELAY_MARGIN = 2\n const DELAY_MAX = 200\n\n let delayCount = 1\n\n function processMutations() {\n const now = performance.now()\n const delay = now - perfMon\n const delayLimit = DELAY * delayCount++ + DELAY_MARGIN\n\n // Back off if the callStack is busy with other stuff\n if (delay > delayLimit && delay < DELAY_MAX) {\n log(`MutationObserver delay: ${delay}ms > ${delayLimit}`)\n setTimeout(processMutations, DELAY * delayCount)\n perfMon = now\n return\n }\n\n delayCount = 1\n\n newMutations.forEach(updateMutation)\n newMutations = []\n\n if (observedMutations.size === 0) {\n pending = false\n return\n }\n\n // apply sizeSelector to new elements\n applySizeSelector()\n\n // Rebuild tagged elements list for size calculation\n checkAndSetupTags()\n\n // Add observers to new elements\n addOverflowObservers(observedMutations)\n observedMutations.forEach(createResizeObservers)\n\n observedMutations.clear()\n\n pending = false\n }\n\n function mutationObserved(mutations) {\n newMutations.push(mutations)\n if (pending) return\n\n perfMon = performance.now()\n pending = true\n requestAnimationFrame(processMutations)\n }\n\n function createMutationObserver() {\n const observer = new window.MutationObserver(mutationObserved)\n const target = document.querySelector('body')\n const config = {\n attributes: false,\n attributeOldValue: false,\n characterData: false,\n characterDataOldValue: false,\n childList: true,\n subtree: true,\n }\n\n log('Create <body/> MutationObserver')\n observer.observe(target, config)\n\n return observer\n }\n\n const observer = createMutationObserver()\n\n return {\n disconnect() {\n log('Disconnect MutationObserver')\n observer.disconnect()\n },\n }\n }\n\n function setupMutationObserver() {\n bodyObserver = setupBodyMutationObserver()\n }\n\n function getMaxElement(side) {\n performance.mark(PREF_START)\n\n const Side = capitalizeFirstLetter(side)\n\n let elVal = 0\n let maxEl = document.documentElement\n let maxVal = hasTags\n ? 0\n : document.documentElement.getBoundingClientRect().bottom\n\n performance.mark(PREF_START)\n\n const targetElements = hasTags\n ? taggedElements\n : isOverflowed()\n ? getOverflowedElements()\n : getAllElements(document)() // We should never get here, but just in case\n\n let len = targetElements.length\n\n targetElements.forEach((element) => {\n if (\n !hasTags &&\n hasCheckVisibility && // Safari missing checkVisibility\n !element.checkVisibility(checkVisibilityOptions)\n ) {\n len -= 1\n return\n }\n\n elVal =\n element.getBoundingClientRect()[side] +\n parseFloat(getComputedStyle(element).getPropertyValue(`margin-${side}`))\n\n if (elVal > maxVal) {\n maxVal = elVal\n maxEl = element\n }\n })\n\n setPerfEl(maxEl)\n performance.mark(PREF_END, {\n detail: {\n Side,\n len,\n hasTags,\n logging,\n },\n })\n\n return maxVal\n }\n\n const getAllMeasurements = (dimension) => [\n dimension.bodyOffset(),\n dimension.bodyScroll(),\n dimension.documentElementOffset(),\n dimension.documentElementScroll(),\n dimension.documentElementBoundingClientRect(),\n ]\n\n const getAllElements = (element) => () =>\n element.querySelectorAll(\n '* :not(head):not(meta):not(base):not(title):not(script):not(link):not(style):not(map):not(area):not(option):not(optgroup):not(template):not(track):not(wbr):not(nobr)',\n )\n\n const prevScrollSize = {\n height: 0,\n width: 0,\n }\n\n const prevBoundingSize = {\n height: 0,\n width: 0,\n }\n\n const getAdjustedScroll = (getDimension) =>\n getDimension.documentElementScroll() + Math.max(0, getDimension.getOffset())\n\n function getAutoSize(getDimension) {\n function returnBoundingClientRect() {\n prevBoundingSize[dimension] = boundingSize\n prevScrollSize[dimension] = scrollSize\n return boundingSize\n }\n\n const hasOverflow = isOverflowed()\n const isHeight = getDimension === getHeight\n const dimension = isHeight ? 'height' : 'width'\n const boundingSize = getDimension.documentElementBoundingClientRect()\n const ceilBoundingSize = Math.ceil(boundingSize)\n const floorBoundingSize = Math.floor(boundingSize)\n const scrollSize = getAdjustedScroll(getDimension)\n const sizes = `HTML: ${boundingSize} Page: ${scrollSize}`\n\n switch (true) {\n case !getDimension.enabled():\n return scrollSize\n\n case hasTags:\n return getDimension.taggedElement()\n\n case !hasOverflow &&\n prevBoundingSize[dimension] === 0 &&\n prevScrollSize[dimension] === 0:\n log(`Initial page size values: ${sizes}`)\n return returnBoundingClientRect()\n\n case triggerLocked &&\n boundingSize === prevBoundingSize[dimension] &&\n scrollSize === prevScrollSize[dimension]:\n log(`Size unchanged: ${sizes}`)\n return Math.max(boundingSize, scrollSize)\n\n case boundingSize === 0:\n log(`Page is hidden: ${sizes}`)\n return scrollSize\n\n case !hasOverflow &&\n boundingSize !== prevBoundingSize[dimension] &&\n scrollSize <= prevScrollSize[dimension]:\n log(\n `New HTML bounding size: ${sizes}`,\n 'Previous bounding size:',\n prevBoundingSize[dimension],\n )\n return returnBoundingClientRect()\n\n case !isHeight:\n return getDimension.taggedElement()\n\n case !hasOverflow && boundingSize < prevBoundingSize[dimension]:\n log('HTML bounding size decreased:', sizes)\n return returnBoundingClientRect()\n\n case scrollSize === floorBoundingSize || scrollSize === ceilBoundingSize:\n log('HTML bounding size equals page size:', sizes)\n return returnBoundingClientRect()\n\n case boundingSize > scrollSize:\n log(`Page size < HTML bounding size: ${sizes}`)\n return returnBoundingClientRect()\n\n default:\n log(`Content overflowing HTML element: ${sizes}`)\n }\n\n return Math.max(getDimension.taggedElement(), returnBoundingClientRect())\n }\n\n const getBodyOffset = () => {\n const { body } = document\n const style = getComputedStyle(body)\n\n return (\n body.offsetHeight +\n parseInt(style.marginTop, BASE) +\n parseInt(style.marginBottom, BASE)\n )\n }\n\n const getHeight = {\n enabled: () => calculateHeight,\n getOffset: () => offsetHeight,\n auto: () => getAutoSize(getHeight),\n bodyOffset: getBodyOffset,\n bodyScroll: () => document.body.scrollHeight,\n offset: () => getHeight.bodyOffset(), // Backwards compatibility\n custom: () => customCalcMethods.height(),\n documentElementOffset: () => document.documentElement.offsetHeight,\n documentElementScroll: () => document.documentElement.scrollHeight,\n documentElementBoundingClientRect: () =>\n document.documentElement.getBoundingClientRect().bottom,\n max: () => Math.max(...getAllMeasurements(getHeight)),\n min: () => Math.min(...getAllMeasurements(getHeight)),\n grow: () => getHeight.max(),\n lowestElement: () => getMaxElement(HEIGHT_EDGE),\n taggedElement: () => getMaxElement(HEIGHT_EDGE),\n }\n\n const getWidth = {\n enabled: () => calculateWidth,\n getOffset: () => offsetWidth,\n auto: () => getAutoSize(getWidth),\n bodyScroll: () => document.body.scrollWidth,\n bodyOffset: () => document.body.offsetWidth,\n custom: () => customCalcMethods.width(),\n documentElementScroll: () => document.documentElement.scrollWidth,\n documentElementOffset: () => document.documentElement.offsetWidth,\n documentElementBoundingClientRect: () =>\n document.documentElement.getBoundingClientRect().right,\n max: () => Math.max(...getAllMeasurements(getWidth)),\n min: () => Math.min(...getAllMeasurements(getWidth)),\n rightMostElement: () => getMaxElement(WIDTH_EDGE),\n scroll: () =>\n Math.max(getWidth.bodyScroll(), getWidth.documentElementScroll()),\n taggedElement: () => getMaxElement(WIDTH_EDGE),\n }\n\n function sizeIFrame(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n function resizeIFrame() {\n height = currentHeight\n width = currentWidth\n sendMsg(height, width, triggerEvent, msg)\n }\n\n function isSizeChangeDetected() {\n const checkTolerance = (a, b) => !(Math.abs(a - b) <= tolerance)\n\n // currentHeight = Math.ceil(\n // undefined === customHeight ? getHeight[heightCalcMode]() : customHeight,\n // )\n\n // currentWidth = Math.ceil(\n // undefined === customWidth ? getWidth[widthCalcMode]() : customWidth,\n // )\n\n currentHeight =\n undefined === customHeight ? getHeight[heightCalcMode]() : customHeight\n currentWidth =\n undefined === customWidth ? getWidth[widthCalcMode]() : customWidth\n\n return (\n (calculateHeight && checkTolerance(height, currentHeight)) ||\n (calculateWidth && checkTolerance(width, currentWidth))\n )\n }\n\n const isForceResizableEvent = () => !(triggerEvent in { init: 1, size: 1 })\n\n const isForceResizableCalcMode = () =>\n (calculateHeight && heightCalcMode in resetRequiredMethods) ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n\n function checkDownSizing() {\n if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIFrame(triggerEventDesc)\n }\n }\n\n let currentHeight\n let currentWidth\n\n if (isSizeChangeDetected() || triggerEvent === 'init') {\n lockTrigger()\n resizeIFrame()\n } else {\n checkDownSizing()\n }\n }\n\n function sendSize(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n if (document.hidden) {\n // Currently only correctly supported in firefox\n // This is checked again on the parent page\n log('Page hidden - Ignored resize request')\n return\n }\n\n if (!(triggerEvent in nonLoggableTriggerEvents)) {\n log(`Trigger event: ${triggerEventDesc}`)\n }\n\n sizeIFrame(triggerEvent, triggerEventDesc, customHeight, customWidth, msg)\n }\n\n function lockTrigger() {\n if (triggerLocked) return\n\n triggerLocked = true\n log('Trigger event lock on')\n\n requestAnimationFrame(() => {\n triggerLocked = false\n log('Trigger event lock off')\n log('--')\n })\n }\n\n function triggerReset(triggerEvent) {\n height = getHeight[heightCalcMode]()\n width = getWidth[widthCalcMode]()\n\n sendMsg(height, width, triggerEvent)\n }\n\n function resetIFrame(triggerEventDesc) {\n const hcm = heightCalcMode\n heightCalcMode = heightCalcModeDefault\n\n log(`Reset trigger event: ${triggerEventDesc}`)\n lockTrigger()\n triggerReset('reset')\n\n heightCalcMode = hcm\n }\n\n function sendMsg(height, width, triggerEvent, msg, targetOrigin) {\n if (mode < -1) return\n\n function setTargetOrigin() {\n if (undefined === targetOrigin) {\n targetOrigin = targetOriginDefault\n return\n }\n\n log(`Message targetOrigin: ${targetOrigin}`)\n }\n\n function sendToParent() {\n const size = `${height + (offsetHeight || 0)}:${width + (offsetWidth || 0)}`\n const message = `${myID}:${size}:${triggerEvent}${undefined === msg ? '' : `:${msg}`}`\n\n log(\n `Sending message to host page (${message}) via ${sameDomain ? 'sameDomain' : 'postMessage'}`,\n )\n\n if (sameDomain) {\n window.parent.iframeParentListener(msgID + message)\n return\n }\n\n target.postMessage(msgID + message, targetOrigin)\n }\n\n setTargetOrigin()\n sendToParent()\n }\n\n function receiver(event) {\n const processRequestFromParent = {\n init: function initFromParent() {\n initMsg = event.data\n target = event.source\n\n init()\n firstRun = false\n setTimeout(() => {\n initLock = false\n }, eventCancelTimer)\n },\n\n reset() {\n if (initLock) {\n log('Page reset ignored by init')\n return\n }\n log('Page size reset by host page')\n triggerReset('resetPage')\n },\n\n resize() {\n sendSize('resizeParent', 'Parent window requested size check')\n },\n\n moveToAnchor() {\n inPageLinks.findTarget(getData())\n },\n\n inPageLink() {\n this.moveToAnchor()\n }, // Backward compatibility\n\n pageInfo() {\n const msgBody = getData()\n log(`PageInfo received from parent: ${msgBody}`)\n if (onPageInfo) {\n onPageInfo(JSON.parse(msgBody))\n } else {\n // not expected, so cancel more messages\n sendMsg(0, 0, 'pageInfoStop')\n }\n log(' --')\n },\n\n parentInfo() {\n const msgBody = getData()\n log(`ParentInfo received from parent: ${msgBody}`)\n if (onParentInfo) {\n onParentInfo(Object.freeze(JSON.parse(msgBody)))\n } else {\n // not expected, so cancel more messages\n sendMsg(0, 0, 'parentInfoStop')\n }\n log(' --')\n },\n\n message() {\n const msgBody = getData()\n log(`onMessage called from parent: ${msgBody}`)\n // eslint-disable-next-line sonarjs/no-extra-arguments\n onMessage(JSON.parse(msgBody))\n log(' --')\n },\n }\n\n const isMessageForUs = () => msgID === `${event.data}`.slice(0, msgIdLen)\n\n const getMessageType = () => event.data.split(']')[1].split(':')[0]\n\n const getData = () => event.data.slice(event.data.indexOf(':') + 1)\n\n const isMiddleTier = () =>\n 'iframeResize' in window ||\n (window.jQuery !== undefined && '' in window.jQuery.prototype)\n\n // Test if this message is from a child below us. This is an ugly test, however, updating\n // the message format would break backwards compatibility.\n const isInitMsg = () => event.data.split(':')[2] in { true: 1, false: 1 }\n\n function callFromParent() {\n const messageType = getMessageType()\n\n if (messageType in processRequestFromParent) {\n processRequestFromParent[messageType]()\n return\n }\n\n if (!isMiddleTier() && !isInitMsg()) {\n warn(`Unexpected message (${event.data})`)\n }\n }\n\n function processMessage() {\n if (firstRun === false) {\n callFromParent()\n return\n }\n\n if (isInitMsg()) {\n processRequestFromParent.init()\n return\n }\n\n log(\n `Ignored message of type \"${getMessageType()}\". Received before initialization.`,\n )\n }\n\n if (isMessageForUs()) {\n processMessage()\n }\n }\n\n // Normally the parent kicks things off when it detects the iFrame has loaded.\n // If this script is async-loaded, then tell parent page to retry init.\n function chkLateLoaded() {\n if (document.readyState !== 'loading') {\n window.parent.postMessage('[iFrameResizerChild]Ready', '*')\n }\n }\n\n window.iframeChildListener = (data) => receiver({ data, sameDomain: true })\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n chkLateLoaded()\n\n /* TEST CODE START */\n function mockMsgListener(msgObject) {\n receiver(msgObject)\n return win\n }\n\n try {\n // eslint-disable-next-line no-restricted-globals\n if (top?.document?.getElementById('banner')) {\n win = {}\n\n // Create test hooks\n window.mockMsgListener = mockMsgListener\n\n removeEventListener(window, 'message', receiver)\n\n define([], () => mockMsgListener)\n }\n } catch (error) {\n // do nothing\n }\n\n /* TEST CODE END */\n}\n\n// Don't run for server side render\nif (typeof window !== 'undefined') {\n iframeResizerChild()\n}\n"],"names":["VERSION","BASE","SIZE_ATTR","OVERFLOW_ATTR","HEIGHT_EDGE","WIDTH_EDGE","addEventListener","el","evt","func","options","y","Object","fromEntries","map","l","p","Math","max","getModeData","replaceAll","String","fromCodePoint","codePointAt","once","fn","done","undefined","Reflect","apply","this","arguments","id","x","logging","setLogOptions","capitalizeFirstLetter","string","charAt","toUpperCase","slice","isDef","value","getElementName","nodeName","name","className","formatLogMsg","msg","join","log","console","info","warn","advise","window","chrome","formatAdvise","adviser","overflowedElements","overflowObserver","side","onChange","observerOptions","root","document","documentElement","rootMargin","threshold","observedElements","WeakSet","observer","IntersectionObserver","entries","forEach","entry","target","toggleAttribute","boundingClientRect","rootBounds","isTarget","querySelectorAll","length","nodeList","has","observe","add","isOverflowed","DEC_PLACES","PREF_START","PREF_END","PREF_MEASURE","timings","usedTags","addUsedTag","round","num","floor","lastPerfEl","perfEl","details","timingCheck","setInterval","hasTags","len","sort","average","min","reduce","a","b","clearInterval","Side","toLowerCase","perfObserver","list","getEntries","duration","performance","measure","detail","usedEl","push","shift","setup","PerformanceObserver","entryTypes","body","readyState","checkVisibilityOptions","contentVisibilityAuto","opacityProperty","visibilityProperty","customCalcMethods","height","getHeight","auto","width","getWidth","deprecatedResizeMethods","bodyOffset","bodyScroll","offset","documentElementOffset","documentElementScroll","documentElementBoundingClientRect","grow","lowestElement","eventCancelTimer","eventHandlersByName","hasCheckVisibility","heightCalcModeDefault","nonLoggableTriggerEvents","reset","resetPage","init","msgID","msgIdLen","resetRequiredMethods","resizeObserveTargets","widthCalcModeDefault","offsetHeight","offsetWidth","autoResize","bodyBackground","bodyMargin","bodyMarginStr","bodyObserver","bodyPadding","calculateHeight","calculateWidth","firstRun","heightCalcMode","initLock","initMsg","inPageLinks","mode","mouseEvents","myID","observeOverflow","resizeFrom","resizeObserver","sameDomain","sizeSelector","taggedElements","parent","targetOriginDefault","tolerance","triggerLocked","version","widthCalcMode","win","onMessage","onReady","onPageInfo","onParentInfo","attr","strBool","str","data","split","Number","enable","readDataFromParent","readData","iframeResizer","iFrameResizer","JSON","stringify","offsetSize","prototype","hasOwnProperty","call","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","constructor","readDataFromPage","location","href","error","checkCrossDomain","checkHeightMode","checkWidthMode","found","checkAttrs","removeAttribute","checkDeprecatedAttrs","checkAndSetupTags","initContinue","parentIframe","freeze","resize","initEventListeners","manageEventListeners","disconnect","sendMsg","close","getId","getPageInfo","callback","getParentProps","TypeError","getParentProperties","moveToAnchor","hash","findTarget","resetIFrame","scrollBy","scrollTo","scrollToOffset","sendMessage","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","customHeight","customWidth","sendSize","size","parentIFrame","sendMouse","e","type","screenY","screenX","addMouseListener","setupMouseEvents","getPagePosition","scrollLeft","scrollTop","getElementPosition","elPosition","getBoundingClientRect","pagePosition","parseInt","left","top","jumpToTarget","jumpPosition","hashData","decodeURIComponent","getElementById","getElementsByName","checkLocationHash","bindAnchors","setupLink","linkClicked","preventDefault","getAttribute","bindLocationHash","initCheck","setTimeout","enableInPageLinks","setupInPageLinks","addOverflowObservers","getAllElements","setBodyStyle","includes","clearFix","createElement","style","clear","display","append","injectClearFixIntoBodyElement","setAutoHeight","setProperty","stopInfiniteResizingOfIFrame","applySizeSelector","title","dataset","iframeSize","manageTriggerEvent","eventName","handleEvent","eventType","passive","remove","removeEventListener","method","checkCalcMode","calcModeDefault","modes","observedMutations","Set","pending","perfMon","newMutations","updateMutation","mutations","i","addedNodes","removedNodes","aLen","rLen","j","delete","DELAY","DELAY_MARGIN","DELAY_MAX","delayCount","processMutations","now","delay","delayLimit","createResizeObservers","mutationObserved","requestAnimationFrame","createMutationObserver","MutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","setupBodyMutationObserver","ResizeObserver","resizeObserved","dispatchResized","Array","isArray","checkPositionType","element","getComputedStyle","position","getAllNonStaticElements","filter","resizeSet","setupResizeObservers","flatMap","getMaxElement","mark","elVal","maxEl","maxVal","bottom","targetElements","checkVisibility","parseFloat","getPropertyValue","getAllMeasurements","dimension","prevScrollSize","prevBoundingSize","getAutoSize","getDimension","returnBoundingClientRect","boundingSize","scrollSize","hasOverflow","isHeight","ceilBoundingSize","ceil","floorBoundingSize","getOffset","getAdjustedScroll","sizes","enabled","taggedElement","marginTop","marginBottom","scrollHeight","custom","scrollWidth","right","rightMostElement","scroll","sizeIFrame","triggerEvent","triggerEventDesc","currentHeight","currentWidth","checkTolerance","abs","isSizeChangeDetected","lockTrigger","hidden","triggerReset","hcm","message","iframeParentListener","postMessage","sendToParent","receiver","event","processRequestFromParent","source","getData","inPageLink","pageInfo","msgBody","parse","parentInfo","getMessageType","indexOf","isMiddleTier","jQuery","isInitMsg","true","false","messageType","callFromParent","chkLateLoaded","iframeChildListener","iframeResizerChild"],"mappings":";;;;;;;;;;;;;;;;;;;2FAAO,MAAMA,EAAU,eAEVC,EAAO,GAGPC,EAAY,mBACZC,EAAgB,uBAEhBC,EAAc,SACdC,EAAa,QCTbC,EAAmB,CAACC,EAAIC,EAAKC,EAAMC,IAC9CH,EAAGD,iBAAiBE,EAAKC,EAAMC,IAAW,GCqB1CC,EAAI,CACF,yCACA,yCACA,qnBACA,0jBAGEC,OAAOC,YACT,CACE,cACA,cACA,cACA,aACA,aACA,eACAC,KAAI,CAACC,EAAGC,IAAM,CAACD,EAAGE,KAAKC,IAAI,EAAGF,EAAI,OAEjC,MAAMG,EAAeJ,GAvBtB,CAAC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