@jctrans-materials/shared 1.0.37-beta.6 → 1.0.37-beta.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,1331 @@
1
+ var Te = function(i, t) {
2
+ return Te = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
3
+ e.__proto__ = n;
4
+ } || function(e, n) {
5
+ for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
6
+ }, Te(i, t);
7
+ }, f = function() {
8
+ return f = Object.assign || function(i) {
9
+ for (var t, e = 1, n = arguments.length; n > e; e++) for (var r in t = arguments[e]) ({}).hasOwnProperty.call(t, r) && (i[r] = t[r]);
10
+ return i;
11
+ }, f.apply(this, arguments);
12
+ };
13
+ function fe(i, t, e, n) {
14
+ return new (e || (e = Promise))(function(r, o) {
15
+ function a(d) {
16
+ try {
17
+ c(n.next(d));
18
+ } catch (u) {
19
+ o(u);
20
+ }
21
+ }
22
+ function s(d) {
23
+ try {
24
+ c(n.throw(d));
25
+ } catch (u) {
26
+ o(u);
27
+ }
28
+ }
29
+ function c(d) {
30
+ var u;
31
+ d.done ? r(d.value) : (u = d.value, u instanceof e ? u : new e(function(g) {
32
+ g(u);
33
+ })).then(a, s);
34
+ }
35
+ c((n = n.apply(i, [])).next());
36
+ });
37
+ }
38
+ function ve(i, t) {
39
+ var e, n, r, o = { label: 0, sent: function() {
40
+ if (1 & r[0]) throw r[1];
41
+ return r[1];
42
+ }, trys: [], ops: [] }, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
43
+ return a.next = s(0), a.throw = s(1), a.return = s(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() {
44
+ return this;
45
+ }), a;
46
+ function s(c) {
47
+ return function(d) {
48
+ return (function(u) {
49
+ if (e) throw new TypeError("Generator is already executing.");
50
+ for (; a && (a = 0, u[0] && (o = 0)), o; ) try {
51
+ if (e = 1, n && (r = 2 & u[0] ? n.return : u[0] ? n.throw || ((r = n.return) && r.call(n), 0) : n.next) && !(r = r.call(n, u[1])).done) return r;
52
+ switch (n = 0, r && (u = [2 & u[0], r.value]), u[0]) {
53
+ case 0:
54
+ case 1:
55
+ r = u;
56
+ break;
57
+ case 4:
58
+ return o.label++, { value: u[1], done: !1 };
59
+ case 5:
60
+ o.label++, n = u[1], u = [0];
61
+ continue;
62
+ case 7:
63
+ u = o.ops.pop(), o.trys.pop();
64
+ continue;
65
+ default:
66
+ if (!((r = (r = o.trys).length > 0 && r[r.length - 1]) || u[0] !== 6 && u[0] !== 2)) {
67
+ o = 0;
68
+ continue;
69
+ }
70
+ if (u[0] === 3 && (!r || u[1] > r[0] && u[1] < r[3])) {
71
+ o.label = u[1];
72
+ break;
73
+ }
74
+ if (u[0] === 6 && o.label < r[1]) {
75
+ o.label = r[1], r = u;
76
+ break;
77
+ }
78
+ if (r && o.label < r[2]) {
79
+ o.label = r[2], o.ops.push(u);
80
+ break;
81
+ }
82
+ r[2] && o.ops.pop(), o.trys.pop();
83
+ continue;
84
+ }
85
+ u = t.call(i, o);
86
+ } catch (g) {
87
+ u = [6, g], n = 0;
88
+ } finally {
89
+ e = r = 0;
90
+ }
91
+ if (5 & u[0]) throw u[1];
92
+ return { value: u[0] ? u[1] : void 0, done: !0 };
93
+ })([c, d]);
94
+ };
95
+ }
96
+ }
97
+ function q(i, t, e) {
98
+ if (e || arguments.length === 2) for (var n, r = 0, o = t.length; o > r; r++) !n && r in t || (n || (n = [].slice.call(t, 0, r)), n[r] = t[r]);
99
+ return i.concat(n || [].slice.call(t));
100
+ }
101
+ var Fe, je, Ge, Me, Se = /^(\.ac\.|\.br\.|\.co\.|\.com\.|\.edu\.|\.gov\.|\.org\.|\.net\.)/, yt = /^[a-zA-Z][a-zA-Z0-9_]{0,99}$/, St = /.+_gdp_session_id_.{36}/;
102
+ function Ot(i) {
103
+ return i && i.__esModule && {}.hasOwnProperty.call(i, "default") ? i.default : i;
104
+ }
105
+ var ne, He, Be, _t = Me ? Ge : (Me = 1, Ge = typeof Array.from == "function" ? Array.from : (je || (je = 1, ne = function(i) {
106
+ return typeof i == "function";
107
+ }, He = function(i) {
108
+ var t = (function(e) {
109
+ var n = Number(e);
110
+ return isNaN(n) ? 0 : n !== 0 && isFinite(n) ? (n > 0 ? 1 : -1) * Math.floor(Math.abs(n)) : n;
111
+ })(i);
112
+ return Math.min(Math.max(t, 0), 9007199254740991);
113
+ }, Be = function(i) {
114
+ var t = i.next();
115
+ return !t.done && t;
116
+ }, Fe = function(i) {
117
+ var t, e, n, r = this, o = arguments.length > 1 ? arguments[1] : void 0;
118
+ if (o !== void 0) {
119
+ if (!ne(o)) throw new TypeError("Array.from: when provided, the second argument must be a function");
120
+ arguments.length > 2 && (t = arguments[2]);
121
+ }
122
+ var a = (function(h, S) {
123
+ if (h != null && S != null) {
124
+ var p = h[S];
125
+ if (p == null) return;
126
+ if (!ne(p)) throw new TypeError(p + " is not a function");
127
+ return p;
128
+ }
129
+ })(i, (function(h) {
130
+ if (h != null) {
131
+ if (["string", "number", "boolean", "symbol"].indexOf(typeof h) > -1 || typeof Symbol < "u" && "iterator" in Symbol && Symbol.iterator in h) return Symbol.iterator;
132
+ if ("@@iterator" in h) return "@@iterator";
133
+ }
134
+ })(i));
135
+ if (a !== void 0) {
136
+ e = ne(r) ? Object(new r()) : [];
137
+ var s, c, d = a.call(i);
138
+ if (d == null) throw new TypeError("Array.from requires an array-like or iterable object");
139
+ for (n = 0; ; ) {
140
+ if (!(s = Be(d))) return e.length = n, e;
141
+ c = s.value, e[n] = o ? o.call(t, c, n) : c, n++;
142
+ }
143
+ } else {
144
+ var u = Object(i);
145
+ if (i == null) throw new TypeError("Array.from requires an array-like object - not null or undefined");
146
+ var g, l = He(u.length);
147
+ for (e = ne(r) ? Object(new r(l)) : Array(l), n = 0; l > n; ) g = u[n], e[n] = o ? o.call(t, g, n) : g, n++;
148
+ e.length = l;
149
+ }
150
+ return e;
151
+ }), Fe)), D = function(i) {
152
+ return _(["undefined", "null"], P(i));
153
+ }, K = function(i) {
154
+ return P(i) === "string";
155
+ }, Q = function(i) {
156
+ return P(i) === "number";
157
+ }, oe = function(i) {
158
+ return T(Number(i)) === "NaN";
159
+ }, k = function(i) {
160
+ return P(i) === "object" && !D(i);
161
+ }, et = function(i) {
162
+ return P(i) === "regexp";
163
+ }, A = function(i) {
164
+ return _(["function", "asyncfunction"], P(i));
165
+ }, N = function(i) {
166
+ return Array.isArray(i) && P(i) === "array";
167
+ }, Ce = function(i) {
168
+ return P(i) === "date";
169
+ }, pe = function(i) {
170
+ try {
171
+ return se(i)[0];
172
+ } catch {
173
+ return;
174
+ }
175
+ }, he = function(i) {
176
+ try {
177
+ var t = se(i);
178
+ return t[t.length - 1];
179
+ } catch {
180
+ return;
181
+ }
182
+ }, Ie = function(i, t) {
183
+ return t === void 0 && (t = 1), N(i) && Q(t) ? i.slice(t > 0 ? t : 1, i.length) : i;
184
+ }, tt = function(i, t) {
185
+ if (t === void 0 && (t = !1), N(i)) {
186
+ for (var e = 0, n = [], r = 0, o = i; r < o.length; r++) {
187
+ var a = o[r];
188
+ a && !y(a) && (n[e++] = a), t && a === 0 && (n[e++] = a);
189
+ }
190
+ return n;
191
+ }
192
+ return i;
193
+ }, rt = function(i, t) {
194
+ return i[De(i, t)];
195
+ }, De = function(i, t) {
196
+ var e = -1;
197
+ return N(i) && i.every(function(n, r) {
198
+ return !t(n) || (e = r, !1);
199
+ }), e;
200
+ }, _ = function(i, t) {
201
+ return (P(i) === "array" || P(i) === "string") && (P(t) === "array" ? t.some(function(e) {
202
+ return i.indexOf(e) >= 0;
203
+ }) : i.indexOf(t) >= 0);
204
+ }, se = Ot(_t), T = function(i) {
205
+ return D(i) ? "" : "".concat(i);
206
+ }, Pe = function(i, t) {
207
+ return typeof i == "string" ? i.split(t) : i;
208
+ }, nt = function(i) {
209
+ if (K(i)) {
210
+ var t = Pe(i, "");
211
+ return "".concat(pe(t).toLowerCase()).concat(Ie(t).join(""));
212
+ }
213
+ return i;
214
+ }, ae = function(i, t) {
215
+ return !!K(i) && i.slice(0, t.length) === t;
216
+ }, me = function(i, t) {
217
+ if (K(i)) {
218
+ var e = i.length, n = e;
219
+ n > e && (n = e);
220
+ var r = n;
221
+ return (n -= t.length) >= 0 && i.slice(n, r) === t;
222
+ }
223
+ return !1;
224
+ }, bt = {}.hasOwnProperty, ee = function(i, t) {
225
+ return !D(i) && bt.call(i, t);
226
+ }, C = function(i) {
227
+ return k(i) ? Object.keys(i) : [];
228
+ }, J = function(i, t) {
229
+ C(i).forEach(function(e) {
230
+ return t(i[e], e);
231
+ });
232
+ }, it = function(i, t) {
233
+ var e = C(i);
234
+ return !(!k(i) || !k(t) || e.length !== C(t).length || _(e.map(function(n) {
235
+ return k(i[n]) ? it(i[n], t[n]) : i[n] === t[n];
236
+ }), !1));
237
+ }, E = function(i, t) {
238
+ if (!k(i)) return !1;
239
+ try {
240
+ return P(t) === "string" ? delete i[t] : P(t) === "array" ? t.map(function(e) {
241
+ return delete i[e];
242
+ }) : (et(t) && C(i).forEach(function(e) {
243
+ t.test(e) && E(i, e);
244
+ }), !0);
245
+ } catch {
246
+ return !1;
247
+ }
248
+ }, y = function(i) {
249
+ return N(i) ? i.length === 0 : k(i) ? C(i).length === 0 : !i;
250
+ }, P = function(i) {
251
+ return {}.toString.call(i).slice(8, -1).toLowerCase();
252
+ }, ot = function(i) {
253
+ if (Ce(i)) {
254
+ var t = function(e) {
255
+ return 10 > e ? "0" + e : e;
256
+ };
257
+ return i.getFullYear() + "-" + t(i.getMonth() + 1) + "-" + t(i.getDate()) + " " + t(i.getHours()) + ":" + t(i.getMinutes()) + ":" + t(i.getSeconds()) + "." + t(i.getMilliseconds());
258
+ }
259
+ return i;
260
+ }, kt = Object.freeze({ __proto__: null, arrayFrom: se, compact: tt, drop: Ie, dropWhile: function(i, t) {
261
+ return N(i) ? i.filter(function(e) {
262
+ return !t(e);
263
+ }) : i;
264
+ }, endsWith: me, find: rt, findIndex: De, fixed: function(i, t) {
265
+ return Q(i) ? Number(i.toFixed(Q(t) ? t : 2)) : K(i) && T(Number(i)) !== "NaN" ? Number(Number(i).toFixed(Q(t) ? t : 2)) : i;
266
+ }, forEach: J, formatDate: ot, get: function(i, t, e) {
267
+ var n = i;
268
+ return k(i) ? (t.split(".").forEach(function(r) {
269
+ n = n ? n[r] : e;
270
+ }), n) : e;
271
+ }, has: ee, head: pe, includes: _, isArray: N, isBoolean: function(i) {
272
+ return P(i) === "boolean";
273
+ }, isDate: Ce, isEmpty: y, isEqual: it, isFunction: A, isNaN: oe, isNil: D, isNumber: Q, isObject: k, isRegExp: et, isString: K, keys: C, last: he, lowerFirst: nt, split: Pe, startsWith: ae, toString: T, typeOf: P, unset: E, upperFirst: function(i) {
274
+ if (K(i)) {
275
+ var t = Pe(i, "");
276
+ return "".concat(pe(t).toUpperCase()).concat(Ie(t).join(""));
277
+ }
278
+ return i;
279
+ } }), Y = function() {
280
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(i) {
281
+ var t = 16 * Math.random() | 0;
282
+ return (i === "x" ? t : 3 & t | 8).toString(16);
283
+ });
284
+ }, I = function(i, t) {
285
+ console.log("%c [GrowingIO]:".concat(i), { info: "color: #3B82F6;", error: "color: #EF4444;", warn: "color: #F59E0B;", success: "color: #10B981;" }[t] || "");
286
+ }, x = function(i) {
287
+ for (var t = [], e = 1; arguments.length > e; e++) t[e - 1] = arguments[e];
288
+ try {
289
+ return i.apply(void 0, t);
290
+ } catch {
291
+ return;
292
+ }
293
+ }, O = function(i) {
294
+ for (var t = [], e = 1; arguments.length > e; e++) t[e - 1] = arguments[e];
295
+ if (A(i)) try {
296
+ i.apply(void 0, t);
297
+ } catch (n) {
298
+ I("回调执行失败!".concat(n), "error");
299
+ }
300
+ }, at = function(i, t) {
301
+ return !(y(i) || D(i) || !i.name || !A(i.method)) || (I("插件不合法,跳过加载! ".concat(Q(t) ? "index" + t : ""), "warn"), !1);
302
+ }, st = function() {
303
+ var i, t = !!(!((i = window?.navigator) === null || i === void 0) && i.sendBeacon), e = window.navigator.userAgent;
304
+ if (e.match(/(iPad|iPhone|iPod)/g)) {
305
+ var n = ut(e);
306
+ return t && n > 13;
307
+ }
308
+ return t;
309
+ }, ut = function(i) {
310
+ var t = i.toLowerCase().match(/cpu.*os (.*?) like mac os/i);
311
+ return !t || 2 > t.length ? 0 : +t[1].split("_").slice(0, 2).join(".");
312
+ }, ct = function() {
313
+ var i = window.navigator.userAgent;
314
+ return /(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(i) && !/chrome\/(\d+\.\d+)/i.test(i);
315
+ }, gt = function() {
316
+ return /bot|crawler|spider|scrapy|jiankongbao|slurp|transcoder|networkbench/i.test(navigator.userAgent.toLowerCase());
317
+ }, dt = function() {
318
+ return typeof Promise < "u" && Promise.toString().indexOf("[native code]") !== -1;
319
+ }, j = function(i, t, e) {
320
+ return t === void 0 && (t = !0), e === void 0 && (e = "参数不合法"), I("".concat(t ? "调用" : "设置", " ").concat(i, " 失败,").concat(e, "!"), "warn");
321
+ }, Ee = function(i, t, e, n) {
322
+ n === void 0 && (n = {}), document.addEventListener ? i.addEventListener(t, e, f(f({}, { capture: !0 }), n)) : i.attachEvent ? i.attachEvent("on" + t, e) : i["on" + t] = e;
323
+ }, V = function(i) {
324
+ return me(i, "_gioenc") ? i.slice(0, -7) : i;
325
+ }, we = function(i) {
326
+ return isNaN(Number(i)) && x(function() {
327
+ return JSON.parse(i);
328
+ }) || i;
329
+ }, B = function(i) {
330
+ var t = {};
331
+ return k(i) && (E(i, "&&sendTo"), J(i, function(e, n) {
332
+ var r = T(n).slice(0, 100);
333
+ k(e) ? t[r] = B(e) : N(e) ? (t[r] = tt(e.slice(0, 100), !0), t[r] = t[r].join("||").slice(0, 1e3)) : Ce(e) ? t[r] = ot(e) : t[r] = D(e) ? "" : T(e).slice(0, 1e3);
334
+ })), t;
335
+ }, te = function(i) {
336
+ return D(i) || C(i).forEach(function(t) {
337
+ A(i[t]) ? i[t] = x(function() {
338
+ return i[t]();
339
+ }) : k(i[t]) ? E(i, t) : N(i[t]) || (i[t] = T(i[t]));
340
+ }), i;
341
+ }, Oe = function() {
342
+ var i, t = window._gio_local_vds || "vds";
343
+ return (i = window[t]) !== null && i !== void 0 ? i : {};
344
+ }, Tt = Object.freeze({ __proto__: null, addListener: Ee, callError: j, checkPluginItem: at, compareVersion: function(i, t) {
345
+ for (var e = function(g) {
346
+ return g.replace(/\s+/g, "");
347
+ }, n = function(g) {
348
+ return g.replace(/[vV]/g, "");
349
+ }, r = e(n(i)), o = e(n(t)), a = r.split("."), s = o.split("."), c = 0; 3 > c; c++) {
350
+ var d = Number(a[c]), u = Number(s[c]);
351
+ if (d > u) return 1;
352
+ if (u > d) return -1;
353
+ if (!isNaN(d) && isNaN(u)) return 1;
354
+ if (isNaN(d) && !isNaN(u)) return -1;
355
+ }
356
+ return 0;
357
+ }, consoleText: I, flattenObject: function(i) {
358
+ i === void 0 && (i = {});
359
+ var t = f({}, i);
360
+ return C(t).forEach(function(e) {
361
+ k(t[e]) ? (C(t[e]).forEach(function(n) {
362
+ t["".concat(e, "_").concat(n)] = T(t[e][n]);
363
+ }), E(t, e)) : N(t[e]) ? (t[e].forEach(function(n, r) {
364
+ k(n) ? C(n).forEach(function(o) {
365
+ t["".concat(e, "_").concat(r, "_").concat(o)] = T(n[o]);
366
+ }) : t["".concat(e, "_").concat(r)] = T(n);
367
+ }), E(t, e)) : D(t[e]) || t[e] === "" ? E(t, e) : t[e] = T(t[e]);
368
+ }), B(t);
369
+ }, getActualKey: V, getDynamicAttributes: te, getGioFunction: function() {
370
+ var i, t, e, n, r = (t = (i = Oe()) === null || i === void 0 ? void 0 : i.namespace) !== null && t !== void 0 ? t : "gdp";
371
+ return A(window[r]) ? window[r] : (n = (e = window.gdp) !== null && e !== void 0 ? e : window.gio) !== null && n !== void 0 ? n : function() {
372
+ };
373
+ }, getIOSVersion: ut, getMainTrackingId: function() {
374
+ var i;
375
+ return (i = Oe().trackingId) !== null && i !== void 0 ? i : "g0";
376
+ }, getVds: Oe, guid: Y, hashCode: function(i, t) {
377
+ t === void 0 && (t = !1);
378
+ var e = 0;
379
+ if (y(i) || typeof i == "boolean") return e;
380
+ for (var n = 0; n < i.length; ) e = (e << 5) - e + i.charCodeAt(n), e &= e, n++;
381
+ return t ? Math.abs(e) : e;
382
+ }, isBot: gt, isPromiseSupported: dt, isSafari: ct, limitObject: B, niceCallback: O, niceTry: x, parseStorageValue: we, queryParse: function(i) {
383
+ if (ae(i, "?") || _(i, ["=", "&"])) {
384
+ var t = {}, e = [];
385
+ return ae(i, "?") && (i = i.substring(1)), i.split("&").forEach(function(n) {
386
+ var r, o = n.split("="), a = o[0], s = (r = o[1]) !== null && r !== void 0 ? r : "";
387
+ D(a) || a === "" || (t[a] = s, e.push(a));
388
+ }), f(f({}, t), { __GIO_ORDER__: e });
389
+ }
390
+ return decodeURIComponent(i);
391
+ }, queryStringify: function(i, t) {
392
+ if (t === void 0 && (t = !1), P(i) === "object") {
393
+ var e = "";
394
+ return (i.__GIO_ORDER__ || C(i)).forEach(function(n) {
395
+ n !== "__GIO_ORDER__" && ee(i, n) && (e === "" ? e = (t ? "?" : "") + "".concat(n, "=").concat(i[n]) : e += "&".concat(n, "=").concat(i[n]));
396
+ }), e;
397
+ }
398
+ if (P(i) === "string") return encodeURIComponent(i);
399
+ }, supportBeacon: st }), ze = function(i) {
400
+ return K(i) && i.length > 0 || Q(i) && i > 0;
401
+ }, We = function(i, t) {
402
+ return K(i) && !y(i) && i.match(yt) ? t() : (I("事件名格式不正确,只能包含数字、字母和下划线,且不能以数字开头,字符总长度不能超过100!", "error"), !1);
403
+ }, Pt = ["web", "wxwv", "Android", "iOS", "minp", "alip", "baidup", "qq", "bytedance", "kuaishoup", "jdp"], Et = { gsid: "_gdp_sequence_ids", originalSource: "_gdp_original_source", sentSign: "_gdp_session_id_sent", sessionId: "_gdp_session_id", userId: "_gdp_cs1_gioenc", userKey: "_gdp_user_key_gioenc", gioId: "_gdp_gio_id_gioenc", gqs: "_gdp_query_string_gioenc", abts: "_gdp_abt_sid" }, ge = { autotrack: { type: "boolean", default: !0 }, appId: { type: "string", default: "" }, compress: { type: "boolean", default: !0 }, cookieDomain: { type: "string", default: "" }, dataCollect: { type: "boolean", default: !0 }, debug: { type: "boolean", default: !1 }, embeddedIgnore: { type: "array", default: [] }, embeddedAdapter: { type: "object", default: { circleServerUrl: "" } }, extraUA: { type: "boolean", default: !0 }, forceLogin: { type: "boolean", default: !1 }, idMapping: { type: "boolean", default: !1 }, enableIdMapping: { type: "boolean", default: !1 }, gtouchHost: { type: "string", default: "" }, hashtag: { type: "boolean", default: !1 }, ignoreFields: { type: "array", default: [] }, impressionScale: { type: "number", default: 0 }, originalSource: { type: "boolean", default: !0 }, packageName: { type: "string", default: "" }, penetrateHybrid: { type: "boolean", default: !0 }, performance: { type: "object", default: { monitor: !0, exception: !0 } }, platform: { type: "string", default: "web" }, requestTimeout: { type: "number", default: 5e3 }, rewriteQuery: { type: "boolean", default: !0 }, sendType: { type: "string", default: "beacon" }, serverUrl: { type: "string", default: "https://napi.growingio.com" }, sessionExpires: { type: "number", default: 30 }, storageType: { type: "string", default: "cookie" }, touch: { type: "boolean", default: !1 }, trackBot: { type: "boolean", default: !0 }, trackPage: { type: "boolean", default: !0 }, version: { type: "string", default: "1.0.0" } }, lt = ["clearGeneralProps", "clearPageAttributes", "clearTrackTimer", "clearUserId", "getABTest", "getOption", "identify", "removeTimer", "sendPage", "sendVisit", "setBeforeSendListener", "setGeneralProps", "setOption", "setPageAttributes", "setPageListener", "setUserAttributes", "setUserId", "track", "trackTimerEnd", "trackTimerPause", "trackTimerResume", "trackTimerStart"], Qe = q(q(["init", "registerPlugins"], ["getPlugins", "getDeviceId", "getUserAgent", "updateImpression"], !0), lt, !0), Ue = { autotrack: "无埋点采集", dataCollect: "数据采集", dataSourceId: "数据源ID", debug: "调试模式", extraUA: "增强用户代理", forceLogin: "强制登录", hashtag: "哈希解析", serverUrl: "数据上报服务地址" }, Ut = ["collectImp", "enableDebug", "enableHT", "getVisitorId", "send", "setAutotrack", "setConfig", "setDataCollect", "setPlatformProfile", "setTrackerHost", "setTrackerScheme"], xt = ["screenHeight", "screenWidth"];
404
+ function ue(i) {
405
+ for (var t = 1; arguments.length > t; t++) {
406
+ var e = arguments[t];
407
+ for (var n in e) i[n] = e[n];
408
+ }
409
+ return i;
410
+ }
411
+ var de, W = (function i(t, e) {
412
+ function n(r, o, a) {
413
+ if (typeof document < "u") {
414
+ typeof (a = ue({}, e, a)).expires == "number" && (a.expires = new Date(Date.now() + 864e5 * a.expires)), a.expires && (a.expires = a.expires.toUTCString()), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
415
+ var s = "";
416
+ for (var c in a) a[c] && (s += "; " + c, a[c] !== !0 && (s += "=" + a[c].split(";")[0]));
417
+ return document.cookie = r + "=" + t.write(o, r) + s;
418
+ }
419
+ }
420
+ return Object.create({ set: n, get: function(r) {
421
+ if (typeof document < "u" && (!arguments.length || r)) {
422
+ for (var o = document.cookie ? document.cookie.split("; ") : [], a = {}, s = 0; s < o.length; s++) {
423
+ var c = o[s].split("="), d = c.slice(1).join("=");
424
+ try {
425
+ var u = decodeURIComponent(c[0]);
426
+ if (a[u] = t.read(d, u), r === u) break;
427
+ } catch {
428
+ }
429
+ }
430
+ return r ? a[r] : a;
431
+ }
432
+ }, remove: function(r, o) {
433
+ n(r, "", ue({}, o, { expires: -1 }));
434
+ }, withAttributes: function(r) {
435
+ return i(this.converter, ue({}, this.attributes, r));
436
+ }, withConverter: function(r) {
437
+ return i(ue({}, this.converter, r), this.attributes);
438
+ } }, { attributes: { value: Object.freeze(e) }, converter: { value: Object.freeze(t) } });
439
+ })({ read: function(i) {
440
+ return i[0] === '"' && (i = i.slice(1, -1)), i.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
441
+ }, write: function(i) {
442
+ return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
443
+ } }, { path: "/" }), At = { A: 1, a: 1, Z: 1, z: 1, "@": 1, "{": 1 }, Ke = function(i) {
444
+ return D(i) ? i : x(function() {
445
+ return "gioenc-".concat(ft(i));
446
+ }) || i;
447
+ }, Ne = function(i) {
448
+ return K(i) && ae(i, "gioenc-") && x(function() {
449
+ return ft(i.replace("gioenc-", ""));
450
+ }) || i;
451
+ }, ft = function(i) {
452
+ return (i = i || "").split("").map(function(t) {
453
+ return At[t] ? t : Ct(t);
454
+ }).join("");
455
+ }, Ct = function(i) {
456
+ if (/[0-9]/.test(i)) return 1 ^ +i;
457
+ var t = i.charCodeAt(0);
458
+ return String.fromCharCode(1 ^ t);
459
+ }, Je = function(i) {
460
+ var t = this;
461
+ this.domain = i, this.getItem = function(e) {
462
+ return we(Ne(W.get(V(e), { domain: t.domain, path: "/" })));
463
+ }, this.setItem = function(e, n, r) {
464
+ var o;
465
+ o = K(n) ? n.length ? me(e, "_gioenc") ? Ke(n) : n : "" : JSON.stringify(n), W.set(V(e), o, { expires: new Date(r || new Date((/* @__PURE__ */ new Date()).toDateString()).getTime() + 3456e7), domain: t.domain, path: "/" });
466
+ }, this.removeItem = function(e) {
467
+ W.remove(V(e), { domain: t.domain, path: "/" });
468
+ }, this.hasItem = function(e) {
469
+ return _(C(W.get()), V(e));
470
+ }, this.getKeys = function() {
471
+ return C(W.get());
472
+ }, this.type = "Cookie";
473
+ }, Dt = function() {
474
+ this.getItem = function(i) {
475
+ var t = x(function() {
476
+ return JSON.parse(localStorage.getItem(V(i)) || "");
477
+ }) || {};
478
+ return k(t) && t.expiredAt > +Date.now() ? we(Ne(t.value)) : void 0;
479
+ }, this.setItem = function(i, t, e) {
480
+ var n = e ?? +new Date((/* @__PURE__ */ new Date()).getFullYear() + 3, (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDay()).getTime();
481
+ localStorage.setItem(V(i), JSON.stringify({ value: K(t) && t.length && me(i, "_gioenc") ? Ke(t) : t, expiredAt: n }));
482
+ }, this.removeItem = function(i) {
483
+ return localStorage.removeItem(V(i));
484
+ }, this.hasItem = function(i) {
485
+ return !!localStorage.getItem(V(i));
486
+ }, this.getKeys = function() {
487
+ return se(Array(localStorage.length)).map(function(i, t) {
488
+ return localStorage.key(t);
489
+ });
490
+ }, this.type = "localStorage";
491
+ }, ie = {}, Kt = function() {
492
+ this.getItem = function(i) {
493
+ var t = x(function() {
494
+ return JSON.parse(ie[V(i)] || "");
495
+ });
496
+ return k(t) && t.expiredAt > +Date.now() ? we(Ne(t.value)) : void 0;
497
+ }, this.setItem = function(i, t, e) {
498
+ var n = e ?? +new Date((/* @__PURE__ */ new Date()).getFullYear() + 3, (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDay()).getTime();
499
+ ie[V(i)] = JSON.stringify({ value: K(t) && t.length ? Ke(t) : t, expiredAt: n });
500
+ }, this.removeItem = function(i) {
501
+ return E(ie, V(i));
502
+ }, this.hasItem = function(i) {
503
+ return ee(ie, V(i));
504
+ }, this.getKeys = function() {
505
+ return C(ie);
506
+ }, this.type = "memory";
507
+ }, _e = function(i) {
508
+ var t = [];
509
+ try {
510
+ var e = i.split("."), n = he(e);
511
+ if (e.length >= 2 && (isNaN(Number(n)) || 0 > Number(n) || Number(n) > 255)) {
512
+ var r = ".".concat(e.slice(-2).join("."));
513
+ Se.test(r) ? de = r : t.push(r);
514
+ var o = ".".concat(e.slice(-3).join("."));
515
+ Se.test(o) || _(t, o) || t.push(o);
516
+ var a = ".".concat(e.slice(-4).join("."));
517
+ Se.test(a) || _(t, a) || t.push(a);
518
+ }
519
+ } catch (s) {
520
+ I(s, "error");
521
+ }
522
+ return t;
523
+ }, Xe = function(i) {
524
+ var t = "";
525
+ return i.some(function(e) {
526
+ return !!le(e) && (t = e, !0);
527
+ }), t;
528
+ }, le = function(i) {
529
+ try {
530
+ W.set("gioCookie", "yes", { domain: i });
531
+ var t = !!W.get("gioCookie", { domain: i });
532
+ return W.remove("gioCookie", { domain: i }), t;
533
+ } catch {
534
+ return !1;
535
+ }
536
+ }, Nt = function(i) {
537
+ var t, e, n, r = i.storageType, o = i.cookieDomain, a = i.projectId;
538
+ if (_(["cookie", "localstorage"], r) || (r = "cookie"), r === "cookie" && (e = !!(n = navigator.userAgent.indexOf("Electron") > -1 || _(["", "localhost", "127.0.0.1"], window.location.hostname) || !_(["http:", "https:"], window.location.protocol) ? "" : Xe(q(q([], _e(window.location.hostname), !0), [window.location.hostname], !1)))), r === "cookie" && e) {
539
+ var s = new Je(n);
540
+ if (o) {
541
+ var c = _e(o), d = Xe(y(c) ? [] : q([o], _e(o), !0));
542
+ d && le(d) ? s.domain = d : I("指定Cookie域无效或无权限,使用默认域!", "warn");
543
+ }
544
+ t = s;
545
+ } else t = (function() {
546
+ try {
547
+ var u = window.localStorage, g = "__storage_test__";
548
+ return u.setItem(g, g), u.removeItem(g), !0;
549
+ } catch {
550
+ return !1;
551
+ }
552
+ })() ? new Dt() : new Kt();
553
+ return r === "cookie" && de && le(de) && (function(u, g, l) {
554
+ if (g && le(g)) {
555
+ var h = new Je(g);
556
+ ["".concat(l, "_gdp_session_id"), "gdp_user_id_gioenc", "".concat(l, "_gdp_cs1_gioenc"), "".concat(l, "_gdp_user_key_gioenc"), "".concat(l, "_gdp_gio_id_gioenc"), "".concat(l, "_gdp_sequence_ids"), "".concat(l, "_gdp_session_id_sent")].forEach(function(S) {
557
+ var p = h.getItem(S);
558
+ h.hasItem(S) && (u.setItem(S, p), h.removeItem(S));
559
+ }), h = void 0;
560
+ }
561
+ })(t, de, a), t;
562
+ }, vt = "ON_COMMIT_REQUEST", pt = "ON_COMPOSE_AFTER", Ye = "ON_ERROR", Ze = "ON_INSTALL", qe = "ON_SEND_AFTER", xe = "ON_SEND_BEFORE", $e = "OPTION_CHANGE", Ve = "OPTION_INITIALIZED", ht = "SDK_INITIALIZED", It = "SESSIONID_UPDATE";
563
+ function qt(i) {
564
+ return fe(this, void 0, void 0, function() {
565
+ var t, e, n, r, o, a, s, c;
566
+ return ve(this, function(d) {
567
+ return t = function(u) {
568
+ var g = "";
569
+ return u.bitness === "64" ? u.architecture === "x86" ? g = "x86_64" : u.architecture === "arm" && (g = "aarch64") : u.architecture === "arm" && u.bitness === "32" && (g = "armv7l"), g === "" ? "X11; CrOS ".concat(u.platformVersion) : "X11; CrOS ".concat(g, " ").concat(u.platformVersion);
570
+ }, e = function(u) {
571
+ var g, l, h = "";
572
+ return u.architecture === "x86" && u.bitness === "64" ? h = "; Win64; x64" : u.architecture === "arm" ? h = "; ARM" : u.wow64 === !0 && (h = "; WOW64"), "Windows NT ".concat((g = u.platformVersion || "10.0", l = /* @__PURE__ */ new Map([["0.3.0", "6.3"], ["0.2.0", "6.2"], ["0.1.0", "6.1"]]), l.has(g) ? l.get(g) : typeof navigator < "u" && navigator.userAgentData && navigator.userAgentData.platform === "Windows" && parseInt(g.split(".")[0], 10) >= 13 ? "13.0" : "10.0")).concat(h);
573
+ }, n = function(u) {
574
+ var g = "Macintosh; Intel Mac OS X ", l = u.platformVersion || "10_15_7";
575
+ return l.indexOf(".") > -1 && (l = l.split(".").join("_")), g + l;
576
+ }, r = function(u) {
577
+ var g = "Linux; Android ";
578
+ return g += u.platformVersion, u.model && (g += "; ", g += u.model), g;
579
+ }, o = function(u) {
580
+ return u.architecture || (u.architecture = "x86"), u.bitness || (u.bitness = "64"), u.model || (u.model = ""), u.platform || (u.platform = "Windows"), u.platformVersion || (u.platformVersion = "10.0"), u.wow64 || (u.wow64 = !1), u;
581
+ }, navigator.userAgentData ? (a = !1, c = RegExp("AppleWebKit/537.36 \\(KHTML, like Gecko\\) Chrome/\\d+.\\d+.\\d+.\\d+ (Mobile )?Safari/537.36"), navigator.userAgentData.brands.forEach(function(u) {
582
+ u.brand === "Chromium" && (a = c.test(navigator.userAgent), s = u.version);
583
+ }), a && s && parseInt(s, 10) >= 100 ? [2, new Promise(function(u) {
584
+ var g;
585
+ (g = navigator.userAgentData) === null || g === void 0 || g.getHighEntropyValues(i).then(function(l) {
586
+ var h, S;
587
+ if (l) {
588
+ var p = { platform: (h = navigator.userAgentData) === null || h === void 0 ? void 0 : h.platform, version: s };
589
+ l = Object.assign(p, l), l = o(l);
590
+ var v = "Mozilla/5.0 (", w = navigator.userAgent;
591
+ if (/OpenHarmony/.test(w)) {
592
+ var b = w.match(/\(([^)]*OpenHarmony[^)]*)\)/);
593
+ if (b && b[1]) v += b[1];
594
+ else {
595
+ var m = w.match(/OpenHarmony\s([\d.]+)/), L = m && m[1] || l.platformVersion || "";
596
+ v += "Phone; OpenHarmony ".concat(L).trim();
597
+ }
598
+ } else _(["Chrome OS", "Chromium OS"], l.platform || "") ? v += t(l) : l.platform === "Windows" ? v += e(l) : l.platform === "macOS" ? v += n(l) : l.platform === "Android" ? v += r(l) : v += "X11; Linux x86_64";
599
+ v += ") AppleWebKit/537.36 (KHTML, like Gecko) Chrome/", v += (function(M, H) {
600
+ var F;
601
+ return ((F = M?.find(function(re) {
602
+ return _(["Google Chrome", "Microsoft Edge", "Opera", "Chromium"], re.brand);
603
+ })) === null || F === void 0 ? void 0 : F.version) || "".concat(H, ".0.0.0");
604
+ })(l?.fullVersionList, p.version || "100"), !((S = navigator.userAgentData) === null || S === void 0) && S.mobile && (v += " Mobile"), v += " Safari/537.36";
605
+ var R = w.indexOf("Safari/537.36");
606
+ if (R !== -1) {
607
+ var G = R + 13, U = w.substring(G);
608
+ U && (v += U);
609
+ }
610
+ u(v);
611
+ } else u("");
612
+ });
613
+ })] : [2, Promise.resolve(void 0)]) : [2, Promise.resolve(void 0)];
614
+ });
615
+ });
616
+ }
617
+ var Vt = ["architecture", "bitness", "model", "platformVersion", "fullVersionList", "wow64"], Lt = ["model", "platformVersion", "fullVersionList"];
618
+ function Ae() {
619
+ return !(typeof navigator > "u" || !navigator.userAgentData || typeof navigator.userAgentData.getHighEntropyValues != "function");
620
+ }
621
+ function Rt(i) {
622
+ return fe(this, void 0, void 0, function() {
623
+ var t, e, n;
624
+ return ve(this, function(r) {
625
+ switch (r.label) {
626
+ case 0:
627
+ if (!Ae()) return [2, ""];
628
+ e = ((n = navigator.userAgentData) === null || n === void 0 ? void 0 : n.mobile) || !1, t = e ? Lt : Vt, r.label = 1;
629
+ case 1:
630
+ return r.trys.push([1, 3, , 4]), [4, qt(q([], t, !0))];
631
+ case 2:
632
+ return [2, r.sent() || ""];
633
+ case 3:
634
+ return r.sent(), [2, ""];
635
+ case 4:
636
+ return [2];
637
+ }
638
+ });
639
+ });
640
+ }
641
+ var be, ke, Z, z = (function() {
642
+ function i() {
643
+ }
644
+ return i.isCompatible = function() {
645
+ return !(!dt() || !Ae()) || (i.hasWarnedOnce || (I("当前浏览器/环境不支持获取增强UA", "warn"), i.hasWarnedOnce = !0), i.cachedUserAgent = "", !1);
646
+ }, i.initialize = function() {
647
+ return fe(this, void 0, void 0, function() {
648
+ return ve(this, function(t) {
649
+ return i.initPromise || (i.initPromise = i._doInitialize()), [2, i.initPromise];
650
+ });
651
+ });
652
+ }, i._doInitialize = function() {
653
+ return fe(this, void 0, void 0, function() {
654
+ var t, e, n, r;
655
+ return ve(this, function(o) {
656
+ switch (o.label) {
657
+ case 0:
658
+ return o.trys.push([0, 2, , 3]), t = new Promise(function(a, s) {
659
+ setTimeout(function() {
660
+ return s(Error("UA获取超时"));
661
+ }, i.TIMEOUT);
662
+ }), [4, Promise.race([Rt(), t])];
663
+ case 1:
664
+ return e = o.sent(), i.cachedUserAgent = e || "", [3, 3];
665
+ case 2:
666
+ return n = o.sent(), i.hasWarnedOnce || (r = n instanceof Error ? n.message : "未知错误", I("获取增强UA失败: ".concat(r), "warn"), i.hasWarnedOnce = !0), i.cachedUserAgent = "", [3, 3];
667
+ case 3:
668
+ return [2];
669
+ }
670
+ });
671
+ });
672
+ }, i.getUserAgent = function() {
673
+ return Ae() && i.cachedUserAgent || "";
674
+ }, i.isInitializing = function() {
675
+ return i.initPromise !== null;
676
+ }, i.cachedUserAgent = null, i.initPromise = null, i.hasWarnedOnce = !1, i.TIMEOUT = 1e3, i;
677
+ })(), Ft = function(i) {
678
+ var t = this;
679
+ this.growingIO = i, this.main = function(e, n) {
680
+ var r, o, a;
681
+ n === void 0 && (n = !0), e || (e = t.growingIO.trackingId);
682
+ var s = t.growingIO, c = s.sdkVersion, d = s.useEmbeddedInherit, u = s.userStore, g = s.dataStore, l = g.currentPage, h = l.path, S = l.query, p = l.title, v = l.getReferralPage, w = g.getTrackerVds(e), b = (r = x(function() {
683
+ return g.lastPageEvent[e];
684
+ })) !== null && r !== void 0 ? r : {}, m = { appVersion: w.version, dataSourceId: w.dataSourceId, deviceId: u.getUid(), domain: e === d ? w.appId : window.location.host, language: navigator.language, path: h, platform: w.platform, query: S, referralPage: v(e) || "", screenHeight: window.screen.height, screenWidth: window.screen.width, sdkVersion: c, sessionId: u.getSessionId(e), timestamp: +Date.now(), timezoneOffset: (/* @__PURE__ */ new Date()).getTimezoneOffset(), title: (a = (o = b.title) !== null && o !== void 0 ? o : p) !== null && a !== void 0 ? a : x(function() {
685
+ return document.title.slice(0, 255);
686
+ }), userId: u.getUserId(e) };
687
+ if (w.idMapping ? m.userKey = u.getUserKey(e) : m.userKey = "", n && !y(g.generalProps[e]) && (m.attributes = f({}, g.generalProps[e]), y(m.attributes) || (m.attributes = B(te(f({}, m.attributes))))), n) {
688
+ var L = g.getTrackerVds(t.growingIO.trackingId);
689
+ if (L && L.extraUA !== !1) {
690
+ var R = z.getUserAgent();
691
+ R && R.trim() && (m.attributes || (m.attributes = {}), m.attributes.$userAgent = R);
692
+ }
693
+ }
694
+ return y(w.ignoreFields) || w.ignoreFields.forEach(function(G) {
695
+ E(m, G);
696
+ }), d && e === d && !y(t.minpExtraParams) && J(f(f({}, m), t.minpExtraParams), function(G, U) {
697
+ var M, H;
698
+ _(w.embeddedIgnore, U) ? (m[U] = (M = w?.originValues[U]) !== null && M !== void 0 ? M : m[U], U === "domain" && (m[U] = window.location.host)) : m[U] = (H = t.minpExtraParams[U]) !== null && H !== void 0 ? H : m[U];
699
+ }), m.trackingId = e, m;
700
+ }, this.minpExtraParams = {};
701
+ }, jt = function(i) {
702
+ var t, e = this;
703
+ this.growingIO = i, this.parsePage = function() {
704
+ var n = e.growingIO.vdsConfig.hashtag, r = location.pathname, o = location.search, a = location.hash, s = a.indexOf("?");
705
+ e.domain = window.location.host, e.title = document.title.slice(0, 255), e.time = +Date.now(), e.path = r, e.query = o, n && (s > -1 ? (e.path += a.slice(0, s), e.query = e.query + "&" + a.slice(s + 1)) : e.path += a), e.query && _(["?", "&"], e.query.charAt(0)) && (e.query = e.query.slice(1));
706
+ }, this._getNoHashHref = function() {
707
+ var n = window.location, r = n.protocol, o = n.host, a = n.pathname, s = n.search;
708
+ return "".concat(r, "://").concat(o).concat(a).concat(s);
709
+ }, this.getReferralPage = function(n) {
710
+ var r, o, a = e.growingIO.dataStore.lastPageEvent[n];
711
+ return a?.path === e.path && ((r = a?.query) !== null && r !== void 0 ? r : "") === ((o = e.query) !== null && o !== void 0 ? o : "") ? a?.referralPage : a?.path ? a?.nextRefferer : document.referrer;
712
+ }, this.handlePage = function() {
713
+ var n = e.growingIO, r = n.vdsConfig.hashtag, o = n.dataStore, a = window.location.href, s = e.lastHref;
714
+ r || (a = e._getNoHashHref(), s = e.lastNoHashHref), s !== a && (e.parsePage(), o.initializedTrackingIds.forEach(function(c) {
715
+ o.sendVerifiedPage(c);
716
+ }));
717
+ }, this.hookHistory = function() {
718
+ var n = window.history.pushState, r = window.history.replaceState, o = e;
719
+ n && x(function() {
720
+ return window.history.pushState = function() {
721
+ for (var a = [], s = 0; arguments.length > s; s++) a[s] = arguments[s];
722
+ n.apply(window.history, a), setTimeout(o.handlePage);
723
+ };
724
+ }), r && x(function() {
725
+ return window.history.replaceState = function() {
726
+ for (var a = [], s = 0; arguments.length > s; s++) a[s] = arguments[s];
727
+ r.apply(window.history, a), setTimeout(o.handlePage);
728
+ };
729
+ }), Ee(window, "popstate", e.handlePage), e.growingIO.vdsConfig.hashtag && Ee(window, "hashchange", e.handlePage);
730
+ }, this.eventSetPageProps = function(n, r) {
731
+ var o = x(function() {
732
+ return e.pageProps[n][e.path];
733
+ });
734
+ return y(o) ? r.attributes : B(f(f({}, r.attributes), te(o)));
735
+ }, this.buildPageEvent = function(n, r) {
736
+ var o = e.growingIO.dataStore, a = o.eventContextBuilder, s = o.eventConverter, c = f(f({ eventType: "PAGE" }, a(n)), { title: e.title, protocolType: location.protocol.substring(0, location.protocol.length - 1), referralPage: e.getReferralPage(n), timestamp: e.time });
737
+ !y(r) && r.title && (c.title = r.title), c.attributes = e.eventSetPageProps(n, c), s(c), e.lastHref = window.location.href, e.lastNoHashHref = e._getNoHashHref(), e.lastLocation = f({}, window.location);
738
+ }, this.title = (t = x(function() {
739
+ return document.title.slice(0, 255);
740
+ })) !== null && t !== void 0 ? t : "", this.lastLocation = f({}, window.location), this.pageListeners = {}, this.pageProps = {};
741
+ }, Gt = function(i) {
742
+ var t, e = this;
743
+ this.growingIO = i, this.ALLOW_SETTING_KEYS = Object.keys(ge), this.trackTimers = {}, this.getTrackerVds = function(r) {
744
+ return e.growingIO.trackingId === r ? f({}, e.growingIO.vdsConfig) : void 0;
745
+ }, this.getKeyPrefix = function(r) {
746
+ return e.growingIO.vdsConfig.projectId;
747
+ }, this.getStorageKey = function(r, o) {
748
+ return "".concat(e.getKeyPrefix(r)).concat(Et[o]);
749
+ }, this.getGsid = function(r) {
750
+ var o, a = e.growingIO.storage.getItem(e.getStorageKey(r, "gsid")) || {}, s = Number(a.globalKey);
751
+ return oe(s) || s >= 1e9 || 1 > s ? (o = 1, e.setGsid(r, o)) : o = s, o;
752
+ }, this.setGsid = function(r, o) {
753
+ var a = oe(Number(o)) || o >= 1e9 || 1 > o ? 1 : o;
754
+ e.setSequenceIds(r, a);
755
+ }, this.setSequenceIds = function(r, o) {
756
+ var a = e.getStorageKey(r, "gsid"), s = e.growingIO.storage.getItem(a) || {};
757
+ s.globalKey = o, e.growingIO.storage.setItem(a, s);
758
+ }, this.initTrackerOptions = function(r) {
759
+ var o = e.initOptions(r);
760
+ return o.trackingId = r.trackingId, e.growingIO.trackingId = r.trackingId, e.growingIO.vdsConfig = o, window[e.growingIO.vdsName] = o, o;
761
+ }, this.initOptions = function(r) {
762
+ var o, a, s, c, d, u, g, l = r.projectId, h = r.dataSourceId, S = r.appId, p = {};
763
+ return e.ALLOW_SETTING_KEYS.forEach(function(v) {
764
+ var w = ge[v].type, b = N(w) ? !_(w, P(r[v])) : P(r[v]) !== w;
765
+ v !== "platform" || _(Pt, r[v]) || (b = !0), b ? p[v] = ge[v].default : v === "ignoreFields" ? p.ignoreFields = r.ignoreFields.filter(function(m) {
766
+ return _(xt, m);
767
+ }) : (p[v] = r[v], _(["dataCollect", "autotrack"], v) && !p[v] && I("已关闭".concat(Ue[v]), "info"));
768
+ }), r.host && I("host字段已废弃,指定上报请求地址请使用 serverUrl!", "error"), p.sessionExpires = Math.round(p.sessionExpires), (oe(p.sessionExpires) || 1 > p.sessionExpires || p.sessionExpires > 360) && (p.sessionExpires = 30), p.storageType = p.storageType.toLowerCase(), p.enableIdMapping && !p.idMapping && (p.idMapping = !0), E(p, "enableIdMapping"), p.sendType = p.sendType.toLowerCase(), _(["beacon", "xhr", "image"], p.sendType) || (p.sendType = "beacon"), !p.trackBot && gt() && (p.dataCollect = !1), !oe(Number(p.requestTimeout)) && p.requestTimeout > 0 || (p.requestTimeout = 5e3), (p.impressionScale > 1 || 0 > p.impressionScale) && (p.impressionScale = 0), f(f(f({}, (o = window[e.growingIO.vdsName]) !== null && o !== void 0 ? o : {}), p), { projectId: l, dataSourceId: h, appId: S, performance: { monitor: (s = (a = p.performance) === null || a === void 0 ? void 0 : a.monitor) === null || s === void 0 || s, exception: (d = (c = p.performance) === null || c === void 0 ? void 0 : c.exception) === null || d === void 0 || d, network: (g = (u = p.performance) === null || u === void 0 ? void 0 : u.network) !== null && g !== void 0 && g } });
769
+ }, this.setOriginalSource = function(r) {
770
+ var o = e.growingIO, a = o.storage, s = o.userStore, c = a.getItem(e.getStorageKey(r, "sentSign"));
771
+ if (s.getSessionId(r) !== c && y(e.getOriginalSource(r))) {
772
+ var d = e.currentPage, u = d.path, g = d.query, l = d.getReferralPage, h = { path: u, query: g, referralPage: document.referrer || l(r) };
773
+ localStorage.setItem(e.getStorageKey(r, "originalSource"), JSON.stringify(h));
774
+ }
775
+ }, this.getOriginalSource = function(r) {
776
+ return x(function() {
777
+ return JSON.parse(localStorage.getItem(e.getStorageKey(r, "originalSource")));
778
+ });
779
+ }, this.setOption = function(r, o, a) {
780
+ var s, c = e.growingIO, d = c.emitter, u = c.userStore, g = e.getTrackerVds(r), l = f({}, g);
781
+ e.updateVdsConfig(r, f(f({}, g), ((s = {})[o] = a, s))), o === "dataCollect" && l.dataCollect !== a && (a ? u.setSessionId(r, Y()) : e.growingIO.clearTrackTimer(r)), d?.emit($e, { trackingId: r, optionName: o, optionValue: a });
782
+ }, this.getOption = function(r, o) {
783
+ var a = e.getTrackerVds(r);
784
+ return o && ee(e.growingIO.vdsConfig, o) ? ee(a, o) ? a[o] : e.growingIO.vdsConfig[o] : y(o) || D(o) ? a : void j("getOption > ".concat(o));
785
+ }, this.updateVdsConfig = function(r, o) {
786
+ var a = window[e.growingIO.vdsName];
787
+ try {
788
+ r === e.growingIO.trackingId ? (e.growingIO.vdsConfig = f(f({}, e.growingIO.vdsConfig), o), window[e.growingIO.vdsName] = f(f({}, a), e.growingIO.vdsConfig)) : (e.growingIO.subInstance[r] = f(f({}, e.growingIO.subInstance[r]), o), window[e.growingIO.vdsName].subInstance[r] = f(f({}, a.subInstance[r]), e.growingIO.subInstance[r]));
789
+ } catch (s) {
790
+ I("Internal Error! ".concat(s), "error");
791
+ }
792
+ }, this.sendVerifiedVisit = function(r, o) {
793
+ var a = e.growingIO, s = a.userStore.getSessionId, c = a.storage.getItem(e.getStorageKey(r, "sentSign")), d = s(r) === c;
794
+ !o && d || e.buildVisitEvent(r);
795
+ }, this.sendVerifiedPage = function(r, o) {
796
+ o === void 0 && (o = !1), o && e.currentPage.parsePage();
797
+ var a = e.getTrackerVds(r).trackPage, s = e.currentPage, c = s.pageListeners, d = s.path, u = s.query, g = s.title, l = s.buildPageEvent;
798
+ A(c[r]) && c[r]({ path: d, query: u, title: g }), a && l(r);
799
+ }, this.buildVisitEvent = function(r, o) {
800
+ var a = e.growingIO, s = a.dataStore, c = s.eventContextBuilder, d = s.eventConverter, u = s.currentPage, g = a.emitter, l = a.vdsConfig, h = e.getOriginalSource(r), S = f(f({ eventType: "VISIT" }, c(r)), { title: u.title, referralPage: document.referrer || e.currentPage.getReferralPage(r), timestamp: u.time - 1 });
801
+ l.originalSource && !D(h) && (S = f(f({}, S), h)), y(o) || J(S, function(p, v) {
802
+ ee(o, v) && (Q(o[v]) ? S[v] = o[v] : y(o[v]) || (S[v] = o[v] || S[v]));
803
+ }), g.on(qe, function(p) {
804
+ var v = p.requestData, w = p.trackingId, b = e.growingIO, m = b.userStore, L = b.storage;
805
+ if (v.eventType === "VISIT" && r === w) {
806
+ L.setItem(e.getStorageKey(v.trackingId, "sentSign"), v.sessionId), m.setUid(v.deviceId);
807
+ var R = m.getUserId(w);
808
+ R && R === v.userId && m.setUserId(w, m.getUserId(w));
809
+ var G = m.getUserKey(w);
810
+ G && G === v.userKey && m.setUserKey(w, m.getUserKey(w));
811
+ var U = m.getGioId(w);
812
+ U && U === v.gioId && m.setGioId(w, m.getGioId(w)), localStorage.removeItem(e.getStorageKey(w, "originalSource"));
813
+ }
814
+ }), d(S);
815
+ }, this.eventConverter = function(r) {
816
+ var o, a, s = e.growingIO.uploader;
817
+ if (e.getTrackerVds(r.trackingId).dataCollect) {
818
+ r.eventSequenceId = e.getGsid(r.trackingId), r.eventType === "LOGIN_USER_ATTRIBUTES" ? E(r, ["timezoneOffset", "eventSequenceId"]) : e.setGsid(r.trackingId, e.getGsid(r.trackingId) + 1);
819
+ var c = {};
820
+ J(r, function(g, l) {
821
+ var h;
822
+ if (l === "element") {
823
+ var S = (h = pe(g)) !== null && h !== void 0 ? h : {};
824
+ J(S, function(p, v) {
825
+ y(p) && p !== 0 || (c[v] = p);
826
+ });
827
+ } else (y(g) || D(g)) && g !== 0 || (c[l] = g);
828
+ }), (o = e.growingIO.emitter) === null || o === void 0 || o.emit(pt, { composedEvent: f({}, c), trackingId: r.trackingId });
829
+ var d = e.beforeSendListener[r.trackingId];
830
+ if (!y(d) && A(d)) {
831
+ var u = (a = x(function() {
832
+ return d(f({}, c));
833
+ })) !== null && a !== void 0 ? a : {};
834
+ k(u) && !y(u) && u.eventType && u.dataSourceId && (["path", "query", "title"].forEach(function(g) {
835
+ u[g] && K(u[g]) && (c[g] = u[g]);
836
+ }), u.attributes && k(u.attributes) && (y(u.attributes) ? E(c, "attributes") : c.attributes = B(u.attributes)));
837
+ }
838
+ s.commitRequest(f(f({}, c), { requestId: Y() }));
839
+ }
840
+ }, this.currentPage = new jt(this.growingIO), this.eventContextBuilderInst = new Ft(this.growingIO), this.eventContextBuilder = (t = this.eventContextBuilderInst) === null || t === void 0 ? void 0 : t.main, this.generalProps = {}, this.beforeSendListener = {}, this.lastPageEvent = {};
841
+ var n = this.growingIO.emitter;
842
+ n?.on(vt, function(r) {
843
+ var o = r.eventData, a = r.trackingId;
844
+ o.eventType !== "PAGE" && o.t !== "page" || (e.lastPageEvent[a] = f(f({}, o), { nextRefferer: window.location.href }));
845
+ }), this.initializedTrackingIds = [], n.on(ht, function(r) {
846
+ var o = r.trackingId;
847
+ e.initializedTrackingIds.push(o);
848
+ }), n?.on(It, function(r) {
849
+ var o = r.trackingId;
850
+ _(e.initializedTrackingIds, o) && (e.growingIO.uploader.hoardingQueue[o] = [], e.currentPage.parsePage(), e.sendVerifiedVisit(o, !0), e.sendVerifiedPage(o, !0));
851
+ }), this.growingIO.emitter.on($e, function(r) {
852
+ var o = r.optionName, a = r.optionValue;
853
+ o === "dataCollect" && a === !1 && e.initializedTrackingIds.forEach(function(s) {
854
+ return e.growingIO.clearTrackTimer(s);
855
+ });
856
+ });
857
+ }, Mt = ["gioPerformance"], Ht = (function(i) {
858
+ function t(e) {
859
+ var n = i.call(this, e) || this;
860
+ return n.growingIO = e, n.growingIO.gioSDKFull = !1, n.pluginsContext = { plugins: {} }, n;
861
+ }
862
+ return (function(e, n) {
863
+ if (typeof n != "function" && n !== null) throw new TypeError("Class extends value " + n + " is not a constructor or null");
864
+ function r() {
865
+ this.constructor = e;
866
+ }
867
+ Te(e, n), e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
868
+ })(t, i), t;
869
+ })(function(i) {
870
+ var t, e, n, r, o, a, s = this;
871
+ this.growingIO = i, this.innerPluginInit = function() {
872
+ var c;
873
+ Mt.forEach(function(u) {
874
+ var g;
875
+ return E((g = s.pluginsContext) === null || g === void 0 ? void 0 : g.plugins, u);
876
+ });
877
+ var d = C((c = s.pluginsContext) === null || c === void 0 ? void 0 : c.plugins).map(function(u) {
878
+ var g;
879
+ return (g = s.pluginsContext) === null || g === void 0 ? void 0 : g.plugins[u];
880
+ });
881
+ y(d) || s.installAll(d, !0);
882
+ }, this.installAll = function(c, d) {
883
+ d === void 0 && (d = !1), (c || s.pluginItems).forEach(function(u) {
884
+ s.install(u.name, c ? u : void 0, d);
885
+ });
886
+ }, this.install = function(c, d, u) {
887
+ var g, l;
888
+ u === void 0 && (u = !1);
889
+ var h = s.growingIO.emitter;
890
+ try {
891
+ d && h.emit(Ze, d);
892
+ var S = De(s.pluginItems, function(v) {
893
+ return v.name === c;
894
+ }), p = { name: nt(c), method: d.method || function() {
895
+ }, options: d.options || {} };
896
+ return S > -1 ? (s.pluginItems[S] = p, u || I("重复加载插件 ".concat(c, " 或插件重名,已跳过加载!"), "warn")) : (s.pluginItems.push(p), u || I("加载插件 ".concat(c), "info"), ((g = s.growingIO) === null || g === void 0 ? void 0 : g.plugins)[c] = new d.method(s.growingIO, d.options)), ((l = s.growingIO) === null || l === void 0 ? void 0 : l.plugins)[c].options = d.options, !0;
897
+ } catch (v) {
898
+ return s.lifeError(d, v), u || I("插件【".concat(c, "】加载异常 ").concat(v), "error"), !1;
899
+ }
900
+ }, this.uninstall = function(c) {
901
+ var d;
902
+ return E(s.pluginItems, c), E((d = s.growingIO) === null || d === void 0 ? void 0 : d.plugins, c), c === "gioEmbeddedAdapter" && (s.growingIO.useEmbeddedInherit = ""), c === "gioHybridAdapter" && (s.growingIO.useHybridInherit = ""), !0;
903
+ }, this.uninstallAll = function() {
904
+ s.growingIO.useEmbeddedInherit = "", s.growingIO.useHybridInherit = "", s.pluginItems.forEach(function(c) {
905
+ return s.uninstall(c.name);
906
+ });
907
+ }, this.lifeError = function(c, d) {
908
+ s.growingIO.emitter.emit(Ye, { plugin: c, error: d }), I("插件执行错误 ".concat(c.name, " ").concat(d), "error");
909
+ }, this.callLifeCycle = function(c, d) {
910
+ s.pluginItems.forEach(function(u) {
911
+ var g = s.growingIO.plugins[u.name] ? s.growingIO.plugins[u.name][c] : void 0;
912
+ if (g && A(g)) try {
913
+ g(d);
914
+ } catch (l) {
915
+ s.lifeError(u, l);
916
+ }
917
+ });
918
+ }, this.pluginsContext = { plugins: {} }, this.pluginItems = [], (t = this.growingIO.emitter) === null || t === void 0 || t.on(Ze, function(c) {
919
+ return s.callLifeCycle("onInstall", c);
920
+ }), (e = this.growingIO.emitter) === null || e === void 0 || e.on(Ye, function(c) {
921
+ return s.callLifeCycle("onError", c);
922
+ }), (n = this.growingIO.emitter) === null || n === void 0 || n.on("ON_COMPOSE_BEFORE", function(c) {
923
+ return s.callLifeCycle("onComposeBefore", c);
924
+ }), (r = this.growingIO.emitter) === null || r === void 0 || r.on(pt, function(c) {
925
+ return s.callLifeCycle("onComposeAfter", c);
926
+ }), (o = this.growingIO.emitter) === null || o === void 0 || o.on(xe, function(c) {
927
+ return s.callLifeCycle("onSendBefore", c);
928
+ }), (a = this.growingIO.emitter) === null || a === void 0 || a.on(qe, function(c) {
929
+ return s.callLifeCycle("onSendAfter", c);
930
+ });
931
+ }), Bt = function(i) {
932
+ var t = this;
933
+ this.growingIO = i, this.generateURL = function(e) {
934
+ var n = t.growingIO.dataStore.getTrackerVds(e), r = n.serverUrl, o = n.projectId;
935
+ return ae(r, "http") ? "".concat(r, "/v3/projects/").concat(o, "/collect") : "https://".concat(r, "/v3/projects/").concat(o, "/collect");
936
+ }, this.getSendType = function(e) {
937
+ var n = t.growingIO.dataStore.getTrackerVds(e).sendType;
938
+ return n === "beacon" ? st() ? "beacon" : "xhr" : n;
939
+ }, this.getHoardingQueue = function(e) {
940
+ var n;
941
+ return (n = t.hoardingQueue[e]) !== null && n !== void 0 ? n : [];
942
+ }, this.commitRequest = function(e) {
943
+ var n, r = t.growingIO, o = r.vdsConfig;
944
+ r.emitter.emit(vt, { eventData: e, trackingId: e.trackingId });
945
+ var a = f(f({}, e), { requestType: t.getSendType(e.trackingId) });
946
+ o.forceLogin ? (t.hoardingQueue[e.trackingId] || (t.hoardingQueue[e.trackingId] = []), (n = t.hoardingQueue[e.trackingId]) === null || n === void 0 || n.push(a)) : (t.requestQueue.push(a), t.initiateRequest(e.trackingId));
947
+ }, this.initiateRequest = function(e) {
948
+ var n = t.getHoardingQueue(e);
949
+ if (q(q([], n, !0), t.requestQueue, !0).length > 0 && t.requestingNum < t.requestLimit) {
950
+ var r = t.growingIO.emitter;
951
+ if (t.requestQueue = q(q([], n, !0), t.requestQueue, !0), t.hoardingQueue[e] = [], y(t.requestQueue)) return;
952
+ var o = t.requestQueue.shift();
953
+ r?.emit(xe, { requestData: f({}, o), trackingId: o.trackingId });
954
+ }
955
+ }, this.sendEvent = function(e) {
956
+ var n, r, o = t.growingIO, a = o.vdsConfig, s = o.useHybridInherit, c = o.plugins, d = f({}, e), u = t.generateURL(e.trackingId);
957
+ if (E(d, ["requestType", "trackingId", "requestId"]), a.debug && console.log("[GrowingIO Debug]:", JSON.stringify(d, null, 2).replace(/"/g, ct() ? "" : '"')), t.requestingNum += 1, s === e.trackingId) return t.requestSuccessFn(e), !1;
958
+ var g, l = f({}, d);
959
+ a.compress && c?.gioCompress ? e.requestType === "image" ? (g = "11", l = (n = c?.gioCompress) === null || n === void 0 ? void 0 : n.compressToEncodedURIComponent(JSON.stringify([l]))) : (g = "1", l = (r = c?.gioCompress) === null || r === void 0 ? void 0 : r.compressToUint8Array(JSON.stringify([l]))) : (g = "0", l = JSON.stringify([l]));
960
+ var h = "".concat(u, "?stm=").concat(+Date.now(), "&compress=").concat(g);
961
+ switch (e.requestType) {
962
+ case "beacon":
963
+ default:
964
+ t.sendByBeacon(e, l, h);
965
+ break;
966
+ case "xhr":
967
+ t.sendByXHR(e, l, h);
968
+ break;
969
+ case "image":
970
+ t.sendByImage(e, l, h);
971
+ }
972
+ }, this.sendByBeacon = function(e, n, r) {
973
+ navigator.sendBeacon(r, n) ? t.requestSuccessFn(e) : t.requestFailFn(e, "xhr");
974
+ }, this.sendByXHR = function(e, n, r) {
975
+ var o = t.growingIO.dataStore.getTrackerVds(e.trackingId).requestTimeout, a = new XMLHttpRequest();
976
+ if (a) return a.open("POST", r, !0), a.onload = function() {
977
+ a.status === 204 ? t.requestSuccessFn(e) : t.requestFailFn(e, "image");
978
+ }, a.ontimeout = a.onerror = a.onabort = function() {
979
+ t.requestFailFn(e, "image");
980
+ }, a.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"), a.timeout = o, void a.send(n);
981
+ if (window?.XDomainRequest) {
982
+ var s = new window.XDomainRequest();
983
+ s.open("POST", r.replace("https://", "http://"), !0), s.onload = function() {
984
+ s.status === 204 ? t.requestSuccessFn(e) : t.requestFailFn(e, "image");
985
+ }, s.onerror = s.ontimeout = function() {
986
+ t.requestFailFn(e, "image");
987
+ }, s.send(n);
988
+ }
989
+ }, this.sendByImage = function(e, n, r) {
990
+ var o = t.growingIO.dataStore.getTrackerVds(e.trackingId).requestTimeout, a = "".concat(r, "&data=").concat(n), s = document.createElement("img");
991
+ s.width = 1, s.height = 1;
992
+ var c = window.setTimeout(function() {
993
+ t.requestingNum -= 1, t.clearImage(s), window.clearTimeout(c), c = null, t.initiateRequest(e.trackingId);
994
+ }, o);
995
+ s.onload = function() {
996
+ t.requestSuccessFn(e), t.clearImage(s), window.clearTimeout(c), c = null;
997
+ }, s.onerror = s.onabort = function() {
998
+ t.requestSuccessFn(e), t.clearImage(s), window.clearTimeout(c), c = null;
999
+ }, s.src = a;
1000
+ }, this.clearImage = function(e) {
1001
+ e.src = "", e.onload = function() {
1002
+ }, e.onerror = e.onerabort = function() {
1003
+ }, e = null;
1004
+ }, this.requestSuccessFn = function(e) {
1005
+ var n;
1006
+ t.requestingNum -= 1;
1007
+ var r = t.growingIO.userStore.getSessionId(e.trackingId);
1008
+ r === e.sessionId && t.growingIO.userStore.setSessionId(e.trackingId, r), (n = t.growingIO.emitter) === null || n === void 0 || n.emit(qe, { requestData: f({}, e), trackingId: e.trackingId }), t.initiateRequest(e.trackingId);
1009
+ }, this.requestFailFn = function(e, n) {
1010
+ if (t.requestingNum -= 1, !t.requestQueue.some(function(o) {
1011
+ return o.requestId === e.requestId;
1012
+ }) && n) var r = window.setTimeout(function() {
1013
+ t.requestQueue.push(f(f({}, e), { requestType: n })), t.initiateRequest(e.trackingId), window.clearTimeout(r), r = null;
1014
+ }, 800);
1015
+ }, this.hoardingQueue = {}, this.requestQueue = [], this.requestLimit = 10, this.requestingNum = 0, this.growingIO.emitter.on(Ve, function(e) {
1016
+ var n = e.trackingId;
1017
+ t.hoardingQueue[n] = [];
1018
+ }), this.growingIO.emitter.on(xe, function(e) {
1019
+ var n = e.requestData;
1020
+ e.trackingId === t.growingIO.trackingId && t.sendEvent(n);
1021
+ });
1022
+ }, ce = "gdp_user_id_gioenc", zt = function(i) {
1023
+ var t = this;
1024
+ this.growingIO = i, this.getUid = function() {
1025
+ var e = t.growingIO.storage.getItem(ce);
1026
+ if (e) return e;
1027
+ var n = Y();
1028
+ return t.setUid(n), n;
1029
+ }, this.setUid = function(e) {
1030
+ var n, r = t.growingIO.storage, o = r.getItem(ce) || t.prevUId;
1031
+ r.setItem(ce, e), o !== e && ((n = t.growingIO.emitter) === null || n === void 0 || n.emit("UID_UPDATE", { newUId: e, oldUId: o })), t.prevUId = e;
1032
+ }, this._getSidKey = function(e) {
1033
+ return t.growingIO.dataStore.getStorageKey(e, "sessionId");
1034
+ }, this.getPrevSessionId = function(e) {
1035
+ var n;
1036
+ return (n = t.prevIds[e]) === null || n === void 0 ? void 0 : n.sessionId;
1037
+ }, this.getSessionId = function(e) {
1038
+ var n = t.growingIO.storage.getItem(t._getSidKey(e));
1039
+ if (n) return n;
1040
+ var r = Y();
1041
+ return t.setSessionId(e, r), r;
1042
+ }, this.setSessionId = function(e, n) {
1043
+ var r;
1044
+ n || (n = Y());
1045
+ var o = t.growingIO, a = o.storage, s = o.dataStore, c = o.emitter, d = a.getItem(t._getSidKey(e)) || t.getPrevSessionId(e), u = ((r = s.getTrackerVds(e)) !== null && r !== void 0 ? r : {}).sessionExpires, g = u === void 0 ? 30 : u;
1046
+ a.setItem(t._getSidKey(e), n, +Date.now() + 60 * g * 1e3), d !== n && (a.getKeys().filter(function(l) {
1047
+ return St.test(l);
1048
+ }).forEach(function(l) {
1049
+ a.removeItem(l);
1050
+ }), a.setItem(s.getStorageKey(e, "sentSign"), ""), c?.emit(It, { newSessionId: n, oldSessionId: d, trackingId: e })), t.prevIds[e] || (t.prevIds[e] = {}), t.prevIds[e].sessionId = n;
1051
+ }, this._getUserIdKey = function(e) {
1052
+ return t.growingIO.dataStore.getStorageKey(e, "userId");
1053
+ }, this.getPrevUserId = function(e) {
1054
+ var n;
1055
+ return (n = t.prevIds[e]) === null || n === void 0 ? void 0 : n.userId;
1056
+ }, this.getUserId = function(e) {
1057
+ return t.growingIO.storage.getItem(t._getUserIdKey(e)) || "";
1058
+ }, this.setUserId = function(e, n) {
1059
+ var r, o, a = t.growingIO.storage, s = a.getItem(t._getUserIdKey(e)) || t.getPrevUserId(e);
1060
+ a.setItem(t._getUserIdKey(e), n), (r = t.growingIO.emitter) === null || r === void 0 || r.emit("SET_USERID", { newUserId: n, oldUserId: s, userKey: t.getUserKey(e), trackingId: e }), s !== n && ((o = t.growingIO.emitter) === null || o === void 0 || o.emit("USERID_UPDATE", { newUserId: n, oldUserId: s, userKey: t.getUserKey(e), trackingId: e })), n && t.setGioId(e, n), t.prevIds[e] || (t.prevIds[e] = {}), t.prevIds[e].userId = n;
1061
+ }, this._getUserKeyKey = function(e) {
1062
+ return t.growingIO.dataStore.getStorageKey(e, "userKey");
1063
+ }, this.getPrevUserKey = function(e) {
1064
+ var n;
1065
+ return (n = t.prevIds[e]) === null || n === void 0 ? void 0 : n.userKey;
1066
+ }, this.getUserKey = function(e) {
1067
+ return t.growingIO.storage.getItem(t._getUserKeyKey(e)) || "";
1068
+ }, this.setUserKey = function(e, n) {
1069
+ var r, o, a = t.growingIO.storage, s = a.getItem(t._getUserKeyKey(e)) || t.getPrevUserKey(e);
1070
+ a.setItem(t._getUserKeyKey(e), n), (r = t.growingIO.emitter) === null || r === void 0 || r.emit("SET_USERKEY", { newUserKey: n, oldUserKey: s, userId: t.getUserId(e), trackingId: e }), s !== n && ((o = t.growingIO.emitter) === null || o === void 0 || o.emit("USERKEY_UPDATE", { newUserKey: n, oldUserKey: s, userId: t.getUserId(e), trackingId: e })), t.prevIds[e] || (t.prevIds[e] = {}), t.prevIds[e].userKey = n;
1071
+ }, this._getGioIdKey = function(e) {
1072
+ return t.growingIO.dataStore.getStorageKey(e, "gioId");
1073
+ }, this.getPrevGioId = function(e) {
1074
+ var n;
1075
+ return (n = t.prevIds[e]) === null || n === void 0 ? void 0 : n.gioId;
1076
+ }, this.getGioId = function(e) {
1077
+ return t.growingIO.storage.getItem(t._getGioIdKey(e)) || "";
1078
+ }, this.setGioId = function(e, n) {
1079
+ var r, o = t.growingIO.storage, a = o.getItem(t._getGioIdKey(e)) || t.getPrevGioId(e);
1080
+ o.setItem(t._getGioIdKey(e), n), a !== n && ((r = t.growingIO.emitter) === null || r === void 0 || r.emit("GIOID_UPDATE", { newGioId: n, oldGioId: a, trackingId: e })), t.prevIds[e] || (t.prevIds[e] = {}), t.prevIds[e].gioId = n;
1081
+ }, this.transferStorage = function(e, n) {
1082
+ if (!n.storage.getItem(ce) && e === n.trackingId && t.growingIO.storage.getItem("gr_user_id")) {
1083
+ var r = n.vdsConfig.projectId, o = n.storage, a = o.getItem("gr_user_id");
1084
+ a && t.setUid(a);
1085
+ var s = o.getItem("".concat(r, "_gr_cs1")) || t.getUserId(e);
1086
+ s && t.setUserId(e, s), o.removeItem("gr_user_id"), o.removeItem("".concat(r, "_gr_cs1")), o.removeItem("".concat(r, "_gr_last_sent_cs1")), o.removeItem("".concat(r, "_gr_last_sent_sid_with_cs1")), o.removeItem("".concat(r, "_gr_session_id")), o.removeItem("".concat(r, "_gr_session_id_sent_vst"));
1087
+ var c = rt(o.getKeys(), function(d) {
1088
+ return d.indexOf("gr_imp_") > -1;
1089
+ });
1090
+ c && o.removeItem(c);
1091
+ }
1092
+ }, this.prevIds = {}, this.growingIO.emitter.on(Ve, function(e) {
1093
+ var n = e.trackingId, r = e.growingIO;
1094
+ t.transferStorage(n, r);
1095
+ });
1096
+ }, Wt = (function() {
1097
+ function i() {
1098
+ var t, e = this;
1099
+ this.init = function(n) {
1100
+ var r;
1101
+ e.emitter.emit("ON_SDK_INITIALIZE_BEFORE");
1102
+ try {
1103
+ if (I("Gio Web SDK 初始化中...", "info"), n.trackingId && _(e.dataStore.initializedTrackingIds, n.trackingId)) throw Error("已存在实例 ".concat(n.trackingId, ",请勿重复初始化!"));
1104
+ if (e.trackingId && !e.plugins.gioMultipleInstances) throw Error("您正在尝试初始化另一个实例,请集成多实例插件后重试!");
1105
+ var o = e.dataStore.currentPage, a = e.dataStore.initTrackerOptions(n);
1106
+ return (!e.trackingId || a.trackingId === e.trackingId) && (e.storage = Nt(e.vdsConfig), o.hookHistory(), a.extraUA !== !1 && z.isCompatible() && z.initialize(), e.gioSDKInitialized = !0, e.vdsConfig.gioSDKInitialized = !0), (r = e.emitter) === null || r === void 0 || r.emit(Ve, { growingIO: e, trackingId: a.trackingId, vdsConfig: a }), o.parsePage(), e.vdsConfig.originalSource && e.dataStore.setOriginalSource(a.trackingId), I("Gio Web SDK 初始化完成!".concat(e.useEmbeddedInherit === a.trackingId ? "小程序模式" : e.useHybridInherit === a.trackingId ? "Hybrid模式" : "Web模式"), "success"), e.vdsConfig.forceLogin && I("forceLogin已开启,请调用 identify 方法设置 openId 以继续上报!", "info"), e._waitForUserAgentAndSendEvents(a.trackingId), !0;
1107
+ } catch (s) {
1108
+ return I(s, "error"), !1;
1109
+ }
1110
+ }, this.handlerDistribute = function(n, r, o) {
1111
+ e.dataStore.getTrackerVds(n) ? z.isInitializing() ? z.initialize().finally(function() {
1112
+ e[r].apply(e, q([n], o, !1));
1113
+ }) : e[r].apply(e, q([n], o, !1)) : (A(he(o)) && O(he(o), !1), I("不存在实例:".concat(n, ",请检查!"), "warn"));
1114
+ }, this.registerPlugins = function(n, r) {
1115
+ if (N(n)) {
1116
+ var o = [];
1117
+ n.forEach(function(a, s) {
1118
+ at(a, s) && o.push(a);
1119
+ }), e.plugins.installAll(o);
1120
+ } else I("插件注册失败,参数不合法,请检查!", "error");
1121
+ O(r, e.plugins.pluginItems);
1122
+ }, this.getPlugins = function(n) {
1123
+ O(n, e.plugins.pluginItems);
1124
+ }, this.getDeviceId = function(n) {
1125
+ O(n, e.userStore.getUid());
1126
+ }, this.setOption = function(n, r, o, a) {
1127
+ var s, c;
1128
+ _(C(Ue), r) ? typeof o === ((s = ge[r]) === null || s === void 0 ? void 0 : s.type) ? (e.dataStore.setOption(n, r, o), I("已修改".concat(Ue[r], ": ").concat(o), "info"), c = !0) : (I("参数格式不正确:".concat(o, ",请检查后重试!"), "error"), c = !1) : (I("不存在可修改的配置项:".concat(r, ",请检查后重试!"), "error"), c = !1), O(a, c);
1129
+ }, this.getOption = function(n, r, o) {
1130
+ A(r) && D(o) && (o = r, r = void 0), O(o, e.dataStore.getOption(n, r));
1131
+ }, this.sendVisit = function(n, r, o) {
1132
+ e.dataStore.buildVisitEvent(f(f({}, r), { trackingId: n })), O(o);
1133
+ }, this.setPageListener = function(n, r) {
1134
+ var o = e.dataStore.currentPage;
1135
+ if (A(r)) {
1136
+ o.pageListeners[n] = r;
1137
+ var a = e.dataStore.currentPage, s = a.path, c = a.query, d = a.title;
1138
+ O(r, { path: s, query: c, title: d });
1139
+ }
1140
+ }, this.setPageAttributes = function(n, r, o) {
1141
+ var a;
1142
+ if (k(r) && !y(r)) if (e.dataStore.getTrackerVds(n).trackPage) a = !1, I("仅在关闭trackPage时允许调用setPageAttributes,请确认后修改初始化配置项!", "error");
1143
+ else {
1144
+ var s = e.dataStore.currentPage;
1145
+ y(s.pageProps[n]) && (s.pageProps[n] = {}), y(s.pageProps[n][s.path]) && (s.pageProps[n][s.path] = {}), y(r) || J(r, function(c, d) {
1146
+ A(s.pageProps[n][s.path][d]) && !A(c) || (s.pageProps[n][s.path][d] = c);
1147
+ }), a = !0;
1148
+ }
1149
+ else a = !1, j("setPageAttributes");
1150
+ O(o, a);
1151
+ }, this.clearPageAttributes = function(n, r, o) {
1152
+ var a = !0;
1153
+ try {
1154
+ if (!y(e.dataStore.currentPage.pageProps[n])) {
1155
+ var s = e.dataStore.currentPage;
1156
+ N(r) && !y(r) ? r.forEach(function(c) {
1157
+ E(s.pageProps[n][s.path], c);
1158
+ }) : s.pageProps[n][s.path] = {};
1159
+ }
1160
+ } catch {
1161
+ j("clearPageAttributes"), a = !1;
1162
+ }
1163
+ O(o, a);
1164
+ }, this.sendPage = function(n, r, o) {
1165
+ e.dataStore.getTrackerVds(n).trackPage ? I("仅在关闭trackPage时允许调用sendPage,请确认后修改初始化配置项!", "error") : (e.dataStore.currentPage.buildPageEvent(n, r), O(o));
1166
+ }, this.identify = function(n, r, o) {
1167
+ if (n === e.trackingId) {
1168
+ if (e.vdsConfig.forceLogin) {
1169
+ if (!ze(r)) return void j("identify");
1170
+ var a = T(r).slice(0, 1e3);
1171
+ e.userStore.setUid(a), e.dataStore.initializedTrackingIds.forEach(function(s) {
1172
+ var c = e.uploader.getHoardingQueue(s);
1173
+ c.forEach(function(d, u) {
1174
+ return c[u].deviceId = a;
1175
+ }), s === e.trackingId && e.vdsConfig.forceLogin && e.dataStore.setOption(s, "forceLogin", !1), e.uploader.initiateRequest(s);
1176
+ });
1177
+ } else j("identify", !1, "forceLogin未开启");
1178
+ O(o);
1179
+ } else j("identify", !1, "子实例不允许调用identify");
1180
+ }, this.setUserAttributes = function(n, r, o) {
1181
+ var a, s;
1182
+ if (k(r) && !y(r)) {
1183
+ var c = e.dataStore, d = c.eventContextBuilder, u = c.eventConverter, g = f({ eventType: "LOGIN_USER_ATTRIBUTES" }, d(n));
1184
+ g.attributes = B(f(f({}, (a = g.attributes) !== null && a !== void 0 ? a : {}), te(r))), u(g), s = !0;
1185
+ } else j("setUserAttributes"), s = !1;
1186
+ O(o, s);
1187
+ }, this.setUserId = function(n, r, o, a) {
1188
+ var s;
1189
+ if (ze(T(r).trim())) {
1190
+ var c = e.userStore.getGioId(n), d = !D(o) && T(o).length > 0 ? T(o).slice(0, 1e3) : "";
1191
+ e.userStore.setUserKey(n, d), !e.dataStore.getTrackerVds(n).idMapping && d && I("您设置了 userKey ,请初始化开启 idMapping!", "warn"), e.userStore.setUserId(n, T(r).slice(0, 1e3)), c && c !== e.userStore.getUserId(n) && e.userStore.setSessionId(n, ""), s = !0;
1192
+ } else e.clearUserId(n), j("setUserId"), s = !1;
1193
+ O(a, s);
1194
+ }, this.clearUserId = function(n, r) {
1195
+ e.userStore.setUserId(n, ""), e.userStore.setUserKey(n, ""), O(r);
1196
+ }, this.setGeneralProps = function(n, r, o) {
1197
+ var a;
1198
+ k(r) && !y(r) ? (y(e.dataStore.generalProps[n]) && (e.dataStore.generalProps[n] = {}), J(r, function(s, c) {
1199
+ A(e.dataStore.generalProps[n][c]) && !A(s) || (e.dataStore.generalProps[n][c] = s);
1200
+ }), a = !0) : (j("setGeneralProps"), a = !1), O(o, a);
1201
+ }, this.clearGeneralProps = function(n, r, o) {
1202
+ y(e.dataStore.generalProps[n]) || (N(r) && !y(r) ? r.forEach(function(a) {
1203
+ E(e.dataStore.generalProps[n], a);
1204
+ }) : e.dataStore.generalProps[n] = {}), O(o);
1205
+ }, this.track = function(n, r, o, a) {
1206
+ We(r, function() {
1207
+ var s, c = e.dataStore, d = c.eventContextBuilder, u = c.eventConverter, g = f({ eventType: "CUSTOM", eventName: r }, d(n));
1208
+ g.attributes = B(f(f({}, (s = g.attributes) !== null && s !== void 0 ? s : {}), te(f({}, k(o) && !y(o) ? o : {})))), e.plugins.gioMultipleInstances && o && o["&&sendTo"] && (g["&&sendTo"] = o["&&sendTo"]), u(g);
1209
+ }), O(a);
1210
+ }, this.trackTimerStart = function(n, r, o) {
1211
+ var a;
1212
+ e.dataStore.getTrackerVds(n).dataCollect ? We(r, function() {
1213
+ a = Y(), e.dataStore.trackTimers[n] || (e.dataStore.trackTimers[n] = {}), e.dataStore.trackTimers[n][a] = { eventName: r, leng: 0, start: +Date.now() };
1214
+ }) : I("指定实例未开启数据采集,请检查!", "error"), O(o, a);
1215
+ }, this.trackTimerPause = function(n, r, o) {
1216
+ var a = e.dataStore.trackTimers[n];
1217
+ if (r && a && a[r]) {
1218
+ var s = a[r];
1219
+ s.start && (s.leng = s.leng + (+Date.now() - s.start)), s.start = 0;
1220
+ } else I("未查询到指定计时器,请检查!", "error");
1221
+ O(o);
1222
+ }, this.trackTimerResume = function(n, r, o) {
1223
+ var a = e.dataStore.trackTimers[n];
1224
+ if (r && a && a[r]) {
1225
+ var s = a[r];
1226
+ s.start === 0 && (s.start = +Date.now());
1227
+ } else I("未查询到指定计时器,请检查!", "error");
1228
+ O(o);
1229
+ }, this.trackTimerEnd = function(n, r, o, a) {
1230
+ var s, c, d = e.dataStore.getTrackerVds(n).dataCollect, u = e.dataStore.trackTimers[n];
1231
+ if (r && u && u[r]) {
1232
+ if (d) {
1233
+ var g = u[r];
1234
+ if (g.start !== 0) {
1235
+ var l = +Date.now() - g.start;
1236
+ g.leng = l > 0 ? g.leng + l : 0;
1237
+ }
1238
+ var h = e.dataStore, S = h.eventContextBuilder, p = h.eventConverter, v = f({ eventType: "CUSTOM", eventName: g.eventName }, S(n));
1239
+ v.attributes = B(f(f(f({}, (s = v.attributes) !== null && s !== void 0 ? s : {}), te(f({}, k(o) && !y(o) ? o : {}))), { event_duration: g.leng > 864e5 ? 0 : g.leng / 1e3 })), e.plugins.gioMultipleInstances && o && o["&&sendTo"] && (v["&&sendTo"] = o["&&sendTo"]), p(v), c = !0;
1240
+ } else I("指定实例未开启数据采集,计时器已移除,请检查!", "error"), c = !1;
1241
+ e.removeTimer(n, r);
1242
+ } else I("未查询到指定计时器,请检查!", "error"), c = !1;
1243
+ O(a, c);
1244
+ }, this.removeTimer = function(n, r, o) {
1245
+ var a = e.dataStore.trackTimers[n];
1246
+ r && a && a[r] ? delete a[r] : I("未查询到指定计时器,请检查!", "error"), O(o);
1247
+ }, this.clearTrackTimer = function(n, r) {
1248
+ e.dataStore.trackTimers[n] = {}, O(r);
1249
+ }, this.updateImpression = function(n) {
1250
+ var r, o, a = (o = (r = e.plugins) === null || r === void 0 ? void 0 : r.gioImpressionTracking) === null || o === void 0 ? void 0 : o.main;
1251
+ a ? a("manual") : I("updateImpression 错误! 请集成半自动埋点浏览插件后重试!", "error"), O(n);
1252
+ }, this.getABTest = function(n, r, o) {
1253
+ I("获取ABTest数据错误! 请集成ABTest插件后重试!", "error"), O(o, {});
1254
+ }, this.setBeforeSendListener = function(n, r, o) {
1255
+ T(r).indexOf("sendPage") > -1 ? I("拦截回调中不能调用sendPage方法,请检查!", "error") : A(r) ? (e.dataStore.beforeSendListener[n] = r, O(o)) : O(o, !1);
1256
+ }, this.getUserAgent = function(n) {
1257
+ var r = "Unknown";
1258
+ try {
1259
+ r = e.vdsConfig.extraUA !== !1 ? z.getUserAgent() : typeof navigator < "u" && navigator.userAgent ? navigator.userAgent : "Unknown";
1260
+ } catch {
1261
+ r = typeof navigator < "u" && navigator.userAgent ? navigator.userAgent : "Unknown";
1262
+ }
1263
+ return O(n, r), r;
1264
+ }, this.sdkVersion = "4.3.1", this.vdsName = window._gio_local_vds || "vds", this.utils = f(f({}, kt), Tt), this.emitter = (t = t || /* @__PURE__ */ Object.create(null), { on: function(n, r) {
1265
+ (t[n] || (t[n] = [])).push(r);
1266
+ }, off: function(n, r) {
1267
+ t[n] && t[n].splice(t[n].indexOf(r) >>> 0, 1);
1268
+ }, emit: function(n, r) {
1269
+ (t[n] || []).slice().map(function(o) {
1270
+ o(r);
1271
+ }), (t["*"] || []).slice().map(function(o) {
1272
+ o(n, r);
1273
+ });
1274
+ } }), this.useEmbeddedInherit = "", this.useHybridInherit = "", this.gioSDKInitialized = !1, this.plugins = new Ht(this), this.plugins.innerPluginInit(), this.dataStore = new Gt(this), this.userStore = new zt(this), this.uploader = new Bt(this);
1275
+ }
1276
+ return i.prototype._waitForUserAgentAndSendEvents = function(t) {
1277
+ var e = this;
1278
+ z.isInitializing() ? z.initialize().finally(function() {
1279
+ e._sendEventsAfterUserAgent(t);
1280
+ }) : this._sendEventsAfterUserAgent(t);
1281
+ }, i.prototype._sendEventsAfterUserAgent = function(t) {
1282
+ var e;
1283
+ this.useEmbeddedInherit !== t && this.dataStore.sendVerifiedVisit(t), this.dataStore.sendVerifiedPage(t), (e = this.emitter) === null || e === void 0 || e.emit(ht, { growingIO: this, trackingId: t });
1284
+ }, i;
1285
+ })(), $ = window._gio_local_vds || "vds", X = (ke = (be = window[$]) === null || be === void 0 ? void 0 : be.namespace) !== null && ke !== void 0 ? ke : "gdp";
1286
+ (function() {
1287
+ var i, t, e, n, r;
1288
+ if (!((i = window[$]) === null || i === void 0) && i.gioSDKInstalled) return Z = window[X], void I("SDK重复加载,请检查是否重复加载SDK或接入其他平台SDK导致冲突!", "warn");
1289
+ window[$] = f(f({}, (t = window[$]) !== null && t !== void 0 ? t : {}), { gioSDKInstalled: !0 });
1290
+ var o = new Wt(), a = function(l) {
1291
+ return _(Qe, l) && !!o[l];
1292
+ };
1293
+ Z = function() {
1294
+ for (var l, h, S = [], p = 0; arguments.length > p; p++) S[p] = arguments[p];
1295
+ var v = S[0], w = "g0", b = v;
1296
+ if (v.indexOf(".") > -1 && (w = (l = v.split(".")[0]) !== null && l !== void 0 ? l : "g0", b = v.split(".")[1]), K(b) && _(Qe, b) && o[b]) {
1297
+ var m = Ie(se(S));
1298
+ if (b === "init") {
1299
+ var L = (function(H, F) {
1300
+ if (_(["", "localhost", "127.0.0.1"], location.hostname) && !window._gr_ignore_local_rule) return I("当前SDK不允许在本地环境初始化!", "error"), !1;
1301
+ var re = T(F[0]), ye = T(F[1]), Le = (F.length === 4 ? F[3] : F[2]) || {};
1302
+ return re && ye ? H.dataStore.initializedTrackingIds.some(function(mt, wt) {
1303
+ var Re = wt === 0 ? H.vdsConfig : H.subInstance[mt];
1304
+ return Re.projectId === re && Re.dataSourceId === ye;
1305
+ }) ? (I("SDK初始化失败,重复初始化,请检查初始化参数!", "error"), !1) : { projectId: re, dataSourceId: ye, appId: Le.appId || T(F.length === 4 ? F[2] : ""), userOptions: Le } : (I('SDK初始化失败,请使用 gdp("init", "您的GrowingIO项目 accountId", "您项目的 dataSourceId", options: { host: "您的数据上报地址host" }); 进行初始化!', "error"), !1);
1306
+ })(o, m);
1307
+ if (L) {
1308
+ var R = L.projectId, G = L.dataSourceId, U = L.appId, M = L.userOptions;
1309
+ return o.init(f(f({}, M), { projectId: R, dataSourceId: G, appId: U || M.appId, trackingId: w }));
1310
+ }
1311
+ return !1;
1312
+ }
1313
+ b === "registerPlugins" ? o.registerPlugins.apply(o, m) : _(["setGeneralProps", "clearGeneralProps"], b) ? o[b].apply(o, q([w], m, !1)) : o.gioSDKInitialized && o.vdsConfig ? _(lt, b) ? x(function() {
1314
+ return o.handlerDistribute(w, b, m);
1315
+ }) : x(function() {
1316
+ return o[b].apply(o, m);
1317
+ }) : (o.emitter.emit("UN_EXECUTE_CALL", S), I("SDK未初始化!", "error"));
1318
+ } else if (_(Ut, b)) I("方法 ".concat(T(b), " 已被弃用,请移除!"), "warn");
1319
+ else {
1320
+ if (b === "canIUse") return a(S[1]);
1321
+ I("不存在名为 ".concat(T(b), " 的方法调用!"), "error");
1322
+ }
1323
+ window[$] = f(f({}, window[$]), { _gr_ignore_local_rule: (h = window._gr_ignore_local_rule) !== null && h !== void 0 && h, gioSDKVersion: o.sdkVersion, gioSDKFull: o.gioSDKFull, canIUse: a });
1324
+ };
1325
+ var s = (e = window[X]) === null || e === void 0 ? void 0 : e.q, c = (n = window[X]) === null || n === void 0 ? void 0 : n.e, d = (r = window[X]) === null || r === void 0 ? void 0 : r.ef;
1326
+ if (window[X] = Z, window[X].e = c, window[X].ef = d, window.gdp = Z, window.gdp.e = c, window.gdp.ef = d, N(s) && !y(s)) for (var u = s.length, g = 0; u > g; g += 1) Z.apply(null, s.shift());
1327
+ })();
1328
+ var Qt = Z;
1329
+ export {
1330
+ Qt as default
1331
+ };