UNPKG

iframe-resizer

Version:

Keep iframes sized to their content.

21 lines (18 loc) 23.8 kB
/*! * @preserve * * @module iframe-resizer/legacy (child) 5.4.4 (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 - 2025, 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:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},l={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:s,keys:c}=Object,u=e=>[e,console[e]],d=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>s(c(e).map(t));const f=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,p=f?"color: #A9C7FB;":"color: #135CD2;",h=f?"color: #E3E3E3;":"color: #1F1F1F;",g="5.4.4",y=10,b="data-iframe-size",v="data-iframe-overflowed",z="data-iframe-ignore",w="bottom",$="right",S="resizeParent",O="setOffsetSize",E="resizeObserver",j="overflowObserver",k="mutationObserver",M=(e,t,n,o)=>e.addEventListener(t,n,o||!1),P=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const T=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(P[e]),A=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},C=e=>e,I=e=>Math.round(1e3*e)/1e3,x=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>""!=`${e}`&&void 0!==e;const R=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${x(t)}`)};let q=!0;const B=(L=function(n={}){const s={},c={},f=[],p={...a,expand:!n.collapsed||a.expanded,...n};let h;function g(){f.length=0}function y(){delete p.event,g()}const b=()=>!!f.some((([e])=>e in i))||!!p.expand;function v(){if(0!==f.length){console[b()?"group":"groupCollapsed"](`%c${p.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(p)} %c${p.showTime?h:""}`,e,t,o);for(const[e,...t]of f)console[e](...t);console.groupEnd(),y()}else y()}function z(){h=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(v)))}function w(e,...t){0===f.length&&z(),f.push([e,...t])}function $(e=r,...t){w("log",`${e}: ${performance.now()-s[e]} ms`,...t)}return{...m(p,d(p)),...m(console,(e=>[e,(...t)=>w(e,...t)])),...m(l,u),count:function(e=r){c[e]?c[e]+=1:c[e]=1,w("log",`${e}: ${c[e]}`)},countReset:function(e=r){delete c[e]},endAutoGroup:v,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;w("error",e)}return n},purge:g,time:function(e=r){s[e]=performance.now()},timeEnd:function(e=r){$(e),delete s[e]},timeLog:$}},L?.__esModule?L.default:L);var L;const F=B({label:"iframeResizer(child)"});var W;const D=(W="log",(...e)=>!q||F[W](...e)),{assert:H,debug:V,endAutoGroup:U,error:Z,errorBoundary:J,event:_,purge:Q,warn:G}=F,X=e=>{return F.warn((t=C,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},Y=X,K=(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)=>X(t))),ee=K("Method"),te=K("Method","replaced with"),ne=K("Option"),oe="--ifr-start",re="--ifr-end",ie=[],ae=new WeakSet,le=e=>"object"==typeof e&&ae.add(e);let se={},ce=0;const ue=setInterval((()=>{if(ie.length<10)return;if(se.hasTags&&se.len<25)return;ie.sort();const e=Math.min(ie.reduce(((e,t)=>e+t),0)/ie.length,ie[Math.floor(ie.length/2)]),t=I(e);t>ce&&(ce=t,_("performanceObserver")),e<=4||(clearInterval(ue),X(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${I(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${se.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function de(e){e.getEntries().forEach((e=>{if(e.name===re){const{duration:t}=performance.measure("--ifr-measure",oe,re);se=e.detail,ie.push(t),ie.length>100&&ie.shift()}}))}function me(){new PerformanceObserver(de).observe({entryTypes:["mark"]}),le(document.documentElement),le(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",me):me()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},r={height:()=>(G("Custom height calculation function not defined"),mt.auto()),width:()=>(G("Custom width calculation function not defined"),ft.auto())},i={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},l="checkVisibility"in window,s="auto",c="[iFrameSizer]",u={max:1,min:1,bodyScroll:1,documentElementScroll:1},d="scroll";let m,f,P,B,L,W=!0,V="",Z=0,K="",ie="",ae=!0,le=!1,se=!0,ce=!1,ue=!1,de=!1,me=1,fe=s,pe="",he=!0,ge="",ye={},be=!0,ve=!1,ze=0,we=!1,$e="",Se=C,Oe=[],Ee="child",je=null,ke=!1,Me="",Pe=[],Te=window.parent,Ae="*",Ce=0,Ie=!1,xe="",Ne=1,Re=d,qe=window,Be=()=>{G("onMessage function not defined")},Le=()=>{},Fe=null,We=null;function De(){var e,t,n;!function(){const e=e=>"true"===e,t=ge.slice(13).split(":");$e=t[0],Z=void 0===t[1]?Z:Number(t[1]),le=void 0===t[2]?le:e(t[2]),ve=void 0===t[3]?ve:e(t[3]),W=void 0===t[6]?W:e(t[6]),K=t[7],fe=void 0===t[8]?fe:t[8],V=t[9],ie=t[10],Ce=void 0===t[11]?Ce:Number(t[11]),ye.enable=void 0!==t[12]&&e(t[12]),Ee=void 0===t[13]?Ee:t[13],Re=void 0===t[14]?Re:t[14],we=void 0===t[15]?we:e(t[15]),m=void 0===t[16]?m:Number(t[16]),f=void 0===t[17]?f:Number(t[17]),ae=void 0===t[18]?ae:e(t[18]),t[19],xe=t[20]||xe,ze=void 0===t[21]?ze:Number(t[21]),be=void 0===t[23]?be:e(t[23])}(),e={id:$e,enabled:ve,expand:be},F.label(`${e.id}`),F.expand(e.expand),q=e.enabled,function(){function e(e){Be=e?.onMessage||Be,Le=e?.onReady||Le,"number"==typeof e?.offset&&(ne("offset","offsetSize"),ae&&(m=e?.offset),le&&(f=e?.offset)),"number"==typeof e?.offsetSize&&(ae&&(m=e?.offsetSize),le&&(f=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Me=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(pe=e.ignoreSelector),Ae=e?.targetOrigin||Ae,fe=e?.heightCalculationMethod||fe,Re=e?.widthCalculationMethod||Re}function t(e,t){return"function"==typeof e&&(r[t]=e,e="custom"),e}if(1===ze)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),fe=t(fe,"height"),Re=t(Re,"width"),D(`Set targetOrigin for parent: %c${Ae}`,p))}(),Xe(),function(){try{ke=1===ze||"iframeParentListener"in window.parent}catch(e){}}(),ze<0?Y(`${T(ze+2)}${T(2)}`):xe.codePointAt(0)>4||ze<2&&Y(T(3)),xe&&""!==xe&&"false"!==xe?xe!==g&&X(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${xe} - Child page: ${g}.\n`):X("<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"),et(),tt(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(b,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&X("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),"BackCompat"===document.compatMode&&X("<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"),Ue(),1!==ze&&(qe.parentIframe=Object.freeze({autoResize:e=>(R(e,"bool","parentIframe.autoResize(enable) enable"),!0===e&&!1===W?(W=!0,bt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===W&&(W=!1),wt(0,0,"autoResize",JSON.stringify(W)),W),close(){wt(0,0,"close")},getId:()=>$e,getOrigin:()=>(ee("getOrigin()","getParentOrigin()"),P),getParentOrigin:()=>P,getPageInfo(e){if("function"==typeof e)return Fe=e,wt(0,0,"pageInfo"),void te("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Fe=null,wt(0,0,"pageInfoStop")},getParentProps:e=>(R(e,"function","parentIframe.getParentProps(callback) callback"),We=e,wt(0,0,"parentInfo"),()=>{We=null,wt(0,0,"parentInfoStop")}),getParentProperties(e){ee("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){R(e,"string","parentIframe.moveToAnchor(anchor) anchor"),ye.findTarget(e)},reset(){zt()},setOffsetSize(e){R(e,"number","parentIframe.setOffsetSize(offset) offset"),m=e,f=e,bt(O,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){R(e,"number","parentIframe.scrollBy(x, y) x"),R(t,"number","parentIframe.scrollBy(x, y) y"),wt(t,e,"scrollBy")},scrollTo(e,t){R(e,"number","parentIframe.scrollTo(x, y) x"),R(t,"number","parentIframe.scrollTo(x, y) y"),wt(t,e,"scrollTo")},scrollToOffset(e,t){R(e,"number","parentIframe.scrollToOffset(x, y) x"),R(t,"number","parentIframe.scrollToOffset(x, y) y"),wt(t,e,"scrollToOffset")},sendMessage(e,t){t&&R(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),wt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){fe=e,et()},setWidthCalculationMethod(e){Re=e,tt()},setTargetOrigin(e){R(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),Ae=e},resize(e,t){e&&R(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&R(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),bt("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ee("size()","resize()"),this.resize(e,t)}}),qe.parentIFrame=qe.parentIframe),function(){function e(e){wt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){M(window.document,t,e)}!0===we&&(t("mouseenter"),t("mouseleave"))}(),ye=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,y)+parseInt(o.x,y),y:parseInt(n.top,y)+parseInt(o.y,y)}}function n(e){function n(e){const n=t(e);wt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?wt(0,0,"inPageLink",`#${o}`):n(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&M(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function i(){M(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){r(),i(),a()}return ye.enable&&(1===ze?X("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l()),{findTarget:n}}(),void 0===K&&(K=`${Z}px`),Qe("margin",(t="margin",(n=K).includes("-")&&(G(`Negative CSS value ignored for ${t}`),n=""),n)),Qe("background",V),Qe("padding",ie),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body)}(),function(e){Ye({method:e,eventType:"After Print",eventName:"afterprint"}),Ye({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ye({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const r=t=>{for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},i=16,a=2,l=200;let s=1;function c(e){Xe(),Ze(e),e.forEach(rt),e.clear()}function u(){_("mutationObserver");const d=performance.now(),m=d-o;if(m>i*s+++a&&m<l)return setTimeout(u,i*s),void(o=d);s=1,t.forEach(r),t.length=0,e.size>0&&c(e),Ue(),He(),n=!1,bt(k,"Mutation Observed")}function d(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(u))}function m(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}m()}(),je=new ResizeObserver(nt),je.observe(document.body),ot.add(document.body),rt(document.body),ae!==le&&(Se=(e=>{const t=e.side||w,n=e.onChange||C,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||C,i=(e=!1)=>n(e),a=(e,n)=>0===e||e>n[t],l=(e,t)=>e.toggleAttribute(v,t),s=new IntersectionObserver((function(e){_("observation");for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,s=e[t],c=a(s,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);l(i,c)}var n;r(i)}),o),c=new WeakSet;return function(){const e=new window.MutationObserver((()=>{D("Detected changes in element attributes"),i(!0)})),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[z],subtree:!0};e.observe(t,n)}(),function(e){for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=c.has(t);!n&&e?(s.observe(t),c.add(t)):H(!n,"Node already observed",t)}}})({onChange:Ve,root:document.documentElement,side:ae?w:$})),Ze(lt(document)()),queueMicrotask(Le),bt("init","Init message from host page",void 0,void 0,g),document.title&&""!==document.title&&wt(0,0,"title",document.title)}function He(){Oe=document.querySelectorAll(`[${v}]:not([${z}]):not([${z}] *)`),ue=Oe.length>0}function Ve(e){He(),(ue||e)&&bt(j,"Overflow updated")}function Ue(){Pe=document.querySelectorAll(`[${b}]`),de=Pe.length>0}function Ze(e){de||Se(e)}let Je=0;function _e(){const n=document.querySelectorAll(`*[${z}]`);ce=n.length>0,ce&&n.length!==Je&&(function(n){const o=1===n.length?"":"s";G(`%c[${z}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),Je=n.length)}function Qe(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),D(`Set body ${e}: %c${t}`,p))}function Ge(e,t,n){if(""!==n)for(const e of document.querySelectorAll(n))e.toggleAttribute(t,!0)}function Xe(){Ge(0,b,Me),Ge(0,z,pe)}function Ye(e){({add(t){function n(){bt(e.eventName,e.eventType)}a[t]=n,M(window,t,n,{passive:!0})},remove(e){const t=a[e];var n,o;delete a[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function Ke(e,t,n,o){return t!==e&&(e in n||(G(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in i&&X(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`)),e}function et(){fe=Ke(fe,s,mt,"height")}function tt(){Re=Ke(Re,d,ft,"width")}function nt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;bt(E,`Element resized <${function(e){switch(!0){case!N(e):return"";case N(e.id):return`${e.nodeName}#${e.id}`;case N(e.name):return`${e.nodeName} (${e.name}`;case N(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}const ot=new WeakSet;function rt(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!ot.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(je.observe(e),ot.add(e))}const t=lt(e)();for(const e of t){if(ot.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(je.observe(e),ot.add(e))}}function it(e){performance.mark(oe);const t=x(e);let n=0,r=document.documentElement,i=de?0:document.documentElement.getBoundingClientRect().bottom;const a=de?Pe:ue?Oe:lt(document)();let s=a.length;for(const t of a)de||!l||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,r=t)):s-=1;return D(`${t} position calculated from:`,r),performance.mark(re,{detail:{Side:t,len:s,hasTags:de,logging:ve}}),i}const at=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],lt=e=>()=>{_e();const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return ce&&t.push(`not([${z}])`,`not([${z}] *)`),e.querySelectorAll(t.join(":"))},st={height:0,width:0},ct={height:0,width:0},ut=[p,h,p];function dt(e){function t(){return ct[o]=r,st[o]=l,r}const n=e===mt,o=n?"height":"width",r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${r}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case de:D("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ue&&0===ct[o]&&0===st[o]:D(`Initial page size values: ${s}`,...ut),c=t();break;case Ie&&r===ct[o]&&l===st[o]:D(`Size unchanged: ${s}`,...ut),c=Math.max(r,l);break;case 0===r:D(`Page is hidden: ${s}`,...ut),c=l;break;case!ue&&r!==ct[o]&&l<=st[o]:D(`New <html> size: ${s} `,...ut),D(`Previous <html> size: %c${ct[o]}px`,p),c=t();break;case!n:c=e.taggedElement();break;case!ue&&r<ct[o]:D(`<html> size decreased: ${s}`,...ut),c=t();break;case l===a||l===i:D(`<html> size equals page size: ${s}`,...ut),c=t();break;case r>l:D(`Page size < <html> size: ${s}`,...ut),c=t();break;case ue:D("Found element overflowing <html> "),c=e.taggedElement();break;default:D(`Using <html> size: ${s}`,...ut),c=t()}return D(`Content ${o}: %c${c}px`,p),c+=function(e){const t=e.getOffset();return 0!==t&&D(`Page offsetSize: %c${t}px`,p),t}(e),c}const mt={enabled:()=>ae,getOffset:()=>m,auto:()=>dt(mt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,y)+parseInt(t.marginBottom,y)},bodyScroll:()=>document.body.scrollHeight,offset:()=>mt.bodyOffset(),custom:()=>r.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...at(mt)),min:()=>Math.min(...at(mt)),grow:()=>mt.max(),lowestElement:()=>it(w),taggedElement:()=>it(w)},ft={enabled:()=>le,getOffset:()=>f,auto:()=>dt(ft),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>r.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...at(ft)),min:()=>Math.min(...at(ft)),rightMostElement:()=>it($),scroll:()=>Math.max(ft.bodyScroll(),ft.documentElementScroll()),taggedElement:()=>it($)},pt=(e,t)=>!(Math.abs(e-t)<=Ce);function ht(e,t,n,o,r){const i=void 0===n?mt[fe]():n,a=void 0===o?ft[Re]():o;switch(!0){case ae&&pt(me,i)||le&&pt(Ne,a)||"init"===e:me=i,Ne=a;case e===O:wt(me,Ne,e,r);break;case!e!==S&&(ae&&fe in u||le&&Re in u):zt();break;case e===E:case e===j:case e===k:Q();break;default:Q(),D("No change in content size detected")}B=!1}let gt=!1;const yt=A((()=>Y(T(4)))),bt=J(((e,t,n,o,r)=>{L=performance.now(),_(e),W||e===S?document.hidden||(gt||(B=!0,ht(e,0,n,o,r),requestAnimationFrame((()=>{gt=!1}))),gt=!0):D("Resizing disabled")}));function vt(e){me=mt[fe](),Ne=ft[Re](),wt(me,Ne,e)}function zt(e){const t=fe;fe=s,Ie||(Ie=!0,requestAnimationFrame((()=>{Ie=!1}))),vt("reset"),fe=t}const wt=J((function(e,t,o,r,i){ze<-1||(_(o),void 0!==i||(i=Ae),function(){const a=`${$e}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(ke)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==ze)throw e;return void yt()}else Te.postMessage(c+a,i);B&&D(function(){const e=I(performance.now()-L);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),p),D("Sending message to host page via "+(ke?"sameOrigin":"postMessage")),D(`%c${a}`,n)}(),U())})),$t=J((function(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>wt(0,0,`${e}Stop`),r={init:function(){ge=e.data,Te=e.source,P=e.origin,De(),se=!1,setTimeout((()=>{he=!1}),128)},reset(){he||vt("resetPage")},resize(){bt(S,"Parent window requested size check")},moveToAnchor(){ye.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();Fe?setTimeout((()=>Fe(n(e)))):o("pageInfo")},parentInfo(){const e=a();We?setTimeout((()=>We(t(n(e))))):o("parentInfo")},message(){const e=a();setTimeout((()=>Be(n(e))))}},i=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function s(){const t=i();t in r?r[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||G(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(_(i()),!1!==se?l()&&r.init():s())}));function St(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?G("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>$t({data:e,sameOrigin:!0}))),M(window,"message",$t),M(window,"readystatechange",St),St())}()}();