@picked/analytics 0.0.42 → 0.0.43-next.1

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