@picked/analytics 0.0.12-next.9 → 0.0.12

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.
@@ -1,1152 +0,0 @@
1
- import { trackSelfDescribingEvent as Nt, newTracker as wt, addGlobalContexts as Pt, enableActivityTracking as Vt, enableActivityTrackingCallback as St } from "@snowplow/browser-tracker";
2
- import { ButtonClickTrackingPlugin as Yt, enableButtonClickTracking as Bt } from "@snowplow/browser-plugin-button-click-tracking";
3
- import { PerformanceNavigationTimingPlugin as Ht } from "@snowplow/browser-plugin-performance-navigation-timing";
4
- import { ErrorTrackingPlugin as qt, enableErrorTracking as At } from "@snowplow/browser-plugin-error-tracking";
5
- import { WebVitalsPlugin as Ft } from "@snowplow/browser-plugin-web-vitals";
6
- import { supportsDocument as X, supportsWindow as Rt, supportsCookies as jt } from "@picked/client";
7
- function J(t, e) {
8
- return `iglu:dev.pckd/${t}/jsonschema/${e}`;
9
- }
10
- function $(t, ...e) {
11
- }
12
- function L(t, ...e) {
13
- }
14
- function l(t, e, s = {}) {
15
- return {
16
- event: {
17
- schema: J("event", "1-0-0"),
18
- data: {
19
- type: t,
20
- meta: s
21
- }
22
- },
23
- context: e.filter(
24
- (i) => i !== void 0
25
- )
26
- };
27
- }
28
- function n(t, e, s) {
29
- return {
30
- schema: J(t, e),
31
- data: s
32
- };
33
- }
34
- function u(t, e) {
35
- return (s, i) => {
36
- const a = e(s, i);
37
- Nt(a);
38
- };
39
- }
40
- function D(t, e, s = { passive: !0 }) {
41
- const i = /* @__PURE__ */ new WeakMap();
42
- return (a, o) => {
43
- let r = i.get(a);
44
- if (r || (r = /* @__PURE__ */ new Set(), i.set(a, r)), r.has(t))
45
- return;
46
- function c(m) {
47
- const C = o();
48
- e({ event: m, analyticsContext: C });
49
- }
50
- a.addEventListener(t, c, s), r.add(t);
51
- };
52
- }
53
- function Ot(t, e) {
54
- const s = /* @__PURE__ */ new Set();
55
- return (i) => {
56
- if (s.has(t) || !X())
57
- return;
58
- function a(o) {
59
- const r = i();
60
- e({ event: o, analyticsContext: r });
61
- }
62
- document.addEventListener(t, a, { passive: !0 }), s.add(t);
63
- };
64
- }
65
- function y(t, e) {
66
- const s = /* @__PURE__ */ new Set();
67
- return (i) => {
68
- if (s.has(t) || !Rt())
69
- return;
70
- function a(o) {
71
- const r = i();
72
- e({ event: o, analyticsContext: r });
73
- }
74
- window.addEventListener(t, a, { passive: !0 }), s.add(t);
75
- };
76
- }
77
- function f(t) {
78
- var s;
79
- return { items: ((s = t.features) == null ? void 0 : s.map(({ feature: i, name: a, key: o, bucket: r }) => ({
80
- ab_feature: i,
81
- ab_name: a,
82
- ab_key: o,
83
- ab_bucket: r
84
- }))) || [] };
85
- }
86
- const b = "unknown";
87
- function d(t) {
88
- var i;
89
- const e = Wt(), s = {
90
- id: t.sessionId || null
91
- };
92
- return e && (s.gaid = e), (i = t.shopifySession) != null && i.clientId && (s.shopify_client_id = t.shopifySession.clientId), s;
93
- }
94
- function O(t) {
95
- if (t.fields)
96
- return {
97
- items: t.fields.map(({ id: e, type: s, label: i, options: a }) => ({
98
- id: e,
99
- type: s,
100
- label: i,
101
- options: a
102
- }))
103
- };
104
- }
105
- function Q(t) {
106
- if (t.responses)
107
- return {
108
- items: t.responses.map(
109
- ({ fieldId: e, value: s }) => ({
110
- field_id: e,
111
- values: Array.isArray(s) ? s.map((i) => ({ value: i })) : [{ value: s }]
112
- })
113
- )
114
- };
115
- }
116
- function x(t, e = !1) {
117
- const { step: s } = t;
118
- if (s)
119
- return {
120
- id: s.id,
121
- title: s.label
122
- };
123
- if (e)
124
- return L('"step" is required for this event', t), {
125
- id: b,
126
- title: b
127
- };
128
- }
129
- function Hn(t, e = !1) {
130
- const { productList: s } = t;
131
- if (s) {
132
- const i = {};
133
- "title" in s && s.title && Object.assign(i, { title: s.title });
134
- const a = "items" in s ? s.items : s;
135
- return Object.assign(i, {
136
- items: a.map((o) => ({
137
- item_id: o.itemId,
138
- item_name: o.itemName,
139
- affiliation: o.affiliation,
140
- coupon: o.coupon,
141
- currency: o.currency,
142
- creative_name: o.creativeName,
143
- creative_slot: o.creativeSlot,
144
- discount: h(o.discount),
145
- index: h(o.index),
146
- item_brand: o.itemBrand,
147
- item_category: o.itemCategory,
148
- item_category2: o.itemCategory2,
149
- item_category3: o.itemCategory3,
150
- item_category4: o.itemCategory4,
151
- item_category5: o.itemCategory5,
152
- item_list_id: o.itemListId,
153
- item_list_name: o.itemListName,
154
- item_variant: o.itemVariant,
155
- location_id: o.locationId,
156
- price: h(o.price),
157
- promotion_id: o.promotionId,
158
- promotion_name: o.promotionName,
159
- quantity: h(o.quantity),
160
- in_stock: o.inStock
161
- }))
162
- }), i;
163
- }
164
- if (e)
165
- return L('"productList" is required for this event', t), {};
166
- }
167
- function p(t, e = !1) {
168
- const { experience: s } = t;
169
- if (s)
170
- return {
171
- id: s.id,
172
- title: s.title
173
- };
174
- if (e)
175
- return L('"experience" is required for this event', t), {
176
- id: b,
177
- title: b
178
- };
179
- }
180
- function Z(t, e = !1) {
181
- const { exception: s } = t;
182
- if (s)
183
- return typeof s == "string" ? { reason: s } : {
184
- reason: s.systemMessage
185
- };
186
- if (e)
187
- return L('"exception" is required for this event', t), {
188
- reason: b
189
- };
190
- }
191
- function w(t) {
192
- const { form: e } = t;
193
- return e ? {
194
- id: e.id,
195
- title: e.title
196
- } : (L('"form" is required for this event', t), {
197
- id: b,
198
- title: b
199
- });
200
- }
201
- function qn(t) {
202
- const { modal: e } = t;
203
- return e ? {
204
- id: e.id,
205
- title: e.title
206
- } : (L('"modal" is required for this event', t), {
207
- id: b,
208
- title: b
209
- });
210
- }
211
- function P(t, e = 300) {
212
- let s;
213
- return function(...i) {
214
- clearTimeout(s), s = setTimeout(() => t.apply(this, i), e);
215
- };
216
- }
217
- function h(t) {
218
- if (typeof t == "number")
219
- return t;
220
- if (typeof t != "string")
221
- return;
222
- const e = parseFloat(t);
223
- if (!isNaN(e))
224
- return e;
225
- }
226
- function Wt() {
227
- if (!X() || !jt())
228
- return null;
229
- const t = "_ga=", e = document.cookie ? document.cookie.split(";") : [];
230
- for (const s of e) {
231
- const i = s.trim();
232
- if (i.startsWith(t)) {
233
- const o = i.substring(t.length).split(".");
234
- if (o.length > 2)
235
- return o.slice(2).join(".");
236
- }
237
- }
238
- }
239
- function Mt(t) {
240
- const e = [];
241
- return t.trackErrors && ($(), e.push(qt())), t.trackVitals && ($(), e.push(Ft())), t.trackPerformance && ($(), e.push(Ht())), (t.trackButtonClickAllowList || t.trackButtonClickFilter) && e.push(Yt()), e;
242
- }
243
- function Gt(t) {
244
- t.trackActivity && !t.trackActivityCallback && ($(), Vt({
245
- minimumVisitLength: 30,
246
- heartbeatDelay: 10
247
- })), t.trackActivity && t.trackActivityCallback && ($(), St({
248
- minimumVisitLength: 30,
249
- heartbeatDelay: 10,
250
- callback: t.trackActivityCallback
251
- })), (t.trackButtonClickAllowList || t.trackButtonClickFilter) && ($(), Bt({
252
- filter: t.trackButtonClickAllowList ? {
253
- allowlist: t.trackButtonClickAllowList
254
- } : t.trackButtonClickFilter
255
- })), t.trackErrors && ($(), At());
256
- }
257
- function An({
258
- organizationId: t,
259
- projectId: e,
260
- cvlyX: s,
261
- collectorUrl: i = "evnts.pckd.dev",
262
- appId: a = "picked-analytics",
263
- trackVitals: o = !0,
264
- trackPerformance: r = !0,
265
- trackWebPage: c = !0,
266
- trackSessions: m = !0,
267
- trackBrowser: C = !0,
268
- trackActivity: kt = !0,
269
- trackErrors: $t = !0,
270
- trackActivityCallback: gt,
271
- trackButtonClickAllowList: Lt
272
- }) {
273
- $();
274
- const W = {
275
- trackVitals: o,
276
- trackErrors: $t,
277
- trackActivity: kt,
278
- trackPerformance: r,
279
- trackActivityCallback: gt,
280
- trackButtonClickAllowList: Lt
281
- }, yt = {
282
- appId: a,
283
- platform: "web",
284
- contexts: {
285
- webPage: c,
286
- session: m,
287
- browser: C || !1
288
- },
289
- plugins: Mt(W)
290
- }, ht = wt(a, i, yt);
291
- return Ut({
292
- organizationId: t,
293
- projectId: e,
294
- cvlyX: s
295
- }), Gt(W), ht;
296
- }
297
- function Ut({ organizationId: t, projectId: e, cvlyX: s }) {
298
- if (!t || !e)
299
- throw new Error("bindGlobalContext: Both organizationId and projectId are required");
300
- const i = [];
301
- i.push(
302
- n("app", "1-0-0", {
303
- organization_id: t,
304
- project_id: e
305
- })
306
- ), s && i.push(
307
- n("cvly_x", "1-0-1", {
308
- vercel_deployment_id: s.vercelDeploymentId,
309
- vercel_env: s.vercelEnv,
310
- vercel_url: s.vercelUrl
311
- })
312
- ), Pt(i);
313
- }
314
- const tt = "app_close";
315
- function zt(t, e) {
316
- const s = f(t), i = d(t), a = p(t), o = x(t);
317
- return l(
318
- tt,
319
- [
320
- n("feature_list", "2-0-0", s),
321
- n("session", "1-0-2", i),
322
- o ? n("step", "1-0-0", o) : void 0,
323
- a ? n("experience", "1-0-1", a) : void 0
324
- ],
325
- e
326
- );
327
- }
328
- const Fn = u(tt, zt), et = "app_load";
329
- function It(t, e) {
330
- const s = f(t), i = d(t), a = p(t), o = x(t);
331
- return l(
332
- et,
333
- [
334
- n("feature_list", "2-0-0", s),
335
- n("session", "1-0-2", i),
336
- o ? n("step", "1-0-0", o) : void 0,
337
- a ? n("experience", "1-0-1", a) : void 0
338
- ],
339
- e
340
- );
341
- }
342
- const Rn = u(et, It), nt = "app_open";
343
- function Kt(t, e) {
344
- const s = f(t), i = d(t), a = p(t), o = x(t);
345
- return l(
346
- nt,
347
- [
348
- n("feature_list", "2-0-0", s),
349
- n("session", "1-0-2", i),
350
- o ? n("step", "1-0-0", o) : void 0,
351
- a ? n("experience", "1-0-1", a) : void 0
352
- ],
353
- e
354
- );
355
- }
356
- const jn = u(nt, Kt), st = "experience_load";
357
- function Xt(t, e) {
358
- const s = f(t), i = d(t), a = p(t, !0), o = x(t);
359
- return l(
360
- st,
361
- [
362
- n("feature_list", "2-0-0", s),
363
- n("session", "1-0-2", i),
364
- n("experience", "1-0-1", a),
365
- o ? n("step", "1-0-0", o) : void 0
366
- ],
367
- e
368
- );
369
- }
370
- const On = u(st, Xt), ot = "field_validation_error";
371
- function Jt(t, e) {
372
- const s = f(t), i = d(t), a = w(t), o = Z(t, !0), r = p(t), c = x(t);
373
- return l(
374
- ot,
375
- [
376
- n("feature_list", "2-0-0", s),
377
- n("session", "1-0-2", i),
378
- n("exception", "1-0-0", o),
379
- n("form", "1-0-0", a),
380
- r && n("experience", "1-0-1", r),
381
- c && n("step", "1-0-0", c)
382
- ],
383
- e
384
- );
385
- }
386
- const Wn = u(ot, Jt), at = "form_submit";
387
- function Qt(t, e) {
388
- const s = f(t), i = d(t), a = w(t), o = p(t), r = x(t);
389
- return l(
390
- at,
391
- [
392
- n("feature_list", "2-0-0", s),
393
- n("session", "1-0-2", i),
394
- n("form", "1-0-0", a),
395
- o && n("experience", "1-0-1", o),
396
- r && n("step", "1-0-0", r)
397
- ],
398
- e
399
- );
400
- }
401
- const Mn = u(at, Qt), it = "form_submit_error";
402
- function Zt(t, e) {
403
- const s = f(t), i = d(t), a = w(t), o = Z(t, !0), r = p(t), c = x(t);
404
- return l(
405
- it,
406
- [
407
- n("feature_list", "2-0-0", s),
408
- n("session", "1-0-2", i),
409
- n("form", "1-0-0", a),
410
- n("exception", "1-0-0", o),
411
- r && n("experience", "1-0-1", r),
412
- c && n("step", "1-0-0", c)
413
- ],
414
- e
415
- );
416
- }
417
- const Gn = u(it, Zt), rt = "form_submit_success";
418
- function te(t, e) {
419
- const s = f(t), i = d(t), a = w(t), o = p(t), r = x(t);
420
- return l(
421
- rt,
422
- [
423
- n("feature_list", "2-0-0", s),
424
- n("session", "1-0-2", i),
425
- n("form", "1-0-0", a),
426
- o && n("experience", "1-0-1", o),
427
- r && n("step", "1-0-0", r)
428
- ],
429
- e
430
- );
431
- }
432
- const Un = u(rt, te), ct = "step_enter";
433
- function ee(t, e) {
434
- const s = f(t), i = d(t), a = p(t), o = x(t, !0), r = O(t);
435
- return l(
436
- ct,
437
- [
438
- n("feature_list", "2-0-0", s),
439
- n("session", "1-0-2", i),
440
- n("step", "1-0-0", o),
441
- r && n("field_list", "1-0-0", r),
442
- a && n("experience", "1-0-1", a)
443
- ],
444
- e
445
- );
446
- }
447
- const zn = u(ct, ee), lt = "step_submit";
448
- function ne(t, e) {
449
- const s = f(t), i = d(t), a = p(t), o = x(t, !0), r = Q(t), c = O(t);
450
- return l(
451
- lt,
452
- [
453
- n("feature_list", "2-0-0", s),
454
- n("session", "1-0-2", i),
455
- n("step", "1-0-0", o),
456
- c && n("field_list", "1-0-0", c),
457
- r && n("response_list", "1-0-0", r),
458
- a && n("experience", "1-0-1", a)
459
- ],
460
- e
461
- );
462
- }
463
- const In = u(lt, ne), ut = "step_submit_success";
464
- function se(t, e) {
465
- const s = f(t), i = d(t), a = p(t), o = x(t, !0), r = O(t), c = Q(t);
466
- return l(
467
- ut,
468
- [
469
- n("feature_list", "2-0-0", s),
470
- n("session", "1-0-2", i),
471
- n("step", "1-0-0", o),
472
- r && n("field_list", "1-0-0", r),
473
- c && n("response_list", "1-0-0", c),
474
- a && n("experience", "1-0-1", a)
475
- ],
476
- e
477
- );
478
- }
479
- const Kn = u(ut, se), ft = "feature_decide";
480
- function oe(t, e) {
481
- const s = f(t), i = d(t), a = p(t), o = x(t);
482
- return l(
483
- ft,
484
- [
485
- n("feature_list", "2-0-0", s),
486
- n("session", "1-0-2", i),
487
- o ? n("step", "1-0-0", o) : void 0,
488
- a ? n("experience", "1-0-1", a) : void 0
489
- ],
490
- e
491
- );
492
- }
493
- const Xn = u(ft, oe);
494
- function _(t) {
495
- return t instanceof Element;
496
- }
497
- function T(t) {
498
- const e = [
499
- "a",
500
- "button",
501
- "input",
502
- "select",
503
- "textarea",
504
- "details",
505
- "summary",
506
- "label",
507
- "form",
508
- "fieldset",
509
- "legend",
510
- "optgroup",
511
- "option",
512
- "output",
513
- "datalist",
514
- "dialog",
515
- "menu",
516
- "menuitem",
517
- "iframe",
518
- "audio",
519
- "video",
520
- "embed",
521
- "object",
522
- "canvas"
523
- ].join(", ");
524
- return _(t) ? t.matches(e) ? t : t.closest(e) : null;
525
- }
526
- function v(t) {
527
- if (t instanceof HTMLSelectElement) {
528
- const e = t.selectedIndex || 0, s = t.options[e];
529
- return (s == null ? void 0 : s.text) ?? "";
530
- }
531
- return "innerText" in t && typeof t.innerText == "string" ? t.innerText : t.textContent;
532
- }
533
- function k(t) {
534
- const e = t.getAttribute("aria-label");
535
- if (e)
536
- return e;
537
- const s = t.getAttribute("aria-labelledby");
538
- if (s) {
539
- const a = document.getElementById(s);
540
- if (a) {
541
- const o = v(a);
542
- if (o)
543
- return o;
544
- }
545
- }
546
- if ("id" in t && t.id) {
547
- const a = document.querySelector(`label[for="${t.id}"]`);
548
- if (a) {
549
- const o = v(a);
550
- if (o)
551
- return o;
552
- }
553
- }
554
- let i = t.parentElement;
555
- for (; i; ) {
556
- if (i.tagName.toLowerCase() === "label") {
557
- const a = v(i);
558
- if (a)
559
- return a;
560
- }
561
- i = i.parentElement;
562
- }
563
- if (t instanceof HTMLInputElement && "labels" in t && t.labels) {
564
- const a = Array.from(t.labels).map((o) => v(o)).filter(Boolean).join(" ");
565
- if (a)
566
- return a;
567
- }
568
- return "placeholder" in t && typeof t.placeholder == "string" ? t.placeholder : null;
569
- }
570
- const ae = 255;
571
- function E(t) {
572
- return t ? t.slice(0, ae) : null;
573
- }
574
- const S = "rapid_scroll";
575
- function ie(t, e) {
576
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
577
- if (!_(r)) {
578
- const C = {
579
- node_type: "unknown"
580
- };
581
- return l(
582
- S,
583
- [
584
- n("feature_list", "2-0-0", s),
585
- n("session", "1-0-2", i),
586
- o ? n("step", "1-0-0", o) : void 0,
587
- a ? n("experience", "1-0-1", a) : void 0,
588
- n("element", "1-0-0", C)
589
- ],
590
- e
591
- );
592
- }
593
- const c = T(r) || r, m = {
594
- id: c.id || null,
595
- node_type: c.nodeName.toLowerCase(),
596
- label: E(k(c)),
597
- text: E(v(c))
598
- };
599
- return l(
600
- S,
601
- [
602
- n("feature_list", "2-0-0", s),
603
- n("session", "1-0-2", i),
604
- o ? n("step", "1-0-0", o) : void 0,
605
- a ? n("experience", "1-0-1", a) : void 0,
606
- n("element", "1-0-0", m)
607
- ],
608
- e
609
- );
610
- }
611
- const re = u(S, ie), ce = 100, le = 100, ue = 300;
612
- let M = 0, G = 0;
613
- const fe = P(
614
- (t, e) => {
615
- re(t, e);
616
- },
617
- ue
618
- );
619
- function de(t, e) {
620
- const s = t.event.target || document.documentElement;
621
- if (!(s instanceof HTMLElement))
622
- return;
623
- const i = s.scrollTop, a = Date.now() - G;
624
- Math.abs(i - M) > ce && a < le && fe(t.event, e), M = i, G = Date.now();
625
- }
626
- const xe = D("scroll", de, !0), Y = "rapid_click";
627
- function pe(t, e) {
628
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
629
- if (!_(r)) {
630
- const C = {
631
- node_type: "unknown"
632
- };
633
- return l(
634
- Y,
635
- [
636
- n("feature_list", "2-0-0", s),
637
- n("session", "1-0-2", i),
638
- n("element", "1-0-0", C),
639
- o ? n("step", "1-0-0", o) : void 0,
640
- a ? n("experience", "1-0-1", a) : void 0
641
- ],
642
- e
643
- );
644
- }
645
- const c = T(r) || r, m = {
646
- id: c.id || null,
647
- node_type: c.nodeName.toLowerCase(),
648
- label: E(k(c)),
649
- text: E(v(c))
650
- };
651
- return l(
652
- Y,
653
- [
654
- n("feature_list", "2-0-0", s),
655
- n("session", "1-0-2", i),
656
- n("element", "1-0-0", m),
657
- o ? n("step", "1-0-0", o) : void 0,
658
- a ? n("experience", "1-0-1", a) : void 0
659
- ],
660
- e
661
- );
662
- }
663
- const me = u(Y, pe);
664
- let N = 0, U = 0;
665
- const Ee = 3, Ce = 500;
666
- function ve(t, e) {
667
- const s = (/* @__PURE__ */ new Date()).getTime();
668
- s - U < Ce ? N++ : N = 1, U = s, N >= Ee && (me(t, e), N = 0);
669
- }
670
- const De = D("click", ve), B = "right_click";
671
- function _e(t, e) {
672
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
673
- if (!_(r)) {
674
- const C = {
675
- node_type: "unknown"
676
- };
677
- return l(B, [
678
- n("feature_list", "2-0-0", s),
679
- n("session", "1-0-2", i),
680
- n("element", "1-0-0", C),
681
- o ? n("step", "1-0-0", o) : void 0,
682
- a ? n("experience", "1-0-1", a) : void 0
683
- ]);
684
- }
685
- const c = T(r) || r, m = {
686
- id: c.id || null,
687
- node_type: c.nodeName.toLowerCase(),
688
- label: E(k(c)),
689
- text: E(v(c))
690
- };
691
- return l(
692
- B,
693
- [
694
- n("feature_list", "2-0-0", s),
695
- n("session", "1-0-2", i),
696
- n("element", "1-0-0", m),
697
- o ? n("step", "1-0-0", o) : void 0,
698
- a ? n("experience", "1-0-1", a) : void 0
699
- ],
700
- e
701
- );
702
- }
703
- const be = u(B, _e);
704
- function Te(t, e) {
705
- be(t, e);
706
- }
707
- const ke = D("contextmenu", Te), dt = "mouse_shake";
708
- function $e(t, e) {
709
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
710
- return l(
711
- dt,
712
- [
713
- n("feature_list", "2-0-0", s),
714
- n("session", "1-0-2", i),
715
- o ? n("step", "1-0-0", o) : void 0,
716
- a ? n("experience", "1-0-1", a) : void 0
717
- ],
718
- e
719
- );
720
- }
721
- const ge = u(dt, $e), Le = 5, ye = 500, he = 500;
722
- let z = { x: 0 }, g = [], I = 0;
723
- const Ne = P(
724
- (t, e) => {
725
- ge(t, e);
726
- },
727
- ye
728
- );
729
- function we(t, e) {
730
- const s = Date.now(), i = t.event.clientX - z.x, a = Math.sign(i);
731
- s - I > he && (g = []), a !== 0 && (g.length === 0 || g[g.length - 1] !== a) && g.push(a), z = { x: t.event.clientX, y: t.event.clientY }, g.length >= Le && (Ne(t, e), g = []), I = s;
732
- }
733
- const Pe = D("mousemove", we), xt = "page_visible";
734
- function Ve(t, e) {
735
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
736
- return l(
737
- xt,
738
- [
739
- n("feature_list", "2-0-0", s),
740
- n("session", "1-0-2", i),
741
- o ? n("step", "1-0-0", o) : void 0,
742
- a ? n("experience", "1-0-1", a) : void 0
743
- ],
744
- e
745
- );
746
- }
747
- const Se = u(xt, Ve), pt = "page_hidden";
748
- function Ye(t, e) {
749
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
750
- return l(
751
- pt,
752
- [
753
- n("feature_list", "2-0-0", s),
754
- n("session", "1-0-2", i),
755
- o ? n("step", "1-0-0", o) : void 0,
756
- a ? n("experience", "1-0-1", a) : void 0
757
- ],
758
- e
759
- );
760
- }
761
- const Be = u(pt, Ye);
762
- function He(t, e) {
763
- if (document.visibilityState === "visible") {
764
- Se(t, e);
765
- return;
766
- }
767
- Be(t, e);
768
- }
769
- const qe = Ot("visibilitychange", He), H = "backspace";
770
- function Ae(t, e) {
771
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
772
- if (!_(r)) {
773
- const C = {
774
- node_type: "unknown"
775
- };
776
- return l(
777
- H,
778
- [
779
- n("feature_list", "2-0-0", s),
780
- n("session", "1-0-2", i),
781
- n("element", "1-0-0", C),
782
- o ? n("step", "1-0-0", o) : void 0,
783
- a ? n("experience", "1-0-1", a) : void 0
784
- ],
785
- e
786
- );
787
- }
788
- const c = T(r) || r, m = {
789
- id: c.id || null,
790
- node_type: c.nodeName.toLowerCase(),
791
- label: E(k(c)),
792
- text: E(v(c))
793
- };
794
- return l(
795
- H,
796
- [
797
- n("feature_list", "2-0-0", s),
798
- n("session", "1-0-2", i),
799
- n("element", "1-0-0", m),
800
- o ? n("step", "1-0-0", o) : void 0,
801
- a ? n("experience", "1-0-1", a) : void 0
802
- ],
803
- e
804
- );
805
- }
806
- const Fe = u(H, Ae);
807
- function Re(t, e) {
808
- t.event.key === "Backspace" && Fe(t, e);
809
- }
810
- const je = D("keydown", Re), mt = "page_hide";
811
- function Oe(t, e) {
812
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
813
- return l(
814
- mt,
815
- [
816
- n("feature_list", "2-0-0", s),
817
- n("session", "1-0-2", i),
818
- o ? n("step", "1-0-0", o) : void 0,
819
- a ? n("experience", "1-0-1", a) : void 0
820
- ],
821
- e
822
- );
823
- }
824
- const We = u(mt, Oe);
825
- function Me(t, e) {
826
- We(t, e);
827
- }
828
- const Ge = y("pagehide", Me), Et = "page_show";
829
- function Ue(t, e) {
830
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
831
- return l(
832
- Et,
833
- [
834
- n("feature_list", "2-0-0", s),
835
- n("session", "1-0-2", i),
836
- o ? n("step", "1-0-0", o) : void 0,
837
- a ? n("experience", "1-0-1", a) : void 0
838
- ],
839
- e
840
- );
841
- }
842
- const ze = u(Et, Ue);
843
- function Ie(t, e) {
844
- ze(t, e);
845
- }
846
- const Ke = y("pageshow", Ie), Ct = "offline";
847
- function Xe(t, e) {
848
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
849
- return l(
850
- Ct,
851
- [
852
- n("feature_list", "2-0-0", s),
853
- n("session", "1-0-2", i),
854
- o ? n("step", "1-0-0", o) : void 0,
855
- a ? n("experience", "1-0-1", a) : void 0
856
- ],
857
- e
858
- );
859
- }
860
- const Je = u(Ct, Xe);
861
- function Qe(t, e) {
862
- Je(t, e);
863
- }
864
- const Ze = y("offline", Qe), q = "scroll";
865
- function tn(t, e) {
866
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
867
- if (!_(r))
868
- return l(
869
- q,
870
- [
871
- n("feature_list", "2-0-0", s),
872
- n("session", "1-0-2", i),
873
- o ? n("step", "1-0-0", o) : void 0,
874
- a ? n("experience", "1-0-1", a) : void 0
875
- ],
876
- e
877
- );
878
- const c = T(r) || r, m = {
879
- id: c.id || null,
880
- node_type: c.nodeName.toLowerCase(),
881
- label: E(k(c)),
882
- text: E(v(c))
883
- };
884
- return l(
885
- q,
886
- [
887
- n("feature_list", "2-0-0", s),
888
- n("session", "1-0-2", i),
889
- o ? n("step", "1-0-0", o) : void 0,
890
- a ? n("experience", "1-0-1", a) : void 0,
891
- n("element", "1-0-0", m)
892
- ],
893
- e
894
- );
895
- }
896
- const en = u(q, tn), nn = P(
897
- (t, e) => {
898
- en(t, e);
899
- },
900
- 500
901
- ), sn = D("scroll", nn, !0), vt = "online";
902
- function on(t, e) {
903
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
904
- return l(
905
- vt,
906
- [
907
- n("feature_list", "2-0-0", s),
908
- n("session", "1-0-2", i),
909
- o ? n("step", "1-0-0", o) : void 0,
910
- a ? n("experience", "1-0-1", a) : void 0
911
- ],
912
- e
913
- );
914
- }
915
- const an = u(vt, on);
916
- function rn(t, e) {
917
- an(t, e);
918
- }
919
- const cn = y("online", rn), Dt = "resize";
920
- function ln(t, e) {
921
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
922
- return l(
923
- Dt,
924
- [
925
- n("feature_list", "2-0-0", s),
926
- n("session", "1-0-2", i),
927
- o ? n("step", "1-0-0", o) : void 0,
928
- a ? n("experience", "1-0-1", a) : void 0
929
- ],
930
- e
931
- );
932
- }
933
- const K = u(Dt, ln);
934
- let V = 0;
935
- const un = P(
936
- (t, e) => {
937
- const s = window.innerWidth;
938
- s !== V ? (K(t, e), V = s) : "ontouchstart" in window || K(t, e), V = s;
939
- },
940
- 300
941
- ), fn = y("resize", un), _t = "unload";
942
- function dn(t, e) {
943
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext);
944
- return l(
945
- _t,
946
- [
947
- n("feature_list", "2-0-0", s),
948
- n("session", "1-0-2", i),
949
- o ? n("step", "1-0-0", o) : void 0,
950
- a ? n("experience", "1-0-1", a) : void 0
951
- ],
952
- e
953
- );
954
- }
955
- const xn = u(_t, dn);
956
- function pn(t, e) {
957
- xn(t, e);
958
- }
959
- const mn = y("unload", pn), A = "click";
960
- function En(t, e) {
961
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
962
- if (!_(r)) {
963
- const C = {
964
- node_type: "unknown"
965
- };
966
- return l(
967
- A,
968
- [
969
- n("feature_list", "2-0-0", s),
970
- n("session", "1-0-2", i),
971
- n("element", "1-0-0", C),
972
- o ? n("step", "1-0-0", o) : void 0,
973
- a ? n("experience", "1-0-1", a) : void 0
974
- ],
975
- e
976
- );
977
- }
978
- const c = T(r) || r, m = {
979
- id: c.id || null,
980
- node_type: c.nodeName.toLowerCase(),
981
- label: E(k(c)),
982
- text: E(v(c))
983
- };
984
- return l(
985
- A,
986
- [
987
- n("feature_list", "2-0-0", s),
988
- n("session", "1-0-2", i),
989
- n("element", "1-0-0", m),
990
- o ? n("step", "1-0-0", o) : void 0,
991
- a ? n("experience", "1-0-1", a) : void 0
992
- ],
993
- e
994
- );
995
- }
996
- const Cn = u(A, En);
997
- function vn(t, e) {
998
- Cn(t, e);
999
- }
1000
- const Dn = D("click", vn), F = "paste";
1001
- function _n(t, e) {
1002
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
1003
- if (!_(r))
1004
- return l(
1005
- F,
1006
- [
1007
- n("feature_list", "2-0-0", s),
1008
- n("session", "1-0-2", i),
1009
- o ? n("step", "1-0-0", o) : void 0,
1010
- a ? n("experience", "1-0-1", a) : void 0
1011
- ],
1012
- e
1013
- );
1014
- const c = T(r) || r, m = {
1015
- id: c.id || null,
1016
- node_type: c.nodeName.toLowerCase(),
1017
- label: E(k(c)),
1018
- text: E(v(c))
1019
- };
1020
- return l(
1021
- F,
1022
- [
1023
- n("feature_list", "2-0-0", s),
1024
- n("session", "1-0-2", i),
1025
- o ? n("step", "1-0-0", o) : void 0,
1026
- a ? n("experience", "1-0-1", a) : void 0,
1027
- n("element", "1-0-0", m)
1028
- ],
1029
- e
1030
- );
1031
- }
1032
- const bn = u(F, _n);
1033
- function Tn(t, e) {
1034
- bn(t, e);
1035
- }
1036
- const kn = D("paste", Tn), R = "copy";
1037
- function $n(t, e) {
1038
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
1039
- if (!_(r))
1040
- return l(
1041
- R,
1042
- [
1043
- n("feature_list", "2-0-0", s),
1044
- n("session", "1-0-2", i),
1045
- o ? n("step", "1-0-0", o) : void 0,
1046
- a ? n("experience", "1-0-1", a) : void 0
1047
- ],
1048
- e
1049
- );
1050
- const c = T(r) || r, m = {
1051
- id: c.id || null,
1052
- node_type: c.nodeName.toLowerCase(),
1053
- label: E(k(c)),
1054
- text: E(v(c))
1055
- };
1056
- return l(
1057
- R,
1058
- [
1059
- n("feature_list", "2-0-0", s),
1060
- n("session", "1-0-2", i),
1061
- o ? n("step", "1-0-0", o) : void 0,
1062
- a ? n("experience", "1-0-1", a) : void 0,
1063
- n("element", "1-0-0", m)
1064
- ],
1065
- e
1066
- );
1067
- }
1068
- const gn = u(R, $n);
1069
- function Ln(t, e) {
1070
- gn(t, e);
1071
- }
1072
- const yn = D("copy", Ln), j = "drag";
1073
- function hn(t, e) {
1074
- const s = f(t.analyticsContext), i = d(t.analyticsContext), a = p(t.analyticsContext), o = x(t.analyticsContext), r = t.event.target || document.activeElement || t.event.currentTarget;
1075
- if (!_(r))
1076
- return l(
1077
- j,
1078
- [
1079
- n("feature_list", "2-0-0", s),
1080
- n("session", "1-0-2", i),
1081
- o ? n("step", "1-0-0", o) : void 0,
1082
- a ? n("experience", "1-0-1", a) : void 0
1083
- ],
1084
- e
1085
- );
1086
- const c = T(r) || r, m = {
1087
- id: c.id || null,
1088
- node_type: c.nodeName.toLowerCase(),
1089
- label: E(k(c)),
1090
- text: E(v(c))
1091
- };
1092
- return l(
1093
- j,
1094
- [
1095
- n("feature_list", "2-0-0", s),
1096
- n("session", "1-0-2", i),
1097
- o ? n("step", "1-0-0", o) : void 0,
1098
- a ? n("experience", "1-0-1", a) : void 0,
1099
- n("element", "1-0-0", m)
1100
- ],
1101
- e
1102
- );
1103
- }
1104
- const Nn = u(j, hn);
1105
- function bt(t, e) {
1106
- const s = t.event.currentTarget;
1107
- if (!s || !(s instanceof HTMLElement))
1108
- return;
1109
- function i(a) {
1110
- bt({ event: a, analyticsContext: t.analyticsContext });
1111
- }
1112
- s.removeEventListener("drag", i), s.addEventListener(
1113
- "dragend",
1114
- () => Tt(s, () => t.analyticsContext)
1115
- ), Nn(t, e);
1116
- }
1117
- const Tt = D("drag", bt);
1118
- function Jn(t, e) {
1119
- e && (Dn(e, t), De(e, t), ke(e, t), yn(e, t), kn(e, t), Tt(e, t), je(e, t), sn(e, t), xe(e, t), Pe(e, t));
1120
- }
1121
- function Qn(t) {
1122
- qe(t), Ge(t), Ke(t), Ze(t), cn(t), fn(t), mn(t);
1123
- }
1124
- export {
1125
- Xn as A,
1126
- d as a,
1127
- Hn as b,
1128
- u as c,
1129
- p as d,
1130
- x as e,
1131
- f,
1132
- l as g,
1133
- n as h,
1134
- qn as i,
1135
- Q as j,
1136
- O as k,
1137
- Z as l,
1138
- An as m,
1139
- Jn as n,
1140
- Qn as o,
1141
- Rn as p,
1142
- jn as q,
1143
- On as r,
1144
- Wn as s,
1145
- Fn as t,
1146
- Mn as u,
1147
- Gn as v,
1148
- Un as w,
1149
- zn as x,
1150
- In as y,
1151
- Kn as z
1152
- };