customer-chat-sdk 1.0.9 → 1.0.11
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/dist/core/IconManager.d.ts +23 -0
- package/dist/core/IconManager.d.ts.map +1 -1
- package/dist/core/IframeManager.d.ts +0 -5
- package/dist/core/IframeManager.d.ts.map +1 -1
- package/dist/customer-sdk.cjs.js +150 -154
- package/dist/customer-sdk.esm.js +150 -154
- package/dist/customer-sdk.min.js +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,13 @@ export declare class IconManager {
|
|
|
9
9
|
private badgeElement;
|
|
10
10
|
private onClickCallback;
|
|
11
11
|
private notificationCallback;
|
|
12
|
+
private isDragging;
|
|
13
|
+
private dragStartX;
|
|
14
|
+
private dragStartY;
|
|
15
|
+
private iconStartX;
|
|
16
|
+
private iconStartY;
|
|
17
|
+
private dragMoveHandler;
|
|
18
|
+
private dragEndHandler;
|
|
12
19
|
constructor();
|
|
13
20
|
/**
|
|
14
21
|
* 显示悬浮图标
|
|
@@ -42,6 +49,22 @@ export declare class IconManager {
|
|
|
42
49
|
* 清除消息订阅
|
|
43
50
|
*/
|
|
44
51
|
clearNotification(): void;
|
|
52
|
+
/**
|
|
53
|
+
* 设置拖动和点击事件
|
|
54
|
+
*/
|
|
55
|
+
private setupDragEvents;
|
|
56
|
+
/**
|
|
57
|
+
* 开始拖动
|
|
58
|
+
*/
|
|
59
|
+
private handleDragStart;
|
|
60
|
+
/**
|
|
61
|
+
* 拖动中
|
|
62
|
+
*/
|
|
63
|
+
private handleDragMove;
|
|
64
|
+
/**
|
|
65
|
+
* 结束拖动
|
|
66
|
+
*/
|
|
67
|
+
private handleDragEnd;
|
|
45
68
|
/**
|
|
46
69
|
* 处理点击事件
|
|
47
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconManager.d.ts","sourceRoot":"","sources":["../../src/core/IconManager.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,oBAAoB,CAAqC;;
|
|
1
|
+
{"version":3,"file":"IconManager.d.ts","sourceRoot":"","sources":["../../src/core/IconManager.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,oBAAoB,CAAqC;IACjE,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,UAAU,CAAI;IACtB,OAAO,CAAC,UAAU,CAAI;IACtB,OAAO,CAAC,UAAU,CAAI;IACtB,OAAO,CAAC,UAAU,CAAI;IACtB,OAAO,CAAC,eAAe,CAAsD;IAC7E,OAAO,CAAC,cAAc,CAAsD;;IAI5E;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA4C3B;;OAEG;IACH,IAAI,IAAI,IAAI;IA0BZ;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;IAIhC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAI1B;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAInC;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAInD;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IA0BpD;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAQzB;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAqEvB;;OAEG;IACH,OAAO,CAAC,cAAc;IA8BtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAwBrB;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,OAAO,CAAC,WAAW;CAgDpB"}
|
|
@@ -13,7 +13,6 @@ export declare class IframeManager {
|
|
|
13
13
|
private iframeElement;
|
|
14
14
|
private overlayElement;
|
|
15
15
|
private containerElement;
|
|
16
|
-
private forceClickArea;
|
|
17
16
|
private isOpen;
|
|
18
17
|
private isCreated;
|
|
19
18
|
constructor(config?: IframeOptions);
|
|
@@ -66,10 +65,6 @@ export declare class IframeManager {
|
|
|
66
65
|
* 控制页面滚动(移动端全屏模式使用)
|
|
67
66
|
*/
|
|
68
67
|
private preventBodyScroll;
|
|
69
|
-
/**
|
|
70
|
-
* 添加关闭按钮(自适应设备)
|
|
71
|
-
*/
|
|
72
|
-
private addCloseButton;
|
|
73
68
|
/**
|
|
74
69
|
* 检测设备类型
|
|
75
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IframeManager.d.ts","sourceRoot":"","sources":["../../src/core/IframeManager.ts"],"names":[],"mappings":"AACA,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAA;CACrD;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"IframeManager.d.ts","sourceRoot":"","sources":["../../src/core/IframeManager.ts"],"names":[],"mappings":"AACA,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAA;CACrD;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,SAAS,CAAQ;gBAEb,MAAM,GAAE,aAAkB;IAatC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B;;OAEG;IACH,IAAI,IAAI,IAAI;IAwDZ;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;OAEG;IACH,IAAI,IAAI,IAAI;IA8BZ;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,OAAO,IAAI,IAAI;IAaf;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAM7B;;OAEG;IACH,OAAO,CAAC,aAAa;IA8BrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAqHpB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0D1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoCzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAKtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA0C3B;;OAEG;IACH,OAAO,CAAC,YAAY;CAMrB"}
|
package/dist/customer-sdk.cjs.js
CHANGED
|
@@ -9,6 +9,13 @@ class IconManager {
|
|
|
9
9
|
this.badgeElement = null;
|
|
10
10
|
this.onClickCallback = null;
|
|
11
11
|
this.notificationCallback = null;
|
|
12
|
+
this.isDragging = false;
|
|
13
|
+
this.dragStartX = 0;
|
|
14
|
+
this.dragStartY = 0;
|
|
15
|
+
this.iconStartX = 0;
|
|
16
|
+
this.iconStartY = 0;
|
|
17
|
+
this.dragMoveHandler = null;
|
|
18
|
+
this.dragEndHandler = null;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* 显示悬浮图标
|
|
@@ -44,8 +51,8 @@ class IconManager {
|
|
|
44
51
|
this.iconElement.textContent = '💬';
|
|
45
52
|
this.iconElement.style.fontSize = '24px';
|
|
46
53
|
this.iconElement.style.color = '#ffffff';
|
|
47
|
-
//
|
|
48
|
-
this.
|
|
54
|
+
// 添加拖动和点击事件
|
|
55
|
+
this.setupDragEvents();
|
|
49
56
|
// 添加到页面
|
|
50
57
|
document.body.appendChild(this.iconElement);
|
|
51
58
|
console.log('CustomerSDK icon displayed');
|
|
@@ -54,10 +61,25 @@ class IconManager {
|
|
|
54
61
|
* 隐藏悬浮图标
|
|
55
62
|
*/
|
|
56
63
|
hide() {
|
|
64
|
+
// 清理所有事件监听器
|
|
65
|
+
if (this.isDragging) {
|
|
66
|
+
this.handleDragEnd();
|
|
67
|
+
}
|
|
68
|
+
// 清理document上的事件监听器(防止内存泄漏)
|
|
69
|
+
if (this.dragMoveHandler) {
|
|
70
|
+
document.removeEventListener('mousemove', this.dragMoveHandler);
|
|
71
|
+
document.removeEventListener('touchmove', this.dragMoveHandler);
|
|
72
|
+
}
|
|
73
|
+
if (this.dragEndHandler) {
|
|
74
|
+
document.removeEventListener('mouseup', this.dragEndHandler);
|
|
75
|
+
document.removeEventListener('touchend', this.dragEndHandler);
|
|
76
|
+
}
|
|
57
77
|
if (this.iconElement) {
|
|
58
78
|
this.iconElement.remove();
|
|
59
79
|
this.iconElement = null;
|
|
60
80
|
this.onClickCallback = null;
|
|
81
|
+
this.dragMoveHandler = null;
|
|
82
|
+
this.dragEndHandler = null;
|
|
61
83
|
console.log('CustomerSDK icon hidden');
|
|
62
84
|
}
|
|
63
85
|
}
|
|
@@ -114,6 +136,132 @@ class IconManager {
|
|
|
114
136
|
}
|
|
115
137
|
console.log('Notification cleared');
|
|
116
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* 设置拖动和点击事件
|
|
141
|
+
*/
|
|
142
|
+
setupDragEvents() {
|
|
143
|
+
if (!this.iconElement)
|
|
144
|
+
return;
|
|
145
|
+
// 绑定事件处理器(用于后续清理)
|
|
146
|
+
this.dragMoveHandler = this.handleDragMove.bind(this);
|
|
147
|
+
this.dragEndHandler = this.handleDragEnd.bind(this);
|
|
148
|
+
// 只在图标上监听开始事件
|
|
149
|
+
this.iconElement.addEventListener('mousedown', this.handleDragStart.bind(this));
|
|
150
|
+
this.iconElement.addEventListener('touchstart', this.handleDragStart.bind(this), { passive: false });
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 开始拖动
|
|
154
|
+
*/
|
|
155
|
+
handleDragStart(e) {
|
|
156
|
+
if (!this.iconElement)
|
|
157
|
+
return;
|
|
158
|
+
// 只处理图标上的事件
|
|
159
|
+
if (e.target !== this.iconElement && !this.iconElement.contains(e.target)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
e.stopPropagation();
|
|
164
|
+
const clientX = 'touches' in e ? e.touches[0].clientX : e.clientX;
|
|
165
|
+
const clientY = 'touches' in e ? e.touches[0].clientY : e.clientY;
|
|
166
|
+
this.isDragging = false;
|
|
167
|
+
this.dragStartX = clientX;
|
|
168
|
+
this.dragStartY = clientY;
|
|
169
|
+
// 获取图标当前位置
|
|
170
|
+
const rect = this.iconElement.getBoundingClientRect();
|
|
171
|
+
this.iconStartX = rect.left;
|
|
172
|
+
this.iconStartY = rect.top;
|
|
173
|
+
// 添加拖动样式
|
|
174
|
+
this.iconElement.style.transition = 'none';
|
|
175
|
+
this.iconElement.style.cursor = 'grabbing';
|
|
176
|
+
// 只在真正开始拖动时添加document事件监听
|
|
177
|
+
// 先添加一个临时的move监听器来检测是否真的在拖动
|
|
178
|
+
const checkDrag = (moveEvent) => {
|
|
179
|
+
const moveX = 'touches' in moveEvent ? moveEvent.touches[0].clientX : moveEvent.clientX;
|
|
180
|
+
const moveY = 'touches' in moveEvent ? moveEvent.touches[0].clientY : moveEvent.clientY;
|
|
181
|
+
const deltaX = moveX - this.dragStartX;
|
|
182
|
+
const deltaY = moveY - this.dragStartY;
|
|
183
|
+
// 如果移动距离超过5px,开始拖动
|
|
184
|
+
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
|
|
185
|
+
this.isDragging = true;
|
|
186
|
+
// 移除临时监听器
|
|
187
|
+
if ('touches' in moveEvent) {
|
|
188
|
+
document.removeEventListener('touchmove', checkDrag);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
document.removeEventListener('mousemove', checkDrag);
|
|
192
|
+
}
|
|
193
|
+
// 添加正式的事件监听器
|
|
194
|
+
if (this.dragMoveHandler && this.dragEndHandler) {
|
|
195
|
+
if ('touches' in moveEvent) {
|
|
196
|
+
document.addEventListener('touchmove', this.dragMoveHandler, { passive: false });
|
|
197
|
+
document.addEventListener('touchend', this.dragEndHandler);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
document.addEventListener('mousemove', this.dragMoveHandler);
|
|
201
|
+
document.addEventListener('mouseup', this.dragEndHandler);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
// 添加临时检测监听器
|
|
207
|
+
if ('touches' in e) {
|
|
208
|
+
document.addEventListener('touchmove', checkDrag, { passive: false });
|
|
209
|
+
document.addEventListener('touchend', this.dragEndHandler);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
document.addEventListener('mousemove', checkDrag);
|
|
213
|
+
document.addEventListener('mouseup', this.dragEndHandler);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 拖动中
|
|
218
|
+
*/
|
|
219
|
+
handleDragMove(e) {
|
|
220
|
+
if (!this.iconElement || !this.isDragging)
|
|
221
|
+
return;
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
e.stopPropagation();
|
|
224
|
+
const clientX = 'touches' in e ? e.touches[0].clientX : e.clientX;
|
|
225
|
+
const clientY = 'touches' in e ? e.touches[0].clientY : e.clientY;
|
|
226
|
+
const deltaX = clientX - this.dragStartX;
|
|
227
|
+
const deltaY = clientY - this.dragStartY;
|
|
228
|
+
// 计算新位置
|
|
229
|
+
const newX = this.iconStartX + deltaX;
|
|
230
|
+
const newY = this.iconStartY + deltaY;
|
|
231
|
+
// 限制在视口内
|
|
232
|
+
const maxX = window.innerWidth - this.iconElement.offsetWidth;
|
|
233
|
+
const maxY = window.innerHeight - this.iconElement.offsetHeight;
|
|
234
|
+
const clampedX = Math.max(0, Math.min(newX, maxX));
|
|
235
|
+
const clampedY = Math.max(0, Math.min(newY, maxY));
|
|
236
|
+
// 更新位置
|
|
237
|
+
this.iconElement.style.left = `${clampedX}px`;
|
|
238
|
+
this.iconElement.style.top = `${clampedY}px`;
|
|
239
|
+
this.iconElement.style.right = 'auto';
|
|
240
|
+
this.iconElement.style.bottom = 'auto';
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* 结束拖动
|
|
244
|
+
*/
|
|
245
|
+
handleDragEnd(e) {
|
|
246
|
+
if (!this.iconElement)
|
|
247
|
+
return;
|
|
248
|
+
// 清理document上的事件监听器
|
|
249
|
+
if (this.dragMoveHandler) {
|
|
250
|
+
document.removeEventListener('mousemove', this.dragMoveHandler);
|
|
251
|
+
document.removeEventListener('touchmove', this.dragMoveHandler);
|
|
252
|
+
}
|
|
253
|
+
if (this.dragEndHandler) {
|
|
254
|
+
document.removeEventListener('mouseup', this.dragEndHandler);
|
|
255
|
+
document.removeEventListener('touchend', this.dragEndHandler);
|
|
256
|
+
}
|
|
257
|
+
this.iconElement.style.transition = 'transform 0.2s ease';
|
|
258
|
+
this.iconElement.style.cursor = 'pointer';
|
|
259
|
+
// 如果只是点击(没有拖动),触发点击事件
|
|
260
|
+
if (!this.isDragging) {
|
|
261
|
+
this.handleClick();
|
|
262
|
+
}
|
|
263
|
+
this.isDragging = false;
|
|
264
|
+
}
|
|
117
265
|
/**
|
|
118
266
|
* 处理点击事件
|
|
119
267
|
*/
|
|
@@ -178,7 +326,6 @@ class IframeManager {
|
|
|
178
326
|
this.iframeElement = null;
|
|
179
327
|
this.overlayElement = null;
|
|
180
328
|
this.containerElement = null; // 包装容器,包含iframe和关闭按钮
|
|
181
|
-
this.forceClickArea = null; // 强制点击区域
|
|
182
329
|
this.isOpen = false;
|
|
183
330
|
this.isCreated = false;
|
|
184
331
|
this.config = {
|
|
@@ -251,10 +398,6 @@ class IframeManager {
|
|
|
251
398
|
// 禁用body滚动,防止出现滚动条
|
|
252
399
|
this.preventBodyScroll(true);
|
|
253
400
|
}
|
|
254
|
-
// 添加关闭按钮(如果是首次显示)
|
|
255
|
-
if (this.config.allowClose && !this.containerElement.querySelector('.customer-sdk-close-btn')) {
|
|
256
|
-
this.addCloseButton();
|
|
257
|
-
}
|
|
258
401
|
}
|
|
259
402
|
this.isOpen = true;
|
|
260
403
|
console.log('CustomerSDK iframe shown');
|
|
@@ -308,11 +451,6 @@ class IframeManager {
|
|
|
308
451
|
*/
|
|
309
452
|
destroy() {
|
|
310
453
|
this.hide();
|
|
311
|
-
// 清理强制点击区域
|
|
312
|
-
if (this.forceClickArea) {
|
|
313
|
-
this.forceClickArea.remove();
|
|
314
|
-
this.forceClickArea = null;
|
|
315
|
-
}
|
|
316
454
|
if (this.containerElement) {
|
|
317
455
|
this.containerElement.remove();
|
|
318
456
|
this.containerElement = null;
|
|
@@ -561,148 +699,6 @@ class IframeManager {
|
|
|
561
699
|
window.scrollTo(0, scrollY);
|
|
562
700
|
}
|
|
563
701
|
}
|
|
564
|
-
/**
|
|
565
|
-
* 添加关闭按钮(自适应设备)
|
|
566
|
-
*/
|
|
567
|
-
addCloseButton() {
|
|
568
|
-
if (!this.iframeElement)
|
|
569
|
-
return;
|
|
570
|
-
const actualMode = this.getActualMode();
|
|
571
|
-
const isPC = actualMode === 'popup';
|
|
572
|
-
const closeButton = document.createElement('button');
|
|
573
|
-
closeButton.className = 'customer-sdk-close-btn';
|
|
574
|
-
closeButton.innerHTML = '×';
|
|
575
|
-
const buttonStyles = isPC ? {
|
|
576
|
-
// PC模式:现代半透明设计
|
|
577
|
-
position: 'absolute',
|
|
578
|
-
top: '8px',
|
|
579
|
-
right: '8px',
|
|
580
|
-
width: '28px',
|
|
581
|
-
height: '28px',
|
|
582
|
-
borderRadius: '50%',
|
|
583
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
584
|
-
color: '#ffffff',
|
|
585
|
-
border: 'none',
|
|
586
|
-
fontSize: '16px',
|
|
587
|
-
fontWeight: '300',
|
|
588
|
-
cursor: 'pointer',
|
|
589
|
-
zIndex: '2147483647', // 最大z-index值
|
|
590
|
-
display: 'flex',
|
|
591
|
-
alignItems: 'center',
|
|
592
|
-
justifyContent: 'center',
|
|
593
|
-
transition: 'all 0.2s ease',
|
|
594
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, sans-serif',
|
|
595
|
-
userSelect: 'none',
|
|
596
|
-
backdropFilter: 'blur(8px)',
|
|
597
|
-
boxShadow: '0 2px 12px rgba(0, 0, 0, 0.15)',
|
|
598
|
-
pointerEvents: 'auto',
|
|
599
|
-
touchAction: 'manipulation'
|
|
600
|
-
} : {
|
|
601
|
-
// 移动端模式:现代半透明设计
|
|
602
|
-
position: 'absolute',
|
|
603
|
-
top: '2px',
|
|
604
|
-
right: '2px',
|
|
605
|
-
width: '30px',
|
|
606
|
-
height: '30px',
|
|
607
|
-
borderRadius: '50%',
|
|
608
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
609
|
-
color: '#ffffff',
|
|
610
|
-
border: 'none',
|
|
611
|
-
fontSize: '18px',
|
|
612
|
-
fontWeight: '300',
|
|
613
|
-
cursor: 'pointer',
|
|
614
|
-
zIndex: '2147483647', // 最大z-index值
|
|
615
|
-
display: 'flex',
|
|
616
|
-
alignItems: 'center',
|
|
617
|
-
justifyContent: 'center',
|
|
618
|
-
transition: 'all 0.2s ease',
|
|
619
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, sans-serif',
|
|
620
|
-
userSelect: 'none',
|
|
621
|
-
backdropFilter: 'blur(8px)',
|
|
622
|
-
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
|
|
623
|
-
pointerEvents: 'auto',
|
|
624
|
-
touchAction: 'manipulation',
|
|
625
|
-
WebkitTouchCallout: 'none',
|
|
626
|
-
WebkitUserSelect: 'none',
|
|
627
|
-
WebkitTapHighlightColor: 'transparent'
|
|
628
|
-
};
|
|
629
|
-
Object.assign(closeButton.style, buttonStyles);
|
|
630
|
-
// iOS Safari特殊处理
|
|
631
|
-
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
632
|
-
if (isIOS) {
|
|
633
|
-
// iOS Safari需要特殊处理
|
|
634
|
-
closeButton.addEventListener('touchstart', (e) => {
|
|
635
|
-
e.preventDefault();
|
|
636
|
-
e.stopPropagation();
|
|
637
|
-
// 立即触发关闭,不等待touchend
|
|
638
|
-
this.close();
|
|
639
|
-
}, { passive: false });
|
|
640
|
-
// 添加click事件作为备用
|
|
641
|
-
closeButton.addEventListener('click', (e) => {
|
|
642
|
-
e.preventDefault();
|
|
643
|
-
e.stopPropagation();
|
|
644
|
-
this.close();
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
// 其他浏览器正常处理
|
|
649
|
-
closeButton.addEventListener('click', (e) => {
|
|
650
|
-
e.preventDefault();
|
|
651
|
-
e.stopPropagation();
|
|
652
|
-
this.close();
|
|
653
|
-
});
|
|
654
|
-
closeButton.addEventListener('touchstart', (e) => {
|
|
655
|
-
e.preventDefault();
|
|
656
|
-
e.stopPropagation();
|
|
657
|
-
});
|
|
658
|
-
closeButton.addEventListener('touchend', (e) => {
|
|
659
|
-
e.preventDefault();
|
|
660
|
-
e.stopPropagation();
|
|
661
|
-
this.close();
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
closeButton.addEventListener('mouseenter', () => {
|
|
665
|
-
Object.assign(closeButton.style, {
|
|
666
|
-
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
667
|
-
transform: 'scale(1.1)'
|
|
668
|
-
});
|
|
669
|
-
});
|
|
670
|
-
closeButton.addEventListener('mouseleave', () => {
|
|
671
|
-
Object.assign(closeButton.style, {
|
|
672
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
673
|
-
transform: 'scale(1)'
|
|
674
|
-
});
|
|
675
|
-
});
|
|
676
|
-
// 创建强制点击区域(所有设备)
|
|
677
|
-
const clickArea = document.createElement('div');
|
|
678
|
-
clickArea.style.cssText = `
|
|
679
|
-
position: fixed;
|
|
680
|
-
top: 0px;
|
|
681
|
-
right: 0px;
|
|
682
|
-
width: 60px;
|
|
683
|
-
height: 60px;
|
|
684
|
-
z-index: 2147483647;
|
|
685
|
-
background: transparent;
|
|
686
|
-
pointer-events: auto;
|
|
687
|
-
touch-action: manipulation;
|
|
688
|
-
`;
|
|
689
|
-
clickArea.addEventListener('touchstart', (e) => {
|
|
690
|
-
e.preventDefault();
|
|
691
|
-
e.stopPropagation();
|
|
692
|
-
this.close();
|
|
693
|
-
}, { passive: false });
|
|
694
|
-
clickArea.addEventListener('click', (e) => {
|
|
695
|
-
e.preventDefault();
|
|
696
|
-
e.stopPropagation();
|
|
697
|
-
this.close();
|
|
698
|
-
});
|
|
699
|
-
// 添加到body而不是container,确保在最顶层
|
|
700
|
-
document.body.appendChild(clickArea);
|
|
701
|
-
// 保存引用以便清理
|
|
702
|
-
this.forceClickArea = clickArea;
|
|
703
|
-
// 将关闭按钮添加到容器内
|
|
704
|
-
this.containerElement?.appendChild(closeButton);
|
|
705
|
-
}
|
|
706
702
|
/**
|
|
707
703
|
* 检测设备类型
|
|
708
704
|
*/
|
package/dist/customer-sdk.esm.js
CHANGED
|
@@ -5,6 +5,13 @@ class IconManager {
|
|
|
5
5
|
this.badgeElement = null;
|
|
6
6
|
this.onClickCallback = null;
|
|
7
7
|
this.notificationCallback = null;
|
|
8
|
+
this.isDragging = false;
|
|
9
|
+
this.dragStartX = 0;
|
|
10
|
+
this.dragStartY = 0;
|
|
11
|
+
this.iconStartX = 0;
|
|
12
|
+
this.iconStartY = 0;
|
|
13
|
+
this.dragMoveHandler = null;
|
|
14
|
+
this.dragEndHandler = null;
|
|
8
15
|
}
|
|
9
16
|
/**
|
|
10
17
|
* 显示悬浮图标
|
|
@@ -40,8 +47,8 @@ class IconManager {
|
|
|
40
47
|
this.iconElement.textContent = '💬';
|
|
41
48
|
this.iconElement.style.fontSize = '24px';
|
|
42
49
|
this.iconElement.style.color = '#ffffff';
|
|
43
|
-
//
|
|
44
|
-
this.
|
|
50
|
+
// 添加拖动和点击事件
|
|
51
|
+
this.setupDragEvents();
|
|
45
52
|
// 添加到页面
|
|
46
53
|
document.body.appendChild(this.iconElement);
|
|
47
54
|
console.log('CustomerSDK icon displayed');
|
|
@@ -50,10 +57,25 @@ class IconManager {
|
|
|
50
57
|
* 隐藏悬浮图标
|
|
51
58
|
*/
|
|
52
59
|
hide() {
|
|
60
|
+
// 清理所有事件监听器
|
|
61
|
+
if (this.isDragging) {
|
|
62
|
+
this.handleDragEnd();
|
|
63
|
+
}
|
|
64
|
+
// 清理document上的事件监听器(防止内存泄漏)
|
|
65
|
+
if (this.dragMoveHandler) {
|
|
66
|
+
document.removeEventListener('mousemove', this.dragMoveHandler);
|
|
67
|
+
document.removeEventListener('touchmove', this.dragMoveHandler);
|
|
68
|
+
}
|
|
69
|
+
if (this.dragEndHandler) {
|
|
70
|
+
document.removeEventListener('mouseup', this.dragEndHandler);
|
|
71
|
+
document.removeEventListener('touchend', this.dragEndHandler);
|
|
72
|
+
}
|
|
53
73
|
if (this.iconElement) {
|
|
54
74
|
this.iconElement.remove();
|
|
55
75
|
this.iconElement = null;
|
|
56
76
|
this.onClickCallback = null;
|
|
77
|
+
this.dragMoveHandler = null;
|
|
78
|
+
this.dragEndHandler = null;
|
|
57
79
|
console.log('CustomerSDK icon hidden');
|
|
58
80
|
}
|
|
59
81
|
}
|
|
@@ -110,6 +132,132 @@ class IconManager {
|
|
|
110
132
|
}
|
|
111
133
|
console.log('Notification cleared');
|
|
112
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* 设置拖动和点击事件
|
|
137
|
+
*/
|
|
138
|
+
setupDragEvents() {
|
|
139
|
+
if (!this.iconElement)
|
|
140
|
+
return;
|
|
141
|
+
// 绑定事件处理器(用于后续清理)
|
|
142
|
+
this.dragMoveHandler = this.handleDragMove.bind(this);
|
|
143
|
+
this.dragEndHandler = this.handleDragEnd.bind(this);
|
|
144
|
+
// 只在图标上监听开始事件
|
|
145
|
+
this.iconElement.addEventListener('mousedown', this.handleDragStart.bind(this));
|
|
146
|
+
this.iconElement.addEventListener('touchstart', this.handleDragStart.bind(this), { passive: false });
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 开始拖动
|
|
150
|
+
*/
|
|
151
|
+
handleDragStart(e) {
|
|
152
|
+
if (!this.iconElement)
|
|
153
|
+
return;
|
|
154
|
+
// 只处理图标上的事件
|
|
155
|
+
if (e.target !== this.iconElement && !this.iconElement.contains(e.target)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
const clientX = 'touches' in e ? e.touches[0].clientX : e.clientX;
|
|
161
|
+
const clientY = 'touches' in e ? e.touches[0].clientY : e.clientY;
|
|
162
|
+
this.isDragging = false;
|
|
163
|
+
this.dragStartX = clientX;
|
|
164
|
+
this.dragStartY = clientY;
|
|
165
|
+
// 获取图标当前位置
|
|
166
|
+
const rect = this.iconElement.getBoundingClientRect();
|
|
167
|
+
this.iconStartX = rect.left;
|
|
168
|
+
this.iconStartY = rect.top;
|
|
169
|
+
// 添加拖动样式
|
|
170
|
+
this.iconElement.style.transition = 'none';
|
|
171
|
+
this.iconElement.style.cursor = 'grabbing';
|
|
172
|
+
// 只在真正开始拖动时添加document事件监听
|
|
173
|
+
// 先添加一个临时的move监听器来检测是否真的在拖动
|
|
174
|
+
const checkDrag = (moveEvent) => {
|
|
175
|
+
const moveX = 'touches' in moveEvent ? moveEvent.touches[0].clientX : moveEvent.clientX;
|
|
176
|
+
const moveY = 'touches' in moveEvent ? moveEvent.touches[0].clientY : moveEvent.clientY;
|
|
177
|
+
const deltaX = moveX - this.dragStartX;
|
|
178
|
+
const deltaY = moveY - this.dragStartY;
|
|
179
|
+
// 如果移动距离超过5px,开始拖动
|
|
180
|
+
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
|
|
181
|
+
this.isDragging = true;
|
|
182
|
+
// 移除临时监听器
|
|
183
|
+
if ('touches' in moveEvent) {
|
|
184
|
+
document.removeEventListener('touchmove', checkDrag);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
document.removeEventListener('mousemove', checkDrag);
|
|
188
|
+
}
|
|
189
|
+
// 添加正式的事件监听器
|
|
190
|
+
if (this.dragMoveHandler && this.dragEndHandler) {
|
|
191
|
+
if ('touches' in moveEvent) {
|
|
192
|
+
document.addEventListener('touchmove', this.dragMoveHandler, { passive: false });
|
|
193
|
+
document.addEventListener('touchend', this.dragEndHandler);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
document.addEventListener('mousemove', this.dragMoveHandler);
|
|
197
|
+
document.addEventListener('mouseup', this.dragEndHandler);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
// 添加临时检测监听器
|
|
203
|
+
if ('touches' in e) {
|
|
204
|
+
document.addEventListener('touchmove', checkDrag, { passive: false });
|
|
205
|
+
document.addEventListener('touchend', this.dragEndHandler);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
document.addEventListener('mousemove', checkDrag);
|
|
209
|
+
document.addEventListener('mouseup', this.dragEndHandler);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* 拖动中
|
|
214
|
+
*/
|
|
215
|
+
handleDragMove(e) {
|
|
216
|
+
if (!this.iconElement || !this.isDragging)
|
|
217
|
+
return;
|
|
218
|
+
e.preventDefault();
|
|
219
|
+
e.stopPropagation();
|
|
220
|
+
const clientX = 'touches' in e ? e.touches[0].clientX : e.clientX;
|
|
221
|
+
const clientY = 'touches' in e ? e.touches[0].clientY : e.clientY;
|
|
222
|
+
const deltaX = clientX - this.dragStartX;
|
|
223
|
+
const deltaY = clientY - this.dragStartY;
|
|
224
|
+
// 计算新位置
|
|
225
|
+
const newX = this.iconStartX + deltaX;
|
|
226
|
+
const newY = this.iconStartY + deltaY;
|
|
227
|
+
// 限制在视口内
|
|
228
|
+
const maxX = window.innerWidth - this.iconElement.offsetWidth;
|
|
229
|
+
const maxY = window.innerHeight - this.iconElement.offsetHeight;
|
|
230
|
+
const clampedX = Math.max(0, Math.min(newX, maxX));
|
|
231
|
+
const clampedY = Math.max(0, Math.min(newY, maxY));
|
|
232
|
+
// 更新位置
|
|
233
|
+
this.iconElement.style.left = `${clampedX}px`;
|
|
234
|
+
this.iconElement.style.top = `${clampedY}px`;
|
|
235
|
+
this.iconElement.style.right = 'auto';
|
|
236
|
+
this.iconElement.style.bottom = 'auto';
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 结束拖动
|
|
240
|
+
*/
|
|
241
|
+
handleDragEnd(e) {
|
|
242
|
+
if (!this.iconElement)
|
|
243
|
+
return;
|
|
244
|
+
// 清理document上的事件监听器
|
|
245
|
+
if (this.dragMoveHandler) {
|
|
246
|
+
document.removeEventListener('mousemove', this.dragMoveHandler);
|
|
247
|
+
document.removeEventListener('touchmove', this.dragMoveHandler);
|
|
248
|
+
}
|
|
249
|
+
if (this.dragEndHandler) {
|
|
250
|
+
document.removeEventListener('mouseup', this.dragEndHandler);
|
|
251
|
+
document.removeEventListener('touchend', this.dragEndHandler);
|
|
252
|
+
}
|
|
253
|
+
this.iconElement.style.transition = 'transform 0.2s ease';
|
|
254
|
+
this.iconElement.style.cursor = 'pointer';
|
|
255
|
+
// 如果只是点击(没有拖动),触发点击事件
|
|
256
|
+
if (!this.isDragging) {
|
|
257
|
+
this.handleClick();
|
|
258
|
+
}
|
|
259
|
+
this.isDragging = false;
|
|
260
|
+
}
|
|
113
261
|
/**
|
|
114
262
|
* 处理点击事件
|
|
115
263
|
*/
|
|
@@ -174,7 +322,6 @@ class IframeManager {
|
|
|
174
322
|
this.iframeElement = null;
|
|
175
323
|
this.overlayElement = null;
|
|
176
324
|
this.containerElement = null; // 包装容器,包含iframe和关闭按钮
|
|
177
|
-
this.forceClickArea = null; // 强制点击区域
|
|
178
325
|
this.isOpen = false;
|
|
179
326
|
this.isCreated = false;
|
|
180
327
|
this.config = {
|
|
@@ -247,10 +394,6 @@ class IframeManager {
|
|
|
247
394
|
// 禁用body滚动,防止出现滚动条
|
|
248
395
|
this.preventBodyScroll(true);
|
|
249
396
|
}
|
|
250
|
-
// 添加关闭按钮(如果是首次显示)
|
|
251
|
-
if (this.config.allowClose && !this.containerElement.querySelector('.customer-sdk-close-btn')) {
|
|
252
|
-
this.addCloseButton();
|
|
253
|
-
}
|
|
254
397
|
}
|
|
255
398
|
this.isOpen = true;
|
|
256
399
|
console.log('CustomerSDK iframe shown');
|
|
@@ -304,11 +447,6 @@ class IframeManager {
|
|
|
304
447
|
*/
|
|
305
448
|
destroy() {
|
|
306
449
|
this.hide();
|
|
307
|
-
// 清理强制点击区域
|
|
308
|
-
if (this.forceClickArea) {
|
|
309
|
-
this.forceClickArea.remove();
|
|
310
|
-
this.forceClickArea = null;
|
|
311
|
-
}
|
|
312
450
|
if (this.containerElement) {
|
|
313
451
|
this.containerElement.remove();
|
|
314
452
|
this.containerElement = null;
|
|
@@ -557,148 +695,6 @@ class IframeManager {
|
|
|
557
695
|
window.scrollTo(0, scrollY);
|
|
558
696
|
}
|
|
559
697
|
}
|
|
560
|
-
/**
|
|
561
|
-
* 添加关闭按钮(自适应设备)
|
|
562
|
-
*/
|
|
563
|
-
addCloseButton() {
|
|
564
|
-
if (!this.iframeElement)
|
|
565
|
-
return;
|
|
566
|
-
const actualMode = this.getActualMode();
|
|
567
|
-
const isPC = actualMode === 'popup';
|
|
568
|
-
const closeButton = document.createElement('button');
|
|
569
|
-
closeButton.className = 'customer-sdk-close-btn';
|
|
570
|
-
closeButton.innerHTML = '×';
|
|
571
|
-
const buttonStyles = isPC ? {
|
|
572
|
-
// PC模式:现代半透明设计
|
|
573
|
-
position: 'absolute',
|
|
574
|
-
top: '8px',
|
|
575
|
-
right: '8px',
|
|
576
|
-
width: '28px',
|
|
577
|
-
height: '28px',
|
|
578
|
-
borderRadius: '50%',
|
|
579
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
580
|
-
color: '#ffffff',
|
|
581
|
-
border: 'none',
|
|
582
|
-
fontSize: '16px',
|
|
583
|
-
fontWeight: '300',
|
|
584
|
-
cursor: 'pointer',
|
|
585
|
-
zIndex: '2147483647', // 最大z-index值
|
|
586
|
-
display: 'flex',
|
|
587
|
-
alignItems: 'center',
|
|
588
|
-
justifyContent: 'center',
|
|
589
|
-
transition: 'all 0.2s ease',
|
|
590
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, sans-serif',
|
|
591
|
-
userSelect: 'none',
|
|
592
|
-
backdropFilter: 'blur(8px)',
|
|
593
|
-
boxShadow: '0 2px 12px rgba(0, 0, 0, 0.15)',
|
|
594
|
-
pointerEvents: 'auto',
|
|
595
|
-
touchAction: 'manipulation'
|
|
596
|
-
} : {
|
|
597
|
-
// 移动端模式:现代半透明设计
|
|
598
|
-
position: 'absolute',
|
|
599
|
-
top: '2px',
|
|
600
|
-
right: '2px',
|
|
601
|
-
width: '30px',
|
|
602
|
-
height: '30px',
|
|
603
|
-
borderRadius: '50%',
|
|
604
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
605
|
-
color: '#ffffff',
|
|
606
|
-
border: 'none',
|
|
607
|
-
fontSize: '18px',
|
|
608
|
-
fontWeight: '300',
|
|
609
|
-
cursor: 'pointer',
|
|
610
|
-
zIndex: '2147483647', // 最大z-index值
|
|
611
|
-
display: 'flex',
|
|
612
|
-
alignItems: 'center',
|
|
613
|
-
justifyContent: 'center',
|
|
614
|
-
transition: 'all 0.2s ease',
|
|
615
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, sans-serif',
|
|
616
|
-
userSelect: 'none',
|
|
617
|
-
backdropFilter: 'blur(8px)',
|
|
618
|
-
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
|
|
619
|
-
pointerEvents: 'auto',
|
|
620
|
-
touchAction: 'manipulation',
|
|
621
|
-
WebkitTouchCallout: 'none',
|
|
622
|
-
WebkitUserSelect: 'none',
|
|
623
|
-
WebkitTapHighlightColor: 'transparent'
|
|
624
|
-
};
|
|
625
|
-
Object.assign(closeButton.style, buttonStyles);
|
|
626
|
-
// iOS Safari特殊处理
|
|
627
|
-
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
628
|
-
if (isIOS) {
|
|
629
|
-
// iOS Safari需要特殊处理
|
|
630
|
-
closeButton.addEventListener('touchstart', (e) => {
|
|
631
|
-
e.preventDefault();
|
|
632
|
-
e.stopPropagation();
|
|
633
|
-
// 立即触发关闭,不等待touchend
|
|
634
|
-
this.close();
|
|
635
|
-
}, { passive: false });
|
|
636
|
-
// 添加click事件作为备用
|
|
637
|
-
closeButton.addEventListener('click', (e) => {
|
|
638
|
-
e.preventDefault();
|
|
639
|
-
e.stopPropagation();
|
|
640
|
-
this.close();
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
else {
|
|
644
|
-
// 其他浏览器正常处理
|
|
645
|
-
closeButton.addEventListener('click', (e) => {
|
|
646
|
-
e.preventDefault();
|
|
647
|
-
e.stopPropagation();
|
|
648
|
-
this.close();
|
|
649
|
-
});
|
|
650
|
-
closeButton.addEventListener('touchstart', (e) => {
|
|
651
|
-
e.preventDefault();
|
|
652
|
-
e.stopPropagation();
|
|
653
|
-
});
|
|
654
|
-
closeButton.addEventListener('touchend', (e) => {
|
|
655
|
-
e.preventDefault();
|
|
656
|
-
e.stopPropagation();
|
|
657
|
-
this.close();
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
closeButton.addEventListener('mouseenter', () => {
|
|
661
|
-
Object.assign(closeButton.style, {
|
|
662
|
-
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
663
|
-
transform: 'scale(1.1)'
|
|
664
|
-
});
|
|
665
|
-
});
|
|
666
|
-
closeButton.addEventListener('mouseleave', () => {
|
|
667
|
-
Object.assign(closeButton.style, {
|
|
668
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
669
|
-
transform: 'scale(1)'
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
// 创建强制点击区域(所有设备)
|
|
673
|
-
const clickArea = document.createElement('div');
|
|
674
|
-
clickArea.style.cssText = `
|
|
675
|
-
position: fixed;
|
|
676
|
-
top: 0px;
|
|
677
|
-
right: 0px;
|
|
678
|
-
width: 60px;
|
|
679
|
-
height: 60px;
|
|
680
|
-
z-index: 2147483647;
|
|
681
|
-
background: transparent;
|
|
682
|
-
pointer-events: auto;
|
|
683
|
-
touch-action: manipulation;
|
|
684
|
-
`;
|
|
685
|
-
clickArea.addEventListener('touchstart', (e) => {
|
|
686
|
-
e.preventDefault();
|
|
687
|
-
e.stopPropagation();
|
|
688
|
-
this.close();
|
|
689
|
-
}, { passive: false });
|
|
690
|
-
clickArea.addEventListener('click', (e) => {
|
|
691
|
-
e.preventDefault();
|
|
692
|
-
e.stopPropagation();
|
|
693
|
-
this.close();
|
|
694
|
-
});
|
|
695
|
-
// 添加到body而不是container,确保在最顶层
|
|
696
|
-
document.body.appendChild(clickArea);
|
|
697
|
-
// 保存引用以便清理
|
|
698
|
-
this.forceClickArea = clickArea;
|
|
699
|
-
// 将关闭按钮添加到容器内
|
|
700
|
-
this.containerElement?.appendChild(closeButton);
|
|
701
|
-
}
|
|
702
698
|
/**
|
|
703
699
|
* 检测设备类型
|
|
704
700
|
*/
|
package/dist/customer-sdk.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CustomerSDK={})}(this,function(e){"use strict";class t{constructor(){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null}async show(){this.iconElement||(this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon",Object.assign(this.iconElement.style,{position:"fixed",width:"40px",height:"40px",backgroundColor:"#007bff",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"999999",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",bottom:"20px",right:"20px"}),this.iconElement.textContent="💬",this.iconElement.style.fontSize="24px",this.iconElement.style.color="#ffffff",this.iconElement.addEventListener("click",this.handleClick.bind(this)),document.body.appendChild(this.iconElement))}hide(){this.iconElement&&(this.iconElement.remove(),this.iconElement=null,this.onClickCallback=null)}setPosition(e){}setStyle(e){}onClick(e){this.onClickCallback=e}onNotification(e){this.notificationCallback=e}showNotification(e){if(!this.iconElement)return;const{showBadge:t=!0,badgeCount:n=0,badgeText:i="",pulse:o=!1}=e;(t||n>0)&&this.createBadge(n,i,o),this.notificationCallback&&this.notificationCallback({badgeCount:n,badgeText:i,pulse:o})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null)}handleClick(){this.onClickCallback&&this.onClickCallback()}createBadge(e,t="",n=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=e>0?e>99?"99+":e.toString():t||"",Object.assign(this.badgeElement.style,{position:"absolute",top:"2px",right:"2px",minWidth:"18px",height:"18px",borderRadius:"50%",backgroundColor:"#ff4444",color:"#ffffff",fontSize:"10px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000001",boxShadow:"0 -1px 4px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15)",...0===e&&""===t&&{width:"12px",height:"12px",minWidth:"12px"},...n&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}class n{constructor(e={}){this.iframeElement=null,this.overlayElement=null,this.containerElement=null,this.forceClickArea=null,this.isOpen=!1,this.isCreated=!1,this.config={src:"",mode:"auto",width:400,height:600,allowClose:!0,...e},this.setupMessageListener()}async init(){try{this.createIframe(),this.isCreated=!0}catch(e){throw e}}show(){if(!this.isOpen){if(!this.isCreated)throw new Error("Iframe not initialized. Call init() first.");try{const e="popup"===this.getActualMode();e&&this.createOverlay(),this.containerElement&&(e?(Object.assign(this.containerElement.style,{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",visibility:"visible",opacity:"1",display:"block"}),this.overlayElement?.appendChild(this.containerElement)):(Object.assign(this.containerElement.style,{position:"fixed",visibility:"visible",opacity:"1",display:"block"}),this.preventBodyScroll(!0)),this.config.allowClose&&!this.containerElement.querySelector(".customer-sdk-close-btn")&&this.addCloseButton()),this.isOpen=!0}catch(e){}}}open(){this.show()}hide(){if(!this.isOpen)return;this.containerElement&&Object.assign(this.containerElement.style,{visibility:"hidden",opacity:"0",display:"none"}),this.overlayElement&&(this.overlayElement.remove(),this.overlayElement=null);"fullscreen"===this.getActualMode()&&this.preventBodyScroll(!1),this.isOpen=!1}close(){this.hide()}destroy(){this.hide(),this.forceClickArea&&(this.forceClickArea.remove(),this.forceClickArea=null),this.containerElement&&(this.containerElement.remove(),this.containerElement=null,this.iframeElement=null),this.isCreated=!1}isIframeOpen(){return this.isOpen}sendToIframe(e){this.iframeElement&&this.iframeElement.contentWindow&&this.iframeElement.contentWindow.postMessage(e,"*")}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.className="customer-sdk-overlay",Object.assign(this.overlayElement.style,{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"999998",display:"flex",alignItems:"center",justifyContent:"center",cursor:this.config.allowClose?"pointer":"default"}),this.config.allowClose&&this.overlayElement.addEventListener("click",e=>{e.target===this.overlayElement&&this.close()}),document.body.appendChild(this.overlayElement)}createIframe(){this.containerElement=document.createElement("div"),this.containerElement.className="customer-sdk-container",this.iframeElement=document.createElement("iframe"),this.iframeElement.className="customer-sdk-iframe",this.iframeElement.src=this.config.src||"",this.iframeElement.frameBorder="0",this.iframeElement.setAttribute("allow",["microphone","camera","geolocation","clipboard-read","clipboard-write","fullscreen","autoplay","encrypted-media"].join("; ")),this.iframeElement.setAttribute("sandbox",["allow-same-origin","allow-scripts","allow-forms","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-storage-access-by-user-activation"].join(" "));const e="popup"===this.getActualMode();this.iframeElement.scrolling=e?"auto":"no";const t={width:e?`${this.config.width}px`:"100%",height:e?`${this.config.height}px`:"100%",maxWidth:e?"450px":"100%",maxHeight:e?"700px":"100%",backgroundColor:"#ffffff",borderRadius:e?"12px":"12px 12px 0 0",boxShadow:e?"0 20px 40px rgba(0, 0, 0, 0.15)":"0 -4px 16px rgba(0, 0, 0, 0.25)",border:"none",position:"fixed",zIndex:"999999",...e?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:"0",left:"0",bottom:"0",right:"0",transform:"none",overflow:"hidden",position:"fixed"},visibility:"hidden",opacity:"0",display:"none"};Object.assign(this.containerElement.style,t);const n={width:"100%",height:"100%",border:"none",borderRadius:"inherit",...e?{}:{overflow:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitScrollbar:"none"}};Object.assign(this.iframeElement.style,n),this.containerElement.appendChild(this.iframeElement),this.iframeElement.addEventListener("load",()=>{e||this.injectMobileStyles()}),document.body.appendChild(this.containerElement)}injectMobileStyles(){if(this.iframeElement)try{const e=this.iframeElement.contentDocument||this.iframeElement.contentWindow?.document;if(e){const t=e.createElement("style");t.textContent="\n /* 移动端iframe全屏样式优化 */\n * {\n -webkit-overflow-scrolling: touch !important;\n }\n \n body, html, #app, .container {\n overflow: auto !important;\n -webkit-overflow-scrolling: touch !important;\n }\n \n /* 隐藏所有滚动条 */\n ::-webkit-scrollbar {\n width: 0px !important;\n height: 0px !important;\n background: transparent !important;\n }\n \n /* Firefox */\n html {\n scrollbar-width: none !important;\n }\n \n /* IE/Edge */\n body {\n -ms-overflow-style: none !important;\n }\n \n /* 确保内容可以滚动 */\n body {\n overflow: auto !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ",e.head?.appendChild(t)}}catch(e){}}preventBodyScroll(e){if(e){const e=window.scrollY;Object.assign(document.body.style,{position:"fixed",top:`-${e}px`,width:"100%",overflow:"hidden"}),document.body.setAttribute("data-scroll-position",e.toString())}else{const e=parseInt(document.body.getAttribute("data-scroll-position")||"0");Object.assign(document.body.style,{position:"",top:"",width:"",overflow:""}),document.body.removeAttribute("data-scroll-position"),window.scrollTo(0,e)}}addCloseButton(){if(!this.iframeElement)return;const e="popup"===this.getActualMode(),t=document.createElement("button");t.className="customer-sdk-close-btn",t.innerHTML="×";const n=e?{position:"absolute",top:"8px",right:"8px",width:"28px",height:"28px",borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.6)",color:"#ffffff",border:"none",fontSize:"16px",fontWeight:"300",cursor:"pointer",zIndex:"2147483647",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",fontFamily:"-apple-system, BlinkMacSystemFont, sans-serif",userSelect:"none",backdropFilter:"blur(8px)",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.15)",pointerEvents:"auto",touchAction:"manipulation"}:{position:"absolute",top:"2px",right:"2px",width:"30px",height:"30px",borderRadius:"50%",backgroundColor:"rgba(0, 0, 0, 0.6)",color:"#ffffff",border:"none",fontSize:"18px",fontWeight:"300",cursor:"pointer",zIndex:"2147483647",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",fontFamily:"-apple-system, BlinkMacSystemFont, sans-serif",userSelect:"none",backdropFilter:"blur(8px)",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.2)",pointerEvents:"auto",touchAction:"manipulation",WebkitTouchCallout:"none",WebkitUserSelect:"none",WebkitTapHighlightColor:"transparent"};Object.assign(t.style,n);/iPad|iPhone|iPod/.test(navigator.userAgent)?(t.addEventListener("touchstart",e=>{e.preventDefault(),e.stopPropagation(),this.close()},{passive:!1}),t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.close()})):(t.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.close()}),t.addEventListener("touchstart",e=>{e.preventDefault(),e.stopPropagation()}),t.addEventListener("touchend",e=>{e.preventDefault(),e.stopPropagation(),this.close()})),t.addEventListener("mouseenter",()=>{Object.assign(t.style,{backgroundColor:"rgba(0, 0, 0, 0.8)",transform:"scale(1.1)"})}),t.addEventListener("mouseleave",()=>{Object.assign(t.style,{backgroundColor:"rgba(0, 0, 0, 0.6)",transform:"scale(1)"})});const i=document.createElement("div");i.style.cssText="\n position: fixed;\n top: 0px;\n right: 0px;\n width: 60px;\n height: 60px;\n z-index: 2147483647;\n background: transparent;\n pointer-events: auto;\n touch-action: manipulation;\n ",i.addEventListener("touchstart",e=>{e.preventDefault(),e.stopPropagation(),this.close()},{passive:!1}),i.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this.close()}),document.body.appendChild(i),this.forceClickArea=i,this.containerElement?.appendChild(t)}isMobileDevice(){return window.innerWidth<=768||/Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent)}getActualMode(){return"auto"===this.config.mode?this.isMobileDevice()?"fullscreen":"popup":this.config.mode}setupMessageListener(){window.addEventListener("message",e=>{this.config.src&&e.origin!==new URL(this.config.src).origin||this.handleIframeMessage(e.data)},!1)}handleIframeMessage(e){let t;if("string"==typeof e)t=e;else{if(!e||!e.type)return;t=e.type}switch(t){case"iframe_ready":break;case"close_iframe":case"close":this.close();break;case"resize_iframe":case"resize":e.width&&e.height&&this.resizeIframe(e.width,e.height);break;case"new-message":this.config.onMessage&&this.config.onMessage(t,e)}}resizeIframe(e,t){this.iframeElement&&(this.iframeElement.style.width=`${e}px`,this.iframeElement.style.height=`${t}px`)}}var i=function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};function o(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{s(i.next(e))}catch(e){r(e)}}function c(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,c)}s((i=i.apply(e,t||[])).next())})}function r(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&c[0]?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],i=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function a(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var c="4.6.2";function s(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function l(e){return!!e&&"function"==typeof e.then}function u(e,t){try{var n=e();l(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function d(e,t,n){return void 0===n&&(n=16),o(this,void 0,void 0,function(){var i,o,a,c;return r(this,function(r){switch(r.label){case 0:i=Array(e.length),o=Date.now(),a=0,r.label=1;case 1:return a<e.length?(i[a]=t(e[a],a),(c=Date.now())>=o+n?(o=c,[4,new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})]):[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return++a,[3,1];case 4:return[2,i]}})})}function f(e){return e.then(void 0,function(){}),e}function m(e){return parseInt(e)}function h(e){return parseFloat(e)}function p(e,t){return"number"==typeof e&&isNaN(e)?t:e}function v(e){return e.reduce(function(e,t){return e+(t?1:0)},0)}function b(e,t){if(void 0===t&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function g(e,t){var n=e[0]>>>16,i=65535&e[0],o=e[1]>>>16,r=65535&e[1],a=t[0]>>>16,c=65535&t[0],s=t[1]>>>16,l=0,u=0,d=0,f=0;d+=(f+=r+(65535&t[1]))>>>16,f&=65535,u+=(d+=o+s)>>>16,d&=65535,l+=(u+=i+c)>>>16,u&=65535,l+=n+a,l&=65535,e[0]=l<<16|u,e[1]=d<<16|f}function y(e,t){var n=e[0]>>>16,i=65535&e[0],o=e[1]>>>16,r=65535&e[1],a=t[0]>>>16,c=65535&t[0],s=t[1]>>>16,l=65535&t[1],u=0,d=0,f=0,m=0;f+=(m+=r*l)>>>16,m&=65535,d+=(f+=o*l)>>>16,f&=65535,d+=(f+=r*s)>>>16,f&=65535,u+=(d+=i*l)>>>16,d&=65535,u+=(d+=o*s)>>>16,d&=65535,u+=(d+=r*c)>>>16,d&=65535,u+=n*l+i*s+o*c+r*a,u&=65535,e[0]=u<<16|d,e[1]=f<<16|m}function w(e,t){var n=e[0];32===(t%=64)?(e[0]=e[1],e[1]=n):t<32?(e[0]=n<<t|e[1]>>>32-t,e[1]=e[1]<<t|n>>>32-t):(t-=32,e[0]=e[1]<<t|n>>>32-t,e[1]=n<<t|e[1]>>>32-t)}function k(e,t){0!==(t%=64)&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function x(e,t){e[0]^=t[0],e[1]^=t[1]}var L=[4283543511,3981806797],E=[3301882366,444984403];function S(e){var t=[0,e[0]>>>1];x(e,t),y(e,L),t[1]=e[0]>>>1,x(e,t),y(e,E),t[1]=e[0]>>>1,x(e,t)}var C=[2277735313,289559509],I=[1291169091,658871167],M=[0,5],V=[0,1390208809],W=[0,944331445];function Z(e,t){var n=function(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++){var i=e.charCodeAt(n);if(i>127)return(new TextEncoder).encode(e);t[n]=i}return t}(e);t=t||0;var i,o=[0,n.length],r=o[1]%16,a=o[1]-r,c=[0,t],s=[0,t],l=[0,0],u=[0,0];for(i=0;i<a;i+=16)l[0]=n[i+4]|n[i+5]<<8|n[i+6]<<16|n[i+7]<<24,l[1]=n[i]|n[i+1]<<8|n[i+2]<<16|n[i+3]<<24,u[0]=n[i+12]|n[i+13]<<8|n[i+14]<<16|n[i+15]<<24,u[1]=n[i+8]|n[i+9]<<8|n[i+10]<<16|n[i+11]<<24,y(l,C),w(l,31),y(l,I),x(c,l),w(c,27),g(c,s),y(c,M),g(c,V),y(u,I),w(u,33),y(u,C),x(s,u),w(s,31),g(s,c),y(s,M),g(s,W);l[0]=0,l[1]=0,u[0]=0,u[1]=0;var d=[0,0];switch(r){case 15:d[1]=n[i+14],k(d,48),x(u,d);case 14:d[1]=n[i+13],k(d,40),x(u,d);case 13:d[1]=n[i+12],k(d,32),x(u,d);case 12:d[1]=n[i+11],k(d,24),x(u,d);case 11:d[1]=n[i+10],k(d,16),x(u,d);case 10:d[1]=n[i+9],k(d,8),x(u,d);case 9:d[1]=n[i+8],x(u,d),y(u,I),w(u,33),y(u,C),x(s,u);case 8:d[1]=n[i+7],k(d,56),x(l,d);case 7:d[1]=n[i+6],k(d,48),x(l,d);case 6:d[1]=n[i+5],k(d,40),x(l,d);case 5:d[1]=n[i+4],k(d,32),x(l,d);case 4:d[1]=n[i+3],k(d,24),x(l,d);case 3:d[1]=n[i+2],k(d,16),x(l,d);case 2:d[1]=n[i+1],k(d,8),x(l,d);case 1:d[1]=n[i],x(l,d),y(l,C),w(l,31),y(l,I),x(c,l)}return x(c,o),x(s,o),g(c,s),g(s,c),S(c),S(s),g(c,s),g(s,c),("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)+("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)}function j(e,t,n,i){var a=Object.keys(e).filter(function(e){return!function(e,t){for(var n=0,i=e.length;n<i;++n)if(e[n]===t)return!0;return!1}(n,e)}),c=f(d(a,function(n){return function(e,t){var n=f(new Promise(function(n){var i=Date.now();u(e.bind(null,t),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=Date.now()-i;if(!e[0])return n(function(){return{error:e[1],duration:o}});var r=e[1];if(function(e){return"function"!=typeof e}(r))return n(function(){return{value:r,duration:o}});n(function(){return new Promise(function(e){var t=Date.now();u(r,function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var r=o+Date.now()-t;if(!n[0])return e({error:n[1],duration:r});e({value:n[1],duration:r})})})})})}));return function(){return n.then(function(e){return e()})}}(e[n],t)},i));return function(){return o(this,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){switch(r.label){case 0:return[4,c];case 1:return[4,d(r.sent(),function(e){return f(e())},i)];case 2:return e=r.sent(),[4,Promise.all(e)];case 3:for(t=r.sent(),n={},o=0;o<a.length;++o)n[a[o]]=t[o];return[2,n]}})})}}function R(){var e=window,t=navigator;return v(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function P(){var e=window,t=navigator;return v(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,0===(t.vendor||"").indexOf("Google"),"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function F(){var e=window;return v(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,0===navigator.vendor.indexOf("Apple"),"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function G(){var e=window,t=e.HTMLElement,n=e.Document;return v(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),n&&"pointerLockElement"in n.prototype])>=4}function N(){var e,t=window;return e=t.print,/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))&&"[object WebPageNamespace]"===String(t.browser)}function A(){var e,t,n=window;return v(["buildID"in navigator,"MozAppearance"in(null!==(t=null===(e=document.documentElement)||void 0===e?void 0:e.style)&&void 0!==t?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function Y(){var e=window,t=navigator,n=e.CSS,i=e.HTMLButtonElement;return v([!("getStorageUpdates"in t),i&&"popover"in i.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function X(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function H(){var e=P(),t=A(),n=window,i=navigator,o="connection";return e?v([!("SharedWorker"in n),i[o]&&"ontypechange"in i[o],!("sinkId"in new Audio)])>=2:!!t&&v(["onorientationchange"in n,"orientation"in n,/android/i.test(i.appVersion)])>=2}function T(e){var t=new Error(e);return t.name=e,t}function O(e,t,n){var i,a,c;return void 0===n&&(n=50),o(this,void 0,void 0,function(){var o,l;return r(this,function(r){switch(r.label){case 0:o=document,r.label=1;case 1:return o.body?[3,3]:[4,s(n)];case 2:return r.sent(),[3,1];case 3:l=o.createElement("iframe"),r.label=4;case 4:return r.trys.push([4,,10,11]),[4,new Promise(function(e,n){var i=!1,r=function(){i=!0,e()};l.onload=r,l.onerror=function(e){i=!0,n(e)};var a=l.style;a.setProperty("display","block","important"),a.position="absolute",a.top="0",a.left="0",a.visibility="hidden",t&&"srcdoc"in l?l.srcdoc=t:l.src="about:blank",o.body.appendChild(l);var c=function(){var e,t;i||("complete"===(null===(t=null===(e=l.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.readyState)?r():setTimeout(c,10))};c()})];case 5:r.sent(),r.label=6;case 6:return(null===(a=null===(i=l.contentWindow)||void 0===i?void 0:i.document)||void 0===a?void 0:a.body)?[3,8]:[4,s(n)];case 7:return r.sent(),[3,6];case 8:return[4,e(l,l.contentWindow)];case 9:return[2,r.sent()];case 10:return null===(c=l.parentNode)||void 0===c||c.removeChild(l),[7];case 11:return[2]}})})}function z(e){for(var t=function(e){for(var t,n,i="Unexpected syntax '".concat(e,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(e),r=o[1]||void 0,a={},c=/([.:#][\w-]+|\[.+?\])/gi,s=function(e,t){a[e]=a[e]||[],a[e].push(t)};;){var l=c.exec(o[2]);if(!l)break;var u=l[0];switch(u[0]){case".":s("class",u.slice(1));break;case"#":s("id",u.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(!d)throw new Error(i);s(d[1],null!==(n=null!==(t=d[4])&&void 0!==t?t:d[5])&&void 0!==n?n:"");break;default:throw new Error(i)}}return[r,a]}(e),n=t[0],i=t[1],o=document.createElement(null!=n?n:"div"),r=0,a=Object.keys(i);r<a.length;r++){var c=a[r],s=i[c].join(" ");"style"===c?D(o.style,s):o.setAttribute(c,s)}return o}function D(e,t){for(var n=0,i=t.split(";");n<i.length;n++){var o=i[n],r=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(o);if(r){var a=r[1],c=r[2],s=r[4];e.setProperty(a,c,s||"")}}}var J=["monospace","sans-serif","serif"],_=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function B(e){return e.toDataURL()}var U,Q;function K(){var e=this;return function(){if(void 0===Q){var e=function(){var t=q();$(t)?Q=setTimeout(e,2500):(U=t,Q=void 0)};e()}}(),function(){return o(e,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return $(e=q())?U?[2,a([],U,!0)]:(n=document).fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement?[4,X()]:[3,2]:[3,2];case 1:t.sent(),e=q(),t.label=2;case 2:return $(e)||(U=e),[2,e]}var n})})}}function q(){var e=screen;return[p(h(e.availTop),null),p(h(e.width)-h(e.availWidth)-p(h(e.availLeft),0),null),p(h(e.height)-h(e.availHeight)-p(h(e.availTop),0),null),p(h(e.availLeft),null)]}function $(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function ee(e){var t;return o(this,void 0,void 0,function(){var n,i,o,a,c,l,u;return r(this,function(r){switch(r.label){case 0:for(n=document,i=n.createElement("div"),o=new Array(e.length),a={},te(i),u=0;u<e.length;++u)"DIALOG"===(c=z(e[u])).tagName&&c.show(),te(l=n.createElement("div")),l.appendChild(c),i.appendChild(l),o[u]=c;r.label=1;case 1:return n.body?[3,3]:[4,s(50)];case 2:return r.sent(),[3,1];case 3:n.body.appendChild(i);try{for(u=0;u<e.length;++u)o[u].offsetParent||(a[e[u]]=!0)}finally{null===(t=i.parentNode)||void 0===t||t.removeChild(i)}return[2,a]}})})}function te(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function ne(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function ie(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}function oe(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function re(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function ae(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function ce(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var se=Math,le=function(){return 0};var ue={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var de=function(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return!0;throw e}e=t}};var fe=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),me=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),he=["FRAGMENT_SHADER","VERTEX_SHADER"],pe=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],ve="WEBGL_debug_renderer_info";function be(e){if(e.webgl)return e.webgl.context;var t,n=document.createElement("canvas");n.addEventListener("webglCreateContextError",function(){return t=void 0});for(var i=0,o=["webgl","experimental-webgl"];i<o.length;i++){var r=o[i];try{t=n.getContext(r)}catch(e){}if(t)break}return e.webgl={context:t},t}function ge(e,t,n){var i=e.getShaderPrecisionFormat(e[t],e[n]);return i?[i.rangeMin,i.rangeMax,i.precision]:[]}function ye(e){return Object.keys(e.__proto__).filter(we)}function we(e){return"string"==typeof e&&!e.match(/[^A-Z0-9_x]/)}function ke(){return A()}function xe(){return P()||F()}function Le(e){return"function"==typeof e.getParameter}var Ee={fonts:function(){var e=this;return O(function(t,n){var i=n.document;return o(e,void 0,void 0,function(){var e,t,n,o,a,c,s,l,u,d,f;return r(this,function(r){for((e=i.body).style.fontSize="48px",(t=i.createElement("div")).style.setProperty("visibility","hidden","important"),n={},o={},a=function(e){var n=i.createElement("span"),o=n.style;return o.position="absolute",o.top="0",o.left="0",o.fontFamily=e,n.textContent="mmMwWLliI0O&1",t.appendChild(n),n},c=function(e,t){return a("'".concat(e,"',").concat(t))},s=function(){for(var e={},t=function(t){e[t]=J.map(function(e){return c(t,e)})},n=0,i=_;n<i.length;n++){t(i[n])}return e},l=function(e){return J.some(function(t,i){return e[i].offsetWidth!==n[t]||e[i].offsetHeight!==o[t]})},u=function(){return J.map(a)}(),d=s(),e.appendChild(t),f=0;f<J.length;f++)n[J[f]]=u[f].offsetWidth,o[J[f]]=u[f].offsetHeight;return[2,_.filter(function(e){return l(d[e])})]})})})},domBlockers:function(e){var t=(void 0===e?{}:e).debug;return o(this,void 0,void 0,function(){var e,n,i,o,a;return r(this,function(r){switch(r.label){case 0:return F()||H()?(c=atob,e={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',c("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",c("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",c("LnNwb25zb3JpdA=="),".ylamainos",c("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",c("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",c("LmhlYWRlci1ibG9ja2VkLWFk"),c("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",c("I2FkXzMwMFgyNTA="),c("I2Jhbm5lcmZsb2F0MjI="),c("I2NhbXBhaWduLWJhbm5lcg=="),c("I0FkLUNvbnRlbnQ=")],adGuardChinese:[c("LlppX2FkX2FfSA=="),c("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",c("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),c("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",c("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",c("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",c("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),c("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),c("LmFkZ29vZ2xl"),c("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[c("YW1wLWF1dG8tYWRz"),c("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",c("I2FkX2ludmlld19hcmVh")],adGuardRussian:[c("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),c("LnJlY2xhbWE="),'div[id^="smi2adblock"]',c("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[c("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),c("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",c("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),c("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),c("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",c("I3Jla2xhbWk="),c("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),c("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),c("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[c("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",c("LndpZGdldF9wb19hZHNfd2lkZ2V0"),c("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",c("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[c("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),c("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",c("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",c("I3Jla2xhbW5pLWJveA=="),c("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",c("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[c("I2FkdmVydGVudGll"),c("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",c("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",c("LnNwb25zb3JsaW5rZ3J1ZW4="),c("I3dlcmJ1bmdza3k="),c("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),c("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[c("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",c("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[c("LnJla2xhbW9zX3RhcnBhcw=="),c("LnJla2xhbW9zX251b3JvZG9z"),c("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),c("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),c("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[c("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[c("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),c("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",c("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[c("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),c("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),c("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",c("LmFkX19tYWlu"),c("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[c("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[c("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),c("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[c("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),c("I2xpdmVyZUFkV3JhcHBlcg=="),c("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),c("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[c("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",c("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),c("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),c("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[c("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),c("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),c("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",c("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),c("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),c("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),c("ZGl2I3NrYXBpZWNfYWQ=")],ro:[c("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),c("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),c("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[c("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),c("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),c("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",c("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),c("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",c("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]},n=Object.keys(e),[4,ee((a=[]).concat.apply(a,n.map(function(t){return e[t]})))]):[2,void 0];case 1:return i=r.sent(),t&&function(e,t){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];"\n".concat(o,":");for(var r=0,a=e[o];r<a.length;r++){var c=a[r];"\n ".concat(t[c]?"🚫":"➡️"," ").concat(c)}}}(e,i),(o=n.filter(function(t){var n=e[t];return v(n.map(function(e){return i[e]}))>.6*n.length})).sort(),[2,o]}var c})})},fontPreferences:function(){return function(e,t){void 0===t&&(t=4e3);return O(function(n,i){var o=i.document,r=o.body,c=r.style;c.width="".concat(t,"px"),c.webkitTextSizeAdjust=c.textSizeAdjust="none",P()?r.style.zoom="".concat(1/i.devicePixelRatio):F()&&(r.style.zoom="reset");var s=o.createElement("div");return s.textContent=a([],Array(t/20|0),!0).map(function(){return"word"}).join(" "),r.appendChild(s),e(o,r)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}(function(e,t){for(var n={},i={},o=0,r=Object.keys(ue);o<r.length;o++){var a=r[o],c=ue[a],s=c[0],l=void 0===s?{}:s,u=c[1],d=void 0===u?"mmMwWLliI0fiflO&1":u,f=e.createElement("span");f.textContent=d,f.style.whiteSpace="nowrap";for(var m=0,h=Object.keys(l);m<h.length;m++){var p=h[m],v=l[p];void 0!==v&&(f.style[p]=v)}n[a]=f,t.append(e.createElement("br"),f)}for(var b=0,g=Object.keys(ue);b<g.length;b++){i[a=g[b]]=n[a].getBoundingClientRect().width}return i})},audio:function(){return F()&&Y()&&N()||P()&&(e=navigator,t=window,n=Audio.prototype,i=t.visualViewport,v(["srLatency"in n,"srChannelCount"in n,"devicePosture"in e,i&&"segments"in i,"getTextInformation"in Image.prototype])>=3)&&function(){var e=window,t=e.URLPattern;return v(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}()?-4:function(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(F()&&!G()&&!function(){var e=window;return v(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}())return-1;var n=4500,i=new t(1,5e3,44100),o=i.createOscillator();o.type="triangle",o.frequency.value=1e4;var r=i.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,o.connect(r),r.connect(i.destination),o.start(0);var a=function(e){var t=3,n=500,i=500,o=5e3,r=function(){},a=new Promise(function(a,c){var s=!1,u=0,d=0;e.oncomplete=function(e){return a(e.renderedBuffer)};var m=function(){setTimeout(function(){return c(T("timeout"))},Math.min(i,d+o-Date.now()))},h=function(){try{var i=e.startRendering();switch(l(i)&&f(i),e.state){case"running":d=Date.now(),s&&m();break;case"suspended":document.hidden||u++,s&&u>=t?c(T("suspended")):setTimeout(h,n)}}catch(e){c(e)}};h(),r=function(){s||(s=!0,d>0&&m())}});return[a,r]}(i),c=a[0],s=a[1],u=f(c.then(function(e){return function(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}(e.getChannelData(0).subarray(n))},function(e){if("timeout"===e.name||"suspended"===e.name)return-3;throw e}));return function(){return s(),u}}();var e,t,n,i},screenFrame:function(){var e=this;if(F()&&Y()&&N())return function(){return Promise.resolve(void 0)};var t=K();return function(){return o(e,void 0,void 0,function(){var e,n;return r(this,function(i){switch(i.label){case 0:return[4,t()];case 1:return e=i.sent(),[2,[(n=function(e){return null===e?null:b(e,10)})(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}},canvas:function(){return function(e){var t,n,i,o=!1,r=function(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}(),a=r[0],c=r[1];!function(e,t){return!(!t||!e.toDataURL)}(a,c)?n=i="unsupported":(o=function(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}(c),e?n=i="skipped":(t=function(e,t){!function(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat(String.fromCharCode(55357,56835));t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}(e,t);var n=B(e),i=B(e);if(n!==i)return["unstable","unstable"];!function(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,i=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<i.length;n++){var o=i[n],r=o[0],a=o[1],c=o[2];t.fillStyle=r,t.beginPath(),t.arc(a,c,40,0,2*Math.PI,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,2*Math.PI,!0),t.arc(60,60,20,0,2*Math.PI,!0),t.fill("evenodd")}(e,t);var o=B(e);return[o,n]}(a,c),n=t[0],i=t[1]));return{winding:o,geometry:n,text:i}}(F()&&Y()&&N())},osCpu:function(){return navigator.oscpu},languages:function(){var e,t=navigator,n=[],i=t.language||t.userLanguage||t.browserLanguage||t.systemLanguage;if(void 0!==i&&n.push([i]),Array.isArray(t.languages))P()&&v([!("MediaSettingsRange"in(e=window)),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3||n.push(t.languages);else if("string"==typeof t.languages){var o=t.languages;o&&n.push(o.split(","))}return n},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return p(h(navigator.deviceMemory),void 0)},screenResolution:function(){var e,t,n;if(!(F()&&Y()&&N()))return e=screen,(n=[(t=function(e){return p(m(e),null)})(e.width),t(e.height)]).sort().reverse(),n},hardwareConcurrency:function(){return p(m(navigator.hardwareConcurrency),void 0)},timezone:function(){var e,t=null===(e=window.Intl)||void 0===e?void 0:e.DateTimeFormat;if(t){var n=(new t).resolvedOptions().timeZone;if(n)return n}var i,o=(i=(new Date).getFullYear(),-Math.max(h(new Date(i,0,1).getTimezoneOffset()),h(new Date(i,6,1).getTimezoneOffset())));return"UTC".concat(o>=0?"+":"").concat(o)},sessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},localStorage:function(){try{return!!window.localStorage}catch(e){return!0}},indexedDB:function(){var e,t;if(!(R()||(e=window,t=navigator,v(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!R())))try{return!!window.indexedDB}catch(e){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var e=navigator.platform;return"MacIntel"===e&&F()&&!G()?function(){if("iPad"===navigator.platform)return!0;var e=screen,t=e.width/e.height;return v(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}()?"iPad":"iPhone":e},plugins:function(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var i=e[n];if(i){for(var o=[],r=0;r<i.length;++r){var a=i[r];o.push({type:a.type,suffixes:a.suffixes})}t.push({name:i.name,description:i.description,mimeTypes:o})}}return t}},touchSupport:function(){var e,t=navigator,n=0;void 0!==t.maxTouchPoints?n=m(t.maxTouchPoints):void 0!==t.msMaxTouchPoints&&(n=t.msMaxTouchPoints);try{document.createEvent("TouchEvent"),e=!0}catch(t){e=!1}return{maxTouchPoints:n,touchEvent:e,touchStart:"ontouchstart"in window}},vendor:function(){return navigator.vendor||""},vendorFlavors:function(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var i=n[t],o=window[i];o&&"object"==typeof o&&e.push(i)}return e.sort()},cookiesEnabled:function(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=-1!==e.cookie.indexOf("cookietest=");return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch(e){return!1}},colorGamut:function(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}},invertedColors:function(){return!!ne("inverted")||!ne("none")&&void 0},forcedColors:function(){return!!ie("active")||!ie("none")&&void 0},monochrome:function(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=100;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}},contrast:function(){return oe("no-preference")?0:oe("high")||oe("more")?1:oe("low")||oe("less")?-1:oe("forced")?10:void 0},reducedMotion:function(){return!!re("reduce")||!re("no-preference")&&void 0},reducedTransparency:function(){return!!ae("reduce")||!ae("no-preference")&&void 0},hdr:function(){return!!ce("high")||!ce("standard")&&void 0},math:function(){var e,t=se.acos||le,n=se.acosh||le,i=se.asin||le,o=se.asinh||le,r=se.atanh||le,a=se.atan||le,c=se.sin||le,s=se.sinh||le,l=se.cos||le,u=se.cosh||le,d=se.tan||le,f=se.tanh||le,m=se.exp||le,h=se.expm1||le,p=se.log1p||le;return{acos:t(.12312423423423424),acosh:n(1e308),acoshPf:(e=1e154,se.log(e+se.sqrt(e*e-1))),asin:i(.12312423423423424),asinh:o(1),asinhPf:function(e){return se.log(e+se.sqrt(e*e+1))}(1),atanh:r(.5),atanhPf:function(e){return se.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:c(-1e300),sinh:s(1),sinhPf:function(e){return se.exp(e)-1/se.exp(e)/2}(1),cos:l(10.000000000123),cosh:u(1),coshPf:function(e){return(se.exp(e)+1/se.exp(e))/2}(1),tan:d(-1e300),tanh:f(1),tanhPf:function(e){return(se.exp(2*e)-1)/(se.exp(2*e)+1)}(1),exp:m(1),expm1:h(1),expm1Pf:function(e){return se.exp(e)-1}(1),log1p:p(10),log1pPf:function(e){return se.log(1+e)}(10),powPI:function(e){return se.pow(se.PI,e)}(-100)}},pdfViewerEnabled:function(){return navigator.pdfViewerEnabled},architecture:function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]},applePay:function(){var e=window.ApplePaySession;if("function"!=typeof(null==e?void 0:e.canMakePayments))return-1;if(de())return-3;try{return e.canMakePayments()?1:0}catch(e){return function(e){if(e instanceof Error&&"InvalidAccessError"===e.name&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}(e)}},privateClickMeasurement:function(){var e,t=document.createElement("a"),n=null!==(e=t.attributionSourceId)&&void 0!==e?e:t.attributionsourceid;return void 0===n?void 0:String(n)},audioBaseLatency:function(){if(!(H()||F()))return-2;if(!window.AudioContext)return-1;var e=(new AudioContext).baseLatency;return null==e?-1:isFinite(e)?e:-3},dateTimeLocale:function(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return t||""===t?t:-3},webGlBasics:function(e){var t,n,i,o,r,a,c=be(e.cache);if(!c)return-1;if(!Le(c))return-2;var s=ke()?null:c.getExtension(ve);return{version:(null===(t=c.getParameter(c.VERSION))||void 0===t?void 0:t.toString())||"",vendor:(null===(n=c.getParameter(c.VENDOR))||void 0===n?void 0:n.toString())||"",vendorUnmasked:s?null===(i=c.getParameter(s.UNMASKED_VENDOR_WEBGL))||void 0===i?void 0:i.toString():"",renderer:(null===(o=c.getParameter(c.RENDERER))||void 0===o?void 0:o.toString())||"",rendererUnmasked:s?null===(r=c.getParameter(s.UNMASKED_RENDERER_WEBGL))||void 0===r?void 0:r.toString():"",shadingLanguageVersion:(null===(a=c.getParameter(c.SHADING_LANGUAGE_VERSION))||void 0===a?void 0:a.toString())||""}},webGlExtensions:function(e){var t=be(e.cache);if(!t)return-1;if(!Le(t))return-2;var n=t.getSupportedExtensions(),i=t.getContextAttributes(),o=[],r=[],a=[],c=[],s=[];if(i)for(var l=0,u=Object.keys(i);l<u.length;l++){var d=u[l];r.push("".concat(d,"=").concat(i[d]))}for(var f=0,m=ye(t);f<m.length;f++){var h=t[k=m[f]];a.push("".concat(k,"=").concat(h).concat(fe.has(h)?"=".concat(t.getParameter(h)):""))}if(n)for(var p=0,v=n;p<v.length;p++){var b=v[p];if(!(b===ve&&ke()||"WEBGL_polygon_mode"===b&&xe())){var g=t.getExtension(b);if(g)for(var y=0,w=ye(g);y<w.length;y++){var k;h=g[k=w[y]];c.push("".concat(k,"=").concat(h).concat(me.has(h)?"=".concat(t.getParameter(h)):""))}else o.push(b)}}for(var x=0,L=he;x<L.length;x++)for(var E=L[x],S=0,C=pe;S<C.length;S++){var I=C[S],M=ge(t,E,I);s.push("".concat(E,".").concat(I,"=").concat(M.join(",")))}return c.sort(),a.sort(),{contextAttributes:r,parameters:a,shaderPrecisions:s,extensions:n,extensionParameters:c,unsupportedExtensions:o}}};function Se(e){var t=function(e){if(H())return.4;if(F())return!G()||Y()&&N()?.3:.5;var t="value"in e.platform?e.platform.value:"";if(/^Win/.test(t))return.6;if(/^Mac/.test(t))return.5;return.7}(e),n=function(e){return b(.99+.01*e,1e-4)}(t);return{score:t,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,"".concat(n))}}function Ce(e){return Z(function(e){for(var t="",n=0,i=Object.keys(e).sort();n<i.length;n++){var o=i[n],r=e[o],a="error"in r?"error":JSON.stringify(r.value);t+="".concat(t?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(a)}return t}(e))}function Ie(e){return void 0===e&&(e=50),function(e,t){void 0===t&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(e){return n.call(window,function(){return e()},{timeout:t})}):s(Math.min(e,t))}(e,2*e)}function Me(e,t){Date.now();return{get:function(n){return o(this,void 0,void 0,function(){var i,o;return r(this,function(r){switch(r.label){case 0:return Date.now(),[4,e()];case 1:return i=r.sent(),o=function(e){var t,n=Se(e);return{get visitorId(){return void 0===t&&(t=Ce(this.components)),t},set visitorId(e){t=e},confidence:n,components:e,version:c}}(i),t||null==n||n.debug,[2,o]}})})}}}var Ve={load:function(e){var t;return void 0===e&&(e={}),o(this,void 0,void 0,function(){var n,i,o;return r(this,function(r){switch(r.label){case 0:return(null===(t=e.monitoring)||void 0===t||t)&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(c,"/npm-monitoring"),!0),e.send()}catch(e){}}(),n=e.delayFallback,i=e.debug,[4,Ie(n)];case 1:return r.sent(),o=function(e){return j(Ee,e,[])}({cache:{},debug:i}),[2,Me(o,i)]}})})},hashComponents:Ce,componentsToDebugString:function(e){return JSON.stringify(e,function(e,t){return t instanceof Error?i({name:(n=t).name,message:n.message,stack:null===(o=n.stack)||void 0===o?void 0:o.split("\n")},n):t;var n,o},2)}};class We{constructor(){this.iconManager=null,this.iframeManager=null,this.config=null,this.isInitialized=!1}async init(e,i){if(!this.isInitialized){this.config=e;try{const o=await this.getDeviceId(),r=this.buildIframeUrl(e,o);this.iconManager=new t,await this.iconManager.show(),this.iframeManager=new n({src:r,mode:"auto",width:400,height:600,allowClose:!0,onMessage:(e,t)=>{"new-message"===e&&this.showNotification(0,{pulse:!0})},...i}),await this.iframeManager.init(),this.iconManager.onClick(()=>{this.clearNotification(),this.iframeManager?.show()}),this.isInitialized=!0}catch(e){throw e}}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(e){this.iconManager?.setPosition(e)}setIconStyle(e){this.iconManager?.setStyle(e)}openChat(){this.clearNotification(),this.iframeManager?.open()}closeChat(){this.iframeManager?.close()}isChatOpen(){return this.iframeManager?.isIframeOpen()||!1}sendToIframe(e){this.iframeManager?.sendToIframe(e)}getConnectionStatus(){return this.isInitialized}showNotification(e=1,t={}){this.iconManager&&(this.iconManager.showNotification({badgeCount:"string"==typeof e?0:e,badgeText:"string"==typeof e?e:"",pulse:t.pulse||!1}),t.autoHide&&t.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},t.autoHide))}clearNotification(){this.iconManager?.clearNotification()}destroy(){this.iconManager?.hide(),this.iframeManager?.close(),this.iconManager=null,this.iframeManager=null,this.config=null,this.isInitialized=!1}async getDeviceId(){try{const e=await Ve.load();return(await e.get()).visitorId}catch(e){return"device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}}buildIframeUrl(e,t){const n=e.iframeUrl;if(!n||""===n.trim())throw new Error("iframeUrl is required but not provided or is empty");const i=new URL(n);return i.searchParams.set("Agent",e.agent),i.searchParams.set("Authorization",e.token),i.searchParams.set("DeviceSign",t),i.searchParams.set("Referrer",document.referrer),i.toString()}}let Ze=null;const je=async(e,t)=>{Ze||(Ze=new We),await Ze.init(e,t)},Re=()=>{if(!Ze)throw new Error("SDK not initialized. Call init() first.");return Ze},Pe=()=>{Re().showIcon()},Fe=()=>{Re().hideIcon()},Ge=e=>{Re().setIconPosition(e)},Ne=e=>{Re().setIconStyle(e)},Ae=()=>{Re().openChat()},Ye=()=>{Re().closeChat()},Xe=()=>Re().isChatOpen(),He=e=>{Re().sendToIframe(e)},Te=()=>Re().getConnectionStatus(),Oe=(e=1,t={})=>{Re().showNotification(e,t)},ze=()=>{Re().clearNotification()},De=()=>{Re().destroy(),Ze=null};var Je={init:je,getInstance:Re,showIcon:Pe,hideIcon:Fe,setIconPosition:Ge,setIconStyle:Ne,openChat:Ae,closeChat:Ye,isChatOpen:Xe,sendToIframe:He,getConnectionStatus:Te,showNotification:Oe,clearNotification:ze,destroy:De};e.CustomerServiceSDK=We,e.clearNotification=ze,e.closeChat=Ye,e.default=Je,e.destroy=De,e.getConnectionStatus=Te,e.getInstance=Re,e.hideIcon=Fe,e.init=je,e.isChatOpen=Xe,e.openChat=Ae,e.sendToIframe=He,e.setIconPosition=Ge,e.setIconStyle=Ne,e.showIcon=Pe,e.showNotification=Oe,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CustomerSDK={})}(this,function(e){"use strict";class t{constructor(){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.iconStartX=0,this.iconStartY=0,this.dragMoveHandler=null,this.dragEndHandler=null}async show(){this.iconElement||(this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon",Object.assign(this.iconElement.style,{position:"fixed",width:"40px",height:"40px",backgroundColor:"#007bff",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"999999",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",bottom:"20px",right:"20px"}),this.iconElement.textContent="💬",this.iconElement.style.fontSize="24px",this.iconElement.style.color="#ffffff",this.setupDragEvents(),document.body.appendChild(this.iconElement))}hide(){this.isDragging&&this.handleDragEnd(),this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)),this.dragEndHandler&&(document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)),this.iconElement&&(this.iconElement.remove(),this.iconElement=null,this.onClickCallback=null,this.dragMoveHandler=null,this.dragEndHandler=null)}setPosition(e){}setStyle(e){}onClick(e){this.onClickCallback=e}onNotification(e){this.notificationCallback=e}showNotification(e){if(!this.iconElement)return;const{showBadge:t=!0,badgeCount:n=0,badgeText:i="",pulse:o=!1}=e;(t||n>0)&&this.createBadge(n,i,o),this.notificationCallback&&this.notificationCallback({badgeCount:n,badgeText:i,pulse:o})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null)}setupDragEvents(){this.iconElement&&(this.dragMoveHandler=this.handleDragMove.bind(this),this.dragEndHandler=this.handleDragEnd.bind(this),this.iconElement.addEventListener("mousedown",this.handleDragStart.bind(this)),this.iconElement.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!1}))}handleDragStart(e){if(!this.iconElement)return;if(e.target!==this.iconElement&&!this.iconElement.contains(e.target))return;e.preventDefault(),e.stopPropagation();const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;this.isDragging=!1,this.dragStartX=t,this.dragStartY=n;const i=this.iconElement.getBoundingClientRect();this.iconStartX=i.left,this.iconStartY=i.top,this.iconElement.style.transition="none",this.iconElement.style.cursor="grabbing";const o=e=>{const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY,i=t-this.dragStartX,r=n-this.dragStartY;(Math.abs(i)>5||Math.abs(r)>5)&&(this.isDragging=!0,"touches"in e?document.removeEventListener("touchmove",o):document.removeEventListener("mousemove",o),this.dragMoveHandler&&this.dragEndHandler&&("touches"in e?(document.addEventListener("touchmove",this.dragMoveHandler,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",this.dragMoveHandler),document.addEventListener("mouseup",this.dragEndHandler))))};"touches"in e?(document.addEventListener("touchmove",o,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",o),document.addEventListener("mouseup",this.dragEndHandler))}handleDragMove(e){if(!this.iconElement||!this.isDragging)return;e.preventDefault(),e.stopPropagation();const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY,i=t-this.dragStartX,o=n-this.dragStartY,r=this.iconStartX+i,a=this.iconStartY+o,c=window.innerWidth-this.iconElement.offsetWidth,s=window.innerHeight-this.iconElement.offsetHeight,l=Math.max(0,Math.min(r,c)),u=Math.max(0,Math.min(a,s));this.iconElement.style.left=`${l}px`,this.iconElement.style.top=`${u}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto"}handleDragEnd(e){this.iconElement&&(this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)),this.dragEndHandler&&(document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)),this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer",this.isDragging||this.handleClick(),this.isDragging=!1)}handleClick(){this.onClickCallback&&this.onClickCallback()}createBadge(e,t="",n=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=e>0?e>99?"99+":e.toString():t||"",Object.assign(this.badgeElement.style,{position:"absolute",top:"2px",right:"2px",minWidth:"18px",height:"18px",borderRadius:"50%",backgroundColor:"#ff4444",color:"#ffffff",fontSize:"10px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000001",boxShadow:"0 -1px 4px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15)",...0===e&&""===t&&{width:"12px",height:"12px",minWidth:"12px"},...n&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}class n{constructor(e={}){this.iframeElement=null,this.overlayElement=null,this.containerElement=null,this.isOpen=!1,this.isCreated=!1,this.config={src:"",mode:"auto",width:400,height:600,allowClose:!0,...e},this.setupMessageListener()}async init(){try{this.createIframe(),this.isCreated=!0}catch(e){throw e}}show(){if(!this.isOpen){if(!this.isCreated)throw new Error("Iframe not initialized. Call init() first.");try{const e="popup"===this.getActualMode();e&&this.createOverlay(),this.containerElement&&(e?(Object.assign(this.containerElement.style,{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",visibility:"visible",opacity:"1",display:"block"}),this.overlayElement?.appendChild(this.containerElement)):(Object.assign(this.containerElement.style,{position:"fixed",visibility:"visible",opacity:"1",display:"block"}),this.preventBodyScroll(!0))),this.isOpen=!0}catch(e){}}}open(){this.show()}hide(){if(!this.isOpen)return;this.containerElement&&Object.assign(this.containerElement.style,{visibility:"hidden",opacity:"0",display:"none"}),this.overlayElement&&(this.overlayElement.remove(),this.overlayElement=null);"fullscreen"===this.getActualMode()&&this.preventBodyScroll(!1),this.isOpen=!1}close(){this.hide()}destroy(){this.hide(),this.containerElement&&(this.containerElement.remove(),this.containerElement=null,this.iframeElement=null),this.isCreated=!1}isIframeOpen(){return this.isOpen}sendToIframe(e){this.iframeElement&&this.iframeElement.contentWindow&&this.iframeElement.contentWindow.postMessage(e,"*")}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.className="customer-sdk-overlay",Object.assign(this.overlayElement.style,{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"999998",display:"flex",alignItems:"center",justifyContent:"center",cursor:this.config.allowClose?"pointer":"default"}),this.config.allowClose&&this.overlayElement.addEventListener("click",e=>{e.target===this.overlayElement&&this.close()}),document.body.appendChild(this.overlayElement)}createIframe(){this.containerElement=document.createElement("div"),this.containerElement.className="customer-sdk-container",this.iframeElement=document.createElement("iframe"),this.iframeElement.className="customer-sdk-iframe",this.iframeElement.src=this.config.src||"",this.iframeElement.frameBorder="0",this.iframeElement.setAttribute("allow",["microphone","camera","geolocation","clipboard-read","clipboard-write","fullscreen","autoplay","encrypted-media"].join("; ")),this.iframeElement.setAttribute("sandbox",["allow-same-origin","allow-scripts","allow-forms","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-storage-access-by-user-activation"].join(" "));const e="popup"===this.getActualMode();this.iframeElement.scrolling=e?"auto":"no";const t={width:e?`${this.config.width}px`:"100%",height:e?`${this.config.height}px`:"100%",maxWidth:e?"450px":"100%",maxHeight:e?"700px":"100%",backgroundColor:"#ffffff",borderRadius:e?"12px":"12px 12px 0 0",boxShadow:e?"0 20px 40px rgba(0, 0, 0, 0.15)":"0 -4px 16px rgba(0, 0, 0, 0.25)",border:"none",position:"fixed",zIndex:"999999",...e?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:"0",left:"0",bottom:"0",right:"0",transform:"none",overflow:"hidden",position:"fixed"},visibility:"hidden",opacity:"0",display:"none"};Object.assign(this.containerElement.style,t);const n={width:"100%",height:"100%",border:"none",borderRadius:"inherit",...e?{}:{overflow:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitScrollbar:"none"}};Object.assign(this.iframeElement.style,n),this.containerElement.appendChild(this.iframeElement),this.iframeElement.addEventListener("load",()=>{e||this.injectMobileStyles()}),document.body.appendChild(this.containerElement)}injectMobileStyles(){if(this.iframeElement)try{const e=this.iframeElement.contentDocument||this.iframeElement.contentWindow?.document;if(e){const t=e.createElement("style");t.textContent="\n /* 移动端iframe全屏样式优化 */\n * {\n -webkit-overflow-scrolling: touch !important;\n }\n \n body, html, #app, .container {\n overflow: auto !important;\n -webkit-overflow-scrolling: touch !important;\n }\n \n /* 隐藏所有滚动条 */\n ::-webkit-scrollbar {\n width: 0px !important;\n height: 0px !important;\n background: transparent !important;\n }\n \n /* Firefox */\n html {\n scrollbar-width: none !important;\n }\n \n /* IE/Edge */\n body {\n -ms-overflow-style: none !important;\n }\n \n /* 确保内容可以滚动 */\n body {\n overflow: auto !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ",e.head?.appendChild(t)}}catch(e){}}preventBodyScroll(e){if(e){const e=window.scrollY;Object.assign(document.body.style,{position:"fixed",top:`-${e}px`,width:"100%",overflow:"hidden"}),document.body.setAttribute("data-scroll-position",e.toString())}else{const e=parseInt(document.body.getAttribute("data-scroll-position")||"0");Object.assign(document.body.style,{position:"",top:"",width:"",overflow:""}),document.body.removeAttribute("data-scroll-position"),window.scrollTo(0,e)}}isMobileDevice(){return window.innerWidth<=768||/Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent)}getActualMode(){return"auto"===this.config.mode?this.isMobileDevice()?"fullscreen":"popup":this.config.mode}setupMessageListener(){window.addEventListener("message",e=>{this.config.src&&e.origin!==new URL(this.config.src).origin||this.handleIframeMessage(e.data)},!1)}handleIframeMessage(e){let t;if("string"==typeof e)t=e;else{if(!e||!e.type)return;t=e.type}switch(t){case"iframe_ready":break;case"close_iframe":case"close":this.close();break;case"resize_iframe":case"resize":e.width&&e.height&&this.resizeIframe(e.width,e.height);break;case"new-message":this.config.onMessage&&this.config.onMessage(t,e)}}resizeIframe(e,t){this.iframeElement&&(this.iframeElement.style.width=`${e}px`,this.iframeElement.style.height=`${t}px`)}}var i=function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};function o(e,t,n,i){return new(n||(n=Promise))(function(o,r){function a(e){try{s(i.next(e))}catch(e){r(e)}}function c(e){try{s(i.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,c)}s((i=i.apply(e,t||[])).next())})}function r(e,t){var n,i,o,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(o=2&c[0]?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],i=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function a(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var c="4.6.2";function s(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function l(e){return!!e&&"function"==typeof e.then}function u(e,t){try{var n=e();l(n)?n.then(function(e){return t(!0,e)},function(e){return t(!1,e)}):t(!0,n)}catch(e){t(!1,e)}}function d(e,t,n){return void 0===n&&(n=16),o(this,void 0,void 0,function(){var i,o,a,c;return r(this,function(r){switch(r.label){case 0:i=Array(e.length),o=Date.now(),a=0,r.label=1;case 1:return a<e.length?(i[a]=t(e[a],a),(c=Date.now())>=o+n?(o=c,[4,new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})]):[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return++a,[3,1];case 4:return[2,i]}})})}function h(e){return e.then(void 0,function(){}),e}function m(e){return parseInt(e)}function f(e){return parseFloat(e)}function v(e,t){return"number"==typeof e&&isNaN(e)?t:e}function p(e){return e.reduce(function(e,t){return e+(t?1:0)},0)}function g(e,t){if(void 0===t&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function b(e,t){var n=e[0]>>>16,i=65535&e[0],o=e[1]>>>16,r=65535&e[1],a=t[0]>>>16,c=65535&t[0],s=t[1]>>>16,l=0,u=0,d=0,h=0;d+=(h+=r+(65535&t[1]))>>>16,h&=65535,u+=(d+=o+s)>>>16,d&=65535,l+=(u+=i+c)>>>16,u&=65535,l+=n+a,l&=65535,e[0]=l<<16|u,e[1]=d<<16|h}function y(e,t){var n=e[0]>>>16,i=65535&e[0],o=e[1]>>>16,r=65535&e[1],a=t[0]>>>16,c=65535&t[0],s=t[1]>>>16,l=65535&t[1],u=0,d=0,h=0,m=0;h+=(m+=r*l)>>>16,m&=65535,d+=(h+=o*l)>>>16,h&=65535,d+=(h+=r*s)>>>16,h&=65535,u+=(d+=i*l)>>>16,d&=65535,u+=(d+=o*s)>>>16,d&=65535,u+=(d+=r*c)>>>16,d&=65535,u+=n*l+i*s+o*c+r*a,u&=65535,e[0]=u<<16|d,e[1]=h<<16|m}function w(e,t){var n=e[0];32===(t%=64)?(e[0]=e[1],e[1]=n):t<32?(e[0]=n<<t|e[1]>>>32-t,e[1]=e[1]<<t|n>>>32-t):(t-=32,e[0]=e[1]<<t|n>>>32-t,e[1]=n<<t|e[1]>>>32-t)}function E(e,t){0!==(t%=64)&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function L(e,t){e[0]^=t[0],e[1]^=t[1]}var k=[4283543511,3981806797],x=[3301882366,444984403];function S(e){var t=[0,e[0]>>>1];L(e,t),y(e,k),t[1]=e[0]>>>1,L(e,t),y(e,x),t[1]=e[0]>>>1,L(e,t)}var M=[2277735313,289559509],C=[1291169091,658871167],I=[0,5],V=[0,1390208809],W=[0,944331445];function Z(e,t){var n=function(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++){var i=e.charCodeAt(n);if(i>127)return(new TextEncoder).encode(e);t[n]=i}return t}(e);t=t||0;var i,o=[0,n.length],r=o[1]%16,a=o[1]-r,c=[0,t],s=[0,t],l=[0,0],u=[0,0];for(i=0;i<a;i+=16)l[0]=n[i+4]|n[i+5]<<8|n[i+6]<<16|n[i+7]<<24,l[1]=n[i]|n[i+1]<<8|n[i+2]<<16|n[i+3]<<24,u[0]=n[i+12]|n[i+13]<<8|n[i+14]<<16|n[i+15]<<24,u[1]=n[i+8]|n[i+9]<<8|n[i+10]<<16|n[i+11]<<24,y(l,M),w(l,31),y(l,C),L(c,l),w(c,27),b(c,s),y(c,I),b(c,V),y(u,C),w(u,33),y(u,M),L(s,u),w(s,31),b(s,c),y(s,I),b(s,W);l[0]=0,l[1]=0,u[0]=0,u[1]=0;var d=[0,0];switch(r){case 15:d[1]=n[i+14],E(d,48),L(u,d);case 14:d[1]=n[i+13],E(d,40),L(u,d);case 13:d[1]=n[i+12],E(d,32),L(u,d);case 12:d[1]=n[i+11],E(d,24),L(u,d);case 11:d[1]=n[i+10],E(d,16),L(u,d);case 10:d[1]=n[i+9],E(d,8),L(u,d);case 9:d[1]=n[i+8],L(u,d),y(u,C),w(u,33),y(u,M),L(s,u);case 8:d[1]=n[i+7],E(d,56),L(l,d);case 7:d[1]=n[i+6],E(d,48),L(l,d);case 6:d[1]=n[i+5],E(d,40),L(l,d);case 5:d[1]=n[i+4],E(d,32),L(l,d);case 4:d[1]=n[i+3],E(d,24),L(l,d);case 3:d[1]=n[i+2],E(d,16),L(l,d);case 2:d[1]=n[i+1],E(d,8),L(l,d);case 1:d[1]=n[i],L(l,d),y(l,M),w(l,31),y(l,C),L(c,l)}return L(c,o),L(s,o),b(c,s),b(s,c),S(c),S(s),b(c,s),b(s,c),("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)+("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)}function R(e,t,n,i){var a=Object.keys(e).filter(function(e){return!function(e,t){for(var n=0,i=e.length;n<i;++n)if(e[n]===t)return!0;return!1}(n,e)}),c=h(d(a,function(n){return function(e,t){var n=h(new Promise(function(n){var i=Date.now();u(e.bind(null,t),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=Date.now()-i;if(!e[0])return n(function(){return{error:e[1],duration:o}});var r=e[1];if(function(e){return"function"!=typeof e}(r))return n(function(){return{value:r,duration:o}});n(function(){return new Promise(function(e){var t=Date.now();u(r,function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var r=o+Date.now()-t;if(!n[0])return e({error:n[1],duration:r});e({value:n[1],duration:r})})})})})}));return function(){return n.then(function(e){return e()})}}(e[n],t)},i));return function(){return o(this,void 0,void 0,function(){var e,t,n,o;return r(this,function(r){switch(r.label){case 0:return[4,c];case 1:return[4,d(r.sent(),function(e){return h(e())},i)];case 2:return e=r.sent(),[4,Promise.all(e)];case 3:for(t=r.sent(),n={},o=0;o<a.length;++o)n[a[o]]=t[o];return[2,n]}})})}}function j(){var e=window,t=navigator;return p(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function H(){var e=window,t=navigator;return p(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,0===(t.vendor||"").indexOf("Google"),"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function Y(){var e=window;return p(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,0===navigator.vendor.indexOf("Apple"),"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function G(){var e=window,t=e.HTMLElement,n=e.Document;return p(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),n&&"pointerLockElement"in n.prototype])>=4}function P(){var e,t=window;return e=t.print,/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))&&"[object WebPageNamespace]"===String(t.browser)}function X(){var e,t,n=window;return p(["buildID"in navigator,"MozAppearance"in(null!==(t=null===(e=document.documentElement)||void 0===e?void 0:e.style)&&void 0!==t?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function F(){var e=window,t=navigator,n=e.CSS,i=e.HTMLButtonElement;return p([!("getStorageUpdates"in t),i&&"popover"in i.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function N(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function D(){var e=H(),t=X(),n=window,i=navigator,o="connection";return e?p([!("SharedWorker"in n),i[o]&&"ontypechange"in i[o],!("sinkId"in new Audio)])>=2:!!t&&p(["onorientationchange"in n,"orientation"in n,/android/i.test(i.appVersion)])>=2}function A(e){var t=new Error(e);return t.name=e,t}function O(e,t,n){var i,a,c;return void 0===n&&(n=50),o(this,void 0,void 0,function(){var o,l;return r(this,function(r){switch(r.label){case 0:o=document,r.label=1;case 1:return o.body?[3,3]:[4,s(n)];case 2:return r.sent(),[3,1];case 3:l=o.createElement("iframe"),r.label=4;case 4:return r.trys.push([4,,10,11]),[4,new Promise(function(e,n){var i=!1,r=function(){i=!0,e()};l.onload=r,l.onerror=function(e){i=!0,n(e)};var a=l.style;a.setProperty("display","block","important"),a.position="absolute",a.top="0",a.left="0",a.visibility="hidden",t&&"srcdoc"in l?l.srcdoc=t:l.src="about:blank",o.body.appendChild(l);var c=function(){var e,t;i||("complete"===(null===(t=null===(e=l.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.readyState)?r():setTimeout(c,10))};c()})];case 5:r.sent(),r.label=6;case 6:return(null===(a=null===(i=l.contentWindow)||void 0===i?void 0:i.document)||void 0===a?void 0:a.body)?[3,8]:[4,s(n)];case 7:return r.sent(),[3,6];case 8:return[4,e(l,l.contentWindow)];case 9:return[2,r.sent()];case 10:return null===(c=l.parentNode)||void 0===c||c.removeChild(l),[7];case 11:return[2]}})})}function T(e){for(var t=function(e){for(var t,n,i="Unexpected syntax '".concat(e,"'"),o=/^\s*([a-z-]*)(.*)$/i.exec(e),r=o[1]||void 0,a={},c=/([.:#][\w-]+|\[.+?\])/gi,s=function(e,t){a[e]=a[e]||[],a[e].push(t)};;){var l=c.exec(o[2]);if(!l)break;var u=l[0];switch(u[0]){case".":s("class",u.slice(1));break;case"#":s("id",u.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(!d)throw new Error(i);s(d[1],null!==(n=null!==(t=d[4])&&void 0!==t?t:d[5])&&void 0!==n?n:"");break;default:throw new Error(i)}}return[r,a]}(e),n=t[0],i=t[1],o=document.createElement(null!=n?n:"div"),r=0,a=Object.keys(i);r<a.length;r++){var c=a[r],s=i[c].join(" ");"style"===c?z(o.style,s):o.setAttribute(c,s)}return o}function z(e,t){for(var n=0,i=t.split(";");n<i.length;n++){var o=i[n],r=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(o);if(r){var a=r[1],c=r[2],s=r[4];e.setProperty(a,c,s||"")}}}var J=["monospace","sans-serif","serif"],_=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function B(e){return e.toDataURL()}var U,Q;function K(){var e=this;return function(){if(void 0===Q){var e=function(){var t=$();q(t)?Q=setTimeout(e,2500):(U=t,Q=void 0)};e()}}(),function(){return o(e,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return q(e=$())?U?[2,a([],U,!0)]:(n=document).fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement?[4,N()]:[3,2]:[3,2];case 1:t.sent(),e=$(),t.label=2;case 2:return q(e)||(U=e),[2,e]}var n})})}}function $(){var e=screen;return[v(f(e.availTop),null),v(f(e.width)-f(e.availWidth)-v(f(e.availLeft),0),null),v(f(e.height)-f(e.availHeight)-v(f(e.availTop),0),null),v(f(e.availLeft),null)]}function q(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function ee(e){var t;return o(this,void 0,void 0,function(){var n,i,o,a,c,l,u;return r(this,function(r){switch(r.label){case 0:for(n=document,i=n.createElement("div"),o=new Array(e.length),a={},te(i),u=0;u<e.length;++u)"DIALOG"===(c=T(e[u])).tagName&&c.show(),te(l=n.createElement("div")),l.appendChild(c),i.appendChild(l),o[u]=c;r.label=1;case 1:return n.body?[3,3]:[4,s(50)];case 2:return r.sent(),[3,1];case 3:n.body.appendChild(i);try{for(u=0;u<e.length;++u)o[u].offsetParent||(a[e[u]]=!0)}finally{null===(t=i.parentNode)||void 0===t||t.removeChild(i)}return[2,a]}})})}function te(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function ne(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function ie(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}function oe(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function re(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function ae(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function ce(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var se=Math,le=function(){return 0};var ue={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var de=function(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(e){if(e instanceof Error&&"SecurityError"===e.name)return!0;throw e}e=t}};var he=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),me=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),fe=["FRAGMENT_SHADER","VERTEX_SHADER"],ve=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],pe="WEBGL_debug_renderer_info";function ge(e){if(e.webgl)return e.webgl.context;var t,n=document.createElement("canvas");n.addEventListener("webglCreateContextError",function(){return t=void 0});for(var i=0,o=["webgl","experimental-webgl"];i<o.length;i++){var r=o[i];try{t=n.getContext(r)}catch(e){}if(t)break}return e.webgl={context:t},t}function be(e,t,n){var i=e.getShaderPrecisionFormat(e[t],e[n]);return i?[i.rangeMin,i.rangeMax,i.precision]:[]}function ye(e){return Object.keys(e.__proto__).filter(we)}function we(e){return"string"==typeof e&&!e.match(/[^A-Z0-9_x]/)}function Ee(){return X()}function Le(){return H()||Y()}function ke(e){return"function"==typeof e.getParameter}var xe={fonts:function(){var e=this;return O(function(t,n){var i=n.document;return o(e,void 0,void 0,function(){var e,t,n,o,a,c,s,l,u,d,h;return r(this,function(r){for((e=i.body).style.fontSize="48px",(t=i.createElement("div")).style.setProperty("visibility","hidden","important"),n={},o={},a=function(e){var n=i.createElement("span"),o=n.style;return o.position="absolute",o.top="0",o.left="0",o.fontFamily=e,n.textContent="mmMwWLliI0O&1",t.appendChild(n),n},c=function(e,t){return a("'".concat(e,"',").concat(t))},s=function(){for(var e={},t=function(t){e[t]=J.map(function(e){return c(t,e)})},n=0,i=_;n<i.length;n++){t(i[n])}return e},l=function(e){return J.some(function(t,i){return e[i].offsetWidth!==n[t]||e[i].offsetHeight!==o[t]})},u=function(){return J.map(a)}(),d=s(),e.appendChild(t),h=0;h<J.length;h++)n[J[h]]=u[h].offsetWidth,o[J[h]]=u[h].offsetHeight;return[2,_.filter(function(e){return l(d[e])})]})})})},domBlockers:function(e){var t=(void 0===e?{}:e).debug;return o(this,void 0,void 0,function(){var e,n,i,o,a;return r(this,function(r){switch(r.label){case 0:return Y()||D()?(c=atob,e={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',c("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",c("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",c("LnNwb25zb3JpdA=="),".ylamainos",c("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",c("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",c("LmhlYWRlci1ibG9ja2VkLWFk"),c("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",c("I2FkXzMwMFgyNTA="),c("I2Jhbm5lcmZsb2F0MjI="),c("I2NhbXBhaWduLWJhbm5lcg=="),c("I0FkLUNvbnRlbnQ=")],adGuardChinese:[c("LlppX2FkX2FfSA=="),c("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",c("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),c("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",c("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",c("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",c("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),c("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),c("LmFkZ29vZ2xl"),c("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[c("YW1wLWF1dG8tYWRz"),c("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",c("I2FkX2ludmlld19hcmVh")],adGuardRussian:[c("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),c("LnJlY2xhbWE="),'div[id^="smi2adblock"]',c("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[c("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),c("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",c("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),c("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),c("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",c("I3Jla2xhbWk="),c("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),c("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),c("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[c("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",c("LndpZGdldF9wb19hZHNfd2lkZ2V0"),c("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",c("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[c("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),c("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",c("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",c("I3Jla2xhbW5pLWJveA=="),c("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",c("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[c("I2FkdmVydGVudGll"),c("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",c("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",c("LnNwb25zb3JsaW5rZ3J1ZW4="),c("I3dlcmJ1bmdza3k="),c("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),c("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[c("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",c("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[c("LnJla2xhbW9zX3RhcnBhcw=="),c("LnJla2xhbW9zX251b3JvZG9z"),c("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),c("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),c("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[c("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[c("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),c("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",c("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[c("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),c("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),c("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",c("LmFkX19tYWlu"),c("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[c("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[c("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),c("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[c("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),c("I2xpdmVyZUFkV3JhcHBlcg=="),c("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),c("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[c("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",c("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),c("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),c("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[c("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),c("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),c("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",c("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),c("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),c("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),c("ZGl2I3NrYXBpZWNfYWQ=")],ro:[c("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),c("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),c("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),c("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[c("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),c("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),c("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",c("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),c("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",c("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]},n=Object.keys(e),[4,ee((a=[]).concat.apply(a,n.map(function(t){return e[t]})))]):[2,void 0];case 1:return i=r.sent(),t&&function(e,t){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];"\n".concat(o,":");for(var r=0,a=e[o];r<a.length;r++){var c=a[r];"\n ".concat(t[c]?"🚫":"➡️"," ").concat(c)}}}(e,i),(o=n.filter(function(t){var n=e[t];return p(n.map(function(e){return i[e]}))>.6*n.length})).sort(),[2,o]}var c})})},fontPreferences:function(){return function(e,t){void 0===t&&(t=4e3);return O(function(n,i){var o=i.document,r=o.body,c=r.style;c.width="".concat(t,"px"),c.webkitTextSizeAdjust=c.textSizeAdjust="none",H()?r.style.zoom="".concat(1/i.devicePixelRatio):Y()&&(r.style.zoom="reset");var s=o.createElement("div");return s.textContent=a([],Array(t/20|0),!0).map(function(){return"word"}).join(" "),r.appendChild(s),e(o,r)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}(function(e,t){for(var n={},i={},o=0,r=Object.keys(ue);o<r.length;o++){var a=r[o],c=ue[a],s=c[0],l=void 0===s?{}:s,u=c[1],d=void 0===u?"mmMwWLliI0fiflO&1":u,h=e.createElement("span");h.textContent=d,h.style.whiteSpace="nowrap";for(var m=0,f=Object.keys(l);m<f.length;m++){var v=f[m],p=l[v];void 0!==p&&(h.style[v]=p)}n[a]=h,t.append(e.createElement("br"),h)}for(var g=0,b=Object.keys(ue);g<b.length;g++){i[a=b[g]]=n[a].getBoundingClientRect().width}return i})},audio:function(){return Y()&&F()&&P()||H()&&(e=navigator,t=window,n=Audio.prototype,i=t.visualViewport,p(["srLatency"in n,"srChannelCount"in n,"devicePosture"in e,i&&"segments"in i,"getTextInformation"in Image.prototype])>=3)&&function(){var e=window,t=e.URLPattern;return p(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}()?-4:function(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(Y()&&!G()&&!function(){var e=window;return p(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}())return-1;var n=4500,i=new t(1,5e3,44100),o=i.createOscillator();o.type="triangle",o.frequency.value=1e4;var r=i.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,o.connect(r),r.connect(i.destination),o.start(0);var a=function(e){var t=3,n=500,i=500,o=5e3,r=function(){},a=new Promise(function(a,c){var s=!1,u=0,d=0;e.oncomplete=function(e){return a(e.renderedBuffer)};var m=function(){setTimeout(function(){return c(A("timeout"))},Math.min(i,d+o-Date.now()))},f=function(){try{var i=e.startRendering();switch(l(i)&&h(i),e.state){case"running":d=Date.now(),s&&m();break;case"suspended":document.hidden||u++,s&&u>=t?c(A("suspended")):setTimeout(f,n)}}catch(e){c(e)}};f(),r=function(){s||(s=!0,d>0&&m())}});return[a,r]}(i),c=a[0],s=a[1],u=h(c.then(function(e){return function(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}(e.getChannelData(0).subarray(n))},function(e){if("timeout"===e.name||"suspended"===e.name)return-3;throw e}));return function(){return s(),u}}();var e,t,n,i},screenFrame:function(){var e=this;if(Y()&&F()&&P())return function(){return Promise.resolve(void 0)};var t=K();return function(){return o(e,void 0,void 0,function(){var e,n;return r(this,function(i){switch(i.label){case 0:return[4,t()];case 1:return e=i.sent(),[2,[(n=function(e){return null===e?null:g(e,10)})(e[0]),n(e[1]),n(e[2]),n(e[3])]]}})})}},canvas:function(){return function(e){var t,n,i,o=!1,r=function(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}(),a=r[0],c=r[1];!function(e,t){return!(!t||!e.toDataURL)}(a,c)?n=i="unsupported":(o=function(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}(c),e?n=i="skipped":(t=function(e,t){!function(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat(String.fromCharCode(55357,56835));t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}(e,t);var n=B(e),i=B(e);if(n!==i)return["unstable","unstable"];!function(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,i=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<i.length;n++){var o=i[n],r=o[0],a=o[1],c=o[2];t.fillStyle=r,t.beginPath(),t.arc(a,c,40,0,2*Math.PI,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,2*Math.PI,!0),t.arc(60,60,20,0,2*Math.PI,!0),t.fill("evenodd")}(e,t);var o=B(e);return[o,n]}(a,c),n=t[0],i=t[1]));return{winding:o,geometry:n,text:i}}(Y()&&F()&&P())},osCpu:function(){return navigator.oscpu},languages:function(){var e,t=navigator,n=[],i=t.language||t.userLanguage||t.browserLanguage||t.systemLanguage;if(void 0!==i&&n.push([i]),Array.isArray(t.languages))H()&&p([!("MediaSettingsRange"in(e=window)),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3||n.push(t.languages);else if("string"==typeof t.languages){var o=t.languages;o&&n.push(o.split(","))}return n},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return v(f(navigator.deviceMemory),void 0)},screenResolution:function(){var e,t,n;if(!(Y()&&F()&&P()))return e=screen,(n=[(t=function(e){return v(m(e),null)})(e.width),t(e.height)]).sort().reverse(),n},hardwareConcurrency:function(){return v(m(navigator.hardwareConcurrency),void 0)},timezone:function(){var e,t=null===(e=window.Intl)||void 0===e?void 0:e.DateTimeFormat;if(t){var n=(new t).resolvedOptions().timeZone;if(n)return n}var i,o=(i=(new Date).getFullYear(),-Math.max(f(new Date(i,0,1).getTimezoneOffset()),f(new Date(i,6,1).getTimezoneOffset())));return"UTC".concat(o>=0?"+":"").concat(o)},sessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},localStorage:function(){try{return!!window.localStorage}catch(e){return!0}},indexedDB:function(){var e,t;if(!(j()||(e=window,t=navigator,p(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!j())))try{return!!window.indexedDB}catch(e){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var e=navigator.platform;return"MacIntel"===e&&Y()&&!G()?function(){if("iPad"===navigator.platform)return!0;var e=screen,t=e.width/e.height;return p(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}()?"iPad":"iPhone":e},plugins:function(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var i=e[n];if(i){for(var o=[],r=0;r<i.length;++r){var a=i[r];o.push({type:a.type,suffixes:a.suffixes})}t.push({name:i.name,description:i.description,mimeTypes:o})}}return t}},touchSupport:function(){var e,t=navigator,n=0;void 0!==t.maxTouchPoints?n=m(t.maxTouchPoints):void 0!==t.msMaxTouchPoints&&(n=t.msMaxTouchPoints);try{document.createEvent("TouchEvent"),e=!0}catch(t){e=!1}return{maxTouchPoints:n,touchEvent:e,touchStart:"ontouchstart"in window}},vendor:function(){return navigator.vendor||""},vendorFlavors:function(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var i=n[t],o=window[i];o&&"object"==typeof o&&e.push(i)}return e.sort()},cookiesEnabled:function(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=-1!==e.cookie.indexOf("cookietest=");return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch(e){return!1}},colorGamut:function(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}},invertedColors:function(){return!!ne("inverted")||!ne("none")&&void 0},forcedColors:function(){return!!ie("active")||!ie("none")&&void 0},monochrome:function(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=100;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}},contrast:function(){return oe("no-preference")?0:oe("high")||oe("more")?1:oe("low")||oe("less")?-1:oe("forced")?10:void 0},reducedMotion:function(){return!!re("reduce")||!re("no-preference")&&void 0},reducedTransparency:function(){return!!ae("reduce")||!ae("no-preference")&&void 0},hdr:function(){return!!ce("high")||!ce("standard")&&void 0},math:function(){var e,t=se.acos||le,n=se.acosh||le,i=se.asin||le,o=se.asinh||le,r=se.atanh||le,a=se.atan||le,c=se.sin||le,s=se.sinh||le,l=se.cos||le,u=se.cosh||le,d=se.tan||le,h=se.tanh||le,m=se.exp||le,f=se.expm1||le,v=se.log1p||le;return{acos:t(.12312423423423424),acosh:n(1e308),acoshPf:(e=1e154,se.log(e+se.sqrt(e*e-1))),asin:i(.12312423423423424),asinh:o(1),asinhPf:function(e){return se.log(e+se.sqrt(e*e+1))}(1),atanh:r(.5),atanhPf:function(e){return se.log((1+e)/(1-e))/2}(.5),atan:a(.5),sin:c(-1e300),sinh:s(1),sinhPf:function(e){return se.exp(e)-1/se.exp(e)/2}(1),cos:l(10.000000000123),cosh:u(1),coshPf:function(e){return(se.exp(e)+1/se.exp(e))/2}(1),tan:d(-1e300),tanh:h(1),tanhPf:function(e){return(se.exp(2*e)-1)/(se.exp(2*e)+1)}(1),exp:m(1),expm1:f(1),expm1Pf:function(e){return se.exp(e)-1}(1),log1p:v(10),log1pPf:function(e){return se.log(1+e)}(10),powPI:function(e){return se.pow(se.PI,e)}(-100)}},pdfViewerEnabled:function(){return navigator.pdfViewerEnabled},architecture:function(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]},applePay:function(){var e=window.ApplePaySession;if("function"!=typeof(null==e?void 0:e.canMakePayments))return-1;if(de())return-3;try{return e.canMakePayments()?1:0}catch(e){return function(e){if(e instanceof Error&&"InvalidAccessError"===e.name&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}(e)}},privateClickMeasurement:function(){var e,t=document.createElement("a"),n=null!==(e=t.attributionSourceId)&&void 0!==e?e:t.attributionsourceid;return void 0===n?void 0:String(n)},audioBaseLatency:function(){if(!(D()||Y()))return-2;if(!window.AudioContext)return-1;var e=(new AudioContext).baseLatency;return null==e?-1:isFinite(e)?e:-3},dateTimeLocale:function(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return t||""===t?t:-3},webGlBasics:function(e){var t,n,i,o,r,a,c=ge(e.cache);if(!c)return-1;if(!ke(c))return-2;var s=Ee()?null:c.getExtension(pe);return{version:(null===(t=c.getParameter(c.VERSION))||void 0===t?void 0:t.toString())||"",vendor:(null===(n=c.getParameter(c.VENDOR))||void 0===n?void 0:n.toString())||"",vendorUnmasked:s?null===(i=c.getParameter(s.UNMASKED_VENDOR_WEBGL))||void 0===i?void 0:i.toString():"",renderer:(null===(o=c.getParameter(c.RENDERER))||void 0===o?void 0:o.toString())||"",rendererUnmasked:s?null===(r=c.getParameter(s.UNMASKED_RENDERER_WEBGL))||void 0===r?void 0:r.toString():"",shadingLanguageVersion:(null===(a=c.getParameter(c.SHADING_LANGUAGE_VERSION))||void 0===a?void 0:a.toString())||""}},webGlExtensions:function(e){var t=ge(e.cache);if(!t)return-1;if(!ke(t))return-2;var n=t.getSupportedExtensions(),i=t.getContextAttributes(),o=[],r=[],a=[],c=[],s=[];if(i)for(var l=0,u=Object.keys(i);l<u.length;l++){var d=u[l];r.push("".concat(d,"=").concat(i[d]))}for(var h=0,m=ye(t);h<m.length;h++){var f=t[E=m[h]];a.push("".concat(E,"=").concat(f).concat(he.has(f)?"=".concat(t.getParameter(f)):""))}if(n)for(var v=0,p=n;v<p.length;v++){var g=p[v];if(!(g===pe&&Ee()||"WEBGL_polygon_mode"===g&&Le())){var b=t.getExtension(g);if(b)for(var y=0,w=ye(b);y<w.length;y++){var E;f=b[E=w[y]];c.push("".concat(E,"=").concat(f).concat(me.has(f)?"=".concat(t.getParameter(f)):""))}else o.push(g)}}for(var L=0,k=fe;L<k.length;L++)for(var x=k[L],S=0,M=ve;S<M.length;S++){var C=M[S],I=be(t,x,C);s.push("".concat(x,".").concat(C,"=").concat(I.join(",")))}return c.sort(),a.sort(),{contextAttributes:r,parameters:a,shaderPrecisions:s,extensions:n,extensionParameters:c,unsupportedExtensions:o}}};function Se(e){var t=function(e){if(D())return.4;if(Y())return!G()||F()&&P()?.3:.5;var t="value"in e.platform?e.platform.value:"";if(/^Win/.test(t))return.6;if(/^Mac/.test(t))return.5;return.7}(e),n=function(e){return g(.99+.01*e,1e-4)}(t);return{score:t,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,"".concat(n))}}function Me(e){return Z(function(e){for(var t="",n=0,i=Object.keys(e).sort();n<i.length;n++){var o=i[n],r=e[o],a="error"in r?"error":JSON.stringify(r.value);t+="".concat(t?"|":"").concat(o.replace(/([:|\\])/g,"\\$1"),":").concat(a)}return t}(e))}function Ce(e){return void 0===e&&(e=50),function(e,t){void 0===t&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(e){return n.call(window,function(){return e()},{timeout:t})}):s(Math.min(e,t))}(e,2*e)}function Ie(e,t){Date.now();return{get:function(n){return o(this,void 0,void 0,function(){var i,o;return r(this,function(r){switch(r.label){case 0:return Date.now(),[4,e()];case 1:return i=r.sent(),o=function(e){var t,n=Se(e);return{get visitorId(){return void 0===t&&(t=Me(this.components)),t},set visitorId(e){t=e},confidence:n,components:e,version:c}}(i),t||null==n||n.debug,[2,o]}})})}}}var Ve={load:function(e){var t;return void 0===e&&(e={}),o(this,void 0,void 0,function(){var n,i,o;return r(this,function(r){switch(r.label){case 0:return(null===(t=e.monitoring)||void 0===t||t)&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(c,"/npm-monitoring"),!0),e.send()}catch(e){}}(),n=e.delayFallback,i=e.debug,[4,Ce(n)];case 1:return r.sent(),o=function(e){return R(xe,e,[])}({cache:{},debug:i}),[2,Ie(o,i)]}})})},hashComponents:Me,componentsToDebugString:function(e){return JSON.stringify(e,function(e,t){return t instanceof Error?i({name:(n=t).name,message:n.message,stack:null===(o=n.stack)||void 0===o?void 0:o.split("\n")},n):t;var n,o},2)}};class We{constructor(){this.iconManager=null,this.iframeManager=null,this.config=null,this.isInitialized=!1}async init(e,i){if(!this.isInitialized){this.config=e;try{const o=await this.getDeviceId(),r=this.buildIframeUrl(e,o);this.iconManager=new t,await this.iconManager.show(),this.iframeManager=new n({src:r,mode:"auto",width:400,height:600,allowClose:!0,onMessage:(e,t)=>{"new-message"===e&&this.showNotification(0,{pulse:!0})},...i}),await this.iframeManager.init(),this.iconManager.onClick(()=>{this.clearNotification(),this.iframeManager?.show()}),this.isInitialized=!0}catch(e){throw e}}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(e){this.iconManager?.setPosition(e)}setIconStyle(e){this.iconManager?.setStyle(e)}openChat(){this.clearNotification(),this.iframeManager?.open()}closeChat(){this.iframeManager?.close()}isChatOpen(){return this.iframeManager?.isIframeOpen()||!1}sendToIframe(e){this.iframeManager?.sendToIframe(e)}getConnectionStatus(){return this.isInitialized}showNotification(e=1,t={}){this.iconManager&&(this.iconManager.showNotification({badgeCount:"string"==typeof e?0:e,badgeText:"string"==typeof e?e:"",pulse:t.pulse||!1}),t.autoHide&&t.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},t.autoHide))}clearNotification(){this.iconManager?.clearNotification()}destroy(){this.iconManager?.hide(),this.iframeManager?.close(),this.iconManager=null,this.iframeManager=null,this.config=null,this.isInitialized=!1}async getDeviceId(){try{const e=await Ve.load();return(await e.get()).visitorId}catch(e){return"device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}}buildIframeUrl(e,t){const n=e.iframeUrl;if(!n||""===n.trim())throw new Error("iframeUrl is required but not provided or is empty");const i=new URL(n);return i.searchParams.set("Agent",e.agent),i.searchParams.set("Authorization",e.token),i.searchParams.set("DeviceSign",t),i.searchParams.set("Referrer",document.referrer),i.toString()}}let Ze=null;const Re=async(e,t)=>{Ze||(Ze=new We),await Ze.init(e,t)},je=()=>{if(!Ze)throw new Error("SDK not initialized. Call init() first.");return Ze},He=()=>{je().showIcon()},Ye=()=>{je().hideIcon()},Ge=e=>{je().setIconPosition(e)},Pe=e=>{je().setIconStyle(e)},Xe=()=>{je().openChat()},Fe=()=>{je().closeChat()},Ne=()=>je().isChatOpen(),De=e=>{je().sendToIframe(e)},Ae=()=>je().getConnectionStatus(),Oe=(e=1,t={})=>{je().showNotification(e,t)},Te=()=>{je().clearNotification()},ze=()=>{je().destroy(),Ze=null};var Je={init:Re,getInstance:je,showIcon:He,hideIcon:Ye,setIconPosition:Ge,setIconStyle:Pe,openChat:Xe,closeChat:Fe,isChatOpen:Ne,sendToIframe:De,getConnectionStatus:Ae,showNotification:Oe,clearNotification:Te,destroy:ze};e.CustomerServiceSDK=We,e.clearNotification=Te,e.closeChat=Fe,e.default=Je,e.destroy=ze,e.getConnectionStatus=Ae,e.getInstance=je,e.hideIcon=Ye,e.init=Re,e.isChatOpen=Ne,e.openChat=Xe,e.sendToIframe=De,e.setIconPosition=Ge,e.setIconStyle=Pe,e.showIcon=He,e.showNotification=Oe,Object.defineProperty(e,"__esModule",{value:!0})});
|
package/package.json
CHANGED