@iframe-resizer/child 5.5.3-beta.5 → 5.5.3-beta.6

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.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/child 5.5.3-beta.5 (umd) - 2025-08-18
4
+ * @module iframe-resizer/child 5.5.3-beta.6 (umd) - 2025-08-19
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(e){"function"==typeof define&&define.amd?define(e):e()}(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},c=Object.assign(console);const{fromEntries:l,keys:d}=Object,u=e=>[e,c[e]],f=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>l(d(e).map(t));const p=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,h=p?"color: #A9C7FB;":"color: #135CD2;",g=p?"color: #E3E3E3;":"color: #1F1F1F;",y="5.5.3-beta.5",b="iframeResizer",v=10,z="data-iframe-size",w="data-iframe-overflowed",$="data-iframe-ignore",S="bottom",O="right",M="autoResizeEnabled",E=Symbol("sizeChanged"),k="manualResize",T="parentResize",j={[k]:1,[T]:1},I="setOffsetSize",A="resizeObserver",x="overflowObserver",C="mutationObserver",P="visibilityObserver",N="No change in content size detected",R="init",q=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),B=(e,t,n,o)=>e.addEventListener(t,n,o||!1),L=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);return t^=Math.imul(t^n>>>15,1935289751),n^=Math.imul(n^t>>>15,3405138345),t^=n>>>16,n^=t>>>16,(2097152*(n>>>0)+(t>>>11)).toString(36)},F=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),W=["spjluzl","rlf","clyzpvu"],D=["<yi>Puchspk Spjluzl Rlf</><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."],H=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],V=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),U=e=>F(D[e]),Z=e=>{const t=e[F(W[0])]||e[F(W[1])]||e[F(W[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=L(F(e));return n in V&&(t=V[n]),t}(n[0]);return 0===o||(e=>e[2]===L(e[0]+e[1]))(n)||(o=-2),o},J=(e,...t)=>setTimeout(()=>e(...t),0),_=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},Q=e=>e,G=e=>Math.round(1e3*e)/1e3,Y=e=>e.charAt(0).toUpperCase()+e.slice(1),X=e=>""!=`${e}`&&void 0!==e;const K=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Y(t)}`)};let ee=!0,te=b;const ne=(oe=function(n={}){const l={},d={},p=[],h={...a,expand:!n.collapsed||a.expanded,...n};let g="";function y(){p.length=0,g=""}function b(){delete h.event,y()}const v=()=>!!p.some(([e])=>e in i)||!!h.expand;function z(){if(0!==p.length){c[v()?"group":"groupCollapsed"](`%c${h.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(h)} %c${h.showTime?g:""}`,e,t,o);for(const[e,...t]of p)c.assert(e in c,`Unknown console method: ${e}`),e in c&&c[e](...t);c.groupEnd(),b()}else b()}function w(){""===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 $(e,...t){0===p.length&&(w(),queueMicrotask(()=>queueMicrotask(z))),p.push([e,...t])}function S(e=r,...t){l[e]?$("log",`${e}: ${performance.now()-l[e]} ms`,...t):$("timeLog",e,...t)}return{...m(h,f(h)),...m(console,e=>[e,(...t)=>$(e,...t)]),...m(s,u),assert:function(e,...t){!0!==e&&$("assert",e,...t)},count:function(e=r){d[e]?d[e]+=1:d[e]=1,$("log",`${e}: ${d[e]}`)},countReset:function(e=r){delete d[e]},endAutoGroup:z,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;$("error",e),z()}return n},event:function(e){w(),h.event=e},purge:y,time:function(e=r){w(),l[e]=performance.now()},timeEnd:function(e=r){S(e),delete l[e]},timeLog:S,touch:w}},oe?.__esModule?oe.default:oe);var oe;const re=ne({label:`${b}(child)`});const ie=e=>(...t)=>!ee||re[e](...t),ae=ie("log"),se=ae,ce=ie("debug");const{assert:le,endAutoGroup:de,error:ue,errorBoundary:fe,event:me,label:pe,purge:he,warn:ge}=re,ye=e=>{return re.warn((t=Q,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},be=ye,ve=(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)=>ye(t)),ze=ve("Method"),we=ve("Method","replaced with"),$e=ve("Option"),Se=["min-height","min-width","max-height","max-width"],Oe=new Set,Me=e=>e.tagName?e.tagName.toLowerCase():"unknown",Ee=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),ke=(e,t)=>{return(n=Ee(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function Te({href:e}){Oe.has(e)||(ae("Unable to access stylesheet:",e),Oe.add(e))}const je=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){Te(n)}return{source:"cross-origin stylesheet",value:Ee(e,t)}}(e,t),Ie=(e,t)=>{const{source:n,value:o}=je(e,t),r=Me(e);ye(`The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${r}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.\n\nIf you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`)};function Ae(){for(const e of[document.documentElement,document.body])for(const t of Se)ae(`Checking <${Me(e)}> for blocking CSS: ${t}`),ke(e,t)&&Ie(e,t)}const xe=e=>t=>void 0===t?void 0:e(t),Ce=xe(e=>"true"===e),Pe=xe(Number),Ne=(e="")=>t=>n=>{n.size>0&&ce(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Re=Ne("attached to"),qe=((e="")=>t=>n=>{n.size>0&&ue(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Be=Ne("detached from"),Le=(t,n=!0)=>o=>{o>0&&se(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,h,e)},Fe=(e,t,n,o)=>{const r=Be(e);return e=>{const i=new Set;let a=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),i.add(o),a+=1);r(i),o(a),i.clear()}},We="Mutation",De=new Set,He=new Set,Ve=new Set,Ue=[],Ze={attributes:!0,attributeFilter:[$,z],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Je,_e=1,Qe=!1,Ge=0;const Ye=Ne("added")(We),Xe=Ne("removed (page)")(We),Ke=Ne("removed (added)")(We),et=e=>e.nodeType!==Node.ELEMENT_NODE||q.has(e.tagName.toLowerCase());function tt(e){const t=e.addedNodes;for(const e of t)et(e)||De.add(e)}function nt(e){const t=e.removedNodes;for(const e of t)et(e)||(De.has(e)?(De.delete(e),Ve.add(e)):He.add(e))}const ot=e=>{se("Mutations:",e);for(const t of e)tt(t),nt(t);Ye(De),Xe(He),Ke(Ve),Ve.clear()};const rt=e=>()=>{const t=performance.now(),n=t-Ge,o=16*_e+++2;if(n>o&&n<200)return me("mutationThrottled"),se("Update delayed due to heavy workload on the callStack"),se(`EventLoop busy time: %c${G(n)}ms %c> Max wait: %c${o-2}ms`,h,g,h),setTimeout(Je,16*_e),void(Ge=t);_e=1,Ue.forEach(ot),Ue.length=0,Qe=!1,He.size>0&&ae(`Detected %c${He.size} %cremoved element${He.size>1?"s":""}`,h,g),De.size>0&&ae(`Found %c${De.size} %cnew element${De.size>1?"s":""}`,h,g),e({addedNodes:De,removedNodes:He}),De.clear(),He.clear()};function it(e){Ue.push(e),Qe||(Ge=performance.now(),Qe=!0,requestAnimationFrame(Je))}function at(e){const t=new window.MutationObserver(it),n=document.body||document.documentElement;return Je=rt(e),t.observe(n,Ze),se("Attached MutationObserver to body"),t}const st="Overflow",ct=Le(st),lt=Le(st,!1),dt=Re(st),ut=qe(st),ft=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,mt=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||Q,i=(t=!1)=>e(t),a=(e,t)=>0===e||e>t[n],s=(e,t)=>e.toggleAttribute(w,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t,i=e[n],c=a(i,o)&&!ft(r);s(r,c)}r(i)},o),l=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r.nodeType===Node.ELEMENT_NODE&&(l.has(r)?t.add(r):(c.observe(r),l.add(r),n.add(r),o+=1));ut(t),dt(n),ct(o),n.clear(),t.clear()},detachObservers:Fe(st,c,l,lt)}},pt="--ifr-start",ht="--ifr-end",gt=[],yt=new WeakSet,bt=e=>"object"==typeof e&&yt.add(e);let vt={},zt=0;function wt(e){e.getEntries().forEach(e=>{if(e.name===ht){const{duration:t}=performance.measure("--ifr-measure",pt,ht);vt=e.detail,gt.push(t),gt.length>100&&gt.shift()}})}function $t(){se("Attached PerformanceObserver to page");new PerformanceObserver(wt).observe({entryTypes:["mark"]}),bt(document.documentElement),bt(document.body),function(){const e=setInterval(()=>{if(gt.length<10)return;if(vt.hasTags&&vt.len<25)return;gt.sort();const t=Math.min(gt.reduce((e,t)=>e+t,0)/gt.length,gt[Math.floor(gt.length/2)]),n=G(t);n>zt&&(zt=n,me("performanceObserver"),ae("Mean time:",G(gt[Math.floor(gt.length/2)])),ae("Median time:",G(gt.reduce((e,t)=>e+t,0)/gt.length)),ae("Average time:",n),ae("Max time:",G(Math.max(...gt)))),performance.clearMarks(),t<=4||(clearInterval(e),ye(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${G(t)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${vt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3)}()}const St="Resize",Ot=Le(St),Mt=Le(St,!1),Et=Re(St),kt=qe(St),Tt=new WeakSet;let jt;function It(e){const t=new Set,n=new Set;let o=0;for(const r of e){if(r.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(r)?.position;""!==e&&"static"!==e&&(Tt.has(r)?t.add(r):(jt.observe(r),Tt.add(r),n.add(r),o+=1))}kt(t),Et(n),Ot(o),n.clear(),t.clear()}const At=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},xt=At("function"),Ct=At("number"),Pt=At("string");"undefined"!=typeof window&&function(){const o={height:()=>(ge("Custom height calculation function not defined"),pn.auto()),width:()=>(ge("Custom width calculation function not defined"),hn.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},i={},a="auto",s="[iFrameSizer]",c="scroll";let l,d,u,f,m,p,L,D,V,ne,oe,ie=!0,he="",ve=0,Se="",Oe="",Me=!1,Ee=!0,ke=!1,Te=!0,je=!1,Ie=!1,xe=!0,Ne=!1,Re=1,qe=a,Be="",Le=!0,We={},De=!1,He=!0,Ve=!1,Ue=0,Ze=!1,Je=new Set,_e="",Qe="child",Ge=!1,Ye="",Xe=[],Ke=window.parent,et="*",tt=0,nt=!1,ot=1,rt=c,it=window,st=()=>{ge("onMessage function not defined")},ct=()=>{},lt=null,dt=null;function ut(e){var t;!function(e){_e=e[0]??_e,ve=Pe(e[1])??ve,ke=Ce(e[2])??ke,Ve=Ce(e[3])??Ve,ie=Ce(e[6])??ie,Se=e[7]??Se,qe=e[8]??qe,he=e[9]??he,Oe=e[10]??Oe,tt=Pe(e[11])??tt,We.enable=Ce(e[12])??!1,Qe=e[13]??Qe,rt=e[14]??rt,Ze=Ce(e[15])??Ze,u=Pe(e[16])??u,f=Pe(e[17])??f,Ee=Ce(e[18])??Ee,l=e[19]??l,ne=e[20]??ne,Ue=Pe(e[21])??Ue,He=Ce(e[23])??He}(e),te=(t={id:_e,enabled:Ve,expand:He}).id||b,re.label(`${te}`),re.expand(t.expand),ee=t.enabled,ae(`Initialising iframe v${y} ${window.location.href}`),function(){function e(e){ae("Reading data from page:",Object.keys(e)),oe=xt(e,"onBeforeResize")??oe,st=xt(e,"onMessage")??st,ct=xt(e,"onReady")??ct,"number"==typeof e?.offset&&($e("offset","offsetSize"),Ee&&(u=Ct(e,"offset")??u),ke&&(f=Ct(e,"offset")??f)),"number"==typeof e?.offsetSize&&(Ee&&(u=Ct(e,"offsetSize")??u),ke&&(f=Ct(e,"offsetSize")??f)),d=Pt(e,F(W[0]))??d,Be=Pt(e,"ignoreSelector")??Be,Ye=Pt(e,"sizeSelector")??Ye,et=Pt(e,"targetOrigin")??et,qe=e?.heightCalculationMethod||qe,rt=e?.widthCalculationMethod||rt}function t(e,t){return"function"==typeof e&&(ye(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),o[t]=e,e="custom"),e}if(1===Ue)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),qe=t(qe,"height"),rt=t(rt,"width"),se(`Set targetOrigin for parent: %c${et}`,h))}(),[zt,Ot,Dt,bt,wt,Ft,Wt,Bt,vt,gt,Me?Q:Ae,At,Jt,Zt,Ut,Nt,()=>Et("background",he),()=>Et("padding",Oe),Me?Q:Rt,Vt,Ht,rn].forEach(e=>{try{e()}catch(e){if(Ue<0)throw e;ye("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),ue(e)}}),ft(_(ct)),ae("Initialization complete"),$n(R,"Init message from host page",void 0,void 0,`${y}:${Ue}`),document.title&&""!==document.title&&On(0,0,"title",document.title)}function ft(e){"complete"===document.readyState?J(e):B(document,"readystatechange",()=>ft(e))}function gt(){Xe=document.querySelectorAll(`[${z}]`),Ne=Xe.length>0,ae(`Tagged elements found: %c${Ne}`,h)}let yt=0;function bt(){const n=document.querySelectorAll(`*[${$}]`);return je=n.length>0,je&&n.length!==yt&&(function(n){const o=1===n.length?"":"s";ge(`%c[${$}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),yt=n.length),je}function vt(){"BackCompat"===document.compatMode&&ye("<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")}function zt(){ne&&""!==ne&&"false"!==ne?ne!==y&&ye(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ne} - Child page: ${y}.\n`):ye("<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")}function wt(){try{Ge=1===Ue||"iframeParentListener"in window.parent}catch(e){ae("Cross domain iframe detected")}}function Ot(){ke===Ee&&(Me=!0)}function Et(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),se(`Set body ${e}: %c${t}`,h))}function kt(e,t,n){if(""!==n){ae(`${e}: %c${n}`,h);for(const e of document.querySelectorAll(n))ae(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function At(){kt("sizeSelector",z,Ye),kt("ignoreSelector",$,Be)}function Nt(){var e,t;void 0===Se&&(Se=`${ve}px`),Et("margin",(e="margin",(t=Se).includes("-")&&(ge(`Negative CSS value ignored for ${e}`),t=""),t))}function Rt(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),ae("Set HTML & body height: %cauto !important",h)}function qt(e){({add(t){function n(){$n(e.eventName,e.eventType)}i[t]=n,B(window,t,n,{passive:!0})},remove(e){const t=i[e];var n,o;delete i[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),ae(`${Y(e.method)} event listener: %c${e.eventType}`,h)}function Bt(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(z,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&ye("<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</>.")}function Lt(e,t,n){const{label:o}=n;return t!==e&&(e in n||(ge(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r)&&ye(`<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 ${ne?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),ae(`Set ${o} calculation method: %c${e}`,h),e}function Ft(){qe=Lt(qe,a,pn)}function Wt(){rt=Lt(rt,c,hn)}function Dt(){const t=Ue,n=Z({key:l}),o=Z({key:d});if(Ue=Math.max(n,o),Ue<0){if(Ue=Math.min(n,o),ye(`${U(Ue+2)}${U(2)}`),X(ne))throw U(Ue+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!X(ne)||t>-1&&Ue>t)&&(sessionStorage.getItem("ifr")!==y&&function(t,n){console.info(`${te} %ciframe-resizer ${t}`,ee||n<1?"font-weight: bold;":e)}(`v${y} (${(e=>F(H[e]))(Ue)})`,Ue),Ue<2&&be(U(3)),sessionStorage.setItem("ifr",y))}function Ht(){var e;!0!==ie&&ae("Auto Resize disabled"),qt({method:e="add",eventType:"After Print",eventName:"afterprint"}),qt({method:e,eventType:"Before Print",eventName:"beforeprint"}),qt({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function Vt(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Ut(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,v)+parseInt(n.x,v),y:parseInt(t.top,v)+parseInt(n.y,v)}}function t(t){const n=t.split("#")[1]||t,o=decodeURIComponent(n),r=document.getElementById(o)||document.getElementsByName(o)[0];void 0===r?(ae(`In page link (#${n}) not found in iFrame, so sending to parent`),On(0,0,"inPageLink",`#${n}`)):function(t){const o=e(t);ae(`Moving to in page link (%c#${n}%c) at x: %c${o.x}%c y: %c${o.y}`,h,g,h,g,h),On(o.y,o.x,"scrollToOffset")}(r)}function n(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}We.enable?1===Ue?ye("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):(ae("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&B(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),B(window,"hashchange",n),setTimeout(n,128)):ae("In page linking not enabled"),We={findTarget:t}}function Zt(){function e(e){On(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){ae(`Add event listener: %c${n}`,h),B(window.document,t,e)}!0===Ze&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}function Jt(){1!==Ue&&(it.parentIframe=Object.freeze({autoResize:e=>(K(e,"boolean","parentIframe.autoResize(enable) enable"),!1===ke&&!1===Ee?(me(M),ye("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===ie?(ie=!0,queueMicrotask(()=>$n(M,"Auto Resize enabled"))):!1===e&&!0===ie&&(ie=!1),On(0,0,"autoResize",JSON.stringify(ie)),ie)),close(){On(0,0,"close")},getId:()=>_e,getOrigin:()=>(ze("getOrigin()","getParentOrigin()"),m),getParentOrigin:()=>m,getPageInfo(e){if("function"==typeof e)return lt=e,On(0,0,"pageInfo"),void we("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");lt=null,On(0,0,"pageInfoStop")},getParentProps:e=>(K(e,"function","parentIframe.getParentProps(callback) callback"),dt=e,On(0,0,"parentInfo"),()=>{dt=null,On(0,0,"parentInfoStop")}),getParentProperties(e){ze("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){K(e,"string","parentIframe.moveToAnchor(anchor) anchor"),We.findTarget(e)},reset(){!function(){const e=qe;qe=a,ae(`Reset trigger event: %c${"parentIframe.reset"}`,h),nt?ae("TriggerLock blocked calculation"):(nt=!0,ce("Trigger event lock on"),requestAnimationFrame(()=>{nt=!1,ce("Trigger event lock off")})),Sn("reset"),qe=e}()},setOffsetSize(e){K(e,"number","parentIframe.setOffsetSize(offset) offset"),u=e,f=e,$n(I,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){K(e,"number","parentIframe.scrollBy(x, y) x"),K(t,"number","parentIframe.scrollBy(x, y) y"),On(t,e,"scrollBy")},scrollTo(e,t){K(e,"number","parentIframe.scrollTo(x, y) x"),K(t,"number","parentIframe.scrollTo(x, y) y"),On(t,e,"scrollTo")},scrollToOffset(e,t){K(e,"number","parentIframe.scrollToOffset(x, y) x"),K(t,"number","parentIframe.scrollToOffset(x, y) y"),On(t,e,"scrollToOffset")},sendMessage(e,t){t&&K(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),On(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){qe=e,Ft()},setWidthCalculationMethod(e){rt=e,Wt()},setTargetOrigin(e){K(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),ae(`Set targetOrigin: %c${e}`,h),et=e},resize(e,t){void 0!==e&&K(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&K(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),$n(k,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ze("size()","resize()"),this.resize(e,t)}}),it.parentIFrame=it.parentIframe)}let _t=new Set;function Qt(){const e=document.querySelectorAll(`[${w}]`);Je=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${$}]`)?n.add(o):t.add(o);return n.size>0&&(me("overflowIgnored"),se("Ignoring elements with [data-iframe-ignore] > *:\n",n),de()),t}(e),Ie=Je.size>0,"function"==typeof Set.prototype.symmetricDifference&&(xe=Je.symmetricDifference(_t).size>0),_t=Je}function Gt(){switch(Qt(),!0){case!xe:return;case Je.size>1:se("Overflowed Elements:",Je);break;case Ie:break;default:se("No overflow detected")}$n(x,"Overflow updated")}function Yt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;$n(A,`Element resized <${function(e){switch(!0){case!X(e):return"";case X(e.id):return`${e.nodeName}#${e.id}`;case X(e.name):return`${e.nodeName} (${e.name}`;case X(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Xt(e){jt=new ResizeObserver(Yt),jt.observe(document.body),Tt.add(document.body),se("Attached ResizeObserver to body"),L={attachObserverToNonStaticElements:It,detachObservers:Fe(St,jt,Tt,Mt)},L.attachObserverToNonStaticElements(e)}function Kt(e){ae(`Visible: %c${e}`,h),De=!e,$n(P,"Visibility changed")}const en=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of ln(n))t.add(e)}return se("Inspecting:\n",t),t},tn=e=>{if(0===e.size)return;me("addObservers");const t=en(e);p.attachObservers(t),L.attachObserverToNonStaticElements(t),de()},nn=e=>{if(0===e.size)return;me("removeObservers");const t=en(e);p.detachObservers(t),L.detachObservers(t),de()};function on(e){!function({addedNodes:e,removedNodes:t}){me("contentMutated"),At(),gt(),Qt(),de(),nn(t),tn(e)}(e),$n(C,"Mutation Observed")}function rn(){const e=ln(document.documentElement);ae("Attaching Observers"),at(on),function(e){const t={root:document.documentElement,side:Ee?S:O};p=mt(Gt,t),p.attachObservers(e)}(e),$t(),Xt(e),function(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;t.observe(n),se("Attached VisibilityObserver to page")}(Kt)}function an(e){performance.mark(pt);const t=Y(e);let n=1,o=document.documentElement,r=Ne?0:document.documentElement.getBoundingClientRect().bottom;const i=Ne?Xe:Ie?Array.from(Je):ln(document.documentElement);for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return se(`${t} position calculated from:`,o),performance.mark(ht,{detail:{hasTags:Ne,len:i.length,logging:Ve,Side:t}}),r}const sn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],cn=`* ${Array.from(q).map(e=>`:not(${e})`).join("")}`,ln=e=>e.querySelectorAll(cn),dn={height:0,width:0},un={height:0,width:0},fn=[h,g,h];function mn(e){function t(){return un[o]=r,dn[o]=s,Math.max(r,1)}const n=e===pn,o=e.label,r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: %c${r}px %cPage: %c${s}px`;let l=0;switch(!0){case!e.enabled():return Math.max(s,1);case Ne:se("Found element with data-iframe-size attribute"),l=e.taggedElement();break;case!Ie&&Te&&0===un[o]&&0===dn[o]:se(`Initial page size values: ${c}`,...fn),l=t();break;case nt&&r===un[o]&&s===dn[o]:se(`Size unchanged: ${c}`,...fn),l=Math.max(r,s);break;case 0===r&&0!==s:se(`Page is hidden: ${c}`,...fn),l=s;break;case!Ie&&r!==un[o]&&s<=dn[o]:se(`New <html> size: ${c} `,...fn),se(`Previous <html> size: %c${un[o]}px`,h),l=t();break;case!n:l=e.taggedElement();break;case!Ie&&r<un[o]:se(`<html> size decreased: ${c}`,...fn),l=t();break;case s===a||s===i:se(`<html> size equals page size: ${c}`,...fn),l=t();break;case r>s:se(`Page size < <html> size: ${c}`,...fn),l=t();break;case Ie:se("Found element overflowing <html> "),l=e.taggedElement();break;default:se(`Using <html> size: ${c}`,...fn),l=t()}return se(`Content ${o}: %c${l}px`,h),l+=function(e){const t=e.getOffset();return 0!==t&&se(`Page offsetSize: %c${t}px`,h),t}(e),l}const pn={label:"height",enabled:()=>Ee,getOffset:()=>u,auto:()=>mn(pn),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,v)+parseInt(t.marginBottom,v)},bodyScroll:()=>document.body.scrollHeight,offset:()=>pn.bodyOffset(),custom:()=>o.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...sn(pn)),min:()=>Math.min(...sn(pn)),grow:()=>pn.max(),lowestElement:()=>an(S),taggedElement:()=>an(S)},hn={label:"width",enabled:()=>ke,getOffset:()=>f,auto:()=>mn(hn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>o.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...sn(hn)),min:()=>Math.min(...sn(hn)),rightMostElement:()=>an(O),scroll:()=>Math.max(hn.bodyScroll(),hn.documentElementScroll()),taggedElement:()=>an(O)},gn=(e,t)=>!(Math.abs(e-t)<=tt);function yn(e,t){const n=e[t](),o=e.enabled()&&void 0!==oe?function(e){const t=oe(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);if(t<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${t}, must be at least 1`);return t}(n):n;return le(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let bn=!1;const vn=_(()=>be(U(4)));let zn,wn=!1;const $n=fe((e,t,n,o,r)=>{switch(V=performance.now(),D=!0,me(e),!0){case!0===De:if(!0===wn)break;ae("Iframe hidden - Ignored resize request"),wn=!0,bn=!1,cancelAnimationFrame(zn);break;case!0===bn:break;case!ie&&!(e in j):se("Resizing disabled");break;default:return wn=!1,bn=!0,zn=requestAnimationFrame(()=>{bn=!1,me("requestAnimationFrame"),ce(`Reset sendPending: %c${e}`,h)}),void function(e,t,n,o,r){const i=n??yn(pn,qe),a=o??yn(hn,rt),s=Ee&&gn(Re,i)||ke&&gn(ot,a)?E:e;switch(ae(`Resize event: %c${t}`,h),s){case R:case M:case E:Re=i,ot=a;case I:On(Re,ot,e,r);break;case x:case C:case A:case P:ae(N);break;default:se(N)}D=!1}(e,t,n,o,r)}de()});function Sn(e){Re=pn[qe](),ot=hn[rt](),On(Re,ot,e)}const On=fe(function(e,t,o,r,i){Ue<0||(me(o),void 0!==i?ae(`Message targetOrigin: %c${i}`,h):i=et,function(){const a=`${_e}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(Ge)try{window.parent.iframeParentListener(s+a)}catch(e){if(1!==Ue)throw e;return void vn()}else Ke.postMessage(s+a,i);D&&ae(function(){const e=G(performance.now()-V);return o===R?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),h),se(`Sending message to parent page via ${Ge?"sameOrigin":"postMessage"}: %c%c${a}`,n,h)}(),de())}),Mn=fe(function(e){me("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>t(n(e)),r=e=>On(0,0,`${e}Stop`),i={init:function(){if("loading"===document.readyState)return void ae("Page not ready, ignoring init message");const t=e.data.slice(13).split(":");Ke=e.source,m=e.origin,ut(t),Te=!1,setTimeout(()=>{Le=!1},128)},reset(){Le?ae("Page reset ignored by init"):(ae("Page size reset by host page"),Sn("resetPage"))},resize(){ae("Resize requested by host page"),$n(T,"Parent window requested size check")},moveToAnchor(){We.findTarget(c())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=c();ae("PageInfo received from parent:",o(e)),lt?J(lt,n(e)):r("pageInfo")},parentInfo(){const e=o(c());ae("ParentInfo received from parent:",e),dt?J(dt,e):r("parentInfo")},message(){const e=c();ae("onMessage called from parent:%c",h,o(e)),J(st,n(e))}},a=()=>e.data.split("]")[1].split(":")[0],c=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function d(){const t=a();me(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||ge(`Unexpected message (${e.data})`)}s===`${e.data}`.slice(0,13)&&function(){if(!1!==Te)return l()?(pe(a()),me(R),void i.init()):void ae(`Ignored message of type "${a()}". Received before initialization.`);d()}()});function En(){"loading"===document.readyState||Te||(ae("[iFrameResizerChild]Ready"),window.parent.postMessage("[iFrameResizerChild]Ready","*"))}"iframeChildListener"in window?ge("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Mn({data:e,sameOrigin:!0})),B(window,"message",Mn),B(window,"readystatechange",En),setTimeout(En))}()});
20
+ !function(e){"function"==typeof define&&define.amd?define(e):e()}(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},c=Object.assign(console);const{fromEntries:l,keys:d}=Object,u=e=>[e,c[e]],f=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>l(d(e).map(t));const p=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,h=p?"color: #A9C7FB;":"color: #135CD2;",g=p?"color: #E3E3E3;":"color: #1F1F1F;",y="5.5.3-beta.6",b="iframeResizer",v=10,z="data-iframe-size",w="data-iframe-overflowed",$="data-iframe-ignore",S="bottom",O="right",M="autoResizeEnabled",E=Symbol("sizeChanged"),k="manualResize",T="parentResize",j={[k]:1,[T]:1},I="setOffsetSize",A="resizeObserver",x="overflowObserver",C="mutationObserver",P="visibilityObserver",N="No change in content size detected",R="init",q=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),B=(e,t,n,o)=>e.addEventListener(t,n,o||!1),L=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,r=0;r<e.length;r++)o=e.codePointAt(r),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);return t^=Math.imul(t^n>>>15,1935289751),n^=Math.imul(n^t>>>15,3405138345),t^=n>>>16,n^=t>>>16,(2097152*(n>>>0)+(t>>>11)).toString(36)},F=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),W=["spjluzl","rlf","clyzpvu"],D=["<yi>Puchspk Spjluzl Rlf</><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."],H=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],V=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),U=e=>F(D[e]),Z=e=>{const t=e[F(W[0])]||e[F(W[1])]||e[F(W[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=L(F(e));return n in V&&(t=V[n]),t}(n[0]);return 0===o||(e=>e[2]===L(e[0]+e[1]))(n)||(o=-2),o},J=(e,...t)=>setTimeout(()=>e(...t),0),_=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},Q=e=>e,G=e=>Math.round(1e3*e)/1e3,Y=e=>e.charAt(0).toUpperCase()+e.slice(1),X=e=>""!=`${e}`&&void 0!==e;const K=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Y(t)}`)};let ee=!0,te=b;const ne=(oe=function(n={}){const l={},d={},p=[],h={...a,expand:!n.collapsed||a.expanded,...n};let g="";function y(){p.length=0,g=""}function b(){delete h.event,y()}const v=()=>!!p.some(([e])=>e in i)||!!h.expand;function z(){if(0!==p.length){c[v()?"group":"groupCollapsed"](`%c${h.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(h)} %c${h.showTime?g:""}`,e,t,o);for(const[e,...t]of p)c.assert(e in c,`Unknown console method: ${e}`),e in c&&c[e](...t);c.groupEnd(),b()}else b()}function w(){""===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 $(e,...t){0===p.length&&(w(),queueMicrotask(()=>queueMicrotask(z))),p.push([e,...t])}function S(e=r,...t){l[e]?$("log",`${e}: ${performance.now()-l[e]} ms`,...t):$("timeLog",e,...t)}return{...m(h,f(h)),...m(console,e=>[e,(...t)=>$(e,...t)]),...m(s,u),assert:function(e,...t){!0!==e&&$("assert",e,...t)},count:function(e=r){d[e]?d[e]+=1:d[e]=1,$("log",`${e}: ${d[e]}`)},countReset:function(e=r){delete d[e]},endAutoGroup:z,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;$("error",e),z()}return n},event:function(e){w(),h.event=e},purge:y,time:function(e=r){w(),l[e]=performance.now()},timeEnd:function(e=r){S(e),delete l[e]},timeLog:S,touch:w}},oe?.__esModule?oe.default:oe);var oe;const re=ne({label:`${b}(child)`});const ie=e=>(...t)=>!ee||re[e](...t),ae=ie("log"),se=ae,ce=ie("debug");const{assert:le,endAutoGroup:de,error:ue,errorBoundary:fe,event:me,label:pe,purge:he,warn:ge}=re,ye=e=>{return re.warn((t=Q,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},be=ye,ve=(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)=>ye(t)),ze=ve("Method"),we=ve("Method","replaced with"),$e=ve("Option"),Se=["min-height","min-width","max-height","max-width"],Oe=new Set,Me=e=>e.tagName?e.tagName.toLowerCase():"unknown",Ee=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),ke=(e,t)=>{return(n=Ee(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function Te({href:e}){Oe.has(e)||(ae("Unable to access stylesheet:",e),Oe.add(e))}const je=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){Te(n)}return{source:"cross-origin stylesheet",value:Ee(e,t)}}(e,t),Ie=(e,t)=>{const{source:n,value:o}=je(e,t),r=Me(e);ye(`The <b>${t}</> CSS property is set to <b>${o}</> on the <b><${r}></> element via ${n}. This may cause issues with the correct operation of <i>iframe-resizer</>.\n\nIf you wish to restrict the size of the iframe, then you should set this property on the iframe element itself, not the content inside it.`)};function Ae(){for(const e of[document.documentElement,document.body])for(const t of Se)ae(`Checking <${Me(e)}> for blocking CSS: ${t}`),ke(e,t)&&Ie(e,t)}const xe=e=>t=>void 0===t?void 0:e(t),Ce=xe(e=>"true"===e),Pe=xe(Number),Ne=(e="")=>t=>n=>{n.size>0&&ce(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},Re=Ne("attached to"),qe=((e="")=>t=>n=>{n.size>0&&ue(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Be=Ne("detached from"),Le=(t,n=!0)=>o=>{o>0&&se(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,h,e)},Fe=(e,t,n,o)=>{const r=Be(e);return e=>{const i=new Set;let a=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),i.add(o),a+=1);r(i),o(a),i.clear()}},We="Mutation",De=new Set,He=new Set,Ve=new Set,Ue=[],Ze={attributes:!0,attributeFilter:[$,z],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Je,_e=1,Qe=!1,Ge=0;const Ye=Ne("added")(We),Xe=Ne("removed (page)")(We),Ke=Ne("removed (added)")(We),et=e=>e.nodeType!==Node.ELEMENT_NODE||q.has(e.tagName.toLowerCase());function tt(e){const t=e.addedNodes;for(const e of t)et(e)||De.add(e)}function nt(e){const t=e.removedNodes;for(const e of t)et(e)||(De.has(e)?(De.delete(e),Ve.add(e)):He.add(e))}const ot=e=>{se("Mutations:",e);for(const t of e)tt(t),nt(t);Ye(De),Xe(He),Ke(Ve),Ve.clear()};const rt=e=>()=>{const t=performance.now(),n=t-Ge,o=16*_e+++2;if(n>o&&n<200)return me("mutationThrottled"),se("Update delayed due to heavy workload on the callStack"),se(`EventLoop busy time: %c${G(n)}ms %c> Max wait: %c${o-2}ms`,h,g,h),setTimeout(Je,16*_e),void(Ge=t);_e=1,Ue.forEach(ot),Ue.length=0,Qe=!1,He.size>0&&ae(`Detected %c${He.size} %cremoved element${He.size>1?"s":""}`,h,g),De.size>0&&ae(`Found %c${De.size} %cnew element${De.size>1?"s":""}`,h,g),e({addedNodes:De,removedNodes:He}),De.clear(),He.clear()};function it(e){Ue.push(e),Qe||(Ge=performance.now(),Qe=!0,requestAnimationFrame(Je))}function at(e){const t=new window.MutationObserver(it),n=document.body||document.documentElement;return Je=rt(e),t.observe(n,Ze),se("Attached MutationObserver to body"),t}const st="Overflow",ct=Le(st),lt=Le(st,!1),dt=Re(st),ut=qe(st),ft=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,mt=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||Q,i=(t=!1)=>e(t),a=(e,t)=>0===e||e>t[n],s=(e,t)=>e.toggleAttribute(w,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t,i=e[n],c=a(i,o)&&!ft(r);s(r,c)}r(i)},o),l=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r.nodeType===Node.ELEMENT_NODE&&(l.has(r)?t.add(r):(c.observe(r),l.add(r),n.add(r),o+=1));ut(t),dt(n),ct(o),n.clear(),t.clear()},detachObservers:Fe(st,c,l,lt)}},pt="--ifr-start",ht="--ifr-end",gt=[],yt=new WeakSet,bt=e=>"object"==typeof e&&yt.add(e);let vt={},zt=0;function wt(e){e.getEntries().forEach(e=>{if(e.name===ht){const{duration:t}=performance.measure("--ifr-measure",pt,ht);vt=e.detail,gt.push(t),gt.length>100&&gt.shift()}})}function $t(){se("Attached PerformanceObserver to page");new PerformanceObserver(wt).observe({entryTypes:["mark"]}),bt(document.documentElement),bt(document.body),function(){const e=setInterval(()=>{if(gt.length<10)return;if(vt.hasTags&&vt.len<25)return;gt.sort();const t=Math.min(gt.reduce((e,t)=>e+t,0)/gt.length,gt[Math.floor(gt.length/2)]),n=G(t);n>zt&&(zt=n,me("performanceObserver"),ae("Mean time:",G(gt[Math.floor(gt.length/2)])),ae("Median time:",G(gt.reduce((e,t)=>e+t,0)/gt.length)),ae("Average time:",n),ae("Max time:",G(Math.max(...gt)))),performance.clearMarks(),t<=4||(clearInterval(e),ye(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${G(t)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${vt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3)}()}const St="Resize",Ot=Le(St),Mt=Le(St,!1),Et=Re(St),kt=qe(St),Tt=new WeakSet;let jt;function It(e){const t=new Set,n=new Set;let o=0;for(const r of e){if(r.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(r)?.position;""!==e&&"static"!==e&&(Tt.has(r)?t.add(r):(jt.observe(r),Tt.add(r),n.add(r),o+=1))}kt(t),Et(n),Ot(o),n.clear(),t.clear()}const At=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},xt=At("function"),Ct=At("number"),Pt=At("string");"undefined"!=typeof window&&function(){const o={height:()=>(ge("Custom height calculation function not defined"),pn.auto()),width:()=>(ge("Custom width calculation function not defined"),hn.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},i={},a="auto",s="[iFrameSizer]",c="scroll";let l,d,u,f,m,p,L,D,V,ne,oe,ie=!0,he="",ve=0,Se="",Oe="",Me=!1,Ee=!0,ke=!1,Te=!0,je=!1,Ie=!1,xe=!0,Ne=!1,Re=1,qe=a,Be="",Le=!0,We={},De=!1,He=!0,Ve=!1,Ue=0,Ze=!1,Je=new Set,_e="",Qe="child",Ge=!1,Ye="",Xe=[],Ke=window.parent,et="*",tt=0,nt=!1,ot=1,rt=c,it=window,st=()=>{ge("onMessage function not defined")},ct=()=>{},lt=null,dt=null;function ut(e){var t;!function(e){_e=e[0]??_e,ve=Pe(e[1])??ve,ke=Ce(e[2])??ke,Ve=Ce(e[3])??Ve,ie=Ce(e[6])??ie,Se=e[7]??Se,qe=e[8]??qe,he=e[9]??he,Oe=e[10]??Oe,tt=Pe(e[11])??tt,We.enable=Ce(e[12])??!1,Qe=e[13]??Qe,rt=e[14]??rt,Ze=Ce(e[15])??Ze,u=Pe(e[16])??u,f=Pe(e[17])??f,Ee=Ce(e[18])??Ee,l=e[19]??l,ne=e[20]??ne,Ue=Pe(e[21])??Ue,He=Ce(e[23])??He}(e),te=(t={id:_e,enabled:Ve,expand:He}).id||b,re.label(`${te}`),re.expand(t.expand),ee=t.enabled,ae(`Initialising iframe v${y} ${window.location.href}`),function(){function e(e){ae("Reading data from page:",Object.keys(e)),oe=xt(e,"onBeforeResize")??oe,st=xt(e,"onMessage")??st,ct=xt(e,"onReady")??ct,"number"==typeof e?.offset&&($e("offset","offsetSize"),Ee&&(u=Ct(e,"offset")??u),ke&&(f=Ct(e,"offset")??f)),"number"==typeof e?.offsetSize&&(Ee&&(u=Ct(e,"offsetSize")??u),ke&&(f=Ct(e,"offsetSize")??f)),d=Pt(e,F(W[0]))??d,Be=Pt(e,"ignoreSelector")??Be,Ye=Pt(e,"sizeSelector")??Ye,et=Pt(e,"targetOrigin")??et,qe=e?.heightCalculationMethod||qe,rt=e?.widthCalculationMethod||rt}function t(e,t){return"function"==typeof e&&(ye(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),o[t]=e,e="custom"),e}if(1===Ue)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),qe=t(qe,"height"),rt=t(rt,"width"),se(`Set targetOrigin for parent: %c${et}`,h))}(),[zt,Ot,Dt,bt,wt,Ft,Wt,Bt,vt,gt,Me?Q:Ae,At,Jt,Zt,Ut,Nt,()=>Et("background",he),()=>Et("padding",Oe),Me?Q:Rt,Vt,Ht,rn].forEach(e=>{try{e()}catch(e){if(Ue<0)throw e;ye("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),ue(e)}}),ft(_(ct)),ae("Initialization complete"),$n(R,"Init message from host page",void 0,void 0,`${y}:${Ue}`),document.title&&""!==document.title&&Mn(0,0,"title",document.title)}function ft(e){"complete"===document.readyState?J(e):B(document,"readystatechange",()=>ft(e))}function gt(){Xe=document.querySelectorAll(`[${z}]`),Ne=Xe.length>0,ae(`Tagged elements found: %c${Ne}`,h)}let yt=0;function bt(){const n=document.querySelectorAll(`*[${$}]`);return je=n.length>0,je&&n.length!==yt&&(function(n){const o=1===n.length?"":"s";ge(`%c[${$}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),yt=n.length),je}function vt(){"BackCompat"===document.compatMode&&ye("<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")}function zt(){ne&&""!==ne&&"false"!==ne?ne!==y&&ye(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ne} - Child page: ${y}.\n`):ye("<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")}function wt(){try{Ge=1===Ue||"iframeParentListener"in window.parent}catch(e){ae("Cross domain iframe detected")}}function Ot(){ke===Ee&&(Me=!0)}function Et(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),se(`Set body ${e}: %c${t}`,h))}function kt(e,t,n){if(""!==n){ae(`${e}: %c${n}`,h);for(const e of document.querySelectorAll(n))ae(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function At(){kt("sizeSelector",z,Ye),kt("ignoreSelector",$,Be)}function Nt(){var e,t;void 0===Se&&(Se=`${ve}px`),Et("margin",(e="margin",(t=Se).includes("-")&&(ge(`Negative CSS value ignored for ${e}`),t=""),t))}function Rt(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),ae("Set HTML & body height: %cauto !important",h)}function qt(e){({add(t){function n(){$n(e.eventName,e.eventType)}i[t]=n,B(window,t,n,{passive:!0})},remove(e){const t=i[e];var n,o;delete i[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),ae(`${Y(e.method)} event listener: %c${e.eventType}`,h)}function Bt(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(z,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&ye("<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</>.")}function Lt(e,t,n){const{label:o}=n;return t!==e&&(e in n||(ge(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r)&&ye(`<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 ${ne?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),ae(`Set ${o} calculation method: %c${e}`,h),e}function Ft(){qe=Lt(qe,a,pn)}function Wt(){rt=Lt(rt,c,hn)}function Dt(){const t=Ue,n=Z({key:l}),o=Z({key:d});if(Ue=Math.max(n,o),Ue<0){if(Ue=Math.min(n,o),ye(`${U(Ue+2)}${U(2)}`),X(ne))throw U(Ue+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!X(ne)||t>-1&&Ue>t)&&(sessionStorage.getItem("ifr")!==y&&function(t,n){console.info(`${te} %ciframe-resizer ${t}`,ee||n<1?"font-weight: bold;":e)}(`v${y} (${(e=>F(H[e]))(Ue)})`,Ue),Ue<2&&be(U(3)),sessionStorage.setItem("ifr",y))}function Ht(){var e;!0!==ie&&ae("Auto Resize disabled"),qt({method:e="add",eventType:"After Print",eventName:"afterprint"}),qt({method:e,eventType:"Before Print",eventName:"beforeprint"}),qt({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function Vt(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Ut(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,v)+parseInt(n.x,v),y:parseInt(t.top,v)+parseInt(n.y,v)}}function t(t){const n=t.split("#")[1]||t,o=decodeURIComponent(n),r=document.getElementById(o)||document.getElementsByName(o)[0];void 0===r?(ae(`In page link (#${n}) not found in iFrame, so sending to parent`),Mn(0,0,"inPageLink",`#${n}`)):function(t){const o=e(t);ae(`Moving to in page link (%c#${n}%c) at x: %c${o.x}%c y: %c${o.y}`,h,g,h,g,h),Mn(o.y,o.x,"scrollToOffset")}(r)}function n(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}We.enable?1===Ue?ye("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):(ae("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&B(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),B(window,"hashchange",n),setTimeout(n,128)):ae("In page linking not enabled"),We={findTarget:t}}function Zt(){function e(e){Mn(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){ae(`Add event listener: %c${n}`,h),B(window.document,t,e)}!0===Ze&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}function Jt(){1!==Ue&&(it.parentIframe=Object.freeze({autoResize:e=>(K(e,"boolean","parentIframe.autoResize(enable) enable"),!1===ke&&!1===Ee?(me(M),ye("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===ie?(ie=!0,queueMicrotask(()=>$n(M,"Auto Resize enabled"))):!1===e&&!0===ie&&(ie=!1),Mn(0,0,"autoResize",JSON.stringify(ie)),ie)),close(){Mn(0,0,"close")},getId:()=>_e,getOrigin:()=>(ze("getOrigin()","getParentOrigin()"),m),getParentOrigin:()=>m,getPageInfo(e){if("function"==typeof e)return lt=e,Mn(0,0,"pageInfo"),void we("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");lt=null,Mn(0,0,"pageInfoStop")},getParentProps:e=>(K(e,"function","parentIframe.getParentProps(callback) callback"),dt=e,Mn(0,0,"parentInfo"),()=>{dt=null,Mn(0,0,"parentInfoStop")}),getParentProperties(e){ze("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){K(e,"string","parentIframe.moveToAnchor(anchor) anchor"),We.findTarget(e)},reset(){!function(){const e=qe;qe=a,ae(`Reset trigger event: %c${"parentIframe.reset"}`,h),nt?ae("TriggerLock blocked calculation"):(nt=!0,ce("Trigger event lock on"),requestAnimationFrame(()=>{nt=!1,ce("Trigger event lock off")})),Sn("reset"),qe=e}()},setOffsetSize(e){K(e,"number","parentIframe.setOffsetSize(offset) offset"),u=e,f=e,$n(I,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){K(e,"number","parentIframe.scrollBy(x, y) x"),K(t,"number","parentIframe.scrollBy(x, y) y"),Mn(t,e,"scrollBy")},scrollTo(e,t){K(e,"number","parentIframe.scrollTo(x, y) x"),K(t,"number","parentIframe.scrollTo(x, y) y"),Mn(t,e,"scrollTo")},scrollToOffset(e,t){K(e,"number","parentIframe.scrollToOffset(x, y) x"),K(t,"number","parentIframe.scrollToOffset(x, y) y"),Mn(t,e,"scrollToOffset")},sendMessage(e,t){t&&K(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Mn(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){qe=e,Ft()},setWidthCalculationMethod(e){rt=e,Wt()},setTargetOrigin(e){K(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),ae(`Set targetOrigin: %c${e}`,h),et=e},resize(e,t){void 0!==e&&K(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&K(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),$n(k,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ze("size()","resize()"),this.resize(e,t)}}),it.parentIFrame=it.parentIframe)}let _t=new Set;function Qt(){const e=document.querySelectorAll(`[${w}]`);Je=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${$}]`)?n.add(o):t.add(o);return n.size>0&&(me("overflowIgnored"),se("Ignoring elements with [data-iframe-ignore] > *:\n",n),de()),t}(e),Ie=Je.size>0,"function"==typeof Set.prototype.symmetricDifference&&(xe=Je.symmetricDifference(_t).size>0),_t=Je}function Gt(){switch(Qt(),!0){case!xe:return;case Je.size>1:se("Overflowed Elements:",Je);break;case Ie:break;default:se("No overflow detected")}$n(x,"Overflow updated")}function Yt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;$n(A,`Element resized <${function(e){switch(!0){case!X(e):return"";case X(e.id):return`${e.nodeName}#${e.id}`;case X(e.name):return`${e.nodeName} (${e.name}`;case X(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Xt(e){jt=new ResizeObserver(Yt),jt.observe(document.body),Tt.add(document.body),se("Attached ResizeObserver to body"),L={attachObserverToNonStaticElements:It,detachObservers:Fe(St,jt,Tt,Mt)},L.attachObserverToNonStaticElements(e)}function Kt(e){ae(`Visible: %c${e}`,h),De=!e,$n(P,"Visibility changed")}const en=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of ln(n))t.add(e)}return se("Inspecting:\n",t),t},tn=e=>{if(0===e.size)return;me("addObservers");const t=en(e);p.attachObservers(t),L.attachObserverToNonStaticElements(t),de()},nn=e=>{if(0===e.size)return;me("removeObservers");const t=en(e);p.detachObservers(t),L.detachObservers(t),de()};function on(e){!function({addedNodes:e,removedNodes:t}){me("contentMutated"),At(),gt(),Qt(),de(),nn(t),tn(e)}(e),$n(C,"Mutation Observed")}function rn(){const e=ln(document.documentElement);ae("Attaching Observers"),at(on),function(e){const t={root:document.documentElement,side:Ee?S:O};p=mt(Gt,t),p.attachObservers(e)}(e),$t(),Xt(e),function(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;t.observe(n),se("Attached VisibilityObserver to page")}(Kt)}function an(e){performance.mark(pt);const t=Y(e);let n=1,o=document.documentElement,r=Ne?0:document.documentElement.getBoundingClientRect().bottom;const i=Ne?Xe:Ie?Array.from(Je):ln(document.documentElement);for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return se(`${t} position calculated from:`,o),performance.mark(ht,{detail:{hasTags:Ne,len:i.length,logging:Ve,Side:t}}),r}const sn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],cn=`* ${Array.from(q).map(e=>`:not(${e})`).join("")}`,ln=e=>e.querySelectorAll(cn),dn={height:0,width:0},un={height:0,width:0},fn=[h,g,h];function mn(e){function t(){return un[o]=r,dn[o]=s,Math.max(r,1)}const n=e===pn,o=e.label,r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: %c${r}px %cPage: %c${s}px`;let l=0;switch(!0){case!e.enabled():return Math.max(s,1);case Ne:se("Found element with data-iframe-size attribute"),l=e.taggedElement();break;case!Ie&&Te&&0===un[o]&&0===dn[o]:se(`Initial page size values: ${c}`,...fn),l=t();break;case nt&&r===un[o]&&s===dn[o]:se(`Size unchanged: ${c}`,...fn),l=Math.max(r,s);break;case 0===r&&0!==s:se(`Page is hidden: ${c}`,...fn),l=s;break;case!Ie&&r!==un[o]&&s<=dn[o]:se(`New <html> size: ${c} `,...fn),se(`Previous <html> size: %c${un[o]}px`,h),l=t();break;case!n:l=e.taggedElement();break;case!Ie&&r<un[o]:se(`<html> size decreased: ${c}`,...fn),l=t();break;case s===a||s===i:se(`<html> size equals page size: ${c}`,...fn),l=t();break;case r>s:se(`Page size < <html> size: ${c}`,...fn),l=t();break;case Ie:se("Found element overflowing <html> "),l=e.taggedElement();break;default:se(`Using <html> size: ${c}`,...fn),l=t()}return se(`Content ${o}: %c${l}px`,h),l+=function(e){const t=e.getOffset();return 0!==t&&se(`Page offsetSize: %c${t}px`,h),t}(e),l}const pn={label:"height",enabled:()=>Ee,getOffset:()=>u,auto:()=>mn(pn),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,v)+parseInt(t.marginBottom,v)},bodyScroll:()=>document.body.scrollHeight,offset:()=>pn.bodyOffset(),custom:()=>o.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...sn(pn)),min:()=>Math.min(...sn(pn)),grow:()=>pn.max(),lowestElement:()=>an(S),taggedElement:()=>an(S)},hn={label:"width",enabled:()=>ke,getOffset:()=>f,auto:()=>mn(hn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>o.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...sn(hn)),min:()=>Math.min(...sn(hn)),rightMostElement:()=>an(O),scroll:()=>Math.max(hn.bodyScroll(),hn.documentElementScroll()),taggedElement:()=>an(O)},gn=(e,t)=>!(Math.abs(e-t)<=tt);function yn(e,t){const n=e[t](),o=e.enabled()&&void 0!==oe?function(e){const t=oe(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);if(t<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${t}, must be at least 1`);return t}(n):n;return le(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let bn=!1;const vn=_(()=>be(U(4)));let zn,wn=!1;const $n=fe((e,t,n,o,r)=>{switch(V=performance.now(),D=!0,me(e),!0){case!0===De:if(!0===wn)break;ae("Iframe hidden - Ignored resize request"),wn=!0,bn=!1,cancelAnimationFrame(zn);break;case!0===bn:break;case!ie&&!(e in j):se("Resizing disabled");break;default:wn=!1,bn=!0,zn=requestAnimationFrame(()=>{bn=!1,me("requestAnimationFrame"),ce(`Reset sendPending: %c${e}`,h)}),function(e,t,n,o,r){const i=n??yn(pn,qe),a=o??yn(hn,rt),s=Ee&&gn(Re,i)||ke&&gn(ot,a)?E:e;switch(ae(`Resize event: %c${t}`,h),s){case R:case M:case E:Re=i,ot=a;case I:On(Re,ot,e,r);break;case x:case C:case A:case P:ae(N);break;default:se(N)}D=!1}(e,t,n,o,r)}de()});function Sn(e){Re=pn[qe](),ot=hn[rt](),Mn(Re,ot,e)}function On(e,t,o,r,i){Ue<-1||(void 0!==i?ae(`Message targetOrigin: %c${i}`,h):i=et,function(){const a=`${_e}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(Ge)try{window.parent.iframeParentListener(s+a)}catch(e){if(1!==Ue)throw e;return void vn()}else Ke.postMessage(s+a,i);D&&ae(function(){const e=G(performance.now()-V);return o===R?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),h),se(`Sending message to parent page via ${Ge?"sameOrigin":"postMessage"}: %c%c${a}`,n,h)}())}const Mn=fe(function(e,t,n,o,r){me(n),On(e,t,n,o,r),de()}),En=fe(function(e){me("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>t(n(e)),r=e=>Mn(0,0,`${e}Stop`),i={init:function(){if("loading"===document.readyState)return void ae("Page not ready, ignoring init message");const t=e.data.slice(13).split(":");Ke=e.source,m=e.origin,ut(t),Te=!1,setTimeout(()=>{Le=!1},128)},reset(){Le?ae("Page reset ignored by init"):(ae("Page size reset by host page"),Sn("resetPage"))},resize(){ae("Resize requested by host page"),$n(T,"Parent window requested size check")},moveToAnchor(){We.findTarget(c())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=c();ae("PageInfo received from parent:",o(e)),lt?J(lt,n(e)):r("pageInfo")},parentInfo(){const e=o(c());ae("ParentInfo received from parent:",e),dt?J(dt,e):r("parentInfo")},message(){const e=c();ae("onMessage called from parent:%c",h,o(e)),J(st,n(e))}},a=()=>e.data.split("]")[1].split(":")[0],c=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function d(){const t=a();me(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||ge(`Unexpected message (${e.data})`)}s===`${e.data}`.slice(0,13)&&function(){if(!1!==Te)return l()?(pe(a()),me(R),void i.init()):void ae(`Ignored message of type "${a()}". Received before initialization.`);d()}()});function kn(){"loading"===document.readyState||Te||(ae("[iFrameResizerChild]Ready"),window.parent.postMessage("[iFrameResizerChild]Ready","*"))}"iframeChildListener"in window?ge("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>En({data:e,sameOrigin:!0})),B(window,"message",En),B(window,"readystatechange",kn),setTimeout(kn))}()});
21
21
  //# sourceMappingURL=index.umd.js.map