iframe-resizer 5.4.5-beta.6 → 5.4.5-beta.8

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/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/legacy 5.4.5-beta.6 (cjs) - 2025-04-10
4
+ * @module iframe-resizer/legacy 5.4.5-beta.8 (cjs) - 2025-04-12
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/legacy 5.4.5-beta.6 (esm) - 2025-04-10
4
+ * @module iframe-resizer/legacy 5.4.5-beta.8 (esm) - 2025-04-12
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/legacy (child) 5.4.5-beta.6 (iife)
4
+ * @module iframe-resizer/legacy (child) 5.4.5-beta.8 (iife)
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,5 +17,5 @@
17
17
  */
18
18
 
19
19
 
20
- !function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,r="default",i=Object.freeze({assert:!0,error:!0,warn:!0}),a={expand:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},s={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:c}=Object,d=e=>[e,console[e]],u=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>l(c(e).map(t));const f=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,p=f?"color: #A9C7FB;":"color: #135CD2;",g=f?"color: #E3E3E3;":"color: #1F1F1F;",h="5.4.5-beta.6",y=10,b="data-iframe-size",v="data-iframe-overflowed",z="data-iframe-ignore",w="bottom",$="right",S="resizeParent",O="setOffsetSize",M="resizeObserver",E="overflowObserver",j="mutationObserver",k=(e,t,n,o)=>e.addEventListener(t,n,o||!1),I=["<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 P=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(I[e]),T=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},A=e=>e,x=e=>Math.round(1e3*e)/1e3,C=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>""!=`${e}`&&void 0!==e;function R(e){switch(!0){case!N(e):return"";case N(e.id):return`${e.nodeName}#${e.id}`;case N(e.name):return`${e.nodeName} (${e.name}`;case N(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const q=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${C(t)}`)};let L=!0;const B=(F=function(n={}){const l={},c={},f=[],p={...a,expand:!n.collapsed||a.expanded,...n};let g="";function h(){f.length=0,g=""}function y(){delete p.event,h()}const b=()=>!!f.some((([e])=>e in i))||!!p.expand;function v(){if(0!==f.length){console[b()?"group":"groupCollapsed"](`%c${p.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(p)} %c${p.showTime?g:""}`,e,t,o);for(const[e,...t]of f)console[e](...t);console.groupEnd(),y()}else y()}function z(){""===g&&(g=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}())}function w(e,...t){0===f.length&&(z(),queueMicrotask((()=>queueMicrotask(v)))),f.push([e,...t])}function $(e=r,...t){w("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...m(p,u(p)),...m(console,(e=>[e,(...t)=>w(e,...t)])),...m(s,d),count:function(e=r){c[e]?c[e]+=1:c[e]=1,w("log",`${e}: ${c[e]}`)},countReset:function(e=r){delete c[e]},endAutoGroup:v,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;w("error",e)}return n},purge:h,time:function(e=r){z(),l[e]=performance.now()},timeEnd:function(e=r){$(e),delete l[e]},timeLog:$,touch:z}},F?.__esModule?F.default:F);var F;const W=B({label:"iframeResizer(child)"});const D=(H="log",(...e)=>!L||W[H](...e));var H;const V=D,{assert:U,debug:Z,endAutoGroup:J,error:_,errorBoundary:Q,event:G,purge:X,warn:Y}=W,K=e=>{return W.warn((t=A,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},ee=K,te=(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)=>K(t))),ne=te("Method"),oe=te("Method","replaced with"),re=te("Option"),ie="--ifr-start",ae="--ifr-end",se=[],le=new WeakSet,ce=e=>"object"==typeof e&&le.add(e);let de={},ue=0;const me=setInterval((()=>{if(se.length<10)return;if(de.hasTags&&de.len<25)return;se.sort();const e=Math.min(se.reduce(((e,t)=>e+t),0)/se.length,se[Math.floor(se.length/2)]),t=x(e);t>ue&&(ue=t,G("performanceObserver"),D("Mean time:",x(se[Math.floor(se.length/2)])),D("Median time:",x(se.reduce(((e,t)=>e+t),0)/se.length)),D("Average time:",t),D("Max time:",x(Math.max(...se)))),e<=4||(clearInterval(me),K(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${x(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${de.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function fe(e){e.getEntries().forEach((e=>{if(e.name===ae){const{duration:t}=performance.measure("--ifr-measure",ie,ae);de=e.detail,se.push(t),se.length>100&&se.shift()}}))}function pe(){new PerformanceObserver(fe).observe({entryTypes:["mark"]}),ce(document.documentElement),ce(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",pe):pe()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},r={height:()=>(Y("Custom height calculation function not defined"),ft.auto()),width:()=>(Y("Custom width calculation function not defined"),pt.auto())},i={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},s="checkVisibility"in window,l="auto",c="[iFrameSizer]",d={max:1,min:1,bodyScroll:1,documentElementScroll:1},u="scroll";let m,f,I,N,B,F=!0,H="",_=0,X="",te="",se=!0,le=!1,ce=!0,de=!1,ue=!1,me=!1,fe=1,pe=l,ge="",he=!0,ye="",be={},ve=!0,ze=!1,we=0,$e=!1,Se="",Oe=A,Me=[],Ee="child",je=null,ke=!1,Ie="",Pe=[],Te=window.parent,Ae="*",xe=0,Ce=!1,Ne="",Re=1,qe=u,Le=window,Be=()=>{Y("onMessage function not defined")},Fe=()=>{},We=null,De=null;function He(){var e,t,n;!function(){const e=e=>"true"===e,t=ye.slice(13).split(":");Se=t[0],_=void 0===t[1]?_:Number(t[1]),le=void 0===t[2]?le:e(t[2]),ze=void 0===t[3]?ze:e(t[3]),F=void 0===t[6]?F:e(t[6]),X=t[7],pe=void 0===t[8]?pe:t[8],H=t[9],te=t[10],xe=void 0===t[11]?xe:Number(t[11]),be.enable=void 0!==t[12]&&e(t[12]),Ee=void 0===t[13]?Ee:t[13],qe=void 0===t[14]?qe:t[14],$e=void 0===t[15]?$e:e(t[15]),m=void 0===t[16]?m:Number(t[16]),f=void 0===t[17]?f:Number(t[17]),se=void 0===t[18]?se:e(t[18]),t[19],Ne=t[20]||Ne,we=void 0===t[21]?we:Number(t[21]),ve=void 0===t[23]?ve:e(t[23])}(),e={id:Se,enabled:ze,expand:ve},W.label(`${e.id}`),W.expand(e.expand),L=e.enabled,D(`Initialising iframe v${h} ${window.location.href}`),function(){function e(e){D("Reading data from page:",e),Be=e?.onMessage||Be,Fe=e?.onReady||Fe,"number"==typeof e?.offset&&(re("offset","offsetSize"),se&&(m=e?.offset),le&&(f=e?.offset)),"number"==typeof e?.offsetSize&&(se&&(m=e?.offsetSize),le&&(f=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Ie=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(ge=e.ignoreSelector),Ae=e?.targetOrigin||Ae,pe=e?.heightCalculationMethod||pe,qe=e?.widthCalculationMethod||qe}function t(e,t){return"function"==typeof e&&(D(`Setup custom ${t}CalcMethod`),r[t]=e,e="custom"),e}if(1===we)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),pe=t(pe,"height"),qe=t(qe,"width"),V(`Set targetOrigin for parent: %c${Ae}`,p))}(),Ye(),function(){try{ke=1===we||"iframeParentListener"in window.parent}catch(e){D("Cross domain iframe detected")}}(),we<0?ee(`${P(we+2)}${P(2)}`):Ne.codePointAt(0)>4||we<2&&ee(P(3)),Ne&&""!==Ne&&"false"!==Ne?Ne!==h&&K(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ne} - Child page: ${h}.\n`):K("<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"),tt(),nt(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(b,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&K("<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&&K("<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"),Ze(),1!==we&&(Le.parentIframe=Object.freeze({autoResize:e=>(q(e,"bool","parentIframe.autoResize(enable) enable"),!0===e&&!1===F?(F=!0,vt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===F&&(F=!1),$t(0,0,"autoResize",JSON.stringify(F)),F),close(){$t(0,0,"close")},getId:()=>Se,getOrigin:()=>(ne("getOrigin()","getParentOrigin()"),I),getParentOrigin:()=>I,getPageInfo(e){if("function"==typeof e)return We=e,$t(0,0,"pageInfo"),void oe("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");We=null,$t(0,0,"pageInfoStop")},getParentProps:e=>(q(e,"function","parentIframe.getParentProps(callback) callback"),De=e,$t(0,0,"parentInfo"),()=>{De=null,$t(0,0,"parentInfoStop")}),getParentProperties(e){ne("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){q(e,"string","parentIframe.moveToAnchor(anchor) anchor"),be.findTarget(e)},reset(){wt("parentIframe.reset")},setOffsetSize(e){q(e,"number","parentIframe.setOffsetSize(offset) offset"),m=e,f=e,vt(O,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){q(e,"number","parentIframe.scrollBy(x, y) x"),q(t,"number","parentIframe.scrollBy(x, y) y"),$t(t,e,"scrollBy")},scrollTo(e,t){q(e,"number","parentIframe.scrollTo(x, y) x"),q(t,"number","parentIframe.scrollTo(x, y) y"),$t(t,e,"scrollTo")},scrollToOffset(e,t){q(e,"number","parentIframe.scrollToOffset(x, y) x"),q(t,"number","parentIframe.scrollToOffset(x, y) y"),$t(t,e,"scrollToOffset")},sendMessage(e,t){t&&q(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),$t(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){pe=e,tt()},setWidthCalculationMethod(e){qe=e,nt()},setTargetOrigin(e){q(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),D(`Set targetOrigin: %c${e}`,p),Ae=e},resize(e,t){e&&q(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&q(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),vt("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ne("size()","resize()"),this.resize(e,t)}}),Le.parentIFrame=Le.parentIframe),function(){function e(e){$t(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){D(`Add event listener: %c${n}`,p),k(window.document,t,e)}!0===$e&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),be=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,y)+parseInt(o.x,y),y:parseInt(n.top,y)+parseInt(o.y,y)}}function n(e){function n(e){const n=t(e);D(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,p,g,p,g,p),$t(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(D(`In page link (#${o}) not found in iFrame, so sending to parent`),$t(0,0,"inPageLink",`#${o}`)):n(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&k(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function i(){k(window,"hashchange",o)}function a(){setTimeout(o,128)}function s(){D("Setting up location.hash handlers"),r(),i(),a()}return be.enable?1===we?K("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):s():D("In page linking not enabled"),{findTarget:n}}(),void 0===X&&(X=`${_}px`),Ge("margin",(t="margin",(n=X).includes("-")&&(Y(`Negative CSS value ignored for ${t}`),n=""),n)),Ge("background",H),Ge("padding",te),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),D("Set HTML & body height: %cauto !important",p)}(),!0!==F&&D("Auto Resize disabled"),function(e){Ke({method:e,eventType:"After Print",eventName:"afterprint"}),Ke({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ke({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const r=t=>{D("Mutations observed:",t.length);for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},i=16,a=2,s=200;let l=1;function c(e){Ye(),Je(e),e.forEach(it),e.clear()}function d(){G("mutationObserver");const u=performance.now(),m=u-o,f=i*l+++a;if(m>f&&m<s)return D(`MutationObserver delay: %c${m}ms > ${f}ms`,p),setTimeout(d,i*l),void(o=u);l=1,t.forEach(r),t.length=0,e.size>0&&c(e),Ze(),Ve(),n=!1,vt(j,"Mutation Observed")}function u(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(d))}function m(){const e=new window.MutationObserver(u),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return D("Setup <body> MutationObserver"),e.observe(t,n),e}m()}(),D("Setup ResizeObserver"),je=new ResizeObserver(ot),je.observe(document.body),rt.add(document.body),it(document.body),se!==le&&(D("Setup OverflowObserver"),Oe=(e=>{const t=e.side||w,n=e.onChange||A,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||A,i=(e=!1)=>n(e),a=(e,n)=>0===e||e>n[t],s=(e,t)=>e.toggleAttribute(v,t),l=new IntersectionObserver((function(e){G("observation");for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,l=e[t],c=a(l,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);s(i,c),c&&D("Overflowed:",i)}var n;r(i)}),o),c=new WeakSet;return function(){const e=new window.MutationObserver((()=>{V("Detected changes in element attributes"),i(!0)})),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[z],subtree:!0};D("Setup OverflowMutationObserver"),e.observe(t,n)}(),function(e){D("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=c.has(t);!n&&e?(l.observe(t),c.add(t)):U(!n,"Node already observed",t)}}})({onChange:Ue,root:document.documentElement,side:se?w:$})),Je(lt(document)()),queueMicrotask(Fe),D("Initialization complete"),vt("init","Init message from host page",void 0,void 0,h),document.title&&""!==document.title&&$t(0,0,"title",document.title)}function Ve(){Me=document.querySelectorAll(`[${v}]:not([${z}]):not([${z}] *)`),ue=Me.length>0}function Ue(e){Ve(),(ue||e)&&(D("Observed Elements:",Me.length),vt(E,"Overflow updated"))}function Ze(){Pe=document.querySelectorAll(`[${b}]`),me=Pe.length>0,D(`Tagged elements found: %c${me}`,me?p:g)}function Je(e){me||Oe(e)}let _e=0;function Qe(){const n=document.querySelectorAll(`*[${z}]`);de=n.length>0,de&&n.length!==_e&&(function(n){const o=1===n.length?"":"s";Y(`%c[${z}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),_e=n.length)}function Ge(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),V(`Set body ${e}: %c${t}`,p))}function Xe(e,t,n){if(""!==n){D(`${e}: %c${n}`,p);for(const e of document.querySelectorAll(n))D(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Ye(){Xe("sizeSelector",b,Ie),Xe("ignoreSelector",z,ge)}function Ke(e){({add(t){function n(){vt(e.eventName,e.eventType)}a[t]=n,k(window,t,n,{passive:!0})},remove(e){const t=a[e];var n,o;delete a[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),D(`${C(e.method)} event listener: %c${e.eventType}`,p)}function et(e,t,n,o){return t!==e&&(e in n||(Y(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in i&&K(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),D(`Set ${o} calculation method: %c${e}`,p)),e}function tt(){pe=et(pe,l,ft,"height")}function nt(){qe=et(qe,u,pt,"width")}function ot(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;vt(M,`Element resized <${R(t)}>`)}const rt=new WeakSet;function it(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!rt.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(je.observe(e),rt.add(e),D(`Attached resizeObserver: %c${R(e)}`,p))}const t=lt(e)();for(const e of t){if(rt.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(je.observe(e),rt.add(e),D(`Attached resizeObserver: %c${R(e)}`,p))}}function at(e){performance.mark(ie);const t=C(e);let n=0,r=document.documentElement,i=me?0:document.documentElement.getBoundingClientRect().bottom;const a=me?Pe:ue?Me:lt(document)();let l=a.length;for(const t of a)me||!s||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,r=t)):l-=1;return V(`${t} position calculated from:`,r),performance.mark(ae,{detail:{Side:t,len:l,hasTags:me,logging:ze}}),i}const st=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],lt=e=>()=>{Qe();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 de&&t.push(`not([${z}])`,`not([${z}] *)`),e.querySelectorAll(t.join(":"))},ct={height:0,width:0},dt={height:0,width:0},ut=[p,g,p];function mt(e){function t(){return dt[o]=r,ct[o]=s,r}const n=e===ft,o=n?"height":"width",r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${r}px %cPage: %c${s}px`;let c=0;switch(!0){case!e.enabled():return s;case me:V("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ue&&0===dt[o]&&0===ct[o]:V(`Initial page size values: ${l}`,...ut),c=t();break;case Ce&&r===dt[o]&&s===ct[o]:V(`Size unchanged: ${l}`,...ut),c=Math.max(r,s);break;case 0===r:V(`Page is hidden: ${l}`,...ut),c=s;break;case!ue&&r!==dt[o]&&s<=ct[o]:V(`New <html> size: ${l} `,...ut),V(`Previous <html> size: %c${dt[o]}px`,p),c=t();break;case!n:c=e.taggedElement();break;case!ue&&r<dt[o]:V(`<html> size decreased: ${l}`,...ut),c=t();break;case s===a||s===i:V(`<html> size equals page size: ${l}`,...ut),c=t();break;case r>s:V(`Page size < <html> size: ${l}`,...ut),c=t();break;case ue:V("Found element overflowing <html> "),c=e.taggedElement();break;default:V(`Using <html> size: ${l}`,...ut),c=t()}return V(`Content ${o}: %c${c}px`,p),c+=function(e){const t=e.getOffset();return 0!==t&&V(`Page offsetSize: %c${t}px`,p),t}(e),c}const ft={enabled:()=>se,getOffset:()=>m,auto:()=>mt(ft),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,y)+parseInt(t.marginBottom,y)},bodyScroll:()=>document.body.scrollHeight,offset:()=>ft.bodyOffset(),custom:()=>r.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...st(ft)),min:()=>Math.min(...st(ft)),grow:()=>ft.max(),lowestElement:()=>at(w),taggedElement:()=>at(w)},pt={enabled:()=>le,getOffset:()=>f,auto:()=>mt(pt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>r.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...st(pt)),min:()=>Math.min(...st(pt)),rightMostElement:()=>at($),scroll:()=>Math.max(pt.bodyScroll(),pt.documentElementScroll()),taggedElement:()=>at($)},gt=(e,t)=>!(Math.abs(e-t)<=xe);function ht(e,t,n,o,r){const i=void 0===n?ft[pe]():n,a=void 0===o?pt[qe]():o;switch(!0){case se&&gt(fe,i)||le&&gt(Re,a)||"init"===e:fe=i,Re=a;case e===O:$t(fe,Re,e,r);break;case!e!==S&&(se&&pe in d||le&&qe in d):wt(t);break;case e===M:case e===E:case e===j:D("No change in content size detected");break;default:V("No change in content size detected")}N=!1}let yt=!1;const bt=T((()=>ee(P(4)))),vt=Q(((e,t,n,o,r)=>{B=performance.now(),G(e),F||e===S?document.hidden?D("Page hidden - Ignored resize request"):(yt||(D(`Resize event: %c${t}`,p),N=!0,ht(e,t,n,o,r),requestAnimationFrame((()=>{yt=!1}))),yt=!0):V("Resizing disabled")}));function zt(e){fe=ft[pe](),Re=pt[qe](),$t(fe,Re,e)}function wt(e){const t=pe;pe=l,D(`Reset trigger event: %c${e}`,p),Ce?D("TriggerLock blocked calculation"):(Ce=!0,Z("Trigger event lock on"),requestAnimationFrame((()=>{Ce=!1,Z("Trigger event lock off")}))),zt("reset"),pe=t}const $t=Q((function(e,t,o,r,i){we<-1||(G(o),void 0!==i?D(`Message targetOrigin: %c${i}`,p):i=Ae,function(){const a=`${Se}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(ke)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==we)throw e;return void bt()}else Te.postMessage(c+a,i);N&&V(function(){const e=x(performance.now()-B);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),p),V("Sending message to host page via "+(ke?"sameOrigin":"postMessage")),V(`%c${a}`,n)}(),J())})),St=Q((function(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>$t(0,0,`${e}Stop`),r={init:function(){ye=e.data,Te=e.source,I=e.origin,He(),ce=!1,setTimeout((()=>{he=!1}),128)},reset(){he?D("Page reset ignored by init"):(D("Page size reset by host page"),zt("resetPage"))},resize(){vt(S,"Parent window requested size check")},moveToAnchor(){be.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();D(`PageInfo received from parent: ${e}`),We?setTimeout((()=>We(n(e)))):o("pageInfo")},parentInfo(){const e=a();D(`ParentInfo received from parent: ${e}`),De?setTimeout((()=>De(t(n(e))))):o("parentInfo")},message(){const e=a();D(`onMessage called from parent: ${e}`),setTimeout((()=>Be(n(e))))}},i=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),s=()=>e.data.split(":")[2]in{true:1,false:1};function l(){const t=i();t in r?r[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||s()||Y(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(G(i()),!1!==ce?s()?r.init():D(`Ignored message of type "${i()}". Received before initialization.`):l())}));function Ot(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?Y("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>St({data:e,sameOrigin:!0}))),k(window,"message",St),k(window,"readystatechange",Ot),Ot())}()}();
20
+ !function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,r="default",i=Object.freeze({assert:!0,error:!0,warn:!0}),a={expand:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},s={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:c}=Object,d=e=>[e,console[e]],u=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>l(c(e).map(t));const f=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,p=f?"color: #A9C7FB;":"color: #135CD2;",g=f?"color: #E3E3E3;":"color: #1F1F1F;",h="5.4.5-beta.8",y=10,b="data-iframe-size",v="data-iframe-overflowed",z="data-iframe-ignore",w="bottom",$="right",S="resizeParent",O="setOffsetSize",M="resizeObserver",E="overflowObserver",k="mutationObserver",j=(e,t,n,o)=>e.addEventListener(t,n,o||!1),I=["<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 P=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(I[e]),T=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},A=e=>e,x=e=>Math.round(1e3*e)/1e3,C=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>""!=`${e}`&&void 0!==e;function R(e){switch(!0){case!N(e):return"";case N(e.id):return`${e.nodeName}#${e.id}`;case N(e.name):return`${e.nodeName} (${e.name}`;case N(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const q=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${C(t)}`)};let L=!0;const B=(F=function(n={}){const l={},c={},f=[],p={...a,expand:!n.collapsed||a.expanded,...n};let g="";function h(){f.length=0,g=""}function y(){delete p.event,h()}const b=()=>!!f.some((([e])=>e in i))||!!p.expand;function v(){if(0!==f.length){console[b()?"group":"groupCollapsed"](`%c${p.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(p)} %c${p.showTime?g:""}`,e,t,o);for(const[e,...t]of f)console[e](...t);console.groupEnd(),y()}else y()}function z(){""===g&&(g=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}())}function w(e,...t){0===f.length&&(z(),queueMicrotask((()=>queueMicrotask(v)))),f.push([e,...t])}function $(e=r,...t){w("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...m(p,u(p)),...m(console,(e=>[e,(...t)=>w(e,...t)])),...m(s,d),count:function(e=r){c[e]?c[e]+=1:c[e]=1,w("log",`${e}: ${c[e]}`)},countReset:function(e=r){delete c[e]},endAutoGroup:v,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;w("error",e)}return n},event:function(e){z(),p.event=e},purge:h,time:function(e=r){z(),l[e]=performance.now()},timeEnd:function(e=r){$(e),delete l[e]},timeLog:$,touch:z}},F?.__esModule?F.default:F);var F;const W=B({label:"iframeResizer(child)"});const D=(H="log",(...e)=>!L||W[H](...e));var H;const V=D,{assert:U,debug:Z,endAutoGroup:J,error:_,errorBoundary:Q,event:G,purge:X,warn:Y}=W,K=e=>{return W.warn((t=A,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},ee=K,te=(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)=>K(t))),ne=te("Method"),oe=te("Method","replaced with"),re=te("Option"),ie="--ifr-start",ae="--ifr-end",se=[],le=new WeakSet,ce=e=>"object"==typeof e&&le.add(e);let de={},ue=0;const me=setInterval((()=>{if(se.length<10)return;if(de.hasTags&&de.len<25)return;se.sort();const e=Math.min(se.reduce(((e,t)=>e+t),0)/se.length,se[Math.floor(se.length/2)]),t=x(e);t>ue&&(ue=t,G("performanceObserver"),D("Mean time:",x(se[Math.floor(se.length/2)])),D("Median time:",x(se.reduce(((e,t)=>e+t),0)/se.length)),D("Average time:",t),D("Max time:",x(Math.max(...se)))),e<=4||(clearInterval(me),K(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${x(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${de.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function fe(e){e.getEntries().forEach((e=>{if(e.name===ae){const{duration:t}=performance.measure("--ifr-measure",ie,ae);de=e.detail,se.push(t),se.length>100&&se.shift()}}))}function pe(){new PerformanceObserver(fe).observe({entryTypes:["mark"]}),ce(document.documentElement),ce(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",pe):pe()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},r={height:()=>(Y("Custom height calculation function not defined"),ft.auto()),width:()=>(Y("Custom width calculation function not defined"),pt.auto())},i={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},s="checkVisibility"in window,l="auto",c="[iFrameSizer]",d={max:1,min:1,bodyScroll:1,documentElementScroll:1},u="scroll";let m,f,I,N,B,F=!0,H="",_=0,X="",te="",se=!0,le=!1,ce=!0,de=!1,ue=!1,me=!1,fe=1,pe=l,ge="",he=!0,ye="",be={},ve=!0,ze=!1,we=0,$e=!1,Se="",Oe=A,Me=[],Ee="child",ke=null,je=!1,Ie="",Pe=[],Te=window.parent,Ae="*",xe=0,Ce=!1,Ne="",Re=1,qe=u,Le=window,Be=()=>{Y("onMessage function not defined")},Fe=()=>{},We=null,De=null;function He(){var e,t,n;!function(){const e=e=>"true"===e,t=ye.slice(13).split(":");Se=t[0],_=void 0===t[1]?_:Number(t[1]),le=void 0===t[2]?le:e(t[2]),ze=void 0===t[3]?ze:e(t[3]),F=void 0===t[6]?F:e(t[6]),X=t[7],pe=void 0===t[8]?pe:t[8],H=t[9],te=t[10],xe=void 0===t[11]?xe:Number(t[11]),be.enable=void 0!==t[12]&&e(t[12]),Ee=void 0===t[13]?Ee:t[13],qe=void 0===t[14]?qe:t[14],$e=void 0===t[15]?$e:e(t[15]),m=void 0===t[16]?m:Number(t[16]),f=void 0===t[17]?f:Number(t[17]),se=void 0===t[18]?se:e(t[18]),t[19],Ne=t[20]||Ne,we=void 0===t[21]?we:Number(t[21]),ve=void 0===t[23]?ve:e(t[23])}(),e={id:Se,enabled:ze,expand:ve},W.label(`${e.id}`),W.expand(e.expand),L=e.enabled,D(`Initialising iframe v${h} ${window.location.href}`),function(){function e(e){D("Reading data from page:",e),Be=e?.onMessage||Be,Fe=e?.onReady||Fe,"number"==typeof e?.offset&&(re("offset","offsetSize"),se&&(m=e?.offset),le&&(f=e?.offset)),"number"==typeof e?.offsetSize&&(se&&(m=e?.offsetSize),le&&(f=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Ie=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(ge=e.ignoreSelector),Ae=e?.targetOrigin||Ae,pe=e?.heightCalculationMethod||pe,qe=e?.widthCalculationMethod||qe}function t(e,t){return"function"==typeof e&&(D(`Setup custom ${t}CalcMethod`),r[t]=e,e="custom"),e}if(1===we)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),pe=t(pe,"height"),qe=t(qe,"width"),V(`Set targetOrigin for parent: %c${Ae}`,p))}(),Ye(),function(){try{je=1===we||"iframeParentListener"in window.parent}catch(e){D("Cross domain iframe detected")}}(),we<0?ee(`${P(we+2)}${P(2)}`):Ne.codePointAt(0)>4||we<2&&ee(P(3)),Ne&&""!==Ne&&"false"!==Ne?Ne!==h&&K(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ne} - Child page: ${h}.\n`):K("<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"),tt(),nt(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(b,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&K("<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&&K("<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"),Ze(),1!==we&&(Le.parentIframe=Object.freeze({autoResize:e=>(q(e,"boolean","parentIframe.autoResize(enable) enable"),!0===e&&!1===F?(F=!0,vt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===F&&(F=!1),$t(0,0,"autoResize",JSON.stringify(F)),F),close(){$t(0,0,"close")},getId:()=>Se,getOrigin:()=>(ne("getOrigin()","getParentOrigin()"),I),getParentOrigin:()=>I,getPageInfo(e){if("function"==typeof e)return We=e,$t(0,0,"pageInfo"),void oe("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");We=null,$t(0,0,"pageInfoStop")},getParentProps:e=>(q(e,"function","parentIframe.getParentProps(callback) callback"),De=e,$t(0,0,"parentInfo"),()=>{De=null,$t(0,0,"parentInfoStop")}),getParentProperties(e){ne("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){q(e,"string","parentIframe.moveToAnchor(anchor) anchor"),be.findTarget(e)},reset(){wt("parentIframe.reset")},setOffsetSize(e){q(e,"number","parentIframe.setOffsetSize(offset) offset"),m=e,f=e,vt(O,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){q(e,"number","parentIframe.scrollBy(x, y) x"),q(t,"number","parentIframe.scrollBy(x, y) y"),$t(t,e,"scrollBy")},scrollTo(e,t){q(e,"number","parentIframe.scrollTo(x, y) x"),q(t,"number","parentIframe.scrollTo(x, y) y"),$t(t,e,"scrollTo")},scrollToOffset(e,t){q(e,"number","parentIframe.scrollToOffset(x, y) x"),q(t,"number","parentIframe.scrollToOffset(x, y) y"),$t(t,e,"scrollToOffset")},sendMessage(e,t){t&&q(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),$t(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){pe=e,tt()},setWidthCalculationMethod(e){qe=e,nt()},setTargetOrigin(e){q(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),D(`Set targetOrigin: %c${e}`,p),Ae=e},resize(e,t){e&&q(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&q(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),vt("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ne("size()","resize()"),this.resize(e,t)}}),Le.parentIFrame=Le.parentIframe),function(){function e(e){$t(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){D(`Add event listener: %c${n}`,p),j(window.document,t,e)}!0===$e&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),be=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,y)+parseInt(o.x,y),y:parseInt(n.top,y)+parseInt(o.y,y)}}function n(e){function n(e){const n=t(e);D(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,p,g,p,g,p),$t(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(D(`In page link (#${o}) not found in iFrame, so sending to parent`),$t(0,0,"inPageLink",`#${o}`)):n(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&j(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function i(){j(window,"hashchange",o)}function a(){setTimeout(o,128)}function s(){D("Setting up location.hash handlers"),r(),i(),a()}return be.enable?1===we?K("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):s():D("In page linking not enabled"),{findTarget:n}}(),void 0===X&&(X=`${_}px`),Ge("margin",(t="margin",(n=X).includes("-")&&(Y(`Negative CSS value ignored for ${t}`),n=""),n)),Ge("background",H),Ge("padding",te),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),D("Set HTML & body height: %cauto !important",p)}(),!0!==F&&D("Auto Resize disabled"),function(e){Ke({method:e,eventType:"After Print",eventName:"afterprint"}),Ke({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ke({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const r=t=>{D("Mutations observed:",t.length);for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},i=16,a=2,s=200;let l=1;function c(e){Ye(),Je(e),e.forEach(it),e.clear()}function d(){G(k);const u=performance.now(),m=u-o,f=i*l+++a;if(m>f&&m<s)return V("backed off due to heavy workload on callStack"),D(`%c${m}ms %c>%c ${f}ms`,p,g,p),setTimeout(d,i*l),void(o=u);l=1,t.forEach(r),t.length=0,e.size>0&&c(e),Ze(),Ve(),n=!1,vt(k,"Mutation Observed")}function u(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(d))}function m(){const e=new window.MutationObserver(u),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return D("Setup <body> MutationObserver"),e.observe(t,n),e}m()}(),D("Setup ResizeObserver"),ke=new ResizeObserver(ot),ke.observe(document.body),rt.add(document.body),it(document.body),se!==le&&(D("Setup OverflowObserver"),Oe=(e=>{const t=e.side||w,n=e.onChange||A,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||A,i=(e=!1)=>n(e),a=(e,n)=>0===e||e>n[t],s=(e,t)=>e.toggleAttribute(v,t),l=new IntersectionObserver((function(e){G("observation");for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,l=e[t],c=a(l,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);s(i,c),c&&D("Overflowed:",i)}var n;r(i)}),o),c=new WeakSet;return function(){const e=new window.MutationObserver((()=>{V("Detected changes in element attributes"),i(!0)})),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[z],subtree:!0};D("Setup OverflowMutationObserver"),e.observe(t,n)}(),function(e){D("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=c.has(t);!n&&e?(l.observe(t),c.add(t)):U(!n,"Node already observed",t)}}})({onChange:Ue,root:document.documentElement,side:se?w:$})),Je(lt(document)()),queueMicrotask(Fe),D("Initialization complete"),vt("init","Init message from host page",void 0,void 0,h),document.title&&""!==document.title&&$t(0,0,"title",document.title)}function Ve(){Me=document.querySelectorAll(`[${v}]:not([${z}]):not([${z}] *)`),ue=Me.length>0}function Ue(e){Ve(),(ue||e)&&(D("Observed Elements:",Me.length),vt(E,"Overflow updated"))}function Ze(){Pe=document.querySelectorAll(`[${b}]`),me=Pe.length>0,D(`Tagged elements found: %c${me}`,me?p:g)}function Je(e){me||Oe(e)}let _e=0;function Qe(){const n=document.querySelectorAll(`*[${z}]`);de=n.length>0,de&&n.length!==_e&&(function(n){const o=1===n.length?"":"s";Y(`%c[${z}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),_e=n.length)}function Ge(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),V(`Set body ${e}: %c${t}`,p))}function Xe(e,t,n){if(""!==n){D(`${e}: %c${n}`,p);for(const e of document.querySelectorAll(n))D(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Ye(){Xe("sizeSelector",b,Ie),Xe("ignoreSelector",z,ge)}function Ke(e){({add(t){function n(){vt(e.eventName,e.eventType)}a[t]=n,j(window,t,n,{passive:!0})},remove(e){const t=a[e];var n,o;delete a[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),D(`${C(e.method)} event listener: %c${e.eventType}`,p)}function et(e,t,n,o){return t!==e&&(e in n||(Y(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in i&&K(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),D(`Set ${o} calculation method: %c${e}`,p)),e}function tt(){pe=et(pe,l,ft,"height")}function nt(){qe=et(qe,u,pt,"width")}function ot(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;vt(M,`Element resized <${R(t)}>`)}const rt=new WeakSet;function it(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!rt.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ke.observe(e),rt.add(e),D(`Attached resizeObserver: %c${R(e)}`,p))}const t=lt(e)();for(const e of t){if(rt.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ke.observe(e),rt.add(e),D(`Attached resizeObserver: %c${R(e)}`,p))}}function at(e){performance.mark(ie);const t=C(e);let n=0,r=document.documentElement,i=me?0:document.documentElement.getBoundingClientRect().bottom;const a=me?Pe:ue?Me:lt(document)();let l=a.length;for(const t of a)me||!s||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,r=t)):l-=1;return V(`${t} position calculated from:`,r),performance.mark(ae,{detail:{Side:t,len:l,hasTags:me,logging:ze}}),i}const st=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],lt=e=>()=>{Qe();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 de&&t.push(`not([${z}])`,`not([${z}] *)`),e.querySelectorAll(t.join(":"))},ct={height:0,width:0},dt={height:0,width:0},ut=[p,g,p];function mt(e){function t(){return dt[o]=r,ct[o]=s,r}const n=e===ft,o=n?"height":"width",r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${r}px %cPage: %c${s}px`;let c=0;switch(!0){case!e.enabled():return s;case me:V("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ue&&0===dt[o]&&0===ct[o]:V(`Initial page size values: ${l}`,...ut),c=t();break;case Ce&&r===dt[o]&&s===ct[o]:V(`Size unchanged: ${l}`,...ut),c=Math.max(r,s);break;case 0===r:V(`Page is hidden: ${l}`,...ut),c=s;break;case!ue&&r!==dt[o]&&s<=ct[o]:V(`New <html> size: ${l} `,...ut),V(`Previous <html> size: %c${dt[o]}px`,p),c=t();break;case!n:c=e.taggedElement();break;case!ue&&r<dt[o]:V(`<html> size decreased: ${l}`,...ut),c=t();break;case s===a||s===i:V(`<html> size equals page size: ${l}`,...ut),c=t();break;case r>s:V(`Page size < <html> size: ${l}`,...ut),c=t();break;case ue:V("Found element overflowing <html> "),c=e.taggedElement();break;default:V(`Using <html> size: ${l}`,...ut),c=t()}return V(`Content ${o}: %c${c}px`,p),c+=function(e){const t=e.getOffset();return 0!==t&&V(`Page offsetSize: %c${t}px`,p),t}(e),c}const ft={enabled:()=>se,getOffset:()=>m,auto:()=>mt(ft),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,y)+parseInt(t.marginBottom,y)},bodyScroll:()=>document.body.scrollHeight,offset:()=>ft.bodyOffset(),custom:()=>r.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...st(ft)),min:()=>Math.min(...st(ft)),grow:()=>ft.max(),lowestElement:()=>at(w),taggedElement:()=>at(w)},pt={enabled:()=>le,getOffset:()=>f,auto:()=>mt(pt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>r.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...st(pt)),min:()=>Math.min(...st(pt)),rightMostElement:()=>at($),scroll:()=>Math.max(pt.bodyScroll(),pt.documentElementScroll()),taggedElement:()=>at($)},gt=(e,t)=>!(Math.abs(e-t)<=xe);function ht(e,t,n,o,r){const i=void 0===n?ft[pe]():n,a=void 0===o?pt[qe]():o;switch(!0){case se&&gt(fe,i)||le&&gt(Re,a)||"init"===e:fe=i,Re=a;case e===O:$t(fe,Re,e,r);break;case!e!==S&&(se&&pe in d||le&&qe in d):wt(t);break;case e===M:case e===E:case e===k:D("No change in content size detected");break;default:V("No change in content size detected")}N=!1}let yt=!1;const bt=T((()=>ee(P(4)))),vt=Q(((e,t,n,o,r)=>{G(e),B=performance.now(),F||e===S?document.hidden?D("Page hidden - Ignored resize request"):(yt||(D(`Resize event: %c${t}`,p),N=!0,ht(e,t,n,o,r),requestAnimationFrame((()=>{yt=!1}))),yt=!0):V("Resizing disabled")}));function zt(e){fe=ft[pe](),Re=pt[qe](),$t(fe,Re,e)}function wt(e){const t=pe;pe=l,D(`Reset trigger event: %c${e}`,p),Ce?D("TriggerLock blocked calculation"):(Ce=!0,Z("Trigger event lock on"),requestAnimationFrame((()=>{Ce=!1,Z("Trigger event lock off")}))),zt("reset"),pe=t}const $t=Q((function(e,t,o,r,i){we<-1||(G(o),void 0!==i?D(`Message targetOrigin: %c${i}`,p):i=Ae,function(){const a=`${Se}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(je)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==we)throw e;return void bt()}else Te.postMessage(c+a,i);N&&D(function(){const e=x(performance.now()-B);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),p),V(`Sending message to parent page via ${je?"sameOrigin":"postMessage"}: %c%c${a}`,n,p)}(),J())})),St=Q((function(e){G("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>$t(0,0,`${e}Stop`),r={init:function(){ye=e.data,Te=e.source,I=e.origin,He(),ce=!1,setTimeout((()=>{he=!1}),128)},reset(){he?D("Page reset ignored by init"):(D("Page size reset by host page"),zt("resetPage"))},resize(){vt(S,"Parent window requested size check")},moveToAnchor(){be.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();D(`PageInfo received from parent: ${e}`),We?setTimeout((()=>We(n(e)))):o("pageInfo")},parentInfo(){const e=a();D(`ParentInfo received from parent: ${e}`),De?setTimeout((()=>De(t(n(e))))):o("parentInfo")},message(){const e=a();D(`onMessage called from parent: ${e}`),setTimeout((()=>Be(n(e))))}},i=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),s=()=>e.data.split(":")[2]in{true:1,false:1};function l(){const t=i();t in r?r[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||s()||Y(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(G(i()),!1!==ce?s()?r.init():D(`Ignored message of type "${i()}". Received before initialization.`):l())}));function Ot(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?Y("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>St({data:e,sameOrigin:!0}))),j(window,"message",St),j(window,"readystatechange",Ot),Ot())}()}();
21
21
  //# sourceMappingURL=iframeResizer.contentWindow.js.map