@iframe-resizer/child 5.3.2 → 5.3.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.cjs.js +3 -2
- package/index.cjs.js.map +1 -0
- package/index.esm.js +3 -2
- package/index.esm.js.map +1 -0
- package/index.umd.js +3 -2
- package/index.umd.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.3.
|
|
4
|
+
* @module iframe-resizer/child 5.3.3-beta.1 (cjs) - 2024-10-23
|
|
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,4 +17,5 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
"use strict";const e="5.3.2",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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))))(s[e]),d=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const h=e=>{f=e.id,p=e.logging},y=e=>""!=`${e}`&&void 0!==e;const g=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),b=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),v=(...e)=>console?.warn(g(...e)),w=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(g)(...e)),z=e=>w(e),S=e=>{const t=e.side||i,n=e.onChange||d,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},E="--ifr-start",j="--ifr-end",$="--ifr-measure",C=[],T=new WeakSet,M=e=>"object"==typeof e&&T.add(e);let O=null,P={};const A=setInterval((()=>{if(C.length<10)return;if(P.hasTags&&P.len<25)return;C.sort();const e=Math.min(C.reduce(((e,t)=>e+t),0)/C.length,C[Math.floor(C.length/2)]);e<=4||(clearInterval(A),w(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${P.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function N(e){e.getEntries().forEach((e=>{if(e.name===j){const{duration:t}=performance.measure($,E,j);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;P=e,T.has(O)||i&&o<=1||(r||M(O),b(`\n ${n} position calculated from:`,O,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),C.push(t),C.length>100&&C.shift()}}))}function I(){new PerformanceObserver(N).observe({entryTypes:["mark"]}),M(document.documentElement),M(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",I):I()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(v("Custom height calculation function not defined"),Le.auto()),width:()=>(v("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},g="checkVisibility"in window,b="auto",$="[iFrameSizer]",C=$.length,T={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="scroll";let P,A,N,I,k,R=!0,x="",q=0,L="",B="",D=!0,W=!1,U=!0,F=!1,V=!1,J=1,H=b,Z=!0,_="",Q={},X=!1,Y=0,G=!1,K="",ee=d,te=[],ne="child",oe=null,ie=!1,re="",ae=[],le=window.parent,se="*",ce=0,de=!1,ue="",me=1,fe=M,pe=window,he=()=>{v("onMessage function not defined")},ye=()=>{},ge=null,be=null;function ve(){var o,d,u;!function(){const e=e=>"true"===e,t=_.slice(C).split(":");K=t[0],q=void 0===t[1]?q:Number(t[1]),W=void 0===t[2]?W:e(t[2]),X=void 0===t[3]?X:e(t[3]),R=void 0===t[6]?R:e(t[6]),L=t[7],H=void 0===t[8]?H:t[8],x=t[9],B=t[10],ce=void 0===t[11]?ce:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ne=void 0===t[13]?ne:t[13],fe=void 0===t[14]?fe:t[14],G=void 0===t[15]?G:e(t[15]),P=void 0===t[16]?P:Number(t[16]),A=void 0===t[17]?A:Number(t[17]),D=void 0===t[18]?D:e(t[18]),t[19],ue=t[20]||ue,Y=void 0===t[21]?Y:Number(t[21])}(),h({id:K,logging:X}),function(){function e(e){he=e?.onMessage||he,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</>."),D&&(P=e?.offset),W&&(A=e?.offset)),"number"==typeof e?.offsetSize&&(D&&(P=e?.offsetSize),W&&(A=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(re=e.sizeSelector),se=e?.targetOrigin||se,H=e?.heightCalculationMethod||H,fe=e?.widthCalculationMethod||fe}function t(e,t){return"function"==typeof e&&(s[t]=e,e="custom"),e}if(1===Y)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),H=t(H,"height"),fe=t(fe,"width"))}(),function(){try{ie="iframeParentListener"in window.parent}catch(e){}}(),Y<0?z(`${c(Y+2)}${c(2)}`):ue.codePointAt(0)>4||Y<2&&z(c(3)),ue&&""!==ue&&"false"!==ue?ue!==e&&w(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ue} - 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"),Te(),Me(),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</>.")}(),ze(),D!==W&&(ee=S({onChange:we,root:document.documentElement,side:D?i:r})),1!==Y&&(pe.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===R?(R=!0,Ue("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===R&&(R=!1),He(0,0,"autoResize",JSON.stringify(R)),R),close(){He(0,0,"close")},getId:()=>K,getOrigin:()=>N,getPageInfo(e){if("function"==typeof e)return ge=e,He(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");ge=null,He(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return be=e,He(0,0,"parentInfo"),()=>{be=null,He(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){Q.findTarget(e)},reset(){Je()},scrollBy(e,t){He(t,e,"scrollBy")},scrollTo(e,t){He(t,e,"scrollTo")},scrollToOffset(e,t){He(t,e,"scrollToOffset")},sendMessage(e,t){He(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){H=e,Te()},setWidthCalculationMethod(e){fe=e,Me()},setTargetOrigin(e){se=e},resize(e,t){Ue(a,`parentIframe.resize(${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)}}),pe.parentIFrame=pe.parentIframe),function(){function e(e){He(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){l(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);He(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?He(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function c(){r(),a(),s()}return Q.enable&&(1===Y?w("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),Se(ke(document)()),void 0===L&&(L=`${q}px`),Ee("margin",(d="margin",(u=L).includes("-")&&(v(`Negative CSS value ignored for ${d}`),u=""),u)),Ee("background",x),Ee("padding",B),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)}(),je(),Ue("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&He(0,0,"title",document.title),$e({method:o="add",eventType:"After Print",eventName:"afterprint"}),$e({method:o,eventType:"Before Print",eventName:"beforeprint"}),$e({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(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?(je(),ze(),Se(e),e.forEach(Ae),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}u()}(),oe=new ResizeObserver(Oe),oe.observe(document.body),Pe.add(document.body),Ae(document.body),setTimeout(ye)}function we(e){te=e,F=te.length>0,Ue("overflowChanged","Overflow updated")}function ze(){ae=document.querySelectorAll(`[${n}]`),V=ae.length>0}function Se(e){V||ee(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function je(){if(""!==re)for(const e of document.querySelectorAll(re))e.dataset.iframeSize=!0}function $e(e){({add(t){function n(){Ue(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function Ce(e,t,n,o){return t!==e&&(e in n||(v(`${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.`)),e}function Te(){H=Ce(H,b,Le,"height")}function Me(){fe=Ce(fe,M,Be,"width")}function Oe(e){Array.isArray(e)&&0!==e.length&&Ue("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const Pe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Pe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(oe.observe(e),Pe.add(e))}const t=ke(e)();for(const e of t){if(Pe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(oe.observe(e),Pe.add(e))}}function Ne(e){performance.mark(E);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=V?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(E);const l=V?ae:F?te:ke(document)();let s=l.length;for(const t of l)V||!g||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1;return O=r,performance.mark(j,{detail:{Side:t,len:s,hasTags:V,logging:X}}),a}const Ie=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=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)"),Re={height:0,width:0},xe={height:0,width:0};function qe(e){function t(){return xe[o]=i,Re[o]=l,i}const n=e===Le,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return l;case V:return e.taggedElement();case!F&&0===xe[o]&&0===Re[o]:return t();case de&&i===xe[o]&&l===Re[o]:return Math.max(i,l);case 0===i:return l;case!F&&i!==xe[o]&&l<=Re[o]:return t();case!n:return e.taggedElement();case!F&&i<xe[o]:case l===a||l===r:case i>l:return t()}return Math.max(e.taggedElement(),t())}const Le={enabled:()=>D,getOffset:()=>P,auto:()=>qe(Le),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Le.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ie(Le)),min:()=>Math.min(...Ie(Le)),grow:()=>Le.max(),lowestElement:()=>Ne(i),taggedElement:()=>Ne(i)},Be={enabled:()=>W,getOffset:()=>A,auto:()=>qe(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ie(Be)),min:()=>Math.min(...Ie(Be)),rightMostElement:()=>Ne(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ne(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Ue(e,t,n,o,i){k=performance.now(),(R||e===a)&&(document.hidden||(We||(I=!0,function(e,t,n,o,i){const r=void 0===n?Le[H]():n,l=void 0===o?Be[fe]():o;D&&De(J,r)||W&&De(me,l)||"init"===e?(Fe(),J=r,me=l,He(J,me,e,i)):!e!==a&&(D&&H in T||W&&fe in T)?Je():I=!1}(e,0,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0))}function Fe(){de||(de=!0,requestAnimationFrame((()=>{de=!1})))}function Ve(e){J=Le[H](),me=Be[fe](),He(J,me,e)}function Je(e){const t=H;H=b,Fe(),Ve("reset"),H=t}function He(e,t,n,o,i){Y<-1||(void 0!==i||(i=se),function(){const r=`${K}:${e+(P||0)}:${t+(A||0)}:${n}${void 0===o?"":`:${o}`}`;X&&(console.group(`[iframe-resizer][${K}]`),console.info("Sending message to host page via "+(ie?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),I&&console.info(function(){const e=m(performance.now()-k);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),I=!1,ie?window.parent.iframeParentListener($+r):le.postMessage($+r,i)}())}function Ze(e){const t={init:function(){_=e.data,le=e.source,N=e.origin,ve(),U=!1,setTimeout((()=>{Z=!1}),f)},reset(){Z||Ve("resetPage")},resize(){Ue(a)},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ge?setTimeout((()=>ge(JSON.parse(e)))):He(0,0,"pageInfoStop")},parentInfo(){const e=o();be?setTimeout(be(Object.freeze(JSON.parse(e)))):He(0,0,"parentInfoStop")},message(){const e=o();he(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};$===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||v(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?v("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}();
|
|
20
|
+
"use strict";const e="5.3.3-beta.1",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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 d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),M=e=>S(e),E=e=>{const t=e.side||i,n=e.onChange||c,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},T="--ifr-start",O="--ifr-end",j="--ifr-measure",P=[],C=new WeakSet,A=e=>"object"==typeof e&&C.add(e);let I=null,N={};const k=setInterval((()=>{if(P.length<10)return;if(N.hasTags&&N.len<25)return;P.sort();const e=Math.min(P.reduce(((e,t)=>e+t),0)/P.length,P[Math.floor(P.length/2)]);z("Max time:",Math.max(...P)),e<=4||(clearInterval(k),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${N.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(j,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;N=e,C.has(I)||i&&o<=1||(r||A(I),w(`\n ${n} position calculated from:`,I,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),P.push(t),P.length>100&&P.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),De.auto()),width:()=>($("Custom width calculation function not defined"),We.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",j=w.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},C="scroll";let A,N,k,R,x,L=!0,q="",B=0,D="",W="",U=!0,F=!1,H=!0,V=!1,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe=[],ie="child",re=null,ae=!1,le="",se=[],de=window.parent,ce="*",ue=0,me=!1,fe="",pe=1,ge=C,he=window,ye=()=>{$("onMessage function not defined")},be=()=>{},ve=null,ze=null;function we(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(j).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),F=void 0===t[2]?F:e(t[2]),G=void 0===t[3]?G:e(t[3]),L=void 0===t[6]?L:e(t[6]),D=t[7],_=void 0===t[8]?_:t[8],q=t[9],W=t[10],ue=void 0===t[11]?ue:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),ie=void 0===t[13]?ie:t[13],ge=void 0===t[14]?ge:t[14],ee=void 0===t[15]?ee:e(t[15]),A=void 0===t[16]?A:Number(t[16]),N=void 0===t[17]?N:Number(t[17]),U=void 0===t[18]?U:e(t[18]),t[19],fe=t[20]||fe,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),ye=e?.onMessage||ye,be=e?.onReady||be,"number"==typeof e?.offset&&(S("<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</>."),U&&(A=e?.offset),F&&(N=e?.offset)),"number"==typeof e?.offsetSize&&(U&&(A=e?.offsetSize),F&&(N=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(le=e.sizeSelector),ce=e?.targetOrigin||ce,_=e?.heightCalculationMethod||_,ge=e?.widthCalculationMethod||ge}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),ge=t(ge,"width"),z(`TargetOrigin for parent set to: ${ce}`))}(),function(){try{ae="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?M(`${d(K+2)}${d(2)}`):fe.codePointAt(0)>4||K<2&&M(d(3)),fe&&""!==fe&&"false"!==fe?fe!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${e}.\n`):S("<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&&S("<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</>.")}(),Se(),U!==F&&(ne=E({onChange:$e,root:document.documentElement,side:U?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,He("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===L&&(L=!1),_e(0,0,"autoResize",JSON.stringify(L)),L),close(){_e(0,0,"close")},getId:()=>te,getOrigin:()=>(S("<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),k),getParentOrigin:()=>k,getPageInfo(e){if("function"==typeof e)return ve=e,_e(0,0,"pageInfo"),void S("<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,_e(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ze=e,_e(0,0,"parentInfo"),()=>{ze=null,_e(0,0,"parentInfoStop")}},getParentProperties(e){S("<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){Y.findTarget(e)},reset(){Ze("parentIframe.reset")},scrollBy(e,t){_e(t,e,"scrollBy")},scrollTo(e,t){_e(t,e,"scrollTo")},scrollToOffset(e,t){_e(t,e,"scrollToOffset")},sendMessage(e,t){_e(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,Pe()},setWidthCalculationMethod(e){ge=e,Ce()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),ce=e},resize(e,t){He(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<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){_e(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=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);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),_e(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?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),_e(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),Me(xe(document)()),void 0===D&&(D=`${B}px`),Ee("margin",(c="margin",(u=D).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Ee("background",q),Ee("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),z('HTML & body height set to "auto !important"')}(),Te(),He("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&_e(0,0,"title",document.title),!0!==L&&z("Auto Resize disabled"),Oe({method:o="add",eventType:"After Print",eventName:"afterprint"}),Oe({method:o,eventType:"Before Print",eventName:"beforeprint"}),Oe({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Te(),Se(),Me(e),e.forEach(Ne),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),re=new ResizeObserver(Ae),re.observe(document.body),Ie.add(document.body),Ne(document.body),setTimeout(be),z("Initialization complete"),z("---")}function $e(e){z("Overflowed Elements:",e.length),oe=e,V=oe.length>0,He("overflowChanged","Overflow updated")}function Se(){se=document.querySelectorAll(`[${n}]`),J=se.length>0,z(`Tagged elements found: ${J}`)}function Me(e){J||ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Te(){if(""!==le){z(`Applying sizeSelector: ${le}`);for(const e of document.querySelectorAll(le))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Oe(e){({add(t){function n(){He(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function je(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function Pe(){_=je(_,v,De,"height")}function Ce(){ge=je(ge,C,We,"width")}function Ae(e){Array.isArray(e)&&0!==e.length&&He("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Ie=new WeakSet;function Ne(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ie.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=xe(e)();for(const e of t){if(Ie.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function ke(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?se:V?oe:xe(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return I=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Re=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xe=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)"),Le={height:0,width:0},qe={height:0,width:0};function Be(e){function t(){return qe[o]=i,Le[o]=l,i}const n=e===De,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: ${i} Page: ${l}`;switch(!0){case!e.enabled():return l;case J:return e.taggedElement();case!V&&0===qe[o]&&0===Le[o]:return z(`Initial page size values: ${s}`),t();case me&&i===qe[o]&&l===Le[o]:return z(`Size unchanged: ${s}`),Math.max(i,l);case 0===i:return z(`Page is hidden: ${s}`),l;case!V&&i!==qe[o]&&l<=Le[o]:return z(`New HTML bounding size: ${s}`,"Previous bounding size:",qe[o]),t();case!n:return e.taggedElement();case!V&&i<qe[o]:return z("HTML bounding size decreased:",s),t();case l===a||l===r:return z("HTML bounding size equals page size:",s),t();case i>l:return z(`Page size < HTML bounding size: ${s}`),t();default:z(`Content overflowing HTML element: ${s}`)}return Math.max(e.taggedElement(),t())}const De={enabled:()=>U,getOffset:()=>A,auto:()=>Be(De),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>De.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Re(De)),min:()=>Math.min(...Re(De)),grow:()=>De.max(),lowestElement:()=>ke(i),taggedElement:()=>ke(i)},We={enabled:()=>F,getOffset:()=>N,auto:()=>Be(We),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Re(We)),min:()=>Math.min(...Re(We)),rightMostElement:()=>ke(r),scroll:()=>Math.max(We.bodyScroll(),We.documentElementScroll()),taggedElement:()=>ke(r)},Ue=(e,t)=>!(Math.abs(e-t)<=ue);let Fe=!1;function He(e,t,n,o,i){x=performance.now(),L||e===a?document.hidden?z("Page hidden - Ignored resize request"):(Fe||(z(`Resize event: ${t}`),R=!0,function(e,t,n,o,i){const r=void 0===n?De[_]():n,l=void 0===o?We[ge]():o;U&&Ue(Z,r)||F&&Ue(pe,l)||"init"===e?(Ve(),Z=r,pe=l,_e(Z,pe,e,i)):!e!==a&&(U&&_ in P||F&&ge in P)?Ze(t):R=!1}(e,t,n,o,i),requestAnimationFrame((()=>{Fe=!1}))),Fe=!0):z("Resizing disabled")}function Ve(){me||(me=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{me=!1,z("Trigger event lock off"),z("--")})))}function Je(e){Z=De[_](),pe=We[ge](),_e(Z,pe,e)}function Ze(e){const t=_;_=v,z(`Reset trigger event: ${e}`),Ve(),Je("reset"),_=t}function _e(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(A||0)}:${t+(N||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(ae?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),R&&console.info(function(){const e=m(performance.now()-x);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),R=!1,ae?window.parent.iframeParentListener(w+r):de.postMessage(w+r,i)}())}function Qe(e){const t={init:function(){X=e.data,de=e.source,k=e.origin,we(),H=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Je("resetPage"))},resize(){He(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),ve?setTimeout((()=>ve(JSON.parse(e)))):_e(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ze?setTimeout(ze(Object.freeze(JSON.parse(e)))):_e(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),ye(JSON.parse(e)),z(" --")}},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};w===`${e.data}`.slice(0,j)&&(!1!==H?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function Xe(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Qe({data:e,sameDomain:!0}))),l(window,"message",Qe),l(window,"readystatechange",Xe),Xe())}();
|
|
21
|
+
//# sourceMappingURL=index.cjs.js.map
|
package/index.cjs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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-overflowed'\n\nexport const HEIGHT_EDGE = 'bottom'\nexport const WIDTH_EDGE = 'right'\n\nexport const MANUAL_RESIZE_REQUEST = 'resizeParent'\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\nconst ROUNDING = 100_000\n\nexport const round = (value) => Math.round(value * ROUNDING) / ROUNDING\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\nconst BOLD = 'font-weight: bold;'\nconst NORMAL = 'font-weight: normal;'\n\n// TODO: remove .join(' '), requires major test updates\nconst formatLogMsg = (...msg) =>\n [`[iframe-resizer][${id || 'child'}]`, ...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 logging && console?.info(`%c[iframe-resizer][${id}]%c`, BOLD, NORMAL, ...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'\n\nconst overflowObserver = (options) => {\n const side = options.side || HEIGHT_EDGE\n const onChange = options.onChange || id\n\n const observerOptions = {\n root: options.root,\n rootMargin: '0px',\n threshold: 1,\n }\n\n function emit() {\n const overflowedNodeList = document.querySelectorAll(`[${OVERFLOW_ATTR}]`)\n onChange(overflowedNodeList)\n }\n\n const emitAfterReflow = () => requestAnimationFrame(emit)\n\n function callback(entries) {\n for (const entry of entries) {\n const { boundingClientRect, rootBounds, target } = entry\n const edge = boundingClientRect[side]\n const hasOverflow = edge === 0 || edge > rootBounds[side]\n target.toggleAttribute(OVERFLOW_ATTR, hasOverflow)\n }\n\n emitAfterReflow()\n }\n\n const observer = new IntersectionObserver(callback, observerOptions)\n const observed = new WeakSet()\n\n return function (nodeList) {\n for (const node of nodeList) {\n if (node.nodeType !== Node.ELEMENT_NODE || observed.has(node)) continue\n\n observer.observe(node)\n observed.add(node)\n }\n }\n}\n\nexport default overflowObserver\n","import { round } from '../common/utils'\nimport { advise, info, log } from './log'\n\nconst SECOND = 1000\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)\n\n// let 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 (\n usedTags.has(perfEl) /* || lastPerfEl === perfEl */ ||\n (hasTags && len <= 1)\n )\n return\n\n if (!logging) addUsedTag(perfEl)\n\n // lastPerfEl = perfEl\n\n info(\n `\\n ${Side} position calculated from:`,\n perfEl,\n `\\n Parsed ${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 MANUAL_RESIZE_REQUEST,\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, round } 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 overflowObserver 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 boundingClientRect: 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 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 widthCalcModeDefault = 'scroll'\n\n let autoResize = true\n let bodyBackground = ''\n let bodyMargin = 0\n let bodyMarginStr = ''\n let bodyPadding = ''\n let calculateHeight = true\n let calculateWidth = false\n let firstRun = true\n let hasOverflow = false\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 origin\n let overflowedNodeList = []\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 timerActive\n let totalTime\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\n setLogOptions({ id: myID, logging })\n log(`Initialising iframe v${VERSION} (${window.location.href})`)\n readDataFromPage()\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 sendSize(\n 'init',\n 'Init message from host page',\n undefined,\n undefined,\n VERSION,\n )\n\n sendTitle()\n initEventListeners()\n setTimeout(onReady)\n\n log('Initialization complete')\n log('---')\n }\n\n function onOverflowChange(nodeList) {\n log('Overflowed Elements:', nodeList.length)\n\n overflowedNodeList = nodeList\n hasOverflow = overflowedNodeList.length > 0\n\n sendSize('overflowChanged', 'Overflow updated')\n }\n\n function setupObserveOverflow() {\n if (calculateHeight === calculateWidth) return\n observeOverflow = overflowObserver({\n onChange: onOverflowChange,\n root: document.documentElement,\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) 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 `<b>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(data) {\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 const data = window.iframeResizer || window.iFrameResizer\n\n if (typeof data !== 'object') return\n\n readData(data)\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\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 for (const el of document.querySelectorAll(sizeSelector)) {\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 }\n\n manageEventListeners('add')\n setupMutationObserver()\n setupResizeObservers()\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 for (const link of document.querySelectorAll('a[href^=\"#\"]')) {\n if (link.getAttribute('href') !== '#') {\n addEventListener(link, 'click', (e) => {\n e.preventDefault()\n findTarget(link.getAttribute('href'))\n })\n }\n }\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 sendSize('autoResizeEnabled', 'Auto Resize enabled')\n } else if (resize === false && autoResize === true) {\n autoResize = false\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 getOrigin: () => {\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n return origin\n },\n\n getParentOrigin: () => origin,\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 MANUAL_RESIZE_REQUEST,\n `parentIframe.resize(${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 function resizeObserved(entries) {\n if (!Array.isArray(entries) || entries.length === 0) return\n\n const el = entries[0].target\n\n sendSize('resizeObserver', `Resize Observed: ${getElementName(el)}`)\n }\n\n const resizeSet = new WeakSet()\n\n // This function has to iterate over all page elements during load\n // so is optimized for performance, rather than best practices.\n function attachResizeObserverToNonStaticElements(rootElement) {\n if (rootElement.nodeType !== Node.ELEMENT_NODE) return\n\n if (!resizeSet.has(rootElement)) {\n const position = getComputedStyle(rootElement)?.position\n if (!(position === '' || position === 'static')) {\n resizeObserver.observe(rootElement)\n resizeSet.add(rootElement)\n log(`Attached resizeObserver: ${getElementName(rootElement)}`)\n }\n }\n\n const nodeList = getAllElements(rootElement)()\n\n for (const node of nodeList) {\n if (resizeSet.has(node) || node?.nodeType !== Node.ELEMENT_NODE) continue\n\n const position = getComputedStyle(node)?.position\n if (position === '' || position === 'static') continue\n\n resizeObserver.observe(node)\n resizeSet.add(node)\n log(`Attached resizeObserver: ${getElementName(node)}`)\n }\n }\n\n function setupResizeObservers() {\n resizeObserver = new ResizeObserver(resizeObserved)\n resizeObserver.observe(document.body)\n resizeSet.add(document.body)\n attachResizeObserverToNonStaticElements(document.body)\n }\n\n function setupMutationObserver() {\n const observedMutations = new Set()\n let pending = false\n let perfMon = 0\n let newMutations = []\n\n const updateMutation = (mutations) => {\n for (const mutation of mutations) {\n const { addedNodes, removedNodes } = mutation\n\n for (const node of addedNodes) {\n observedMutations.add(node)\n }\n\n for (const node of removedNodes) {\n observedMutations.delete(node)\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 log('MutationObserver: 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(attachResizeObserverToNonStaticElements)\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 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 : hasOverflow\n ? overflowedNodeList\n : getAllElements(document)() // We should never get here, but just in case\n\n let len = targetElements.length\n\n for (const element of targetElements) {\n if (\n !hasTags &&\n hasCheckVisibility && // Safari was missing checkVisibility until March 2024\n !element.checkVisibility(checkVisibilityOptions)\n ) {\n len -= 1\n continue\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.boundingClientRect(),\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 isHeight = getDimension === getHeight\n const dimension = isHeight ? 'height' : 'width'\n const boundingSize = getDimension.boundingClientRect()\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 boundingClientRect: () =>\n Math.max(\n document.documentElement.getBoundingClientRect().bottom,\n document.body.getBoundingClientRect().bottom,\n ),\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 boundingClientRect: () =>\n Math.max(\n document.documentElement.getBoundingClientRect().right,\n document.body.getBoundingClientRect().right,\n ),\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 const checkTolerance = (a, b) => !(Math.abs(a - b) <= tolerance)\n\n function sizeIframe(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n const isForceResizableEvent = () => !triggerEvent !== MANUAL_RESIZE_REQUEST\n\n const isForceResizableCalcMode = () =>\n (calculateHeight && heightCalcMode in resetRequiredMethods) ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n\n const isSizeChangeDetected = () =>\n (calculateHeight && checkTolerance(height, newHeight)) ||\n (calculateWidth && checkTolerance(width, newWidth))\n\n const newHeight =\n undefined === customHeight ? getHeight[heightCalcMode]() : customHeight\n const newWidth =\n undefined === customWidth ? getWidth[widthCalcMode]() : customWidth\n\n if (isSizeChangeDetected() || triggerEvent === 'init') {\n lockTrigger()\n height = newHeight\n width = newWidth\n sendMsg(height, width, triggerEvent, msg)\n } else if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIframe(triggerEventDesc)\n } else {\n timerActive = false // We're not resizing, so turn off the timer\n }\n }\n\n let sendPending = false\n\n function sendSize(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n totalTime = performance.now()\n\n if (!autoResize && triggerEvent !== MANUAL_RESIZE_REQUEST) {\n log('Resizing disabled')\n return\n }\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 (!sendPending) {\n log(`Resize event: ${triggerEventDesc}`)\n timerActive = true\n sizeIframe(triggerEvent, triggerEventDesc, customHeight, customWidth, msg)\n requestAnimationFrame(() => {\n sendPending = false\n })\n }\n\n sendPending = true\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 displayTimeTaken() {\n const timer = round(performance.now() - totalTime)\n return triggerEvent === 'init'\n ? `Initialised iFrame in %c${timer}ms`\n : `Content size recalculated in %c${timer}ms`\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 /* eslint-disable no-console */\n if (logging) {\n console.group(`[iframe-resizer][${myID}]`)\n console.info(\n `Sending message to host page via ${sameDomain ? 'sameDomain' : 'postMessage'}`,\n )\n console.info(`%c${message}`, 'font-style: italic')\n if (timerActive)\n console.info(displayTimeTaken(), 'font-weight:bold;color:#777')\n console.groupEnd()\n }\n /* eslint-enable no-console */\n\n timerActive = false\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 origin = event.origin\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(MANUAL_RESIZE_REQUEST, '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 setTimeout(() => 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 setTimeout(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 if ('iframeChildListener' in window) {\n warn('Already setup')\n } else {\n window.iframeChildListener = (data) =>\n setTimeout(() => receiver({ data, sameDomain: true }))\n\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n\n chkLateLoaded()\n }\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","MANUAL_RESIZE_REQUEST","addEventListener","el","evt","func","options","y","Object","fromEntries","map","l","p","Math","max","getModeData","replaceAll","String","fromCodePoint","codePointAt","id","x","ROUNDING","round","value","logging","setLogOptions","capitalizeFirstLetter","string","charAt","toUpperCase","slice","isDef","undefined","getElementName","nodeName","name","className","formatLogMsg","msg","join","log","console","info","warn","advise","window","chrome","formatAdvise","adviser","overflowObserver","side","onChange","observerOptions","root","rootMargin","threshold","emit","overflowedNodeList","document","querySelectorAll","observer","IntersectionObserver","entries","entry","boundingClientRect","rootBounds","target","edge","hasOverflow","toggleAttribute","requestAnimationFrame","observed","WeakSet","nodeList","node","nodeType","Node","ELEMENT_NODE","has","observe","add","PREF_START","PREF_END","PREF_MEASURE","timings","usedTags","addUsedTag","perfEl","details","timingCheck","setInterval","length","hasTags","len","sort","average","min","reduce","a","b","floor","clearInterval","Side","toLowerCase","perfObserver","list","getEntries","forEach","duration","performance","measure","detail","usedEl","push","shift","setup","PerformanceObserver","entryTypes","documentElement","body","readyState","checkVisibilityOptions","contentVisibilityAuto","opacityProperty","visibilityProperty","customCalcMethods","height","getHeight","auto","width","getWidth","deprecatedResizeMethods","bodyOffset","bodyScroll","offset","documentElementOffset","documentElementScroll","grow","lowestElement","eventCancelTimer","eventHandlersByName","hasCheckVisibility","heightCalcModeDefault","msgID","msgIdLen","resetRequiredMethods","widthCalcModeDefault","offsetHeight","offsetWidth","origin","timerActive","totalTime","autoResize","bodyBackground","bodyMargin","bodyMarginStr","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","init","method","attr","strBool","str","data","split","Number","enable","readDataFromParent","location","href","readData","JSON","stringify","offsetSize","prototype","hasOwnProperty","call","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","iframeResizer","iFrameResizer","readDataFromPage","error","checkCrossDomain","checkHeightMode","checkWidthMode","found","checkAttrs","removeAttribute","checkDeprecatedAttrs","checkAndSetupTags","onOverflowChange","parentIframe","freeze","resize","sendSize","sendMsg","close","getId","getOrigin","getParentOrigin","getPageInfo","callback","getParentProps","TypeError","getParentProperties","this","moveToAnchor","hash","findTarget","reset","resetIframe","scrollBy","scrollTo","scrollToOffset","sendMessage","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","customHeight","customWidth","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","link","getAttribute","preventDefault","bindLocationHash","initCheck","setTimeout","enableInPageLinks","setupInPageLinks","addOverflowObservers","getAllElements","setBodyStyle","includes","clearFix","createElement","style","clear","display","append","injectClearFixIntoBodyElement","setAutoHeight","setProperty","stopInfiniteResizingOfIframe","applySizeSelector","title","manageTriggerEvent","eventType","eventName","observedMutations","Set","pending","perfMon","newMutations","updateMutation","mutations","mutation","addedNodes","removedNodes","delete","DELAY","DELAY_MARGIN","DELAY_MAX","delayCount","processMutations","now","delay","delayLimit","attachResizeObserverToNonStaticElements","mutationObserved","createMutationObserver","MutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","setupMutationObserver","ResizeObserver","resizeObserved","resizeSet","dataset","iframeSize","handleEvent","passive","remove","removeEventListener","checkCalcMode","calcModeDefault","modes","Array","isArray","rootElement","position","getComputedStyle","getMaxElement","mark","elVal","maxEl","maxVal","bottom","targetElements","element","checkVisibility","parseFloat","getPropertyValue","getAllMeasurements","dimension","prevScrollSize","prevBoundingSize","getAutoSize","getDimension","returnBoundingClientRect","boundingSize","scrollSize","isHeight","ceilBoundingSize","ceil","floorBoundingSize","getOffset","getAdjustedScroll","sizes","enabled","taggedElement","marginTop","marginBottom","scrollHeight","custom","scrollWidth","right","rightMostElement","scroll","checkTolerance","abs","sendPending","triggerEvent","triggerEventDesc","hidden","newHeight","newWidth","lockTrigger","sizeIframe","triggerReset","hcm","message","group","timer","displayTimeTaken","groupEnd","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,kBAEhBC,EAAc,SACdC,EAAa,QAEbC,EAAwB,eCXxBC,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,G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
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -17,4 +17,5 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
const e="5.3.2",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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))))(s[e]),d=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const h=e=>{f=e.id,p=e.logging},y=e=>""!=`${e}`&&void 0!==e;const g=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),b=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),v=(...e)=>console?.warn(g(...e)),w=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(g)(...e)),z=e=>w(e),S=e=>{const t=e.side||i,n=e.onChange||d,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},E="--ifr-start",j="--ifr-end",$="--ifr-measure",C=[],T=new WeakSet,M=e=>"object"==typeof e&&T.add(e);let O=null,P={};const A=setInterval((()=>{if(C.length<10)return;if(P.hasTags&&P.len<25)return;C.sort();const e=Math.min(C.reduce(((e,t)=>e+t),0)/C.length,C[Math.floor(C.length/2)]);e<=4||(clearInterval(A),w(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${P.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function N(e){e.getEntries().forEach((e=>{if(e.name===j){const{duration:t}=performance.measure($,E,j);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;P=e,T.has(O)||i&&o<=1||(r||M(O),b(`\n ${n} position calculated from:`,O,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),C.push(t),C.length>100&&C.shift()}}))}function I(){new PerformanceObserver(N).observe({entryTypes:["mark"]}),M(document.documentElement),M(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",I):I()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(v("Custom height calculation function not defined"),Le.auto()),width:()=>(v("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},g="checkVisibility"in window,b="auto",$="[iFrameSizer]",C=$.length,T={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="scroll";let P,A,N,I,k,R=!0,x="",q=0,L="",B="",D=!0,W=!1,U=!0,F=!1,V=!1,J=1,H=b,Z=!0,_="",Q={},X=!1,Y=0,G=!1,K="",ee=d,te=[],ne="child",oe=null,ie=!1,re="",ae=[],le=window.parent,se="*",ce=0,de=!1,ue="",me=1,fe=M,pe=window,he=()=>{v("onMessage function not defined")},ye=()=>{},ge=null,be=null;function ve(){var o,d,u;!function(){const e=e=>"true"===e,t=_.slice(C).split(":");K=t[0],q=void 0===t[1]?q:Number(t[1]),W=void 0===t[2]?W:e(t[2]),X=void 0===t[3]?X:e(t[3]),R=void 0===t[6]?R:e(t[6]),L=t[7],H=void 0===t[8]?H:t[8],x=t[9],B=t[10],ce=void 0===t[11]?ce:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ne=void 0===t[13]?ne:t[13],fe=void 0===t[14]?fe:t[14],G=void 0===t[15]?G:e(t[15]),P=void 0===t[16]?P:Number(t[16]),A=void 0===t[17]?A:Number(t[17]),D=void 0===t[18]?D:e(t[18]),t[19],ue=t[20]||ue,Y=void 0===t[21]?Y:Number(t[21])}(),h({id:K,logging:X}),function(){function e(e){he=e?.onMessage||he,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</>."),D&&(P=e?.offset),W&&(A=e?.offset)),"number"==typeof e?.offsetSize&&(D&&(P=e?.offsetSize),W&&(A=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(re=e.sizeSelector),se=e?.targetOrigin||se,H=e?.heightCalculationMethod||H,fe=e?.widthCalculationMethod||fe}function t(e,t){return"function"==typeof e&&(s[t]=e,e="custom"),e}if(1===Y)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),H=t(H,"height"),fe=t(fe,"width"))}(),function(){try{ie="iframeParentListener"in window.parent}catch(e){}}(),Y<0?z(`${c(Y+2)}${c(2)}`):ue.codePointAt(0)>4||Y<2&&z(c(3)),ue&&""!==ue&&"false"!==ue?ue!==e&&w(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ue} - 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"),Te(),Me(),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</>.")}(),ze(),D!==W&&(ee=S({onChange:we,root:document.documentElement,side:D?i:r})),1!==Y&&(pe.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===R?(R=!0,Ue("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===R&&(R=!1),He(0,0,"autoResize",JSON.stringify(R)),R),close(){He(0,0,"close")},getId:()=>K,getOrigin:()=>N,getPageInfo(e){if("function"==typeof e)return ge=e,He(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");ge=null,He(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return be=e,He(0,0,"parentInfo"),()=>{be=null,He(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){Q.findTarget(e)},reset(){Je()},scrollBy(e,t){He(t,e,"scrollBy")},scrollTo(e,t){He(t,e,"scrollTo")},scrollToOffset(e,t){He(t,e,"scrollToOffset")},sendMessage(e,t){He(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){H=e,Te()},setWidthCalculationMethod(e){fe=e,Me()},setTargetOrigin(e){se=e},resize(e,t){Ue(a,`parentIframe.resize(${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)}}),pe.parentIFrame=pe.parentIframe),function(){function e(e){He(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){l(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);He(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?He(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function c(){r(),a(),s()}return Q.enable&&(1===Y?w("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),Se(ke(document)()),void 0===L&&(L=`${q}px`),Ee("margin",(d="margin",(u=L).includes("-")&&(v(`Negative CSS value ignored for ${d}`),u=""),u)),Ee("background",x),Ee("padding",B),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)}(),je(),Ue("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&He(0,0,"title",document.title),$e({method:o="add",eventType:"After Print",eventName:"afterprint"}),$e({method:o,eventType:"Before Print",eventName:"beforeprint"}),$e({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(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?(je(),ze(),Se(e),e.forEach(Ae),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}u()}(),oe=new ResizeObserver(Oe),oe.observe(document.body),Pe.add(document.body),Ae(document.body),setTimeout(ye)}function we(e){te=e,F=te.length>0,Ue("overflowChanged","Overflow updated")}function ze(){ae=document.querySelectorAll(`[${n}]`),V=ae.length>0}function Se(e){V||ee(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function je(){if(""!==re)for(const e of document.querySelectorAll(re))e.dataset.iframeSize=!0}function $e(e){({add(t){function n(){Ue(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function Ce(e,t,n,o){return t!==e&&(e in n||(v(`${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.`)),e}function Te(){H=Ce(H,b,Le,"height")}function Me(){fe=Ce(fe,M,Be,"width")}function Oe(e){Array.isArray(e)&&0!==e.length&&Ue("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const Pe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Pe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(oe.observe(e),Pe.add(e))}const t=ke(e)();for(const e of t){if(Pe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(oe.observe(e),Pe.add(e))}}function Ne(e){performance.mark(E);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=V?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(E);const l=V?ae:F?te:ke(document)();let s=l.length;for(const t of l)V||!g||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1;return O=r,performance.mark(j,{detail:{Side:t,len:s,hasTags:V,logging:X}}),a}const Ie=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=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)"),Re={height:0,width:0},xe={height:0,width:0};function qe(e){function t(){return xe[o]=i,Re[o]=l,i}const n=e===Le,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return l;case V:return e.taggedElement();case!F&&0===xe[o]&&0===Re[o]:return t();case de&&i===xe[o]&&l===Re[o]:return Math.max(i,l);case 0===i:return l;case!F&&i!==xe[o]&&l<=Re[o]:return t();case!n:return e.taggedElement();case!F&&i<xe[o]:case l===a||l===r:case i>l:return t()}return Math.max(e.taggedElement(),t())}const Le={enabled:()=>D,getOffset:()=>P,auto:()=>qe(Le),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Le.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ie(Le)),min:()=>Math.min(...Ie(Le)),grow:()=>Le.max(),lowestElement:()=>Ne(i),taggedElement:()=>Ne(i)},Be={enabled:()=>W,getOffset:()=>A,auto:()=>qe(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ie(Be)),min:()=>Math.min(...Ie(Be)),rightMostElement:()=>Ne(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ne(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Ue(e,t,n,o,i){k=performance.now(),(R||e===a)&&(document.hidden||(We||(I=!0,function(e,t,n,o,i){const r=void 0===n?Le[H]():n,l=void 0===o?Be[fe]():o;D&&De(J,r)||W&&De(me,l)||"init"===e?(Fe(),J=r,me=l,He(J,me,e,i)):!e!==a&&(D&&H in T||W&&fe in T)?Je():I=!1}(e,0,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0))}function Fe(){de||(de=!0,requestAnimationFrame((()=>{de=!1})))}function Ve(e){J=Le[H](),me=Be[fe](),He(J,me,e)}function Je(e){const t=H;H=b,Fe(),Ve("reset"),H=t}function He(e,t,n,o,i){Y<-1||(void 0!==i||(i=se),function(){const r=`${K}:${e+(P||0)}:${t+(A||0)}:${n}${void 0===o?"":`:${o}`}`;X&&(console.group(`[iframe-resizer][${K}]`),console.info("Sending message to host page via "+(ie?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),I&&console.info(function(){const e=m(performance.now()-k);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),I=!1,ie?window.parent.iframeParentListener($+r):le.postMessage($+r,i)}())}function Ze(e){const t={init:function(){_=e.data,le=e.source,N=e.origin,ve(),U=!1,setTimeout((()=>{Z=!1}),f)},reset(){Z||Ve("resetPage")},resize(){Ue(a)},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ge?setTimeout((()=>ge(JSON.parse(e)))):He(0,0,"pageInfoStop")},parentInfo(){const e=o();be?setTimeout(be(Object.freeze(JSON.parse(e)))):He(0,0,"parentInfoStop")},message(){const e=o();he(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};$===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||v(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?v("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}();
|
|
20
|
+
const e="5.3.3-beta.1",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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 d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),M=e=>S(e),E=e=>{const t=e.side||i,n=e.onChange||c,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},T="--ifr-start",O="--ifr-end",j="--ifr-measure",P=[],C=new WeakSet,A=e=>"object"==typeof e&&C.add(e);let I=null,N={};const k=setInterval((()=>{if(P.length<10)return;if(N.hasTags&&N.len<25)return;P.sort();const e=Math.min(P.reduce(((e,t)=>e+t),0)/P.length,P[Math.floor(P.length/2)]);z("Max time:",Math.max(...P)),e<=4||(clearInterval(k),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${N.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(j,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;N=e,C.has(I)||i&&o<=1||(r||A(I),w(`\n ${n} position calculated from:`,I,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),P.push(t),P.length>100&&P.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),De.auto()),width:()=>($("Custom width calculation function not defined"),We.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",j=w.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},C="scroll";let A,N,k,R,x,L=!0,q="",B=0,D="",W="",U=!0,F=!1,H=!0,V=!1,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe=[],ie="child",re=null,ae=!1,le="",se=[],de=window.parent,ce="*",ue=0,me=!1,fe="",pe=1,ge=C,he=window,ye=()=>{$("onMessage function not defined")},be=()=>{},ve=null,ze=null;function we(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(j).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),F=void 0===t[2]?F:e(t[2]),G=void 0===t[3]?G:e(t[3]),L=void 0===t[6]?L:e(t[6]),D=t[7],_=void 0===t[8]?_:t[8],q=t[9],W=t[10],ue=void 0===t[11]?ue:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),ie=void 0===t[13]?ie:t[13],ge=void 0===t[14]?ge:t[14],ee=void 0===t[15]?ee:e(t[15]),A=void 0===t[16]?A:Number(t[16]),N=void 0===t[17]?N:Number(t[17]),U=void 0===t[18]?U:e(t[18]),t[19],fe=t[20]||fe,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),ye=e?.onMessage||ye,be=e?.onReady||be,"number"==typeof e?.offset&&(S("<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</>."),U&&(A=e?.offset),F&&(N=e?.offset)),"number"==typeof e?.offsetSize&&(U&&(A=e?.offsetSize),F&&(N=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(le=e.sizeSelector),ce=e?.targetOrigin||ce,_=e?.heightCalculationMethod||_,ge=e?.widthCalculationMethod||ge}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),ge=t(ge,"width"),z(`TargetOrigin for parent set to: ${ce}`))}(),function(){try{ae="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?M(`${d(K+2)}${d(2)}`):fe.codePointAt(0)>4||K<2&&M(d(3)),fe&&""!==fe&&"false"!==fe?fe!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${e}.\n`):S("<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&&S("<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</>.")}(),Se(),U!==F&&(ne=E({onChange:$e,root:document.documentElement,side:U?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,He("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===L&&(L=!1),_e(0,0,"autoResize",JSON.stringify(L)),L),close(){_e(0,0,"close")},getId:()=>te,getOrigin:()=>(S("<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),k),getParentOrigin:()=>k,getPageInfo(e){if("function"==typeof e)return ve=e,_e(0,0,"pageInfo"),void S("<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,_e(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ze=e,_e(0,0,"parentInfo"),()=>{ze=null,_e(0,0,"parentInfoStop")}},getParentProperties(e){S("<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){Y.findTarget(e)},reset(){Ze("parentIframe.reset")},scrollBy(e,t){_e(t,e,"scrollBy")},scrollTo(e,t){_e(t,e,"scrollTo")},scrollToOffset(e,t){_e(t,e,"scrollToOffset")},sendMessage(e,t){_e(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,Pe()},setWidthCalculationMethod(e){ge=e,Ce()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),ce=e},resize(e,t){He(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<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){_e(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=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);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),_e(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?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),_e(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),Me(xe(document)()),void 0===D&&(D=`${B}px`),Ee("margin",(c="margin",(u=D).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Ee("background",q),Ee("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),z('HTML & body height set to "auto !important"')}(),Te(),He("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&_e(0,0,"title",document.title),!0!==L&&z("Auto Resize disabled"),Oe({method:o="add",eventType:"After Print",eventName:"afterprint"}),Oe({method:o,eventType:"Before Print",eventName:"beforeprint"}),Oe({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Te(),Se(),Me(e),e.forEach(Ne),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),re=new ResizeObserver(Ae),re.observe(document.body),Ie.add(document.body),Ne(document.body),setTimeout(be),z("Initialization complete"),z("---")}function $e(e){z("Overflowed Elements:",e.length),oe=e,V=oe.length>0,He("overflowChanged","Overflow updated")}function Se(){se=document.querySelectorAll(`[${n}]`),J=se.length>0,z(`Tagged elements found: ${J}`)}function Me(e){J||ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Te(){if(""!==le){z(`Applying sizeSelector: ${le}`);for(const e of document.querySelectorAll(le))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Oe(e){({add(t){function n(){He(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function je(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function Pe(){_=je(_,v,De,"height")}function Ce(){ge=je(ge,C,We,"width")}function Ae(e){Array.isArray(e)&&0!==e.length&&He("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Ie=new WeakSet;function Ne(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ie.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=xe(e)();for(const e of t){if(Ie.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function ke(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?se:V?oe:xe(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return I=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Re=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xe=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)"),Le={height:0,width:0},qe={height:0,width:0};function Be(e){function t(){return qe[o]=i,Le[o]=l,i}const n=e===De,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: ${i} Page: ${l}`;switch(!0){case!e.enabled():return l;case J:return e.taggedElement();case!V&&0===qe[o]&&0===Le[o]:return z(`Initial page size values: ${s}`),t();case me&&i===qe[o]&&l===Le[o]:return z(`Size unchanged: ${s}`),Math.max(i,l);case 0===i:return z(`Page is hidden: ${s}`),l;case!V&&i!==qe[o]&&l<=Le[o]:return z(`New HTML bounding size: ${s}`,"Previous bounding size:",qe[o]),t();case!n:return e.taggedElement();case!V&&i<qe[o]:return z("HTML bounding size decreased:",s),t();case l===a||l===r:return z("HTML bounding size equals page size:",s),t();case i>l:return z(`Page size < HTML bounding size: ${s}`),t();default:z(`Content overflowing HTML element: ${s}`)}return Math.max(e.taggedElement(),t())}const De={enabled:()=>U,getOffset:()=>A,auto:()=>Be(De),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>De.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Re(De)),min:()=>Math.min(...Re(De)),grow:()=>De.max(),lowestElement:()=>ke(i),taggedElement:()=>ke(i)},We={enabled:()=>F,getOffset:()=>N,auto:()=>Be(We),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Re(We)),min:()=>Math.min(...Re(We)),rightMostElement:()=>ke(r),scroll:()=>Math.max(We.bodyScroll(),We.documentElementScroll()),taggedElement:()=>ke(r)},Ue=(e,t)=>!(Math.abs(e-t)<=ue);let Fe=!1;function He(e,t,n,o,i){x=performance.now(),L||e===a?document.hidden?z("Page hidden - Ignored resize request"):(Fe||(z(`Resize event: ${t}`),R=!0,function(e,t,n,o,i){const r=void 0===n?De[_]():n,l=void 0===o?We[ge]():o;U&&Ue(Z,r)||F&&Ue(pe,l)||"init"===e?(Ve(),Z=r,pe=l,_e(Z,pe,e,i)):!e!==a&&(U&&_ in P||F&&ge in P)?Ze(t):R=!1}(e,t,n,o,i),requestAnimationFrame((()=>{Fe=!1}))),Fe=!0):z("Resizing disabled")}function Ve(){me||(me=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{me=!1,z("Trigger event lock off"),z("--")})))}function Je(e){Z=De[_](),pe=We[ge](),_e(Z,pe,e)}function Ze(e){const t=_;_=v,z(`Reset trigger event: ${e}`),Ve(),Je("reset"),_=t}function _e(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(A||0)}:${t+(N||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(ae?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),R&&console.info(function(){const e=m(performance.now()-x);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),R=!1,ae?window.parent.iframeParentListener(w+r):de.postMessage(w+r,i)}())}function Qe(e){const t={init:function(){X=e.data,de=e.source,k=e.origin,we(),H=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Je("resetPage"))},resize(){He(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),ve?setTimeout((()=>ve(JSON.parse(e)))):_e(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ze?setTimeout(ze(Object.freeze(JSON.parse(e)))):_e(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),ye(JSON.parse(e)),z(" --")}},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};w===`${e.data}`.slice(0,j)&&(!1!==H?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function Xe(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Qe({data:e,sameDomain:!0}))),l(window,"message",Qe),l(window,"readystatechange",Xe),Xe())}();
|
|
21
|
+
//# sourceMappingURL=index.esm.js.map
|
package/index.esm.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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-overflowed'\n\nexport const HEIGHT_EDGE = 'bottom'\nexport const WIDTH_EDGE = 'right'\n\nexport const MANUAL_RESIZE_REQUEST = 'resizeParent'\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\nconst ROUNDING = 100_000\n\nexport const round = (value) => Math.round(value * ROUNDING) / ROUNDING\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\nconst BOLD = 'font-weight: bold;'\nconst NORMAL = 'font-weight: normal;'\n\n// TODO: remove .join(' '), requires major test updates\nconst formatLogMsg = (...msg) =>\n [`[iframe-resizer][${id || 'child'}]`, ...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 logging && console?.info(`%c[iframe-resizer][${id}]%c`, BOLD, NORMAL, ...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'\n\nconst overflowObserver = (options) => {\n const side = options.side || HEIGHT_EDGE\n const onChange = options.onChange || id\n\n const observerOptions = {\n root: options.root,\n rootMargin: '0px',\n threshold: 1,\n }\n\n function emit() {\n const overflowedNodeList = document.querySelectorAll(`[${OVERFLOW_ATTR}]`)\n onChange(overflowedNodeList)\n }\n\n const emitAfterReflow = () => requestAnimationFrame(emit)\n\n function callback(entries) {\n for (const entry of entries) {\n const { boundingClientRect, rootBounds, target } = entry\n const edge = boundingClientRect[side]\n const hasOverflow = edge === 0 || edge > rootBounds[side]\n target.toggleAttribute(OVERFLOW_ATTR, hasOverflow)\n }\n\n emitAfterReflow()\n }\n\n const observer = new IntersectionObserver(callback, observerOptions)\n const observed = new WeakSet()\n\n return function (nodeList) {\n for (const node of nodeList) {\n if (node.nodeType !== Node.ELEMENT_NODE || observed.has(node)) continue\n\n observer.observe(node)\n observed.add(node)\n }\n }\n}\n\nexport default overflowObserver\n","import { round } from '../common/utils'\nimport { advise, info, log } from './log'\n\nconst SECOND = 1000\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)\n\n// let 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 (\n usedTags.has(perfEl) /* || lastPerfEl === perfEl */ ||\n (hasTags && len <= 1)\n )\n return\n\n if (!logging) addUsedTag(perfEl)\n\n // lastPerfEl = perfEl\n\n info(\n `\\n ${Side} position calculated from:`,\n perfEl,\n `\\n Parsed ${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 MANUAL_RESIZE_REQUEST,\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, round } 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 overflowObserver 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 boundingClientRect: 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 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 widthCalcModeDefault = 'scroll'\n\n let autoResize = true\n let bodyBackground = ''\n let bodyMargin = 0\n let bodyMarginStr = ''\n let bodyPadding = ''\n let calculateHeight = true\n let calculateWidth = false\n let firstRun = true\n let hasOverflow = false\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 origin\n let overflowedNodeList = []\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 timerActive\n let totalTime\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\n setLogOptions({ id: myID, logging })\n log(`Initialising iframe v${VERSION} (${window.location.href})`)\n readDataFromPage()\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 sendSize(\n 'init',\n 'Init message from host page',\n undefined,\n undefined,\n VERSION,\n )\n\n sendTitle()\n initEventListeners()\n setTimeout(onReady)\n\n log('Initialization complete')\n log('---')\n }\n\n function onOverflowChange(nodeList) {\n log('Overflowed Elements:', nodeList.length)\n\n overflowedNodeList = nodeList\n hasOverflow = overflowedNodeList.length > 0\n\n sendSize('overflowChanged', 'Overflow updated')\n }\n\n function setupObserveOverflow() {\n if (calculateHeight === calculateWidth) return\n observeOverflow = overflowObserver({\n onChange: onOverflowChange,\n root: document.documentElement,\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) 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 `<b>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(data) {\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 const data = window.iframeResizer || window.iFrameResizer\n\n if (typeof data !== 'object') return\n\n readData(data)\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\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 for (const el of document.querySelectorAll(sizeSelector)) {\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 }\n\n manageEventListeners('add')\n setupMutationObserver()\n setupResizeObservers()\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 for (const link of document.querySelectorAll('a[href^=\"#\"]')) {\n if (link.getAttribute('href') !== '#') {\n addEventListener(link, 'click', (e) => {\n e.preventDefault()\n findTarget(link.getAttribute('href'))\n })\n }\n }\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 sendSize('autoResizeEnabled', 'Auto Resize enabled')\n } else if (resize === false && autoResize === true) {\n autoResize = false\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 getOrigin: () => {\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n return origin\n },\n\n getParentOrigin: () => origin,\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 MANUAL_RESIZE_REQUEST,\n `parentIframe.resize(${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 function resizeObserved(entries) {\n if (!Array.isArray(entries) || entries.length === 0) return\n\n const el = entries[0].target\n\n sendSize('resizeObserver', `Resize Observed: ${getElementName(el)}`)\n }\n\n const resizeSet = new WeakSet()\n\n // This function has to iterate over all page elements during load\n // so is optimized for performance, rather than best practices.\n function attachResizeObserverToNonStaticElements(rootElement) {\n if (rootElement.nodeType !== Node.ELEMENT_NODE) return\n\n if (!resizeSet.has(rootElement)) {\n const position = getComputedStyle(rootElement)?.position\n if (!(position === '' || position === 'static')) {\n resizeObserver.observe(rootElement)\n resizeSet.add(rootElement)\n log(`Attached resizeObserver: ${getElementName(rootElement)}`)\n }\n }\n\n const nodeList = getAllElements(rootElement)()\n\n for (const node of nodeList) {\n if (resizeSet.has(node) || node?.nodeType !== Node.ELEMENT_NODE) continue\n\n const position = getComputedStyle(node)?.position\n if (position === '' || position === 'static') continue\n\n resizeObserver.observe(node)\n resizeSet.add(node)\n log(`Attached resizeObserver: ${getElementName(node)}`)\n }\n }\n\n function setupResizeObservers() {\n resizeObserver = new ResizeObserver(resizeObserved)\n resizeObserver.observe(document.body)\n resizeSet.add(document.body)\n attachResizeObserverToNonStaticElements(document.body)\n }\n\n function setupMutationObserver() {\n const observedMutations = new Set()\n let pending = false\n let perfMon = 0\n let newMutations = []\n\n const updateMutation = (mutations) => {\n for (const mutation of mutations) {\n const { addedNodes, removedNodes } = mutation\n\n for (const node of addedNodes) {\n observedMutations.add(node)\n }\n\n for (const node of removedNodes) {\n observedMutations.delete(node)\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 log('MutationObserver: 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(attachResizeObserverToNonStaticElements)\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 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 : hasOverflow\n ? overflowedNodeList\n : getAllElements(document)() // We should never get here, but just in case\n\n let len = targetElements.length\n\n for (const element of targetElements) {\n if (\n !hasTags &&\n hasCheckVisibility && // Safari was missing checkVisibility until March 2024\n !element.checkVisibility(checkVisibilityOptions)\n ) {\n len -= 1\n continue\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.boundingClientRect(),\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 isHeight = getDimension === getHeight\n const dimension = isHeight ? 'height' : 'width'\n const boundingSize = getDimension.boundingClientRect()\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 boundingClientRect: () =>\n Math.max(\n document.documentElement.getBoundingClientRect().bottom,\n document.body.getBoundingClientRect().bottom,\n ),\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 boundingClientRect: () =>\n Math.max(\n document.documentElement.getBoundingClientRect().right,\n document.body.getBoundingClientRect().right,\n ),\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 const checkTolerance = (a, b) => !(Math.abs(a - b) <= tolerance)\n\n function sizeIframe(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n const isForceResizableEvent = () => !triggerEvent !== MANUAL_RESIZE_REQUEST\n\n const isForceResizableCalcMode = () =>\n (calculateHeight && heightCalcMode in resetRequiredMethods) ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n\n const isSizeChangeDetected = () =>\n (calculateHeight && checkTolerance(height, newHeight)) ||\n (calculateWidth && checkTolerance(width, newWidth))\n\n const newHeight =\n undefined === customHeight ? getHeight[heightCalcMode]() : customHeight\n const newWidth =\n undefined === customWidth ? getWidth[widthCalcMode]() : customWidth\n\n if (isSizeChangeDetected() || triggerEvent === 'init') {\n lockTrigger()\n height = newHeight\n width = newWidth\n sendMsg(height, width, triggerEvent, msg)\n } else if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIframe(triggerEventDesc)\n } else {\n timerActive = false // We're not resizing, so turn off the timer\n }\n }\n\n let sendPending = false\n\n function sendSize(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n totalTime = performance.now()\n\n if (!autoResize && triggerEvent !== MANUAL_RESIZE_REQUEST) {\n log('Resizing disabled')\n return\n }\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 (!sendPending) {\n log(`Resize event: ${triggerEventDesc}`)\n timerActive = true\n sizeIframe(triggerEvent, triggerEventDesc, customHeight, customWidth, msg)\n requestAnimationFrame(() => {\n sendPending = false\n })\n }\n\n sendPending = true\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 displayTimeTaken() {\n const timer = round(performance.now() - totalTime)\n return triggerEvent === 'init'\n ? `Initialised iFrame in %c${timer}ms`\n : `Content size recalculated in %c${timer}ms`\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 /* eslint-disable no-console */\n if (logging) {\n console.group(`[iframe-resizer][${myID}]`)\n console.info(\n `Sending message to host page via ${sameDomain ? 'sameDomain' : 'postMessage'}`,\n )\n console.info(`%c${message}`, 'font-style: italic')\n if (timerActive)\n console.info(displayTimeTaken(), 'font-weight:bold;color:#777')\n console.groupEnd()\n }\n /* eslint-enable no-console */\n\n timerActive = false\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 origin = event.origin\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(MANUAL_RESIZE_REQUEST, '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 setTimeout(() => 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 setTimeout(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 if ('iframeChildListener' in window) {\n warn('Already setup')\n } else {\n window.iframeChildListener = (data) =>\n setTimeout(() => receiver({ data, sameDomain: true }))\n\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n\n chkLateLoaded()\n }\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","MANUAL_RESIZE_REQUEST","addEventListener","el","evt","func","options","y","Object","fromEntries","map","l","p","Math","max","getModeData","replaceAll","String","fromCodePoint","codePointAt","id","x","ROUNDING","round","value","logging","setLogOptions","capitalizeFirstLetter","string","charAt","toUpperCase","slice","isDef","undefined","getElementName","nodeName","name","className","formatLogMsg","msg","join","log","console","info","warn","advise","window","chrome","formatAdvise","adviser","overflowObserver","side","onChange","observerOptions","root","rootMargin","threshold","emit","overflowedNodeList","document","querySelectorAll","observer","IntersectionObserver","entries","entry","boundingClientRect","rootBounds","target","edge","hasOverflow","toggleAttribute","requestAnimationFrame","observed","WeakSet","nodeList","node","nodeType","Node","ELEMENT_NODE","has","observe","add","PREF_START","PREF_END","PREF_MEASURE","timings","usedTags","addUsedTag","perfEl","details","timingCheck","setInterval","length","hasTags","len","sort","average","min","reduce","a","b","floor","clearInterval","Side","toLowerCase","perfObserver","list","getEntries","forEach","duration","performance","measure","detail","usedEl","push","shift","setup","PerformanceObserver","entryTypes","documentElement","body","readyState","checkVisibilityOptions","contentVisibilityAuto","opacityProperty","visibilityProperty","customCalcMethods","height","getHeight","auto","width","getWidth","deprecatedResizeMethods","bodyOffset","bodyScroll","offset","documentElementOffset","documentElementScroll","grow","lowestElement","eventCancelTimer","eventHandlersByName","hasCheckVisibility","heightCalcModeDefault","msgID","msgIdLen","resetRequiredMethods","widthCalcModeDefault","offsetHeight","offsetWidth","origin","timerActive","totalTime","autoResize","bodyBackground","bodyMargin","bodyMarginStr","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","init","method","attr","strBool","str","data","split","Number","enable","readDataFromParent","location","href","readData","JSON","stringify","offsetSize","prototype","hasOwnProperty","call","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","iframeResizer","iFrameResizer","readDataFromPage","error","checkCrossDomain","checkHeightMode","checkWidthMode","found","checkAttrs","removeAttribute","checkDeprecatedAttrs","checkAndSetupTags","onOverflowChange","parentIframe","freeze","resize","sendSize","sendMsg","close","getId","getOrigin","getParentOrigin","getPageInfo","callback","getParentProps","TypeError","getParentProperties","this","moveToAnchor","hash","findTarget","reset","resetIframe","scrollBy","scrollTo","scrollToOffset","sendMessage","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","customHeight","customWidth","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","link","getAttribute","preventDefault","bindLocationHash","initCheck","setTimeout","enableInPageLinks","setupInPageLinks","addOverflowObservers","getAllElements","setBodyStyle","includes","clearFix","createElement","style","clear","display","append","injectClearFixIntoBodyElement","setAutoHeight","setProperty","stopInfiniteResizingOfIframe","applySizeSelector","title","manageTriggerEvent","eventType","eventName","observedMutations","Set","pending","perfMon","newMutations","updateMutation","mutations","mutation","addedNodes","removedNodes","delete","DELAY","DELAY_MARGIN","DELAY_MAX","delayCount","processMutations","now","delay","delayLimit","attachResizeObserverToNonStaticElements","mutationObserved","createMutationObserver","MutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","setupMutationObserver","ResizeObserver","resizeObserved","resizeSet","dataset","iframeSize","handleEvent","passive","remove","removeEventListener","checkCalcMode","calcModeDefault","modes","Array","isArray","rootElement","position","getComputedStyle","getMaxElement","mark","elVal","maxEl","maxVal","bottom","targetElements","element","checkVisibility","parseFloat","getPropertyValue","getAllMeasurements","dimension","prevScrollSize","prevBoundingSize","getAutoSize","getDimension","returnBoundingClientRect","boundingSize","scrollSize","isHeight","ceilBoundingSize","ceil","floorBoundingSize","getOffset","getAdjustedScroll","sizes","enabled","taggedElement","marginTop","marginBottom","scrollHeight","custom","scrollWidth","right","rightMostElement","scroll","checkTolerance","abs","sendPending","triggerEvent","triggerEventDesc","hidden","newHeight","newWidth","lockTrigger","sizeIframe","triggerReset","hcm","message","group","timer","displayTimeTaken","groupEnd","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,kBAEhBC,EAAc,SACdC,EAAa,QAEbC,EAAwB,eCXxBC,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,IC3BzBS,EAAMC,GAAMA,EAEnBC,EAAW,IAEJC,EAASC,GAAUX,KAAKU,MAAMC,EAAQF,GAAYA,ECd/D,IAAIF,EAAK,GACLK,GAAU,EAEP,MAAMC,EAAiBpB,IAC5Bc,EAAKd,EAAQc,GACbK,EAAUnB,EAAQmB,OAAO,EAGdE,EAAyBC,GACpCA,EAAOC,OAAO,GAAGC,cAAgBF,EAAOG,MAAM,GAE1CC,EAASR,GAAyB,IAAf,GAAGA,UAA4BS,IAAVT,EAEvC,SAASU,EAAe/B,GAC7B,QAAQ,GACN,KAAM6B,EAAM7B,GACV,MAAO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C5R,IAAU,GAAG6Q,EAAM/N,OAAO/J,MAAM,EAAGkH,MA4B7C,IAAbe,EAKA0Q,IACFZ,EAAyBrO,OAI3BhJ,EACE,4BAA4B6X,yCAzBhC,WACE,MAAMO,EAAcP,IAEhBO,KAAef,EACjBA,EAAyBe,KAItBL,KAAmBE,KACtB9X,EAAK,uBAAuBiX,EAAM/N,QAErC,CAIGgP,GAiBL,CAID,SAASC,KACqB,YAAxBpX,SAAS8D,YACX3E,OAAOgI,OAAO4O,YAAY,4BAA6B,IAE1D,CAEG,wBAAyB5W,OAC3BF,EAAK,kBAELE,OAAOkY,oBAAuBlP,GAC5B8F,YAAW,IAAMgI,GAAS,CAAE9N,OAAMnB,YAAY,MAEhDzK,EAAiB4C,OAAQ,UAAW8W,IACpC1Z,EAAiB4C,OAAQ,mBAAoBiY,IAE7CA,KAGJ,CAIEE"}
|
package/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.3.
|
|
4
|
+
* @module iframe-resizer/child 5.3.3-beta.1 (umd) - 2024-10-23
|
|
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,4 +17,5 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.3.2",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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))))(s[e]),d=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const h=e=>{f=e.id,p=e.logging},y=e=>""!=`${e}`&&void 0!==e;const g=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),b=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),v=(...e)=>console?.warn(g(...e)),w=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(g)(...e)),z=e=>w(e),S=e=>{const t=e.side||i,n=e.onChange||d,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},E="--ifr-start",j="--ifr-end",$="--ifr-measure",C=[],T=new WeakSet,M=e=>"object"==typeof e&&T.add(e);let O=null,P={};const A=setInterval((()=>{if(C.length<10)return;if(P.hasTags&&P.len<25)return;C.sort();const e=Math.min(C.reduce(((e,t)=>e+t),0)/C.length,C[Math.floor(C.length/2)]);e<=4||(clearInterval(A),w(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${P.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function N(e){e.getEntries().forEach((e=>{if(e.name===j){const{duration:t}=performance.measure($,E,j);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;P=e,T.has(O)||i&&o<=1||(r||M(O),b(`\n ${n} position calculated from:`,O,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),C.push(t),C.length>100&&C.shift()}}))}function I(){new PerformanceObserver(N).observe({entryTypes:["mark"]}),M(document.documentElement),M(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",I):I()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(v("Custom height calculation function not defined"),Le.auto()),width:()=>(v("Custom width calculation function not defined"),Be.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},g="checkVisibility"in window,b="auto",$="[iFrameSizer]",C=$.length,T={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="scroll";let P,A,N,I,k,R=!0,x="",q=0,L="",B="",D=!0,W=!1,U=!0,F=!1,V=!1,J=1,H=b,Z=!0,_="",Q={},X=!1,Y=0,G=!1,K="",ee=d,te=[],ne="child",oe=null,ie=!1,re="",ae=[],le=window.parent,se="*",ce=0,de=!1,ue="",me=1,fe=M,pe=window,he=()=>{v("onMessage function not defined")},ye=()=>{},ge=null,be=null;function ve(){var o,d,u;!function(){const e=e=>"true"===e,t=_.slice(C).split(":");K=t[0],q=void 0===t[1]?q:Number(t[1]),W=void 0===t[2]?W:e(t[2]),X=void 0===t[3]?X:e(t[3]),R=void 0===t[6]?R:e(t[6]),L=t[7],H=void 0===t[8]?H:t[8],x=t[9],B=t[10],ce=void 0===t[11]?ce:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),ne=void 0===t[13]?ne:t[13],fe=void 0===t[14]?fe:t[14],G=void 0===t[15]?G:e(t[15]),P=void 0===t[16]?P:Number(t[16]),A=void 0===t[17]?A:Number(t[17]),D=void 0===t[18]?D:e(t[18]),t[19],ue=t[20]||ue,Y=void 0===t[21]?Y:Number(t[21])}(),h({id:K,logging:X}),function(){function e(e){he=e?.onMessage||he,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</>."),D&&(P=e?.offset),W&&(A=e?.offset)),"number"==typeof e?.offsetSize&&(D&&(P=e?.offsetSize),W&&(A=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(re=e.sizeSelector),se=e?.targetOrigin||se,H=e?.heightCalculationMethod||H,fe=e?.widthCalculationMethod||fe}function t(e,t){return"function"==typeof e&&(s[t]=e,e="custom"),e}if(1===Y)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),H=t(H,"height"),fe=t(fe,"width"))}(),function(){try{ie="iframeParentListener"in window.parent}catch(e){}}(),Y<0?z(`${c(Y+2)}${c(2)}`):ue.codePointAt(0)>4||Y<2&&z(c(3)),ue&&""!==ue&&"false"!==ue?ue!==e&&w(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ue} - 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"),Te(),Me(),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</>.")}(),ze(),D!==W&&(ee=S({onChange:we,root:document.documentElement,side:D?i:r})),1!==Y&&(pe.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===R?(R=!0,Ue("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===R&&(R=!1),He(0,0,"autoResize",JSON.stringify(R)),R),close(){He(0,0,"close")},getId:()=>K,getOrigin:()=>N,getPageInfo(e){if("function"==typeof e)return ge=e,He(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");ge=null,He(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return be=e,He(0,0,"parentInfo"),()=>{be=null,He(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){Q.findTarget(e)},reset(){Je()},scrollBy(e,t){He(t,e,"scrollBy")},scrollTo(e,t){He(t,e,"scrollTo")},scrollToOffset(e,t){He(t,e,"scrollToOffset")},sendMessage(e,t){He(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){H=e,Te()},setWidthCalculationMethod(e){fe=e,Me()},setTargetOrigin(e){se=e},resize(e,t){Ue(a,`parentIframe.resize(${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)}}),pe.parentIFrame=pe.parentIframe),function(){function e(e){He(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){l(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);He(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?He(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function c(){r(),a(),s()}return Q.enable&&(1===Y?w("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),Se(ke(document)()),void 0===L&&(L=`${q}px`),Ee("margin",(d="margin",(u=L).includes("-")&&(v(`Negative CSS value ignored for ${d}`),u=""),u)),Ee("background",x),Ee("padding",B),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)}(),je(),Ue("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&He(0,0,"title",document.title),$e({method:o="add",eventType:"After Print",eventName:"afterprint"}),$e({method:o,eventType:"Before Print",eventName:"beforeprint"}),$e({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(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?(je(),ze(),Se(e),e.forEach(Ae),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}u()}(),oe=new ResizeObserver(Oe),oe.observe(document.body),Pe.add(document.body),Ae(document.body),setTimeout(ye)}function we(e){te=e,F=te.length>0,Ue("overflowChanged","Overflow updated")}function ze(){ae=document.querySelectorAll(`[${n}]`),V=ae.length>0}function Se(e){V||ee(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function je(){if(""!==re)for(const e of document.querySelectorAll(re))e.dataset.iframeSize=!0}function $e(e){({add(t){function n(){Ue(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function Ce(e,t,n,o){return t!==e&&(e in n||(v(`${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.`)),e}function Te(){H=Ce(H,b,Le,"height")}function Me(){fe=Ce(fe,M,Be,"width")}function Oe(e){Array.isArray(e)&&0!==e.length&&Ue("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const Pe=new WeakSet;function Ae(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Pe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(oe.observe(e),Pe.add(e))}const t=ke(e)();for(const e of t){if(Pe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(oe.observe(e),Pe.add(e))}}function Ne(e){performance.mark(E);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=V?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(E);const l=V?ae:F?te:ke(document)();let s=l.length;for(const t of l)V||!g||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1;return O=r,performance.mark(j,{detail:{Side:t,len:s,hasTags:V,logging:X}}),a}const Ie=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ke=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)"),Re={height:0,width:0},xe={height:0,width:0};function qe(e){function t(){return xe[o]=i,Re[o]=l,i}const n=e===Le,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return l;case V:return e.taggedElement();case!F&&0===xe[o]&&0===Re[o]:return t();case de&&i===xe[o]&&l===Re[o]:return Math.max(i,l);case 0===i:return l;case!F&&i!==xe[o]&&l<=Re[o]:return t();case!n:return e.taggedElement();case!F&&i<xe[o]:case l===a||l===r:case i>l:return t()}return Math.max(e.taggedElement(),t())}const Le={enabled:()=>D,getOffset:()=>P,auto:()=>qe(Le),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Le.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Ie(Le)),min:()=>Math.min(...Ie(Le)),grow:()=>Le.max(),lowestElement:()=>Ne(i),taggedElement:()=>Ne(i)},Be={enabled:()=>W,getOffset:()=>A,auto:()=>qe(Be),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Ie(Be)),min:()=>Math.min(...Ie(Be)),rightMostElement:()=>Ne(r),scroll:()=>Math.max(Be.bodyScroll(),Be.documentElementScroll()),taggedElement:()=>Ne(r)},De=(e,t)=>!(Math.abs(e-t)<=ce);let We=!1;function Ue(e,t,n,o,i){k=performance.now(),(R||e===a)&&(document.hidden||(We||(I=!0,function(e,t,n,o,i){const r=void 0===n?Le[H]():n,l=void 0===o?Be[fe]():o;D&&De(J,r)||W&&De(me,l)||"init"===e?(Fe(),J=r,me=l,He(J,me,e,i)):!e!==a&&(D&&H in T||W&&fe in T)?Je():I=!1}(e,0,n,o,i),requestAnimationFrame((()=>{We=!1}))),We=!0))}function Fe(){de||(de=!0,requestAnimationFrame((()=>{de=!1})))}function Ve(e){J=Le[H](),me=Be[fe](),He(J,me,e)}function Je(e){const t=H;H=b,Fe(),Ve("reset"),H=t}function He(e,t,n,o,i){Y<-1||(void 0!==i||(i=se),function(){const r=`${K}:${e+(P||0)}:${t+(A||0)}:${n}${void 0===o?"":`:${o}`}`;X&&(console.group(`[iframe-resizer][${K}]`),console.info("Sending message to host page via "+(ie?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),I&&console.info(function(){const e=m(performance.now()-k);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),I=!1,ie?window.parent.iframeParentListener($+r):le.postMessage($+r,i)}())}function Ze(e){const t={init:function(){_=e.data,le=e.source,N=e.origin,ve(),U=!1,setTimeout((()=>{Z=!1}),f)},reset(){Z||Ve("resetPage")},resize(){Ue(a)},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ge?setTimeout((()=>ge(JSON.parse(e)))):He(0,0,"pageInfoStop")},parentInfo(){const e=o();be?setTimeout(be(Object.freeze(JSON.parse(e)))):He(0,0,"parentInfoStop")},message(){const e=o();he(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};$===`${e.data}`.slice(0,C)&&(!1!==U?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||v(`Unexpected message (${e.data})`)}())}function _e(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?v("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ze({data:e,sameDomain:!0}))),l(window,"message",Ze),l(window,"readystatechange",_e),_e())}()}));
|
|
20
|
+
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.3.3-beta.1",t=10,n="data-iframe-size",o="data-overflowed",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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 d=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),c=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const g=e=>{f=e.id,p=e.logging},h=e=>e.charAt(0).toUpperCase()+e.slice(1),y=e=>""!=`${e}`&&void 0!==e;function b(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}const v=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),z=(...e)=>p&&console?.log(v(...e)),w=(...e)=>p&&console?.info(`%c[iframe-resizer][${f}]%c`,"font-weight: bold;","font-weight: normal;",...e),$=(...e)=>console?.warn(v(...e)),S=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(v)(...e)),M=e=>S(e),E=e=>{const t=e.side||i,n=e.onChange||c,r={root:e.root,rootMargin:"0px",threshold:1};function a(){const e=document.querySelectorAll(`[${o}]`);n(e)}const l=new IntersectionObserver((function(e){for(const n of e){const{boundingClientRect:e,rootBounds:i,target:r}=n,a=e[t],l=0===a||a>i[t];r.toggleAttribute(o,l)}requestAnimationFrame(a)}),r),s=new WeakSet;return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}},T="--ifr-start",O="--ifr-end",j="--ifr-measure",P=[],C=new WeakSet,A=e=>"object"==typeof e&&C.add(e);let I=null,N={};const k=setInterval((()=>{if(P.length<10)return;if(N.hasTags&&N.len<25)return;P.sort();const e=Math.min(P.reduce(((e,t)=>e+t),0)/P.length,P[Math.floor(P.length/2)]);z("Max time:",Math.max(...P)),e<=4||(clearInterval(k),S(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${N.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===O){const{duration:t}=performance.measure(j,T,O);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;N=e,C.has(I)||i&&o<=1||(r||A(I),w(`\n ${n} position calculated from:`,I,`\n Parsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),P.push(t),P.length>100&&P.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>($("Custom height calculation function not defined"),De.auto()),width:()=>($("Custom width calculation function not defined"),We.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},y="checkVisibility"in window,v="auto",w="[iFrameSizer]",j=w.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},C="scroll";let A,N,k,R,x,L=!0,q="",B=0,D="",W="",U=!0,F=!1,H=!0,V=!1,J=!1,Z=1,_=v,Q=!0,X="",Y={},G=!1,K=0,ee=!1,te="",ne=c,oe=[],ie="child",re=null,ae=!1,le="",se=[],de=window.parent,ce="*",ue=0,me=!1,fe="",pe=1,ge=C,he=window,ye=()=>{$("onMessage function not defined")},be=()=>{},ve=null,ze=null;function we(){var o,c,u;!function(){const e=e=>"true"===e,t=X.slice(j).split(":");te=t[0],B=void 0===t[1]?B:Number(t[1]),F=void 0===t[2]?F:e(t[2]),G=void 0===t[3]?G:e(t[3]),L=void 0===t[6]?L:e(t[6]),D=t[7],_=void 0===t[8]?_:t[8],q=t[9],W=t[10],ue=void 0===t[11]?ue:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),ie=void 0===t[13]?ie:t[13],ge=void 0===t[14]?ge:t[14],ee=void 0===t[15]?ee:e(t[15]),A=void 0===t[16]?A:Number(t[16]),N=void 0===t[17]?N:Number(t[17]),U=void 0===t[18]?U:e(t[18]),t[19],fe=t[20]||fe,K=void 0===t[21]?K:Number(t[21])}(),g({id:te,logging:G}),z(`Initialising iframe v${e} (${window.location.href})`),function(){function e(e){z(`Reading data from page: ${JSON.stringify(e)}`),ye=e?.onMessage||ye,be=e?.onReady||be,"number"==typeof e?.offset&&(S("<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</>."),U&&(A=e?.offset),F&&(N=e?.offset)),"number"==typeof e?.offsetSize&&(U&&(A=e?.offsetSize),F&&(N=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(le=e.sizeSelector),ce=e?.targetOrigin||ce,_=e?.heightCalculationMethod||_,ge=e?.widthCalculationMethod||ge}function t(e,t){return"function"==typeof e&&(z(`Setup custom ${t}CalcMethod`),s[t]=e,e="custom"),e}if(1===K)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),_=t(_,"height"),ge=t(ge,"width"),z(`TargetOrigin for parent set to: ${ce}`))}(),function(){try{ae="iframeParentListener"in window.parent}catch(e){z("Cross domain iframe detected.")}}(),K<0?M(`${d(K+2)}${d(2)}`):fe.codePointAt(0)>4||K<2&&M(d(3)),fe&&""!==fe&&"false"!==fe?fe!==e&&S(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${e}.\n`):S("<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&&S("<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</>.")}(),Se(),U!==F&&(ne=E({onChange:$e,root:document.documentElement,side:U?i:r})),1!==K&&(he.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===L?(L=!0,He("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===L&&(L=!1),_e(0,0,"autoResize",JSON.stringify(L)),L),close(){_e(0,0,"close")},getId:()=>te,getOrigin:()=>(S("<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),k),getParentOrigin:()=>k,getPageInfo(e){if("function"==typeof e)return ve=e,_e(0,0,"pageInfo"),void S("<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,_e(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ze=e,_e(0,0,"parentInfo"),()=>{ze=null,_e(0,0,"parentInfoStop")}},getParentProperties(e){S("<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){Y.findTarget(e)},reset(){Ze("parentIframe.reset")},scrollBy(e,t){_e(t,e,"scrollBy")},scrollTo(e,t){_e(t,e,"scrollTo")},scrollToOffset(e,t){_e(t,e,"scrollToOffset")},sendMessage(e,t){_e(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){_=e,Pe()},setWidthCalculationMethod(e){ge=e,Ce()},setTargetOrigin(e){z(`Set targetOrigin: ${e}`),ce=e},resize(e,t){He(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){S("<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){_e(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){z(`Add event listener: ${n}`),l(window.document,t,e)}!0===ee&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Y=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);z(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),_e(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?(z(`In page link (#${o}) not found in iFrame, so sending to parent`),_e(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function d(){z("Setting up location.hash handlers"),r(),a(),s()}return Y.enable?1===K?S("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):d():z("In page linking not enabled"),{findTarget:o}}(),Me(xe(document)()),void 0===D&&(D=`${B}px`),Ee("margin",(c="margin",(u=D).includes("-")&&($(`Negative CSS value ignored for ${c}`),u=""),u)),Ee("background",q),Ee("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),z('HTML & body height set to "auto !important"')}(),Te(),He("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&_e(0,0,"title",document.title),!0!==L&&z("Auto Resize disabled"),Oe({method:o="add",eventType:"After Print",eventName:"afterprint"}),Oe({method:o,eventType:"Before Print",eventName:"beforeprint"}),Oe({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},r=16,a=2,l=200;let s=1;function d(){z("MutationObserver: processMutations");const c=performance.now(),u=c-n,m=r*s+++a;if(u>m&&u<l)return z(`MutationObserver delay: ${u}ms > ${m}`),setTimeout(d,r*s),void(n=c);s=1,o.forEach(i),o=[],0!==e.size?(Te(),Se(),Me(e),e.forEach(Ne),e.clear(),t=!1):t=!1}function c(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(d))}function u(){const e=new window.MutationObserver(c),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return z("Create <body/> MutationObserver"),e.observe(t,n),e}u()}(),re=new ResizeObserver(Ae),re.observe(document.body),Ie.add(document.body),Ne(document.body),setTimeout(be),z("Initialization complete"),z("---")}function $e(e){z("Overflowed Elements:",e.length),oe=e,V=oe.length>0,He("overflowChanged","Overflow updated")}function Se(){se=document.querySelectorAll(`[${n}]`),J=se.length>0,z(`Tagged elements found: ${J}`)}function Me(e){J||ne(e)}function Ee(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),z(`Body ${e} set to "${t}"`))}function Te(){if(""!==le){z(`Applying sizeSelector: ${le}`);for(const e of document.querySelectorAll(le))z(`Applying data-iframe-size to: ${b(e)}`),e.dataset.iframeSize=!0}}function Oe(e){({add(t){function n(){He(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),z(`${h(e.method)} event listener: ${e.eventType}`)}function je(e,t,n,o){return t!==e&&(e in n||($(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&S(`<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.`),z(`${o} calculation method set to "${e}"`)),e}function Pe(){_=je(_,v,De,"height")}function Ce(){ge=je(ge,C,We,"width")}function Ae(e){Array.isArray(e)&&0!==e.length&&He("resizeObserver",`Resize Observed: ${b(e[0].target)}`)}const Ie=new WeakSet;function Ne(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Ie.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}const t=xe(e)();for(const e of t){if(Ie.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(re.observe(e),Ie.add(e),z(`Attached resizeObserver: ${b(e)}`))}}function ke(e){performance.mark(T);const t=h(e);let n=0,i=document.documentElement,r=J?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(T);const a=J?se:V?oe:xe(document)();let l=a.length;for(const t of a)J||!y||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):l-=1;return I=i,performance.mark(O,{detail:{Side:t,len:l,hasTags:J,logging:G}}),r}const Re=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],xe=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)"),Le={height:0,width:0},qe={height:0,width:0};function Be(e){function t(){return qe[o]=i,Le[o]=l,i}const n=e===De,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: ${i} Page: ${l}`;switch(!0){case!e.enabled():return l;case J:return e.taggedElement();case!V&&0===qe[o]&&0===Le[o]:return z(`Initial page size values: ${s}`),t();case me&&i===qe[o]&&l===Le[o]:return z(`Size unchanged: ${s}`),Math.max(i,l);case 0===i:return z(`Page is hidden: ${s}`),l;case!V&&i!==qe[o]&&l<=Le[o]:return z(`New HTML bounding size: ${s}`,"Previous bounding size:",qe[o]),t();case!n:return e.taggedElement();case!V&&i<qe[o]:return z("HTML bounding size decreased:",s),t();case l===a||l===r:return z("HTML bounding size equals page size:",s),t();case i>l:return z(`Page size < HTML bounding size: ${s}`),t();default:z(`Content overflowing HTML element: ${s}`)}return Math.max(e.taggedElement(),t())}const De={enabled:()=>U,getOffset:()=>A,auto:()=>Be(De),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>De.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Re(De)),min:()=>Math.min(...Re(De)),grow:()=>De.max(),lowestElement:()=>ke(i),taggedElement:()=>ke(i)},We={enabled:()=>F,getOffset:()=>N,auto:()=>Be(We),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Re(We)),min:()=>Math.min(...Re(We)),rightMostElement:()=>ke(r),scroll:()=>Math.max(We.bodyScroll(),We.documentElementScroll()),taggedElement:()=>ke(r)},Ue=(e,t)=>!(Math.abs(e-t)<=ue);let Fe=!1;function He(e,t,n,o,i){x=performance.now(),L||e===a?document.hidden?z("Page hidden - Ignored resize request"):(Fe||(z(`Resize event: ${t}`),R=!0,function(e,t,n,o,i){const r=void 0===n?De[_]():n,l=void 0===o?We[ge]():o;U&&Ue(Z,r)||F&&Ue(pe,l)||"init"===e?(Ve(),Z=r,pe=l,_e(Z,pe,e,i)):!e!==a&&(U&&_ in P||F&&ge in P)?Ze(t):R=!1}(e,t,n,o,i),requestAnimationFrame((()=>{Fe=!1}))),Fe=!0):z("Resizing disabled")}function Ve(){me||(me=!0,z("Trigger event lock on"),requestAnimationFrame((()=>{me=!1,z("Trigger event lock off"),z("--")})))}function Je(e){Z=De[_](),pe=We[ge](),_e(Z,pe,e)}function Ze(e){const t=_;_=v,z(`Reset trigger event: ${e}`),Ve(),Je("reset"),_=t}function _e(e,t,n,o,i){K<-1||(void 0!==i?z(`Message targetOrigin: ${i}`):i=ce,function(){const r=`${te}:${e+(A||0)}:${t+(N||0)}:${n}${void 0===o?"":`:${o}`}`;G&&(console.group(`[iframe-resizer][${te}]`),console.info("Sending message to host page via "+(ae?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),R&&console.info(function(){const e=m(performance.now()-x);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),R=!1,ae?window.parent.iframeParentListener(w+r):de.postMessage(w+r,i)}())}function Qe(e){const t={init:function(){X=e.data,de=e.source,k=e.origin,we(),H=!1,setTimeout((()=>{Q=!1}),f)},reset(){Q?z("Page reset ignored by init"):(z("Page size reset by host page"),Je("resetPage"))},resize(){He(a,"Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();z(`PageInfo received from parent: ${e}`),ve?setTimeout((()=>ve(JSON.parse(e)))):_e(0,0,"pageInfoStop"),z(" --")},parentInfo(){const e=o();z(`ParentInfo received from parent: ${e}`),ze?setTimeout(ze(Object.freeze(JSON.parse(e)))):_e(0,0,"parentInfoStop"),z(" --")},message(){const e=o();z(`onMessage called from parent: ${e}`),ye(JSON.parse(e)),z(" --")}},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};w===`${e.data}`.slice(0,j)&&(!1!==H?r()?t.init():z(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||$(`Unexpected message (${e.data})`)}())}function Xe(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?$("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Qe({data:e,sameDomain:!0}))),l(window,"message",Qe),l(window,"readystatechange",Xe),Xe())}()}));
|
|
21
|
+
//# sourceMappingURL=index.umd.js.map
|
package/index.umd.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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-overflowed'\n\nexport const HEIGHT_EDGE = 'bottom'\nexport const WIDTH_EDGE = 'right'\n\nexport const MANUAL_RESIZE_REQUEST = 'resizeParent'\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\nconst ROUNDING = 100_000\n\nexport const round = (value) => Math.round(value * ROUNDING) / ROUNDING\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\nconst BOLD = 'font-weight: bold;'\nconst NORMAL = 'font-weight: normal;'\n\n// TODO: remove .join(' '), requires major test updates\nconst formatLogMsg = (...msg) =>\n [`[iframe-resizer][${id || 'child'}]`, ...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 logging && console?.info(`%c[iframe-resizer][${id}]%c`, BOLD, NORMAL, ...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'\n\nconst overflowObserver = (options) => {\n const side = options.side || HEIGHT_EDGE\n const onChange = options.onChange || id\n\n const observerOptions = {\n root: options.root,\n rootMargin: '0px',\n threshold: 1,\n }\n\n function emit() {\n const overflowedNodeList = document.querySelectorAll(`[${OVERFLOW_ATTR}]`)\n onChange(overflowedNodeList)\n }\n\n const emitAfterReflow = () => requestAnimationFrame(emit)\n\n function callback(entries) {\n for (const entry of entries) {\n const { boundingClientRect, rootBounds, target } = entry\n const edge = boundingClientRect[side]\n const hasOverflow = edge === 0 || edge > rootBounds[side]\n target.toggleAttribute(OVERFLOW_ATTR, hasOverflow)\n }\n\n emitAfterReflow()\n }\n\n const observer = new IntersectionObserver(callback, observerOptions)\n const observed = new WeakSet()\n\n return function (nodeList) {\n for (const node of nodeList) {\n if (node.nodeType !== Node.ELEMENT_NODE || observed.has(node)) continue\n\n observer.observe(node)\n observed.add(node)\n }\n }\n}\n\nexport default overflowObserver\n","import { round } from '../common/utils'\nimport { advise, info, log } from './log'\n\nconst SECOND = 1000\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)\n\n// let 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 (\n usedTags.has(perfEl) /* || lastPerfEl === perfEl */ ||\n (hasTags && len <= 1)\n )\n return\n\n if (!logging) addUsedTag(perfEl)\n\n // lastPerfEl = perfEl\n\n info(\n `\\n ${Side} position calculated from:`,\n perfEl,\n `\\n Parsed ${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 MANUAL_RESIZE_REQUEST,\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, round } 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 overflowObserver 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 boundingClientRect: 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 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 widthCalcModeDefault = 'scroll'\n\n let autoResize = true\n let bodyBackground = ''\n let bodyMargin = 0\n let bodyMarginStr = ''\n let bodyPadding = ''\n let calculateHeight = true\n let calculateWidth = false\n let firstRun = true\n let hasOverflow = false\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 origin\n let overflowedNodeList = []\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 timerActive\n let totalTime\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\n setLogOptions({ id: myID, logging })\n log(`Initialising iframe v${VERSION} (${window.location.href})`)\n readDataFromPage()\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 sendSize(\n 'init',\n 'Init message from host page',\n undefined,\n undefined,\n VERSION,\n )\n\n sendTitle()\n initEventListeners()\n setTimeout(onReady)\n\n log('Initialization complete')\n log('---')\n }\n\n function onOverflowChange(nodeList) {\n log('Overflowed Elements:', nodeList.length)\n\n overflowedNodeList = nodeList\n hasOverflow = overflowedNodeList.length > 0\n\n sendSize('overflowChanged', 'Overflow updated')\n }\n\n function setupObserveOverflow() {\n if (calculateHeight === calculateWidth) return\n observeOverflow = overflowObserver({\n onChange: onOverflowChange,\n root: document.documentElement,\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) 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 `<b>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(data) {\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 const data = window.iframeResizer || window.iFrameResizer\n\n if (typeof data !== 'object') return\n\n readData(data)\n heightCalcMode = setupCustomCalcMethods(heightCalcMode, 'height')\n widthCalcMode = setupCustomCalcMethods(widthCalcMode, 'width')\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 for (const el of document.querySelectorAll(sizeSelector)) {\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 }\n\n manageEventListeners('add')\n setupMutationObserver()\n setupResizeObservers()\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 for (const link of document.querySelectorAll('a[href^=\"#\"]')) {\n if (link.getAttribute('href') !== '#') {\n addEventListener(link, 'click', (e) => {\n e.preventDefault()\n findTarget(link.getAttribute('href'))\n })\n }\n }\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 sendSize('autoResizeEnabled', 'Auto Resize enabled')\n } else if (resize === false && autoResize === true) {\n autoResize = false\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 getOrigin: () => {\n advise(\n `<rb>Deprecated Method</>\n \nThe <b>getOrigin()</> method has been deprecated and replaced with <b>getParentOrigin()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n`,\n )\n return origin\n },\n\n getParentOrigin: () => origin,\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 MANUAL_RESIZE_REQUEST,\n `parentIframe.resize(${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 function resizeObserved(entries) {\n if (!Array.isArray(entries) || entries.length === 0) return\n\n const el = entries[0].target\n\n sendSize('resizeObserver', `Resize Observed: ${getElementName(el)}`)\n }\n\n const resizeSet = new WeakSet()\n\n // This function has to iterate over all page elements during load\n // so is optimized for performance, rather than best practices.\n function attachResizeObserverToNonStaticElements(rootElement) {\n if (rootElement.nodeType !== Node.ELEMENT_NODE) return\n\n if (!resizeSet.has(rootElement)) {\n const position = getComputedStyle(rootElement)?.position\n if (!(position === '' || position === 'static')) {\n resizeObserver.observe(rootElement)\n resizeSet.add(rootElement)\n log(`Attached resizeObserver: ${getElementName(rootElement)}`)\n }\n }\n\n const nodeList = getAllElements(rootElement)()\n\n for (const node of nodeList) {\n if (resizeSet.has(node) || node?.nodeType !== Node.ELEMENT_NODE) continue\n\n const position = getComputedStyle(node)?.position\n if (position === '' || position === 'static') continue\n\n resizeObserver.observe(node)\n resizeSet.add(node)\n log(`Attached resizeObserver: ${getElementName(node)}`)\n }\n }\n\n function setupResizeObservers() {\n resizeObserver = new ResizeObserver(resizeObserved)\n resizeObserver.observe(document.body)\n resizeSet.add(document.body)\n attachResizeObserverToNonStaticElements(document.body)\n }\n\n function setupMutationObserver() {\n const observedMutations = new Set()\n let pending = false\n let perfMon = 0\n let newMutations = []\n\n const updateMutation = (mutations) => {\n for (const mutation of mutations) {\n const { addedNodes, removedNodes } = mutation\n\n for (const node of addedNodes) {\n observedMutations.add(node)\n }\n\n for (const node of removedNodes) {\n observedMutations.delete(node)\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 log('MutationObserver: 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(attachResizeObserverToNonStaticElements)\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 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 : hasOverflow\n ? overflowedNodeList\n : getAllElements(document)() // We should never get here, but just in case\n\n let len = targetElements.length\n\n for (const element of targetElements) {\n if (\n !hasTags &&\n hasCheckVisibility && // Safari was missing checkVisibility until March 2024\n !element.checkVisibility(checkVisibilityOptions)\n ) {\n len -= 1\n continue\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.boundingClientRect(),\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 isHeight = getDimension === getHeight\n const dimension = isHeight ? 'height' : 'width'\n const boundingSize = getDimension.boundingClientRect()\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 boundingClientRect: () =>\n Math.max(\n document.documentElement.getBoundingClientRect().bottom,\n document.body.getBoundingClientRect().bottom,\n ),\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 boundingClientRect: () =>\n Math.max(\n document.documentElement.getBoundingClientRect().right,\n document.body.getBoundingClientRect().right,\n ),\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 const checkTolerance = (a, b) => !(Math.abs(a - b) <= tolerance)\n\n function sizeIframe(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n const isForceResizableEvent = () => !triggerEvent !== MANUAL_RESIZE_REQUEST\n\n const isForceResizableCalcMode = () =>\n (calculateHeight && heightCalcMode in resetRequiredMethods) ||\n (calculateWidth && widthCalcMode in resetRequiredMethods)\n\n const isSizeChangeDetected = () =>\n (calculateHeight && checkTolerance(height, newHeight)) ||\n (calculateWidth && checkTolerance(width, newWidth))\n\n const newHeight =\n undefined === customHeight ? getHeight[heightCalcMode]() : customHeight\n const newWidth =\n undefined === customWidth ? getWidth[widthCalcMode]() : customWidth\n\n if (isSizeChangeDetected() || triggerEvent === 'init') {\n lockTrigger()\n height = newHeight\n width = newWidth\n sendMsg(height, width, triggerEvent, msg)\n } else if (isForceResizableEvent() && isForceResizableCalcMode()) {\n resetIframe(triggerEventDesc)\n } else {\n timerActive = false // We're not resizing, so turn off the timer\n }\n }\n\n let sendPending = false\n\n function sendSize(\n triggerEvent,\n triggerEventDesc,\n customHeight,\n customWidth,\n msg,\n ) {\n totalTime = performance.now()\n\n if (!autoResize && triggerEvent !== MANUAL_RESIZE_REQUEST) {\n log('Resizing disabled')\n return\n }\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 (!sendPending) {\n log(`Resize event: ${triggerEventDesc}`)\n timerActive = true\n sizeIframe(triggerEvent, triggerEventDesc, customHeight, customWidth, msg)\n requestAnimationFrame(() => {\n sendPending = false\n })\n }\n\n sendPending = true\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 displayTimeTaken() {\n const timer = round(performance.now() - totalTime)\n return triggerEvent === 'init'\n ? `Initialised iFrame in %c${timer}ms`\n : `Content size recalculated in %c${timer}ms`\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 /* eslint-disable no-console */\n if (logging) {\n console.group(`[iframe-resizer][${myID}]`)\n console.info(\n `Sending message to host page via ${sameDomain ? 'sameDomain' : 'postMessage'}`,\n )\n console.info(`%c${message}`, 'font-style: italic')\n if (timerActive)\n console.info(displayTimeTaken(), 'font-weight:bold;color:#777')\n console.groupEnd()\n }\n /* eslint-enable no-console */\n\n timerActive = false\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 origin = event.origin\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(MANUAL_RESIZE_REQUEST, '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 setTimeout(() => 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 setTimeout(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 if ('iframeChildListener' in window) {\n warn('Already setup')\n } else {\n window.iframeChildListener = (data) =>\n setTimeout(() => receiver({ data, sameDomain: true }))\n\n addEventListener(window, 'message', receiver)\n addEventListener(window, 'readystatechange', chkLateLoaded)\n\n chkLateLoaded()\n }\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","MANUAL_RESIZE_REQUEST","addEventListener","el","evt","func","options","y","Object","fromEntries","map","l","p","Math","max","getModeData","replaceAll","String","fromCodePoint","codePointAt","id","x","ROUNDING","round","value","logging","setLogOptions","capitalizeFirstLetter","string","charAt","toUpperCase","slice","isDef","undefined","getElementName","nodeName","name","className","formatLogMsg","msg","join","log","console","info","warn","advise","window","chrome","formatAdvise","adviser","overflowObserver","side","onChange","observerOptions","root","rootMargin","threshold","emit","overflowedNodeList","document","querySelectorAll","observer","IntersectionObserver","entries","entry","boundingClientRect","rootBounds","target","edge","hasOverflow","toggleAttribute","requestAnimationFrame","observed","WeakSet","nodeList","node","nodeType","Node","ELEMENT_NODE","has","observe","add","PREF_START","PREF_END","PREF_MEASURE","timings","usedTags","addUsedTag","perfEl","details","timingCheck","setInterval","length","hasTags","len","sort","average","min","reduce","a","b","floor","clearInterval","Side","toLowerCase","perfObserver","list","getEntries","forEach","duration","performance","measure","detail","usedEl","push","shift","setup","PerformanceObserver","entryTypes","documentElement","body","readyState","checkVisibilityOptions","contentVisibilityAuto","opacityProperty","visibilityProperty","customCalcMethods","height","getHeight","auto","width","getWidth","deprecatedResizeMethods","bodyOffset","bodyScroll","offset","documentElementOffset","documentElementScroll","grow","lowestElement","eventCancelTimer","eventHandlersByName","hasCheckVisibility","heightCalcModeDefault","msgID","msgIdLen","resetRequiredMethods","widthCalcModeDefault","offsetHeight","offsetWidth","origin","timerActive","totalTime","autoResize","bodyBackground","bodyMargin","bodyMarginStr","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","init","method","attr","strBool","str","data","split","Number","enable","readDataFromParent","location","href","readData","JSON","stringify","offsetSize","prototype","hasOwnProperty","call","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","iframeResizer","iFrameResizer","readDataFromPage","error","checkCrossDomain","checkHeightMode","checkWidthMode","found","checkAttrs","removeAttribute","checkDeprecatedAttrs","checkAndSetupTags","onOverflowChange","parentIframe","freeze","resize","sendSize","sendMsg","close","getId","getOrigin","getParentOrigin","getPageInfo","callback","getParentProps","TypeError","getParentProperties","this","moveToAnchor","hash","findTarget","reset","resetIframe","scrollBy","scrollTo","scrollToOffset","sendMessage","setHeightCalculationMethod","setWidthCalculationMethod","setTargetOrigin","customHeight","customWidth","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","link","getAttribute","preventDefault","bindLocationHash","initCheck","setTimeout","enableInPageLinks","setupInPageLinks","addOverflowObservers","getAllElements","setBodyStyle","includes","clearFix","createElement","style","clear","display","append","injectClearFixIntoBodyElement","setAutoHeight","setProperty","stopInfiniteResizingOfIframe","applySizeSelector","title","manageTriggerEvent","eventType","eventName","observedMutations","Set","pending","perfMon","newMutations","updateMutation","mutations","mutation","addedNodes","removedNodes","delete","DELAY","DELAY_MARGIN","DELAY_MAX","delayCount","processMutations","now","delay","delayLimit","attachResizeObserverToNonStaticElements","mutationObserved","createMutationObserver","MutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","setupMutationObserver","ResizeObserver","resizeObserved","resizeSet","dataset","iframeSize","handleEvent","passive","remove","removeEventListener","checkCalcMode","calcModeDefault","modes","Array","isArray","rootElement","position","getComputedStyle","getMaxElement","mark","elVal","maxEl","maxVal","bottom","targetElements","element","checkVisibility","parseFloat","getPropertyValue","getAllMeasurements","dimension","prevScrollSize","prevBoundingSize","getAutoSize","getDimension","returnBoundingClientRect","boundingSize","scrollSize","isHeight","ceilBoundingSize","ceil","floorBoundingSize","getOffset","getAdjustedScroll","sizes","enabled","taggedElement","marginTop","marginBottom","scrollHeight","custom","scrollWidth","right","rightMostElement","scroll","checkTolerance","abs","sendPending","triggerEvent","triggerEventDesc","hidden","newHeight","newWidth","lockTrigger","sizeIframe","triggerReset","hcm","message","group","timer","displayTimeTaken","groupEnd","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,kBAEhBC,EAAc,SACdC,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