@iframe-resizer/core 6.0.0-beta.2 → 6.0.0-beta.4

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.umd.js CHANGED
@@ -1,38 +1,27 @@
1
- (function(b,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("auto-console-group")):typeof define=="function"&&define.amd?define(["exports","auto-console-group"],r):(b=typeof globalThis<"u"?globalThis:b||self,r(b.connectResizer={},b.acg))})(this,(function(b,r){"use strict";const G="6.0.0-beta.2",te="iframeResizer",Je="[iFrameResizerChild]Ready",ne="autoResize",Ye="beforeUnload",Xe="close",Ke="inPageLink",H="init",oe="iframeReady",Qe="lazy",F="load",M="message",et="mouseenter",tt="mouseleave",ie="onload",se="pageInfo",re="parentInfo",nt="pageInfoStop",ot="parentInfoStop",D="reset",B="resize",it="scrollBy",st="scrollTo",rt="scrollToOffset",lt="title",ct="height",at="width",ut="offset",ft="offsetSize",le="scroll",pt="hidden",ht="child",W="parent",U="string",dt="number",ce="object",ae="function",V="auto",yt="font-weight: bold;",ue="none",fe="both",P="vertical",pe="horizontal",gt="omit",mt=M.length,N="[iFrameSizer]",q=N.length,bt=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),he=Object.freeze({[ie]:1,[H]:1,[oe]:1}),R="expanded",k="collapsed",Z=0,J=1,Y=2,vt=Object.freeze({[R]:1,[k]:1}),de="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",ye=e=>typeof e===ce&&e!==null,X=e=>typeof e===U;function zt(e){if(!ye(e))return!1;try{return e.tagName==="IFRAME"||e instanceof HTMLIFrameElement}catch{return!1}}const wt=(e,...t)=>setTimeout(()=>e(...t),0),It=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},Et=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),$=(e,t)=>Object.hasOwn?Object.hasOwn(e,t):Et(e,t),Tt=e=>e,Ot=e=>e.charAt(0).toUpperCase()+e.slice(1),Lt=e=>e?.__esModule?e.default:e,Ht=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Ot(t)}`)},Rt=e=>(t,n="renamed to")=>(o,s,c="",l="")=>e(l,`<rb>Deprecated ${t}(${o.replace("()","")})</>
2
-
3
- The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${s}</>. ${c}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),ge={br:`
4
- `,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},kt=Object.keys(ge),St=new RegExp(`<(${kt.join("|")})>`,"gi"),Mt=(e,t)=>ge[t]??"",$t=e=>e.replace(St,Mt),At=e=>e.replaceAll("<br>",`
5
- `).replaceAll(/<\/?[^>]+>/gi,""),me=e=>t=>e(X(t)?window.chrome?$t(t):At(t):t),i={},be=Lt(r);let K=!0;const jt=be({expand:!1,label:W}),Gt=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,Pt=e=>i[e]?i[e].log:K;function Nt({enabled:e,expand:t,iframeId:n}){const o=be({expand:t,label:Gt(n)});K=e,i[n]||(i[n]={console:o})}const I=e=>(t,...n)=>i[t]?i[t].console[e](...n):jt[e](...n),ve=e=>(t,...n)=>Pt(t)===!0?I(e)(t,...n):null,u=ve("log"),m=u,Ct=ve("debug"),z=I("warn"),_t=I("error"),v=I("event"),xt=I("purge"),Ft=I("endAutoGroup"),ze=I("errorBoundary");function Dt(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,K||t<1?yt:r.NORMAL))}const Bt=e=>(...t)=>[`${te}(${e})`,...t].join(" "),Wt=me(Tt),g=(e,...t)=>i[e]?i[e].console.warn(...t.map(Wt)):queueMicrotask(()=>{const n=me(Bt(e));console?.warn(...t.map(n))}),Ut=Rt(g)("Option"),C=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:P,firstRun:!0,inPageLinks:!1,heightCalculationMethod:V,id:"iFrameResizer",log:!1,logExpand:!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:V,onBeforeClose:()=>!0,onAfterClose(){},onInit:!1,onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady:e=>{typeof i[e.id].onInit===ae&&(Ut("init()","onReady()","",e.id),i[e.id].onInit(e))},onResized(){},onScroll:()=>!0});let we=0;function Vt(e){const t=e?.id||C.id+we++;return document.getElementById(t)===null?t:`${t}${we++}`}function qt(e,t){let{id:n}=e;if(n&&!X(n))throw new TypeError("Invalid id for iFrame. Expected String");return(!n||n==="")&&(n=Vt(t),e.id=n,v(n,"assignId"),u(n,`Added missing iframe ID: ${n} (${e.src})`)),n}function Zt(e){const{search:t}=window.location;if(t.includes("ifrlog"))switch(new URLSearchParams(t).get("ifrlog")){case String(Z):{e.log=!1;break}case R:case String(Y):{e.log=R;break}case k:case String(J):{e.log=k;break}default:e.log=k}}const A=(e,t,n,o)=>e.addEventListener(t,n,o||!1),Ie=(e,t,n)=>e.removeEventListener(t,n,!1),Jt=e=>e.split(":").filter((t,n)=>n!==19).join(":");function Yt(e,t,n){function o(f){const p=e in he?Jt(t):t;m(n,f,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),m(n,`Message data: %c${p}`,r.HIGHLIGHT)}const{iframe:s,postMessageTarget:c,sameOrigin:l,targetOrigin:a}=i[n];if(l)try{s.contentWindow.iframeChildListener(N+t),o(`Sending message to iframe %c${n}%c via same origin%c`);return}catch{e in he?(i[n].sameOrigin=!1,u(n,"New iframe does not support same origin")):z(n,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${n}%c targetOrigin: %c${a.join(", ")}`);for(const f of a)c.postMessage(N+t,f)}function E(e,t,n){if(v(n,e),!i[n]?.postMessageTarget){z(n,"Iframe not found");return}Yt(e,t,n)}const Xt=(e,t)=>Object.values(i).filter(({autoResize:n,firstRun:o})=>n&&!o).forEach(({iframe:n})=>E(e,t,n.id));function Kt(){document.hidden!==!0&&Xt("tabVisible",B)}function Qt(e){if(e.boxSizing!=="border-box")return 0;const t=e.paddingTop?parseInt(e.paddingTop,10):0,n=e.paddingBottom?parseInt(e.paddingBottom,10):0;return t+n}function en(e){if(e.boxSizing!=="border-box")return 0;const t=e.borderTopWidth?parseInt(e.borderTopWidth,10):0,n=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0;return t+n}function tn(e){const t=e.slice(q).split(":"),n=t[1]?Number(t[1]):0,o=i[t[0]]?.iframe,s=o?getComputedStyle(o):null,c=s?Qt(s)+en(s):0,l={iframe:o,id:t[0],height:n+c,width:Number(t[2]),type:t[3],msg:t[4],message:t[4]};return t[5]&&(l.mode=t[5]),l}const nn={true:1,false:1,undefined:1};function on(e){const{id:t,msg:n,iframe:o}=e,s=zt(o);return s||(u(t,`Received: %c${n}`,r.HIGHLIGHT),z(t,"The target iframe was not found.")),s}function sn(e,t){const{id:n}=e,{data:o,origin:s}=t;if("sameOrigin"in t&&t.sameOrigin)return!0;const l=i[n]?.checkOrigin;function a(){function f(){u(n,`Checking connection is from allowed list of origins: %c${l}`,r.HIGHLIGHT);for(const h of l)if(h===s)return!0;return!1}function p(){const h=i[n]?.remoteHost;return u(n,`Checking connection is from: %c${h}`,r.HIGHLIGHT),s===h}return l.constructor===Array?f():p()}if(l&&`${s}`!="null"&&!a())throw new Error(`Unexpected message received from: ${s} for ${n}. Message was: ${o}. This error can be disabled by setting the checkOrigin: false option or by providing an array of trusted domains.`);return!0}const rn=e=>N===`${e}`.slice(0,q)&&e.slice(q).split(":")[0]in i;function ln(e){const{id:t,type:n}=e,o=n in nn;return o&&u(t,"Ignoring init message from meta parent page"),o}function cn(e){try{i[e].sameOrigin=!!i[e]?.iframe?.contentWindow?.iframeChildListener}catch{i[e].sameOrigin=!1}u(e,`sameOrigin: %c${i[e].sameOrigin}`,r.HIGHLIGHT)}function an(e,t){if(t!==G){if(t===void 0){g(e,`<rb>Legacy version detected in iframe</>
1
+ (function(m,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@iframe-resizer/common/consts"),require("@iframe-resizer/common/utils"),require("@iframe-resizer/common/deprecate"),require("@iframe-resizer/common/format-advise"),require("auto-console-group"),require("@iframe-resizer/common/listeners"),require("@iframe-resizer/common/mode")):typeof define=="function"&&define.amd?define(["exports","@iframe-resizer/common/consts","@iframe-resizer/common/utils","@iframe-resizer/common/deprecate","@iframe-resizer/common/format-advise","auto-console-group","@iframe-resizer/common/listeners","@iframe-resizer/common/mode"],i):(m=typeof globalThis<"u"?globalThis:m||self,i(m.connectResizer={},m.consts,m.utils,m.deprecate,m.createFormatAdvise,m.acg,m.listeners,m.setMode))})(this,(function(m,i,p,fe,D,s,H,T){"use strict";const r={},_=p.esModuleInterop(s);let P=!0;const ue=_({expand:!1,label:i.PARENT}),le=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,de=e=>r[e]?r[e].log:P;function ge({enabled:e,expand:n,iframeId:t}){const o=_({expand:n,label:le(t)});P=e,r[t]||(r[t]={console:o})}const S=e=>(n,...t)=>r[n]?r[n].console[e](...t):ue[e](...t),z=e=>(n,...t)=>de(n)===!0?S(e)(n,...t):null,u=z("log"),O=u,me=z("debug"),L=S("warn"),he=S("error"),w=S("event"),Ee=S("purge"),pe=S("endAutoGroup"),C=S("errorBoundary");function Ie(e,n){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,P||n<1?i.BOLD:s.NORMAL))}const Oe=e=>(...n)=>[`${i.LABEL}(${e})`,...n].join(" "),be=D(p.id),b=(e,...n)=>r[e]?r[e].console.warn(...n.map(be)):queueMicrotask(()=>{const t=D(Oe(e));console?.warn(...n.map(t))}),$=fe(b);$("Function"),$("Method"),$("Option");const y=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyPadding:null,checkOrigin:!0,direction:i.VERTICAL,firstRun:!0,inPageLinks:!1,heightCalculationMethod:i.AUTO,id:"iframeResizer",log:!1,logExpand:!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:i.AUTO,onBeforeClose:()=>!0,onAfterClose(){},onMessage:null,onMouseEnter(){},onMouseLeave(){},onReady(){},onResized(){},onScroll:()=>!0});let F=0;function Te(e){const n=e?.id||y.id+F++;return document.getElementById(n)===null?n:`${n}${F++}`}function we(e,n){let{id:t}=e;if(t&&!p.isString(t))throw new TypeError("Invalid id for iframe. Expected String");return(!t||t==="")&&(t=Te(n),e.id=t,w(t,"assignId"),u(t,`Added missing iframe ID: ${t} (${e.src})`)),t}function Le(e){const{search:n}=window.location;if(n.includes("ifrlog"))switch(new URLSearchParams(n).get("ifrlog")){case String(i.LOG_DISABLED):{e.log=!1;break}case i.EXPAND:case String(i.LOG_EXPANDED):{e.log=i.EXPAND;break}case i.COLLAPSE:case String(i.LOG_COLLAPSED):{e.log=i.COLLAPSE;break}default:e.log=i.COLLAPSE}}const He=e=>e.split(i.SEPARATOR).filter((n,t)=>t!==19).join(i.SEPARATOR);function Se(e,n,t){function o(d){const g=e in i.INIT_EVENTS?He(n):n;O(t,d,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),O(t,`Message data: %c${g}`,s.HIGHLIGHT)}const{iframe:a,postMessageTarget:l,sameOrigin:c,targetOrigin:f}=r[t];if(c)try{a.contentWindow.iframeChildListener(i.MESSAGE_ID+n),o(`Sending message to iframe %c${t}%c via same origin%c`);return}catch{e in i.INIT_EVENTS?(r[t].sameOrigin=!1,u(t,"New iframe does not support same origin")):L(t,"Same origin messaging failed, falling back to postMessage")}o(`Sending message to iframe: %c${t}%c targetOrigin: %c${f.join(", ")}`);for(const d of f)l.postMessage(i.MESSAGE_ID+n,d)}function G(e,n,t){if(w(t,e),!r[t]?.postMessageTarget){L(t,"Iframe not found");return}Se(e,n,t)}const Re=(e,n)=>Object.values(r).filter(({autoResize:t,firstRun:o})=>t&&!o).forEach(({iframe:t})=>G(e,n,t.id));function Ae(){document.hidden!==!0&&Re("tabVisible",i.RESIZE)}function Ge(e){if(e.boxSizing!=="border-box")return 0;const n=e.paddingTop?parseInt(e.paddingTop,10):0,t=e.paddingBottom?parseInt(e.paddingBottom,10):0;return n+t}function Me(e){if(e.boxSizing!=="border-box")return 0;const n=e.borderTopWidth?parseInt(e.borderTopWidth,10):0,t=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0;return n+t}function ye(e){const n=e.slice(i.MESSAGE_ID_LENGTH).split(":"),t=n[1]?Number(n[1]):0,o=r[n[0]]?.iframe,a=o?getComputedStyle(o):null,l=a?Ge(a)+Me(a):0,c={iframe:o,id:n[0],height:t+l,width:Number(n[2]),type:n[3],msg:n[4],message:n[4]};return n[5]&&(c.mode=n[5]),c}const Ne={true:1,false:1,undefined:1};function Pe(e){const{id:n,msg:t,iframe:o}=e,a=p.isIframe(o);return a||(u(n,`Received: %c${t}`,s.HIGHLIGHT),L(n,"The target iframe was not found.")),a}function $e(e,n){const{id:t}=e,{data:o,origin:a}=n;if("sameOrigin"in n&&n.sameOrigin)return!0;const c=r[t]?.checkOrigin;function f(){function d(){u(t,`Checking connection is from allowed list of origins: %c${c}`,s.HIGHLIGHT);for(const h of c)if(h===a)return!0;return!1}function g(){const h=r[t]?.remoteHost;return u(t,`Checking connection is from: %c${h}`,s.HIGHLIGHT),a===h}return c.constructor===Array?d():g()}if(c&&`${a}`!="null"&&!f())throw new Error(`Unexpected message received from: ${a} for ${t}. Message was: ${o}. This error can be disabled by setting the checkOrigin: false option or by providing an array of trusted domains.`);return!0}const ve=e=>i.MESSAGE_ID===`${e}`.slice(0,i.MESSAGE_ID_LENGTH)&&e.slice(i.MESSAGE_ID_LENGTH).split(":")[0]in r;function ke(e){const{id:n,type:t}=e,o=t in Ne;return o&&u(n,"Ignoring init message from meta parent page"),o}function De(e){try{r[e].sameOrigin=!!r[e]?.iframe?.contentWindow?.iframeChildListener}catch{r[e].sameOrigin=!1}u(e,`sameOrigin: %c${r[e].sameOrigin}`,s.HIGHLIGHT)}function _e(e,n){if(n!==i.VERSION){if(n===void 0){b(e,`<rb>Legacy version detected in iframe</>
6
2
 
7
3
  Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
8
4
 
9
5
  See <u>https://iframe-resizer.com/setup/#child-page-setup</> for more details.
10
- `);return}u(e,`Version mismatch (Child: %c${t}%c !== Parent: %c${G})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT)}}function T(e,t,n){if(!i[e])return null;const o=i[e][t];if(typeof o!==ae)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return wt(o,n);try{return o(n)}catch(s){return console.error(s),z(e,`Error in ${t} callback`),null}}function un(e,t){const{id:n,iframe:o}=e;u(n,`onMessage passed: {iframe: %c${n}%c, message: %c${t}%c}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT,r.FOREGROUND),T(n,"onMessage",{iframe:o,message:JSON.parse(t)})}function _(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(":")+mt+t)}function Ee(e,t){const{id:n,iframe:o,height:s,type:c,width:l}=t;let a={x:0,y:0};if(l===0&&s===0){const f=_(n,9).split(":");a={x:f[1],y:f[0]}}else a={x:l,y:s};T(n,e,{iframe:o,screenX:Number(a.x),screenY:Number(a.y),type:c})}const d={position:null,version:G};function Te(){d.position=null}const fn=()=>d.position;function pn(e){d.position=e}function Oe(e){return d.position===null&&(d.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${d.position.x}%c, %c${d.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),d.position}function Le(e){d.position!==null&&(window.scrollTo(d.position.x,d.position.y),m(e,`Set page position: %c${d.position.x}%c, %c${d.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),Te())}function He(e,t){const{id:n}=t,o=`${t[e]}px`;i[n].iframe.style[e]=o,m(n,`Set ${e}: %c${o}`,r.HIGHLIGHT)}function Re(e){const{id:t}=e,{sizeHeight:n,sizeWidth:o}=i[t];n&&He(ct,e),o&&He(at,e)}function ke(e){const{id:t}=e;Re(e),Le(t),T(t,"onResized",e)}function Se(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function Me(e){const{id:t}=e;if(T(t,"onBeforeClose",t)===!1){u(t,"Close iframe cancelled by onBeforeClose");return}u(t,`Removing iFrame: %c${t}`,r.HIGHLIGHT);try{e.parentNode&&e.remove()}catch(n){z(t,n)}T(t,"onAfterClose",t),Se(e)}function $e(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===H?"parent page":"child page"}`),Oe(t),Re(e),E(D,D,t)}const Ae=(e,t)=>{const n={};return(o,s)=>{const{iframe:c}=i[s];function l(f,p){n[p]||(f(),n[p]=requestAnimationFrame(()=>{n[p]=null}))}function a(){E(`${o} (${e})`,`${e}:${t(c)}`,s)}l(a,s)}},je=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},Ge=((e,t)=>n=>{let o=!1;const s=y=>()=>{i[n]?(!o||o===y)&&(e(y,n),o=y,requestAnimationFrame(()=>{o=!1})):h()},c=s(le),l=s("resize window"),a=new ResizeObserver(s("pageObserver")),f=new ResizeObserver(s("iframeObserver"));function p(y,L){u(n,`${y}listeners for send${t}`),L(window,le,c),L(window,B,l)}function h(){v(n,`stop${t}`),p("Remove ",Ie),a.disconnect(),f.disconnect(),i[n]&&Ie(i[n].iframe,F,h)}function S(){p("Add ",A),a.observe(document.body),f.observe(i[n].iframe)}i[n]&&(i[n][`stop${t}`]=h,A(i[n].iframe,F,h),S())});function hn(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:o,scrollX:s,innerHeight:c,innerWidth:l}=window,{clientHeight:a,clientWidth:f}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(a,c||0),clientWidth:Math.max(f,l||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:o,scrollLeft:s,documentHeight:a,documentWidth:f,windowHeight:c,windowWidth:l})}const dn=Ae(se,hn),yn=Ge(dn,"PageInfo"),gn=je("stopPageInfo");function mn(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,o=typeof window<"u"&&window.visualViewport?window.visualViewport:{},{width:s=0,height:c=0,offsetLeft:l=0,offsetTop:a=0,pageLeft:f=0,pageTop:p=0,scale:h=1}=o;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:s,height:c,offsetLeft:l,offsetTop:a,pageLeft:f,pageTop:p,scale:h}})}const bn=Ae(re,mn),vn=Ge(bn,"ParentInfo"),zn=je("stopParentInfo");function Pe(e){const t=e.getBoundingClientRect(),n=Oe(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function Ne(e){const{x:t,y:n}=fn(),o=i[e]?.iframe;if(T(e,"onScroll",{iframe:o,top:n,left:t,x:t,y:n})===!1){Te();return}Le(e)}function wn(e){const{id:t,height:n,width:o}=e,s=window.parentIframe||window.parentIFrame||window;m(t,`scrollBy: x: %c${o}%c y: %c${n}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),s.scrollBy(o,n)}const Ce=e=>t=>{const{id:n,iframe:o,height:s,width:c}=t;function l(y){pn(y),Ne(n)}function a(y,L){y[`scrollTo${e?"Offset":""}`](L.x,L.y)}const f=y=>({x:c+y.x,y:s+y.y}),p=e?Pe(o):{x:0,y:0},h=f(p),S=window.parentIframe||window.parentIFrame;m(n,`Reposition requested (offset x:%c${p.x}%c y:%c${p.y})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),S?a(S,h):l(h)},In=Ce(!1),En=Ce(!0);function Tn(e,t,n){const{x:o,y:s}=Pe(n);m(e,`Moving to in page link: %c#${t}`,r.HIGHLIGHT),d.position={x:o,y:s},Ne(e),window.location.hash=t}function On(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function Ln(e,t){const n=t.split("#")[1]||"",o=decodeURIComponent(n),s=document.getElementById(o)||document.getElementsByName(o)[0];if(s){Tn(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}On(e,n)}function Hn(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function Rn(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,m(e,`Set iframe title attribute: %c${t}`,r.HIGHLIGHT))}const x=e=>{if(!e)return"";let t=-559038744,n=1103547984;for(let o,s=0;s<e.length;s++)o=e.codePointAt(s),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)},w=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),kn=new Date,_e=e=>new Set(Array.from({length:9},e)),xe=" - lewpylk",j=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Sn=["<yi>Puchspk Spjluzl Rlf</><iy><iy>","<yi>Tpzzpun Spjluzl Rlf</><iy><iy>","Aopz spiyhyf pz hchpshisl dpao ivao Jvttlyjphs huk Vwlu-Zvbyjl spjluzlz.<iy><iy><i>Jvttlyjphs Spjluzl</><iy>Mvy jvttlyjphs bzl, <p>pmyhtl-ylzpgly</> ylxbpylz h svd jvza vul aptl spjluzl mll. Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.<iy><iy><i>Vwlu Zvbyjl Spjluzl</><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-jvttlyjphs vwlu zvbyjl wyvqlja aolu fvb jhu bzl pa mvy myll bukly aol alytz vm aol NWS C3 Spjluzl. Av jvumpyt fvb hjjlwa aolzl alytz, wslhzl zla aol <i>spjluzl</> rlf pu <p>pmyhtl-ylzpgly</> vwapvuz av <i>NWSc3</>.<iy><iy>Mvy tvyl pumvythapvu wslhzl zll: <b>oaawz://pmyhtl-ylzpgly.jvt/nws</>","<i>NWSc3 Spjluzl Clyzpvu</><iy><iy>Aopz clyzpvu vm <p>pmyhtl-ylzpgly</> pz ilpun bzlk bukly aol alytz vm aol <i>NWS C3</> spjluzl. Aopz spjluzl hssvdz fvb av bzl <p>pmyhtl-ylzpgly</> pu Vwlu Zvbyjl wyvqljaz, iba pa ylxbpylz fvby wyvqlja av il wbispj, wyvcpkl haaypibapvu huk il spjluzlk bukly clyzpvu 3 vy shaly vm aol NUB Nlulyhs Wbispj Spjluzl.<iy><iy>Pm fvb hyl bzpun aopz spiyhyf pu h uvu-vwlu zvbyjl wyvqlja vy dlizpal, fvb dpss ullk av wbyjohzl h svd jvza vul aptl jvttlyjphs spjluzl.<iy><iy>Mvy tvyl pumvythapvu cpzpa <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</>.","<iy><yi>Zvsv spjluzl kvlz uva zbwwvya jyvzz-kvthpu</><iy><iy>Av bzl <p>pmyhtl-ylzpgly</> dpao jyvzz kvthpu pmyhtlz fvb ullk lpaoly aol Wyvmlzzpvuhs vy Ibzpulzz spjluzlz. Mvy klahpsz vu bwnyhkl wypjpun wslhzl jvuahja pumv@pmyhtl-ylzpgly.jvt.","Pu whnl spurpun ylxbpylz h Wyvmlzzpvuhs vy Ibzpulzz spjluzl. Wslhzl zll <b>oaawz://pmyhtl-ylzpgly.jvt/wypjpun</> mvy tvyl klahpsz.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.</><iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> fvb jhu bzl aol <i>mpyza 11 johyhjalyz vm fvb spjluzl rlf</> av nla h 60% kpzjvbua ha oaawz://pmyhtl-ylzpgly.jvt/wypjpun.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Fvb hyl jbyyluasf bzpun h spjluzl rlf mvy aol wylcpvbz clyzpvu vm <p>pmyhtl-ylzpgly</>.<iy><iy>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz.","<yi> VLT rlf lewpylk</><iy><iy>Aol spjluzl rlf fvb hyl bzpun mvy <p>pmyhtl-ylzpgly</> pz myvt h wypvy flhy huk ohz lewpylk. Hu bwkhalk rlf pz ylslhzlk vu aol mpyza vm Uvcltily lhjo flhy.<iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt oaawz://pmyhtl-ylzpgly.jvt/tf-vyklyz."],Mn=e=>[e[0],...e.slice(1).map(t=>`${t}${xe}`),`${e[4]}${xe}`,...e.slice(1)],$n=Mn(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),Fe=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),De=kn[w(j[4])](),An=_e((e,t)=>x(`${De+t}`)),jn=_e((e,t)=>x(`${De-++t}`)),Gn=e=>An.has(e)?9:jn.has(e)?5:-2,O=e=>w(Sn[e]),Pn=e=>w($n[e]),Nn=e=>{const t=e[w(j[0])]||e[w(j[1])]||e[w(j[2])]||e[w(j[3])];if(!t)return-1;const n=t.split("-");let o=(function(s="",c=""){let l=-2;const a=x(w(s));return a in Fe&&(l=Fe[a]),l===9?Gn(c):l})(...n);return o===0||(s=>s[2]===x(s[0]+s[1]))(n)||(o=-2),o};let Q=!1,Be=!1;function We(e,t=-3){if(Q)return;const n=Math.max(i[e].mode,t);if(n>i[e].mode&&(i[e].mode=n),n<0)throw xt(e),i[e].vAdvised||g(e||"Parent",`${O(n+2)}${O(2)}`),i[e].vAdvised=!0,O(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(n>5&&Be||Dt(`v${G} (${Pn(n)})`,n),n){case 1:case 2:case 3:g("Parent",O(6));break;case 4:g("Parent",O(7));break;case 5:g("Parent",O(8));break;default:n<1&&g("Parent",O(3))}Q=!0}function Cn(e){if(Q)return;const{mode:t}=i[e];t>5&&We(e,t)}function _n(e){e?.log===-1&&(e.log=!1,Be=!0)}function xn(e,t){i[e]&&(u(e,`First run for ${e}`),We(e,t===void 0?void 0:Number(t)),i[e].firstRun=!1)}function Fn(e){const{height:t,id:n,iframe:o,mode:s,message:c,type:l,width:a}=e,{lastMessage:f}=i[n];switch(i[n]?.firstRun&&xn(n,s),u(n,`Received: %c${f}`,r.HIGHLIGHT),l){case ne:i[n].autoResize=JSON.parse(_(n,9));break;case Ye:m(n,"Ready state reset"),i[n].initialised=!1;break;case Xe:Me(o);break;case Ke:Ln(n,_(n,9));break;case H:ke(e),cn(n),an(n,c),i[n].initialised=!0,T(n,"onReady",o);break;case M:un(e,_(n,6));break;case et:Ee("onMouseEnter",e);break;case tt:Ee("onMouseLeave",e);break;case se:yn(n);break;case re:vn(n);break;case nt:gn(n);break;case ot:zn(n);break;case D:$e(e);break;case it:wn(e);break;case st:In(e);break;case rt:En(e);break;case lt:Rn(n,c);break;default:if(a===0&&t===0){z(n,`Unsupported message received (${l}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);return}if(a===0||t===0){u(n,"Ignoring message with 0 height or width");return}if(document.hidden){u(n,"Page hidden - ignored resize request");return}ke(e)}}const Dn=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},Bn=e=>Object.values(i).forEach(Dn(e));function Ue(e){const t=e.data;if(t===Je){Bn(e.source);return}if(!rn(t)){if(typeof t!==U)return;v(W,"ignoredMessage"),Ct(W,t);return}const n=tn(t),{id:o,type:s}=n;switch(v(o,s),!0){case!i[o]:throw new Error(`${s} No settings for ${o}. Message was: ${t}`);case!on(n):case ln(n):case!sn(n,e):return;default:i[o].lastMessage=e.data,ze(o,Fn)(n)}}const Wn=It(()=>{A(window,M,Ue),A(document,"visibilitychange",Kt),window.iframeParentListener=e=>setTimeout(()=>Ue({data:e,sameOrigin:!0}))}),Ve={};function Un(e){if(Ve[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;Ve[e]=!0;const n=Array.from(t).flatMap(o=>[`
11
- `,o,`
12
- `]);return g(e,`<rb>Duplicate ID attributes detected</>
6
+ `);return}u(e,`Version mismatch (Child: %c${n}%c !== Parent: %c${i.VERSION})`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT)}}function R(e,n,t){if(!r[e])return null;const o=r[e][n];if(typeof o!==i.FUNCTION)throw new TypeError(`${n} on iframe[${e}] is not a function`);if(n!=="onBeforeClose"&&n!=="onScroll")return p.isolateUserCode(o,t);try{return o(t)}catch(a){return console.error(a),L(e,`Error in ${n} callback`),null}}function ze(e,n){const{id:t,iframe:o}=e;u(t,`onMessage passed: {iframe: %c${t}%c, message: %c${n}%c}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT,s.FOREGROUND),R(t,"onMessage",{iframe:o,message:JSON.parse(n)})}function N(e,n){const{lastMessage:t}=r[e];return t.slice(t.indexOf(i.SEPARATOR)+i.MESSAGE_HEADER_LENGTH+n)}function B(e,n){const{id:t,iframe:o,height:a,type:l,width:c}=n;let f={x:0,y:0};if(c===0&&a===0){const d=N(t,9).split(i.SEPARATOR);f={x:d[1],y:d[0]}}else f={x:c,y:a};R(t,e,{iframe:o,screenX:Number(f.x),screenY:Number(f.y),type:l})}const E={position:null,version:i.VERSION};function x(){E.position=null}const Ce=()=>E.position;function Fe(e){E.position=e}function W(e){return E.position===null&&(E.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${E.position.x}%c, %c${E.position.y}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),E.position}function U(e){E.position!==null&&(window.scrollTo(E.position.x,E.position.y),O(e,`Set page position: %c${E.position.x}%c, %c${E.position.y}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),x())}function V(e,n){const{id:t}=n,o=`${n[e]}px`;r[t].iframe.style[e]=o,O(t,`Set ${e}: %c${o}`,s.HIGHLIGHT)}function j(e){const{id:n}=e,{sizeHeight:t,sizeWidth:o}=r[n];t&&V(i.HEIGHT,e),o&&V(i.WIDTH,e)}function q(e){const{id:n}=e;j(e),U(n),R(n,"onResized",e)}function X(e){const{id:n}=e;u(n,"Disconnected from iframe"),delete r[n],delete e.iframeResizer}function Z(e){const{id:n}=e;if(R(n,"onBeforeClose",n)===!1){u(n,"Close iframe cancelled by onBeforeClose");return}u(n,`Removing iframe: %c${n}`,s.HIGHLIGHT);try{e.parentNode&&e.remove()}catch(t){L(n,t)}R(n,"onAfterClose",n),X(e)}function Y(e){const{id:n,type:t}=e;u(n,`Size reset requested by ${t===i.INIT?"parent page":"child page"}`),W(n),j(e),G(i.RESET,i.RESET,n)}const J=(e,n)=>{const t={};return(o,a)=>{const{iframe:l}=r[a];function c(d,g){t[g]||(d(),t[g]=requestAnimationFrame(()=>{t[g]=null}))}function f(){G(`${o} (${e})`,`${e}:${n(l)}`,a)}c(f,a)}},K=e=>n=>{e in r[n]&&(r[n][e](),delete r[n][e])},Q=((e,n)=>t=>{let o=!1;const a=I=>()=>{r[t]?(!o||o===I)&&(e(I,t),o=I,requestAnimationFrame(()=>{o=!1})):h()},l=a(i.SCROLL),c=a("resize window"),f=new ResizeObserver(a("pageObserver")),d=new ResizeObserver(a("iframeObserver"));function g(I,A){u(t,`${I}listeners for send${n}`),A(window,i.SCROLL,l),A(window,i.RESIZE,c)}function h(){w(t,`stop${n}`),g("Remove ",H.removeEventListener),f.disconnect(),d.disconnect(),r[t]&&H.removeEventListener(r[t].iframe,i.LOAD,h)}function M(){g("Add ",H.addEventListener),f.observe(document.body),d.observe(r[t].iframe)}r[t]&&(r[t][`stop${n}`]=h,H.addEventListener(r[t].iframe,i.LOAD,h),M())});function Be(e){const n=document.body.getBoundingClientRect(),t=e.getBoundingClientRect(),{scrollY:o,scrollX:a,innerHeight:l,innerWidth:c}=window,{clientHeight:f,clientWidth:d}=document.documentElement;return JSON.stringify({iframeHeight:t.height,iframeWidth:t.width,clientHeight:Math.max(f,l||0),clientWidth:Math.max(d,c||0),offsetTop:Math.trunc(t.top-n.top),offsetLeft:Math.trunc(t.left-n.left),scrollTop:o,scrollLeft:a,documentHeight:f,documentWidth:d,windowHeight:l,windowWidth:c})}const xe=J(i.PAGE_INFO,Be),We=Q(xe,"PageInfo"),Ue=K("stopPageInfo");function Ve(e){const{scrollWidth:n,scrollHeight:t}=document.documentElement,o=typeof window<"u"&&window.visualViewport?window.visualViewport:{},{width:a=0,height:l=0,offsetLeft:c=0,offsetTop:f=0,pageLeft:d=0,pageTop:g=0,scale:h=1}=o;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:n,scrollHeight:t},viewport:{width:a,height:l,offsetLeft:c,offsetTop:f,pageLeft:d,pageTop:g,scale:h}})}const je=J(i.PARENT_INFO,Ve),qe=Q(je,"ParentInfo"),Xe=K("stopParentInfo");function ee(e){const n=e.getBoundingClientRect(),t=W(e.id);return{x:Number(n.left)+Number(t.x),y:Number(n.top)+Number(t.y)}}function ne(e){const{x:n,y:t}=Ce(),o=r[e]?.iframe;if(R(e,"onScroll",{iframe:o,top:t,left:n,x:n,y:t})===!1){x();return}U(e)}function Ze(e){const{id:n,height:t,width:o}=e,a=window.parentIframe||window.parentIFrame||window;O(n,`scrollBy: x: %c${o}%c y: %c${t}`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),a.scrollBy(o,t)}const te=e=>n=>{const{id:t,iframe:o,height:a,width:l}=n;function c(I){Fe(I),ne(t)}function f(I,A){I[`scrollTo${e?"Offset":""}`](A.x,A.y)}const d=I=>({x:l+I.x,y:a+I.y}),g=e?ee(o):{x:0,y:0},h=d(g),M=window.parentIframe||window.parentIFrame;O(t,`Reposition requested (offset x:%c${g.x}%c y:%c${g.y})`,s.HIGHLIGHT,s.FOREGROUND,s.HIGHLIGHT),M?f(M,h):c(h)},Ye=te(!1),Je=te(!0);function Ke(e,n,t){const{x:o,y:a}=ee(t);O(e,`Moving to in page link: %c#${n}`,s.HIGHLIGHT),E.position={x:o,y:a},ne(e),window.location.hash=n}function Qe(e,n){const t=window.parentIframe||window.parentIFrame;if(!t){u(e,`In page link #${n} not found`);return}t.moveToAnchor(n)}function en(e,n){const t=n.split("#")[1]||"",o=decodeURIComponent(t),a=document.getElementById(o)||document.getElementsByName(o)[0];if(a){Ke(e,t,a);return}if(window.top===window.self){u(e,`In page link #${t} not found`);return}Qe(e,t)}function nn(e){const n=r[e]?.iframe?.title;return n===""||n===void 0}function tn(e,n){r[e]?.syncTitle&&(r[e].iframe.title=n,O(e,`Set iframe title attribute: %c${n}`,s.HIGHLIGHT))}let v=!1,ie=!1;function re(e,n=-3){if(v)return;const t=Math.max(r[e].mode,n);if(t>r[e].mode&&(r[e].mode=t),t<0)throw Ee(e),r[e].vAdvised||b(e||"Parent",`${T.getModeData(t+2)}${T.getModeData(2)}`),r[e].vAdvised=!0,T.getModeData(t+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(t>5&&ie||Ie(`v${i.VERSION} (${T.getModeLabel(t)})`,t),t){case 1:case 2:case 3:b("Parent",T.getModeData(6));break;case 4:b("Parent",T.getModeData(7));break;case 5:b("Parent",T.getModeData(8));break;default:t<1&&b("Parent",T.getModeData(3))}v=!0}function rn(e){if(v)return;const{mode:n}=r[e];n>5&&re(e,n)}function on(e){e?.log===-1&&(e.log=!1,ie=!0)}function an(e,n){r[e]&&(u(e,`First run for ${e}`),re(e,n===void 0?void 0:Number(n)),r[e].firstRun=!1)}function sn(e){const{height:n,id:t,iframe:o,mode:a,message:l,type:c,width:f}=e,{lastMessage:d}=r[t];switch(r[t]?.firstRun&&an(t,a),u(t,`Received: %c${d}`,s.HIGHLIGHT),c){case i.AUTO_RESIZE:r[t].autoResize=JSON.parse(N(t,9));break;case i.BEFORE_UNLOAD:O(t,"Ready state reset"),r[t].initialised=!1;break;case i.CLOSE:Z(o);break;case i.IN_PAGE_LINK:en(t,N(t,9));break;case i.INIT:q(e),De(t),_e(t,l),r[t].initialised=!0,R(t,"onReady",o);break;case i.MESSAGE:ze(e,N(t,6));break;case i.MOUSE_ENTER:B("onMouseEnter",e);break;case i.MOUSE_LEAVE:B("onMouseLeave",e);break;case i.PAGE_INFO:We(t);break;case i.PARENT_INFO:qe(t);break;case i.PAGE_INFO_STOP:Ue(t);break;case i.PARENT_INFO_STOP:Xe(t);break;case i.RESET:Y(e);break;case i.SCROLL_BY:Ze(e);break;case i.SCROLL_TO:Ye(e);break;case i.SCROLL_TO_OFFSET:Je(e);break;case i.TITLE:tn(t,l);break;default:if(f===0&&n===0){L(t,`Unsupported message received (${c}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);return}if(f===0||n===0){u(t,"Ignoring message with 0 height or width");return}if(document.hidden){u(t,"Page hidden - ignored resize request");return}q(e)}}const cn=e=>({initChild:n,postMessageTarget:t})=>{e===t&&n()},fn=e=>Object.values(r).forEach(cn(e));function oe(e){const n=e.data;if(n===i.CHILD_READY_MESSAGE){fn(e.source);return}if(!ve(n)){if(typeof n!==i.STRING)return;w(i.PARENT,"ignoredMessage"),me(i.PARENT,n);return}const t=ye(n),{id:o,type:a}=t;switch(w(o,a),!0){case!r[o]:throw new Error(`${a} No settings for ${o}. Message was: ${n}`);case!Pe(t):case ke(t):case!$e(t,e):return;default:r[o].lastMessage=e.data,C(o,sn)(t)}}const un=p.once(()=>{H.addEventListener(window,i.MESSAGE,oe),H.addEventListener(document,"visibilitychange",Ae),window.iframeParentListener=e=>setTimeout(()=>oe({data:e,sameOrigin:!0}))}),ae={};function ln(e){if(ae[e]===!0)return!1;const n=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(n.length<=1)return!0;ae[e]=!0;const t=Array.from(n).flatMap(o=>[i.NEW_LINE,o,i.NEW_LINE]);return b(e,`<rb>Duplicate ID attributes detected</>
13
7
 
14
8
  The <b>${e}</> ID is not unique. Having multiple iframes on the same page with the same ID causes problems with communication between the iframe and parent page. Please ensure that the ID of each iframe has a unique value.
15
9
 
16
- Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...n,`
17
- `),!1}const Vn=`<rb>Deprecated Method Name</>
18
-
19
- The <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${de}`,qn=`<rb>Deprecated Method</>
20
-
21
- Use of the <b>resize()</> method from the parent page is deprecated and will be removed in a future version of <i>iframe-resizer</>. As there are no longer any edge cases that require triggering a resize from the parent page, it is recommended to remove this method from your code.`;function Zn(e){if(i[e]){const{iframe:t}=i[e],n={close:Me.bind(null,t),disconnect:Se.bind(null,t),moveToAnchor(o){Ht(o,U,"moveToAnchor(anchor) anchor"),E("Move to anchor",`moveToAnchor:${o}`,e)},removeListeners(){g(e,Vn),this.disconnect()},resize(){g(e,qn),E("Window resize",B,e)},sendMessage(o){o=JSON.stringify(o),E(M,`${M}:${o}`,e)}};t.iframeResizer=n,t.iFrameResizer=n}}const Jn="8",Yn="32",Xn=ht,Kn=!0;function Qn(e){const{autoResize:t,bodyBackground:n,bodyMargin:o,bodyPadding:s,heightCalculationMethod:c,inPageLinks:l,license:a,log:f,logExpand:p,mouseEvents:h,offsetHeight:S,offsetWidth:y,mode:L,sizeHeight:So,sizeWidth:Mo,tolerance:$o,widthCalculationMethod:Ao}=i[e];return[e,Jn,Mo,f,Yn,Kn,t,o,c,n,s,$o,l,Xn,Ao,h,S,y,So,a,d.version,L,"",p].join(":")}const eo="0";function to(e){const{bodyMargin:t}=i[e];(typeof t===dt||t===eo)&&(i[e].bodyMargin=`${t}px`)}const no=e=>{try{return new URL(e).origin}catch{return null}},oo=e=>typeof e===ce&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin"));function io(e,t){const{checkOrigin:n,iframe:{src:o,sandbox:s},initialisedFirstPage:c,waitForLoad:l}=t[e],a=no(o);v(e,"noResponse"),g(e,`<rb>No response from iframe</>
10
+ Found <bb>${n.length}</> iframes with the <b>${e}</> ID:`,...t,i.NEW_LINE),!1}function dn(e){if(r[e]){const{iframe:n}=r[e];n.iframeResizer={close:Z.bind(null,n),disconnect:X.bind(null,n),moveToAnchor(t){p.typeAssert(t,i.STRING,"moveToAnchor(anchor) anchor"),G("Move to anchor",`moveToAnchor:${t}`,e)},sendMessage(t){t=JSON.stringify(t),G(i.MESSAGE,`${i.MESSAGE}:${t}`,e)}}}}const gn="8",mn="32",hn=i.CHILD,En=!0;function pn(e){const{autoResize:n,bodyBackground:t,bodyMargin:o,bodyPadding:a,heightCalculationMethod:l,inPageLinks:c,license:f,log:d,logExpand:g,mouseEvents:h,offsetHeight:M,offsetWidth:I,mode:A,sizeHeight:qn,sizeWidth:Xn,tolerance:Zn,widthCalculationMethod:Yn}=r[e];return[e,gn,Xn,d,mn,En,n,o,l,t,a,Zn,c,hn,Yn,h,M,I,qn,f,E.version,A,"",g].join(i.SEPARATOR)}const In="0";function On(e){const{bodyMargin:n}=r[e];(typeof n===i.NUMBER||n===In)&&(r[e].bodyMargin=`${n}px`)}const bn=e=>{try{return new URL(e).origin}catch{return null}},Tn=e=>typeof e===i.OBJECT&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin"));function wn(e,n){const{checkOrigin:t,iframe:{src:o,sandbox:a},initialisedFirstPage:l,waitForLoad:c}=n[e],f=bn(o);w(e,"noResponse"),b(e,`<rb>No response from iframe</>
22
11
 
23
- The iframe (<i>${e}</>) has not responded within ${t[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
24
- ${n&&a?`
25
- The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${a}</>, then the connection to the iframe may be blocked by the browser. To disable this option, set <b>checkOrigin</> to <bb>false</> or an array of allowed origins. See <u>https://iframe-resizer.com/checkorigin</> for more information.
26
- `:""}${l&&!c?`
12
+ The iframe (<i>${e}</>) has not responded within ${n[e].warningTimeout/1e3} seconds. Check <b>@iframe-resizer/child</> package has been loaded in the iframe.
13
+ ${t&&f?`
14
+ The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${f}</>, then the connection to the iframe may be blocked by the browser. To disable this option, set <b>checkOrigin</> to <bb>false</> or an array of allowed origins. See <u>https://iframe-resizer.com/checkorigin</> for more information.
15
+ `:""}${c&&!l?`
27
16
  The <b>waitForLoad</> option is currently set to <bb>true</>. If the iframe loads before <i>iframe-resizer</> runs, this option will prevent <i>iframe-resizer</> initialising. To disable this option, set <b>waitForLoad</> to <bb>false</>.
28
- `:""}${oo(s)?`
17
+ `:""}${Tn(a)?`
29
18
  The iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>allow-scripts</> values.
30
19
  `:""}
31
20
  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.
32
- `)}function so(e,t){function n(){if(t[e]===void 0)return;const{initialised:c,loadErrorShown:l}=t[e];if(t[e].msgTimeout=void 0,c){t[e].initialisedFirstPage=!0;return}l||(t[e].loadErrorShown=!0,io(e,t))}const{msgTimeout:o,warningTimeout:s}=t[e];s&&(o&&clearTimeout(o),t[e].msgTimeout=setTimeout(n,s))}const ro=1,lo=e=>e.loading===Qe,co=e=>e===H;function ao(e){i[e]?.heightCalculationMethod in bt&&$e({id:e,iframe:i[e].iframe,height:1,width:1,type:H})}function uo(e,t){A(e,F,()=>setTimeout(t,ro))}const fo=e=>{const{src:t,srcdoc:n}=e;return!n&&(t==null||t===""||t==="about:blank")};function po(e,t){const{iframe:n,waitForLoad:o}=i[e];if(o!==!0){if(fo(n)){setTimeout(()=>{v(e,"noContent"),m(e,"No content detected in the iframe, delaying initialisation")});return}setTimeout(t)}}function ho(e,t){const n=s=>()=>{if(!i[e])return;const{firstRun:c,iframe:l}=i[e];E(s,t,e),co(s)&&lo(l)||so(e,i),c||ao(e)},{iframe:o}=i[e];i[e].initChild=n(oe),uo(o,n(ie)),po(e,n(H))}function yo(e,t){return t?(("sizeWidth"in t||"sizeHeight"in t||ne in t)&&g(e,`<rb>Deprecated Option</>
21
+ `)}function Ln(e,n){function t(){if(n[e]===void 0)return;const{initialised:l,loadErrorShown:c}=n[e];if(n[e].msgTimeout=void 0,l){n[e].initialisedFirstPage=!0;return}c||(n[e].loadErrorShown=!0,wn(e,n))}const{msgTimeout:o,warningTimeout:a}=n[e];a&&(o&&clearTimeout(o),n[e].msgTimeout=setTimeout(t,a))}const Hn=1,Sn=e=>e.loading===i.LAZY,Rn=e=>e===i.INIT;function An(e){r[e]?.heightCalculationMethod in i.RESET_REQUIRED_METHODS&&Y({id:e,iframe:r[e].iframe,height:i.MIN_SIZE,width:i.MIN_SIZE,type:i.INIT})}function Gn(e,n){const t=()=>setTimeout(n,Hn);H.addEventListener(e,i.LOAD,t)}const Mn=e=>{const{src:n,srcdoc:t}=e;return!t&&(n==null||n===""||n==="about:blank")};function yn(e,n){const{iframe:t,waitForLoad:o}=r[e];if(o!==!0){if(Mn(t)){setTimeout(()=>{w(e,"noContent"),O(e,"No content detected in the iframe, delaying initialisation")});return}setTimeout(n)}}function Nn(e,n){const t=a=>()=>{if(!r[e])return;const{firstRun:l,iframe:c}=r[e];G(a,n,e),Rn(a)&&Sn(c)||Ln(e,r),l||An(e)},{iframe:o}=r[e];r[e].initChild=t(i.INIT_FROM_IFRAME),Gn(o,t(i.ONLOAD)),yn(e,t(i.INIT))}function Pn(e,n){return n?(("sizeWidth"in n||"sizeHeight"in n||i.AUTO_RESIZE in n)&&b(e,`<rb>Deprecated Option</>
33
22
 
34
- The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${P}</>, <bb>${pe}</>, <bb>${fe}</> or <bb>${ue}</>.
35
- `),t):{}}function go(e){i[e].warningTimeout||m(e,"warningTimeout:%c disabled",r.HIGHLIGHT)}function mo(e,{offset:t,offsetSize:n}){const o=n||t;o&&(i[e].direction===P?(i[e].offsetHeight=o,u(e,`Offset height: %c${o}`,r.HIGHLIGHT)):(i[e].offsetWidth=o,u(e,`Offset width: %c${o}`,r.HIGHLIGHT)))}function bo(e){const{direction:t}=i[e];switch(t){case P:break;case pe:i[e].sizeHeight=!1;case fe:i[e].sizeWidth=!0;break;case ue:i[e].sizeWidth=!1,i[e].sizeHeight=!1,i[e].autoResize=!1;break;default:throw new TypeError(`Direction value of "${t}" is not valid`)}u(e,`direction: %c${t}`,r.HIGHLIGHT)}const qe=e=>e===""||e.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":e;function vo(e){const{checkOrigin:t,remoteHost:n}=i[e];Array.isArray(t)&&t.length===0&&z(e,"checkOrigin is an empty array — no messages will be sent to the iframe"),i[e].targetOrigin=Array.isArray(t)?t.map(qe):[t===!1?"*":qe(n)]}function zo(e){const{id:t}=e;i[t].postMessageTarget===null&&(i[t].postMessageTarget=e.contentWindow)}function ee(e,t,n){$(i[e],t)&&(g(e,`<rb>Deprecated option</>
23
+ The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${i.VERTICAL}</>, <bb>${i.HORIZONTAL}</>, <bb>${i.BOTH}</> or <bb>${i.NONE}</>.
24
+ `),n):{}}function $n(e){r[e].warningTimeout||O(e,"warningTimeout:%c disabled",s.HIGHLIGHT)}function vn(e,{offset:n,offsetSize:t}){const o=t||n;o&&(r[e].direction===i.VERTICAL?(r[e].offsetHeight=o,u(e,`Offset height: %c${o}`,s.HIGHLIGHT)):(r[e].offsetWidth=o,u(e,`Offset width: %c${o}`,s.HIGHLIGHT)))}function kn(e){const{direction:n}=r[e];switch(n){case i.VERTICAL:break;case i.HORIZONTAL:r[e].sizeHeight=!1;case i.BOTH:r[e].sizeWidth=!0;break;case i.NONE:r[e].sizeWidth=!1,r[e].sizeHeight=!1,r[e].autoResize=!1;break;default:throw new TypeError(`Direction value of "${n}" is not valid`)}u(e,`direction: %c${n}`,s.HIGHLIGHT)}const se=e=>e===""||e.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":e;function Dn(e){const{checkOrigin:n,remoteHost:t}=r[e];Array.isArray(n)&&n.length===0&&L(e,"checkOrigin is an empty array — no messages will be sent to the iframe"),r[e].targetOrigin=Array.isArray(n)?n.map(se):[n===!1?"*":se(t)]}function _n(e){const{id:n}=e;r[n].postMessageTarget===null&&(r[n].postMessageTarget=e.contentWindow)}function k(e,n,t){p.hasOwn(r[e],n)&&(b(e,`<rb>Deprecated option</>
36
25
 
37
- The <b>${t}</> option has been renamed to <b>${n}</>. ${de}`),i[e][n]=i[e][t],delete i[e][t])}function wo(e){ee(e,ut,ft),ee(e,"onClose","onBeforeClose"),ee(e,"onClosed","onAfterClose")}const Io=e=>$(e,"onMouseEnter")||$(e,"onMouseLeave");function Eo(e,t){const{id:n}=e;i[n]={...i[n],iframe:e,remoteHost:e?.src.split("/").slice(0,3).join("/"),...C,...yo(n,t),mouseEvents:Io(t),mode:Nn(t),syncTitle:Hn(n)},wo(n),bo(n),mo(n,t),go(n),zo(e),vo(n)}const To="yes",Ze="no";function Oo(e){const{id:t}=e;switch(u(t,`Iframe scrolling ${i[t]?.scrolling?"enabled":"disabled"} for ${t}`),e.style.overflow=i[t]?.scrolling===!1?pt:V,i[t]?.scrolling){case gt:break;case!0:e.scrolling=To;break;case!1:e.scrolling=Ze;break;default:e.scrolling=i[t]?.scrolling||Ze}}function Lo(e,t,n){Eo(t,n),u(e,`src: %c${t.srcdoc||t.src}`,r.HIGHLIGHT),Cn(e),Oo(t),to(e),ho(e,Qn(e)),Zn(e),u(e,"Setup complete")}function Ho(e,t){const{id:n}=e;v(n,"setup"),Un(n)&&Lo(n,e,t),Ft(n)}function Ro(e,t){t.log===Z?t.log=!1:t.log===J?t.log=k:t.log===Y&&(t.log=R);const n=$(t,"log"),o=X(t.log),s=n?o?!0:t.log:C.log;$(t,"logExpand")||(t.logExpand=n&&o?t.log===R:C.logExpand),_n(t),Nt({enabled:s,expand:t.logExpand,iframeId:e}),o&&!(t.log in vt)&&_t(e,`Invalid value for options.log: Accepted values are "${R}" and "${k}"`),t.log=s}function ko(e){if(!ye(e))throw new TypeError("Options is not an object");return Wn(),Zt(e),t=>{const n=qt(t,e);return te in t?(v(n,"alreadySetup"),z(n,`Ignored iframe (${n}), already setup.`)):(Ro(n,e),ze(n,Ho)(t,e)),t?.iframeResizer}}b.LOG_COLLAPSED=J,b.LOG_DISABLED=Z,b.LOG_EXPANDED=Y,b.default=ko,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
26
+ The <b>${n}</> option has been renamed to <b>${t}</>. ${i.REMOVED_NEXT_VERSION}`),r[e][t]=r[e][n],delete r[e][n])}function zn(e){k(e,i.OFFSET,i.OFFSET_SIZE),k(e,"onClose","onBeforeClose"),k(e,"onClosed","onAfterClose")}const Cn=e=>p.hasOwn(e,"onMouseEnter")||p.hasOwn(e,"onMouseLeave");function Fn(e,n){const{id:t}=e;r[t]={...r[t],iframe:e,remoteHost:e?.src.split("/").slice(0,3).join("/"),...y,...Pn(t,n),mouseEvents:Cn(n),mode:T(n),syncTitle:nn(t)},zn(t),kn(t),vn(t,n),$n(t),_n(e),Dn(t)}const Bn="yes",ce="no";function xn(e){const{id:n}=e;switch(u(n,`Iframe scrolling ${r[n]?.scrolling?"enabled":"disabled"} for ${n}`),e.style.overflow=r[n]?.scrolling===!1?i.HIDDEN:i.AUTO,r[n]?.scrolling){case i.OMIT:break;case!0:e.scrolling=Bn;break;case!1:e.scrolling=ce;break;default:e.scrolling=r[n]?.scrolling||ce}}function Wn(e,n,t){Fn(n,t),u(e,`src: %c${n.srcdoc||n.src}`,s.HIGHLIGHT),rn(e),xn(n),On(e),Nn(e,pn(e)),dn(e),u(e,"Setup complete")}function Un(e,n){const{id:t}=e;w(t,"setup"),ln(t)&&Wn(t,e,n),pe(t)}function Vn(e,n){n.log===i.LOG_DISABLED?n.log=!1:n.log===i.LOG_COLLAPSED?n.log=i.COLLAPSE:n.log===i.LOG_EXPANDED&&(n.log=i.EXPAND);const t=p.hasOwn(n,"log"),o=p.isString(n.log),a=t?o?!0:n.log:y.log;p.hasOwn(n,"logExpand")||(n.logExpand=t&&o?n.log===i.EXPAND:y.logExpand),on(n),ge({enabled:a,expand:n.logExpand,iframeId:e}),o&&!(n.log in i.LOG_OPTIONS)&&he(e,`Invalid value for options.log: Accepted values are "${i.EXPAND}" and "${i.COLLAPSE}"`),n.log=a}function jn(e){if(!p.isObject(e))throw new TypeError("Options is not an object");return un(),Le(e),n=>{const t=we(n,e);return i.LABEL in n?(w(t,"alreadySetup"),L(t,`Ignored iframe (${t}), already setup.`)):(Vn(t,e),C(t,Un)(n,e)),n?.iframeResizer}}Object.defineProperty(m,"LOG_COLLAPSED",{enumerable:!0,get:()=>i.LOG_COLLAPSED}),Object.defineProperty(m,"LOG_DISABLED",{enumerable:!0,get:()=>i.LOG_DISABLED}),Object.defineProperty(m,"LOG_EXPANDED",{enumerable:!0,get:()=>i.LOG_EXPANDED}),m.default=jn,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
38
27
  //# sourceMappingURL=index.umd.js.map