iframe-resizer 5.4.0-beta.9 → 5.4.0
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 -3
- package/js/iframeResizer.contentWindow.min.js +2 -3
- package/js/iframeResizer.js +2 -3
- package/js/iframeResizer.min.js +2 -3
- package/package.json +4 -4
- package/js/iframeResizer.contentWindow.js.map +0 -1
- package/js/iframeResizer.contentWindow.min.js.map +0 -1
- package/js/iframeResizer.js.map +0 -1
- package/js/iframeResizer.min.js.map +0 -1
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.0
|
|
4
|
+
* @module iframe-resizer/legacy (child) 5.4.0 (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,4 @@
|
|
|
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,i="default",r={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},a={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:s}=Object,c=e=>t=>[t,function(n){e[t]=n}],d=(e,t)=>l(s(e).map(t));const u=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),m=u()?"color: #A9C7FB;":"color: #135CD2;",f=u()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0-beta.9",h=10,g="data-iframe-size",y="data-iframe-overflowed",v="data-iframe-ignore",b="bottom",z="right",w="resizeParent",$="setOffsetSize",S=(e,t,n,o)=>e.addEventListener(t,n,o||!1),E=["<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 M=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(E[e]),O=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},j=e=>e,k=e=>Math.round(1e3*e)/1e3,P=e=>e.charAt(0).toUpperCase()+e.slice(1),A=e=>""!=`${e}`&&void 0!==e;function C(e){switch(!0){case!A(e):return"";case A(e.id):return`${e.nodeName}#${e.id}`;case A(e.name):return`${e.nodeName} (${e.name}`;case A(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let T=!0;const I=(N=function(n={}){const l={},s=[],u={...r,...n};let m;function f(){s.length=0}function p(){delete u.event,f()}const h=()=>!s.some((([e])=>"error"===e||"warn"===e))&&!!u.collapsed;function g(){if(0!==s.length){console[h()?"groupCollapsed":"group"](`%c${u.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(u)} %c${u.showTime?m:""}`,e,t,o);for(const[e,...t]of s)console[e](...t);console.groupEnd(),p()}else p()}function y(){m=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(g)))}function v(e,...t){0===s.length&&y(),s.push([e,...t])}function b(e=i,...t){v("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...d(u,c(u)),...d(console,(e=>[e,(...t)=>v(e,...t)])),...d(a,(e=>[e,console[e]])),endAutoGroup:g,purge:f,time:function(e=i){l[e]=performance.now()},timeEnd:function(e=i){b(e),delete l[e]},timeLog:b}},N?.__esModule?N.default:N);var N;const R=I({label:"iframeResizer(child)"});const x=e=>(...t)=>!T||R[e](...t),q=x("log"),L=x("info"),{event:F,assert:B,debug:D,endAutoGroup:W,error:V,purge:H,warn:U}=R,Z=(...e)=>{return R.warn((t=j,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,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,...t)=>Z(...t))),Q=_("Method"),G=_("Method","replaced with"),X=_("Option"),Y=requestAnimationFrame,K="--ifr-start",ee="--ifr-end",te=[],ne=new WeakSet,oe=e=>"object"==typeof e&&ne.add(e);let ie={},re=0;const ae=setInterval((()=>{if(te.length<10)return;if(ie.hasTags&&ie.len<25)return;te.sort();const e=Math.min(te.reduce(((e,t)=>e+t),0)/te.length,te[Math.floor(te.length/2)]),t=k(e);t>re&&(re=t,F("performanceObserver"),q("Mean time:",k(te[Math.floor(te.length/2)])),q("Median time:",k(te.reduce(((e,t)=>e+t),0)/te.length)),q("Average time:",t),q("Max time:",k(Math.max(...te)))),e<=4||(clearInterval(ae),Z(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${k(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${ie.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function le(e){e.getEntries().forEach((e=>{if(e.name===ee){const{duration:t}=performance.measure("--ifr-measure",K,ee);ie=e.detail,te.push(t),te.length>100&&te.shift()}}))}function se(){new PerformanceObserver(le).observe({entryTypes:["mark"]}),oe(document.documentElement),oe(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",se):se()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(U("Custom height calculation function not defined"),at.auto()),width:()=>(U("Custom width calculation function not defined"),lt.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},l="checkVisibility"in window,s="auto",c="[iFrameSizer]",d={max:1,min:1,bodyScroll:1,documentElementScroll:1},u="scroll";let E,A,I,N,x,B=!0,V="",H=0,_="",te="",ne=!0,oe=!1,ie=!0,re=!1,ae=!1,le=!1,se=1,ce=s,de="",ue=!0,me="",fe={},pe=!1,he=0,ge=!1,ye="",ve=j,be=[],ze="child",we=null,$e=!1,Se="",Ee=[],Me=window.parent,Oe="*",je=0,ke=!1,Pe="",Ae=1,Ce=u,Te=window,Ie=()=>{U("onMessage function not defined")},Ne=()=>{},Re=null,xe=null;function qe(){var e,t,n,o;!function(){const e=e=>"true"===e,t=me.slice(13).split(":");ye=t[0],H=void 0===t[1]?H:Number(t[1]),oe=void 0===t[2]?oe:e(t[2]),pe=void 0===t[3]?pe:e(t[3]),B=void 0===t[6]?B:e(t[6]),_=t[7],ce=void 0===t[8]?ce:t[8],V=t[9],te=t[10],je=void 0===t[11]?je:Number(t[11]),fe.enable=void 0!==t[12]&&e(t[12]),ze=void 0===t[13]?ze:t[13],Ce=void 0===t[14]?Ce:t[14],ge=void 0===t[15]?ge:e(t[15]),E=void 0===t[16]?E:Number(t[16]),A=void 0===t[17]?A:Number(t[17]),ne=void 0===t[18]?ne:e(t[18]),t[19],Pe=t[20]||Pe,he=void 0===t[21]?he:Number(t[21])}(),e={id:ye,enabled:pe},R.label(`${e.id}`),T=e.enabled,q(`Initialising iframe v${p} ${window.location.href}`),function(){function e(e){q("Reading data from page:",e),Ie=e?.onMessage||Ie,Ne=e?.onReady||Ne,"number"==typeof e?.offset&&(X("offset","offsetSize"),ne&&(E=e?.offset),oe&&(A=e?.offset)),"number"==typeof e?.offsetSize&&(ne&&(E=e?.offsetSize),oe&&(A=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Se=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(de=e.ignoreSelector),Oe=e?.targetOrigin||Oe,ce=e?.heightCalculationMethod||ce,Ce=e?.widthCalculationMethod||Ce}function t(e,t){return"function"==typeof e&&(q(`Setup custom ${t}CalcMethod`),i[t]=e,e="custom"),e}if(1===he)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),ce=t(ce,"height"),Ce=t(Ce,"width"),L(`Set TargetOrigin for parent: %c${Oe}`,m))}(),Ue(),function(){try{$e=1===he||"iframeParentListener"in window.parent}catch(e){q("Cross domain iframe detected")}}(),he<0?J(`${M(he+2)}${M(2)}`):Pe.codePointAt(0)>4||he<2&&J(M(3)),Pe&&""!==Pe&&"false"!==Pe?Pe!==p&&Z(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Pe} - Child page: ${p}.\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"),_e(),Qe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&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"),Fe(),1!==he&&(Te.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===B?(B=!0,ut("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===B&&(B=!1),pt(0,0,"autoResize",JSON.stringify(B)),B),close(){pt(0,0,"close")},getId:()=>ye,getOrigin:()=>(Q("getOrigin()","getParentOrigin()"),I),getParentOrigin:()=>I,getPageInfo(e){if("function"==typeof e)return Re=e,pt(0,0,"pageInfo"),void G("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Re=null,pt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return xe=e,pt(0,0,"parentInfo"),()=>{xe=null,pt(0,0,"parentInfoStop")}},getParentProperties(e){Q("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){fe.findTarget(e)},reset(){ft("parentIframe.reset")},setOffsetSize(e){E=e,A=e,ut($,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){pt(t,e,"scrollBy")},scrollTo(e,t){pt(t,e,"scrollTo")},scrollToOffset(e,t){pt(t,e,"scrollToOffset")},sendMessage(e,t){pt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){ce=e,_e()},setWidthCalculationMethod(e){Ce=e,Qe()},setTargetOrigin(e){q(`Set targetOrigin: %c${e}`,m),Oe=e},resize(e,t){ut(w,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){Q("size()","resize()"),this.resize(e,t)}}),Te.parentIFrame=Te.parentIframe),function(){function e(e){pt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){q(`Add event listener: %c${n}`,m),S(window.document,t,e)}!0===ge&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),fe=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,h)+parseInt(o.x,h),y:parseInt(n.top,h)+parseInt(o.y,h)}}function n(e){function n(e){const n=t(e);q(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,m,f,m,f,m),pt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(q(`In page link (#${o}) not found in iFrame, so sending to parent`),pt(0,0,"inPageLink",`#${o}`)):n(r)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function i(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&S(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){S(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){q("Setting up location.hash handlers"),i(),r(),a()}return fe.enable?1===he?Z("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l():q("In page linking not enabled"),{findTarget:n}}(),void 0===_&&(_=`${H}px`),Ve("margin",(n="margin",(o=_).includes("-")&&(U(`Negative CSS value ignored for ${n}`),o=""),o)),Ve("background",V),Ve("padding",te),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),q("Set HTML & body height: %cauto !important",m)}(),!0!==B&&q("Auto Resize disabled"),Ze({method:t="add",eventType:"After Print",eventName:"afterprint"}),Ze({method:t,eventType:"Before Print",eventName:"beforeprint"}),Ze({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{q("Mutations observed:",t.length);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)}},r=16,a=2,l=200;let s=1;function c(){F("mutationObserver");const d=performance.now(),u=d-n,f=r*s+++a;if(u>f&&u<l)return q(`MutationObserver delay: %c${u}ms > ${f}ms`,m),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Ue(),Fe(),Be(e),e.forEach(Ye),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return q("Setup <body> MutationObserver"),e.observe(t,n),e}u()}(),q("Setup ResizeObserver"),we=new ResizeObserver(Ge),we.observe(document.body),Xe.add(document.body),Ye(document.body),ne!==oe&&(q("Setup OverflowObserver"),ve=(e=>{const t=e.side||b,n=e.onChange||j,o=(e,n)=>0===e||e>n[t],i={root:e.root,rootMargin:"0px",threshold:1},r=()=>n(document.querySelectorAll(`[${y}]`)),a=(e,t)=>e.toggleAttribute(y,t),l=new IntersectionObserver((function(e){for(const i of e){const{boundingClientRect:e,rootBounds:r,target:l}=i,s=e[t],c=!((n=l).hidden||null===n.offsetParent||"none"===n.style.display)&&o(s,r);a(l,c)}var n;Y(r)}),i),s=new WeakSet;return function(e){q("Attached overflowObservers");for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}})({onChange:Le,root:document.documentElement,side:ne?b:z})),Be(tt(document)()),queueMicrotask(Ne),q("Initialization complete"),ut("init","Init message from host page",void 0,void 0,p),document.title&&""!==document.title&&pt(0,0,"title",document.title)}function Le(e){be=e,ae=be.length>0,ae&&(q("Observed Elements:",e.length),ut("overflowObserver","Overflow updated"))}function Fe(){Ee=document.querySelectorAll(`[${g}]`),le=Ee.length>0,q(`Tagged elements found: %c${le}`,le?m:f)}function Be(e){le||ve(e)}let De=0;function We(){const n=document.querySelectorAll(`*[${v}]`);re=n.length>0,re&&n.length!==De&&(function(n){const o=1===n.length?"":"s";U(`%c[${v}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),De=n.length)}function Ve(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),L(`Set body ${e}: %c${t}`,m))}function He(e,t,n){if(""!==n){q(`${e}: %c${n}`,m);for(const e of document.querySelectorAll(n))q(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Ue(){He("sizeSelector",g,Se),He("ignoreSelector",v,de)}function Ze(e){({add(t){function n(){ut(e.eventName,e.eventType)}a[t]=n,S(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),q(`${P(e.method)} event listener: %c${e.eventType}`,m)}function Je(e,t,n,o){return t!==e&&(e in n||(U(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&Z(`<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.`),q(`Set ${o} calculation method: %c${e}`,m)),e}function _e(){ce=Je(ce,s,at,"height")}function Qe(){Ce=Je(Ce,u,lt,"width")}function Ge(e){Array.isArray(e)&&0!==e.length&&ut("resizeObserver",`Element resized <${C(e[0].target)}>`)}const Xe=new WeakSet;function Ye(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Xe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(we.observe(e),Xe.add(e),q(`Attached resizeObserver: %c${C(e)}`,m))}const t=tt(e)();for(const e of t){if(Xe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(we.observe(e),Xe.add(e),q(`Attached resizeObserver: %c${C(e)}`,m))}}function Ke(e){performance.mark(K);const t=P(e);let n=0,i=document.documentElement,r=le?0:document.documentElement.getBoundingClientRect().bottom;const a=le?Ee:ae?be:tt(document)();let s=a.length;for(const t of a)le||!l||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):s-=1;return L(`${t} position calculated from:`,i),performance.mark(ee,{detail:{Side:t,len:s,hasTags:le,logging:pe}}),r}const et=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],tt=e=>()=>{We();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 re&&t.push(`not([${v}])`,`not([${v}] *)`),e.querySelectorAll(t.join(":"))},nt={height:0,width:0},ot={height:0,width:0},it=[m,f,m];function rt(e){function t(){return ot[o]=i,nt[o]=l,i}const n=e===at,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${i}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case le:L("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ae&&0===ot[o]&&0===nt[o]:L(`Initial page size values: ${s}`,...it),c=t();break;case ke&&i===ot[o]&&l===nt[o]:L(`Size unchanged: ${s}`,...it),c=Math.max(i,l);break;case 0===i:L(`Page is hidden: ${s}`,...it),c=l;break;case!ae&&i!==ot[o]&&l<=nt[o]:L(`New <html> size: ${s} `,...it),L(`Previous <html> size: %c${ot[o]}px`,m),c=t();break;case!n:c=e.taggedElement();break;case!ae&&i<ot[o]:L(`<html> size decreased: ${s}`,...it),c=t();break;case l===a||l===r:L(`<html> size equals page size: ${s}`,...it),c=t();break;case i>l:L(`Page size < <html> size: ${s}`,...it),c=t();break;case ae:L("Found element overflowing <html> "),c=e.taggedElement();break;default:c=t()}return L(`Content ${o}: %c${c}px`,m),c+=function(e){const t=e.getOffset();return 0!==t&&L(`Page offsetSize: %c${t}px`,m),t}(e),c}const at={enabled:()=>ne,getOffset:()=>E,auto:()=>rt(at),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,h)+parseInt(t.marginBottom,h)},bodyScroll:()=>document.body.scrollHeight,offset:()=>at.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(...et(at)),min:()=>Math.min(...et(at)),grow:()=>at.max(),lowestElement:()=>Ke(b),taggedElement:()=>Ke(b)},lt={enabled:()=>oe,getOffset:()=>A,auto:()=>rt(lt),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(...et(lt)),min:()=>Math.min(...et(lt)),rightMostElement:()=>Ke(z),scroll:()=>Math.max(lt.bodyScroll(),lt.documentElementScroll()),taggedElement:()=>Ke(z)},st=(e,t)=>!(Math.abs(e-t)<=je);let ct=!1;const dt=O((()=>J(M(4))));function ut(e,t,n,o,i){x=performance.now(),F(e),B||e===w?document.hidden?q("Page hidden - Ignored resize request"):(ct||(q(`Resize event: %c${t}`,m),N=!0,function(e,t,n,o,i){const r=void 0===n?at[ce]():n,a=void 0===o?lt[Ce]():o;ne&&st(se,r)||oe&&st(Ae,a)||"init"===e?(se=r,Ae=a,pt(se,Ae,e,i)):!e!==w&&(ne&&ce in d||oe&&Ce in d)?ft(t):e===$?pt(se,Ae,e):(q("No change in content size detected"),N=!1)}(e,t,n,o,i),requestAnimationFrame((()=>{ct=!1}))),ct=!0):L("Resizing disabled")}function mt(e){se=at[ce](),Ae=lt[Ce](),pt(se,Ae,e)}function ft(e){const t=ce;ce=s,q(`Reset trigger event: %c${e}`,m),ke?q("TriggerLock blocked calculation"):(ke=!0,D("Trigger event lock on"),requestAnimationFrame((()=>{ke=!1,D("Trigger event lock off")}))),mt("reset"),ce=t}function pt(e,t,o,i,r){he<-1||(F(o),void 0!==r?q(`Message targetOrigin: %c${r}`,m):r=Oe,function(){const a=`${ye}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if($e)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==he)throw e;return void dt()}else Me.postMessage(c+a,r);N&&L(function(){const e=k(performance.now()-x);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),m),N=!1,L("Sending message to host page via "+($e?"sameDomain":"postMessage")),L(`%c${a}`,n)}(),W())}function ht(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>pt(0,0,`${e}Stop`),i={init:function(){me=e.data,Me=e.source,I=e.origin,qe(),ie=!1,setTimeout((()=>{ue=!1}),128)},reset(){ue?q("Page reset ignored by init"):(q("Page size reset by host page"),mt("resetPage"))},resize(){ut(w,"Parent window requested size check")},moveToAnchor(){fe.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();q(`PageInfo received from parent: ${e}`),Re?setTimeout((()=>Re(n(e)))):o("pageInfo")},parentInfo(){const e=a();q(`ParentInfo received from parent: ${e}`),xe?setTimeout((()=>xe(t(n(e))))):o("parentInfo")},message(){const e=a();q(`onMessage called from parent: ${e}`),setTimeout((()=>Ie(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function s(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||U(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(F(r()),!1!==ie?l()?i.init():q(`Ignored message of type "${r()}". Received before initialization.`):s())}function gt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?U("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>ht({data:e}))),S(window,"message",ht),S(window,"readystatechange",gt),gt())}()}();
|
|
21
|
-
//# sourceMappingURL=iframeResizer.contentWindow.js.map
|
|
20
|
+
!function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,i="default",r={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},a={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:s}=Object,c=e=>[e,console[e]],u=e=>t=>[t,function(n){e[t]=n}],d=(e,t)=>l(s(e).map(t));const m=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),f=m()?"color: #A9C7FB;":"color: #135CD2;",p=m()?"color: #E3E3E3;":"color: #1F1F1F;",h="5.4.0",y=10,g="data-iframe-size",v="data-iframe-overflowed",b="data-iframe-ignore",z="bottom",w="right",$="resizeParent",S="setOffsetSize",E="resizeObserver",j="overflowObserver",k="mutationObserver",O=(e,t,n,o)=>e.addEventListener(t,n,o||!1),M=["<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 P=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(M[e]),C=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},A=e=>e,T=e=>Math.round(1e3*e)/1e3,N=e=>""!=`${e}`&&void 0!==e;let I=!0;var x;const R=(x=function(n={}){const l={},s={},m=[],f={...r,...n};let p;function h(){m.length=0}function y(){delete f.event,h()}const g=()=>!m.some((([e])=>"error"===e||"warn"===e))&&!!f.collapsed;function v(){if(0!==m.length){console[g()?"groupCollapsed":"group"](`%c${f.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(f)} %c${f.showTime?p:""}`,e,t,o);for(const[e,...t]of m)console[e](...t);console.groupEnd(),y()}else y()}function b(){p=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(v)))}function z(e,...t){0===m.length&&b(),m.push([e,...t])}function w(e=i,...t){z("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...d(f,u(f)),...d(console,(e=>[e,(...t)=>z(e,...t)])),...d(a,c),count:function(e=i){s[e]?s[e]+=1:s[e]=1,z("log",`${e}: ${s[e]}`)},countReset:function(e=i){delete s[e]},endAutoGroup:v,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){z("error",e)}return n},purge:h,time:function(e=i){l[e]=performance.now()},timeEnd:function(e=i){w(e),delete l[e]},timeLog:w}},x?.__esModule?x.default:x)({label:"iframeResizer(child)"});const q=(L="info",(...e)=>!I||R[L](...e));var L;const{assert:B,debug:F,endAutoGroup:D,error:W,errorBoundary:V,event:H,purge:U,warn:Z}=R,J=e=>{return R.warn((t=A,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},_=J,Q=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,t)=>J(t))),G=Q("Method"),X=Q("Method","replaced with"),Y=Q("Option"),K=requestAnimationFrame,ee="--ifr-start",te="--ifr-end",ne=[],oe=new WeakSet,ie=e=>"object"==typeof e&&oe.add(e);let re={},ae=0;const le=setInterval((()=>{if(ne.length<10)return;if(re.hasTags&&re.len<25)return;ne.sort();const e=Math.min(ne.reduce(((e,t)=>e+t),0)/ne.length,ne[Math.floor(ne.length/2)]),t=T(e);t>ae&&(ae=t,H("performanceObserver")),e<=4||(clearInterval(le),J(`<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 ${re.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===te){const{duration:t}=performance.measure("--ifr-measure",ee,te);re=e.detail,ne.push(t),ne.length>100&&ne.shift()}}))}function ce(){new PerformanceObserver(se).observe({entryTypes:["mark"]}),ie(document.documentElement),ie(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",ce):ce()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(Z("Custom height calculation function not defined"),ct.auto()),width:()=>(Z("Custom width calculation function not defined"),ut.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},l="checkVisibility"in window,s="auto",c="[iFrameSizer]",u={max:1,min:1,bodyScroll:1,documentElementScroll:1},d="scroll";let m,M,x,L,B,F=!0,W="",Q=0,ne="",oe="",ie=!0,re=!1,ae=!0,le=!1,se=!1,ce=!1,ue=1,de=s,me="",fe=!0,pe="",he={},ye=!1,ge=0,ve=!1,be="",ze=A,we=[],$e="child",Se=null,Ee=!1,je="",ke=[],Oe=window.parent,Me="*",Pe=0,Ce=!1,Ae="",Te=1,Ne=d,Ie=window,xe=()=>{Z("onMessage function not defined")},Re=()=>{},qe=null,Le=null;function Be(){var e,t,n;!function(){const e=e=>"true"===e,t=pe.slice(13).split(":");be=t[0],Q=void 0===t[1]?Q:Number(t[1]),re=void 0===t[2]?re:e(t[2]),ye=void 0===t[3]?ye:e(t[3]),F=void 0===t[6]?F:e(t[6]),ne=t[7],de=void 0===t[8]?de:t[8],W=t[9],oe=t[10],Pe=void 0===t[11]?Pe:Number(t[11]),he.enable=void 0!==t[12]&&e(t[12]),$e=void 0===t[13]?$e:t[13],Ne=void 0===t[14]?Ne:t[14],ve=void 0===t[15]?ve:e(t[15]),m=void 0===t[16]?m:Number(t[16]),M=void 0===t[17]?M:Number(t[17]),ie=void 0===t[18]?ie:e(t[18]),t[19],Ae=t[20]||Ae,ge=void 0===t[21]?ge:Number(t[21])}(),e={id:be,enabled:ye},R.label(`${e.id}`),I=e.enabled,function(){function e(e){xe=e?.onMessage||xe,Re=e?.onReady||Re,"number"==typeof e?.offset&&(Y("offset","offsetSize"),ie&&(m=e?.offset),re&&(M=e?.offset)),"number"==typeof e?.offsetSize&&(ie&&(m=e?.offsetSize),re&&(M=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(je=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(me=e.ignoreSelector),Me=e?.targetOrigin||Me,de=e?.heightCalculationMethod||de,Ne=e?.widthCalculationMethod||Ne}function t(e,t){return"function"==typeof e&&(i[t]=e,e="custom"),e}if(1===ge)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),de=t(de,"height"),Ne=t(Ne,"width"),q(`Set TargetOrigin for parent: %c${Me}`,f))}(),_e(),function(){try{Ee=1===ge||"iframeParentListener"in window.parent}catch(e){}}(),ge<0?_(`${P(ge+2)}${P(2)}`):Ae.codePointAt(0)>4||ge<2&&_(P(3)),Ae&&""!==Ae&&"false"!==Ae?Ae!==h&&J(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ae} - Child page: ${h}.\n`):J("<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"),Xe(),Ye(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&J("<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&&J("<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"),We(),1!==ge&&(Ie.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===F?(F=!0,ht("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===F&&(F=!1),vt(0,0,"autoResize",JSON.stringify(F)),F),close(){vt(0,0,"close")},getId:()=>be,getOrigin:()=>(G("getOrigin()","getParentOrigin()"),x),getParentOrigin:()=>x,getPageInfo(e){if("function"==typeof e)return qe=e,vt(0,0,"pageInfo"),void X("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");qe=null,vt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return Le=e,vt(0,0,"parentInfo"),()=>{Le=null,vt(0,0,"parentInfoStop")}},getParentProperties(e){G("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){he.findTarget(e)},reset(){gt()},setOffsetSize(e){m=e,M=e,ht(S,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){vt(t,e,"scrollBy")},scrollTo(e,t){vt(t,e,"scrollTo")},scrollToOffset(e,t){vt(t,e,"scrollToOffset")},sendMessage(e,t){vt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){de=e,Xe()},setWidthCalculationMethod(e){Ne=e,Ye()},setTargetOrigin(e){Me=e},resize(e,t){ht("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){G("size()","resize()"),this.resize(e,t)}}),Ie.parentIFrame=Ie.parentIframe),function(){function e(e){vt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){O(window.document,t,e)}!0===ve&&(t("mouseenter"),t("mouseleave"))}(),he=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,y)+parseInt(o.x,y),y:parseInt(n.top,y)+parseInt(o.y,y)}}function n(e){function n(e){const n=t(e);vt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?vt(0,0,"inPageLink",`#${o}`):n(r)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function i(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&O(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){O(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){i(),r(),a()}return he.enable&&(1===ge?J("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l()),{findTarget:n}}(),void 0===ne&&(ne=`${Q}px`),Ze("margin",(t="margin",(n=ne).includes("-")&&(Z(`Negative CSS value ignored for ${t}`),n=""),n)),Ze("background",W),Ze("padding",oe),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)}(),function(e){Qe({method:e,eventType:"After Print",eventName:"afterprint"}),Qe({method:e,eventType:"Before Print",eventName:"beforeprint"}),Qe({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const i=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)}},r=16,a=2,l=200;let s=1;function c(e){_e(),Ve(e),e.forEach(tt),e.clear()}function u(){H("mutationObserver");const d=performance.now(),m=d-o;if(m>r*s+++a&&m<l)return setTimeout(u,r*s),void(o=d);s=1,t.forEach(i),t.length=0,e.size>0&&c(e),We(),Fe(),n=!1,ht(k,"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:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}m()}(),Se=new ResizeObserver(Ke),Se.observe(document.body),et.add(document.body),tt(document.body),ie!==re&&(ze=(e=>{const t=e.side||z,n=e.onChange||A,o=(e,n)=>0===e||e>n[t],i={root:e.root,rootMargin:"0px",threshold:1},r=(e=!1)=>n(e),a=(e,t)=>e.toggleAttribute(v,t),l=new IntersectionObserver((function(e){for(const i of e){const{boundingClientRect:e,rootBounds:r,target:l}=i,s=e[t],c=!((n=l).hidden||null===n.offsetParent||"none"===n.style.display)&&o(s,r);a(l,c)}var n;K(r)}),i),s=new WeakSet;return function(){const e=new window.MutationObserver((()=>{q("Detected changes in element attributes"),r(!0)})),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[b],subtree:!0};e.observe(t,n)}(),function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}})({onChange:De,root:document.documentElement,side:ie?z:w})),Ve(it(document)()),queueMicrotask(Re),ht("init","Init message from host page",void 0,void 0,h),document.title&&""!==document.title&&vt(0,0,"title",document.title)}function Fe(){we=document.querySelectorAll(`[${v}]:not([${b}]):not([${b}] *)`),se=we.length>0}function De(e){Fe(),(se||e)&&ht(j,"Overflow updated")}function We(){ke=document.querySelectorAll(`[${g}]`),ce=ke.length>0}function Ve(e){ce||ze(e)}let He=0;function Ue(){const n=document.querySelectorAll(`*[${b}]`);le=n.length>0,le&&n.length!==He&&(function(n){const o=1===n.length?"":"s";Z(`%c[${b}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),He=n.length)}function Ze(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),q(`Set body ${e}: %c${t}`,f))}function Je(e,t,n){if(""!==n)for(const e of document.querySelectorAll(n))e.toggleAttribute(t,!0)}function _e(){Je(0,g,je),Je(0,b,me)}function Qe(e){({add(t){function n(){ht(e.eventName,e.eventType)}a[t]=n,O(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)}function Ge(e,t,n,o){return t!==e&&(e in n||(Z(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&J(`<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.`)),e}function Xe(){de=Ge(de,s,ct,"height")}function Ye(){Ne=Ge(Ne,d,ut,"width")}function Ke(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;ht(E,`Element resized <${function(e){switch(!0){case!N(e):return"";case N(e.id):return`${e.nodeName}#${e.id}`;case N(e.name):return`${e.nodeName} (${e.name}`;case N(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}const et=new WeakSet;function tt(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!et.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Se.observe(e),et.add(e))}const t=it(e)();for(const e of t){if(et.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Se.observe(e),et.add(e))}}function nt(e){performance.mark(ee);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=ce?0:document.documentElement.getBoundingClientRect().bottom;const s=ce?ke:se?we:it(document)();let c=s.length;for(const t of s)ce||!l||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):c-=1;return q(`${t} position calculated from:`,r),performance.mark(te,{detail:{Side:t,len:c,hasTags:ce,logging:ye}}),a}const ot=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],it=e=>()=>{Ue();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 le&&t.push(`not([${b}])`,`not([${b}] *)`),e.querySelectorAll(t.join(":"))},rt={height:0,width:0},at={height:0,width:0},lt=[f,p,f];function st(e){function t(){return at[o]=i,rt[o]=l,i}const n=e===ct,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${i}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case ce:q("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!se&&0===at[o]&&0===rt[o]:q(`Initial page size values: ${s}`,...lt),c=t();break;case Ce&&i===at[o]&&l===rt[o]:q(`Size unchanged: ${s}`,...lt),c=Math.max(i,l);break;case 0===i:q(`Page is hidden: ${s}`,...lt),c=l;break;case!se&&i!==at[o]&&l<=rt[o]:q(`New <html> size: ${s} `,...lt),q(`Previous <html> size: %c${at[o]}px`,f),c=t();break;case!n:c=e.taggedElement();break;case!se&&i<at[o]:q(`<html> size decreased: ${s}`,...lt),c=t();break;case l===a||l===r:q(`<html> size equals page size: ${s}`,...lt),c=t();break;case i>l:q(`Page size < <html> size: ${s}`,...lt),c=t();break;case se:q("Found element overflowing <html> "),c=e.taggedElement();break;default:q(`Using <html> size: ${s}`,...lt),c=t()}return q(`Content ${o}: %c${c}px`,f),c+=function(e){const t=e.getOffset();return 0!==t&&q(`Page offsetSize: %c${t}px`,f),t}(e),c}const ct={enabled:()=>ie,getOffset:()=>m,auto:()=>st(ct),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,y)+parseInt(t.marginBottom,y)},bodyScroll:()=>document.body.scrollHeight,offset:()=>ct.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(...ot(ct)),min:()=>Math.min(...ot(ct)),grow:()=>ct.max(),lowestElement:()=>nt(z),taggedElement:()=>nt(z)},ut={enabled:()=>re,getOffset:()=>M,auto:()=>st(ut),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>i.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...ot(ut)),min:()=>Math.min(...ot(ut)),rightMostElement:()=>nt(w),scroll:()=>Math.max(ut.bodyScroll(),ut.documentElementScroll()),taggedElement:()=>nt(w)},dt=(e,t)=>!(Math.abs(e-t)<=Pe);function mt(e,t,n,o,i){const r=void 0===n?ct[de]():n,a=void 0===o?ut[Ne]():o;switch(!0){case ie&&dt(ue,r)||re&&dt(Te,a)||"init"===e:ue=r,Te=a;case e===S:vt(ue,Te,e,i);break;case!e!==$&&(ie&&de in u||re&&Ne in u):gt();break;case e===E:case e===j:case e===k:U();break;default:U(),q("No change in content size detected")}L=!1}let ft=!1;const pt=C((()=>_(P(4)))),ht=V(((e,t,n,o,i)=>{B=performance.now(),H(e),F||e===$?document.hidden||(ft||(L=!0,mt(e,0,n,o,i),requestAnimationFrame((()=>{ft=!1}))),ft=!0):q("Resizing disabled")}));function yt(e){ue=ct[de](),Te=ut[Ne](),vt(ue,Te,e)}function gt(e){const t=de;de=s,Ce||(Ce=!0,requestAnimationFrame((()=>{Ce=!1}))),yt("reset"),de=t}const vt=V((function(e,t,o,i,r){ge<-1||(H(o),void 0!==r||(r=Me),function(){const a=`${be}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if(Ee)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==ge)throw e;return void pt()}else Oe.postMessage(c+a,r);L&&q(function(){const e=T(performance.now()-B);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),f),q("Sending message to host page via "+(Ee?"sameDomain":"postMessage")),q(`%c${a}`,n)}(),D())})),bt=V((function(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>vt(0,0,`${e}Stop`),i={init:function(){pe=e.data,Oe=e.source,x=e.origin,Be(),ae=!1,setTimeout((()=>{fe=!1}),128)},reset(){fe||yt("resetPage")},resize(){ht($,"Parent window requested size check")},moveToAnchor(){he.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();qe?setTimeout((()=>qe(n(e)))):o("pageInfo")},parentInfo(){const e=a();Le?setTimeout((()=>Le(t(n(e))))):o("parentInfo")},message(){const e=a();setTimeout((()=>xe(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function s(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||Z(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(H(r()),!1!==ae?l()&&i.init():s())}));function zt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?Z("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>bt({data:e,sameDomain:!0}))),O(window,"message",bt),O(window,"readystatechange",zt),zt())}()}();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy (child) 5.4.0
|
|
4
|
+
* @module iframe-resizer/legacy (child) 5.4.0 (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,4 @@
|
|
|
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,i="default",r={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},a={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:s}=Object,c=e=>t=>[t,function(n){e[t]=n}],d=(e,t)=>l(s(e).map(t));const u=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),m=u()?"color: #A9C7FB;":"color: #135CD2;",f=u()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0-beta.9",h=10,g="data-iframe-size",y="data-iframe-overflowed",v="data-iframe-ignore",b="bottom",z="right",w="resizeParent",$="setOffsetSize",S=(e,t,n,o)=>e.addEventListener(t,n,o||!1),E=["<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 M=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(E[e]),O=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},j=e=>e,k=e=>Math.round(1e3*e)/1e3,P=e=>e.charAt(0).toUpperCase()+e.slice(1),A=e=>""!=`${e}`&&void 0!==e;function C(e){switch(!0){case!A(e):return"";case A(e.id):return`${e.nodeName}#${e.id}`;case A(e.name):return`${e.nodeName} (${e.name}`;case A(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}let T=!0;const I=(N=function(n={}){const l={},s=[],u={...r,...n};let m;function f(){s.length=0}function p(){delete u.event,f()}const h=()=>!s.some((([e])=>"error"===e||"warn"===e))&&!!u.collapsed;function g(){if(0!==s.length){console[h()?"groupCollapsed":"group"](`%c${u.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(u)} %c${u.showTime?m:""}`,e,t,o);for(const[e,...t]of s)console[e](...t);console.groupEnd(),p()}else p()}function y(){m=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(g)))}function v(e,...t){0===s.length&&y(),s.push([e,...t])}function b(e=i,...t){v("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...d(u,c(u)),...d(console,(e=>[e,(...t)=>v(e,...t)])),...d(a,(e=>[e,console[e]])),endAutoGroup:g,purge:f,time:function(e=i){l[e]=performance.now()},timeEnd:function(e=i){b(e),delete l[e]},timeLog:b}},N?.__esModule?N.default:N);var N;const R=I({label:"iframeResizer(child)"});const x=e=>(...t)=>!T||R[e](...t),q=x("log"),L=x("info"),{event:F,assert:B,debug:D,endAutoGroup:W,error:V,purge:H,warn:U}=R,Z=(...e)=>{return R.warn((t=j,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,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,...t)=>Z(...t))),Q=_("Method"),G=_("Method","replaced with"),X=_("Option"),Y=requestAnimationFrame,K="--ifr-start",ee="--ifr-end",te=[],ne=new WeakSet,oe=e=>"object"==typeof e&&ne.add(e);let ie={},re=0;const ae=setInterval((()=>{if(te.length<10)return;if(ie.hasTags&&ie.len<25)return;te.sort();const e=Math.min(te.reduce(((e,t)=>e+t),0)/te.length,te[Math.floor(te.length/2)]),t=k(e);t>re&&(re=t,F("performanceObserver"),q("Mean time:",k(te[Math.floor(te.length/2)])),q("Median time:",k(te.reduce(((e,t)=>e+t),0)/te.length)),q("Average time:",t),q("Max time:",k(Math.max(...te)))),e<=4||(clearInterval(ae),Z(`<rb>Performance Warning</>\n\nCalculating the page size is taking an excessive amount of time (${k(e)}ms).\n\nTo improve performance add the <b>data-iframe-size</> attribute to the ${ie.Side.toLowerCase()} most element on the page. For more details see: <u>https://iframe-resizer.com/perf</>.`))}),5e3);function le(e){e.getEntries().forEach((e=>{if(e.name===ee){const{duration:t}=performance.measure("--ifr-measure",K,ee);ie=e.detail,te.push(t),te.length>100&&te.shift()}}))}function se(){new PerformanceObserver(le).observe({entryTypes:["mark"]}),oe(document.documentElement),oe(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",se):se()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(U("Custom height calculation function not defined"),at.auto()),width:()=>(U("Custom width calculation function not defined"),lt.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},l="checkVisibility"in window,s="auto",c="[iFrameSizer]",d={max:1,min:1,bodyScroll:1,documentElementScroll:1},u="scroll";let E,A,I,N,x,B=!0,V="",H=0,_="",te="",ne=!0,oe=!1,ie=!0,re=!1,ae=!1,le=!1,se=1,ce=s,de="",ue=!0,me="",fe={},pe=!1,he=0,ge=!1,ye="",ve=j,be=[],ze="child",we=null,$e=!1,Se="",Ee=[],Me=window.parent,Oe="*",je=0,ke=!1,Pe="",Ae=1,Ce=u,Te=window,Ie=()=>{U("onMessage function not defined")},Ne=()=>{},Re=null,xe=null;function qe(){var e,t,n,o;!function(){const e=e=>"true"===e,t=me.slice(13).split(":");ye=t[0],H=void 0===t[1]?H:Number(t[1]),oe=void 0===t[2]?oe:e(t[2]),pe=void 0===t[3]?pe:e(t[3]),B=void 0===t[6]?B:e(t[6]),_=t[7],ce=void 0===t[8]?ce:t[8],V=t[9],te=t[10],je=void 0===t[11]?je:Number(t[11]),fe.enable=void 0!==t[12]&&e(t[12]),ze=void 0===t[13]?ze:t[13],Ce=void 0===t[14]?Ce:t[14],ge=void 0===t[15]?ge:e(t[15]),E=void 0===t[16]?E:Number(t[16]),A=void 0===t[17]?A:Number(t[17]),ne=void 0===t[18]?ne:e(t[18]),t[19],Pe=t[20]||Pe,he=void 0===t[21]?he:Number(t[21])}(),e={id:ye,enabled:pe},R.label(`${e.id}`),T=e.enabled,q(`Initialising iframe v${p} ${window.location.href}`),function(){function e(e){q("Reading data from page:",e),Ie=e?.onMessage||Ie,Ne=e?.onReady||Ne,"number"==typeof e?.offset&&(X("offset","offsetSize"),ne&&(E=e?.offset),oe&&(A=e?.offset)),"number"==typeof e?.offsetSize&&(ne&&(E=e?.offsetSize),oe&&(A=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(Se=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(de=e.ignoreSelector),Oe=e?.targetOrigin||Oe,ce=e?.heightCalculationMethod||ce,Ce=e?.widthCalculationMethod||Ce}function t(e,t){return"function"==typeof e&&(q(`Setup custom ${t}CalcMethod`),i[t]=e,e="custom"),e}if(1===he)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),ce=t(ce,"height"),Ce=t(Ce,"width"),L(`Set TargetOrigin for parent: %c${Oe}`,m))}(),Ue(),function(){try{$e=1===he||"iframeParentListener"in window.parent}catch(e){q("Cross domain iframe detected")}}(),he<0?J(`${M(he+2)}${M(2)}`):Pe.codePointAt(0)>4||he<2&&J(M(3)),Pe&&""!==Pe&&"false"!==Pe?Pe!==p&&Z(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Pe} - Child page: ${p}.\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"),_e(),Qe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&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"),Fe(),1!==he&&(Te.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===B?(B=!0,ut("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===B&&(B=!1),pt(0,0,"autoResize",JSON.stringify(B)),B),close(){pt(0,0,"close")},getId:()=>ye,getOrigin:()=>(Q("getOrigin()","getParentOrigin()"),I),getParentOrigin:()=>I,getPageInfo(e){if("function"==typeof e)return Re=e,pt(0,0,"pageInfo"),void G("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");Re=null,pt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return xe=e,pt(0,0,"parentInfo"),()=>{xe=null,pt(0,0,"parentInfoStop")}},getParentProperties(e){Q("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){fe.findTarget(e)},reset(){ft("parentIframe.reset")},setOffsetSize(e){E=e,A=e,ut($,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){pt(t,e,"scrollBy")},scrollTo(e,t){pt(t,e,"scrollTo")},scrollToOffset(e,t){pt(t,e,"scrollToOffset")},sendMessage(e,t){pt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){ce=e,_e()},setWidthCalculationMethod(e){Ce=e,Qe()},setTargetOrigin(e){q(`Set targetOrigin: %c${e}`,m),Oe=e},resize(e,t){ut(w,`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){Q("size()","resize()"),this.resize(e,t)}}),Te.parentIFrame=Te.parentIframe),function(){function e(e){pt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){q(`Add event listener: %c${n}`,m),S(window.document,t,e)}!0===ge&&(t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave"))}(),fe=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,h)+parseInt(o.x,h),y:parseInt(n.top,h)+parseInt(o.y,h)}}function n(e){function n(e){const n=t(e);q(`Moving to in page link (%c#${o}%c) at x: %c${n.x}%c y: %c${n.y}`,m,f,m,f,m),pt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(q(`In page link (#${o}) not found in iFrame, so sending to parent`),pt(0,0,"inPageLink",`#${o}`)):n(r)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function i(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&S(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){S(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){q("Setting up location.hash handlers"),i(),r(),a()}return fe.enable?1===he?Z("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l():q("In page linking not enabled"),{findTarget:n}}(),void 0===_&&(_=`${H}px`),Ve("margin",(n="margin",(o=_).includes("-")&&(U(`Negative CSS value ignored for ${n}`),o=""),o)),Ve("background",V),Ve("padding",te),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),q("Set HTML & body height: %cauto !important",m)}(),!0!==B&&q("Auto Resize disabled"),Ze({method:t="add",eventType:"After Print",eventName:"afterprint"}),Ze({method:t,eventType:"Before Print",eventName:"beforeprint"}),Ze({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),function(){const e=new Set;let t=!1,n=0,o=[];const i=t=>{q("Mutations observed:",t.length);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)}},r=16,a=2,l=200;let s=1;function c(){F("mutationObserver");const d=performance.now(),u=d-n,f=r*s+++a;if(u>f&&u<l)return q(`MutationObserver delay: %c${u}ms > ${f}ms`,m),setTimeout(c,r*s),void(n=d);s=1,o.forEach(i),o=[],0!==e.size?(Ue(),Fe(),Be(e),e.forEach(Ye),e.clear(),t=!1):t=!1}function d(e){o.push(e),t||(n=performance.now(),t=!0,requestAnimationFrame(c))}function u(){const e=new window.MutationObserver(d),t=document.querySelector("body"),n={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return q("Setup <body> MutationObserver"),e.observe(t,n),e}u()}(),q("Setup ResizeObserver"),we=new ResizeObserver(Ge),we.observe(document.body),Xe.add(document.body),Ye(document.body),ne!==oe&&(q("Setup OverflowObserver"),ve=(e=>{const t=e.side||b,n=e.onChange||j,o=(e,n)=>0===e||e>n[t],i={root:e.root,rootMargin:"0px",threshold:1},r=()=>n(document.querySelectorAll(`[${y}]`)),a=(e,t)=>e.toggleAttribute(y,t),l=new IntersectionObserver((function(e){for(const i of e){const{boundingClientRect:e,rootBounds:r,target:l}=i,s=e[t],c=!((n=l).hidden||null===n.offsetParent||"none"===n.style.display)&&o(s,r);a(l,c)}var n;Y(r)}),i),s=new WeakSet;return function(e){q("Attached overflowObservers");for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}})({onChange:Le,root:document.documentElement,side:ne?b:z})),Be(tt(document)()),queueMicrotask(Ne),q("Initialization complete"),ut("init","Init message from host page",void 0,void 0,p),document.title&&""!==document.title&&pt(0,0,"title",document.title)}function Le(e){be=e,ae=be.length>0,ae&&(q("Observed Elements:",e.length),ut("overflowObserver","Overflow updated"))}function Fe(){Ee=document.querySelectorAll(`[${g}]`),le=Ee.length>0,q(`Tagged elements found: %c${le}`,le?m:f)}function Be(e){le||ve(e)}let De=0;function We(){const n=document.querySelectorAll(`*[${v}]`);re=n.length>0,re&&n.length!==De&&(function(n){const o=1===n.length?"":"s";U(`%c[${v}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),De=n.length)}function Ve(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),L(`Set body ${e}: %c${t}`,m))}function He(e,t,n){if(""!==n){q(`${e}: %c${n}`,m);for(const e of document.querySelectorAll(n))q(`Applying ${t} to:`,e),e.toggleAttribute(t,!0)}}function Ue(){He("sizeSelector",g,Se),He("ignoreSelector",v,de)}function Ze(e){({add(t){function n(){ut(e.eventName,e.eventType)}a[t]=n,S(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),q(`${P(e.method)} event listener: %c${e.eventType}`,m)}function Je(e,t,n,o){return t!==e&&(e in n||(U(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&Z(`<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.`),q(`Set ${o} calculation method: %c${e}`,m)),e}function _e(){ce=Je(ce,s,at,"height")}function Qe(){Ce=Je(Ce,u,lt,"width")}function Ge(e){Array.isArray(e)&&0!==e.length&&ut("resizeObserver",`Element resized <${C(e[0].target)}>`)}const Xe=new WeakSet;function Ye(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!Xe.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(we.observe(e),Xe.add(e),q(`Attached resizeObserver: %c${C(e)}`,m))}const t=tt(e)();for(const e of t){if(Xe.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(we.observe(e),Xe.add(e),q(`Attached resizeObserver: %c${C(e)}`,m))}}function Ke(e){performance.mark(K);const t=P(e);let n=0,i=document.documentElement,r=le?0:document.documentElement.getBoundingClientRect().bottom;const a=le?Ee:ae?be:tt(document)();let s=a.length;for(const t of a)le||!l||t.checkVisibility(o)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>r&&(r=n,i=t)):s-=1;return L(`${t} position calculated from:`,i),performance.mark(ee,{detail:{Side:t,len:s,hasTags:le,logging:pe}}),r}const et=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],tt=e=>()=>{We();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 re&&t.push(`not([${v}])`,`not([${v}] *)`),e.querySelectorAll(t.join(":"))},nt={height:0,width:0},ot={height:0,width:0},it=[m,f,m];function rt(e){function t(){return ot[o]=i,nt[o]=l,i}const n=e===at,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${i}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case le:L("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!ae&&0===ot[o]&&0===nt[o]:L(`Initial page size values: ${s}`,...it),c=t();break;case ke&&i===ot[o]&&l===nt[o]:L(`Size unchanged: ${s}`,...it),c=Math.max(i,l);break;case 0===i:L(`Page is hidden: ${s}`,...it),c=l;break;case!ae&&i!==ot[o]&&l<=nt[o]:L(`New <html> size: ${s} `,...it),L(`Previous <html> size: %c${ot[o]}px`,m),c=t();break;case!n:c=e.taggedElement();break;case!ae&&i<ot[o]:L(`<html> size decreased: ${s}`,...it),c=t();break;case l===a||l===r:L(`<html> size equals page size: ${s}`,...it),c=t();break;case i>l:L(`Page size < <html> size: ${s}`,...it),c=t();break;case ae:L("Found element overflowing <html> "),c=e.taggedElement();break;default:c=t()}return L(`Content ${o}: %c${c}px`,m),c+=function(e){const t=e.getOffset();return 0!==t&&L(`Page offsetSize: %c${t}px`,m),t}(e),c}const at={enabled:()=>ne,getOffset:()=>E,auto:()=>rt(at),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,h)+parseInt(t.marginBottom,h)},bodyScroll:()=>document.body.scrollHeight,offset:()=>at.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(...et(at)),min:()=>Math.min(...et(at)),grow:()=>at.max(),lowestElement:()=>Ke(b),taggedElement:()=>Ke(b)},lt={enabled:()=>oe,getOffset:()=>A,auto:()=>rt(lt),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(...et(lt)),min:()=>Math.min(...et(lt)),rightMostElement:()=>Ke(z),scroll:()=>Math.max(lt.bodyScroll(),lt.documentElementScroll()),taggedElement:()=>Ke(z)},st=(e,t)=>!(Math.abs(e-t)<=je);let ct=!1;const dt=O((()=>J(M(4))));function ut(e,t,n,o,i){x=performance.now(),F(e),B||e===w?document.hidden?q("Page hidden - Ignored resize request"):(ct||(q(`Resize event: %c${t}`,m),N=!0,function(e,t,n,o,i){const r=void 0===n?at[ce]():n,a=void 0===o?lt[Ce]():o;ne&&st(se,r)||oe&&st(Ae,a)||"init"===e?(se=r,Ae=a,pt(se,Ae,e,i)):!e!==w&&(ne&&ce in d||oe&&Ce in d)?ft(t):e===$?pt(se,Ae,e):(q("No change in content size detected"),N=!1)}(e,t,n,o,i),requestAnimationFrame((()=>{ct=!1}))),ct=!0):L("Resizing disabled")}function mt(e){se=at[ce](),Ae=lt[Ce](),pt(se,Ae,e)}function ft(e){const t=ce;ce=s,q(`Reset trigger event: %c${e}`,m),ke?q("TriggerLock blocked calculation"):(ke=!0,D("Trigger event lock on"),requestAnimationFrame((()=>{ke=!1,D("Trigger event lock off")}))),mt("reset"),ce=t}function pt(e,t,o,i,r){he<-1||(F(o),void 0!==r?q(`Message targetOrigin: %c${r}`,m):r=Oe,function(){const a=`${ye}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if($e)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==he)throw e;return void dt()}else Me.postMessage(c+a,r);N&&L(function(){const e=k(performance.now()-x);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),m),N=!1,L("Sending message to host page via "+($e?"sameDomain":"postMessage")),L(`%c${a}`,n)}(),W())}function ht(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>pt(0,0,`${e}Stop`),i={init:function(){me=e.data,Me=e.source,I=e.origin,qe(),ie=!1,setTimeout((()=>{ue=!1}),128)},reset(){ue?q("Page reset ignored by init"):(q("Page size reset by host page"),mt("resetPage"))},resize(){ut(w,"Parent window requested size check")},moveToAnchor(){fe.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();q(`PageInfo received from parent: ${e}`),Re?setTimeout((()=>Re(n(e)))):o("pageInfo")},parentInfo(){const e=a();q(`ParentInfo received from parent: ${e}`),xe?setTimeout((()=>xe(t(n(e))))):o("parentInfo")},message(){const e=a();q(`onMessage called from parent: ${e}`),setTimeout((()=>Ie(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function s(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||U(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(F(r()),!1!==ie?l()?i.init():q(`Ignored message of type "${r()}". Received before initialization.`):s())}function gt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?U("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>ht({data:e}))),S(window,"message",ht),S(window,"readystatechange",gt),gt())}()}();
|
|
21
|
-
//# sourceMappingURL=iframeResizer.contentWindow.min.js.map
|
|
20
|
+
!function(){"use strict";const e="font-weight: normal;",t="font-weight: bold;",n="font-style: italic;",o=e+n,i="default",r={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},a={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:l,keys:s}=Object,c=e=>[e,console[e]],u=e=>t=>[t,function(n){e[t]=n}],d=(e,t)=>l(s(e).map(t));const m=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),f=m()?"color: #A9C7FB;":"color: #135CD2;",p=m()?"color: #E3E3E3;":"color: #1F1F1F;",h="5.4.0",y=10,g="data-iframe-size",v="data-iframe-overflowed",b="data-iframe-ignore",z="bottom",w="right",$="resizeParent",S="setOffsetSize",E="resizeObserver",j="overflowObserver",k="mutationObserver",O=(e,t,n,o)=>e.addEventListener(t,n,o||!1),M=["<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 P=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(M[e]),C=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},A=e=>e,T=e=>Math.round(1e3*e)/1e3,N=e=>""!=`${e}`&&void 0!==e;let I=!0;var x;const R=(x=function(n={}){const l={},s={},m=[],f={...r,...n};let p;function h(){m.length=0}function y(){delete f.event,h()}const g=()=>!m.some((([e])=>"error"===e||"warn"===e))&&!!f.collapsed;function v(){if(0!==m.length){console[g()?"groupCollapsed":"group"](`%c${f.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(f)} %c${f.showTime?p:""}`,e,t,o);for(const[e,...t]of m)console[e](...t);console.groupEnd(),y()}else y()}function b(){p=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(v)))}function z(e,...t){0===m.length&&b(),m.push([e,...t])}function w(e=i,...t){z("log",`${e}: ${performance.now()-l[e]} ms`,...t)}return{...d(f,u(f)),...d(console,(e=>[e,(...t)=>z(e,...t)])),...d(a,c),count:function(e=i){s[e]?s[e]+=1:s[e]=1,z("log",`${e}: ${s[e]}`)},countReset:function(e=i){delete s[e]},endAutoGroup:v,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){z("error",e)}return n},purge:h,time:function(e=i){l[e]=performance.now()},timeEnd:function(e=i){w(e),delete l[e]},timeLog:w}},x?.__esModule?x.default:x)({label:"iframeResizer(child)"});const q=(L="info",(...e)=>!I||R[L](...e));var L;const{assert:B,debug:F,endAutoGroup:D,error:W,errorBoundary:V,event:H,purge:U,warn:Z}=R,J=e=>{return R.warn((t=A,e=>window.chrome?t(e.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):t(e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(e));var t},_=J,Q=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(((e,t)=>J(t))),G=Q("Method"),X=Q("Method","replaced with"),Y=Q("Option"),K=requestAnimationFrame,ee="--ifr-start",te="--ifr-end",ne=[],oe=new WeakSet,ie=e=>"object"==typeof e&&oe.add(e);let re={},ae=0;const le=setInterval((()=>{if(ne.length<10)return;if(re.hasTags&&re.len<25)return;ne.sort();const e=Math.min(ne.reduce(((e,t)=>e+t),0)/ne.length,ne[Math.floor(ne.length/2)]),t=T(e);t>ae&&(ae=t,H("performanceObserver")),e<=4||(clearInterval(le),J(`<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 ${re.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===te){const{duration:t}=performance.measure("--ifr-measure",ee,te);re=e.detail,ne.push(t),ne.length>100&&ne.shift()}}))}function ce(){new PerformanceObserver(se).observe({entryTypes:["mark"]}),ie(document.documentElement),ie(document.body)}"undefined"!=typeof document&&"undefined"!=typeof PerformanceObserver&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",ce):ce()),"undefined"!=typeof window&&function(){const o={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},i={height:()=>(Z("Custom height calculation function not defined"),ct.auto()),width:()=>(Z("Custom width calculation function not defined"),ut.auto())},r={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,boundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},a={},l="checkVisibility"in window,s="auto",c="[iFrameSizer]",u={max:1,min:1,bodyScroll:1,documentElementScroll:1},d="scroll";let m,M,x,L,B,F=!0,W="",Q=0,ne="",oe="",ie=!0,re=!1,ae=!0,le=!1,se=!1,ce=!1,ue=1,de=s,me="",fe=!0,pe="",he={},ye=!1,ge=0,ve=!1,be="",ze=A,we=[],$e="child",Se=null,Ee=!1,je="",ke=[],Oe=window.parent,Me="*",Pe=0,Ce=!1,Ae="",Te=1,Ne=d,Ie=window,xe=()=>{Z("onMessage function not defined")},Re=()=>{},qe=null,Le=null;function Be(){var e,t,n;!function(){const e=e=>"true"===e,t=pe.slice(13).split(":");be=t[0],Q=void 0===t[1]?Q:Number(t[1]),re=void 0===t[2]?re:e(t[2]),ye=void 0===t[3]?ye:e(t[3]),F=void 0===t[6]?F:e(t[6]),ne=t[7],de=void 0===t[8]?de:t[8],W=t[9],oe=t[10],Pe=void 0===t[11]?Pe:Number(t[11]),he.enable=void 0!==t[12]&&e(t[12]),$e=void 0===t[13]?$e:t[13],Ne=void 0===t[14]?Ne:t[14],ve=void 0===t[15]?ve:e(t[15]),m=void 0===t[16]?m:Number(t[16]),M=void 0===t[17]?M:Number(t[17]),ie=void 0===t[18]?ie:e(t[18]),t[19],Ae=t[20]||Ae,ge=void 0===t[21]?ge:Number(t[21])}(),e={id:be,enabled:ye},R.label(`${e.id}`),I=e.enabled,function(){function e(e){xe=e?.onMessage||xe,Re=e?.onReady||Re,"number"==typeof e?.offset&&(Y("offset","offsetSize"),ie&&(m=e?.offset),re&&(M=e?.offset)),"number"==typeof e?.offsetSize&&(ie&&(m=e?.offsetSize),re&&(M=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(je=e.sizeSelector),Object.prototype.hasOwnProperty.call(e,"ignoreSelector")&&(me=e.ignoreSelector),Me=e?.targetOrigin||Me,de=e?.heightCalculationMethod||de,Ne=e?.widthCalculationMethod||Ne}function t(e,t){return"function"==typeof e&&(i[t]=e,e="custom"),e}if(1===ge)return;const n=window.iframeResizer||window.iFrameResizer;"object"==typeof n&&(e(n),de=t(de,"height"),Ne=t(Ne,"width"),q(`Set TargetOrigin for parent: %c${Me}`,f))}(),_e(),function(){try{Ee=1===ge||"iframeParentListener"in window.parent}catch(e){}}(),ge<0?_(`${P(ge+2)}${P(2)}`):Ae.codePointAt(0)>4||ge<2&&_(P(3)),Ae&&""!==Ae&&"false"!==Ae?Ae!==h&&J(`<b>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${Ae} - Child page: ${h}.\n`):J("<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"),Xe(),Ye(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((n=>{e=!0,n.removeAttribute(t),n.toggleAttribute(g,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&J("<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&&J("<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"),We(),1!==ge&&(Ie.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===F?(F=!0,ht("autoResizeEnabled","Auto Resize enabled")):!1===e&&!0===F&&(F=!1),vt(0,0,"autoResize",JSON.stringify(F)),F),close(){vt(0,0,"close")},getId:()=>be,getOrigin:()=>(G("getOrigin()","getParentOrigin()"),x),getParentOrigin:()=>x,getPageInfo(e){if("function"==typeof e)return qe=e,vt(0,0,"pageInfo"),void X("getPageInfo()","getParentProps()","See <u>https://iframe-resizer.com/upgrade</> for details. ");qe=null,vt(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIframe.getParentProps(callback) callback not a function");return Le=e,vt(0,0,"parentInfo"),()=>{Le=null,vt(0,0,"parentInfoStop")}},getParentProperties(e){G("getParentProperties()","getParentProps()"),this.getParentProps(e)},moveToAnchor(e){he.findTarget(e)},reset(){gt()},setOffsetSize(e){m=e,M=e,ht(S,`parentIframe.setOffsetSize(${e})`)},scrollBy(e,t){vt(t,e,"scrollBy")},scrollTo(e,t){vt(t,e,"scrollTo")},scrollToOffset(e,t){vt(t,e,"scrollToOffset")},sendMessage(e,t){vt(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){de=e,Xe()},setWidthCalculationMethod(e){Ne=e,Ye()},setTargetOrigin(e){Me=e},resize(e,t){ht("parentIframe.resize()",`parentIframe.resize(${e||""}${t?`,${t}`:""})`,e,t)},size(e,t){G("size()","resize()"),this.resize(e,t)}}),Ie.parentIFrame=Ie.parentIframe),function(){function e(e){vt(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){O(window.document,t,e)}!0===ve&&(t("mouseenter"),t("mouseleave"))}(),he=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,y)+parseInt(o.x,y),y:parseInt(n.top,y)+parseInt(o.y,y)}}function n(e){function n(e){const n=t(e);vt(n.y,n.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?vt(0,0,"inPageLink",`#${o}`):n(r)}function o(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&n(t)}function i(){for(const e of document.querySelectorAll('a[href^="#"]'))"#"!==e.getAttribute("href")&&O(e,"click",(t=>{t.preventDefault(),n(e.getAttribute("href"))}))}function r(){O(window,"hashchange",o)}function a(){setTimeout(o,128)}function l(){i(),r(),a()}return he.enable&&(1===ge?J("In page linking requires a Professional or Business license. Please see <u>https://iframe-resizer.com/pricing</> for more details."):l()),{findTarget:n}}(),void 0===ne&&(ne=`${Q}px`),Ze("margin",(t="margin",(n=ne).includes("-")&&(Z(`Negative CSS value ignored for ${t}`),n=""),n)),Ze("background",W),Ze("padding",oe),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)}(),function(e){Qe({method:e,eventType:"After Print",eventName:"afterprint"}),Qe({method:e,eventType:"Before Print",eventName:"beforeprint"}),Qe({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}("add"),function(){const e=new Set,t=[];let n=!1,o=0;const i=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)}},r=16,a=2,l=200;let s=1;function c(e){_e(),Ve(e),e.forEach(tt),e.clear()}function u(){H("mutationObserver");const d=performance.now(),m=d-o;if(m>r*s+++a&&m<l)return setTimeout(u,r*s),void(o=d);s=1,t.forEach(i),t.length=0,e.size>0&&c(e),We(),Fe(),n=!1,ht(k,"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:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return e.observe(t,n),e}m()}(),Se=new ResizeObserver(Ke),Se.observe(document.body),et.add(document.body),tt(document.body),ie!==re&&(ze=(e=>{const t=e.side||z,n=e.onChange||A,o=(e,n)=>0===e||e>n[t],i={root:e.root,rootMargin:"0px",threshold:1},r=(e=!1)=>n(e),a=(e,t)=>e.toggleAttribute(v,t),l=new IntersectionObserver((function(e){for(const i of e){const{boundingClientRect:e,rootBounds:r,target:l}=i,s=e[t],c=!((n=l).hidden||null===n.offsetParent||"none"===n.style.display)&&o(s,r);a(l,c)}var n;K(r)}),i),s=new WeakSet;return function(){const e=new window.MutationObserver((()=>{q("Detected changes in element attributes"),r(!0)})),t=document.querySelector("body"),n={attributes:!0,attributeFilter:[b],subtree:!0};e.observe(t,n)}(),function(e){for(const t of e)t.nodeType!==Node.ELEMENT_NODE||s.has(t)||(l.observe(t),s.add(t))}})({onChange:De,root:document.documentElement,side:ie?z:w})),Ve(it(document)()),queueMicrotask(Re),ht("init","Init message from host page",void 0,void 0,h),document.title&&""!==document.title&&vt(0,0,"title",document.title)}function Fe(){we=document.querySelectorAll(`[${v}]:not([${b}]):not([${b}] *)`),se=we.length>0}function De(e){Fe(),(se||e)&&ht(j,"Overflow updated")}function We(){ke=document.querySelectorAll(`[${g}]`),ce=ke.length>0}function Ve(e){ce||ze(e)}let He=0;function Ue(){const n=document.querySelectorAll(`*[${b}]`);le=n.length>0,le&&n.length!==He&&(function(n){const o=1===n.length?"":"s";Z(`%c[${b}]%c found on %c${n.length}%c element${o}`,t,e,t,e)}(n),He=n.length)}function Ze(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),q(`Set body ${e}: %c${t}`,f))}function Je(e,t,n){if(""!==n)for(const e of document.querySelectorAll(n))e.toggleAttribute(t,!0)}function _e(){Je(0,g,je),Je(0,b,me)}function Qe(e){({add(t){function n(){ht(e.eventName,e.eventType)}a[t]=n,O(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)}function Ge(e,t,n,o){return t!==e&&(e in n||(Z(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in r&&J(`<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.`)),e}function Xe(){de=Ge(de,s,ct,"height")}function Ye(){Ne=Ge(Ne,d,ut,"width")}function Ke(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;ht(E,`Element resized <${function(e){switch(!0){case!N(e):return"";case N(e.id):return`${e.nodeName}#${e.id}`;case N(e.name):return`${e.nodeName} (${e.name}`;case N(e.className):return`${e.nodeName}.${e.className}`;default:return e.nodeName}}(t)}>`)}const et=new WeakSet;function tt(e){if(e.nodeType!==Node.ELEMENT_NODE)return;if(!et.has(e)){const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Se.observe(e),et.add(e))}const t=it(e)();for(const e of t){if(et.has(e)||e?.nodeType!==Node.ELEMENT_NODE)continue;const t=getComputedStyle(e)?.position;""!==t&&"static"!==t&&(Se.observe(e),et.add(e))}}function nt(e){performance.mark(ee);const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let i=0,r=document.documentElement,a=ce?0:document.documentElement.getBoundingClientRect().bottom;const s=ce?ke:se?we:it(document)();let c=s.length;for(const t of s)ce||!l||t.checkVisibility(o)?(i=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),i>a&&(a=i,r=t)):c-=1;return q(`${t} position calculated from:`,r),performance.mark(te,{detail:{Side:t,len:c,hasTags:ce,logging:ye}}),a}const ot=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.boundingClientRect()],it=e=>()=>{Ue();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 le&&t.push(`not([${b}])`,`not([${b}] *)`),e.querySelectorAll(t.join(":"))},rt={height:0,width:0},at={height:0,width:0},lt=[f,p,f];function st(e){function t(){return at[o]=i,rt[o]=l,i}const n=e===ct,o=n?"height":"width",i=e.boundingClientRect(),r=Math.ceil(i),a=Math.floor(i),l=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),s=`HTML: %c${i}px %cPage: %c${l}px`;let c=0;switch(!0){case!e.enabled():return l;case ce:q("Found element with data-iframe-size attribute"),c=e.taggedElement();break;case!se&&0===at[o]&&0===rt[o]:q(`Initial page size values: ${s}`,...lt),c=t();break;case Ce&&i===at[o]&&l===rt[o]:q(`Size unchanged: ${s}`,...lt),c=Math.max(i,l);break;case 0===i:q(`Page is hidden: ${s}`,...lt),c=l;break;case!se&&i!==at[o]&&l<=rt[o]:q(`New <html> size: ${s} `,...lt),q(`Previous <html> size: %c${at[o]}px`,f),c=t();break;case!n:c=e.taggedElement();break;case!se&&i<at[o]:q(`<html> size decreased: ${s}`,...lt),c=t();break;case l===a||l===r:q(`<html> size equals page size: ${s}`,...lt),c=t();break;case i>l:q(`Page size < <html> size: ${s}`,...lt),c=t();break;case se:q("Found element overflowing <html> "),c=e.taggedElement();break;default:q(`Using <html> size: ${s}`,...lt),c=t()}return q(`Content ${o}: %c${c}px`,f),c+=function(e){const t=e.getOffset();return 0!==t&&q(`Page offsetSize: %c${t}px`,f),t}(e),c}const ct={enabled:()=>ie,getOffset:()=>m,auto:()=>st(ct),bodyOffset:()=>{const{body:e}=document,t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,y)+parseInt(t.marginBottom,y)},bodyScroll:()=>document.body.scrollHeight,offset:()=>ct.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(...ot(ct)),min:()=>Math.min(...ot(ct)),grow:()=>ct.max(),lowestElement:()=>nt(z),taggedElement:()=>nt(z)},ut={enabled:()=>re,getOffset:()=>M,auto:()=>st(ut),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>i.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,boundingClientRect:()=>Math.max(document.documentElement.getBoundingClientRect().right,document.body.getBoundingClientRect().right),max:()=>Math.max(...ot(ut)),min:()=>Math.min(...ot(ut)),rightMostElement:()=>nt(w),scroll:()=>Math.max(ut.bodyScroll(),ut.documentElementScroll()),taggedElement:()=>nt(w)},dt=(e,t)=>!(Math.abs(e-t)<=Pe);function mt(e,t,n,o,i){const r=void 0===n?ct[de]():n,a=void 0===o?ut[Ne]():o;switch(!0){case ie&&dt(ue,r)||re&&dt(Te,a)||"init"===e:ue=r,Te=a;case e===S:vt(ue,Te,e,i);break;case!e!==$&&(ie&&de in u||re&&Ne in u):gt();break;case e===E:case e===j:case e===k:U();break;default:U(),q("No change in content size detected")}L=!1}let ft=!1;const pt=C((()=>_(P(4)))),ht=V(((e,t,n,o,i)=>{B=performance.now(),H(e),F||e===$?document.hidden||(ft||(L=!0,mt(e,0,n,o,i),requestAnimationFrame((()=>{ft=!1}))),ft=!0):q("Resizing disabled")}));function yt(e){ue=ct[de](),Te=ut[Ne](),vt(ue,Te,e)}function gt(e){const t=de;de=s,Ce||(Ce=!0,requestAnimationFrame((()=>{Ce=!1}))),yt("reset"),de=t}const vt=V((function(e,t,o,i,r){ge<-1||(H(o),void 0!==r||(r=Me),function(){const a=`${be}:${e}:${t}:${o}${void 0===i?"":`:${i}`}`;if(Ee)try{window.parent.iframeParentListener(c+a)}catch(e){if(1!==ge)throw e;return void pt()}else Oe.postMessage(c+a,r);L&&q(function(){const e=T(performance.now()-B);return"init"===o?`Initialised iFrame in %c${e}ms`:`Size calculated in %c${e}ms`}(),f),q("Sending message to host page via "+(Ee?"sameDomain":"postMessage")),q(`%c${a}`,n)}(),D())})),bt=V((function(e){const{freeze:t}=Object,{parse:n}=JSON,o=e=>vt(0,0,`${e}Stop`),i={init:function(){pe=e.data,Oe=e.source,x=e.origin,Be(),ae=!1,setTimeout((()=>{fe=!1}),128)},reset(){fe||yt("resetPage")},resize(){ht($,"Parent window requested size check")},moveToAnchor(){he.findTarget(a())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=a();qe?setTimeout((()=>qe(n(e)))):o("pageInfo")},parentInfo(){const e=a();Le?setTimeout((()=>Le(t(n(e))))):o("parentInfo")},message(){const e=a();setTimeout((()=>xe(n(e))))}},r=()=>e.data.split("]")[1].split(":")[0],a=()=>e.data.slice(e.data.indexOf(":")+1),l=()=>e.data.split(":")[2]in{true:1,false:1};function s(){const t=r();t in i?i[t]():"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype||l()||Z(`Unexpected message (${e.data})`)}c===`${e.data}`.slice(0,13)&&(H(r()),!1!==ae?l()&&i.init():s())}));function zt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"iframeChildListener"in window?Z("Already setup"):(window.iframeChildListener=e=>setTimeout((()=>bt({data:e,sameDomain:!0}))),O(window,"message",bt),O(window,"readystatechange",zt),zt())}()}();
|
package/js/iframeResizer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy (parent) 5.4.0
|
|
4
|
+
* @module iframe-resizer/legacy (parent) 5.4.0 (umd) - 2025-03-31
|
|
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,4 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=t()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="font-weight: normal;",t="font-style: italic;",i=e+t,n="default",o={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},r={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:a,keys:s}=Object,l=e=>t=>[t,function(i){e[t]=i}],c=(e,t)=>a(s(e).map(t));const d=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),u=d()?"color: #A9C7FB;":"color: #135CD2;",f=d()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0-beta.9",m="iframeResizer",h="[iFrameSizer]",g=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),y=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t)),w=e=>e,b=(v=function(t={}){const a={},s=[],d={...o,...t};let u;function f(){s.length=0}function p(){delete d.event,f()}const m=()=>!s.some((([e])=>"error"===e||"warn"===e))&&!!d.collapsed;function h(){if(0!==s.length){console[m()?"groupCollapsed":"group"](`%c${d.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(d)} %c${d.showTime?u:""}`,e,"font-weight: bold;",i);for(const[e,...t]of s)console[e](...t);console.groupEnd(),p()}else p()}function g(){u=function(){const e=new Date,t=(t,i)=>e[t]().toString().padStart(i,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(h)))}function y(e,...t){0===s.length&&g(),s.push([e,...t])}function w(e=n,...t){y("log",`${e}: ${performance.now()-a[e]} ms`,...t)}return{...c(d,l(d)),...c(console,(e=>[e,(...t)=>y(e,...t)])),...c(r,(e=>[e,console[e]])),endAutoGroup:h,purge:f,time:function(e=n){a[e]=performance.now()},timeEnd:function(e=n){w(e),delete a[e]},timeLog:w}},v?.__esModule?v.default:v);var v;let z={},$=!1;const j=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const k=e=>(t,...i)=>z[t]?.console[e](...i),T=(M="log",(e,...t)=>!0===(e=>z[e]?z[e].log:$)(e)?k(M)(e,...t):null);var M;const R=k("info"),S=k("warn"),I=k("event");const E=(e,...t)=>z[e]?z[e].console.warn(y(w)(...t)):queueMicrotask((()=>console?.warn(y((e=>(...t)=>[`${m}(${e})`,...t].join(" "))(e))(...t)))),x=(e=>(t,i="renamed to")=>(n,o,r="",a="")=>e(a,`<rb>Deprecated ${t}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${t.toLowerCase()} has been ${i} <b>${o}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(E),C=x("Function"),O=x("Option"),A=(e,t,i,n)=>e.addEventListener(t,i,n||!1),W=(e,t,i)=>e.removeEventListener(t,i,!1),F=e=>{if(!e)return"";let t=-559038744,i=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),t=Math.imul(t^n,2246822519),i=Math.imul(i^n,3266489917);return t^=Math.imul(t^i>>>15,1935289751),i^=Math.imul(i^t>>>15,3405138345),t^=i>>>16,i^=t>>>16,(2097152*(i>>>0)+(t>>>11)).toString(36)},L=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),N=["<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."],D=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],P=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),H=e=>L(N[e]),B=e=>{const t=e[L("spjluzl")];if(!t)return-1;const i=t.split("-");let n=function(e=""){let t=-2;const i=F(L(e));return i in P&&(t=P[i]),t}(i[0]);return 0===n||(e=>e[2]===F(e[0]+e[1]))(i)||(n=-2),n},q={},J=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof q[e.id].onInit&&(O("init()","onReady()","",e.id),q[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),U={position:null,version:p};function V(e){function i(){ee(M),Q(x),j("onResized",M)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const r=e=>k.slice(k.indexOf(":")+7+e);const a=(e,t)=>(i,n)=>{const o={};var r,a;r=function(){te(`${i} (${e})`,`${e}:${t()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},s=(e,t)=>()=>{let i=!1;const n=t=>()=>{q[l]?i&&i!==t||(e(t,l),i=t,requestAnimationFrame((()=>{i=!1}))):s()},o=n("scroll"),r=n("resize window");function a(e,i){T(l,`${e} listeners for send${t}`),i(window,"scroll",o),i(window,"resize",r)}function s(){a("Remove ",W),c.disconnect(),d.disconnect()}const l=x,c=new ResizeObserver(n("pageObserver")),d=new ResizeObserver(n("iframeObserver"));a("Add ",A),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),d.observe(q[l].iframe,{attributes:!0,childList:!1,subtree:!1}),q[l]&&(q[l][`stop${t}`]=s)},l=e=>()=>{e in q[x]&&(q[x][e](),delete q[x][e])},c=a("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=M.iframe.getBoundingClientRect(),{scrollY:i,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),d=a("parentInfo",(function(){const{iframe:e}=M,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:i},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),m=s(c,"PageInfo"),g=s(d,"ParentInfo"),y=l("stopPageInfo"),w=l("stopParentInfo");function b(e){const t=e.getBoundingClientRect();return Y(x),{x:Number(t.left)+Number(U.position.x),y:Number(t.top)+Number(U.position.y)}}function v(e){const t=e?b(M.iframe):{x:0,y:0};R(x,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,u,f,u);const i=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(M,t),n=window.parentIframe||window.parentIFrame;n?function(t,i){t["scrollTo"+(e?"Offset":"")](i.x,i.y)}(n,i):function(e){U.position=e,z(x)}(i)}function z(e){const{x:t,y:i}=U.position,n=q[e]?.iframe;!1!==j("onScroll",{iframe:n,top:i,left:t,x:t,y:i})?Q(e):_()}function $(e){let t={};if(0===M.width&&0===M.height){const e=r(9).split(":");t={x:e[1],y:e[0]}}else t={x:M.width,y:M.height};j(e,{iframe:M.iframe,screenX:Number(t.x),screenY:Number(t.y),type:M.type})}const j=(e,t)=>Z(x,e,t);let k=e.data,M={},x=null;"[iFrameResizerChild]Ready"!==k?h===`${k}`.slice(0,13)&&k.slice(13).split(":")[0]in q?(M=function(){const e=k.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=q[e[0]]?.iframe,r=getComputedStyle(i);return{iframe:i,id:e[0],height:t+n(r)+o(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),x=M.id,I(x,M.type),x?(function(e){if(!q[e])throw new Error(`${M.type} No settings for ${e}. Message was: ${k}`)}(x),function(){const e=M.type in{true:1,false:1,undefined:1};return e&&T(x,"Ignoring init message from meta parent page"),e}()||(T(x,`Received: %c${k}`,t),q[x].loaded=!0,(null!==M.iframe||(S(x,`The iframe (${M.id}) was not found.`),0))&&function(){const{origin:t,sameDomain:i}=e;if(i)return!0;let n=q[x]?.checkOrigin;if(n&&"null"!=`${t}`&&!(n.constructor===Array?function(){let e=0,i=!1;for(T(x,`Checking connection is from allowed list of origins: %c${n}`,u);e<n.length;e++)if(n[e]===t){i=!0;break}return i}():function(){const e=q[x]?.remoteHost;return T(x,`Checking connection is from: %c${e}`,u),t===e}()))throw new Error(`Unexpected message received from: ${t} for ${M.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(q[x]?.firstRun&&q[x]&&(q[x].firstRun=!1),M.type){case"close":X(M.iframe);break;case"message":n=r(6),T(x,`onMessage passed: {iframe: %c${M.iframe.id}%c, message: %c${n}}`,u,f,t),j("onMessage",{iframe:M.iframe,message:JSON.parse(n)});break;case"mouseenter":$("onMouseEnter");break;case"mouseleave":$("onMouseLeave");break;case"autoResize":q[x].autoResize=JSON.parse(r(9));break;case"scrollBy":!function(){const e=M.width,t=M.height,i=window.parentIframe||window.parentIFrame||window;R(x,`scrollBy: x: %c${e}%c y: %c${t}`,u,f,u),i.scrollBy(e,t)}();break;case"scrollTo":v(!1);break;case"scrollToOffset":v(!0);break;case"pageInfo":c("start",x),m();break;case"parentInfo":d("start",x),g();break;case"pageInfoStop":y();break;case"parentInfoStop":w();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",i=decodeURIComponent(t);let n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){const e=b(n);R(x,`Moving to in page link: %c#${t}`,u),U.position={x:e.x,y:e.y},z(x),window.location.hash=t}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):T(x,`In page link #${t} not found and window.parentIframe not found`)}():T(x,`In page link #${t} not found`)}(r(9));break;case"title":!function(e,t){q[t]?.syncTitle&&(q[t].iframe.title=e,R(t,`Set iframe title attribute: %c${e}`,u))}(M.msg,x);break;case"reset":K(M);break;case"init":i(),function(e){try{q[e].sameDomain=!!q[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){q[e].sameDomain=!1}T(e,`sameDomain: %c${q[e].sameDomain}`,u)}(x),(e=M.msg)!==p&&(void 0!==e?T(x,`Version mismatch (Child: %c${e}%c !== Parent: %c${p})`,u,f,u):E(x,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),oe=!0,j("onReady",M.iframe);break;default:if(0===M.width&&0===M.height)return void S(x,`Unsupported message received (${M.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===M.width||0===M.height)return void T(x,"Ignoring message with 0 height or width");if(document.hidden)return void T(x,"Page hidden - ignored resize request");i()}var e,n}())):S("","iframeResizer received messageData without id, message was: ",k)):null!==x&&T(x,"Ignored:",k):Object.keys(q).forEach((e=>{q[e].mode>=0&&te("iFrame requested init",ie(e),e)}))}function Z(e,t,i){let n=null,o=null;if(q[e]){if(n=q[e][t],"function"!=typeof n)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{o=n(i)}catch(i){console.error(i),S(e,`Error in ${t} callback`)}else setTimeout((()=>n(i)))}return o}function G(e){const{id:t}=e;T(t,"Disconnected from iframe"),delete q[t]}function X(e){const{id:t}=e;if(!1!==Z(t,"onClose",t)){T(t,`Removing iFrame: %c${t}`,u);try{e.parentNode&&e.remove()}catch(e){S(t,e)}Z(t,"onClosed",t),G(e)}else T(t,"Close iframe cancelled by onClose event")}function Y(e){null===U.position&&(U.position={x:window.scrollX,y:window.scrollY},T(e,`Get page position: %c${U.position.x}%c, %c${U.position.y}`,u,f,u))}function _(){U.position=null}function Q(e){null!==U.position&&(window.scrollTo(U.position.x,U.position.y),R(e,`Set page position: %c${U.position.x}%c, %c${U.position.y}`,u,f,u),_())}function K(e){T(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),Y(e.id),ee(e),te("reset","reset",e.id)}function ee(e){function t(t){const n=`${e[t]}px`;e.iframe.style[t]=n,R(i,`Set ${t}: %c${n}`,u)}const{id:i}=e,{sizeHeight:n,sizeWidth:o}=q[i];n&&t("height"),o&&t("width")}function te(e,i,n,o){I(n,e),q[n]&&(q[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:o,sameDomain:r,targetOrigin:a}=q[n];if(r)try{return e.contentWindow.iframeChildListener(h+i),T(n,`Sending message to iframe %c${n}%c via sameDomain`,u,f),void T(n,`%c${i}`,t)}catch(e){T(n,"Same domain connection failed. Trying cross domain")}T(n,`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`,u,f,u),T(n,`%c${i}`,t),o.postMessage(h+i,a)}():S(n,`Iframe(${n}) not found`),o&&q[n]?.warningTimeout&&(q[n].msgTimeout=setTimeout((function(){if(void 0===q[n])return;const{iframe:e,loaded:t,loadErrorShown:i,waitForLoad:o}=q[n],{sandbox:r}=e;t||i||(q[n].loadErrorShown=!0,E(n,`<rb>No response from iFrame</>\n \nThe iframe (<i>${n}</>) has not responded within ${q[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),q[n].warningTimeout)))}function ie(e){const t=q[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,U.version,t.mode].join(":")}z=q;let ne=0,oe=!1,re=!1;const ae=e=>t=>{function i(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&E(r,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function n(e){const t=q[e]?.iframe?.title;return""===t||void 0===t}const o=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");const r=function(i){if(i&&"string"!=typeof i)throw new TypeError("Invalid id for iFrame. Expected String");return""!==i&&i||(i=function(){let t=e?.id||J.id+ne++;return null!==document.getElementById(t)&&(t+=ne++),t}(),t.id=i,T(i,`Added missing iframe ID: ${i} (${t.src})`)),i}(t.id);return function({enabled:e,iframeId:t}){$=e,z[t]||(z[t]={console:b({label:j(t)})})}({enabled:Object.hasOwn(e,"log")?e.log:J.log,iframeId:r}),"iframeResizer"in t?S(r,`Ignored iframe (${r}), already setup.`):(function(e){var a,s;q[r]={...q[r],iframe:t,firstRun:!0,remoteHost:t?.src.split("/").slice(0,3).join("/"),...J,...i(e),mouseEvents:o(e),mode:B(e),syncTitle:n(r)},I(r,"setup"),function(){const{direction:e}=q[r];if("horizontal"===e)return q[r].sizeWidth=!0,q[r].sizeHeight=!1,void T(r,"Direction: %chorizontal",u);if("none"===e)return q[r].sizeWidth=!1,q[r].sizeHeight=!1,q[r].autoResize=!1,void T(r,"Direction: %cnone",u);if("vertical"!==e)throw new TypeError(r,`Direction value of "${e}" is not valid`);T(r,"Direction: %cvertical",u)}(),(a=e?.offsetSize||e?.offset)&&("vertical"===q[r].direction?(q[r].offsetHeight=a,T(r,`Offset height: %c${a}`,u)):(q[r].offsetWidth=a,T(r,`Offset width: %c${a}`,u))),e?.offset&&E(r,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===q[r].postMessageTarget&&(q[r].postMessageTarget=t.contentWindow),q[r].targetOrigin=!0===q[r].checkOrigin?""===(s=q[r].remoteHost)||null!==s.match(/^(about:blank|javascript:|file:\/\/)/)?"*":s:"*"}(e),function(){const{mode:e}=q[r];e<0&&E("Parent",`${H(e+2)}${H(2)}`),re||e<0||(re=!0,function(e,t){"iframeResizer"in window||(window.iframeResizer={version:e}),!$&&t>0||queueMicrotask((()=>console.info(`%ciframe-resizer ${e}`,"font-weight: bold;")))}(`v${p} (${(e=>L(D[e]))(e)})`,e),e<1&&E("Parent",H(3)))}(),le(),function(){switch(T(r,`Iframe scrolling ${q[r]?.scrolling?"enabled":"disabled"} for ${r}`),t.style.overflow=!1===q[r]?.scrolling?"hidden":"auto",q[r]?.scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=q[r]?q[r].scrolling:"no"}}(),function(){const{bodyMargin:e}=q[r];"number"!=typeof e&&"0"!==e||(q[r].bodyMargin=`${e}px`)}(),function(e){const{id:i}=t,{mode:n,waitForLoad:o}=q[i];-1!==n&&-2!==n&&(A(t,"load",(function(){te("iFrame.onload",`${e}:${oe}`,i,!0),function(){const e=q[r]?.firstRun,i=q[r]?.heightCalculationMethod in g;!e&&i&&K({iframe:t,height:0,width:0,type:"init"})}()})),!1===o&&te("init",`${e}:${oe}`,i,!0))}(ie(r)),function(){if(q[r]){const{iframe:e}=q[r],t={close:X.bind(null,e),disconnect:G.bind(null,e),removeListeners(){E(r,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:te.bind(null,"Window resize","resize",r),moveToAnchor(e){te("Move to anchor",`moveToAnchor:${e}`,r)},sendMessage(e){te("message",`message:${e=JSON.stringify(e)}`,r)}};e.iframeResizer=t,e.iFrameResizer=t}}()),t?.iFrameResizer};function se(){!1===document.hidden&&(T("document","Trigger event: Visibility change"),function(e,t){const i=e=>q[e]?.autoResize&&!q[e]?.firstRun;Object.keys(q).forEach((function(n){i(n)&&te(e,t,n)}))}("Tab Visible","resize"))}const le=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{A(window,"message",V),A(document,"visibilitychange",se),window.iframeParentListener=e=>setTimeout((()=>V({data:e,sameDomain:!0})))})),ce=`[${m}] `;const de=function(){function e(e){switch(!0){case!e:throw new TypeError(`${ce}iframe is not defined`);case!e.tagName:throw new TypeError(`${ce}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${ce}Expected <IFRAME> tag, found <${e.tagName}>`);default:t(e),i.push(e)}}let t,i;return function(n,o){if("undefined"==typeof window)return[];switch(t=ae(n),i=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${ce}Unexpected data type (${typeof o})`)}return Object.freeze(i)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){C("iFrameResize()","iframeResize()","","parent"),de(...e)}),de}));
|
|
21
|
-
//# sourceMappingURL=iframeResizer.js.map
|
|
20
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=t()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="font-weight: normal;",t=e+"font-style: italic;",n="default",o={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},i={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:r,keys:a}=Object,s=e=>[e,console[e]],l=e=>t=>[t,function(n){e[t]=n}],c=(e,t)=>r(a(e).map(t));const u=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),d=u()?"color: #A9C7FB;":"color: #135CD2;",f=u()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0",h="iframeResizer",m="[iFrameSizer]",y=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),g=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t)),w=e=>e,b=(v=function(r={}){const a={},u={},d=[],f={...o,...r};let p;function h(){d.length=0}function m(){delete f.event,h()}const y=()=>!d.some((([e])=>"error"===e||"warn"===e))&&!!f.collapsed;function g(){if(0!==d.length){console[y()?"groupCollapsed":"group"](`%c${f.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(f)} %c${f.showTime?p:""}`,e,"font-weight: bold;",t);for(const[e,...t]of d)console[e](...t);console.groupEnd(),m()}else m()}function w(){p=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(g)))}function b(e,...t){0===d.length&&w(),d.push([e,...t])}function v(e=n,...t){b("log",`${e}: ${performance.now()-a[e]} ms`,...t)}return{...c(f,l(f)),...c(console,(e=>[e,(...t)=>b(e,...t)])),...c(i,s),count:function(e=n){u[e]?u[e]+=1:u[e]=1,b("log",`${e}: ${u[e]}`)},countReset:function(e=n){delete u[e]},endAutoGroup:g,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){b("error",e)}return n},purge:h,time:function(e=n){a[e]=performance.now()},timeEnd:function(e=n){v(e),delete a[e]},timeLog:v}},v?.__esModule?v.default:v);var v;let z={},$=!1;const j=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const k=e=>(t,...n)=>z[t]?.console[e](...n),T=(M="info",(e,...t)=>!0===(e=>z[e]?z[e].log:$)(e)?k(M)(e,...t):null);var M;const R=k("warn"),E=k("event");const S=(e,...t)=>z[e]?z[e].console.warn(g(w)(...t)):queueMicrotask((()=>console?.warn(g((e=>(...t)=>[`${h}(${e})`,...t].join(" "))(e))(...t)))),x=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(S),I=x("Function"),O=x("Option"),C=(e,t,n,o)=>e.addEventListener(t,n,o||!1),W=(e,t,n)=>e.removeEventListener(t,n,!1),A=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,i=0;i<e.length;i++)o=e.codePointAt(i),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);return t^=Math.imul(t^n>>>15,1935289751),n^=Math.imul(n^t>>>15,3405138345),t^=n>>>16,n^=t>>>16,(2097152*(n>>>0)+(t>>>11)).toString(36)},F=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),L=["<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."],N=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],B=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),H=e=>F(L[e]),P=e=>{const t=e[F("spjluzl")];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=A(F(e));return n in B&&(t=B[n]),t}(n[0]);return 0===o||(e=>e[2]===A(e[0]+e[1]))(n)||(o=-2),o},D={},q=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,waitForLoad:!1,warningTimeout:5e3,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof D[e.id].onInit&&(O("init()","onReady()","",e.id),D[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),J={position:null,version:p};function U(e){function t(){K(M),_(x),$("onResized",M)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const i=e=>k.slice(k.indexOf(":")+7+e);const r=(e,t)=>(n,o)=>{const i={};var r,a;r=function(){ee(`${n} (${e})`,`${e}:${t()}`,o)},i[a=o]||(r(),i[a]=requestAnimationFrame((()=>{i[a]=null})))},a=(e,t)=>()=>{let n=!1;const o=t=>()=>{D[l]?n&&n!==t||(e(t,l),n=t,requestAnimationFrame((()=>{n=!1}))):s()},i=o("scroll"),r=o("resize window");function a(e,t){t(window,"scroll",i),t(window,"resize",r)}function s(){a(0,W),c.disconnect(),u.disconnect()}const l=x,c=new ResizeObserver(o("pageObserver")),u=new ResizeObserver(o("iframeObserver"));a(0,C),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(D[l].iframe,{attributes:!0,childList:!1,subtree:!1}),D[l]&&(D[l][`stop${t}`]=s)},s=e=>()=>{e in D[x]&&(D[x][e](),delete D[x][e])},l=r("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=M.iframe.getBoundingClientRect(),{scrollY:n,scrollX:o,innerHeight:i,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,i||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:n,scrollLeft:o,documentHeight:a,documentWidth:s,windowHeight:i,windowWidth:r})})),c=r("parentInfo",(function(){const{iframe:e}=M,{scrollWidth:t,scrollHeight:n}=document.documentElement,{width:o,height:i,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:o,height:i,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),u=a(l,"PageInfo"),h=a(c,"ParentInfo"),y=s("stopPageInfo"),g=s("stopParentInfo");function w(e){const t=e.getBoundingClientRect();return X(),{x:Number(t.left)+Number(J.position.x),y:Number(t.top)+Number(J.position.y)}}function b(e){const t=e?w(M.iframe):{x:0,y:0};T(x,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,d,f,d);const n=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(M,t),o=window.parentIframe||window.parentIFrame;o?function(t,n){t["scrollTo"+(e?"Offset":"")](n.x,n.y)}(o,n):function(e){J.position=e,v(x)}(n)}function v(e){const{x:t,y:n}=J.position,o=D[e]?.iframe;!1!==$("onScroll",{iframe:o,top:n,left:t,x:t,y:n})?_(e):Y()}function z(e){let t={};if(0===M.width&&0===M.height){const e=i(9).split(":");t={x:e[1],y:e[0]}}else t={x:M.width,y:M.height};$(e,{iframe:M.iframe,screenX:Number(t.x),screenY:Number(t.y),type:M.type})}const $=(e,t)=>Z(x,e,t);function j(){switch(D[x]?.firstRun&&D[x]&&(D[x].firstRun=!1),M.type){case"close":G(M.iframe);break;case"message":n=i(6),$("onMessage",{iframe:M.iframe,message:JSON.parse(n)});break;case"mouseenter":z("onMouseEnter");break;case"mouseleave":z("onMouseLeave");break;case"autoResize":D[x].autoResize=JSON.parse(i(9));break;case"scrollBy":!function(){const e=M.width,t=M.height,n=window.parentIframe||window.parentIFrame||window;T(x,`scrollBy: x: %c${e}%c y: %c${t}`,d,f,d),n.scrollBy(e,t)}();break;case"scrollTo":b(!1);break;case"scrollToOffset":b(!0);break;case"pageInfo":l("start",x),u();break;case"parentInfo":c("start",x),h();break;case"pageInfoStop":y();break;case"parentInfoStop":g();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const e=w(o);T(x,`Moving to in page link: %c#${t}`,d),J.position={x:e.x,y:e.y},v(x),window.location.hash=t}():window.top!==window.self&&function(){const e=window.parentIframe||window.parentIFrame;e&&e.moveToAnchor(t)}()}(i(9));break;case"title":!function(e,t){D[t]?.syncTitle&&(D[t].iframe.title=e,T(t,`Set iframe title attribute: %c${e}`,d))}(M.msg,x);break;case"reset":Q(M);break;case"init":t(),function(e){try{D[e].sameDomain=!!D[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){D[e].sameDomain=!1}}(x),(e=M.msg)!==p&&(void 0!==e||S(x,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),oe=!0,$("onReady",M.iframe);break;default:if(0===M.width&&0===M.height)return void R(x,`Unsupported message received (${M.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===M.width||0===M.height)return;if(document.hidden)return;t()}var e,n}let k=e.data,M={},x=null;"[iFrameResizerChild]Ready"!==k?m===`${k}`.slice(0,13)&&k.slice(13).split(":")[0]in D&&(M=function(){const e=k.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=D[e[0]]?.iframe,r=getComputedStyle(i);return{iframe:i,id:e[0],height:t+n(r)+o(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),x=M.id,x?(E(x,M.type),D[x].errorBoundary((function(){!function(e){if(!D[e])throw new Error(`${M.type} No settings for ${e}. Message was: ${k}`)}(x),M.type in{true:1,false:1,undefined:1}||(D[x].loaded=!0,(null!==M.iframe||(R(x,`The iframe (${M.id}) was not found.`),0))&&function(){const{origin:t,sameDomain:n}=e;if(n)return!0;let o=D[x]?.checkOrigin;if(o&&"null"!=`${t}`&&!(o.constructor===Array?function(){let e=0,n=!1;for(;e<o.length;e++)if(o[e]===t){n=!0;break}return n}():function(){const e=D[x]?.remoteHost;return t===e}()))throw new Error(`Unexpected message received from: ${t} for ${M.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&j())}))()):R("","iframeResizer received messageData without id, message was: ",k)):Object.keys(D).forEach((e=>{D[e].mode>=0&&ee("iFrame requested init",te(e),e)}))}function Z(e,t,n){let o=null,i=null;if(D[e]){if(o=D[e][t],"function"!=typeof o)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{i=o(n)}catch(n){console.error(n),R(e,`Error in ${t} callback`)}else setTimeout((()=>o(n)))}return i}function V(e){const{id:t}=e;delete D[t]}function G(e){const{id:t}=e;if(!1!==Z(t,"onClose",t)){try{e.parentNode&&e.remove()}catch(e){R(t,e)}Z(t,"onClosed",t),V(e)}}function X(e){null===J.position&&(J.position={x:window.scrollX,y:window.scrollY})}function Y(){J.position=null}function _(e){null!==J.position&&(window.scrollTo(J.position.x,J.position.y),T(e,`Set page position: %c${J.position.x}%c, %c${J.position.y}`,d,f,d),Y())}function Q(e){X(e.id),K(e),ee("reset","reset",e.id)}function K(e){function t(t){const o=`${e[t]}px`;e.iframe.style[t]=o,T(n,`Set ${t}: %c${o}`,d)}const{id:n}=e,{sizeHeight:o,sizeWidth:i}=D[n];o&&t("height"),i&&t("width")}function ee(e,t,n,o){E(n,e),D[n]&&(D[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:o,sameDomain:i,targetOrigin:r}=D[n];if(i)try{return void e.contentWindow.iframeChildListener(m+t)}catch(e){}o.postMessage(m+t,r)}():R(n,`Iframe(${n}) not found`),o&&D[n]?.warningTimeout&&(D[n].msgTimeout=setTimeout((function(){if(void 0===D[n])return;const{iframe:e,loaded:t,loadErrorShown:o,waitForLoad:i}=D[n],{sandbox:r}=e;t||o||(D[n].loadErrorShown=!0,S(n,`<rb>No response from iFrame</>\n \nThe iframe (<i>${n}</>) has not responded within ${D[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${i?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),D[n].warningTimeout)))}function te(e){const t=D[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,J.version,t.mode].join(":")}z=D;let ne=0,oe=!1,ie=!1;const re=t=>n=>{function o(e){const{id:t}=n,{mode:o,waitForLoad:i}=D[t];-1!==o&&-2!==o&&(C(n,"load",(function(){ee("iFrame.onload",`${e}:${oe}`,t,!0),function(){const e=D[u]?.firstRun,t=D[u]?.heightCalculationMethod in y;!e&&t&&Q({iframe:n,height:0,width:0,type:"init"})}()})),!1===i&&ee("init",`${e}:${oe}`,t,!0))}function i(e){return e?(("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&S(u,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e):{}}function r(){const{mode:n}=D[u];ie||n>0&&t.vInfoDisable||(ie=!0,function(t,n){queueMicrotask((()=>console.info(`%ciframe-resizer ${t}`,$||n<1?"font-weight: bold;":e)))}(`v${p} (${(e=>F(N[e]))(n)})`,n)),n<0?S("Parent",`${H(n+2)}${H(2)}`):n<1&&S("Parent",H(3))}function a(e){const t=D[e]?.iframe?.title;return""===t||void 0===t}const s=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");function l(e){var t,o;D[u]={...D[u],iframe:n,firstRun:!0,remoteHost:n?.src.split("/").slice(0,3).join("/"),...q,...i(e),mouseEvents:s(e),mode:P(e),syncTitle:a(u)},E(u,"setup"),function(){const{direction:e}=D[u];if("horizontal"===e)return D[u].sizeWidth=!0,void(D[u].sizeHeight=!1);if("none"===e)return D[u].sizeWidth=!1,D[u].sizeHeight=!1,void(D[u].autoResize=!1);if("vertical"!==e)throw new TypeError(u,`Direction value of "${e}" is not valid`)}(),(t=e?.offsetSize||e?.offset)&&("vertical"===D[u].direction?D[u].offsetHeight=t:D[u].offsetWidth=t),e?.offset&&S(u,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===D[u].postMessageTarget&&(D[u].postMessageTarget=n.contentWindow),D[u].targetOrigin=!0===D[u].checkOrigin?""===(o=D[u].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const c=()=>"iframeResizer"in n,u=function(e){if(e&&"string"!=typeof e)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=t?.id||q.id+ne++;return null!==document.getElementById(e)&&(e+=ne++),e}(),n.id=e),e}(n.id);if("object"!=typeof t)throw new TypeError("Options is not an object");return function(e){-1===e?.log&&(e.log=!1,e.vInfoDisable=!0)}(t),function({enabled:e,iframeId:t}){const n=b({label:j(t)});$=e,z[t]||(z[t]={console:n,errorBoundary:n.errorBoundary})}({enabled:Object.hasOwn(t,"log")?t.log:q.log,iframeId:u}),D[u].errorBoundary((function(e){c()?R(u,`Ignored iframe (${u}), already setup.`):(l(e),r(),se(),function(){switch(n.style.overflow=!1===D[u]?.scrolling?"hidden":"auto",D[u]?.scrolling){case"omit":break;case!0:n.scrolling="yes";break;case!1:n.scrolling="no";break;default:n.scrolling=D[u]?D[u].scrolling:"no"}}(),function(){const{bodyMargin:e}=D[u];"number"!=typeof e&&"0"!==e||(D[u].bodyMargin=`${e}px`)}(),o(te(u)),function(){if(D[u]){const{iframe:e}=D[u],t={close:G.bind(null,e),disconnect:V.bind(null,e),removeListeners(){S(u,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:ee.bind(null,"Window resize","resize",u),moveToAnchor(e){ee("Move to anchor",`moveToAnchor:${e}`,u)},sendMessage(e){ee("message",`message:${e=JSON.stringify(e)}`,u)}};e.iframeResizer=t,e.iFrameResizer=t}}())}))(t),n?.iFrameResizer};function ae(){!1===document.hidden&&function(e,t){const n=e=>D[e]?.autoResize&&!D[e]?.firstRun;Object.keys(D).forEach((function(o){n(o)&&ee(e,t,o)}))}("Tab Visible","resize")}const se=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{C(window,"message",U),C(document,"visibilitychange",ae),window.iframeParentListener=e=>setTimeout((()=>U({data:e,sameDomain:!0})))})),le=`[${h}] `;const ce=function(){function e(e){switch(!0){case!e:throw new TypeError(`${le}iframe is not defined`);case!e.tagName:throw new TypeError(`${le}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${le}Expected <IFRAME> tag, found <${e.tagName}>`);default:t(e),n.push(e)}}let t,n;return function(o,i){if("undefined"==typeof window)return[];switch(t=re(o),n=[],typeof i){case"undefined":case"string":document.querySelectorAll(i||"iframe").forEach(e);break;case"object":e(i);break;default:throw new TypeError(`${le}Unexpected data type (${typeof i})`)}return Object.freeze(n)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){I("iFrameResize()","iframeResize()","","parent"),ce(...e)}),ce}));
|
package/js/iframeResizer.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/legacy (parent) 5.4.0
|
|
4
|
+
* @module iframe-resizer/legacy (parent) 5.4.0 (umd) - 2025-03-31
|
|
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,4 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=t()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="font-weight: normal;",t="font-style: italic;",i=e+t,n="default",o={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},r={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:a,keys:s}=Object,l=e=>t=>[t,function(i){e[t]=i}],c=(e,t)=>a(s(e).map(t));const d=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),u=d()?"color: #A9C7FB;":"color: #135CD2;",f=d()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0-beta.9",m="iframeResizer",h="[iFrameSizer]",g=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),y=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t)),w=e=>e,b=(v=function(t={}){const a={},s=[],d={...o,...t};let u;function f(){s.length=0}function p(){delete d.event,f()}const m=()=>!s.some((([e])=>"error"===e||"warn"===e))&&!!d.collapsed;function h(){if(0!==s.length){console[m()?"groupCollapsed":"group"](`%c${d.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(d)} %c${d.showTime?u:""}`,e,"font-weight: bold;",i);for(const[e,...t]of s)console[e](...t);console.groupEnd(),p()}else p()}function g(){u=function(){const e=new Date,t=(t,i)=>e[t]().toString().padStart(i,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(h)))}function y(e,...t){0===s.length&&g(),s.push([e,...t])}function w(e=n,...t){y("log",`${e}: ${performance.now()-a[e]} ms`,...t)}return{...c(d,l(d)),...c(console,(e=>[e,(...t)=>y(e,...t)])),...c(r,(e=>[e,console[e]])),endAutoGroup:h,purge:f,time:function(e=n){a[e]=performance.now()},timeEnd:function(e=n){w(e),delete a[e]},timeLog:w}},v?.__esModule?v.default:v);var v;let z={},$=!1;const j=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const k=e=>(t,...i)=>z[t]?.console[e](...i),T=(M="log",(e,...t)=>!0===(e=>z[e]?z[e].log:$)(e)?k(M)(e,...t):null);var M;const R=k("info"),S=k("warn"),I=k("event");const E=(e,...t)=>z[e]?z[e].console.warn(y(w)(...t)):queueMicrotask((()=>console?.warn(y((e=>(...t)=>[`${m}(${e})`,...t].join(" "))(e))(...t)))),x=(e=>(t,i="renamed to")=>(n,o,r="",a="")=>e(a,`<rb>Deprecated ${t}(${n.replace("()","")})</>\n\nThe <b>${n}</> ${t.toLowerCase()} has been ${i} <b>${o}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(E),C=x("Function"),O=x("Option"),A=(e,t,i,n)=>e.addEventListener(t,i,n||!1),W=(e,t,i)=>e.removeEventListener(t,i,!1),F=e=>{if(!e)return"";let t=-559038744,i=1103547984;for(let n,o=0;o<e.length;o++)n=e.codePointAt(o),t=Math.imul(t^n,2246822519),i=Math.imul(i^n,3266489917);return t^=Math.imul(t^i>>>15,1935289751),i^=Math.imul(i^t>>>15,3405138345),t^=i>>>16,i^=t>>>16,(2097152*(i>>>0)+(t>>>11)).toString(36)},L=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),N=["<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."],D=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],P=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),H=e=>L(N[e]),B=e=>{const t=e[L("spjluzl")];if(!t)return-1;const i=t.split("-");let n=function(e=""){let t=-2;const i=F(L(e));return i in P&&(t=P[i]),t}(i[0]);return 0===n||(e=>e[2]===F(e[0]+e[1]))(i)||(n=-2),n},q={},J=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,waitForLoad:!1,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof q[e.id].onInit&&(O("init()","onReady()","",e.id),q[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),U={position:null,version:p};function V(e){function i(){ee(M),Q(x),j("onResized",M)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const r=e=>k.slice(k.indexOf(":")+7+e);const a=(e,t)=>(i,n)=>{const o={};var r,a;r=function(){te(`${i} (${e})`,`${e}:${t()}`,n)},o[a=n]||(r(),o[a]=requestAnimationFrame((()=>{o[a]=null})))},s=(e,t)=>()=>{let i=!1;const n=t=>()=>{q[l]?i&&i!==t||(e(t,l),i=t,requestAnimationFrame((()=>{i=!1}))):s()},o=n("scroll"),r=n("resize window");function a(e,i){T(l,`${e} listeners for send${t}`),i(window,"scroll",o),i(window,"resize",r)}function s(){a("Remove ",W),c.disconnect(),d.disconnect()}const l=x,c=new ResizeObserver(n("pageObserver")),d=new ResizeObserver(n("iframeObserver"));a("Add ",A),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),d.observe(q[l].iframe,{attributes:!0,childList:!1,subtree:!1}),q[l]&&(q[l][`stop${t}`]=s)},l=e=>()=>{e in q[x]&&(q[x][e](),delete q[x][e])},c=a("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=M.iframe.getBoundingClientRect(),{scrollY:i,scrollX:n,innerHeight:o,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,o||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:i,scrollLeft:n,documentHeight:a,documentWidth:s,windowHeight:o,windowWidth:r})})),d=a("parentInfo",(function(){const{iframe:e}=M,{scrollWidth:t,scrollHeight:i}=document.documentElement,{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:i},viewport:{width:n,height:o,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),m=s(c,"PageInfo"),g=s(d,"ParentInfo"),y=l("stopPageInfo"),w=l("stopParentInfo");function b(e){const t=e.getBoundingClientRect();return Y(x),{x:Number(t.left)+Number(U.position.x),y:Number(t.top)+Number(U.position.y)}}function v(e){const t=e?b(M.iframe):{x:0,y:0};R(x,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,u,f,u);const i=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(M,t),n=window.parentIframe||window.parentIFrame;n?function(t,i){t["scrollTo"+(e?"Offset":"")](i.x,i.y)}(n,i):function(e){U.position=e,z(x)}(i)}function z(e){const{x:t,y:i}=U.position,n=q[e]?.iframe;!1!==j("onScroll",{iframe:n,top:i,left:t,x:t,y:i})?Q(e):_()}function $(e){let t={};if(0===M.width&&0===M.height){const e=r(9).split(":");t={x:e[1],y:e[0]}}else t={x:M.width,y:M.height};j(e,{iframe:M.iframe,screenX:Number(t.x),screenY:Number(t.y),type:M.type})}const j=(e,t)=>Z(x,e,t);let k=e.data,M={},x=null;"[iFrameResizerChild]Ready"!==k?h===`${k}`.slice(0,13)&&k.slice(13).split(":")[0]in q?(M=function(){const e=k.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=q[e[0]]?.iframe,r=getComputedStyle(i);return{iframe:i,id:e[0],height:t+n(r)+o(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),x=M.id,I(x,M.type),x?(function(e){if(!q[e])throw new Error(`${M.type} No settings for ${e}. Message was: ${k}`)}(x),function(){const e=M.type in{true:1,false:1,undefined:1};return e&&T(x,"Ignoring init message from meta parent page"),e}()||(T(x,`Received: %c${k}`,t),q[x].loaded=!0,(null!==M.iframe||(S(x,`The iframe (${M.id}) was not found.`),0))&&function(){const{origin:t,sameDomain:i}=e;if(i)return!0;let n=q[x]?.checkOrigin;if(n&&"null"!=`${t}`&&!(n.constructor===Array?function(){let e=0,i=!1;for(T(x,`Checking connection is from allowed list of origins: %c${n}`,u);e<n.length;e++)if(n[e]===t){i=!0;break}return i}():function(){const e=q[x]?.remoteHost;return T(x,`Checking connection is from: %c${e}`,u),t===e}()))throw new Error(`Unexpected message received from: ${t} for ${M.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&function(){switch(q[x]?.firstRun&&q[x]&&(q[x].firstRun=!1),M.type){case"close":X(M.iframe);break;case"message":n=r(6),T(x,`onMessage passed: {iframe: %c${M.iframe.id}%c, message: %c${n}}`,u,f,t),j("onMessage",{iframe:M.iframe,message:JSON.parse(n)});break;case"mouseenter":$("onMouseEnter");break;case"mouseleave":$("onMouseLeave");break;case"autoResize":q[x].autoResize=JSON.parse(r(9));break;case"scrollBy":!function(){const e=M.width,t=M.height,i=window.parentIframe||window.parentIFrame||window;R(x,`scrollBy: x: %c${e}%c y: %c${t}`,u,f,u),i.scrollBy(e,t)}();break;case"scrollTo":v(!1);break;case"scrollToOffset":v(!0);break;case"pageInfo":c("start",x),m();break;case"parentInfo":d("start",x),g();break;case"pageInfoStop":y();break;case"parentInfoStop":w();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",i=decodeURIComponent(t);let n=document.getElementById(i)||document.getElementsByName(i)[0];n?function(){const e=b(n);R(x,`Moving to in page link: %c#${t}`,u),U.position={x:e.x,y:e.y},z(x),window.location.hash=t}():window.top!==window.self?function(){const e=window.parentIframe||window.parentIFrame;e?e.moveToAnchor(t):T(x,`In page link #${t} not found and window.parentIframe not found`)}():T(x,`In page link #${t} not found`)}(r(9));break;case"title":!function(e,t){q[t]?.syncTitle&&(q[t].iframe.title=e,R(t,`Set iframe title attribute: %c${e}`,u))}(M.msg,x);break;case"reset":K(M);break;case"init":i(),function(e){try{q[e].sameDomain=!!q[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){q[e].sameDomain=!1}T(e,`sameDomain: %c${q[e].sameDomain}`,u)}(x),(e=M.msg)!==p&&(void 0!==e?T(x,`Version mismatch (Child: %c${e}%c !== Parent: %c${p})`,u,f,u):E(x,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),oe=!0,j("onReady",M.iframe);break;default:if(0===M.width&&0===M.height)return void S(x,`Unsupported message received (${M.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===M.width||0===M.height)return void T(x,"Ignoring message with 0 height or width");if(document.hidden)return void T(x,"Page hidden - ignored resize request");i()}var e,n}())):S("","iframeResizer received messageData without id, message was: ",k)):null!==x&&T(x,"Ignored:",k):Object.keys(q).forEach((e=>{q[e].mode>=0&&te("iFrame requested init",ie(e),e)}))}function Z(e,t,i){let n=null,o=null;if(q[e]){if(n=q[e][t],"function"!=typeof n)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{o=n(i)}catch(i){console.error(i),S(e,`Error in ${t} callback`)}else setTimeout((()=>n(i)))}return o}function G(e){const{id:t}=e;T(t,"Disconnected from iframe"),delete q[t]}function X(e){const{id:t}=e;if(!1!==Z(t,"onClose",t)){T(t,`Removing iFrame: %c${t}`,u);try{e.parentNode&&e.remove()}catch(e){S(t,e)}Z(t,"onClosed",t),G(e)}else T(t,"Close iframe cancelled by onClose event")}function Y(e){null===U.position&&(U.position={x:window.scrollX,y:window.scrollY},T(e,`Get page position: %c${U.position.x}%c, %c${U.position.y}`,u,f,u))}function _(){U.position=null}function Q(e){null!==U.position&&(window.scrollTo(U.position.x,U.position.y),R(e,`Set page position: %c${U.position.x}%c, %c${U.position.y}`,u,f,u),_())}function K(e){T(e.id,"Size reset requested by "+("init"===e.type?"parent page":"child page")),Y(e.id),ee(e),te("reset","reset",e.id)}function ee(e){function t(t){const n=`${e[t]}px`;e.iframe.style[t]=n,R(i,`Set ${t}: %c${n}`,u)}const{id:i}=e,{sizeHeight:n,sizeWidth:o}=q[i];n&&t("height"),o&&t("width")}function te(e,i,n,o){I(n,e),q[n]&&(q[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:o,sameDomain:r,targetOrigin:a}=q[n];if(r)try{return e.contentWindow.iframeChildListener(h+i),T(n,`Sending message to iframe %c${n}%c via sameDomain`,u,f),void T(n,`%c${i}`,t)}catch(e){T(n,"Same domain connection failed. Trying cross domain")}T(n,`Sending message to iframe: %c${n}%c targetOrigin: %c${a}`,u,f,u),T(n,`%c${i}`,t),o.postMessage(h+i,a)}():S(n,`Iframe(${n}) not found`),o&&q[n]?.warningTimeout&&(q[n].msgTimeout=setTimeout((function(){if(void 0===q[n])return;const{iframe:e,loaded:t,loadErrorShown:i,waitForLoad:o}=q[n],{sandbox:r}=e;t||i||(q[n].loadErrorShown=!0,E(n,`<rb>No response from iFrame</>\n \nThe iframe (<i>${n}</>) has not responded within ${q[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${o?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),q[n].warningTimeout)))}function ie(e){const t=q[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,U.version,t.mode].join(":")}z=q;let ne=0,oe=!1,re=!1;const ae=e=>t=>{function i(e){if(!e)return{};if("object"!=typeof e)throw new TypeError("Options is not an object");return("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&E(r,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e}function n(e){const t=q[e]?.iframe?.title;return""===t||void 0===t}const o=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");const r=function(i){if(i&&"string"!=typeof i)throw new TypeError("Invalid id for iFrame. Expected String");return""!==i&&i||(i=function(){let t=e?.id||J.id+ne++;return null!==document.getElementById(t)&&(t+=ne++),t}(),t.id=i,T(i,`Added missing iframe ID: ${i} (${t.src})`)),i}(t.id);return function({enabled:e,iframeId:t}){$=e,z[t]||(z[t]={console:b({label:j(t)})})}({enabled:Object.hasOwn(e,"log")?e.log:J.log,iframeId:r}),"iframeResizer"in t?S(r,`Ignored iframe (${r}), already setup.`):(function(e){var a,s;q[r]={...q[r],iframe:t,firstRun:!0,remoteHost:t?.src.split("/").slice(0,3).join("/"),...J,...i(e),mouseEvents:o(e),mode:B(e),syncTitle:n(r)},I(r,"setup"),function(){const{direction:e}=q[r];if("horizontal"===e)return q[r].sizeWidth=!0,q[r].sizeHeight=!1,void T(r,"Direction: %chorizontal",u);if("none"===e)return q[r].sizeWidth=!1,q[r].sizeHeight=!1,q[r].autoResize=!1,void T(r,"Direction: %cnone",u);if("vertical"!==e)throw new TypeError(r,`Direction value of "${e}" is not valid`);T(r,"Direction: %cvertical",u)}(),(a=e?.offsetSize||e?.offset)&&("vertical"===q[r].direction?(q[r].offsetHeight=a,T(r,`Offset height: %c${a}`,u)):(q[r].offsetWidth=a,T(r,`Offset width: %c${a}`,u))),e?.offset&&E(r,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===q[r].postMessageTarget&&(q[r].postMessageTarget=t.contentWindow),q[r].targetOrigin=!0===q[r].checkOrigin?""===(s=q[r].remoteHost)||null!==s.match(/^(about:blank|javascript:|file:\/\/)/)?"*":s:"*"}(e),function(){const{mode:e}=q[r];e<0&&E("Parent",`${H(e+2)}${H(2)}`),re||e<0||(re=!0,function(e,t){"iframeResizer"in window||(window.iframeResizer={version:e}),!$&&t>0||queueMicrotask((()=>console.info(`%ciframe-resizer ${e}`,"font-weight: bold;")))}(`v${p} (${(e=>L(D[e]))(e)})`,e),e<1&&E("Parent",H(3)))}(),le(),function(){switch(T(r,`Iframe scrolling ${q[r]?.scrolling?"enabled":"disabled"} for ${r}`),t.style.overflow=!1===q[r]?.scrolling?"hidden":"auto",q[r]?.scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=q[r]?q[r].scrolling:"no"}}(),function(){const{bodyMargin:e}=q[r];"number"!=typeof e&&"0"!==e||(q[r].bodyMargin=`${e}px`)}(),function(e){const{id:i}=t,{mode:n,waitForLoad:o}=q[i];-1!==n&&-2!==n&&(A(t,"load",(function(){te("iFrame.onload",`${e}:${oe}`,i,!0),function(){const e=q[r]?.firstRun,i=q[r]?.heightCalculationMethod in g;!e&&i&&K({iframe:t,height:0,width:0,type:"init"})}()})),!1===o&&te("init",`${e}:${oe}`,i,!0))}(ie(r)),function(){if(q[r]){const{iframe:e}=q[r],t={close:X.bind(null,e),disconnect:G.bind(null,e),removeListeners(){E(r,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:te.bind(null,"Window resize","resize",r),moveToAnchor(e){te("Move to anchor",`moveToAnchor:${e}`,r)},sendMessage(e){te("message",`message:${e=JSON.stringify(e)}`,r)}};e.iframeResizer=t,e.iFrameResizer=t}}()),t?.iFrameResizer};function se(){!1===document.hidden&&(T("document","Trigger event: Visibility change"),function(e,t){const i=e=>q[e]?.autoResize&&!q[e]?.firstRun;Object.keys(q).forEach((function(n){i(n)&&te(e,t,n)}))}("Tab Visible","resize"))}const le=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{A(window,"message",V),A(document,"visibilitychange",se),window.iframeParentListener=e=>setTimeout((()=>V({data:e,sameDomain:!0})))})),ce=`[${m}] `;const de=function(){function e(e){switch(!0){case!e:throw new TypeError(`${ce}iframe is not defined`);case!e.tagName:throw new TypeError(`${ce}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${ce}Expected <IFRAME> tag, found <${e.tagName}>`);default:t(e),i.push(e)}}let t,i;return function(n,o){if("undefined"==typeof window)return[];switch(t=ae(n),i=[],typeof o){case"undefined":case"string":document.querySelectorAll(o||"iframe").forEach(e);break;case"object":e(o);break;default:throw new TypeError(`${ce}Unexpected data type (${typeof o})`)}return Object.freeze(i)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){C("iFrameResize()","iframeResize()","","parent"),de(...e)}),de}));
|
|
21
|
-
//# sourceMappingURL=iframeResizer.min.js.map
|
|
20
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).iframeResize=t()}(this,(function(){"use strict";console.info("IFRAME-RESIZER 5\n\nThis package has been split into separate packages for Parent and Child pages. Along with new packages for jQuery, React and Vue.\n\nGoing forward you are advised to use the new separate packages for Parent and Child pages, rather than this combined package.\n\nPlease see https://iframe-resizer.com/upgrade for more details.\n");const e="font-weight: normal;",t=e+"font-style: italic;",n="default",o={collapsed:!1,defaultEvent:void 0,event:void 0,label:"AutoConsoleGroup",showTime:!0},i={profile:0,profileEnd:0,timeStamp:0,trace:0};const{fromEntries:r,keys:a}=Object,s=e=>[e,console[e]],l=e=>t=>[t,function(n){e[t]=n}],c=(e,t)=>r(a(e).map(t));const u=()=>!(typeof window>"u")&&(null==window?void 0:window.matchMedia("(prefers-color-scheme: dark)").matches),d=u()?"color: #A9C7FB;":"color: #135CD2;",f=u()?"color: #E3E3E3;":"color: #1F1F1F;",p="5.4.0",h="iframeResizer",m="[iFrameSizer]",y=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),g=e=>t=>window.chrome?e(t.replaceAll("<br>","\n").replaceAll("<rb>","[31;1m").replaceAll("</>","[m").replaceAll("<b>","[1m").replaceAll("<i>","[3m").replaceAll("<u>","[4m")):e((e=>e.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,""))(t)),w=e=>e,b=(v=function(r={}){const a={},u={},d=[],f={...o,...r};let p;function h(){d.length=0}function m(){delete f.event,h()}const y=()=>!d.some((([e])=>"error"===e||"warn"===e))&&!!f.collapsed;function g(){if(0!==d.length){console[y()?"groupCollapsed":"group"](`%c${f.label}%c ${(e=>{const t=e.event||e.defaultEvent;return t?`${t}`:""})(f)} %c${f.showTime?p:""}`,e,"font-weight: bold;",t);for(const[e,...t]of d)console[e](...t);console.groupEnd(),m()}else m()}function w(){p=function(){const e=new Date,t=(t,n)=>e[t]().toString().padStart(n,"0");return`@ ${t("getHours",2)}:${t("getMinutes",2)}:${t("getSeconds",2)}.${t("getMilliseconds",3)}`}(),queueMicrotask((()=>queueMicrotask(g)))}function b(e,...t){0===d.length&&w(),d.push([e,...t])}function v(e=n,...t){b("log",`${e}: ${performance.now()-a[e]} ms`,...t)}return{...c(f,l(f)),...c(console,(e=>[e,(...t)=>b(e,...t)])),...c(i,s),count:function(e=n){u[e]?u[e]+=1:u[e]=1,b("log",`${e}: ${u[e]}`)},countReset:function(e=n){delete u[e]},endAutoGroup:g,errorBoundary:e=>(...t)=>{let n;try{n=e(...t)}catch(e){b("error",e)}return n},purge:h,time:function(e=n){a[e]=performance.now()},timeEnd:function(e=n){v(e),delete a[e]},timeLog:v}},v?.__esModule?v.default:v);var v;let z={},$=!1;const j=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`;const k=e=>(t,...n)=>z[t]?.console[e](...n),T=(M="info",(e,...t)=>!0===(e=>z[e]?z[e].log:$)(e)?k(M)(e,...t):null);var M;const R=k("warn"),E=k("event");const S=(e,...t)=>z[e]?z[e].console.warn(g(w)(...t)):queueMicrotask((()=>console?.warn(g((e=>(...t)=>[`${h}(${e})`,...t].join(" "))(e))(...t)))),x=(e=>(t,n="renamed to")=>(o,i,r="",a="")=>e(a,`<rb>Deprecated ${t}(${o.replace("()","")})</>\n\nThe <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${i}</>. ${r}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`))(S),I=x("Function"),O=x("Option"),C=(e,t,n,o)=>e.addEventListener(t,n,o||!1),W=(e,t,n)=>e.removeEventListener(t,n,!1),A=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,i=0;i<e.length;i++)o=e.codePointAt(i),t=Math.imul(t^o,2246822519),n=Math.imul(n^o,3266489917);return t^=Math.imul(t^n>>>15,1935289751),n^=Math.imul(n^t>>>15,3405138345),t^=n>>>16,n^=t>>>16,(2097152*(n>>>0)+(t>>>11)).toString(36)},F=e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))),L=["<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."],N=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],B=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)]))),H=e=>F(L[e]),P=e=>{const t=e[F("spjluzl")];if(!t)return-1;const n=t.split("-");let o=function(e=""){let t=-2;const n=A(F(e));return n in B&&(t=B[n]),t}(n[0]);return 0===o||(e=>e[2]===A(e[0]+e[1]))(n)||(o=-2),o},D={},q=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:"vertical",inPageLinks:!1,heightCalculationMethod:"auto",id:"iFrameResizer",log:!1,license:void 0,mouseEvents:!0,offsetHeight:null,offsetWidth:null,postMessageTarget:null,sameDomain:!1,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,waitForLoad:!1,warningTimeout:5e3,widthCalculationMethod:"auto",onClose:()=>!0,onClosed(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{"function"==typeof D[e.id].onInit&&(O("init()","onReady()","",e.id),D[e.id].onInit(e))},onResized(){},onScroll:()=>!0}),J={position:null,version:p};function U(e){function t(){K(M),_(x),$("onResized",M)}function n(e){if("border-box"!==e.boxSizing)return 0;return(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){if("border-box"!==e.boxSizing)return 0;return(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}const i=e=>k.slice(k.indexOf(":")+7+e);const r=(e,t)=>(n,o)=>{const i={};var r,a;r=function(){ee(`${n} (${e})`,`${e}:${t()}`,o)},i[a=o]||(r(),i[a]=requestAnimationFrame((()=>{i[a]=null})))},a=(e,t)=>()=>{let n=!1;const o=t=>()=>{D[l]?n&&n!==t||(e(t,l),n=t,requestAnimationFrame((()=>{n=!1}))):s()},i=o("scroll"),r=o("resize window");function a(e,t){t(window,"scroll",i),t(window,"resize",r)}function s(){a(0,W),c.disconnect(),u.disconnect()}const l=x,c=new ResizeObserver(o("pageObserver")),u=new ResizeObserver(o("iframeObserver"));a(0,C),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),u.observe(D[l].iframe,{attributes:!0,childList:!1,subtree:!1}),D[l]&&(D[l][`stop${t}`]=s)},s=e=>()=>{e in D[x]&&(D[x][e](),delete D[x][e])},l=r("pageInfo",(function(){const e=document.body.getBoundingClientRect(),t=M.iframe.getBoundingClientRect(),{scrollY:n,scrollX:o,innerHeight:i,innerWidth:r}=window,{clientHeight:a,clientWidth:s}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(a,i||0),clientWidth:Math.max(s,r||0),offsetTop:parseInt(t.top-e.top,10),offsetLeft:parseInt(t.left-e.left,10),scrollTop:n,scrollLeft:o,documentHeight:a,documentWidth:s,windowHeight:i,windowWidth:r})})),c=r("parentInfo",(function(){const{iframe:e}=M,{scrollWidth:t,scrollHeight:n}=document.documentElement,{width:o,height:i,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:o,height:i,offsetLeft:r,offsetTop:a,pageLeft:s,pageTop:l,scale:c}})})),u=a(l,"PageInfo"),h=a(c,"ParentInfo"),y=s("stopPageInfo"),g=s("stopParentInfo");function w(e){const t=e.getBoundingClientRect();return X(),{x:Number(t.left)+Number(J.position.x),y:Number(t.top)+Number(J.position.y)}}function b(e){const t=e?w(M.iframe):{x:0,y:0};T(x,`Reposition requested (offset x:%c${t.x}%c y:%c${t.y})`,d,f,d);const n=((e,t)=>({x:e.width+t.x,y:e.height+t.y}))(M,t),o=window.parentIframe||window.parentIFrame;o?function(t,n){t["scrollTo"+(e?"Offset":"")](n.x,n.y)}(o,n):function(e){J.position=e,v(x)}(n)}function v(e){const{x:t,y:n}=J.position,o=D[e]?.iframe;!1!==$("onScroll",{iframe:o,top:n,left:t,x:t,y:n})?_(e):Y()}function z(e){let t={};if(0===M.width&&0===M.height){const e=i(9).split(":");t={x:e[1],y:e[0]}}else t={x:M.width,y:M.height};$(e,{iframe:M.iframe,screenX:Number(t.x),screenY:Number(t.y),type:M.type})}const $=(e,t)=>Z(x,e,t);function j(){switch(D[x]?.firstRun&&D[x]&&(D[x].firstRun=!1),M.type){case"close":G(M.iframe);break;case"message":n=i(6),$("onMessage",{iframe:M.iframe,message:JSON.parse(n)});break;case"mouseenter":z("onMouseEnter");break;case"mouseleave":z("onMouseLeave");break;case"autoResize":D[x].autoResize=JSON.parse(i(9));break;case"scrollBy":!function(){const e=M.width,t=M.height,n=window.parentIframe||window.parentIFrame||window;T(x,`scrollBy: x: %c${e}%c y: %c${t}`,d,f,d),n.scrollBy(e,t)}();break;case"scrollTo":b(!1);break;case"scrollToOffset":b(!0);break;case"pageInfo":l("start",x),u();break;case"parentInfo":c("start",x),h();break;case"pageInfoStop":y();break;case"parentInfoStop":g();break;case"inPageLink":!function(e){const t=e.split("#")[1]||"",n=decodeURIComponent(t);let o=document.getElementById(n)||document.getElementsByName(n)[0];o?function(){const e=w(o);T(x,`Moving to in page link: %c#${t}`,d),J.position={x:e.x,y:e.y},v(x),window.location.hash=t}():window.top!==window.self&&function(){const e=window.parentIframe||window.parentIFrame;e&&e.moveToAnchor(t)}()}(i(9));break;case"title":!function(e,t){D[t]?.syncTitle&&(D[t].iframe.title=e,T(t,`Set iframe title attribute: %c${e}`,d))}(M.msg,x);break;case"reset":Q(M);break;case"init":t(),function(e){try{D[e].sameDomain=!!D[e]?.iframe?.contentWindow?.iframeChildListener}catch(t){D[e].sameDomain=!1}}(x),(e=M.msg)!==p&&(void 0!==e||S(x,"<rb>Legacy version detected in iframe</>\n\nDetected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.\n\nSee <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.\n")),oe=!0,$("onReady",M.iframe);break;default:if(0===M.width&&0===M.height)return void R(x,`Unsupported message received (${M.type}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);if(0===M.width||0===M.height)return;if(document.hidden)return;t()}var e,n}let k=e.data,M={},x=null;"[iFrameResizerChild]Ready"!==k?m===`${k}`.slice(0,13)&&k.slice(13).split(":")[0]in D&&(M=function(){const e=k.slice(13).split(":"),t=e[1]?Number(e[1]):0,i=D[e[0]]?.iframe,r=getComputedStyle(i);return{iframe:i,id:e[0],height:t+n(r)+o(r),width:Number(e[2]),type:e[3],msg:e[4]}}(),x=M.id,x?(E(x,M.type),D[x].errorBoundary((function(){!function(e){if(!D[e])throw new Error(`${M.type} No settings for ${e}. Message was: ${k}`)}(x),M.type in{true:1,false:1,undefined:1}||(D[x].loaded=!0,(null!==M.iframe||(R(x,`The iframe (${M.id}) was not found.`),0))&&function(){const{origin:t,sameDomain:n}=e;if(n)return!0;let o=D[x]?.checkOrigin;if(o&&"null"!=`${t}`&&!(o.constructor===Array?function(){let e=0,n=!1;for(;e<o.length;e++)if(o[e]===t){n=!0;break}return n}():function(){const e=D[x]?.remoteHost;return t===e}()))throw new Error(`Unexpected message received from: ${t} for ${M.iframe.id}. Message was: ${e.data}. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.`);return!0}()&&j())}))()):R("","iframeResizer received messageData without id, message was: ",k)):Object.keys(D).forEach((e=>{D[e].mode>=0&&ee("iFrame requested init",te(e),e)}))}function Z(e,t,n){let o=null,i=null;if(D[e]){if(o=D[e][t],"function"!=typeof o)throw new TypeError(`${t} on iFrame[${e}] is not a function`);if("onClose"===t||"onScroll"===t)try{i=o(n)}catch(n){console.error(n),R(e,`Error in ${t} callback`)}else setTimeout((()=>o(n)))}return i}function V(e){const{id:t}=e;delete D[t]}function G(e){const{id:t}=e;if(!1!==Z(t,"onClose",t)){try{e.parentNode&&e.remove()}catch(e){R(t,e)}Z(t,"onClosed",t),V(e)}}function X(e){null===J.position&&(J.position={x:window.scrollX,y:window.scrollY})}function Y(){J.position=null}function _(e){null!==J.position&&(window.scrollTo(J.position.x,J.position.y),T(e,`Set page position: %c${J.position.x}%c, %c${J.position.y}`,d,f,d),Y())}function Q(e){X(e.id),K(e),ee("reset","reset",e.id)}function K(e){function t(t){const o=`${e[t]}px`;e.iframe.style[t]=o,T(n,`Set ${t}: %c${o}`,d)}const{id:n}=e,{sizeHeight:o,sizeWidth:i}=D[n];o&&t("height"),i&&t("width")}function ee(e,t,n,o){E(n,e),D[n]&&(D[n]?.postMessageTarget?function(){const{iframe:e,postMessageTarget:o,sameDomain:i,targetOrigin:r}=D[n];if(i)try{return void e.contentWindow.iframeChildListener(m+t)}catch(e){}o.postMessage(m+t,r)}():R(n,`Iframe(${n}) not found`),o&&D[n]?.warningTimeout&&(D[n].msgTimeout=setTimeout((function(){if(void 0===D[n])return;const{iframe:e,loaded:t,loadErrorShown:o,waitForLoad:i}=D[n],{sandbox:r}=e;t||o||(D[n].loadErrorShown=!0,S(n,`<rb>No response from iFrame</>\n \nThe iframe (<i>${n}</>) has not responded within ${D[n].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.\n${i?"\nThe <b>waitForLoad</> option is currently set to <i>'true'</>. If the iframe loads before the JavaScript runs, this option will prevent <i>iframe-resizer</> from initialising. To disable this, set the <b>waitForLoad</> option to <i>'false'</>. \n":""}${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"\nThe iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"} \n${!(r?.length>0)||r.contains("allow-scripts")&&r.contains("allow-same-origin")?"":"The iframe has the <b>sandbox</> attribute, please ensure it contains both the <i>'allow-same-origin'</> and <i>'allow-scripts'</> values.\n"}This message can be ignored if everything is working, or you can set the <b>warningTimeout</> option to a higher value or zero to suppress this warning.\n`))}),D[n].warningTimeout)))}function te(e){const t=D[e];return[e,"8",t.sizeWidth,t.log,"32",!0,t.autoResize,t.bodyMargin,t.heightCalculationMethod,t.bodyBackground,t.bodyPadding,t.tolerance,t.inPageLinks,"child",t.widthCalculationMethod,t.mouseEvents,t.offsetHeight,t.offsetWidth,t.sizeHeight,t.license,J.version,t.mode].join(":")}z=D;let ne=0,oe=!1,ie=!1;const re=t=>n=>{function o(e){const{id:t}=n,{mode:o,waitForLoad:i}=D[t];-1!==o&&-2!==o&&(C(n,"load",(function(){ee("iFrame.onload",`${e}:${oe}`,t,!0),function(){const e=D[u]?.firstRun,t=D[u]?.heightCalculationMethod in y;!e&&t&&Q({iframe:n,height:0,width:0,type:"init"})}()})),!1===i&&ee("init",`${e}:${oe}`,t,!0))}function i(e){return e?(("sizeWidth"in e||"sizeHeight"in e||"autoResize"in e)&&S(u,'<rb>Deprecated Option</>\n\nThe <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <i>"vertical"</>, <i>"horizontal"</> or <i>"horizontal"</>.\n'),e):{}}function r(){const{mode:n}=D[u];ie||n>0&&t.vInfoDisable||(ie=!0,function(t,n){queueMicrotask((()=>console.info(`%ciframe-resizer ${t}`,$||n<1?"font-weight: bold;":e)))}(`v${p} (${(e=>F(N[e]))(n)})`,n)),n<0?S("Parent",`${H(n+2)}${H(2)}`):n<1&&S("Parent",H(3))}function a(e){const t=D[e]?.iframe?.title;return""===t||void 0===t}const s=e=>Object.hasOwn(e,"onMouseEnter")||Object.hasOwn(e,"onMouseLeave");function l(e){var t,o;D[u]={...D[u],iframe:n,firstRun:!0,remoteHost:n?.src.split("/").slice(0,3).join("/"),...q,...i(e),mouseEvents:s(e),mode:P(e),syncTitle:a(u)},E(u,"setup"),function(){const{direction:e}=D[u];if("horizontal"===e)return D[u].sizeWidth=!0,void(D[u].sizeHeight=!1);if("none"===e)return D[u].sizeWidth=!1,D[u].sizeHeight=!1,void(D[u].autoResize=!1);if("vertical"!==e)throw new TypeError(u,`Direction value of "${e}" is not valid`)}(),(t=e?.offsetSize||e?.offset)&&("vertical"===D[u].direction?D[u].offsetHeight=t:D[u].offsetWidth=t),e?.offset&&S(u,"<rb>Deprecated option</>\n\n The <b>offset</> option has been renamed to <b>offsetSize</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>."),null===D[u].postMessageTarget&&(D[u].postMessageTarget=n.contentWindow),D[u].targetOrigin=!0===D[u].checkOrigin?""===(o=D[u].remoteHost)||null!==o.match(/^(about:blank|javascript:|file:\/\/)/)?"*":o:"*"}const c=()=>"iframeResizer"in n,u=function(e){if(e&&"string"!=typeof e)throw new TypeError("Invalid id for iFrame. Expected String");return""!==e&&e||(e=function(){let e=t?.id||q.id+ne++;return null!==document.getElementById(e)&&(e+=ne++),e}(),n.id=e),e}(n.id);if("object"!=typeof t)throw new TypeError("Options is not an object");return function(e){-1===e?.log&&(e.log=!1,e.vInfoDisable=!0)}(t),function({enabled:e,iframeId:t}){const n=b({label:j(t)});$=e,z[t]||(z[t]={console:n,errorBoundary:n.errorBoundary})}({enabled:Object.hasOwn(t,"log")?t.log:q.log,iframeId:u}),D[u].errorBoundary((function(e){c()?R(u,`Ignored iframe (${u}), already setup.`):(l(e),r(),se(),function(){switch(n.style.overflow=!1===D[u]?.scrolling?"hidden":"auto",D[u]?.scrolling){case"omit":break;case!0:n.scrolling="yes";break;case!1:n.scrolling="no";break;default:n.scrolling=D[u]?D[u].scrolling:"no"}}(),function(){const{bodyMargin:e}=D[u];"number"!=typeof e&&"0"!==e||(D[u].bodyMargin=`${e}px`)}(),o(te(u)),function(){if(D[u]){const{iframe:e}=D[u],t={close:G.bind(null,e),disconnect:V.bind(null,e),removeListeners(){S(u,"\n<rb>Deprecated Method Name</>\n\nThe [removeListeners()</> method has been renamed to [disconnect()</>.\n"),this.disconnect()},resize:ee.bind(null,"Window resize","resize",u),moveToAnchor(e){ee("Move to anchor",`moveToAnchor:${e}`,u)},sendMessage(e){ee("message",`message:${e=JSON.stringify(e)}`,u)}};e.iframeResizer=t,e.iFrameResizer=t}}())}))(t),n?.iFrameResizer};function ae(){!1===document.hidden&&function(e,t){const n=e=>D[e]?.autoResize&&!D[e]?.firstRun;Object.keys(D).forEach((function(o){n(o)&&ee(e,t,o)}))}("Tab Visible","resize")}const se=(e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}})((()=>{C(window,"message",U),C(document,"visibilitychange",ae),window.iframeParentListener=e=>setTimeout((()=>U({data:e,sameDomain:!0})))})),le=`[${h}] `;const ce=function(){function e(e){switch(!0){case!e:throw new TypeError(`${le}iframe is not defined`);case!e.tagName:throw new TypeError(`${le}Not a valid DOM element`);case"IFRAME"!==e.tagName.toUpperCase():throw new TypeError(`${le}Expected <IFRAME> tag, found <${e.tagName}>`);default:t(e),n.push(e)}}let t,n;return function(o,i){if("undefined"==typeof window)return[];switch(t=re(o),n=[],typeof i){case"undefined":case"string":document.querySelectorAll(i||"iframe").forEach(e);break;case"object":e(i);break;default:throw new TypeError(`${le}Unexpected data type (${typeof i})`)}return Object.freeze(n)}}();return"undefined"!=typeof window&&(window.iFrameResize=window.iFrameResize||function(...e){I("iFrameResize()","iframeResize()","","parent"),ce(...e)}),ce}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iframe-resizer",
|
|
3
|
-
"version": "5.4.0
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"homepage": "https://iframe-resizer.com",
|
|
6
6
|
"author": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"legacy"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@iframe-resizer/child": "5.4.0
|
|
42
|
-
"@iframe-resizer/jquery": "5.4.0
|
|
43
|
-
"@iframe-resizer/parent": "5.4.0
|
|
41
|
+
"@iframe-resizer/child": "5.4.0",
|
|
42
|
+
"@iframe-resizer/jquery": "5.4.0",
|
|
43
|
+
"@iframe-resizer/parent": "5.4.0"
|
|
44
44
|
}
|
|
45
45
|
}
|