@iframe-resizer/child 5.4.5-beta.11 → 5.4.5-beta.12

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.5-beta.11 2025-04-15 - 21:16:10.331Z_
25
+ _iframe-resizer version 5.4.5-beta.12 2025-04-15 - 21:53:20.088Z_
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.4.5-beta.11 (cjs) - 2025-04-15
4
+ * @module iframe-resizer/child 5.4.5-beta.12 (cjs) - 2025-04-15
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.5-beta.11",n=10,o="data-iframe-size",i="data-iframe-overflowed",r="data-iframe-ignore",a="bottom",l="right",s="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 O;const S=(O=e,O?.__esModule?O.default:O)({label:"iframeResizer(child)"});const T=(M="log",(...e)=>!H||S[M](...e));var M;const k=T,{assert:E,debug:j,endAutoGroup:G,error:P,errorBoundary:A,event:L,purge:x,warn:C}=S,R=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},N=R,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)=>R(t))),B=q("Method"),D=q("Method","replaced with"),F=q("Option"),W="--ifr-start",U="--ifr-end",V=[],Z=new WeakSet,J=e=>"object"==typeof e&&Z.add(e);let _={},Q=0;const X=setInterval((()=>{if(V.length<10)return;if(_.hasTags&&_.len<25)return;V.sort();const e=Math.min(V.reduce(((e,t)=>e+t),0)/V.length,V[Math.floor(V.length/2)]),t=v(e);t>Q&&(Q=t,L("performanceObserver"),T("Mean time:",v(V[Math.floor(V.length/2)])),T("Median time:",v(V.reduce(((e,t)=>e+t),0)/V.length)),T("Average time:",t),T("Max time:",v(Math.max(...V)))),e<=4||(clearInterval(X),R(`<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 ${_.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function Y(e){e.getEntries().forEach((e=>{if(e.name===U){const{duration:t}=performance.measure("--ifr-measure",W,U);_=e.detail,V.push(t),V.length>100&&V.shift()}}))}function K(){new PerformanceObserver(Y).observe({entryTypes:["mark"]}),J(document.documentElement),J(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",K):K()),"undefined"!=typeof window&&function(){const g={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},w={height:()=>(C("Custom height calculation function not defined"),dt.auto()),width:()=>(C("Custom width calculation function not defined"),ut.auto())},O={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]",V={max:1,min:1,bodyScroll:1,documentElementScroll:1},Z="scroll";let J,_,Q,X,Y,K=!0,ee="",te=0,ne="",oe="",ie=!0,re=!1,ae=!0,le=!1,se=!1,ce=!1,de=1,ue=x,me="",fe=!0,pe="",ge={},he=!0,ye=!1,be=0,ve=!1,ze="",we=b,Ie=[],$e="child",He=null,Oe=!1,Se="",Te=[],Me=window.parent,ke="*",Ee=0,je=!1,Ge="",Pe=1,Ae=Z,Le=window,xe=()=>{C("onMessage function not defined")},Ce=()=>{},Re=null,Ne=null;function qe(){if("loading"===document.readyState)return C("Document not ready, current state: %c%s",e.HIGHLIGHT,document.readyState),void p(document,"readystatechange",qe);var s,d,u;!function(){const e=e=>"true"===e,t=pe.slice(13).split(":");ze=t[0],te=void 0===t[1]?te:Number(t[1]),re=void 0===t[2]?re:e(t[2]),ye=void 0===t[3]?ye:e(t[3]),K=void 0===t[6]?K:e(t[6]),ne=t[7],ue=void 0===t[8]?ue:t[8],ee=t[9],oe=t[10],Ee=void 0===t[11]?Ee:Number(t[11]),ge.enable=void 0!==t[12]&&e(t[12]),$e=void 0===t[13]?$e:t[13],Ae=void 0===t[14]?Ae:t[14],ve=void 0===t[15]?ve:e(t[15]),J=void 0===t[16]?J:Number(t[16]),_=void 0===t[17]?_:Number(t[17]),ie=void 0===t[18]?ie:e(t[18]),t[19],Ge=t[20]||Ge,be=void 0===t[21]?be:Number(t[21]),he=void 0===t[23]?he:e(t[23])}(),s={id:ze,enabled:ye,expand:he},S.label(`${s.id}`),S.expand(s.expand),H=s.enabled,T(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){T("Reading data from page:",e),xe=e?.onMessage||xe,Ce=e?.onReady||Ce,"number"==typeof e?.offset&&(F("offset","offsetSize"),ie&&(J=e?.offset),re&&(_=e?.offset)),"number"==typeof e?.offsetSize&&(ie&&(J=e?.offsetSize),re&&(_=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Se=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(me=e.ignoreSelector),ke=e?.targetOrigin||ke,ue=e?.heightCalculationMethod||ue,Ae=e?.widthCalculationMethod||Ae}function n(e,t){return"function"==typeof e&&(T(`Setup custom ${t}CalcMethod`),w[t]=e,e="custom"),e}if(1===be)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),ue=n(ue,"height"),Ae=n(Ae,"width"),k(`Set targetOrigin for parent: %c${ke}`,e.HIGHLIGHT))}(),_e(),function(){try{Oe=1===be||"iframeParentListener"in window.parent}catch(e){T("Cross domain iframe detected")}}(),be<0?N(`${h(be+2)}${h(2)}`):Ge.codePointAt(0)>4||be<2&&N(h(3)),Ge&&""!==Ge&&"false"!==Ge?Ge!==t&&R(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ge} - Child page: ${t}.\n`):R("<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"),Ye(),Ke(),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&&R("<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&&R("<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"),Fe(),1!==be&&(Le.parentIframe=Object.freeze({autoResize:e=>($(e,"boolean","parentIframe.autoResize(enable) enable"),!0===e&&!1===K?(K=!0,ht("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===K&&(K=!1),vt(0,0,"autoResize",JSON.stringify(K)),K),close(){vt(0,0,"close")},getId:()=>ze,getOrigin:()=>(B("getOrigin()","getParentOrigin()"),Q),getParentOrigin:()=>Q,getPageInfo(e){if("function"==typeof e)return Re=e,vt(0,0,"pageInfo"),void D("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Re=null,vt(0,0,"pageInfoStop")},getParentProps:e=>($(e,"function","parentIframe.getParentProps(callback) callback"),Ne=e,vt(0,0,"parentInfo"),()=>{Ne=null,vt(0,0,"parentInfoStop")}),getParentProperties(e){B("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){$(e,"string","parentIframe.moveToAnchor(anchor) anchor"),ge.findTarget(e)},reset(){bt("parentIframe.reset")},setOffsetSize(e){$(e,"number","parentIframe.setOffsetSize(offset) offset"),J=e,_=e,ht(c,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){$(e,"number","parentIframe.scrollBy(x, y) x"),$(t,"number","parentIframe.scrollBy(x, y) y"),vt(t,e,"scrollBy")},scrollTo(e,t){$(e,"number","parentIframe.scrollTo(x, y) x"),$(t,"number","parentIframe.scrollTo(x, y) y"),vt(t,e,"scrollTo")},scrollToOffset(e,t){$(e,"number","parentIframe.scrollToOffset(x, y) x"),$(t,"number","parentIframe.scrollToOffset(x, y) y"),vt(t,e,"scrollToOffset")},sendMessage(e,t){t&&$(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),vt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){ue=e,Ye()},setWidthCalculationMethod(e){Ae=e,Ke()},setTargetOrigin(t){$(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),T(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),ke=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){B("size()","resize()"),this.resize(e,t)}}),Le.parentIFrame=Le.parentIframe),function(){function t(e){vt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){T(`Add event listener: %c${o}`,e.HIGHLIGHT),p(window.document,n,t)}!0===ve&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),ge=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);T(`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),vt(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?(T(`In page link (#${i}) not found in iFrame, so sending to parent`),vt(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 l(){p(window,"hashchange",r)}function s(){setTimeout(r,128)}function c(){T("Setting up location.hash handlers"),a(),l(),s()}return ge.enable?1===be?R("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():T("In page linking not enabled"),{findTarget:i}}(),void 0===ne&&(ne=`${te}px`),Ze("margin",(d="margin",(u=ne).includes("-")&&(C(`Negative CSS value ignored for ${d}`),u=""),u)),Ze("background",ee),Ze("padding",oe),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),T("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==K&&T("Auto Resize disabled"),function(e){Qe({method:e,eventType:"After Print",eventName:"afterprint"}),Qe({method:e,eventType:"Before Print",eventName:"beforeprint"})}("add"),function(){const t=new Set,n=[];let i=!1,a=0;const l=e=>{k("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)}},s=16,c=2,d=200;let u=1;function f(e){_e(),We(e),e.forEach(nt),e.clear()}function p(){const o=performance.now(),r=o-a,g=s*u+++c;if(r>g&&r<d)return k("Backed off due to heavy workload on callStack"),T(`Delay: %c${v(r)}ms %c> Delay limit: %c${g}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(p,s*u),void(a=o);u=1,n.forEach(l),n.length=0,t.size>0&&f(t),Fe(),Be(),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 T("Setup <body> MutationObserver"),e.observe(t,n),e}h()}(),T("Setup ResizeObserver"),He=new ResizeObserver(et),He.observe(document.body),tt.add(document.body),nt(document.body),ie!==re&&(T("Setup OverflowObserver"),we=(e=>{const t=e.side||a,n=e.onChange||b,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||b,l=(e=!1)=>n(e),s=(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],l=s(a,i)&&!((n=r).hidden||null===n.offsetParent||"none"===n.style.display);c(r,l),l&&T("Overflowed:",r)}var n;r(l)}),o),u=new WeakSet;return function(e){T("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)):E(!n,"Node already observed",t)}}})({onChange:De,root:document.documentElement,side:ie?a:l})),We(rt(document)()),queueMicrotask(Ce),T("Initialization complete"),ht("init","Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&vt(0,0,"title",document.title)}function Be(){Ie=document.querySelectorAll(`[${i}]:not([${r}]):not([${r}] *)`),se=Ie.length>0}function De(e){Be(),(se||e)&&(T("Observed Elements:",Ie.length),ht(u,"Overflow updated"))}function Fe(){Te=document.querySelectorAll(`[${o}]`),ce=Te.length>0,T(`Tagged elements found: %c${ce}`,e.HIGHLIGHT)}function We(e){ce||we(e)}let Ue=0;function Ve(){const t=document.querySelectorAll(`*[${r}]`);le=t.length>0,le&&t.length!==Ue&&(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),Ue=t.length)}function Ze(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),k(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function Je(t,n,o){if(""!==o){T(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))T(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function _e(){Je("sizeSelector",o,Se),Je("ignoreSelector",r,me)}function Qe(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),T(`${z(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Xe(t,n,o,i){return n!==t&&(t in o||(C(`${t} is not a valid option for ${i}CalculationMethod.`),t=n),t in O&&R(`<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.`),T(`Set ${i} calculation method: %c${t}`,e.HIGHLIGHT)),t}function Ye(){ue=Xe(ue,x,dt,"height")}function Ke(){Ae=Xe(Ae,Z,ut,"width")}function et(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;ht(d,`Element resized <${I(t)}>`)}const tt=new WeakSet;function nt(t){if(t.nodeType!==Node.ELEMENT_NODE)return;if(!tt.has(t)){const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(He.observe(t),tt.add(t),T(`Attached resizeObserver: %c${I(t)}`,e.HIGHLIGHT))}const n=rt(t)();for(const t of n){if(tt.has(t)||t?.nodeType!==Node.ELEMENT_NODE)continue;const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(He.observe(t),tt.add(t),T(`Attached resizeObserver: %c${I(t)}`,e.HIGHLIGHT))}}function ot(e){performance.mark(W);const t=z(e);let n=0,o=document.documentElement,i=ce?0:document.documentElement.getBoundingClientRect().bottom;const r=ce?Te:se?Ie:rt(document)();let a=r.length;for(const t of r)ce||!P||t.checkVisibility(g)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,o=t)):a-=1;return k(`${t} position calculated from:`,o),performance.mark(U,{detail:{Side:t,len:a,hasTags:ce,logging:ye}}),i}const it=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],rt=e=>()=>{Ve();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 le&&t.push(`not([${r}])`,`not([${r}] *)`),e.querySelectorAll(t.join(":"))},at={height:0,width:0},lt={height:0,width:0},st=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function ct(t){function n(){return lt[i]=r,at[i]=s,r}const o=t===dt,i=o?"height":"width",r=t.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${r}px %cPage: %c${s}px`;let d=0;switch(!0){case!t.enabled():return s;case ce:k("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!se&&0===lt[i]&&0===at[i]:k(`Initial page size values: ${c}`,...st),d=n();break;case je&&r===lt[i]&&s===at[i]:k(`Size unchanged: ${c}`,...st),d=Math.max(r,s);break;case 0===r:k(`Page is hidden: ${c}`,...st),d=s;break;case!se&&r!==lt[i]&&s<=at[i]:k(`New <html> size: ${c} `,...st),k(`Previous <html> size: %c${lt[i]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!se&&r<lt[i]:k(`<html> size decreased: ${c}`,...st),d=n();break;case s===l||s===a:k(`<html> size equals page size: ${c}`,...st),d=n();break;case r>s:k(`Page size < <html> size: ${c}`,...st),d=n();break;case se:k("Found element overflowing <html> "),d=t.taggedElement();break;default:k(`Using <html> size: ${c}`,...st),d=n()}return k(`Content ${i}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&k(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const dt={enabled:()=>ie,getOffset:()=>J,auto:()=>ct(dt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>dt.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(...it(dt)),min:()=>Math.min(...it(dt)),grow:()=>dt.max(),lowestElement:()=>ot(a),taggedElement:()=>ot(a)},ut={enabled:()=>re,getOffset:()=>_,auto:()=>ct(ut),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(...it(ut)),min:()=>Math.min(...it(ut)),rightMostElement:()=>ot(l),scroll:()=>Math.max(ut.bodyScroll(),ut.documentElementScroll()),taggedElement:()=>ot(l)},mt=(e,t)=>!(Math.abs(e-t)<=Ee);function ft(e,t,n,o,i){const r=void 0===n?dt[ue]():n,a=void 0===o?ut[Ae]():o;switch(!0){case ie&&mt(de,r)||re&&mt(Pe,a)||"init"===e:de=r,Pe=a;case e===c:vt(de,Pe,e,i);break;case!e!==s&&(ie&&ue in V||re&&Ae in V):bt(t);break;case e===d:case e===u:case e===m:T(f);break;default:k(f)}X=!1}let pt=!1;const gt=y((()=>N(h(4)))),ht=A(((t,n,o,i,r)=>{L(t),Y=performance.now(),K||t===s?document.hidden?T("Page hidden - Ignored resize request"):(pt||(T(`Resize event: %c${n}`,e.HIGHLIGHT),X=!0,ft(t,n,o,i,r),requestAnimationFrame((()=>{pt=!1}))),pt=!0):k("Resizing disabled")}));function yt(e){de=dt[ue](),Pe=ut[Ae](),vt(de,Pe,e)}function bt(t){const n=ue;ue=x,T(`Reset trigger event: %c${t}`,e.HIGHLIGHT),je?T("TriggerLock blocked calculation"):(je=!0,j("Trigger event lock on"),requestAnimationFrame((()=>{je=!1,j("Trigger event lock off")}))),yt("reset"),ue=n}const vt=A((function(t,n,o,i,r){be<-1||(L(o),void 0!==r?T(`Message targetOrigin: %c${r}`,e.HIGHLIGHT):r=ke,function(){const a=`${ze}:${t}:${n}:${o}${void 0===i?"":`:${i}`}`;if(Oe)try{window.parent.iframeParentListener(q+a)}catch(e){if(1!==be)throw e;return void gt()}else Me.postMessage(q+a,r);X&&T(function(){const e=v(performance.now()-Y);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),k(`Sending message to parent page via ${Oe?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),G())})),zt=A((function(t){L("onMessage");const{freeze:n}=Object,{parse:o}=JSON,i=e=>n(o(e)),r=e=>vt(0,0,`${e}Stop`),a={init:function(){pe=t.data,Me=t.source,Q=t.origin,qe(),ae=!1,setTimeout((()=>{fe=!1}),128)},reset(){fe?T("Page reset ignored by init"):(T("Page size reset by host page"),yt("resetPage"))},resize(){ht(s,"Parent window requested size check")},moveToAnchor(){ge.findTarget(c())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=c();T("PageInfo received from parent:",i(e)),Re?setTimeout((()=>Re(o(e)))):r("pageInfo")},parentInfo(){const e=i(c());T("ParentInfo received from parent:",e),Ne?setTimeout((()=>Ne(e))):r("parentInfo")},message(){const t=c();T("onMessage called from parent:%c",e.HIGHLIGHT,i(t)),setTimeout((()=>xe(o(t))))}},l=()=>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=l();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)&&(L(l()),!1!==ae?d()?a.init():T(`Ignored message of type "${l()}". Received before initialization.`):u())}));function wt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?C("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>zt({data:e,sameOrigin:!0}))),p(window,"message",zt),p(window,"readystatechange",wt),wt())}();
20
+ "use strict";const e=require("auto-console-group"),t="5.4.5-beta.12",n=10,o="data-iframe-size",i="data-iframe-overflowed",r="data-iframe-ignore",a="bottom",l="right",s="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 O;const S=(O=e,O?.__esModule?O.default:O)({label:"iframeResizer(child)"});const T=(M="log",(...e)=>!H||S[M](...e));var M;const k=T,{assert:E,debug:j,endAutoGroup:G,error:P,errorBoundary:A,event:L,purge:x,warn:C}=S,R=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},N=R,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)=>R(t))),B=q("Method"),D=q("Method","replaced with"),F=q("Option"),W="--ifr-start",U="--ifr-end",V=[],Z=new WeakSet,J=e=>"object"==typeof e&&Z.add(e);let _={},Q=0;const X=setInterval((()=>{if(V.length<10)return;if(_.hasTags&&_.len<25)return;V.sort();const e=Math.min(V.reduce(((e,t)=>e+t),0)/V.length,V[Math.floor(V.length/2)]),t=v(e);t>Q&&(Q=t,L("performanceObserver"),T("Mean time:",v(V[Math.floor(V.length/2)])),T("Median time:",v(V.reduce(((e,t)=>e+t),0)/V.length)),T("Average time:",t),T("Max time:",v(Math.max(...V)))),e<=4||(clearInterval(X),R(`<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 ${_.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function Y(e){e.getEntries().forEach((e=>{if(e.name===U){const{duration:t}=performance.measure("--ifr-measure",W,U);_=e.detail,V.push(t),V.length>100&&V.shift()}}))}function K(){new PerformanceObserver(Y).observe({entryTypes:["mark"]}),J(document.documentElement),J(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",K):K()),"undefined"!=typeof window&&function(){const g={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},w={height:()=>(C("Custom height calculation function not defined"),dt.auto()),width:()=>(C("Custom width calculation function not defined"),ut.auto())},O={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]",V={max:1,min:1,bodyScroll:1,documentElementScroll:1},Z="scroll";let J,_,Q,X,Y,K=!0,ee="",te=0,ne="",oe="",ie=!0,re=!1,ae=!0,le=!1,se=!1,ce=!1,de=1,ue=x,me="",fe=!0,pe="",ge={},he=!0,ye=!1,be=0,ve=!1,ze="",we=b,Ie=[],$e="child",He=null,Oe=!1,Se="",Te=[],Me=window.parent,ke="*",Ee=0,je=!1,Ge="",Pe=1,Ae=Z,Le=window,xe=()=>{C("onMessage function not defined")},Ce=()=>{},Re=null,Ne=null;function qe(){if("loading"===document.readyState)return C("Document not ready, current state: %c%s",e.HIGHLIGHT,document.readyState),void p(document,"readystatechange",qe);var s,d,u;!function(){const e=e=>"true"===e,t=pe.slice(13).split(":");ze=t[0],te=void 0===t[1]?te:Number(t[1]),re=void 0===t[2]?re:e(t[2]),ye=void 0===t[3]?ye:e(t[3]),K=void 0===t[6]?K:e(t[6]),ne=t[7],ue=void 0===t[8]?ue:t[8],ee=t[9],oe=t[10],Ee=void 0===t[11]?Ee:Number(t[11]),ge.enable=void 0!==t[12]&&e(t[12]),$e=void 0===t[13]?$e:t[13],Ae=void 0===t[14]?Ae:t[14],ve=void 0===t[15]?ve:e(t[15]),J=void 0===t[16]?J:Number(t[16]),_=void 0===t[17]?_:Number(t[17]),ie=void 0===t[18]?ie:e(t[18]),t[19],Ge=t[20]||Ge,be=void 0===t[21]?be:Number(t[21]),he=void 0===t[23]?he:e(t[23])}(),s={id:ze,enabled:ye,expand:he},S.label(`${s.id}`),S.expand(s.expand),H=s.enabled,T(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){T("Reading data from page:",e),xe=e?.onMessage||xe,Ce=e?.onReady||Ce,"number"==typeof e?.offset&&(F("offset","offsetSize"),ie&&(J=e?.offset),re&&(_=e?.offset)),"number"==typeof e?.offsetSize&&(ie&&(J=e?.offsetSize),re&&(_=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Se=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(me=e.ignoreSelector),ke=e?.targetOrigin||ke,ue=e?.heightCalculationMethod||ue,Ae=e?.widthCalculationMethod||Ae}function n(e,t){return"function"==typeof e&&(T(`Setup custom ${t}CalcMethod`),w[t]=e,e="custom"),e}if(1===be)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),ue=n(ue,"height"),Ae=n(Ae,"width"),k(`Set targetOrigin for parent: %c${ke}`,e.HIGHLIGHT))}(),_e(),function(){try{Oe=1===be||"iframeParentListener"in window.parent}catch(e){T("Cross domain iframe detected")}}(),be<0?N(`${h(be+2)}${h(2)}`):Ge.codePointAt(0)>4||be<2&&N(h(3)),Ge&&""!==Ge&&"false"!==Ge?Ge!==t&&R(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ge} - Child page: ${t}.\n`):R("<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"),Ye(),Ke(),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&&R("<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&&R("<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"),Fe(),1!==be&&(Le.parentIframe=Object.freeze({autoResize:e=>($(e,"boolean","parentIframe.autoResize(enable) enable"),!0===e&&!1===K?(K=!0,ht("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===K&&(K=!1),vt(0,0,"autoResize",JSON.stringify(K)),K),close(){vt(0,0,"close")},getId:()=>ze,getOrigin:()=>(B("getOrigin()","getParentOrigin()"),Q),getParentOrigin:()=>Q,getPageInfo(e){if("function"==typeof e)return Re=e,vt(0,0,"pageInfo"),void D("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Re=null,vt(0,0,"pageInfoStop")},getParentProps:e=>($(e,"function","parentIframe.getParentProps(callback) callback"),Ne=e,vt(0,0,"parentInfo"),()=>{Ne=null,vt(0,0,"parentInfoStop")}),getParentProperties(e){B("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){$(e,"string","parentIframe.moveToAnchor(anchor) anchor"),ge.findTarget(e)},reset(){bt("parentIframe.reset")},setOffsetSize(e){$(e,"number","parentIframe.setOffsetSize(offset) offset"),J=e,_=e,ht(c,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){$(e,"number","parentIframe.scrollBy(x, y) x"),$(t,"number","parentIframe.scrollBy(x, y) y"),vt(t,e,"scrollBy")},scrollTo(e,t){$(e,"number","parentIframe.scrollTo(x, y) x"),$(t,"number","parentIframe.scrollTo(x, y) y"),vt(t,e,"scrollTo")},scrollToOffset(e,t){$(e,"number","parentIframe.scrollToOffset(x, y) x"),$(t,"number","parentIframe.scrollToOffset(x, y) y"),vt(t,e,"scrollToOffset")},sendMessage(e,t){t&&$(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),vt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){ue=e,Ye()},setWidthCalculationMethod(e){Ae=e,Ke()},setTargetOrigin(t){$(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),T(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),ke=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){B("size()","resize()"),this.resize(e,t)}}),Le.parentIFrame=Le.parentIframe),function(){function t(e){vt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){T(`Add event listener: %c${o}`,e.HIGHLIGHT),p(window.document,n,t)}!0===ve&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),ge=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);T(`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),vt(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?(T(`In page link (#${i}) not found in iFrame, so sending to parent`),vt(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 l(){p(window,"hashchange",r)}function s(){setTimeout(r,128)}function c(){T("Setting up location.hash handlers"),a(),l(),s()}return ge.enable?1===be?R("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():T("In page linking not enabled"),{findTarget:i}}(),void 0===ne&&(ne=`${te}px`),Ze("margin",(d="margin",(u=ne).includes("-")&&(C(`Negative CSS value ignored for ${d}`),u=""),u)),Ze("background",ee),Ze("padding",oe),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),T("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==K&&T("Auto Resize disabled"),function(e){Qe({method:e,eventType:"After Print",eventName:"afterprint"}),Qe({method:e,eventType:"Before Print",eventName:"beforeprint"})}("add"),function(){const t=new Set,n=[];let i=!1,a=0;const l=e=>{k("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)}},s=16,c=2,d=200;let u=1;function f(e){_e(),We(e),e.forEach(nt),e.clear()}function p(){const o=performance.now(),r=o-a,g=s*u+++c;if(r>g&&r<d)return k("Backed off due to heavy workload on callStack"),T(`Delay: %c${v(r)}ms %c> Delay limit: %c${g}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(p,s*u),void(a=o);u=1,n.forEach(l),n.length=0,t.size>0&&f(t),Fe(),Be(),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 T("Setup <body> MutationObserver"),e.observe(t,n),e}h()}(),T("Setup ResizeObserver"),He=new ResizeObserver(et),He.observe(document.body),tt.add(document.body),nt(document.body),ie!==re&&(T("Setup OverflowObserver"),we=(e=>{const t=e.side||a,n=e.onChange||b,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||b,l=(e=!1)=>n(e),s=(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],l=s(a,i)&&!((n=r).hidden||null===n.offsetParent||"none"===n.style.display);c(r,l),l&&T("Overflowed:",r)}var n;r(l)}),o),u=new WeakSet;return function(e){T("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)):E(!n,"Node already observed",t)}}})({onChange:De,root:document.documentElement,side:ie?a:l})),We(rt(document)()),queueMicrotask(Ce),T("Initialization complete"),ht("init","Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&vt(0,0,"title",document.title)}function Be(){Ie=document.querySelectorAll(`[${i}]:not([${r}]):not([${r}] *)`),se=Ie.length>0}function De(e){Be(),(se||e)&&(T("Observed Elements:",Ie.length),ht(u,"Overflow updated"))}function Fe(){Te=document.querySelectorAll(`[${o}]`),ce=Te.length>0,T(`Tagged elements found: %c${ce}`,e.HIGHLIGHT)}function We(e){ce||we(e)}let Ue=0;function Ve(){const t=document.querySelectorAll(`*[${r}]`);le=t.length>0,le&&t.length!==Ue&&(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),Ue=t.length)}function Ze(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),k(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function Je(t,n,o){if(""!==o){T(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))T(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function _e(){Je("sizeSelector",o,Se),Je("ignoreSelector",r,me)}function Qe(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),T(`${z(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Xe(t,n,o,i){return n!==t&&(t in o||(C(`${t} is not a valid option for ${i}CalculationMethod.`),t=n),t in O&&R(`<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.`),T(`Set ${i} calculation method: %c${t}`,e.HIGHLIGHT)),t}function Ye(){ue=Xe(ue,x,dt,"height")}function Ke(){Ae=Xe(Ae,Z,ut,"width")}function et(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;ht(d,`Element resized <${I(t)}>`)}const tt=new WeakSet;function nt(t){if(t.nodeType!==Node.ELEMENT_NODE)return;if(!tt.has(t)){const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(He.observe(t),tt.add(t),T(`Attached resizeObserver: %c${I(t)}`,e.HIGHLIGHT))}const n=rt(t)();for(const t of n){if(tt.has(t)||t?.nodeType!==Node.ELEMENT_NODE)continue;const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(He.observe(t),tt.add(t),T(`Attached resizeObserver: %c${I(t)}`,e.HIGHLIGHT))}}function ot(e){performance.mark(W);const t=z(e);let n=0,o=document.documentElement,i=ce?0:document.documentElement.getBoundingClientRect().bottom;const r=ce?Te:se?Ie:rt(document)();let a=r.length;for(const t of r)ce||!P||t.checkVisibility(g)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,o=t)):a-=1;return k(`${t} position calculated from:`,o),performance.mark(U,{detail:{Side:t,len:a,hasTags:ce,logging:ye}}),i}const it=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],rt=e=>()=>{Ve();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 le&&t.push(`not([${r}])`,`not([${r}] *)`),e.querySelectorAll(t.join(":"))},at={height:0,width:0},lt={height:0,width:0},st=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function ct(t){function n(){return lt[i]=r,at[i]=s,r}const o=t===dt,i=o?"height":"width",r=t.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${r}px %cPage: %c${s}px`;let d=0;switch(!0){case!t.enabled():return s;case ce:k("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!se&&0===lt[i]&&0===at[i]:k(`Initial page size values: ${c}`,...st),d=n();break;case je&&r===lt[i]&&s===at[i]:k(`Size unchanged: ${c}`,...st),d=Math.max(r,s);break;case 0===r:k(`Page is hidden: ${c}`,...st),d=s;break;case!se&&r!==lt[i]&&s<=at[i]:k(`New <html> size: ${c} `,...st),k(`Previous <html> size: %c${lt[i]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!se&&r<lt[i]:k(`<html> size decreased: ${c}`,...st),d=n();break;case s===l||s===a:k(`<html> size equals page size: ${c}`,...st),d=n();break;case r>s:k(`Page size < <html> size: ${c}`,...st),d=n();break;case se:k("Found element overflowing <html> "),d=t.taggedElement();break;default:k(`Using <html> size: ${c}`,...st),d=n()}return k(`Content ${i}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&k(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const dt={enabled:()=>ie,getOffset:()=>J,auto:()=>ct(dt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>dt.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(...it(dt)),min:()=>Math.min(...it(dt)),grow:()=>dt.max(),lowestElement:()=>ot(a),taggedElement:()=>ot(a)},ut={enabled:()=>re,getOffset:()=>_,auto:()=>ct(ut),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(...it(ut)),min:()=>Math.min(...it(ut)),rightMostElement:()=>ot(l),scroll:()=>Math.max(ut.bodyScroll(),ut.documentElementScroll()),taggedElement:()=>ot(l)},mt=(e,t)=>!(Math.abs(e-t)<=Ee);function ft(e,t,n,o,i){const r=void 0===n?dt[ue]():n,a=void 0===o?ut[Ae]():o;switch(!0){case ie&&mt(de,r)||re&&mt(Pe,a)||"init"===e:de=r,Pe=a;case e===c:vt(de,Pe,e,i);break;case!e!==s&&(ie&&ue in V||re&&Ae in V):bt(t);break;case e===d:case e===u:case e===m:T(f);break;default:k(f)}X=!1}let pt=!1;const gt=y((()=>N(h(4)))),ht=A(((t,n,o,i,r)=>{L(t),Y=performance.now(),K||t===s?document.hidden?T("Page hidden - Ignored resize request"):(pt||(T(`Resize event: %c${n}`,e.HIGHLIGHT),X=!0,ft(t,n,o,i,r),requestAnimationFrame((()=>{pt=!1}))),pt=!0):k("Resizing disabled")}));function yt(e){de=dt[ue](),Pe=ut[Ae](),vt(de,Pe,e)}function bt(t){const n=ue;ue=x,T(`Reset trigger event: %c${t}`,e.HIGHLIGHT),je?T("TriggerLock blocked calculation"):(je=!0,j("Trigger event lock on"),requestAnimationFrame((()=>{je=!1,j("Trigger event lock off")}))),yt("reset"),ue=n}const vt=A((function(t,n,o,i,r){be<-1||(L(o),void 0!==r?T(`Message targetOrigin: %c${r}`,e.HIGHLIGHT):r=ke,function(){const a=`${ze}:${t}:${n}:${o}${void 0===i?"":`:${i}`}`;if(Oe)try{window.parent.iframeParentListener(q+a)}catch(e){if(1!==be)throw e;return void gt()}else Me.postMessage(q+a,r);X&&T(function(){const e=v(performance.now()-Y);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),k(`Sending message to parent page via ${Oe?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),G())})),zt=A((function(t){L("onMessage");const{freeze:n}=Object,{parse:o}=JSON,i=e=>n(o(e)),r=e=>vt(0,0,`${e}Stop`),a={init:function(){pe=t.data,Me=t.source,Q=t.origin,qe(),ae=!1,setTimeout((()=>{fe=!1}),128)},reset(){fe?T("Page reset ignored by init"):(T("Page size reset by host page"),yt("resetPage"))},resize(){ht(s,"Parent window requested size check")},moveToAnchor(){ge.findTarget(c())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=c();T("PageInfo received from parent:",i(e)),Re?setTimeout((()=>Re(o(e)))):r("pageInfo")},parentInfo(){const e=i(c());T("ParentInfo received from parent:",e),Ne?setTimeout((()=>Ne(e))):r("parentInfo")},message(){const t=c();T("onMessage called from parent:%c",e.HIGHLIGHT,i(t)),setTimeout((()=>xe(o(t))))}},l=()=>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=l();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)&&(L(l()),!1!==ae?d()?a.init():T(`Ignored message of type "${l()}". Received before initialization.`):u())}));function wt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?C("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>zt({data:e,sameOrigin:!0}))),p(window,"message",zt),p(window,"readystatechange",wt),wt())}();
21
21
  //# sourceMappingURL=index.cjs.js.map