@iframe-resizer/child 6.0.0-beta.0 → 6.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.cjs.js +20 -51
- package/index.cjs.js.map +1 -1
- package/index.d.ts +94 -0
- package/index.esm.js +20 -1453
- package/index.esm.js.map +1 -1
- package/index.umd.js +20 -53
- package/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/iframe-resizer.child.d.ts +0 -164
package/index.umd.js
CHANGED
|
@@ -1,54 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`)}function Ut(e,t,n){const{label:o}=n;return t!==e&&(e in n||(I(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in Po&&_o(o,e)),a(`Set ${o} calculation method: %c${e}`,s.HIGHLIGHT),e}function Wt(){i.heightCalcMode=Ut(i.heightCalcMode,Ge,O)}function Vt(){i.widthCalcMode=Ut(i.widthCalcMode,Et,S)}function jo(){try{c.sameOrigin=i.mode===1||"iframeParentListener"in window.parent}catch{a("Cross domain iframe detected")}}const xo=`<rb>Deprecated Attributes</>
|
|
21
|
-
|
|
22
|
-
The <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 Bo(){let e=!1;const t=n=>document.querySelectorAll(`[${n}]`).forEach(o=>{o.toggleAttribute(se,!0),o.removeAttribute(n),e=!0});t("data-iframe-height"),t("data-iframe-width"),e&&h(xo)}let qt=0;function Fo(e){const t=e.length===1?"":"s";I(`%c[${U}]%c found on %c${e.length}%c element${t}`,s.BOLD,s.NORMAL,s.BOLD,s.NORMAL)}function Uo(){const e=document.querySelectorAll(`*[${U}]`),t=e.length>0;return t&&e.length!==qt&&(Fo(e),qt=e.length),t}const Zt=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)},G=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Y=["spjluzl","rlf","clyzpvu","rlf2"],Wo=["<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."],Vo=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],Yt=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl"].map((e,t)=>[e,Math.max(0,t-1)])),F=e=>G(Wo[e]),qo=e=>G(Vo[e]),Zo=e=>G(Y[e]),Qt=e=>{const t=e[G(Y[0])]||e[G(Y[1])]||e[G(Y[2])]||e[G(Y[3])];if(!t)return-1;const n=t.split("-");let o=(function(r=""){let u=-2;const l=Zt(G(r));return l in Yt&&(u=Yt[l]),u>4?u-4:u})(n[0]);return o===0||(r=>r[2]===Zt(r[0]+r[1]))(n)||(o=-2),o};function Yo({key:e,key2:t,mode:n,version:o}){const r=n,u=Qt({key:e}),l=Qt({key2:t});if(i.mode=n=Math.max(u,l),n<0){if(n=Math.min(u,l),h(`${F(n+2)}${F(2)}`),j(o))throw c.firstRun=!1,F(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!j(o)||r>-1&&n>r)&&(sessionStorage.getItem("ifr")!==E&&ro(`v${E} (${qo(n)})`,n),n<2&&h(F(3)),sessionStorage.setItem("ifr",E))}const Qo="BackCompat",Jo=`<rb>Quirks Mode Detected</>
|
|
23
|
-
|
|
24
|
-
This 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</>.
|
|
25
|
-
|
|
26
|
-
For more information see <u>https://iframe-resizer.com/quirks-mode</>.
|
|
27
|
-
`;function Ko(){document.compatMode===Qo&&h(Jo)}const Xo="complete";let Jt=!1;function Kt(e){document.readyState===Xo?ae(e):Jt||N(document,ft,()=>Kt(e)),Jt=!0}const er=()=>{d(`Set targetOrigin for parent: %c${i.targetOrigin}`,s.HIGHLIGHT),i.autoResize!==!0&&a("Auto Resize disabled")};function Xt(){c.taggedElements=document.querySelectorAll(`[${se}]`),c.hasTags=c.taggedElements.length>0,a(`Tagged elements found: %c${c.hasTags}`,s.HIGHLIGHT)}const tr=`<rb>Legacy version detected on parent page</>
|
|
28
|
-
|
|
29
|
-
Detected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.
|
|
30
|
-
|
|
31
|
-
See <u>https://iframe-resizer.com/setup/</> for more details.
|
|
32
|
-
`,nr=e=>`<b>Version mismatch</>
|
|
33
|
-
|
|
34
|
-
The parent and child pages are running different versions of <i>iframe resizer</>.
|
|
35
|
-
|
|
36
|
-
Parent page: ${e} - Child page: ${E}.
|
|
37
|
-
`;function or({version:e}){!e||e===""||e===Bn?h(tr):e!==E&&h(nr(e))}const rr=Ot(()=>h(F(4)));function sr(e){if(!c.timerActive)return;const t=P(performance.now()-c.totalTime),n=e===re?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`;a(n,s.HIGHLIGHT)}function ir(e){return e===void 0?e=i.targetOrigin:a(`Message targetOrigin: %c${e}`,s.HIGHLIGHT),e}function cr(e,t){const{mode:n}=i,{sameOrigin:o,target:r}=c;if(o)try{window.parent.iframeParentListener(ce+e)}catch(u){if(n===1)rr();else throw u;return!1}else r.postMessage(ce+e,ir(t));return!0}function en(e,t,n,o,r){const{parentId:u}=i,{sameOrigin:l}=c,y=`${e}:${t}`,v=`${u}:${y}:${n}${o===void 0?"":`:${o}`}`;i.mode<-1||!cr(v,r)||(sr(n),d(`Sending message to parent page via ${l?"sameOrigin":"postMessage"}: %c%c${v}`,s.ITALIC,s.HIGHLIGHT))}const g=De((e,t,n,o,r)=>{m(n),en(e,t,n,o,r),D()}),ar=e=>g(0,0,e.type,`${e.screenY}:${e.screenX}`);function tn(e,t){a(`Add event listener: %c${t}`,s.HIGHLIGHT),N(window.document,e,ar)}function lr({mouseEvents:e}){e===!0&&(tn($n,"Mouse Enter"),tn(Ln,"Mouse Leave"))}const dr=()=>g(0,0,Hn);function ur({persisted:e}){e||dr(),m(it),d("Page persisted:",e),!e&&je.forEach(qn)}const fr=()=>N(window,Zn(it),ur),nn=(e,t)=>!(Math.abs(e-t)<=i.tolerance);function mr(e,t){const{calculateHeight:n,calculateWidth:o}=i,{height:r,width:u}=c;return n&&nn(r,e)||o&&nn(u,t)}function hr(e){const t=i.onBeforeResize(e);if(t===void 0)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}const on=e=>t=>{const n=e[t]();return e.enabled()&&i.onBeforeResize!==void 0?hr(n):n},pr=on(O),gr=on(S);function yr(e,t,n,o){const{heightCalcMode:r,widthCalcMode:u}=i,l=n??pr(r),y=o??gr(u),v=mr(l,y)?mt:e;switch(a(`Resize event: %c${t}`,s.HIGHLIGHT),v){case re:case Ae:case mt:case $e:case Le:c.height=l,c.width=y;case pt:return c;case Ne:case yt:case gt:case bt:{a(vt);break}default:d(vt)}return null}let ge=!1,Ue=!1,Q=null;function br(e,t,n,o,r){const{autoResize:u}=i,{isHidden:l}=c;switch(m(e),!0){case l===!0:{if(Ue===!0)break;a("Iframe hidden - Ignored resize request"),Ue=!0,ge=!1,cancelAnimationFrame(Q),Q=null;break}case(ge===!0&&e!==Ne&&!(e in ht)):{a("Resize already pending - Ignored resize request");break}case(!u&&!(e in ht)):{d("Resizing disabled");break}default:{Ue=!1,ge=!0,c.totalTime=performance.now(),c.timerActive=!0;const y=yr(e,t,n,o);y&&en(y.height,y.width,e,r),Q||(Q=requestAnimationFrame(()=>{ge=!1,Q=null,m("requestAnimationFrame"),de(`Reset sendPending: %c${e}`,s.HIGHLIGHT)})),c.timerActive=!1}}D()}const T=De(br);function rn({eventType:e,eventName:t}){N(window,t,()=>T(t,e),{passive:!0})}function vr(){rn({eventType:"After Print",eventName:"afterprint"}),rn({eventType:"Before Print",eventName:"beforeprint"})}function wr(){if(c.triggerLocked){a("TriggerLock blocked calculation");return}c.triggerLocked=!0,de("Trigger event lock on"),requestAnimationFrame(()=>{c.triggerLocked=!1,de("Trigger event lock off")})}function sn(e){const{heightCalcMode:t,widthCalcMode:n}=i,o=O[t](),r=S[n]();a(`Reset trigger event: %c${e}`,s.HIGHLIGHT),g(o,r,e)}function Er(e){const t=i.heightCalcMode;a(`Reset trigger event: %c${e}`,s.HIGHLIGHT),i.heightCalcMode=Ge,wr(),sn("reset"),i.heightCalcMode=t}const zr=`Auto Resize can not be changed when <b>direction</> is set to '${Ce}'.`;function Ir(e){z(e,_n,"parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=i;return o===!1&&n===!1?(m(Ae),h(zr),!1):(e===!0&&t===!1?(i.autoResize=!0,queueMicrotask(()=>T(Ae,"Auto Resize enabled"))):e===!1&&t===!0&&(i.autoResize=!1),g(0,0,Rn,JSON.stringify(i.autoResize)),i.autoResize)}function Or(e){i.heightCalcMode=e,Wt()}function Sr(e){i.widthCalcMode=e,Vt()}function Tr(e){z(e,V,"parentIframe.moveToAnchor(anchor) anchor"),c.inPageLinks.findTarget(e)}function Rr(e){z(e,L,"parentIframe.setOffsetSize(offset) offset"),i.offsetHeight=e,i.offsetWidth=e,T(pt,`parentIframe.setOffsetSize(${e})`)}function Hr(){return m("getOrigin"),At("getOrigin()","getParentOrigin()"),c.origin}const Mr=()=>c.origin;function Ar(e){z(e,V,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),a(`Set targetOrigin: %c${e}`,s.HIGHLIGHT),i.targetOrigin=e}function $r(e){if(typeof e===q){c.onPageInfo=e,g(0,0,ct),io("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");return}c.onPageInfo=null,g(0,0,Nn)}function cn(e){return z(e,q,"parentIframe.getParentProps(callback) callback"),c.onParentInfo=e,g(0,0,at),()=>{c.onParentInfo=null,g(0,0,Cn)}}function Lr(e){At("getParentProperties()","getParentProps()"),cn(e)}const Nr=e=>`<rb>Deprecated API object name</>
|
|
38
|
-
The <b>window.parentIFrame</> object has been renamed to <b>window.parentIframe</>. Please update your code as the old object will be removed in a future version.
|
|
39
|
-
|
|
40
|
-
Called property: '${String(e)}'
|
|
41
|
-
`;function Cr(e){const t=new Set;return new Proxy(e,{get(n,o){t.has(o)||(h(Nr(o)),t.add(o));const r=n[o],u=Object.getOwnPropertyDescriptor(n,o);return u&&!u.configurable&&!u.writable?r:typeof r=="function"?r.bind(n):r}})}function Gr(e,t){e!==void 0&&z(e,L,"parentIframe.resize(customHeight, customWidth) customHeight"),t!==void 0&&z(t,L,"parentIframe.resize(customHeight, customWidth) customWidth");const n=`${e||""}${t?`,${t}`:""}`;T($e,`parentIframe.resize(${n})`,e,t)}const We=e=>(t,n)=>{z(t,L,`parentIframe.${e}(x, y) x`),z(n,L,`parentIframe.${e}(x, y) y`),g(n,t,e)},kr=We(Gn),Pr=We(kn),Dr=We(lt);function _r(e,t){t&&z(t,V,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),g(0,0,Se,JSON.stringify(e),t)}const jr=()=>g(0,0,Mn),xr=()=>i.parentId,Br=()=>Er("parentIframe.reset"),Fr=()=>I("parentIframe.size() has been renamed parentIframe.resize()");function Ur(){const{win:e}=c;i.mode!==1&&(e.parentIframe=Object.freeze({autoResize:Ir,close:jr,getId:xr,getOrigin:Hr,getParentOrigin:Mr,getPageInfo:$r,getParentProps:cn,getParentProperties:Lr,moveToAnchor:Tr,reset:Br,setOffsetSize:Rr,scrollBy:kr,scrollTo:Pr,scrollToOffset:Dr,sendMessage:_r,setHeightCalculationMethod:Or,setWidthCalculationMethod:Sr,setTargetOrigin:Ar,resize:Gr,size:Fr}),e.parentIFrame=Cr(e.parentIframe))}const J=(e="")=>t=>n=>{n.size>0&&de(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[`
|
|
42
|
-
`,o]))},Wr=(e="")=>t=>n=>{n.size>0&&Mt(`${t}Observer ${e}:`,...Array.from(n).flatMap(o=>[`
|
|
43
|
-
`,o]))},an=J("attached to"),ln=Wr("already attached"),Vr=J("detached from"),ye=(e,t=!0)=>n=>{n>0&&d(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${n===1?"":"s"}`,s.HIGHLIGHT,s.NORMAL,s.HIGHLIGHT,s.NORMAL)},dn=(e,t,n,o)=>{const r=Vr(e);return u=>{const l=new Set;let y=0;for(const v of u)n.has(v)&&(t.unobserve(v),n.delete(v),l.add(v),y+=1);r(l),o(y),l.clear()}},un=16,fn=2,qr=200,Ve="Mutation",R=new Set,k=new Set,qe=new Set,be=[],Zr={attributes:!0,attributeFilter:[U,se],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ze=1,Ye,Qe=!1,Je=0;const Yr=J("added")(Ve),Qr=J("removed (page)")(Ve),Jr=J("removed (added)")(Ve),mn=e=>e.nodeType!==Node.ELEMENT_NODE||It.has(e.tagName.toLowerCase());function Kr(e){const t=e.addedNodes;for(const n of t)mn(n)||R.add(n)}function Xr(e){const t=e.removedNodes;for(const n of t)mn(n)||(R.has(n)?(R.delete(n),qe.add(n)):k.add(n))}const es=e=>{d("Mutations:",e);for(const t of e)Kr(t),Xr(t);Yr(R),Qr(k),Jr(qe),qe.clear()};function ts(){k.size>0&&a(`Detected %c${k.size} %cremoved element${k.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND),R.size>0&&a(`Found %c${R.size} %cnew element${R.size>1?"s":""}`,s.HIGHLIGHT,s.FOREGROUND)}const ns=e=>()=>{const t=performance.now(),n=t-Je,o=un*Ze+++fn;if(n>o&&n<qr){m("mutationThrottled"),d("Update delayed due to heavy workload on the callStack"),d(`EventLoop busy time: %c${P(n)}ms %c> Max wait: %c${o-fn}ms`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),setTimeout(Ye,un*Ze),Je=t;return}Ze=1,be.forEach(es),be.length=0,Qe=!1,ts(),e({addedNodes:R,removedNodes:k}),R.clear(),k.clear()};function os(e){be.push(e),!Qe&&(Je=performance.now(),Qe=!0,requestAnimationFrame(Ye))}function rs(e){const t=new window.MutationObserver(os),n=document.body||document.documentElement;return Ye=ns(e),t.observe(n,Zr),d("Attached%c MutationObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{...t,disconnect:()=>{R.clear(),k.clear(),be.length=0,t.disconnect(),d("Detached%c MutationObserver",s.HIGHLIGHT)}}}const ss={characterData:!0,childList:!0,subtree:!0};function is(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,ss),d("Attached%c TitleObserver%c to head",s.HIGHLIGHT,s.FOREGROUND),setTimeout(e),{disconnect:()=>{n.disconnect(),d("Detached%c TitleObserver",s.HIGHLIGHT)}}}function cs(e){const t=new IntersectionObserver(o=>e(o.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),d("Attached%c VisibilityObserver%c to page",s.HIGHLIGHT,s.FOREGROUND),{disconnect:()=>{t.disconnect(),d("Detached%c VisibilityObserver",s.HIGHLIGHT)}}}let hn=new Set;function as(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${U}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{m("overflowIgnored"),d(`Ignoring elements with [data-iframe-ignore] > *:
|
|
44
|
-
`,n),D()}),t}function pn(){const e=document.querySelectorAll(`[${dt}]`),t=as(e);let n=!1;return typeof Set.prototype.symmetricDifference===q&&(n=t.symmetricDifference(hn).size>0),hn=t,c.overflowedNodeSet=t,c.hasOverflow=t.size>0,{hasOverflowUpdated:n,overflowedNodeSet:t}}const H={},gn=e=>{const t=new Set;for(const n of e){t.add(n);for(const o of xe(n))t.add(o)}return d(`Inspecting:
|
|
45
|
-
`,t),t},ls=e=>{if(e.size===0)return;m("addObservers");const t=gn(e);H.overflow.attachObservers(t),H.resize.attachObserverToNonStaticElements(t),D()},ds=e=>{if(e.size===0)return;m("removeObservers");const t=gn(e);H.overflow.detachObservers(t),H.resize.detachObservers(t),D()};function us({addedNodes:e,removedNodes:t}){m("contentMutated"),c.applySelectors(),Xt(),pn(),D(),ds(t),ls(e)}function fs(e){us(e),T(yt,"Mutation Observed")}const K="Overflow",ms=ye(K),hs=ye(K,!1),ps=an(K),gs=ln(K),ys=e=>e.hidden||e.offsetParent===null||e.style.display===Ce,bs=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||le,u=(M=!1)=>e(M),l=(M,A)=>M===0||M>A[n],y=(M,A)=>M.toggleAttribute(dt,A);function v(M){for(const A of M){const{boundingClientRect:ne,rootBounds:oe,target:$}=A;if(!oe)continue;const gi=ne[n],yi=l(gi,oe)&&!ys($);y($,yi)}r(u)}const f=new IntersectionObserver(v,o),w=new WeakSet;function p(M){const A=new Set,ne=new Set;let oe=0;for(const $ of M)if($.nodeType===Node.ELEMENT_NODE){if(w.has($)){A.add($);continue}f.observe($),w.add($),ne.add($),oe+=1}gs(A),ps(ne),ms(oe),ne.clear(),A.clear()}return{attachObservers:p,detachObservers:dn(K,f,w,hs),disconnect:()=>{f.disconnect(),d("Detached%c OverflowObserver",s.HIGHLIGHT)}}};function vs(){const{hasOverflow:e}=c,{hasOverflowUpdated:t,overflowedNodeSet:n}=pn();switch(!0){case!t:return;case n.size>1:d("Overflowed Elements:",n);break;case e:break;default:d("No overflow detected")}T(Ne,"Overflow updated")}function ws(e){const t={root:document.documentElement,side:i.calculateHeight?He:Me};return H.overflow=bs(vs,t),H.overflow.attachObservers(e),H.overflow}const X="Resize",Es=ye(X),zs=ye(X,!1),Is=an(X),Os=ln(X),ve=new WeakSet,Ke=new Set,Xe=new Set;let ee;function Ss(e){let t=0;for(const n of e){if(n.nodeType!==Node.ELEMENT_NODE)continue;const o=getComputedStyle(n)?.position;if(!(o===""||o==="static")){if(ve.has(n)){Ke.add(n);continue}ee.observe(n),ve.add(n),Xe.add(n),t+=1}}Os(Ke),Is(Xe),Es(t),Xe.clear(),Ke.clear()}const Ts=e=>(ee=new ResizeObserver(e),ee.observe(document.body),ve.add(document.body),d("Attached%c ResizeObserver%c to body",s.HIGHLIGHT,s.FOREGROUND),{attachObserverToNonStaticElements:Ss,detachObservers:dn(X,ee,ve,zs),disconnect:()=>{ee.disconnect(),d("Detached%c ResizeObserver",s.HIGHLIGHT)}});function Rs(e){if(!Array.isArray(e)||e.length===0)return;const t=e[0].target;T(gt,`Element resized <${Yn(t)}>`)}function Hs(e){return H.resize=Ts(Rs),H.resize.attachObserverToNonStaticElements(e),H.resize}let yn;function Ms(){const e=document.title;e!==yn&&(yn=e,a(`Title: %c${e}`,s.HIGHLIGHT),e&&g(0,0,Pn,e))}function As(e){a(`Visible: %c${e}`,s.HIGHLIGHT),c.isHidden=!e,T(bt,"Visibility changed")}function $s(e){je.push(...e.map(t=>t.disconnect))}function Ls(){m("attachObservers");const e=xe(document.documentElement),t=[rs(fs),ws(e),Co(),Hs(e),is(Ms),cs(As)];$s(t)}const bn=(e,t,n)=>{if(n!==""){a(`${e}: %c${n}`,s.HIGHLIGHT);for(const o of document.querySelectorAll(n))a(`Applying ${t} to:`,o),o.toggleAttribute(t,!0)}};function Ns({sizeSelector:e,ignoreSelector:t}){return()=>{bn("sizeSelector",se,e),bn("ignoreSelector",U,t)}}function Cs(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Gs(e,t){return t.includes("-")&&(I(`Negative CSS value ignored for ${e}`),t=""),t}function et(e,t){t===void 0||t===""||t===Fn||(document.body.style.setProperty(e,t),d(`Set body ${e}: %c${t}`,s.HIGHLIGHT))}function ks({bodyMarginStr:e,bodyMargin:t}){e===void 0&&(e=`${t}px`),et("margin",Gs("margin",e))}const Ps=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function Ds(e){const t=e.getBoundingClientRect(),n=Ps();return{x:parseInt(t.left,10)+parseInt(n.x,10),y:parseInt(t.top,10)+parseInt(n.y,10)}}function _s(e,t){const n=Ds(t);a(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),g(n.y,n.x,lt)}function tt(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];if(o!==void 0){_s(t,o);return}a(`In page link (#${t}) not found in iframe, so sending to parent`),g(0,0,An,`#${t}`)}function vn(){const{hash:e,href:t}=window.location;e!==""&&e!=="#"&&tt(t)}function js(){for(const e of document.querySelectorAll('a[href^="#"]'))e.getAttribute("href")!=="#"&&N(e,"click",t=>{t.preventDefault(),tt(e.getAttribute("href"))})}function xs(){N(window,"hashchange",vn)}function Bs(){setTimeout(vn,zt)}function Fs(){a("Setting up location.hash handlers"),js(),xs(),Bs(),c.inPageLinks={findTarget:tt}}function Us(e){const{mode:t}=i;e?t===1?h(F(5)):Fs():a("In page linking not enabled")}const Ws="important";function Vs(){const e=t=>t.style.setProperty(W,ie,Ws);e(document.documentElement),e(document.body),a("Set HTML & body height: %cauto !important",s.HIGHLIGHT)}const qs="custom",Zs=e=>`<rb>Deprecated Option(${e}CalculationMethod)</>
|
|
46
|
-
|
|
47
|
-
The use of <b>${e}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.
|
|
48
|
-
|
|
49
|
-
See <u>https://iframe-resizer.com/api/child</> for more details.
|
|
50
|
-
`;function wn(e,t){return typeof e!==q?e:(h(Zs(t)),t===W?O.custom=e:S.custom=e,qs)}const nt=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},ot=nt(q),we=nt(L),Ee=nt(V),Ys=e=>e!==null&&typeof e===jn&&!Array.isArray(e);function Qs(e){const{calculateHeight:t,calculateWidth:n}=i;let o,r;return typeof e?.offset===L&&(co(Te,Re),t&&(o=we(e,Te)),n&&(r=we(e,Te))),typeof e?.offsetSize===L&&(t&&(o=we(e,Re)),n&&(r=we(e,Re))),{offsetHeight:o,offsetWidth:r}}function Js(e){a("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=Qs(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:Ee(e,"ignoreSelector"),key2:Ee(e,Zo(0)),sizeSelector:Ee(e,"sizeSelector"),targetOrigin:Ee(e,"targetOrigin"),heightCalcMode:wn(e?.heightCalculationMethod,W),widthCalcMode:wn(e?.widthCalculationMethod,ut),onBeforeResize:ot(e,"onBeforeResize"),onMessage:ot(e,"onMessage"),onReady:ot(e,"onReady")}}function Ks(){const{mode:e}=i;if(e===1)return{};const t=window.iframeResizer||window.iFrameResizer;return Ys(t)?Js(t):{}}const Xs=e=>e==="true",En=e=>t=>t===void 0?void 0:e(t),_=En(Xs),te=En(Number),ei=e=>({parentId:e[0],bodyMargin:te(e[1]),calculateWidth:_(e[2]),logging:_(e[3]),autoResize:_(e[6]),bodyMarginStr:e[7],heightCalcMode:e[8],bodyBackground:e[9],bodyPadding:e[10],tolerance:te(e[11]),inPageLinks:_(e[12]),widthCalcMode:e[14],mouseEvents:_(e[15]),offsetHeight:te(e[16]),offsetWidth:te(e[17]),calculateHeight:_(e[18]),key:e[19],version:e[20],mode:te(e[21]),logExpand:_(e[23])});function ti(e){const{mode:t}=i;e.forEach(n=>{try{n()}catch(o){if(t<0)throw o;h(`<rb>Error in setup function</>
|
|
51
|
-
<i>iframe-resizer</> detected an error during setup.
|
|
52
|
-
|
|
53
|
-
Please report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>`),Mt(o)}})}function zn(e){for(const[t,n]of Object.entries(e))n!==void 0&&(i[t]=n)}function ni({logExpand:e,logging:t,parentId:n}){oo({id:n,enabled:t,expand:e}),m("initReceived"),a(`Initialising iframe v${E} ${window.location.href}`)}function oi(e){m("ready"),Kt(Ot(e)),a("Initialization complete",(({key:t,key2:n,...o})=>o)(i))}function ri({bodyBackground:e,bodyPadding:t,inPageLinks:n,onReady:o}){const r=zo(i),u=[()=>or(i),()=>Yo(i),Uo,jo,Wt,Vt,Bo,Ko,Xt,er,r?le:Eo,()=>ks(i),()=>et("background",e),()=>et("padding",t),r?le:Vs,Cs,c.applySelectors,()=>Us(n),vr,()=>lr(i),fr,()=>Ur(),()=>T(re,"Init message from host page",void 0,void 0,`${E}:${i.mode}`),Ls,D];ti(u),oi(o)}function si(e){c.firstRun&&(zn(ei(e)),ni(i),zn(Ks()),c.applySelectors=Ns(i),ri(i))}function ii(e){if(document.readyState==="loading"){a("Page not ready, ignoring init message");return}const t=e.data.slice(wt).split(":");c.target=e.source,c.origin=e.origin,si(t),c.firstRun=!1,setTimeout(()=>{c.initLock=!1},zt)}const{freeze:ci}=Object,{parse:rt}=JSON,st=e=>ci(rt(e)),In=e=>g(0,0,`${e}Stop`),ze=e=>e.data.slice(e.data.indexOf(":")+1),ai=e=>uo(e)?re:e.data.split("]")[1].split(":")[0];function li(e){const t=ze(e);a("onMessage called from parent:%c",s.HIGHLIGHT,st(t)),ae(i.onMessage,rt(t))}function di(e){const{onPageInfo:t}=c,n=ze(e);a("PageInfo received from parent:",st(n)),t?ae(t,rt(n)):In(ct)}function ui(e){const{onParentInfo:t}=c,n=st(ze(e));a("ParentInfo received from parent:",n),t?ae(t,n):In(at)}function fi(){if(c.initLock){a("Page reset ignored by init");return}a("Page size reset by host page"),sn("resetPage")}function mi(){a("Resize requested by host page"),T(Le,"Parent window requested size check")}const On=e=>c.inPageLinks.findTarget(ze(e)),Sn={init:ii,reset:fi,resize:mi,moveToAnchor:On,inPageLink:On,pageInfo:di,parentInfo:ui,message:li};function hi(e){const{firstRun:t}=c,n=ai(e);switch(m(n),!0){case n in Sn:Sn[n](e);break;case(t&&lo()):I(`Ignored message of type "${n}". Received before initialization.`);break;default:I(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const Ie=De(e=>{ao(e)&&hi(e)});function pi(){if("iframeChildListener"in window){I("Already setup");return}window.iframeChildListener=t=>setTimeout(()=>Ie({data:t,sameOrigin:!0})),m("listen"),N(window,Se,Ie),N(document,ft,Gt),Gt();function e(t){return Ie(t),c.win}try{top?.document?.getElementById("banner")&&(c.win={},window.mockMsgListener=e,Lt(window,Se,Ie),typeof window.define=="function"&&window.define([],()=>e))}catch{}}typeof window!==xn&&pi()}));
|
|
1
|
+
/*!
|
|
2
|
+
* @preserve
|
|
3
|
+
*
|
|
4
|
+
* @module iframe-resizer/child 6.0.0-beta.10 (esm) - 2026-04-16
|
|
5
|
+
*
|
|
6
|
+
* @license GPL-3.0 For use with GPL compliant sites (fully published front & backend source code)
|
|
7
|
+
* Alternatively for commercial use, you can purchase a license from
|
|
8
|
+
* https://iframe-resizer.com/pricing
|
|
9
|
+
*
|
|
10
|
+
* @description Keep same and cross domain iframes sized to their content
|
|
11
|
+
*
|
|
12
|
+
* @author David J. Bradshaw <info@iframe-resizer.com>
|
|
13
|
+
*
|
|
14
|
+
* @see {@link https://iframe-resizer.com}
|
|
15
|
+
*
|
|
16
|
+
* @copyright (c) 2013 - 2026, David J. Bradshaw. All rights reserved.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";const e="6.0.0-beta.10",t="iframeResizer",n=":",o="init",r="message",i="pageHide",a="parentInfo",s="scrollToOffset",c="data-iframe-size",l="data-iframe-overflowed",d="data-iframe-ignore",u="height",f="width",m="offsetSize",p="string",h="number",g="function",y="auto",v="readystatechange",b="bottom",z="right",w="autoResizeEnabled",$=Symbol("sizeChanged"),k="manualResize",S="parentResize",j={[k]:1,[S]:1},O="setOffsetSize",M="resizeObserver",E="overflowObserver",R="mutationObserver",T="visibilityObserver",A="none",P="No change in content size detected",I="[iFrameSizer]",x=y,C=new Set(["head","body","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),N=(e,...t)=>setTimeout(()=>e(...t),0),L=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},q=e=>e,B=e=>Math.round(1e3*e)/1e3,W=e=>e.charAt(0).toUpperCase()+e.slice(1),H=e=>""!=`${e}`&&void 0!==e,F=e=>e();const D=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${W(t)}`)},V={br:"\n",rb:"[31;1m",bb:"[34;1m",b:"[1m",i:"[3m",u:"[4m","/":"[m"},U=Object.keys(V),Z=new RegExp(`<(${U.join("|")})>`,"gi"),J=(e,t)=>V[t]??"",Q=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)},G=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),Y=new Date,_=e=>new Set(Array.from({length:9},e)),X=" - lewpylk",K=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],ee=["<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</>. 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.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> fvb jhu bzl aol <i>mpyza 11 johyhjalyz vm fvb spjluzl rlf</> av nla h 60% kpzjvbua ha oaawz://pmyhtl-ylzpgly.jvt/wypjpun.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.<iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt:<iy><iy>oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz","<yi> VLT rlf lewpylk</><iy><iy>Aol spjluzl rlf fvb hyl bzpun mvy <p>pmyhtl-ylzpgly</> pz myvt h wypvy flhy huk ohz lewpylk. Hu bwkhalk rlf pz ylslhzlk vu aol mpyza vm Uvcltily lhjo flhy.<iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt:<iy><iy>oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz","<yi>Bzl dpao slnhjf jspluaz</><iy><iy>Dolu bzpun <p>pmyhtl-ylzpgly</> jopsk whjrhnl dpao hu vskly clyzpvu vm aol whylua, fvb jhu zla aol spjluzl rlf pu aol pmyhtl. Mvy klahpsz vu ovd av zla aopz bw, wslhzl zll aol kvjbtluahapvu ha:<iy><iy>oaawz://pmyhtl-ylzpgly.jvt/zlabw/jopsk/#spjluzl"],te=[(se=["NWSc3","zvsv","wyv","ibzpulzz","VLT"])[0],...se.slice(1).map(e=>`${e}${X}`),`${se[4]}${X}`,...se.slice(1)],ne=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),oe=new Set([1,6]),re=Y[G(K[4])](),ie=_((e,t)=>Q(`${re+t}`)),ae=_((e,t)=>Q(""+(re-++t)));var se;const ce=e=>oe.has(e),le=e=>G(ee[e]),de=e=>G(K[e]),ue=e=>{const t=e[G(K[0])]||e[G(K[1])]||e[G(K[2])]||e[G(K[3])];if(!t)return-1;const n=t.split("-");let o=function(e="",t=""){let n=-2;const o=Q(G(e));return o in ne&&(n=ne[o]),9===n?(r=t,ie.has(r)?9:ae.has(r)?5:-2):n;var r}(...n);return 0===o||(r=n)[2]===Q(r[0]+r[1])||(o=-2),o;var r},fe="font-weight: normal;",me="font-weight: bold;",pe="font-style: italic;",he=fe+pe,ge="default",ye=Object.freeze({assert:!0,error:!0,warn:!0}),ve={expand:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},be={profile:0,profileEnd:0,timeStamp:0,trace:0},ze=Object.assign(console);const{fromEntries:we,keys:$e}=Object,ke=e=>[e,ze[e]],Se=e=>t=>[t,function(n){e[t]=n}],je=(e,t)=>we($e(e).map(t));const Oe=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,Me=Oe?"color: #A9C7FB;":"color: #135CD2;",Ee=Oe?"color: #E3E3E3;":"color: #1F1F1F;";let Re=!0,Te=t;var Ae;const Pe=(Ae=function(e={}){const t={},n={},o=[],r={...ve,expand:!e.collapsed||ve.expanded,...e};let i="";function a(){o.length=0,i=""}function s(){delete r.event,a()}const c=()=>!!o.some(([e])=>e in ye)||!!r.expand;function l(){if(0!==o.length){ze[c()?"group":"groupCollapsed"](`%c${r.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(r)} %c${r.showTime?i:""}`,fe,me,he);for(const[e,...t]of o)ze.assert(e in ze,`Unknown console method: ${e}`),e in ze&&ze[e](...t);ze.groupEnd(),s()}else s()}function d(){""===i&&(i=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(l)))}function u(e,...t){0===o.length&&d(),o.push([e,...t])}function f(e=ge,...n){t[e]?u("log",`${e}: ${performance.now()-t[e]} ms`,...n):u("timeLog",e,...n)}return{...je(r,Se(r)),...je(console,e=>[e,(...t)=>u(e,...t)]),...je(be,ke),assert:function(e,...t){!0!==e&&u("assert",e,...t)},count:function(e=ge){n[e]?n[e]+=1:n[e]=1,u("log",`${e}: ${n[e]}`)},countReset:function(e=ge){delete n[e]},endAutoGroup:l,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(o){if(!Error.prototype.isPrototypeOf(o))throw o;u("error",o),l()}return n},event:function(e){d(),r.event=e},purge:a,time:function(e=ge){d(),t[e]=performance.now()},timeEnd:function(e=ge){f(e),delete t[e]},timeLog:f,touch:d}},Ae?.__esModule?Ae.default:Ae)({label:`${t}(child)`,expand:!1});const Ie=e=>(...t)=>!Re||Pe[e](...t),xe=Ie("log"),Ce=xe,Ne=Ie("debug");const{assert:Le,endAutoGroup:qe,error:Be,errorBoundary:We,event:He,label:Fe,purge:De,warn:Ve}=Pe,Ue=(Ze=q,e=>Ze("string"==typeof e?window.chrome?e.replace(Z,J):(e=>e.replaceAll("<br>","\n").replaceAll(/<\/?[^>]+>/gi,""))(e):e));var Ze;const Je=(...e)=>Pe.warn(...e.map(Ue)),Qe=[];function Ge(e,t){xe(`${e} event listener: %c${t}`,Me)}const Ye=(e,t,n,o)=>{e.removeEventListener(t,n,o),Ge("Removed",t)},_e=(e,t,n,o=!1)=>{e.addEventListener(t,n,o),Qe.push(()=>Ye(e,t,n,o)),Ge("Added",t)},Xe={applySelectors:null,firstRun:!0,hasTags:!1,hasOverflow:!1,height:0,isHidden:!1,initLock:!0,inPageLinks:{},origin:void 0,hasOverflowUpdated:!0,overflowedNodeSet:new Set,sameOrigin:!1,taggedElements:[],target:window?.parent,timerActive:!1,totalTime:0,triggerLocked:!1,width:0,win:window,onPageInfo:null,onParentInfo:null};let Ke=!1;function et(e){const t=window?.iframeResizer?.targetOrigin||"*",n=Array.isArray(t)?t:[t];for(const o of n)e.postMessage("[iFrameResizerChild]Ready",o)}function tt(){if("loading"===document.readyState||!Xe.firstRun||Ke)return;const{parent:e,top:t}=window;He("ready"),xe("Sending%c ready%c to parent from",Me,Ee,window.location.href),et(e),e!==t&&et(t),Ke=!0}const nt="iframeResize",ot=["min-height","min-width","max-height","max-width"],rt=new Set,it=e=>e.tagName?e.tagName.toLowerCase():"unknown",at=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),st=(e,t)=>{return!!(n=at(e,t))&&"0px"!==n&&n!==y&&n!==A;var n};function ct({href:e}){rt.has(e)||(xe("Unable to access stylesheet:",e),rt.add(e))}const lt=(e,t)=>function(e,t){const n=e.style.getPropertyValue(t);return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const o of document.styleSheets)try{for(const n of o.cssRules||[]){if(!("selectorText"in n))continue;const r=n;if(!e.matches(r.selectorText))continue;const i=r.style.getPropertyValue(t);if(!i)continue;const{ownerNode:a}=o;return{source:a instanceof Element&&"STYLE"===a.tagName?"an inline <style> block":`stylesheet (${o.href})`,value:i}}}catch(n){ct(o)}return{source:"cross-origin stylesheet",value:at(e,t)}}(e,t),dt=(e,t)=>{const{source:n,value:o}=lt(e,t),r=it(e);Je(`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 ut(){for(const e of[document.documentElement,document.body])for(const t of ot)xe(`Checking <${it(e)}> for blocking CSS: ${t}`),st(e,t)&&dt(e,t)}const ft={autoResize:!0,bodyBackground:"",bodyMargin:0,bodyMarginStr:"",bodyPadding:"",calculateHeight:!0,calculateWidth:!1,heightCalcMode:y,ignoreSelector:"",inPageLinks:!1,logging:!1,logExpand:!1,mode:0,mouseEvents:!1,offsetHeight:0,offsetWidth:0,parentId:void 0,sizeSelector:"",targetOrigin:"*",tolerance:0,widthCalcMode:y,onBeforeResize:void 0,onMessage:()=>{Ve("onMessage function not defined")},onReady:()=>{}};function mt(){try{Xe.sameOrigin=1===ft.mode||"iframeParentListener"in window.parent}catch(e){xe("Cross domain iframe detected")}}let pt=0;function ht(){const e=document.querySelectorAll(`*[${d}]`),t=e.length>0;return t&&e.length!==pt&&(!function(e){const t=1===e.length?"":"s";Ve(`%c[${d}]%c found on %c${e.length}%c element${t}`,me,fe,me,fe)}(e),pt=e.length),t}function gt(t,n,o){var r;(!H(o)||n>-1&&t>n)&&(function(e,t){console.info(`%ciframe-resizer ${e}`,Re||t<1?"font-weight: bold;":fe)}(`v${e} (${r=t,G(te[r])})`,t),0===t&&((...e)=>{console.warn(...e.map(Ue))})(le(3)))}function yt(){"BackCompat"===document.compatMode&&Je("<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")}let vt=!1;function bt(e){"complete"===document.readyState?N(e):vt||_e(document,v,()=>bt(e)),vt=!0}const zt=()=>{Ce(`Set targetOrigin for parent: %c${ft.targetOrigin}`,Me),!0!==ft.autoResize&&xe("Auto Resize disabled")};function wt(){Xe.taggedElements=document.querySelectorAll(`[${c}]`),Xe.hasTags=Xe.taggedElements.length>0,xe(`Tagged elements found: %c${Xe.hasTags}`,Me)}function $t({version:t}){t&&""!==t&&"false"!==t?t!==e&&Je((t=>`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${t} - Child page: ${e}.\n`)(t)):Je("<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")}const kt=L(()=>Je(le(4)));function St(e,t){const{mode:n}=ft,{sameOrigin:o,target:r}=Xe;if(o)try{window.parent.iframeParentListener(I+e)}catch(i){if(!ce(n))throw new Error(i);return kt(),!1}else{Le(r,"Internal error: postMessage target is undefined");const n=function(e){return void 0===e?e=ft.targetOrigin:xe(`Message targetOrigin: %c${e}`,Me),e}(t),o=Array.isArray(n)?n:[n];for(const t of o)r.postMessage(I+e,t)}return!0}function jt(e,t,n,r,i){const{parentId:a}=ft,{sameOrigin:s}=Xe,c=`${a}:${`${e}:${t}`}:${n}${void 0===r?"":`:${r}`}`;if(ft.mode<-1)return;St(c,i)&&(!function(e){if(!Xe.timerActive)return;const t=B(performance.now()-Xe.totalTime);xe(e===o?`Initialised iframe in %c${t}ms`:`Size calculated in %c${t}ms`,Me)}(n),Ce(`Sending message to parent page via ${s?"sameOrigin":"postMessage"}: %c%c${c}`,pe,Me))}const Ot=We((e,t,n,o,r)=>{He(n),jt(e,t,n,o,r),qe()}),Mt=e=>Ot(0,0,e.type,`${e.screenY}:${e.screenX}`);function Et(e,t){xe(`Add event listener: %c${t}`,Me),_e(window.document,e,Mt)}function Rt({persisted:e}){e||Ot(0,0,"beforeUnload"),He(i),Ce("Page persisted:",e),e||Qe.forEach(F)}const Tt=()=>_e(window,i.toLowerCase(),Rt),At=(e,t)=>!(Math.abs(e-t)<=ft.tolerance);const Pt=[Me,Ee,Me],It={height:0,width:0},xt={height:0,width:0};function Ct(e,t,n){return xt[e]=t,It[e]=n,t}function Nt(e){const{hasOverflow:t,hasTags:n,triggerLocked:o}=Xe,r=e.label,i=r===u,a=e.boundingClientRect(),s=Math.ceil(a),c=Math.floor(a),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),d=`HTML: %c${a}px %cPage: %c${l}px`;let f;switch(!0){case!e.enabled():return Math.max(l,1);case n:Ce("Found element with data-iframe-size attribute"),f=e.taggedElement();break;case!t&&Xe.firstRun&&0===xt[r]&&0===It[r]:Ce(`Initial page size values: ${d}`,...Pt),f=Ct(r,a,l);break;case o&&a===xt[r]&&l===It[r]:Ce(`Size unchanged: ${d}`,...Pt),f=Math.max(a,l);break;case 0===a&&0!==l:Ce(`Page is hidden: ${d}`,...Pt),f=l;break;case!t&&a!==xt[r]&&l<=It[r]:Ce(`New <html> size: ${d} `,...Pt),Ce(`Previous <html> size: %c${xt[r]}px`,Me),f=Ct(r,a,l);break;case!i:f=e.taggedElement();break;case!t&&a<xt[r]:Ce(`<html> size decreased: ${d}`,...Pt),f=Ct(r,a,l);break;case l===c||l===s:Ce(`<html> size equals page size: ${d}`,...Pt),f=Ct(r,a,l);break;case a>l:Ce(`Page size < <html> size: ${d}`,...Pt),f=Ct(r,a,l);break;case t:Ce("Found elements possibly overflowing <html> "),f=e.taggedElement();break;default:Ce(`Using <html> size: ${d}`,...Pt),f=Ct(r,a,l)}return Ce(`Content ${r}: %c${f}px`,Me),f+=function(e){const t=e.getOffset();return 0!==t&&Ce(`Page offsetSize: %c${t}px`,Me),t}(e),Math.max(f,1)}const Lt="--ifr-start",qt="--ifr-end",Bt="--ifr-measure",Wt=[];let Ht,Ft={},Dt=0;function Vt(){try{performance.clearMarks(Lt),performance.clearMarks(qt),performance.clearMeasures(Bt)}catch{}}function Ut(e){e.getEntries().forEach(e=>{if(e.name===qt)try{const{duration:t}=performance.measure(Bt,Lt,qt);Ft=e.detail,Wt.push(t),Wt.length>100&&Wt.shift()}catch{}})}function Zt(){Ce("Attached%c PerformanceObserver%c to page",Me,Ee);const e=new PerformanceObserver(Ut);return e.observe({entryTypes:["mark"]}),Ht=setInterval(()=>{if(Wt.length<10)return;if(Ft.hasTags&&Ft.len<25)return;Wt.sort();const e=Math.min(Wt.reduce((e,t)=>e+t,0)/Wt.length,Wt[Math.floor(Wt.length/2)]),t=B(e);t>Dt&&(Dt=t,He("performanceObserver"),xe("Mean time:",B(Wt[Math.floor(Wt.length/2)])),xe("Median time:",B(Wt.reduce((e,t)=>e+t,0)/Wt.length)),xe("Average time:",t),xe("Max time:",B(Math.max(...Wt)))),Vt(),e<=4||(clearInterval(Ht),Je(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${B(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Ft.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3),{disconnect:()=>{Vt(),clearInterval(Ht),e.disconnect(),Ce("Detached%c PerformanceObserver",Me)}}}const Jt=`* ${Array.from(C).map(e=>`:not(${e})`).join("")}`,Qt=e=>e.querySelectorAll(Jt);function Gt(e){performance.mark(Lt);const t=W(e),{logging:n}=ft,{hasTags:o}=Xe,r=function(){const{hasOverflow:e,hasTags:t,overflowedNodeSet:n,taggedElements:o}=Xe;return t?o:e?Array.from(n):Qt(document.documentElement)}(),{maxEl:i,maxVal:a}=function(e,t){const n=`margin-${t}`;let o,r=document.documentElement,i=Xe.hasTags?1:document.documentElement.getBoundingClientRect().bottom;for(const a of e)o=a.getBoundingClientRect()[t]+parseFloat(getComputedStyle(a).getPropertyValue(n)),o>i&&(i=o,r=a);return{maxEl:r,maxVal:i}}(r,e);return Ce(`${t} position calculated from:`,i),Ce(`Checked %c${r.length}%c elements`,Me,Ee),performance.mark(qt,{detail:{hasTags:o,len:r.length,logging:n,Side:t}}),a}const Yt={label:u,enabled:()=>ft.calculateHeight,getOffset:()=>ft.offsetHeight,auto:()=>Nt(Yt),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),documentElementScroll:()=>document.documentElement.scrollHeight,taggedElement:()=>Gt(b)},_t={label:f,enabled:()=>ft.calculateWidth,getOffset:()=>ft.offsetWidth,auto:()=>Nt(_t),boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),documentElementScroll:()=>document.documentElement.scrollWidth,taggedElement:()=>Gt(z)};const Xt=(e,t)=>(n,o)=>{const r=e[n]();return e.enabled()&&void 0!==ft.onBeforeResize?function(e,t,n){const o=ft.onBeforeResize(e,t,n);if(void 0===o)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(o))throw new TypeError(`Invalid value returned from onBeforeResize(): ${o}, expected Number`);if(o<1)throw new RangeError(`Out of range value returned from onBeforeResize(): ${o}, must be at least 1`);return o}(r,o,t):r},Kt=Xt(Yt,u),en=Xt(_t,f);function tn(e,t,n,r){const{heightCalcMode:i,widthCalcMode:a}=ft;0===window.scrollY&&0===window.scrollX||(Ce("Reset iframe scroll position to (0, 0)"),window.scrollTo(0,0));const s=n??Kt(i,e),c=r??en(a,e),l=function(e,t){const{calculateHeight:n,calculateWidth:o}=ft,{height:r,width:i}=Xe;return n&&At(r,e)||o&&At(i,t)}(s,c)?$:e;switch(xe(`Resize event: %c${t}`,Me),l){case o:case w:case $:case k:case S:Xe.height=s,Xe.width=c;case O:return Xe;case E:case R:case M:case T:xe(P),De();break;default:De(),Ce(P)}return null}let nn=!1,on=!1,rn=null;const an=We(function(e,t,n,o,r){const{autoResize:i}=ft,{isHidden:a}=Xe;switch(He(e),!0){case!0===a&&!(e in j):if(!0===on)break;xe("Iframe hidden - Ignored resize request"),on=!0,nn=!1,cancelAnimationFrame(rn),rn=null;break;case!0===nn&&e!==E&&!(e in j):De(),xe("Resize already pending - Ignored resize request");break;case!i&&!(e in j):Ce("Resizing disabled");break;default:{on=!1,nn=!0,Xe.totalTime=performance.now(),Xe.timerActive=!0;const i=tn(e,t,n,o);i&&jt(i.height,i.width,e,r),rn||(rn=requestAnimationFrame(()=>{nn=!1,rn=null,He("requestAnimationFrame"),Ne(`Reset sendPending: %c${e}`,Me)})),Xe.timerActive=!1}}qe()});function sn({eventType:e,eventName:t}){_e(window,t,()=>an(t,e),{passive:!0})}function cn(){sn({eventType:"After Print",eventName:"afterprint"}),sn({eventType:"Before Print",eventName:"beforeprint"})}function ln(e){const{heightCalcMode:t,widthCalcMode:n}=ft,o=Yt[t](),r=_t[n]();xe(`Reset trigger event: %c${e}`,Me),Ot(o,r,e)}function dn(e){const t=ft.heightCalcMode;xe(`Reset trigger event: %c${e}`,Me),ft.heightCalcMode=x,Xe.triggerLocked?xe("TriggerLock blocked calculation"):(Xe.triggerLocked=!0,Ne("Trigger event lock on"),requestAnimationFrame(()=>{Xe.triggerLocked=!1,Ne("Trigger event lock off")})),ln("reset"),ft.heightCalcMode=t}const un=`Auto Resize can not be changed when <b>direction</> is set to '${A}'.`;function fn(e){D(e,"boolean","parentIframe.autoResize(enable) enable");const{autoResize:t,calculateHeight:n,calculateWidth:o}=ft;return!1===o&&!1===n?(He(w),Je(un),!1):(!0===e&&!1===t?(ft.autoResize=!0,queueMicrotask(()=>an(w,"Auto Resize enabled"))):!1===e&&!0===t&&(ft.autoResize=!1),Ot(0,0,"autoResize",JSON.stringify(ft.autoResize)),ft.autoResize)}function mn(e){D(e,p,"parentIframe.moveToAnchor(anchor) anchor"),Xe.inPageLinks?.findTarget?Xe.inPageLinks.findTarget(e):Je("<rb>Move to Anchor</><br><br>moveToAnchor() requires <b>inPageLinks</> to be enabled")}function pn(e){D(e,h,"parentIframe.setOffsetSize(offset) offset"),ft.offsetHeight=e,ft.offsetWidth=e,an(O,`parentIframe.setOffsetSize(${e})`)}const hn=()=>Xe.origin;function gn(e){D(e,p,"parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),xe(`Set targetOrigin: %c${e}`,Me),ft.targetOrigin=e}function yn(e){return D(e,g,"parentIframe.getParentProps(callback) callback"),Xe.onParentInfo=e,Ot(0,0,a),()=>{Xe.onParentInfo=null,Ot(0,0,"parentInfoStop")}}function vn(e,t){void 0!==e&&D(e,h,"parentIframe.resize(customHeight, customWidth) customHeight"),void 0!==t&&D(t,h,"parentIframe.resize(customHeight, customWidth) customWidth");an(k,`parentIframe.resize(${`${void 0===e?"":e}${void 0===t?"":`,${t}`}`})`,e,t)}const bn=e=>(t,n)=>{D(t,h,`parentIframe.${e}(x, y) x`),D(n,h,`parentIframe.${e}(x, y) y`),Ot(n,t,e)},zn=bn("scrollBy"),wn=bn("scrollTo"),$n=bn(s);function kn(e,t){t&&D(t,p,"parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Ot(0,0,r,JSON.stringify(e),t)}const Sn=()=>Ot(0,0,"close"),jn=()=>ft.parentId,On=()=>dn("parentIframe.reset");const Mn=(e="")=>t=>n=>{n.size>0&&Ne(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))},En=Mn("attached to"),Rn=((e="")=>t=>n=>{n.size>0&&Be(`${t}Observer ${e}:`,...Array.from(n).flatMap(e=>["\n",e]))})("already attached"),Tn=Mn("detached from"),An=(e,t=!0)=>n=>{n>0&&Ce(`${t?"At":"De"}tached %c${e}Observer%c ${t?"to":"from"} %c${n}%c element${1===n?"":"s"}`,Me,fe,Me,fe)},Pn=(e,t,n,o)=>{const r=Tn(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()}},In="Mutation",xn=new Set,Cn=new Set,Nn=new Set,Ln=[],qn={attributes:!0,attributeFilter:[d,c],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Bn,Wn=1,Hn=!1,Fn=0;const Dn=Mn("added")(In),Vn=Mn("removed (page)")(In),Un=Mn("removed (added)")(In),Zn=e=>e.nodeType!==Node.ELEMENT_NODE||C.has(e.tagName.toLowerCase());function Jn(e){const t=e.addedNodes;for(const n of t)Zn(n)||xn.add(n)}function Qn(e){const t=e.removedNodes;for(const n of t)Zn(n)||(xn.has(n)?(xn.delete(n),Nn.add(n)):Cn.add(n))}const Gn=e=>{Ce("Mutations:",e);for(const t of e)Jn(t),Qn(t);Dn(xn),Vn(Cn),Un(Nn),Nn.clear()};const Yn=e=>()=>{const t=performance.now(),n=t-Fn,o=16*Wn+++2;if(n>o&&n<200)return He("mutationThrottled"),Ce("Update delayed due to heavy workload on the callStack"),Ce(`EventLoop busy time: %c${B(n)}ms %c> Max wait: %c${o-2}ms`,Me,Ee,Me),setTimeout(Bn,16*Wn),void(Fn=t);Wn=1,Ln.forEach(Gn),Ln.length=0,Hn=!1,Cn.size>0&&xe(`Detected %c${Cn.size} %cremoved element${Cn.size>1?"s":""}`,Me,Ee),xn.size>0&&xe(`Found %c${xn.size} %cnew element${xn.size>1?"s":""}`,Me,Ee),e({addedNodes:xn,removedNodes:Cn}),xn.clear(),Cn.clear()};function _n(e){Ln.push(e),Hn||(Fn=performance.now(),Hn=!0,requestAnimationFrame(Bn))}function Xn(e){const t=new window.MutationObserver(_n),n=document.body||document.documentElement;return Bn=Yn(e),t.observe(n,qn),Ce("Attached%c MutationObserver%c to body",Me,Ee),{disconnect:()=>{xn.clear(),Cn.clear(),Ln.length=0,t.disconnect(),Ce("Detached%c MutationObserver",Me)}}}const Kn={characterData:!0,childList:!0,subtree:!0};function eo(e){const t=document.querySelector("title")??document.head??document.documentElement,n=new MutationObserver(e);return n.observe(t,Kn),Ce("Attached%c TitleObserver%c to head",Me,Ee),setTimeout(e),{disconnect:()=>{n.disconnect(),Ce("Detached%c TitleObserver",Me)}}}function to(e){const t=new IntersectionObserver(t=>e(t.at(-1)?.isIntersecting??!1),{threshold:0}),n=document.documentElement;return t.observe(n),Ce("Attached%c VisibilityObserver%c to page",Me,Ee),{disconnect:()=>{t.disconnect(),Ce("Detached%c VisibilityObserver",Me)}}}let no=new Set;function oo(){const e=function(e){const t=new Set,n=new Set;for(const o of e)o.closest(`[${d}]`)?n.add(o):t.add(o);return n.size>0&&queueMicrotask(()=>{He("overflowIgnored"),Ce("Ignoring elements with [data-iframe-ignore] > *:\n",n),qe()}),t}(document.querySelectorAll(`[${l}]`));let t=!0;return typeof Set.prototype.symmetricDifference===g&&(t=e.symmetricDifference(no).size>0),no=e,Xe.overflowedNodeSet=e,Xe.hasOverflow=e.size>0,{hasOverflowUpdated:t,overflowedNodeSet:e}}const ro={},io=e=>{const t=new Set;for(const n of e)if(n instanceof Element){t.add(n);for(const e of Qt(n))t.add(e)}return Ce("Inspecting:\n",t),t};function ao({addedNodes:e,removedNodes:t}){He("contentMutated"),Xe.applySelectors(),wt(),oo(),qe(),(e=>{if(0===e.size)return;He("removeObservers");const t=io(e);ro.overflow.detachObservers(t),ro.resize.detachObservers(t),qe()})(t),(e=>{if(0===e.size)return;He("addObservers");const t=io(e);ro.overflow.attachObservers(t),ro.resize.attachObserverToNonStaticElements(t),qe()})(e)}function so(e){ao(e),an(R,"Mutation Observed")}const co="Overflow",lo=An(co),uo=An(co,!1),fo=En(co),mo=Rn(co),po=e=>e instanceof HTMLElement&&(!!e.hidden||null===e.offsetParent||e.style.display===A);function ho(){const{hasOverflow:e}=Xe,{hasOverflowUpdated:t,overflowedNodeSet:n}=oo();switch(!0){case!t:return;case n.size>1:Ce("Overflowed Elements:",n);break;case e:break;default:Ce("No overflow detected")}an(E,"Overflow updated")}function go(e){const t={root:document.documentElement,side:ft.calculateHeight?b:z};return ro.overflow=((e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||q,i=(t=!1)=>e(t),a=(e,t)=>0===e||e>t[n],s=(e,t)=>{e.toggleAttribute(l,t)},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)&&!(r instanceof HTMLElement&&po(r));s(r,c)}r(i)},o),d=new WeakSet;return{attachObservers:function(e){const t=new Set,n=new Set;let o=0;for(const r of e)r instanceof Element&&(d.has(r)?t.add(r):(c.observe(r),d.add(r),n.add(r),o+=1));mo(t),fo(n),lo(o),n.clear(),t.clear()},detachObservers:Pn(co,c,d,uo),disconnect:()=>{c.disconnect(),Ce("Detached%c OverflowObserver",Me)}}})(ho,t),ro.overflow.attachObservers(e),ro.overflow}const yo="Resize",vo=An(yo),bo=An(yo,!1),zo=En(yo),wo=Rn(yo),$o=new WeakSet,ko=new Set,So=new Set;let jo;function Oo(e){let t=0;for(const n of e){if(!(n instanceof Element))continue;const e=getComputedStyle(n)?.position;""!==e&&"static"!==e&&($o.has(n)?ko.add(n):(jo.observe(n),$o.add(n),So.add(n),t+=1))}wo(ko),zo(So),vo(t),So.clear(),ko.clear()}function Mo(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;an(M,`Element resized <${function(e){switch(!0){case!H(e):return"";case H(e.id):return`${e.nodeName}#${e.id}`;case H(e.name):return`${e.nodeName} (${e.name}`;case H(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Eo(e){return ro.resize=(jo=new ResizeObserver(Mo),jo.observe(document.body),$o.add(document.body),Ce("Attached%c ResizeObserver%c to body",Me,Ee),{attachObserverToNonStaticElements:Oo,detachObservers:Pn(yo,jo,$o,bo),disconnect:()=>{jo.disconnect(),Ce("Detached%c ResizeObserver",Me)}}),ro.resize.attachObserverToNonStaticElements(e),ro.resize}let Ro;function To(){const e=document.title;e!==Ro&&(Ro=e,xe(`Title: %c${e}`,Me),e&&Ot(0,0,"title",e))}function Ao(e){xe(`Visible: %c${e}`,Me),Xe.isHidden=!e,an(T,"Visibility changed")}function Po(){He("attachObservers");const e=Qt(document.documentElement);!function(e){Qe.push(...e.map(e=>e.disconnect))}([Xn(so),go(e),Zt(),Eo(e),eo(To),to(Ao)])}const Io=(e,t,n)=>{if(""!==n){xe(`${e}: %c${n}`,Me);for(const e of document.querySelectorAll(n))xe(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}};function xo(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function Co(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),Ce(`Set body ${e}: %c${t}`,Me))}function No({bodyMarginStr:e,bodyMargin:t}){var n,o;void 0===e&&(e=`${t}px`),Co("margin",(n="margin",(o=e).includes("-")&&(Ve(`Negative CSS value ignored for ${n}`),o=""),o))}function Lo(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:Math.round(t.left+n.x),y:Math.round(t.top+n.y)}}function qo(e){const t=e.split("#")[1]||e,n=decodeURIComponent(t),o=document.getElementById(n)||document.getElementsByName(n)[0];void 0===o?(xe(`In page link (#${t}) not found in iframe, so sending to parent`),Ot(0,0,"inPageLink",`#${t}`)):function(e,t){const n=Lo(t);xe(`Moving to in page link (%c#${e}%c) at x: %c${n.x}%c y: %c${n.y}`,Me,Ee,Me,Ee,Me),Ot(n.y,n.x,s)}(t,o)}function Bo(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&qo(t)}function Wo(){xe("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]')){const t=e.getAttribute("href");t&&"#"!==t&&_e(e,"click",e=>{e.preventDefault(),qo(t)})}}(),_e(window,"hashchange",Bo),setTimeout(Bo,128),Xe.inPageLinks={findTarget:qo}}function Ho(){const e=e=>e.style.setProperty(u,y,"important");e(document.documentElement),e(document.body),xe("Set HTML & body height: %cauto !important",Me)}const Fo=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Do=Fo(g),Vo=Fo(h),Uo=Fo(p);function Zo(e){xe("Reading data from page:",Object.keys(e));const{offsetHeight:t,offsetWidth:n}=function(e){const{calculateHeight:t,calculateWidth:n}=ft;let o,r;return typeof e?.offsetSize===h&&(t&&(o=Vo(e,m)),n&&(r=Vo(e,m))),{offsetHeight:o,offsetWidth:r}}(e);return{offsetHeight:t,offsetWidth:n,ignoreSelector:Uo(e,"ignoreSelector"),[de(3)]:Uo(e,de(0)),sizeSelector:Uo(e,"sizeSelector"),targetOrigin:Uo(e,"targetOrigin"),onBeforeResize:Do(e,"onBeforeResize"),onMessage:Do(e,"onMessage"),onReady:Do(e,"onReady")}}function Jo(){const{mode:e}=ft;if(ce(e))return{};const t=window.iframeResizer||window.iFrameResizer;return null===(n=t)||"object"!=typeof n||Array.isArray(n)?{}:Zo(t);var n}const Qo=e=>t=>void 0===t?void 0:e(t),Go=Qo(e=>"true"===e),Yo=Qo(Number);function _o(e){for(const[t,n]of Object.entries(e))void 0!==n&&(ft[t]=n)}function Xo({logExpand:n,logging:o,parentId:r=""}){var i;Te=(i={id:r,enabled:o,expand:n}).id||t,Pe.label(`${Te}`),Pe.expand(i.expand),Re=i.enabled,He("initReceived"),xe(`Initialising iframe v${e} ${window.location.href}`)}function Ko(e){He("ready"),bt(L(e)),xe("Initialization complete",(({key:e,key2:t,...n})=>n)(ft))}function er({bodyBackground:t,bodyPadding:n,inPageLinks:r,onReady:i}){const a=(({calculateWidth:e,calculateHeight:t})=>e===t)(ft),s=[ht,mt,yt,wt,zt,a?q:ut,()=>No(ft),()=>Co("background",t),()=>Co("padding",n),a?q:Ho,xo,Xe.applySelectors,()=>function(e){const{mode:t}=ft;e?ce(t)?Je(le(5)):Wo():xe("In page linking not enabled")}(r),cn,()=>function({mouseEvents:e}){!0===e&&(Et("mouseenter","Mouse Enter"),Et("mouseleave","Mouse Leave"))}(ft),Tt,()=>function(){const{win:e}=Xe;1!==ft.mode&&(e.parentIframe=Object.freeze({autoResize:fn,close:Sn,getId:jn,getParentOrigin:hn,getParentProps:yn,moveToAnchor:mn,reset:On,setOffsetSize:pn,scrollBy:zn,scrollTo:wn,scrollToOffset:$n,sendMessage:kn,setTargetOrigin:gn,resize:vn}))}(),()=>an(o,"Init message from host page",void 0,void 0,`${e}:${ft.mode}`),Po,qe];$t(ft),function({key:e,key2:t,mode:n,version:o}){const r=n,i=H(e)?ue({key:e}):-1,a=H(t)?ue({key:t}):-1;let s;switch(n=Math.max(i,a)){case-2:case-1:De(),s=`${le(Math.min(i,a)+2)}${le(2)}`,Xe.firstRun=!1;break;case 1:case 2:case 3:s=le(6);break;case 4:s=le(7);break;case 5:s=le(8)}if(n>=0&>(n,r,o),(!H(o)||!Xe.firstRun)&&(s&&Je(s),n<0))throw Je(le(9)),s.split("<br>")[0].replace(/<\/?[a-z][^>]*>|<\/>/gi,"");ft.mode=n}(ft),function(e){const{mode:t}=ft;e.forEach(e=>{try{e()}catch(n){if(t<0)throw n;Je("<rb>Error in setup function</>\n<i>iframe-resizer</> detected an error during setup.\n\nPlease report the following error message at <u>https://github.com/davidjbradshaw/iframe-resizer/issues</>"),Be(n)}})}(s),Ko(i)}function tr(e){Xe.firstRun&&(_o((e=>({parentId:e[0],bodyMargin:Yo(e[1]),calculateWidth:Go(e[2]),logging:Go(e[3]),autoResize:Go(e[6]),bodyMarginStr:e[7],bodyBackground:e[9],bodyPadding:e[10],tolerance:Yo(e[11]),inPageLinks:Go(e[12]),mouseEvents:Go(e[15]),offsetHeight:Yo(e[16]),offsetWidth:Yo(e[17]),calculateHeight:Go(e[18]),key:e[19],version:e[20],mode:Yo(e[21]),logExpand:Go(e[23])}))(e)),Xo(ft),_o(Jo()),Xe.applySelectors=function({sizeSelector:e,ignoreSelector:t}){return()=>{Io("sizeSelector",c,e),Io("ignoreSelector",d,t)}}(ft),er(ft))}const{freeze:nr}=Object,{parse:or}=JSON,rr=e=>nr(or(e)),ir=e=>Ot(0,0,`${e}Stop`),ar=e=>e.data.slice(e.data.indexOf(n)+1),sr=e=>(e=>e.data.split(n)[2]in{true:1,false:1})(e)?o:e.data.split("]")[1].split(n)[0];const cr=e=>Xe.inPageLinks.findTarget(ar(e)),lr={init:function(e){if("loading"===document.readyState)return void xe("Page not ready, ignoring init message");const t=e.data.slice(13).split(n);Xe.target=e.source,Xe.origin=e.origin,tr(t),Xe.firstRun=!1,setTimeout(()=>{Xe.initLock=!1},128)},reset:function(){Xe.initLock?xe("Page reset ignored by init"):(xe("Page size reset by host page"),ln("resetPage"))},resize:function(){xe("Resize requested by host page"),an(S,"Parent window requested size check")},moveToAnchor:cr,inPageLink:cr,pageInfo:function(e){const{onPageInfo:t}=Xe,n=ar(e);xe("PageInfo received from parent:",rr(n)),t?N(t,or(n)):ir("pageInfo")},parentInfo:function(e){const{onParentInfo:t}=Xe,n=rr(ar(e));xe("ParentInfo received from parent:",n),t?N(t,n):ir(a)},message:function(e){const t=ar(e);xe("onMessage called from parent:%c",Me,rr(t)),N(ft.onMessage,or(t))}};function dr(e){const{firstRun:t}=Xe,n=sr(e);switch(He(n),!0){case n in lr:lr[n](e);break;case t&&(nt in window||void 0!==window.jQuery&&nt in window.jQuery.prototype):Ve(`Ignored message of type "${n}". Received before initialization.`);break;default:Ve(`Unexpected message (${e.data}), this is likely due to a newer version of iframe-resizer running on the parent page.`)}}const ur=We(e=>{(e=>I===`${e.data}`.slice(0,13))(e)&&dr(e)});"undefined"!=typeof window&&function(){if("iframeChildListener"in window)Ve("Already setup");else{window.iframeChildListener=e=>{setTimeout(()=>ur({data:e,sameOrigin:!0}))},He("listen"),_e(window,r,ur),_e(document,v,tt),tt();try{top?.document?.getElementById("banner")&&(Xe.win={},window.mockMsgListener=e,Ye(window,r,ur),"function"==typeof window.define&&window.define([],()=>e))}catch(t){}}function e(e){return ur(e),Xe.win}}()});
|
|
54
21
|
//# sourceMappingURL=index.umd.js.map
|