@iframe-resizer/child 5.5.2-beta.1 → 5.5.2-beta.2
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 +1 -1
- package/index.cjs.js +2 -2
- package/index.cjs.js.map +1 -1
- package/index.esm.js +2 -2
- package/index.esm.js.map +1 -1
- package/index.umd.js +2 -2
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.5.2-beta.
|
|
4
|
+
* @module iframe-resizer/child 5.5.2-beta.2 (cjs) - 2025-08-03
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
"use strict";const e=require("auto-console-group"),t="5.5.2-beta.1",n="iframeResizer",o=10,r="data-iframe-size",i="data-iframe-overflowed",a="data-iframe-ignore",s="bottom",l="right",c="autoResizeEnabled",u=Symbol("sizeChanged"),d="manualResize",m={},f="setOffsetSize",p="resizeObserver",h="overflowObserver",g="mutationObserver",y="visibilityObserver",v="none",b="No change in content size detected",z="init",w=new Set(["head","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),$=(e,t,n,o)=>e.addEventListener(t,n,o||!1),I=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)},O=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),H=["spjluzl","rlf","clyzpvu"],T=["<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."],S=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],M=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),E=e=>O(T[e]),k=e=>{const t=e[O(H[0])]||e[O(H[1])]||e[O(H[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=I(O(e));return n in M&&(t=M[n]),t}(n[0]);return 0===o||(e=>e[2]===I(e[0]+e[1]))(n)||(o=-2),o},G=e=>e.nodeType===Node.ELEMENT_NODE,j=(e,...t)=>setTimeout(()=>e(...t),0),R=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},A=e=>e,N=e=>Math.round(1e3*e)/1e3,L=e=>e.charAt(0).toUpperCase()+e.slice(1),x=e=>""!=`${e}`&&void 0!==e;const P=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${L(t)}`)};let C=!0,q=n;var B;const D=(B=e,B?.__esModule?B.default:B)({label:`${n}(child)`});const F=(W="log",(...e)=>!C||D[W](...e));var W;const U=F;const{assert:V,debug:Z,endAutoGroup:J,error:_,errorBoundary:Q,event:Y,label:X,purge:K,warn:ee}=D,te=e=>{return D.warn((t=A,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},ne=te,oe=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>te(t)),re=oe("Method"),ie=oe("Method","replaced with"),ae=oe("Option"),se=["min-height","min-width","max-height","max-width"],le=new Set,ce=e=>e.tagName?e.tagName.toLowerCase():"unknown",ue=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),de=(e,t)=>{return(n=ue(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function me({href:e}){le.has(e)||(F("Unable to access stylesheet:",e),le.add(e))}const fe=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){me(n)}return{source:"cross-origin stylesheet",value:ue(e,t)}}(e,t),pe=(e,t)=>{const{source:n,value:o}=fe(e,t),r=ce(e);te(`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 he(){for(const e of[document.documentElement,document.body])for(const t of se)F(`Checking <${ce(e)}> for blocking CSS: ${t}`),de(e,t)&&pe(e,t)}const ge=e=>t=>void 0===t?void 0:e(t),ye=ge(e=>"true"===e),ve=ge(Number),be=new Set,ze=new Set,we=[],$e={attributes:!0,attributeFilter:[a,r],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let Ie,Oe=1,He=!1,Te=0;const Se=t=>{U("Mutations:",t);for(const e of t){const{addedNodes:t,removedNodes:n}=e;for(const e of t)G(e)&&(w.has(e.tagName.toLowerCase())||be.add(e));for(const e of n)G(e)&&(w.has(e.tagName.toLowerCase())||(be.has(e)?be.delete(e):ze.add(e)))}ze.size>0&&F(`Detected %c${ze.size} %cremoved element${ze.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),be.size>0&&F(`Found %c${be.size} %cnew element${be.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND)};function Me(e){we.push(e),He||(Te=performance.now(),He=!0,requestAnimationFrame(Ie))}function Ee(t){const n=new window.MutationObserver(Me),o=document.body||document.documentElement;return Ie=(t=>()=>{const n=performance.now(),o=n-Te,r=16*Oe+++2;if(o>r&&o<200)return Y("mutationThrottled"),U("Update delayed due to heavy workload on the callStack"),U(`EventLoop busy time: %c${N(o)}ms %c> Max wait: %c${r-2}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(Ie,16*Oe),void(Te=n);Oe=1,we.forEach(Se),we.length=0,t({addedMutations:be,removedMutations:ze}),He=!1,be.clear(),ze.clear()})(t),n.observe(o,$e),U("Attached MutationObserver to body"),n}const ke=(t,n=!0)=>o=>{o>0&&U(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,e.HIGHLIGHT,e.NORMAL)},Ge=(e,t,n)=>e=>{let o=0;for(const r of e)n.has(r)&&(t.unobserve(r),n.delete(r),o+=1);return o},je=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,Re=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||A,a=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[n],l=(e,t)=>e.toggleAttribute(i,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t,i=e[n],a=s(i,o)&&!je(r);l(r,a)}r(a)},o),u=new WeakSet;return{attachObservers:function(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=u.has(n);e&&(V(!o,"Node already observed for overflow",n),o||(c.observe(n),u.add(n),t+=1))}return t},detachObservers:Ge(0,c,u)}},Ae="--ifr-start",Ne="--ifr-end",Le=[],xe=new WeakSet,Pe=e=>"object"==typeof e&&xe.add(e);let Ce={},qe=0;function Be(e){e.getEntries().forEach(e=>{if(e.name===Ne){const{duration:t}=performance.measure("--ifr-measure",Ae,Ne);Ce=e.detail,Le.push(t),Le.length>100&&Le.shift()}})}function De(){U("Attached PerformanceObserver to page");new PerformanceObserver(Be).observe({entryTypes:["mark"]}),Pe(document.documentElement),Pe(document.body),function(){const e=setInterval(()=>{if(Le.length<10)return;if(Ce.hasTags&&Ce.len<25)return;Le.sort();const t=Math.min(Le.reduce((e,t)=>e+t,0)/Le.length,Le[Math.floor(Le.length/2)]),n=N(t);n>qe&&(qe=n,Y("performanceObserver"),F("Mean time:",N(Le[Math.floor(Le.length/2)])),F("Median time:",N(Le.reduce((e,t)=>e+t,0)/Le.length)),F("Average time:",n),F("Max time:",N(Math.max(...Le)))),t<=4||(clearInterval(e),te(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${N(t)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Ce.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3)}()}const Fe=new WeakSet;let We;function Ue(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=Fe.has(n);if(!e)continue;const r=getComputedStyle(n)?.position;""!==r&&"static"!==r&&(V(!o,"Node already observed for resize",n),o||(We.observe(n),Fe.add(n),t+=1))}return t}const Ve=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ze=Ve("function"),Je=Ve("number"),_e=Ve("string");"undefined"!=typeof window&&function(){const I={height:()=>(ee("Custom height calculation function not defined"),Wt.auto()),width:()=>(ee("Custom width calculation function not defined"),Ut.auto())},T={},M={},A="auto",B="[iFrameSizer]",W="scroll";let _,K,oe,se,le,ce,ue,de,me,fe,pe,ge=!0,be="",ze=0,we="",$e="",Ie=!1,Oe=!0,He=!1,Te=!0,Se=!1,Me=!1,je=!1,Le=1,xe=A,Pe="",Ce=!0,qe={},Be=!1,Ve=!0,Qe=!1,Ye=0,Xe=!1,Ke=[],et="",tt="child",nt=!1,ot="",rt=[],it=window.parent,at="*",st=0,lt=!1,ct=1,ut=W,dt=window,mt=()=>{ee("onMessage function not defined")},ft=()=>{},pt=null,ht=null;function gt(i){var a,u,m;!function(e){et=e[0]??et,ze=ve(e[1])??ze,He=ye(e[2])??He,Qe=ye(e[3])??Qe,ge=ye(e[6])??ge,we=e[7]??we,xe=e[8]??xe,be=e[9]??be,$e=e[10]??$e,st=ve(e[11])??st,qe.enable=ye(e[12])??!1,tt=e[13]??tt,ut=e[14]??ut,Xe=ye(e[15])??Xe,oe=ve(e[16])??oe,se=ve(e[17])??se,Oe=ye(e[18])??Oe,_=e[19]??_,fe=e[20]??fe,Ye=ve(e[21])??Ye,Ve=ye(e[23])??Ve}(i),q=(a={id:et,enabled:Qe,expand:Ve}).id||n,D.label(`${q}`),D.expand(a.expand),C=a.enabled,F(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){F("Reading data from page:",Object.keys(e)),pe=Ze(e,"onBeforeResize")??pe,mt=Ze(e,"onMessage")??mt,ft=Ze(e,"onReady")??ft,"number"==typeof e?.offset&&(ae("offset","offsetSize"),Oe&&(oe=Je(e,"offset")??oe),He&&(se=Je(e,"offset")??se)),"number"==typeof e?.offsetSize&&(Oe&&(oe=Je(e,"offsetSize")??oe),He&&(se=Je(e,"offsetSize")??se)),K=_e(e,O(H[0]))??K,Pe=_e(e,"ignoreSelector")??Pe,ot=_e(e,"sizeSelector")??ot,at=_e(e,"targetOrigin")??at,xe=e?.heightCalculationMethod||xe,ut=e?.widthCalculationMethod||ut}function n(e,t){return"function"==typeof e&&(te(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),I[t]=e,e="custom"),e}if(1===Ye)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),xe=n(xe,"height"),ut=n(ut,"width"),U(`Set targetOrigin for parent: %c${at}`,e.HIGHLIGHT))}(),It(),function(){try{nt=1===Ye||"iframeParentListener"in window.parent}catch(e){F("Cross domain iframe detected")}}(),He===Oe&&(Ie=!0),function(){const n=Ye,o=k({key:_}),r=k({key:K});if(Ye=Math.max(o,r),Ye<0){if(Ye=Math.min(o,r),te(`${E(Ye+2)}${E(2)}`),x(fe))throw E(Ye+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!x(fe)||n>-1&&Ye>n)&&(sessionStorage.getItem("ifr")!==t&&function(t,n){console.info(`${q} %ciframe-resizer ${t}`,C||n<1?"font-weight: bold;":e.NORMAL)}(`v${t} (${(e=>O(S[e]))(Ye)})`,Ye),Ye<2&&ne(E(3)),sessionStorage.setItem("ifr",t))}(),fe&&""!==fe&&"false"!==fe?fe!==t&&te(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${fe} - Child page: ${t}.\n`):te("<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"),Tt(),St(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(r,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&te("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}(),"BackCompat"===document.compatMode&&te("<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"),vt(),Ie||he(),1!==Ye&&(dt.parentIframe=Object.freeze({autoResize:e=>(P(e,"boolean","parentIframe.autoResize(enable) enable"),!1===He&&!1===Oe?(Y(c),te(`Auto Resize can not be changed when <b>direction</> is set to '${v}'.`),!1):(!0===e&&!1===ge?(ge=!0,queueMicrotask(()=>Yt(c,"Auto Resize enabled"))):!1===e&&!0===ge&&(ge=!1),Kt(0,0,"autoResize",JSON.stringify(ge)),ge)),close(){Kt(0,0,"close")},getId:()=>et,getOrigin:()=>(re("getOrigin()","getParentOrigin()"),le),getParentOrigin:()=>le,getPageInfo(e){if("function"==typeof e)return pt=e,Kt(0,0,"pageInfo"),void ie("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");pt=null,Kt(0,0,"pageInfoStop")},getParentProps:e=>(P(e,"function","parentIframe.getParentProps(callback) callback"),ht=e,Kt(0,0,"parentInfo"),()=>{ht=null,Kt(0,0,"parentInfoStop")}),getParentProperties(e){re("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){P(e,"string","parentIframe.moveToAnchor(anchor) anchor"),qe.findTarget(e)},reset(){!function(){const t=xe;xe=A,F("Reset trigger event: %cparentIframe.reset",e.HIGHLIGHT),lt?F("TriggerLock blocked calculation"):(lt=!0,Z("Trigger event lock on"),requestAnimationFrame(()=>{lt=!1,Z("Trigger event lock off")})),Xt("reset"),xe=t}()},setOffsetSize(e){P(e,"number","parentIframe.setOffsetSize(offset) offset"),oe=e,se=e,Yt(f,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){P(e,"number","parentIframe.scrollBy(x, y) x"),P(t,"number","parentIframe.scrollBy(x, y) y"),Kt(t,e,"scrollBy")},scrollTo(e,t){P(e,"number","parentIframe.scrollTo(x, y) x"),P(t,"number","parentIframe.scrollTo(x, y) y"),Kt(t,e,"scrollTo")},scrollToOffset(e,t){P(e,"number","parentIframe.scrollToOffset(x, y) x"),P(t,"number","parentIframe.scrollToOffset(x, y) y"),Kt(t,e,"scrollToOffset")},sendMessage(e,t){t&&P(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Kt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){xe=e,Tt()},setWidthCalculationMethod(e){ut=e,St()},setTargetOrigin(t){P(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),F(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),at=t},resize(e,t){e&&P(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&P(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),Yt(d,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){re("size()","resize()"),this.resize(e,t)}}),dt.parentIFrame=dt.parentIframe),function(){function t(e){Kt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){F(`Add event listener: %c${o}`,e.HIGHLIGHT),$(window.document,n,t)}!0===Xe&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),qe=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(e){const n=e.getBoundingClientRect(),r=t();return{x:parseInt(n.left,o)+parseInt(r.x,o),y:parseInt(n.top,o)+parseInt(r.y,o)}}function r(t){function o(t){const o=n(t);F(`Moving to in page link (%c#${r}%c) at x: %c${o.x}%c y: %c${o.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Kt(o.y,o.x,"scrollToOffset")}const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(F(`In page link (#${r}) not found in iFrame, so sending to parent`),Kt(0,0,"inPageLink",`#${r}`)):o(a)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&r(t)}function a(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&$(e,"click",t=>{t.preventDefault(),r(e.getAttribute("href"))})}function s(){$(window,"hashchange",i)}function l(){setTimeout(i,128)}function c(){F("Setting up location.hash handlers"),a(),s(),l()}return qe.enable?1===Ye?te("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():F("In page linking not enabled"),{findTarget:r}}(),void 0===we&&(we=`${ze}px`),wt("margin",(u="margin",(m=we).includes("-")&&(ee(`Negative CSS value ignored for ${u}`),m=""),m)),wt("background",be),wt("padding",$e),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),Ie||function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),F("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==ge&&F("Auto Resize disabled"),function(e){Ot({method:e,eventType:"After Print",eventName:"afterprint"}),Ot({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ot({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=Ct(document.documentElement)();F("Attaching Observers"),Ee(Lt),function(e){const t={root:document.documentElement,side:Oe?s:l};ce=Re(Rt,t);const n=ce.attachObservers(e);Mt(n)}(e),De(),function(e){We=new ResizeObserver(At),We.observe(document.body),Fe.add(document.body),U("Attached ResizeObserver to body"),ue={attachObserverToNonStaticElements:Ue,detachObservers:Ge(0,We,Fe)};const t=ue.attachObserverToNonStaticElements(e);kt(t)}(e),function(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;t.observe(n),U("Attached VisibilityObserver to page")}(Nt)}(),yt(R(ft)),F("Initialization complete"),Yt(z,"Init message from host page",void 0,void 0,`${t}:${Ye}`),document.title&&""!==document.title&&Kt(0,0,"title",document.title)}function yt(e){"complete"===document.readyState?j(e):$(document,"readystatechange",()=>yt(e))}function vt(){rt=document.querySelectorAll(`[${r}]`),je=rt.length>0,F(`Tagged elements found: %c${je}`,e.HIGHLIGHT)}let bt=0;function zt(){const t=document.querySelectorAll(`*[${a}]`);return Se=t.length>0,Se&&t.length!==bt&&(function(t){const n=1===t.length?"":"s";ee(`%c[${a}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),bt=t.length),Se}function wt(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),U(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function $t(t,n,o){if(""!==o){F(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))F(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function It(){$t("sizeSelector",r,ot),$t("ignoreSelector",a,Pe)}function Ot(t){({add(e){function n(){Yt(t.eventName,t.eventType)}M[e]=n,$(window,e,n,{passive:!0})},remove(e){const t=M[e];var n,o;delete M[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),F(`${L(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Ht(t,n,o,r){return n!==t&&(t in o||(ee(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in T)&&te(`<rb>Deprecated ${r}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${fe?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),F(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function Tt(){xe=Ht(xe,A,Wt,"height")}function St(){ut=Ht(ut,W,Ut,"width")}const Mt=ke("Overflow"),Et=ke("Overflow",!1),kt=ke("Resize"),Gt=ke("Resize",!1);function jt(){const e=document.querySelectorAll(`[${i}]`);Ke=Array.from(e).filter(e=>!e.closest(`[${a}]`)),Me=Ke.length>0}function Rt(e){jt(),(Me||e)&&(Ke.length>1?U("Overflowed Elements:",...Ke):Me||U("Overflow removed"),Yt(h,"Overflow updated"))}function At(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;Yt(p,`Element resized <${function(e){switch(!0){case!x(e):return"";case x(e.id):return`${e.nodeName}#${e.id}`;case x(e.name):return`${e.nodeName} (${e.name}`;case x(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Nt(t){F(`Visible: %c${t}`,e.HIGHLIGHT),Be=!t,Yt(y,"Visibility changed")}function Lt(e){!function({addedMutations:e,removedMutations:t}){Y("contentMutated"),It(),vt(),jt();let n=0,o=0,r=0,i=0;for(const e of t){const t=Ct(e)();o+=ce.detachObservers(t),i+=ue.detachObservers(t)}for(const t of e){const e=Ct(t)();n+=ce.attachObservers(e),r+=ue.attachObserverToNonStaticElements(e)}Et(o),Gt(i),Mt(n),kt(r),J()}(e),Yt(g,"Mutation Observed")}function xt(e){performance.mark(Ae);const t=L(e);let n=0,o=document.documentElement,r=je?0:document.documentElement.getBoundingClientRect().bottom;const i=je?rt:Me?Ke:Ct(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return U(`${t} position calculated from:`,o),performance.mark(Ne,{detail:{hasTags:je,len:i.length,logging:Qe,Side:t}}),r}const Pt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],Ct=e=>()=>{V(G(e),"getAllElements() requires a DOM element");const t=["* ",...[...w].map(e=>`not(${e})`)];return zt()&&t.push(`not([${a}])`,`not([${a}] *)`),[e,...e.querySelectorAll(t.join(":"))]},qt={height:0,width:0},Bt={height:0,width:0},Dt=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function Ft(t){function n(){return Bt[r]=i,qt[r]=l,i}const o=t===Wt,r=o?"height":"width",i=t.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${i}px %cPage: %c${l}px`;let u=0;switch(!0){case!t.enabled():return l;case je:U("Found element with data-iframe-size attribute"),u=t.taggedElement();break;case!Me&&0===Bt[r]&&0===qt[r]:U(`Initial page size values: ${c}`,...Dt),u=n();break;case lt&&i===Bt[r]&&l===qt[r]:U(`Size unchanged: ${c}`,...Dt),u=Math.max(i,l);break;case 0===i:U(`Page is hidden: ${c}`,...Dt),u=l;break;case!Me&&i!==Bt[r]&&l<=qt[r]:U(`New <html> size: ${c} `,...Dt),U(`Previous <html> size: %c${Bt[r]}px`,e.HIGHLIGHT),u=n();break;case!o:u=t.taggedElement();break;case!Me&&i<Bt[r]:U(`<html> size decreased: ${c}`,...Dt),u=n();break;case l===s||l===a:U(`<html> size equals page size: ${c}`,...Dt),u=n();break;case i>l:U(`Page size < <html> size: ${c}`,...Dt),u=n();break;case Me:U("Found element overflowing <html> "),u=t.taggedElement();break;default:U(`Using <html> size: ${c}`,...Dt),u=n()}return U(`Content ${r}: %c${u}px`,e.HIGHLIGHT),u+=function(t){const n=t.getOffset();return 0!==n&&U(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),u}const Wt={enabled:()=>Oe,getOffset:()=>oe,auto:()=>Ft(Wt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,o)+parseInt(t.marginBottom,o)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Wt.bodyOffset(),custom:()=>I.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Pt(Wt)),min:()=>Math.min(...Pt(Wt)),grow:()=>Wt.max(),lowestElement:()=>xt(s),taggedElement:()=>xt(s)},Ut={enabled:()=>He,getOffset:()=>se,auto:()=>Ft(Ut),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>I.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Pt(Ut)),min:()=>Math.min(...Pt(Ut)),rightMostElement:()=>xt(l),scroll:()=>Math.max(Ut.bodyScroll(),Ut.documentElementScroll()),taggedElement:()=>xt(l)},Vt=(e,t)=>!(Math.abs(e-t)<=st);function Zt(e,t){const n=e[t]();return e.enabled()&&void 0!==pe?function(e){const t=pe(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);return t}(n):n}let Jt=!1;const _t=R(()=>ne(E(4)));let Qt=!1;const Yt=Q((t,n,o,r,i)=>{if(me=performance.now(),de=!0,Y(t),!0!==Jt){if(!ge&&!(t in m))return U("Resizing disabled"),void J();if(Be){if(!0===Qt)return;return F("Iframe hidden - Ignored resize request"),void(Qt=!0)}Qt=!1,Jt=!0,requestAnimationFrame(()=>{Jt=!1}),function(t,n,o,r,i){const a=o??Zt(Wt,xe),s=r??Zt(Ut,ut),l=Oe&&Vt(Le,a)||He&&Vt(ct,s)?u:t;switch(F(`Resize event: %c${n}`,e.HIGHLIGHT),l){case z:case c:case u:Le=a,ct=s;case f:Kt(Le,ct,t,i);break;case h:case g:case p:case y:F(b);break;default:U(b)}de=!1}(t,n,o,r,i)}});function Xt(e){Le=Wt[xe](),ct=Ut[ut](),Kt(Le,ct,e)}const Kt=Q(function(t,n,o,r,i){Ye<-1||(Y(o),void 0!==i?F(`Message targetOrigin: %c${i}`,e.HIGHLIGHT):i=at,function(){const a=`${et}:${t}:${n}:${o}${void 0===r?"":`:${r}`}`;if(nt)try{window.parent.iframeParentListener(B+a)}catch(e){if(1!==Ye)throw e;return void _t()}else it.postMessage(B+a,i);de&&F(function(){const e=N(performance.now()-me);return o===z?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),U(`Sending message to parent page via ${nt?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),J())}),en=Q(function(t){Y("onMessage");const{freeze:n}=Object,{parse:o}=JSON,r=e=>n(o(e)),i=e=>Kt(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void F("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");it=t.source,le=t.origin,gt(e),Te=!1,setTimeout(()=>{Ce=!1},128)},reset(){Ce?F("Page reset ignored by init"):(F("Page size reset by host page"),Xt("resetPage"))},resize(){F("Resize requested by host page"),Yt("parentResize","Parent window requested size check")},moveToAnchor(){qe.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();F("PageInfo received from parent:",r(e)),pt?j(pt,o(e)):i("pageInfo")},parentInfo(){const e=r(l());F("ParentInfo received from parent:",e),ht?j(ht,e):i("parentInfo")},message(){const t=l();F("onMessage called from parent:%c",e.HIGHLIGHT,r(t)),j(mt,o(t))}},s=()=>t.data.split("]")[1].split(":")[0],l=()=>t.data.slice(t.data.indexOf(":")+1),c=()=>t.data.split(":")[2]in{true:1,false:1};function u(){const e=s();Y(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||ee(`Unexpected message (${t.data})`)}B===`${t.data}`.slice(0,13)&&function(){if(!1!==Te)return c()?(X(s()),Y(z),void a.init()):void F(`Ignored message of type "${s()}". Received before initialization.`);u()}()});function tn(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?ee("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>en({data:e,sameOrigin:!0})),$(window,"message",en),$(window,"readystatechange",tn),tn())}();
|
|
20
|
+
"use strict";const e=require("auto-console-group"),t="5.5.2-beta.2",n="iframeResizer",o=10,r="data-iframe-size",i="data-iframe-overflowed",a="data-iframe-ignore",s="bottom",l="right",c="autoResizeEnabled",d=Symbol("sizeChanged"),u={},m="setOffsetSize",f="resizeObserver",p="overflowObserver",h="mutationObserver",g="visibilityObserver",y="No change in content size detected",v="init",b=new Set(["head","meta","base","title","script","link","style","map","area","option","optgroup","template","track","wbr","nobr"]),z=(e,t,n,o)=>e.addEventListener(t,n,o||!1),w=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)},$=e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)),I=["spjluzl","rlf","clyzpvu"],H=["<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."],O=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],T=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)])),S=e=>$(H[e]),E=e=>{const t=e[$(I[0])]||e[$(I[1])]||e[$(I[2])];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=w($(e));return n in T&&(t=T[n]),t}(n[0]);return 0===o||(e=>e[2]===w(e[0]+e[1]))(n)||(o=-2),o},M=(e,...t)=>setTimeout(()=>e(...t),0),N=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},G=e=>e,R=e=>Math.round(1e3*e)/1e3,k=e=>e.charAt(0).toUpperCase()+e.slice(1),L=e=>""!=`${e}`&&void 0!==e;const j=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${k(t)}`)};let A=!0,x=n;var C;const P=(C=e,C?.__esModule?C.default:C)({label:`${n}(child)`});const B=(F="log",(...e)=>!A||P[F](...e));var F;const q=B;const{assert:D,debug:W,endAutoGroup:U,error:V,errorBoundary:Z,event:J,label:_,purge:Q,warn:Y}=P,X=e=>{return P.warn((t=G,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},K=X,ee=(e=>(t,n="renamed to")=>(o,r,i="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${r}</>. ${i}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))((e,t)=>X(t)),te=ee("Method"),ne=ee("Method","replaced with"),oe=ee("Option"),re=["min-height","min-width","max-height","max-width"],ie=new Set,ae=e=>e.tagName?e.tagName.toLowerCase():"unknown",se=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),le=(e,t)=>{return(n=se(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function ce({href:e}){ie.has(e)||(B("Unable to access stylesheet:",e),ie.add(e))}const de=(e,t)=>function(e,t){const n=e.style[t];return n?{source:"an inline style attribute",value:n}:null}(e,t)||function(e,t){for(const n of document.styleSheets)try{for(const o of n.cssRules||[])if(o.selectorText&&e.matches(o.selectorText)){const e=o.style[t];if(e)return{source:"STYLE"===n.ownerNode.tagName?"an inline <style> block":`stylesheet (${n.href})`,value:e}}}catch(e){ce(n)}return{source:"cross-origin stylesheet",value:se(e,t)}}(e,t),ue=(e,t)=>{const{source:n,value:o}=de(e,t),r=ae(e);X(`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 me(){for(const e of[document.documentElement,document.body])for(const t of re)B(`Checking <${ae(e)}> for blocking CSS: ${t}`),le(e,t)&&ue(e,t)}const fe=e=>t=>void 0===t?void 0:e(t),pe=fe(e=>"true"===e),he=fe(Number),ge=new Set,ye=new Set,ve=[],be={attributes:!0,attributeFilter:[a,r],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};let ze,we=1,$e=!1,Ie=0;const He=e=>e.nodeType!==Node.ELEMENT_NODE||b.has(e.tagName.toLowerCase());function Oe(t){const n=t.addedNodes;for(const t of n)He(t)||(ge.add(t),W(`Added: %c${t.tagName.toLowerCase()}%c ${t.id||""}`,e.HIGHLIGHT,e.FOREGROUND,t))}function Te(t){const n=t.removedNodes;for(const t of n)He(t)||(ge.has(t)?(ge.delete(t),W(`Removed (Added): %c${t.tagName.toLowerCase()}%c ${t.id||""}`,e.HIGHLIGHT,e.FOREGROUND,t)):(ye.add(t),W(`Removed (page): %c${t.tagName.toLowerCase()}%c ${t.id||""}`,e.HIGHLIGHT,e.FOREGROUND,t)))}const Se=e=>{q("Mutations:",e);for(const t of e)Oe(t),Te(t)};const Ee=t=>()=>{const n=performance.now(),o=n-Ie,r=16*we+++2;if(o>r&&o<200)return J("mutationThrottled"),q("Update delayed due to heavy workload on the callStack"),q(`EventLoop busy time: %c${R(o)}ms %c> Max wait: %c${r-2}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(ze,16*we),void(Ie=n);we=1,ve.forEach(Se),ve.length=0,$e=!1,ye.size>0&&B(`Detected %c${ye.size} %cremoved element${ye.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),ge.size>0&&B(`Found %c${ge.size} %cnew element${ge.size>1?"s":""}`,e.HIGHLIGHT,e.FOREGROUND),t({addedNodes:ge,removedNodes:ye}),ge.clear(),ye.clear()};function Me(e){ve.push(e),$e||(Ie=performance.now(),$e=!0,requestAnimationFrame(ze))}function Ne(e){const t=new window.MutationObserver(Me),n=document.body||document.documentElement;return ze=Ee(e),t.observe(n,be),q("Attached MutationObserver to body"),t}const Ge=(t,n=!0)=>o=>{o>0&&q(`${n?"At":"De"}tached ${t}Observer ${n?"to":"from"} %c${o}%c element${1===o?"":"s"}`,e.HIGHLIGHT,e.NORMAL)},Re=(e,t,n)=>e=>{let o=0;for(const r of e)n.has(r)&&(t.unobserve(r),n.delete(r),o+=1);return o},ke=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,Le=(e,t)=>{const n=t.side,o={root:t.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||G,a=(t=!1)=>e(t),s=(e,t)=>0===e||e>t[n],l=(e,t)=>e.toggleAttribute(i,t);const c=new IntersectionObserver(function(e){for(const t of e){const{boundingClientRect:e,rootBounds:o,target:r}=t,i=e[n],a=s(i,o)&&!ke(r);l(r,a)}r(a)},o),d=new WeakSet;return{attachObservers:function(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=d.has(n);e&&(D(!o,"Node already observed for overflow",n),o||(c.observe(n),d.add(n),t+=1))}return t},detachObservers:Re(0,c,d)}},je="--ifr-start",Ae="--ifr-end",xe=[],Ce=new WeakSet,Pe=e=>"object"==typeof e&&Ce.add(e);let Be={},Fe=0;function qe(e){e.getEntries().forEach(e=>{if(e.name===Ae){const{duration:t}=performance.measure("--ifr-measure",je,Ae);Be=e.detail,xe.push(t),xe.length>100&&xe.shift()}})}function De(){q("Attached PerformanceObserver to page");new PerformanceObserver(qe).observe({entryTypes:["mark"]}),Pe(document.documentElement),Pe(document.body),function(){const e=setInterval(()=>{if(xe.length<10)return;if(Be.hasTags&&Be.len<25)return;xe.sort();const t=Math.min(xe.reduce((e,t)=>e+t,0)/xe.length,xe[Math.floor(xe.length/2)]),n=R(t);n>Fe&&(Fe=n,J("performanceObserver"),B("Mean time:",R(xe[Math.floor(xe.length/2)])),B("Median time:",R(xe.reduce((e,t)=>e+t,0)/xe.length)),B("Average time:",n),B("Max time:",R(Math.max(...xe)))),t<=4||(clearInterval(e),X(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(t)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${Be.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))},5e3)}()}const We=new WeakSet;let Ue;function Ve(e){let t=0;for(const n of e){const e=n.nodeType===Node.ELEMENT_NODE,o=We.has(n);if(!e)continue;const r=getComputedStyle(n)?.position;""!==r&&"static"!==r&&(D(!o,"Node already observed for resize",n),o||(Ue.observe(n),We.add(n),t+=1))}return t}const Ze=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Je=Ze("function"),_e=Ze("number"),Qe=Ze("string");"undefined"!=typeof window&&function(){const w={height:()=>(Y("Custom height calculation function not defined"),rn.auto()),width:()=>(Y("Custom width calculation function not defined"),an.auto())},H={},T={},C="auto",F="[iFrameSizer]",D="scroll";let Q,ee,re,ie,ae,se,le,ce,de,ue,fe,ge=!0,ye="",ve=0,be="",ze="",we=!1,$e=!0,Ie=!1,He=!0,Oe=!1,Te=!1,Se=!1,Ee=1,Me=C,ke="",xe=!0,Ce={},Pe=!1,Be=!0,Fe=!1,qe=0,Ze=!1,Ye=[],Xe="",Ke="child",et=!1,tt="",nt=[],ot=window.parent,rt="*",it=0,at=!1,st=1,lt=D,ct=window,dt=()=>{Y("onMessage function not defined")},ut=()=>{},mt=null,ft=null;function pt(o){var r;!function(e){Xe=e[0]??Xe,ve=he(e[1])??ve,Ie=pe(e[2])??Ie,Fe=pe(e[3])??Fe,ge=pe(e[6])??ge,be=e[7]??be,Me=e[8]??Me,ye=e[9]??ye,ze=e[10]??ze,it=he(e[11])??it,Ce.enable=pe(e[12])??!1,Ke=e[13]??Ke,lt=e[14]??lt,Ze=pe(e[15])??Ze,re=he(e[16])??re,ie=he(e[17])??ie,$e=pe(e[18])??$e,Q=e[19]??Q,ue=e[20]??ue,qe=he(e[21])??qe,Be=pe(e[23])??Be}(o),x=(r={id:Xe,enabled:Fe,expand:Be}).id||n,P.label(`${x}`),P.expand(r.expand),A=r.enabled,B(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){B("Reading data from page:",Object.keys(e)),fe=Je(e,"onBeforeResize")??fe,dt=Je(e,"onMessage")??dt,ut=Je(e,"onReady")??ut,"number"==typeof e?.offset&&(oe("offset","offsetSize"),$e&&(re=_e(e,"offset")??re),Ie&&(ie=_e(e,"offset")??ie)),"number"==typeof e?.offsetSize&&($e&&(re=_e(e,"offsetSize")??re),Ie&&(ie=_e(e,"offsetSize")??ie)),ee=Qe(e,$(I[0]))??ee,ke=Qe(e,"ignoreSelector")??ke,tt=Qe(e,"sizeSelector")??tt,rt=Qe(e,"targetOrigin")??rt,Me=e?.heightCalculationMethod||Me,lt=e?.widthCalculationMethod||lt}function n(e,t){return"function"==typeof e&&(X(`<rb>Deprecated Option(${t}CalculationMethod)</>\n\nThe use of <b>${t}CalculationMethod</> as a function is deprecated and will be removed in a future version of <i>iframe-resizer</>. Please use the new <b>onBeforeResize</> event handler instead.\n\nSee <u>https://iframe-resizer.com/api/child</> for more details.`),w[t]=e,e="custom"),e}if(1===qe)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),Me=n(Me,"height"),lt=n(lt,"width"),q(`Set targetOrigin for parent: %c${rt}`,e.HIGHLIGHT))}(),[zt,$t,kt,vt,wt,Gt,Rt,Mt,bt,gt,we?G:me,Ot,Ct,xt,At,Tt,()=>It("background",ye),()=>It("padding",ze),we?G:St,jt,Lt,_t].forEach(e=>{try{e()}catch(e){if(qe<0)throw e;X("<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</>"),V(e)}}),ht(N(ut)),B("Initialization complete"),mn(v,"Init message from host page",void 0,void 0,`${t}:${qe}`),document.title&&""!==document.title&&pn(0,0,"title",document.title)}function ht(e){"complete"===document.readyState?M(e):z(document,"readystatechange",()=>ht(e))}function gt(){nt=document.querySelectorAll(`[${r}]`),Se=nt.length>0,B(`Tagged elements found: %c${Se}`,e.HIGHLIGHT)}let yt=0;function vt(){const t=document.querySelectorAll(`*[${a}]`);return Oe=t.length>0,Oe&&t.length!==yt&&(function(t){const n=1===t.length?"":"s";Y(`%c[${a}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),yt=t.length),Oe}function bt(){"BackCompat"===document.compatMode&&X("<rb>Quirks Mode Detected</>\n\nThis iframe is running in the browser's legacy <b>Quirks Mode</>, this may cause issues with the correct operation of <i>iframe-resizer</>. It is recommended that you switch to the modern <b>Standards Mode</>.\n\nFor more information see <u>https://iframe-resizer.com/quirks-mode</>.\n")}function zt(){ue&&""!==ue&&"false"!==ue?ue!==t&&X(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ue} - Child page: ${t}.\n`):X("<rb>Legacy version detected on parent page</>\n\nDetected legacy version of parent page script. It is recommended to update the parent page to use <b>@iframe-resizer/parent</>.\n\nSee <u>https://iframe-resizer.com/setup/</> for more details.\n")}function wt(){try{et=1===qe||"iframeParentListener"in window.parent}catch(e){B("Cross domain iframe detected")}}function $t(){Ie===$e&&(we=!0)}function It(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),q(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function Ht(t,n,o){if(""!==o){B(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))B(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function Ot(){Ht("sizeSelector",r,tt),Ht("ignoreSelector",a,ke)}function Tt(){var e,t;void 0===be&&(be=`${ve}px`),It("margin",(e="margin",(t=be).includes("-")&&(Y(`Negative CSS value ignored for ${e}`),t=""),t))}function St(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),B("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}function Et(t){({add(e){function n(){mn(t.eventName,t.eventType)}T[e]=n,z(window,e,n,{passive:!0})},remove(e){const t=T[e];var n,o;delete T[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),B(`${k(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function Mt(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(r,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&X("<rb>Deprecated Attributes</>\n \nThe <b>data-iframe-height</> and <b>data-iframe-width</> attributes have been deprecated and replaced with the single <b>data-iframe-size</> attribute. Use of the old attributes will be removed in a future version of <i>iframe-resizer</>.")}function Nt(t,n,o,r){return n!==t&&(t in o||(Y(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in H)&&X(`<rb>Deprecated ${r}CalculationMethod (${t})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${r} calculation method. It is recommended that you ${ue?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),B(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function Gt(){Me=Nt(Me,C,rn,"height")}function Rt(){lt=Nt(lt,D,an,"width")}function kt(){const n=qe,o=E({key:Q}),r=E({key:ee});if(qe=Math.max(o,r),qe<0){if(qe=Math.min(o,r),X(`${S(qe+2)}${S(2)}`),L(ue))throw S(qe+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"")}else(!L(ue)||n>-1&&qe>n)&&(sessionStorage.getItem("ifr")!==t&&function(t,n){console.info(`${x} %ciframe-resizer ${t}`,A||n<1?"font-weight: bold;":e.NORMAL)}(`v${t} (${(e=>$(O[e]))(qe)})`,qe),qe<2&&K(S(3)),sessionStorage.setItem("ifr",t))}function Lt(){!0!==ge&&B("Auto Resize disabled"),function(e){Et({method:e,eventType:"After Print",eventName:"afterprint"}),Et({method:e,eventType:"Before Print",eventName:"beforeprint"}),Et({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add")}function jt(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}function At(){function t(e){const t=e.getBoundingClientRect(),n={x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop};return{x:parseInt(t.left,o)+parseInt(n.x,o),y:parseInt(t.top,o)+parseInt(n.y,o)}}function n(n){const o=n.split("#")[1]||n,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(B(`In page link (#${o}) not found in iFrame, so sending to parent`),pn(0,0,"inPageLink",`#${o}`)):function(n){const r=t(n);B(`Moving to in page link (%c#${o}%c) at x: %c${r.x}%c y: %c${r.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),pn(r.y,r.x,"scrollToOffset")}(i)}function r(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}Ce.enable?1===qe?X("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):(B("Setting up location.hash handlers"),function(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&z(e,"click",t=>{t.preventDefault(),n(e.getAttribute("href"))})}(),z(window,"hashchange",r),setTimeout(r,128)):B("In page linking not enabled"),Ce={findTarget:n}}function xt(){function t(e){pn(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){B(`Add event listener: %c${o}`,e.HIGHLIGHT),z(window.document,n,t)}!0===Ze&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}function Ct(){1!==qe&&(ct.parentIframe=Object.freeze({autoResize:e=>(j(e,"boolean","parentIframe.autoResize(enable) enable"),!1===Ie&&!1===$e?(J(c),X("Auto Resize can not be changed when <b>direction</> is set to 'none'."),!1):(!0===e&&!1===ge?(ge=!0,queueMicrotask(()=>mn(c,"Auto Resize enabled"))):!1===e&&!0===ge&&(ge=!1),pn(0,0,"autoResize",JSON.stringify(ge)),ge)),close(){pn(0,0,"close")},getId:()=>Xe,getOrigin:()=>(te("getOrigin()","getParentOrigin()"),ae),getParentOrigin:()=>ae,getPageInfo(e){if("function"==typeof e)return mt=e,pn(0,0,"pageInfo"),void ne("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");mt=null,pn(0,0,"pageInfoStop")},getParentProps:e=>(j(e,"function","parentIframe.getParentProps(callback) callback"),ft=e,pn(0,0,"parentInfo"),()=>{ft=null,pn(0,0,"parentInfoStop")}),getParentProperties(e){te("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){j(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Ce.findTarget(e)},reset(){!function(){const t=Me;Me=C,B(`Reset trigger event: %c${"parentIframe.reset"}`,e.HIGHLIGHT),at?B("TriggerLock blocked calculation"):(at=!0,W("Trigger event lock on"),requestAnimationFrame(()=>{at=!1,W("Trigger event lock off")})),fn("reset"),Me=t}()},setOffsetSize(e){j(e,"number","parentIframe.setOffsetSize(offset) offset"),re=e,ie=e,mn(m,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){j(e,"number","parentIframe.scrollBy(x, y) x"),j(t,"number","parentIframe.scrollBy(x, y) y"),pn(t,e,"scrollBy")},scrollTo(e,t){j(e,"number","parentIframe.scrollTo(x, y) x"),j(t,"number","parentIframe.scrollTo(x, y) y"),pn(t,e,"scrollTo")},scrollToOffset(e,t){j(e,"number","parentIframe.scrollToOffset(x, y) x"),j(t,"number","parentIframe.scrollToOffset(x, y) y"),pn(t,e,"scrollToOffset")},sendMessage(e,t){t&&j(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),pn(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Me=e,Gt()},setWidthCalculationMethod(e){lt=e,Rt()},setTargetOrigin(t){j(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),B(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),rt=t},resize(e,t){e&&j(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&j(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),mn("manualResize",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){te("size()","resize()"),this.resize(e,t)}}),ct.parentIFrame=ct.parentIframe)}const Pt=Ge("Overflow"),Bt=Ge("Overflow",!1),Ft=Ge("Resize"),qt=Ge("Resize",!1);function Dt(){const e=document.querySelectorAll(`[${i}]`);Ye=Array.from(e).filter(e=>!e.closest(`[${a}]`)),Te=Ye.length>0}function Wt(e){Dt(),(Te||e)&&(Ye.length>1?q("Overflowed Elements:",...Ye):Te||q("No overflow detected"),mn(p,"Overflow updated"))}function Ut(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;mn(f,`Element resized <${function(e){switch(!0){case!L(e):return"";case L(e.id):return`${e.nodeName}#${e.id}`;case L(e.name):return`${e.nodeName} (${e.name}`;case L(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}function Vt(e){Ue=new ResizeObserver(Ut),Ue.observe(document.body),We.add(document.body),q("Attached ResizeObserver to body"),le={attachObserverToNonStaticElements:Ve,detachObservers:Re(0,Ue,We)};const t=le.attachObserverToNonStaticElements(e);Ft(t)}function Zt(t){B(`Visible: %c${t}`,e.HIGHLIGHT),Pe=!t,mn(g,"Visibility changed")}function Jt(e){!function({addedNodes:e,removedNodes:t}){J("contentMutated"),Ot(),gt(),Dt();let n=0,o=0,r=0,i=0;B("removedNodes:",t);for(const e of t){const t=Kt(e)();o+=se.detachObservers(t),i+=le.detachObservers(t)}B("addedNodes:",e);for(const t of e){const e=Kt(t)();n+=se.attachObservers(e),r+=le.attachObserverToNonStaticElements(e)}Bt(o),Pt(n),qt(i),Ft(r),U()}(e),mn(h,"Mutation Observed")}function _t(){const e=Kt(document.documentElement)();B("Attaching Observers"),Ne(Jt),function(e){const t={root:document.documentElement,side:$e?s:l};se=Le(Wt,t);const n=se.attachObservers(e);Pt(n)}(e),De(),Vt(e),function(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;t.observe(n),q("Attached VisibilityObserver to page")}(Zt)}function Qt(e){performance.mark(je);const t=k(e);let n=0,o=document.documentElement,r=Se?0:document.documentElement.getBoundingClientRect().bottom;const i=Se?nt:Te?Ye:Kt(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return q(`${t} position calculated from:`,o),performance.mark(Ae,{detail:{hasTags:Se,len:i.length,logging:Fe,Side:t}}),r}const Yt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],Xt=e=>`:not(${e})`,Kt=e=>()=>[e,...e.querySelectorAll(`* ${[...b].map(Xt).join("")}`)],en={height:0,width:0},tn={height:0,width:0},nn=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function on(t){function n(){return tn[r]=i,en[r]=l,i}const o=t===rn,r=o?"height":"width",i=t.boundingClientRect(),a=Math.ceil(i),s=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(t),c=`HTML: %c${i}px %cPage: %c${l}px`;let d=0;switch(!0){case!t.enabled():return l;case Se:q("Found element with data-iframe-size attribute"),d=t.taggedElement();break;case!Te&&0===tn[r]&&0===en[r]:q(`Initial page size values: ${c}`,...nn),d=n();break;case at&&i===tn[r]&&l===en[r]:q(`Size unchanged: ${c}`,...nn),d=Math.max(i,l);break;case 0===i:q(`Page is hidden: ${c}`,...nn),d=l;break;case!Te&&i!==tn[r]&&l<=en[r]:q(`New <html> size: ${c} `,...nn),q(`Previous <html> size: %c${tn[r]}px`,e.HIGHLIGHT),d=n();break;case!o:d=t.taggedElement();break;case!Te&&i<tn[r]:q(`<html> size decreased: ${c}`,...nn),d=n();break;case l===s||l===a:q(`<html> size equals page size: ${c}`,...nn),d=n();break;case i>l:q(`Page size < <html> size: ${c}`,...nn),d=n();break;case Te:q("Found element overflowing <html> "),d=t.taggedElement();break;default:q(`Using <html> size: ${c}`,...nn),d=n()}return q(`Content ${r}: %c${d}px`,e.HIGHLIGHT),d+=function(t){const n=t.getOffset();return 0!==n&&q(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),d}const rn={enabled:()=>$e,getOffset:()=>re,auto:()=>on(rn),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,o)+parseInt(t.marginBottom,o)},bodyScroll:()=>document.body.scrollHeight,offset:()=>rn.bodyOffset(),custom:()=>w.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...Yt(rn)),min:()=>Math.min(...Yt(rn)),grow:()=>rn.max(),lowestElement:()=>Qt(s),taggedElement:()=>Qt(s)},an={enabled:()=>Ie,getOffset:()=>ie,auto:()=>on(an),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>w.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...Yt(an)),min:()=>Math.min(...Yt(an)),rightMostElement:()=>Qt(l),scroll:()=>Math.max(an.bodyScroll(),an.documentElementScroll()),taggedElement:()=>Qt(l)},sn=(e,t)=>!(Math.abs(e-t)<=it);function ln(e,t){const n=e[t]();return e.enabled()&&void 0!==fe?function(e){const t=fe(e);if(void 0===t)throw new TypeError("No value returned from onBeforeResize(), expected a numeric value");if(Number.isNaN(t))throw new TypeError(`Invalid value returned from onBeforeResize(): ${t}, expected Number`);return t}(n):n}let cn=!1;const dn=N(()=>K(S(4)));let un=!1;const mn=Z((t,n,o,r,i)=>{if(de=performance.now(),ce=!0,J(t),!0!==cn){if(!ge&&!(t in u))return q("Resizing disabled"),void U();if(Pe){if(!0===un)return;return B("Iframe hidden - Ignored resize request"),void(un=!0)}un=!1,cn=!0,requestAnimationFrame(()=>{cn=!1}),function(t,n,o,r,i){const a=o??ln(rn,Me),s=r??ln(an,lt),l=$e&&sn(Ee,a)||Ie&&sn(st,s)?d:t;switch(B(`Resize event: %c${n}`,e.HIGHLIGHT),l){case v:case c:case d:Ee=a,st=s;case m:pn(Ee,st,t,i);break;case p:case h:case f:case g:B(y);break;default:q(y)}ce=!1}(t,n,o,r,i)}});function fn(e){Ee=rn[Me](),st=an[lt](),pn(Ee,st,e)}const pn=Z(function(t,n,o,r,i){qe<0||(J(o),void 0!==i?B(`Message targetOrigin: %c${i}`,e.HIGHLIGHT):i=rt,function(){const a=`${Xe}:${t}:${n}:${o}${void 0===r?"":`:${r}`}`;if(et)try{window.parent.iframeParentListener(F+a)}catch(e){if(1!==qe)throw e;return void dn()}else ot.postMessage(F+a,i);ce&&B(function(){const e=R(performance.now()-de);return o===v?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),q(`Sending message to parent page via ${et?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),U())}),hn=Z(function(t){J("onMessage");const{freeze:n}=Object,{parse:o}=JSON,r=e=>n(o(e)),i=e=>pn(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void B("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");ot=t.source,ae=t.origin,pt(e),He=!1,setTimeout(()=>{xe=!1},128)},reset(){xe?B("Page reset ignored by init"):(B("Page size reset by host page"),fn("resetPage"))},resize(){B("Resize requested by host page"),mn("parentResize","Parent window requested size check")},moveToAnchor(){Ce.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();B("PageInfo received from parent:",r(e)),mt?M(mt,o(e)):i("pageInfo")},parentInfo(){const e=r(l());B("ParentInfo received from parent:",e),ft?M(ft,e):i("parentInfo")},message(){const t=l();B("onMessage called from parent:%c",e.HIGHLIGHT,r(t)),M(dt,o(t))}},s=()=>t.data.split("]")[1].split(":")[0],l=()=>t.data.slice(t.data.indexOf(":")+1),c=()=>t.data.split(":")[2]in{true:1,false:1};function d(){const e=s();J(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||Y(`Unexpected message (${t.data})`)}F===`${t.data}`.slice(0,13)&&function(){if(!1!==He)return c()?(_(s()),J(v),void a.init()):void B(`Ignored message of type "${s()}". Received before initialization.`);d()}()});function gn(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?Y("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>hn({data:e,sameOrigin:!0})),z(window,"message",hn),z(window,"readystatechange",gn),gn())}();
|
|
21
21
|
//# sourceMappingURL=index.cjs.js.map
|