/*!
 *  @preserve
 *  
 *  @module      iframe-resizer/child 5.3.0 (umd) - 2024-09-04
 *
 *  @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 - 2024, David J. Bradshaw. All rights reserved.
 */


!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e="5.3.0",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a="resizeParent",l=(e,t,n,o)=>e.addEventListener(t,n,o||!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const c=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),d=e=>e,u=1e5,m=e=>Math.round(e*u)/u;let f="",p=!1;const h=e=>{f=e.id,p=e.logging},y=e=>""!=`${e}`&&void 0!==e;const g=(...e)=>[`[iframe-resizer][${f||"child"}]`,...e].join(" "),b=(...e)=>p&&console?.info(`[iframe-resizer][${f}]`,...e),v=(...e)=>console?.warn(g(...e)),w=(...e)=>console?.warn((e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(g)(...e)),z=e=>w(e);let S=[];const E=e=>{const t=e.side||i,n=e.onChange||d,r={root:document.documentElement,rootMargin:"0px",threshold:1},a=new WeakSet;function l(){S=document.querySelectorAll(`[${o}]`),n()}const s=new IntersectionObserver((function(e){e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[t]||e.boundingClientRect[t]>e.rootBounds[t])(e))})),requestAnimationFrame(l)}),r);return function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||a.has(t)||(s.observe(t),a.add(t))}},j=()=>S.length>0,C="--ifr-start",$="--ifr-end",T="--ifr-measure",M=[],P=new WeakSet,A=e=>"object"==typeof e&&P.add(e);let O=null,N=null,I={};const k=setInterval((()=>{if(M.length<10)return;if(I.hasTags&&I.len<25)return;M.sort();const e=Math.min(M.reduce(((e,t)=>e+t),0)/M.length,M[Math.floor(M.length/2)]);e<=4||(clearInterval(k),w(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${m(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${I.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function R(e){e.getEntries().forEach((e=>{if(e.name===$){const{duration:t}=performance.measure(T,C,$);!function(e,t){const{Side:n,len:o,hasTags:i,logging:r}=e;I=e,P.has(N)||O===N||i&&o<=1||(r||A(N),O=N,b(`\n${n} position calculated from:`,N,`\nParsed ${o} ${i?"tagged":"potentially overflowing"} elements in ${m(t)}ms`))}(e.detail,t),M.push(t),M.length>100&&M.shift()}}))}function x(){new PerformanceObserver(R).observe({entryTypes:["mark"]}),A(document.documentElement),A(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",x):x()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},s={height:()=>(v("Custom height calculation function not defined"),xe.auto()),width:()=>(v("Custom width calculation function not defined"),qe.auto())},u={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},f=128,p={},g="checkVisibility"in window,b="auto",T="[iFrameSizer]",M=T.length,P={max:1,min:1,bodyScroll:1,documentElementScroll:1},A="scroll";let O,I,k,R,x=!0,q="",L=0,B="",D="",W=!0,U=!1,F=!0,V=!1,J=1,H=b,Z=!0,_="",Q={},X=!1,Y=0,G=!1,K="",ee=d,te="child",ne=null,oe=!1,ie="",re=[],ae=window.parent,le="*",se=0,ce=!1,de="",ue=1,me=A,fe=window,pe=()=>{v("onMessage function not defined")},he=()=>{},ye=null,ge=null;function be(){var o,d,u;!function(){const e=e=>"true"===e,t=_.slice(M).split(":");K=t[0],L=void 0===t[1]?L:Number(t[1]),U=void 0===t[2]?U:e(t[2]),X=void 0===t[3]?X:e(t[3]),x=void 0===t[6]?x:e(t[6]),B=t[7],H=void 0===t[8]?H:t[8],q=t[9],D=t[10],se=void 0===t[11]?se:Number(t[11]),Q.enable=void 0!==t[12]&&e(t[12]),te=void 0===t[13]?te:t[13],me=void 0===t[14]?me:t[14],G=void 0===t[15]?G:e(t[15]),O=void 0===t[16]?O:Number(t[16]),I=void 0===t[17]?I:Number(t[17]),W=void 0===t[18]?W:e(t[18]),t[19],de=t[20]||de,Y=void 0===t[21]?Y:Number(t[21])}(),h({id:K,logging:X}),function(){function e(e){pe=e?.onMessage||pe,he=e?.onReady||he,"number"==typeof e?.offset&&(w("<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),W&&(O=e?.offset),U&&(I=e?.offset)),"number"==typeof e?.offsetSize&&(W&&(O=e?.offsetSize),U&&(I=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ie=e.sizeSelector),le=e?.targetOrigin||le,H=e?.heightCalculationMethod||H,me=e?.widthCalculationMethod||me}function t(e,t){return"function"==typeof e&&(s[t]=e,e="custom"),e}if(1===Y)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),H=t(H,"height"),me=t(me,"width"))}(),function(){try{oe="iframeParentListener"in window.parent}catch(e){}}(),Y<0?z(`${c(Y+2)}${c(2)}`):de.codePointAt(0)>4||Y<2&&z(c(3)),de&&""!==de&&"false"!==de?de!==e&&w(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${de} - Child page: ${e}.\n`):w("<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"),Ce(),$e(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&w("<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</>.")}(),ve(),W!==U&&(ee=E({onChange:()=>De("overflowChanged","Overflow updated"),side:W?i:r})),1!==Y&&(fe.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===x?(x=!0,De("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===x&&(x=!1),Ve(0,0,"autoResize",JSON.stringify(x)),x),close(){Ve(0,0,"close")},getId:()=>K,getPageInfo(e){if("function"==typeof e)return ye=e,Ve(0,0,"pageInfo"),void w("<rb>Deprecated Method</>\n          \nThe <b>getPageInfo()</> method has been deprecated and replaced with  <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ye=null,Ve(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return ge=e,Ve(0,0,"parentInfo"),()=>{ge=null,Ve(0,0,"parentInfoStop")}},getParentProperties(e){w("<rb>Renamed Method</>\n          \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Q.findTarget(e)},reset(){Fe()},scrollBy(e,t){Ve(t,e,"scrollBy")},scrollTo(e,t){Ve(t,e,"scrollTo")},scrollToOffset(e,t){Ve(t,e,"scrollToOffset")},sendMessage(e,t){Ve(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){H=e,Ce()},setWidthCalculationMethod(e){me=e,$e()},setTargetOrigin(e){le=e},resize(e,t){De(a,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){w("<rb>Deprecated Method</>\n          \nThe <b>size()</> method has been deprecated and replaced with  <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),fe.parentIFrame=fe.parentIframe),function(){function e(e){Ve(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){l(window.document,t,e)}!0===G&&(t("mouseenter"),t("mouseleave"))}(),Q=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);Ve(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?Ve(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&l(e,"click",(t=>{t.preventDefault(),o(e.getAttribute("href"))}))}function a(){l(window,"hashchange",i)}function s(){setTimeout(i,f)}function c(){r(),a(),s()}return Q.enable&&(1===Y?w("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c()),{findTarget:o}}(),we(Ne(document)()),void 0===B&&(B=`${L}px`),ze("margin",(d="margin",(u=B).includes("-")&&(v(`Negative CSS value ignored for ${d}`),u=""),u)),ze("background",q),ze("padding",D),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)}(),Se(),De("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&Ve(0,0,"title",document.title),Ee({method:o="add",eventType:"After Print",eventName:"afterprint"}),Ee({method:o,eventType:"Before Print",eventName:"beforeprint"}),Ee({method:o,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=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)}},r=16,a=2,l=200;let s=1;function c(){const d=performance.now(),u=d-n;if(u>r*s+++a&&u<l)return setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Se(),ve(),we(e),e.forEach(Pe),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){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}u()}(),ne=new ResizeObserver(Te),ne.observe(document.body),Me.add(document.body),Pe(document.body),setTimeout(he)}function ve(){re=document.querySelectorAll(`[${n}]`),V=re.length>0}function we(e){V||ee(e)}function ze(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function Se(){if(""!==ie)for(const e of document.querySelectorAll(ie))e.dataset.iframeSize=!0}function Ee(e){({add(t){function n(){De(e.eventName,e.eventType)}p[t]=n,l(window,t,n,{passive:!0})},remove(e){const t=p[e];var n,o;delete p[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName)}function je(e,t,n,o){return t!==e&&(e in n||(v(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in u&&w(`<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 Ce(){H=je(H,b,xe,"height")}function $e(){me=je(me,A,qe,"width")}function Te(e){Array.isArray(e)&&0!==e.length&&De("resizeObserver",`Resize Observed: ${function(e){switch(!0){case!y(e):return"";case y(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case y(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(y(e.className)?`.${e.className}`:"")}}(e[0].target)}`)}const Me=new WeakSet;function Pe(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Me.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ne.observe(e),Me.add(e))}const t=Ne(e)();for(const e of t){if(Me.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(ne.observe(e),Me.add(e))}}function Ae(e){performance.mark(C);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=V?0:document.documentElement.getBoundingClientRect().bottom;performance.mark(C);const l=V?re:j()?S:Ne(document)();let s=l.length;for(const t of l)V||!g||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):s-=1;return N=r,performance.mark($,{detail:{Side:t,len:s,hasTags:V,logging:X}}),a}const Oe=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],Ne=e=>()=>e.querySelectorAll("* :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)"),Ie={height:0,width:0},ke={height:0,width:0};function Re(e){function t(){return ke[i]=r,Ie[i]=s,r}const n=j(),o=e===xe,i=o?"height":"width",r=e.boundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return s;case V:return e.taggedElement();case!n&&0===ke[i]&&0===Ie[i]:return t();case ce&&r===ke[i]&&s===Ie[i]:return Math.max(r,s);case 0===r:return s;case!n&&r!==ke[i]&&s<=Ie[i]:return t();case!o:return e.taggedElement();case!n&&r<ke[i]:case s===l||s===a:case r>s:return t()}return Math.max(e.taggedElement(),t())}const xe={enabled:()=>W,getOffset:()=>O,auto:()=>Re(xe),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>xe.bodyOffset(),custom:()=>s.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Oe(xe)),min:()=>Math.min(...Oe(xe)),grow:()=>xe.max(),lowestElement:()=>Ae(i),taggedElement:()=>Ae(i)},qe={enabled:()=>U,getOffset:()=>I,auto:()=>Re(qe),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>s.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Oe(qe)),min:()=>Math.min(...Oe(qe)),rightMostElement:()=>Ae(r),scroll:()=>Math.max(qe.bodyScroll(),qe.documentElementScroll()),taggedElement:()=>Ae(r)},Le=(e,t)=>!(Math.abs(e-t)<=se);let Be=!1;function De(e,t,n,o,i){R=performance.now(),(x||e===a)&&(document.hidden||(Be||(k=!0,function(e,t,n,o,i){const r=void 0===n?xe[H]():n,l=void 0===o?qe[me]():o;W&&Le(J,r)||U&&Le(ue,l)||"init"===e?(We(),J=r,ue=l,Ve(J,ue,e,i)):!e!==a&&(W&&H in P||U&&me in P)?Fe():k=!1}(e,0,n,o,i),requestAnimationFrame((()=>{Be=!1}))),Be=!0))}function We(){ce||(ce=!0,requestAnimationFrame((()=>{ce=!1})))}function Ue(e){J=xe[H](),ue=qe[me](),Ve(J,ue,e)}function Fe(e){const t=H;H=b,We(),Ue("reset"),H=t}function Ve(e,t,n,o,i){Y<-1||(void 0!==i||(i=le),function(){const r=`${K}:${e+(O||0)}:${t+(I||0)}:${n}${void 0===o?"":`:${o}`}`;X&&(console.group(`[iframe-resizer][${K}]`),console.info("Sending message to host page via "+(oe?"sameDomain":"postMessage")),console.info(`%c${r}`,"font-style: italic"),k&&console.info(function(){const e=m(performance.now()-R);return"init"===n?`Initialised iFrame in %c${e}ms`:`Content size recalculated in %c${e}ms`}(),"font-weight:bold;color:#777"),console.groupEnd()),k=!1,oe?window.parent.iframeParentListener(T+r):ae.postMessage(T+r,i)}())}function Je(e){const t={init:function(){_=e.data,ae=e.source,be(),F=!1,setTimeout((()=>{Z=!1}),f)},reset(){Z||Ue("resetPage")},resize(){De(a)},moveToAnchor(){Q.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ye?setTimeout((()=>ye(JSON.parse(e)))):Ve(0,0,"pageInfoStop")},parentInfo(){const e=o();ge?setTimeout(ge(Object.freeze(JSON.parse(e)))):Ve(0,0,"parentInfoStop")},message(){const e=o();pe(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};T===`${e.data}`.slice(0,M)&&(!1!==F?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||v(`Unexpected message (${e.data})`)}())}function He(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?v("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Je({data:e,sameDomain:!0}))),l(window,"message",Je),l(window,"readystatechange",He),He())}()}));
