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