@iframe-resizer/child 5.5.0-beta.1 → 5.5.0-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 +2 -2
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.0-beta.
|
|
4
|
+
* @module iframe-resizer/child 5.5.0-beta.2 (cjs) - 2025-07-22
|
|
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.0-beta.1",n=10,o="data-iframe-size",r="data-iframe-overflowed",i="data-iframe-ignore",a="bottom",s="right",l="autoResizeEnabled",c=Symbol("sizeChanged"),u="manualResize",d="parentResize",m={[u]:1,[d]:1},f="setOffsetSize",p="resizeObserver",h="overflowObserver",g="mutationObserver",y="none",b="No change in content size detected",v="init",z=(e,t,n,o)=>e.addEventListener(t,n,o||!1),w=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const $=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(w[e]),I=(e,...t)=>setTimeout((()=>e(...t)),0),S=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},H=e=>e,T=e=>Math.round(1e3*e)/1e3,O=e=>e.charAt(0).toUpperCase()+e.slice(1),E=e=>""!=`${e}`&&void 0!==e;function M(e){switch(!0){case!E(e):return"";case E(e.id):return`${e.nodeName}#${e.id}`;case E(e.name):return`${e.nodeName} (${e.name}`;case E(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const k=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${O(t)}`)};let j=!0;var G;const A=(G=e,G?.__esModule?G.default:G)({label:"iframeResizer(child)"});const L=(R="log",(...e)=>!j||A[R](...e));var R;const C=L,{assert:P,debug:x,endAutoGroup:N,error:B,errorBoundary:q,event:D,label:F,purge:W,warn:U}=A,V=e=>{return A.warn((t=H,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},Z=V,J=(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)=>V(t))),_=J("Method"),Q=J("Method","replaced with"),Y=J("Option"),X=["min-height","min-width","max-height","max-width"],K=new Set,ee=e=>e.tagName?e.tagName.toLowerCase():"unknown",te=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),ne=(e,t)=>{return(n=te(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function oe({href:e}){K.has(e)||(L("Unable to access stylesheet:",e),K.add(e))}const re=(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){oe(n)}return{source:"cross-origin stylesheet",value:te(e,t)}}(e,t),ie=(e,t)=>{const{source:n,value:o}=re(e,t),r=ee(e);V(`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 ae(){for(const e of[document.documentElement,document.body])for(const t of X)L(`Checking <${ee(e)}> for blocking CSS: ${t}`),ne(e,t)&&ie(e,t)}const se=e=>t=>void 0===t?void 0:e(t),le=se((e=>"true"===e)),ce=se(Number),ue="--ifr-start",de="--ifr-end",me=[],fe=new WeakSet,pe=e=>"object"==typeof e&&fe.add(e);let he={},ge=0;const ye=setInterval((()=>{if(me.length<10)return;if(he.hasTags&&he.len<25)return;me.sort();const e=Math.min(me.reduce(((e,t)=>e+t),0)/me.length,me[Math.floor(me.length/2)]),t=T(e);t>ge&&(ge=t,D("performanceObserver"),L("Mean time:",T(me[Math.floor(me.length/2)])),L("Median time:",T(me.reduce(((e,t)=>e+t),0)/me.length)),L("Average time:",t),L("Max time:",T(Math.max(...me)))),e<=4||(clearInterval(ye),V(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${T(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${he.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function be(e){e.getEntries().forEach((e=>{if(e.name===de){const{duration:t}=performance.measure("--ifr-measure",ue,de);he=e.detail,me.push(t),me.length>100&&me.shift()}}))}function ve(){new PerformanceObserver(be).observe({entryTypes:["mark"]}),pe(document.documentElement),pe(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",ve):ve());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}.`)}},we=ze("function"),$e=ze("number"),Ie=ze("string");"undefined"!=typeof window&&function(){const w={height:()=>(U("Custom height calculation function not defined"),St.auto()),width:()=>(U("Custom width calculation function not defined"),Ht.auto())},E={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},G={},R="auto",B="[iFrameSizer]",W="scroll";let J,X,K,ee,te,ne,oe,re=!0,ie="",se=0,me="",fe="",pe=!1,he=!0,ge=!1,ye=!0,be=!1,ve=!1,ze=!1,Se=1,He=R,Te="",Oe=!0,Ee={},Me=!0,ke=!1,je="",Ge=0,Ae=!1,Le="",Re=H,Ce=[],Pe="child",xe=null,Ne=!1,Be="",qe=[],De=window.parent,Fe="*",We=0,Ue=!1,Ve=1,Ze=W,Je=window,_e=()=>{U("onMessage function not defined")},Qe=()=>{},Ye=null,Xe=null;function Ke(c){var d,m,p;!function(e){Le=e[0]??Le,se=ce(e[1])??se,ge=le(e[2])??ge,ke=le(e[3])??ke,re=le(e[6])??re,me=e[7]??me,He=e[8]??He,ie=e[9]??ie,fe=e[10]??fe,We=ce(e[11])??We,Ee.enable=le(e[12])??!1,Pe=e[13]??Pe,Ze=e[14]??Ze,Ae=le(e[15])??Ae,J=ce(e[16])??J,X=ce(e[17])??X,he=le(e[18])??he,je=e[19]??je,ne=e[20]??ne,Ge=ce(e[21])??Ge,Me=le(e[23])??Me}(c),d={id:Le,enabled:ke,expand:Me},A.label(`${d.id}`),A.expand(d.expand),j=d.enabled,L(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){L("Reading data from page:",e),oe=we(e,"onBeforeResize")??oe,_e=we(e,"onMessage")??_e,Qe=we(e,"onReady")??Qe,"number"==typeof e?.offset&&(Y("offset","offsetSize"),he&&(J=$e(e,"offset")??J),ge&&(X=$e(e,"offset")??X)),"number"==typeof e?.offsetSize&&(he&&(J=$e(e,"offsetSize")??J),ge&&(X=$e(e,"offsetSize")??X)),Te=Ie(e,"ignoreSelector")??Te,Be=Ie(e,"sizeSelector")??Be,Fe=Ie(e,"targetOrigin")??Fe,He=e?.heightCalculationMethod||He,Ze=e?.widthCalculationMethod||Ze}function n(e,t){return"function"==typeof e&&(V(`<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===Ge)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),He=n(He,"height"),Ze=n(Ze,"width"),C(`Set targetOrigin for parent: %c${Fe}`,e.HIGHLIGHT))}(),ct(),function(){try{Ne=1===Ge||"iframeParentListener"in window.parent}catch(e){L("Cross domain iframe detected")}}(),ge===he&&(pe=!0),Ge<0?Z(`${$(Ge+2)}${$(2)}`):ne?.codePointAt(0)>4||Ge<2&&Z($(3)),ne&&""!==ne&&"false"!==ne?ne!==t&&V(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ne} - Child page: ${t}.\n`):V("<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"),mt(),ft(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(o,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&V("<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&&V("<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"),ot(),pe||ae(),1!==Ge&&(Je.parentIframe=Object.freeze({autoResize:e=>(k(e,"boolean","parentIframe.autoResize(enable) enable"),!1===ge&&!1===he?(D(l),V(`Auto Resize can not be changed when <b>direction</> is set to '${y}'.`),!1):(!0===e&&!1===re?(re=!0,queueMicrotask((()=>kt(l,"Auto Resize enabled")))):!1===e&&!0===re&&(re=!1),Gt(0,0,"autoResize",JSON.stringify(re)),re)),close(){Gt(0,0,"close")},getId:()=>Le,getOrigin:()=>(_("getOrigin()","getParentOrigin()"),K),getParentOrigin:()=>K,getPageInfo(e){if("function"==typeof e)return Ye=e,Gt(0,0,"pageInfo"),void Q("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Ye=null,Gt(0,0,"pageInfoStop")},getParentProps:e=>(k(e,"function","parentIframe.getParentProps(callback) callback"),Xe=e,Gt(0,0,"parentInfo"),()=>{Xe=null,Gt(0,0,"parentInfoStop")}),getParentProperties(e){_("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){k(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Ee.findTarget(e)},reset(){!function(){const t=He;He=R,L("Reset trigger event: %cparentIframe.reset",e.HIGHLIGHT),Ue?L("TriggerLock blocked calculation"):(Ue=!0,x("Trigger event lock on"),requestAnimationFrame((()=>{Ue=!1,x("Trigger event lock off")}))),jt("reset"),He=t}()},setOffsetSize(e){k(e,"number","parentIframe.setOffsetSize(offset) offset"),J=e,X=e,kt(f,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){k(e,"number","parentIframe.scrollBy(x, y) x"),k(t,"number","parentIframe.scrollBy(x, y) y"),Gt(t,e,"scrollBy")},scrollTo(e,t){k(e,"number","parentIframe.scrollTo(x, y) x"),k(t,"number","parentIframe.scrollTo(x, y) y"),Gt(t,e,"scrollTo")},scrollToOffset(e,t){k(e,"number","parentIframe.scrollToOffset(x, y) x"),k(t,"number","parentIframe.scrollToOffset(x, y) y"),Gt(t,e,"scrollToOffset")},sendMessage(e,t){t&&k(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Gt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){He=e,mt()},setWidthCalculationMethod(e){Ze=e,ft()},setTargetOrigin(t){k(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),L(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),Fe=t},resize(e,t){e&&k(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&k(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),kt(u,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){_("size()","resize()"),this.resize(e,t)}}),Je.parentIFrame=Je.parentIframe),function(){function t(e){Gt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){L(`Add event listener: %c${o}`,e.HIGHLIGHT),z(window.document,n,t)}!0===Ae&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),Ee=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(e){const o=e.getBoundingClientRect(),r=t();return{x:parseInt(o.left,n)+parseInt(r.x,n),y:parseInt(o.top,n)+parseInt(r.y,n)}}function r(t){function n(t){const n=o(t);L(`Moving to in page link (%c#${r}%c) at x: %c${n.x}%c y: %c${n.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Gt(n.y,n.x,"scrollToOffset")}const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(L(`In page link (#${r}) not found in iFrame, so sending to parent`),Gt(0,0,"inPageLink",`#${r}`)):n(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")&&z(e,"click",(t=>{t.preventDefault(),r(e.getAttribute("href"))}))}function s(){z(window,"hashchange",i)}function l(){setTimeout(i,128)}function c(){L("Setting up location.hash handlers"),a(),s(),l()}return Ee.enable?1===Ge?V("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():L("In page linking not enabled"),{findTarget:r}}(),void 0===me&&(me=`${se}px`),st("margin",(m="margin",(p=me).includes("-")&&(U(`Negative CSS value ignored for ${m}`),p=""),p)),st("background",ie),st("padding",fe),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),pe||function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),L("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==re&&L("Auto Resize disabled"),function(e){ut({method:e,eventType:"After Print",eventName:"afterprint"}),ut({method:e,eventType:"Before Print",eventName:"beforeprint"}),ut({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const t=new Set,n=[];let r=!1,a=0;const s=e=>{C("Mutations observed:",e);for(const n of e){const{addedNodes:e,removedNodes:o}=n;for(const n of e)t.add(n);for(const e of o)t.delete(e)}},l=16,c=2,u=200;let d=1;function m(e){ct(),rt(e),e.forEach(gt),e.clear()}function f(){const o=performance.now(),i=o-a,p=l*d+++c;if(i>p&&i<u)return C("Backed off due to heavy workload on callStack"),L(`Delay: %c${T(i)}ms %c> Delay limit: %c${p}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(f,l*d),void(a=o);d=1,n.forEach(s),n.length=0,t.size>0&&m(t),ot(),tt(),r=!1,kt(g,"Mutation Observed")}function p(e){n.push(e),r||(a=performance.now(),r=!0,requestAnimationFrame(f))}function h(){const e=new window.MutationObserver(p),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[i,o],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return L("Setup <body> MutationObserver"),e.observe(t,n),e}h()}(),L("Setup ResizeObserver"),xe=new ResizeObserver(pt),xe.observe(document.body),ht.add(document.body),gt(document.body),he!==ge&&(L("Setup OverflowObserver"),Re=(e=>{const t=e.side||a,n=e.onChange||H,o={root:e.root,rootMargin:"0px",threshold:1},i=window?.requestAnimationFrame||H,s=(e=!1)=>n(e),l=(e,n)=>0===e||e>n[t],c=(e,t)=>e.toggleAttribute(r,t),u=new IntersectionObserver((function(e){for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,a=e[t],s=l(a,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);c(i,s)}var n;i(s)}),o),d=new WeakSet;return function(e){L("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=d.has(t);!n&&e?(u.observe(t),d.add(t)):P(!n,"Node already observed",t)}}})({onChange:nt,root:document.documentElement,side:he?a:s})),rt(vt(document)()),et(S(Qe)),L("Initialization complete"),kt(v,"Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&Gt(0,0,"title",document.title)}function et(e){"complete"===document.readyState?I(e):z(document,"readystatechange",(()=>et(e)))}function tt(){const e=document.querySelectorAll(`[${r}]`);Ce=Array.from(e).filter((e=>!e.closest(`[${i}]`))),ve=Ce.length>0}function nt(e){tt(),(ve||e)&&(ve?C("Overflowed Elements:",...Ce):C("Overflow removed"),kt(h,"Overflow updated"))}function ot(){qe=document.querySelectorAll(`[${o}]`),ze=qe.length>0,L(`Tagged elements found: %c${ze}`,e.HIGHLIGHT)}function rt(e){ze||Re(e)}let it=0;function at(){const t=document.querySelectorAll(`*[${i}]`);be=t.length>0,be&&t.length!==it&&(function(t){const n=1===t.length?"":"s";U(`%c[${i}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),it=t.length)}function st(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),C(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function lt(t,n,o){if(""!==o){L(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))L(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function ct(){lt("sizeSelector",o,Be),lt("ignoreSelector",i,Te)}function ut(t){({add(e){function n(){kt(t.eventName,t.eventType)}G[e]=n,z(window,e,n,{passive:!0})},remove(e){const t=G[e];var n,o;delete G[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),L(`${O(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function dt(t,n,o,r){return n!==t&&(t in o||(U(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in E)&&V(`<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 ${ne?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),L(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function mt(){He=dt(He,R,St,"height")}function ft(){Ze=dt(Ze,W,Ht,"width")}function pt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;kt(p,`Element resized <${M(t)}>`)}const ht=new WeakSet;function gt(t){if(t.nodeType!==Node.ELEMENT_NODE)return;if(!ht.has(t)){const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(xe.observe(t),ht.add(t),L(`Attached resizeObserver: %c${M(t)}`,e.HIGHLIGHT))}const n=vt(t)();for(const t of n){if(ht.has(t)||t?.nodeType!==Node.ELEMENT_NODE)continue;const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(xe.observe(t),ht.add(t),L(`Attached resizeObserver: %c${M(t)}`,e.HIGHLIGHT))}}function yt(e){performance.mark(ue);const t=O(e);let n=0,o=document.documentElement,r=ze?0:document.documentElement.getBoundingClientRect().bottom;const i=ze?qe:ve?Ce:vt(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return C(`${t} position calculated from:`,o),performance.mark(de,{detail:{hasTags:ze,len:i.length,logging:ke,Side:t}}),r}const bt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],vt=e=>()=>{at();const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return be&&t.push(`not([${i}])`,`not([${i}] *)`),e.querySelectorAll(t.join(":"))},zt={height:0,width:0},wt={height:0,width:0},$t=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function It(t){function n(){return wt[r]=i,zt[r]=l,i}const o=t===St,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 ze:C("Found element with data-iframe-size attribute"),u=t.taggedElement();break;case!ve&&0===wt[r]&&0===zt[r]:C(`Initial page size values: ${c}`,...$t),u=n();break;case Ue&&i===wt[r]&&l===zt[r]:C(`Size unchanged: ${c}`,...$t),u=Math.max(i,l);break;case 0===i:C(`Page is hidden: ${c}`,...$t),u=l;break;case!ve&&i!==wt[r]&&l<=zt[r]:C(`New <html> size: ${c} `,...$t),C(`Previous <html> size: %c${wt[r]}px`,e.HIGHLIGHT),u=n();break;case!o:u=t.taggedElement();break;case!ve&&i<wt[r]:C(`<html> size decreased: ${c}`,...$t),u=n();break;case l===s||l===a:C(`<html> size equals page size: ${c}`,...$t),u=n();break;case i>l:C(`Page size < <html> size: ${c}`,...$t),u=n();break;case ve:C("Found element overflowing <html> "),u=t.taggedElement();break;default:C(`Using <html> size: ${c}`,...$t),u=n()}return C(`Content ${r}: %c${u}px`,e.HIGHLIGHT),u+=function(t){const n=t.getOffset();return 0!==n&&C(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),u}const St={enabled:()=>he,getOffset:()=>J,auto:()=>It(St),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>St.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(...bt(St)),min:()=>Math.min(...bt(St)),grow:()=>St.max(),lowestElement:()=>yt(a),taggedElement:()=>yt(a)},Ht={enabled:()=>ge,getOffset:()=>X,auto:()=>It(Ht),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(...bt(Ht)),min:()=>Math.min(...bt(Ht)),rightMostElement:()=>yt(s),scroll:()=>Math.max(Ht.bodyScroll(),Ht.documentElementScroll()),taggedElement:()=>yt(s)},Tt=(e,t)=>!(Math.abs(e-t)<=We);function Ot(e,t){const n=e[t]();return e.enabled()&&void 0!==oe?function(e){const t=oe(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 Et=!1;const Mt=S((()=>Z($(4)))),kt=q(((t,n,o,r,i)=>{if(te=performance.now(),ee=!0,D(t),!0!==Et)return re||t in m?void(document.hidden?L("Page hidden - Ignored resize request"):(Et=!0,requestAnimationFrame((()=>{Et=!1})),function(t,n,o,r,i){const a=o??Ot(St,He),s=r??Ot(Ht,Ze),u=he&&Tt(Se,a)||ge&&Tt(Ve,s)?c:t;switch(L(`Resize event: %c${n}`,e.HIGHLIGHT),u){case v:case l:case c:Se=a,Ve=s;case f:Gt(Se,Ve,t,i);break;case p:case h:case g:L(b);break;default:C(b)}ee=!1}(t,n,o,r,i))):(C("Resizing disabled"),void N())}));function jt(e){Se=St[He](),Ve=Ht[Ze](),Gt(Se,Ve,e)}const Gt=q((function(t,n,o,r,i){Ge<-1||(D(o),void 0!==i?L(`Message targetOrigin: %c${i}`,e.HIGHLIGHT):i=Fe,function(){const a=`${Le}:${t}:${n}:${o}${void 0===r?"":`:${r}`}`;if(Ne)try{window.parent.iframeParentListener(B+a)}catch(e){if(1!==Ge)throw e;return void Mt()}else De.postMessage(B+a,i);ee&&L(function(){const e=T(performance.now()-te);return o===v?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),C(`Sending message to parent page via ${Ne?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),N())})),At=q((function(t){D("onMessage");const{freeze:n}=Object,{parse:o}=JSON,r=e=>n(o(e)),i=e=>Gt(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void L("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");De=t.source,K=t.origin,Ke(e),ye=!1,setTimeout((()=>{Oe=!1}),128)},reset(){Oe?L("Page reset ignored by init"):(L("Page size reset by host page"),jt("resetPage"))},resize(){L("Resize requested by host page"),kt(d,"Parent window requested size check")},moveToAnchor(){Ee.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();L("PageInfo received from parent:",r(e)),Ye?I(Ye,o(e)):i("pageInfo")},parentInfo(){const e=r(l());L("ParentInfo received from parent:",e),Xe?I(Xe,e):i("parentInfo")},message(){const t=l();L("onMessage called from parent:%c",e.HIGHLIGHT,r(t)),I(_e,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();D(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||U(`Unexpected message (${t.data})`)}B===`${t.data}`.slice(0,13)&&function(){if(!1!==ye)return c()?(F(s()),D(v),void a.init()):void L(`Ignored message of type "${s()}". Received before initialization.`);u()}()}));function Lt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?U("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>At({data:e,sameOrigin:!0}))),z(window,"message",At),z(window,"readystatechange",Lt),Lt())}();
|
|
20
|
+
"use strict";const e=require("auto-console-group"),t="5.5.0-beta.2",n=10,o="data-iframe-size",r="data-iframe-overflowed",i="data-iframe-ignore",a="bottom",s="right",l="autoResizeEnabled",c=Symbol("sizeChanged"),u="manualResize",d="parentResize",m={[u]:1,[d]:1},f="setOffsetSize",p="resizeObserver",h="overflowObserver",g="mutationObserver",y="visibilityObserver",b="none",v="No change in content size detected",z="init",w=(e,t,n,o)=>e.addEventListener(t,n,o||!1),I=["<iy><yi>Puchspk Spjluzl Rlf</><iy><iy>","<iy><yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map((e,t)=>[e,Math.max(0,t-1)]));const $=e=>(e=>e.replace(/[A-Za-z]/g,e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26)))(I[e]),S=(e,...t)=>setTimeout(()=>e(...t),0),H=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},T=e=>e,O=e=>Math.round(1e3*e)/1e3,E=e=>e.charAt(0).toUpperCase()+e.slice(1),M=e=>""!=`${e}`&&void 0!==e;function k(e){switch(!0){case!M(e):return"";case M(e.id):return`${e.nodeName}#${e.id}`;case M(e.name):return`${e.nodeName} (${e.name}`;case M(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const j=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${E(t)}`)};let G=!0;var L;const A=(L=e,L?.__esModule?L.default:L)({label:"iframeResizer(child)"});const R=(C="log",(...e)=>!G||A[C](...e));var C;const x=R,{assert:P,debug:N,endAutoGroup:B,error:q,errorBoundary:D,event:F,label:W,purge:U,warn:V}=A,Z=e=>{return A.warn((t=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},J=Z,_=(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)=>Z(t)),Q=_("Method"),Y=_("Method","replaced with"),X=_("Option"),K=["min-height","min-width","max-height","max-width"],ee=new Set,te=e=>e.tagName?e.tagName.toLowerCase():"unknown",ne=(e,t)=>window.getComputedStyle(e).getPropertyValue(t),oe=(e,t)=>{return(n=ne(e,t))&&"0px"!==n&&"auto"!==n&&"none"!==n;var n};function re({href:e}){ee.has(e)||(R("Unable to access stylesheet:",e),ee.add(e))}const ie=(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){re(n)}return{source:"cross-origin stylesheet",value:ne(e,t)}}(e,t),ae=(e,t)=>{const{source:n,value:o}=ie(e,t),r=te(e);Z(`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 se(){for(const e of[document.documentElement,document.body])for(const t of K)R(`Checking <${te(e)}> for blocking CSS: ${t}`),oe(e,t)&&ae(e,t)}const le=e=>t=>void 0===t?void 0:e(t),ce=le(e=>"true"===e),ue=le(Number),de=e=>e.hidden||null===e.offsetParent||"none"===e.style.display,me=e=>{const t=e.side,n=e.onChange||T,o={root:e.root,rootMargin:"0px",threshold:1},i=window?.requestAnimationFrame||T,a=(e=!1)=>n(e),s=(e,n)=>0===e||e>n[t],l=(e,t)=>e.toggleAttribute(r,t);const c=new IntersectionObserver(function(e){for(const n of e){const{boundingClientRect:e,rootBounds:o,target:r}=n,i=e[t],a=s(i,o)&&!de(r);l(r,a)}i(a)},o),u=new WeakSet;return function(e){R("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=u.has(t);!n&&e?(c.observe(t),u.add(t)):P(!n,"Node already observed",t)}}},fe="--ifr-start",pe="--ifr-end",he=[],ge=new WeakSet,ye=e=>"object"==typeof e&&ge.add(e);let be={},ve=0;const ze=setInterval(()=>{if(he.length<10)return;if(be.hasTags&&be.len<25)return;he.sort();const e=Math.min(he.reduce((e,t)=>e+t,0)/he.length,he[Math.floor(he.length/2)]),t=O(e);t>ve&&(ve=t,F("performanceObserver"),R("Mean time:",O(he[Math.floor(he.length/2)])),R("Median time:",O(he.reduce((e,t)=>e+t,0)/he.length)),R("Average time:",t),R("Max time:",O(Math.max(...he)))),e<=4||(clearInterval(ze),Z(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${O(e)}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);function we(e){e.getEntries().forEach(e=>{if(e.name===pe){const{duration:t}=performance.measure("--ifr-measure",fe,pe);be=e.detail,he.push(t),he.length>100&&he.shift()}})}function Ie(){new PerformanceObserver(we).observe({entryTypes:["mark"]}),ye(document.documentElement),ye(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",Ie):Ie());const $e=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Se=$e("function"),He=$e("number"),Te=$e("string");"undefined"!=typeof window&&function(){const I={height:()=>(V("Custom height calculation function not defined"),Ot.auto()),width:()=>(V("Custom width calculation function not defined"),Et.auto())},M={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},L={},C="auto",P="[iFrameSizer]",q="scroll";let U,_,K,ee,te,ne,oe,re=!0,ie="",ae=0,le="",de="",he=!1,ge=!0,ye=!1,be=!0,ve=!1,ze=!1,we=!1,Ie=1,$e=C,Oe="",Ee=!0,Me={},ke=!1,je=!0,Ge=!1,Le="",Ae=0,Re=!1,Ce="",xe=T,Pe=[],Ne="child",Be=null,qe=!1,De="",Fe=[],We=window.parent,Ue="*",Ve=0,Ze=!1,Je=1,_e=q,Qe=window,Ye=()=>{V("onMessage function not defined")},Xe=()=>{},Ke=null,et=null;function tt(r){var c,d,m;!function(e){Ce=e[0]??Ce,ae=ue(e[1])??ae,ye=ce(e[2])??ye,Ge=ce(e[3])??Ge,re=ce(e[6])??re,le=e[7]??le,$e=e[8]??$e,ie=e[9]??ie,de=e[10]??de,Ve=ue(e[11])??Ve,Me.enable=ce(e[12])??!1,Ne=e[13]??Ne,_e=e[14]??_e,Re=ce(e[15])??Re,U=ue(e[16])??U,_=ue(e[17])??_,ge=ce(e[18])??ge,Le=e[19]??Le,ne=e[20]??ne,Ae=ue(e[21])??Ae,je=ce(e[23])??je}(r),c={id:Ce,enabled:Ge,expand:je},A.label(`${c.id}`),A.expand(c.expand),G=c.enabled,R(`Initialising iframe v${t} ${window.location.href}`),function(){function t(e){R("Reading data from page:",e),oe=Se(e,"onBeforeResize")??oe,Ye=Se(e,"onMessage")??Ye,Xe=Se(e,"onReady")??Xe,"number"==typeof e?.offset&&(X("offset","offsetSize"),ge&&(U=He(e,"offset")??U),ye&&(_=He(e,"offset")??_)),"number"==typeof e?.offsetSize&&(ge&&(U=He(e,"offsetSize")??U),ye&&(_=He(e,"offsetSize")??_)),Oe=Te(e,"ignoreSelector")??Oe,De=Te(e,"sizeSelector")??De,Ue=Te(e,"targetOrigin")??Ue,$e=e?.heightCalculationMethod||$e,_e=e?.widthCalculationMethod||_e}function n(e,t){return"function"==typeof e&&(Z(`<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===Ae)return;const o=window.iframeResizer||window.iFrameResizer;"object"==typeof o&&(t(o),$e=n($e,"height"),_e=n(_e,"width"),x(`Set targetOrigin for parent: %c${Ue}`,e.HIGHLIGHT))}(),dt(),function(){try{qe=1===Ae||"iframeParentListener"in window.parent}catch(e){R("Cross domain iframe detected")}}(),ye===ge&&(he=!0),Ae<0?J(`${$(Ae+2)}${$(2)}`):ne?.codePointAt(0)>4||Ae<2&&J($(3)),ne&&""!==ne&&"false"!==ne?ne!==t&&Z(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ne} - Child page: ${t}.\n`):Z("<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"),pt(),ht(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach(n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(o,!0)});t("data-iframe-height"),t("data-iframe-width"),e&&Z("<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&&Z("<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"),it(),he||se(),1!==Ae&&(Qe.parentIframe=Object.freeze({autoResize:e=>(j(e,"boolean","parentIframe.autoResize(enable) enable"),!1===ye&&!1===ge?(F(l),Z(`Auto Resize can not be changed when <b>direction</> is set to '${b}'.`),!1):(!0===e&&!1===re?(re=!0,queueMicrotask(()=>At(l,"Auto Resize enabled"))):!1===e&&!0===re&&(re=!1),Ct(0,0,"autoResize",JSON.stringify(re)),re)),close(){Ct(0,0,"close")},getId:()=>Ce,getOrigin:()=>(Q("getOrigin()","getParentOrigin()"),K),getParentOrigin:()=>K,getPageInfo(e){if("function"==typeof e)return Ke=e,Ct(0,0,"pageInfo"),void Y("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Ke=null,Ct(0,0,"pageInfoStop")},getParentProps:e=>(j(e,"function","parentIframe.getParentProps(callback) callback"),et=e,Ct(0,0,"parentInfo"),()=>{et=null,Ct(0,0,"parentInfoStop")}),getParentProperties(e){Q("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){j(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Me.findTarget(e)},reset(){!function(){const t=$e;$e=C,R("Reset trigger event: %cparentIframe.reset",e.HIGHLIGHT),Ze?R("TriggerLock blocked calculation"):(Ze=!0,N("Trigger event lock on"),requestAnimationFrame(()=>{Ze=!1,N("Trigger event lock off")})),Rt("reset"),$e=t}()},setOffsetSize(e){j(e,"number","parentIframe.setOffsetSize(offset) offset"),U=e,_=e,At(f,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){j(e,"number","parentIframe.scrollBy(x, y) x"),j(t,"number","parentIframe.scrollBy(x, y) y"),Ct(t,e,"scrollBy")},scrollTo(e,t){j(e,"number","parentIframe.scrollTo(x, y) x"),j(t,"number","parentIframe.scrollTo(x, y) y"),Ct(t,e,"scrollTo")},scrollToOffset(e,t){j(e,"number","parentIframe.scrollToOffset(x, y) x"),j(t,"number","parentIframe.scrollToOffset(x, y) y"),Ct(t,e,"scrollToOffset")},sendMessage(e,t){t&&j(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Ct(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){$e=e,pt()},setWidthCalculationMethod(e){_e=e,ht()},setTargetOrigin(t){j(t,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),R(`Set targetOrigin: %c${t}`,e.HIGHLIGHT),Ue=t},resize(e,t){e&&j(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&j(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),At(u,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){Q("size()","resize()"),this.resize(e,t)}}),Qe.parentIFrame=Qe.parentIframe),function(){function t(e){Ct(0,0,e.type,`${e.screenY}:${e.screenX}`)}function n(n,o){R(`Add event listener: %c${o}`,e.HIGHLIGHT),w(window.document,n,t)}!0===Re&&(n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave"))}(),Me=function(){const t=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function o(e){const o=e.getBoundingClientRect(),r=t();return{x:parseInt(o.left,n)+parseInt(r.x,n),y:parseInt(o.top,n)+parseInt(r.y,n)}}function r(t){function n(t){const n=o(t);R(`Moving to in page link (%c#${r}%c) at x: %c${n.x}%c y: %c${n.y}`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),Ct(n.y,n.x,"scrollToOffset")}const r=t.split("#")[1]||t,i=decodeURIComponent(r),a=document.getElementById(i)||document.getElementsByName(i)[0];void 0===a?(R(`In page link (#${r}) not found in iFrame, so sending to parent`),Ct(0,0,"inPageLink",`#${r}`)):n(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")&&w(e,"click",t=>{t.preventDefault(),r(e.getAttribute("href"))})}function s(){w(window,"hashchange",i)}function l(){setTimeout(i,128)}function c(){R("Setting up location.hash handlers"),a(),s(),l()}return Me.enable?1===Ae?Z("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):c():R("In page linking not enabled"),{findTarget:r}}(),void 0===le&&(le=`${ae}px`),ct("margin",(d="margin",(m=le).includes("-")&&(V(`Negative CSS value ignored for ${d}`),m=""),m)),ct("background",ie),ct("padding",de),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),he||function(){const t=e=>e.style.setProperty("height","auto","important");t(document.documentElement),t(document.body),R("Set HTML & body height: %cauto !important",e.HIGHLIGHT)}(),!0!==re&&R("Auto Resize disabled"),function(e){mt({method:e,eventType:"After Print",eventName:"afterprint"}),mt({method:e,eventType:"Before Print",eventName:"beforeprint"}),mt({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const t=new Set,n=[];let r=!1,a=0;const s=e=>{x("Mutations observed:",e);for(const n of e){const{addedNodes:e,removedNodes:o}=n;for(const n of e)t.add(n);for(const e of o)t.delete(e)}},l=16,c=2,u=200;let d=1;function m(e){dt(),at(e),e.forEach(bt),e.clear()}function f(){const o=performance.now(),i=o-a,p=l*d+++c;if(i>p&&i<u)return x("Backed off due to heavy workload on callStack"),R(`Delay: %c${O(i)}ms %c> Delay limit: %c${p}ms`,e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT),setTimeout(f,l*d),void(a=o);d=1,n.forEach(s),n.length=0,t.size>0&&m(t),it(),ot(),r=!1,At(g,"Mutation Observed")}function p(e){n.push(e),r||(a=performance.now(),r=!0,requestAnimationFrame(f))}function h(){const e=new window.MutationObserver(p),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[i,o],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return R("Setup <body> MutationObserver"),e.observe(t,n),e}h()}(),ge!==ye&&(R("Setup OverflowObserver"),xe=me({onChange:rt,root:document.documentElement,side:ge?a:s})),at(It(document)()),R("Setup ResizeObserver"),Be=new ResizeObserver(gt),Be.observe(document.body),yt.add(document.body),bt(document.body),R("Setup VisibilityObserver"),function(e){const t=new IntersectionObserver(t=>e(t[0].isIntersecting),{threshold:0}),n=document.documentElement;t.observe(n)}(vt),nt(H(Xe)),R("Initialization complete"),At(z,"Init message from host page",void 0,void 0,t),document.title&&""!==document.title&&Ct(0,0,"title",document.title)}function nt(e){"complete"===document.readyState?S(e):w(document,"readystatechange",()=>nt(e))}function ot(){const e=document.querySelectorAll(`[${r}]`);Pe=Array.from(e).filter(e=>!e.closest(`[${i}]`)),ze=Pe.length>0}function rt(e){ot(),(ze||e)&&(ze?x("Overflowed Elements:",...Pe):x("Overflow removed"),At(h,"Overflow updated"))}function it(){Fe=document.querySelectorAll(`[${o}]`),we=Fe.length>0,R(`Tagged elements found: %c${we}`,e.HIGHLIGHT)}function at(e){we||xe(e)}let st=0;function lt(){const t=document.querySelectorAll(`*[${i}]`);ve=t.length>0,ve&&t.length!==st&&(function(t){const n=1===t.length?"":"s";V(`%c[${i}]%c found on %c${t.length}%c element${n}`,e.BOLD,e.NORMAL,e.BOLD,e.NORMAL)}(t),st=t.length)}function ct(t,n){void 0!==n&&""!==n&&"null"!==n&&(document.body.style.setProperty(t,n),x(`Set body ${t}: %c${n}`,e.HIGHLIGHT))}function ut(t,n,o){if(""!==o){R(`${t}: %c${o}`,e.HIGHLIGHT);for(const e of document.querySelectorAll(o))R(`Applying ${n} to:`,e),e.toggleAttribute(n,!0)}}function dt(){ut("sizeSelector",o,De),ut("ignoreSelector",i,Oe)}function mt(t){({add(e){function n(){At(t.eventName,t.eventType)}L[e]=n,w(window,e,n,{passive:!0})},remove(e){const t=L[e];var n,o;delete L[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[t.method](t.eventName),R(`${E(t.method)} event listener: %c${t.eventType}`,e.HIGHLIGHT)}function ft(t,n,o,r){return n!==t&&(t in o||(V(`${t} is not a valid option for ${r}CalculationMethod.`),t=n),t in M)&&Z(`<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 ${ne?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),R(`Set ${r} calculation method: %c${t}`,e.HIGHLIGHT),t}function pt(){$e=ft($e,C,Ot,"height")}function ht(){_e=ft(_e,q,Et,"width")}function gt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;At(p,`Element resized <${k(t)}>`)}const yt=new WeakSet;function bt(t){if(t.nodeType!==Node.ELEMENT_NODE)return;if(!yt.has(t)){const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(Be.observe(t),yt.add(t),R(`Attached resizeObserver: %c${k(t)}`,e.HIGHLIGHT))}const n=It(t)();for(const t of n){if(yt.has(t)||t?.nodeType!==Node.ELEMENT_NODE)continue;const n=getComputedStyle(t)?.position;""!==n&&"static"!==n&&(Be.observe(t),yt.add(t),R(`Attached resizeObserver: %c${k(t)}`,e.HIGHLIGHT))}}function vt(t){R(`Visible: %c${t}`,e.HIGHLIGHT),ke=!t,At(y,"Visibility changed")}function zt(e){performance.mark(fe);const t=E(e);let n=0,o=document.documentElement,r=we?0:document.documentElement.getBoundingClientRect().bottom;const i=we?Fe:ze?Pe:It(document)();for(const t of i)n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,o=t);return x(`${t} position calculated from:`,o),performance.mark(pe,{detail:{hasTags:we,len:i.length,logging:Ge,Side:t}}),r}const wt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],It=e=>()=>{lt();const t=["* ","not(head)","not(meta)","not(base)","not(title)","not(script)","not(link)","not(style)","not(map)","not(area)","not(option)","not(optgroup)","not(template)","not(track)","not(wbr)","not(nobr)"];return ve&&t.push(`not([${i}])`,`not([${i}] *)`),e.querySelectorAll(t.join(":"))},$t={height:0,width:0},St={height:0,width:0},Ht=[e.HIGHLIGHT,e.FOREGROUND,e.HIGHLIGHT];function Tt(t){function n(){return St[r]=i,$t[r]=l,i}const o=t===Ot,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 we:x("Found element with data-iframe-size attribute"),u=t.taggedElement();break;case!ze&&0===St[r]&&0===$t[r]:x(`Initial page size values: ${c}`,...Ht),u=n();break;case Ze&&i===St[r]&&l===$t[r]:x(`Size unchanged: ${c}`,...Ht),u=Math.max(i,l);break;case 0===i:x(`Page is hidden: ${c}`,...Ht),u=l;break;case!ze&&i!==St[r]&&l<=$t[r]:x(`New <html> size: ${c} `,...Ht),x(`Previous <html> size: %c${St[r]}px`,e.HIGHLIGHT),u=n();break;case!o:u=t.taggedElement();break;case!ze&&i<St[r]:x(`<html> size decreased: ${c}`,...Ht),u=n();break;case l===s||l===a:x(`<html> size equals page size: ${c}`,...Ht),u=n();break;case i>l:x(`Page size < <html> size: ${c}`,...Ht),u=n();break;case ze:x("Found element overflowing <html> "),u=t.taggedElement();break;default:x(`Using <html> size: ${c}`,...Ht),u=n()}return x(`Content ${r}: %c${u}px`,e.HIGHLIGHT),u+=function(t){const n=t.getOffset();return 0!==n&&x(`Page offsetSize: %c${n}px`,e.HIGHLIGHT),n}(t),u}const Ot={enabled:()=>ge,getOffset:()=>U,auto:()=>Tt(Ot),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,n)+parseInt(t.marginBottom,n)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ot.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(...wt(Ot)),min:()=>Math.min(...wt(Ot)),grow:()=>Ot.max(),lowestElement:()=>zt(a),taggedElement:()=>zt(a)},Et={enabled:()=>ye,getOffset:()=>_,auto:()=>Tt(Et),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(...wt(Et)),min:()=>Math.min(...wt(Et)),rightMostElement:()=>zt(s),scroll:()=>Math.max(Et.bodyScroll(),Et.documentElementScroll()),taggedElement:()=>zt(s)},Mt=(e,t)=>!(Math.abs(e-t)<=Ve);function kt(e,t){const n=e[t]();return e.enabled()&&void 0!==oe?function(e){const t=oe(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 Gt=H(()=>J($(4)));let Lt=!1;const At=D((t,n,o,r,i)=>{if(te=performance.now(),ee=!0,F(t),!0!==jt){if(!re&&!(t in m))return x("Resizing disabled"),void B();if(ke){if(!0===Lt)return;return R("Iframe hidden - Ignored resize request"),void(Lt=!0)}Lt=!1,jt=!0,requestAnimationFrame(()=>{jt=!1}),function(t,n,o,r,i){const a=o??kt(Ot,$e),s=r??kt(Et,_e),u=ge&&Mt(Ie,a)||ye&&Mt(Je,s)?c:t;switch(R(`Resize event: %c${n}`,e.HIGHLIGHT),u){case z:case l:case c:Ie=a,Je=s;case f:Ct(Ie,Je,t,i);break;case h:case g:case p:case y:R(v);break;default:x(v)}ee=!1}(t,n,o,r,i)}});function Rt(e){Ie=Ot[$e](),Je=Et[_e](),Ct(Ie,Je,e)}const Ct=D(function(t,n,o,r,i){Ae<-1||(F(o),void 0!==i?R(`Message targetOrigin: %c${i}`,e.HIGHLIGHT):i=Ue,function(){const a=`${Ce}:${t}:${n}:${o}${void 0===r?"":`:${r}`}`;if(qe)try{window.parent.iframeParentListener(P+a)}catch(e){if(1!==Ae)throw e;return void Gt()}else We.postMessage(P+a,i);ee&&R(function(){const e=O(performance.now()-te);return o===z?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),e.HIGHLIGHT),x(`Sending message to parent page via ${qe?"sameOrigin":"postMessage"}: %c%c${a}`,e.ITALIC,e.HIGHLIGHT)}(),B())}),xt=D(function(t){F("onMessage");const{freeze:n}=Object,{parse:o}=JSON,r=e=>n(o(e)),i=e=>Ct(0,0,`${e}Stop`),a={init:function(){if("loading"===document.readyState)return void R("Page not ready, ignoring init message");const e=t.data.slice(13).split(":");We=t.source,K=t.origin,tt(e),be=!1,setTimeout(()=>{Ee=!1},128)},reset(){Ee?R("Page reset ignored by init"):(R("Page size reset by host page"),Rt("resetPage"))},resize(){R("Resize requested by host page"),At(d,"Parent window requested size check")},moveToAnchor(){Me.findTarget(l())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=l();R("PageInfo received from parent:",r(e)),Ke?S(Ke,o(e)):i("pageInfo")},parentInfo(){const e=r(l());R("ParentInfo received from parent:",e),et?S(et,e):i("parentInfo")},message(){const t=l();R("onMessage called from parent:%c",e.HIGHLIGHT,r(t)),S(Ye,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();F(e),e in a?a[e]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||c()||V(`Unexpected message (${t.data})`)}P===`${t.data}`.slice(0,13)&&function(){if(!1!==be)return c()?(W(s()),F(z),void a.init()):void R(`Ignored message of type "${s()}". Received before initialization.`);u()}()});function Pt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?V("Already setup"):(window.iframeChildListener=e=>setTimeout(()=>xt({data:e,sameOrigin:!0})),w(window,"message",xt),w(window,"readystatechange",Pt),Pt())}();
|
|
21
21
|
//# sourceMappingURL=index.cjs.js.map
|