@iframe-resizer/child 5.2.0-beta.1 → 5.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/iframe-resizer.child.d.ts +114 -111
- package/index.cjs.js +2 -2
- package/index.cjs.js.map +1 -1
- package/index.esm.js +2 -2
- package/index.esm.js.map +1 -1
- package/index.umd.js +2 -2
- package/index.umd.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,126 +9,129 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
declare module '@iframe-resizer/child' {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
32
|
-
export interface IFramePage {
|
|
33
|
-
/**
|
|
34
|
-
* Turn autoResizing of the iFrame on and off. Returns bool of current state.
|
|
35
|
-
*/
|
|
36
|
-
autoResize(resize?: boolean): boolean
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Remove the iFrame from the parent page.
|
|
40
|
-
*/
|
|
41
|
-
close(): void
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Returns the ID of the iFrame that the page is contained in.
|
|
45
|
-
*/
|
|
46
|
-
getId(): string
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Ask the containing page for its positioning coordinates.
|
|
50
|
-
*
|
|
51
|
-
* Your callback function will be recalled when the parent page is scrolled or resized.
|
|
52
|
-
*
|
|
53
|
-
* Pass false to disable the callback.
|
|
54
|
-
*/
|
|
55
|
-
getParentProps(callback: (data: ParentProps) => void): void
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Scroll the parent page by x and y
|
|
59
|
-
*/
|
|
60
|
-
scrollBy(x: number, y: number): void
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Scroll the parent page to the coordinates x and y
|
|
64
|
-
*/
|
|
65
|
-
scrollTo(x: number, y: number): void
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Scroll the parent page to the coordinates x and y relative to the position of the iFrame.
|
|
69
|
-
*/
|
|
70
|
-
scrollToOffset(x: number, y: number): void
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Send data to the containing page, message can be any data type that can be serialized into JSON. The `targetOrigin`
|
|
74
|
-
* option is used to restrict where the message is sent to; to stop an attacker mimicking your parent page.
|
|
75
|
-
* See the MDN documentation on postMessage for more details.
|
|
76
|
-
*/
|
|
77
|
-
sendMessage(message: any, targetOrigin?: string): void
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Set default target origin.
|
|
81
|
-
*/
|
|
82
|
-
setTargetOrigin(targetOrigin: string): void
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Manually force iFrame to resize. To use passed arguments you need first to disable the `autoResize` option to
|
|
86
|
-
* prevent auto resizing and enable the `sizeWidth` option if you wish to set the width.
|
|
87
|
-
*/
|
|
88
|
-
size(customHeight?: string, customWidth?: string): void
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface ParentProps {
|
|
92
|
-
/**
|
|
93
|
-
* The values returned by iframe.getBoundingClientRect()
|
|
94
|
-
*/
|
|
95
|
-
iframe: {
|
|
96
|
-
x: number
|
|
97
|
-
y: number
|
|
98
|
-
width: number
|
|
99
|
-
height: number
|
|
100
|
-
top: number
|
|
101
|
-
right: number
|
|
102
|
-
bottom: number
|
|
103
|
-
left: number
|
|
12
|
+
namespace iframeResizer {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
|
+
interface IFramePageOptions {
|
|
15
|
+
/**
|
|
16
|
+
* This option allows you to restrict the domain of the parent page,
|
|
17
|
+
* to prevent other sites mimicking your parent page.
|
|
18
|
+
*/
|
|
19
|
+
targetOrigin?: string | undefined
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Receive message posted from the parent page with the iframe.iFrameResizer.sendMessage() method.
|
|
23
|
+
*/
|
|
24
|
+
onMessage?(message: any): void
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* This function is called once iFrame-Resizer has been initialized after receiving a call from the parent page.
|
|
28
|
+
*/
|
|
29
|
+
onReady?(): void
|
|
104
30
|
}
|
|
105
31
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
33
|
+
interface IFramePage {
|
|
34
|
+
/**
|
|
35
|
+
* Turn autoResizing of the iFrame on and off. Returns bool of current state.
|
|
36
|
+
*/
|
|
37
|
+
autoResize(resize?: boolean): boolean
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Remove the iFrame from the parent page.
|
|
41
|
+
*/
|
|
42
|
+
close(): void
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns the ID of the iFrame that the page is contained in.
|
|
46
|
+
*/
|
|
47
|
+
getId(): string
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Ask the containing page for its positioning coordinates.
|
|
51
|
+
*
|
|
52
|
+
* Your callback function will be recalled when the parent page is scrolled or resized.
|
|
53
|
+
*
|
|
54
|
+
* Pass false to disable the callback.
|
|
55
|
+
*/
|
|
56
|
+
getParentProps(callback: (data: ParentProps) => void): void
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Scroll the parent page by x and y
|
|
60
|
+
*/
|
|
61
|
+
scrollBy(x: number, y: number): void
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Scroll the parent page to the coordinates x and y
|
|
65
|
+
*/
|
|
66
|
+
scrollTo(x: number, y: number): void
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Scroll the parent page to the coordinates x and y relative to the position of the iFrame.
|
|
70
|
+
*/
|
|
71
|
+
scrollToOffset(x: number, y: number): void
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Send data to the containing page, message can be any data type that can be serialized into JSON. The `targetOrigin`
|
|
75
|
+
* option is used to restrict where the message is sent to; to stop an attacker mimicking your parent page.
|
|
76
|
+
* See the MDN documentation on postMessage for more details.
|
|
77
|
+
*/
|
|
78
|
+
sendMessage(message: any, targetOrigin?: string): void
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set default target origin.
|
|
82
|
+
*/
|
|
83
|
+
setTargetOrigin(targetOrigin: string): void
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Manually force iFrame to resize. To use passed arguments you need first to disable the `autoResize` option to
|
|
87
|
+
* prevent auto resizing and enable the `sizeWidth` option if you wish to set the width.
|
|
88
|
+
*/
|
|
89
|
+
size(customHeight?: string, customWidth?: string): void
|
|
112
90
|
}
|
|
113
91
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
92
|
+
interface ParentProps {
|
|
93
|
+
/**
|
|
94
|
+
* The values returned by iframe.getBoundingClientRect()
|
|
95
|
+
*/
|
|
96
|
+
iframe: {
|
|
97
|
+
x: number
|
|
98
|
+
y: number
|
|
99
|
+
width: number
|
|
100
|
+
height: number
|
|
101
|
+
top: number
|
|
102
|
+
right: number
|
|
103
|
+
bottom: number
|
|
104
|
+
left: number
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The values returned by document.documentElement.scrollWidth and document.documentElement.scrollHeight
|
|
109
|
+
*/
|
|
110
|
+
document: {
|
|
111
|
+
scrollWidth: number
|
|
112
|
+
scrollHeight: number
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The values returned by window.visualViewport
|
|
117
|
+
*/
|
|
118
|
+
viewport: {
|
|
119
|
+
width: number
|
|
120
|
+
height: number
|
|
121
|
+
offsetLeft: number
|
|
122
|
+
offsetTop: number
|
|
123
|
+
pageLeft: number
|
|
124
|
+
pageTop: number
|
|
125
|
+
scale: number
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
global {
|
|
129
131
|
interface Window {
|
|
130
|
-
iFrameResizer: IFramePageOptions
|
|
131
|
-
parentIFrame: IFramePage
|
|
132
|
+
iFrameResizer: iframeResizer.IFramePageOptions
|
|
133
|
+
parentIFrame: iframeResizer.IFramePage
|
|
132
134
|
}
|
|
133
135
|
}
|
|
136
|
+
|
|
134
137
|
}
|
package/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @preserve
|
|
3
3
|
*
|
|
4
|
-
* @module iframe-resizer/child 5.2.0-beta.
|
|
4
|
+
* @module iframe-resizer/child 5.2.0-beta.3 (cjs) - 2024-07-11
|
|
5
5
|
*
|
|
6
6
|
* @license GPL-3.0 for non-commercial use only.
|
|
7
7
|
* For commercial use, you must purchase a license from
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
"use strict";const e="5.2.0-beta.1",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=(e,t,n)=>e.removeEventListener(t,n,!1),c=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const s=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(c[e]),u=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},d=e=>e;let m=i,f=d;const p={root:document.documentElement,rootMargin:"0px",threshold:1};let h=[];const y=new WeakSet,g=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[m]||e.boundingClientRect[m]>e.rootBounds[m])(e))})),h=document.querySelectorAll(`[${o}]`),f()}),p),v=e=>(m=e.side,f=e.onChange,e=>e.forEach((e=>{y.has(e)||(g.observe(e),y.add(e))}))),b=()=>h.length>0,w={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},z={height:()=>($e("Custom height calculation function not defined"),tt.auto()),width:()=>($e("Custom width calculation function not defined"),nt.auto())},S={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},j=128,$={},E="checkVisibility"in window,P="auto",C="[iFrameSizer]",A=C.length,M={max:1,min:1,bodyScroll:1,documentElementScroll:1},O=["body"],T="scroll";let R,I,N=!0,k="",x=0,B="",q=null,W="",L=!0,U=!1,F=null,V=!0,D=!1,H=1,J=P,Z=!0,Q="",X={},Y=!0,G=!1,K=0,_=!1,ee="",te=d,ne="child",oe=null,ie=!1,re="",ae=window.parent,le="*",ce=0,se=!1,ue="",de=1,me=T,fe=window,pe=()=>{$e("onMessage function not defined")},he=()=>{},ye=null,ge=null;const ve=e=>""!=`${e}`&&void 0!==e,be=new WeakSet,we=e=>"object"==typeof e&&be.add(e);function ze(e){switch(!0){case!ve(e):return"";case ve(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ve(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ve(e.className)?`.${e.className}`:"")}}const Se=(...e)=>[`[iframe-resizer][${ee}]`,...e].join(" "),je=(...e)=>console?.info(`[iframe-resizer][${ee}]`,...e),$e=(...e)=>console?.warn(Se(...e)),Ee=(...e)=>console?.warn((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(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(Se)(...e)),Pe=e=>Ee(e);function Ce(){!function(){const e=e=>"true"===e,t=Q.slice(A).split(":");ee=t[0],x=void 0===t[1]?x:Number(t[1]),U=void 0===t[2]?U:e(t[2]),G=void 0===t[3]?G:e(t[3]),N=void 0===t[6]?N:e(t[6]),B=t[7],J=void 0===t[8]?J:t[8],k=t[9],W=t[10],ce=void 0===t[11]?ce:Number(t[11]),X.enable=void 0!==t[12]&&e(t[12]),ne=void 0===t[13]?ne:t[13],me=void 0===t[14]?me:t[14],_=void 0===t[15]?_:e(t[15]),R=void 0===t[16]?R:Number(t[16]),I=void 0===t[17]?I:Number(t[17]),L=void 0===t[18]?L:e(t[18]),t[19],ue=t[20]||ue,K=void 0===t[21]?K:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;pe=e?.onMessage||pe,he=e?.onReady||he,"number"==typeof e?.offset&&(L&&(R=e?.offset),U&&(I=e?.offset)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(re=e.sizeSelector),le=e?.targetOrigin||le,J=e?.heightCalculationMethod||J,me=e?.widthCalculationMethod||me}function t(e,t){return"function"==typeof e&&(z[t]=e,e="custom"),e}if(1===K)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),J=t(J,"height"),me=t(me,"width"))}(),function(){try{ie="iframeParentListener"in window.parent}catch(e){}}(),K<0?Pe(`${s(K+2)}${s(2)}`):ue.codePointAt(0)>4||K<2&&Pe(s(3)),function(){if(!ue||""===ue||"false"===ue)return void Ee("<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/<u> for more details.\n");ue!==e&&Ee(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ue} - Child page: ${e}.\n`)}(),ke(),xe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&Ee("<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</>.")}(),function(){if(L===U)return;te=v({onChange:u(Ae),side:L?i:r})}(),Me(),function(){if(1===K)return;fe.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===N?(N=!0,Be()):!1===e&&!0===N&&(N=!1,Ie("remove"),oe?.disconnect(),q?.disconnect()),ct(0,0,"autoResize",JSON.stringify(N)),N),close(){ct(0,0,"close")},getId:()=>ee,getPageInfo(e){if("function"==typeof e)return ye=e,ct(0,0,"pageInfo"),void Ee("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ye=null,ct(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return ge=e,ct(0,0,"parentInfo"),()=>{ge=null,ct(0,0,"parentInfoStop")}},getParentProperties(e){Ee("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){X.findTarget(e)},reset(){lt()},scrollBy(e,t){ct(t,e,"scrollBy")},scrollTo(e,t){ct(t,e,"scrollTo")},scrollToOffset(e,t){ct(t,e,"scrollToOffset")},sendMessage(e,t){ct(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){J=e,ke()},setWidthCalculationMethod(e){me=e,xe()},setTargetOrigin(e){le=e},resize(e,t){it("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){Ee("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),fe.parentIFrame=fe.parentIframe}(),function(){if(!0!==_)return;function e(e){ct(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){a(window.document,t,e)}t("mouseenter"),t("mouseleave")}(),X=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);ct(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?ct(0,0,"inPageLink",`#${o}`):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function c(){setTimeout(i,j)}function s(){r(),l(),c()}X.enable&&(1===K?Ee("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):s());return{findTarget:o}}(),we(document.documentElement),we(document.body),function(){void 0===B&&(B=`${x}px`);Oe("margin",function(e,t){t.includes("-")&&($e(`Negative CSS value ignored for ${e}`),t="");return t}("margin",B))}(),Oe("background",k),Oe("padding",W),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)}(),Te()}const Ae=()=>{it("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&ct(0,0,"title",document.title),Be(),he(),Y=!1};function Me(){const e=document.querySelectorAll(`[${n}]`);D=e.length>0,F=D?e:Ge(document)(),D?setTimeout(Ae):te(F)}function Oe(e,t){void 0!==t&&""!==t&&"null"!==t&&document.body.style.setProperty(e,t)}function Te(){""!==re&&document.querySelectorAll(re).forEach((e=>{e.dataset.iframeSize=!0}))}function Re(e){({add(t){function n(){it(e.eventName,e.eventType)}$[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=$[e];delete $[e],l(window,e,t)}})[e.method](e.eventName)}function Ie(e){Re({method:e,eventType:"After Print",eventName:"afterprint"}),Re({method:e,eventType:"Before Print",eventName:"beforeprint"}),Re({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function Ne(e,t,n,o){return t!==e&&(e in n||($e(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in S&&Ee(`<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 ke(){J=Ne(J,P,tt,"height")}function xe(){me=Ne(me,T,nt,"width")}function Be(){!0===N&&(Ie("add"),q=function(){function e(e){e.forEach(He),Te(),Me()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return t.observe(n,o),t}const n=t();return{disconnect(){n.disconnect()}}}(),oe=new ResizeObserver(We),De(window.document))}let qe;function We(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;qe=()=>it("resizeObserver",`Resize Observed: ${ze(t)}`),setTimeout((()=>{qe&&qe(),qe=void 0}),0)}const Le=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Ue=()=>[...Ge(document)()].filter(Le),Fe=new WeakSet;function Ve(e){e&&(Fe.has(e)||(oe.observe(e),Fe.add(e)))}function De(e){[...Ue(),...O.flatMap((t=>e.querySelector(t)))].forEach(Ve)}function He(e){"childList"===e.type&&De(e.target)}let Je=null;let Ze=4,Qe=4;function Xe(e){const t=(n=e).charAt(0).toUpperCase()+n.slice(1);var n;let o=0,i=document.documentElement,r=D?0:document.documentElement.getBoundingClientRect().bottom,a=performance.now();const l=!D&&b()?h:F;let c=l.length;l.forEach((t=>{D||!E||t.checkVisibility(w)?(o=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),o>r&&(r=o,i=t)):c-=1})),a=(performance.now()-a).toPrecision(1),function(e,t,n,o){be.has(e)||Je===e||D&&o<=1||(Je=e,je(`\n${t} position calculated from:\n`,e,`\nParsed ${o} ${D?"tagged":"potentially overflowing"} elements in ${n}ms`))}(i,t,a,c);const s=`\nParsed ${c} element${1===c?"":"s"} in ${a}ms\n${t} ${D?"tagged ":""}element found at: ${r}px\nPosition calculated from HTML element: ${ze(i)} (${function(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\n"," ")}...`:e}(i,100)})`;return a<4||c<99||D||Y||Ze<a&&Ze<Qe&&(Ze=1.2*a,Ee(`<rb>Performance Warning</>\n\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\n${s}`)),Qe=a,r}const Ye=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],Ge=e=>()=>e.querySelectorAll("* :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)"),Ke={height:0,width:0},_e={height:0,width:0};function et(e){function t(){return _e[i]=r,Ke[i]=c,r}const n=b(),o=e===tt,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),c=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e);switch(!0){case!e.enabled():return c;case D:return e.taggedElement();case!n&&0===_e[i]&&0===Ke[i]:return t();case se&&r===_e[i]&&c===Ke[i]:return Math.max(r,c);case 0===r:return c;case!n&&r!==_e[i]&&c<=Ke[i]:return t();case!o:return e.taggedElement();case!n&&r<_e[i]:case c===l||c===a:case r>c:return t()}return Math.max(e.taggedElement(),t())}const tt={enabled:()=>L,getOffset:()=>R,auto:()=>et(tt),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>tt.bodyOffset(),custom:()=>z.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(...Ye(tt)),min:()=>Math.min(...Ye(tt)),grow:()=>tt.max(),lowestElement:()=>Xe(i),taggedElement:()=>Xe(i)},nt={enabled:()=>U,getOffset:()=>I,auto:()=>et(nt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>z.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(...Ye(nt)),min:()=>Math.min(...Ye(nt)),rightMostElement:()=>Xe(r),scroll:()=>Math.max(nt.bodyScroll(),nt.documentElementScroll()),taggedElement:()=>Xe(r)};function ot(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=ce);return r=void 0===n?tt[J]():n,a=void 0===o?nt[me]():o,L&&e(H,r)||U&&e(de,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(L&&J in M||U&&me in M)&<():(rt(),H=r,de=a,ct(H,de,e,i))}function it(e,t,n,o,i){document.hidden||ot(e,0,n,o,i)}function rt(){se||(se=!0,requestAnimationFrame((()=>{se=!1})))}function at(e){H=tt[J](),de=nt[me](),ct(H,de,e)}function lt(e){const t=J;J=P,rt(),at("reset"),J=t}function ct(e,t,n,o,i){K<-1||(void 0!==i||(i=le),function(){const r=`${ee}:${`${e+(R||0)}:${t+(I||0)}`}:${n}${void 0===o?"":`:${o}`}`;ie?window.parent.iframeParentListener(C+r):ae.postMessage(C+r,i)}())}function st(e){const t={init:function(){Q=e.data,ae=e.source,Ce(),V=!1,setTimeout((()=>{Z=!1}),j)},reset(){Z||at("resetPage")},resize(){it("resizeParent")},moveToAnchor(){X.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();ye?ye(JSON.parse(e)):ct(0,0,"pageInfoStop")},parentInfo(){const e=o();ge?ge(Object.freeze(JSON.parse(e))):ct(0,0,"parentInfoStop")},message(){const e=o();pe(JSON.parse(e))}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};C===`${e.data}`.slice(0,A)&&(!1!==V?r()&&t.init():function(){const o=n();o in t?t[o]():i()||r()||$e(`Unexpected message (${e.data})`)}())}function ut(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>st({data:e,sameDomain:!0}),a(window,"message",st),a(window,"readystatechange",ut),ut());
|
|
20
|
+
"use strict";const e="5.2.0-beta.3",t=10,n="data-iframe-size",o="data-iframe-overflow",i="bottom",r="right",a=(e,t,n,o)=>e.addEventListener(t,n,o||!1),l=(e,t,n)=>e.removeEventListener(t,n,!1),s=["<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</>."];Object.fromEntries(["2cgs7fdf4xb","1c9ctcccr4z","1q2pc4eebgb","ueokt0969w","w2zxchhgqz","1umuxblj2e5"].map(((e,t)=>[e,Math.max(0,t-1)])));const c=e=>(e=>e.replaceAll(/[A-Za-z]/g,(e=>String.fromCodePoint((e<="Z"?90:122)>=(e=e.codePointAt(0)+19)?e:e-26))))(s[e]),d=e=>{let t=!1;return function(){return t?void 0:(t=!0,Reflect.apply(e,this,arguments))}},u=e=>e;let m=i,f=u;const p={root:document.documentElement,rootMargin:"0px",threshold:1};let h=[];const g=new WeakSet,y=new IntersectionObserver((e=>{e.forEach((e=>{e.target.toggleAttribute(o,(e=>0===e.boundingClientRect[m]||e.boundingClientRect[m]>e.rootBounds[m])(e))})),h=document.querySelectorAll(`[${o}]`),f()}),p),v=e=>(m=e.side,f=e.onChange,e=>e.forEach((e=>{g.has(e)||(y.observe(e),g.add(e))}))),b=()=>h.length>0,z={contentVisibilityAuto:!0,opacityProperty:!0,visibilityProperty:!0},w={height:()=>(Me("Custom height calculation function not defined"),it.auto()),width:()=>(Me("Custom width calculation function not defined"),rt.auto())},$={bodyOffset:1,bodyScroll:1,offset:1,documentElementOffset:1,documentElementScroll:1,documentElementBoundingClientRect:1,max:1,min:1,grow:1,lowestElement:1},S=128,j={},P=window&&"checkVisibility"in window,E="auto",M={reset:1,resetPage:1,init:1},T="[iFrameSizer]",C=T.length,A={max:1,min:1,bodyScroll:1,documentElementScroll:1},O=["body"],I="scroll";let R,k,N=!0,x="",L=0,B="",q=null,H="",W=!0,F=!1,D=null,U=!0,V=!1,J=1,Z=E,Q=!0,X="",Y={},G=!0,K=!1,_=0,ee=!1,te="",ne=u,oe="child",ie=null,re=!1,ae="",le=window?.parent,se="*",ce=0,de=!1,ue="",me=1,fe=I,pe=window,he=()=>{Me("onMessage function not defined")},ge=()=>{},ye=null,ve=null;const be=e=>e.charAt(0).toUpperCase()+e.slice(1),ze=e=>""!=`${e}`&&void 0!==e,we=new WeakSet,$e=e=>"object"==typeof e&&we.add(e);function Se(e){switch(!0){case!ze(e):return"";case ze(e.id):return`${e.nodeName.toUpperCase()}#${e.id}`;case ze(e.name):return`${e.nodeName.toUpperCase()} (${e.name})`;default:return e.nodeName.toUpperCase()+(ze(e.className)?`.${e.className}`:"")}}const je=(...e)=>[`[iframe-resizer][${te}]`,...e].join(" "),Pe=(...e)=>K&&console?.log(je(...e)),Ee=(...e)=>console?.info(`[iframe-resizer][${te}]`,...e),Me=(...e)=>console?.warn(je(...e)),Te=(...e)=>console?.warn((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(t.replaceAll("<br>","\n").replaceAll(/<[/a-z]+>/gi,"")))(je)(...e)),Ce=e=>Te(e);function Ae(){!function(){const e=e=>"true"===e,t=X.slice(C).split(":");te=t[0],L=void 0===t[1]?L:Number(t[1]),F=void 0===t[2]?F:e(t[2]),K=void 0===t[3]?K:e(t[3]),N=void 0===t[6]?N:e(t[6]),B=t[7],Z=void 0===t[8]?Z:t[8],x=t[9],H=t[10],ce=void 0===t[11]?ce:Number(t[11]),Y.enable=void 0!==t[12]&&e(t[12]),oe=void 0===t[13]?oe:t[13],fe=void 0===t[14]?fe:t[14],ee=void 0===t[15]?ee:e(t[15]),R=void 0===t[16]?R:Number(t[16]),k=void 0===t[17]?k:Number(t[17]),W=void 0===t[18]?W:e(t[18]),t[19],ue=t[20]||ue,_=void 0===t[21]?_:Number(t[21])}(),function(){function e(){const e=window.iframeResizer||window.iFrameResizer;Pe(`Reading data from page: ${JSON.stringify(e)}`),he=e?.onMessage||he,ge=e?.onReady||ge,"number"==typeof e?.offset&&(Te("<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</>."),W&&(R=e?.offset),F&&(k=e?.offset)),"number"==typeof e?.offsetSize&&(W&&(R=e?.offsetSize),F&&(k=e?.offsetSize)),Object.prototype.hasOwnProperty.call(e,"sizeSelector")&&(ae=e.sizeSelector),se=e?.targetOrigin||se,Z=e?.heightCalculationMethod||Z,fe=e?.widthCalculationMethod||fe}function t(e,t){return"function"==typeof e&&(Pe(`Setup custom ${t}CalcMethod`),w[t]=e,e="custom"),e}if(1===_)return;"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),Z=t(Z,"height"),fe=t(fe,"width"));Pe(`TargetOrigin for parent set to: ${se}`)}(),Pe(`Initialising iFrame v${e} (${window.location.href})`),function(){try{re="iframeParentListener"in window.parent}catch(e){Pe("Cross domain iframe detected.")}}(),_<0?Ce(`${c(_+2)}${c(2)}`):ue.codePointAt(0)>4||_<2&&Ce(c(3)),function(){if(!ue||""===ue||"false"===ue)return void Te("<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");ue!==e&&Te(`<rb>Version mismatch</>\n\nThe parent and child pages are running different versions of <i>iframe resizer</>.\n\nParent page: ${ue} - Child page: ${e}.\n`)}(),Be(),qe(),function(){let e=!1;const t=t=>document.querySelectorAll(`[${t}]`).forEach((o=>{e=!0,o.removeAttribute(t),o.toggleAttribute(n,!0)}));t("data-iframe-height"),t("data-iframe-width"),e&&Te("<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</>.")}(),function(){if(W===F)return;ne=v({onChange:d(Oe),side:W?i:r})}(),Ie(),function(){if(1===_)return;pe.parentIframe=Object.freeze({autoResize:e=>(!0===e&&!1===N?(N=!0,He()):!1===e&&!0===N&&(N=!1,xe("remove"),ie?.disconnect(),q?.disconnect()),ut(0,0,"autoResize",JSON.stringify(N)),N),close(){ut(0,0,"close")},getId:()=>te,getPageInfo(e){if("function"==typeof e)return ye=e,ut(0,0,"pageInfo"),void Te("<rb>Deprecated Method</>\n \nThe <b>getPageInfo()</> method has been deprecated and replaced with <b>getParentProps()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n");ye=null,ut(0,0,"pageInfoStop")},getParentProps(e){if("function"!=typeof e)throw new TypeError("parentIFrame.getParentProps(callback) callback not a function");return ve=e,ut(0,0,"parentInfo"),()=>{ve=null,ut(0,0,"parentInfoStop")}},getParentProperties(e){Te("<rb>Renamed Method</>\n \nThe <b>getParentProperties()</> method has been renamed <b>getParentProps()</>. Use of the old name will be removed in a future version of <i>iframe-resizer</>.\n"),this.getParentProps(e)},moveToAnchor(e){Y.findTarget(e)},reset(){dt("parentIFrame.reset")},scrollBy(e,t){ut(t,e,"scrollBy")},scrollTo(e,t){ut(t,e,"scrollTo")},scrollToOffset(e,t){ut(t,e,"scrollToOffset")},sendMessage(e,t){ut(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod(e){Z=e,Be()},setWidthCalculationMethod(e){fe=e,qe()},setTargetOrigin(e){Pe(`Set targetOrigin: ${e}`),se=e},resize(e,t){lt("size",`parentIFrame.size(${`${e||""}${t?`,${t}`:""}`})`,e,t)},size(e,t){Te("<rb>Deprecated Method</>\n \nThe <b>size()</> method has been deprecated and replaced with <b>resize()</>. Use of this method will be removed in a future version of <i>iframe-resizer</>.\n"),this.resize(e,t)}}),pe.parentIFrame=pe.parentIframe}(),function(){if(!0!==ee)return;function e(e){ut(0,0,e.type,`${e.screenY}:${e.screenX}`)}function t(t,n){Pe(`Add event listener: ${n}`),a(window.document,t,e)}t("mouseenter","Mouse Enter"),t("mouseleave","Mouse Leave")}(),Y=function(){const e=()=>({x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop});function n(n){const o=n.getBoundingClientRect(),i=e();return{x:parseInt(o.left,t)+parseInt(i.x,t),y:parseInt(o.top,t)+parseInt(i.y,t)}}function o(e){function t(e){const t=n(e);Pe(`Moving to in page link (#${o}) at x: ${t.x}y: ${t.y}`),ut(t.y,t.x,"scrollToOffset")}const o=e.split("#")[1]||e,i=decodeURIComponent(o),r=document.getElementById(i)||document.getElementsByName(i)[0];void 0===r?(Pe(`In page link (#${o}) not found in iFrame, so sending to parent`),ut(0,0,"inPageLink",`#${o}`)):t(r)}function i(){const{hash:e,href:t}=window.location;""!==e&&"#"!==e&&o(t)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&a(e,"click",t)}document.querySelectorAll('a[href^="#"]').forEach(e)}function l(){a(window,"hashchange",i)}function s(){setTimeout(i,S)}function c(){Pe("Setting up location.hash handlers"),r(),l(),s()}Y.enable?1===_?Te("In page linking requires a Professional or Business license. Please see https://iframe-resizer.com/pricing for more details."):c():Pe("In page linking not enabled");return{findTarget:o}}(),$e(document.documentElement),$e(document.body),function(){void 0===B&&(B=`${L}px`);Re("margin",function(e,t){t.includes("-")&&(Me(`Negative CSS value ignored for ${e}`),t="");return t}("margin",B))}(),Re("background",x),Re("padding",H),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),Pe('HTML & body height set to "auto !important"')}(),ke()}const Oe=()=>{lt("init","Init message from host page",void 0,void 0,e),document.title&&""!==document.title&&ut(0,0,"title",document.title),He(),ge(),G=!1,Pe("Initialization complete"),Pe("---")};function Ie(){const e=document.querySelectorAll(`[${n}]`);V=e.length>0,Pe(`Tagged elements found: ${V}`),D=V?e:et(document)(),V?setTimeout(Oe):ne(D)}function Re(e,t){void 0!==t&&""!==t&&"null"!==t&&(document.body.style.setProperty(e,t),Pe(`Body ${e} set to "${t}"`))}function ke(){""!==ae&&(Pe(`Applying sizeSelector: ${ae}`),document.querySelectorAll(ae).forEach((e=>{Pe(`Applying data-iframe-size to: ${Se(e)}`),e.dataset.iframeSize=!0})))}function Ne(e){({add(t){function n(){lt(e.eventName,e.eventType)}j[t]=n,a(window,t,n,{passive:!0})},remove(e){const t=j[e];delete j[e],l(window,e,t)}})[e.method](e.eventName),Pe(`${be(e.method)} event listener: ${e.eventType}`)}function xe(e){Ne({method:e,eventType:"After Print",eventName:"afterprint"}),Ne({method:e,eventType:"Before Print",eventName:"beforeprint"}),Ne({method:e,eventType:"Ready State Change",eventName:"readystatechange"})}function Le(e,t,n,o){return t!==e&&(e in n||(Me(`${e} is not a valid option for ${o}CalculationMethod.`),e=t),e in $&&Te(`<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.`),Pe(`${o} calculation method set to "${e}"`)),e}function Be(){Z=Le(Z,E,it,"height")}function qe(){fe=Le(fe,I,rt,"width")}function He(){!0===N?(xe("add"),q=function(){function e(e){e.forEach(Qe),ke(),Ie()}function t(){const t=new window.MutationObserver(e),n=document.querySelector("body"),o={attributes:!1,attributeOldValue:!1,characterData:!1,characterDataOldValue:!1,childList:!0,subtree:!0};return Pe("Create <body/> MutationObserver"),t.observe(n,o),t}const n=t();return{disconnect(){Pe("Disconnect MutationObserver"),n.disconnect()}}}(),ie=new ResizeObserver(Fe),Ze(window.document)):Pe("Auto Resize disabled")}let We;function Fe(e){if(!Array.isArray(e)||0===e.length)return;const t=e[0].target;We=()=>lt("resizeObserver",`Resize Observed: ${Se(t)}`),setTimeout((()=>{We&&We(),We=void 0}),0)}const De=e=>{const t=getComputedStyle(e);return""!==t?.position&&"static"!==t?.position},Ue=()=>[...et(document)()].filter(De),Ve=new WeakSet;function Je(e){e&&(Ve.has(e)||(ie.observe(e),Ve.add(e),Pe(`Attached resizeObserver: ${Se(e)}`)))}function Ze(e){[...Ue(),...O.flatMap((t=>e.querySelector(t)))].forEach(Je)}function Qe(e){"childList"===e.type&&Ze(e.target)}let Xe=null;let Ye=4,Ge=4;function Ke(e){const t=be(e);let n=0,o=document.documentElement,i=V?0:document.documentElement.getBoundingClientRect().bottom,r=performance.now();const a=!V&&b()?h:D;let l=a.length;a.forEach((t=>{V||!P||t.checkVisibility(z)?(n=t.getBoundingClientRect()[e]+parseFloat(getComputedStyle(t).getPropertyValue(`margin-${e}`)),n>i&&(i=n,o=t)):l-=1})),r=(performance.now()-r).toPrecision(1),function(e,t,n,o){we.has(e)||Xe===e||V&&o<=1||(Xe=e,Ee(`\n${t} position calculated from:\n`,e,`\nParsed ${o} ${V?"tagged":"potentially overflowing"} elements in ${n}ms`))}(o,t,r,l);const s=`\nParsed ${l} element${1===l?"":"s"} in ${r}ms\n${t} ${V?"tagged ":""}element found at: ${i}px\nPosition calculated from HTML element: ${Se(o)} (${function(e,t=30){const n=e?.outerHTML?.toString();return n?n.length<t?n:`${n.slice(0,t).replaceAll("\n"," ")}...`:e}(o,100)})`;return r<4||l<99||V||G?Pe(s):Ye<r&&Ye<Ge&&(Ye=1.2*r,Te(`<rb>Performance Warning</>\n\nCalculating the page size took an excessive amount of time. To improve performance add the <b>data-iframe-size</> attribute to the ${e} most element on the page.\n${s}`)),Ge=r,i}const _e=e=>[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll(),e.documentElementBoundingClientRect()],et=e=>()=>e.querySelectorAll("* :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)"),tt={height:0,width:0},nt={height:0,width:0};function ot(e){function t(){return nt[i]=r,tt[i]=s,r}const n=b(),o=e===it,i=o?"height":"width",r=e.documentElementBoundingClientRect(),a=Math.ceil(r),l=Math.floor(r),s=(e=>e.documentElementScroll()+Math.max(0,e.getOffset()))(e),c=`HTML: ${r} Page: ${s}`;switch(!0){case!e.enabled():return s;case V:return e.taggedElement();case!n&&0===nt[i]&&0===tt[i]:return Pe(`Initial page size values: ${c}`),t();case de&&r===nt[i]&&s===tt[i]:return Pe(`Size unchanged: ${c}`),Math.max(r,s);case 0===r:return Pe(`Page is hidden: ${c}`),s;case!n&&r!==nt[i]&&s<=tt[i]:return Pe(`New HTML bounding size: ${c}`,"Previous bounding size:",nt[i]),t();case!o:return e.taggedElement();case!n&&r<nt[i]:return Pe("HTML bounding size decreased:",c),t();case s===l||s===a:return Pe("HTML bounding size equals page size:",c),t();case r>s:return Pe(`Page size < HTML bounding size: ${c}`),t();default:Pe(`Content overflowing HTML element: ${c}`)}return Math.max(e.taggedElement(),t())}const it={enabled:()=>W,getOffset:()=>R,auto:()=>ot(it),bodyOffset:()=>{const{body:e}=document,n=getComputedStyle(e);return e.offsetHeight+parseInt(n.marginTop,t)+parseInt(n.marginBottom,t)},bodyScroll:()=>document.body.scrollHeight,offset:()=>it.bodyOffset(),custom:()=>w.height(),documentElementOffset:()=>document.documentElement.offsetHeight,documentElementScroll:()=>document.documentElement.scrollHeight,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().bottom,max:()=>Math.max(..._e(it)),min:()=>Math.min(..._e(it)),grow:()=>it.max(),lowestElement:()=>Ke(i),taggedElement:()=>Ke(i)},rt={enabled:()=>F,getOffset:()=>k,auto:()=>ot(rt),bodyScroll:()=>document.body.scrollWidth,bodyOffset:()=>document.body.offsetWidth,custom:()=>w.width(),documentElementScroll:()=>document.documentElement.scrollWidth,documentElementOffset:()=>document.documentElement.offsetWidth,documentElementBoundingClientRect:()=>document.documentElement.getBoundingClientRect().right,max:()=>Math.max(..._e(rt)),min:()=>Math.min(..._e(rt)),rightMostElement:()=>Ke(r),scroll:()=>Math.max(rt.bodyScroll(),rt.documentElementScroll()),taggedElement:()=>Ke(r)};function at(e,t,n,o,i){let r,a;!function(){const e=(e,t)=>!(Math.abs(e-t)<=ce);return r=void 0===n?it[Z]():n,a=void 0===o?rt[fe]():o,W&&e(J,r)||F&&e(me,a)}()&&"init"!==e?!(e in{init:1,size:1})&&(W&&Z in A||F&&fe in A)&&dt(t):(st(),J=r,me=a,ut(J,me,e,i))}function lt(e,t,n,o,i){document.hidden?Pe("Page hidden - Ignored resize request"):(e in M||Pe(`Trigger event: ${t}`),at(e,t,n,o,i))}function st(){de||(de=!0,Pe("Trigger event lock on"),requestAnimationFrame((()=>{de=!1,Pe("Trigger event lock off"),Pe("--")})))}function ct(e){J=it[Z](),me=rt[fe](),ut(J,me,e)}function dt(e){const t=Z;Z=E,Pe(`Reset trigger event: ${e}`),st(),ct("reset"),Z=t}function ut(e,t,n,o,i){_<-1||(void 0!==i?Pe(`Message targetOrigin: ${i}`):i=se,function(){const r=`${te}:${`${e+(R||0)}:${t+(k||0)}`}:${n}${void 0===o?"":`:${o}`}`;Pe(`Sending message to host page (${r}) via ${re?"sameDomain":"postMessage"}`),re?window.parent.iframeParentListener(T+r):le.postMessage(T+r,i)}())}function mt(e){const t={init:function(){X=e.data,le=e.source,Ae(),U=!1,setTimeout((()=>{Q=!1}),S)},reset(){Q?Pe("Page reset ignored by init"):(Pe("Page size reset by host page"),ct("resetPage"))},resize(){lt("resizeParent","Parent window requested size check")},moveToAnchor(){Y.findTarget(o())},inPageLink(){this.moveToAnchor()},pageInfo(){const e=o();Pe(`PageInfo received from parent: ${e}`),ye?ye(JSON.parse(e)):ut(0,0,"pageInfoStop"),Pe(" --")},parentInfo(){const e=o();Pe(`ParentInfo received from parent: ${e}`),ve?ve(Object.freeze(JSON.parse(e))):ut(0,0,"parentInfoStop"),Pe(" --")},message(){const e=o();Pe(`onMessage called from parent: ${e}`),he(JSON.parse(e)),Pe(" --")}},n=()=>e.data.split("]")[1].split(":")[0],o=()=>e.data.slice(e.data.indexOf(":")+1),i=()=>"iframeResize"in window||void 0!==window.jQuery&&""in window.jQuery.prototype,r=()=>e.data.split(":")[2]in{true:1,false:1};T===`${e.data}`.slice(0,C)&&(!1!==U?r()?t.init():Pe(`Ignored message of type "${n()}". Received before initialization.`):function(){const o=n();o in t?t[o]():i()||r()||Me(`Unexpected message (${e.data})`)}())}function ft(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}"undefined"!=typeof window&&(window.iframeChildListener=e=>mt({data:e,sameDomain:!0}),a(window,"message",mt),a(window,"readystatechange",ft),ft());
|
|
21
21
|
//# sourceMappingURL=index.cjs.js.map
|