iframe-resizer 5.4.6-beta.1 → 5.4.6-beta.3
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/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/js/iframeResizer.contentWindow.js +2 -2
- package/js/iframeResizer.contentWindow.js.map +1 -1
- package/js/iframeResizer.contentWindow.min.js +2 -2
- package/js/iframeResizer.contentWindow.min.js.map +1 -1
- package/js/iframeResizer.js +2 -2
- package/js/iframeResizer.js.map +1 -1
- package/js/iframeResizer.min.js +2 -2
- package/js/iframeResizer.min.js.map +1 -1
- package/package.json +4 -4
package/index.cjs.js
CHANGED
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy (child) 5.4.6-beta.
|
|
4
|
+
* @module iframe-resizer/legacy (child) 5.4.6-beta.3 (iife)
|
|
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
|
-
!function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,r="default",i=Object.freeze({assert:!0,error:!0,warn:!0}),a={expand:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},s={profile:0,profileEnd:0,timeStamp:0,trace:0},l=Object.assign(console);const{fromEntries:c,keys:u}=Object,d=e=>[e,l[e]],m=e=>t=>[t,function(n){e[t]=n}],f=(e,t)=>c(u(e).map(t));const p=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,g=p?"color: #A9C7FB;":"color: #135CD2;",h=p?"color: #E3E3E3;":"color: #1F1F1F;",y="5.4.6-beta.1",b=10,v="data-iframe-size",z="data-iframe-overflowed",w="data-iframe-ignore",$="bottom",S="right",O="resizeParent",E="setOffsetSize",M="resizeObserver",k="overflowObserver",j="mutationObserver",T="No change in content size detected",I=(e,t,n,o)=>e.addEventListener(t,n,o||!1),P=["<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 A=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(P[e]),x=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},C=e=>e,R=e=>Math.round(1e3*e)/1e3,N=e=>e.charAt(0).toUpperCase()+e.slice(1),B=e=>""!=`${e}`&&void 0!==e;function q(e){switch(!0){case!B(e):return"";case B(e.id):return`${e.nodeName}#${e.id}`;case B(e.name):return`${e.nodeName} (${e.name}`;case B(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const L=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${N(t)}`)};let F=!0;const W=(D=function(n={}){const c={},u={},p=[],g={...a,expand:!n.collapsed||a.expanded,...n};let h="";function y(){p.length=0,h=""}function b(){delete g.event,y()}const v=()=>!!p.some((([e])=>e in i))||!!g.expand;function z(){if(0!==p.length){l[v()?"group":"groupCollapsed"](`%c${g.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(g)} %c${g.showTime?h:""}`,e,t,o);for(const[e,...t]of p)l.assert(e in l,`Unknown console method: ${e}`),e in l&&l[e](...t);l.groupEnd(),b()}else b()}function w(){""===h&&(h=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}())}function $(e,...t){0===p.length&&(w(),queueMicrotask((()=>queueMicrotask(z)))),p.push([e,...t])}function S(e=r,...t){c[e]?$("log",`${e}: ${performance.now()-c[e]} ms`,...t):$("timeLog",e,...t)}return{...f(g,m(g)),...f(console,(e=>[e,(...t)=>$(e,...t)])),...f(s,d),assert:function(e,...t){e||$("assert",e,...t)},count:function(e=r){u[e]?u[e]+=1:u[e]=1,$("log",`${e}: ${u[e]}`)},countReset:function(e=r){delete u[e]},endAutoGroup:z,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;$("error",e)}return n},event:function(e){w(),g.event=e},purge:y,time:function(e=r){w(),c[e]=performance.now()},timeEnd:function(e=r){S(e),delete c[e]},timeLog:S,touch:w}},D?.__esModule?D.default:D);var D;const H=W({label:"iframeResizer(child)"});const V=(U="log",(...e)=>!F||H[U](...e));var U;const Z=V,{assert:J,debug:_,endAutoGroup:Q,error:G,errorBoundary:X,event:Y,label:K,purge:ee,warn:te}=H,ne=e=>{return H.warn((t=C,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},oe=ne,re=(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)=>ne(t))),ie=re("Method"),ae=re("Method","replaced with"),se=re("Option"),le=e=>t=>void 0===t?void 0:e(t),ce=le((e=>"true"===e)),ue=le(Number),de="--ifr-start",me="--ifr-end",fe=[],pe=new WeakSet,ge=e=>"object"==typeof e&&pe.add(e);let he={},ye=0;const be=setInterval((()=>{if(fe.length<10)return;if(he.hasTags&&he.len<25)return;fe.sort();const e=Math.min(fe.reduce(((e,t)=>e+t),0)/fe.length,fe[Math.floor(fe.length/2)]),t=R(e);t>ye&&(ye=t,Y("performanceObserver"),V("Mean time:",R(fe[Math.floor(fe.length/2)])),V("Median time:",R(fe.reduce(((e,t)=>e+t),0)/fe.length)),V("Average time:",t),V("Max time:",R(Math.max(...fe)))),e<=4||(clearInterval(be),ne(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${R(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 ve(e){e.getEntries().forEach((e=>{if(e.name===me){const{duration:t}=performance.measure("--ifr-measure",de,me);he=e.detail,fe.push(t),fe.length>100&&fe.shift()}}))}function ze(){new PerformanceObserver(ve).observe({entryTypes:["mark"]}),ge(document.documentElement),ge(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",ze):ze());const we=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},$e=we("function"),Se=we("number"),Oe=we("string");"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},r={height:()=>(te("Custom height calculation function not defined"),wt.auto()),width:()=>(te("Custom width calculation function not defined"),$t.auto())},i={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},s="checkVisibility"in window,l="auto",c="[iFrameSizer]",u={max:1,min:1,bodyScroll:1,documentElementScroll:1},d="scroll";let m,f,p,P,B,W,D=!0,U="",G=0,ee="",re="",le=!0,fe=!1,pe=!0,ge=!1,he=!1,ye=!1,be=1,ve=l,ze="",we=!0,Ee={},Me=!0,ke=!1,je="",Te=0,Ie=!1,Pe="",Ae=C,xe=[],Ce="child",Re=null,Ne=!1,Be="",qe=[],Le=window.parent,Fe="*",We=0,De=!1,He="",Ve=1,Ue=d,Ze=window,Je=()=>{te("onMessage function not defined")},_e=()=>{},Qe=null,Ge=null;function Xe(e){var t,n,o;!function(e){Pe=e[0]??Pe,G=ue(e[1])??G,fe=ce(e[2])??fe,ke=ce(e[3])??ke,D=ce(e[6])??D,ee=e[7]??ee,ve=e[8]??ve,U=e[9]??U,re=e[10]??re,We=ue(e[11])??We,Ee.enable=ce(e[12])??!1,Ce=e[13]??Ce,Ue=e[14]??Ue,Ie=ce(e[15])??Ie,m=ue(e[16])??m,f=ue(e[17])??f,le=ce(e[18])??le,je=e[19]??je,He=e[20]??He,Te=ue(e[21])??Te,Me=ce(e[23])??Me}(e),t={id:Pe,enabled:ke,expand:Me},H.label(`${t.id}`),H.expand(t.expand),F=t.enabled,V(`Initialising iframe v${y} ${window.location.href}`),function(){function e(e){V("Reading data from page:",e),W=$e(e,"onBeforeResize")??W,Je=$e(e,"onMessage")??Je,_e=$e(e,"onReady")??_e,"number"==typeof e?.offset&&(se("offset","offsetSize"),le&&(m=Se(e,"offset")??m),fe&&(f=Se(e,"offset")??f)),"number"==typeof e?.offsetSize&&(le&&(m=Se(e,"offsetSize")??m),fe&&(f=Se(e,"offsetSize")??f)),ze=Oe(e,"ignoreSelector")??ze,Be=Oe(e,"sizeSelector")??Be,Fe=Oe(e,"targetOrigin")??Fe,ve=e?.heightCalculationMethod||ve,Ue=e?.widthCalculationMethod||Ue}function t(e,t){return"function"==typeof e&&(ne(`<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.`),r[t]=e,e="custom"),e}if(1===Te)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),ve=t(ve,"height"),Ue=t(Ue,"width"),Z(`Set targetOrigin for parent: %c${Fe}`,g))}(),at(),function(){try{Ne=1===Te||"iframeParentListener"in window.parent}catch(e){V("Cross domain iframe detected")}}(),Te<0?oe(`${A(Te+2)}${A(2)}`):He.codePointAt(0)>4||Te<2&&oe(A(3)),He&&""!==He&&"false"!==He?He!==y&&ne(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${He} - Child page: ${y}.\n`):ne("<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"),ct(),ut(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(v,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&ne("<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&&ne("<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"),et(),1!==Te&&(Ze.parentIframe=Object.freeze({autoResize:e=>(L(e,"boolean","parentIframe.autoResize(enable) enable"),!0===e&&!1===D?(D=!0,jt("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===D&&(D=!1),Pt(0,0,"autoResize",JSON.stringify(D)),D),close(){Pt(0,0,"close")},getId:()=>Pe,getOrigin:()=>(ie("getOrigin()","getParentOrigin()"),p),getParentOrigin:()=>p,getPageInfo(e){if("function"==typeof e)return Qe=e,Pt(0,0,"pageInfo"),void ae("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Qe=null,Pt(0,0,"pageInfoStop")},getParentProps:e=>(L(e,"function","parentIframe.getParentProps(callback) callback"),Ge=e,Pt(0,0,"parentInfo"),()=>{Ge=null,Pt(0,0,"parentInfoStop")}),getParentProperties(e){ie("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){L(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Ee.findTarget(e)},reset(){It("parentIframe.reset")},setOffsetSize(e){L(e,"number","parentIframe.setOffsetSize(offset) offset"),m=e,f=e,jt(E,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){L(e,"number","parentIframe.scrollBy(x, y) x"),L(t,"number","parentIframe.scrollBy(x, y) y"),Pt(t,e,"scrollBy")},scrollTo(e,t){L(e,"number","parentIframe.scrollTo(x, y) x"),L(t,"number","parentIframe.scrollTo(x, y) y"),Pt(t,e,"scrollTo")},scrollToOffset(e,t){L(e,"number","parentIframe.scrollToOffset(x, y) x"),L(t,"number","parentIframe.scrollToOffset(x, y) y"),Pt(t,e,"scrollToOffset")},sendMessage(e,t){t&&L(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Pt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){ve=e,ct()},setWidthCalculationMethod(e){Ue=e,ut()},setTargetOrigin(e){L(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),V(`Set targetOrigin: %c${e}`,g),Fe=e},resize(e,t){e&&L(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&L(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),jt("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ie("size()","resize()"),this.resize(e,t)}}),Ze.parentIFrame=Ze.parentIframe),function(){function e(e){Pt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){V(`Add event listener: %c${n}`,g),I(window.document,t,e)}!0===Ie&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Ee=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,b)+parseInt(o.x,b),y:parseInt(n.top,b)+parseInt(o.y,b)}}function n(e){function n(e){const n=t(e);V(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,g,h,g,h,g),Pt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(V(`In page link (#${o}) not found in iFrame, so sending to parent`),Pt(0,0,"inPageLink",`#${o}`)):n(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&I(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function i(){I(window,"hashchange",o)}function a(){setTimeout(o,128)}function s(){V("Setting up location.hash handlers"),r(),i(),a()}return Ee.enable?1===Te?ne("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):s():V("In page linking not enabled"),{findTarget:n}}(),void 0===ee&&(ee=`${G}px`),rt("margin",(n="margin",(o=ee).includes("-")&&(te(`Negative CSS value ignored for ${n}`),o=""),o)),rt("background",U),rt("padding",re),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),V("Set HTML & body height: %cauto !important",g)}(),!0!==D&&V("Auto Resize disabled"),function(e){st({method:e,eventType:"After Print",eventName:"afterprint"}),st({method:e,eventType:"Before Print",eventName:"beforeprint"}),st({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const r=t=>{Z("Mutations observed:",t);for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},i=16,a=2,s=200;let l=1;function c(e){at(),tt(e),e.forEach(ft),e.clear()}function u(){const d=performance.now(),m=d-o,f=i*l+++a;if(m>f&&m<s)return Z("Backed off due to heavy workload on callStack"),V(`Delay: %c${R(m)}ms %c> Delay limit: %c${f}ms`,g,h,g),setTimeout(u,i*l),void(o=d);l=1,t.forEach(r),t.length=0,e.size>0&&c(e),et(),Ye(),n=!1,jt(j,"Mutation Observed")}function d(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(u))}function m(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[w,v],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return V("Setup <body> MutationObserver"),e.observe(t,n),e}m()}(),V("Setup ResizeObserver"),Re=new ResizeObserver(dt),Re.observe(document.body),mt.add(document.body),ft(document.body),le!==fe&&(V("Setup OverflowObserver"),Ae=(e=>{const t=e.side||$,n=e.onChange||C,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||C,i=(e=!1)=>n(e),a=(e,n)=>0===e||e>n[t],s=(e,t)=>e.toggleAttribute(z,t),l=new IntersectionObserver((function(e){Y("observation");for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,l=e[t],c=a(l,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);s(i,c),c&&V("Overflowed:",i)}var n;r(i)}),o),c=new WeakSet;return function(e){V("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=c.has(t);!n&&e?(l.observe(t),c.add(t)):J(!n,"Node already observed",t)}}})({onChange:Ke,root:document.documentElement,side:le?$:S})),tt(ht(document)()),queueMicrotask(_e),V("Initialization complete"),jt("init","Init message from host page",void 0,void 0,y),document.title&&""!==document.title&&Pt(0,0,"title",document.title)}function Ye(){xe=document.querySelectorAll(`[${z}]:not([${w}]):not([${w}] *)`),he=xe.length>0}function Ke(e){Ye(),(he||e)&&(V("Observed Elements:",xe.length),jt(k,"Overflow updated"))}function et(){qe=document.querySelectorAll(`[${v}]`),ye=qe.length>0,V(`Tagged elements found: %c${ye}`,g)}function tt(e){ye||Ae(e)}let nt=0;function ot(){const n=document.querySelectorAll(`*[${w}]`);ge=n.length>0,ge&&n.length!==nt&&(function(n){const o=1===n.length?"":"s";te(`%c[${w}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),nt=n.length)}function rt(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),Z(`Set body ${e}: %c${t}`,g))}function it(e,t,n){if(""!==n){V(`${e}: %c${n}`,g);for(const e of document.querySelectorAll(n))V(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function at(){it("sizeSelector",v,Be),it("ignoreSelector",w,ze)}function st(e){({add(t){function n(){jt(e.eventName,e.eventType)}a[t]=n,I(window,t,n,{passive:!0})},remove(e){const t=a[e];var n,o;delete a[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),V(`${N(e.method)} event listener: %c${e.eventType}`,g)}function lt(e,t,n,o){return t!==e&&(e in n||(te(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in i&&ne(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you remove this option.`),V(`Set ${o} calculation method: %c${e}`,g)),e}function ct(){ve=lt(ve,l,wt,"height")}function ut(){Ue=lt(Ue,d,$t,"width")}function dt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;jt(M,`Element resized <${q(t)}>`)}const mt=new WeakSet;function ft(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!mt.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Re.observe(e),mt.add(e),V(`Attached resizeObserver: %c${q(e)}`,g))}const t=ht(e)();for(const e of t){if(mt.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Re.observe(e),mt.add(e),V(`Attached resizeObserver: %c${q(e)}`,g))}}function pt(e){performance.mark(de);const t=N(e);let n=0,r=document.documentElement,i=ye?0:document.documentElement.getBoundingClientRect().bottom;const a=ye?qe:he?xe:ht(document)();let l=a.length;for(const t of a)ye||!s||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,r=t)):l-=1;return Z(`${t} position calculated from:`,r),performance.mark(me,{detail:{Side:t,len:l,hasTags:ye,logging:ke}}),i}const gt=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],ht=e=>()=>{ot();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 ge&&t.push(`not([${w}])`,`not([${w}] *)`),e.querySelectorAll(t.join(":"))},yt={height:0,width:0},bt={height:0,width:0},vt=[g,h,g];function zt(e){function t(){return bt[o]=r,yt[o]=s,r}const n=e===wt,o=n?"height":"width",r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${r}px %cPage: %c${s}px`;let c=0;switch(!0){case!e.enabled():return s;case ye:Z("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!he&&0===bt[o]&&0===yt[o]:Z(`Initial page size values: ${l}`,...vt),c=t();break;case De&&r===bt[o]&&s===yt[o]:Z(`Size unchanged: ${l}`,...vt),c=Math.max(r,s);break;case 0===r:Z(`Page is hidden: ${l}`,...vt),c=s;break;case!he&&r!==bt[o]&&s<=yt[o]:Z(`New <html> size: ${l} `,...vt),Z(`Previous <html> size: %c${bt[o]}px`,g),c=t();break;case!n:c=e.taggedElement();break;case!he&&r<bt[o]:Z(`<html> size decreased: ${l}`,...vt),c=t();break;case s===a||s===i:Z(`<html> size equals page size: ${l}`,...vt),c=t();break;case r>s:Z(`Page size < <html> size: ${l}`,...vt),c=t();break;case he:Z("Found element overflowing <html> "),c=e.taggedElement();break;default:Z(`Using <html> size: ${l}`,...vt),c=t()}return Z(`Content ${o}: %c${c}px`,g),c+=function(e){const t=e.getOffset();return 0!==t&&Z(`Page offsetSize: %c${t}px`,g),t}(e),c}const wt={enabled:()=>le,getOffset:()=>m,auto:()=>zt(wt),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,b)+parseInt(t.marginBottom,b)},bodyScroll:()=>document.body.scrollHeight,offset:()=>wt.bodyOffset(),custom:()=>r.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...gt(wt)),min:()=>Math.min(...gt(wt)),grow:()=>wt.max(),lowestElement:()=>pt($),taggedElement:()=>pt($)},$t={enabled:()=>fe,getOffset:()=>f,auto:()=>zt($t),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>r.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...gt($t)),min:()=>Math.min(...gt($t)),rightMostElement:()=>pt(S),scroll:()=>Math.max($t.bodyScroll(),$t.documentElementScroll()),taggedElement:()=>pt(S)},St=(e,t)=>!(Math.abs(e-t)<=We);function Ot(e,t){const n=e[t]();return e.enabled()&&void 0!==W?function(e){const t=W(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}function Et(e,t,n,o,r){const i=n??Ot(wt,ve),a=o??Ot($t,Ue);switch(V(`Resize event: %c${t}`,g),!0){case le&&St(be,i)||fe&&St(Ve,a)||"init"===e:be=i,Ve=a;case e===E:Pt(be,Ve,e,r);break;case!e!==O&&(le&&ve in u||fe&&Ue in u):It(t);break;case e===M:case e===k:case e===j:V(T);break;default:Z(T)}P=!1}let Mt=!1;const kt=x((()=>oe(A(4)))),jt=X(((e,t,n,o,r)=>{B=performance.now(),P=!0,Y(e),!0!==Mt&&(D||e===O?document.hidden?V("Page hidden - Ignored resize request"):(Mt=!0,requestAnimationFrame((()=>{Mt=!1})),Et(e,t,n,o,r)):Z("Resizing disabled"))}));function Tt(e){be=wt[ve](),Ve=$t[Ue](),Pt(be,Ve,e)}function It(e){const t=ve;ve=l,V(`Reset trigger event: %c${e}`,g),De?V("TriggerLock blocked calculation"):(De=!0,_("Trigger event lock on"),requestAnimationFrame((()=>{De=!1,_("Trigger event lock off")}))),Tt("reset"),ve=t}const Pt=X((function(e,t,o,r,i){Te<-1||(Y(o),void 0!==i?V(`Message targetOrigin: %c${i}`,g):i=Fe,function(){const a=`${Pe}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(Ne)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==Te)throw e;return void kt()}else Le.postMessage(c+a,i);P&&V(function(){const e=R(performance.now()-B);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),g),Z(`Sending message to parent page via ${Ne?"sameOrigin":"postMessage"}: %c%c${a}`,n,g)}(),Q())})),At=X((function(e){Y("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>t(n(e)),r=e=>Pt(0,0,`${e}Stop`),i={init:function(){if("loading"===document.readyState)return void V("Page not ready, ignoring init message");const t=e.data.slice(13).split(":");Le=e.source,p=e.origin,Xe(t),pe=!1,setTimeout((()=>{we=!1}),128)},reset(){we?V("Page reset ignored by init"):(V("Page size reset by host page"),Tt("resetPage"))},resize(){jt(O,"Parent window requested size check")},moveToAnchor(){Ee.findTarget(s())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=s();V("PageInfo received from parent:",o(e)),Qe?setTimeout((()=>Qe(n(e)))):r("pageInfo")},parentInfo(){const e=o(s());V("ParentInfo received from parent:",e),Ge?setTimeout((()=>Ge(e))):r("parentInfo")},message(){const e=s();V("onMessage called from parent:%c",g,o(e)),setTimeout((()=>Je(n(e))))}},a=()=>e.data.split("]")[1].split(":")[0],s=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function u(){const t=a();Y(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||te(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&function(){if(!1!==pe)return l()?(K(a()),Y("init"),void i.init()):void V(`Ignored message of type "${a()}". Received before initialization.`);u()}()}));function xt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?te("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>At({data:e,sameOrigin:!0}))),I(window,"message",At),I(window,"readystatechange",xt),xt())}()}();
|
|
20
|
+
!function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,r="default",i=Object.freeze({assert:!0,error:!0,warn:!0}),a={expand:!0,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},s={profile:0,profileEnd:0,timeStamp:0,trace:0},l=Object.assign(console);const{fromEntries:c,keys:d}=Object,u=e=>[e,l[e]],f=e=>t=>[t,function(n){e[t]=n}],m=(e,t)=>c(d(e).map(t));const p=!(typeof window>"u"||"function"!=typeof window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches,g=p?"color: #A9C7FB;":"color: #135CD2;",h=p?"color: #E3E3E3;":"color: #1F1F1F;",y="5.4.6-beta.3",b=10,v="data-iframe-size",z="data-iframe-overflowed",w="data-iframe-ignore",$="bottom",S="right",O=Symbol("sizeChanged"),M="manualResize",E="parentResize",k={[M]:1,[E]:1},j="setOffsetSize",T="resizeObserver",I="overflowObserver",A="mutationObserver",P="No change in content size detected",C="init",x=(e,t,n,o)=>e.addEventListener(t,n,o||!1),R=["<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 N=e=>(e=>e.replace(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(R[e]),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,F=e=>e.charAt(0).toUpperCase()+e.slice(1),D=e=>""!=`${e}`&&void 0!==e;function W(e){switch(!0){case!D(e):return"";case D(e.id):return`${e.nodeName}#${e.id}`;case D(e.name):return`${e.nodeName} (${e.name}`;case D(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}const H=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${F(t)}`)};let V=!0;const U=(Z=function(n={}){const c={},d={},p=[],g={...a,expand:!n.collapsed||a.expanded,...n};let h="";function y(){p.length=0,h=""}function b(){delete g.event,y()}const v=()=>!!p.some((([e])=>e in i))||!!g.expand;function z(){if(0!==p.length){l[v()?"group":"groupCollapsed"](`%c${g.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(g)} %c${g.showTime?h:""}`,e,t,o);for(const[e,...t]of p)l.assert(e in l,`Unknown console method: ${e}`),e in l&&l[e](...t);l.groupEnd(),b()}else b()}function w(){""===h&&(h=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}())}function $(e,...t){0===p.length&&(w(),queueMicrotask((()=>queueMicrotask(z)))),p.push([e,...t])}function S(e=r,...t){c[e]?$("log",`${e}: ${performance.now()-c[e]} ms`,...t):$("timeLog",e,...t)}return{...m(g,f(g)),...m(console,(e=>[e,(...t)=>$(e,...t)])),...m(s,u),assert:function(e,...t){e||$("assert",e,...t)},count:function(e=r){d[e]?d[e]+=1:d[e]=1,$("log",`${e}: ${d[e]}`)},countReset:function(e=r){delete d[e]},endAutoGroup:z,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){if(!Error.prototype.isPrototypeOf(e))throw e;$("error",e)}return n},event:function(e){w(),g.event=e},purge:y,time:function(e=r){w(),c[e]=performance.now()},timeEnd:function(e=r){S(e),delete c[e]},timeLog:S,touch:w}},Z?.__esModule?Z.default:Z);var Z;const J=U({label:"iframeResizer(child)"});const _=(Q="log",(...e)=>!V||J[Q](...e));var Q;const G=_,{assert:X,debug:Y,endAutoGroup:K,error:ee,errorBoundary:te,event:ne,label:oe,purge:re,warn:ie}=J,ae=e=>{return J.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},se=ae,le=(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)=>ae(t))),ce=le("Method"),de=le("Method","replaced with"),ue=le("Option"),fe=e=>t=>void 0===t?void 0:e(t),me=fe((e=>"true"===e)),pe=fe(Number),ge="--ifr-start",he="--ifr-end",ye=[],be=new WeakSet,ve=e=>"object"==typeof e&&be.add(e);let ze={},we=0;const $e=setInterval((()=>{if(ye.length<10)return;if(ze.hasTags&&ze.len<25)return;ye.sort();const e=Math.min(ye.reduce(((e,t)=>e+t),0)/ye.length,ye[Math.floor(ye.length/2)]),t=L(e);t>we&&(we=t,ne("performanceObserver"),_("Mean time:",L(ye[Math.floor(ye.length/2)])),_("Median time:",L(ye.reduce(((e,t)=>e+t),0)/ye.length)),_("Average time:",t),_("Max time:",L(Math.max(...ye)))),e<=4||(clearInterval($e),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 ${ze.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function Se(e){e.getEntries().forEach((e=>{if(e.name===he){const{duration:t}=performance.measure("--ifr-measure",ge,he);ze=e.detail,ye.push(t),ye.length>100&&ye.shift()}}))}function Oe(){new PerformanceObserver(Se).observe({entryTypes:["mark"]}),ve(document.documentElement),ve(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",Oe):Oe());const Me=e=>(t,n)=>{if(n in t){if(typeof t[n]===e)return t[n];throw new TypeError(`${n} is not a ${e}.`)}},Ee=Me("function"),ke=Me("number"),je=Me("string");"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},r={height:()=>(ie("Custom height calculation function not defined"),Ot.auto()),width:()=>(ie("Custom width calculation function not defined"),Mt.auto())},i={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},s="checkVisibility"in window,l="auto",c="[iFrameSizer]",d="scroll";let u,f,m,p,R,D,U,Z=!0,Q="",ee=0,re="",le="",fe=!0,ye=!1,be=!0,ve=!1,ze=!1,we=!1,$e=1,Se=l,Oe="",Me=!0,Te={},Ie=!0,Ae=!1,Pe="",Ce=0,xe=!1,Re="",Ne=B,qe=[],Be="child",Le=null,Fe=!1,De="",We=[],He=window.parent,Ve="*",Ue=0,Ze=!1,Je=1,_e=d,Qe=window,Ge=()=>{ie("onMessage function not defined")},Xe=()=>{},Ye=null,Ke=null;function et(e){var t,n,o;!function(e){Re=e[0]??Re,ee=pe(e[1])??ee,ye=me(e[2])??ye,Ae=me(e[3])??Ae,Z=me(e[6])??Z,re=e[7]??re,Se=e[8]??Se,Q=e[9]??Q,le=e[10]??le,Ue=pe(e[11])??Ue,Te.enable=me(e[12])??!1,Be=e[13]??Be,_e=e[14]??_e,xe=me(e[15])??xe,u=pe(e[16])??u,f=pe(e[17])??f,fe=me(e[18])??fe,Pe=e[19]??Pe,D=e[20]??D,Ce=pe(e[21])??Ce,Ie=me(e[23])??Ie}(e),t={id:Re,enabled:Ae,expand:Ie},J.label(`${t.id}`),J.expand(t.expand),V=t.enabled,_(`Initialising iframe v${y} ${window.location.href}`),function(){function e(e){_("Reading data from page:",e),U=Ee(e,"onBeforeResize")??U,Ge=Ee(e,"onMessage")??Ge,Xe=Ee(e,"onReady")??Xe,"number"==typeof e?.offset&&(ue("offset","offsetSize"),fe&&(u=ke(e,"offset")??u),ye&&(f=ke(e,"offset")??f)),"number"==typeof e?.offsetSize&&(fe&&(u=ke(e,"offsetSize")??u),ye&&(f=ke(e,"offsetSize")??f)),Oe=je(e,"ignoreSelector")??Oe,De=je(e,"sizeSelector")??De,Ve=je(e,"targetOrigin")??Ve,Se=e?.heightCalculationMethod||Se,_e=e?.widthCalculationMethod||_e}function t(e,t){return"function"==typeof e&&(ae(`<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.`),r[t]=e,e="custom"),e}if(1===Ce)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),Se=t(Se,"height"),_e=t(_e,"width"),G(`Set targetOrigin for parent: %c${Ve}`,g))}(),ct(),function(){try{Fe=1===Ce||"iframeParentListener"in window.parent}catch(e){_("Cross domain iframe detected")}}(),Ce<0?se(`${N(Ce+2)}${N(2)}`):D?.codePointAt(0)>4||Ce<2&&se(N(3)),D&&""!==D&&"false"!==D?D!==y&&ae(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${D} - Child page: ${y}.\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"),ft(),mt(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(v,!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</>.")}(),"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"),ot(),1!==Ce&&(Qe.parentIframe=Object.freeze({autoResize:e=>(H(e,"boolean","parentIframe.autoResize(enable) enable"),!0===e&&!1===Z?(Z=!0,It("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===Z&&(Z=!1),Pt(0,0,"autoResize",JSON.stringify(Z)),Z),close(){Pt(0,0,"close")},getId:()=>Re,getOrigin:()=>(ce("getOrigin()","getParentOrigin()"),m),getParentOrigin:()=>m,getPageInfo(e){if("function"==typeof e)return Ye=e,Pt(0,0,"pageInfo"),void de("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Ye=null,Pt(0,0,"pageInfoStop")},getParentProps:e=>(H(e,"function","parentIframe.getParentProps(callback) callback"),Ke=e,Pt(0,0,"parentInfo"),()=>{Ke=null,Pt(0,0,"parentInfoStop")}),getParentProperties(e){ce("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){H(e,"string","parentIframe.moveToAnchor(anchor) anchor"),Te.findTarget(e)},reset(){!function(){const e=Se;Se=l,_("Reset trigger event: %cparentIframe.reset",g),Ze?_("TriggerLock blocked calculation"):(Ze=!0,Y("Trigger event lock on"),requestAnimationFrame((()=>{Ze=!1,Y("Trigger event lock off")}))),At("reset"),Se=e}()},setOffsetSize(e){H(e,"number","parentIframe.setOffsetSize(offset) offset"),u=e,f=e,It(j,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){H(e,"number","parentIframe.scrollBy(x, y) x"),H(t,"number","parentIframe.scrollBy(x, y) y"),Pt(t,e,"scrollBy")},scrollTo(e,t){H(e,"number","parentIframe.scrollTo(x, y) x"),H(t,"number","parentIframe.scrollTo(x, y) y"),Pt(t,e,"scrollTo")},scrollToOffset(e,t){H(e,"number","parentIframe.scrollToOffset(x, y) x"),H(t,"number","parentIframe.scrollToOffset(x, y) y"),Pt(t,e,"scrollToOffset")},sendMessage(e,t){t&&H(t,"string","parentIframe.sendMessage(msg, targetOrigin) targetOrigin"),Pt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Se=e,ft()},setWidthCalculationMethod(e){_e=e,mt()},setTargetOrigin(e){H(e,"string","parentIframe.setTargetOrigin(targetOrigin) targetOrigin"),_(`Set targetOrigin: %c${e}`,g),Ve=e},resize(e,t){e&&H(e,"number","parentIframe.resize(customHeight, customWidth) customHeight"),t&&H(t,"number","parentIframe.resize(customHeight, customWidth) customWidth"),It(M,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){ce("size()","resize()"),this.resize(e,t)}}),Qe.parentIFrame=Qe.parentIframe),function(){function e(e){Pt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){_(`Add event listener: %c${n}`,g),x(window.document,t,e)}!0===xe&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),Te=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function t(t){const n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,b)+parseInt(o.x,b),y:parseInt(n.top,b)+parseInt(o.y,b)}}function n(e){function n(e){const n=t(e);_(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,g,h,g,h,g),Pt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,r=decodeURIComponent(o),i=document.getElementById(r)||document.getElementsByName(r)[0];void 0===i?(_(`In page link (#${o}) not found in iFrame, so sending to parent`),Pt(0,0,"inPageLink",`#${o}`)):n(i)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function r(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&x(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function i(){x(window,"hashchange",o)}function a(){setTimeout(o,128)}function s(){_("Setting up location.hash handlers"),r(),i(),a()}return Te.enable?1===Ce?ae("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):s():_("In page linking not enabled"),{findTarget:n}}(),void 0===re&&(re=`${ee}px`),st("margin",(n="margin",(o=re).includes("-")&&(ie(`Negative CSS value ignored for ${n}`),o=""),o)),st("background",Q),st("padding",le),function(){const e=document.createElement("div");e.style.clear="both",e.style.display="block",e.style.height="0",document.body.append(e)}(),function(){const e=e=>e.style.setProperty("height","auto","important");e(document.documentElement),e(document.body),_("Set HTML & body height: %cauto !important",g)}(),!0!==Z&&_("Auto Resize disabled"),function(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"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const r=t=>{G("Mutations observed:",t);for(const n of t){const{addedNodes:t,removedNodes:o}=n;for(const n of t)e.add(n);for(const t of o)e.delete(t)}},i=16,a=2,s=200;let l=1;function c(e){ct(),rt(e),e.forEach(ht),e.clear()}function d(){const u=performance.now(),f=u-o,m=i*l+++a;if(f>m&&f<s)return G("Backed off due to heavy workload on callStack"),_(`Delay: %c${L(f)}ms %c> Delay limit: %c${m}ms`,g,h,g),setTimeout(d,i*l),void(o=u);l=1,t.forEach(r),t.length=0,e.size>0&&c(e),ot(),tt(),n=!1,It(A,"Mutation Observed")}function u(e){t.push(e),n||(o=performance.now(),n=!0,requestAnimationFrame(d))}function f(){const e=new window.MutationObserver(u),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[w,v],attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return _("Setup <body> MutationObserver"),e.observe(t,n),e}f()}(),_("Setup ResizeObserver"),Le=new ResizeObserver(pt),Le.observe(document.body),gt.add(document.body),ht(document.body),fe!==ye&&(_("Setup OverflowObserver"),Ne=(e=>{const t=e.side||$,n=e.onChange||B,o={root:e.root,rootMargin:"0px",threshold:1},r=window?.requestAnimationFrame||B,i=(e=!1)=>n(e),a=(e,n)=>0===e||e>n[t],s=(e,t)=>e.toggleAttribute(z,t),l=new IntersectionObserver((function(e){ne("observation");for(const o of e){const{boundingClientRect:e,rootBounds:r,target:i}=o,l=e[t],c=a(l,r)&&!((n=i).hidden||null===n.offsetParent||"none"===n.style.display);s(i,c),c&&_("Overflowed:",i)}var n;r(i)}),o),c=new WeakSet;return function(e){_("Attached overflowObservers");for(const t of e){const e=t.nodeType===Node.ELEMENT_NODE,n=c.has(t);!n&&e?(l.observe(t),c.add(t)):X(!n,"Node already observed",t)}}})({onChange:nt,root:document.documentElement,side:fe?$:S})),rt(vt(document)()),queueMicrotask(Xe),_("Initialization complete"),It(C,"Init message from host page",void 0,void 0,y),document.title&&""!==document.title&&Pt(0,0,"title",document.title)}function tt(){qe=document.querySelectorAll(`[${z}]:not([${w}]):not([${w}] *)`),ze=qe.length>0}function nt(e){tt(),(ze||e)&&(_("Observed Elements:",qe.length),It(I,"Overflow updated"))}function ot(){We=document.querySelectorAll(`[${v}]`),we=We.length>0,_(`Tagged elements found: %c${we}`,g)}function rt(e){we||Ne(e)}let it=0;function at(){const n=document.querySelectorAll(`*[${w}]`);ve=n.length>0,ve&&n.length!==it&&(function(n){const o=1===n.length?"":"s";ie(`%c[${w}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),it=n.length)}function st(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),G(`Set body ${e}: %c${t}`,g))}function lt(e,t,n){if(""!==n){_(`${e}: %c${n}`,g);for(const e of document.querySelectorAll(n))_(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function ct(){lt("sizeSelector",v,De),lt("ignoreSelector",w,Oe)}function dt(e){({add(t){function n(){It(e.eventName,e.eventType)}a[t]=n,x(window,t,n,{passive:!0})},remove(e){const t=a[e];var n,o;delete a[e],n=e,o=t,window.removeEventListener(n,o,!1)}})[e.method](e.eventName),_(`${F(e.method)} event listener: %c${e.eventType}`,g)}function ut(e,t,n,o){return t!==e&&(e in n||(ie(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in i)&&ae(`<rb>Deprecated ${o}CalculationMethod (${e})</>\n\nThis version of <i>iframe-resizer</> can auto detect the most suitable ${o} calculation method. It is recommended that you ${D?"remove this option.":"set this option to <b>'auto'</> when using an older version of <i>iframe-resizer</> on the parent page."}`),_(`Set ${o} calculation method: %c${e}`,g),e}function ft(){Se=ut(Se,l,Ot,"height")}function mt(){_e=ut(_e,d,Mt,"width")}function pt(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;It(T,`Element resized <${W(t)}>`)}const gt=new WeakSet;function ht(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!gt.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Le.observe(e),gt.add(e),_(`Attached resizeObserver: %c${W(e)}`,g))}const t=vt(e)();for(const e of t){if(gt.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Le.observe(e),gt.add(e),_(`Attached resizeObserver: %c${W(e)}`,g))}}function yt(e){performance.mark(ge);const t=F(e);let n=0,r=document.documentElement,i=we?0:document.documentElement.getBoundingClientRect().bottom;const a=we?We:ze?qe:vt(document)();let l=a.length;for(const t of a)we||!s||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,r=t)):l-=1;return G(`${t} position calculated from:`,r),performance.mark(he,{detail:{Side:t,len:l,hasTags:we,logging:Ae}}),i}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 ve&&t.push(`not([${w}])`,`not([${w}] *)`),e.querySelectorAll(t.join(":"))},zt={height:0,width:0},wt={height:0,width:0},$t=[g,h,g];function St(e){function t(){return wt[o]=r,zt[o]=s,r}const n=e===Ot,o=n?"height":"width",r=e.boundingClientRect(),i=Math.ceil(r),a=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),l=`HTML: %c${r}px %cPage: %c${s}px`;let c=0;switch(!0){case!e.enabled():return s;case we:G("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ze&&0===wt[o]&&0===zt[o]:G(`Initial page size values: ${l}`,...$t),c=t();break;case Ze&&r===wt[o]&&s===zt[o]:G(`Size unchanged: ${l}`,...$t),c=Math.max(r,s);break;case 0===r:G(`Page is hidden: ${l}`,...$t),c=s;break;case!ze&&r!==wt[o]&&s<=zt[o]:G(`New <html> size: ${l} `,...$t),G(`Previous <html> size: %c${wt[o]}px`,g),c=t();break;case!n:c=e.taggedElement();break;case!ze&&r<wt[o]:G(`<html> size decreased: ${l}`,...$t),c=t();break;case s===a||s===i:G(`<html> size equals page size: ${l}`,...$t),c=t();break;case r>s:G(`Page size < <html> size: ${l}`,...$t),c=t();break;case ze:G("Found element overflowing <html> "),c=e.taggedElement();break;default:G(`Using <html> size: ${l}`,...$t),c=t()}return G(`Content ${o}: %c${c}px`,g),c+=function(e){const t=e.getOffset();return 0!==t&&G(`Page offsetSize: %c${t}px`,g),t}(e),c}const Ot={enabled:()=>fe,getOffset:()=>u,auto:()=>St(Ot),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,b)+parseInt(t.marginBottom,b)},bodyScroll:()=>document.body.scrollHeight,offset:()=>Ot.bodyOffset(),custom:()=>r.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().bottom,document.body.getBoundingClientRect().bottom),max:()=>Math.max(...bt(Ot)),min:()=>Math.min(...bt(Ot)),grow:()=>Ot.max(),lowestElement:()=>yt($),taggedElement:()=>yt($)},Mt={enabled:()=>ye,getOffset:()=>f,auto:()=>St(Mt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>r.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...bt(Mt)),min:()=>Math.min(...bt(Mt)),rightMostElement:()=>yt(S),scroll:()=>Math.max(Mt.bodyScroll(),Mt.documentElementScroll()),taggedElement:()=>yt(S)},Et=(e,t)=>!(Math.abs(e-t)<=Ue);function kt(e,t){const n=e[t]();return e.enabled()&&void 0!==U?function(e){const t=U(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 Tt=q((()=>se(N(4)))),It=te(((e,t,n,o,r)=>{if(R=performance.now(),p=!0,ne(e),!0!==jt)return Z||e in k?void(document.hidden?_("Page hidden - Ignored resize request"):(jt=!0,requestAnimationFrame((()=>{jt=!1})),function(e,t,n,o,r){const i=n??kt(Ot,Se),a=o??kt(Mt,_e),s=fe&&Et($e,i)||ye&&Et(Je,a)?O:e;switch(_(`Resize event: %c${t}`,g),s){case C:case O:$e=i,Je=a;case j:Pt($e,Je,e,r);break;case T:case I:case A:_(P);break;default:G(P)}p=!1}(e,t,n,o,r))):(G("Resizing disabled"),void K())}));function At(e){$e=Ot[Se](),Je=Mt[_e](),Pt($e,Je,e)}const Pt=te((function(e,t,o,r,i){Ce<-1||(ne(o),void 0!==i?_(`Message targetOrigin: %c${i}`,g):i=Ve,function(){const a=`${Re}:${e}:${t}:${o}${void 0===r?"":`:${r}`}`;if(Fe)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==Ce)throw e;return void Tt()}else He.postMessage(c+a,i);p&&_(function(){const e=L(performance.now()-R);return o===C?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),g),G(`Sending message to parent page via ${Fe?"sameOrigin":"postMessage"}: %c%c${a}`,n,g)}(),K())})),Ct=te((function(e){ne("onMessage");const{freeze:t}=Object,{parse:n}=JSON,o=e=>t(n(e)),r=e=>Pt(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(":");He=e.source,m=e.origin,et(t),be=!1,setTimeout((()=>{Me=!1}),128)},reset(){Me?_("Page reset ignored by init"):(_("Page size reset by host page"),At("resetPage"))},resize(){_("Resize requested by host page"),"auto"===Se&&"auto"===_e&&ae("<rb>Deprecated Method</>\n \nUse of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As the size detection no longer requires a trigger event from the parent page."),It(E,"Parent window requested size check")},moveToAnchor(){Te.findTarget(s())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=s();_("PageInfo received from parent:",o(e)),Ye?setTimeout((()=>Ye(n(e)))):r("pageInfo")},parentInfo(){const e=o(s());_("ParentInfo received from parent:",e),Ke?setTimeout((()=>Ke(e))):r("parentInfo")},message(){const e=s();_("onMessage called from parent:%c",g,o(e)),setTimeout((()=>Ge(n(e))))}},a=()=>e.data.split("]")[1].split(":")[0],s=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function d(){const t=a();ne(t),t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||ie(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&function(){if(!1!==be)return l()?(oe(a()),ne(C),void i.init()):void _(`Ignored message of type "${a()}". Received before initialization.`);d()}()}));function xt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?ie("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>Ct({data:e,sameOrigin:!0}))),x(window,"message",Ct),x(window,"readystatechange",xt),xt())}()}();
|
|
21
21
|
//# sourceMappingURL=iframeResizer.contentWindow.js.map
|