lazy-bee 1.0.5 → 1.0.7

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.
@@ -0,0 +1,2606 @@
1
+ ! function (e, t) {
2
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).gdp = t()
3
+ }(this, (function () {
4
+ "use strict";
5
+ const e = ["web", "wxwv", "minp", "alip", "baidup", "qq", "bytedance"],
6
+ t = {
7
+ autotrack: {
8
+ type: "boolean",
9
+ default: !0
10
+ },
11
+ compress: {
12
+ type: "boolean",
13
+ default: !0
14
+ },
15
+ dataCollect: {
16
+ type: "boolean",
17
+ default: !0
18
+ },
19
+ debug: {
20
+ type: "boolean",
21
+ default: !1
22
+ },
23
+ hashtag: {
24
+ type: "boolean",
25
+ default: !1
26
+ },
27
+ touch: {
28
+ type: "boolean",
29
+ default: !1
30
+ },
31
+ version: {
32
+ type: "string",
33
+ default: "1.0.0"
34
+ },
35
+ platform: {
36
+ type: "string",
37
+ default: "web"
38
+ },
39
+ cookieDomain: {
40
+ type: "string",
41
+ default: ""
42
+ }
43
+ },
44
+ i = {
45
+ enableIdMapping: {
46
+ type: "boolean",
47
+ default: !1
48
+ },
49
+ gtouchHost: {
50
+ type: "string",
51
+ default: ""
52
+ },
53
+ host: {
54
+ type: "string",
55
+ default: ""
56
+ },
57
+ ignoreFields: {
58
+ type: "array",
59
+ default: []
60
+ },
61
+ penetrateHybrid: {
62
+ type: "boolean",
63
+ default: !0
64
+ },
65
+ scheme: {
66
+ type: "string",
67
+ default: location.protocol.indexOf("http") > -1 ? location.protocol.replace(":", "") : "https"
68
+ },
69
+ sessionExpires: {
70
+ type: "number",
71
+ default: 30
72
+ },
73
+ performance: {
74
+ type: "object",
75
+ default: {
76
+ monitor: !0,
77
+ exception: !0
78
+ }
79
+ },
80
+ embeddedIgnore: {
81
+ type: "array",
82
+ default: []
83
+ }
84
+ },
85
+ n = {},
86
+ r = ["clearUserId", "getGioInfo", "getLocation", "getOption", "init", "setDataCollect", "setOption", "setUserId", "track", "setGeneralProps", "clearGeneralProps", "enableDebug", "enableHT", "setAutotrack", "setTrackerHost", "setTrackerScheme", "setUserAttributes", "getVisitorId", "getDeviceId", "registerPlugins", "getPlugins", "sendPage", "sendVisit", "trackTimerStart", "trackTimerPause", "trackTimerResume", "trackTimerEnd", "removeTimer", "clearTrackTimer"],
87
+ s = ["autotrack", "dataCollect", "dataSourceId", "debug", "host", "hashtag", "scheme"],
88
+ o = {
89
+ autotrack: "无埋点采集",
90
+ dataCollect: "数据采集",
91
+ debug: "调试模式"
92
+ },
93
+ a = ["send", "setConfig", "collectImp", "setPlatformProfile"],
94
+ d = ["screenHeight", "screenWidth"],
95
+ l = {
96
+ click: "VIEW_CLICK",
97
+ change: "VIEW_CHANGE",
98
+ submit: "FORM_SUBMIT"
99
+ };
100
+ var c, h, u, g, p, f, m, v = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {},
101
+ I = "function" == typeof Array.from ? Array.from : (h || (h = 1, u = function (e) {
102
+ return "function" == typeof e
103
+ }, g = function (e) {
104
+ var t = function (e) {
105
+ var t = Number(e);
106
+ return isNaN(t) ? 0 : 0 !== t && isFinite(t) ? (t > 0 ? 1 : -1) * Math.floor(Math.abs(t)) : t
107
+ }(e);
108
+ return Math.min(Math.max(t, 0), 9007199254740991)
109
+ }, p = function (e) {
110
+ if (null != e) {
111
+ if (["string", "number", "boolean", "symbol"].indexOf(typeof e) > -1) return Symbol.iterator;
112
+ if ("undefined" != typeof Symbol && "iterator" in Symbol && Symbol.iterator in e) return Symbol.iterator;
113
+ if ("@@iterator" in e) return "@@iterator"
114
+ }
115
+ }, f = function (e, t) {
116
+ if (null != e && null != t) {
117
+ var i = e[t];
118
+ if (null == i) return;
119
+ if (!u(i)) throw new TypeError(i + " is not a function");
120
+ return i
121
+ }
122
+ }, m = function (e) {
123
+ var t = e.next();
124
+ return !t.done && t
125
+ }, c = function (e) {
126
+ var t, i, n, r = this,
127
+ s = arguments.length > 1 ? arguments[1] : void 0;
128
+ if (void 0 !== s) {
129
+ if (!u(s)) throw new TypeError("Array.from: when provided, the second argument must be a function");
130
+ arguments.length > 2 && (t = arguments[2])
131
+ }
132
+ var o = f(e, p(e));
133
+ if (void 0 !== o) {
134
+ i = u(r) ? Object(new r) : [];
135
+ var a, d, l = o.call(e);
136
+ if (null == l) throw new TypeError("Array.from requires an array-like or iterable object");
137
+ for (n = 0;;) {
138
+ if (!(a = m(l))) return i.length = n, i;
139
+ d = a.value, i[n] = s ? s.call(t, d, n) : d, n++
140
+ }
141
+ } else {
142
+ var c = Object(e);
143
+ if (null == e) throw new TypeError("Array.from requires an array-like object - not null or undefined");
144
+ var h, v = g(c.length);
145
+ for (i = u(r) ? Object(new r(v)) : Array(v), n = 0; v > n;) h = c[n], i[n] = s ? s.call(t, h, n) : h, n++;
146
+ i.length = v
147
+ }
148
+ return i
149
+ }), c);
150
+ const w = e => L(["undefined", "null"], X(e)),
151
+ O = e => "string" === X(e),
152
+ b = e => "number" === X(e),
153
+ y = e => {
154
+ const t = Number(e);
155
+ return t != t
156
+ },
157
+ E = e => "boolean" === X(e),
158
+ S = e => "object" === X(e) && !w(e),
159
+ _ = e => "regexp" === X(e),
160
+ T = e => "function" === X(e),
161
+ N = e => Array.isArray(e) && "array" === X(e),
162
+ C = e => "date" === X(e),
163
+ A = e => {
164
+ try {
165
+ return k(e)[0]
166
+ } catch (e) {
167
+ return
168
+ }
169
+ },
170
+ x = e => {
171
+ try {
172
+ const t = k(e);
173
+ return t[t.length - 1]
174
+ } catch (e) {
175
+ return
176
+ }
177
+ },
178
+ P = (e, t = 1) => N(e) && b(t) ? e.slice(t > 0 ? t : 1, e.length) : e,
179
+ D = e => {
180
+ if (N(e)) {
181
+ let t = 0;
182
+ const i = [];
183
+ for (const n of e) n && !$(n) && (i[t++] = n);
184
+ return i
185
+ }
186
+ return e
187
+ },
188
+ R = (e, t) => {
189
+ let i;
190
+ return N(e) && e.forEach((e => {
191
+ t(e) && void 0 === i && (i = e)
192
+ })), i
193
+ },
194
+ L = (e, t) => ("array" === X(e) || "string" === X(e)) && e.indexOf(t) >= 0,
195
+ k = I,
196
+ j = e => w(e) ? "" : "" + e,
197
+ U = (e, t) => "string" == typeof e ? e.split(t) : e,
198
+ G = e => {
199
+ if (O(e)) {
200
+ const t = U(e, "");
201
+ return `${A(t).toLowerCase()}${P(t).join("")}`
202
+ }
203
+ return e
204
+ },
205
+ q = (e, t) => !!O(e) && e.slice(0, t.length) === t,
206
+ H = (e, t) => {
207
+ if (O(e)) {
208
+ const {
209
+ length: i
210
+ } = e;
211
+ let n = i;
212
+ n > i && (n = i);
213
+ const r = n;
214
+ return n -= t.length, n >= 0 && e.slice(n, r) === t
215
+ }
216
+ return !1
217
+ },
218
+ B = {}.hasOwnProperty,
219
+ K = (e, t) => !w(e) && B.call(e, t),
220
+ V = e => S(e) ? Object.keys(e) : [],
221
+ W = (e, t) => {
222
+ V(e).forEach((i => t(e[i], i)))
223
+ },
224
+ M = (e, t) => {
225
+ const i = V(e);
226
+ return !(!S(e) || !S(t) || i.length !== V(t).length || L(i.map(((i, n) => S(e[i]) ? M(e[i], t[i]) : e[i] === t[i])), !1))
227
+ },
228
+ F = (e, t) => {
229
+ if (!S(e)) return !1;
230
+ try {
231
+ return "string" === X(t) ? delete e[t] : "array" === X(t) ? t.map((t => delete e[t])) : (_(t) && V(e).forEach((i => {
232
+ t.test(i) && F(e, i)
233
+ })), !0)
234
+ } catch (e) {
235
+ return !1
236
+ }
237
+ },
238
+ $ = e => N(e) ? 0 === e.length : S(e) ? 0 === V(e).length : !e,
239
+ X = e => ({}.toString.call(e).slice(8, -1).toLowerCase());
240
+ var z = Object.freeze({
241
+ __proto__: null,
242
+ isNil: w,
243
+ isString: O,
244
+ isNumber: b,
245
+ isNaN: y,
246
+ isBoolean: E,
247
+ isObject: S,
248
+ isRegExp: _,
249
+ isFunction: T,
250
+ isArray: N,
251
+ isDate: C,
252
+ fixed: (e, t) => b(e) ? Number(e.toFixed(b(t) ? t : 2)) : O(e) && "NaN" !== j(Number(e)) ? Number(Number(e).toFixed(b(t) ? t : 2)) : e,
253
+ head: A,
254
+ last: x,
255
+ drop: P,
256
+ dropWhile: (e, t) => N(e) ? e.filter((e => !t(e))) : e,
257
+ compact: D,
258
+ find: R,
259
+ includes: L,
260
+ arrayFrom: k,
261
+ toString: j,
262
+ split: U,
263
+ lowerFirst: G,
264
+ upperFirst: e => {
265
+ if (O(e)) {
266
+ const t = U(e, "");
267
+ return `${A(t).toUpperCase()}${P(t).join("")}`
268
+ }
269
+ return e
270
+ },
271
+ startsWith: q,
272
+ endsWith: H,
273
+ hasOwnProperty: B,
274
+ has: K,
275
+ keys: V,
276
+ forEach: W,
277
+ isEqual: M,
278
+ get: (e, t, i) => {
279
+ let n = e;
280
+ return S(e) ? (t.split(".").forEach((e => {
281
+ n = n ? n[e] : i
282
+ })), n) : i
283
+ },
284
+ unset: F,
285
+ isEmpty: $,
286
+ typeOf: X,
287
+ formatDate: e => {
288
+ if (C(e)) {
289
+ const t = e => 10 > e ? "0" + e : e;
290
+ return e.getFullYear() + "-" + t(e.getMonth() + 1) + "-" + t(e.getDate()) + " " + t(e.getHours()) + ":" + t(e.getMinutes()) + ":" + t(e.getSeconds()) + "." + t(e.getMilliseconds())
291
+ }
292
+ return e
293
+ }
294
+ });
295
+ const J = (e, t) => {
296
+ console.log("%c [GrowingIO]:" + e, {
297
+ info: "color: #3B82F6;",
298
+ error: "color: #EF4444;",
299
+ warn: "color: #F59E0B;",
300
+ success: "color: #10B981;"
301
+ } [t] || "")
302
+ },
303
+ Z = e => {
304
+ try {
305
+ return e()
306
+ } catch (e) {
307
+ return
308
+ }
309
+ },
310
+ Y = e => {
311
+ const t = {};
312
+ return S(e) && W(e, ((e, i) => {
313
+ var n;
314
+ const r = j(i).slice(0, 100);
315
+ S(e) ? t[r] = Y(e) : N(e) ? (t[r] = e.slice(0, 100), "cdp" === (null === (n = window.vds) || void 0 === n ? void 0 : n.gioEnvironment) && (t[r] = t[r].join("||"))) : t[r] = w(e) ? "" : j(e).slice(0, 1e3)
316
+ })), t
317
+ },
318
+ Q = (e, t, i, n = {}) => {
319
+ document.addEventListener ? e.addEventListener(t, i, Object.assign(Object.assign({}, {
320
+ capture: !0
321
+ }), n)) : e.attachEvent ? e.attachEvent("on" + t, i) : e["on" + t] = i
322
+ },
323
+ ee = (e, t) => O(e) && !$(e) && e.match(/^[a-zA-Z_][0-9a-zA-Z_]{0,100}$/) ? t() : (J("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!", "error"), !1);
324
+ var te = Object.freeze({
325
+ __proto__: null,
326
+ consoleText: J,
327
+ niceTry: Z,
328
+ limitObject: Y,
329
+ addListener: Q,
330
+ flattenObject: (e = {}) => {
331
+ const t = Object.assign({}, e);
332
+ return V(t).forEach((e => {
333
+ S(t[e]) ? (V(t[e]).forEach((i => {
334
+ t[`${e}_${i}`] = j(t[e][i])
335
+ })), F(t, e)) : N(t[e]) ? (t[e].forEach(((i, n) => {
336
+ S(i) ? V(i).forEach((r => {
337
+ t[`${e}_${n}_${r}`] = j(i[r])
338
+ })) : t[`${e}_${n}`] = j(i)
339
+ })), F(t, e)) : w(t[e]) || "" === t[e] ? F(t, e) : t[e] = j(t[e])
340
+ })), t
341
+ },
342
+ eventNameValidate: ee
343
+ });
344
+ const ie = e => O(e) && e.length > 0 || b(e) && e > 0,
345
+ ne = e => {
346
+ var t;
347
+ return e.vdsConfig || e.gioSDKInitialized || (null === (t = window.vds) || void 0 === t ? void 0 : t.gioSDKInitialized) ? (J("SDK重复初始化,请检查是否重复加载SDK或接入其他平台SDK导致冲突!", "warn"), !1) : !(L(["", "localhost", "127.0.0.1"], location.hostname) && !window._gr_ignore_local_rule && (J("当前SDK不允许在本地环境初始化!", "warn"), 1))
348
+ },
349
+ re = e => !$(D(e)) || (J('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options); 进行初始化!', "error"), !1),
350
+ se = e => {
351
+ const t = A(e);
352
+ let i = x(e);
353
+ return ie(j(t).trim()) ? (S(i) && i || (i = {}), {
354
+ projectId: t,
355
+ userOptions: i
356
+ }) : (J("SDK初始化失败,accountId 参数不合法!", "error"), !1)
357
+ },
358
+ oe = e => {
359
+ const t = e[1],
360
+ i = e[2],
361
+ n = x(e);
362
+ return t && O(t) ? S(n) && n.host ? {
363
+ dataSourceId: t,
364
+ appId: O(i) ? i : "",
365
+ cdpOptions: n
366
+ } : (J("SDK初始化失败,未在配置中指定 host!", "error"), !1) : (J("SDK初始化失败,dataSourceId 参数不合法!", "error"), !1)
367
+ },
368
+ ae = /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i,
369
+ de = /^(https?:\/\/)|(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;
370
+ var le = "SDK_INITIALIZED",
371
+ ce = "USERID_UPDATE",
372
+ he = "USERKEY_UPDATE",
373
+ ue = "SESSIONID_UPDATE",
374
+ ge = {},
375
+ pe = {}.hasOwnProperty;
376
+
377
+ function fe(e) {
378
+ try {
379
+ return decodeURIComponent(e.replace(/\+/g, " "))
380
+ } catch (e) {
381
+ return null
382
+ }
383
+ }
384
+
385
+ function me(e) {
386
+ try {
387
+ return encodeURIComponent(e)
388
+ } catch (e) {
389
+ return null
390
+ }
391
+ }
392
+ ge.stringify = function (e, t) {
393
+ t = t || "";
394
+ var i, n, r = [];
395
+ for (n in "string" != typeof t && (t = "?"), e)
396
+ if (pe.call(e, n)) {
397
+ if ((i = e[n]) || null != i && !isNaN(i) || (i = ""), n = me(n), i = me(i), null === n || null === i) continue;
398
+ r.push(n + "=" + i)
399
+ } return r.length ? t + r.join("&") : ""
400
+ }, ge.parse = function (e) {
401
+ for (var t, i = /([^=?#&]+)=?([^&]*)/g, n = {}; t = i.exec(e);) {
402
+ var r = fe(t[1]),
403
+ s = fe(t[2]);
404
+ null === r || null === s || r in n || (n[r] = s)
405
+ }
406
+ return n
407
+ };
408
+ var ve = {
409
+ name: "gioCompress",
410
+ method: class {
411
+ constructor(e) {
412
+ this.growingIO = e, this._compress = function (e, t, i) {
413
+ if (null === e) return "";
414
+ let n, r, s, o = {},
415
+ a = {},
416
+ d = "",
417
+ l = "",
418
+ c = "",
419
+ h = 2,
420
+ u = 3,
421
+ g = 2,
422
+ p = [],
423
+ f = 0,
424
+ m = 0;
425
+ for (s = 0; s < e.length; s += 1)
426
+ if (d = e.charAt(s), {}.hasOwnProperty.call(o, d) || (o[d] = u++, a[d] = !0), l = c + d, {}.hasOwnProperty.call(o, l)) c = l;
427
+ else {
428
+ if ({}.hasOwnProperty.call(a, c)) {
429
+ if (256 > c.charCodeAt(0)) {
430
+ for (n = 0; g > n; n++) f <<= 1, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++;
431
+ for (r = c.charCodeAt(0), n = 0; 8 > n; n++) f = f << 1 | 1 & r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r >>= 1
432
+ } else {
433
+ for (r = 1, n = 0; g > n; n++) f = f << 1 | r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r = 0;
434
+ for (r = c.charCodeAt(0), n = 0; 16 > n; n++) f = f << 1 | 1 & r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r >>= 1
435
+ }
436
+ h--, 0 === h && (h = Math.pow(2, g), g++), delete a[c]
437
+ } else
438
+ for (r = o[c], n = 0; g > n; n++) f = f << 1 | 1 & r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r >>= 1;
439
+ h--, 0 === h && (h = Math.pow(2, g), g++), o[l] = u++, c = d + ""
440
+ } if ("" !== c) {
441
+ if ({}.hasOwnProperty.call(a, c)) {
442
+ if (256 > c.charCodeAt(0)) {
443
+ for (n = 0; g > n; n++) f <<= 1, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++;
444
+ for (r = c.charCodeAt(0), n = 0; 8 > n; n++) f = f << 1 | 1 & r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r >>= 1
445
+ } else {
446
+ for (r = 1, n = 0; g > n; n++) f = f << 1 | r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r = 0;
447
+ for (r = c.charCodeAt(0), n = 0; 16 > n; n++) f = f << 1 | 1 & r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r >>= 1
448
+ }
449
+ h--, 0 === h && (h = Math.pow(2, g), g++), delete a[c]
450
+ } else
451
+ for (r = o[c], n = 0; g > n; n++) f = f << 1 | 1 & r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r >>= 1;
452
+ h--, 0 === h && (h = Math.pow(2, g), g++)
453
+ }
454
+ for (r = 2, n = 0; g > n; n++) f = f << 1 | 1 & r, m === t - 1 ? (m = 0, p.push(i(f)), f = 0) : m++, r >>= 1;
455
+ for (;;) {
456
+ if (f <<= 1, m === t - 1) {
457
+ p.push(i(f));
458
+ break
459
+ }
460
+ m++
461
+ }
462
+ return p.join("")
463
+ }, this.compress = e => {
464
+ const t = this;
465
+ return this._compress(e, 16, (function (e) {
466
+ return t.f(e)
467
+ }))
468
+ }, this.compressToUTF16 = e => {
469
+ const t = this;
470
+ return null === e ? "" : this._compress(e, 15, (function (e) {
471
+ return t.f(e + 32)
472
+ })) + " "
473
+ }, this.compressToUint8Array = e => {
474
+ const t = this.compress(e),
475
+ i = new Uint8Array(2 * t.length);
476
+ for (let e = 0, n = t.length; n > e; e++) {
477
+ const n = t.charCodeAt(e);
478
+ i[2 * e] = n >>> 8, i[2 * e + 1] = n % 256
479
+ }
480
+ return i
481
+ }, this.compressToEncodedURIComponent = e => null == e ? "" : this._compress(e, 6, (function (e) {
482
+ return this.keyStrUriSafe.charAt(e)
483
+ })), this.f = String.fromCharCode, this.keyStrUriSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"
484
+ }
485
+ }
486
+ },
487
+ Ie = {
488
+ name: "gioCustomTracking",
489
+ method: class {
490
+ constructor(e) {
491
+ this.growingIO = e, this.getValidResourceItem = e => {
492
+ if (e && S(e) && e.id && e.key) {
493
+ const t = {
494
+ id: O(e.id) ? e.id : j(e.id),
495
+ key: O(e.key) ? e.key : j(e.key)
496
+ };
497
+ return e.attributes && (t.attributes = e.attributes), t
498
+ }
499
+ }, this.getDynamicAttributes = e => (w(e) || V(e).forEach((t => {
500
+ T(e[t]) ? e[t] = e[t]() : S(e[t]) ? F(e, t) : N(e[t]) || (e[t] = j(e[t]))
501
+ })), e), this.buildCustomEvent = (e, t, i, n) => {
502
+ ee(e, (() => {
503
+ const {
504
+ dataStore: {
505
+ eventContextBuilder: r,
506
+ eventConverter: s,
507
+ currentPage: o
508
+ }
509
+ } = this.growingIO;
510
+ let a = Object.assign({
511
+ eventType: "CUSTOM",
512
+ eventName: e,
513
+ pageShowTimestamp: null == o ? void 0 : o.time,
514
+ attributes: Y(this.getDynamicAttributes(S(t) && !$(t) ? t : void 0)),
515
+ resourceItem: Y(this.getValidResourceItem(i))
516
+ }, r());
517
+ $(n) || (a = Object.assign(Object.assign({}, a), n)), s(a)
518
+ }))
519
+ }, this.buildUserAttributesEvent = (e, t) => {
520
+ const {
521
+ dataStore: {
522
+ eventContextBuilder: i,
523
+ eventConverter: n
524
+ }
525
+ } = this.growingIO;
526
+ let r = Object.assign({
527
+ eventType: "LOGIN_USER_ATTRIBUTES",
528
+ attributes: Y(e)
529
+ }, i());
530
+ $(t) || (r = Object.assign(Object.assign({}, r), t)), n(r)
531
+ }
532
+ }
533
+ }
534
+ };
535
+ const we = {
536
+ gioprojectid: "projectId",
537
+ giodatacollect: "dataCollect",
538
+ gioappid: "domain",
539
+ giodatasourceid: "dataSourceId",
540
+ gios: "sessionId",
541
+ giou: "uid",
542
+ giocs1: "userId",
543
+ gioid: "gioId",
544
+ giouserkey: "userKey",
545
+ gioappchannel: "appChannel",
546
+ giodevicebrand: "deviceBrand",
547
+ giodevicemodel: "deviceModel",
548
+ giodevicetype: "deviceType",
549
+ giolanguage: "language",
550
+ gionetworkstate: "networkState",
551
+ giooperatingsystem: "operatingSystem",
552
+ gioplatform: "platform",
553
+ gioplatformversion: "platformVersion",
554
+ gioscreenheight: "screenHeight",
555
+ gioscreenwidth: "screenWidth"
556
+ },
557
+ Oe = ["giodatasourceid", "gioplatform", "gioappchannel", "giodevicebrand", "giodevicemodel", "giodevicetype", "giolanguage", "gionetworkstate", "giooperatingsystem", "gioplatformversion", "gioscreenheight", "gioscreenwidth"],
558
+ be = ["giocs1", "gios", "giou", "gioid", "giouserkey"],
559
+ ye = "gio_search_cookie_gioenc";
560
+ var Ee = {
561
+ name: "gioEmbeddedAdapter",
562
+ method: class {
563
+ constructor(e) {
564
+ this.growingIO = e, this.main = e => {
565
+ var t;
566
+ const {
567
+ projectId: i,
568
+ appId: n
569
+ } = e, r = this.getGQS();
570
+ let s = !1;
571
+ return "none" !== this.qsFrom && r.gioprojectid === i && r.gioappid === n && ($(r) ? this.growingIO.storage.removeItem(ye) : this.growingIO.storage.setItem(ye, ge.stringify(r)), K(r, "giodatacollect") && (this.growingIO.vdsConfig.dataCollect = L(["true", !0], r.giodatacollect)), null === (t = this.growingIO.emitter) || void 0 === t || t.on("SDK_INITIALIZED", (() => {
572
+ const {
573
+ userStore: e,
574
+ vdsConfig: {
575
+ sessionExpires: t
576
+ },
577
+ dataStore: {
578
+ eventContextBuilderInst: i
579
+ }
580
+ } = this.growingIO;
581
+ be.forEach((t => {
582
+ var i;
583
+ e[we[t]] = null !== (i = r[t]) && void 0 !== i ? i : ""
584
+ })), window.setInterval((() => {
585
+ e.sessionId = r.gios
586
+ }), .8 * t * 60 * 1e3), Oe.forEach((e => {
587
+ K(r, e) && (i.minpExtraParams[we[e]] = r[e])
588
+ }))
589
+ })), this.growingIO.setUserId = () => {}, this.growingIO.clearUserId = () => {}, K(r, "giodatacollect") && (this.growingIO.setDataCollect = () => {}, this.growingIO.setOption = () => {}), s = !0), this.gioURLRewrite(), s
590
+ }, this.getGQS = () => {
591
+ const {
592
+ hashtag: e
593
+ } = this.growingIO.vdsConfig, t = this.growingIO.storage.getItem(ye), i = window.location.search, n = window.location.hash, r = e ? n.substring(n.indexOf("?") + 1) : "", s = ge.parse(i), o = ge.parse(r), a = ge.parse((t || "").replace("gioenc-", ""));
594
+ let d = {};
595
+ if (K(s, "gioprojectid")) d = s, this.qsFrom = "search";
596
+ else if (K(o, "gioprojectid")) d = o, this.qsFrom = "hash";
597
+ else {
598
+ if (!K(a, "gioprojectid")) return this.qsFrom = "none", {};
599
+ d = a, this.qsFrom = "cookie"
600
+ }
601
+ const l = {},
602
+ c = {},
603
+ h = ["gioappid", "gioprojectid", "giodatacollect", ...be, ...Oe];
604
+ return V(d).forEach((e => {
605
+ const t = e.toLowerCase();
606
+ L(h, t) ? L(["", "undefined", "null", void 0, null], d[e]) || (l[t] = d[e], L(["true", "TRUE", !0], d[e]) && (l[t] = !0), L(["false", "FALSE", !1], d[e]) && (l[t] = !1)) : c[e] = d[e]
607
+ })), this.gqs = l, this.ngqs = c, l
608
+ }, this.gioURLRewrite = () => {
609
+ const {
610
+ hashtag: e
611
+ } = this.growingIO.vdsConfig;
612
+ let t = window.location.search,
613
+ i = window.location.hash,
614
+ n = !1;
615
+ if ("search" === this.qsFrom && (t = ge.stringify(this.ngqs, !0), n = !0), e && "hash" === this.qsFrom && (i = `${i.split("?")[0]}${ge.stringify(this.ngqs,!0)}`, n = !0), n) {
616
+ const e = `${window.location.pathname}${t||""}${i||""}`;
617
+ window.history.replaceState(null, document.title, e)
618
+ }
619
+ }, this.gqs = {}, this.ngqs = {}, this.qsFrom = "search"
620
+ }
621
+ }
622
+ },
623
+ Se = {},
624
+ _e = {};
625
+ ! function (e) {
626
+ var t = v && v.__spreadArray || function (e, t, i) {
627
+ if (i || 2 === arguments.length)
628
+ for (var n, r = 0, s = t.length; s > r; r++) !n && r in t || (n || (n = [].slice.call(t, 0, r)), n[r] = t[r]);
629
+ return e.concat(n || [].slice.call(t))
630
+ };
631
+ Object.defineProperty(e, "__esModule", {
632
+ value: !0
633
+ }), e.GROWING_TITLE_OLD = e.GROWING_TITLE = e.GROWING_GTITLE = e.GROWING_CDP_INDEX = e.GROWING_INDEX_OLD = e.GROWING_INDEX = e.GROWING_CONTAINER = e.GROWING_TRACK = e.GROWING_IGNORE = e.VALID_CLASS_SELECTOR = e.VALID_ID_SELECTOR = e.EXCLUDE_CLASS_RE = e.UNSUPPORTED_TAGS = e.TEXT_NODE = e.UNSUPPORTED_CLICK_TAGS = e.SUPPORTED_ICON_TAGS = e.SUPPORTED_CHANGE_TYPES = e.SUPPORTED_CLICK_INPUT_TYPES = e.SUPPORTED_CONTAINER_TAGS = e.LIST_TAGS = void 0, e.LIST_TAGS = ["TR", "LI", "DL"], e.SUPPORTED_CONTAINER_TAGS = t(["A", "BUTTON"], e.LIST_TAGS, !0), e.SUPPORTED_CLICK_INPUT_TYPES = ["button", "submit", "reset"], e.SUPPORTED_CHANGE_TYPES = ["radio", "checkbox", "search"], e.SUPPORTED_ICON_TAGS = ["I", "EM", "svg", "IMG"], e.UNSUPPORTED_CLICK_TAGS = ["TEXTAREA", "HTML", "BODY"], e.TEXT_NODE = ["I", "SPAN", "EM", "B", "STRONG"], e.UNSUPPORTED_TAGS = ["tspan", "text", "g", "rect", "path", "defs", "clippath", "desc", "title", "math", "use"], e.EXCLUDE_CLASS_RE = /(^| |[^ ]+\-)(clear|clearfix|active|hover|enabled|current|selected|unselected|hidden|display|focus|disabled|undisabled|open|checked|unchecked|undefined|null|ng-|growing-)[^\. ]*/g, e.VALID_ID_SELECTOR = /^[a-zA-Z-\_][a-zA-Z\-\_0-9]+$/, e.VALID_CLASS_SELECTOR = /^([a-zA-Z\-\_0-9]+)$/, e.GROWING_IGNORE = "data-growing-ignore", e.GROWING_TRACK = "data-growing-track", e.GROWING_CONTAINER = "data-growing-container", e.GROWING_INDEX = "data-growing-index", e.GROWING_INDEX_OLD = "data-growing-idx", e.GROWING_CDP_INDEX = "data-index", e.GROWING_GTITLE = "data-growing-title", e.GROWING_TITLE = "data-title", e.GROWING_TITLE_OLD = "growing-title"
634
+ }(_e);
635
+ var Te = {},
636
+ Ne = {};
637
+ Object.defineProperty(Ne, "__esModule", {
638
+ value: !0
639
+ }), Ne.lastFindIndex = Ne.findIndex = Ne.arrayEquals = Ne.rmBlank = Ne.normalizePath = Ne.splitNoEmpty = Ne.filterText = void 0, Ne.filterText = function (e, t) {
640
+ if (void 0 === t && (t = !0), e && (null == (e = e.replace(/[\n \t]+/g, " ").trim()) ? void 0 : e.length)) return e.slice(0, t ? 50 : void 0)
641
+ }, Ne.splitNoEmpty = function (e, t) {
642
+ return e ? e.split(t).filter((function (e) {
643
+ return !!e
644
+ })) : []
645
+ }, Ne.normalizePath = function (e) {
646
+ var t = e.length;
647
+ return t > 1 && "/" === e.charAt(t - 1) ? e.slice(0, t - 1) : e
648
+ }, Ne.rmBlank = function (e) {
649
+ return e ? e.replace(/[\n \t]+/g, "") : ""
650
+ }, Ne.arrayEquals = function (e, t) {
651
+ if (!e || !t) return !1;
652
+ if (e.length !== t.length) return !1;
653
+ for (var i = 0, n = e.length; n > i; i++)
654
+ if (e[i] !== t[i]) return !1;
655
+ return !0
656
+ }, Ne.findIndex = function (e, t) {
657
+ if (null == e || "function" != typeof t) return -1;
658
+ for (var i = 0; i < e.length; i++) {
659
+ var n = e[i];
660
+ if (t.call(void 0, n)) return i
661
+ }
662
+ return -1
663
+ }, Ne.lastFindIndex = function (e, t) {
664
+ if (null == e || "function" != typeof t) return -1;
665
+ for (var i = e.length - 1; i >= 0; i--) {
666
+ var n = e[i];
667
+ if (t.call(void 0, n)) return i
668
+ }
669
+ return -1
670
+ },
671
+ function (e) {
672
+ var t = v && v.__spreadArray || function (e, t, i) {
673
+ if (i || 2 === arguments.length)
674
+ for (var n, r = 0, s = t.length; s > r; r++) !n && r in t || (n || (n = [].slice.call(t, 0, r)), n[r] = t[r]);
675
+ return e.concat(n || [].slice.call(t))
676
+ },
677
+ i = v && v.__importDefault || function (e) {
678
+ return e && e.__esModule ? e : {
679
+ default: e
680
+ }
681
+ };
682
+ Object.defineProperty(e, "__esModule", {
683
+ value: !0
684
+ }), e.removeDiffTagOnHeadAndTail = e.computeXpath = e.getMarkIndex = e.getEffectiveNode = e.isIgnore = e.depthInside = e.changeableInput = e.clickableInput = e.onlyContainsTextChildren = e.onlyContainsIconChildren = e.supportIconTag = e.isContainerTag = e.isListTag = e.isParentOfLeaf = e.isLeaf = e.getChildren = e.getDeepChildren = e.findParent = e.isRootNode = e.hasValidAttribute = void 0;
685
+ var n = Ne,
686
+ r = _e,
687
+ s = i(I);
688
+ e.hasValidAttribute = function (e, t) {
689
+ return e instanceof Element && e.hasAttribute(t) && "false" !== e.getAttribute(t)
690
+ }, e.isRootNode = function (e) {
691
+ return !e || -1 !== ["BODY", "HTML", "#document"].indexOf(e.nodeName)
692
+ }, e.findParent = function (t, i) {
693
+ for (var n = t.parentNode; n && !(0, e.isRootNode)(n);) {
694
+ if (i(n)) return n;
695
+ n = n.parentNode
696
+ }
697
+ }, e.getDeepChildren = function (i) {
698
+ return (0, s.default)((null == i ? void 0 : i.childNodes) || []).reduce((function (i, n) {
699
+ return n instanceof Element ? t(t(t([], i, !0), [n], !1), (0, e.getDeepChildren)(n), !0) : i
700
+ }), [])
701
+ }, e.getChildren = function (e) {
702
+ return (0, s.default)((null == e ? void 0 : e.childNodes) || []).filter((function (e) {
703
+ return e instanceof Element
704
+ }))
705
+ }, e.isLeaf = function (t) {
706
+ return !t.hasChildNodes() || "svg" === t.nodeName || 0 === (0, e.getChildren)(t).length
707
+ }, e.isParentOfLeaf = function (t) {
708
+ return !(!t.hasChildNodes() || "svg" === t.nodeName) && 0 === (0, s.default)(t.childNodes).filter((function (t) {
709
+ return !(0, e.isLeaf)(t)
710
+ })).length
711
+ }, e.isListTag = function (e) {
712
+ return -1 !== r.LIST_TAGS.indexOf(e.nodeName)
713
+ }, e.isContainerTag = function (t) {
714
+ return (0, e.hasValidAttribute)(t, r.GROWING_CONTAINER) || -1 !== r.SUPPORTED_CONTAINER_TAGS.indexOf(t.nodeName)
715
+ }, e.supportIconTag = function (e) {
716
+ var t = e.nodeName;
717
+ return -1 !== r.SUPPORTED_ICON_TAGS.indexOf(t)
718
+ }, e.onlyContainsIconChildren = function (t) {
719
+ if (t.textContent) return !1;
720
+ var i = (0, e.getChildren)(t);
721
+ if (0 === i.length) return !1;
722
+ for (var n = 0, r = i; n < r.length; n++) {
723
+ var s = r[n];
724
+ if (!(0, e.supportIconTag)(s) && "SPAN" !== s.nodeName) return !1
725
+ }
726
+ return !0
727
+ }, e.onlyContainsTextChildren = function (t) {
728
+ return 0 !== (0, e.getChildren)(t).length && !(0, e.getDeepChildren)(t).map((function (e) {
729
+ return e.tagName
730
+ })).some((function (e) {
731
+ return -1 === r.TEXT_NODE.indexOf(e)
732
+ }))
733
+ }, e.clickableInput = function (e) {
734
+ return e instanceof HTMLInputElement && "INPUT" === e.tagName && -1 !== r.SUPPORTED_CLICK_INPUT_TYPES.indexOf(e.type)
735
+ }, e.changeableInput = function (e) {
736
+ return e instanceof HTMLInputElement && "INPUT" === e.tagName && -1 !== r.SUPPORTED_CHANGE_TYPES.indexOf(e.type)
737
+ }, e.depthInside = function (t, i, n) {
738
+ if (void 0 === i && (i = 4), void 0 === n && (n = 1), n > i) return !1;
739
+ for (var r = "svg" === t.tagName ? [] : (0, e.getChildren)(t), s = 0; s < r.length; s++) {
740
+ var o = r[s];
741
+ if (!(0, e.depthInside)(o, i, n + 1)) return !1
742
+ }
743
+ return i >= n
744
+ }, e.isIgnore = function (t) {
745
+ if (!(t instanceof Element) || (0, e.hasValidAttribute)(t, r.GROWING_IGNORE)) return !0;
746
+ for (var i = t.parentNode; i && !(0, e.isRootNode)(i);) {
747
+ if ((0, e.hasValidAttribute)(i, r.GROWING_IGNORE)) return !0;
748
+ i = i.parentNode
749
+ }
750
+ return !1
751
+ }, e.getEffectiveNode = function (t) {
752
+ for (var i, n; t && (n = void 0, !((i = t) instanceof Element && -1 === r.UNSUPPORTED_TAGS.indexOf(null === (n = i.tagName) || void 0 === n ? void 0 : n.toLowerCase()))) && t.parentNode;) t = t.parentNode;
753
+ var s, o = t.parentNode;
754
+ return !(0, e.isRootNode)(o) && ((0, e.onlyContainsIconChildren)(o) || "BUTTON" === (s = o).tagName && (0, e.onlyContainsTextChildren)(s)) ? o : t
755
+ }, e.getMarkIndex = function (e) {
756
+ if (e instanceof Element) {
757
+ var t = e.getAttribute(r.GROWING_INDEX) || e.getAttribute(r.GROWING_INDEX_OLD) || e.getAttribute(r.GROWING_CDP_INDEX);
758
+ if (t) {
759
+ if (/^\d{1,10}$/.test(t) && +t > 0 && 2147483647 > +t) return +t;
760
+ window.console.error("[GioNode]:标记的index不符合规范(index必须是大于0且小于2147483647的整数字)。", t)
761
+ }
762
+ }
763
+ }, e.computeXpath = function (e) {
764
+ for (var t = e.parentPaths(!0), i = Math.min(t.length, +(t.length >= 10) + 4), n = ["", "", ""], r = 0; r < t.length; r++) {
765
+ var s = t[r].path,
766
+ o = t[r].name;
767
+ n[0] = s + n[0], n[2] = "/".concat(o) + n[2], i > r && (n[1] = s + n[1])
768
+ }
769
+ return n
770
+ }, e.removeDiffTagOnHeadAndTail = function (e, t) {
771
+ var i = function (e) {
772
+ return e.nodeName === t.nodeName
773
+ },
774
+ r = (0, n.findIndex)(e, i),
775
+ s = (0, n.lastFindIndex)(e, i);
776
+ return -1 === r || -1 === s ? [] : e.slice(r, s + 1)
777
+ }
778
+ }(Te);
779
+ var Ce = {},
780
+ Ae = {};
781
+ Object.defineProperty(Ae, "__esModule", {
782
+ value: !0
783
+ });
784
+ var xe = _e,
785
+ Pe = Ne,
786
+ De = Te;
787
+
788
+ function Re(e) {
789
+ var t;
790
+ if (e instanceof Element) {
791
+ var i = e.getAttribute("name");
792
+ if (i) return [i];
793
+ if (e.hasAttribute("class")) {
794
+ var n = null === (t = e.getAttribute("class")) || void 0 === t ? void 0 : t.replace(xe.EXCLUDE_CLASS_RE, "").trim();
795
+ if (null == n ? void 0 : n.length) return n.split(/\s+/).filter((function (e) {
796
+ return xe.VALID_CLASS_SELECTOR.test(e) && !e.match(/[a-z][A-Z][a-z][A-Z]/) && !e.match(/[0-9][0-9][0-9][0-9]/)
797
+ })).sort()
798
+ }
799
+ }
800
+ return []
801
+ }
802
+ var Le = function () {
803
+ function e(e) {
804
+ var t;
805
+ this.node = e, this.tagName = this.node.nodeName, this.name = this.tagName.toLowerCase(), this.id = (t = this.node).id && xe.VALID_ID_SELECTOR.test(t.id) ? t.id : null, this.classList = Re(this.node), this.guessListAndIndex()
806
+ }
807
+ return e.prototype.guessListAndIndex = function () {
808
+ var e, t = this;
809
+ this._tagList = (0, De.isListTag)(this.node);
810
+ var i = (0, De.removeDiffTagOnHeadAndTail)((0, De.getChildren)(this.node.parentNode), this.node);
811
+ if (this._tagList && -1 !== (s = i.filter((function (e) {
812
+ return e.tagName === t.tagName
813
+ })).indexOf(this.node)) && (this._index = s + 1), i.length >= 3 && (null === (e = this.classList) || void 0 === e ? void 0 : e.length)) {
814
+ for (var n = 0, r = 0, s = 1; s <= i.length; s++) {
815
+ var o = i[s - 1];
816
+ if (o.tagName !== this.tagName) {
817
+ r = 0;
818
+ break
819
+ }(0, Pe.arrayEquals)(this.classList, Re(o)) && (r += 1), this.node === o && (n = s)
820
+ }
821
+ 3 > r || (this._pseudoList = !0, this._index = this._index || n)
822
+ }
823
+ }, Object.defineProperty(e.prototype, "path", {
824
+ get: function () {
825
+ var e;
826
+ return this._path || (this._path = "/".concat(this.name), this.id && (this._path += "#".concat(this.id)), (null === (e = this.classList) || void 0 === e ? void 0 : e.length) && (this._path += ".".concat(this.classList.join(".")))), this._path
827
+ },
828
+ enumerable: !1,
829
+ configurable: !0
830
+ }), Object.defineProperty(e.prototype, "pseudoList", {
831
+ get: function () {
832
+ return !!this._pseudoList
833
+ },
834
+ enumerable: !1,
835
+ configurable: !0
836
+ }), Object.defineProperty(e.prototype, "list", {
837
+ get: function () {
838
+ return !!this._tagList || !!this._pseudoList
839
+ },
840
+ enumerable: !1,
841
+ configurable: !0
842
+ }), Object.defineProperty(e.prototype, "index", {
843
+ get: function () {
844
+ return (0, De.getMarkIndex)(this.node) || this._index
845
+ },
846
+ enumerable: !1,
847
+ configurable: !0
848
+ }), Object.defineProperty(e.prototype, "container", {
849
+ get: function () {
850
+ return (0, De.isContainerTag)(this.node) || this.list
851
+ },
852
+ enumerable: !1,
853
+ configurable: !0
854
+ }), Object.defineProperty(e.prototype, "parent", {
855
+ get: function () {
856
+ return this.node.parentNode ? new e(this.node.parentNode) : null
857
+ },
858
+ enumerable: !1,
859
+ configurable: !0
860
+ }), e.prototype.parentPaths = function (e) {
861
+ void 0 === e && (e = !1);
862
+ for (var t = e ? [this] : [], i = this.parent; i && !(0, De.isRootNode)(i.node);) t.push(i), i = i.parent;
863
+ return t
864
+ }, e
865
+ }();
866
+ Ae.default = Le;
867
+ var ke = {};
868
+ Object.defineProperty(ke, "__esModule", {
869
+ value: !0
870
+ }), ke.getElementHref = ke.getImgHref = ke.getAnchorHref = void 0;
871
+ var je = Ne;
872
+
873
+ function Ue(e) {
874
+ if (e.hasAttribute("href")) {
875
+ var t = e.getAttribute("href");
876
+ if (t && 0 !== t.indexOf("javascript")) return (0, je.normalizePath)(t.slice(0, 320))
877
+ }
878
+ }
879
+
880
+ function Ge(e) {
881
+ if (e.src && -1 === e.src.indexOf("data:image")) return e.src
882
+ }
883
+ ke.getAnchorHref = Ue, ke.getImgHref = Ge, ke.getElementHref = function (e) {
884
+ var t = e;
885
+ if (t) switch (e.nodeName.toLowerCase()) {
886
+ case "a":
887
+ return Ue(t);
888
+ case "img":
889
+ return Ge(t)
890
+ }
891
+ };
892
+ var qe = {},
893
+ He = v && v.__importDefault || function (e) {
894
+ return e && e.__esModule ? e : {
895
+ default: e
896
+ }
897
+ };
898
+ Object.defineProperty(qe, "__esModule", {
899
+ value: !0
900
+ }), qe.getElementContent = qe.getFormContent = void 0;
901
+ var Be = Te,
902
+ Ke = ke,
903
+ Ve = _e,
904
+ We = He(Ae),
905
+ Me = Ne,
906
+ Fe = He(I),
907
+ $e = function (e) {
908
+ return e.htmlFor || e.getAttribute("for")
909
+ },
910
+ Xe = function (e) {
911
+ var t = e.getAttribute(Ve.GROWING_GTITLE) || e.getAttribute(Ve.GROWING_TITLE) || e.getAttribute(Ve.GROWING_TITLE_OLD) || e.getAttribute("title");
912
+ return null == t ? void 0 : t.trim()
913
+ };
914
+
915
+ function ze(e) {
916
+ var t = e.node;
917
+ return e.list ? Je(t) : (0, Me.filterText)(t.textContent) || void 0
918
+ }
919
+
920
+ function Je(e) {
921
+ for (var t = void 0, i = !1, n = 0, r = (0, Fe.default)(e.childNodes); n < r.length; n++) {
922
+ var s = r[n];
923
+ if (s.nodeType === Node.TEXT_NODE) {
924
+ var o = (0, Me.filterText)(s.textContent);
925
+ if (o) return o
926
+ }
927
+ if (s.nodeType === Node.ELEMENT_NODE && -1 === ["INPUT", "SELECT"].indexOf(s.nodeName)) {
928
+ if (new We.default(s).pseudoList) return;
929
+ i = (0, Be.onlyContainsIconChildren)(s) || (0, Be.supportIconTag)(s);
930
+ var a = Ye(s);
931
+ if (i) t = a, i = !1;
932
+ else if (a || (a = Je(s)), a) return a
933
+ }
934
+ }
935
+ return t
936
+ }
937
+
938
+ function Ze(e) {
939
+ for (var t = e.getElementsByTagName("input"), i = 0, n = (0, Fe.default)(t); i < n.length; i++) {
940
+ var r = n[i];
941
+ if (("search" === r.type || "text" === r.type && ("q" === r.id || -1 !== r.id.indexOf("search") || "q" === r.name || -1 !== r.name.indexOf("search"))) && !(0, Be.isIgnore)(r)) {
942
+ var s = Ye(r);
943
+ if (s) return s
944
+ }
945
+ }
946
+ }
947
+
948
+ function Ye(e) {
949
+ return function (e) {
950
+ var t = e;
951
+ if (t) {
952
+ var i = Xe(t);
953
+ if (i) return i;
954
+ var n, r, s, o = new We.default(e);
955
+ switch (e.nodeName.toLowerCase()) {
956
+ case "a":
957
+ return function (e) {
958
+ if (((0, Be.isLeaf)(e) || (0, Be.onlyContainsIconChildren)(e)) && e.textContent) {
959
+ var t = (0, Me.filterText)(e.textContent);
960
+ if (t) return t
961
+ }
962
+ var i = (0, Ke.getAnchorHref)(e);
963
+ if (i) {
964
+ var n = i.indexOf("?");
965
+ return n > -1 ? i.slice(0, n) : i
966
+ }
967
+ }(t);
968
+ case "svg":
969
+ return function (e) {
970
+ for (var t = 0, i = (0, Fe.default)(e.childNodes); t < i.length; t++) {
971
+ var n = i[t];
972
+ if (n.nodeType === Node.ELEMENT_NODE && "use" === n.tagName.toLowerCase() && n.hasAttribute("xlink:href")) return n.getAttribute("xlink:href")
973
+ }
974
+ }(t);
975
+ case "button":
976
+ return (null === (s = (r = t).name) || void 0 === s ? void 0 : s.length) ? r.name : (0, Me.filterText)(r.textContent) || Je(r);
977
+ case "img":
978
+ return function (e) {
979
+ if (e.alt) return e.alt;
980
+ var t = (0, Ke.getImgHref)(e);
981
+ if (t) {
982
+ var i = t.split("?")[0].split("/");
983
+ if (i.length > 0) return i[i.length - 1]
984
+ }
985
+ }(t);
986
+ case "label":
987
+ return ze(o);
988
+ case "input":
989
+ return function (e) {
990
+ if ((0, Be.clickableInput)(e)) return e.value;
991
+ if ("password" !== e.type && (0, Be.hasValidAttribute)(e, Ve.GROWING_TRACK)) return e.value;
992
+ if ((0, Be.changeableInput)(e)) {
993
+ var t = (0, Be.findParent)(e, (function (e) {
994
+ return "LABEL" === e.nodeName
995
+ }));
996
+ if (!t && e.id)
997
+ for (var i = document.body.getElementsByTagName("label"), n = 0; n < i.length; n++) {
998
+ var r = i[n];
999
+ if ($e(r) === e.id) {
1000
+ t = r;
1001
+ break
1002
+ }
1003
+ }
1004
+ if (t) {
1005
+ var s = ze(new We.default(t));
1006
+ if (s && s.length > 0) return s + " (" + e.checked + ")"
1007
+ }
1008
+ return e.value
1009
+ }
1010
+ }(t);
1011
+ case "select":
1012
+ return n = t, (0, Fe.default)(n.options).filter((function (e) {
1013
+ return e.selected
1014
+ })).map((function (e) {
1015
+ return e.label
1016
+ })).join(", ") || n.value;
1017
+ case "form":
1018
+ return Ze(t)
1019
+ }
1020
+ return (0, Be.isLeaf)(t) ? function (e) {
1021
+ var t = (0, Me.filterText)(e.textContent);
1022
+ if (t) return t
1023
+ }(t) : (0, Be.isParentOfLeaf)(t) && !(0, Be.onlyContainsIconChildren)(t) ? function (e) {
1024
+ for (var t = "", i = 0, n = (0, Fe.default)(e.childNodes); i < n.length; i++) {
1025
+ var r = n[i];
1026
+ t += (r.nodeType === Node.TEXT_NODE && r.textContent ? r.textContent.trim() : "") + " "
1027
+ }
1028
+ return (0, Me.filterText)(t, !1)
1029
+ }(t) : o.container || (0, Be.onlyContainsIconChildren)(e) ? Je(t) : void 0
1030
+ }
1031
+ }(e) || void 0
1032
+ }
1033
+ qe.getFormContent = Ze, qe.getElementContent = Ye;
1034
+ var Qe, et = v && v.__extends || (Qe = function (e, t) {
1035
+ return Qe = Object.setPrototypeOf || {
1036
+ __proto__: []
1037
+ }
1038
+ instanceof Array && function (e, t) {
1039
+ e.__proto__ = t
1040
+ } || function (e, t) {
1041
+ for (var i in t)({}).hasOwnProperty.call(t, i) && (e[i] = t[i])
1042
+ }, Qe(e, t)
1043
+ }, function (e, t) {
1044
+ if ("function" != typeof t && null !== t) throw new TypeError("Class extends value " + t + " is not a constructor or null");
1045
+
1046
+ function i() {
1047
+ this.constructor = e
1048
+ }
1049
+ Qe(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
1050
+ }),
1051
+ tt = v && v.__importDefault || function (e) {
1052
+ return e && e.__esModule ? e : {
1053
+ default: e
1054
+ }
1055
+ };
1056
+ Object.defineProperty(Ce, "__esModule", {
1057
+ value: !0
1058
+ });
1059
+ var it = tt(Ae),
1060
+ nt = ke,
1061
+ rt = qe,
1062
+ st = Te,
1063
+ ot = function (e) {
1064
+ function t(t) {
1065
+ var i = e.call(this, t) || this;
1066
+ i.node = t;
1067
+ var n = (0, st.computeXpath)(i),
1068
+ r = n[0],
1069
+ s = n[1],
1070
+ o = n[2];
1071
+ return i.fullXpath = r, i.xpath = s, i.skeleton = o, i
1072
+ }
1073
+ return et(t, e), Object.defineProperty(t.prototype, "href", {
1074
+ get: function () {
1075
+ return (0, nt.getElementHref)(this.node)
1076
+ },
1077
+ enumerable: !1,
1078
+ configurable: !0
1079
+ }), Object.defineProperty(t.prototype, "content", {
1080
+ get: function () {
1081
+ return (0, rt.getElementContent)(this.node)
1082
+ },
1083
+ enumerable: !1,
1084
+ configurable: !0
1085
+ }), t
1086
+ }(it.default);
1087
+ Ce.default = ot;
1088
+ var at = v && v.__assign || function () {
1089
+ return at = Object.assign || function (e) {
1090
+ for (var t, i = 1, n = arguments.length; n > i; i++)
1091
+ for (var r in t = arguments[i])({}).hasOwnProperty.call(t, r) && (e[r] = t[r]);
1092
+ return e
1093
+ }, at.apply(this, arguments)
1094
+ },
1095
+ dt = v && v.__importDefault || function (e) {
1096
+ return e && e.__esModule ? e : {
1097
+ default: e
1098
+ }
1099
+ };
1100
+ Object.defineProperty(Se, "__esModule", {
1101
+ value: !0
1102
+ });
1103
+ var lt = _e,
1104
+ ct = Te,
1105
+ ht = dt(Ce),
1106
+ ut = function () {
1107
+ function e(e, t, i) {
1108
+ void 0 === t && (t = null), void 0 === i && (i = !0), this.origin = e, this.action = t, this.direct = i, this.target = "self" === t ? e : (0, ct.getEffectiveNode)(e), this.ignore = (0, ct.isIgnore)(this.target), this.vnode = new ht.default(this.target), this.tagName = this.vnode.tagName
1109
+ }
1110
+ return Object.defineProperty(e.prototype, "content", {
1111
+ get: function () {
1112
+ return this.vnode.content
1113
+ },
1114
+ enumerable: !1,
1115
+ configurable: !0
1116
+ }), Object.defineProperty(e.prototype, "href", {
1117
+ get: function () {
1118
+ return this.vnode.href
1119
+ },
1120
+ enumerable: !1,
1121
+ configurable: !0
1122
+ }), Object.defineProperty(e.prototype, "index", {
1123
+ get: function () {
1124
+ return this.vnode.index
1125
+ },
1126
+ enumerable: !1,
1127
+ configurable: !0
1128
+ }), e.prototype.inferParentIndex = function () {
1129
+ var t = this;
1130
+ return this.parentIndex || (0, ct.findParent)(this.target, (function (i) {
1131
+ var n = new e(i, t.action, !1);
1132
+ n.traceable() && n.index && (t.parentIndex = n.index)
1133
+ })), this.parentIndex
1134
+ }, Object.defineProperty(e.prototype, "xpath", {
1135
+ get: function () {
1136
+ return this.vnode.xpath
1137
+ },
1138
+ enumerable: !1,
1139
+ configurable: !0
1140
+ }), Object.defineProperty(e.prototype, "fullXpath", {
1141
+ get: function () {
1142
+ return this.vnode.fullXpath
1143
+ },
1144
+ enumerable: !1,
1145
+ configurable: !0
1146
+ }), Object.defineProperty(e.prototype, "skeleton", {
1147
+ get: function () {
1148
+ return this.vnode.skeleton
1149
+ },
1150
+ enumerable: !1,
1151
+ configurable: !0
1152
+ }), e.prototype.info = function (e) {
1153
+ return void 0 === e && (e = !0), e && this.inferParentIndex(), {
1154
+ skeleton: this.skeleton,
1155
+ fullXpath: this.fullXpath,
1156
+ xpath: this.xpath,
1157
+ content: this.content,
1158
+ href: this.href,
1159
+ index: this.parentIndex || this.index
1160
+ }
1161
+ }, e.prototype.traceable = function () {
1162
+ if (this.ignore) return !1;
1163
+ if (this.direct) {
1164
+ if ("click" === this.action || "hover" === this.action) {
1165
+ if (-1 !== lt.UNSUPPORTED_CLICK_TAGS.indexOf(this.target.tagName)) return !1;
1166
+ if ("INPUT" === this.target.tagName && !(0, ct.clickableInput)(this.target)) return !1;
1167
+ if (!(0, ct.isContainerTag)(this.target) && !(0, ct.depthInside)(this.target, 5)) return !1
1168
+ }
1169
+ return !0
1170
+ }
1171
+ return this.vnode.container
1172
+ }, e.prototype.trackNodes = function () {
1173
+ if (!this.traceable()) return [];
1174
+ var e = [this];
1175
+ if ("submit" !== this.action)
1176
+ for (var t = this.parentElement; t;) {
1177
+ if (t.ignore) return [];
1178
+ t.traceable() && e.unshift(t), t = t.parentElement
1179
+ }
1180
+ var i = void 0;
1181
+ return e.map((function (e) {
1182
+ var t = e.info(!1),
1183
+ n = t.index;
1184
+ return !i && n && (i = n), at(at({}, t), {
1185
+ index: i || n
1186
+ })
1187
+ }))
1188
+ }, Object.defineProperty(e.prototype, "parentElement", {
1189
+ get: function () {
1190
+ var t = this.target.parentNode;
1191
+ if (t && t.nodeName && !(0, ct.isRootNode)(t)) return new e(t, this.action, !1)
1192
+ },
1193
+ enumerable: !1,
1194
+ configurable: !0
1195
+ }), e
1196
+ }(),
1197
+ gt = Se.default = ut;
1198
+ class pt {
1199
+ constructor(e) {
1200
+ this.handler = e;
1201
+ const t = navigator.userAgent,
1202
+ i = /chrome/i.exec(t),
1203
+ n = /android/i.exec(t);
1204
+ this.hasTouch = "ontouchstart" in window && !(i && !n)
1205
+ }
1206
+ main() {
1207
+ const e = this.hasTouch ? ["touchstart"] : ["mousedown"],
1208
+ t = this.hasTouch ? ["touchend", "touchcancel"] : ["mouseup", "mouseleave"],
1209
+ i = this.hasTouch ? ["touchmove"] : ["mousemove"];
1210
+ for (const t of e) Q(window, t, this.touchStartHandler.bind(this));
1211
+ for (const e of i) Q(window, e, this.touchMoveHandler.bind(this));
1212
+ for (const e of t) Q(window, e, this.touchStopHandler.bind(this))
1213
+ }
1214
+ touchStartHandler(e) {
1215
+ if (e.which > 1) return;
1216
+ const t = +Date.now();
1217
+ this.safeguard !== t && (this.touchTimeout && clearTimeout(this.touchTimeout), this.safeguard = t, this.touchEvent = {
1218
+ time: t,
1219
+ target: e.target,
1220
+ x: this._page("x", e),
1221
+ y: this._page("y", e),
1222
+ isTrusted: !0,
1223
+ type: "click"
1224
+ })
1225
+ }
1226
+ touchMoveHandler(e) {
1227
+ const t = Math.abs(this._page("x", e) - (this.touchEvent && this.touchEvent.x) || 0),
1228
+ i = Math.abs(this._page("y", e) - (this.touchEvent && this.touchEvent.y) || 0);
1229
+ (t > 10 || i > 10) && (this.touchEvent = null)
1230
+ }
1231
+ touchStopHandler(e) {
1232
+ const t = +Date.now() - (this.touchEvent && this.touchEvent.time) || 0;
1233
+ this.touchEvent && 200 > t ? this.touchTimeout = setTimeout((() => {
1234
+ this.handler(this.touchEvent), this.touchEvent = null
1235
+ }), 200) : this.touchEvent && t >= 200 && 700 > t && (this.handler(this.touchEvent), this.touchEvent = null)
1236
+ }
1237
+ _page(e, t) {
1238
+ return (this.hasTouch ? t.touches[0] : t)["page" + e.toUpperCase()]
1239
+ }
1240
+ }
1241
+ var ft = {
1242
+ name: "gioEventAutoTracking",
1243
+ method: class {
1244
+ constructor(e) {
1245
+ this.growingIO = e, this.main = () => {
1246
+ Q(document, "submit", this._handleAction), Q(document, "change", this._handleAction);
1247
+ const {
1248
+ vdsConfig: e
1249
+ } = this.growingIO;
1250
+ e.touch ? new pt(this._handleAction).main() : Q(document, "click", this._handleAction)
1251
+ }, this._handleAction = (e, t) => {
1252
+ const {
1253
+ vdsConfig: i,
1254
+ emitter: n
1255
+ } = this.growingIO;
1256
+ if (!i.autotrack) return !1;
1257
+ const r = e.target;
1258
+ if (!r) return !1;
1259
+ let s = new gt(r, e.type, !0).trackNodes();
1260
+ if ("click" !== e.type && (s = $(x(s)) ? [] : [x(s)]), $(s)) return !1;
1261
+ null == n || n.emit("onComposeBefore", {
1262
+ event: t,
1263
+ params: null != e ? e : {}
1264
+ }), s.forEach((t => {
1265
+ const {
1266
+ fullXpath: n,
1267
+ index: r,
1268
+ content: s,
1269
+ href: o
1270
+ } = t;
1271
+ if (!q(t.fullXpath || "", "/div#__vconsole") && !q(t.fullXpath || "", "/div#__giokit") && (i.debug && console.log("Action:", e.type, Date.now()), n)) {
1272
+ const {
1273
+ dataStore: {
1274
+ eventContextBuilder: t,
1275
+ eventConverter: i,
1276
+ currentPage: a
1277
+ }
1278
+ } = this.growingIO;
1279
+ i(Object.assign(Object.assign({
1280
+ eventType: l[e.type],
1281
+ element: [{
1282
+ xpath: n,
1283
+ index: r,
1284
+ textValue: s,
1285
+ hyperlink: o
1286
+ }]
1287
+ }, t()), {
1288
+ pageShowTimestamp: a.time
1289
+ }))
1290
+ }
1291
+ }))
1292
+ }
1293
+ }
1294
+ }
1295
+ };
1296
+ const mt = ["VIEW_CLICK", "VIEW_CHANGE", "FORM_SUBMIT", "PAGE", "CUSTOM", "LOGIN_USER_ATTRIBUTES"],
1297
+ vt = ["LOGIN_USER_ATTRIBUTES"];
1298
+ var It = {
1299
+ name: "gioHybridAdapter",
1300
+ method: class {
1301
+ constructor(e) {
1302
+ this.growingIO = e, this.penetrateHybrid = !0, this.main = e => {
1303
+ var t;
1304
+ this.projectId = e.projectId, E(e.penetrateHybrid) && (this.penetrateHybrid = e.penetrateHybrid), this._initHybridBridge();
1305
+ const i = this.projectId === (null === (t = this.hybridConfig) || void 0 === t ? void 0 : t.projectId);
1306
+ if (i) {
1307
+ const {
1308
+ emitter: e
1309
+ } = this.growingIO;
1310
+ null == e || e.on(ce, (({
1311
+ newUserId: e,
1312
+ oldUserId: t,
1313
+ userKey: i
1314
+ }) => {
1315
+ this.penetrateHybrid && (!e && t ? i ? this._clearNativeUserIdAndUserKey() : this._clearNativeUserId() : i ? this._setNativeUserIdAndUserKey(j(e), j(i)) : this._setNativeUserId(j(e)))
1316
+ })), null == e || e.on(he, (({
1317
+ newUserKey: e,
1318
+ oldUserKey: t,
1319
+ userId: i
1320
+ }) => {
1321
+ this.penetrateHybrid && (!e && t ? this._clearNativeUserIdAndUserKey() : this._setNativeUserIdAndUserKey(j(i), j(e)))
1322
+ }))
1323
+ }
1324
+ return i
1325
+ }, this._initHybridBridge = () => {
1326
+ var e, t, i;
1327
+ this.hasHybridBridge = !!window.GrowingWebViewJavascriptBridge, this.hasHybridBridge && ((null === (e = null === window || void 0 === window ? void 0 : window.GrowingWebViewJavascriptBridge) || void 0 === e ? void 0 : e.configuration) || (window.GrowingWebViewJavascriptBridge.configuration = JSON.parse(window.GrowingWebViewJavascriptBridge.getConfiguration())), (null === (t = null === window || void 0 === window ? void 0 : window.GrowingWebViewJavascriptBridge) || void 0 === t ? void 0 : t.configuration) && (this.hybridConfig = null === (i = null === window || void 0 === window ? void 0 : window.GrowingWebViewJavascriptBridge) || void 0 === i ? void 0 : i.configuration))
1328
+ }, this.onSendBefore = ({
1329
+ requestData: e
1330
+ }) => {
1331
+ var t, i;
1332
+ this.hasHybridBridge && L(mt, e.eventType) && (L(vt, e.eventType) ? this.penetrateHybrid && (null === (t = window.GrowingWebViewJavascriptBridge) || void 0 === t || t.dispatchEvent(JSON.stringify(this.processAttributes(e)))) : (this.penetrateHybrid || (F(e, "userId"), F(e, "userKey"), F(e, "cs1")), null === (i = window.GrowingWebViewJavascriptBridge) || void 0 === i || i.dispatchEvent(JSON.stringify(this.processAttributes(e)))))
1333
+ }, this.processAttributes = e => (W(e, ((t, i) => {
1334
+ S(t) || N(t) ? W(e[i], ((t, n) => {
1335
+ S(t) || N(t) ? e[i][n] = JSON.stringify(t) : e[i][n] = j(t)
1336
+ })) : e[i] = j(t)
1337
+ })), e), this._setNativeUserId = e => {
1338
+ Z((() => window.GrowingWebViewJavascriptBridge.setNativeUserId(e)))
1339
+ }, this._clearNativeUserId = () => {
1340
+ Z((() => window.GrowingWebViewJavascriptBridge.clearNativeUserId()))
1341
+ }, this._setNativeUserIdAndUserKey = (e, t) => {
1342
+ Z((() => window.GrowingWebViewJavascriptBridge.setNativeUserIdAndUserKey(e, t)))
1343
+ }, this._clearNativeUserIdAndUserKey = () => {
1344
+ Z((() => window.GrowingWebViewJavascriptBridge.clearNativeUserIdAndUserKey()))
1345
+ }
1346
+ }
1347
+ }
1348
+ };
1349
+ const wt = ["i", "span", "em", "b", "strong", "svg"];
1350
+ var Ot;
1351
+ ! function (e) {
1352
+ e[e.OUTER = 0] = "OUTER", e[e.INNER_COVERED = 1] = "INNER_COVERED", e[e.INNER_SHOW = 2] = "INNER_SHOW"
1353
+ }(Ot || (Ot = {}));
1354
+ const bt = ["HR", "BR", "SCRIPT", "NOSCRIPT", "STYLE", "HEAD", "BASE", "LINK", "META", "TITLE", "BODY", "HTML", "TEMPLATE", "CODE", ..._e.UNSUPPORTED_CLICK_TAGS],
1355
+ yt = ["SELECT", "A", "BUTTON", "INPUT", "IMG", "FORM"],
1356
+ Et = (e, t, i) => document.elementFromPoint(t, i) === e;
1357
+ class St {
1358
+ constructor(e, t, i) {
1359
+ this.node = e, this.parentNodeDesc = t, this.devicesInfo = i, this.proxy = new gt(e), this.tagName = this.node.tagName, this.name = this.tagName.toLowerCase(), this.isIgnore = !!this.node.dataset.growingIgnore, this.isUnSupported = -1 !== bt.indexOf(this.tagName), this.rect = this.computeWindowRect()
1360
+ }
1361
+ info() {
1362
+ const e = this.desc();
1363
+ e.zLevel += this.devicesInfo.webviewZLevel;
1364
+ const t = this.getDeviceRect(this.rect);
1365
+ return F(e, "isContainer"), Object.assign(Object.assign(Object.assign({}, e), t), {
1366
+ parentXPath: this.parentNodeDesc.isContainer ? this.parentNodeDesc.xpath : void 0,
1367
+ href: this.proxy.href,
1368
+ content: this.proxy.content,
1369
+ nodeType: this.nodeType()
1370
+ })
1371
+ }
1372
+ nodeType() {
1373
+ return "input" !== this.name || Te.changeableInput(this.node) ? this.node.tagName : "INPUT_BTN"
1374
+ }
1375
+ desc() {
1376
+ return {
1377
+ index: this.parentNodeDesc.index || this.proxy.index,
1378
+ zLevel: this.zLevel(),
1379
+ xpath: this.proxy.xpath,
1380
+ isContainer: this.isDefinedContainer()
1381
+ }
1382
+ }
1383
+ cssVisible() {
1384
+ const e = this.computedStyle();
1385
+ return Number(e.opacity) > 0 && "visible" === e.visibility && "none" !== e.display
1386
+ }
1387
+ viewportStatus() {
1388
+ const {
1389
+ top: e,
1390
+ left: t,
1391
+ width: i,
1392
+ height: n
1393
+ } = this.rect, {
1394
+ winWidth: r,
1395
+ winHeight: s
1396
+ } = this.devicesInfo;
1397
+ if (0 >= i || 0 >= n) return Ot.OUTER;
1398
+ const o = this.node;
1399
+ return s > e && r > t && i > 0 && n > 0 ? Et(o, t + i / 2, e + n / 2) || Et(o, t + 1, e + 1) || Et(o, t + i - 1, e + 1) || Et(o, t + 1, e + n - 1) || Et(o, t + i - 1, e + n - 1) ? Ot.INNER_SHOW : Ot.INNER_COVERED : Ot.OUTER
1400
+ }
1401
+ isCircleable() {
1402
+ return this.proxy.target === this.proxy.origin && (!!this.isDefinedContainer() || !("input" === this.name && this.node instanceof HTMLInputElement && "password" === this.node.type) && (-1 !== yt.indexOf(this.name) || (Te.isLeaf(this.node) ? !this.isBigBlank() : this.hasBackgroundImage() && Te.depthInside(this.node, 4))))
1403
+ }
1404
+ isSimpleContainer() {
1405
+ return "select" === this.name || this.isDefaultContainer() && (function (e, t) {
1406
+ if (0 === e.children.length) return !1;
1407
+ for (const i of k(e.children))
1408
+ if (-1 === t.indexOf(i.tagName.toLowerCase())) return !1;
1409
+ return !0
1410
+ }(this.node, wt) || !this.node.childElementCount)
1411
+ }
1412
+ isDefinedContainer() {
1413
+ var e;
1414
+ return w(this.isContainer) ? this.isDefaultContainer() || this.isMarkContainer() || Te.isParentOfLeaf(this.node) && (!!(null === (e = this.node.innerText) || void 0 === e ? void 0 : e.trim().length) || function (e) {
1415
+ const t = e.attributes;
1416
+ if (t.length > 0)
1417
+ for (let e = 0; e < t.length; e++) {
1418
+ const i = t[e].value;
1419
+ if (i && "false" !== i) return !0
1420
+ }
1421
+ return !1
1422
+ }(this.node)) || "select" === this.name : !!this.isContainer
1423
+ }
1424
+ isDefaultContainer() {
1425
+ return -1 !== _e.SUPPORTED_CONTAINER_TAGS.indexOf(this.tagName) || Te.clickableInput(this.node)
1426
+ }
1427
+ isMarkContainer() {
1428
+ return this.node.hasAttribute("data-growing-container") || this.node.hasAttribute("growing-container")
1429
+ }
1430
+ isBigBlank() {
1431
+ var e, t;
1432
+ const i = null !== (t = null === (e = this.node.innerText) || void 0 === e ? void 0 : e.trim().length) && void 0 !== t ? t : 0,
1433
+ {
1434
+ width: n,
1435
+ height: r
1436
+ } = this.rect,
1437
+ {
1438
+ winWidth: s,
1439
+ winHeight: o
1440
+ } = this.devicesInfo;
1441
+ return !i && (n > s >> 1 || r > o >> 1)
1442
+ }
1443
+ hasBackgroundImage() {
1444
+ const e = this.computedStyle().backgroundImage;
1445
+ return !!e && "none" !== e && e.length > 0
1446
+ }
1447
+ zLevel() {
1448
+ const e = this.computedStyle(),
1449
+ t = e.zIndex;
1450
+ if ("auto" !== t) return Number(t || "0") + this.parentNodeDesc.zLevel;
1451
+ switch (e.position) {
1452
+ case "relative":
1453
+ return this.parentNodeDesc.zLevel + 2;
1454
+ case "sticky":
1455
+ return this.parentNodeDesc.zLevel + 3;
1456
+ case "absolute":
1457
+ return this.parentNodeDesc.zLevel + 4;
1458
+ case "fixed":
1459
+ return this.parentNodeDesc.zLevel + 5;
1460
+ default:
1461
+ return this.parentNodeDesc.zLevel + 1
1462
+ }
1463
+ }
1464
+ computeWindowRect() {
1465
+ if (this.rect) return this.rect;
1466
+ const e = this.node.getBoundingClientRect(),
1467
+ t = e.top,
1468
+ i = e.bottom,
1469
+ n = e.left;
1470
+ let r = e.right - n,
1471
+ s = i - t;
1472
+ return 0 > t ? s = t + s : t + s > this.devicesInfo.winHeight && (s = this.devicesInfo.winHeight - t), 0 > n ? r = n + r : n + r > this.devicesInfo.winWidth && (r = this.devicesInfo.winWidth - n), this.rect = {
1473
+ top: t,
1474
+ left: n,
1475
+ width: r,
1476
+ height: s
1477
+ }, this.rect
1478
+ }
1479
+ computedStyle() {
1480
+ return window.getComputedStyle(this.node)
1481
+ }
1482
+ getDeviceRect(e) {
1483
+ const {
1484
+ scale: t,
1485
+ webviewTop: i,
1486
+ webviewLeft: n
1487
+ } = this.devicesInfo;
1488
+ return {
1489
+ top: e.top * t + i,
1490
+ left: e.left * t + n,
1491
+ width: e.width * t,
1492
+ height: e.height * t
1493
+ }
1494
+ }
1495
+ }
1496
+ const _t = ["DOMContentLoaded", "onreadystatechange"],
1497
+ Tt = ["scroll", "resize", "load", "beforeunload", "popstate", "hashchange", "pagehide", "unload"];
1498
+ class Nt {
1499
+ constructor(e) {
1500
+ this.growingIO = e, this.addDomChangeListener()
1501
+ }
1502
+ getDomTree(e, t, i, n, r, s) {
1503
+ const o = function (e, t, i, n, r) {
1504
+ const s = document.documentElement.clientWidth;
1505
+ return {
1506
+ winWidth: s,
1507
+ winHeight: document.documentElement.clientHeight,
1508
+ scale: i / s,
1509
+ webviewTop: t,
1510
+ webviewLeft: e,
1511
+ webviewWidth: i,
1512
+ webviewHeight: n,
1513
+ webviewZLevel: r
1514
+ }
1515
+ }(e, t, i, n, r),
1516
+ a = this.getElementsByParent(s || document.body, {
1517
+ isContainer: !1,
1518
+ zLevel: 0
1519
+ }, o),
1520
+ {
1521
+ domain: d,
1522
+ path: l,
1523
+ query: c,
1524
+ title: h
1525
+ } = this.growingIO.dataStore.currentPage;
1526
+ return {
1527
+ page: {
1528
+ domain: d,
1529
+ path: l,
1530
+ query: c,
1531
+ title: h
1532
+ },
1533
+ elements: a
1534
+ }
1535
+ }
1536
+ getElementsByParent(e, t, i) {
1537
+ const n = [];
1538
+ return [].slice.call(e.childNodes, 0).filter((e => 1 === e.nodeType)).forEach((e => {
1539
+ const r = new St(e, t, i);
1540
+ if (r.cssVisible() && !r.isIgnore) {
1541
+ switch (r.viewportStatus()) {
1542
+ case Ot.INNER_SHOW:
1543
+ r.isCircleable() && n.push(r.info());
1544
+ break;
1545
+ case Ot.INNER_COVERED:
1546
+ r.isDefaultContainer() && n.push(r.info())
1547
+ }
1548
+ r.isSimpleContainer() || [].push.apply(n, this.getElementsByParent(e, r.desc(), i))
1549
+ }
1550
+ })), n
1551
+ }
1552
+ addDomChangeListener() {
1553
+ let e;
1554
+ const t = (t = "") => () => {
1555
+ var i;
1556
+ "beforeunload" === t && e && e.disconnect(), null === (i = window.GrowingWebViewJavascriptBridge) || void 0 === i || i.onDomChanged()
1557
+ };
1558
+ e = new MutationObserver(t("mutation")), e.observe(document.body, {
1559
+ attributes: !0,
1560
+ characterData: !0,
1561
+ childList: !0,
1562
+ subtree: !0
1563
+ }), _t.forEach((e => {
1564
+ Q(document, e, t(e))
1565
+ })), Tt.forEach((e => {
1566
+ Q(window, e, t(e))
1567
+ }))
1568
+ }
1569
+ }
1570
+ class Ct {
1571
+ constructor(e) {
1572
+ var t;
1573
+ this.growingIO = e, null === (t = this.growingIO.emitter) || void 0 === t || t.on(le, (() => {
1574
+ if (window.GrowingWebViewJavascriptBridge) {
1575
+ const e = this;
1576
+ window.GrowingWebViewJavascriptBridge.getDomTree = function () {
1577
+ if (arguments.length >= 4) return Ct.bindGetDomTree(e.growingIO), Ct.domHelper.getDomTree.apply(Ct.domHelper, arguments)
1578
+ }
1579
+ }
1580
+ }))
1581
+ }
1582
+ static bindGetDomTree(e) {
1583
+ this.domHelper || (this.domHelper = new Nt(e), window.GrowingWebViewJavascriptBridge.getDomTree = this.domHelper.getDomTree.bind(this.domHelper))
1584
+ }
1585
+ }
1586
+ var At = {
1587
+ name: "gioHybridCircle",
1588
+ method: Ct
1589
+ };
1590
+
1591
+ function xt(e) {
1592
+ for (var t = 1; arguments.length > t; t++) {
1593
+ var i = arguments[t];
1594
+ for (var n in i) e[n] = i[n]
1595
+ }
1596
+ return e
1597
+ }
1598
+ var Pt = function e(t, i) {
1599
+ function n(e, n, r) {
1600
+ if ("undefined" != typeof document) {
1601
+ "number" == typeof (r = xt({}, i, r)).expires && (r.expires = new Date(Date.now() + 864e5 * r.expires)), r.expires && (r.expires = r.expires.toUTCString()), e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
1602
+ var s = "";
1603
+ for (var o in r) r[o] && (s += "; " + o, !0 !== r[o] && (s += "=" + r[o].split(";")[0]));
1604
+ return document.cookie = e + "=" + t.write(n, e) + s
1605
+ }
1606
+ }
1607
+ return Object.create({
1608
+ set: n,
1609
+ get: function (e) {
1610
+ if ("undefined" != typeof document && (!arguments.length || e)) {
1611
+ for (var i = document.cookie ? document.cookie.split("; ") : [], n = {}, r = 0; r < i.length; r++) {
1612
+ var s = i[r].split("="),
1613
+ o = s.slice(1).join("=");
1614
+ try {
1615
+ var a = decodeURIComponent(s[0]);
1616
+ if (n[a] = t.read(o, a), e === a) break
1617
+ } catch (e) {}
1618
+ }
1619
+ return e ? n[e] : n
1620
+ }
1621
+ },
1622
+ remove: function (e, t) {
1623
+ n(e, "", xt({}, t, {
1624
+ expires: -1
1625
+ }))
1626
+ },
1627
+ withAttributes: function (t) {
1628
+ return e(this.converter, xt({}, this.attributes, t))
1629
+ },
1630
+ withConverter: function (t) {
1631
+ return e(xt({}, this.converter, t), this.attributes)
1632
+ }
1633
+ }, {
1634
+ attributes: {
1635
+ value: Object.freeze(i)
1636
+ },
1637
+ converter: {
1638
+ value: Object.freeze(t)
1639
+ }
1640
+ })
1641
+ }({
1642
+ read: function (e) {
1643
+ return '"' === e[0] && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
1644
+ },
1645
+ write: function (e) {
1646
+ return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent)
1647
+ }
1648
+ }, {
1649
+ path: "/"
1650
+ });
1651
+ const Dt = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function (e) {
1652
+ const t = 16 * Math.random() | 0;
1653
+ return ("x" === e ? t : 3 & t | 8).toString(16)
1654
+ })),
1655
+ Rt = () => {
1656
+ var e;
1657
+ const t = !!(null === (e = null === window || void 0 === window ? void 0 : window.navigator) || void 0 === e ? void 0 : e.sendBeacon),
1658
+ i = window.navigator.userAgent;
1659
+ if (i.match(/(iPad|iPhone|iPod)/g)) {
1660
+ const e = Lt(i);
1661
+ return t && e > 13
1662
+ }
1663
+ return t
1664
+ },
1665
+ Lt = e => {
1666
+ const t = e.toLowerCase().match(/cpu.*os (.*?) like mac os/i);
1667
+ return !t || 2 > t.length ? 0 : +t[1].split("_").slice(0, 2).join(".")
1668
+ },
1669
+ kt = e => {
1670
+ Pt.set("gioCookie", "yes", {
1671
+ domain: e
1672
+ });
1673
+ const t = !!Pt.get("gioCookie", {
1674
+ domain: e
1675
+ });
1676
+ return Pt.remove("gioCookie", {
1677
+ domain: e
1678
+ }), t
1679
+ },
1680
+ jt = e => H(e, "_gioenc") ? e.slice(0, -7) : e,
1681
+ Ut = e => y(Number(e)) && Z((() => JSON.parse(e))) || e;
1682
+ var Gt = {
1683
+ name: "gioImpressionTracking",
1684
+ method: class {
1685
+ constructor(e) {
1686
+ var t;
1687
+ this.growingIO = e, this.documentReady = !1, this.main = e => {
1688
+ "listener" === e ? (this.documentReady = !0, this.growingIO.gioSDKInitialized && this.initMutationObserver()) : "emitter" === e && this.documentReady && this.initMutationObserver()
1689
+ }, this.initIntersectionObserver = () => {
1690
+ this.intersectionObserver = new IntersectionObserver((e => {
1691
+ $(e) || e.map((e => {
1692
+ const {
1693
+ dataset: t
1694
+ } = e.target;
1695
+ if (e.intersectionRatio > 0) {
1696
+ const {
1697
+ eventId: e,
1698
+ properties: i,
1699
+ items: n
1700
+ } = this.getImpressionProperties(t), r = t.id;
1701
+ if (r) {
1702
+ if ("once" === t.gioImpType && K(this.sentImps, r)) return;
1703
+ this.sentImps[r] = {
1704
+ eventId: e,
1705
+ properties: i,
1706
+ items: n
1707
+ }
1708
+ }
1709
+ e && this.growingIO.track(e, i, n)
1710
+ }
1711
+ }))
1712
+ }))
1713
+ }, this.initMutationObserver = () => {
1714
+ if (this.mutationObserver) return !1;
1715
+ const e = document.querySelectorAll("[data-gio-imp-track]");
1716
+ k(e).map((e => {
1717
+ var t;
1718
+ null === (t = this.intersectionObserver) || void 0 === t || t.observe(e)
1719
+ })), this.mutationObserver = new MutationObserver((e => e.map((e => {
1720
+ var t;
1721
+ if ("attributes" === e.type) {
1722
+ const {
1723
+ dataset: i
1724
+ } = e.target;
1725
+ if (i.gioImpTrack) return null === (t = this.intersectionObserver) || void 0 === t ? void 0 : t.observe(e.target)
1726
+ }
1727
+ })))), this.mutationObserver.observe(document.body, {
1728
+ attributes: !0,
1729
+ childList: !0,
1730
+ subtree: !0,
1731
+ attributeOldValue: !0,
1732
+ attributeFilter: ["data-gio-imp-track", "data-gio-imp-attrs", "data-gio-imp-items", /^data-gio-track-[a-z]+$/i]
1733
+ })
1734
+ }, this.getImpressionProperties = e => {
1735
+ let t = {
1736
+ eventId: void 0,
1737
+ properties: {}
1738
+ };
1739
+ if (!(null == e ? void 0 : e.gioImpTrack)) return t;
1740
+ if (t.eventId = e.gioImpTrack, K(e, "gioImpAttrs")) t.properties = Z((() => S(e.gioImpAttrs) ? e.gioImpAttrs : JSON.parse(e.gioImpAttrs))), t.items = Z((() => S(e.gioImpItems) ? e.gioImpItems : JSON.parse(e.gioImpItems)));
1741
+ else {
1742
+ const i = /^gioTrack(.+)/;
1743
+ for (const n in e) {
1744
+ let r;
1745
+ const s = n.match(i);
1746
+ s && (r = G(s[1]), "track" !== r && (t.properties[r] = e[n]))
1747
+ }
1748
+ }
1749
+ return t.properties = Y(t.properties), t.items = Y(t.items), /^\w+$/.test(t.eventId) && !Number.isInteger(Number(A(t.eventId.split("")))) || (t.eventId = null, t = {}), t
1750
+ }, this.sentImps = {}, window.ActiveXObject || "ActiveXObject" in window || navigator.userAgent.indexOf("compatible") > -1 && navigator.userAgent.indexOf("MSIE") > -1 || navigator.userAgent.indexOf("Trident") > -1 && navigator.userAgent.indexOf("rv:11.0") > -1 ? J("IE浏览器不支持半自动埋点,gioImpressionTracking已自动关闭!", "warn") : (this.initIntersectionObserver(), Q(document, "readystatechange", (() => {
1751
+ L(["interactive", "complete"], document.readyState) && this.main("listener")
1752
+ }), {
1753
+ once: !0
1754
+ }), null === (t = this.growingIO.emitter) || void 0 === t || t.on(le, (() => this.main("emitter"))), Q(window, "unload", (() => {
1755
+ this.intersectionObserver.disconnect(), this.mutationObserver.disconnect()
1756
+ })))
1757
+ }
1758
+ }
1759
+ },
1760
+ qt = {
1761
+ name: "gioWebCircle",
1762
+ method: class {
1763
+ constructor(e) {
1764
+ var t;
1765
+ this.growingIO = e, this.injectCircle = (e, t) => {
1766
+ const i = document.createElement("link"),
1767
+ n = document.createElement("script");
1768
+ i.rel = "stylesheet", i.href = e, n.src = t, document.head.appendChild(i), document.head.appendChild(n)
1769
+ }, null === (t = this.growingIO.emitter) || void 0 === t || t.on(le, (() => {
1770
+ window.addEventListener("message", (e => {
1771
+ const {
1772
+ data: t,
1773
+ source: i
1774
+ } = e, n = window.vds;
1775
+ if (t && i) {
1776
+ const e = i.vds,
1777
+ r = t.cssURL,
1778
+ s = t.jsURL;
1779
+ e && "SDK_INJECT_CIRCLE_SCRIPT" === t.type && n.projectId === e.projectId && n.dataSourceId === e.dataSourceId && this.injectCircle(r, s)
1780
+ }
1781
+ }))
1782
+ }))
1783
+ }
1784
+ }
1785
+ };
1786
+ const Ht = ["gioPerformance"];
1787
+ class Bt {
1788
+ constructor(e) {
1789
+ var t, i, n, r;
1790
+ this.growingIO = e, this.innerPluginInit = () => {
1791
+ var e;
1792
+ Ht.forEach((e => {
1793
+ var t;
1794
+ return F(null === (t = this.pluginsContext) || void 0 === t ? void 0 : t.plugins, e)
1795
+ })), V(null === (e = this.pluginsContext) || void 0 === e ? void 0 : e.plugins).forEach((e => {
1796
+ var t;
1797
+ const {
1798
+ name: i,
1799
+ method: n
1800
+ } = null === (t = this.pluginsContext) || void 0 === t ? void 0 : t.plugins[e];
1801
+ R(this.pluginItems, (e => e.name === i)) || this.pluginItems.push({
1802
+ name: G(i || e),
1803
+ method: n || (e => {})
1804
+ })
1805
+ })), $(this.pluginItems) || this.installAll()
1806
+ }, this.install = (e, t, i) => {
1807
+ var n, r;
1808
+ const s = t || R(this.pluginItems, (t => t.name === e));
1809
+ if ((null === (n = this.growingIO) || void 0 === n ? void 0 : n.plugins)[e]) return J(`重复加载插件 ${e} 或插件重名,已跳过加载!`, "warn"), !1;
1810
+ if (!s) return J(`插件加载失败!不存在名为 ${e} 的插件!`, "error"), !1;
1811
+ try {
1812
+ return (null === (r = this.growingIO) || void 0 === r ? void 0 : r.plugins)[e] = new s.method(this.growingIO, i), "cdp" === this.growingIO.gioEnvironment && t && J("加载插件:" + e, "info"), !0
1813
+ } catch (e) {
1814
+ return J("插件加载异常:" + e, "error"), !1
1815
+ }
1816
+ }, this.installAll = e => {
1817
+ (e || this.pluginItems).forEach((t => this.install(t.name, e ? t : void 0, e ? null == t ? void 0 : t.options : void 0)))
1818
+ }, this.uninstall = e => {
1819
+ var t;
1820
+ F(this.pluginItems, e);
1821
+ const i = F(null === (t = this.growingIO) || void 0 === t ? void 0 : t.plugins, e);
1822
+ return i || J(`卸载插件 ${e} 失败!`, "error"), i
1823
+ }, this.uninstallAll = () => {
1824
+ this.pluginItems.forEach((e => this.uninstall(e.name)))
1825
+ }, this.lifeError = (e, t) => J(`插件执行错误 ${e.name} ${t}`, "error"), this.onComposeBefore = e => {
1826
+ this.pluginItems.forEach((t => {
1827
+ var i;
1828
+ const n = null === (i = this.growingIO.plugins[t.name]) || void 0 === i ? void 0 : i.onComposeBefore;
1829
+ if (n && T(n)) try {
1830
+ n(e)
1831
+ } catch (e) {
1832
+ this.lifeError(t, e)
1833
+ }
1834
+ }))
1835
+ }, this.onComposeAfter = e => {
1836
+ this.pluginItems.forEach((t => {
1837
+ var i;
1838
+ const n = null === (i = this.growingIO.plugins[t.name]) || void 0 === i ? void 0 : i.onComposeAfter;
1839
+ if (n && T(n)) try {
1840
+ n(e)
1841
+ } catch (e) {
1842
+ this.lifeError(t, e)
1843
+ }
1844
+ }))
1845
+ }, this.onSendBefore = e => {
1846
+ this.pluginItems.forEach((t => {
1847
+ var i;
1848
+ const n = null === (i = this.growingIO.plugins[t.name]) || void 0 === i ? void 0 : i.onSendBefore;
1849
+ if (n && T(n)) try {
1850
+ n(e)
1851
+ } catch (e) {
1852
+ this.lifeError(t, e)
1853
+ }
1854
+ }))
1855
+ }, this.onSendAfter = e => {
1856
+ this.pluginItems.forEach((t => {
1857
+ var i;
1858
+ const n = null === (i = this.growingIO.plugins[t.name]) || void 0 === i ? void 0 : i.onSendAfter;
1859
+ if (n && T(n)) try {
1860
+ n(e)
1861
+ } catch (e) {
1862
+ this.lifeError(t, e)
1863
+ }
1864
+ }))
1865
+ }, this.pluginsContext = {
1866
+ plugins: {}
1867
+ }, this.pluginItems = [], null === (t = this.growingIO.emitter) || void 0 === t || t.on("onComposeBefore", this.onComposeBefore), null === (i = this.growingIO.emitter) || void 0 === i || i.on("onComposeAfter", this.onComposeAfter), null === (n = this.growingIO.emitter) || void 0 === n || n.on("onSendBefore", this.onSendBefore), null === (r = this.growingIO.emitter) || void 0 === r || r.on("onSendAfter", this.onSendAfter)
1868
+ }
1869
+ }
1870
+ class Kt extends Bt {
1871
+ constructor(e) {
1872
+ super(e), this.growingIO = e, this.growingIO.gioSDKFull = !0, this.pluginsContext = {
1873
+ plugins: {
1874
+ gioCompress: ve,
1875
+ gioCustomTracking: Ie,
1876
+ gioEmbeddedAdapter: Ee,
1877
+ gioEventAutoTracking: ft,
1878
+ gioHybridAdapter: It,
1879
+ gioHybridCircle: At,
1880
+ gioImpressionTracking: Gt,
1881
+ gioWebCircle: qt
1882
+ }
1883
+ }
1884
+ }
1885
+ }
1886
+ const Vt = {
1887
+ A: 1,
1888
+ a: 1,
1889
+ Z: 1,
1890
+ z: 1,
1891
+ "@": 1,
1892
+ "{": 1
1893
+ },
1894
+ Wt = e => w(e) ? e : Z((() => "gioenc-" + Ft(e))) || e,
1895
+ Mt = e => O(e) && q(e, "gioenc-") && Z((() => Ft(e.replace("gioenc-", "")))) || e,
1896
+ Ft = e => (e = e || "").split("").map((e => Vt[e] ? e : $t(e))).join(""),
1897
+ $t = e => {
1898
+ if (/[0-9]/.test(e)) return 1 ^ +e; {
1899
+ let t = e.charCodeAt(0);
1900
+ return String.fromCharCode(1 ^ t)
1901
+ }
1902
+ };
1903
+ class Xt {
1904
+ constructor() {
1905
+ this.getItem = e => {
1906
+ const t = Z((() => JSON.parse(localStorage.getItem(jt(e)) || ""))) || {};
1907
+ return S(t) && t.expiredAt > +Date.now() ? Ut(Mt(t.value)) : void 0
1908
+ }, this.setItem = (e, t, i) => {
1909
+ const n = null != i ? i : +new Date(9999, 12);
1910
+ localStorage.setItem(jt(e), JSON.stringify({
1911
+ value: O(t) && t.length && H(e, "_gioenc") ? Wt(t) : t,
1912
+ expiredAt: n
1913
+ }))
1914
+ }, this.removeItem = e => localStorage.removeItem(jt(e)), this.hasItem = e => !!localStorage.getItem(jt(e)), this.getKeys = () => k(Array(localStorage.length)).map(((e, t) => localStorage.key(t))), this.type = "localStorage"
1915
+ }
1916
+ }
1917
+ const zt = {};
1918
+ let Jt;
1919
+ const Zt = (() => {
1920
+ let e = window.location.hostname;
1921
+ const t = Z((() => {
1922
+ const t = e.split("."),
1923
+ i = x(t);
1924
+ if ("localhost" !== e && (y(Number(i)) || 0 > Number(i) || Number(i) > 255)) return ["." + t.slice(-2).join("."), "." + t.slice(-3).join(".")]
1925
+ })) || [e];
1926
+ let i = "";
1927
+ return t.some((e => !!kt(e) && (i = e, !0))), i
1928
+ })();
1929
+ Jt = !L(["", "localhost", "127.0.0.1"], window.location.hostname) && L(["http:", "https:"], window.location.protocol) && Zt ? new class {
1930
+ constructor(e) {
1931
+ this.domain = e, this.getItem = e => Ut(Mt(Pt.get(jt(e)))), this.setItem = (e, t, i) => {
1932
+ let n;
1933
+ n = O(t) ? t.length ? H(e, "_gioenc") ? Wt(t) : t : "" : JSON.stringify(t), Pt.set(jt(e), n, {
1934
+ expires: i ? new Date(i) : 3650,
1935
+ domain: this.domain
1936
+ })
1937
+ }, this.removeItem = e => {
1938
+ Pt.remove(jt(e), {
1939
+ domain: this.domain
1940
+ })
1941
+ }, this.hasItem = e => L(V(Pt.get()), jt(e)), this.getKeys = () => V(Pt.get()), this.type = "Cookie"
1942
+ }
1943
+ }(Zt) : (e => {
1944
+ try {
1945
+ const e = window.localStorage,
1946
+ t = "__storage_test__";
1947
+ return e.setItem(t, t), e.removeItem(t), !0
1948
+ } catch (e) {
1949
+ return !1
1950
+ }
1951
+ })() ? new Xt : new class {
1952
+ constructor() {
1953
+ this.getItem = e => {
1954
+ const t = Z((() => JSON.parse(zt[jt(e)] || "")));
1955
+ return S(t) && t.expiredAt > +Date.now() ? Ut(Mt(t.value)) : void 0
1956
+ }, this.setItem = (e, t, i) => {
1957
+ const n = null != i ? i : +new Date(9999, 12);
1958
+ zt[jt(e)] = JSON.stringify({
1959
+ value: O(t) && t.length ? Wt(t) : t,
1960
+ expiredAt: n
1961
+ })
1962
+ }, this.removeItem = e => F(zt, jt(e)), this.hasItem = e => K(zt, jt(e)), this.getKeys = () => V(zt), this.type = "memory"
1963
+ }
1964
+ };
1965
+ var Yt = Jt;
1966
+ class Qt {
1967
+ constructor() {
1968
+ var e;
1969
+ this.trackingId = "g0", this.init = e => {
1970
+ var t, i, n, r, s, o;
1971
+ J("Gio Web SDK 初始化中...", "info");
1972
+ const {
1973
+ initOptions: a,
1974
+ currentPage: d,
1975
+ sendVisit: l,
1976
+ sendPage: c
1977
+ } = this.dataStore;
1978
+ a(e), this.useEmbeddedInherit = null === (i = null === (t = this.plugins) || void 0 === t ? void 0 : t.gioEmbeddedAdapter) || void 0 === i ? void 0 : i.main(e), this.useHybridInherit = null === (r = null === (n = this.plugins) || void 0 === n ? void 0 : n.gioHybridAdapter) || void 0 === r ? void 0 : r.main(e), null == this || this.initCallback(), d.hookHistory(), d.parsePage(), null === (s = this.emitter) || void 0 === s || s.emit(le, this), J("Gio Web SDK 初始化完成!", "success"), this.useEmbeddedInherit || l(), c(), this.gioSDKInitialized = !0, this.vdsConfig.gioSDKInitialized = !0, window[this.vds] = this.vdsConfig, null === (o = this.emitter) || void 0 === o || o.emit("SDK_INITIALIZED_COMPLATE", this)
1979
+ }, this.setOption = (e, t) => {
1980
+ if (L(s, e)) {
1981
+ const i = this.dataStore.setOption(e, t);
1982
+ return i && o[e] && J(`已${t?"开启":"关闭"}${o[e]}`, "info"), i
1983
+ }
1984
+ return J(`不存在可修改的配置项:${e},请检查后重试!`, "warn"), !1
1985
+ }, this.getOption = e => this.dataStore.getOption(e), this.setGeneralProps = e => {
1986
+ S(e) && !$(e) ? (this.dataStore.generalProps = Object.assign(Object.assign({}, this.dataStore.generalProps), e), V(this.dataStore.generalProps).forEach((e => {
1987
+ L([void 0, null], this.dataStore.generalProps[e]) && (this.dataStore.generalProps[e] = "")
1988
+ }))) : this.callError("setGeneralProps")
1989
+ }, this.clearGeneralProps = e => {
1990
+ N(e) && !$(e) ? e.forEach((e => {
1991
+ F(this.dataStore.generalProps, e)
1992
+ })) : this.dataStore.generalProps = {}
1993
+ }, this.reissuePage = () => {
1994
+ this.dataStore.sendPage()
1995
+ }, this.notRecommended = () => J("不推荐的方法使用,建议使用 gio('setOption', [optionName], [value])!", "info"), this.callError = (e, t = !0, i = "参数不合法") => J(`${t?"调用":"设置"} ${e} 失败,${i}!`, "warn"), this.gioEnvironment = "cdp", this.sdkVersion = "3.8.3", this.vds = window.gioCompatibilityVds ? "gdp_vds" : "vds", this.utils = Object.assign(Object.assign(Object.assign({}, z), te), {
1996
+ qs: ge
1997
+ }), this.emitter = {
1998
+ all: e = e || new Map,
1999
+ on: function (t, i) {
2000
+ var n = e.get(t);
2001
+ n ? n.push(i) : e.set(t, [i])
2002
+ },
2003
+ off: function (t, i) {
2004
+ var n = e.get(t);
2005
+ n && (i ? n.splice(n.indexOf(i) >>> 0, 1) : e.set(t, []))
2006
+ },
2007
+ emit: function (t, i) {
2008
+ var n = e.get(t);
2009
+ n && n.slice().map((function (e) {
2010
+ e(i)
2011
+ })), (n = e.get("*")) && n.slice().map((function (e) {
2012
+ e(t, i)
2013
+ }))
2014
+ }
2015
+ }, this.gioSDKInitialized = !1, this.storage = Yt, this.plugins = new Kt(this), this.plugins.innerPluginInit()
2016
+ }
2017
+ }
2018
+ class ei {
2019
+ constructor(e) {
2020
+ var t;
2021
+ this.growingIO = e;
2022
+ const {
2023
+ projectId: i
2024
+ } = this.growingIO.vdsConfig, {
2025
+ getItem: n,
2026
+ setItem: r,
2027
+ getKeys: s,
2028
+ removeItem: o
2029
+ } = this.growingIO.storage;
2030
+ this.getItem = n, this.setItem = r, this.getKeys = s, this.removeItem = o, this.sIdStorageName = i + "_gdp_session_id", this.uidStorageName = "gdp_user_id_gioenc", this.userIdStorageName = i + "_gdp_cs1_gioenc", this.userKeyStorageName = i + "_gdp_user_key_gioenc", this.gioIdStorageName = i + "_gdp_gio_id_gioenc", null === (t = this.growingIO.emitter) || void 0 === t || t.on(ue, (() => {
2031
+ this.growingIO.gioSDKInitialized && (this.growingIO.dataStore.sendVisit(!0), this.growingIO.dataStore.sendPage(!0))
2032
+ }))
2033
+ }
2034
+ get sessionId() {
2035
+ return this.getItem(this.sIdStorageName) || (this.sessionId = Dt(), this.sessionId)
2036
+ }
2037
+ set sessionId(e) {
2038
+ var t;
2039
+ e || (e = Dt());
2040
+ const i = this.getItem(this.sIdStorageName) || this.prevSessionId,
2041
+ {
2042
+ sessionExpires: n = 30
2043
+ } = this.growingIO.vdsConfig;
2044
+ this.setItem(this.sIdStorageName, e, +Date.now() + 60 * n * 1e3), i !== e && (this.getKeys().filter((e => /.+_gdp_session_id_.+/.test(e))).forEach((e => {
2045
+ this.removeItem(e)
2046
+ })), null === (t = this.growingIO.emitter) || void 0 === t || t.emit(ue, {
2047
+ newSessionId: e,
2048
+ oldSessionId: i
2049
+ })), this.prevSessionId = e
2050
+ }
2051
+ get uid() {
2052
+ return this.getItem(this.uidStorageName) || (this.uid = Dt(), this.uid)
2053
+ }
2054
+ set uid(e) {
2055
+ var t;
2056
+ const i = this.getItem(this.uidStorageName) || this.prevUId;
2057
+ this.setItem(this.uidStorageName, e), i !== e && (null === (t = this.growingIO.emitter) || void 0 === t || t.emit("UID_UPDATE", {
2058
+ newUId: e,
2059
+ oldUId: i
2060
+ })), this.prevUId = e
2061
+ }
2062
+ get userId() {
2063
+ return this.getItem(this.userIdStorageName) || ""
2064
+ }
2065
+ set userId(e) {
2066
+ var t;
2067
+ const i = this.getItem(this.userIdStorageName) || this.prevUserId;
2068
+ this.setItem(this.userIdStorageName, e), i !== e && (null === (t = this.growingIO.emitter) || void 0 === t || t.emit(ce, {
2069
+ newUserId: e,
2070
+ oldUserId: i,
2071
+ userKey: this.userKey
2072
+ })), e && (this.gioId = e), this.prevUserId = e
2073
+ }
2074
+ get userKey() {
2075
+ return this.getItem(this.userKeyStorageName) || ""
2076
+ }
2077
+ set userKey(e) {
2078
+ var t;
2079
+ const i = this.getItem(this.userKeyStorageName) || this.prevUserKey;
2080
+ this.setItem(this.userKeyStorageName, e), i !== e && (null === (t = this.growingIO.emitter) || void 0 === t || t.emit(he, {
2081
+ newUserKey: e,
2082
+ oldUserKey: i,
2083
+ userId: this.userId
2084
+ })), this.prevUserKey = e
2085
+ }
2086
+ get gioId() {
2087
+ return this.getItem(this.gioIdStorageName) || ""
2088
+ }
2089
+ set gioId(e) {
2090
+ var t;
2091
+ const i = this.getItem(this.gioIdStorageName) || this.prevGioId;
2092
+ this.setItem(this.gioIdStorageName, e), i !== e && (null === (t = this.growingIO.emitter) || void 0 === t || t.emit("GIOID_UPDATE", {
2093
+ newGioId: e,
2094
+ oldGioId: i
2095
+ })), this.prevGioId = e
2096
+ }
2097
+ }
2098
+ class ti {
2099
+ constructor(e) {
2100
+ this.growingIO = e, this.main = () => {
2101
+ var e;
2102
+ const {
2103
+ sdkVersion: t,
2104
+ useEmbeddedInherit: i,
2105
+ vdsConfig: n,
2106
+ userStore: r,
2107
+ dataStore: s,
2108
+ trackingId: o
2109
+ } = this.growingIO, {
2110
+ path: a,
2111
+ query: d
2112
+ } = s.currentPage;
2113
+ let l = {
2114
+ appVersion: n.version,
2115
+ dataSourceId: n.dataSourceId,
2116
+ deviceId: r.uid,
2117
+ domain: i ? n.appId : window.location.host,
2118
+ gioId: r.gioId,
2119
+ language: navigator.language,
2120
+ path: a,
2121
+ platform: n.platform,
2122
+ query: d,
2123
+ referralPage: (null === (e = s.lastPageEvent) || void 0 === e ? void 0 : e.referralPage) || "",
2124
+ screenHeight: window.screen.height,
2125
+ screenWidth: window.screen.width,
2126
+ sdkVersion: t,
2127
+ sessionId: r.sessionId,
2128
+ timestamp: +Date.now(),
2129
+ title: document.title.slice(0, 255),
2130
+ userId: r.userId
2131
+ };
2132
+ if (n.enableIdMapping && (l.userKey = r.userKey), $(n.ignoreFields) || n.ignoreFields.forEach((e => {
2133
+ F(l, e)
2134
+ })), i && !$(this.minpExtraParams)) {
2135
+ const e = Object.assign({}, l);
2136
+ W(Object.assign(Object.assign({}, l), this.minpExtraParams), ((t, i) => {
2137
+ var r;
2138
+ L(n.embeddedIgnore, i) ? (l[i] = e[i], "domain" === i && (l[i] = window.location.host)) : l[i] = null !== (r = this.minpExtraParams[i]) && void 0 !== r ? r : l[i]
2139
+ }))
2140
+ }
2141
+ return l.trackingId = o, l
2142
+ }, this.minpExtraParams = {}
2143
+ }
2144
+ }
2145
+ class ii {
2146
+ constructor(e) {
2147
+ this.growingIO = e, this.parsePage = () => {
2148
+ const {
2149
+ hashtag: e
2150
+ } = this.growingIO.vdsConfig, t = location.pathname, i = location.search, n = location.hash, r = n.indexOf("?");
2151
+ this.domain = window.location.host, this.title = document.title.slice(0, 255), this.time = +Date.now(), this.path = t, this.query = i, e && (r > -1 ? (this.path += n.slice(0, r), this.query = this.query + "&" + n.slice(r + 1)) : this.path += n), this.query && L(["?", "&"], this.query.charAt(0)) && (this.query = this.query.slice(1))
2152
+ }, this._getNoHashHref = () => {
2153
+ const {
2154
+ protocol: e,
2155
+ host: t,
2156
+ pathname: i,
2157
+ search: n
2158
+ } = window.location;
2159
+ return `${e}://${t}${i}${n}`
2160
+ }, this.pageListener = () => {
2161
+ const {
2162
+ hashtag: e
2163
+ } = this.growingIO.vdsConfig;
2164
+ let t = window.location.href,
2165
+ i = this.lastHref;
2166
+ e || (t = this._getNoHashHref(), i = this.lastNoHashHref), i !== t && (this.parsePage(), this.buildPageEvent())
2167
+ }, this.hookHistory = () => {
2168
+ const e = window.history.pushState,
2169
+ t = window.history.replaceState,
2170
+ i = this;
2171
+ e && Z((() => window.history.pushState = function () {
2172
+ e.apply(window.history, arguments), setTimeout(i.pageListener)
2173
+ })), t && Z((() => window.history.replaceState = function () {
2174
+ t.apply(window.history, arguments), setTimeout(i.pageListener)
2175
+ })), Q(window, "popstate", this.pageListener);
2176
+ const {
2177
+ hashtag: n
2178
+ } = this.growingIO.vdsConfig;
2179
+ n && Q(window, "hashchange", this.pageListener)
2180
+ }, this.buildPageEvent = e => {
2181
+ const {
2182
+ dataStore: {
2183
+ lastPageEvent: t,
2184
+ eventContextBuilder: i,
2185
+ eventConverter: n
2186
+ }
2187
+ } = this.growingIO;
2188
+ let r = Object.assign(Object.assign({
2189
+ eventType: "PAGE"
2190
+ }, i()), {
2191
+ protocolType: location.protocol.substring(0, location.protocol.length - 1),
2192
+ referralPage: (null == t ? void 0 : t.path) === this.path && (null == t ? void 0 : t.query) === this.query ? null == t ? void 0 : t.referralPage : (null == t ? void 0 : t.path) ? this.lastHref : document.referrer
2193
+ });
2194
+ $(e) || (r = Object.assign(Object.assign({}, r), e)), r.timestamp = this.time, n(r), this.lastHref = window.location.href, this.lastNoHashHref = this._getNoHashHref(), this.lastLocation = Object.assign({}, window.location)
2195
+ }, this.title = document.title.slice(0, 255), this.lastLocation = Object.assign({}, window.location)
2196
+ }
2197
+ }
2198
+ const ni = {
2199
+ referralPage: document.referrer
2200
+ };
2201
+ class ri {
2202
+ constructor(r) {
2203
+ var a, l;
2204
+ this.growingIO = r, this.ALLOW_SETTING = Object.assign(Object.assign({}, t), "saas" === this.growingIO.gioEnvironment ? n : i), this.allowOptKeys = Object.keys(this.ALLOW_SETTING), this.trackTimers = {}, this.initStorageId = () => {
2205
+ const e = this.growingIO.storage.getItem(this.seqStorageIdName) || {};
2206
+ let t = Object.assign({}, e);
2207
+ F(t, "globalKey"), t = S(t) && !w(t) ? t : {}, this._esid = {}, V(t).forEach((e => {
2208
+ this._esid[e] = y(Number(t[e])) || t[e] >= 1e9 || 1 > t[e] ? 1 : t[e]
2209
+ })), M(t, this._esid) || this.setSequenceIds("esid", this._esid);
2210
+ const i = Number(e.globalKey);
2211
+ this._gsid = y(i) || i >= 1e9 || 1 > i ? 1 : i, i !== this._gsid && this.setSequenceIds("gsid", this._gsid)
2212
+ }, this.setSequenceIds = (e, t) => {
2213
+ let i = this.growingIO.storage.getItem(this.seqStorageIdName) || {};
2214
+ "gsid" === e ? i.globalKey = t : i = Object.assign(Object.assign({}, i), t), this.growingIO.storage.setItem(this.seqStorageIdName, i)
2215
+ }, this.initOptions = t => {
2216
+ var i, n, r, s, a, l, c;
2217
+ const {
2218
+ projectId: h,
2219
+ dataSourceId: u,
2220
+ appId: g
2221
+ } = t;
2222
+ this.initialDataSourceId = u;
2223
+ const p = {};
2224
+ this.allowOptKeys.forEach((i => {
2225
+ const n = this.ALLOW_SETTING[i].type;
2226
+ let r = N(n) ? !L(n, X(t[i])) : X(t[i]) !== n;
2227
+ "platform" !== i || L(e, t[i]) || (r = !0), r ? p[i] = this.ALLOW_SETTING[i].default : "ignoreFields" === i ? p.ignoreFields = t.ignoreFields.filter((e => L(d, e))) : (p[i] = t[i], L(["dataCollect", "autotrack"], i) && (p[i] || J("已关闭" + o[i], "info")))
2228
+ })), p.sessionExpires = Math.round(p.sessionExpires), (y(p.sessionExpires) || 1 > p.sessionExpires || p.sessionExpires > 360) && (p.sessionExpires = 30), "Cookie" === this.growingIO.storage.type && p.cookieDomain && kt(p.cookieDomain) && (this.growingIO.storage.domain = p.cookieDomain), this.growingIO.vdsConfig = Object.assign(Object.assign(Object.assign({}, null !== (i = window.vds) && void 0 !== i ? i : {}), p), {
2229
+ projectId: h,
2230
+ dataSourceId: u,
2231
+ appId: g,
2232
+ performance: {
2233
+ monitor: null === (r = null === (n = p.performance) || void 0 === n ? void 0 : n.monitor) || void 0 === r || r,
2234
+ exception: null === (a = null === (s = p.performance) || void 0 === s ? void 0 : s.exception) || void 0 === a || a,
2235
+ network: null !== (c = null === (l = p.performance) || void 0 === l ? void 0 : l.network) && void 0 !== c && c
2236
+ }
2237
+ }), window.vds = this.growingIO.vdsConfig, this.seqStorageIdName = h + "_gdp_sequence_ids"
2238
+ }, this.setOption = (e, t) => {
2239
+ var i;
2240
+ const {
2241
+ vdsConfig: n,
2242
+ callError: r,
2243
+ uploader: o,
2244
+ emitter: a
2245
+ } = this.growingIO, d = O(e) && L(s, e), l = d && typeof t === ((null === (i = this.ALLOW_SETTING[e]) || void 0 === i ? void 0 : i.type) || "string"), c = Object.assign({}, n);
2246
+ return d && l ? (n[e] = t, "dataCollect" === e && c.dataCollect !== t && (t ? (this.sendVisit(!0), this.sendPage()) : this.growingIO.clearTrackTimer()), L(["host", "scheme"], e) && (null == o || o.generateHost()), null == a || a.emit("OPTION_CHANGE", {
2247
+ optionName: e,
2248
+ optionValue: t
2249
+ }), window.vds[e] = t, !0) : (r("setOption > " + e), !1)
2250
+ }, this.getOption = e => {
2251
+ const {
2252
+ vdsConfig: t,
2253
+ callError: i
2254
+ } = this.growingIO;
2255
+ return e && K(t, j(e)) ? t[j(e)] : w(e) ? Object.assign({}, t) : void i("getOption > " + e)
2256
+ }, this.sendVisit = e => {
2257
+ const {
2258
+ userStore: {
2259
+ sessionId: t
2260
+ },
2261
+ vdsConfig: {
2262
+ projectId: i,
2263
+ dataCollect: n
2264
+ },
2265
+ storage: r
2266
+ } = this.growingIO;
2267
+ if (n) {
2268
+ const n = `${i}_gdp_session_id_${t}`,
2269
+ s = r.getItem(n);
2270
+ !e && L([!0, "true"], s) || (this.buildVisitEvent(), r.setItem(n, !0))
2271
+ }
2272
+ }, this.buildVisitEvent = e => {
2273
+ const {
2274
+ dataStore: {
2275
+ eventContextBuilder: t,
2276
+ eventConverter: i
2277
+ }
2278
+ } = this.growingIO, n = this.lastVisitEvent;
2279
+ let r = Object.assign(Object.assign({
2280
+ eventType: "VISIT"
2281
+ }, t()), {
2282
+ referralPage: n.referralPage
2283
+ });
2284
+ $(e) || (r.session = (null == e ? void 0 : e.session) || r.session, r.trackingId = null == e ? void 0 : e.trackingId, r = Object.assign(Object.assign({}, r), e)), (null == n ? void 0 : n.path) && (r.title = n.title, r.path = n.path, r.query = n.query, r.timestamp = n.timestamp), i(r)
2285
+ }, this.sendPage = e => {
2286
+ e && this.currentPage.parsePage(), this.currentPage.buildPageEvent()
2287
+ }, this.buildErrorEvent = e => {
2288
+ const {
2289
+ dataStore: {
2290
+ eventContextBuilder: t,
2291
+ eventConverter: i
2292
+ }
2293
+ } = this.growingIO;
2294
+ i(Object.assign({
2295
+ eventType: "CUSTOM",
2296
+ pageShowTimestamp: this.currentPage.time,
2297
+ eventName: "onError",
2298
+ attributes: e
2299
+ }, t()))
2300
+ }, this.currentPage = new ii(this.growingIO), this.eventContextBuilderInst = new ti(this.growingIO), this.eventContextBuilder = this.eventContextBuilderInst.main, this.generalProps = {}, this.localStore = new Xt, this._lastVisitEvent = ni, null === (a = this.growingIO.emitter) || void 0 === a || a.on("onComposeAfter", (({
2301
+ composedEvent: e
2302
+ }) => {
2303
+ "VISIT" !== e.eventType && "vst" !== e.t || e.trackingId !== this.growingIO.trackingId || (this.lastVisitEvent = e, this._lastVisitEvent = e)
2304
+ })), this.lastPageEvent = {}, null === (l = this.growingIO.emitter) || void 0 === l || l.on("onComposeAfter", (({
2305
+ composedEvent: e
2306
+ }) => {
2307
+ "PAGE" !== e.eventType && "page" !== e.t || e.trackingId !== this.growingIO.trackingId || (this.lastPageEvent = e)
2308
+ }))
2309
+ }
2310
+ get esid() {
2311
+ const e = this.growingIO.storage.getItem(this.seqStorageIdName) || {};
2312
+ let t = Object.assign({}, e);
2313
+ return F(t, "globalKey"), t = S(t) && !w(t) ? t : {}, this._esid = {}, V(t).forEach((e => {
2314
+ this._esid[e] = y(Number(t[e])) || t[e] >= 1e9 || 1 > t[e] ? 1 : t[e]
2315
+ })), this._esid
2316
+ }
2317
+ set esid(e) {
2318
+ const t = {};
2319
+ V(e).forEach((i => {
2320
+ t[i] = y(e[i]) || e[i] >= 1e9 || 1 > e[i] ? 1 : e[i]
2321
+ })), M(this._esid, t) || (this._esid = t, this.setSequenceIds("esid", this._esid))
2322
+ }
2323
+ get gsid() {
2324
+ const e = this.growingIO.storage.getItem(this.seqStorageIdName) || {},
2325
+ t = Number(e.globalKey);
2326
+ return this._gsid = y(t) || t >= 1e9 || 1 > t ? 1 : t, this._gsid
2327
+ }
2328
+ set gsid(e) {
2329
+ y(Number(e)) || e >= 1e9 || 1 > e ? this._gsid = 1 : this._gsid = e, this.setSequenceIds("gsid", this._gsid)
2330
+ }
2331
+ get lastVisitEvent() {
2332
+ var e;
2333
+ const {
2334
+ sessionId: t
2335
+ } = this.growingIO.userStore;
2336
+ return this._lastVisitEvent.path ? (t !== this._lastVisitEvent.sessionId && (this._lastVisitEvent = ni), this._lastVisitEvent) : null !== (e = Z((() => this.localStore.getItem(t + "_gdp_last_vst_gioenc")))) && void 0 !== e ? e : ni
2337
+ }
2338
+ set lastVisitEvent(e) {
2339
+ this.localStore.getKeys().filter((e => /.+_gdp_last_vst/.test(e))).forEach((e => {
2340
+ this.localStore.removeItem(e)
2341
+ }));
2342
+ const {
2343
+ sessionId: t
2344
+ } = this.growingIO.userStore;
2345
+ this.localStore.setItem(t + "_gdp_last_vst_gioenc", JSON.stringify(e))
2346
+ }
2347
+ }
2348
+ class si extends ri {
2349
+ constructor(e) {
2350
+ super(e), this.growingIO = e, this.eventConverter = e => {
2351
+ var t;
2352
+ const {
2353
+ vdsConfig: i,
2354
+ dataStore: n,
2355
+ uploader: r
2356
+ } = this.growingIO;
2357
+ if (i.dataCollect) {
2358
+ e.trackingId === this.growingIO.trackingId && (e.globalSequenceId = n.gsid, e.eventSequenceId = n.esid[e.eventType] || 1);
2359
+ const i = {};
2360
+ W(e, ((e, t) => {
2361
+ var n;
2362
+ if ("element" === t) {
2363
+ const t = null !== (n = A(e)) && void 0 !== n ? n : {};
2364
+ W(t, ((e, t) => {
2365
+ $(e) && 0 !== e || (i[t] = e)
2366
+ }))
2367
+ } else($(e) || w(e)) && 0 !== e || (i[t] = e)
2368
+ })), e.trackingId === this.growingIO.trackingId && (this.growingIO.dataStore.gsid += 1, this.growingIO.dataStore.esid = Object.assign(Object.assign({}, this.growingIO.dataStore.esid), {
2369
+ [i.eventType]: (this.growingIO.dataStore.esid[i.eventType] || 1) + 1
2370
+ })), null === (t = this.growingIO.emitter) || void 0 === t || t.emit("onComposeAfter", {
2371
+ composedEvent: Object.assign({}, i)
2372
+ }), e.trackingId === this.growingIO.trackingId && r.commitRequest(i)
2373
+ }
2374
+ }
2375
+ }
2376
+ }
2377
+ class oi {
2378
+ constructor(e) {
2379
+ this.growingIO = e, this.commitRequest = e => {
2380
+ const t = Object.assign({}, e);
2381
+ this.requestQueue.push(Object.assign(Object.assign({}, t), {
2382
+ requestType: Rt() ? "Beacon" : "XHR"
2383
+ })), this.initiateRequest()
2384
+ }, this.initiateRequest = () => {
2385
+ var e, t;
2386
+ if ([...this.requestQueue].length > 0 && this.requestingNum < this.requestLimit) {
2387
+ const {
2388
+ vdsConfig: i,
2389
+ emitter: n,
2390
+ plugins: r,
2391
+ useHybridInherit: s
2392
+ } = this.growingIO;
2393
+ if (this.requestQueue = [...this.requestQueue].filter((e => (this.retryIds[e.globalSequenceId || e.esid] || 0) <= this.retryLimit)), $(this.requestQueue)) return;
2394
+ const o = this.requestQueue.shift(),
2395
+ {
2396
+ requestType: a
2397
+ } = o;
2398
+ if (null == n || n.emit("onSendBefore", {
2399
+ requestData: o
2400
+ }), F(o, ["requestType", "trackingId"]), i.debug && console.log("[GrowingIO Debug]:", JSON.stringify(o, null, 2).replace(/\"/g, (() => {
2401
+ const e = window.navigator.userAgent;
2402
+ return /(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(e) && !/chrome\/(\d+\.\d+)/i.test(e)
2403
+ })() ? "" : '"')), this.requestingNum += 1, s) return this.requestSuccessFn(o), !1;
2404
+ let d = Object.assign({}, o);
2405
+ switch (i.compress && (null === (e = null == r ? void 0 : r.gioCompress) || void 0 === e ? void 0 : e.compressToUint8Array) ? (this.compressType = "1", d = null === (t = null == r ? void 0 : r.gioCompress) || void 0 === t ? void 0 : t.compressToUint8Array(JSON.stringify([d]))) : (this.compressType = "0", d = JSON.stringify([d])), a) {
2406
+ case "Beacon":
2407
+ default:
2408
+ this.sendByBeacon(o, d);
2409
+ break;
2410
+ case "XHR":
2411
+ this.sendByXHR(o, d);
2412
+ break;
2413
+ case "Image":
2414
+ this.sendByImage(o, d)
2415
+ }
2416
+ }
2417
+ }, this.generateURL = () => `${this.requestURL}?stm=${+Date.now()}&compress=${this.compressType}`, this.sendByBeacon = (e, t) => {
2418
+ navigator.sendBeacon(this.generateURL(), t) ? this.requestSuccessFn(e) : this.requestFailFn(e, "Beacon")
2419
+ }, this.sendByXHR = (e, t) => {
2420
+ var i;
2421
+ const n = L(["unload", "beforeunload", "pagehide"], null === (i = null === window || void 0 === window ? void 0 : window.event) || void 0 === i ? void 0 : i.type),
2422
+ r = new XMLHttpRequest;
2423
+ if (r) return r.open("POST", this.generateURL(), n), r.onreadystatechange = () => {
2424
+ 4 === r.readyState && 204 === r.status ? this.requestSuccessFn(e) : this.requestFailFn(e, "XHR")
2425
+ }, r.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"), void r.send(t);
2426
+ if (null === window || void 0 === window ? void 0 : window.XDomainRequest) {
2427
+ const i = new window.XDomainRequest;
2428
+ i.open("POST", this.generateURL().replace("https://", "http://"), n), i.onload = () => {
2429
+ 204 === i.status ? this.requestSuccessFn(e) : this.requestFailFn(e, "XHR")
2430
+ }, i.onerror = i.ontimeout = () => {
2431
+ this.requestFailFn(e, "XHR")
2432
+ }, i.send(t)
2433
+ }
2434
+ }, this.sendByImage = (e, t) => {
2435
+ const i = `${this.generateURL()}&data=${t}`;
2436
+ let n = document.createElement("img");
2437
+ n.width = 1, n.height = 1, n.onload = () => {
2438
+ this.requestSuccessFn(e), this.clearImage(n)
2439
+ }, n.onerror = n.onabort = () => {
2440
+ this.requestFailFn(e, "Image"), this.clearImage(n)
2441
+ }, n.src = i
2442
+ }, this.clearImage = e => {
2443
+ e.src = "", e.onload = () => {}, e.onerror = e.onerabort = () => {}, e = null
2444
+ }, this.requestSuccessFn = e => {
2445
+ var t;
2446
+ this.requestingNum -= 1;
2447
+ const i = e.globalSequenceId || e.esid || -1;
2448
+ this.retryIds[i] && (this.retryIds[i] = 0), this.growingIO.userStore.sessionId = this.growingIO.userStore.sessionId, null === (t = this.growingIO.emitter) || void 0 === t || t.emit("onSendAfter", {
2449
+ requestData: e
2450
+ }), this.initiateRequest()
2451
+ }, this.requestFailFn = (e, t) => {
2452
+ this.requestingNum -= 1;
2453
+ const i = e.globalSequenceId || e.esid || -1;
2454
+ this.retryIds[i] || (this.retryIds[i] = 0), this.retryIds[i] += 1;
2455
+ const n = this.requestQueue.some((t => t.globalSequenceId === e.globalSequenceId && t.esid === e.esid));
2456
+ let r = t;
2457
+ this.retryIds[i] < this.retryLimit + 1 || (r = "Beacon" === t ? "XHR" : "XHR" === t ? "Image" : void 0, this.retryIds[i] = 0), !n && r && this.requestQueue.push(Object.assign(Object.assign({}, e), {
2458
+ requestType: r
2459
+ }))
2460
+ }, this.requestQueue = [], this.requestLimit = 10, this.requestTimeout = 5e3, this.retryLimit = 1, this.retryIds = {}, this.requestingNum = 0, this.requestURL = ""
2461
+ }
2462
+ }
2463
+ class ai extends oi {
2464
+ constructor(e) {
2465
+ super(e), this.growingIO = e, this.generateHost = () => {
2466
+ let {
2467
+ scheme: e,
2468
+ host: t = "",
2469
+ projectId: i
2470
+ } = this.growingIO.vdsConfig;
2471
+ e ? H(j(e), "://") || (e += "://") : e = (location.protocol.indexOf("http") > -1 ? location.protocol.replace(":", "") : "https") + "//", q(t, "http") && (t = t.substring(t.indexOf("://") + (H(j(e), "://") ? 3 : 0))), this.requestURL = `${e}${t}/v3/projects/${i}/collect`
2472
+ }, this.requestURL = "", this.generateHost()
2473
+ }
2474
+ }
2475
+ class di extends Qt {
2476
+ constructor() {
2477
+ super(), this.registerPlugins = e => {
2478
+ N(e) ? (e.forEach(((t, i) => {
2479
+ var n, r;
2480
+ $(t) || w(t) ? J("插件不合法,跳过加载!", "warn") : (null === (n = t.js) || void 0 === n ? void 0 : n.default) && (e[i] = Object.assign(Object.assign({}, null === (r = t.js) || void 0 === r ? void 0 : r.default), {
2481
+ options: t.options
2482
+ }))
2483
+ })), e = D(e), this.plugins.pluginItems = [...this.plugins.pluginItems, ...e], this.plugins.installAll(e)) : J("插件注册失败,请检查!", "error")
2484
+ }, this.getPlugins = () => this.plugins.pluginItems, this.initCallback = () => {
2485
+ var e, t;
2486
+ this.userStore = new ei(this), this.uploader = new ai(this), null === (t = null === (e = this.plugins) || void 0 === e ? void 0 : e.gioEventAutoTracking) || void 0 === t || t.main(), this.vdsConfig.enableIdMapping || (this.userStore.userKey = "")
2487
+ }, this.setTrackerScheme = e => {
2488
+ L(["http", "https"], e) ? (this.dataStore.setOption("scheme", e), this.notRecommended()) : this.callError("scheme", !1)
2489
+ }, this.setTrackerHost = e => {
2490
+ ae.test(e) || de.test(e) ? (this.dataStore.setOption("host", e), this.notRecommended()) : this.callError("host", !1)
2491
+ }, this.setDataCollect = e => {
2492
+ this.setOption("dataCollect", !!e), this.notRecommended()
2493
+ }, this.setAutotrack = e => {
2494
+ this.setOption("autotrack", !!e), this.notRecommended()
2495
+ }, this.enableDebug = e => {
2496
+ this.setOption("debug", !!e), this.notRecommended()
2497
+ }, this.enableHT = e => {
2498
+ this.setOption("hashtag", !!e), this.notRecommended()
2499
+ }, this.getVisitorId = () => this.userStore.uid, this.getDeviceId = () => this.userStore.uid, this.setUserAttributes = (e, t) => {
2500
+ var i, n;
2501
+ !$(e) && S(e) ? null === (n = null === (i = this.plugins) || void 0 === i ? void 0 : i.gioCustomTracking) || void 0 === n || n.buildUserAttributesEvent(e, t) : this.callError("setUserAttributes")
2502
+ }, this.setUserId = (e, t) => {
2503
+ if (ie(j(e).trim())) {
2504
+ const i = this.userStore.gioId;
2505
+ this.vdsConfig.enableIdMapping && (this.userStore.userKey = !w(t) && j(t).length > 0 ? j(t).slice(0, 1e3) : ""), e = j(e).slice(0, 1e3), this.userStore.userId = e, i && i !== e && (this.userStore.sessionId = ""), i || i === e || this.dataStore.sendVisit(!0)
2506
+ } else this.clearUserId(), this.callError("setUserId")
2507
+ }, this.clearUserId = () => {
2508
+ this.userStore.userId = "", this.userStore.userKey = ""
2509
+ }, this.track = (e, t, i, n) => {
2510
+ var r, s;
2511
+ ((null === (s = null === (r = this.plugins) || void 0 === r ? void 0 : r.gioCustomTracking) || void 0 === s ? void 0 : s.buildCustomEvent) || function () {})(e, Object.assign(Object.assign({}, this.dataStore.generalProps), S(t) && !$(t) ? t : {}), i, n)
2512
+ }, this.sendPage = e => this.dataStore.currentPage.buildPageEvent(e), this.sendVisit = e => this.dataStore.buildVisitEvent(e), this.trackTimerStart = (e, t) => {
2513
+ this.vdsConfig.dataCollect && ee(e, (() => {
2514
+ const i = Dt();
2515
+ T(t) ? (this.dataStore.trackTimers[i] = {
2516
+ eventName: e,
2517
+ leng: 0,
2518
+ start: +Date.now()
2519
+ }, t(i)) : J("回调方法不合法,返回timerId失败!")
2520
+ }))
2521
+ }, this.trackTimerPause = e => {
2522
+ if (e && this.dataStore.trackTimers[e]) {
2523
+ const t = this.dataStore.trackTimers[e];
2524
+ t.start && (t.leng = t.leng + (+Date.now() - t.start)), t.start = 0
2525
+ }
2526
+ }, this.trackTimerResume = e => {
2527
+ if (e && this.dataStore.trackTimers[e]) {
2528
+ const t = this.dataStore.trackTimers[e];
2529
+ 0 === t.start && (t.start = +Date.now())
2530
+ }
2531
+ }, this.trackTimerEnd = (e, t) => {
2532
+ if (this.vdsConfig.dataCollect) {
2533
+ const i = 864e5;
2534
+ if (e && this.dataStore.trackTimers[e]) {
2535
+ const n = this.dataStore.trackTimers[e];
2536
+ if (0 !== n.start) {
2537
+ const e = +Date.now() - n.start;
2538
+ n.leng = e > 0 ? n.leng + e : 0
2539
+ }
2540
+ this.track(n.eventName, Object.assign(Object.assign({}, t), {
2541
+ event_duration: n.leng > i ? 0 : n.leng / 1e3
2542
+ })), this.removeTimer(e)
2543
+ } else J("未查找到对应的计时器,请检查!", "error")
2544
+ }
2545
+ }, this.removeTimer = e => {
2546
+ e && this.dataStore.trackTimers[e] && delete this.dataStore.trackTimers[e]
2547
+ }, this.clearTrackTimer = () => {
2548
+ this.dataStore.trackTimers = {}
2549
+ }, this.dataStore = new si(this)
2550
+ }
2551
+ }
2552
+ let li;
2553
+ return function () {
2554
+ var e, t, i, n, s;
2555
+ let o = window.gioCompatibilityVds ? "gdp_vds" : "vds";
2556
+ if (null === (e = window[o]) || void 0 === e ? void 0 : e.gioSDKInstalled) return li = window.gdp, void J("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!", "warn");
2557
+ window[o] = Object.assign(Object.assign({}, null !== (t = window[o]) && void 0 !== t ? t : {}), {
2558
+ gioSDKInstalled: !0
2559
+ });
2560
+ const d = new di;
2561
+ li = function () {
2562
+ var e;
2563
+ const t = arguments[0];
2564
+ if (O(t) && L(r, t) && d[t]) {
2565
+ const e = P(k(arguments));
2566
+ if ("init" === t) {
2567
+ if (!ne(d)) return;
2568
+ if (!re(e)) return;
2569
+ const t = se(e);
2570
+ if (!t) return;
2571
+ const i = oe(e);
2572
+ if (!i) return;
2573
+ const {
2574
+ projectId: n
2575
+ } = t, {
2576
+ dataSourceId: r,
2577
+ appId: s,
2578
+ cdpOptions: o
2579
+ } = i;
2580
+ d.init(Object.assign(Object.assign({}, o), {
2581
+ projectId: n,
2582
+ dataSourceId: r,
2583
+ appId: s
2584
+ }))
2585
+ } else if ("registerPlugins" === t) d.registerPlugins(e[0]);
2586
+ else {
2587
+ if (d.gioSDKInitialized && d.vdsConfig) return d[t](...e);
2588
+ J("SDK未初始化!", "error")
2589
+ }
2590
+ } else L(a, t) ? J(`方法 ${j(t)} 已被弃用,请移除!`, "warn") : J(`不存在名为 ${j(t)} 的方法调用!`, "error");
2591
+ window[o] = Object.assign(Object.assign({}, window[o]), {
2592
+ _gr_ignore_local_rule: null !== (e = window._gr_ignore_local_rule) && void 0 !== e && e,
2593
+ gioEnvironment: "cdp",
2594
+ gioSDKVersion: d.sdkVersion,
2595
+ gioSDKFull: d.gioSDKFull,
2596
+ canIUse: e => L(r, e) && d[e]
2597
+ })
2598
+ };
2599
+ const l = null === (i = null === window || void 0 === window ? void 0 : window.gdp) || void 0 === i ? void 0 : i.q,
2600
+ c = null === (n = null === window || void 0 === window ? void 0 : window.gdp) || void 0 === n ? void 0 : n.e,
2601
+ h = null === (s = null === window || void 0 === window ? void 0 : window.gdp) || void 0 === s ? void 0 : s.ef;
2602
+ window.gdp = li, window.gdp.e = c, window.gdp.ef = h, N(l) && !$(l) && l.forEach((e => {
2603
+ li.apply(null, e)
2604
+ }))
2605
+ }(), li
2606
+ }));