@iframe-resizer/child
Version:
Keep iframes sized to their content.
21 lines (18 loc) • 29 kB
JavaScript
/*!
* @preserve
*
* @module iframe-resizer/child 5.5.9 (esm) - 2026-02-06
*
* @license GPL-3.0 for non-commercial use only.
* For commercial use, you must purchase a license from
* https://iframe-resizer.com/pricing
*
* @description Keep same and cross domain iFrames sized to their content
*
* @author David J. Bradshaw <info@iframe-resizer.com>
*
* @see {@link https://iframe-resizer.com}
*
* @copyright (c) 2013 - 2026, David J. Bradshaw. All rights reserved.
*/
import e,{NORMAL as t,HIGHLIGHT as n,FOREGROUND as o,ITALIC as r,BOLD as a}from"auto-console-group";const i="5.5.9",s="iframeResizer",c=":",l="init",d="message",u="pageHide",m="pageInfo",f="parentInfo",p="scrollToOffset",h="title",y=10,g="data-iframe-size",b="data-iframe-overflowed",v="data-iframe-ignore",z="height",w="width",$="offset",S="offsetSize",O="string",E="number",M="object",j="function",k="auto",x="readystatechange",T="bottom",I="right",N="autoResizeEnabled",C=Symbol("sizeChanged"),P="manualResize",A="parentResize",R={[P]:1,[A]:1},B="setOffsetSize",L="resizeObserver",q="overflowObserver",D="mutationObserver",W="visibilityObserver",F="[iFrameSizer]",V=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),H=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)},U=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),Z=["spjluzl","rlf","clyzpvu"],J=["<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.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz."],_=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],Q=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl"].map((e,t)=>[e,Math.max(0,t-1)])),Y=e=>U(J[e]),G=e=>{const t=e[U(Z[0])]||e[U(Z[1])]||e[U(Z[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=H(U(e));return n in Q&&(t=Q[n]),t>4?t-4:t}(n[0]);return 0===o||(e=>e[2]===H(e[0]+e[1]))(n)||(o=-2),o},X=(e,...t)=>setTimeout(()=>e(...t),0),K=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},ee=e=>e,te=e=>Math.round(1e3*e)/1e3,ne=e=>e.charAt(0).toUpperCase()+e.slice(1),oe=e=>""!=`${e}`&&void 0!==e,re=e=>e();const ae=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${ne(t)}`)},ie={br:"\n",rb:"[31;1m",bb:"[34;1m",b:"[1m",i:"[3m",u:"[4m","/":"[m"},se=Object.keys(ie),ce=new RegExp(`<(${se.join("|")})>`,"gi"),le=(e,t)=>ie[t]??"";let de=!0,ue=s;var me;const fe=(me=e,me?.__esModule?me.default:me)({label:`${s}(child)`,expand:!1});var pe;const he=(pe="log",(...e)=>!de||fe[pe](...e));const{assert:ye,endAutoGroup:ge,error:be,errorBoundary:ve,event:ze,label:we,purge:$e,warn:Se}=fe,Oe=(Ee=ee,e=>Ee(typeof e===O?window.chrome?e.replace(ce,le):(e=>e.replaceAll("<br>","\n").replaceAll(/<\/?[^>]+>/gi,""))(e):e));var Ee;const Me=(...e)=>fe.warn(...e.map(Oe)),je=(e=>(t,n="renamed to")=>(o,r,a="",i="")=>e(i,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${a}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>Me(t)),ke=je("Method"),xe=je("Method","replaced with"),Te=je("Option"),Ie=["min-height","min-width","max-height","max-width"],Ne=new Set,Ce=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),Pe=(e,t)=>{return(n=Ce(e,t))&&"0px"!==n&&n!==k&&"none"!==n;var n};function Ae({href:e}){Ne.has(e)||Ne.add(e)}const Re=(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){Ae(n)}return{source:"cross-origin stylesheet",value:Ce(e,t)}}(e,t),Be=(e,t)=>{const{source:n,value:o}=Re(e,t),r=(e=>e.tagName?e.tagName.toLowerCase():"unknown")(e);Me(`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 Le(){for(const e of[document.documentElement,document.body])for(const t of Ie)Pe(e,t)&&Be(e,t)}const qe=e=>t=>void 0===t?void 0:e(t),De=qe(e=>"true"===e),We=qe(Number),Fe=[],Ve=(e,t,n,o)=>{e.removeEventListener(t,n,o)},He=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Fe.push(()=>Ve(e,t,n,o))},Ue=e=>e=>{e.size},Ze=((e="")=>t=>n=>{n.size>0&&be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Je=e=>e=>{e.size},_e=(e,o=!0)=>r=>{r>0&&he(`${o?"At":"De"}tached %c${e}Observer%c ${o?"to":"from"} %c${r}%c element${1===r?"":"s"}`,n,t,n,t)},Qe=(e,t,n,o)=>{const r=Je(e);return e=>{const a=new Set;let i=0;for(const o of e)n.has(o)&&(t.unobserve(o),n.delete(o),a.add(o),i+=1);r(a),o(i),a.clear()}},Ye=new Set,Ge=new Set,Xe=new Set,Ke=[],et={attributes:!0,attributeFilter:[v,g],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let tt,nt=1,ot=!1,rt=0;const at=e=>{e.size},it=e=>{e.size},st=e=>{e.size},ct=e=>e.nodeType!==Node.ELEMENT_NODE||V.has(e.tagName.toLowerCase());function lt(e){const t=e.addedNodes;for(const e of t)ct(e)||Ye.add(e)}function dt(e){const t=e.removedNodes;for(const e of t)ct(e)||(Ye.has(e)?(Ye.delete(e),Xe.add(e)):Ge.add(e))}const ut=e=>{he("Mutations:",e);for(const t of e)lt(t),dt(t);at(Ye),it(Ge),st(Xe),Xe.clear()};const mt=e=>()=>{const t=performance.now(),r=t-rt,a=16*nt+++2;if(r>a&&r<200)return ze("mutationThrottled"),he("Update delayed due to heavy workload on the callStack"),he(`EventLoop busy time: %c${te(r)}ms %c> Max wait: %c${a-2}ms`,n,o,n),setTimeout(tt,16*nt),void(rt=t);nt=1,Ke.forEach(ut),Ke.length=0,ot=!1,Ge.size,Ye.size,e({addedNodes:Ye,removedNodes:Ge}),Ye.clear(),Ge.clear()};function ft(e){Ke.push(e),ot||(rt=performance.now(),ot=!0,requestAnimationFrame(tt))}function pt(e){const t=new window.MutationObserver(ft),r=document.body||document.documentElement;return tt=mt(e),t.observe(r,et),he("Attached%c MutationObserver%c to body",n,o),{...t,disconnect:()=>{Ye.clear(),Ge.clear(),Ke.length=0,t.disconnect(),he("Detached%c MutationObserver",n)}}}const ht="Overflow",yt=_e(ht),gt=_e(ht,!1),bt=Ue(ht),vt=Ze(ht),zt=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,wt=(e,t)=>{const o=t.side,r={root:t.root,rootMargin:"0px",threshold:1},a=window?.requestAnimationFrame||ee,i=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[o],c=(e,t)=>e.toggleAttribute(b,t);const l=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:n,target:r}=t;if(!n)continue;const a=e[o],i=s(a,n)&&!zt(r);c(r,i)}a(i)},r),d=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&&(d.has(r)?t.add(r):(l.observe(r),d.add(r),n.add(r),o+=1));vt(t),bt(n),yt(o),n.clear(),t.clear()},detachObservers:Qe(ht,l,d,gt),disconnect:()=>{l.disconnect(),he("Detached%c OverflowObserver",n)}}},$t="--ifr-start",St="--ifr-end",Ot="--ifr-measure",Et=[];let Mt,jt={},kt=0;function xt(){try{performance.clearMarks($t),performance.clearMarks(St),performance.clearMeasures(Ot)}catch{}}function Tt(e){e.getEntries().forEach(e=>{if(e.name===St)try{const{duration:t}=performance.measure(Ot,$t,St);jt=e.detail,Et.push(t),Et.length>100&&Et.shift()}catch{}})}function It(){he("Attached%c PerformanceObserver%c to page",n,o);const e=new PerformanceObserver(Tt);return e.observe({entryTypes:["mark"]}),Mt=setInterval(()=>{if(Et.length<10)return;if(jt.hasTags&&jt.len<25)return;Et.sort();const e=Math.min(Et.reduce((e,t)=>e+t,0)/Et.length,Et[Math.floor(Et.length/2)]),t=te(e);t>kt&&(kt=t,ze("performanceObserver")),xt(),e<=4||(clearInterval(Mt),Me(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${te(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${jt.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{xt(),clearInterval(Mt),e.disconnect(),he("Detached%c PerformanceObserver",n)}}}const Nt="Resize",Ct=_e(Nt),Pt=_e(Nt,!1),At=Ue(Nt),Rt=Ze(Nt),Bt=new WeakSet,Lt=new Set,qt=new Set;let Dt;function Wt(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&(Bt.has(n)?Lt.add(n):(Dt.observe(n),Bt.add(n),qt.add(n),t+=1))}Rt(Lt),At(qt),Ct(t),qt.clear(),Lt.clear()}function Ft(e){const t=new IntersectionObserver(t=>e(t.at(-1).isIntersecting),{threshold:0}),r=document.documentElement;return t.observe(r),he("Attached%c VisibilityObserver%c to page",n,o),{disconnect:()=>{t.disconnect(),he("Detached%c VisibilityObserver",n)}}}const Vt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ht=Vt(j),Ut=Vt(E),Zt=Vt(O);"undefined"!=typeof window&&function(){const e={height:()=>(Se("Custom height calculation function not defined"),Cn.auto()),width:()=>(Se("Custom width calculation function not defined"),Pn.auto())},H={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},J={},Q=k,te="scroll";let ie,se,ce,le,me,pe,Oe,Ee=!0,je="",Ie=0,Ne="",Ce="",Pe=!1,Ae=!0,Re=!1,Be=!0,qe=!1,Ue=!1,Ze=!0,Je=!1,_e=1,Ye=Q,Ge="",Xe=!0,Ke={},et=!1,tt=!1,nt=!1,ot=0,rt=!1,at=0,it=0,st=new Set,ct="",lt="child",dt=!1,ut="",mt=[],ft=window.parent,ht="*",yt=0,gt=!1,bt=1,vt=te,zt=window,Ot=()=>{Se("onMessage function not defined")},Et=()=>{},Mt=null,jt=null;function kt(t){var o;!function(e){ct=e[0]??ct,Ie=We(e[1])??Ie,Re=De(e[2])??Re,nt=De(e[3])??nt,Ee=De(e[6])??Ee,Ne=e[7]??Ne,Ye=e[8]??Ye,je=e[9]??je,Ce=e[10]??Ce,yt=We(e[11])??yt,Ke.enable=De(e[12])??!1,lt=e[13]??lt,vt=e[14]??vt,rt=De(e[15])??rt,at=We(e[16])??at,it=We(e[17])??it,Ae=De(e[18])??Ae,ie=e[19]??ie,pe=e[20]??pe,ot=We(e[21])??ot,tt=De(e[23])??tt}(t),ue=(o={id:ct,enabled:nt,expand:tt}).id||s,fe.label(`${ue}`),fe.expand(o.expand),de=o.enabled,ze("initReceived"),function(){function t(e){Oe=Ht(e,"onBeforeResize")??Oe,Ot=Ht(e,"onMessage")??Ot,Et=Ht(e,"onReady")??Et,typeof e?.offset===E&&(Te($,S),Ae&&(at=Ut(e,$)??at),Re&&(it=Ut(e,$)??it)),typeof e?.offsetSize===E&&(Ae&&(at=Ut(e,S)??at),Re&&(it=Ut(e,S)??it)),se=Zt(e,U(Z[0]))??se,Ge=Zt(e,"ignoreSelector")??Ge,ut=Zt(e,"sizeSelector")??ut,ht=Zt(e,"targetOrigin")??ht,Ye=e?.heightCalculationMethod||Ye,vt=e?.widthCalculationMethod||vt}function o(t,n){return typeof t===j&&(Me(`<rb>Deprecated Option(${n}CalculationMethod)</>\n\nThe use of <b>${n}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.`),e[n]=t,t="custom"),t}if(1===ot)return;const r=window.iframeResizer||window.iFrameResizer;typeof r===M&&(t(r),Ye=o(Ye,z),vt=o(vt,w),he(`Set targetOrigin for parent: %c${ht}`,n))}(),[Jt,Qt,sn,qt,_t,rn,an,nn,Vt,Rt,Pe?ee:Le,Kt,()=>Yt("background",je),()=>Yt("padding",Ce),Pe?ee:en,ln,Xt,On,dn,cn,un,Tt,mn].forEach(e=>{try{e()}catch(e){if(ot<0)throw e;Me("<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</>"),be(e)}}),At(K(Et)),ge(),Wn(l,"Init message from host page",void 0,void 0,`${i}:${ot}`),document.title&&""!==document.title&&Hn(0,0,h,document.title)}function xt({persisted:e}){e||Hn(0,0,"beforeUnload"),ze(u),he("Page persisted:",e),e||Fe.forEach(re)}const Tt=()=>He(window,u.toLowerCase(),xt);let Ct=!1;function At(e){"complete"===document.readyState?X(e):Ct||He(document,x,()=>At(e)),Ct=!0}function Rt(){mt=document.querySelectorAll(`[${g}]`),Je=mt.length>0}let Lt=0;function qt(){const e=document.querySelectorAll(`*[${v}]`);return qe=e.length>0,qe&&e.length!==Lt&&(function(e){const n=1===e.length?"":"s";Se(`%c[${v}]%c found on %c${e.length}%c element${n}`,a,t,a,t)}(e),Lt=e.length),qe}function Vt(){"BackCompat"===document.compatMode&&Me("<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 Jt(){pe&&""!==pe&&"false"!==pe?pe!==i&&Me(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${pe} - Child page: ${i}.\n`):Me("<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 _t(){try{dt=1===ot||"iframeParentListener"in window.parent}catch(e){}}function Qt(){Re===Ae&&(Pe=!0)}function Yt(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),he(`Set body ${e}: %c${t}`,n))}function Gt(e,t,n){if(""!==n)for(const e of document.querySelectorAll(n))e.toggleAttribute(t,!0)}function Xt(){Gt(0,g,ut),Gt(0,v,Ge)}function Kt(){var e,t;void 0===Ne&&(Ne=`${Ie}px`),Yt("margin",(e="margin",(t=Ne).includes("-")&&(Se(`Negative CSS value ignored for ${e}`),t=""),t))}function en(){const e=e=>e.style.setProperty(z,k,"important");e(document.documentElement),e(document.body)}function tn(e){({add(t){function n(){Wn(e.eventName,e.eventType)}J[t]=n,He(window,t,n,{passive:!0})},remove(e){const t=J[e];delete J[e],Ve(window,e,t)}})[e.method](e.eventName)}function nn(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&Me("<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 on(e,t,n){const{label:o}=n;return t!==e&&(e in n||(Se(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in H)&&Me(`<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 ${pe?"remove this option.":`set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page. This can be done on the child page by adding the following code:\n\nwindow.iframeResizer = {\n license: 'xxxx',\n ${o}CalculationMethod: '${k}',\n}\n`}\n`),e}function rn(){Ye=on(Ye,Q,Cn)}function an(){vt=on(vt,te,Pn)}function sn(){const e=ot,n=G({key:ie}),o=G({key:se});if(ot=Math.max(n,o),ot<0){if(ot=Math.min(n,o),$e(),Me(`${Y(ot+2)}${Y(2)}`),oe(pe))throw Y(ot+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!oe(pe)||e>-1&&ot>e)&&(sessionStorage.getItem("ifr")!==i&&function(e,n){console.info(`${ue} %ciframe-resizer ${e}`,de||n<1?"font-weight: bold;":t)}(`v${i} (${(e=>U(_[e]))(ot)})`,ot),ot<2&&Me(Y(3)),sessionStorage.setItem("ifr",i))}function cn(){!function(e){tn({method:e,eventType:"After Print",eventName:"afterprint"}),tn({method:e,eventType:"Before Print",eventName:"beforeprint"})}("add")}function ln(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function dn(){function e(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,y)+parseInt(n.x,y),y:parseInt(t.top,y)+parseInt(n.y,y)}}function t(t){const n=t.split("#")[1]||t,o=decodeURIComponent(n),r=document.getElementById(o)||document.getElementsByName(o)[0];void 0===r?Hn(0,0,"inPageLink",`#${n}`):function(t){const n=e(t);Hn(n.y,n.x,p)}(r)}function n(){const{hash:e,href:n}=window.location;""!==e&&"#"!==e&&t(n)}const{enable:o}=Ke;o&&(1===ot?Me(Y(5)):(function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&He(e,"click",n=>{n.preventDefault(),t(e.getAttribute("href"))})}(),He(window,"hashchange",n),setTimeout(n,128))),Ke={...Ke,findTarget:t}}function un(){function e(e){Hn(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){He(window.document,t,e)}!0===rt&&(t("mouseenter"),t("mouseleave"))}function mn(){1!==ot&&(zt.parentIframe=Object.freeze({autoResize:e=>(ae(e,"boolean","parentIframe.autoResize(enable) enable"),!1===Re&&!1===Ae?(ze(N),Me("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===Ee?(Ee=!0,queueMicrotask(()=>Wn(N,"Auto Resize enabled"))):!1===e&&!0===Ee&&(Ee=!1),Hn(0,0,"autoResize",JSON.stringify(Ee)),Ee)),close(){Hn(0,0,"close")},getId:()=>ct,getOrigin:()=>(ze("getOrigin"),ke("getOrigin()","getParentOrigin()"),ce),getParentOrigin:()=>ce,getPageInfo(e){if(typeof e===j)return Mt=e,Hn(0,0,m),void xe("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Mt=null,Hn(0,0,"pageInfoStop")},getParentProps:e=>(ae(e,j,"parentIframe.getParentProps(callback) callback"),jt=e,Hn(0,0,f),()=>{jt=null,Hn(0,0,"parentInfoStop")}),getParentProperties(e){ke("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){ae(e,O,"parentIframe.moveToAnchor(anchor) anchor"),Ke.findTarget(e)},reset(){!function(){const e=Ye;Ye=Q,gt||(gt=!0,requestAnimationFrame(()=>{gt=!1})),Fn("reset"),Ye=e}()},setOffsetSize(e){ae(e,E,"parentIframe.setOffsetSize(offset) offset"),at=e,it=e,Wn(B,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){ae(e,E,"parentIframe.scrollBy(x, y) x"),ae(t,E,"parentIframe.scrollBy(x, y) y"),Hn(t,e,"scrollBy")},scrollTo(e,t){ae(e,E,"parentIframe.scrollTo(x, y) x"),ae(t,E,"parentIframe.scrollTo(x, y) y"),Hn(t,e,"scrollTo")},scrollToOffset(e,t){ae(e,E,"parentIframe.scrollToOffset(x, y) x"),ae(t,E,"parentIframe.scrollToOffset(x, y) y"),Hn(t,e,p)},sendMessage(e,t){t&&ae(t,O,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Hn(0,0,d,JSON.stringify(e),t)},setHeightCalculationMethod(e){Ye=e,rn()},setWidthCalculationMethod(e){vt=e,an()},setTargetOrigin(e){ae(e,O,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),ht=e},resize(e,t){void 0!==e&&ae(e,E,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&ae(t,E,"parentIframe.resize(customHeight, customWidth) customWidth"),Wn(P,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ke("size()","resize()"),this.resize(e,t)}}),zt.parentIFrame=zt.parentIframe)}let fn=new Set;function pn(){const e=document.querySelectorAll(`[${b}]`);st=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${v}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{ze("overflowIgnored"),he("Ignoring elements with [data-iframe-ignore] > *:\n",n),ge()}),t}(e),Ue=st.size>0,typeof Set.prototype.symmetricDifference===j&&(Ze=st.symmetricDifference(fn).size>0),fn=st}function hn(){switch(pn(),!0){case!Ze:return;case st.size>1:he("Overflowed Elements:",st);break;case Ue:break;default:he("No overflow detected")}Wn(q,"Overflow updated")}function yn(e){const t={root:document.documentElement,side:Ae?T:I};return le=wt(hn,t),le.attachObservers(e),le}function gn(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Wn(L,`Element resized <${function(e){switch(!0){case!oe(e):return"";case oe(e.id):return`${e.nodeName}#${e.id}`;case oe(e.name):return`${e.nodeName} (${e.name}`;case oe(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function bn(e){return Dt=new ResizeObserver(gn),Dt.observe(document.body),Bt.add(document.body),he("Attached%c ResizeObserver%c to body",n,o),me={attachObserverToNonStaticElements:Wt,detachObservers:Qe(Nt,Dt,Bt,Pt),disconnect:()=>{Dt.disconnect(),he("Detached%c ResizeObserver",n)}},me.attachObserverToNonStaticElements(e),me}function vn(e){et=!e,Wn(W,"Visibility changed")}const zn=e=>{const t=new Set;for(const n of e){t.add(n);for(const e of kn(n))t.add(e)}return he("Inspecting:\n",t),t},wn=e=>{if(0===e.size)return;ze("addObservers");const t=zn(e);le.attachObservers(t),me.attachObserverToNonStaticElements(t),ge()},$n=e=>{if(0===e.size)return;ze("removeObservers");const t=zn(e);le.detachObservers(t),me.detachObservers(t),ge()};function Sn(e){!function({addedNodes:e,removedNodes:t}){ze("contentMutated"),Xt(),Rt(),pn(),ge(),$n(t),wn(e)}(e),Wn(D,"Mutation Observed")}function On(){const e=kn(document.documentElement);var t;t=[pt(Sn),yn(e),It(),bn(e),Ft(vn)],Fe.push(...t.map(e=>e.disconnect))}function En(e){performance.mark($t);const t=ne(e);let r=1,a=document.documentElement,i=Je?0:document.documentElement.getBoundingClientRect().bottom;const s=Je?mt:Ue?Array.from(st):kn(document.documentElement);for(const t of s)r=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),r>i&&(i=r,a=t);return he(`${t} position calculated from:`,a),he(`Checked %c${s.length}%c elements`,n,o),performance.mark(St,{detail:{hasTags:Je,len:s.length,logging:nt,Side:t}}),i}const Mn=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],jn=`* ${Array.from(V).map(e=>`:not(${e})`).join("")}`,kn=e=>e.querySelectorAll(jn),xn={height:0,width:0},Tn={height:0,width:0},In=[n,o,n];function Nn(e){function t(){return Tn[r]=a,xn[r]=c,Math.max(a,1)}const o=e===Cn,r=e.label,a=e.boundingClientRect(),i=Math.ceil(a),s=Math.floor(a),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${a}px %cPage: %c${c}px`;let d=1;switch(!0){case!e.enabled():return Math.max(c,1);case Je:he("Found element with data-iframe-size attribute"),d=e.taggedElement();break;case!Ue&&Be&&0===Tn[r]&&0===xn[r]:he(`Initial page size values: ${l}`,...In),d=t();break;case gt&&a===Tn[r]&&c===xn[r]:he(`Size unchanged: ${l}`,...In),d=Math.max(a,c);break;case 0===a&&0!==c:he(`Page is hidden: ${l}`,...In),d=c;break;case!Ue&&a!==Tn[r]&&c<=xn[r]:he(`New <html> size: ${l} `,...In),he(`Previous <html> size: %c${Tn[r]}px`,n),d=t();break;case!o:d=e.taggedElement();break;case!Ue&&a<Tn[r]:he(`<html> size decreased: ${l}`,...In),d=t();break;case c===s||c===i:he(`<html> size equals page size: ${l}`,...In),d=t();break;case a>c:he(`Page size < <html> size: ${l}`,...In),d=t();break;case Ue:he("Found elements possibly overflowing <html> "),d=e.taggedElement();break;default:he(`Using <html> size: ${l}`,...In),d=t()}return he(`Content ${r}: %c${d}px`,n),d+=function(e){const t=e.getOffset();return 0!==t&&he(`Page offsetSize: %c${t}px`,n),t}(e),Math.max(d,1)}const Cn={label:z,enabled:()=>Ae,getOffset:()=>at,auto:()=>Nn(Cn),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,y)+parseInt(t.marginBottom,y)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Cn.bodyOffset(),custom:()=>e.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Mn(Cn)),min:()=>Math.min(...Mn(Cn)),grow:()=>Cn.max(),lowestElement:()=>En(T),taggedElement:()=>En(T)},Pn={label:w,enabled:()=>Re,getOffset:()=>it,auto:()=>Nn(Pn),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>e.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Mn(Pn)),min:()=>Math.min(...Mn(Pn)),rightMostElement:()=>En(I),scroll:()=>Math.max(Pn.bodyScroll(),Pn.documentElementScroll()),taggedElement:()=>En(I)},An=(e,t)=>!(Math.abs(e-t)<=yt);function Rn(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 ye(o>=1,`New iframe ${e.label} is too small: ${o}, must be at least 1`),o}let Bn=!1;const Ln=K(()=>Me(Y(4)));let qn,Dn=!1;const Wn=ve((e,t,n,o,r)=>{switch(ze(e),!0){case!0===et:if(!0===Dn)break;Dn=!0,Bn=!1,cancelAnimationFrame(qn),qn=null;break;case!0===Bn&&e!==q:$e();break;case!Ee&&!(e in R):he("Resizing disabled");break;default:Dn=!1,Bn=!0,performance.now(),qn||(qn=requestAnimationFrame(()=>{Bn=!1,qn=null,ze("requestAnimationFrame")})),function(e,t,n,o,r){const a=n??Rn(Cn,Ye),i=o??Rn(Pn,vt);switch(Ae&&An(_e,a)||Re&&An(bt,i)?C:e){case l:case N:case C:_e=a,bt=i;case B:Vn(_e,bt,e,r);break;case q:case D:case L:case W:$e();break;default:$e(),he("No change in content size detected")}}(e,0,n,o,r)}ge()});function Fn(e){_e=Cn[Ye](),bt=Pn[vt](),Hn(_e,bt,e)}function Vn(e,t,o,a,i){ot<-1||(void 0!==i||(i=ht),function(){const s=`${ct}:${e}:${t}:${o}${void 0===a?"":`:${a}`}`;if(dt)try{window.parent.iframeParentListener(F+s)}catch(e){if(1!==ot)throw e;return void Ln()}else ft.postMessage(F+s,i);he(`Sending message to parent page via ${dt?"sameOrigin":"postMessage"}: %c%c${s}`,r,n)}())}const Hn=ve((e,t,n,o,r)=>{ze(n),Vn(e,t,n,o,r),ge()}),Un=ve(function(e){ze("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>Hn(0,0,`${e}Stop`),r={init:function(){if("loading"===document.readyState)return;const t=e.data.slice(13).split(c);ft=e.source,ce=e.origin,kt(t),Be=!1,setTimeout(()=>{Xe=!1},128)},reset(){Xe||Fn("resetPage")},resize(){Wn(A,"Parent window requested size check")},moveToAnchor(){Ke.findTarget(i())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=i();Mt?X(Mt,n(e)):o(m)},parentInfo(){const e=(r=i(),t(n(r)));var r;jt?X(jt,e):o(f)},message(){const e=i();X(Ot,n(e))}},a=()=>e.data.split("]")[1].split(c)[0],i=()=>e.data.slice(e.data.indexOf(c)+1),s=()=>e.data.split(c)[2]in{true:1,false:1};function d(){const t=a();ze(t),t in r?r[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||s()||Se(`Unexpected message (${e.data})`)}F===`${e.data}`.slice(0,13)&&function(){if(!1!==Be)return s()?(we(a()),ze(l),void r.init()):void 0;d()}()});let Zn=!1;const Jn=e=>e.postMessage("[iFrameResizerChild]Ready",window?.iframeResizer?.targetOrigin||"*");function _n(){if("loading"===document.readyState||!Be||Zn)return;const{parent:e,top:t}=window;ze("ready"),Jn(e),e!==t&&Jn(t),Zn=!0}"iframeChildListener"in window?Se("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>Un({data:e,sameOrigin:!0})),ze("listen"),He(window,d,Un),He(document,x,_n),_n())}();