/*!
 *  @preserve
 *  
 *  @module      iframe-resizer/parent 5.4.6 (umd) - 2025-04-24
 *
 *  @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(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=t()}(this,(function(){"use strict";const e="font-weight: normal;",t=e+"font-style: italic;",n="default",o=Object.freeze({assert:!0,error:!0,warn:!0}),i={expand:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},r={profile:0,profileEnd:0,timeStamp:0,trace:0},a=Object.assign(console);const{fromEntries:s,keys:l}=Object,c=e=>[e,a[e]],u=e=>t=>[t,function(n){e[t]=n}],d=(e,t)=>s(l(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;",m="5.4.6",g="iframeResizer",y="[iFrameSizer]",w=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),b="onload",v="init",z=Object.freeze({[b]:1,[v]:1}),$="expanded",j="collapsed",k=Object.freeze({[$]:1,[j]:1}),x=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((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t)),T=e=>e,M=(E=function(s={}){const l={},f={},p=[],h={...i,expand:!s.collapsed||i.expanded,...s};let m="";function g(){p.length=0,m=""}function y(){delete h.event,g()}const w=()=>!!p.some((([e])=>e in o))||!!h.expand;function b(){if(0!==p.length){a[w()?"group":"groupCollapsed"](`%c${h.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(h)} %c${h.showTime?m:""}`,e,"font-weight: bold;",t);for(const[e,...t]of p)a.assert(e in a,`Unknown console method: ${e}`),e in a&&a[e](...t);a.groupEnd(),y()}else y()}function v(){""===m&&(m=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}())}function z(e,...t){0===p.length&&(v(),queueMicrotask((()=>queueMicrotask(b)))),p.push([e,...t])}function $(e=n,...t){l[e]?z("log",`${e}: ${performance.now()-l[e]} ms`,...t):z("timeLog",e,...t)}return{...d(h,u(h)),...d(console,(e=>[e,(...t)=>z(e,...t)])),...d(r,c),assert:function(e,...t){e||z("assert",e,...t)},count:function(e=n){f[e]?f[e]+=1:f[e]=1,z("log",`${e}: ${f[e]}`)},countReset:function(e=n){delete f[e]},endAutoGroup:b,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;z("error",e)}return n},event:function(e){v(),h.event=e},purge:g,time:function(e=n){v(),l[e]=performance.now()},timeEnd:function(e=n){$(e),delete l[e]},timeLog:$,touch:v}},E?.__esModule?E.default:E);var E;let O={},R=!1;const S=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const I=e=>(t,...n)=>O[t]?.console[e](...n);var W;const A=(W="log",(e,...t)=>!0===(e=>O[e]?O[e].log:R)(e)?I(W)(e,...t):null),C=I("warn"),L=I("error"),F=I("event"),N=I("purge"),H=I("errorBoundary");const B=(e,...t)=>O[e]?O[e].console.warn(x(T)(...t)):queueMicrotask((()=>console?.warn(x((e=>(...t)=>[`${g}(${e})`,...t].join(" "))(e))(...t)))),P=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(B),q=P("Function"),D=P("Option"),U=(e,t,n,o)=>e.addEventListener(t,n,o||!1),J=(e,t,n)=>e.removeEventListener(t,n,!1),Z=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,i=0;i<e.length;i++)o=e.codePointAt(i),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)},V=e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),X=["<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."],Y=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],G=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),_=e=>V(X[e]),K=e=>{const t=e[V("spjluzl")];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=Z(V(e));return n in G&&(t=G[n]),t}(n[0]);return 0===o||(e=>e[2]===Z(e[0]+e[1]))(n)||(o=-2),o},Q={},ee=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,logExpand:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,waitForLoad:!1,warningTimeout:5e3,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof Q[e.id].onInit&&(D("init()","onReady()","",e.id),Q[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),te={position:null,version:m};function ne(e){function t(){ue(x),le(T),$("onResized",x)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const i=e=>k.slice(k.indexOf(":")+7+e);const r=(e,t)=>(n,o)=>{const i={};var r,a;r=function(){fe(`${n} (${e})`,`${e}:${t()}`,o)},i[a=o]||(r(),i[a]=requestAnimationFrame((()=>{i[a]=null})))},a=(e,t)=>()=>{let n=!1;const o=t=>()=>{Q[l]?n&&n!==t||(e(t,l),n=t,requestAnimationFrame((()=>{n=!1}))):s()},i=o("scroll"),r=o("resize window");function a(e,t){t(window,"scroll",i),t(window,"resize",r)}function s(){F(l,`stop${t}`),a(0,J),c.disconnect(),u.disconnect(),J(Q[l].iframe,"load",s)}const l=T,c=new ResizeObserver(o("pageObserver")),u=new ResizeObserver(o("iframeObserver"));Q[l]&&(Q[l][`stop${t}`]=s,U(Q[l].iframe,"load",s),a(0,U),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(Q[l].iframe,{attributes:!0,childList:!1,subtree:!1}))},s=e=>()=>{e in Q[T]&&(Q[T][e](),delete Q[T][e])},l=r("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=x.iframe.getBoundingClientRect(),{scrollY:n,scrollX:o,innerHeight:i,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,i||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:n,scrollLeft:o,documentHeight:a,documentWidth:s,windowHeight:i,windowWidth:r})})),c=r("parentInfo",(function(){const{iframe:e}=x,{scrollWidth:t,scrollHeight:n}=document.documentElement,{width:o,height:i,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:o,height:i,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),u=a(l,"PageInfo"),d=a(c,"ParentInfo"),f=s("stopPageInfo"),g=s("stopParentInfo");function w(e){const t=e.getBoundingClientRect();return ae(),{x:Number(t.left)+Number(te.position.x),y:Number(t.top)+Number(te.position.y)}}function b(e){const t=e?w(x.iframe):{x:0,y:0};A(T,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,p,h,p);const n=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(x,t),o=window.parentIframe||window.parentIFrame;o?function(t,n){t["scrollTo"+(e?"Offset":"")](n.x,n.y)}(o,n):function(e){te.position=e,v(T)}(n)}function v(e){const{x:t,y:n}=te.position,o=Q[e]?.iframe;!1!==$("onScroll",{iframe:o,top:n,left:t,x:t,y:n})?le(e):se()}function z(e){let t={};if(0===x.width&&0===x.height){const e=i(9).split(":");t={x:e[1],y:e[0]}}else t={x:x.width,y:x.height};$(e,{iframe:x.iframe,screenX:Number(t.x),screenY:Number(t.y),type:x.type})}const $=(e,t)=>oe(T,e,t);function j(){const{height:e,iframe:n,msg:o,type:r,width:a}=x;switch(Q[T]?.firstRun&&Q[T]&&(Q[T].firstRun=!1),r){case"close":re(n);break;case"message":l=i(6),$("onMessage",{iframe:x.iframe,message:JSON.parse(l)});break;case"mouseenter":z("onMouseEnter");break;case"mouseleave":z("onMouseLeave");break;case"autoResize":Q[T].autoResize=JSON.parse(i(9));break;case"scrollBy":!function(){const e=x.width,t=x.height,n=window.parentIframe||window.parentIFrame||window;A(T,`scrollBy: x: %c${e}%c y: %c${t}`,p,h,p),n.scrollBy(e,t)}();break;case"scrollTo":b(!1);break;case"scrollToOffset":b(!0);break;case"pageInfo":u();break;case"parentInfo":d();break;case"pageInfoStop":f();break;case"parentInfoStop":g();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const e=w(o);A(T,`Moving to in page link: %c#${t}`,p),te.position={x:e.x,y:e.y},v(T),window.location.hash=t}():window.top!==window.self&&function(){const e=window.parentIframe||window.parentIFrame;e&&e.moveToAnchor(t)}()}(i(9));break;case"title":!function(e,t){Q[t]?.syncTitle&&(Q[t].iframe.title=e,A(t,`Set iframe title attribute: %c${e}`,p))}(o,T);break;case"reset":ce(x);break;case"init":t(),function(e){try{Q[e].sameOrigin=!!Q[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){Q[e].sameOrigin=!1}}(T),(s=o)!==m&&(void 0!==s||B(T,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),me=!0,$("onReady",n);break;default:if(0===a&&0===e)return void C(T,`Unsupported message received (${r}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===a||0===e)return;if(document.hidden)return;t()}var s,l}let k=e.data,x={},T=null;"[iFrameResizerChild]Ready"!==k?y===`${k}`.slice(0,13)&&k.slice(13).split(":")[0]in Q&&(x=function(){const e=k.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=Q[e[0]]?.iframe,r=getComputedStyle(i);return{iframe:i,id:e[0],height:t+n(r)+o(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),T=x.id,T?(F(T,x.type),H(T,(function(){!function(e){if(!Q[e])throw new Error(`${x.type} No settings for ${e}. Message was: ${k}`)}(T),x.type in{true:1,false:1,undefined:1}||(Q[T].loaded=!0,(null!==x.iframe||(C(T,`The iframe (${x.id}) was not found.`),0))&&function(){const{origin:t,sameOrigin:n}=e;if(n)return!0;let o=Q[T]?.checkOrigin;if(o&&"null"!=`${t}`&&!(o.constructor===Array?function(){let e=0,n=!1;for(;e<o.length;e++)if(o[e]===t){n=!0;break}return n}():function(){const e=Q[T]?.remoteHost;return t===e}()))throw new Error(`Unexpected message received from: ${t} for ${x.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&j())}))()):C("","iframeResizer received messageData without id, message was: ",k)):Object.keys(Q).forEach((e=>{Q[e].mode>=0&&fe("iFrame requested init",pe(e),e)}))}function oe(e,t,n){let o=null,i=null;if(Q[e]){if(o=Q[e][t],"function"!=typeof o)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{i=o(n)}catch(n){console.error(n),C(e,`Error in ${t} callback`)}else setTimeout((()=>o(n)))}return i}function ie(e){const{id:t}=e;delete Q[t],delete e.iframeResizer}function re(e){const{id:t}=e;if(!1!==oe(t,"onClose",t)){try{e.parentNode&&e.remove()}catch(e){C(t,e)}oe(t,"onClosed",t),ie(e)}}function ae(e){null===te.position&&(te.position={x:window.scrollX,y:window.scrollY})}function se(){te.position=null}function le(e){null!==te.position&&(window.scrollTo(te.position.x,te.position.y),A(e,`Set page position: %c${te.position.x}%c, %c${te.position.y}`,p,h,p),se())}function ce(e){ae(e.id),ue(e),fe("reset","reset",e.id)}function ue(e){function t(t){const o=`${e[t]}px`;e.iframe.style[t]=o,A(n,`Set ${t}: %c${o}`,p)}const{id:n}=e,{sizeHeight:o,sizeWidth:i}=Q[n];o&&t("height"),i&&t("width")}O=Q;const de=e=>e.split(":").filter(((e,t)=>19!==t)).join(":");function fe(e,t,n,o){function i(o){const i=e in z?de(t):t;A(n,o,p,h,p),A(n,`Message data: %c${i}`,p)}F(n,e),Q[n]&&(Q[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:o,sameOrigin:r,targetOrigin:a}=Q[n];if(r)try{return e.contentWindow.iframeChildListener(y+t),void i(`Sending message to iframe %c${n}%c via sameOrigin`)}catch(e){}i(`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`),o.postMessage(y+t,a)}():C(n,`Iframe(${n}) not found`),o&&Q[n]?.warningTimeout&&(Q[n].msgTimeout=setTimeout((function(){if(void 0===Q[n])return;const{iframe:e,loaded:t,loadErrorShown:o,waitForLoad:i}=Q[n],{sandbox:r}=e,a="object"==typeof r&&r.length>0;t||o||(Q[n].loadErrorShown=!0,B(n,`<rb>No response from iFrame</>\n            \nThe iframe (<i>${n}</>) has not responded within ${Q[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${i?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>.  \n":""}${!a||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!a||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),Q[n].warningTimeout)))}function pe(e){const t=Q[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,te.version,t.mode,"",t.logExpand].join(":")}let he=0,me=!1,ge=!1;const ye=t=>n=>{function o(){if(Q[d]){const{iframe:e}=Q[d],t={close:re.bind(null,e),disconnect:ie.bind(null,e),removeListeners(){B(d,"<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize(){B(d,"<rb>Deprecated Method</>\n        \nUse of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As their are no longer any edge cases that require triggering a resize from the parent page, it is recommended to remove this method from your code."),fe.bind(null,"Window resize","resize",d)},moveToAnchor(e){((e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${o=t,o.charAt(0).toUpperCase()+o.slice(1)}`);var o})(e,"string","moveToAnchor(anchor) anchor"),fe("Move to anchor",`moveToAnchor:${e}`,d)},sendMessage(e){fe("message",`message:${e=JSON.stringify(e)}`,d)}};e.iframeResizer=t,e.iFrameResizer=t}}function i(e){const{id:t}=n,{mode:o,waitForLoad:i}=Q[t];-1!==o&&-2!==o&&(U(n,"load",(function(){fe(b,`${e}:${me}`,t,!0),function(){const e=Q[d]?.firstRun,t=Q[d]?.heightCalculationMethod in w;!e&&t&&ce({iframe:n,height:0,width:0,type:"init"})}()})),!1===i&&fe(v,`${e}:${me}`,t,!0))}function r(e){return e?(("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&B(d,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e):{}}function a(){const{mode:n}=Q[d];if(n<0)throw B("Parent",`${_(n+2)}${_(2)}`),N(d),_(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");ge||n>0&&t.vInfoDisable||function(t,n){queueMicrotask((()=>console.info(`%ciframe-resizer ${t}`,R||n<1?"font-weight: bold;":e)))}(`v${m} (${(e=>V(Y[e]))(n)})`,n),!ge&&n<1&&B("Parent",_(3)),ge=!0}function s(e){const t=Q[e]?.iframe?.title;return""===t||void 0===t}const l=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");function c(e){var t,o;Q[d]={...Q[d],iframe:n,firstRun:!0,remoteHost:n?.src.split("/").slice(0,3).join("/"),...ee,...r(e),mouseEvents:l(e),mode:K(e),syncTitle:s(d)},F(d,"setup"),function(){const{direction:e}=Q[d];if("horizontal"===e)return Q[d].sizeWidth=!0,void(Q[d].sizeHeight=!1);if("none"===e)return Q[d].sizeWidth=!1,Q[d].sizeHeight=!1,void(Q[d].autoResize=!1);if("vertical"!==e)throw new TypeError(d,`Direction value of "${e}" is not valid`)}(),(t=e?.offsetSize||e?.offset)&&("vertical"===Q[d].direction?Q[d].offsetHeight=t:Q[d].offsetWidth=t),e?.offset&&B(d,"<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</>."),null===Q[d].postMessageTarget&&(Q[d].postMessageTarget=n.contentWindow),Q[d].targetOrigin=!0===Q[d].checkOrigin?""===(o=Q[d].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const u=()=>"iframeResizer"in n,d=function(e){if(e&&"string"!=typeof e)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=t?.id||ee.id+he++;return null!==document.getElementById(e)&&(e+=he++),e}(),n.id=e),e}(n.id);if("object"!=typeof t)throw new TypeError("Options is not an object");return function(e){const{search:t}=window.location;t.includes("ifrlog")&&(e.log=$,e.logExpand=!t.includes("ifrlog=collapsed"))}(t),function(e,t){const n=Object.hasOwn(t,"log"),o="string"==typeof t.log,i=n?!!o||t.log:ee.log;Object.hasOwn(t,"logExpand")||(t.logExpand=n&&o?t.log===$:ee.logExpand),function(e){-1===e?.log&&(e.log=!1,e.vInfoDisable=!0)}(t),function({enabled:e,expand:t,iframeId:n}){const o=M({expand:t,label:S(n)});R=e,O[n]||(O[n]={console:o})}({enabled:i,expand:t.logExpand,iframeId:e}),o&&!(t.log in k)&&L(e,'Invalid value for options.log: Accepted values are "expanded" and "collapsed"'),t.log=i}(d,t),H(d,(function(e){u()?C(d,`Ignored iframe (${d}), already setup.`):(c(e),a(),be(),function(){switch(n.style.overflow=!1===Q[d]?.scrolling?"hidden":"auto",Q[d]?.scrolling){case"omit":break;case!0:n.scrolling="yes";break;case!1:n.scrolling="no";break;default:n.scrolling=Q[d]?Q[d].scrolling:"no"}}(),function(){const{bodyMargin:e}=Q[d];"number"!=typeof e&&"0"!==e||(Q[d].bodyMargin=`${e}px`)}(),i(pe(d)),o())}))(t),n?.iFrameResizer};function we(){!1===document.hidden&&function(e,t){const n=e=>Q[e]?.autoResize&&!Q[e]?.firstRun;Object.keys(Q).forEach((function(o){n(o)&&fe(e,t,o)}))}("Tab Visible","resize")}const be=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{U(window,"message",ne),U(document,"visibilitychange",we),window.iframeParentListener=e=>setTimeout((()=>ne({data:e,sameOrigin:!0})))})),ve=`[${g}] `;const ze=function(){function e(e){switch(!0){case!e:throw new TypeError(`${ve}iframe is not defined`);case!e.tagName:throw new TypeError(`${ve}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${ve}Expected <IFRAME> tag, found <${e.tagName}>`);default:t(e),n.push(e)}}let t,n;return function(o,i){if("undefined"==typeof window)return[];switch(t=ye(o),n=[],typeof i){case"undefined":case"string":document.querySelectorAll(i||"iframe").forEach(e);break;case"object":e(i);break;default:throw new TypeError(`${ve}Unexpected data type (${typeof i})`)}return Object.freeze(n)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){q("iFrameResize()","iframeResize()","","parent"),ze(...e)}),ze}));
