@iframe-resizer/core 6.0.0-beta.0 → 6.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.cjs.js +14 -14
- package/index.cjs.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.esm.js +524 -455
- package/index.esm.js.map +1 -1
- package/index.umd.js +17 -17
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +7 -7
package/index.umd.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
(function(r
|
|
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.1",te="iframeResizer",Ze="[iFrameResizerChild]Ready",ne="autoResize",Je="beforeUnload",Ye="close",Xe="inPageLink",H="init",oe="iframeReady",Ke="lazy",F="load",k="message",Qe="mouseenter",et="mouseleave",ie="onload",se="pageInfo",re="parentInfo",tt="pageInfoStop",nt="parentInfoStop",D="reset",B="resize",ot="scrollBy",it="scrollTo",st="scrollToOffset",rt="title",ct="height",lt="width",at="offset",ut="offsetSize",ce="scroll",ft="hidden",pt="child",W="parent",U="string",dt="number",le="object",ae="function",V="auto",ht="font-weight: bold;",ue="none",fe="both",P="vertical",pe="horizontal",gt="omit",mt=k.length,N="[iFrameSizer]",q=N.length,yt=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),de=Object.freeze({[ie]:1,[H]:1,[oe]:1}),R="expanded",S="collapsed",Z=0,J=1,Y=2,bt=Object.freeze({[R]:1,[S]:1}),he="Use of the old name will be removed in a future version of <i>iframe-resizer</>.",ge=e=>typeof e===le&&e!==null,X=e=>typeof e===U;function vt(e){if(!ge(e))return!1;try{return e.tagName==="IFRAME"||e instanceof HTMLIFrameElement}catch{return!1}}const wt=(e,...t)=>setTimeout(()=>e(...t),0),zt=e=>{let t=!1;return function(...n){return t?void 0:(t=!0,e.apply(this,n))}},It=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),$=(e,t)=>Object.hasOwn?Object.hasOwn(e,t):It(e,t),Et=e=>e,Tt=e=>e.charAt(0).toUpperCase()+e.slice(1),Ot=e=>e?.__esModule?e.default:e,Lt=(e,t,n)=>{if(typeof e!==t)throw new TypeError(`${n} is not a ${Tt(t)}`)},Ht=e=>(t,n="renamed to")=>(o,s,l="",c="")=>e(c,`<rb>Deprecated ${t}(${o.replace("()","")})</>
|
|
2
2
|
|
|
3
|
-
The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${s}</>. ${
|
|
4
|
-
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},
|
|
5
|
-
`).replaceAll(/<\/?[^>]+>/gi,""),
|
|
3
|
+
The <b>${o}</> ${t.toLowerCase()} has been ${n} <b>${s}</>. ${l}Use of the old ${t.toLowerCase()} will be removed in a future version of <i>iframe-resizer</>.`),me={br:`
|
|
4
|
+
`,rb:"\x1B[31;1m",bb:"\x1B[34;1m",b:"\x1B[1m",i:"\x1B[3m",u:"\x1B[4m","/":"\x1B[m"},Rt=Object.keys(me),St=new RegExp(`<(${Rt.join("|")})>`,"gi"),Mt=(e,t)=>me[t]??"",kt=e=>e.replace(St,Mt),$t=e=>e.replaceAll("<br>",`
|
|
5
|
+
`).replaceAll(/<\/?[^>]+>/gi,""),ye=e=>t=>e(X(t)?window.chrome?kt(t):$t(t):t),i={},be=Ot(r);let K=!0;const At=be({expand:!1,label:W}),jt=e=>window.top===window.self?`parent(${e})`:`nested parent(${e})`,Gt=e=>i[e]?i[e].log:K;function Pt({enabled:e,expand:t,iframeId:n}){const o=be({expand:t,label:jt(n)});K=e,i[n]||(i[n]={console:o})}const I=e=>(t,...n)=>i[t]?i[t].console[e](...n):At[e](...n),ve=e=>(t,...n)=>Gt(t)===!0?I(e)(t,...n):null,u=ve("log"),y=u,Nt=ve("debug"),w=I("warn"),Ct=I("error"),v=I("event"),_t=I("purge"),xt=I("endAutoGroup"),we=I("errorBoundary");function Ft(e,t){queueMicrotask(()=>console.info(`%ciframe-resizer ${e}`,K||t<1?ht:r.NORMAL))}const Dt=e=>(...t)=>[`${te}(${e})`,...t].join(" "),Bt=ye(Et),m=(e,...t)=>i[e]?i[e].console.warn(...t.map(Bt)):queueMicrotask(()=>{const n=ye(Dt(e));console?.warn(...t.map(n))}),Wt=Ht(m)("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&&(Wt("init()","onReady()","",e.id),i[e.id].onInit(e))},onResized(){},onScroll:()=>!0});let ze=0;function Ut(e){const t=e?.id||C.id+ze++;return document.getElementById(t)===null?t:`${t}${ze++}`}function Vt(e,t){let{id:n}=e;if(n&&!X(n))throw new TypeError("Invalid id for iFrame. Expected String");return(!n||n==="")&&(n=Ut(t),e.id=n,v(n,"assignId"),u(n,`Added missing iframe ID: ${n} (${e.src})`)),n}function qt(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 S:case String(J):{e.log=S;break}default:e.log=S}}const A=(e,t,n,o)=>e.addEventListener(t,n,o||!1),Ie=(e,t,n)=>e.removeEventListener(t,n,!1),Zt=e=>e.split(":").filter((t,n)=>n!==19).join(":");function Jt(e,t,n){function o(f){const p=e in de?Zt(t):t;y(n,f,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),y(n,`Message data: %c${p}`,r.HIGHLIGHT)}const{iframe:s,postMessageTarget:l,sameOrigin:c,targetOrigin:a}=i[n];if(c)try{s.contentWindow.iframeChildListener(N+t),o(`Sending message to iframe %c${n}%c via same origin%c`);return}catch{e in de?(i[n].sameOrigin=!1,u(n,"New iframe does not support same origin")):w(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)l.postMessage(N+t,f)}function E(e,t,n){if(v(n,e),!i[n]?.postMessageTarget){w(n,"Iframe not found");return}Jt(e,t,n)}const Yt=(e,t)=>Object.values(i).filter(({autoResize:n,firstRun:o})=>n&&!o).forEach(({iframe:n})=>E(e,t,n.id));function Xt(){document.hidden!==!0&&Yt("tabVisible",B)}function Kt(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 Qt(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 en(e){const t=e.slice(q).split(":"),n=t[1]?Number(t[1]):0,o=i[t[0]]?.iframe,s=getComputedStyle(o),l={iframe:o,id:t[0],height:n+Kt(s)+Qt(s),width:Number(t[2]),type:t[3],msg:t[4],message:t[4]};return t[5]&&(l.mode=t[5]),l}const tn={true:1,false:1,undefined:1};function nn(e){const{id:t,msg:n,iframe:o}=e,s=vt(o);return s||(u(t,`Received: %c${n}`,r.HIGHLIGHT),w(t,"The target iframe was not found.")),s}function on(e,t){const{id:n}=e,{data:o,origin:s}=t;if("sameOrigin"in t&&t.sameOrigin)return!0;const c=i[n]?.checkOrigin;function a(){function f(){u(n,`Checking connection is from allowed list of origins: %c${c}`,r.HIGHLIGHT);for(const h of c)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 c.constructor===Array?f():p()}if(c&&`${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 sn=e=>N===`${e}`.slice(0,q)&&e.slice(q).split(":")[0]in i;function rn(e){const{id:t,type:n}=e,o=n in tn;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 ln(e,t){if(t!==G){if(t===void 0){m(e,`<rb>Legacy version detected in iframe</>
|
|
6
6
|
|
|
7
7
|
Detected legacy version of child page script. It is recommended to update the page in the iframe to use <b>@iframe-resizer/child</>.
|
|
8
8
|
|
|
9
9
|
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${v})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT)}}function E(e,t,n){if(!i[e])return null;const o=i[e][t];if(typeof o!==ie)throw new TypeError(`${t} on iframe[${e}] is not a function`);if(t!=="onBeforeClose"&&t!=="onScroll")return dt(o,n);try{return o(n)}catch(s){return console.error(s),z(e,`Error in ${t} callback`),null}}function en(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),E(n,"onMessage",{iframe:o,message:JSON.parse(t)})}function G(e,t){const{lastMessage:n}=i[e];return n.slice(n.indexOf(":")+at+t)}function ye(e,t){const{id:n,iframe:o,height:s,type:c,width:a}=t;let l={x:0,y:0};if(a===0&&s===0){const f=G(n,9).split(":");l={x:f[1],y:f[0]}}else l={x:a,y:s};E(n,e,{iframe:o,screenX:Number(l.x),screenY:Number(l.y),type:c})}const p={position:null,version:v};function ve(){p.position=null}const tn=()=>p.position;function nn(e){p.position=e}function we(e){return p.position===null&&(p.position={x:window.scrollX,y:window.scrollY}),u(e,`Get page position: %c${p.position.x}%c, %c${p.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),p.position}function ze(e){p.position!==null&&(window.scrollTo(p.position.x,p.position.y),m(e,`Set page position: %c${p.position.x}%c, %c${p.position.y}`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),ve())}function Ie(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 Ee(e){const{id:t}=e,{sizeHeight:n,sizeWidth:o}=i[t];n&&Ie(et,e),o&&Ie(tt,e)}function Te(e){const{id:t}=e;Ee(e),ze(t),E(t,"onResized",e)}function Oe(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function He(e){const{id:t}=e;if(E(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)}E(t,"onAfterClose",t),Oe(e)}function Re(e){const{id:t,type:n}=e;u(t,`Size reset requested by ${n===R?"parent page":"child page"}`),we(t),Ee(e),I(x,x,t)}const Le=(e,t)=>{const n={};return(o,s)=>{const{iframe:c}=i[s];function a(f,d){n[d]||(f(),n[d]=requestAnimationFrame(()=>{n[d]=null}))}function l(){I(`${o} (${e})`,`${e}:${t(c)}`,s)}a(l,s)}},Me=e=>t=>{e in i[t]&&(i[t][e](),delete i[t][e])},Se=(e,t)=>n=>{let o=!1;const s=h=>()=>{i[n]?(!o||o===h)&&(e(h,n),o=h,requestAnimationFrame(()=>{o=!1})):f()},c=s(ne),a=s("resize window");function l(h,H){u(n,`${h}listeners for send${t}`),H(window,ne,c),H(window,C,a)}function f(){y(n,`stop${t}`),l("Remove ",be),g.disconnect(),O.disconnect(),i[n]&&be(i[n].iframe,P,f)}function d(){l("Add ",S),g.observe(document.body),O.observe(i[n].iframe)}const g=new ResizeObserver(s("pageObserver")),O=new ResizeObserver(s("iframeObserver"));i[n]&&(i[n][`stop${t}`]=f,S(i[n].iframe,P,f),d())};function on(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:o,scrollX:s,innerHeight:c,innerWidth:a}=window,{clientHeight:l,clientWidth:f}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(l,c||0),clientWidth:Math.max(f,a||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:o,scrollLeft:s,documentHeight:l,documentWidth:f,windowHeight:c,windowWidth:a})}const sn=Le(ee,on),rn=Se(sn,"PageInfo"),cn=Me("stopPageInfo");function an(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,{width:o,height:s,offsetLeft:c,offsetTop:a,pageLeft:l,pageTop:f,scale:d}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:o,height:s,offsetLeft:c,offsetTop:a,pageLeft:l,pageTop:f,scale:d}})}const ln=Le(te,an),un=Se(ln,"ParentInfo"),fn=Me("stopParentInfo");function $e(e){const t=e.getBoundingClientRect(),n=we(e.id);return{x:Number(t.left)+Number(n.x),y:Number(t.top)+Number(n.y)}}function ke(e){const{x:t,y:n}=tn(),o=i[e]?.iframe;if(E(e,"onScroll",{iframe:o,top:n,left:t,x:t,y:n})===!1){ve();return}ze(e)}function dn(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 Ae=e=>t=>{function n(h){nn(h),ke(c)}function o(h,H){h[`scrollTo${e?"Offset":""}`](H.x,H.y)}const s=h=>({x:f+h.x,y:l+h.y}),{id:c,iframe:a,height:l,width:f}=t,d=e?$e(a):{x:0,y:0},g=s(d),O=window.parentIframe||window.parentIFrame;m(c,`Reposition requested (offset x:%c${d.x}%c y:%c${d.y})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),O?o(O,g):n(g)},pn=Ae(!1),hn=Ae(!0);function gn(e,t,n){const{x:o,y:s}=$e(n);m(e,`Moving to in page link: %c#${t}`,r.HIGHLIGHT),p.position={x:o,y:s},ke(e),window.location.hash=t}function mn(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function bn(e,t){const n=t.split("#")[1]||"",o=decodeURIComponent(n),s=document.getElementById(o)||document.getElementsByName(o)[0];if(s){gn(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}mn(e,n)}function yn(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function vn(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,m(e,`Set iframe title attribute: %c${t}`,r.HIGHLIGHT))}const Ge=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)},T=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),j=["spjluzl","rlf","clyzpvu","rlf2"],wn=["<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."],zn=["NWSc3","zvsv","wyv","ibzpulzz","vlt"],je=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl"].map((e,t)=>[e,Math.max(0,t-1)])),N=e=>T(wn[e]),In=e=>T(zn[e]),En=e=>{const t=e[T(j[0])]||e[T(j[1])]||e[T(j[2])]||e[T(j[3])];if(!t)return-1;const n=t.split("-");let o=(function(s=""){let c=-2;const a=Ge(T(s));return a in je&&(c=je[a]),c>4?c-4:c})(n[0]);return o===0||(s=>s[2]===Ge(s[0]+s[1]))(n)||(o=-2),o};let Z=!1,Ne=!1;function Pe(e,t=-3){if(Z)return;const n=Math.max(i[e].mode,t);if(n>i[e].mode&&(i[e].mode=n),n<0)throw $t(e),i[e].vAdvised||b(e||"Parent",`${N(n+2)}${N(2)}`),i[e].vAdvised=!0,N(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");n>0&&Ne||At(`v${v} (${In(n)})`,n),n<1&&b("Parent",N(3)),Z=!0}function Tn(e){if(Z)return;const{mode:t}=i[e];t!==-1&&Pe(e,t)}function On(e){e?.log===-1&&(e.log=!1,Ne=!0)}function Hn(e,t){i[e]&&(u(e,`First run for ${e}`),Pe(e,t!==void 0?Number(t):void 0),i[e].firstRun=!1)}function Rn(e){const{height:t,id:n,iframe:o,mode:s,message:c,type:a,width:l}=e,{lastMessage:f}=i[n];switch(i[n]?.firstRun&&Hn(n,s),u(n,`Received: %c${f}`,r.HIGHLIGHT),a){case X:i[n].autoResize=JSON.parse(G(n,9));break;case We:m(n,"Ready state reset"),i[n].initialised=!1;break;case Be:He(o);break;case De:bn(n,G(n,9));break;case R:Te(e),Kt(n),Qt(n,c),i[n].initialised=!0,E(n,"onReady",o);break;case L:en(e,G(n,6));break;case Ve:ye("onMouseEnter",e);break;case qe:ye("onMouseLeave",e);break;case ee:rn(n);break;case te:un(n);break;case Ze:cn(n);break;case Je:fn(n);break;case x:Re(e);break;case Ye:dn(e);break;case Xe:pn(e);break;case Ke:hn(e);break;case Qe:vn(n,c);break;default:if(l===0&&t===0){z(n,`Unsupported message received (${a}), this is likely due to the iframe containing a later version of iframe-resizer than the parent page`);return}if(l===0||t===0){u(n,"Ignoring message with 0 height or width");return}if(document.hidden){u(n,"Page hidden - ignored resize request");return}Te(e)}}const Ln=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},Mn=e=>Object.values(i).forEach(Ln(e));function xe(e){const t=e.data;if(t===_e){Mn(e.source);return}if(!Yt(t)){if(typeof t!==_)return;y(F,"ignoredMessage"),Mt(F,t);return}const n=Vt(t),{id:o,type:s}=n;switch(y(o,s),!0){case!i[o]:throw new Error(`${s} No settings for ${o}. Message was: ${t}`);case!Zt(n):case Xt(n):case!Jt(n,e):return;default:i[o].lastMessage=e.data,ge(o,Rn)(n)}}const Sn=pt(()=>{S(window,L,xe),S(document,"visibilitychange",Bt),window.iframeParentListener=e=>setTimeout(()=>xe({data:e,sameOrigin:!0}))}),Ce={};function $n(e){if(Ce[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;Ce[e]=!0;const n=Array.from(t).flatMap(o=>[`
|
|
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),w(e,`Error in ${t} callback`),null}}function an(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:l,width:c}=t;let a={x:0,y:0};if(c===0&&s===0){const f=_(n,9).split(":");a={x:f[1],y:f[0]}}else a={x:c,y:s};T(n,e,{iframe:o,screenX:Number(a.x),screenY:Number(a.y),type:l})}const d={position:null,version:G};function Te(){d.position=null}const un=()=>d.position;function fn(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),y(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,y(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(lt,e)}function Se(e){const{id:t}=e;Re(e),Le(t),T(t,"onResized",e)}function Me(e){const{id:t}=e;u(t,"Disconnected from iframe"),delete i[t],delete e.iframeResizer}function ke(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){w(t,n)}T(t,"onAfterClose",t),Me(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:l}=i[s];function c(f,p){n[p]||(f(),n[p]=requestAnimationFrame(()=>{n[p]=null}))}function a(){E(`${o} (${e})`,`${e}:${t(l)}`,s)}c(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=g=>()=>{i[n]?(!o||o===g)&&(e(g,n),o=g,requestAnimationFrame(()=>{o=!1})):h()},l=s(ce),c=s("resize window"),a=new ResizeObserver(s("pageObserver")),f=new ResizeObserver(s("iframeObserver"));function p(g,L){u(n,`${g}listeners for send${t}`),L(window,ce,l),L(window,B,c)}function h(){v(n,`stop${t}`),p("Remove ",Ie),a.disconnect(),f.disconnect(),i[n]&&Ie(i[n].iframe,F,h)}function M(){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),M())});function pn(e){const t=document.body.getBoundingClientRect(),n=e.getBoundingClientRect(),{scrollY:o,scrollX:s,innerHeight:l,innerWidth:c}=window,{clientHeight:a,clientWidth:f}=document.documentElement;return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(a,l||0),clientWidth:Math.max(f,c||0),offsetTop:Math.trunc(n.top-t.top),offsetLeft:Math.trunc(n.left-t.left),scrollTop:o,scrollLeft:s,documentHeight:a,documentWidth:f,windowHeight:l,windowWidth:c})}const dn=Ae(se,pn),hn=Ge(dn,"PageInfo"),gn=je("stopPageInfo");function mn(e){const{scrollWidth:t,scrollHeight:n}=document.documentElement,{width:o,height:s,offsetLeft:l,offsetTop:c,pageLeft:a,pageTop:f,scale:p}=window.visualViewport;return JSON.stringify({iframe:e.getBoundingClientRect(),document:{scrollWidth:t,scrollHeight:n},viewport:{width:o,height:s,offsetLeft:l,offsetTop:c,pageLeft:a,pageTop:f,scale:p}})}const yn=Ae(re,mn),bn=Ge(yn,"ParentInfo"),vn=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}=un(),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;y(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:l}=t;function c(g){fn(g),Ne(n)}function a(g,L){g[`scrollTo${e?"Offset":""}`](L.x,L.y)}const f=g=>({x:l+g.x,y:s+g.y}),p=e?Pe(o):{x:0,y:0},h=f(p),M=window.parentIframe||window.parentIFrame;y(n,`Reposition requested (offset x:%c${p.x}%c y:%c${p.y})`,r.HIGHLIGHT,r.FOREGROUND,r.HIGHLIGHT),M?a(M,h):c(h)},zn=Ce(!1),In=Ce(!0);function En(e,t,n){const{x:o,y:s}=Pe(n);y(e,`Moving to in page link: %c#${t}`,r.HIGHLIGHT),d.position={x:o,y:s},Ne(e),window.location.hash=t}function Tn(e,t){const n=window.parentIframe||window.parentIFrame;if(!n){u(e,`In page link #${t} not found`);return}n.moveToAnchor(t)}function On(e,t){const n=t.split("#")[1]||"",o=decodeURIComponent(n),s=document.getElementById(o)||document.getElementsByName(o)[0];if(s){En(e,n,s);return}if(window.top===window.self){u(e,`In page link #${n} not found`);return}Tn(e,n)}function Ln(e){const t=i[e]?.iframe?.title;return t===""||t===void 0}function Hn(e,t){i[e]?.syncTitle&&(i[e].iframe.title=t,y(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)},z=e=>e.replace(/[A-Za-z]/g,t=>String.fromCodePoint((t<="Z"?90:122)>=(t=t.codePointAt(0)+19)?t:t-26)),Rn=new Date,_e=e=>new Set(Array.from({length:9},e)),Sn=e=>[e[0],...e.slice(1).map(t=>`${t} - lewpylk`),`${e[4]} - lewpylk`,...e.slice(1)],j=["spjluzl","rlf","clyzpvu","rlf2","nlaMbssFlhy"],Mn=["<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>Av bwnyhkl av <i>Clyzpvu 6</> vm <p>pmyhtl-ylzpgly</> fvb jhu bzl aol mpyza 11 johyhjalyz vm fvb spjlujl rlf av nla h 60% kpzjvbua ha <ii>oaaw://pmyhtl-ylzpgly.jvt</>.","<yi>Clyzpvu 5 rlf klaljalk</><iy><iy>Av bwnyhkl av clyzpvu 6 vm<p>pmyhtl-ylzpgly</> wslhzl kvdusvhk aol shalza rlf myvt sltvu-zxbllgf.jvt.","<yi>VLT rlf lewpylk</><iy><iy>Wslhzl kvdusvhk aol shalza rlf myvt sltvu-zxbllgf.jvt."],kn=Sn(["NWSc3","zvsv","wyv","ibzpulzz","VLT"]),xe=Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5","1foobarqaz","2b5sdlfhbev","zo4ui3arjo","oclbb4thgl","igb1wzrjqr"].map((e,t)=>[e,Math.max(0,t-1)])),Fe=Rn[z(j[4])](),$n=_e((e,t)=>x(`${Fe+t}`)),An=_e((e,t)=>x(`${Fe-++t}`)),jn=e=>$n.has(e)?9:An.has(e)?5:-2,O=e=>z(Mn[e]),Gn=e=>z(kn[e]),Pn=e=>{const t=e[z(j[0])]||e[z(j[1])]||e[z(j[2])]||e[z(j[3])];if(!t)return-1;const n=t.split("-");let o=(function(s="",l=""){let c=-2;const a=x(z(s));return a in xe&&(c=xe[a]),c===9?jn(l):c})(...n);return o===0||(s=>s[2]===x(s[0]+s[1]))(n)||(o=-2),o};let Q=!1,De=!1;function Be(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 _t(e),i[e].vAdvised||m(e||"Parent",`${O(n+2)}${O(2)}`),i[e].vAdvised=!0,O(n+2).replace(/<\/?[a-z][^>]*>|<\/>/gi,"");switch(n>5&&De||Ft(`v${G} (${Gn(n)})`,n),n){case 1:case 2:case 3:m(e,O(6));break;case 4:m(e,O(7));break;case 5:m(e,O(8));break;default:n<1&&m("Parent",O(3))}Q=!0}function Nn(e){if(Q)return;const{mode:t}=i[e];t>5&&Be(e,t)}function Cn(e){e?.log===-1&&(e.log=!1,De=!0)}function _n(e,t){i[e]&&(u(e,`First run for ${e}`),Be(e,t===void 0?void 0:Number(t)),i[e].firstRun=!1)}function xn(e){const{height:t,id:n,iframe:o,mode:s,message:l,type:c,width:a}=e,{lastMessage:f}=i[n];switch(i[n]?.firstRun&&_n(n,s),u(n,`Received: %c${f}`,r.HIGHLIGHT),c){case ne:i[n].autoResize=JSON.parse(_(n,9));break;case Je:y(n,"Ready state reset"),i[n].initialised=!1;break;case Ye:ke(o);break;case Xe:On(n,_(n,9));break;case H:Se(e),cn(n),ln(n,l),i[n].initialised=!0,T(n,"onReady",o);break;case k:an(e,_(n,6));break;case Qe:Ee("onMouseEnter",e);break;case et:Ee("onMouseLeave",e);break;case se:hn(n);break;case re:bn(n);break;case tt:gn(n);break;case nt:vn(n);break;case D:$e(e);break;case ot:wn(e);break;case it:zn(e);break;case st:In(e);break;case rt:Hn(n,l);break;default:if(a===0&&t===0){w(n,`Unsupported message received (${c}), 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}Se(e)}}const Fn=e=>({initChild:t,postMessageTarget:n})=>{e===n&&t()},Dn=e=>Object.values(i).forEach(Fn(e));function We(e){const t=e.data;if(t===Ze){Dn(e.source);return}if(!sn(t)){if(typeof t!==U)return;v(W,"ignoredMessage"),Nt(W,t);return}const n=en(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!nn(n):case rn(n):case!on(n,e):return;default:i[o].lastMessage=e.data,we(o,xn)(n)}}const Bn=zt(()=>{A(window,k,We),A(document,"visibilitychange",Xt),window.iframeParentListener=e=>setTimeout(()=>We({data:e,sameOrigin:!0}))}),Ue={};function Wn(e){if(Ue[e]===!0)return!1;const t=document.querySelectorAll(`iframe#${CSS.escape(e)}`);if(t.length<=1)return!0;Ue[e]=!0;const n=Array.from(t).flatMap(o=>[`
|
|
11
11
|
`,o,`
|
|
12
|
-
`]);return
|
|
12
|
+
`]);return m(e,`<rb>Duplicate ID attributes detected</>
|
|
13
13
|
|
|
14
14
|
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
15
|
|
|
16
16
|
Found <bb>${t.length}</> iframes with the <b>${e}</> ID:`,...n,`
|
|
17
|
-
`),!1}const
|
|
17
|
+
`),!1}const Un=`<rb>Deprecated Method Name</>
|
|
18
18
|
|
|
19
|
-
The <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${
|
|
19
|
+
The <b>removeListeners()</> method has been renamed to <b>disconnect()</>. ${he}`,Vn=`<rb>Deprecated Method</>
|
|
20
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
|
|
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 qn(e){if(i[e]){const{iframe:t}=i[e],n={close:ke.bind(null,t),disconnect:Me.bind(null,t),moveToAnchor(o){Lt(o,U,"moveToAnchor(anchor) anchor"),E("Move to anchor",`moveToAnchor:${o}`,e)},removeListeners(){m(e,Un),this.disconnect()},resize(){m(e,Vn),E("Window resize",B,e)},sendMessage(o){o=JSON.stringify(o),E(k,`${k}:${o}`,e)}};t.iframeResizer=n,t.iFrameResizer=n}}const Zn="8",Jn="32",Yn=pt,Xn=!0;function Kn(e){const{autoResize:t,bodyBackground:n,bodyMargin:o,bodyPadding:s,heightCalculationMethod:l,inPageLinks:c,license:a,log:f,logExpand:p,mouseEvents:h,offsetHeight:M,offsetWidth:g,mode:L,sizeHeight:So,sizeWidth:Mo,tolerance:ko,widthCalculationMethod:$o}=i[e];return[e,Zn,Mo,f,Jn,Xn,t,o,l,n,s,ko,c,Yn,$o,h,M,g,So,a,d.version,L,"",p].join(":")}const Qn="0";function eo(e){const{bodyMargin:t}=i[e];(typeof t===dt||t===Qn)&&(i[e].bodyMargin=`${t}px`)}const to=e=>{try{return new URL(e).origin}catch{return null}},no=e=>typeof e===le&&e.length>0&&!(e.contains("allow-scripts")&&e.contains("allow-same-origin"));function oo(e,t){const{checkOrigin:n,iframe:{src:o,sandbox:s},initialisedFirstPage:l,waitForLoad:c}=t[e],a=to(o);v(e,"noResponse"),m(e,`<rb>No response from iframe</>
|
|
22
22
|
|
|
23
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&&
|
|
25
|
-
The <b>checkOrigin</> option is currently enabled. If the iframe redirects away from <i>${
|
|
26
|
-
`:""}${
|
|
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
|
+
`:""}${c&&!l?`
|
|
27
27
|
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
|
-
`:""}${
|
|
28
|
+
`:""}${no(s)?`
|
|
29
29
|
The iframe has the <b>sandbox</> attribute, please ensure it contains both the <bb>allow-same-origin</> and <bb>allow-scripts</> values.
|
|
30
30
|
`:""}
|
|
31
31
|
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
|
|
32
|
+
`)}function io(e,t){function n(){if(t[e]===void 0)return;const{initialised:l,loadErrorShown:c}=t[e];if(t[e].msgTimeout=void 0,l){t[e].initialisedFirstPage=!0;return}c||(t[e].loadErrorShown=!0,oo(e,t))}const{msgTimeout:o,warningTimeout:s}=t[e];s&&(o&&clearTimeout(o),t[e].msgTimeout=setTimeout(n,s))}const so=1,ro=e=>e.loading===Ke,co=e=>e===H;function lo(e){i[e]?.heightCalculationMethod in yt&&$e({id:e,iframe:i[e].iframe,height:1,width:1,type:H})}function ao(e,t){A(e,F,()=>setTimeout(t,so))}const uo=e=>{const{src:t,srcdoc:n}=e;return!n&&(t==null||t===""||t==="about:blank")};function fo(e,t){const{iframe:n,waitForLoad:o}=i[e];if(o!==!0){if(uo(n)){setTimeout(()=>{v(e,"noContent"),y(e,"No content detected in the iframe, delaying initialisation")});return}setTimeout(t)}}function po(e,t){const n=s=>()=>{if(!i[e])return;const{firstRun:l,iframe:c}=i[e];E(s,t,e),co(s)&&ro(c)||io(e,i),l||lo(e)},{iframe:o}=i[e];i[e].initChild=n(oe),ao(o,n(ie)),fo(e,n(H))}function ho(e,t){return t?(("sizeWidth"in t||"sizeHeight"in t||ne in t)&&m(e,`<rb>Deprecated Option</>
|
|
33
33
|
|
|
34
|
-
The <b>sizeWidth</>, <b>sizeHeight</> and <b>autoResize</> options have been replaced with new <b>direction</> option which expects values of <bb>${
|
|
35
|
-
`),t):{}}function
|
|
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||y(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 yo(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 Ve=e=>e===""||e.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":e;function bo(e){const{checkOrigin:t,remoteHost:n}=i[e];Array.isArray(t)&&t.length===0&&w(e,"checkOrigin is an empty array — no messages will be sent to the iframe"),i[e].targetOrigin=Array.isArray(t)?t.map(Ve):[t===!1?"*":Ve(n)]}function vo(e){const{id:t}=e;i[t].postMessageTarget===null&&(i[t].postMessageTarget=e.contentWindow)}function ee(e,t,n){$(i[e],t)&&(m(e,`<rb>Deprecated option</>
|
|
36
36
|
|
|
37
|
-
The <b>${t}</> option has been renamed to <b>${n}</>. ${
|
|
37
|
+
The <b>${t}</> option has been renamed to <b>${n}</>. ${he}`),i[e][n]=i[e][t],delete i[e][t])}function wo(e){ee(e,at,ut),ee(e,"onClose","onBeforeClose"),ee(e,"onClosed","onAfterClose")}const zo=e=>$(e,"onMouseEnter")||$(e,"onMouseLeave");function Io(e,t){const{id:n}=e;i[n]={...i[n],iframe:e,remoteHost:e?.src.split("/").slice(0,3).join("/"),...C,...ho(n,t),mouseEvents:zo(t),mode:Pn(t),syncTitle:Ln(n)},wo(n),yo(n),mo(n,t),go(n),vo(e),bo(n)}const Eo="yes",qe="no";function To(e){const{id:t}=e;switch(u(t,`Iframe scrolling ${i[t]?.scrolling?"enabled":"disabled"} for ${t}`),e.style.overflow=i[t]?.scrolling===!1?ft:V,i[t]?.scrolling){case gt:break;case!0:e.scrolling=Eo;break;case!1:e.scrolling=qe;break;default:e.scrolling=i[t]?.scrolling||qe}}function Oo(e,t,n){Io(t,n),u(e,`src: %c${t.srcdoc||t.src}`,r.HIGHLIGHT),Nn(e),To(t),eo(e),po(e,Kn(e)),qn(e),u(e,"Setup complete")}function Lo(e,t){const{id:n}=e;v(n,"setup"),Wn(n)&&Oo(n,e,t),xt(n)}function Ho(e,t){t.log===Z?t.log=!1:t.log===J?t.log=S: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),Cn(t),Pt({enabled:s,expand:t.logExpand,iframeId:e}),o&&!(t.log in bt)&&Ct(e,`Invalid value for options.log: Accepted values are "${R}" and "${S}"`),t.log=s}function Ro(e){if(!ge(e))throw new TypeError("Options is not an object");return Bn(),qt(e),t=>{const n=Vt(t,e);return te in t?(v(n,"alreadySetup"),w(n,`Ignored iframe (${n}), already setup.`)):(Ho(n,e),we(n,Lo)(t,e)),t?.iframeResizer}}b.LOG_COLLAPSED=J,b.LOG_DISABLED=Z,b.LOG_EXPANDED=Y,b.default=Ro,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
38
38
|
//# sourceMappingURL=index.umd.js.map
|