UNPKG

iframe-resizer

Version:

Keep iframes sized to their content.

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