@iframe-resizer/child 5.4.6-beta.1 → 5.4.6-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/child
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.4.6-beta.1 2025-04-23 - 10:48:04.032Z_
25
+ _iframe-resizer version 5.4.6-beta.3 2025-04-23 - 20:02:10.315Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.4.6-beta.1 (cjs) - 2025-04-23
4
+ * @module iframe-resizer/child 5.4.6-beta.3 (cjs) - 2025-04-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,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- "use strict";const e=require("auto-console-group"),t="5.4.6-beta.1",n=10,o="data-iframe-size",i="data-iframe-overflowed",r="data-iframe-ignore",a="bottom",s="right",l="resizeParent",c="setOffsetSize",d="resizeObserver",u="overflowObserver",m="mutationObserver",f="No change in content size detected",p=(e,t,n,o)=>e.addEventListener(t,n,o||!1),g=["<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</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const h=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(g[e]),y=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},b=e=>e,v=e=>Math.round(1e3*e)/1e3,z=e=>e.charAt(0).toUpperCase()+e.slice(1),w=e=>""!=`${e}`&&void 0!==e;function I(e){switch(!0){case!w(e):return"";case w(e.id):return`${e.nodeName}#${e.id}`;case w(e.name):return`${e.nodeName} (${e.name}`;case w(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const $=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${z(t)}`)};let H=!0;var T;const S=(T=e,T?.__esModule?T.default:T)({label:"iframeResizer(child)"});const O=(M="log",(...e)=>!H||S[M](...e));var M;const E=O,{assert:k,debug:j,endAutoGroup:G,error:P,errorBoundary:A,event:L,label:R,purge:x,warn:C}=S,N=e=>{return S.warn((t=b,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},B=N,q=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,t)=>N(t))),D=q("Method"),F=q("Method","replaced with"),W=q("Option"),U=e=>t=>void 0===t?void 0:e(t),V=U((e=>"true"===e)),Z=U(Number),J="--ifr-start",_="--ifr-end",Q=[],X=new WeakSet,Y=e=>"object"==typeof e&&X.add(e);let K={},ee=0;const te=setInterval((()=>{if(Q.length<10)return;if(K.hasTags&&K.len<25)return;Q.sort();const e=Math.min(Q.reduce(((e,t)=>e+t),0)/Q.length,Q[Math.floor(Q.length/2)]),t=v(e);t>ee&&(ee=t,L("performanceObserver"),O("Mean time:",v(Q[Math.floor(Q.length/2)])),O("Median time:",v(Q.reduce(((e,t)=>e+t),0)/Q.length)),O("Average time:",t),O("Max time:",v(Math.max(...Q)))),e<=4||(clearInterval(te),N(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${v(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${K.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function ne(e){e.getEntries().forEach((e=>{if(e.name===_){const{duration:t}=performance.measure("--ifr-measure",J,_);K=e.detail,Q.push(t),Q.length>100&&Q.shift()}}))}function oe(){new PerformanceObserver(ne).observe({entryTypes:["mark"]}),Y(document.documentElement),Y(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",oe):oe());const ie=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},re=ie("function"),ae=ie("number"),se=ie("string");"undefined"!=typeof window&&function(){const g={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},w={height:()=>(C("Custom height calculation function not defined"),yt.auto()),width:()=>(C("Custom width calculation function not defined"),bt.auto())},T={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},M={},P="checkVisibility"in window,x="auto",q="[iFrameSizer]",U={max:1,min:1,bodyScroll:1,documentElementScroll:1},Q="scroll";let X,Y,K,ee,te,ne,oe=!0,ie="",le=0,ce="",de="",ue=!0,me=!1,fe=!0,pe=!1,ge=!1,he=!1,ye=1,be=x,ve="",ze=!0,we={},Ie=!0,$e=!1,He="",Te=0,Se=!1,Oe="",Me=b,Ee=[],ke="child",je=null,Ge=!1,Pe="",Ae=[],Le=window.parent,Re="*",xe=0,Ce=!1,Ne="",Be=1,qe=Q,De=window,Fe=()=>{C("onMessage function not defined")},We=()=>{},Ue=null,Ve=null;function Ze(l){var d,u,f;!function(e){Oe=e[0]??Oe,le=Z(e[1])??le,me=V(e[2])??me,$e=V(e[3])??$e,oe=V(e[6])??oe,ce=e[7]??ce,be=e[8]??be,ie=e[9]??ie,de=e[10]??de,xe=Z(e[11])??xe,we.enable=V(e[12])??!1,ke=e[13]??ke,qe=e[14]??qe,Se=V(e[15])??Se,X=Z(e[16])??X,Y=Z(e[17])??Y,ue=V(e[18])??ue,He=e[19]??He,Ne=e[20]??Ne,Te=Z(e[21])??Te,Ie=V(e[23])??Ie}(l),d={id:Oe,enabled:$e,expand:Ie},S.label(`${d.id}`),S.expand(d.expand),H=d.enabled,O(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){O("Reading data from page:",e),ne=re(e,"onBeforeResize")??ne,Fe=re(e,"onMessage")??Fe,We=re(e,"onReady")??We,"number"==typeof e?.offset&&(W("offset","offsetSize"),ue&&(X=ae(e,"offset")??X),me&&(Y=ae(e,"offset")??Y)),"number"==typeof e?.offsetSize&&(ue&&(X=ae(e,"offsetSize")??X),me&&(Y=ae(e,"offsetSize")??Y)),ve=se(e,"ignoreSelector")??ve,Pe=se(e,"sizeSelector")??Pe,Re=se(e,"targetOrigin")??Re,be=e?.heightCalculationMethod||be,qe=e?.widthCalculationMethod||qe}function n(e,t){return"function"==typeof e&&(N(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),w[t]=e,e="custom"),e}if(1===Te)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),be=n(be,"height"),qe=n(qe,"width"),E(`Set targetOrigin for parent: %c${Re}`,e.HIGHLIGHT))}(),nt(),function(){try{Ge=1===Te||"iframeParentListener"in window.parent}catch(e){O("Cross domain iframe detected")}}(),Te<0?B(`${h(Te+2)}${h(2)}`):Ne.codePointAt(0)>4||Te<2&&B(h(3)),Ne&&""!==Ne&&"false"!==Ne?Ne!==t&&N(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ne} - Child page: ${t}.\n`):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"),rt(),at(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(o,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&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</>.")}(),"BackCompat"===document.compatMode&&N("<rb>Quirks Mode Detected</>\n\nThis iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n"),Qe(),1!==Te&&(De.parentIframe=Object.freeze({autoResize:e=>($(e,"boolean","parentIframe.autoResize(enable) enable"),!0===e&&!1===oe?(oe=!0,Ht("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===oe&&(oe=!1),Ot(0,0,"autoResize",JSON.stringify(oe)),oe),close(){Ot(0,0,"close")},getId:()=>Oe,getOrigin:()=>(D("getOrigin()","getParentOrigin()"),K),getParentOrigin:()=>K,getPageInfo(e){if("function"==typeof e)return Ue=e,Ot(0,0,"pageInfo"),void F("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Ue=null,Ot(0,0,"pageInfoStop")},getParentProps:e=>($(e,"function","parentIframe.getParentProps(callback) callback"),Ve=e,Ot(0,0,"parentInfo"),()=>{Ve=null,Ot(0,0,"parentInfoStop")}),getParentProperties(e){D("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){$(e,"string","parentIframe.moveToAnchor(anchor) anchor"),we.findTarget(e)},reset(){St("parentIframe.reset")},setOffsetSize(e){$(e,"number","parentIframe.setOffsetSize(offset) offset"),X=e,Y=e,Ht(c,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){$(e,"number","parentIframe.scrollBy(x, y) x"),$(t,"number","parentIframe.scrollBy(x, y) y"),Ot(t,e,"scrollBy")},scrollTo(e,t){$(e,"number","parentIframe.scrollTo(x, y) x"),$(t,"number","parentIframe.scrollTo(x, y) y"),Ot(t,e,"scrollTo")},scrollToOffset(e,t){$(e,"number","parentIframe.scrollToOffset(x, y) x"),$(t,"number","parentIframe.scrollToOffset(x, y) y"),Ot(t,e,"scrollToOffset")},sendMessage(e,t){t&&$(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Ot(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){be=e,rt()},setWidthCalculationMethod(e){qe=e,at()},setTargetOrigin(t){$(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),O(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),Re=t},resize(e,t){e&&$(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&$(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Ht("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){D("size()","resize()"),this.resize(e,t)}}),De.parentIFrame=De.parentIframe),function(){function t(e){Ot(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){O(`Add event listener: %c${o}`,e.HIGHLIGHT),p(window.document,n,t)}!0===Se&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),we=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(e){const o=e.getBoundingClientRect(),i=t();return{x:parseInt(o.left,n)+parseInt(i.x,n),y:parseInt(o.top,n)+parseInt(i.y,n)}}function i(t){function n(t){const n=o(t);O(`Moving to in page link (%c#${i}%c) at x: %c${n.x}%c y: %c${n.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Ot(n.y,n.x,"scrollToOffset")}const i=t.split("#")[1]||t,r=decodeURIComponent(i),a=document.getElementById(r)||document.getElementsByName(r)[0];void 0===a?(O(`In page link (#${i}) not found in iFrame, so sending to parent`),Ot(0,0,"inPageLink",`#${i}`)):n(a)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&i(t)}function a(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&p(e,"click",(t=>{t.preventDefault(),i(e.getAttribute("href"))}))}function s(){p(window,"hashchange",r)}function l(){setTimeout(r,128)}function c(){O("Setting up location.hash handlers"),a(),s(),l()}return we.enable?1===Te?N("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():O("In page linking not enabled"),{findTarget:i}}(),void 0===ce&&(ce=`${le}px`),et("margin",(u="margin",(f=ce).includes("-")&&(C(`Negative CSS value ignored for ${u}`),f=""),f)),et("background",ie),et("padding",de),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),O("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==oe&&O("Auto Resize disabled"),function(e){ot({method:e,eventType:"After Print",eventName:"afterprint"}),ot({method:e,eventType:"Before Print",eventName:"beforeprint"}),ot({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const t=new Set,n=[];let i=!1,a=0;const s=e=>{E("Mutations observed:",e);for(const n of e){const{addedNodes:e,removedNodes:o}=n;for(const n of e)t.add(n);for(const e of o)t.delete(e)}},l=16,c=2,d=200;let u=1;function f(e){nt(),Xe(e),e.forEach(ct),e.clear()}function p(){const o=performance.now(),r=o-a,g=l*u+++c;if(r>g&&r<d)return E("Backed off due to heavy workload on callStack"),O(`Delay: %c${v(r)}ms %c> Delay limit: %c${g}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(p,l*u),void(a=o);u=1,n.forEach(s),n.length=0,t.size>0&&f(t),Qe(),Je(),i=!1,Ht(m,"Mutation Observed")}function g(e){n.push(e),i||(a=performance.now(),i=!0,requestAnimationFrame(p))}function h(){const e=new window.MutationObserver(g),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[r,o],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return O("Setup <body> MutationObserver"),e.observe(t,n),e}h()}(),O("Setup ResizeObserver"),je=new ResizeObserver(st),je.observe(document.body),lt.add(document.body),ct(document.body),ue!==me&&(O("Setup OverflowObserver"),Me=(e=>{const t=e.side||a,n=e.onChange||b,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||b,s=(e=!1)=>n(e),l=(e,n)=>0===e||e>n[t],c=(e,t)=>e.toggleAttribute(i,t),d=new IntersectionObserver((function(e){L("observation");for(const o of e){const{boundingClientRect:e,rootBounds:i,target:r}=o,a=e[t],s=l(a,i)&&!((n=r).hidden||null===n.offsetParent||"none"===n.style.display);c(r,s),s&&O("Overflowed:",r)}var n;r(s)}),o),u=new WeakSet;return function(e){O("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=u.has(t);!n&&e?(d.observe(t),u.add(t)):k(!n,"Node already observed",t)}}})({onChange:_e,root:document.documentElement,side:ue?a:s})),Xe(mt(document)()),queueMicrotask(We),O("Initialization complete"),Ht("init","Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&Ot(0,0,"title",document.title)}function Je(){Ee=document.querySelectorAll(`[${i}]:not([${r}]):not([${r}] *)`),ge=Ee.length>0}function _e(e){Je(),(ge||e)&&(O("Observed Elements:",Ee.length),Ht(u,"Overflow updated"))}function Qe(){Ae=document.querySelectorAll(`[${o}]`),he=Ae.length>0,O(`Tagged elements found: %c${he}`,e.HIGHLIGHT)}function Xe(e){he||Me(e)}let Ye=0;function Ke(){const t=document.querySelectorAll(`*[${r}]`);pe=t.length>0,pe&&t.length!==Ye&&(function(t){const n=1===t.length?"":"s";C(`%c[${r}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),Ye=t.length)}function et(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),E(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function tt(t,n,o){if(""!==o){O(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))O(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function nt(){tt("sizeSelector",o,Pe),tt("ignoreSelector",r,ve)}function ot(t){({add(e){function n(){Ht(t.eventName,t.eventType)}M[e]=n,p(window,e,n,{passive:!0})},remove(e){const t=M[e];var n,o;delete M[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),O(`${z(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function it(t,n,o,i){return n!==t&&(t in o||(C(`${t} is not a valid option for ${i}CalculationMethod.`),t=n),t in T&&N(`<rb>Deprecated ${i}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${i} calculation method. It is recommended that you remove this option.`),O(`Set ${i} calculation method: %c${t}`,e.HIGHLIGHT)),t}function rt(){be=it(be,x,yt,"height")}function at(){qe=it(qe,Q,bt,"width")}function st(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ht(d,`Element resized <${I(t)}>`)}const lt=new WeakSet;function ct(t){if(t.nodeType!==Node.ELEMENT_NODE)return;if(!lt.has(t)){const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(je.observe(t),lt.add(t),O(`Attached resizeObserver: %c${I(t)}`,e.HIGHLIGHT))}const n=mt(t)();for(const t of n){if(lt.has(t)||t?.nodeType!==Node.ELEMENT_NODE)continue;const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(je.observe(t),lt.add(t),O(`Attached resizeObserver: %c${I(t)}`,e.HIGHLIGHT))}}function dt(e){performance.mark(J);const t=z(e);let n=0,o=document.documentElement,i=he?0:document.documentElement.getBoundingClientRect().bottom;const r=he?Ae:ge?Ee:mt(document)();let a=r.length;for(const t of r)he||!P||t.checkVisibility(g)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,o=t)):a-=1;return E(`${t} position calculated from:`,o),performance.mark(_,{detail:{Side:t,len:a,hasTags:he,logging:$e}}),i}const ut=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],mt=e=>()=>{Ke();const t=["* ","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)"];return pe&&t.push(`not([${r}])`,`not([${r}] *)`),e.querySelectorAll(t.join(":"))},ft={height:0,width:0},pt={height:0,width:0},gt=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function ht(t){function n(){return pt[i]=r,ft[i]=l,r}const o=t===yt,i=o?"height":"width",r=t.boundingClientRect(),a=Math.ceil(r),s=Math.floor(r),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${r}px %cPage: %c${l}px`;let d=0;switch(!0){case!t.enabled():return l;case he:E("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!ge&&0===pt[i]&&0===ft[i]:E(`Initial page size values: ${c}`,...gt),d=n();break;case Ce&&r===pt[i]&&l===ft[i]:E(`Size unchanged: ${c}`,...gt),d=Math.max(r,l);break;case 0===r:E(`Page is hidden: ${c}`,...gt),d=l;break;case!ge&&r!==pt[i]&&l<=ft[i]:E(`New <html> size: ${c} `,...gt),E(`Previous <html> size: %c${pt[i]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!ge&&r<pt[i]:E(`<html> size decreased: ${c}`,...gt),d=n();break;case l===s||l===a:E(`<html> size equals page size: ${c}`,...gt),d=n();break;case r>l:E(`Page size < <html> size: ${c}`,...gt),d=n();break;case ge:E("Found element overflowing <html> "),d=t.taggedElement();break;default:E(`Using <html> size: ${c}`,...gt),d=n()}return E(`Content ${i}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&E(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const yt={enabled:()=>ue,getOffset:()=>X,auto:()=>ht(yt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>yt.bodyOffset(),custom:()=>w.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...ut(yt)),min:()=>Math.min(...ut(yt)),grow:()=>yt.max(),lowestElement:()=>dt(a),taggedElement:()=>dt(a)},bt={enabled:()=>me,getOffset:()=>Y,auto:()=>ht(bt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>w.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...ut(bt)),min:()=>Math.min(...ut(bt)),rightMostElement:()=>dt(s),scroll:()=>Math.max(bt.bodyScroll(),bt.documentElementScroll()),taggedElement:()=>dt(s)},vt=(e,t)=>!(Math.abs(e-t)<=xe);function zt(e,t){const n=e[t]();return e.enabled()&&void 0!==ne?function(e){const t=ne(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);return t}(n):n}function wt(t,n,o,i,r){const a=o??zt(yt,be),s=i??zt(bt,qe);switch(O(`Resize event: %c${n}`,e.HIGHLIGHT),!0){case ue&&vt(ye,a)||me&&vt(Be,s)||"init"===t:ye=a,Be=s;case t===c:Ot(ye,Be,t,r);break;case!t!==l&&(ue&&be in U||me&&qe in U):St(n);break;case t===d:case t===u:case t===m:O(f);break;default:E(f)}ee=!1}let It=!1;const $t=y((()=>B(h(4)))),Ht=A(((e,t,n,o,i)=>{te=performance.now(),ee=!0,L(e),!0!==It&&(oe||e===l?document.hidden?O("Page hidden - Ignored resize request"):(It=!0,requestAnimationFrame((()=>{It=!1})),wt(e,t,n,o,i)):E("Resizing disabled"))}));function Tt(e){ye=yt[be](),Be=bt[qe](),Ot(ye,Be,e)}function St(t){const n=be;be=x,O(`Reset trigger event: %c${t}`,e.HIGHLIGHT),Ce?O("TriggerLock blocked calculation"):(Ce=!0,j("Trigger event lock on"),requestAnimationFrame((()=>{Ce=!1,j("Trigger event lock off")}))),Tt("reset"),be=n}const Ot=A((function(t,n,o,i,r){Te<-1||(L(o),void 0!==r?O(`Message targetOrigin: %c${r}`,e.HIGHLIGHT):r=Re,function(){const a=`${Oe}:${t}:${n}:${o}${void 0===i?"":`:${i}`}`;if(Ge)try{window.parent.iframeParentListener(q+a)}catch(e){if(1!==Te)throw e;return void $t()}else Le.postMessage(q+a,r);ee&&O(function(){const e=v(performance.now()-te);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),E(`Sending message to parent page via ${Ge?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),G())})),Mt=A((function(t){L("onMessage");const{freeze:n}=Object,{parse:o}=JSON,i=e=>n(o(e)),r=e=>Ot(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void O("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");Le=t.source,K=t.origin,Ze(e),fe=!1,setTimeout((()=>{ze=!1}),128)},reset(){ze?O("Page reset ignored by init"):(O("Page size reset by host page"),Tt("resetPage"))},resize(){Ht(l,"Parent window requested size check")},moveToAnchor(){we.findTarget(c())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=c();O("PageInfo received from parent:",i(e)),Ue?setTimeout((()=>Ue(o(e)))):r("pageInfo")},parentInfo(){const e=i(c());O("ParentInfo received from parent:",e),Ve?setTimeout((()=>Ve(e))):r("parentInfo")},message(){const t=c();O("onMessage called from parent:%c",e.HIGHLIGHT,i(t)),setTimeout((()=>Fe(o(t))))}},s=()=>t.data.split("]")[1].split(":")[0],c=()=>t.data.slice(t.data.indexOf(":")+1),d=()=>t.data.split(":")[2]in{true:1,false:1};function u(){const e=s();L(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||d()||C(`Unexpected message (${t.data})`)}q===`${t.data}`.slice(0,13)&&function(){if(!1!==fe)return d()?(R(s()),L("init"),void a.init()):void O(`Ignored message of type "${s()}". Received before initialization.`);u()}()}));function Et(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?C("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Mt({data:e,sameOrigin:!0}))),p(window,"message",Mt),p(window,"readystatechange",Et),Et())}();
20
+ "use strict";const e=require("auto-console-group"),t="5.4.6-beta.3",n=10,o="data-iframe-size",r="data-iframe-overflowed",i="data-iframe-ignore",a="bottom",s="right",l=Symbol("sizeChanged"),c="manualResize",d="parentResize",u={[c]:1,[d]:1},m="setOffsetSize",f="resizeObserver",p="overflowObserver",h="mutationObserver",g="No change in content size detected",y="init",b=(e,t,n,o)=>e.addEventListener(t,n,o||!1),v=["<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</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const z=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(v[e]),w=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},I=e=>e,$=e=>Math.round(1e3*e)/1e3,H=e=>e.charAt(0).toUpperCase()+e.slice(1),T=e=>""!=`${e}`&&void 0!==e;function O(e){switch(!0){case!T(e):return"";case T(e.id):return`${e.nodeName}#${e.id}`;case T(e.name):return`${e.nodeName} (${e.name}`;case T(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const S=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${H(t)}`)};let M=!0;var E;const k=(E=e,E?.__esModule?E.default:E)({label:"iframeResizer(child)"});const j=(G="log",(...e)=>!M||k[G](...e));var G;const A=j,{assert:P,debug:L,endAutoGroup:R,error:C,errorBoundary:x,event:N,label:q,purge:B,warn:D}=k,F=e=>{return k.warn((t=I,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","").replaceAll("</>","").replaceAll("<b>","").replaceAll("<i>","").replaceAll("<u>","")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},W=F,U=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,t)=>F(t))),V=U("Method"),Z=U("Method","replaced with"),J=U("Option"),_=e=>t=>void 0===t?void 0:e(t),Q=_((e=>"true"===e)),X=_(Number),Y="--ifr-start",K="--ifr-end",ee=[],te=new WeakSet,ne=e=>"object"==typeof e&&te.add(e);let oe={},re=0;const ie=setInterval((()=>{if(ee.length<10)return;if(oe.hasTags&&oe.len<25)return;ee.sort();const e=Math.min(ee.reduce(((e,t)=>e+t),0)/ee.length,ee[Math.floor(ee.length/2)]),t=$(e);t>re&&(re=t,N("performanceObserver"),j("Mean time:",$(ee[Math.floor(ee.length/2)])),j("Median time:",$(ee.reduce(((e,t)=>e+t),0)/ee.length)),j("Average time:",t),j("Max time:",$(Math.max(...ee)))),e<=4||(clearInterval(ie),F(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${$(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${oe.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function ae(e){e.getEntries().forEach((e=>{if(e.name===K){const{duration:t}=performance.measure("--ifr-measure",Y,K);oe=e.detail,ee.push(t),ee.length>100&&ee.shift()}}))}function se(){new PerformanceObserver(ae).observe({entryTypes:["mark"]}),ne(document.documentElement),ne(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",se):se());const le=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},ce=le("function"),de=le("number"),ue=le("string");"undefined"!=typeof window&&function(){const v={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},T={height:()=>(D("Custom height calculation function not defined"),zt.auto()),width:()=>(D("Custom width calculation function not defined"),wt.auto())},E={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},G={},C="checkVisibility"in window,B="auto",U="[iFrameSizer]",_="scroll";let ee,te,ne,oe,re,ie,ae,se=!0,le="",me=0,fe="",pe="",he=!0,ge=!1,ye=!0,be=!1,ve=!1,ze=!1,we=1,Ie=B,$e="",He=!0,Te={},Oe=!0,Se=!1,Me="",Ee=0,ke=!1,je="",Ge=I,Ae=[],Pe="child",Le=null,Re=!1,Ce="",xe=[],Ne=window.parent,qe="*",Be=0,De=!1,Fe=1,We=_,Ue=window,Ve=()=>{D("onMessage function not defined")},Ze=()=>{},Je=null,_e=null;function Qe(l){var d,u,f;!function(e){je=e[0]??je,me=X(e[1])??me,ge=Q(e[2])??ge,Se=Q(e[3])??Se,se=Q(e[6])??se,fe=e[7]??fe,Ie=e[8]??Ie,le=e[9]??le,pe=e[10]??pe,Be=X(e[11])??Be,Te.enable=Q(e[12])??!1,Pe=e[13]??Pe,We=e[14]??We,ke=Q(e[15])??ke,ee=X(e[16])??ee,te=X(e[17])??te,he=Q(e[18])??he,Me=e[19]??Me,ie=e[20]??ie,Ee=X(e[21])??Ee,Oe=Q(e[23])??Oe}(l),d={id:je,enabled:Se,expand:Oe},k.label(`${d.id}`),k.expand(d.expand),M=d.enabled,j(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){j("Reading data from page:",e),ae=ce(e,"onBeforeResize")??ae,Ve=ce(e,"onMessage")??Ve,Ze=ce(e,"onReady")??Ze,"number"==typeof e?.offset&&(J("offset","offsetSize"),he&&(ee=de(e,"offset")??ee),ge&&(te=de(e,"offset")??te)),"number"==typeof e?.offsetSize&&(he&&(ee=de(e,"offsetSize")??ee),ge&&(te=de(e,"offsetSize")??te)),$e=ue(e,"ignoreSelector")??$e,Ce=ue(e,"sizeSelector")??Ce,qe=ue(e,"targetOrigin")??qe,Ie=e?.heightCalculationMethod||Ie,We=e?.widthCalculationMethod||We}function n(e,t){return"function"==typeof e&&(F(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),T[t]=e,e="custom"),e}if(1===Ee)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),Ie=n(Ie,"height"),We=n(We,"width"),A(`Set targetOrigin for parent: %c${qe}`,e.HIGHLIGHT))}(),it(),function(){try{Re=1===Ee||"iframeParentListener"in window.parent}catch(e){j("Cross domain iframe detected")}}(),Ee<0?W(`${z(Ee+2)}${z(2)}`):ie?.codePointAt(0)>4||Ee<2&&W(z(3)),ie&&""!==ie&&"false"!==ie?ie!==t&&F(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ie} - Child page: ${t}.\n`):F("<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"),lt(),ct(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(o,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&F("<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</>.")}(),"BackCompat"===document.compatMode&&F("<rb>Quirks Mode Detected</>\n\nThis iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n"),Ke(),1!==Ee&&(Ue.parentIframe=Object.freeze({autoResize:e=>(S(e,"boolean","parentIframe.autoResize(enable) enable"),!0===e&&!1===se?(se=!0,Ot("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===se&&(se=!1),Mt(0,0,"autoResize",JSON.stringify(se)),se),close(){Mt(0,0,"close")},getId:()=>je,getOrigin:()=>(V("getOrigin()","getParentOrigin()"),ne),getParentOrigin:()=>ne,getPageInfo(e){if("function"==typeof e)return Je=e,Mt(0,0,"pageInfo"),void Z("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Je=null,Mt(0,0,"pageInfoStop")},getParentProps:e=>(S(e,"function","parentIframe.getParentProps(callback) callback"),_e=e,Mt(0,0,"parentInfo"),()=>{_e=null,Mt(0,0,"parentInfoStop")}),getParentProperties(e){V("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){S(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Te.findTarget(e)},reset(){!function(){const t=Ie;Ie=B,j("Reset trigger event: %cparentIframe.reset",e.HIGHLIGHT),De?j("TriggerLock blocked calculation"):(De=!0,L("Trigger event lock on"),requestAnimationFrame((()=>{De=!1,L("Trigger event lock off")}))),St("reset"),Ie=t}()},setOffsetSize(e){S(e,"number","parentIframe.setOffsetSize(offset) offset"),ee=e,te=e,Ot(m,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){S(e,"number","parentIframe.scrollBy(x, y) x"),S(t,"number","parentIframe.scrollBy(x, y) y"),Mt(t,e,"scrollBy")},scrollTo(e,t){S(e,"number","parentIframe.scrollTo(x, y) x"),S(t,"number","parentIframe.scrollTo(x, y) y"),Mt(t,e,"scrollTo")},scrollToOffset(e,t){S(e,"number","parentIframe.scrollToOffset(x, y) x"),S(t,"number","parentIframe.scrollToOffset(x, y) y"),Mt(t,e,"scrollToOffset")},sendMessage(e,t){t&&S(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Mt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Ie=e,lt()},setWidthCalculationMethod(e){We=e,ct()},setTargetOrigin(t){S(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),j(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),qe=t},resize(e,t){e&&S(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&S(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Ot(c,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){V("size()","resize()"),this.resize(e,t)}}),Ue.parentIFrame=Ue.parentIframe),function(){function t(e){Mt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){j(`Add event listener: %c${o}`,e.HIGHLIGHT),b(window.document,n,t)}!0===ke&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),Te=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(e){const o=e.getBoundingClientRect(),r=t();return{x:parseInt(o.left,n)+parseInt(r.x,n),y:parseInt(o.top,n)+parseInt(r.y,n)}}function r(t){function n(t){const n=o(t);j(`Moving to in page link (%c#${r}%c) at x: %c${n.x}%c y: %c${n.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Mt(n.y,n.x,"scrollToOffset")}const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(j(`In page link (#${r}) not found in iFrame, so sending to parent`),Mt(0,0,"inPageLink",`#${r}`)):n(a)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&r(t)}function a(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&b(e,"click",(t=>{t.preventDefault(),r(e.getAttribute("href"))}))}function s(){b(window,"hashchange",i)}function l(){setTimeout(i,128)}function c(){j("Setting up location.hash handlers"),a(),s(),l()}return Te.enable?1===Ee?F("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():j("In page linking not enabled"),{findTarget:r}}(),void 0===fe&&(fe=`${me}px`),ot("margin",(u="margin",(f=fe).includes("-")&&(D(`Negative CSS value ignored for ${u}`),f=""),f)),ot("background",le),ot("padding",pe),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),j("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==se&&j("Auto Resize disabled"),function(e){at({method:e,eventType:"After Print",eventName:"afterprint"}),at({method:e,eventType:"Before Print",eventName:"beforeprint"}),at({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const t=new Set,n=[];let r=!1,a=0;const s=e=>{A("Mutations observed:",e);for(const n of e){const{addedNodes:e,removedNodes:o}=n;for(const n of e)t.add(n);for(const e of o)t.delete(e)}},l=16,c=2,d=200;let u=1;function m(e){it(),et(e),e.forEach(mt),e.clear()}function f(){const o=performance.now(),i=o-a,p=l*u+++c;if(i>p&&i<d)return A("Backed off due to heavy workload on callStack"),j(`Delay: %c${$(i)}ms %c> Delay limit: %c${p}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(f,l*u),void(a=o);u=1,n.forEach(s),n.length=0,t.size>0&&m(t),Ke(),Xe(),r=!1,Ot(h,"Mutation Observed")}function p(e){n.push(e),r||(a=performance.now(),r=!0,requestAnimationFrame(f))}function g(){const e=new window.MutationObserver(p),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[i,o],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return j("Setup <body> MutationObserver"),e.observe(t,n),e}g()}(),j("Setup ResizeObserver"),Le=new ResizeObserver(dt),Le.observe(document.body),ut.add(document.body),mt(document.body),he!==ge&&(j("Setup OverflowObserver"),Ge=(e=>{const t=e.side||a,n=e.onChange||I,o={root:e.root,rootMargin:"0px",threshold:1},i=window?.requestAnimationFrame||I,s=(e=!1)=>n(e),l=(e,n)=>0===e||e>n[t],c=(e,t)=>e.toggleAttribute(r,t),d=new IntersectionObserver((function(e){N("observation");for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,a=e[t],s=l(a,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);c(i,s),s&&j("Overflowed:",i)}var n;i(s)}),o),u=new WeakSet;return function(e){j("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=u.has(t);!n&&e?(d.observe(t),u.add(t)):P(!n,"Node already observed",t)}}})({onChange:Ye,root:document.documentElement,side:he?a:s})),et(ht(document)()),queueMicrotask(Ze),j("Initialization complete"),Ot(y,"Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&Mt(0,0,"title",document.title)}function Xe(){Ae=document.querySelectorAll(`[${r}]:not([${i}]):not([${i}] *)`),ve=Ae.length>0}function Ye(e){Xe(),(ve||e)&&(j("Observed Elements:",Ae.length),Ot(p,"Overflow updated"))}function Ke(){xe=document.querySelectorAll(`[${o}]`),ze=xe.length>0,j(`Tagged elements found: %c${ze}`,e.HIGHLIGHT)}function et(e){ze||Ge(e)}let tt=0;function nt(){const t=document.querySelectorAll(`*[${i}]`);be=t.length>0,be&&t.length!==tt&&(function(t){const n=1===t.length?"":"s";D(`%c[${i}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),tt=t.length)}function ot(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),A(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function rt(t,n,o){if(""!==o){j(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))j(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function it(){rt("sizeSelector",o,Ce),rt("ignoreSelector",i,$e)}function at(t){({add(e){function n(){Ot(t.eventName,t.eventType)}G[e]=n,b(window,e,n,{passive:!0})},remove(e){const t=G[e];var n,o;delete G[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),j(`${H(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function st(t,n,o,r){return n!==t&&(t in o||(D(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in E)&&F(`<rb>Deprecated ${r}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${ie?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),j(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function lt(){Ie=st(Ie,B,zt,"height")}function ct(){We=st(We,_,wt,"width")}function dt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Ot(f,`Element resized <${O(t)}>`)}const ut=new WeakSet;function mt(t){if(t.nodeType!==Node.ELEMENT_NODE)return;if(!ut.has(t)){const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(Le.observe(t),ut.add(t),j(`Attached resizeObserver: %c${O(t)}`,e.HIGHLIGHT))}const n=ht(t)();for(const t of n){if(ut.has(t)||t?.nodeType!==Node.ELEMENT_NODE)continue;const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(Le.observe(t),ut.add(t),j(`Attached resizeObserver: %c${O(t)}`,e.HIGHLIGHT))}}function ft(e){performance.mark(Y);const t=H(e);let n=0,o=document.documentElement,r=ze?0:document.documentElement.getBoundingClientRect().bottom;const i=ze?xe:ve?Ae:ht(document)();let a=i.length;for(const t of i)ze||!C||t.checkVisibility(v)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t)):a-=1;return A(`${t} position calculated from:`,o),performance.mark(K,{detail:{Side:t,len:a,hasTags:ze,logging:Se}}),r}const pt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ht=e=>()=>{nt();const t=["* ","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)"];return be&&t.push(`not([${i}])`,`not([${i}] *)`),e.querySelectorAll(t.join(":"))},gt={height:0,width:0},yt={height:0,width:0},bt=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function vt(t){function n(){return yt[r]=i,gt[r]=l,i}const o=t===zt,r=o?"height":"width",i=t.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${i}px %cPage: %c${l}px`;let d=0;switch(!0){case!t.enabled():return l;case ze:A("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!ve&&0===yt[r]&&0===gt[r]:A(`Initial page size values: ${c}`,...bt),d=n();break;case De&&i===yt[r]&&l===gt[r]:A(`Size unchanged: ${c}`,...bt),d=Math.max(i,l);break;case 0===i:A(`Page is hidden: ${c}`,...bt),d=l;break;case!ve&&i!==yt[r]&&l<=gt[r]:A(`New <html> size: ${c} `,...bt),A(`Previous <html> size: %c${yt[r]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!ve&&i<yt[r]:A(`<html> size decreased: ${c}`,...bt),d=n();break;case l===s||l===a:A(`<html> size equals page size: ${c}`,...bt),d=n();break;case i>l:A(`Page size < <html> size: ${c}`,...bt),d=n();break;case ve:A("Found element overflowing <html> "),d=t.taggedElement();break;default:A(`Using <html> size: ${c}`,...bt),d=n()}return A(`Content ${r}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&A(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const zt={enabled:()=>he,getOffset:()=>ee,auto:()=>vt(zt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>zt.bodyOffset(),custom:()=>T.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...pt(zt)),min:()=>Math.min(...pt(zt)),grow:()=>zt.max(),lowestElement:()=>ft(a),taggedElement:()=>ft(a)},wt={enabled:()=>ge,getOffset:()=>te,auto:()=>vt(wt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>T.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...pt(wt)),min:()=>Math.min(...pt(wt)),rightMostElement:()=>ft(s),scroll:()=>Math.max(wt.bodyScroll(),wt.documentElementScroll()),taggedElement:()=>ft(s)},It=(e,t)=>!(Math.abs(e-t)<=Be);function $t(e,t){const n=e[t]();return e.enabled()&&void 0!==ae?function(e){const t=ae(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);return t}(n):n}let Ht=!1;const Tt=w((()=>W(z(4)))),Ot=x(((t,n,o,r,i)=>{if(re=performance.now(),oe=!0,N(t),!0!==Ht)return se||t in u?void(document.hidden?j("Page hidden - Ignored resize request"):(Ht=!0,requestAnimationFrame((()=>{Ht=!1})),function(t,n,o,r,i){const a=o??$t(zt,Ie),s=r??$t(wt,We),c=he&&It(we,a)||ge&&It(Fe,s)?l:t;switch(j(`Resize event: %c${n}`,e.HIGHLIGHT),c){case y:case l:we=a,Fe=s;case m:Mt(we,Fe,t,i);break;case f:case p:case h:j(g);break;default:A(g)}oe=!1}(t,n,o,r,i))):(A("Resizing disabled"),void R())}));function St(e){we=zt[Ie](),Fe=wt[We](),Mt(we,Fe,e)}const Mt=x((function(t,n,o,r,i){Ee<-1||(N(o),void 0!==i?j(`Message targetOrigin: %c${i}`,e.HIGHLIGHT):i=qe,function(){const a=`${je}:${t}:${n}:${o}${void 0===r?"":`:${r}`}`;if(Re)try{window.parent.iframeParentListener(U+a)}catch(e){if(1!==Ee)throw e;return void Tt()}else Ne.postMessage(U+a,i);oe&&j(function(){const e=$(performance.now()-re);return o===y?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),A(`Sending message to parent page via ${Re?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),R())})),Et=x((function(t){N("onMessage");const{freeze:n}=Object,{parse:o}=JSON,r=e=>n(o(e)),i=e=>Mt(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void j("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");Ne=t.source,ne=t.origin,Qe(e),ye=!1,setTimeout((()=>{He=!1}),128)},reset(){He?j("Page reset ignored by init"):(j("Page size reset by host page"),St("resetPage"))},resize(){j("Resize requested by host page"),"auto"===Ie&&"auto"===We&&F("<rb>Deprecated Method</>\n \nUse of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As the size detection no longer requires a trigger event from the parent page."),Ot(d,"Parent window requested size check")},moveToAnchor(){Te.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();j("PageInfo received from parent:",r(e)),Je?setTimeout((()=>Je(o(e)))):i("pageInfo")},parentInfo(){const e=r(l());j("ParentInfo received from parent:",e),_e?setTimeout((()=>_e(e))):i("parentInfo")},message(){const t=l();j("onMessage called from parent:%c",e.HIGHLIGHT,r(t)),setTimeout((()=>Ve(o(t))))}},s=()=>t.data.split("]")[1].split(":")[0],l=()=>t.data.slice(t.data.indexOf(":")+1),c=()=>t.data.split(":")[2]in{true:1,false:1};function u(){const e=s();N(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||D(`Unexpected message (${t.data})`)}U===`${t.data}`.slice(0,13)&&function(){if(!1!==ye)return c()?(q(s()),N(y),void a.init()):void j(`Ignored message of type "${s()}". Received before initialization.`);u()}()}));function kt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?D("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Et({data:e,sameOrigin:!0}))),b(window,"message",Et),b(window,"readystatechange",kt),kt())}();
21
21
  //# sourceMappingURL=index.cjs.js.map