@askdialog/dialog-vue 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/dialog-vue.css +1 -0
- package/dist/dialog-vue.js +4522 -0
- package/dist/dialog-vue.umd.cjs +22 -0
- package/dist/vite.svg +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,4522 @@
|
|
|
1
|
+
import { defineComponent as vt, createElementBlock as ct, openBlock as Ce, createElementVNode as ne, toDisplayString as Ni, Fragment as en, renderList as go, createVNode as Bi, createBlock as Hi, onMounted as tn, watch as vo, renderSlot as fo, ref as Ar, computed as Dr, withCtx as mo } from "vue";
|
|
2
|
+
var qr;
|
|
3
|
+
(function(r) {
|
|
4
|
+
r.OPEN_ASSISTANT = "open_assistant", r.CLOSE_ASSISTANT = "close_assistant", r.SEND_MESSAGE = "PRODUCT_QUESTION", r.SEND_GENERIC_QUESTION = "GENERIC_QUESTION";
|
|
5
|
+
})(qr || (qr = {}));
|
|
6
|
+
var _e, g = typeof window < "u" ? window : void 0, ie = typeof globalThis < "u" ? globalThis : g, rn = Array.prototype, Nr = rn.forEach, Br = rn.indexOf, oe = ie == null ? void 0 : ie.navigator, S = ie == null ? void 0 : ie.document, te = ie == null ? void 0 : ie.location, Ui = ie == null ? void 0 : ie.fetch, ji = ie != null && ie.XMLHttpRequest && "withCredentials" in new ie.XMLHttpRequest() ? ie.XMLHttpRequest : void 0, Hr = ie == null ? void 0 : ie.AbortController, j = oe == null ? void 0 : oe.userAgent, C = g ?? {}, Ie = { DEBUG: !1, LIB_VERSION: "1.235.3" }, yi = "$copy_autocapture", yo = ["$snapshot", "$pageview", "$pageleave", "$set", "survey dismissed", "survey sent", "survey shown", "$identify", "$groupidentify", "$create_alias", "$$client_ingestion_warning", "$web_experiment_applied", "$feature_enrollment_update", "$feature_flag_called"];
|
|
7
|
+
(function(r) {
|
|
8
|
+
r.GZipJS = "gzip-js", r.Base64 = "base64";
|
|
9
|
+
})(_e || (_e = {}));
|
|
10
|
+
var bo = ["fatal", "error", "warning", "log", "info", "debug"];
|
|
11
|
+
function T(r, e) {
|
|
12
|
+
return r.indexOf(e) !== -1;
|
|
13
|
+
}
|
|
14
|
+
var hi = function(r) {
|
|
15
|
+
return r.trim();
|
|
16
|
+
}, br = function(r) {
|
|
17
|
+
return r.replace(/^\$/, "");
|
|
18
|
+
}, wo = Array.isArray, sn = Object.prototype, nn = sn.hasOwnProperty, pi = sn.toString, q = wo || function(r) {
|
|
19
|
+
return pi.call(r) === "[object Array]";
|
|
20
|
+
}, ge = (r) => typeof r == "function", N = (r) => r === Object(r) && !q(r), st = (r) => {
|
|
21
|
+
if (N(r)) {
|
|
22
|
+
for (var e in r) if (nn.call(r, e)) return !1;
|
|
23
|
+
return !0;
|
|
24
|
+
}
|
|
25
|
+
return !1;
|
|
26
|
+
}, k = (r) => r === void 0, z = (r) => pi.call(r) == "[object String]", zi = (r) => z(r) && r.trim().length === 0, He = (r) => r === null, R = (r) => k(r) || He(r), ee = (r) => pi.call(r) == "[object Number]", Ae = (r) => pi.call(r) === "[object Boolean]", ko = (r) => r instanceof FormData, So = (r) => T(yo, r), on = (r) => {
|
|
27
|
+
var e = { _log: function(t) {
|
|
28
|
+
if (g && (Ie.DEBUG || C.POSTHOG_DEBUG) && !k(g.console) && g.console) {
|
|
29
|
+
for (var i = ("__rrweb_original__" in g.console[t]) ? g.console[t].__rrweb_original__ : g.console[t], s = arguments.length, n = new Array(s > 1 ? s - 1 : 0), o = 1; o < s; o++) n[o - 1] = arguments[o];
|
|
30
|
+
i(r, ...n);
|
|
31
|
+
}
|
|
32
|
+
}, info: function() {
|
|
33
|
+
for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
|
|
34
|
+
e._log("log", ...i);
|
|
35
|
+
}, warn: function() {
|
|
36
|
+
for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
|
|
37
|
+
e._log("warn", ...i);
|
|
38
|
+
}, error: function() {
|
|
39
|
+
for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
|
|
40
|
+
e._log("error", ...i);
|
|
41
|
+
}, critical: function() {
|
|
42
|
+
for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
|
|
43
|
+
console.error(r, ...i);
|
|
44
|
+
}, uninitializedWarning: (t) => {
|
|
45
|
+
e.error("You must initialize PostHog before calling ".concat(t));
|
|
46
|
+
}, createLogger: (t) => on("".concat(r, " ").concat(t)) };
|
|
47
|
+
return e;
|
|
48
|
+
}, x = on("[PostHog.js]"), Q = x.createLogger, Eo = Q("[ExternalScriptsLoader]"), Ur = (r, e, t) => {
|
|
49
|
+
if (r.config.disable_external_dependency_loading) return Eo.warn("".concat(e, " was requested but loading of external scripts is disabled.")), t("Loading of external scripts is disabled");
|
|
50
|
+
var i = S == null ? void 0 : S.querySelectorAll("script");
|
|
51
|
+
if (i) {
|
|
52
|
+
for (var s = 0; s < i.length; s++) if (i[s].src === e) return t();
|
|
53
|
+
}
|
|
54
|
+
var n = () => {
|
|
55
|
+
if (!S) return t("document not found");
|
|
56
|
+
var o = S.createElement("script");
|
|
57
|
+
if (o.type = "text/javascript", o.crossOrigin = "anonymous", o.src = e, o.onload = (c) => t(void 0, c), o.onerror = (c) => t(c), r.config.prepare_external_dependency_script && (o = r.config.prepare_external_dependency_script(o)), !o) return t("prepare_external_dependency_script returned null");
|
|
58
|
+
var a, l = S.querySelectorAll("body > script");
|
|
59
|
+
l.length > 0 ? (a = l[0].parentNode) === null || a === void 0 || a.insertBefore(o, l[0]) : S.body.appendChild(o);
|
|
60
|
+
};
|
|
61
|
+
S != null && S.body ? n() : S == null || S.addEventListener("DOMContentLoaded", n);
|
|
62
|
+
};
|
|
63
|
+
function jr(r, e) {
|
|
64
|
+
var t = Object.keys(r);
|
|
65
|
+
if (Object.getOwnPropertySymbols) {
|
|
66
|
+
var i = Object.getOwnPropertySymbols(r);
|
|
67
|
+
e && (i = i.filter(function(s) {
|
|
68
|
+
return Object.getOwnPropertyDescriptor(r, s).enumerable;
|
|
69
|
+
})), t.push.apply(t, i);
|
|
70
|
+
}
|
|
71
|
+
return t;
|
|
72
|
+
}
|
|
73
|
+
function f(r) {
|
|
74
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
75
|
+
var t = arguments[e] != null ? arguments[e] : {};
|
|
76
|
+
e % 2 ? jr(Object(t), !0).forEach(function(i) {
|
|
77
|
+
w(r, i, t[i]);
|
|
78
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : jr(Object(t)).forEach(function(i) {
|
|
79
|
+
Object.defineProperty(r, i, Object.getOwnPropertyDescriptor(t, i));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return r;
|
|
83
|
+
}
|
|
84
|
+
function w(r, e, t) {
|
|
85
|
+
return e in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
86
|
+
}
|
|
87
|
+
function an(r, e) {
|
|
88
|
+
if (r == null) return {};
|
|
89
|
+
var t, i, s = function(o, a) {
|
|
90
|
+
if (o == null) return {};
|
|
91
|
+
var l, c, d = {}, u = Object.keys(o);
|
|
92
|
+
for (c = 0; c < u.length; c++) l = u[c], a.indexOf(l) >= 0 || (d[l] = o[l]);
|
|
93
|
+
return d;
|
|
94
|
+
}(r, e);
|
|
95
|
+
if (Object.getOwnPropertySymbols) {
|
|
96
|
+
var n = Object.getOwnPropertySymbols(r);
|
|
97
|
+
for (i = 0; i < n.length; i++) t = n[i], e.indexOf(t) >= 0 || Object.prototype.propertyIsEnumerable.call(r, t) && (s[t] = r[t]);
|
|
98
|
+
}
|
|
99
|
+
return s;
|
|
100
|
+
}
|
|
101
|
+
C.__PosthogExtensions__ = C.__PosthogExtensions__ || {}, C.__PosthogExtensions__.loadExternalDependency = (r, e, t) => {
|
|
102
|
+
var i = "/static/".concat(e, ".js") + "?v=".concat(r.version);
|
|
103
|
+
if (e === "remote-config" && (i = "/array/".concat(r.config.token, "/config.js")), e === "toolbar") {
|
|
104
|
+
var s = 3e5, n = Math.floor(Date.now() / s) * s;
|
|
105
|
+
i = "".concat(i, "&t=").concat(n);
|
|
106
|
+
}
|
|
107
|
+
var o = r.requestRouter.endpointFor("assets", i);
|
|
108
|
+
Ur(r, o, t);
|
|
109
|
+
}, C.__PosthogExtensions__.loadSiteApp = (r, e, t) => {
|
|
110
|
+
var i = r.requestRouter.endpointFor("api", e);
|
|
111
|
+
Ur(r, i, t);
|
|
112
|
+
};
|
|
113
|
+
var Xt = {};
|
|
114
|
+
function Ne(r, e, t) {
|
|
115
|
+
if (q(r)) {
|
|
116
|
+
if (Nr && r.forEach === Nr) r.forEach(e, t);
|
|
117
|
+
else if ("length" in r && r.length === +r.length) {
|
|
118
|
+
for (var i = 0, s = r.length; i < s; i++) if (i in r && e.call(t, r[i], i) === Xt) return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function $(r, e, t) {
|
|
123
|
+
if (!R(r)) {
|
|
124
|
+
if (q(r)) return Ne(r, e, t);
|
|
125
|
+
if (ko(r)) {
|
|
126
|
+
for (var i of r.entries()) if (e.call(t, i[1], i[0]) === Xt) return;
|
|
127
|
+
} else for (var s in r) if (nn.call(r, s) && e.call(t, r[s], s) === Xt) return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
var H = function(r) {
|
|
131
|
+
for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) t[i - 1] = arguments[i];
|
|
132
|
+
return Ne(t, function(s) {
|
|
133
|
+
for (var n in s) s[n] !== void 0 && (r[n] = s[n]);
|
|
134
|
+
}), r;
|
|
135
|
+
}, Gt = function(r) {
|
|
136
|
+
for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) t[i - 1] = arguments[i];
|
|
137
|
+
return Ne(t, function(s) {
|
|
138
|
+
Ne(s, function(n) {
|
|
139
|
+
r.push(n);
|
|
140
|
+
});
|
|
141
|
+
}), r;
|
|
142
|
+
};
|
|
143
|
+
function Jt(r) {
|
|
144
|
+
for (var e = Object.keys(r), t = e.length, i = new Array(t); t--; ) i[t] = [e[t], r[e[t]]];
|
|
145
|
+
return i;
|
|
146
|
+
}
|
|
147
|
+
var zr = function(r) {
|
|
148
|
+
try {
|
|
149
|
+
return r();
|
|
150
|
+
} catch {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}, xo = function(r) {
|
|
154
|
+
return function() {
|
|
155
|
+
try {
|
|
156
|
+
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
|
|
157
|
+
return r.apply(this, t);
|
|
158
|
+
} catch (s) {
|
|
159
|
+
x.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."), x.critical(s);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}, Rt = function(r) {
|
|
163
|
+
var e = {};
|
|
164
|
+
return $(r, function(t, i) {
|
|
165
|
+
z(t) && t.length > 0 && (e[i] = t);
|
|
166
|
+
}), e;
|
|
167
|
+
};
|
|
168
|
+
function Io(r, e) {
|
|
169
|
+
return t = r, i = (n) => z(n) && !He(e) ? n.slice(0, e) : n, s = /* @__PURE__ */ new Set(), function n(o, a) {
|
|
170
|
+
return o !== Object(o) ? i ? i(o, a) : o : s.has(o) ? void 0 : (s.add(o), q(o) ? (l = [], Ne(o, (c) => {
|
|
171
|
+
l.push(n(c));
|
|
172
|
+
})) : (l = {}, $(o, (c, d) => {
|
|
173
|
+
s.has(c) || (l[d] = n(c, d));
|
|
174
|
+
})), l);
|
|
175
|
+
var l;
|
|
176
|
+
}(t);
|
|
177
|
+
var t, i, s;
|
|
178
|
+
}
|
|
179
|
+
var Co = ["herokuapp.com", "vercel.app", "netlify.app"];
|
|
180
|
+
function Po(r) {
|
|
181
|
+
var e = r == null ? void 0 : r.hostname;
|
|
182
|
+
if (!z(e)) return !1;
|
|
183
|
+
var t = e.split(".").slice(-2).join(".");
|
|
184
|
+
for (var i of Co) if (t === i) return !1;
|
|
185
|
+
return !0;
|
|
186
|
+
}
|
|
187
|
+
function ln(r, e) {
|
|
188
|
+
for (var t = 0; t < r.length; t++) if (e(r[t])) return r[t];
|
|
189
|
+
}
|
|
190
|
+
function U(r, e, t, i) {
|
|
191
|
+
var { capture: s = !1, passive: n = !0 } = i ?? {};
|
|
192
|
+
r == null || r.addEventListener(e, t, { capture: s, passive: n });
|
|
193
|
+
}
|
|
194
|
+
var un = "$people_distinct_id", wt = "__alias", kt = "__timers", Wr = "$autocapture_disabled_server_side", Wi = "$heatmaps_enabled_server_side", Vr = "$exception_capture_enabled_server_side", Gr = "$web_vitals_enabled_server_side", cn = "$dead_clicks_enabled_server_side", Jr = "$web_vitals_allowed_metrics", Vi = "$session_recording_enabled_server_side", Yr = "$console_log_recording_enabled_server_side", Kr = "$session_recording_network_payload_capture", Qr = "$session_recording_masking", Zr = "$session_recording_canvas_recording", Xr = "$replay_sample_rate", es = "$replay_minimum_duration", ts = "$replay_script_config", ei = "$sesid", St = "$session_is_sampled", bi = "$session_recording_url_trigger_activated_session", wi = "$session_recording_event_trigger_activated_session", nt = "$enabled_feature_flags", Yt = "$early_access_features", Gi = "$feature_flag_details", Et = "$stored_person_properties", Ge = "$stored_group_properties", Ji = "$surveys", qt = "$surveys_activated", ti = "$flag_call_reported", Se = "$user_state", Yi = "$client_session_props", Ki = "$capture_rate_limit", Qi = "$initial_campaign_params", Zi = "$initial_referrer_info", Xi = "$initial_person_info", ii = "$epp", dn = "__POSTHOG_TOOLBAR__", is = "$posthog_cookieless", Fo = [un, wt, "__cmpns", kt, Vi, Wi, ei, nt, Se, Yt, Gi, Ge, Et, Ji, ti, Yi, Ki, Qi, Zi, ii];
|
|
195
|
+
function rs(r) {
|
|
196
|
+
var e;
|
|
197
|
+
return r instanceof Element && (r.id === dn || !((e = r.closest) === null || e === void 0 || !e.call(r, ".toolbar-global-fade-container")));
|
|
198
|
+
}
|
|
199
|
+
function _i(r) {
|
|
200
|
+
return !!r && r.nodeType === 1;
|
|
201
|
+
}
|
|
202
|
+
function Be(r, e) {
|
|
203
|
+
return !!r && !!r.tagName && r.tagName.toLowerCase() === e.toLowerCase();
|
|
204
|
+
}
|
|
205
|
+
function hn(r) {
|
|
206
|
+
return !!r && r.nodeType === 3;
|
|
207
|
+
}
|
|
208
|
+
function pn(r) {
|
|
209
|
+
return !!r && r.nodeType === 11;
|
|
210
|
+
}
|
|
211
|
+
function wr(r) {
|
|
212
|
+
return r ? hi(r).split(/\s+/) : [];
|
|
213
|
+
}
|
|
214
|
+
function ss(r) {
|
|
215
|
+
var e = g == null ? void 0 : g.location.href;
|
|
216
|
+
return !!(e && r && r.some((t) => e.match(t)));
|
|
217
|
+
}
|
|
218
|
+
function ri(r) {
|
|
219
|
+
var e = "";
|
|
220
|
+
switch (typeof r.className) {
|
|
221
|
+
case "string":
|
|
222
|
+
e = r.className;
|
|
223
|
+
break;
|
|
224
|
+
case "object":
|
|
225
|
+
e = (r.className && "baseVal" in r.className ? r.className.baseVal : null) || r.getAttribute("class") || "";
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
e = "";
|
|
229
|
+
}
|
|
230
|
+
return wr(e);
|
|
231
|
+
}
|
|
232
|
+
function _n(r) {
|
|
233
|
+
return R(r) ? null : hi(r).split(/(\s+)/).filter((e) => dt(e)).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255);
|
|
234
|
+
}
|
|
235
|
+
function gi(r) {
|
|
236
|
+
var e = "";
|
|
237
|
+
return tr(r) && !fn(r) && r.childNodes && r.childNodes.length && $(r.childNodes, function(t) {
|
|
238
|
+
var i;
|
|
239
|
+
hn(t) && t.textContent && (e += (i = _n(t.textContent)) !== null && i !== void 0 ? i : "");
|
|
240
|
+
}), hi(e);
|
|
241
|
+
}
|
|
242
|
+
function gn(r) {
|
|
243
|
+
return k(r.target) ? r.srcElement || null : (e = r.target) !== null && e !== void 0 && e.shadowRoot ? r.composedPath()[0] || null : r.target || null;
|
|
244
|
+
var e;
|
|
245
|
+
}
|
|
246
|
+
var er = ["a", "button", "form", "input", "select", "textarea", "label"];
|
|
247
|
+
function vn(r) {
|
|
248
|
+
var e = r.parentNode;
|
|
249
|
+
return !(!e || !_i(e)) && e;
|
|
250
|
+
}
|
|
251
|
+
function To(r, e) {
|
|
252
|
+
var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0, i = arguments.length > 3 ? arguments[3] : void 0, s = arguments.length > 4 ? arguments[4] : void 0;
|
|
253
|
+
if (!g || !r || Be(r, "html") || !_i(r) || t != null && t.url_allowlist && !ss(t.url_allowlist) || t != null && t.url_ignorelist && ss(t.url_ignorelist)) return !1;
|
|
254
|
+
if (t != null && t.dom_event_allowlist) {
|
|
255
|
+
var n = t.dom_event_allowlist;
|
|
256
|
+
if (n && !n.some((h) => e.type === h)) return !1;
|
|
257
|
+
}
|
|
258
|
+
for (var o = !1, a = [r], l = !0, c = r; c.parentNode && !Be(c, "body"); ) if (pn(c.parentNode)) a.push(c.parentNode.host), c = c.parentNode.host;
|
|
259
|
+
else {
|
|
260
|
+
if (!(l = vn(c))) break;
|
|
261
|
+
if (i || er.indexOf(l.tagName.toLowerCase()) > -1) o = !0;
|
|
262
|
+
else {
|
|
263
|
+
var d = g.getComputedStyle(l);
|
|
264
|
+
d && d.getPropertyValue("cursor") === "pointer" && (o = !0);
|
|
265
|
+
}
|
|
266
|
+
a.push(l), c = l;
|
|
267
|
+
}
|
|
268
|
+
if (!function(h, _) {
|
|
269
|
+
var v = _ == null ? void 0 : _.element_allowlist;
|
|
270
|
+
if (k(v)) return !0;
|
|
271
|
+
var b = function(E) {
|
|
272
|
+
if (v.some((I) => E.tagName.toLowerCase() === I)) return { v: !0 };
|
|
273
|
+
};
|
|
274
|
+
for (var m of h) {
|
|
275
|
+
var y = b(m);
|
|
276
|
+
if (typeof y == "object") return y.v;
|
|
277
|
+
}
|
|
278
|
+
return !1;
|
|
279
|
+
}(a, t) || !function(h, _) {
|
|
280
|
+
var v = _ == null ? void 0 : _.css_selector_allowlist;
|
|
281
|
+
if (k(v)) return !0;
|
|
282
|
+
var b = function(E) {
|
|
283
|
+
if (v.some((I) => E.matches(I))) return { v: !0 };
|
|
284
|
+
};
|
|
285
|
+
for (var m of h) {
|
|
286
|
+
var y = b(m);
|
|
287
|
+
if (typeof y == "object") return y.v;
|
|
288
|
+
}
|
|
289
|
+
return !1;
|
|
290
|
+
}(a, t)) return !1;
|
|
291
|
+
var u = g.getComputedStyle(r);
|
|
292
|
+
if (u && u.getPropertyValue("cursor") === "pointer" && e.type === "click") return !0;
|
|
293
|
+
var p = r.tagName.toLowerCase();
|
|
294
|
+
switch (p) {
|
|
295
|
+
case "html":
|
|
296
|
+
return !1;
|
|
297
|
+
case "form":
|
|
298
|
+
return (s || ["submit"]).indexOf(e.type) >= 0;
|
|
299
|
+
case "input":
|
|
300
|
+
case "select":
|
|
301
|
+
case "textarea":
|
|
302
|
+
return (s || ["change", "click"]).indexOf(e.type) >= 0;
|
|
303
|
+
default:
|
|
304
|
+
return o ? (s || ["click"]).indexOf(e.type) >= 0 : (s || ["click"]).indexOf(e.type) >= 0 && (er.indexOf(p) > -1 || r.getAttribute("contenteditable") === "true");
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function tr(r) {
|
|
308
|
+
for (var e = r; e.parentNode && !Be(e, "body"); e = e.parentNode) {
|
|
309
|
+
var t = ri(e);
|
|
310
|
+
if (T(t, "ph-sensitive") || T(t, "ph-no-capture")) return !1;
|
|
311
|
+
}
|
|
312
|
+
if (T(ri(r), "ph-include")) return !0;
|
|
313
|
+
var i = r.type || "";
|
|
314
|
+
if (z(i)) switch (i.toLowerCase()) {
|
|
315
|
+
case "hidden":
|
|
316
|
+
case "password":
|
|
317
|
+
return !1;
|
|
318
|
+
}
|
|
319
|
+
var s = r.name || r.id || "";
|
|
320
|
+
return !(z(s) && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g, "")));
|
|
321
|
+
}
|
|
322
|
+
function fn(r) {
|
|
323
|
+
return !!(Be(r, "input") && !["button", "checkbox", "submit", "reset"].includes(r.type) || Be(r, "select") || Be(r, "textarea") || r.getAttribute("contenteditable") === "true");
|
|
324
|
+
}
|
|
325
|
+
var mn = "(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})", Ro = new RegExp("^(?:".concat(mn, ")$")), $o = new RegExp(mn), yn = "\\d{3}-?\\d{2}-?\\d{4}", Oo = new RegExp("^(".concat(yn, ")$")), Lo = new RegExp("(".concat(yn, ")"));
|
|
326
|
+
function dt(r) {
|
|
327
|
+
var e = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
|
|
328
|
+
return !(R(r) || z(r) && (r = hi(r), (e ? Ro : $o).test((r || "").replace(/[- ]/g, "")) || (e ? Oo : Lo).test(r)));
|
|
329
|
+
}
|
|
330
|
+
function bn(r) {
|
|
331
|
+
var e = gi(r);
|
|
332
|
+
return dt(e = "".concat(e, " ").concat(wn(r)).trim()) ? e : "";
|
|
333
|
+
}
|
|
334
|
+
function wn(r) {
|
|
335
|
+
var e = "";
|
|
336
|
+
return r && r.childNodes && r.childNodes.length && $(r.childNodes, function(t) {
|
|
337
|
+
var i;
|
|
338
|
+
if (t && ((i = t.tagName) === null || i === void 0 ? void 0 : i.toLowerCase()) === "span") try {
|
|
339
|
+
var s = gi(t);
|
|
340
|
+
e = "".concat(e, " ").concat(s).trim(), t.childNodes && t.childNodes.length && (e = "".concat(e, " ").concat(wn(t)).trim());
|
|
341
|
+
} catch (n) {
|
|
342
|
+
x.error("[AutoCapture]", n);
|
|
343
|
+
}
|
|
344
|
+
}), e;
|
|
345
|
+
}
|
|
346
|
+
function Mo(r) {
|
|
347
|
+
return function(e) {
|
|
348
|
+
var t = e.map((i) => {
|
|
349
|
+
var s, n, o = "";
|
|
350
|
+
if (i.tag_name && (o += i.tag_name), i.attr_class) for (var a of (i.attr_class.sort(), i.attr_class)) o += ".".concat(a.replace(/"/g, ""));
|
|
351
|
+
var l = f(f(f(f({}, i.text ? { text: i.text } : {}), {}, { "nth-child": (s = i.nth_child) !== null && s !== void 0 ? s : 0, "nth-of-type": (n = i.nth_of_type) !== null && n !== void 0 ? n : 0 }, i.href ? { href: i.href } : {}), i.attr_id ? { attr_id: i.attr_id } : {}), i.attributes), c = {};
|
|
352
|
+
return Jt(l).sort((d, u) => {
|
|
353
|
+
var [p] = d, [h] = u;
|
|
354
|
+
return p.localeCompare(h);
|
|
355
|
+
}).forEach((d) => {
|
|
356
|
+
var [u, p] = d;
|
|
357
|
+
return c[ns(u.toString())] = ns(p.toString());
|
|
358
|
+
}), o += ":", o += Jt(l).map((d) => {
|
|
359
|
+
var [u, p] = d;
|
|
360
|
+
return "".concat(u, '="').concat(p, '"');
|
|
361
|
+
}).join("");
|
|
362
|
+
});
|
|
363
|
+
return t.join(";");
|
|
364
|
+
}(function(e) {
|
|
365
|
+
return e.map((t) => {
|
|
366
|
+
var i, s, n = { text: (i = t.$el_text) === null || i === void 0 ? void 0 : i.slice(0, 400), tag_name: t.tag_name, href: (s = t.attr__href) === null || s === void 0 ? void 0 : s.slice(0, 2048), attr_class: Ao(t), attr_id: t.attr__id, nth_child: t.nth_child, nth_of_type: t.nth_of_type, attributes: {} };
|
|
367
|
+
return Jt(t).filter((o) => {
|
|
368
|
+
var [a] = o;
|
|
369
|
+
return a.indexOf("attr__") === 0;
|
|
370
|
+
}).forEach((o) => {
|
|
371
|
+
var [a, l] = o;
|
|
372
|
+
return n.attributes[a] = l;
|
|
373
|
+
}), n;
|
|
374
|
+
});
|
|
375
|
+
}(r));
|
|
376
|
+
}
|
|
377
|
+
function ns(r) {
|
|
378
|
+
return r.replace(/"|\\"/g, '\\"');
|
|
379
|
+
}
|
|
380
|
+
function Ao(r) {
|
|
381
|
+
var e = r.attr__class;
|
|
382
|
+
return e ? q(e) ? e : wr(e) : void 0;
|
|
383
|
+
}
|
|
384
|
+
class kn {
|
|
385
|
+
constructor() {
|
|
386
|
+
this.clicks = [];
|
|
387
|
+
}
|
|
388
|
+
isRageClick(e, t, i) {
|
|
389
|
+
var s = this.clicks[this.clicks.length - 1];
|
|
390
|
+
if (s && Math.abs(e - s.x) + Math.abs(t - s.y) < 30 && i - s.timestamp < 1e3) {
|
|
391
|
+
if (this.clicks.push({ x: e, y: t, timestamp: i }), this.clicks.length === 3) return !0;
|
|
392
|
+
} else this.clicks = [{ x: e, y: t, timestamp: i }];
|
|
393
|
+
return !1;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
var Do = ["localhost", "127.0.0.1"], at = (r) => {
|
|
397
|
+
var e = S == null ? void 0 : S.createElement("a");
|
|
398
|
+
return k(e) ? null : (e.href = r, e);
|
|
399
|
+
}, qo = function(r) {
|
|
400
|
+
var e, t, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "&", s = [];
|
|
401
|
+
return $(r, function(n, o) {
|
|
402
|
+
k(n) || k(o) || o === "undefined" || (e = encodeURIComponent(((a) => a instanceof File)(n) ? n.name : n.toString()), t = encodeURIComponent(o), s[s.length] = t + "=" + e);
|
|
403
|
+
}), s.join(i);
|
|
404
|
+
}, si = function(r, e) {
|
|
405
|
+
for (var t, i = ((r.split("#")[0] || "").split(/\?(.*)/)[1] || "").replace(/^\?+/g, "").split("&"), s = 0; s < i.length; s++) {
|
|
406
|
+
var n = i[s].split("=");
|
|
407
|
+
if (n[0] === e) {
|
|
408
|
+
t = n;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (!q(t) || t.length < 2) return "";
|
|
413
|
+
var o = t[1];
|
|
414
|
+
try {
|
|
415
|
+
o = decodeURIComponent(o);
|
|
416
|
+
} catch {
|
|
417
|
+
x.error("Skipping decoding for malformed query param: " + o);
|
|
418
|
+
}
|
|
419
|
+
return o.replace(/\+/g, " ");
|
|
420
|
+
}, ki = function(r, e, t) {
|
|
421
|
+
if (!r || !e || !e.length) return r;
|
|
422
|
+
for (var i = r.split("#"), s = i[0] || "", n = i[1], o = s.split("?"), a = o[1], l = o[0], c = (a || "").split("&"), d = [], u = 0; u < c.length; u++) {
|
|
423
|
+
var p = c[u].split("=");
|
|
424
|
+
q(p) && (e.includes(p[0]) ? d.push(p[0] + "=" + t) : d.push(c[u]));
|
|
425
|
+
}
|
|
426
|
+
var h = l;
|
|
427
|
+
return a != null && (h += "?" + d.join("&")), n != null && (h += "#" + n), h;
|
|
428
|
+
}, ni = function(r, e) {
|
|
429
|
+
var t = r.match(new RegExp(e + "=([^&]*)"));
|
|
430
|
+
return t ? t[1] : null;
|
|
431
|
+
}, os = Q("[AutoCapture]");
|
|
432
|
+
function Si(r, e) {
|
|
433
|
+
return e.length > r ? e.slice(0, r) + "..." : e;
|
|
434
|
+
}
|
|
435
|
+
function No(r) {
|
|
436
|
+
if (r.previousElementSibling) return r.previousElementSibling;
|
|
437
|
+
var e = r;
|
|
438
|
+
do
|
|
439
|
+
e = e.previousSibling;
|
|
440
|
+
while (e && !_i(e));
|
|
441
|
+
return e;
|
|
442
|
+
}
|
|
443
|
+
function Bo(r, e, t, i) {
|
|
444
|
+
var s = r.tagName.toLowerCase(), n = { tag_name: s };
|
|
445
|
+
er.indexOf(s) > -1 && !t && (s.toLowerCase() === "a" || s.toLowerCase() === "button" ? n.$el_text = Si(1024, bn(r)) : n.$el_text = Si(1024, gi(r)));
|
|
446
|
+
var o = ri(r);
|
|
447
|
+
o.length > 0 && (n.classes = o.filter(function(d) {
|
|
448
|
+
return d !== "";
|
|
449
|
+
})), $(r.attributes, function(d) {
|
|
450
|
+
var u;
|
|
451
|
+
if ((!fn(r) || ["name", "id", "class", "aria-label"].indexOf(d.name) !== -1) && (i == null || !i.includes(d.name)) && !e && dt(d.value) && (u = d.name, !z(u) || u.substring(0, 10) !== "_ngcontent" && u.substring(0, 7) !== "_nghost")) {
|
|
452
|
+
var p = d.value;
|
|
453
|
+
d.name === "class" && (p = wr(p).join(" ")), n["attr__" + d.name] = Si(1024, p);
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
for (var a = 1, l = 1, c = r; c = No(c); ) a++, c.tagName === r.tagName && l++;
|
|
457
|
+
return n.nth_child = a, n.nth_of_type = l, n;
|
|
458
|
+
}
|
|
459
|
+
function Ho(r, e) {
|
|
460
|
+
for (var t, i, { e: s, maskAllElementAttributes: n, maskAllText: o, elementAttributeIgnoreList: a, elementsChainAsString: l } = e, c = [r], d = r; d.parentNode && !Be(d, "body"); ) pn(d.parentNode) ? (c.push(d.parentNode.host), d = d.parentNode.host) : (c.push(d.parentNode), d = d.parentNode);
|
|
461
|
+
var u, p = [], h = {}, _ = !1, v = !1;
|
|
462
|
+
if ($(c, (I) => {
|
|
463
|
+
var F = tr(I);
|
|
464
|
+
I.tagName.toLowerCase() === "a" && (_ = I.getAttribute("href"), _ = F && _ && dt(_) && _), T(ri(I), "ph-no-capture") && (v = !0), p.push(Bo(I, n, o, a));
|
|
465
|
+
var O = function(L) {
|
|
466
|
+
if (!tr(L)) return {};
|
|
467
|
+
var P = {};
|
|
468
|
+
return $(L.attributes, function(D) {
|
|
469
|
+
if (D.name && D.name.indexOf("data-ph-capture-attribute") === 0) {
|
|
470
|
+
var V = D.name.replace("data-ph-capture-attribute-", ""), he = D.value;
|
|
471
|
+
V && he && dt(he) && (P[V] = he);
|
|
472
|
+
}
|
|
473
|
+
}), P;
|
|
474
|
+
}(I);
|
|
475
|
+
H(h, O);
|
|
476
|
+
}), v) return { props: {}, explicitNoCapture: v };
|
|
477
|
+
if (o || (r.tagName.toLowerCase() === "a" || r.tagName.toLowerCase() === "button" ? p[0].$el_text = bn(r) : p[0].$el_text = gi(r)), _) {
|
|
478
|
+
var b, m;
|
|
479
|
+
p[0].attr__href = _;
|
|
480
|
+
var y = (b = at(_)) === null || b === void 0 ? void 0 : b.host, E = g == null || (m = g.location) === null || m === void 0 ? void 0 : m.host;
|
|
481
|
+
y && E && y !== E && (u = _);
|
|
482
|
+
}
|
|
483
|
+
return { props: H({ $event_type: s.type, $ce_version: 1 }, l ? {} : { $elements: p }, { $elements_chain: Mo(p) }, (t = p[0]) !== null && t !== void 0 && t.$el_text ? { $el_text: (i = p[0]) === null || i === void 0 ? void 0 : i.$el_text } : {}, u && s.type === "click" ? { $external_click_url: u } : {}, h) };
|
|
484
|
+
}
|
|
485
|
+
class Uo {
|
|
486
|
+
constructor(e) {
|
|
487
|
+
w(this, "_initialized", !1), w(this, "_isDisabledServerSide", null), w(this, "rageclicks", new kn()), w(this, "_elementsChainAsString", !1), this.instance = e, this._elementSelectors = null;
|
|
488
|
+
}
|
|
489
|
+
get config() {
|
|
490
|
+
var e, t, i = N(this.instance.config.autocapture) ? this.instance.config.autocapture : {};
|
|
491
|
+
return i.url_allowlist = (e = i.url_allowlist) === null || e === void 0 ? void 0 : e.map((s) => new RegExp(s)), i.url_ignorelist = (t = i.url_ignorelist) === null || t === void 0 ? void 0 : t.map((s) => new RegExp(s)), i;
|
|
492
|
+
}
|
|
493
|
+
_addDomEventHandlers() {
|
|
494
|
+
if (this.isBrowserSupported()) {
|
|
495
|
+
if (g && S) {
|
|
496
|
+
var e = (i) => {
|
|
497
|
+
i = i || (g == null ? void 0 : g.event);
|
|
498
|
+
try {
|
|
499
|
+
this._captureEvent(i);
|
|
500
|
+
} catch (s) {
|
|
501
|
+
os.error("Failed to capture event", s);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
if (U(S, "submit", e, { capture: !0 }), U(S, "change", e, { capture: !0 }), U(S, "click", e, { capture: !0 }), this.config.capture_copied_text) {
|
|
505
|
+
var t = (i) => {
|
|
506
|
+
i = i || (g == null ? void 0 : g.event), this._captureEvent(i, yi);
|
|
507
|
+
};
|
|
508
|
+
U(S, "copy", t, { capture: !0 }), U(S, "cut", t, { capture: !0 });
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
} else os.info("Disabling Automatic Event Collection because this browser is not supported");
|
|
512
|
+
}
|
|
513
|
+
startIfEnabled() {
|
|
514
|
+
this.isEnabled && !this._initialized && (this._addDomEventHandlers(), this._initialized = !0);
|
|
515
|
+
}
|
|
516
|
+
onRemoteConfig(e) {
|
|
517
|
+
e.elementsChainAsString && (this._elementsChainAsString = e.elementsChainAsString), this.instance.persistence && this.instance.persistence.register({ [Wr]: !!e.autocapture_opt_out }), this._isDisabledServerSide = !!e.autocapture_opt_out, this.startIfEnabled();
|
|
518
|
+
}
|
|
519
|
+
setElementSelectors(e) {
|
|
520
|
+
this._elementSelectors = e;
|
|
521
|
+
}
|
|
522
|
+
getElementSelectors(e) {
|
|
523
|
+
var t, i = [];
|
|
524
|
+
return (t = this._elementSelectors) === null || t === void 0 || t.forEach((s) => {
|
|
525
|
+
var n = S == null ? void 0 : S.querySelectorAll(s);
|
|
526
|
+
n == null || n.forEach((o) => {
|
|
527
|
+
e === o && i.push(s);
|
|
528
|
+
});
|
|
529
|
+
}), i;
|
|
530
|
+
}
|
|
531
|
+
get isEnabled() {
|
|
532
|
+
var e, t, i = (e = this.instance.persistence) === null || e === void 0 ? void 0 : e.props[Wr], s = this._isDisabledServerSide;
|
|
533
|
+
if (He(s) && !Ae(i) && !this.instance.config.advanced_disable_decide) return !1;
|
|
534
|
+
var n = (t = this._isDisabledServerSide) !== null && t !== void 0 ? t : !!i;
|
|
535
|
+
return !!this.instance.config.autocapture && !n;
|
|
536
|
+
}
|
|
537
|
+
_captureEvent(e) {
|
|
538
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "$autocapture";
|
|
539
|
+
if (this.isEnabled) {
|
|
540
|
+
var i, s = gn(e);
|
|
541
|
+
hn(s) && (s = s.parentNode || null), t === "$autocapture" && e.type === "click" && e instanceof MouseEvent && this.instance.config.rageclick && (i = this.rageclicks) !== null && i !== void 0 && i.isRageClick(e.clientX, e.clientY, (/* @__PURE__ */ new Date()).getTime()) && this._captureEvent(e, "$rageclick");
|
|
542
|
+
var n = t === yi;
|
|
543
|
+
if (s && To(s, e, this.config, n, n ? ["copy", "cut"] : void 0)) {
|
|
544
|
+
var { props: o, explicitNoCapture: a } = Ho(s, { e, maskAllElementAttributes: this.instance.config.mask_all_element_attributes, maskAllText: this.instance.config.mask_all_text, elementAttributeIgnoreList: this.config.element_attribute_ignorelist, elementsChainAsString: this._elementsChainAsString });
|
|
545
|
+
if (a) return !1;
|
|
546
|
+
var l = this.getElementSelectors(s);
|
|
547
|
+
if (l && l.length > 0 && (o.$element_selectors = l), t === yi) {
|
|
548
|
+
var c, d = _n(g == null || (c = g.getSelection()) === null || c === void 0 ? void 0 : c.toString()), u = e.type || "clipboard";
|
|
549
|
+
if (!d) return !1;
|
|
550
|
+
o.$selected_content = d, o.$copy_type = u;
|
|
551
|
+
}
|
|
552
|
+
return this.instance.capture(t, o), !0;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
isBrowserSupported() {
|
|
557
|
+
return ge(S == null ? void 0 : S.querySelectorAll);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
Math.trunc || (Math.trunc = function(r) {
|
|
561
|
+
return r < 0 ? Math.ceil(r) : Math.floor(r);
|
|
562
|
+
}), Number.isInteger || (Number.isInteger = function(r) {
|
|
563
|
+
return ee(r) && isFinite(r) && Math.floor(r) === r;
|
|
564
|
+
});
|
|
565
|
+
var as = "0123456789abcdef";
|
|
566
|
+
class oi {
|
|
567
|
+
constructor(e) {
|
|
568
|
+
if (this.bytes = e, e.length !== 16) throw new TypeError("not 128-bit length");
|
|
569
|
+
}
|
|
570
|
+
static fromFieldsV7(e, t, i, s) {
|
|
571
|
+
if (!Number.isInteger(e) || !Number.isInteger(t) || !Number.isInteger(i) || !Number.isInteger(s) || e < 0 || t < 0 || i < 0 || s < 0 || e > 281474976710655 || t > 4095 || i > 1073741823 || s > 4294967295) throw new RangeError("invalid field value");
|
|
572
|
+
var n = new Uint8Array(16);
|
|
573
|
+
return n[0] = e / Math.pow(2, 40), n[1] = e / Math.pow(2, 32), n[2] = e / Math.pow(2, 24), n[3] = e / Math.pow(2, 16), n[4] = e / Math.pow(2, 8), n[5] = e, n[6] = 112 | t >>> 8, n[7] = t, n[8] = 128 | i >>> 24, n[9] = i >>> 16, n[10] = i >>> 8, n[11] = i, n[12] = s >>> 24, n[13] = s >>> 16, n[14] = s >>> 8, n[15] = s, new oi(n);
|
|
574
|
+
}
|
|
575
|
+
toString() {
|
|
576
|
+
for (var e = "", t = 0; t < this.bytes.length; t++) e = e + as.charAt(this.bytes[t] >>> 4) + as.charAt(15 & this.bytes[t]), t !== 3 && t !== 5 && t !== 7 && t !== 9 || (e += "-");
|
|
577
|
+
if (e.length !== 36) throw new Error("Invalid UUIDv7 was generated");
|
|
578
|
+
return e;
|
|
579
|
+
}
|
|
580
|
+
clone() {
|
|
581
|
+
return new oi(this.bytes.slice(0));
|
|
582
|
+
}
|
|
583
|
+
equals(e) {
|
|
584
|
+
return this.compareTo(e) === 0;
|
|
585
|
+
}
|
|
586
|
+
compareTo(e) {
|
|
587
|
+
for (var t = 0; t < 16; t++) {
|
|
588
|
+
var i = this.bytes[t] - e.bytes[t];
|
|
589
|
+
if (i !== 0) return Math.sign(i);
|
|
590
|
+
}
|
|
591
|
+
return 0;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
class jo {
|
|
595
|
+
constructor() {
|
|
596
|
+
w(this, "timestamp", 0), w(this, "counter", 0), w(this, "random", new zo());
|
|
597
|
+
}
|
|
598
|
+
generate() {
|
|
599
|
+
var e = this.generateOrAbort();
|
|
600
|
+
if (k(e)) {
|
|
601
|
+
this.timestamp = 0;
|
|
602
|
+
var t = this.generateOrAbort();
|
|
603
|
+
if (k(t)) throw new Error("Could not generate UUID after timestamp reset");
|
|
604
|
+
return t;
|
|
605
|
+
}
|
|
606
|
+
return e;
|
|
607
|
+
}
|
|
608
|
+
generateOrAbort() {
|
|
609
|
+
var e = Date.now();
|
|
610
|
+
if (e > this.timestamp) this.timestamp = e, this.resetCounter();
|
|
611
|
+
else {
|
|
612
|
+
if (!(e + 1e4 > this.timestamp)) return;
|
|
613
|
+
this.counter++, this.counter > 4398046511103 && (this.timestamp++, this.resetCounter());
|
|
614
|
+
}
|
|
615
|
+
return oi.fromFieldsV7(this.timestamp, Math.trunc(this.counter / Math.pow(2, 30)), this.counter & Math.pow(2, 30) - 1, this.random.nextUint32());
|
|
616
|
+
}
|
|
617
|
+
resetCounter() {
|
|
618
|
+
this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
var ls, Sn = (r) => {
|
|
622
|
+
if (typeof UUIDV7_DENY_WEAK_RNG < "u" && UUIDV7_DENY_WEAK_RNG) throw new Error("no cryptographically strong RNG available");
|
|
623
|
+
for (var e = 0; e < r.length; e++) r[e] = 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random());
|
|
624
|
+
return r;
|
|
625
|
+
};
|
|
626
|
+
g && !k(g.crypto) && crypto.getRandomValues && (Sn = (r) => crypto.getRandomValues(r));
|
|
627
|
+
class zo {
|
|
628
|
+
constructor() {
|
|
629
|
+
w(this, "buffer", new Uint32Array(8)), w(this, "cursor", 1 / 0);
|
|
630
|
+
}
|
|
631
|
+
nextUint32() {
|
|
632
|
+
return this.cursor >= this.buffer.length && (Sn(this.buffer), this.cursor = 0), this.buffer[this.cursor++];
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
var De = () => Wo().toString(), Wo = () => (ls || (ls = new jo())).generate(), Vo = "Thu, 01 Jan 1970 00:00:00 GMT", ft = "", Go = /[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;
|
|
636
|
+
function Jo(r, e) {
|
|
637
|
+
if (e) {
|
|
638
|
+
var t = function(s) {
|
|
639
|
+
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : S;
|
|
640
|
+
if (ft) return ft;
|
|
641
|
+
if (!n || ["localhost", "127.0.0.1"].includes(s)) return "";
|
|
642
|
+
for (var o = s.split("."), a = Math.min(o.length, 8), l = "dmn_chk_" + De(), c = new RegExp("(^|;)\\s*" + l + "=1"); !ft && a--; ) {
|
|
643
|
+
var d = o.slice(a).join("."), u = l + "=1;domain=." + d;
|
|
644
|
+
n.cookie = u, c.test(n.cookie) && (n.cookie = u + ";expires=" + Vo, ft = d);
|
|
645
|
+
}
|
|
646
|
+
return ft;
|
|
647
|
+
}(r);
|
|
648
|
+
if (!t) {
|
|
649
|
+
var i = ((s) => {
|
|
650
|
+
var n = s.match(Go);
|
|
651
|
+
return n ? n[0] : "";
|
|
652
|
+
})(r);
|
|
653
|
+
i !== t && x.info("Warning: cookie subdomain discovery mismatch", i, t), t = i;
|
|
654
|
+
}
|
|
655
|
+
return t ? "; domain=." + t : "";
|
|
656
|
+
}
|
|
657
|
+
return "";
|
|
658
|
+
}
|
|
659
|
+
var Me, Pe = { is_supported: () => !!S, error: function(r) {
|
|
660
|
+
x.error("cookieStore error: " + r);
|
|
661
|
+
}, get: function(r) {
|
|
662
|
+
if (S) {
|
|
663
|
+
try {
|
|
664
|
+
for (var e = r + "=", t = S.cookie.split(";").filter((n) => n.length), i = 0; i < t.length; i++) {
|
|
665
|
+
for (var s = t[i]; s.charAt(0) == " "; ) s = s.substring(1, s.length);
|
|
666
|
+
if (s.indexOf(e) === 0) return decodeURIComponent(s.substring(e.length, s.length));
|
|
667
|
+
}
|
|
668
|
+
} catch {
|
|
669
|
+
}
|
|
670
|
+
return null;
|
|
671
|
+
}
|
|
672
|
+
}, parse: function(r) {
|
|
673
|
+
var e;
|
|
674
|
+
try {
|
|
675
|
+
e = JSON.parse(Pe.get(r)) || {};
|
|
676
|
+
} catch {
|
|
677
|
+
}
|
|
678
|
+
return e;
|
|
679
|
+
}, set: function(r, e, t, i, s) {
|
|
680
|
+
if (S) try {
|
|
681
|
+
var n = "", o = "", a = Jo(S.location.hostname, i);
|
|
682
|
+
if (t) {
|
|
683
|
+
var l = /* @__PURE__ */ new Date();
|
|
684
|
+
l.setTime(l.getTime() + 24 * t * 60 * 60 * 1e3), n = "; expires=" + l.toUTCString();
|
|
685
|
+
}
|
|
686
|
+
s && (o = "; secure");
|
|
687
|
+
var c = r + "=" + encodeURIComponent(JSON.stringify(e)) + n + "; SameSite=Lax; path=/" + a + o;
|
|
688
|
+
return c.length > 3686.4 && x.warn("cookieStore warning: large cookie, len=" + c.length), S.cookie = c, c;
|
|
689
|
+
} catch {
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
}, remove: function(r, e) {
|
|
693
|
+
try {
|
|
694
|
+
Pe.set(r, "", -1, e);
|
|
695
|
+
} catch {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
} }, Ei = null, W = { is_supported: function() {
|
|
699
|
+
if (!He(Ei)) return Ei;
|
|
700
|
+
var r = !0;
|
|
701
|
+
if (k(g)) r = !1;
|
|
702
|
+
else try {
|
|
703
|
+
var e = "__mplssupport__";
|
|
704
|
+
W.set(e, "xyz"), W.get(e) !== '"xyz"' && (r = !1), W.remove(e);
|
|
705
|
+
} catch {
|
|
706
|
+
r = !1;
|
|
707
|
+
}
|
|
708
|
+
return r || x.error("localStorage unsupported; falling back to cookie store"), Ei = r, r;
|
|
709
|
+
}, error: function(r) {
|
|
710
|
+
x.error("localStorage error: " + r);
|
|
711
|
+
}, get: function(r) {
|
|
712
|
+
try {
|
|
713
|
+
return g == null ? void 0 : g.localStorage.getItem(r);
|
|
714
|
+
} catch (e) {
|
|
715
|
+
W.error(e);
|
|
716
|
+
}
|
|
717
|
+
return null;
|
|
718
|
+
}, parse: function(r) {
|
|
719
|
+
try {
|
|
720
|
+
return JSON.parse(W.get(r)) || {};
|
|
721
|
+
} catch {
|
|
722
|
+
}
|
|
723
|
+
return null;
|
|
724
|
+
}, set: function(r, e) {
|
|
725
|
+
try {
|
|
726
|
+
g == null || g.localStorage.setItem(r, JSON.stringify(e));
|
|
727
|
+
} catch (t) {
|
|
728
|
+
W.error(t);
|
|
729
|
+
}
|
|
730
|
+
}, remove: function(r) {
|
|
731
|
+
try {
|
|
732
|
+
g == null || g.localStorage.removeItem(r);
|
|
733
|
+
} catch (e) {
|
|
734
|
+
W.error(e);
|
|
735
|
+
}
|
|
736
|
+
} }, Yo = ["distinct_id", ei, St, ii, Xi], Nt = f(f({}, W), {}, { parse: function(r) {
|
|
737
|
+
try {
|
|
738
|
+
var e = {};
|
|
739
|
+
try {
|
|
740
|
+
e = Pe.parse(r) || {};
|
|
741
|
+
} catch {
|
|
742
|
+
}
|
|
743
|
+
var t = H(e, JSON.parse(W.get(r) || "{}"));
|
|
744
|
+
return W.set(r, t), t;
|
|
745
|
+
} catch {
|
|
746
|
+
}
|
|
747
|
+
return null;
|
|
748
|
+
}, set: function(r, e, t, i, s, n) {
|
|
749
|
+
try {
|
|
750
|
+
W.set(r, e, void 0, void 0, n);
|
|
751
|
+
var o = {};
|
|
752
|
+
Yo.forEach((a) => {
|
|
753
|
+
e[a] && (o[a] = e[a]);
|
|
754
|
+
}), Object.keys(o).length && Pe.set(r, o, t, i, s, n);
|
|
755
|
+
} catch (a) {
|
|
756
|
+
W.error(a);
|
|
757
|
+
}
|
|
758
|
+
}, remove: function(r, e) {
|
|
759
|
+
try {
|
|
760
|
+
g == null || g.localStorage.removeItem(r), Pe.remove(r, e);
|
|
761
|
+
} catch (t) {
|
|
762
|
+
W.error(t);
|
|
763
|
+
}
|
|
764
|
+
} }), Bt = {}, Ko = { is_supported: function() {
|
|
765
|
+
return !0;
|
|
766
|
+
}, error: function(r) {
|
|
767
|
+
x.error("memoryStorage error: " + r);
|
|
768
|
+
}, get: function(r) {
|
|
769
|
+
return Bt[r] || null;
|
|
770
|
+
}, parse: function(r) {
|
|
771
|
+
return Bt[r] || null;
|
|
772
|
+
}, set: function(r, e) {
|
|
773
|
+
Bt[r] = e;
|
|
774
|
+
}, remove: function(r) {
|
|
775
|
+
delete Bt[r];
|
|
776
|
+
} }, je = null, J = { is_supported: function() {
|
|
777
|
+
if (!He(je)) return je;
|
|
778
|
+
if (je = !0, k(g)) je = !1;
|
|
779
|
+
else try {
|
|
780
|
+
var r = "__support__";
|
|
781
|
+
J.set(r, "xyz"), J.get(r) !== '"xyz"' && (je = !1), J.remove(r);
|
|
782
|
+
} catch {
|
|
783
|
+
je = !1;
|
|
784
|
+
}
|
|
785
|
+
return je;
|
|
786
|
+
}, error: function(r) {
|
|
787
|
+
x.error("sessionStorage error: ", r);
|
|
788
|
+
}, get: function(r) {
|
|
789
|
+
try {
|
|
790
|
+
return g == null ? void 0 : g.sessionStorage.getItem(r);
|
|
791
|
+
} catch (e) {
|
|
792
|
+
J.error(e);
|
|
793
|
+
}
|
|
794
|
+
return null;
|
|
795
|
+
}, parse: function(r) {
|
|
796
|
+
try {
|
|
797
|
+
return JSON.parse(J.get(r)) || null;
|
|
798
|
+
} catch {
|
|
799
|
+
}
|
|
800
|
+
return null;
|
|
801
|
+
}, set: function(r, e) {
|
|
802
|
+
try {
|
|
803
|
+
g == null || g.sessionStorage.setItem(r, JSON.stringify(e));
|
|
804
|
+
} catch (t) {
|
|
805
|
+
J.error(t);
|
|
806
|
+
}
|
|
807
|
+
}, remove: function(r) {
|
|
808
|
+
try {
|
|
809
|
+
g == null || g.sessionStorage.removeItem(r);
|
|
810
|
+
} catch (e) {
|
|
811
|
+
J.error(e);
|
|
812
|
+
}
|
|
813
|
+
} };
|
|
814
|
+
(function(r) {
|
|
815
|
+
r[r.PENDING = -1] = "PENDING", r[r.DENIED = 0] = "DENIED", r[r.GRANTED = 1] = "GRANTED";
|
|
816
|
+
})(Me || (Me = {}));
|
|
817
|
+
class Qo {
|
|
818
|
+
constructor(e) {
|
|
819
|
+
this.instance = e;
|
|
820
|
+
}
|
|
821
|
+
get config() {
|
|
822
|
+
return this.instance.config;
|
|
823
|
+
}
|
|
824
|
+
get consent() {
|
|
825
|
+
return this.getDnt() ? Me.DENIED : this.storedConsent;
|
|
826
|
+
}
|
|
827
|
+
isOptedOut() {
|
|
828
|
+
return this.consent === Me.DENIED || this.consent === Me.PENDING && this.config.opt_out_capturing_by_default;
|
|
829
|
+
}
|
|
830
|
+
isOptedIn() {
|
|
831
|
+
return !this.isOptedOut();
|
|
832
|
+
}
|
|
833
|
+
optInOut(e) {
|
|
834
|
+
this.storage.set(this.storageKey, e ? 1 : 0, this.config.cookie_expiration, this.config.cross_subdomain_cookie, this.config.secure_cookie);
|
|
835
|
+
}
|
|
836
|
+
reset() {
|
|
837
|
+
this.storage.remove(this.storageKey, this.config.cross_subdomain_cookie);
|
|
838
|
+
}
|
|
839
|
+
get storageKey() {
|
|
840
|
+
var { token: e, opt_out_capturing_cookie_prefix: t } = this.instance.config;
|
|
841
|
+
return (t || "__ph_opt_in_out_") + e;
|
|
842
|
+
}
|
|
843
|
+
get storedConsent() {
|
|
844
|
+
var e = this.storage.get(this.storageKey);
|
|
845
|
+
return e === "1" ? Me.GRANTED : e === "0" ? Me.DENIED : Me.PENDING;
|
|
846
|
+
}
|
|
847
|
+
get storage() {
|
|
848
|
+
if (!this._storage) {
|
|
849
|
+
var e = this.config.opt_out_capturing_persistence_type;
|
|
850
|
+
this._storage = e === "localStorage" ? W : Pe;
|
|
851
|
+
var t = e === "localStorage" ? Pe : W;
|
|
852
|
+
t.get(this.storageKey) && (this._storage.get(this.storageKey) || this.optInOut(t.get(this.storageKey) === "1"), t.remove(this.storageKey, this.config.cross_subdomain_cookie));
|
|
853
|
+
}
|
|
854
|
+
return this._storage;
|
|
855
|
+
}
|
|
856
|
+
getDnt() {
|
|
857
|
+
return !!this.config.respect_dnt && !!ln([oe == null ? void 0 : oe.doNotTrack, oe == null ? void 0 : oe.msDoNotTrack, C.doNotTrack], (e) => T([!0, 1, "1", "yes"], e));
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
var Ht = Q("[Dead Clicks]"), Zo = () => !0, Xo = (r) => {
|
|
861
|
+
var e, t = !((e = r.instance.persistence) === null || e === void 0 || !e.get_property(cn)), i = r.instance.config.capture_dead_clicks;
|
|
862
|
+
return Ae(i) ? i : t;
|
|
863
|
+
};
|
|
864
|
+
class En {
|
|
865
|
+
get lazyLoadedDeadClicksAutocapture() {
|
|
866
|
+
return this._lazyLoadedDeadClicksAutocapture;
|
|
867
|
+
}
|
|
868
|
+
constructor(e, t, i) {
|
|
869
|
+
this.instance = e, this.isEnabled = t, this.onCapture = i, this.startIfEnabled();
|
|
870
|
+
}
|
|
871
|
+
onRemoteConfig(e) {
|
|
872
|
+
this.instance.persistence && this.instance.persistence.register({ [cn]: e == null ? void 0 : e.captureDeadClicks }), this.startIfEnabled();
|
|
873
|
+
}
|
|
874
|
+
startIfEnabled() {
|
|
875
|
+
this.isEnabled(this) && this.loadScript(() => {
|
|
876
|
+
this.start();
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
loadScript(e) {
|
|
880
|
+
var t, i, s;
|
|
881
|
+
(t = C.__PosthogExtensions__) !== null && t !== void 0 && t.initDeadClicksAutocapture && e(), (i = C.__PosthogExtensions__) === null || i === void 0 || (s = i.loadExternalDependency) === null || s === void 0 || s.call(i, this.instance, "dead-clicks-autocapture", (n) => {
|
|
882
|
+
n ? Ht.error("failed to load script", n) : e();
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
start() {
|
|
886
|
+
var e;
|
|
887
|
+
if (S) {
|
|
888
|
+
if (!this._lazyLoadedDeadClicksAutocapture && (e = C.__PosthogExtensions__) !== null && e !== void 0 && e.initDeadClicksAutocapture) {
|
|
889
|
+
var t = N(this.instance.config.capture_dead_clicks) ? this.instance.config.capture_dead_clicks : {};
|
|
890
|
+
t.__onCapture = this.onCapture, this._lazyLoadedDeadClicksAutocapture = C.__PosthogExtensions__.initDeadClicksAutocapture(this.instance, t), this._lazyLoadedDeadClicksAutocapture.start(S), Ht.info("starting...");
|
|
891
|
+
}
|
|
892
|
+
} else Ht.error("`document` not found. Cannot start.");
|
|
893
|
+
}
|
|
894
|
+
stop() {
|
|
895
|
+
this._lazyLoadedDeadClicksAutocapture && (this._lazyLoadedDeadClicksAutocapture.stop(), this._lazyLoadedDeadClicksAutocapture = void 0, Ht.info("stopping..."));
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
var xi = Q("[ExceptionAutocapture]");
|
|
899
|
+
class ea {
|
|
900
|
+
constructor(e) {
|
|
901
|
+
var t;
|
|
902
|
+
w(this, "startCapturing", () => {
|
|
903
|
+
var i;
|
|
904
|
+
if (g && this.isEnabled && (i = C.__PosthogExtensions__) !== null && i !== void 0 && i.errorWrappingFunctions) {
|
|
905
|
+
var s = C.__PosthogExtensions__.errorWrappingFunctions.wrapOnError, n = C.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection, o = C.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;
|
|
906
|
+
try {
|
|
907
|
+
!this.unwrapOnError && this.config.capture_unhandled_errors && (this.unwrapOnError = s(this.captureException.bind(this))), !this.unwrapUnhandledRejection && this.config.capture_unhandled_rejections && (this.unwrapUnhandledRejection = n(this.captureException.bind(this))), !this.unwrapConsoleError && this.config.capture_console_errors && (this.unwrapConsoleError = o(this.captureException.bind(this)));
|
|
908
|
+
} catch (a) {
|
|
909
|
+
xi.error("failed to start", a), this.stopCapturing();
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}), this.instance = e, this.remoteEnabled = !((t = this.instance.persistence) === null || t === void 0 || !t.props[Vr]), this.config = this.requiredConfig(), this.startIfEnabled();
|
|
913
|
+
}
|
|
914
|
+
requiredConfig() {
|
|
915
|
+
var e = this.instance.config.capture_exceptions, t = { capture_unhandled_errors: !1, capture_unhandled_rejections: !1, capture_console_errors: !1 };
|
|
916
|
+
return N(e) ? t = f(f({}, t), e) : (k(e) ? this.remoteEnabled : e) && (t = f(f({}, t), {}, { capture_unhandled_errors: !0, capture_unhandled_rejections: !0 })), t;
|
|
917
|
+
}
|
|
918
|
+
get isEnabled() {
|
|
919
|
+
return this.config.capture_console_errors || this.config.capture_unhandled_errors || this.config.capture_unhandled_rejections;
|
|
920
|
+
}
|
|
921
|
+
startIfEnabled() {
|
|
922
|
+
this.isEnabled && (xi.info("enabled"), this.loadScript(this.startCapturing));
|
|
923
|
+
}
|
|
924
|
+
loadScript(e) {
|
|
925
|
+
var t, i, s;
|
|
926
|
+
(t = C.__PosthogExtensions__) !== null && t !== void 0 && t.errorWrappingFunctions && e(), (i = C.__PosthogExtensions__) === null || i === void 0 || (s = i.loadExternalDependency) === null || s === void 0 || s.call(i, this.instance, "exception-autocapture", (n) => {
|
|
927
|
+
if (n) return xi.error("failed to load script", n);
|
|
928
|
+
e();
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
stopCapturing() {
|
|
932
|
+
var e, t, i;
|
|
933
|
+
(e = this.unwrapOnError) === null || e === void 0 || e.call(this), this.unwrapOnError = void 0, (t = this.unwrapUnhandledRejection) === null || t === void 0 || t.call(this), this.unwrapUnhandledRejection = void 0, (i = this.unwrapConsoleError) === null || i === void 0 || i.call(this), this.unwrapConsoleError = void 0;
|
|
934
|
+
}
|
|
935
|
+
onRemoteConfig(e) {
|
|
936
|
+
var t = e.autocaptureExceptions;
|
|
937
|
+
this.remoteEnabled = !!t || !1, this.config = this.requiredConfig(), this.instance.persistence && this.instance.persistence.register({ [Vr]: this.remoteEnabled }), this.startIfEnabled();
|
|
938
|
+
}
|
|
939
|
+
captureException(e) {
|
|
940
|
+
var t = this.instance.requestRouter.endpointFor("ui");
|
|
941
|
+
e.$exception_personURL = "".concat(t, "/project/").concat(this.instance.config.token, "/person/").concat(this.instance.get_distinct_id()), this.instance.exceptions.sendExceptionEvent(e);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
function xn(r) {
|
|
945
|
+
return !k(Event) && In(r, Event);
|
|
946
|
+
}
|
|
947
|
+
function In(r, e) {
|
|
948
|
+
try {
|
|
949
|
+
return r instanceof e;
|
|
950
|
+
} catch {
|
|
951
|
+
return !1;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
function Kt(r, e) {
|
|
955
|
+
return Object.prototype.toString.call(r) === "[object ".concat(e, "]");
|
|
956
|
+
}
|
|
957
|
+
function Ii(r) {
|
|
958
|
+
return Kt(r, "DOMError");
|
|
959
|
+
}
|
|
960
|
+
var us = /\(error: (.*)\)/, cs = 50, ot = "?";
|
|
961
|
+
function Ci(r, e, t, i) {
|
|
962
|
+
var s = { platform: "web:javascript", filename: r, function: e === "<anonymous>" ? ot : e, in_app: !0 };
|
|
963
|
+
return k(t) || (s.lineno = t), k(i) || (s.colno = i), s;
|
|
964
|
+
}
|
|
965
|
+
var ta = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i, ia = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i, ra = /\((\S*)(?::(\d+))(?::(\d+))\)/, sa = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i, na = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i, oa = function() {
|
|
966
|
+
for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
|
|
967
|
+
var i = e.sort((s, n) => s[0] - n[0]).map((s) => s[1]);
|
|
968
|
+
return function(s) {
|
|
969
|
+
for (var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, o = [], a = s.split(`
|
|
970
|
+
`), l = n; l < a.length; l++) {
|
|
971
|
+
var c = a[l];
|
|
972
|
+
if (!(c.length > 1024)) {
|
|
973
|
+
var d = us.test(c) ? c.replace(us, "$1") : c;
|
|
974
|
+
if (!d.match(/\S*Error: /)) {
|
|
975
|
+
for (var u of i) {
|
|
976
|
+
var p = u(d);
|
|
977
|
+
if (p) {
|
|
978
|
+
o.push(p);
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
if (o.length >= cs) break;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return function(h) {
|
|
987
|
+
if (!h.length) return [];
|
|
988
|
+
var _ = Array.from(h);
|
|
989
|
+
return _.reverse(), _.slice(0, cs).map((v) => f(f({}, v), {}, { filename: v.filename || aa(_).filename, function: v.function || ot }));
|
|
990
|
+
}(o);
|
|
991
|
+
};
|
|
992
|
+
}([30, (r) => {
|
|
993
|
+
var e = ta.exec(r);
|
|
994
|
+
if (e) {
|
|
995
|
+
var [, t, i, s] = e;
|
|
996
|
+
return Ci(t, ot, +i, +s);
|
|
997
|
+
}
|
|
998
|
+
var n = ia.exec(r);
|
|
999
|
+
if (n) {
|
|
1000
|
+
if (n[2] && n[2].indexOf("eval") === 0) {
|
|
1001
|
+
var o = ra.exec(n[2]);
|
|
1002
|
+
o && (n[2] = o[1], n[3] = o[2], n[4] = o[3]);
|
|
1003
|
+
}
|
|
1004
|
+
var [a, l] = hs(n[1] || ot, n[2]);
|
|
1005
|
+
return Ci(l, a, n[3] ? +n[3] : void 0, n[4] ? +n[4] : void 0);
|
|
1006
|
+
}
|
|
1007
|
+
}], [50, (r) => {
|
|
1008
|
+
var e = sa.exec(r);
|
|
1009
|
+
if (e) {
|
|
1010
|
+
if (e[3] && e[3].indexOf(" > eval") > -1) {
|
|
1011
|
+
var t = na.exec(e[3]);
|
|
1012
|
+
t && (e[1] = e[1] || "eval", e[3] = t[1], e[4] = t[2], e[5] = "");
|
|
1013
|
+
}
|
|
1014
|
+
var i = e[3], s = e[1] || ot;
|
|
1015
|
+
return [s, i] = hs(s, i), Ci(i, s, e[4] ? +e[4] : void 0, e[5] ? +e[5] : void 0);
|
|
1016
|
+
}
|
|
1017
|
+
}]);
|
|
1018
|
+
function aa(r) {
|
|
1019
|
+
return r[r.length - 1] || {};
|
|
1020
|
+
}
|
|
1021
|
+
var Ut, ds, Pi, hs = (r, e) => {
|
|
1022
|
+
var t = r.indexOf("safari-extension") !== -1, i = r.indexOf("safari-web-extension") !== -1;
|
|
1023
|
+
return t || i ? [r.indexOf("@") !== -1 ? r.split("@")[0] : ot, t ? "safari-extension:".concat(e) : "safari-web-extension:".concat(e)] : [r, e];
|
|
1024
|
+
}, la = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
1025
|
+
function kr(r) {
|
|
1026
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, t = r.stacktrace || r.stack || "", i = function(o) {
|
|
1027
|
+
return o && ua.test(o.message) ? 1 : 0;
|
|
1028
|
+
}(r);
|
|
1029
|
+
try {
|
|
1030
|
+
var s = oa, n = function(o, a) {
|
|
1031
|
+
var l = function(c) {
|
|
1032
|
+
var d = globalThis._posthogChunkIds;
|
|
1033
|
+
if (!d) return {};
|
|
1034
|
+
var u = Object.keys(d);
|
|
1035
|
+
return Pi && u.length === ds || (ds = u.length, Pi = u.reduce((p, h) => {
|
|
1036
|
+
Ut || (Ut = {});
|
|
1037
|
+
var _ = Ut[h];
|
|
1038
|
+
if (_) p[_[0]] = _[1];
|
|
1039
|
+
else for (var v = c(h), b = v.length - 1; b >= 0; b--) {
|
|
1040
|
+
var m = v[b], y = m == null ? void 0 : m.filename, E = d[h];
|
|
1041
|
+
if (y && E) {
|
|
1042
|
+
p[y] = E, Ut[h] = [y, E];
|
|
1043
|
+
break;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
return p;
|
|
1047
|
+
}, {})), Pi;
|
|
1048
|
+
}(a);
|
|
1049
|
+
return o.forEach((c) => {
|
|
1050
|
+
c.filename && (c.chunk_id = l[c.filename]);
|
|
1051
|
+
}), o;
|
|
1052
|
+
}(s(t, i), s);
|
|
1053
|
+
return n.slice(0, n.length - e);
|
|
1054
|
+
} catch {
|
|
1055
|
+
}
|
|
1056
|
+
return [];
|
|
1057
|
+
}
|
|
1058
|
+
var ua = /Minified React error #\d+;/i;
|
|
1059
|
+
function Fi(r, e) {
|
|
1060
|
+
var t, i, s = kr(r), n = (t = e == null ? void 0 : e.handled) === null || t === void 0 || t, o = (i = e == null ? void 0 : e.synthetic) !== null && i !== void 0 && i;
|
|
1061
|
+
return { $exception_list: [{ type: e != null && e.overrideExceptionType ? e.overrideExceptionType : r.name, value: function(a) {
|
|
1062
|
+
var l = a.message;
|
|
1063
|
+
return l.error && typeof l.error.message == "string" ? String(l.error.message) : String(l);
|
|
1064
|
+
}(r), stacktrace: { frames: s, type: "raw" }, mechanism: { handled: n, synthetic: o } }], $exception_level: "error" };
|
|
1065
|
+
}
|
|
1066
|
+
function Ti(r, e) {
|
|
1067
|
+
var t, i, s, n = (t = e == null ? void 0 : e.handled) === null || t === void 0 || t, o = (i = e == null ? void 0 : e.synthetic) === null || i === void 0 || i, a = { type: e != null && e.overrideExceptionType ? e.overrideExceptionType : (s = e == null ? void 0 : e.defaultExceptionType) !== null && s !== void 0 ? s : "Error", value: r || (e == null ? void 0 : e.defaultExceptionMessage), mechanism: { handled: n, synthetic: o } };
|
|
1068
|
+
if (e != null && e.syntheticException) {
|
|
1069
|
+
var l = kr(e.syntheticException, 1);
|
|
1070
|
+
l.length && (a.stacktrace = { frames: l, type: "raw" });
|
|
1071
|
+
}
|
|
1072
|
+
return { $exception_list: [a], $exception_level: "error" };
|
|
1073
|
+
}
|
|
1074
|
+
function ca(r) {
|
|
1075
|
+
return z(r) && !zi(r) && bo.indexOf(r) >= 0;
|
|
1076
|
+
}
|
|
1077
|
+
function da(r, e) {
|
|
1078
|
+
var t, i, s = (t = e == null ? void 0 : e.handled) === null || t === void 0 || t, n = (i = e == null ? void 0 : e.synthetic) === null || i === void 0 || i, o = e != null && e.overrideExceptionType ? e.overrideExceptionType : xn(r) ? r.constructor.name : "Error", a = "Non-Error 'exception' captured with keys: ".concat(function(d) {
|
|
1079
|
+
var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 40, p = Object.keys(d);
|
|
1080
|
+
if (p.sort(), !p.length) return "[object has no keys]";
|
|
1081
|
+
for (var h = p.length; h > 0; h--) {
|
|
1082
|
+
var _ = p.slice(0, h).join(", ");
|
|
1083
|
+
if (!(_.length > u)) return h === p.length || _.length <= u ? _ : "".concat(_.slice(0, u), "...");
|
|
1084
|
+
}
|
|
1085
|
+
return "";
|
|
1086
|
+
}(r)), l = { type: o, value: a, mechanism: { handled: s, synthetic: n } };
|
|
1087
|
+
if (e != null && e.syntheticException) {
|
|
1088
|
+
var c = kr(e == null ? void 0 : e.syntheticException, 1);
|
|
1089
|
+
c.length && (l.stacktrace = { frames: c, type: "raw" });
|
|
1090
|
+
}
|
|
1091
|
+
return { $exception_list: [l], $exception_level: ca(r.level) ? r.level : "error" };
|
|
1092
|
+
}
|
|
1093
|
+
function ha(r, e) {
|
|
1094
|
+
var { error: t, event: i } = r, s = { $exception_list: [] }, n = t || i;
|
|
1095
|
+
if (Ii(n) || function(h) {
|
|
1096
|
+
return Kt(h, "DOMException");
|
|
1097
|
+
}(n)) {
|
|
1098
|
+
var o = n;
|
|
1099
|
+
if (function(h) {
|
|
1100
|
+
return "stack" in h;
|
|
1101
|
+
}(n)) s = Fi(n, e);
|
|
1102
|
+
else {
|
|
1103
|
+
var a = o.name || (Ii(o) ? "DOMError" : "DOMException"), l = o.message ? "".concat(a, ": ").concat(o.message) : a, c = Ii(o) ? "DOMError" : "DOMException";
|
|
1104
|
+
s = Ti(l, f(f({}, e), {}, { overrideExceptionType: c, defaultExceptionMessage: l }));
|
|
1105
|
+
}
|
|
1106
|
+
return "code" in o && (s.$exception_DOMException_code = "".concat(o.code)), s;
|
|
1107
|
+
}
|
|
1108
|
+
if (function(h) {
|
|
1109
|
+
return Kt(h, "ErrorEvent");
|
|
1110
|
+
}(n) && n.error) return Fi(n.error, e);
|
|
1111
|
+
if (function(h) {
|
|
1112
|
+
switch (Object.prototype.toString.call(h)) {
|
|
1113
|
+
case "[object Error]":
|
|
1114
|
+
case "[object Exception]":
|
|
1115
|
+
case "[object DOMException]":
|
|
1116
|
+
case "[object DOMError]":
|
|
1117
|
+
return !0;
|
|
1118
|
+
default:
|
|
1119
|
+
return In(h, Error);
|
|
1120
|
+
}
|
|
1121
|
+
}(n)) return Fi(n, e);
|
|
1122
|
+
if (function(h) {
|
|
1123
|
+
return Kt(h, "Object");
|
|
1124
|
+
}(n) || xn(n)) return da(n, e);
|
|
1125
|
+
if (k(t) && z(i)) {
|
|
1126
|
+
var d = "Error", u = i, p = i.match(la);
|
|
1127
|
+
return p && (d = p[1], u = p[2]), Ti(u, f(f({}, e), {}, { overrideExceptionType: d, defaultExceptionMessage: u }));
|
|
1128
|
+
}
|
|
1129
|
+
return Ti(n, e);
|
|
1130
|
+
}
|
|
1131
|
+
function ai(r) {
|
|
1132
|
+
var e, t;
|
|
1133
|
+
return ((e = JSON.stringify(r, (t = [], function(i, s) {
|
|
1134
|
+
if (N(s)) {
|
|
1135
|
+
for (; t.length > 0 && t[t.length - 1] !== this; ) t.pop();
|
|
1136
|
+
return t.includes(s) ? "[Circular]" : (t.push(s), s);
|
|
1137
|
+
}
|
|
1138
|
+
return s;
|
|
1139
|
+
}))) === null || e === void 0 ? void 0 : e.length) || 0;
|
|
1140
|
+
}
|
|
1141
|
+
function ir(r) {
|
|
1142
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 66060288e-1;
|
|
1143
|
+
if (r.size >= e && r.data.length > 1) {
|
|
1144
|
+
var t = Math.floor(r.data.length / 2), i = r.data.slice(0, t), s = r.data.slice(t);
|
|
1145
|
+
return [ir({ size: ai(i), data: i, sessionId: r.sessionId, windowId: r.windowId }), ir({ size: ai(s), data: s, sessionId: r.sessionId, windowId: r.windowId })].flatMap((n) => n);
|
|
1146
|
+
}
|
|
1147
|
+
return [r];
|
|
1148
|
+
}
|
|
1149
|
+
var Ee = ((r) => (r[r.DomContentLoaded = 0] = "DomContentLoaded", r[r.Load = 1] = "Load", r[r.FullSnapshot = 2] = "FullSnapshot", r[r.IncrementalSnapshot = 3] = "IncrementalSnapshot", r[r.Meta = 4] = "Meta", r[r.Custom = 5] = "Custom", r[r.Plugin = 6] = "Plugin", r))(Ee || {}), pe = ((r) => (r[r.Mutation = 0] = "Mutation", r[r.MouseMove = 1] = "MouseMove", r[r.MouseInteraction = 2] = "MouseInteraction", r[r.Scroll = 3] = "Scroll", r[r.ViewportResize = 4] = "ViewportResize", r[r.Input = 5] = "Input", r[r.TouchMove = 6] = "TouchMove", r[r.MediaInteraction = 7] = "MediaInteraction", r[r.StyleSheetRule = 8] = "StyleSheetRule", r[r.CanvasMutation = 9] = "CanvasMutation", r[r.Font = 10] = "Font", r[r.Log = 11] = "Log", r[r.Drag = 12] = "Drag", r[r.StyleDeclaration = 13] = "StyleDeclaration", r[r.Selection = 14] = "Selection", r[r.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", r[r.CustomElement = 16] = "CustomElement", r))(pe || {}), rr = "[SessionRecording]", sr = "redacted", jt = { initiatorTypes: ["audio", "beacon", "body", "css", "early-hint", "embed", "fetch", "frame", "iframe", "icon", "image", "img", "input", "link", "navigation", "object", "ping", "script", "track", "video", "xmlhttprequest"], maskRequestFn: (r) => r, recordHeaders: !1, recordBody: !1, recordInitialRequests: !1, recordPerformance: !1, performanceEntryTypeToObserve: ["first-input", "navigation", "paint", "resource"], payloadSizeLimitBytes: 1e6, payloadHostDenyList: [".lr-ingest.io", ".ingest.sentry.io", ".clarity.ms", "analytics.google.com"] }, pa = ["authorization", "x-forwarded-for", "authorization", "cookie", "set-cookie", "x-api-key", "x-real-ip", "remote-addr", "forwarded", "proxy-authorization", "x-csrf-token", "x-csrftoken", "x-xsrf-token"], _a = ["password", "secret", "passwd", "api_key", "apikey", "auth", "credentials", "mysql_pwd", "privatekey", "private_key", "token"], ga = ["/s/", "/e/", "/i/"];
|
|
1150
|
+
function ps(r, e, t, i) {
|
|
1151
|
+
if (R(r)) return r;
|
|
1152
|
+
var s = (e == null ? void 0 : e["content-length"]) || function(n) {
|
|
1153
|
+
return new Blob([n]).size;
|
|
1154
|
+
}(r);
|
|
1155
|
+
return z(s) && (s = parseInt(s)), s > t ? rr + " ".concat(i, " body too large to record (").concat(s, " bytes)") : r;
|
|
1156
|
+
}
|
|
1157
|
+
function _s(r, e) {
|
|
1158
|
+
if (R(r)) return r;
|
|
1159
|
+
var t = r;
|
|
1160
|
+
return dt(t, !1) || (t = rr + " " + e + " body " + sr), $(_a, (i) => {
|
|
1161
|
+
var s, n;
|
|
1162
|
+
(s = t) !== null && s !== void 0 && s.length && ((n = t) === null || n === void 0 ? void 0 : n.indexOf(i)) !== -1 && (t = rr + " " + e + " body " + sr + " as might contain: " + i);
|
|
1163
|
+
}), t;
|
|
1164
|
+
}
|
|
1165
|
+
var va = (r, e) => {
|
|
1166
|
+
var t, i, s, n = { payloadSizeLimitBytes: jt.payloadSizeLimitBytes, performanceEntryTypeToObserve: [...jt.performanceEntryTypeToObserve], payloadHostDenyList: [...e.payloadHostDenyList || [], ...jt.payloadHostDenyList] }, o = r.session_recording.recordHeaders !== !1 && e.recordHeaders, a = r.session_recording.recordBody !== !1 && e.recordBody, l = r.capture_performance !== !1 && e.recordPerformance, c = (t = n, s = Math.min(1e6, (i = t.payloadSizeLimitBytes) !== null && i !== void 0 ? i : 1e6), (p) => (p != null && p.requestBody && (p.requestBody = ps(p.requestBody, p.requestHeaders, s, "Request")), p != null && p.responseBody && (p.responseBody = ps(p.responseBody, p.responseHeaders, s, "Response")), p)), d = (p) => {
|
|
1167
|
+
return c(((v, b) => {
|
|
1168
|
+
var m, y = at(v.name), E = b.indexOf("http") === 0 ? (m = at(b)) === null || m === void 0 ? void 0 : m.pathname : b;
|
|
1169
|
+
E === "/" && (E = "");
|
|
1170
|
+
var I = y == null ? void 0 : y.pathname.replace(E || "", "");
|
|
1171
|
+
if (!(y && I && ga.some((F) => I.indexOf(F) === 0))) return v;
|
|
1172
|
+
})((_ = (h = p).requestHeaders, R(_) || $(Object.keys(_ ?? {}), (v) => {
|
|
1173
|
+
pa.includes(v.toLowerCase()) && (_[v] = sr);
|
|
1174
|
+
}), h), r.api_host));
|
|
1175
|
+
var h, _;
|
|
1176
|
+
}, u = ge(r.session_recording.maskNetworkRequestFn);
|
|
1177
|
+
return u && ge(r.session_recording.maskCapturedNetworkRequestFn) && x.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."), u && (r.session_recording.maskCapturedNetworkRequestFn = (p) => {
|
|
1178
|
+
var h = r.session_recording.maskNetworkRequestFn({ url: p.name });
|
|
1179
|
+
return f(f({}, p), {}, { name: h == null ? void 0 : h.url });
|
|
1180
|
+
}), n.maskRequestFn = ge(r.session_recording.maskCapturedNetworkRequestFn) ? (p) => {
|
|
1181
|
+
var h, _, v, b = d(p);
|
|
1182
|
+
return b && (h = (_ = (v = r.session_recording).maskCapturedNetworkRequestFn) === null || _ === void 0 ? void 0 : _.call(v, b)) !== null && h !== void 0 ? h : void 0;
|
|
1183
|
+
} : (p) => function(h) {
|
|
1184
|
+
if (!k(h)) return h.requestBody = _s(h.requestBody, "Request"), h.responseBody = _s(h.responseBody, "Response"), h;
|
|
1185
|
+
}(d(p)), f(f(f({}, jt), n), {}, { recordHeaders: o, recordBody: a, recordPerformance: l, recordInitialRequests: l });
|
|
1186
|
+
};
|
|
1187
|
+
function ue(r, e, t, i, s) {
|
|
1188
|
+
return e > t && (x.warn("min cannot be greater than max."), e = t), ee(r) ? r > t ? (i && x.warn(i + " cannot be greater than max: " + t + ". Using max value instead."), t) : r < e ? (i && x.warn(i + " cannot be less than min: " + e + ". Using min value instead."), e) : r : (i && x.warn(i + " must be a number. using max or fallback. max: " + t + ", fallback: " + s), ue(s || t, e, t, i));
|
|
1189
|
+
}
|
|
1190
|
+
class fa {
|
|
1191
|
+
constructor(e) {
|
|
1192
|
+
var t, i, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1193
|
+
w(this, "bucketSize", 100), w(this, "refillRate", 10), w(this, "mutationBuckets", {}), w(this, "loggedTracker", {}), w(this, "refillBuckets", () => {
|
|
1194
|
+
Object.keys(this.mutationBuckets).forEach((n) => {
|
|
1195
|
+
this.mutationBuckets[n] = this.mutationBuckets[n] + this.refillRate, this.mutationBuckets[n] >= this.bucketSize && delete this.mutationBuckets[n];
|
|
1196
|
+
});
|
|
1197
|
+
}), w(this, "getNodeOrRelevantParent", (n) => {
|
|
1198
|
+
var o = this.rrweb.mirror.getNode(n);
|
|
1199
|
+
if ((o == null ? void 0 : o.nodeName) !== "svg" && o instanceof Element) {
|
|
1200
|
+
var a = o.closest("svg");
|
|
1201
|
+
if (a) return [this.rrweb.mirror.getId(a), a];
|
|
1202
|
+
}
|
|
1203
|
+
return [n, o];
|
|
1204
|
+
}), w(this, "numberOfChanges", (n) => {
|
|
1205
|
+
var o, a, l, c, d, u, p, h;
|
|
1206
|
+
return ((o = (a = n.removes) === null || a === void 0 ? void 0 : a.length) !== null && o !== void 0 ? o : 0) + ((l = (c = n.attributes) === null || c === void 0 ? void 0 : c.length) !== null && l !== void 0 ? l : 0) + ((d = (u = n.texts) === null || u === void 0 ? void 0 : u.length) !== null && d !== void 0 ? d : 0) + ((p = (h = n.adds) === null || h === void 0 ? void 0 : h.length) !== null && p !== void 0 ? p : 0);
|
|
1207
|
+
}), w(this, "throttleMutations", (n) => {
|
|
1208
|
+
if (n.type !== 3 || n.data.source !== 0) return n;
|
|
1209
|
+
var o = n.data, a = this.numberOfChanges(o);
|
|
1210
|
+
o.attributes && (o.attributes = o.attributes.filter((c) => {
|
|
1211
|
+
var d, u, p, [h, _] = this.getNodeOrRelevantParent(c.id);
|
|
1212
|
+
return this.mutationBuckets[h] === 0 ? !1 : (this.mutationBuckets[h] = (d = this.mutationBuckets[h]) !== null && d !== void 0 ? d : this.bucketSize, this.mutationBuckets[h] = Math.max(this.mutationBuckets[h] - 1, 0), this.mutationBuckets[h] === 0 && (this.loggedTracker[h] || (this.loggedTracker[h] = !0, (u = (p = this.options).onBlockedNode) === null || u === void 0 || u.call(p, h, _))), c);
|
|
1213
|
+
}));
|
|
1214
|
+
var l = this.numberOfChanges(o);
|
|
1215
|
+
return l !== 0 || a === l ? n : void 0;
|
|
1216
|
+
}), this.rrweb = e, this.options = s, this.refillRate = ue((t = this.options.refillRate) !== null && t !== void 0 ? t : this.refillRate, 0, 100, "mutation throttling refill rate"), this.bucketSize = ue((i = this.options.bucketSize) !== null && i !== void 0 ? i : this.bucketSize, 0, 100, "mutation throttling bucket size"), setInterval(() => {
|
|
1217
|
+
this.refillBuckets();
|
|
1218
|
+
}, 1e3);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
var ce = Uint8Array, re = Uint16Array, ht = Uint32Array, Sr = new ce([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]), Er = new ce([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]), gs = new ce([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Cn = function(r, e) {
|
|
1222
|
+
for (var t = new re(31), i = 0; i < 31; ++i) t[i] = e += 1 << r[i - 1];
|
|
1223
|
+
var s = new ht(t[30]);
|
|
1224
|
+
for (i = 1; i < 30; ++i) for (var n = t[i]; n < t[i + 1]; ++n) s[n] = n - t[i] << 5 | i;
|
|
1225
|
+
return [t, s];
|
|
1226
|
+
}, Pn = Cn(Sr, 2), ma = Pn[0], nr = Pn[1];
|
|
1227
|
+
ma[28] = 258, nr[258] = 28;
|
|
1228
|
+
for (var vs = Cn(Er, 0)[1], Fn = new re(32768), M = 0; M < 32768; ++M) {
|
|
1229
|
+
var ze = (43690 & M) >>> 1 | (21845 & M) << 1;
|
|
1230
|
+
ze = (61680 & (ze = (52428 & ze) >>> 2 | (13107 & ze) << 2)) >>> 4 | (3855 & ze) << 4, Fn[M] = ((65280 & ze) >>> 8 | (255 & ze) << 8) >>> 1;
|
|
1231
|
+
}
|
|
1232
|
+
var Pt = function(r, e, t) {
|
|
1233
|
+
for (var i = r.length, s = 0, n = new re(e); s < i; ++s) ++n[r[s] - 1];
|
|
1234
|
+
var o, a = new re(e);
|
|
1235
|
+
for (s = 0; s < e; ++s) a[s] = a[s - 1] + n[s - 1] << 1;
|
|
1236
|
+
for (o = new re(i), s = 0; s < i; ++s) o[s] = Fn[a[r[s] - 1]++] >>> 15 - r[s];
|
|
1237
|
+
return o;
|
|
1238
|
+
}, Qe = new ce(288);
|
|
1239
|
+
for (M = 0; M < 144; ++M) Qe[M] = 8;
|
|
1240
|
+
for (M = 144; M < 256; ++M) Qe[M] = 9;
|
|
1241
|
+
for (M = 256; M < 280; ++M) Qe[M] = 7;
|
|
1242
|
+
for (M = 280; M < 288; ++M) Qe[M] = 8;
|
|
1243
|
+
var li = new ce(32);
|
|
1244
|
+
for (M = 0; M < 32; ++M) li[M] = 5;
|
|
1245
|
+
var ya = Pt(Qe, 9), ba = Pt(li, 5), Tn = function(r) {
|
|
1246
|
+
return (r / 8 >> 0) + (7 & r && 1);
|
|
1247
|
+
}, Rn = function(r, e, t) {
|
|
1248
|
+
(t == null || t > r.length) && (t = r.length);
|
|
1249
|
+
var i = new (r instanceof re ? re : r instanceof ht ? ht : ce)(t - e);
|
|
1250
|
+
return i.set(r.subarray(e, t)), i;
|
|
1251
|
+
}, ke = function(r, e, t) {
|
|
1252
|
+
t <<= 7 & e;
|
|
1253
|
+
var i = e / 8 >> 0;
|
|
1254
|
+
r[i] |= t, r[i + 1] |= t >>> 8;
|
|
1255
|
+
}, mt = function(r, e, t) {
|
|
1256
|
+
t <<= 7 & e;
|
|
1257
|
+
var i = e / 8 >> 0;
|
|
1258
|
+
r[i] |= t, r[i + 1] |= t >>> 8, r[i + 2] |= t >>> 16;
|
|
1259
|
+
}, Ri = function(r, e) {
|
|
1260
|
+
for (var t = [], i = 0; i < r.length; ++i) r[i] && t.push({ s: i, f: r[i] });
|
|
1261
|
+
var s = t.length, n = t.slice();
|
|
1262
|
+
if (!s) return [new ce(0), 0];
|
|
1263
|
+
if (s == 1) {
|
|
1264
|
+
var o = new ce(t[0].s + 1);
|
|
1265
|
+
return o[t[0].s] = 1, [o, 1];
|
|
1266
|
+
}
|
|
1267
|
+
t.sort(function(F, O) {
|
|
1268
|
+
return F.f - O.f;
|
|
1269
|
+
}), t.push({ s: -1, f: 25001 });
|
|
1270
|
+
var a = t[0], l = t[1], c = 0, d = 1, u = 2;
|
|
1271
|
+
for (t[0] = { s: -1, f: a.f + l.f, l: a, r: l }; d != s - 1; ) a = t[t[c].f < t[u].f ? c++ : u++], l = t[c != d && t[c].f < t[u].f ? c++ : u++], t[d++] = { s: -1, f: a.f + l.f, l: a, r: l };
|
|
1272
|
+
var p = n[0].s;
|
|
1273
|
+
for (i = 1; i < s; ++i) n[i].s > p && (p = n[i].s);
|
|
1274
|
+
var h = new re(p + 1), _ = or(t[d - 1], h, 0);
|
|
1275
|
+
if (_ > e) {
|
|
1276
|
+
i = 0;
|
|
1277
|
+
var v = 0, b = _ - e, m = 1 << b;
|
|
1278
|
+
for (n.sort(function(F, O) {
|
|
1279
|
+
return h[O.s] - h[F.s] || F.f - O.f;
|
|
1280
|
+
}); i < s; ++i) {
|
|
1281
|
+
var y = n[i].s;
|
|
1282
|
+
if (!(h[y] > e)) break;
|
|
1283
|
+
v += m - (1 << _ - h[y]), h[y] = e;
|
|
1284
|
+
}
|
|
1285
|
+
for (v >>>= b; v > 0; ) {
|
|
1286
|
+
var E = n[i].s;
|
|
1287
|
+
h[E] < e ? v -= 1 << e - h[E]++ - 1 : ++i;
|
|
1288
|
+
}
|
|
1289
|
+
for (; i >= 0 && v; --i) {
|
|
1290
|
+
var I = n[i].s;
|
|
1291
|
+
h[I] == e && (--h[I], ++v);
|
|
1292
|
+
}
|
|
1293
|
+
_ = e;
|
|
1294
|
+
}
|
|
1295
|
+
return [new ce(h), _];
|
|
1296
|
+
}, or = function(r, e, t) {
|
|
1297
|
+
return r.s == -1 ? Math.max(or(r.l, e, t + 1), or(r.r, e, t + 1)) : e[r.s] = t;
|
|
1298
|
+
}, fs = function(r) {
|
|
1299
|
+
for (var e = r.length; e && !r[--e]; ) ;
|
|
1300
|
+
for (var t = new re(++e), i = 0, s = r[0], n = 1, o = function(l) {
|
|
1301
|
+
t[i++] = l;
|
|
1302
|
+
}, a = 1; a <= e; ++a) if (r[a] == s && a != e) ++n;
|
|
1303
|
+
else {
|
|
1304
|
+
if (!s && n > 2) {
|
|
1305
|
+
for (; n > 138; n -= 138) o(32754);
|
|
1306
|
+
n > 2 && (o(n > 10 ? n - 11 << 5 | 28690 : n - 3 << 5 | 12305), n = 0);
|
|
1307
|
+
} else if (n > 3) {
|
|
1308
|
+
for (o(s), --n; n > 6; n -= 6) o(8304);
|
|
1309
|
+
n > 2 && (o(n - 3 << 5 | 8208), n = 0);
|
|
1310
|
+
}
|
|
1311
|
+
for (; n--; ) o(s);
|
|
1312
|
+
n = 1, s = r[a];
|
|
1313
|
+
}
|
|
1314
|
+
return [t.subarray(0, i), e];
|
|
1315
|
+
}, yt = function(r, e) {
|
|
1316
|
+
for (var t = 0, i = 0; i < e.length; ++i) t += r[i] * e[i];
|
|
1317
|
+
return t;
|
|
1318
|
+
}, ar = function(r, e, t) {
|
|
1319
|
+
var i = t.length, s = Tn(e + 2);
|
|
1320
|
+
r[s] = 255 & i, r[s + 1] = i >>> 8, r[s + 2] = 255 ^ r[s], r[s + 3] = 255 ^ r[s + 1];
|
|
1321
|
+
for (var n = 0; n < i; ++n) r[s + n + 4] = t[n];
|
|
1322
|
+
return 8 * (s + 4 + i);
|
|
1323
|
+
}, ms = function(r, e, t, i, s, n, o, a, l, c, d) {
|
|
1324
|
+
ke(e, d++, t), ++s[256];
|
|
1325
|
+
for (var u = Ri(s, 15), p = u[0], h = u[1], _ = Ri(n, 15), v = _[0], b = _[1], m = fs(p), y = m[0], E = m[1], I = fs(v), F = I[0], O = I[1], L = new re(19), P = 0; P < y.length; ++P) L[31 & y[P]]++;
|
|
1326
|
+
for (P = 0; P < F.length; ++P) L[31 & F[P]]++;
|
|
1327
|
+
for (var D = Ri(L, 7), V = D[0], he = D[1], ae = 19; ae > 4 && !V[gs[ae - 1]]; --ae) ;
|
|
1328
|
+
var we, ve, fe, Xe, Fe = c + 5 << 3, Ue = yt(s, Qe) + yt(n, li) + o, me = yt(s, p) + yt(n, v) + o + 14 + 3 * ae + yt(L, V) + (2 * L[16] + 3 * L[17] + 7 * L[18]);
|
|
1329
|
+
if (Fe <= Ue && Fe <= me) return ar(e, d, r.subarray(l, l + c));
|
|
1330
|
+
if (ke(e, d, 1 + (me < Ue)), d += 2, me < Ue) {
|
|
1331
|
+
we = Pt(p, h), ve = p, fe = Pt(v, b), Xe = v;
|
|
1332
|
+
var Te = Pt(V, he);
|
|
1333
|
+
for (ke(e, d, E - 257), ke(e, d + 5, O - 1), ke(e, d + 10, ae - 4), d += 14, P = 0; P < ae; ++P) ke(e, d + 3 * P, V[gs[P]]);
|
|
1334
|
+
d += 3 * ae;
|
|
1335
|
+
for (var et = [y, F], Z = 0; Z < 2; ++Z) {
|
|
1336
|
+
var le = et[Z];
|
|
1337
|
+
for (P = 0; P < le.length; ++P) {
|
|
1338
|
+
var se = 31 & le[P];
|
|
1339
|
+
ke(e, d, Te[se]), d += V[se], se > 15 && (ke(e, d, le[P] >>> 5 & 127), d += le[P] >>> 12);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
} else we = ya, ve = Qe, fe = ba, Xe = li;
|
|
1343
|
+
for (P = 0; P < a; ++P) if (i[P] > 255) {
|
|
1344
|
+
se = i[P] >>> 18 & 31, mt(e, d, we[se + 257]), d += ve[se + 257], se > 7 && (ke(e, d, i[P] >>> 23 & 31), d += Sr[se]);
|
|
1345
|
+
var tt = 31 & i[P];
|
|
1346
|
+
mt(e, d, fe[tt]), d += Xe[tt], tt > 3 && (mt(e, d, i[P] >>> 5 & 8191), d += Er[tt]);
|
|
1347
|
+
} else mt(e, d, we[i[P]]), d += ve[i[P]];
|
|
1348
|
+
return mt(e, d, we[256]), d + ve[256];
|
|
1349
|
+
}, wa = new ht([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]), ka = function() {
|
|
1350
|
+
for (var r = new ht(256), e = 0; e < 256; ++e) {
|
|
1351
|
+
for (var t = e, i = 9; --i; ) t = (1 & t && 3988292384) ^ t >>> 1;
|
|
1352
|
+
r[e] = t;
|
|
1353
|
+
}
|
|
1354
|
+
return r;
|
|
1355
|
+
}(), Sa = function() {
|
|
1356
|
+
var r = 4294967295;
|
|
1357
|
+
return { p: function(e) {
|
|
1358
|
+
for (var t = r, i = 0; i < e.length; ++i) t = ka[255 & t ^ e[i]] ^ t >>> 8;
|
|
1359
|
+
r = t;
|
|
1360
|
+
}, d: function() {
|
|
1361
|
+
return 4294967295 ^ r;
|
|
1362
|
+
} };
|
|
1363
|
+
}, Ea = function(r, e, t, i, s) {
|
|
1364
|
+
return function(n, o, a, l, c, d) {
|
|
1365
|
+
var u = n.length, p = new ce(l + u + 5 * (1 + Math.floor(u / 7e3)) + c), h = p.subarray(l, p.length - c), _ = 0;
|
|
1366
|
+
if (!o || u < 8) for (var v = 0; v <= u; v += 65535) {
|
|
1367
|
+
var b = v + 65535;
|
|
1368
|
+
b < u ? _ = ar(h, _, n.subarray(v, b)) : (h[v] = d, _ = ar(h, _, n.subarray(v, u)));
|
|
1369
|
+
}
|
|
1370
|
+
else {
|
|
1371
|
+
for (var m = wa[o - 1], y = m >>> 13, E = 8191 & m, I = (1 << a) - 1, F = new re(32768), O = new re(I + 1), L = Math.ceil(a / 3), P = 2 * L, D = function(mi) {
|
|
1372
|
+
return (n[mi] ^ n[mi + 1] << L ^ n[mi + 2] << P) & I;
|
|
1373
|
+
}, V = new ht(25e3), he = new re(288), ae = new re(32), we = 0, ve = 0, fe = (v = 0, 0), Xe = 0, Fe = 0; v < u; ++v) {
|
|
1374
|
+
var Ue = D(v), me = 32767 & v, Te = O[Ue];
|
|
1375
|
+
if (F[me] = Te, O[Ue] = me, Xe <= v) {
|
|
1376
|
+
var et = u - v;
|
|
1377
|
+
if ((we > 7e3 || fe > 24576) && et > 423) {
|
|
1378
|
+
_ = ms(n, h, 0, V, he, ae, ve, fe, Fe, v - Fe, _), fe = we = ve = 0, Fe = v;
|
|
1379
|
+
for (var Z = 0; Z < 286; ++Z) he[Z] = 0;
|
|
1380
|
+
for (Z = 0; Z < 30; ++Z) ae[Z] = 0;
|
|
1381
|
+
}
|
|
1382
|
+
var le = 2, se = 0, tt = E, Re = me - Te & 32767;
|
|
1383
|
+
if (et > 2 && Ue == D(v - Re)) for (var co = Math.min(y, et) - 1, ho = Math.min(32767, v), po = Math.min(258, et); Re <= ho && --tt && me != Te; ) {
|
|
1384
|
+
if (n[v + le] == n[v + le - Re]) {
|
|
1385
|
+
for (var $e = 0; $e < po && n[v + $e] == n[v + $e - Re]; ++$e) ;
|
|
1386
|
+
if ($e > le) {
|
|
1387
|
+
if (le = $e, se = Re, $e > co) break;
|
|
1388
|
+
var _o = Math.min(Re, $e - 2), $r = 0;
|
|
1389
|
+
for (Z = 0; Z < _o; ++Z) {
|
|
1390
|
+
var fi = v - Re + Z + 32768 & 32767, Or = fi - F[fi] + 32768 & 32767;
|
|
1391
|
+
Or > $r && ($r = Or, Te = fi);
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
Re += (me = Te) - (Te = F[me]) + 32768 & 32767;
|
|
1396
|
+
}
|
|
1397
|
+
if (se) {
|
|
1398
|
+
V[fe++] = 268435456 | nr[le] << 18 | vs[se];
|
|
1399
|
+
var Lr = 31 & nr[le], Mr = 31 & vs[se];
|
|
1400
|
+
ve += Sr[Lr] + Er[Mr], ++he[257 + Lr], ++ae[Mr], Xe = v + le, ++we;
|
|
1401
|
+
} else V[fe++] = n[v], ++he[n[v]];
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
_ = ms(n, h, d, V, he, ae, ve, fe, Fe, v - Fe, _);
|
|
1405
|
+
}
|
|
1406
|
+
return Rn(p, 0, l + Tn(_) + c);
|
|
1407
|
+
}(r, e.level == null ? 6 : e.level, e.mem == null ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(r.length)))) : 12 + e.mem, t, i, !0);
|
|
1408
|
+
}, lr = function(r, e, t) {
|
|
1409
|
+
for (; t; ++e) r[e] = t, t >>>= 8;
|
|
1410
|
+
}, xa = function(r, e) {
|
|
1411
|
+
var t = e.filename;
|
|
1412
|
+
if (r[0] = 31, r[1] = 139, r[2] = 8, r[8] = e.level < 2 ? 4 : e.level == 9 ? 2 : 0, r[9] = 3, e.mtime != 0 && lr(r, 4, Math.floor(new Date(e.mtime || Date.now()) / 1e3)), t) {
|
|
1413
|
+
r[3] = 8;
|
|
1414
|
+
for (var i = 0; i <= t.length; ++i) r[i + 10] = t.charCodeAt(i);
|
|
1415
|
+
}
|
|
1416
|
+
}, Ia = function(r) {
|
|
1417
|
+
return 10 + (r.filename && r.filename.length + 1 || 0);
|
|
1418
|
+
};
|
|
1419
|
+
function $n(r, e) {
|
|
1420
|
+
e === void 0 && (e = {});
|
|
1421
|
+
var t = Sa(), i = r.length;
|
|
1422
|
+
t.p(r);
|
|
1423
|
+
var s = Ea(r, e, Ia(e), 8), n = s.length;
|
|
1424
|
+
return xa(s, e), lr(s, n - 8, t.d()), lr(s, n - 4, i), s;
|
|
1425
|
+
}
|
|
1426
|
+
function On(r, e) {
|
|
1427
|
+
var t = r.length;
|
|
1428
|
+
if (typeof TextEncoder < "u") return new TextEncoder().encode(r);
|
|
1429
|
+
for (var i = new ce(r.length + (r.length >>> 1)), s = 0, n = function(c) {
|
|
1430
|
+
i[s++] = c;
|
|
1431
|
+
}, o = 0; o < t; ++o) {
|
|
1432
|
+
if (s + 5 > i.length) {
|
|
1433
|
+
var a = new ce(s + 8 + (t - o << 1));
|
|
1434
|
+
a.set(i), i = a;
|
|
1435
|
+
}
|
|
1436
|
+
var l = r.charCodeAt(o);
|
|
1437
|
+
l < 128 || e ? n(l) : l < 2048 ? (n(192 | l >>> 6), n(128 | 63 & l)) : l > 55295 && l < 57344 ? (n(240 | (l = 65536 + (1047552 & l) | 1023 & r.charCodeAt(++o)) >>> 18), n(128 | l >>> 12 & 63), n(128 | l >>> 6 & 63), n(128 | 63 & l)) : (n(224 | l >>> 12), n(128 | l >>> 6 & 63), n(128 | 63 & l));
|
|
1438
|
+
}
|
|
1439
|
+
return Rn(i, 0, s);
|
|
1440
|
+
}
|
|
1441
|
+
function Ca(r, e) {
|
|
1442
|
+
return function(t) {
|
|
1443
|
+
for (var i = 0, s = 0; s < t.length; s++) i = (i << 5) - i + t.charCodeAt(s), i |= 0;
|
|
1444
|
+
return Math.abs(i);
|
|
1445
|
+
}(r) % 100 < ue(100 * e, 0, 100);
|
|
1446
|
+
}
|
|
1447
|
+
var xt = "[SessionRecording]", Y = Q(xt);
|
|
1448
|
+
function zt() {
|
|
1449
|
+
var r, e;
|
|
1450
|
+
return C == null || (r = C.__PosthogExtensions__) === null || r === void 0 || (e = r.rrweb) === null || e === void 0 ? void 0 : e.record;
|
|
1451
|
+
}
|
|
1452
|
+
var Pa = 3e5, Fa = [pe.MouseMove, pe.MouseInteraction, pe.Scroll, pe.ViewportResize, pe.Input, pe.TouchMove, pe.MediaInteraction, pe.Drag], ys = (r) => ({ rrwebMethod: r, enqueuedAt: Date.now(), attempt: 1 });
|
|
1453
|
+
function We(r) {
|
|
1454
|
+
return function(e, t) {
|
|
1455
|
+
for (var i = "", s = 0; s < e.length; ) {
|
|
1456
|
+
var n = e[s++];
|
|
1457
|
+
i += String.fromCharCode(n);
|
|
1458
|
+
}
|
|
1459
|
+
return i;
|
|
1460
|
+
}($n(On(JSON.stringify(r))));
|
|
1461
|
+
}
|
|
1462
|
+
function bs(r) {
|
|
1463
|
+
return r.type === Ee.Custom && r.data.tag === "sessionIdle";
|
|
1464
|
+
}
|
|
1465
|
+
function ws(r, e) {
|
|
1466
|
+
return e.some((t) => t.matching === "regex" && new RegExp(t.url).test(r));
|
|
1467
|
+
}
|
|
1468
|
+
class Ta {
|
|
1469
|
+
get sessionIdleThresholdMilliseconds() {
|
|
1470
|
+
return this.instance.config.session_recording.session_idle_threshold_ms || 3e5;
|
|
1471
|
+
}
|
|
1472
|
+
get started() {
|
|
1473
|
+
return this._captureStarted;
|
|
1474
|
+
}
|
|
1475
|
+
get sessionManager() {
|
|
1476
|
+
if (!this.instance.sessionManager) throw new Error(xt + " must be started with a valid sessionManager.");
|
|
1477
|
+
return this.instance.sessionManager;
|
|
1478
|
+
}
|
|
1479
|
+
get fullSnapshotIntervalMillis() {
|
|
1480
|
+
var e, t;
|
|
1481
|
+
return this.triggerStatus === "trigger_pending" ? 6e4 : (e = (t = this.instance.config.session_recording) === null || t === void 0 ? void 0 : t.full_snapshot_interval_millis) !== null && e !== void 0 ? e : Pa;
|
|
1482
|
+
}
|
|
1483
|
+
get isSampled() {
|
|
1484
|
+
var e = this.instance.get_property(St);
|
|
1485
|
+
return Ae(e) ? e : null;
|
|
1486
|
+
}
|
|
1487
|
+
get sessionDuration() {
|
|
1488
|
+
var e, t, i = (e = this.buffer) === null || e === void 0 ? void 0 : e.data[((t = this.buffer) === null || t === void 0 ? void 0 : t.data.length) - 1], { sessionStartTimestamp: s } = this.sessionManager.checkAndGetSessionAndWindowId(!0);
|
|
1489
|
+
return i ? i.timestamp - s : null;
|
|
1490
|
+
}
|
|
1491
|
+
get isRecordingEnabled() {
|
|
1492
|
+
var e = !!this.instance.get_property(Vi), t = !this.instance.config.disable_session_recording;
|
|
1493
|
+
return g && e && t;
|
|
1494
|
+
}
|
|
1495
|
+
get isConsoleLogCaptureEnabled() {
|
|
1496
|
+
var e = !!this.instance.get_property(Yr), t = this.instance.config.enable_recording_console_log;
|
|
1497
|
+
return t ?? e;
|
|
1498
|
+
}
|
|
1499
|
+
get canvasRecording() {
|
|
1500
|
+
var e, t, i, s, n, o, a = this.instance.config.session_recording.captureCanvas, l = this.instance.get_property(Zr), c = (e = (t = a == null ? void 0 : a.recordCanvas) !== null && t !== void 0 ? t : l == null ? void 0 : l.enabled) !== null && e !== void 0 && e, d = (i = (s = a == null ? void 0 : a.canvasFps) !== null && s !== void 0 ? s : l == null ? void 0 : l.fps) !== null && i !== void 0 ? i : 4, u = (n = (o = a == null ? void 0 : a.canvasQuality) !== null && o !== void 0 ? o : l == null ? void 0 : l.quality) !== null && n !== void 0 ? n : 0.4;
|
|
1501
|
+
if (typeof u == "string") {
|
|
1502
|
+
var p = parseFloat(u);
|
|
1503
|
+
u = isNaN(p) ? 0.4 : p;
|
|
1504
|
+
}
|
|
1505
|
+
return { enabled: c, fps: ue(d, 0, 12, "canvas recording fps", 4), quality: ue(u, 0, 1, "canvas recording quality", 0.4) };
|
|
1506
|
+
}
|
|
1507
|
+
get networkPayloadCapture() {
|
|
1508
|
+
var e, t, i = this.instance.get_property(Kr), s = { recordHeaders: (e = this.instance.config.session_recording) === null || e === void 0 ? void 0 : e.recordHeaders, recordBody: (t = this.instance.config.session_recording) === null || t === void 0 ? void 0 : t.recordBody }, n = (s == null ? void 0 : s.recordHeaders) || (i == null ? void 0 : i.recordHeaders), o = (s == null ? void 0 : s.recordBody) || (i == null ? void 0 : i.recordBody), a = N(this.instance.config.capture_performance) ? this.instance.config.capture_performance.network_timing : this.instance.config.capture_performance, l = !!(Ae(a) ? a : i != null && i.capturePerformance);
|
|
1509
|
+
return n || o || l ? { recordHeaders: n, recordBody: o, recordPerformance: l } : void 0;
|
|
1510
|
+
}
|
|
1511
|
+
get masking() {
|
|
1512
|
+
var e, t, i, s, n, o, a = this.instance.get_property(Qr), l = { maskAllInputs: (e = this.instance.config.session_recording) === null || e === void 0 ? void 0 : e.maskAllInputs, maskTextSelector: (t = this.instance.config.session_recording) === null || t === void 0 ? void 0 : t.maskTextSelector, blockSelector: (i = this.instance.config.session_recording) === null || i === void 0 ? void 0 : i.blockSelector }, c = (s = l == null ? void 0 : l.maskAllInputs) !== null && s !== void 0 ? s : a == null ? void 0 : a.maskAllInputs, d = (n = l == null ? void 0 : l.maskTextSelector) !== null && n !== void 0 ? n : a == null ? void 0 : a.maskTextSelector, u = (o = l == null ? void 0 : l.blockSelector) !== null && o !== void 0 ? o : a == null ? void 0 : a.blockSelector;
|
|
1513
|
+
return k(c) && k(d) && k(u) ? void 0 : { maskAllInputs: c == null || c, maskTextSelector: d, blockSelector: u };
|
|
1514
|
+
}
|
|
1515
|
+
get sampleRate() {
|
|
1516
|
+
var e = this.instance.get_property(Xr);
|
|
1517
|
+
return ee(e) ? e : null;
|
|
1518
|
+
}
|
|
1519
|
+
get minimumDuration() {
|
|
1520
|
+
var e = this.instance.get_property(es);
|
|
1521
|
+
return ee(e) ? e : null;
|
|
1522
|
+
}
|
|
1523
|
+
get status() {
|
|
1524
|
+
return this.receivedDecide ? this.isRecordingEnabled ? this.isSampled === !1 ? "disabled" : this._urlBlocked ? "paused" : R(this._linkedFlag) || this._linkedFlagSeen ? this.triggerStatus === "trigger_pending" ? "buffering" : Ae(this.isSampled) ? this.isSampled ? "sampled" : "disabled" : "active" : "buffering" : "disabled" : "buffering";
|
|
1525
|
+
}
|
|
1526
|
+
get urlTriggerStatus() {
|
|
1527
|
+
var e;
|
|
1528
|
+
return this._urlTriggers.length === 0 ? "trigger_disabled" : ((e = this.instance) === null || e === void 0 ? void 0 : e.get_property(bi)) === this.sessionId ? "trigger_activated" : "trigger_pending";
|
|
1529
|
+
}
|
|
1530
|
+
get eventTriggerStatus() {
|
|
1531
|
+
var e;
|
|
1532
|
+
return this._eventTriggers.length === 0 ? "trigger_disabled" : ((e = this.instance) === null || e === void 0 ? void 0 : e.get_property(wi)) === this.sessionId ? "trigger_activated" : "trigger_pending";
|
|
1533
|
+
}
|
|
1534
|
+
get triggerStatus() {
|
|
1535
|
+
var e = this.eventTriggerStatus === "trigger_activated" || this.urlTriggerStatus === "trigger_activated", t = this.eventTriggerStatus === "trigger_pending" || this.urlTriggerStatus === "trigger_pending";
|
|
1536
|
+
return e ? "trigger_activated" : t ? "trigger_pending" : "trigger_disabled";
|
|
1537
|
+
}
|
|
1538
|
+
constructor(e) {
|
|
1539
|
+
if (w(this, "queuedRRWebEvents", []), w(this, "isIdle", "unknown"), w(this, "_linkedFlagSeen", !1), w(this, "_lastActivityTimestamp", Date.now()), w(this, "_linkedFlag", null), w(this, "_removePageViewCaptureHook", void 0), w(this, "_onSessionIdListener", void 0), w(this, "_persistDecideOnSessionListener", void 0), w(this, "_samplingSessionListener", void 0), w(this, "_urlTriggers", []), w(this, "_urlBlocklist", []), w(this, "_urlBlocked", !1), w(this, "_eventTriggers", []), w(this, "_removeEventTriggerCaptureHook", void 0), w(this, "_forceAllowLocalhostNetworkCapture", !1), w(this, "_onBeforeUnload", () => {
|
|
1540
|
+
this._flushBuffer();
|
|
1541
|
+
}), w(this, "_onOffline", () => {
|
|
1542
|
+
this._tryAddCustomEvent("browser offline", {});
|
|
1543
|
+
}), w(this, "_onOnline", () => {
|
|
1544
|
+
this._tryAddCustomEvent("browser online", {});
|
|
1545
|
+
}), w(this, "_onVisibilityChange", () => {
|
|
1546
|
+
if (S != null && S.visibilityState) {
|
|
1547
|
+
var s = "window " + S.visibilityState;
|
|
1548
|
+
this._tryAddCustomEvent(s, {});
|
|
1549
|
+
}
|
|
1550
|
+
}), this.instance = e, this._captureStarted = !1, this._endpoint = "/s/", this.stopRrweb = void 0, this.receivedDecide = !1, !this.instance.sessionManager) throw Y.error("started without valid sessionManager"), new Error(xt + " started without valid sessionManager. This is a bug.");
|
|
1551
|
+
if (this.instance.config.__preview_experimental_cookieless_mode) throw new Error(xt + " cannot be used with __preview_experimental_cookieless_mode.");
|
|
1552
|
+
var { sessionId: t, windowId: i } = this.sessionManager.checkAndGetSessionAndWindowId();
|
|
1553
|
+
this.sessionId = t, this.windowId = i, this.buffer = this.clearBuffer(), this.sessionIdleThresholdMilliseconds >= this.sessionManager.sessionTimeoutMs && Y.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds, ") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs, "). Session will never be detected as idle"));
|
|
1554
|
+
}
|
|
1555
|
+
startIfEnabledOrStop(e) {
|
|
1556
|
+
this.isRecordingEnabled ? (this._startCapture(e), U(g, "beforeunload", this._onBeforeUnload), U(g, "offline", this._onOffline), U(g, "online", this._onOnline), U(g, "visibilitychange", this._onVisibilityChange), this._setupSampling(), this._addEventTriggerListener(), R(this._removePageViewCaptureHook) && (this._removePageViewCaptureHook = this.instance.on("eventCaptured", (t) => {
|
|
1557
|
+
try {
|
|
1558
|
+
if (t.event === "$pageview") {
|
|
1559
|
+
var i = t != null && t.properties.$current_url ? this._maskUrl(t == null ? void 0 : t.properties.$current_url) : "";
|
|
1560
|
+
if (!i) return;
|
|
1561
|
+
this._tryAddCustomEvent("$pageview", { href: i });
|
|
1562
|
+
}
|
|
1563
|
+
} catch (s) {
|
|
1564
|
+
Y.error("Could not add $pageview to rrweb session", s);
|
|
1565
|
+
}
|
|
1566
|
+
})), this._onSessionIdListener || (this._onSessionIdListener = this.sessionManager.onSessionId((t, i, s) => {
|
|
1567
|
+
var n, o, a, l;
|
|
1568
|
+
s && (this._tryAddCustomEvent("$session_id_change", { sessionId: t, windowId: i, changeReason: s }), (n = this.instance) === null || n === void 0 || (o = n.persistence) === null || o === void 0 || o.unregister(wi), (a = this.instance) === null || a === void 0 || (l = a.persistence) === null || l === void 0 || l.unregister(bi));
|
|
1569
|
+
}))) : this.stopRecording();
|
|
1570
|
+
}
|
|
1571
|
+
stopRecording() {
|
|
1572
|
+
var e, t, i, s;
|
|
1573
|
+
this._captureStarted && this.stopRrweb && (this.stopRrweb(), this.stopRrweb = void 0, this._captureStarted = !1, g == null || g.removeEventListener("beforeunload", this._onBeforeUnload), g == null || g.removeEventListener("offline", this._onOffline), g == null || g.removeEventListener("online", this._onOnline), g == null || g.removeEventListener("visibilitychange", this._onVisibilityChange), this.clearBuffer(), clearInterval(this._fullSnapshotTimer), (e = this._removePageViewCaptureHook) === null || e === void 0 || e.call(this), this._removePageViewCaptureHook = void 0, (t = this._removeEventTriggerCaptureHook) === null || t === void 0 || t.call(this), this._removeEventTriggerCaptureHook = void 0, (i = this._onSessionIdListener) === null || i === void 0 || i.call(this), this._onSessionIdListener = void 0, (s = this._samplingSessionListener) === null || s === void 0 || s.call(this), this._samplingSessionListener = void 0, Y.info("stopped"));
|
|
1574
|
+
}
|
|
1575
|
+
_resetSampling() {
|
|
1576
|
+
var e;
|
|
1577
|
+
(e = this.instance.persistence) === null || e === void 0 || e.unregister(St);
|
|
1578
|
+
}
|
|
1579
|
+
makeSamplingDecision(e) {
|
|
1580
|
+
var t, i = this.sessionId !== e, s = this.sampleRate;
|
|
1581
|
+
if (ee(s)) {
|
|
1582
|
+
var n = this.isSampled, o = i || !Ae(n), a = o ? Ca(e, s) : n;
|
|
1583
|
+
o && (a ? this._reportStarted("sampled") : Y.warn("Sample rate (".concat(s, ") has determined that this sessionId (").concat(e, ") will not be sent to the server.")), this._tryAddCustomEvent("samplingDecisionMade", { sampleRate: s, isSampled: a })), (t = this.instance.persistence) === null || t === void 0 || t.register({ [St]: a });
|
|
1584
|
+
} else this._resetSampling();
|
|
1585
|
+
}
|
|
1586
|
+
onRemoteConfig(e) {
|
|
1587
|
+
var t, i, s, n, o, a;
|
|
1588
|
+
if (this._tryAddCustomEvent("$remote_config_received", e), this._persistRemoteConfig(e), this._linkedFlag = ((t = e.sessionRecording) === null || t === void 0 ? void 0 : t.linkedFlag) || null, (i = e.sessionRecording) !== null && i !== void 0 && i.endpoint && (this._endpoint = (a = e.sessionRecording) === null || a === void 0 ? void 0 : a.endpoint), this._setupSampling(), !R(this._linkedFlag) && !this._linkedFlagSeen) {
|
|
1589
|
+
var l = z(this._linkedFlag) ? this._linkedFlag : this._linkedFlag.flag, c = z(this._linkedFlag) ? null : this._linkedFlag.variant;
|
|
1590
|
+
this.instance.onFeatureFlags((d, u) => {
|
|
1591
|
+
var p = N(u) && l in u, h = c ? u[l] === c : p;
|
|
1592
|
+
h && this._reportStarted("linked_flag_matched", { linkedFlag: l, linkedVariant: c }), this._linkedFlagSeen = h;
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
(s = e.sessionRecording) !== null && s !== void 0 && s.urlTriggers && (this._urlTriggers = e.sessionRecording.urlTriggers), (n = e.sessionRecording) !== null && n !== void 0 && n.urlBlocklist && (this._urlBlocklist = e.sessionRecording.urlBlocklist), (o = e.sessionRecording) !== null && o !== void 0 && o.eventTriggers && (this._eventTriggers = e.sessionRecording.eventTriggers), this.receivedDecide = !0, this.startIfEnabledOrStop();
|
|
1596
|
+
}
|
|
1597
|
+
_setupSampling() {
|
|
1598
|
+
ee(this.sampleRate) && R(this._samplingSessionListener) && (this._samplingSessionListener = this.sessionManager.onSessionId((e) => {
|
|
1599
|
+
this.makeSamplingDecision(e);
|
|
1600
|
+
}));
|
|
1601
|
+
}
|
|
1602
|
+
_persistRemoteConfig(e) {
|
|
1603
|
+
if (this.instance.persistence) {
|
|
1604
|
+
var t, i = this.instance.persistence, s = () => {
|
|
1605
|
+
var n, o, a, l, c, d, u, p, h, _ = (n = e.sessionRecording) === null || n === void 0 ? void 0 : n.sampleRate, v = R(_) ? null : parseFloat(_);
|
|
1606
|
+
R(v) && this._resetSampling();
|
|
1607
|
+
var b = (o = e.sessionRecording) === null || o === void 0 ? void 0 : o.minimumDurationMilliseconds;
|
|
1608
|
+
i.register({ [Vi]: !!e.sessionRecording, [Yr]: (a = e.sessionRecording) === null || a === void 0 ? void 0 : a.consoleLogRecordingEnabled, [Kr]: f({ capturePerformance: e.capturePerformance }, (l = e.sessionRecording) === null || l === void 0 ? void 0 : l.networkPayloadCapture), [Qr]: (c = e.sessionRecording) === null || c === void 0 ? void 0 : c.masking, [Zr]: { enabled: (d = e.sessionRecording) === null || d === void 0 ? void 0 : d.recordCanvas, fps: (u = e.sessionRecording) === null || u === void 0 ? void 0 : u.canvasFps, quality: (p = e.sessionRecording) === null || p === void 0 ? void 0 : p.canvasQuality }, [Xr]: v, [es]: k(b) ? null : b, [ts]: (h = e.sessionRecording) === null || h === void 0 ? void 0 : h.scriptConfig });
|
|
1609
|
+
};
|
|
1610
|
+
s(), (t = this._persistDecideOnSessionListener) === null || t === void 0 || t.call(this), this._persistDecideOnSessionListener = this.sessionManager.onSessionId(s);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
log(e) {
|
|
1614
|
+
var t, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "log";
|
|
1615
|
+
(t = this.instance.sessionRecording) === null || t === void 0 || t.onRRwebEmit({ type: 6, data: { plugin: "rrweb/console@1", payload: { level: i, trace: [], payload: [JSON.stringify(e)] } }, timestamp: Date.now() });
|
|
1616
|
+
}
|
|
1617
|
+
_startCapture(e) {
|
|
1618
|
+
if (!k(Object.assign) && !k(Array.from) && !(this._captureStarted || this.instance.config.disable_session_recording || this.instance.consent.isOptedOut())) {
|
|
1619
|
+
var t, i;
|
|
1620
|
+
this._captureStarted = !0, this.sessionManager.checkAndGetSessionAndWindowId(), zt() ? this._onScriptLoaded() : (t = C.__PosthogExtensions__) === null || t === void 0 || (i = t.loadExternalDependency) === null || i === void 0 || i.call(t, this.instance, this.scriptName, (s) => {
|
|
1621
|
+
if (s) return Y.error("could not load recorder", s);
|
|
1622
|
+
this._onScriptLoaded();
|
|
1623
|
+
}), Y.info("starting"), this.status === "active" && this._reportStarted(e || "recording_initialized");
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
get scriptName() {
|
|
1627
|
+
var e, t, i;
|
|
1628
|
+
return ((e = this.instance) === null || e === void 0 || (t = e.persistence) === null || t === void 0 || (i = t.get_property(ts)) === null || i === void 0 ? void 0 : i.script) || "recorder";
|
|
1629
|
+
}
|
|
1630
|
+
isInteractiveEvent(e) {
|
|
1631
|
+
var t;
|
|
1632
|
+
return e.type === 3 && Fa.indexOf((t = e.data) === null || t === void 0 ? void 0 : t.source) !== -1;
|
|
1633
|
+
}
|
|
1634
|
+
_updateWindowAndSessionIds(e) {
|
|
1635
|
+
var t = this.isInteractiveEvent(e);
|
|
1636
|
+
t || this.isIdle || e.timestamp - this._lastActivityTimestamp > this.sessionIdleThresholdMilliseconds && (this.isIdle = !0, clearInterval(this._fullSnapshotTimer), this._tryAddCustomEvent("sessionIdle", { eventTimestamp: e.timestamp, lastActivityTimestamp: this._lastActivityTimestamp, threshold: this.sessionIdleThresholdMilliseconds, bufferLength: this.buffer.data.length, bufferSize: this.buffer.size }), this._flushBuffer());
|
|
1637
|
+
var i = !1;
|
|
1638
|
+
if (t && (this._lastActivityTimestamp = e.timestamp, this.isIdle)) {
|
|
1639
|
+
var s = this.isIdle === "unknown";
|
|
1640
|
+
this.isIdle = !1, s || (this._tryAddCustomEvent("sessionNoLongerIdle", { reason: "user activity", type: e.type }), i = !0);
|
|
1641
|
+
}
|
|
1642
|
+
if (!this.isIdle) {
|
|
1643
|
+
var { windowId: n, sessionId: o } = this.sessionManager.checkAndGetSessionAndWindowId(!t, e.timestamp), a = this.sessionId !== o, l = this.windowId !== n;
|
|
1644
|
+
this.windowId = n, this.sessionId = o, a || l ? (this.stopRecording(), this.startIfEnabledOrStop("session_id_changed")) : i && this._scheduleFullSnapshot();
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
_tryRRWebMethod(e) {
|
|
1648
|
+
try {
|
|
1649
|
+
return e.rrwebMethod(), !0;
|
|
1650
|
+
} catch (t) {
|
|
1651
|
+
return this.queuedRRWebEvents.length < 10 ? this.queuedRRWebEvents.push({ enqueuedAt: e.enqueuedAt || Date.now(), attempt: e.attempt++, rrwebMethod: e.rrwebMethod }) : Y.warn("could not emit queued rrweb event.", t, e), !1;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
_tryAddCustomEvent(e, t) {
|
|
1655
|
+
return this._tryRRWebMethod(ys(() => zt().addCustomEvent(e, t)));
|
|
1656
|
+
}
|
|
1657
|
+
_tryTakeFullSnapshot() {
|
|
1658
|
+
return this._tryRRWebMethod(ys(() => zt().takeFullSnapshot()));
|
|
1659
|
+
}
|
|
1660
|
+
_onScriptLoaded() {
|
|
1661
|
+
var e, t, i, s, n = { blockClass: "ph-no-capture", blockSelector: void 0, ignoreClass: "ph-ignore-input", maskTextClass: "ph-mask", maskTextSelector: void 0, maskTextFn: void 0, maskAllInputs: !0, maskInputOptions: { password: !0 }, maskInputFn: void 0, slimDOMOptions: {}, collectFonts: !1, inlineStylesheet: !0, recordCrossOriginIframes: !1 }, o = this.instance.config.session_recording;
|
|
1662
|
+
for (var [a, l] of Object.entries(o || {})) a in n && (a === "maskInputOptions" ? n.maskInputOptions = f({ password: !0 }, l) : n[a] = l);
|
|
1663
|
+
this.canvasRecording && this.canvasRecording.enabled && (n.recordCanvas = !0, n.sampling = { canvas: this.canvasRecording.fps }, n.dataURLOptions = { type: "image/webp", quality: this.canvasRecording.quality }), this.masking && (n.maskAllInputs = (t = this.masking.maskAllInputs) === null || t === void 0 || t, n.maskTextSelector = (i = this.masking.maskTextSelector) !== null && i !== void 0 ? i : void 0, n.blockSelector = (s = this.masking.blockSelector) !== null && s !== void 0 ? s : void 0);
|
|
1664
|
+
var c = zt();
|
|
1665
|
+
if (c) {
|
|
1666
|
+
this.mutationRateLimiter = (e = this.mutationRateLimiter) !== null && e !== void 0 ? e : new fa(c, { refillRate: this.instance.config.session_recording.__mutationRateLimiterRefillRate, bucketSize: this.instance.config.session_recording.__mutationRateLimiterBucketSize, onBlockedNode: (u, p) => {
|
|
1667
|
+
var h = "Too many mutations on node '".concat(u, "'. Rate limiting. This could be due to SVG animations or something similar");
|
|
1668
|
+
Y.info(h, { node: p }), this.log(xt + " " + h, "warn");
|
|
1669
|
+
} });
|
|
1670
|
+
var d = this._gatherRRWebPlugins();
|
|
1671
|
+
this.stopRrweb = c(f({ emit: (u) => {
|
|
1672
|
+
this.onRRwebEmit(u);
|
|
1673
|
+
}, plugins: d }, n)), this._lastActivityTimestamp = Date.now(), this.isIdle = Ae(this.isIdle) ? this.isIdle : "unknown", this._tryAddCustomEvent("$session_options", { sessionRecordingOptions: n, activePlugins: d.map((u) => u == null ? void 0 : u.name) }), this._tryAddCustomEvent("$posthog_config", { config: this.instance.config });
|
|
1674
|
+
} else Y.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.");
|
|
1675
|
+
}
|
|
1676
|
+
_scheduleFullSnapshot() {
|
|
1677
|
+
if (this._fullSnapshotTimer && clearInterval(this._fullSnapshotTimer), this.isIdle !== !0) {
|
|
1678
|
+
var e = this.fullSnapshotIntervalMillis;
|
|
1679
|
+
e && (this._fullSnapshotTimer = setInterval(() => {
|
|
1680
|
+
this._tryTakeFullSnapshot();
|
|
1681
|
+
}, e));
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
_gatherRRWebPlugins() {
|
|
1685
|
+
var e, t, i, s, n = [], o = (e = C.__PosthogExtensions__) === null || e === void 0 || (t = e.rrwebPlugins) === null || t === void 0 ? void 0 : t.getRecordConsolePlugin;
|
|
1686
|
+
o && this.isConsoleLogCaptureEnabled && n.push(o());
|
|
1687
|
+
var a = (i = C.__PosthogExtensions__) === null || i === void 0 || (s = i.rrwebPlugins) === null || s === void 0 ? void 0 : s.getRecordNetworkPlugin;
|
|
1688
|
+
return this.networkPayloadCapture && ge(a) && (!Do.includes(location.hostname) || this._forceAllowLocalhostNetworkCapture ? n.push(a(va(this.instance.config, this.networkPayloadCapture))) : Y.info("NetworkCapture not started because we are on localhost.")), n;
|
|
1689
|
+
}
|
|
1690
|
+
onRRwebEmit(e) {
|
|
1691
|
+
var t;
|
|
1692
|
+
if (this._processQueuedEvents(), e && N(e)) {
|
|
1693
|
+
if (e.type === Ee.Meta) {
|
|
1694
|
+
var i = this._maskUrl(e.data.href);
|
|
1695
|
+
if (this._lastHref = i, !i) return;
|
|
1696
|
+
e.data.href = i;
|
|
1697
|
+
} else this._pageViewFallBack();
|
|
1698
|
+
if (this._checkUrlTriggerConditions(), !this._urlBlocked || function(u) {
|
|
1699
|
+
return u.type === Ee.Custom && u.data.tag === "recording paused";
|
|
1700
|
+
}(e)) {
|
|
1701
|
+
e.type === Ee.FullSnapshot && this._scheduleFullSnapshot(), e.type === Ee.FullSnapshot && this.triggerStatus === "trigger_pending" && this.clearBuffer();
|
|
1702
|
+
var s = this.mutationRateLimiter ? this.mutationRateLimiter.throttleMutations(e) : e;
|
|
1703
|
+
if (s) {
|
|
1704
|
+
var n = function(u) {
|
|
1705
|
+
var p = u;
|
|
1706
|
+
if (p && N(p) && p.type === 6 && N(p.data) && p.data.plugin === "rrweb/console@1") {
|
|
1707
|
+
p.data.payload.payload.length > 10 && (p.data.payload.payload = p.data.payload.payload.slice(0, 10), p.data.payload.payload.push("...[truncated]"));
|
|
1708
|
+
for (var h = [], _ = 0; _ < p.data.payload.payload.length; _++) p.data.payload.payload[_] && p.data.payload.payload[_].length > 2e3 ? h.push(p.data.payload.payload[_].slice(0, 2e3) + "...[truncated]") : h.push(p.data.payload.payload[_]);
|
|
1709
|
+
return p.data.payload.payload = h, u;
|
|
1710
|
+
}
|
|
1711
|
+
return u;
|
|
1712
|
+
}(s);
|
|
1713
|
+
if (this._updateWindowAndSessionIds(n), this.isIdle !== !0 || bs(n)) {
|
|
1714
|
+
if (bs(n)) {
|
|
1715
|
+
var o = n.data.payload;
|
|
1716
|
+
if (o) {
|
|
1717
|
+
var a = o.lastActivityTimestamp, l = o.threshold;
|
|
1718
|
+
n.timestamp = a + l;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
var c = (t = this.instance.config.session_recording.compress_events) === null || t === void 0 || t ? function(u) {
|
|
1722
|
+
if (ai(u) < 1024) return u;
|
|
1723
|
+
try {
|
|
1724
|
+
if (u.type === Ee.FullSnapshot) return f(f({}, u), {}, { data: We(u.data), cv: "2024-10" });
|
|
1725
|
+
if (u.type === Ee.IncrementalSnapshot && u.data.source === pe.Mutation) return f(f({}, u), {}, { cv: "2024-10", data: f(f({}, u.data), {}, { texts: We(u.data.texts), attributes: We(u.data.attributes), removes: We(u.data.removes), adds: We(u.data.adds) }) });
|
|
1726
|
+
if (u.type === Ee.IncrementalSnapshot && u.data.source === pe.StyleSheetRule) return f(f({}, u), {}, { cv: "2024-10", data: f(f({}, u.data), {}, { adds: u.data.adds ? We(u.data.adds) : void 0, removes: u.data.removes ? We(u.data.removes) : void 0 }) });
|
|
1727
|
+
} catch (p) {
|
|
1728
|
+
Y.error("could not compress event - will use uncompressed event", p);
|
|
1729
|
+
}
|
|
1730
|
+
return u;
|
|
1731
|
+
}(n) : n, d = { $snapshot_bytes: ai(c), $snapshot_data: c, $session_id: this.sessionId, $window_id: this.windowId };
|
|
1732
|
+
this.status !== "disabled" ? this._captureSnapshotBuffered(d) : this.clearBuffer();
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
_pageViewFallBack() {
|
|
1739
|
+
if (!this.instance.config.capture_pageview && g) {
|
|
1740
|
+
var e = this._maskUrl(g.location.href);
|
|
1741
|
+
this._lastHref !== e && (this._tryAddCustomEvent("$url_changed", { href: e }), this._lastHref = e);
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
_processQueuedEvents() {
|
|
1745
|
+
if (this.queuedRRWebEvents.length) {
|
|
1746
|
+
var e = [...this.queuedRRWebEvents];
|
|
1747
|
+
this.queuedRRWebEvents = [], e.forEach((t) => {
|
|
1748
|
+
Date.now() - t.enqueuedAt <= 2e3 && this._tryRRWebMethod(t);
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
_maskUrl(e) {
|
|
1753
|
+
var t = this.instance.config.session_recording;
|
|
1754
|
+
if (t.maskNetworkRequestFn) {
|
|
1755
|
+
var i, s = { url: e };
|
|
1756
|
+
return (i = s = t.maskNetworkRequestFn(s)) === null || i === void 0 ? void 0 : i.url;
|
|
1757
|
+
}
|
|
1758
|
+
return e;
|
|
1759
|
+
}
|
|
1760
|
+
clearBuffer() {
|
|
1761
|
+
return this.buffer = { size: 0, data: [], sessionId: this.sessionId, windowId: this.windowId }, this.buffer;
|
|
1762
|
+
}
|
|
1763
|
+
_flushBuffer() {
|
|
1764
|
+
this.flushBufferTimer && (clearTimeout(this.flushBufferTimer), this.flushBufferTimer = void 0);
|
|
1765
|
+
var e = this.minimumDuration, t = this.sessionDuration, i = ee(t) && t >= 0, s = ee(e) && i && t < e;
|
|
1766
|
+
return this.status === "buffering" || this.status === "paused" || this.status === "disabled" || s ? (this.flushBufferTimer = setTimeout(() => {
|
|
1767
|
+
this._flushBuffer();
|
|
1768
|
+
}, 2e3), this.buffer) : (this.buffer.data.length > 0 && ir(this.buffer).forEach((n) => {
|
|
1769
|
+
this._captureSnapshot({ $snapshot_bytes: n.size, $snapshot_data: n.data, $session_id: n.sessionId, $window_id: n.windowId, $lib: "web", $lib_version: Ie.LIB_VERSION });
|
|
1770
|
+
}), this.clearBuffer());
|
|
1771
|
+
}
|
|
1772
|
+
_captureSnapshotBuffered(e) {
|
|
1773
|
+
var t, i = 2 + (((t = this.buffer) === null || t === void 0 ? void 0 : t.data.length) || 0);
|
|
1774
|
+
!this.isIdle && (this.buffer.size + e.$snapshot_bytes + i > 943718.4 || this.buffer.sessionId !== this.sessionId) && (this.buffer = this._flushBuffer()), this.buffer.size += e.$snapshot_bytes, this.buffer.data.push(e.$snapshot_data), this.flushBufferTimer || this.isIdle || (this.flushBufferTimer = setTimeout(() => {
|
|
1775
|
+
this._flushBuffer();
|
|
1776
|
+
}, 2e3));
|
|
1777
|
+
}
|
|
1778
|
+
_captureSnapshot(e) {
|
|
1779
|
+
this.instance.capture("$snapshot", e, { _url: this.instance.requestRouter.endpointFor("api", this._endpoint), _noTruncate: !0, _batchKey: "recordings", skip_client_rate_limiting: !0 });
|
|
1780
|
+
}
|
|
1781
|
+
_checkUrlTriggerConditions() {
|
|
1782
|
+
if (g !== void 0 && g.location.href) {
|
|
1783
|
+
var e = g.location.href, t = this._urlBlocked, i = ws(e, this._urlBlocklist);
|
|
1784
|
+
i && !t ? this._pauseRecording() : !i && t && this._resumeRecording(), ws(e, this._urlTriggers) && this._activateTrigger("url");
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
_activateTrigger(e) {
|
|
1788
|
+
var t, i;
|
|
1789
|
+
this.triggerStatus === "trigger_pending" && ((t = this.instance) === null || t === void 0 || (i = t.persistence) === null || i === void 0 || i.register({ [e === "url" ? bi : wi]: this.sessionId }), this._flushBuffer(), this._reportStarted(e + "_trigger_matched"));
|
|
1790
|
+
}
|
|
1791
|
+
_pauseRecording() {
|
|
1792
|
+
this._urlBlocked || (this._urlBlocked = !0, clearInterval(this._fullSnapshotTimer), Y.info("recording paused due to URL blocker"), this._tryAddCustomEvent("recording paused", { reason: "url blocker" }));
|
|
1793
|
+
}
|
|
1794
|
+
_resumeRecording() {
|
|
1795
|
+
this._urlBlocked && (this._urlBlocked = !1, this._tryTakeFullSnapshot(), this._scheduleFullSnapshot(), this._tryAddCustomEvent("recording resumed", { reason: "left blocked url" }), Y.info("recording resumed"));
|
|
1796
|
+
}
|
|
1797
|
+
_addEventTriggerListener() {
|
|
1798
|
+
this._eventTriggers.length !== 0 && R(this._removeEventTriggerCaptureHook) && (this._removeEventTriggerCaptureHook = this.instance.on("eventCaptured", (e) => {
|
|
1799
|
+
try {
|
|
1800
|
+
this._eventTriggers.includes(e.event) && this._activateTrigger("event");
|
|
1801
|
+
} catch (t) {
|
|
1802
|
+
Y.error("Could not activate event trigger", t);
|
|
1803
|
+
}
|
|
1804
|
+
}));
|
|
1805
|
+
}
|
|
1806
|
+
overrideLinkedFlag() {
|
|
1807
|
+
this._linkedFlagSeen = !0, this._tryTakeFullSnapshot(), this._reportStarted("linked_flag_overridden");
|
|
1808
|
+
}
|
|
1809
|
+
overrideSampling() {
|
|
1810
|
+
var e;
|
|
1811
|
+
(e = this.instance.persistence) === null || e === void 0 || e.register({ [St]: !0 }), this._tryTakeFullSnapshot(), this._reportStarted("sampling_overridden");
|
|
1812
|
+
}
|
|
1813
|
+
overrideTrigger(e) {
|
|
1814
|
+
this._activateTrigger(e);
|
|
1815
|
+
}
|
|
1816
|
+
_reportStarted(e, t) {
|
|
1817
|
+
this.instance.register_for_session({ $session_recording_start_reason: e }), Y.info(e.replace("_", " "), t), T(["recording_initialized", "session_id_changed"], e) || this._tryAddCustomEvent(e, t);
|
|
1818
|
+
}
|
|
1819
|
+
get sdkDebugProperties() {
|
|
1820
|
+
var { sessionStartTimestamp: e } = this.sessionManager.checkAndGetSessionAndWindowId(!0);
|
|
1821
|
+
return { $recording_status: this.status, $sdk_debug_replay_internal_buffer_length: this.buffer.data.length, $sdk_debug_replay_internal_buffer_size: this.buffer.size, $sdk_debug_current_session_duration: this.sessionDuration, $sdk_debug_session_start: e };
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
var $i = Q("[SegmentIntegration]");
|
|
1825
|
+
function Ra(r, e) {
|
|
1826
|
+
var t = r.config.segment;
|
|
1827
|
+
if (!t) return e();
|
|
1828
|
+
(function(i, s) {
|
|
1829
|
+
var n = i.config.segment;
|
|
1830
|
+
if (!n) return s();
|
|
1831
|
+
var o = (l) => {
|
|
1832
|
+
var c = () => l.anonymousId() || De();
|
|
1833
|
+
i.config.get_device_id = c, l.id() && (i.register({ distinct_id: l.id(), $device_id: c() }), i.persistence.set_property(Se, "identified")), s();
|
|
1834
|
+
}, a = n.user();
|
|
1835
|
+
"then" in a && ge(a.then) ? a.then((l) => o(l)) : o(a);
|
|
1836
|
+
})(r, () => {
|
|
1837
|
+
t.register(((i) => {
|
|
1838
|
+
Promise && Promise.resolve || $i.warn("This browser does not have Promise support, and can not use the segment integration");
|
|
1839
|
+
var s = (n, o) => {
|
|
1840
|
+
var a;
|
|
1841
|
+
if (!o) return n;
|
|
1842
|
+
n.event.userId || n.event.anonymousId === i.get_distinct_id() || ($i.info("No userId set, resetting PostHog"), i.reset()), n.event.userId && n.event.userId !== i.get_distinct_id() && ($i.info("UserId set, identifying with PostHog"), i.identify(n.event.userId));
|
|
1843
|
+
var l = i._calculate_event_properties(o, (a = n.event.properties) !== null && a !== void 0 ? a : {}, /* @__PURE__ */ new Date());
|
|
1844
|
+
return n.event.properties = Object.assign({}, l, n.event.properties), n;
|
|
1845
|
+
};
|
|
1846
|
+
return { name: "PostHog JS", type: "enrichment", version: "1.0.0", isLoaded: () => !0, load: () => Promise.resolve(), track: (n) => s(n, n.event.event), page: (n) => s(n, "$pageview"), identify: (n) => s(n, "$identify"), screen: (n) => s(n, "$screen") };
|
|
1847
|
+
})(r)).then(() => {
|
|
1848
|
+
e();
|
|
1849
|
+
});
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1852
|
+
var Ln = "posthog-js";
|
|
1853
|
+
function Mn(r) {
|
|
1854
|
+
var { organization: e, projectId: t, prefix: i, severityAllowList: s = ["error"] } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1855
|
+
return (n) => {
|
|
1856
|
+
var o, a, l, c, d;
|
|
1857
|
+
if (!(s === "*" || s.includes(n.level)) || !r.__loaded) return n;
|
|
1858
|
+
n.tags || (n.tags = {});
|
|
1859
|
+
var u = r.requestRouter.endpointFor("ui", "/project/".concat(r.config.token, "/person/").concat(r.get_distinct_id()));
|
|
1860
|
+
n.tags["PostHog Person URL"] = u, r.sessionRecordingStarted() && (n.tags["PostHog Recording URL"] = r.get_session_replay_url({ withTimestamp: !0 }));
|
|
1861
|
+
var p = ((o = n.exception) === null || o === void 0 ? void 0 : o.values) || [], h = p.map((v) => f(f({}, v), {}, { stacktrace: v.stacktrace ? f(f({}, v.stacktrace), {}, { type: "raw", frames: (v.stacktrace.frames || []).map((b) => f(f({}, b), {}, { platform: "web:javascript" })) }) : void 0 })), _ = { $exception_message: ((a = p[0]) === null || a === void 0 ? void 0 : a.value) || n.message, $exception_type: (l = p[0]) === null || l === void 0 ? void 0 : l.type, $exception_personURL: u, $exception_level: n.level, $exception_list: h, $sentry_event_id: n.event_id, $sentry_exception: n.exception, $sentry_exception_message: ((c = p[0]) === null || c === void 0 ? void 0 : c.value) || n.message, $sentry_exception_type: (d = p[0]) === null || d === void 0 ? void 0 : d.type, $sentry_tags: n.tags };
|
|
1862
|
+
return e && t && (_.$sentry_url = (i || "https://sentry.io/organizations/") + e + "/issues/?project=" + t + "&query=" + n.event_id), r.exceptions.sendExceptionEvent(_), n;
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
class $a {
|
|
1866
|
+
constructor(e, t, i, s, n) {
|
|
1867
|
+
this.name = Ln, this.setupOnce = function(o) {
|
|
1868
|
+
o(Mn(e, { organization: t, projectId: i, prefix: s, severityAllowList: n }));
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
var xe, Oa = g != null && g.location ? ni(g.location.hash, "__posthog") || ni(location.hash, "state") : null, ks = "_postHogToolbarParams", Ss = Q("[Toolbar]");
|
|
1873
|
+
(function(r) {
|
|
1874
|
+
r[r.UNINITIALIZED = 0] = "UNINITIALIZED", r[r.LOADING = 1] = "LOADING", r[r.LOADED = 2] = "LOADED";
|
|
1875
|
+
})(xe || (xe = {}));
|
|
1876
|
+
class La {
|
|
1877
|
+
constructor(e) {
|
|
1878
|
+
this.instance = e;
|
|
1879
|
+
}
|
|
1880
|
+
setToolbarState(e) {
|
|
1881
|
+
C.ph_toolbar_state = e;
|
|
1882
|
+
}
|
|
1883
|
+
getToolbarState() {
|
|
1884
|
+
var e;
|
|
1885
|
+
return (e = C.ph_toolbar_state) !== null && e !== void 0 ? e : xe.UNINITIALIZED;
|
|
1886
|
+
}
|
|
1887
|
+
maybeLoadToolbar() {
|
|
1888
|
+
var e, t, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0;
|
|
1889
|
+
if (!g || !S) return !1;
|
|
1890
|
+
i = (e = i) !== null && e !== void 0 ? e : g.location, n = (t = n) !== null && t !== void 0 ? t : g.history;
|
|
1891
|
+
try {
|
|
1892
|
+
if (!s) {
|
|
1893
|
+
try {
|
|
1894
|
+
g.localStorage.setItem("test", "test"), g.localStorage.removeItem("test");
|
|
1895
|
+
} catch {
|
|
1896
|
+
return !1;
|
|
1897
|
+
}
|
|
1898
|
+
s = g == null ? void 0 : g.localStorage;
|
|
1899
|
+
}
|
|
1900
|
+
var o, a = Oa || ni(i.hash, "__posthog") || ni(i.hash, "state"), l = a ? zr(() => JSON.parse(atob(decodeURIComponent(a)))) || zr(() => JSON.parse(decodeURIComponent(a))) : null;
|
|
1901
|
+
return l && l.action === "ph_authorize" ? ((o = l).source = "url", o && Object.keys(o).length > 0 && (l.desiredHash ? i.hash = l.desiredHash : n ? n.replaceState(n.state, "", i.pathname + i.search) : i.hash = "")) : ((o = JSON.parse(s.getItem(ks) || "{}")).source = "localstorage", delete o.userIntent), !(!o.token || this.instance.config.token !== o.token) && (this.loadToolbar(o), !0);
|
|
1902
|
+
} catch {
|
|
1903
|
+
return !1;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
_callLoadToolbar(e) {
|
|
1907
|
+
var t = C.ph_load_toolbar || C.ph_load_editor;
|
|
1908
|
+
!R(t) && ge(t) ? t(e, this.instance) : Ss.warn("No toolbar load function found");
|
|
1909
|
+
}
|
|
1910
|
+
loadToolbar(e) {
|
|
1911
|
+
var t = !(S == null || !S.getElementById(dn));
|
|
1912
|
+
if (!g || t) return !1;
|
|
1913
|
+
var i = this.instance.requestRouter.region === "custom" && this.instance.config.advanced_disable_toolbar_metrics, s = f(f({ token: this.instance.config.token }, e), {}, { apiURL: this.instance.requestRouter.endpointFor("ui") }, i ? { instrument: !1 } : {});
|
|
1914
|
+
if (g.localStorage.setItem(ks, JSON.stringify(f(f({}, s), {}, { source: void 0 }))), this.getToolbarState() === xe.LOADED) this._callLoadToolbar(s);
|
|
1915
|
+
else if (this.getToolbarState() === xe.UNINITIALIZED) {
|
|
1916
|
+
var n, o;
|
|
1917
|
+
this.setToolbarState(xe.LOADING), (n = C.__PosthogExtensions__) === null || n === void 0 || (o = n.loadExternalDependency) === null || o === void 0 || o.call(n, this.instance, "toolbar", (a) => {
|
|
1918
|
+
if (a) return Ss.error("[Toolbar] Failed to load", a), void this.setToolbarState(xe.UNINITIALIZED);
|
|
1919
|
+
this.setToolbarState(xe.LOADED), this._callLoadToolbar(s);
|
|
1920
|
+
}), U(g, "turbolinks:load", () => {
|
|
1921
|
+
this.setToolbarState(xe.UNINITIALIZED), this.loadToolbar(s);
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
return !0;
|
|
1925
|
+
}
|
|
1926
|
+
_loadEditor(e) {
|
|
1927
|
+
return this.loadToolbar(e);
|
|
1928
|
+
}
|
|
1929
|
+
maybeLoadEditor() {
|
|
1930
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0;
|
|
1931
|
+
return this.maybeLoadToolbar(e, t, i);
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
var Ma = Q("[TracingHeaders]");
|
|
1935
|
+
class Aa {
|
|
1936
|
+
constructor(e) {
|
|
1937
|
+
w(this, "_restoreXHRPatch", void 0), w(this, "_restoreFetchPatch", void 0), w(this, "_startCapturing", () => {
|
|
1938
|
+
var t, i, s, n;
|
|
1939
|
+
k(this._restoreXHRPatch) && ((t = C.__PosthogExtensions__) === null || t === void 0 || (i = t.tracingHeadersPatchFns) === null || i === void 0 || i._patchXHR(this.instance.sessionManager)), k(this._restoreFetchPatch) && ((s = C.__PosthogExtensions__) === null || s === void 0 || (n = s.tracingHeadersPatchFns) === null || n === void 0 || n._patchFetch(this.instance.sessionManager));
|
|
1940
|
+
}), this.instance = e;
|
|
1941
|
+
}
|
|
1942
|
+
_loadScript(e) {
|
|
1943
|
+
var t, i, s;
|
|
1944
|
+
(t = C.__PosthogExtensions__) !== null && t !== void 0 && t.tracingHeadersPatchFns && e(), (i = C.__PosthogExtensions__) === null || i === void 0 || (s = i.loadExternalDependency) === null || s === void 0 || s.call(i, this.instance, "tracing-headers", (n) => {
|
|
1945
|
+
if (n) return Ma.error("failed to load script", n);
|
|
1946
|
+
e();
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
startIfEnabledOrStop() {
|
|
1950
|
+
var e, t;
|
|
1951
|
+
this.instance.config.__add_tracing_headers ? this._loadScript(this._startCapturing) : ((e = this._restoreXHRPatch) === null || e === void 0 || e.call(this), (t = this._restoreFetchPatch) === null || t === void 0 || t.call(this), this._restoreXHRPatch = void 0, this._restoreFetchPatch = void 0);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
var Oe = Q("[Web Vitals]"), Es = 9e5;
|
|
1955
|
+
class Da {
|
|
1956
|
+
constructor(e) {
|
|
1957
|
+
var t;
|
|
1958
|
+
w(this, "_enabledServerSide", !1), w(this, "_initialized", !1), w(this, "buffer", { url: void 0, metrics: [], firstMetricTimestamp: void 0 }), w(this, "_flushToCapture", () => {
|
|
1959
|
+
clearTimeout(this._delayedFlushTimer), this.buffer.metrics.length !== 0 && (this.instance.capture("$web_vitals", this.buffer.metrics.reduce((i, s) => f(f({}, i), {}, { ["$web_vitals_".concat(s.name, "_event")]: f({}, s), ["$web_vitals_".concat(s.name, "_value")]: s.value }), {})), this.buffer = { url: void 0, metrics: [], firstMetricTimestamp: void 0 });
|
|
1960
|
+
}), w(this, "_addToBuffer", (i) => {
|
|
1961
|
+
var s, n = (s = this.instance.sessionManager) === null || s === void 0 ? void 0 : s.checkAndGetSessionAndWindowId(!0);
|
|
1962
|
+
if (k(n)) Oe.error("Could not read session ID. Dropping metrics!");
|
|
1963
|
+
else {
|
|
1964
|
+
this.buffer = this.buffer || { url: void 0, metrics: [], firstMetricTimestamp: void 0 };
|
|
1965
|
+
var o = this._currentURL();
|
|
1966
|
+
k(o) || (R(i == null ? void 0 : i.name) || R(i == null ? void 0 : i.value) ? Oe.error("Invalid metric received", i) : this._maxAllowedValue && i.value >= this._maxAllowedValue ? Oe.error("Ignoring metric with value >= " + this._maxAllowedValue, i) : (this.buffer.url !== o && (this._flushToCapture(), this._delayedFlushTimer = setTimeout(this._flushToCapture, this.flushToCaptureTimeoutMs)), k(this.buffer.url) && (this.buffer.url = o), this.buffer.firstMetricTimestamp = k(this.buffer.firstMetricTimestamp) ? Date.now() : this.buffer.firstMetricTimestamp, i.attribution && i.attribution.interactionTargetElement && (i.attribution.interactionTargetElement = void 0), this.buffer.metrics.push(f(f({}, i), {}, { $current_url: o, $session_id: n.sessionId, $window_id: n.windowId, timestamp: Date.now() })), this.buffer.metrics.length === this.allowedMetrics.length && this._flushToCapture()));
|
|
1967
|
+
}
|
|
1968
|
+
}), w(this, "_startCapturing", () => {
|
|
1969
|
+
var i, s, n, o, a = C.__PosthogExtensions__;
|
|
1970
|
+
k(a) || k(a.postHogWebVitalsCallbacks) || ({ onLCP: i, onCLS: s, onFCP: n, onINP: o } = a.postHogWebVitalsCallbacks), i && s && n && o ? (this.allowedMetrics.indexOf("LCP") > -1 && i(this._addToBuffer.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && s(this._addToBuffer.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && n(this._addToBuffer.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && o(this._addToBuffer.bind(this)), this._initialized = !0) : Oe.error("web vitals callbacks not loaded - not starting");
|
|
1971
|
+
}), this.instance = e, this._enabledServerSide = !((t = this.instance.persistence) === null || t === void 0 || !t.props[Gr]), this.startIfEnabled();
|
|
1972
|
+
}
|
|
1973
|
+
get allowedMetrics() {
|
|
1974
|
+
var e, t, i = N(this.instance.config.capture_performance) ? (e = this.instance.config.capture_performance) === null || e === void 0 ? void 0 : e.web_vitals_allowed_metrics : void 0;
|
|
1975
|
+
return k(i) ? ((t = this.instance.persistence) === null || t === void 0 ? void 0 : t.props[Jr]) || ["CLS", "FCP", "INP", "LCP"] : i;
|
|
1976
|
+
}
|
|
1977
|
+
get flushToCaptureTimeoutMs() {
|
|
1978
|
+
return (N(this.instance.config.capture_performance) ? this.instance.config.capture_performance.web_vitals_delayed_flush_ms : void 0) || 5e3;
|
|
1979
|
+
}
|
|
1980
|
+
get _maxAllowedValue() {
|
|
1981
|
+
var e = N(this.instance.config.capture_performance) && ee(this.instance.config.capture_performance.__web_vitals_max_value) ? this.instance.config.capture_performance.__web_vitals_max_value : Es;
|
|
1982
|
+
return 0 < e && e <= 6e4 ? Es : e;
|
|
1983
|
+
}
|
|
1984
|
+
get isEnabled() {
|
|
1985
|
+
var e = te == null ? void 0 : te.protocol;
|
|
1986
|
+
if (e !== "http:" && e !== "https:") return Oe.info("Web Vitals are disabled on non-http/https protocols"), !1;
|
|
1987
|
+
var t = N(this.instance.config.capture_performance) ? this.instance.config.capture_performance.web_vitals : void 0;
|
|
1988
|
+
return Ae(t) ? t : this._enabledServerSide;
|
|
1989
|
+
}
|
|
1990
|
+
startIfEnabled() {
|
|
1991
|
+
this.isEnabled && !this._initialized && (Oe.info("enabled, starting..."), this.loadScript(this._startCapturing));
|
|
1992
|
+
}
|
|
1993
|
+
onRemoteConfig(e) {
|
|
1994
|
+
var t = N(e.capturePerformance) && !!e.capturePerformance.web_vitals, i = N(e.capturePerformance) ? e.capturePerformance.web_vitals_allowed_metrics : void 0;
|
|
1995
|
+
this.instance.persistence && (this.instance.persistence.register({ [Gr]: t }), this.instance.persistence.register({ [Jr]: i })), this._enabledServerSide = t, this.startIfEnabled();
|
|
1996
|
+
}
|
|
1997
|
+
loadScript(e) {
|
|
1998
|
+
var t, i, s;
|
|
1999
|
+
(t = C.__PosthogExtensions__) !== null && t !== void 0 && t.postHogWebVitalsCallbacks && e(), (i = C.__PosthogExtensions__) === null || i === void 0 || (s = i.loadExternalDependency) === null || s === void 0 || s.call(i, this.instance, "web-vitals", (n) => {
|
|
2000
|
+
n ? Oe.error("failed to load script", n) : e();
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
_currentURL() {
|
|
2004
|
+
var e = g ? g.location.href : void 0;
|
|
2005
|
+
return e || Oe.error("Could not determine current URL"), e;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
var qa = Q("[Heatmaps]");
|
|
2009
|
+
function xs(r) {
|
|
2010
|
+
return N(r) && "clientX" in r && "clientY" in r && ee(r.clientX) && ee(r.clientY);
|
|
2011
|
+
}
|
|
2012
|
+
class Na {
|
|
2013
|
+
constructor(e) {
|
|
2014
|
+
var t;
|
|
2015
|
+
w(this, "rageclicks", new kn()), w(this, "_enabledServerSide", !1), w(this, "_initialized", !1), w(this, "_flushInterval", null), this.instance = e, this._enabledServerSide = !((t = this.instance.persistence) === null || t === void 0 || !t.props[Wi]);
|
|
2016
|
+
}
|
|
2017
|
+
get flushIntervalMilliseconds() {
|
|
2018
|
+
var e = 5e3;
|
|
2019
|
+
return N(this.instance.config.capture_heatmaps) && this.instance.config.capture_heatmaps.flush_interval_milliseconds && (e = this.instance.config.capture_heatmaps.flush_interval_milliseconds), e;
|
|
2020
|
+
}
|
|
2021
|
+
get isEnabled() {
|
|
2022
|
+
return k(this.instance.config.capture_heatmaps) ? k(this.instance.config.enable_heatmaps) ? this._enabledServerSide : this.instance.config.enable_heatmaps : this.instance.config.capture_heatmaps !== !1;
|
|
2023
|
+
}
|
|
2024
|
+
startIfEnabled() {
|
|
2025
|
+
if (this.isEnabled) {
|
|
2026
|
+
if (this._initialized) return;
|
|
2027
|
+
qa.info("starting..."), this._setupListeners(), this._flushInterval = setInterval(this.flush.bind(this), this.flushIntervalMilliseconds);
|
|
2028
|
+
} else {
|
|
2029
|
+
var e, t;
|
|
2030
|
+
clearInterval((e = this._flushInterval) !== null && e !== void 0 ? e : void 0), (t = this.deadClicksCapture) === null || t === void 0 || t.stop(), this.getAndClearBuffer();
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
onRemoteConfig(e) {
|
|
2034
|
+
var t = !!e.heatmaps;
|
|
2035
|
+
this.instance.persistence && this.instance.persistence.register({ [Wi]: t }), this._enabledServerSide = t, this.startIfEnabled();
|
|
2036
|
+
}
|
|
2037
|
+
getAndClearBuffer() {
|
|
2038
|
+
var e = this.buffer;
|
|
2039
|
+
return this.buffer = void 0, e;
|
|
2040
|
+
}
|
|
2041
|
+
_onDeadClick(e) {
|
|
2042
|
+
this._onClick(e.originalEvent, "deadclick");
|
|
2043
|
+
}
|
|
2044
|
+
_setupListeners() {
|
|
2045
|
+
g && S && (U(g, "beforeunload", this.flush.bind(this)), U(S, "click", (e) => this._onClick(e || (g == null ? void 0 : g.event)), { capture: !0 }), U(S, "mousemove", (e) => this._onMouseMove(e || (g == null ? void 0 : g.event)), { capture: !0 }), this.deadClicksCapture = new En(this.instance, Zo, this._onDeadClick.bind(this)), this.deadClicksCapture.startIfEnabled(), this._initialized = !0);
|
|
2046
|
+
}
|
|
2047
|
+
_getProperties(e, t) {
|
|
2048
|
+
var i = this.instance.scrollManager.scrollY(), s = this.instance.scrollManager.scrollX(), n = this.instance.scrollManager.scrollElement(), o = function(a, l, c) {
|
|
2049
|
+
for (var d = a; d && _i(d) && !Be(d, "body"); ) {
|
|
2050
|
+
if (d === c) return !1;
|
|
2051
|
+
if (T(l, g == null ? void 0 : g.getComputedStyle(d).position)) return !0;
|
|
2052
|
+
d = vn(d);
|
|
2053
|
+
}
|
|
2054
|
+
return !1;
|
|
2055
|
+
}(gn(e), ["fixed", "sticky"], n);
|
|
2056
|
+
return { x: e.clientX + (o ? 0 : s), y: e.clientY + (o ? 0 : i), target_fixed: o, type: t };
|
|
2057
|
+
}
|
|
2058
|
+
_onClick(e) {
|
|
2059
|
+
var t, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "click";
|
|
2060
|
+
if (!rs(e.target) && xs(e)) {
|
|
2061
|
+
var s = this._getProperties(e, i);
|
|
2062
|
+
(t = this.rageclicks) !== null && t !== void 0 && t.isRageClick(e.clientX, e.clientY, (/* @__PURE__ */ new Date()).getTime()) && this._capture(f(f({}, s), {}, { type: "rageclick" })), this._capture(s);
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
_onMouseMove(e) {
|
|
2066
|
+
!rs(e.target) && xs(e) && (clearTimeout(this._mouseMoveTimeout), this._mouseMoveTimeout = setTimeout(() => {
|
|
2067
|
+
this._capture(this._getProperties(e, "mousemove"));
|
|
2068
|
+
}, 500));
|
|
2069
|
+
}
|
|
2070
|
+
_capture(e) {
|
|
2071
|
+
if (g) {
|
|
2072
|
+
var t = g.location.href;
|
|
2073
|
+
this.buffer = this.buffer || {}, this.buffer[t] || (this.buffer[t] = []), this.buffer[t].push(e);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
flush() {
|
|
2077
|
+
this.buffer && !st(this.buffer) && this.instance.capture("$$heatmap", { $heatmap_data: this.getAndClearBuffer() });
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
class Ba {
|
|
2081
|
+
constructor(e) {
|
|
2082
|
+
this._instance = e;
|
|
2083
|
+
}
|
|
2084
|
+
doPageView(e, t) {
|
|
2085
|
+
var i, s = this._previousPageViewProperties(e, t);
|
|
2086
|
+
return this._currentPageview = { pathname: (i = g == null ? void 0 : g.location.pathname) !== null && i !== void 0 ? i : "", pageViewId: t, timestamp: e }, this._instance.scrollManager.resetContext(), s;
|
|
2087
|
+
}
|
|
2088
|
+
doPageLeave(e) {
|
|
2089
|
+
var t;
|
|
2090
|
+
return this._previousPageViewProperties(e, (t = this._currentPageview) === null || t === void 0 ? void 0 : t.pageViewId);
|
|
2091
|
+
}
|
|
2092
|
+
doEvent() {
|
|
2093
|
+
var e;
|
|
2094
|
+
return { $pageview_id: (e = this._currentPageview) === null || e === void 0 ? void 0 : e.pageViewId };
|
|
2095
|
+
}
|
|
2096
|
+
_previousPageViewProperties(e, t) {
|
|
2097
|
+
var i = this._currentPageview;
|
|
2098
|
+
if (!i) return { $pageview_id: t };
|
|
2099
|
+
var s = { $pageview_id: t, $prev_pageview_id: i.pageViewId }, n = this._instance.scrollManager.getContext();
|
|
2100
|
+
if (n && !this._instance.config.disable_scroll_properties) {
|
|
2101
|
+
var { maxScrollHeight: o, lastScrollY: a, maxScrollY: l, maxContentHeight: c, lastContentY: d, maxContentY: u } = n;
|
|
2102
|
+
if (!(k(o) || k(a) || k(l) || k(c) || k(d) || k(u))) {
|
|
2103
|
+
o = Math.ceil(o), a = Math.ceil(a), l = Math.ceil(l), c = Math.ceil(c), d = Math.ceil(d), u = Math.ceil(u);
|
|
2104
|
+
var p = o <= 1 ? 1 : ue(a / o, 0, 1), h = o <= 1 ? 1 : ue(l / o, 0, 1), _ = c <= 1 ? 1 : ue(d / c, 0, 1), v = c <= 1 ? 1 : ue(u / c, 0, 1);
|
|
2105
|
+
s = H(s, { $prev_pageview_last_scroll: a, $prev_pageview_last_scroll_percentage: p, $prev_pageview_max_scroll: l, $prev_pageview_max_scroll_percentage: h, $prev_pageview_last_content: d, $prev_pageview_last_content_percentage: _, $prev_pageview_max_content: u, $prev_pageview_max_content_percentage: v });
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
return i.pathname && (s.$prev_pageview_pathname = i.pathname), i.timestamp && (s.$prev_pageview_duration = (e.getTime() - i.timestamp.getTime()) / 1e3), s;
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
class Ha {
|
|
2112
|
+
constructor(e) {
|
|
2113
|
+
this.instance = e;
|
|
2114
|
+
}
|
|
2115
|
+
sendExceptionEvent(e) {
|
|
2116
|
+
this.instance.capture("$exception", e, { _noTruncate: !0, _batchKey: "exceptionEvent" });
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
var de = "Mobile", ui = "iOS", be = "Android", $t = "Tablet", An = be + " " + $t, Dn = "iPad", qn = "Apple", Nn = qn + " Watch", Ot = "Safari", pt = "BlackBerry", Bn = "Samsung", Hn = Bn + "Browser", Un = Bn + " Internet", Ze = "Chrome", Ua = Ze + " OS", jn = Ze + " " + ui, xr = "Internet Explorer", zn = xr + " " + de, Ir = "Opera", ja = Ir + " Mini", Cr = "Edge", Wn = "Microsoft " + Cr, lt = "Firefox", Vn = lt + " " + ui, Lt = "Nintendo", Mt = "PlayStation", ut = "Xbox", Gn = be + " " + de, Jn = de + " " + Ot, It = "Windows", ur = It + " Phone", Is = "Nokia", cr = "Ouya", Yn = "Generic", za = Yn + " " + de.toLowerCase(), Kn = Yn + " " + $t.toLowerCase(), dr = "Konqueror", X = "(\\d+(\\.\\d+)?)", Oi = new RegExp("Version/" + X), Wa = new RegExp(ut, "i"), Va = new RegExp(Mt + " \\w+", "i"), Ga = new RegExp(Lt + " \\w+", "i"), Pr = new RegExp(pt + "|PlayBook|BB10", "i"), Ja = { "NT3.51": "NT 3.11", "NT4.0": "NT 4.0", "5.0": "2000", 5.1: "XP", 5.2: "XP", "6.0": "Vista", 6.1: "7", 6.2: "8", 6.3: "8.1", 6.4: "10", "10.0": "10" }, hr, Ya = (r, e) => e && T(e, qn) || function(t) {
|
|
2120
|
+
return T(t, Ot) && !T(t, Ze) && !T(t, be);
|
|
2121
|
+
}(r), Cs = function(r, e) {
|
|
2122
|
+
return e = e || "", T(r, " OPR/") && T(r, "Mini") ? ja : T(r, " OPR/") ? Ir : Pr.test(r) ? pt : T(r, "IE" + de) || T(r, "WPDesktop") ? zn : T(r, Hn) ? Un : T(r, Cr) || T(r, "Edg/") ? Wn : T(r, "FBIOS") ? "Facebook " + de : T(r, "UCWEB") || T(r, "UCBrowser") ? "UC Browser" : T(r, "CriOS") ? jn : T(r, "CrMo") || T(r, Ze) ? Ze : T(r, be) && T(r, Ot) ? Gn : T(r, "FxiOS") ? Vn : T(r.toLowerCase(), dr.toLowerCase()) ? dr : Ya(r, e) ? T(r, de) ? Jn : Ot : T(r, lt) ? lt : T(r, "MSIE") || T(r, "Trident/") ? xr : T(r, "Gecko") ? lt : "";
|
|
2123
|
+
}, Ka = { [zn]: [new RegExp("rv:" + X)], [Wn]: [new RegExp(Cr + "?\\/" + X)], [Ze]: [new RegExp("(" + Ze + "|CrMo)\\/" + X)], [jn]: [new RegExp("CriOS\\/" + X)], "UC Browser": [new RegExp("(UCBrowser|UCWEB)\\/" + X)], [Ot]: [Oi], [Jn]: [Oi], [Ir]: [new RegExp("(Opera|OPR)\\/" + X)], [lt]: [new RegExp(lt + "\\/" + X)], [Vn]: [new RegExp("FxiOS\\/" + X)], [dr]: [new RegExp("Konqueror[:/]?" + X, "i")], [pt]: [new RegExp(pt + " " + X), Oi], [Gn]: [new RegExp("android\\s" + X, "i")], [Un]: [new RegExp(Hn + "\\/" + X)], [xr]: [new RegExp("(rv:|MSIE )" + X)], Mozilla: [new RegExp("rv:" + X)] }, Ps = [[new RegExp(ut + "; " + ut + " (.*?)[);]", "i"), (r) => [ut, r && r[1] || ""]], [new RegExp(Lt, "i"), [Lt, ""]], [new RegExp(Mt, "i"), [Mt, ""]], [Pr, [pt, ""]], [new RegExp(It, "i"), (r, e) => {
|
|
2124
|
+
if (/Phone/.test(e) || /WPDesktop/.test(e)) return [ur, ""];
|
|
2125
|
+
if (new RegExp(de).test(e) && !/IEMobile\b/.test(e)) return [It + " " + de, ""];
|
|
2126
|
+
var t = /Windows NT ([0-9.]+)/i.exec(e);
|
|
2127
|
+
if (t && t[1]) {
|
|
2128
|
+
var i = t[1], s = Ja[i] || "";
|
|
2129
|
+
return /arm/i.test(e) && (s = "RT"), [It, s];
|
|
2130
|
+
}
|
|
2131
|
+
return [It, ""];
|
|
2132
|
+
}], [/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/, (r) => {
|
|
2133
|
+
if (r && r[3]) {
|
|
2134
|
+
var e = [r[3], r[4], r[5] || "0"];
|
|
2135
|
+
return [ui, e.join(".")];
|
|
2136
|
+
}
|
|
2137
|
+
return [ui, ""];
|
|
2138
|
+
}], [/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i, (r) => {
|
|
2139
|
+
var e = "";
|
|
2140
|
+
return r && r.length >= 3 && (e = k(r[2]) ? r[3] : r[2]), ["watchOS", e];
|
|
2141
|
+
}], [new RegExp("(" + be + " (\\d+)\\.(\\d+)\\.?(\\d+)?|" + be + ")", "i"), (r) => {
|
|
2142
|
+
if (r && r[2]) {
|
|
2143
|
+
var e = [r[2], r[3], r[4] || "0"];
|
|
2144
|
+
return [be, e.join(".")];
|
|
2145
|
+
}
|
|
2146
|
+
return [be, ""];
|
|
2147
|
+
}], [/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i, (r) => {
|
|
2148
|
+
var e = ["Mac OS X", ""];
|
|
2149
|
+
if (r && r[1]) {
|
|
2150
|
+
var t = [r[1], r[2], r[3] || "0"];
|
|
2151
|
+
e[1] = t.join(".");
|
|
2152
|
+
}
|
|
2153
|
+
return e;
|
|
2154
|
+
}], [/Mac/i, ["Mac OS X", ""]], [/CrOS/, [Ua, ""]], [/Linux|debian/i, ["Linux", ""]]], Fs = function(r) {
|
|
2155
|
+
return Ga.test(r) ? Lt : Va.test(r) ? Mt : Wa.test(r) ? ut : new RegExp(cr, "i").test(r) ? cr : new RegExp("(" + ur + "|WPDesktop)", "i").test(r) ? ur : /iPad/.test(r) ? Dn : /iPod/.test(r) ? "iPod Touch" : /iPhone/.test(r) ? "iPhone" : /(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r) ? Nn : Pr.test(r) ? pt : /(kobo)\s(ereader|touch)/i.test(r) ? "Kobo" : new RegExp(Is, "i").test(r) ? Is : /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r) || /(kf[a-z]+)( bui|\)).+silk\//i.test(r) ? "Kindle Fire" : /(Android|ZTE)/i.test(r) ? !new RegExp(de).test(r) || /(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r) ? /pixel[\daxl ]{1,6}/i.test(r) && !/pixel c/i.test(r) || /(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r) || /lmy47v/i.test(r) && !/QTAQZ3/i.test(r) ? be : An : be : new RegExp("(pda|" + de + ")", "i").test(r) ? za : new RegExp($t, "i").test(r) && !new RegExp($t + " pc", "i").test(r) ? Kn : "";
|
|
2156
|
+
}, Wt = "https?://(.*)", Qt = ["gclid", "gclsrc", "dclid", "gbraid", "wbraid", "fbclid", "msclkid", "twclid", "li_fat_id", "igshid", "ttclid", "rdt_cid", "irclid", "_kx"], Qa = Gt(["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term", "gad_source", "mc_cid"], Qt), Li = "<masked>", A = { campaignParams: function() {
|
|
2157
|
+
var { customTrackedParams: r, maskPersonalDataProperties: e, customPersonalDataProperties: t } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2158
|
+
if (!S) return {};
|
|
2159
|
+
var i = e ? Gt([], Qt, t || []) : [];
|
|
2160
|
+
return this._campaignParamsFromUrl(ki(S.URL, i, Li), r);
|
|
2161
|
+
}, _campaignParamsFromUrl: function(r, e) {
|
|
2162
|
+
var t = Qa.concat(e || []), i = {};
|
|
2163
|
+
return $(t, function(s) {
|
|
2164
|
+
var n = si(r, s);
|
|
2165
|
+
i[s] = n || null;
|
|
2166
|
+
}), i;
|
|
2167
|
+
}, _searchEngine: function(r) {
|
|
2168
|
+
return r ? r.search(Wt + "google.([^/?]*)") === 0 ? "google" : r.search(Wt + "bing.com") === 0 ? "bing" : r.search(Wt + "yahoo.com") === 0 ? "yahoo" : r.search(Wt + "duckduckgo.com") === 0 ? "duckduckgo" : null : null;
|
|
2169
|
+
}, _searchInfoFromReferrer: function(r) {
|
|
2170
|
+
var e = A._searchEngine(r), t = e != "yahoo" ? "q" : "p", i = {};
|
|
2171
|
+
if (!He(e)) {
|
|
2172
|
+
i.$search_engine = e;
|
|
2173
|
+
var s = S ? si(S.referrer, t) : "";
|
|
2174
|
+
s.length && (i.ph_keyword = s);
|
|
2175
|
+
}
|
|
2176
|
+
return i;
|
|
2177
|
+
}, searchInfo: function() {
|
|
2178
|
+
var r = S == null ? void 0 : S.referrer;
|
|
2179
|
+
return r ? this._searchInfoFromReferrer(r) : {};
|
|
2180
|
+
}, browser: Cs, browserVersion: function(r, e) {
|
|
2181
|
+
var t = Cs(r, e), i = Ka[t];
|
|
2182
|
+
if (k(i)) return null;
|
|
2183
|
+
for (var s = 0; s < i.length; s++) {
|
|
2184
|
+
var n = i[s], o = r.match(n);
|
|
2185
|
+
if (o) return parseFloat(o[o.length - 2]);
|
|
2186
|
+
}
|
|
2187
|
+
return null;
|
|
2188
|
+
}, browserLanguage: function() {
|
|
2189
|
+
return navigator.language || navigator.userLanguage;
|
|
2190
|
+
}, browserLanguagePrefix: function() {
|
|
2191
|
+
var r = this.browserLanguage();
|
|
2192
|
+
return typeof r == "string" ? r.split("-")[0] : void 0;
|
|
2193
|
+
}, os: function(r) {
|
|
2194
|
+
for (var e = 0; e < Ps.length; e++) {
|
|
2195
|
+
var [t, i] = Ps[e], s = t.exec(r), n = s && (ge(i) ? i(s, r) : i);
|
|
2196
|
+
if (n) return n;
|
|
2197
|
+
}
|
|
2198
|
+
return ["", ""];
|
|
2199
|
+
}, device: Fs, deviceType: function(r) {
|
|
2200
|
+
var e = Fs(r);
|
|
2201
|
+
return e === Dn || e === An || e === "Kobo" || e === "Kindle Fire" || e === Kn ? $t : e === Lt || e === ut || e === Mt || e === cr ? "Console" : e === Nn ? "Wearable" : e ? de : "Desktop";
|
|
2202
|
+
}, referrer: function() {
|
|
2203
|
+
return (S == null ? void 0 : S.referrer) || "$direct";
|
|
2204
|
+
}, referringDomain: function() {
|
|
2205
|
+
var r;
|
|
2206
|
+
return S != null && S.referrer && ((r = at(S.referrer)) === null || r === void 0 ? void 0 : r.host) || "$direct";
|
|
2207
|
+
}, referrerInfo: function() {
|
|
2208
|
+
return { $referrer: this.referrer(), $referring_domain: this.referringDomain() };
|
|
2209
|
+
}, personInfo: function() {
|
|
2210
|
+
var { maskPersonalDataProperties: r, customPersonalDataProperties: e } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = r ? Gt([], Qt, e || []) : [], i = te == null ? void 0 : te.href.substring(0, 1e3);
|
|
2211
|
+
return { r: this.referrer().substring(0, 1e3), u: i ? ki(i, t, Li) : void 0 };
|
|
2212
|
+
}, personPropsFromInfo: function(r) {
|
|
2213
|
+
var e, { r: t, u: i } = r, s = { $referrer: t, $referring_domain: t == null ? void 0 : t == "$direct" ? "$direct" : (e = at(t)) === null || e === void 0 ? void 0 : e.host };
|
|
2214
|
+
if (i) {
|
|
2215
|
+
s.$current_url = i;
|
|
2216
|
+
var n = at(i);
|
|
2217
|
+
s.$host = n == null ? void 0 : n.host, s.$pathname = n == null ? void 0 : n.pathname;
|
|
2218
|
+
var o = this._campaignParamsFromUrl(i);
|
|
2219
|
+
H(s, o);
|
|
2220
|
+
}
|
|
2221
|
+
if (t) {
|
|
2222
|
+
var a = this._searchInfoFromReferrer(t);
|
|
2223
|
+
H(s, a);
|
|
2224
|
+
}
|
|
2225
|
+
return s;
|
|
2226
|
+
}, initialPersonPropsFromInfo: function(r) {
|
|
2227
|
+
var e = this.personPropsFromInfo(r), t = {};
|
|
2228
|
+
return $(e, function(i, s) {
|
|
2229
|
+
t["$initial_".concat(br(s))] = i;
|
|
2230
|
+
}), t;
|
|
2231
|
+
}, timezone: function() {
|
|
2232
|
+
try {
|
|
2233
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2234
|
+
} catch {
|
|
2235
|
+
return;
|
|
2236
|
+
}
|
|
2237
|
+
}, timezoneOffset: function() {
|
|
2238
|
+
try {
|
|
2239
|
+
return (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
2240
|
+
} catch {
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
2243
|
+
}, properties: function() {
|
|
2244
|
+
var { maskPersonalDataProperties: r, customPersonalDataProperties: e } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2245
|
+
if (!j) return {};
|
|
2246
|
+
var t = r ? Gt([], Qt, e || []) : [], [i, s] = A.os(j);
|
|
2247
|
+
return H(Rt({ $os: i, $os_version: s, $browser: A.browser(j, navigator.vendor), $device: A.device(j), $device_type: A.deviceType(j), $timezone: A.timezone(), $timezone_offset: A.timezoneOffset() }), { $current_url: ki(te == null ? void 0 : te.href, t, Li), $host: te == null ? void 0 : te.host, $pathname: te == null ? void 0 : te.pathname, $raw_user_agent: j.length > 1e3 ? j.substring(0, 997) + "..." : j, $browser_version: A.browserVersion(j, navigator.vendor), $browser_language: A.browserLanguage(), $browser_language_prefix: A.browserLanguagePrefix(), $screen_height: g == null ? void 0 : g.screen.height, $screen_width: g == null ? void 0 : g.screen.width, $viewport_height: g == null ? void 0 : g.innerHeight, $viewport_width: g == null ? void 0 : g.innerWidth, $lib: "web", $lib_version: Ie.LIB_VERSION, $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10), $time: Date.now() / 1e3 });
|
|
2248
|
+
}, people_properties: function() {
|
|
2249
|
+
if (!j) return {};
|
|
2250
|
+
var [r, e] = A.os(j);
|
|
2251
|
+
return H(Rt({ $os: r, $os_version: e, $browser: A.browser(j, navigator.vendor) }), { $browser_version: A.browserVersion(j, navigator.vendor) });
|
|
2252
|
+
} }, ye = Q("[FeatureFlags]"), Mi = "$active_feature_flags", it = "$override_feature_flags", Ts = "$feature_flag_payloads", bt = "$override_feature_flag_payloads", Rs = "$feature_flag_request_id", $s = (r) => {
|
|
2253
|
+
var e = {};
|
|
2254
|
+
for (var [t, i] of Jt(r || {})) i && (e[t] = i);
|
|
2255
|
+
return e;
|
|
2256
|
+
}, Za = (r) => {
|
|
2257
|
+
var e = r.flags;
|
|
2258
|
+
return e ? (r.featureFlags = Object.fromEntries(Object.keys(e).map((t) => {
|
|
2259
|
+
var i;
|
|
2260
|
+
return [t, (i = e[t].variant) !== null && i !== void 0 ? i : e[t].enabled];
|
|
2261
|
+
})), r.featureFlagPayloads = Object.fromEntries(Object.keys(e).filter((t) => e[t].enabled).filter((t) => {
|
|
2262
|
+
var i;
|
|
2263
|
+
return (i = e[t].metadata) === null || i === void 0 ? void 0 : i.payload;
|
|
2264
|
+
}).map((t) => {
|
|
2265
|
+
var i;
|
|
2266
|
+
return [t, (i = e[t].metadata) === null || i === void 0 ? void 0 : i.payload];
|
|
2267
|
+
}))) : ye.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"), r;
|
|
2268
|
+
};
|
|
2269
|
+
(function(r) {
|
|
2270
|
+
r.FeatureFlags = "feature_flags", r.Recordings = "recordings";
|
|
2271
|
+
})(hr || (hr = {}));
|
|
2272
|
+
class Xa {
|
|
2273
|
+
constructor(e) {
|
|
2274
|
+
w(this, "_override_warning", !1), w(this, "_hasLoadedFlags", !1), w(this, "_requestInFlight", !1), w(this, "_reloadingDisabled", !1), w(this, "_additionalReloadRequested", !1), w(this, "_decideCalled", !1), w(this, "_flagsLoadedFromRemote", !1), this.instance = e, this.featureFlagEventHandlers = [];
|
|
2275
|
+
}
|
|
2276
|
+
decide() {
|
|
2277
|
+
if (this.instance.config.__preview_remote_config) this._decideCalled = !0;
|
|
2278
|
+
else {
|
|
2279
|
+
var e = !this._reloadDebouncer && (this.instance.config.advanced_disable_feature_flags || this.instance.config.advanced_disable_feature_flags_on_first_load);
|
|
2280
|
+
this._callDecideEndpoint({ disableFlags: e });
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
get hasLoadedFlags() {
|
|
2284
|
+
return this._hasLoadedFlags;
|
|
2285
|
+
}
|
|
2286
|
+
getFlags() {
|
|
2287
|
+
return Object.keys(this.getFlagVariants());
|
|
2288
|
+
}
|
|
2289
|
+
getFlagsWithDetails() {
|
|
2290
|
+
var e = this.instance.get_property(Gi), t = this.instance.get_property(it), i = this.instance.get_property(bt);
|
|
2291
|
+
if (!i && !t) return e || {};
|
|
2292
|
+
var s = H({}, e || {}), n = [.../* @__PURE__ */ new Set([...Object.keys(i || {}), ...Object.keys(t || {})])];
|
|
2293
|
+
for (var o of n) {
|
|
2294
|
+
var a, l, c = s[o], d = t == null ? void 0 : t[o], u = k(d) ? (a = c == null ? void 0 : c.enabled) !== null && a !== void 0 && a : !!d, p = k(d) ? c.variant : typeof d == "string" ? d : void 0, h = i == null ? void 0 : i[o], _ = f(f({}, c), {}, { enabled: u, variant: u ? p ?? (c == null ? void 0 : c.variant) : void 0 });
|
|
2295
|
+
u !== (c == null ? void 0 : c.enabled) && (_.original_enabled = c == null ? void 0 : c.enabled), p !== (c == null ? void 0 : c.variant) && (_.original_variant = c == null ? void 0 : c.variant), h && (_.metadata = f(f({}, c == null ? void 0 : c.metadata), {}, { payload: h, original_payload: c == null || (l = c.metadata) === null || l === void 0 ? void 0 : l.payload })), s[o] = _;
|
|
2296
|
+
}
|
|
2297
|
+
return this._override_warning || (ye.warn(" Overriding feature flag details!", { flagDetails: e, overriddenPayloads: i, finalDetails: s }), this._override_warning = !0), s;
|
|
2298
|
+
}
|
|
2299
|
+
getFlagVariants() {
|
|
2300
|
+
var e = this.instance.get_property(nt), t = this.instance.get_property(it);
|
|
2301
|
+
if (!t) return e || {};
|
|
2302
|
+
for (var i = H({}, e), s = Object.keys(t), n = 0; n < s.length; n++) i[s[n]] = t[s[n]];
|
|
2303
|
+
return this._override_warning || (ye.warn(" Overriding feature flags!", { enabledFlags: e, overriddenFlags: t, finalFlags: i }), this._override_warning = !0), i;
|
|
2304
|
+
}
|
|
2305
|
+
getFlagPayloads() {
|
|
2306
|
+
var e = this.instance.get_property(Ts), t = this.instance.get_property(bt);
|
|
2307
|
+
if (!t) return e || {};
|
|
2308
|
+
for (var i = H({}, e || {}), s = Object.keys(t), n = 0; n < s.length; n++) i[s[n]] = t[s[n]];
|
|
2309
|
+
return this._override_warning || (ye.warn(" Overriding feature flag payloads!", { flagPayloads: e, overriddenPayloads: t, finalPayloads: i }), this._override_warning = !0), i;
|
|
2310
|
+
}
|
|
2311
|
+
reloadFeatureFlags() {
|
|
2312
|
+
this._reloadingDisabled || this.instance.config.advanced_disable_feature_flags || this._reloadDebouncer || (this._reloadDebouncer = setTimeout(() => {
|
|
2313
|
+
this._callDecideEndpoint();
|
|
2314
|
+
}, 5));
|
|
2315
|
+
}
|
|
2316
|
+
clearDebouncer() {
|
|
2317
|
+
clearTimeout(this._reloadDebouncer), this._reloadDebouncer = void 0;
|
|
2318
|
+
}
|
|
2319
|
+
ensureFlagsLoaded() {
|
|
2320
|
+
this._hasLoadedFlags || this._requestInFlight || this._reloadDebouncer || this.reloadFeatureFlags();
|
|
2321
|
+
}
|
|
2322
|
+
setAnonymousDistinctId(e) {
|
|
2323
|
+
this.$anon_distinct_id = e;
|
|
2324
|
+
}
|
|
2325
|
+
setReloadingPaused(e) {
|
|
2326
|
+
this._reloadingDisabled = e;
|
|
2327
|
+
}
|
|
2328
|
+
_callDecideEndpoint(e) {
|
|
2329
|
+
var t;
|
|
2330
|
+
if (this.clearDebouncer(), !this.instance.config.advanced_disable_decide) if (this._requestInFlight) this._additionalReloadRequested = !0;
|
|
2331
|
+
else {
|
|
2332
|
+
var i = { token: this.instance.config.token, distinct_id: this.instance.get_distinct_id(), groups: this.instance.getGroups(), $anon_distinct_id: this.$anon_distinct_id, person_properties: f(f({}, ((t = this.instance.persistence) === null || t === void 0 ? void 0 : t.get_initial_props()) || {}), this.instance.get_property(Et) || {}), group_properties: this.instance.get_property(Ge) };
|
|
2333
|
+
(e != null && e.disableFlags || this.instance.config.advanced_disable_feature_flags) && (i.disable_flags = !0);
|
|
2334
|
+
var s = this.instance.config.__preview_flags_v2 && this.instance.config.__preview_remote_config;
|
|
2335
|
+
s && (i.timezone = A.timezone()), this._requestInFlight = !0, this.instance._send_request({ method: "POST", url: this.instance.requestRouter.endpointFor("api", s ? "/flags/?v=2" : "/decide/?v=4"), data: i, compression: this.instance.config.disable_compression ? void 0 : _e.Base64, timeout: this.instance.config.feature_flag_request_timeout_ms, callback: (n) => {
|
|
2336
|
+
var o, a, l, c = !0;
|
|
2337
|
+
n.statusCode === 200 && (this._additionalReloadRequested || (this.$anon_distinct_id = void 0), c = !1), this._requestInFlight = !1, this._decideCalled || (this._decideCalled = !0, this.instance._onRemoteConfig((l = n.json) !== null && l !== void 0 ? l : {})), i.disable_flags && !this._additionalReloadRequested || (this._flagsLoadedFromRemote = !c, n.json && (o = n.json.quotaLimited) !== null && o !== void 0 && o.includes(hr.FeatureFlags) ? ye.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.") : (this.receivedFeatureFlags((a = n.json) !== null && a !== void 0 ? a : {}, c), this._additionalReloadRequested && (this._additionalReloadRequested = !1, this._callDecideEndpoint())));
|
|
2338
|
+
} });
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
getFeatureFlag(e) {
|
|
2342
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2343
|
+
if (this._hasLoadedFlags || this.getFlags() && this.getFlags().length > 0) {
|
|
2344
|
+
var i = this.getFlagVariants()[e], s = "".concat(i), n = this.instance.get_property(Rs) || void 0, o = this.instance.get_property(ti) || {};
|
|
2345
|
+
if ((t.send_event || !("send_event" in t)) && (!(e in o) || !o[e].includes(s))) {
|
|
2346
|
+
var a, l, c, d, u, p, h, _, v, b, m;
|
|
2347
|
+
q(o[e]) ? o[e].push(s) : o[e] = [s], (a = this.instance.persistence) === null || a === void 0 || a.register({ [ti]: o });
|
|
2348
|
+
var y = this.getFeatureFlagDetails(e), E = { $feature_flag: e, $feature_flag_response: i, $feature_flag_payload: this.getFeatureFlagPayload(e) || null, $feature_flag_request_id: n, $feature_flag_bootstrapped_response: ((l = this.instance.config.bootstrap) === null || l === void 0 || (c = l.featureFlags) === null || c === void 0 ? void 0 : c[e]) || null, $feature_flag_bootstrapped_payload: ((d = this.instance.config.bootstrap) === null || d === void 0 || (u = d.featureFlagPayloads) === null || u === void 0 ? void 0 : u[e]) || null, $used_bootstrap_value: !this._flagsLoadedFromRemote };
|
|
2349
|
+
k(y == null || (p = y.metadata) === null || p === void 0 ? void 0 : p.version) || (E.$feature_flag_version = y.metadata.version);
|
|
2350
|
+
var I, F = (h = y == null || (_ = y.reason) === null || _ === void 0 ? void 0 : _.description) !== null && h !== void 0 ? h : y == null || (v = y.reason) === null || v === void 0 ? void 0 : v.code;
|
|
2351
|
+
F && (E.$feature_flag_reason = F), y != null && (b = y.metadata) !== null && b !== void 0 && b.id && (E.$feature_flag_id = y.metadata.id), k(y == null ? void 0 : y.original_variant) && k(y == null ? void 0 : y.original_enabled) || (E.$feature_flag_original_response = k(y.original_variant) ? y.original_enabled : y.original_variant), y != null && (m = y.metadata) !== null && m !== void 0 && m.original_payload && (E.$feature_flag_original_payload = y == null || (I = y.metadata) === null || I === void 0 ? void 0 : I.original_payload), this.instance.capture("$feature_flag_called", E);
|
|
2352
|
+
}
|
|
2353
|
+
return i;
|
|
2354
|
+
}
|
|
2355
|
+
ye.warn('getFeatureFlag for key "' + e + `" failed. Feature flags didn't load in time.`);
|
|
2356
|
+
}
|
|
2357
|
+
getFeatureFlagDetails(e) {
|
|
2358
|
+
return this.getFlagsWithDetails()[e];
|
|
2359
|
+
}
|
|
2360
|
+
getFeatureFlagPayload(e) {
|
|
2361
|
+
return this.getFlagPayloads()[e];
|
|
2362
|
+
}
|
|
2363
|
+
getRemoteConfigPayload(e, t) {
|
|
2364
|
+
var i = this.instance.config.token;
|
|
2365
|
+
this.instance._send_request({ method: "POST", url: this.instance.requestRouter.endpointFor("api", "/decide/?v=4"), data: { distinct_id: this.instance.get_distinct_id(), token: i }, compression: this.instance.config.disable_compression ? void 0 : _e.Base64, timeout: this.instance.config.feature_flag_request_timeout_ms, callback: (s) => {
|
|
2366
|
+
var n, o = (n = s.json) === null || n === void 0 ? void 0 : n.featureFlagPayloads;
|
|
2367
|
+
t((o == null ? void 0 : o[e]) || void 0);
|
|
2368
|
+
} });
|
|
2369
|
+
}
|
|
2370
|
+
isFeatureEnabled(e) {
|
|
2371
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2372
|
+
if (this._hasLoadedFlags || this.getFlags() && this.getFlags().length > 0) return !!this.getFeatureFlag(e, t);
|
|
2373
|
+
ye.warn('isFeatureEnabled for key "' + e + `" failed. Feature flags didn't load in time.`);
|
|
2374
|
+
}
|
|
2375
|
+
addFeatureFlagsHandler(e) {
|
|
2376
|
+
this.featureFlagEventHandlers.push(e);
|
|
2377
|
+
}
|
|
2378
|
+
removeFeatureFlagsHandler(e) {
|
|
2379
|
+
this.featureFlagEventHandlers = this.featureFlagEventHandlers.filter((t) => t !== e);
|
|
2380
|
+
}
|
|
2381
|
+
receivedFeatureFlags(e, t) {
|
|
2382
|
+
if (this.instance.persistence) {
|
|
2383
|
+
this._hasLoadedFlags = !0;
|
|
2384
|
+
var i = this.getFlagVariants(), s = this.getFlagPayloads(), n = this.getFlagsWithDetails();
|
|
2385
|
+
(function(o, a) {
|
|
2386
|
+
var l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, c = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, d = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}, u = Za(o), p = u.flags, h = u.featureFlags, _ = u.featureFlagPayloads;
|
|
2387
|
+
if (h) {
|
|
2388
|
+
var v = o.requestId;
|
|
2389
|
+
if (q(h)) {
|
|
2390
|
+
ye.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");
|
|
2391
|
+
var b = {};
|
|
2392
|
+
if (h) for (var m = 0; m < h.length; m++) b[h[m]] = !0;
|
|
2393
|
+
a && a.register({ [Mi]: h, [nt]: b });
|
|
2394
|
+
} else {
|
|
2395
|
+
var y = h, E = _, I = p;
|
|
2396
|
+
o.errorsWhileComputingFlags && (y = f(f({}, l), y), E = f(f({}, c), E), I = f(f({}, d), I)), a && a.register(f({ [Mi]: Object.keys($s(y)), [nt]: y || {}, [Ts]: E || {}, [Gi]: I || {} }, v ? { [Rs]: v } : {}));
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
})(e, this.instance.persistence, i, s, n), this._fireFeatureFlagsCallbacks(t);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
override(e) {
|
|
2403
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
2404
|
+
ye.warn("override is deprecated. Please use overrideFeatureFlags instead."), this.overrideFeatureFlags({ flags: e, suppressWarning: t });
|
|
2405
|
+
}
|
|
2406
|
+
overrideFeatureFlags(e) {
|
|
2407
|
+
if (!this.instance.__loaded || !this.instance.persistence) return ye.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");
|
|
2408
|
+
if (e === !1) return this.instance.persistence.unregister(it), this.instance.persistence.unregister(bt), void this._fireFeatureFlagsCallbacks();
|
|
2409
|
+
if (e && typeof e == "object" && ("flags" in e || "payloads" in e)) {
|
|
2410
|
+
var t, i = e;
|
|
2411
|
+
if (this._override_warning = !!((t = i.suppressWarning) !== null && t !== void 0 && t), "flags" in i) {
|
|
2412
|
+
if (i.flags === !1) this.instance.persistence.unregister(it);
|
|
2413
|
+
else if (i.flags) if (q(i.flags)) {
|
|
2414
|
+
for (var s = {}, n = 0; n < i.flags.length; n++) s[i.flags[n]] = !0;
|
|
2415
|
+
this.instance.persistence.register({ [it]: s });
|
|
2416
|
+
} else this.instance.persistence.register({ [it]: i.flags });
|
|
2417
|
+
}
|
|
2418
|
+
return "payloads" in i && (i.payloads === !1 ? this.instance.persistence.unregister(bt) : i.payloads && this.instance.persistence.register({ [bt]: i.payloads })), void this._fireFeatureFlagsCallbacks();
|
|
2419
|
+
}
|
|
2420
|
+
this._fireFeatureFlagsCallbacks();
|
|
2421
|
+
}
|
|
2422
|
+
onFeatureFlags(e) {
|
|
2423
|
+
if (this.addFeatureFlagsHandler(e), this._hasLoadedFlags) {
|
|
2424
|
+
var { flags: t, flagVariants: i } = this._prepareFeatureFlagsForCallbacks();
|
|
2425
|
+
e(t, i);
|
|
2426
|
+
}
|
|
2427
|
+
return () => this.removeFeatureFlagsHandler(e);
|
|
2428
|
+
}
|
|
2429
|
+
updateEarlyAccessFeatureEnrollment(e, t) {
|
|
2430
|
+
var i, s = (this.instance.get_property(Yt) || []).find((l) => l.flagKey === e), n = { ["$feature_enrollment/".concat(e)]: t }, o = { $feature_flag: e, $feature_enrollment: t, $set: n };
|
|
2431
|
+
s && (o.$early_access_feature_name = s.name), this.instance.capture("$feature_enrollment_update", o), this.setPersonPropertiesForFlags(n, !1);
|
|
2432
|
+
var a = f(f({}, this.getFlagVariants()), {}, { [e]: t });
|
|
2433
|
+
(i = this.instance.persistence) === null || i === void 0 || i.register({ [Mi]: Object.keys($s(a)), [nt]: a }), this._fireFeatureFlagsCallbacks();
|
|
2434
|
+
}
|
|
2435
|
+
getEarlyAccessFeatures(e) {
|
|
2436
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = arguments.length > 2 ? arguments[2] : void 0, s = this.instance.get_property(Yt), n = i ? "&".concat(i.map((o) => "stage=".concat(o)).join("&")) : "";
|
|
2437
|
+
if (s && !t) return e(s);
|
|
2438
|
+
this.instance._send_request({ url: this.instance.requestRouter.endpointFor("api", "/api/early_access_features/?token=".concat(this.instance.config.token).concat(n)), method: "GET", callback: (o) => {
|
|
2439
|
+
var a;
|
|
2440
|
+
if (o.json) {
|
|
2441
|
+
var l = o.json.earlyAccessFeatures;
|
|
2442
|
+
return (a = this.instance.persistence) === null || a === void 0 || a.register({ [Yt]: l }), e(l);
|
|
2443
|
+
}
|
|
2444
|
+
} });
|
|
2445
|
+
}
|
|
2446
|
+
_prepareFeatureFlagsForCallbacks() {
|
|
2447
|
+
var e = this.getFlags(), t = this.getFlagVariants();
|
|
2448
|
+
return { flags: e.filter((i) => t[i]), flagVariants: Object.keys(t).filter((i) => t[i]).reduce((i, s) => (i[s] = t[s], i), {}) };
|
|
2449
|
+
}
|
|
2450
|
+
_fireFeatureFlagsCallbacks(e) {
|
|
2451
|
+
var { flags: t, flagVariants: i } = this._prepareFeatureFlagsForCallbacks();
|
|
2452
|
+
this.featureFlagEventHandlers.forEach((s) => s(t, i, { errorsLoading: e }));
|
|
2453
|
+
}
|
|
2454
|
+
setPersonPropertiesForFlags(e) {
|
|
2455
|
+
var t = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1], i = this.instance.get_property(Et) || {};
|
|
2456
|
+
this.instance.register({ [Et]: f(f({}, i), e) }), t && this.instance.reloadFeatureFlags();
|
|
2457
|
+
}
|
|
2458
|
+
resetPersonPropertiesForFlags() {
|
|
2459
|
+
this.instance.unregister(Et);
|
|
2460
|
+
}
|
|
2461
|
+
setGroupPropertiesForFlags(e) {
|
|
2462
|
+
var t = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1], i = this.instance.get_property(Ge) || {};
|
|
2463
|
+
Object.keys(i).length !== 0 && Object.keys(i).forEach((s) => {
|
|
2464
|
+
i[s] = f(f({}, i[s]), e[s]), delete e[s];
|
|
2465
|
+
}), this.instance.register({ [Ge]: f(f({}, i), e) }), t && this.instance.reloadFeatureFlags();
|
|
2466
|
+
}
|
|
2467
|
+
resetGroupPropertiesForFlags(e) {
|
|
2468
|
+
if (e) {
|
|
2469
|
+
var t = this.instance.get_property(Ge) || {};
|
|
2470
|
+
this.instance.register({ [Ge]: f(f({}, t), {}, { [e]: {} }) });
|
|
2471
|
+
} else this.instance.unregister(Ge);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
var el = ["cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory"];
|
|
2475
|
+
class Ai {
|
|
2476
|
+
constructor(e) {
|
|
2477
|
+
this.config = e, this.props = {}, this.campaign_params_saved = !1, this.name = ((t) => {
|
|
2478
|
+
var i = "";
|
|
2479
|
+
return t.token && (i = t.token.replace(/\+/g, "PL").replace(/\//g, "SL").replace(/=/g, "EQ")), t.persistence_name ? "ph_" + t.persistence_name : "ph_" + i + "_posthog";
|
|
2480
|
+
})(e), this.storage = this.buildStorage(e), this.load(), e.debug && x.info("Persistence loaded", e.persistence, f({}, this.props)), this.update_config(e, e), this.save();
|
|
2481
|
+
}
|
|
2482
|
+
buildStorage(e) {
|
|
2483
|
+
el.indexOf(e.persistence.toLowerCase()) === -1 && (x.critical("Unknown persistence type " + e.persistence + "; falling back to localStorage+cookie"), e.persistence = "localStorage+cookie");
|
|
2484
|
+
var t = e.persistence.toLowerCase();
|
|
2485
|
+
return t === "localstorage" && W.is_supported() ? W : t === "localstorage+cookie" && Nt.is_supported() ? Nt : t === "sessionstorage" && J.is_supported() ? J : t === "memory" ? Ko : t === "cookie" ? Pe : Nt.is_supported() ? Nt : Pe;
|
|
2486
|
+
}
|
|
2487
|
+
properties() {
|
|
2488
|
+
var e = {};
|
|
2489
|
+
return $(this.props, function(t, i) {
|
|
2490
|
+
if (i === nt && N(t)) for (var s = Object.keys(t), n = 0; n < s.length; n++) e["$feature/".concat(s[n])] = t[s[n]];
|
|
2491
|
+
else a = i, l = !1, (He(o = Fo) ? l : Br && o.indexOf === Br ? o.indexOf(a) != -1 : ($(o, function(c) {
|
|
2492
|
+
if (l || (l = c === a)) return Xt;
|
|
2493
|
+
}), l)) || (e[i] = t);
|
|
2494
|
+
var o, a, l;
|
|
2495
|
+
}), e;
|
|
2496
|
+
}
|
|
2497
|
+
load() {
|
|
2498
|
+
if (!this.disabled) {
|
|
2499
|
+
var e = this.storage.parse(this.name);
|
|
2500
|
+
e && (this.props = H({}, e));
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
save() {
|
|
2504
|
+
this.disabled || this.storage.set(this.name, this.props, this.expire_days, this.cross_subdomain, this.secure, this.config.debug);
|
|
2505
|
+
}
|
|
2506
|
+
remove() {
|
|
2507
|
+
this.storage.remove(this.name, !1), this.storage.remove(this.name, !0);
|
|
2508
|
+
}
|
|
2509
|
+
clear() {
|
|
2510
|
+
this.remove(), this.props = {};
|
|
2511
|
+
}
|
|
2512
|
+
register_once(e, t, i) {
|
|
2513
|
+
if (N(e)) {
|
|
2514
|
+
k(t) && (t = "None"), this.expire_days = k(i) ? this.default_expiry : i;
|
|
2515
|
+
var s = !1;
|
|
2516
|
+
if ($(e, (n, o) => {
|
|
2517
|
+
this.props.hasOwnProperty(o) && this.props[o] !== t || (this.props[o] = n, s = !0);
|
|
2518
|
+
}), s) return this.save(), !0;
|
|
2519
|
+
}
|
|
2520
|
+
return !1;
|
|
2521
|
+
}
|
|
2522
|
+
register(e, t) {
|
|
2523
|
+
if (N(e)) {
|
|
2524
|
+
this.expire_days = k(t) ? this.default_expiry : t;
|
|
2525
|
+
var i = !1;
|
|
2526
|
+
if ($(e, (s, n) => {
|
|
2527
|
+
e.hasOwnProperty(n) && this.props[n] !== s && (this.props[n] = s, i = !0);
|
|
2528
|
+
}), i) return this.save(), !0;
|
|
2529
|
+
}
|
|
2530
|
+
return !1;
|
|
2531
|
+
}
|
|
2532
|
+
unregister(e) {
|
|
2533
|
+
e in this.props && (delete this.props[e], this.save());
|
|
2534
|
+
}
|
|
2535
|
+
update_campaign_params() {
|
|
2536
|
+
if (!this.campaign_params_saved) {
|
|
2537
|
+
var e = A.campaignParams({ customTrackedParams: this.config.custom_campaign_params, maskPersonalDataProperties: this.config.mask_personal_data_properties, customPersonalDataProperties: this.config.custom_personal_data_properties });
|
|
2538
|
+
st(Rt(e)) || this.register(e), this.campaign_params_saved = !0;
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
update_search_keyword() {
|
|
2542
|
+
this.register(A.searchInfo());
|
|
2543
|
+
}
|
|
2544
|
+
update_referrer_info() {
|
|
2545
|
+
this.register_once(A.referrerInfo(), void 0);
|
|
2546
|
+
}
|
|
2547
|
+
set_initial_person_info() {
|
|
2548
|
+
this.props[Qi] || this.props[Zi] || this.register_once({ [Xi]: A.personInfo({ maskPersonalDataProperties: this.config.mask_personal_data_properties, customPersonalDataProperties: this.config.custom_personal_data_properties }) }, void 0);
|
|
2549
|
+
}
|
|
2550
|
+
get_referrer_info() {
|
|
2551
|
+
return Rt({ $referrer: this.props.$referrer, $referring_domain: this.props.$referring_domain });
|
|
2552
|
+
}
|
|
2553
|
+
get_initial_props() {
|
|
2554
|
+
var e = {};
|
|
2555
|
+
$([Zi, Qi], (s) => {
|
|
2556
|
+
var n = this.props[s];
|
|
2557
|
+
n && $(n, function(o, a) {
|
|
2558
|
+
e["$initial_" + br(a)] = o;
|
|
2559
|
+
});
|
|
2560
|
+
});
|
|
2561
|
+
var t = this.props[Xi];
|
|
2562
|
+
if (t) {
|
|
2563
|
+
var i = A.initialPersonPropsFromInfo(t);
|
|
2564
|
+
H(e, i);
|
|
2565
|
+
}
|
|
2566
|
+
return e;
|
|
2567
|
+
}
|
|
2568
|
+
safe_merge(e) {
|
|
2569
|
+
return $(this.props, function(t, i) {
|
|
2570
|
+
i in e || (e[i] = t);
|
|
2571
|
+
}), e;
|
|
2572
|
+
}
|
|
2573
|
+
update_config(e, t) {
|
|
2574
|
+
if (this.default_expiry = this.expire_days = e.cookie_expiration, this.set_disabled(e.disable_persistence), this.set_cross_subdomain(e.cross_subdomain_cookie), this.set_secure(e.secure_cookie), e.persistence !== t.persistence) {
|
|
2575
|
+
var i = this.buildStorage(e), s = this.props;
|
|
2576
|
+
this.clear(), this.storage = i, this.props = s, this.save();
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
set_disabled(e) {
|
|
2580
|
+
this.disabled = e, this.disabled ? this.remove() : this.save();
|
|
2581
|
+
}
|
|
2582
|
+
set_cross_subdomain(e) {
|
|
2583
|
+
e !== this.cross_subdomain && (this.cross_subdomain = e, this.remove(), this.save());
|
|
2584
|
+
}
|
|
2585
|
+
get_cross_subdomain() {
|
|
2586
|
+
return !!this.cross_subdomain;
|
|
2587
|
+
}
|
|
2588
|
+
set_secure(e) {
|
|
2589
|
+
e !== this.secure && (this.secure = e, this.remove(), this.save());
|
|
2590
|
+
}
|
|
2591
|
+
set_event_timer(e, t) {
|
|
2592
|
+
var i = this.props[kt] || {};
|
|
2593
|
+
i[e] = t, this.props[kt] = i, this.save();
|
|
2594
|
+
}
|
|
2595
|
+
remove_event_timer(e) {
|
|
2596
|
+
var t = (this.props[kt] || {})[e];
|
|
2597
|
+
return k(t) || (delete this.props[kt][e], this.save()), t;
|
|
2598
|
+
}
|
|
2599
|
+
get_property(e) {
|
|
2600
|
+
return this.props[e];
|
|
2601
|
+
}
|
|
2602
|
+
set_property(e, t) {
|
|
2603
|
+
this.props[e] = t, this.save();
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
var Qn, B, Zn, Je, Os, Xn, pr, eo, Ls, _r, Ms, As, Ds, qs, gr = {}, to = [], tl = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Fr = Array.isArray;
|
|
2607
|
+
function qe(r, e) {
|
|
2608
|
+
for (var t in e) r[t] = e[t];
|
|
2609
|
+
return r;
|
|
2610
|
+
}
|
|
2611
|
+
function io(r) {
|
|
2612
|
+
var e = r.parentNode;
|
|
2613
|
+
e && e.removeChild(r);
|
|
2614
|
+
}
|
|
2615
|
+
function Di(r, e, t, i, s) {
|
|
2616
|
+
var n = { type: r, props: e, key: t, ref: i, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: s ?? ++Zn, __i: -1, __u: 0 };
|
|
2617
|
+
return s == null && B.vnode != null && B.vnode(n), n;
|
|
2618
|
+
}
|
|
2619
|
+
function Tr(r) {
|
|
2620
|
+
return r.children;
|
|
2621
|
+
}
|
|
2622
|
+
function Zt(r, e) {
|
|
2623
|
+
this.props = r, this.context = e;
|
|
2624
|
+
}
|
|
2625
|
+
function _t(r, e) {
|
|
2626
|
+
if (e == null) return r.__ ? _t(r.__, r.__i + 1) : null;
|
|
2627
|
+
for (var t; e < r.__k.length; e++) if ((t = r.__k[e]) != null && t.__e != null) return t.__e;
|
|
2628
|
+
return typeof r.type == "function" ? _t(r) : null;
|
|
2629
|
+
}
|
|
2630
|
+
function ro(r) {
|
|
2631
|
+
var e, t;
|
|
2632
|
+
if ((r = r.__) != null && r.__c != null) {
|
|
2633
|
+
for (r.__e = r.__c.base = null, e = 0; e < r.__k.length; e++) if ((t = r.__k[e]) != null && t.__e != null) {
|
|
2634
|
+
r.__e = r.__c.base = t.__e;
|
|
2635
|
+
break;
|
|
2636
|
+
}
|
|
2637
|
+
return ro(r);
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
function vr(r) {
|
|
2641
|
+
(!r.__d && (r.__d = !0) && Je.push(r) && !ci.__r++ || Os !== B.debounceRendering) && ((Os = B.debounceRendering) || Xn)(ci);
|
|
2642
|
+
}
|
|
2643
|
+
function ci() {
|
|
2644
|
+
var r, e, t, i, s, n, o, a, l;
|
|
2645
|
+
for (Je.sort(pr); r = Je.shift(); ) r.__d && (e = Je.length, i = void 0, n = (s = (t = r).__v).__e, a = [], l = [], (o = t.__P) && ((i = qe({}, s)).__v = s.__v + 1, B.vnode && B.vnode(i), oo(o, i, s, t.__n, o.ownerSVGElement !== void 0, 32 & s.__u ? [n] : null, a, n ?? _t(s), !!(32 & s.__u), l), i.__.__k[i.__i] = i, sl(a, i, l), i.__e != n && ro(i)), Je.length > e && Je.sort(pr));
|
|
2646
|
+
ci.__r = 0;
|
|
2647
|
+
}
|
|
2648
|
+
function so(r, e, t, i, s, n, o, a, l, c, d) {
|
|
2649
|
+
var u, p, h, _, v, b = i && i.__k || to, m = e.length;
|
|
2650
|
+
for (t.__d = l, il(t, e, b), l = t.__d, u = 0; u < m; u++) (h = t.__k[u]) != null && typeof h != "boolean" && typeof h != "function" && (p = h.__i === -1 ? gr : b[h.__i] || gr, h.__i = u, oo(r, h, p, s, n, o, a, l, c, d), _ = h.__e, h.ref && p.ref != h.ref && (p.ref && Rr(p.ref, null, h), d.push(h.ref, h.__c || _, h)), v == null && _ != null && (v = _), 65536 & h.__u || p.__k === h.__k ? l = no(h, l, r) : typeof h.type == "function" && h.__d !== void 0 ? l = h.__d : _ && (l = _.nextSibling), h.__d = void 0, h.__u &= -196609);
|
|
2651
|
+
t.__d = l, t.__e = v;
|
|
2652
|
+
}
|
|
2653
|
+
function il(r, e, t) {
|
|
2654
|
+
var i, s, n, o, a, l = e.length, c = t.length, d = c, u = 0;
|
|
2655
|
+
for (r.__k = [], i = 0; i < l; i++) (s = r.__k[i] = (s = e[i]) == null || typeof s == "boolean" || typeof s == "function" ? null : typeof s == "string" || typeof s == "number" || typeof s == "bigint" || s.constructor == String ? Di(null, s, null, null, s) : Fr(s) ? Di(Tr, { children: s }, null, null, null) : s.constructor === void 0 && s.__b > 0 ? Di(s.type, s.props, s.key, s.ref ? s.ref : null, s.__v) : s) != null ? (s.__ = r, s.__b = r.__b + 1, a = rl(s, t, o = i + u, d), s.__i = a, n = null, a !== -1 && (d--, (n = t[a]) && (n.__u |= 131072)), n == null || n.__v === null ? (a == -1 && u--, typeof s.type != "function" && (s.__u |= 65536)) : a !== o && (a === o + 1 ? u++ : a > o ? d > l - o ? u += a - o : u-- : u = a < o && a == o - 1 ? a - o : 0, a !== i + u && (s.__u |= 65536))) : (n = t[i]) && n.key == null && n.__e && (n.__e == r.__d && (r.__d = _t(n)), fr(n, n, !1), t[i] = null, d--);
|
|
2656
|
+
if (d) for (i = 0; i < c; i++) (n = t[i]) != null && (131072 & n.__u) == 0 && (n.__e == r.__d && (r.__d = _t(n)), fr(n, n));
|
|
2657
|
+
}
|
|
2658
|
+
function no(r, e, t) {
|
|
2659
|
+
var i, s;
|
|
2660
|
+
if (typeof r.type == "function") {
|
|
2661
|
+
for (i = r.__k, s = 0; i && s < i.length; s++) i[s] && (i[s].__ = r, e = no(i[s], e, t));
|
|
2662
|
+
return e;
|
|
2663
|
+
}
|
|
2664
|
+
return r.__e != e && (t.insertBefore(r.__e, e || null), e = r.__e), e && e.nextSibling;
|
|
2665
|
+
}
|
|
2666
|
+
function rl(r, e, t, i) {
|
|
2667
|
+
var s = r.key, n = r.type, o = t - 1, a = t + 1, l = e[t];
|
|
2668
|
+
if (l === null || l && s == l.key && n === l.type) return t;
|
|
2669
|
+
if (i > (l != null && (131072 & l.__u) == 0 ? 1 : 0)) for (; o >= 0 || a < e.length; ) {
|
|
2670
|
+
if (o >= 0) {
|
|
2671
|
+
if ((l = e[o]) && (131072 & l.__u) == 0 && s == l.key && n === l.type) return o;
|
|
2672
|
+
o--;
|
|
2673
|
+
}
|
|
2674
|
+
if (a < e.length) {
|
|
2675
|
+
if ((l = e[a]) && (131072 & l.__u) == 0 && s == l.key && n === l.type) return a;
|
|
2676
|
+
a++;
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
return -1;
|
|
2680
|
+
}
|
|
2681
|
+
function Ns(r, e, t) {
|
|
2682
|
+
e[0] === "-" ? r.setProperty(e, t ?? "") : r[e] = t == null ? "" : typeof t != "number" || tl.test(e) ? t : t + "px";
|
|
2683
|
+
}
|
|
2684
|
+
function Vt(r, e, t, i, s) {
|
|
2685
|
+
var n;
|
|
2686
|
+
e: if (e === "style") if (typeof t == "string") r.style.cssText = t;
|
|
2687
|
+
else {
|
|
2688
|
+
if (typeof i == "string" && (r.style.cssText = i = ""), i) for (e in i) t && e in t || Ns(r.style, e, "");
|
|
2689
|
+
if (t) for (e in t) i && t[e] === i[e] || Ns(r.style, e, t[e]);
|
|
2690
|
+
}
|
|
2691
|
+
else if (e[0] === "o" && e[1] === "n") n = e !== (e = e.replace(/(PointerCapture)$|Capture$/, "$1")), e = e.toLowerCase() in r ? e.toLowerCase().slice(2) : e.slice(2), r.l || (r.l = {}), r.l[e + n] = t, t ? i ? t.u = i.u : (t.u = Date.now(), r.addEventListener(e, n ? Hs : Bs, n)) : r.removeEventListener(e, n ? Hs : Bs, n);
|
|
2692
|
+
else {
|
|
2693
|
+
if (s) e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
2694
|
+
else if (e !== "width" && e !== "height" && e !== "href" && e !== "list" && e !== "form" && e !== "tabIndex" && e !== "download" && e !== "rowSpan" && e !== "colSpan" && e !== "role" && e in r) try {
|
|
2695
|
+
r[e] = t ?? "";
|
|
2696
|
+
break e;
|
|
2697
|
+
} catch {
|
|
2698
|
+
}
|
|
2699
|
+
typeof t == "function" || (t == null || t === !1 && e[4] !== "-" ? r.removeAttribute(e) : r.setAttribute(e, t));
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
function Bs(r) {
|
|
2703
|
+
var e = this.l[r.type + !1];
|
|
2704
|
+
if (r.t) {
|
|
2705
|
+
if (r.t <= e.u) return;
|
|
2706
|
+
} else r.t = Date.now();
|
|
2707
|
+
return e(B.event ? B.event(r) : r);
|
|
2708
|
+
}
|
|
2709
|
+
function Hs(r) {
|
|
2710
|
+
return this.l[r.type + !0](B.event ? B.event(r) : r);
|
|
2711
|
+
}
|
|
2712
|
+
function oo(r, e, t, i, s, n, o, a, l, c) {
|
|
2713
|
+
var d, u, p, h, _, v, b, m, y, E, I, F, O, L, P, D = e.type;
|
|
2714
|
+
if (e.constructor !== void 0) return null;
|
|
2715
|
+
128 & t.__u && (l = !!(32 & t.__u), n = [a = e.__e = t.__e]), (d = B.__b) && d(e);
|
|
2716
|
+
e: if (typeof D == "function") try {
|
|
2717
|
+
if (m = e.props, y = (d = D.contextType) && i[d.__c], E = d ? y ? y.props.value : d.__ : i, t.__c ? b = (u = e.__c = t.__c).__ = u.__E : ("prototype" in D && D.prototype.render ? e.__c = u = new D(m, E) : (e.__c = u = new Zt(m, E), u.constructor = D, u.render = ol), y && y.sub(u), u.props = m, u.state || (u.state = {}), u.context = E, u.__n = i, p = u.__d = !0, u.__h = [], u._sb = []), u.__s == null && (u.__s = u.state), D.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = qe({}, u.__s)), qe(u.__s, D.getDerivedStateFromProps(m, u.__s))), h = u.props, _ = u.state, u.__v = e, p) D.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
2718
|
+
else {
|
|
2719
|
+
if (D.getDerivedStateFromProps == null && m !== h && u.componentWillReceiveProps != null && u.componentWillReceiveProps(m, E), !u.__e && (u.shouldComponentUpdate != null && u.shouldComponentUpdate(m, u.__s, E) === !1 || e.__v === t.__v)) {
|
|
2720
|
+
for (e.__v !== t.__v && (u.props = m, u.state = u.__s, u.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.forEach(function(V) {
|
|
2721
|
+
V && (V.__ = e);
|
|
2722
|
+
}), I = 0; I < u._sb.length; I++) u.__h.push(u._sb[I]);
|
|
2723
|
+
u._sb = [], u.__h.length && o.push(u);
|
|
2724
|
+
break e;
|
|
2725
|
+
}
|
|
2726
|
+
u.componentWillUpdate != null && u.componentWillUpdate(m, u.__s, E), u.componentDidUpdate != null && u.__h.push(function() {
|
|
2727
|
+
u.componentDidUpdate(h, _, v);
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
if (u.context = E, u.props = m, u.__P = r, u.__e = !1, F = B.__r, O = 0, "prototype" in D && D.prototype.render) {
|
|
2731
|
+
for (u.state = u.__s, u.__d = !1, F && F(e), d = u.render(u.props, u.state, u.context), L = 0; L < u._sb.length; L++) u.__h.push(u._sb[L]);
|
|
2732
|
+
u._sb = [];
|
|
2733
|
+
} else do
|
|
2734
|
+
u.__d = !1, F && F(e), d = u.render(u.props, u.state, u.context), u.state = u.__s;
|
|
2735
|
+
while (u.__d && ++O < 25);
|
|
2736
|
+
u.state = u.__s, u.getChildContext != null && (i = qe(qe({}, i), u.getChildContext())), p || u.getSnapshotBeforeUpdate == null || (v = u.getSnapshotBeforeUpdate(h, _)), so(r, Fr(P = d != null && d.type === Tr && d.key == null ? d.props.children : d) ? P : [P], e, t, i, s, n, o, a, l, c), u.base = e.__e, e.__u &= -161, u.__h.length && o.push(u), b && (u.__E = u.__ = null);
|
|
2737
|
+
} catch (V) {
|
|
2738
|
+
e.__v = null, l || n != null ? (e.__e = a, e.__u |= l ? 160 : 32, n[n.indexOf(a)] = null) : (e.__e = t.__e, e.__k = t.__k), B.__e(V, e, t);
|
|
2739
|
+
}
|
|
2740
|
+
else n == null && e.__v === t.__v ? (e.__k = t.__k, e.__e = t.__e) : e.__e = nl(t.__e, e, t, i, s, n, o, l, c);
|
|
2741
|
+
(d = B.diffed) && d(e);
|
|
2742
|
+
}
|
|
2743
|
+
function sl(r, e, t) {
|
|
2744
|
+
e.__d = void 0;
|
|
2745
|
+
for (var i = 0; i < t.length; i++) Rr(t[i], t[++i], t[++i]);
|
|
2746
|
+
B.__c && B.__c(e, r), r.some(function(s) {
|
|
2747
|
+
try {
|
|
2748
|
+
r = s.__h, s.__h = [], r.some(function(n) {
|
|
2749
|
+
n.call(s);
|
|
2750
|
+
});
|
|
2751
|
+
} catch (n) {
|
|
2752
|
+
B.__e(n, s.__v);
|
|
2753
|
+
}
|
|
2754
|
+
});
|
|
2755
|
+
}
|
|
2756
|
+
function nl(r, e, t, i, s, n, o, a, l) {
|
|
2757
|
+
var c, d, u, p, h, _, v, b = t.props, m = e.props, y = e.type;
|
|
2758
|
+
if (y === "svg" && (s = !0), n != null) {
|
|
2759
|
+
for (c = 0; c < n.length; c++) if ((h = n[c]) && "setAttribute" in h == !!y && (y ? h.localName === y : h.nodeType === 3)) {
|
|
2760
|
+
r = h, n[c] = null;
|
|
2761
|
+
break;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
if (r == null) {
|
|
2765
|
+
if (y === null) return document.createTextNode(m);
|
|
2766
|
+
r = s ? document.createElementNS("http://www.w3.org/2000/svg", y) : document.createElement(y, m.is && m), n = null, a = !1;
|
|
2767
|
+
}
|
|
2768
|
+
if (y === null) b === m || a && r.data === m || (r.data = m);
|
|
2769
|
+
else {
|
|
2770
|
+
if (n = n && Qn.call(r.childNodes), b = t.props || gr, !a && n != null) for (b = {}, c = 0; c < r.attributes.length; c++) b[(h = r.attributes[c]).name] = h.value;
|
|
2771
|
+
for (c in b) h = b[c], c == "children" || (c == "dangerouslySetInnerHTML" ? u = h : c === "key" || c in m || Vt(r, c, null, h, s));
|
|
2772
|
+
for (c in m) h = m[c], c == "children" ? p = h : c == "dangerouslySetInnerHTML" ? d = h : c == "value" ? _ = h : c == "checked" ? v = h : c === "key" || a && typeof h != "function" || b[c] === h || Vt(r, c, h, b[c], s);
|
|
2773
|
+
if (d) a || u && (d.__html === u.__html || d.__html === r.innerHTML) || (r.innerHTML = d.__html), e.__k = [];
|
|
2774
|
+
else if (u && (r.innerHTML = ""), so(r, Fr(p) ? p : [p], e, t, i, s && y !== "foreignObject", n, o, n ? n[0] : t.__k && _t(t, 0), a, l), n != null) for (c = n.length; c--; ) n[c] != null && io(n[c]);
|
|
2775
|
+
a || (c = "value", _ !== void 0 && (_ !== r[c] || y === "progress" && !_ || y === "option" && _ !== b[c]) && Vt(r, c, _, b[c], !1), c = "checked", v !== void 0 && v !== r[c] && Vt(r, c, v, b[c], !1));
|
|
2776
|
+
}
|
|
2777
|
+
return r;
|
|
2778
|
+
}
|
|
2779
|
+
function Rr(r, e, t) {
|
|
2780
|
+
try {
|
|
2781
|
+
typeof r == "function" ? r(e) : r.current = e;
|
|
2782
|
+
} catch (i) {
|
|
2783
|
+
B.__e(i, t);
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
function fr(r, e, t) {
|
|
2787
|
+
var i, s;
|
|
2788
|
+
if (B.unmount && B.unmount(r), (i = r.ref) && (i.current && i.current !== r.__e || Rr(i, null, e)), (i = r.__c) != null) {
|
|
2789
|
+
if (i.componentWillUnmount) try {
|
|
2790
|
+
i.componentWillUnmount();
|
|
2791
|
+
} catch (n) {
|
|
2792
|
+
B.__e(n, e);
|
|
2793
|
+
}
|
|
2794
|
+
i.base = i.__P = null, r.__c = void 0;
|
|
2795
|
+
}
|
|
2796
|
+
if (i = r.__k) for (s = 0; s < i.length; s++) i[s] && fr(i[s], e, t || typeof r.type != "function");
|
|
2797
|
+
t || r.__e == null || io(r.__e), r.__ = r.__e = r.__d = void 0;
|
|
2798
|
+
}
|
|
2799
|
+
function ol(r, e, t) {
|
|
2800
|
+
return this.constructor(r, t);
|
|
2801
|
+
}
|
|
2802
|
+
Qn = to.slice, B = { __e: function(r, e, t, i) {
|
|
2803
|
+
for (var s, n, o; e = e.__; ) if ((s = e.__c) && !s.__) try {
|
|
2804
|
+
if ((n = s.constructor) && n.getDerivedStateFromError != null && (s.setState(n.getDerivedStateFromError(r)), o = s.__d), s.componentDidCatch != null && (s.componentDidCatch(r, i || {}), o = s.__d), o) return s.__E = s;
|
|
2805
|
+
} catch (a) {
|
|
2806
|
+
r = a;
|
|
2807
|
+
}
|
|
2808
|
+
throw r;
|
|
2809
|
+
} }, Zn = 0, Zt.prototype.setState = function(r, e) {
|
|
2810
|
+
var t;
|
|
2811
|
+
t = this.__s != null && this.__s !== this.state ? this.__s : this.__s = qe({}, this.state), typeof r == "function" && (r = r(qe({}, t), this.props)), r && qe(t, r), r != null && this.__v && (e && this._sb.push(e), vr(this));
|
|
2812
|
+
}, Zt.prototype.forceUpdate = function(r) {
|
|
2813
|
+
this.__v && (this.__e = !0, r && this.__h.push(r), vr(this));
|
|
2814
|
+
}, Zt.prototype.render = Tr, Je = [], Xn = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, pr = function(r, e) {
|
|
2815
|
+
return r.__v.__b - e.__v.__b;
|
|
2816
|
+
}, ci.__r = 0, eo = 0, function(r) {
|
|
2817
|
+
r.Button = "button", r.Tab = "tab", r.Selector = "selector";
|
|
2818
|
+
}(Ls || (Ls = {})), function(r) {
|
|
2819
|
+
r.Left = "left", r.Center = "center", r.Right = "right", r.NextToTrigger = "next_to_trigger";
|
|
2820
|
+
}(_r || (_r = {})), function(r) {
|
|
2821
|
+
r.Popover = "popover", r.API = "api", r.Widget = "widget";
|
|
2822
|
+
}(Ms || (Ms = {})), function(r) {
|
|
2823
|
+
r.Open = "open", r.MultipleChoice = "multiple_choice", r.SingleChoice = "single_choice", r.Rating = "rating", r.Link = "link";
|
|
2824
|
+
}(As || (As = {})), function(r) {
|
|
2825
|
+
r.NextQuestion = "next_question", r.End = "end", r.ResponseBased = "response_based", r.SpecificQuestion = "specific_question";
|
|
2826
|
+
}(Ds || (Ds = {})), function(r) {
|
|
2827
|
+
r.Once = "once", r.Recurring = "recurring", r.Always = "always";
|
|
2828
|
+
}(qs || (qs = {}));
|
|
2829
|
+
var gt = function(r, e) {
|
|
2830
|
+
if (!function(t) {
|
|
2831
|
+
try {
|
|
2832
|
+
new RegExp(t);
|
|
2833
|
+
} catch {
|
|
2834
|
+
return !1;
|
|
2835
|
+
}
|
|
2836
|
+
return !0;
|
|
2837
|
+
}(e)) return !1;
|
|
2838
|
+
try {
|
|
2839
|
+
return new RegExp(e).test(r);
|
|
2840
|
+
} catch {
|
|
2841
|
+
return !1;
|
|
2842
|
+
}
|
|
2843
|
+
}, G = Q("[Surveys]"), Us = { icontains: (r, e) => r.some((t) => e.toLowerCase().includes(t.toLowerCase())), not_icontains: (r, e) => r.every((t) => !e.toLowerCase().includes(t.toLowerCase())), regex: (r, e) => r.some((t) => gt(e, t)), not_regex: (r, e) => r.every((t) => !gt(e, t)), exact: (r, e) => r.some((t) => e === t), is_not: (r, e) => r.every((t) => e !== t) };
|
|
2844
|
+
function js(r) {
|
|
2845
|
+
return r ?? "icontains";
|
|
2846
|
+
}
|
|
2847
|
+
_r.Right;
|
|
2848
|
+
(function(r, e) {
|
|
2849
|
+
var t = { __c: e = "__cC" + eo++, __: r, Consumer: function(i, s) {
|
|
2850
|
+
return i.children(s);
|
|
2851
|
+
}, Provider: function(i) {
|
|
2852
|
+
var s, n;
|
|
2853
|
+
return this.getChildContext || (s = [], (n = {})[e] = this, this.getChildContext = function() {
|
|
2854
|
+
return n;
|
|
2855
|
+
}, this.shouldComponentUpdate = function(o) {
|
|
2856
|
+
this.props.value !== o.value && s.some(function(a) {
|
|
2857
|
+
a.__e = !0, vr(a);
|
|
2858
|
+
});
|
|
2859
|
+
}, this.sub = function(o) {
|
|
2860
|
+
s.push(o);
|
|
2861
|
+
var a = o.componentWillUnmount;
|
|
2862
|
+
o.componentWillUnmount = function() {
|
|
2863
|
+
s.splice(s.indexOf(o), 1), a && a.call(o);
|
|
2864
|
+
};
|
|
2865
|
+
}), i.children;
|
|
2866
|
+
} };
|
|
2867
|
+
t.Provider.__ = t.Consumer.contextType = t;
|
|
2868
|
+
})({ isPreviewMode: !1, previewPageIndex: 0, onPopupSurveyDismissed: () => {
|
|
2869
|
+
}, isPopup: !0, onPreviewSubmit: () => {
|
|
2870
|
+
} });
|
|
2871
|
+
class ao {
|
|
2872
|
+
constructor() {
|
|
2873
|
+
w(this, "events", {}), this.events = {};
|
|
2874
|
+
}
|
|
2875
|
+
on(e, t) {
|
|
2876
|
+
return this.events[e] || (this.events[e] = []), this.events[e].push(t), () => {
|
|
2877
|
+
this.events[e] = this.events[e].filter((i) => i !== t);
|
|
2878
|
+
};
|
|
2879
|
+
}
|
|
2880
|
+
emit(e, t) {
|
|
2881
|
+
for (var i of this.events[e] || []) i(t);
|
|
2882
|
+
for (var s of this.events["*"] || []) s(e, t);
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
class Ye {
|
|
2886
|
+
constructor(e) {
|
|
2887
|
+
w(this, "_debugEventEmitter", new ao()), w(this, "checkStep", (t, i) => this.checkStepEvent(t, i) && this.checkStepUrl(t, i) && this.checkStepElement(t, i)), w(this, "checkStepEvent", (t, i) => i == null || !i.event || (t == null ? void 0 : t.event) === (i == null ? void 0 : i.event)), this.instance = e, this.actionEvents = /* @__PURE__ */ new Set(), this.actionRegistry = /* @__PURE__ */ new Set();
|
|
2888
|
+
}
|
|
2889
|
+
init() {
|
|
2890
|
+
var e;
|
|
2891
|
+
if (!k((e = this.instance) === null || e === void 0 ? void 0 : e._addCaptureHook)) {
|
|
2892
|
+
var t;
|
|
2893
|
+
(t = this.instance) === null || t === void 0 || t._addCaptureHook((i, s) => {
|
|
2894
|
+
this.on(i, s);
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
register(e) {
|
|
2899
|
+
var t, i;
|
|
2900
|
+
if (!k((t = this.instance) === null || t === void 0 ? void 0 : t._addCaptureHook) && (e.forEach((o) => {
|
|
2901
|
+
var a, l;
|
|
2902
|
+
(a = this.actionRegistry) === null || a === void 0 || a.add(o), (l = o.steps) === null || l === void 0 || l.forEach((c) => {
|
|
2903
|
+
var d;
|
|
2904
|
+
(d = this.actionEvents) === null || d === void 0 || d.add((c == null ? void 0 : c.event) || "");
|
|
2905
|
+
});
|
|
2906
|
+
}), (i = this.instance) !== null && i !== void 0 && i.autocapture)) {
|
|
2907
|
+
var s, n = /* @__PURE__ */ new Set();
|
|
2908
|
+
e.forEach((o) => {
|
|
2909
|
+
var a;
|
|
2910
|
+
(a = o.steps) === null || a === void 0 || a.forEach((l) => {
|
|
2911
|
+
l != null && l.selector && n.add(l == null ? void 0 : l.selector);
|
|
2912
|
+
});
|
|
2913
|
+
}), (s = this.instance) === null || s === void 0 || s.autocapture.setElementSelectors(n);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
on(e, t) {
|
|
2917
|
+
var i;
|
|
2918
|
+
t != null && e.length != 0 && (this.actionEvents.has(e) || this.actionEvents.has(t == null ? void 0 : t.event)) && this.actionRegistry && ((i = this.actionRegistry) === null || i === void 0 ? void 0 : i.size) > 0 && this.actionRegistry.forEach((s) => {
|
|
2919
|
+
this.checkAction(t, s) && this._debugEventEmitter.emit("actionCaptured", s.name);
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
_addActionHook(e) {
|
|
2923
|
+
this.onAction("actionCaptured", (t) => e(t));
|
|
2924
|
+
}
|
|
2925
|
+
checkAction(e, t) {
|
|
2926
|
+
if ((t == null ? void 0 : t.steps) == null) return !1;
|
|
2927
|
+
for (var i of t.steps) if (this.checkStep(e, i)) return !0;
|
|
2928
|
+
return !1;
|
|
2929
|
+
}
|
|
2930
|
+
onAction(e, t) {
|
|
2931
|
+
return this._debugEventEmitter.on(e, t);
|
|
2932
|
+
}
|
|
2933
|
+
checkStepUrl(e, t) {
|
|
2934
|
+
if (t != null && t.url) {
|
|
2935
|
+
var i, s = e == null || (i = e.properties) === null || i === void 0 ? void 0 : i.$current_url;
|
|
2936
|
+
if (!s || typeof s != "string" || !Ye.matchString(s, t == null ? void 0 : t.url, (t == null ? void 0 : t.url_matching) || "contains")) return !1;
|
|
2937
|
+
}
|
|
2938
|
+
return !0;
|
|
2939
|
+
}
|
|
2940
|
+
static matchString(e, t, i) {
|
|
2941
|
+
switch (i) {
|
|
2942
|
+
case "regex":
|
|
2943
|
+
return !!g && gt(e, t);
|
|
2944
|
+
case "exact":
|
|
2945
|
+
return t === e;
|
|
2946
|
+
case "contains":
|
|
2947
|
+
var s = Ye.escapeStringRegexp(t).replace(/_/g, ".").replace(/%/g, ".*");
|
|
2948
|
+
return gt(e, s);
|
|
2949
|
+
default:
|
|
2950
|
+
return !1;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
static escapeStringRegexp(e) {
|
|
2954
|
+
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
2955
|
+
}
|
|
2956
|
+
checkStepElement(e, t) {
|
|
2957
|
+
if ((t != null && t.href || t != null && t.tag_name || t != null && t.text) && !this.getElementsList(e).some((n) => !(t != null && t.href && !Ye.matchString(n.href || "", t == null ? void 0 : t.href, (t == null ? void 0 : t.href_matching) || "exact")) && (t == null || !t.tag_name || n.tag_name === (t == null ? void 0 : t.tag_name)) && !(t != null && t.text && !Ye.matchString(n.text || "", t == null ? void 0 : t.text, (t == null ? void 0 : t.text_matching) || "exact") && !Ye.matchString(n.$el_text || "", t == null ? void 0 : t.text, (t == null ? void 0 : t.text_matching) || "exact")))) return !1;
|
|
2958
|
+
if (t != null && t.selector) {
|
|
2959
|
+
var i, s = e == null || (i = e.properties) === null || i === void 0 ? void 0 : i.$element_selectors;
|
|
2960
|
+
if (!s || !s.includes(t == null ? void 0 : t.selector)) return !1;
|
|
2961
|
+
}
|
|
2962
|
+
return !0;
|
|
2963
|
+
}
|
|
2964
|
+
getElementsList(e) {
|
|
2965
|
+
return (e == null ? void 0 : e.properties.$elements) == null ? [] : e == null ? void 0 : e.properties.$elements;
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
class At {
|
|
2969
|
+
constructor(e) {
|
|
2970
|
+
this.instance = e, this.eventToSurveys = /* @__PURE__ */ new Map(), this.actionToSurveys = /* @__PURE__ */ new Map();
|
|
2971
|
+
}
|
|
2972
|
+
register(e) {
|
|
2973
|
+
var t;
|
|
2974
|
+
k((t = this.instance) === null || t === void 0 ? void 0 : t._addCaptureHook) || (this.setupEventBasedSurveys(e), this.setupActionBasedSurveys(e));
|
|
2975
|
+
}
|
|
2976
|
+
setupActionBasedSurveys(e) {
|
|
2977
|
+
var t = e.filter((i) => {
|
|
2978
|
+
var s, n, o, a;
|
|
2979
|
+
return ((s = i.conditions) === null || s === void 0 ? void 0 : s.actions) && ((n = i.conditions) === null || n === void 0 || (o = n.actions) === null || o === void 0 || (a = o.values) === null || a === void 0 ? void 0 : a.length) > 0;
|
|
2980
|
+
});
|
|
2981
|
+
t.length !== 0 && (this.actionMatcher == null && (this.actionMatcher = new Ye(this.instance), this.actionMatcher.init(), this.actionMatcher._addActionHook((i) => {
|
|
2982
|
+
this.onAction(i);
|
|
2983
|
+
})), t.forEach((i) => {
|
|
2984
|
+
var s, n, o, a, l, c, d, u, p, h;
|
|
2985
|
+
i.conditions && (s = i.conditions) !== null && s !== void 0 && s.actions && (n = i.conditions) !== null && n !== void 0 && (o = n.actions) !== null && o !== void 0 && o.values && ((a = i.conditions) === null || a === void 0 || (l = a.actions) === null || l === void 0 || (c = l.values) === null || c === void 0 ? void 0 : c.length) > 0 && ((d = this.actionMatcher) === null || d === void 0 || d.register(i.conditions.actions.values), (u = i.conditions) === null || u === void 0 || (p = u.actions) === null || p === void 0 || (h = p.values) === null || h === void 0 || h.forEach((_) => {
|
|
2986
|
+
if (_ && _.name) {
|
|
2987
|
+
var v = this.actionToSurveys.get(_.name);
|
|
2988
|
+
v && v.push(i.id), this.actionToSurveys.set(_.name, v || [i.id]);
|
|
2989
|
+
}
|
|
2990
|
+
}));
|
|
2991
|
+
}));
|
|
2992
|
+
}
|
|
2993
|
+
setupEventBasedSurveys(e) {
|
|
2994
|
+
var t;
|
|
2995
|
+
e.filter((i) => {
|
|
2996
|
+
var s, n, o, a;
|
|
2997
|
+
return ((s = i.conditions) === null || s === void 0 ? void 0 : s.events) && ((n = i.conditions) === null || n === void 0 || (o = n.events) === null || o === void 0 || (a = o.values) === null || a === void 0 ? void 0 : a.length) > 0;
|
|
2998
|
+
}).length !== 0 && ((t = this.instance) === null || t === void 0 || t._addCaptureHook((i, s) => {
|
|
2999
|
+
this.onEvent(i, s);
|
|
3000
|
+
}), e.forEach((i) => {
|
|
3001
|
+
var s, n, o;
|
|
3002
|
+
(s = i.conditions) === null || s === void 0 || (n = s.events) === null || n === void 0 || (o = n.values) === null || o === void 0 || o.forEach((a) => {
|
|
3003
|
+
if (a && a.name) {
|
|
3004
|
+
var l = this.eventToSurveys.get(a.name);
|
|
3005
|
+
l && l.push(i.id), this.eventToSurveys.set(a.name, l || [i.id]);
|
|
3006
|
+
}
|
|
3007
|
+
});
|
|
3008
|
+
}));
|
|
3009
|
+
}
|
|
3010
|
+
onEvent(e, t) {
|
|
3011
|
+
var i, s, n = ((i = this.instance) === null || i === void 0 || (s = i.persistence) === null || s === void 0 ? void 0 : s.props[qt]) || [];
|
|
3012
|
+
if (At.SURVEY_SHOWN_EVENT_NAME == e && t && n.length > 0) {
|
|
3013
|
+
var o, a = t == null || (o = t.properties) === null || o === void 0 ? void 0 : o.$survey_id;
|
|
3014
|
+
if (a) {
|
|
3015
|
+
var l = n.indexOf(a);
|
|
3016
|
+
l >= 0 && (n.splice(l, 1), this._updateActivatedSurveys(n));
|
|
3017
|
+
}
|
|
3018
|
+
} else this.eventToSurveys.has(e) && this._updateActivatedSurveys(n.concat(this.eventToSurveys.get(e) || []));
|
|
3019
|
+
}
|
|
3020
|
+
onAction(e) {
|
|
3021
|
+
var t, i, s = ((t = this.instance) === null || t === void 0 || (i = t.persistence) === null || i === void 0 ? void 0 : i.props[qt]) || [];
|
|
3022
|
+
this.actionToSurveys.has(e) && this._updateActivatedSurveys(s.concat(this.actionToSurveys.get(e) || []));
|
|
3023
|
+
}
|
|
3024
|
+
_updateActivatedSurveys(e) {
|
|
3025
|
+
var t, i;
|
|
3026
|
+
(t = this.instance) === null || t === void 0 || (i = t.persistence) === null || i === void 0 || i.register({ [qt]: [...new Set(e)] });
|
|
3027
|
+
}
|
|
3028
|
+
getSurveys() {
|
|
3029
|
+
var e, t, i = (e = this.instance) === null || e === void 0 || (t = e.persistence) === null || t === void 0 ? void 0 : t.props[qt];
|
|
3030
|
+
return i || [];
|
|
3031
|
+
}
|
|
3032
|
+
getEventToSurveys() {
|
|
3033
|
+
return this.eventToSurveys;
|
|
3034
|
+
}
|
|
3035
|
+
_getActionMatcher() {
|
|
3036
|
+
return this.actionMatcher;
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
w(At, "SURVEY_SHOWN_EVENT_NAME", "survey shown");
|
|
3040
|
+
class al {
|
|
3041
|
+
constructor(e) {
|
|
3042
|
+
w(this, "_isFetchingSurveys", !1), w(this, "_isInitializingSurveys", !1), w(this, "_surveyCallbacks", []), this.instance = e, this._surveyEventReceiver = null;
|
|
3043
|
+
}
|
|
3044
|
+
onRemoteConfig(e) {
|
|
3045
|
+
var t = e.surveys;
|
|
3046
|
+
if (R(t)) return G.warn("Decide not loaded yet. Not loading surveys.");
|
|
3047
|
+
var i = q(t);
|
|
3048
|
+
this._hasSurveys = i ? t.length > 0 : t, G.info("decide response received, hasSurveys: ".concat(this._hasSurveys)), this._hasSurveys && this.loadIfEnabled();
|
|
3049
|
+
}
|
|
3050
|
+
reset() {
|
|
3051
|
+
localStorage.removeItem("lastSeenSurveyDate");
|
|
3052
|
+
var e = (() => {
|
|
3053
|
+
for (var t = [], i = 0; i < localStorage.length; i++) {
|
|
3054
|
+
var s = localStorage.key(i);
|
|
3055
|
+
s != null && s.startsWith("seenSurvey_") && t.push(s);
|
|
3056
|
+
}
|
|
3057
|
+
return t;
|
|
3058
|
+
})();
|
|
3059
|
+
e.forEach((t) => localStorage.removeItem(t));
|
|
3060
|
+
}
|
|
3061
|
+
loadIfEnabled() {
|
|
3062
|
+
if (!this._surveyManager) if (this._isInitializingSurveys) G.info("Already initializing surveys, skipping...");
|
|
3063
|
+
else if (this.instance.config.disable_surveys) G.info("Disabled. Not loading surveys.");
|
|
3064
|
+
else {
|
|
3065
|
+
var e = C == null ? void 0 : C.__PosthogExtensions__;
|
|
3066
|
+
if (e) if (this._hasSurveys) {
|
|
3067
|
+
this._isInitializingSurveys = !0;
|
|
3068
|
+
try {
|
|
3069
|
+
var t = e.generateSurveys;
|
|
3070
|
+
if (t) this._surveyManager = t(this.instance), this._isInitializingSurveys = !1, this._surveyEventReceiver = new At(this.instance), G.info("Surveys loaded successfully"), this._notifySurveyCallbacks({ isLoaded: !0 });
|
|
3071
|
+
else {
|
|
3072
|
+
var i = e.loadExternalDependency;
|
|
3073
|
+
if (i) i(this.instance, "surveys", (n) => {
|
|
3074
|
+
if (n || !e.generateSurveys) return G.error("Could not load surveys script", n), void (this._isInitializingSurveys = !1);
|
|
3075
|
+
this._surveyManager = e.generateSurveys(this.instance), this._isInitializingSurveys = !1, this._surveyEventReceiver = new At(this.instance), G.info("Surveys loaded successfully"), this._notifySurveyCallbacks({ isLoaded: !0 });
|
|
3076
|
+
});
|
|
3077
|
+
else {
|
|
3078
|
+
var s = "PostHog loadExternalDependency extension not found. Cannot load remote config.";
|
|
3079
|
+
G.error(s), this._isInitializingSurveys = !1, this._notifySurveyCallbacks({ isLoaded: !1, error: s });
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
} catch (n) {
|
|
3083
|
+
throw G.error("Error initializing surveys", n), this._isInitializingSurveys = !1, this._notifySurveyCallbacks({ isLoaded: !1, error: "Error initializing surveys" }), n;
|
|
3084
|
+
}
|
|
3085
|
+
} else G.info("No surveys to load.");
|
|
3086
|
+
else G.error("PostHog Extensions not found.");
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
onSurveysLoaded(e) {
|
|
3090
|
+
return this._surveyCallbacks.push(e), this._surveyManager && this._notifySurveyCallbacks({ isLoaded: !0 }), () => {
|
|
3091
|
+
this._surveyCallbacks = this._surveyCallbacks.filter((t) => t !== e);
|
|
3092
|
+
};
|
|
3093
|
+
}
|
|
3094
|
+
getSurveys(e) {
|
|
3095
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
3096
|
+
if (this.instance.config.disable_surveys) return G.info("Disabled. Not loading surveys."), e([]);
|
|
3097
|
+
var i = this.instance.get_property(Ji);
|
|
3098
|
+
if (i && !t) return e(i, { isLoaded: !0 });
|
|
3099
|
+
if (this._isFetchingSurveys) return e([], { isLoaded: !1, error: "Surveys are already being loaded" });
|
|
3100
|
+
try {
|
|
3101
|
+
this._isFetchingSurveys = !0, this.instance._send_request({ url: this.instance.requestRouter.endpointFor("api", "/api/surveys/?token=".concat(this.instance.config.token)), method: "GET", timeout: this.instance.config.surveys_request_timeout_ms, callback: (s) => {
|
|
3102
|
+
var n;
|
|
3103
|
+
this._isFetchingSurveys = !1;
|
|
3104
|
+
var o = s.statusCode;
|
|
3105
|
+
if (o !== 200 || !s.json) {
|
|
3106
|
+
var a = "Surveys API could not be loaded, status: ".concat(o);
|
|
3107
|
+
return G.error(a), e([], { isLoaded: !1, error: a });
|
|
3108
|
+
}
|
|
3109
|
+
var l, c = s.json.surveys || [], d = c.filter((u) => {
|
|
3110
|
+
var p, h, _, v, b, m, y, E, I, F, O, L;
|
|
3111
|
+
return ((p = u.conditions) === null || p === void 0 ? void 0 : p.events) && ((h = u.conditions) === null || h === void 0 || (_ = h.events) === null || _ === void 0 ? void 0 : _.values) && ((v = u.conditions) === null || v === void 0 || (b = v.events) === null || b === void 0 || (m = b.values) === null || m === void 0 ? void 0 : m.length) > 0 || ((y = u.conditions) === null || y === void 0 ? void 0 : y.actions) && ((E = u.conditions) === null || E === void 0 || (I = E.actions) === null || I === void 0 ? void 0 : I.values) && ((F = u.conditions) === null || F === void 0 || (O = F.actions) === null || O === void 0 || (L = O.values) === null || L === void 0 ? void 0 : L.length) > 0;
|
|
3112
|
+
});
|
|
3113
|
+
return d.length > 0 && ((l = this._surveyEventReceiver) === null || l === void 0 || l.register(d)), (n = this.instance.persistence) === null || n === void 0 || n.register({ [Ji]: c }), e(c, { isLoaded: !0 });
|
|
3114
|
+
} });
|
|
3115
|
+
} catch (s) {
|
|
3116
|
+
throw this._isFetchingSurveys = !1, s;
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
_notifySurveyCallbacks(e) {
|
|
3120
|
+
for (var t of this._surveyCallbacks) try {
|
|
3121
|
+
e.isLoaded ? this.getSurveys(t) : t([], e);
|
|
3122
|
+
} catch (i) {
|
|
3123
|
+
G.error("Error in survey callback", i);
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
isSurveyFeatureFlagEnabled(e) {
|
|
3127
|
+
return !e || this.instance.featureFlags.isFeatureEnabled(e);
|
|
3128
|
+
}
|
|
3129
|
+
getActiveMatchingSurveys(e) {
|
|
3130
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
3131
|
+
this.getSurveys((i) => {
|
|
3132
|
+
var s, n = i.filter((l) => !(!l.start_date || l.end_date)).filter((l) => {
|
|
3133
|
+
var c;
|
|
3134
|
+
if (!l.conditions) return !0;
|
|
3135
|
+
var d = function(h) {
|
|
3136
|
+
var _, v, b;
|
|
3137
|
+
if ((_ = h.conditions) === null || _ === void 0 || !_.url) return !0;
|
|
3138
|
+
var m = g == null || (v = g.location) === null || v === void 0 ? void 0 : v.href;
|
|
3139
|
+
if (!m) return !1;
|
|
3140
|
+
var y = [h.conditions.url];
|
|
3141
|
+
return Us[js((b = h.conditions) === null || b === void 0 ? void 0 : b.urlMatchType)](y, m);
|
|
3142
|
+
}(l), u = (c = l.conditions) === null || c === void 0 || !c.selector || (S == null ? void 0 : S.querySelector(l.conditions.selector)), p = function(h) {
|
|
3143
|
+
var _, v, b;
|
|
3144
|
+
if ((_ = h.conditions) === null || _ === void 0 || !_.deviceTypes || ((v = h.conditions) === null || v === void 0 ? void 0 : v.deviceTypes.length) === 0) return !0;
|
|
3145
|
+
if (!j) return !1;
|
|
3146
|
+
var m = A.deviceType(j);
|
|
3147
|
+
return Us[js((b = h.conditions) === null || b === void 0 ? void 0 : b.deviceTypesMatchType)](h.conditions.deviceTypes, m);
|
|
3148
|
+
}(l);
|
|
3149
|
+
return d && u && p;
|
|
3150
|
+
}), o = (s = this._surveyEventReceiver) === null || s === void 0 ? void 0 : s.getSurveys(), a = n.filter((l) => {
|
|
3151
|
+
var c, d, u, p, h, _, v, b, m;
|
|
3152
|
+
if (!(l.linked_flag_key || l.targeting_flag_key || l.internal_targeting_flag_key || (c = l.feature_flag_keys) !== null && c !== void 0 && c.length)) return !0;
|
|
3153
|
+
var y = this.isSurveyFeatureFlagEnabled(l.linked_flag_key), E = this.isSurveyFeatureFlagEnabled(l.targeting_flag_key), I = ((d = (u = l.conditions) === null || u === void 0 || (p = u.events) === null || p === void 0 || (h = p.values) === null || h === void 0 ? void 0 : h.length) !== null && d !== void 0 ? d : 0) > 0, F = ((_ = (v = l.conditions) === null || v === void 0 || (b = v.actions) === null || b === void 0 || (m = b.values) === null || m === void 0 ? void 0 : m.length) !== null && _ !== void 0 ? _ : 0) > 0, O = !I && !F || (o == null ? void 0 : o.includes(l.id)), L = this._canActivateRepeatedly(l) || this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key), P = this.checkFlags(l);
|
|
3154
|
+
return y && E && L && O && P;
|
|
3155
|
+
});
|
|
3156
|
+
return e(a);
|
|
3157
|
+
}, t);
|
|
3158
|
+
}
|
|
3159
|
+
checkFlags(e) {
|
|
3160
|
+
var t;
|
|
3161
|
+
return (t = e.feature_flag_keys) === null || t === void 0 || !t.length || e.feature_flag_keys.every((i) => {
|
|
3162
|
+
var { key: s, value: n } = i;
|
|
3163
|
+
return !s || !n || this.instance.featureFlags.isFeatureEnabled(n);
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
_canActivateRepeatedly(e) {
|
|
3167
|
+
var t;
|
|
3168
|
+
return R((t = C.__PosthogExtensions__) === null || t === void 0 ? void 0 : t.canActivateRepeatedly) ? (G.warn("init was not called"), !1) : C.__PosthogExtensions__.canActivateRepeatedly(e);
|
|
3169
|
+
}
|
|
3170
|
+
canRenderSurvey(e) {
|
|
3171
|
+
if (R(this._surveyManager)) return G.warn("init was not called"), { visible: !1, disabledReason: "SDK is not enabled or survey functionality is not yet loaded" };
|
|
3172
|
+
var t = null;
|
|
3173
|
+
return this.getSurveys((i) => {
|
|
3174
|
+
var s = i.filter((n) => n.id === e)[0];
|
|
3175
|
+
t = s ? f({}, this._surveyManager.canRenderSurvey(s)) : { visible: !1, disabledReason: "Survey not found" };
|
|
3176
|
+
}), t;
|
|
3177
|
+
}
|
|
3178
|
+
renderSurvey(e, t) {
|
|
3179
|
+
R(this._surveyManager) ? G.warn("init was not called") : this.getSurveys((i) => {
|
|
3180
|
+
var s = i.filter((n) => n.id === e)[0];
|
|
3181
|
+
this._surveyManager.renderSurvey(s, S == null ? void 0 : S.querySelector(t));
|
|
3182
|
+
});
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
var zs = Q("[RateLimiter]");
|
|
3186
|
+
class ll {
|
|
3187
|
+
constructor(e) {
|
|
3188
|
+
var t, i;
|
|
3189
|
+
w(this, "serverLimits", {}), w(this, "lastEventRateLimited", !1), w(this, "checkForLimiting", (s) => {
|
|
3190
|
+
var n = s.text;
|
|
3191
|
+
if (n && n.length) try {
|
|
3192
|
+
(JSON.parse(n).quota_limited || []).forEach((o) => {
|
|
3193
|
+
zs.info("".concat(o || "events", " is quota limited.")), this.serverLimits[o] = (/* @__PURE__ */ new Date()).getTime() + 6e4;
|
|
3194
|
+
});
|
|
3195
|
+
} catch (o) {
|
|
3196
|
+
return void zs.warn('could not rate limit - continuing. Error: "'.concat(o == null ? void 0 : o.message, '"'), { text: n });
|
|
3197
|
+
}
|
|
3198
|
+
}), this.instance = e, this.captureEventsPerSecond = ((t = e.config.rate_limiting) === null || t === void 0 ? void 0 : t.events_per_second) || 10, this.captureEventsBurstLimit = Math.max(((i = e.config.rate_limiting) === null || i === void 0 ? void 0 : i.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond), this.lastEventRateLimited = this.clientRateLimitContext(!0).isRateLimited;
|
|
3199
|
+
}
|
|
3200
|
+
clientRateLimitContext() {
|
|
3201
|
+
var e, t, i, s = arguments.length > 0 && arguments[0] !== void 0 && arguments[0], n = (/* @__PURE__ */ new Date()).getTime(), o = (e = (t = this.instance.persistence) === null || t === void 0 ? void 0 : t.get_property(Ki)) !== null && e !== void 0 ? e : { tokens: this.captureEventsBurstLimit, last: n };
|
|
3202
|
+
o.tokens += (n - o.last) / 1e3 * this.captureEventsPerSecond, o.last = n, o.tokens > this.captureEventsBurstLimit && (o.tokens = this.captureEventsBurstLimit);
|
|
3203
|
+
var a = o.tokens < 1;
|
|
3204
|
+
return a || s || (o.tokens = Math.max(0, o.tokens - 1)), !a || this.lastEventRateLimited || s || this.instance.capture("$$client_ingestion_warning", { $$client_ingestion_warning_message: "posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond, " events per second and ").concat(this.captureEventsBurstLimit, " events burst limit.") }, { skip_client_rate_limiting: !0 }), this.lastEventRateLimited = a, (i = this.instance.persistence) === null || i === void 0 || i.set_property(Ki, o), { isRateLimited: a, remainingTokens: o.tokens };
|
|
3205
|
+
}
|
|
3206
|
+
isServerRateLimited(e) {
|
|
3207
|
+
var t = this.serverLimits[e || "events"] || !1;
|
|
3208
|
+
return t !== !1 && (/* @__PURE__ */ new Date()).getTime() < t;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
var Ve = Q("[RemoteConfig]");
|
|
3212
|
+
class ul {
|
|
3213
|
+
constructor(e) {
|
|
3214
|
+
this.instance = e;
|
|
3215
|
+
}
|
|
3216
|
+
get remoteConfig() {
|
|
3217
|
+
var e, t;
|
|
3218
|
+
return (e = C._POSTHOG_REMOTE_CONFIG) === null || e === void 0 || (t = e[this.instance.config.token]) === null || t === void 0 ? void 0 : t.config;
|
|
3219
|
+
}
|
|
3220
|
+
_loadRemoteConfigJs(e) {
|
|
3221
|
+
var t, i, s;
|
|
3222
|
+
(t = C.__PosthogExtensions__) !== null && t !== void 0 && t.loadExternalDependency ? (i = C.__PosthogExtensions__) === null || i === void 0 || (s = i.loadExternalDependency) === null || s === void 0 || s.call(i, this.instance, "remote-config", () => e(this.remoteConfig)) : (Ve.error("PostHog Extensions not found. Cannot load remote config."), e());
|
|
3223
|
+
}
|
|
3224
|
+
_loadRemoteConfigJSON(e) {
|
|
3225
|
+
this.instance._send_request({ method: "GET", url: this.instance.requestRouter.endpointFor("assets", "/array/".concat(this.instance.config.token, "/config")), callback: (t) => {
|
|
3226
|
+
e(t.json);
|
|
3227
|
+
} });
|
|
3228
|
+
}
|
|
3229
|
+
load() {
|
|
3230
|
+
try {
|
|
3231
|
+
if (this.remoteConfig) return Ve.info("Using preloaded remote config", this.remoteConfig), void this.onRemoteConfig(this.remoteConfig);
|
|
3232
|
+
if (this.instance.config.advanced_disable_decide) return void Ve.warn("Remote config is disabled. Falling back to local config.");
|
|
3233
|
+
this._loadRemoteConfigJs((e) => {
|
|
3234
|
+
if (!e) return Ve.info("No config found after loading remote JS config. Falling back to JSON."), void this._loadRemoteConfigJSON((t) => {
|
|
3235
|
+
this.onRemoteConfig(t);
|
|
3236
|
+
});
|
|
3237
|
+
this.onRemoteConfig(e);
|
|
3238
|
+
});
|
|
3239
|
+
} catch (e) {
|
|
3240
|
+
Ve.error("Error loading remote config", e);
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
onRemoteConfig(e) {
|
|
3244
|
+
e ? this.instance.config.__preview_remote_config ? (this.instance._onRemoteConfig(e), e.hasFeatureFlags !== !1 && this.instance.featureFlags.ensureFlagsLoaded()) : Ve.info("__preview_remote_config is disabled. Logging config instead", e) : Ve.error("Failed to fetch remote config from PostHog.");
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
var cl = function(r) {
|
|
3248
|
+
var e, t, i, s, n = "";
|
|
3249
|
+
for (e = t = 0, i = (r = (r + "").replace(/\r\n/g, `
|
|
3250
|
+
`).replace(/\r/g, `
|
|
3251
|
+
`)).length, s = 0; s < i; s++) {
|
|
3252
|
+
var o = r.charCodeAt(s), a = null;
|
|
3253
|
+
o < 128 ? t++ : a = o > 127 && o < 2048 ? String.fromCharCode(o >> 6 | 192, 63 & o | 128) : String.fromCharCode(o >> 12 | 224, o >> 6 & 63 | 128, 63 & o | 128), He(a) || (t > e && (n += r.substring(e, t)), n += a, e = t = s + 1);
|
|
3254
|
+
}
|
|
3255
|
+
return t > e && (n += r.substring(e, r.length)), n;
|
|
3256
|
+
}, dl = !!ji || !!Ui, Ws = "text/plain", di = (r, e) => {
|
|
3257
|
+
var [t, i] = r.split("?"), s = f({}, e);
|
|
3258
|
+
i == null || i.split("&").forEach((o) => {
|
|
3259
|
+
var [a] = o.split("=");
|
|
3260
|
+
delete s[a];
|
|
3261
|
+
});
|
|
3262
|
+
var n = qo(s);
|
|
3263
|
+
return n = n ? (i ? i + "&" : "") + n : i, "".concat(t, "?").concat(n);
|
|
3264
|
+
}, Ct = (r, e) => JSON.stringify(r, (t, i) => typeof i == "bigint" ? i.toString() : i, e), qi = (r) => {
|
|
3265
|
+
var { data: e, compression: t } = r;
|
|
3266
|
+
if (e) {
|
|
3267
|
+
if (t === _e.GZipJS) {
|
|
3268
|
+
var i = $n(On(Ct(e)), { mtime: 0 }), s = new Blob([i], { type: Ws });
|
|
3269
|
+
return { contentType: Ws, body: s, estimatedSize: s.size };
|
|
3270
|
+
}
|
|
3271
|
+
if (t === _e.Base64) {
|
|
3272
|
+
var n = function(l) {
|
|
3273
|
+
var c, d, u, p, h, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", v = 0, b = 0, m = "", y = [];
|
|
3274
|
+
if (!l) return l;
|
|
3275
|
+
l = cl(l);
|
|
3276
|
+
do
|
|
3277
|
+
c = (h = l.charCodeAt(v++) << 16 | l.charCodeAt(v++) << 8 | l.charCodeAt(v++)) >> 18 & 63, d = h >> 12 & 63, u = h >> 6 & 63, p = 63 & h, y[b++] = _.charAt(c) + _.charAt(d) + _.charAt(u) + _.charAt(p);
|
|
3278
|
+
while (v < l.length);
|
|
3279
|
+
switch (m = y.join(""), l.length % 3) {
|
|
3280
|
+
case 1:
|
|
3281
|
+
m = m.slice(0, -2) + "==";
|
|
3282
|
+
break;
|
|
3283
|
+
case 2:
|
|
3284
|
+
m = m.slice(0, -1) + "=";
|
|
3285
|
+
}
|
|
3286
|
+
return m;
|
|
3287
|
+
}(Ct(e)), o = ((l) => "data=" + encodeURIComponent(typeof l == "string" ? l : Ct(l)))(n);
|
|
3288
|
+
return { contentType: "application/x-www-form-urlencoded", body: o, estimatedSize: new Blob([o]).size };
|
|
3289
|
+
}
|
|
3290
|
+
var a = Ct(e);
|
|
3291
|
+
return { contentType: "application/json", body: a, estimatedSize: new Blob([a]).size };
|
|
3292
|
+
}
|
|
3293
|
+
}, Ft = [];
|
|
3294
|
+
Ui && Ft.push({ transport: "fetch", method: (r) => {
|
|
3295
|
+
var e, t, { contentType: i, body: s, estimatedSize: n } = (e = qi(r)) !== null && e !== void 0 ? e : {}, o = new Headers();
|
|
3296
|
+
$(r.headers, function(d, u) {
|
|
3297
|
+
o.append(u, d);
|
|
3298
|
+
}), i && o.append("Content-Type", i);
|
|
3299
|
+
var a = r.url, l = null;
|
|
3300
|
+
if (Hr) {
|
|
3301
|
+
var c = new Hr();
|
|
3302
|
+
l = { signal: c.signal, timeout: setTimeout(() => c.abort(), r.timeout) };
|
|
3303
|
+
}
|
|
3304
|
+
Ui(a, f({ method: (r == null ? void 0 : r.method) || "GET", headers: o, keepalive: r.method === "POST" && (n || 0) < 52428.8, body: s, signal: (t = l) === null || t === void 0 ? void 0 : t.signal }, r.fetchOptions)).then((d) => d.text().then((u) => {
|
|
3305
|
+
var p, h = { statusCode: d.status, text: u };
|
|
3306
|
+
if (d.status === 200) try {
|
|
3307
|
+
h.json = JSON.parse(u);
|
|
3308
|
+
} catch (_) {
|
|
3309
|
+
x.error(_);
|
|
3310
|
+
}
|
|
3311
|
+
(p = r.callback) === null || p === void 0 || p.call(r, h);
|
|
3312
|
+
})).catch((d) => {
|
|
3313
|
+
var u;
|
|
3314
|
+
x.error(d), (u = r.callback) === null || u === void 0 || u.call(r, { statusCode: 0, text: d });
|
|
3315
|
+
}).finally(() => l ? clearTimeout(l.timeout) : null);
|
|
3316
|
+
} }), ji && Ft.push({ transport: "XHR", method: (r) => {
|
|
3317
|
+
var e, t = new ji();
|
|
3318
|
+
t.open(r.method || "GET", r.url, !0);
|
|
3319
|
+
var { contentType: i, body: s } = (e = qi(r)) !== null && e !== void 0 ? e : {};
|
|
3320
|
+
$(r.headers, function(n, o) {
|
|
3321
|
+
t.setRequestHeader(o, n);
|
|
3322
|
+
}), i && t.setRequestHeader("Content-Type", i), r.timeout && (t.timeout = r.timeout), t.withCredentials = !0, t.onreadystatechange = () => {
|
|
3323
|
+
if (t.readyState === 4) {
|
|
3324
|
+
var n, o = { statusCode: t.status, text: t.responseText };
|
|
3325
|
+
if (t.status === 200) try {
|
|
3326
|
+
o.json = JSON.parse(t.responseText);
|
|
3327
|
+
} catch {
|
|
3328
|
+
}
|
|
3329
|
+
(n = r.callback) === null || n === void 0 || n.call(r, o);
|
|
3330
|
+
}
|
|
3331
|
+
}, t.send(s);
|
|
3332
|
+
} }), oe != null && oe.sendBeacon && Ft.push({ transport: "sendBeacon", method: (r) => {
|
|
3333
|
+
var e = di(r.url, { beacon: "1" });
|
|
3334
|
+
try {
|
|
3335
|
+
var t, { contentType: i, body: s } = (t = qi(r)) !== null && t !== void 0 ? t : {}, n = typeof s == "string" ? new Blob([s], { type: i }) : s;
|
|
3336
|
+
oe.sendBeacon(e, n);
|
|
3337
|
+
} catch {
|
|
3338
|
+
}
|
|
3339
|
+
} });
|
|
3340
|
+
var mr = 3e3;
|
|
3341
|
+
class hl {
|
|
3342
|
+
constructor(e, t) {
|
|
3343
|
+
w(this, "isPaused", !0), w(this, "queue", []), this.flushTimeoutMs = ue((t == null ? void 0 : t.flush_interval_ms) || mr, 250, 5e3, "flush interval", mr), this.sendRequest = e;
|
|
3344
|
+
}
|
|
3345
|
+
enqueue(e) {
|
|
3346
|
+
this.queue.push(e), this.flushTimeout || this.setFlushTimeout();
|
|
3347
|
+
}
|
|
3348
|
+
unload() {
|
|
3349
|
+
this.clearFlushTimeout();
|
|
3350
|
+
var e = this.queue.length > 0 ? this.formatQueue() : {}, t = Object.values(e), i = [...t.filter((s) => s.url.indexOf("/e") === 0), ...t.filter((s) => s.url.indexOf("/e") !== 0)];
|
|
3351
|
+
i.map((s) => {
|
|
3352
|
+
this.sendRequest(f(f({}, s), {}, { transport: "sendBeacon" }));
|
|
3353
|
+
});
|
|
3354
|
+
}
|
|
3355
|
+
enable() {
|
|
3356
|
+
this.isPaused = !1, this.setFlushTimeout();
|
|
3357
|
+
}
|
|
3358
|
+
setFlushTimeout() {
|
|
3359
|
+
var e = this;
|
|
3360
|
+
this.isPaused || (this.flushTimeout = setTimeout(() => {
|
|
3361
|
+
if (this.clearFlushTimeout(), this.queue.length > 0) {
|
|
3362
|
+
var t = this.formatQueue(), i = function(n) {
|
|
3363
|
+
var o = t[n], a = (/* @__PURE__ */ new Date()).getTime();
|
|
3364
|
+
o.data && q(o.data) && $(o.data, (l) => {
|
|
3365
|
+
l.offset = Math.abs(l.timestamp - a), delete l.timestamp;
|
|
3366
|
+
}), e.sendRequest(o);
|
|
3367
|
+
};
|
|
3368
|
+
for (var s in t) i(s);
|
|
3369
|
+
}
|
|
3370
|
+
}, this.flushTimeoutMs));
|
|
3371
|
+
}
|
|
3372
|
+
clearFlushTimeout() {
|
|
3373
|
+
clearTimeout(this.flushTimeout), this.flushTimeout = void 0;
|
|
3374
|
+
}
|
|
3375
|
+
formatQueue() {
|
|
3376
|
+
var e = {};
|
|
3377
|
+
return $(this.queue, (t) => {
|
|
3378
|
+
var i, s = t, n = (s ? s.batchKey : null) || s.url;
|
|
3379
|
+
k(e[n]) && (e[n] = f(f({}, s), {}, { data: [] })), (i = e[n].data) === null || i === void 0 || i.push(s.data);
|
|
3380
|
+
}), this.queue = [], e;
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
var pl = ["retriesPerformedSoFar"];
|
|
3384
|
+
class _l {
|
|
3385
|
+
constructor(e) {
|
|
3386
|
+
w(this, "isPolling", !1), w(this, "pollIntervalMs", 3e3), w(this, "queue", []), this.instance = e, this.queue = [], this.areWeOnline = !0, !k(g) && "onLine" in g.navigator && (this.areWeOnline = g.navigator.onLine, U(g, "online", () => {
|
|
3387
|
+
this.areWeOnline = !0, this.flush();
|
|
3388
|
+
}), U(g, "offline", () => {
|
|
3389
|
+
this.areWeOnline = !1;
|
|
3390
|
+
}));
|
|
3391
|
+
}
|
|
3392
|
+
retriableRequest(e) {
|
|
3393
|
+
var { retriesPerformedSoFar: t } = e, i = an(e, pl);
|
|
3394
|
+
ee(t) && t > 0 && (i.url = di(i.url, { retry_count: t })), this.instance._send_request(f(f({}, i), {}, { callback: (s) => {
|
|
3395
|
+
var n;
|
|
3396
|
+
s.statusCode !== 200 && (s.statusCode < 400 || s.statusCode >= 500) && (t ?? 0) < 10 ? this.enqueue(f({ retriesPerformedSoFar: t }, i)) : (n = i.callback) === null || n === void 0 || n.call(i, s);
|
|
3397
|
+
} }));
|
|
3398
|
+
}
|
|
3399
|
+
enqueue(e) {
|
|
3400
|
+
var t = e.retriesPerformedSoFar || 0;
|
|
3401
|
+
e.retriesPerformedSoFar = t + 1;
|
|
3402
|
+
var i = function(o) {
|
|
3403
|
+
var a = 3e3 * Math.pow(2, o), l = a / 2, c = Math.min(18e5, a), d = (Math.random() - 0.5) * (c - l);
|
|
3404
|
+
return Math.ceil(c + d);
|
|
3405
|
+
}(t), s = Date.now() + i;
|
|
3406
|
+
this.queue.push({ retryAt: s, requestOptions: e });
|
|
3407
|
+
var n = "Enqueued failed request for retry in ".concat(i);
|
|
3408
|
+
navigator.onLine || (n += " (Browser is offline)"), x.warn(n), this.isPolling || (this.isPolling = !0, this.poll());
|
|
3409
|
+
}
|
|
3410
|
+
poll() {
|
|
3411
|
+
this.poller && clearTimeout(this.poller), this.poller = setTimeout(() => {
|
|
3412
|
+
this.areWeOnline && this.queue.length > 0 && this.flush(), this.poll();
|
|
3413
|
+
}, this.pollIntervalMs);
|
|
3414
|
+
}
|
|
3415
|
+
flush() {
|
|
3416
|
+
var e = Date.now(), t = [], i = this.queue.filter((n) => n.retryAt < e || (t.push(n), !1));
|
|
3417
|
+
if (this.queue = t, i.length > 0) for (var { requestOptions: s } of i) this.retriableRequest(s);
|
|
3418
|
+
}
|
|
3419
|
+
unload() {
|
|
3420
|
+
for (var { requestOptions: e } of (this.poller && (clearTimeout(this.poller), this.poller = void 0), this.queue)) try {
|
|
3421
|
+
this.instance._send_request(f(f({}, e), {}, { transport: "sendBeacon" }));
|
|
3422
|
+
} catch (t) {
|
|
3423
|
+
x.error(t);
|
|
3424
|
+
}
|
|
3425
|
+
this.queue = [];
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
class gl {
|
|
3429
|
+
constructor(e) {
|
|
3430
|
+
w(this, "_updateScrollData", () => {
|
|
3431
|
+
var t, i, s, n;
|
|
3432
|
+
this.context || (this.context = {});
|
|
3433
|
+
var o = this.scrollElement(), a = this.scrollY(), l = o ? Math.max(0, o.scrollHeight - o.clientHeight) : 0, c = a + ((o == null ? void 0 : o.clientHeight) || 0), d = (o == null ? void 0 : o.scrollHeight) || 0;
|
|
3434
|
+
this.context.lastScrollY = Math.ceil(a), this.context.maxScrollY = Math.max(a, (t = this.context.maxScrollY) !== null && t !== void 0 ? t : 0), this.context.maxScrollHeight = Math.max(l, (i = this.context.maxScrollHeight) !== null && i !== void 0 ? i : 0), this.context.lastContentY = c, this.context.maxContentY = Math.max(c, (s = this.context.maxContentY) !== null && s !== void 0 ? s : 0), this.context.maxContentHeight = Math.max(d, (n = this.context.maxContentHeight) !== null && n !== void 0 ? n : 0);
|
|
3435
|
+
}), this.instance = e;
|
|
3436
|
+
}
|
|
3437
|
+
getContext() {
|
|
3438
|
+
return this.context;
|
|
3439
|
+
}
|
|
3440
|
+
resetContext() {
|
|
3441
|
+
var e = this.context;
|
|
3442
|
+
return setTimeout(this._updateScrollData, 0), e;
|
|
3443
|
+
}
|
|
3444
|
+
startMeasuringScrollPosition() {
|
|
3445
|
+
U(g, "scroll", this._updateScrollData, { capture: !0 }), U(g, "scrollend", this._updateScrollData, { capture: !0 }), U(g, "resize", this._updateScrollData);
|
|
3446
|
+
}
|
|
3447
|
+
scrollElement() {
|
|
3448
|
+
if (!this.instance.config.scroll_root_selector) return g == null ? void 0 : g.document.documentElement;
|
|
3449
|
+
var e = q(this.instance.config.scroll_root_selector) ? this.instance.config.scroll_root_selector : [this.instance.config.scroll_root_selector];
|
|
3450
|
+
for (var t of e) {
|
|
3451
|
+
var i = g == null ? void 0 : g.document.querySelector(t);
|
|
3452
|
+
if (i) return i;
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
scrollY() {
|
|
3456
|
+
if (this.instance.config.scroll_root_selector) {
|
|
3457
|
+
var e = this.scrollElement();
|
|
3458
|
+
return e && e.scrollTop || 0;
|
|
3459
|
+
}
|
|
3460
|
+
return g && (g.scrollY || g.pageYOffset || g.document.documentElement.scrollTop) || 0;
|
|
3461
|
+
}
|
|
3462
|
+
scrollX() {
|
|
3463
|
+
if (this.instance.config.scroll_root_selector) {
|
|
3464
|
+
var e = this.scrollElement();
|
|
3465
|
+
return e && e.scrollLeft || 0;
|
|
3466
|
+
}
|
|
3467
|
+
return g && (g.scrollX || g.pageXOffset || g.document.documentElement.scrollLeft) || 0;
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
var vl = (r) => A.personInfo({ maskPersonalDataProperties: r == null ? void 0 : r.config.mask_personal_data_properties, customPersonalDataProperties: r == null ? void 0 : r.config.custom_personal_data_properties });
|
|
3471
|
+
class fl {
|
|
3472
|
+
constructor(e, t, i, s) {
|
|
3473
|
+
w(this, "_onSessionIdCallback", (n) => {
|
|
3474
|
+
var o = this._getStored();
|
|
3475
|
+
if (!o || o.sessionId !== n) {
|
|
3476
|
+
var a = { sessionId: n, props: this._sessionSourceParamGenerator(this.instance) };
|
|
3477
|
+
this._persistence.register({ [Yi]: a });
|
|
3478
|
+
}
|
|
3479
|
+
}), this.instance = e, this._sessionIdManager = t, this._persistence = i, this._sessionSourceParamGenerator = s || vl, this._sessionIdManager.onSessionId(this._onSessionIdCallback);
|
|
3480
|
+
}
|
|
3481
|
+
_getStored() {
|
|
3482
|
+
return this._persistence.props[Yi];
|
|
3483
|
+
}
|
|
3484
|
+
getSetOnceProps() {
|
|
3485
|
+
var e, t = (e = this._getStored()) === null || e === void 0 ? void 0 : e.props;
|
|
3486
|
+
return t ? "r" in t ? A.personPropsFromInfo(t) : { $referring_domain: t.referringDomain, $pathname: t.initialPathName, utm_source: t.utm_source, utm_campaign: t.utm_campaign, utm_medium: t.utm_medium, utm_content: t.utm_content, utm_term: t.utm_term } : {};
|
|
3487
|
+
}
|
|
3488
|
+
getSessionProps() {
|
|
3489
|
+
var e = {};
|
|
3490
|
+
return $(Rt(this.getSetOnceProps()), (t, i) => {
|
|
3491
|
+
i === "$current_url" && (i = "url"), e["$session_entry_".concat(br(i))] = t;
|
|
3492
|
+
}), e;
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
var Vs = Q("[SessionId]");
|
|
3496
|
+
class ml {
|
|
3497
|
+
constructor(e, t, i) {
|
|
3498
|
+
var s;
|
|
3499
|
+
if (w(this, "_sessionIdChangedHandlers", []), !e.persistence) throw new Error("SessionIdManager requires a PostHogPersistence instance");
|
|
3500
|
+
if (e.config.__preview_experimental_cookieless_mode) throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");
|
|
3501
|
+
this.config = e.config, this.persistence = e.persistence, this._windowId = void 0, this._sessionId = void 0, this._sessionStartTimestamp = null, this._sessionActivityTimestamp = null, this._sessionIdGenerator = t || De, this._windowIdGenerator = i || De;
|
|
3502
|
+
var n = this.config.persistence_name || this.config.token, o = this.config.session_idle_timeout_seconds || 1800;
|
|
3503
|
+
if (this._sessionTimeoutMs = 1e3 * ue(o, 60, 36e3, "session_idle_timeout_seconds", 1800), e.register({ $configured_session_timeout_ms: this._sessionTimeoutMs }), this.resetIdleTimer(), this._window_id_storage_key = "ph_" + n + "_window_id", this._primary_window_exists_storage_key = "ph_" + n + "_primary_window_exists", this._canUseSessionStorage()) {
|
|
3504
|
+
var a = J.parse(this._window_id_storage_key), l = J.parse(this._primary_window_exists_storage_key);
|
|
3505
|
+
a && !l ? this._windowId = a : J.remove(this._window_id_storage_key), J.set(this._primary_window_exists_storage_key, !0);
|
|
3506
|
+
}
|
|
3507
|
+
if ((s = this.config.bootstrap) !== null && s !== void 0 && s.sessionID) try {
|
|
3508
|
+
var c = ((d) => {
|
|
3509
|
+
var u = d.replace(/-/g, "");
|
|
3510
|
+
if (u.length !== 32) throw new Error("Not a valid UUID");
|
|
3511
|
+
if (u[12] !== "7") throw new Error("Not a UUIDv7");
|
|
3512
|
+
return parseInt(u.substring(0, 12), 16);
|
|
3513
|
+
})(this.config.bootstrap.sessionID);
|
|
3514
|
+
this._setSessionId(this.config.bootstrap.sessionID, (/* @__PURE__ */ new Date()).getTime(), c);
|
|
3515
|
+
} catch (d) {
|
|
3516
|
+
Vs.error("Invalid sessionID in bootstrap", d);
|
|
3517
|
+
}
|
|
3518
|
+
this._listenToReloadWindow();
|
|
3519
|
+
}
|
|
3520
|
+
get sessionTimeoutMs() {
|
|
3521
|
+
return this._sessionTimeoutMs;
|
|
3522
|
+
}
|
|
3523
|
+
onSessionId(e) {
|
|
3524
|
+
return k(this._sessionIdChangedHandlers) && (this._sessionIdChangedHandlers = []), this._sessionIdChangedHandlers.push(e), this._sessionId && e(this._sessionId, this._windowId), () => {
|
|
3525
|
+
this._sessionIdChangedHandlers = this._sessionIdChangedHandlers.filter((t) => t !== e);
|
|
3526
|
+
};
|
|
3527
|
+
}
|
|
3528
|
+
_canUseSessionStorage() {
|
|
3529
|
+
return this.config.persistence !== "memory" && !this.persistence.disabled && J.is_supported();
|
|
3530
|
+
}
|
|
3531
|
+
_setWindowId(e) {
|
|
3532
|
+
e !== this._windowId && (this._windowId = e, this._canUseSessionStorage() && J.set(this._window_id_storage_key, e));
|
|
3533
|
+
}
|
|
3534
|
+
_getWindowId() {
|
|
3535
|
+
return this._windowId ? this._windowId : this._canUseSessionStorage() ? J.parse(this._window_id_storage_key) : null;
|
|
3536
|
+
}
|
|
3537
|
+
_setSessionId(e, t, i) {
|
|
3538
|
+
e === this._sessionId && t === this._sessionActivityTimestamp && i === this._sessionStartTimestamp || (this._sessionStartTimestamp = i, this._sessionActivityTimestamp = t, this._sessionId = e, this.persistence.register({ [ei]: [t, e, i] }));
|
|
3539
|
+
}
|
|
3540
|
+
_getSessionId() {
|
|
3541
|
+
if (this._sessionId && this._sessionActivityTimestamp && this._sessionStartTimestamp) return [this._sessionActivityTimestamp, this._sessionId, this._sessionStartTimestamp];
|
|
3542
|
+
var e = this.persistence.props[ei];
|
|
3543
|
+
return q(e) && e.length === 2 && e.push(e[0]), e || [0, null, 0];
|
|
3544
|
+
}
|
|
3545
|
+
resetSessionId() {
|
|
3546
|
+
this._setSessionId(null, null, null);
|
|
3547
|
+
}
|
|
3548
|
+
_listenToReloadWindow() {
|
|
3549
|
+
U(g, "beforeunload", () => {
|
|
3550
|
+
this._canUseSessionStorage() && J.remove(this._primary_window_exists_storage_key);
|
|
3551
|
+
}, { capture: !1 });
|
|
3552
|
+
}
|
|
3553
|
+
checkAndGetSessionAndWindowId() {
|
|
3554
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 && arguments[0], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
3555
|
+
if (this.config.__preview_experimental_cookieless_mode) throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");
|
|
3556
|
+
var i = t || (/* @__PURE__ */ new Date()).getTime(), [s, n, o] = this._getSessionId(), a = this._getWindowId(), l = ee(o) && o > 0 && Math.abs(i - o) > 864e5, c = !1, d = !n, u = !e && Math.abs(i - s) > this.sessionTimeoutMs;
|
|
3557
|
+
d || u || l ? (n = this._sessionIdGenerator(), a = this._windowIdGenerator(), Vs.info("new session ID generated", { sessionId: n, windowId: a, changeReason: { noSessionId: d, activityTimeout: u, sessionPastMaximumLength: l } }), o = i, c = !0) : a || (a = this._windowIdGenerator(), c = !0);
|
|
3558
|
+
var p = s === 0 || !e || l ? i : s, h = o === 0 ? (/* @__PURE__ */ new Date()).getTime() : o;
|
|
3559
|
+
return this._setWindowId(a), this._setSessionId(n, p, h), e || this.resetIdleTimer(), c && this._sessionIdChangedHandlers.forEach((_) => _(n, a, c ? { noSessionId: d, activityTimeout: u, sessionPastMaximumLength: l } : void 0)), { sessionId: n, windowId: a, sessionStartTimestamp: h, changeReason: c ? { noSessionId: d, activityTimeout: u, sessionPastMaximumLength: l } : void 0, lastActivityTimestamp: s };
|
|
3560
|
+
}
|
|
3561
|
+
resetIdleTimer() {
|
|
3562
|
+
clearTimeout(this._enforceIdleTimeout), this._enforceIdleTimeout = setTimeout(() => {
|
|
3563
|
+
this.resetSessionId();
|
|
3564
|
+
}, 1.1 * this.sessionTimeoutMs);
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
var yl = ["$set_once", "$set"], Le = Q("[SiteApps]");
|
|
3568
|
+
class bl {
|
|
3569
|
+
constructor(e) {
|
|
3570
|
+
this.instance = e, this.bufferedInvocations = [], this.apps = {};
|
|
3571
|
+
}
|
|
3572
|
+
get isEnabled() {
|
|
3573
|
+
return !!this.instance.config.opt_in_site_apps;
|
|
3574
|
+
}
|
|
3575
|
+
eventCollector(e, t) {
|
|
3576
|
+
if (t) {
|
|
3577
|
+
var i = this.globalsForEvent(t);
|
|
3578
|
+
this.bufferedInvocations.push(i), this.bufferedInvocations.length > 1e3 && (this.bufferedInvocations = this.bufferedInvocations.slice(10));
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
get siteAppLoaders() {
|
|
3582
|
+
var e, t;
|
|
3583
|
+
return (e = C._POSTHOG_REMOTE_CONFIG) === null || e === void 0 || (t = e[this.instance.config.token]) === null || t === void 0 ? void 0 : t.siteApps;
|
|
3584
|
+
}
|
|
3585
|
+
init() {
|
|
3586
|
+
if (this.isEnabled) {
|
|
3587
|
+
var e = this.instance._addCaptureHook(this.eventCollector.bind(this));
|
|
3588
|
+
this.stopBuffering = () => {
|
|
3589
|
+
e(), this.bufferedInvocations = [], this.stopBuffering = void 0;
|
|
3590
|
+
};
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
globalsForEvent(e) {
|
|
3594
|
+
var t, i, s, n, o, a, l;
|
|
3595
|
+
if (!e) throw new Error("Event payload is required");
|
|
3596
|
+
var c = {}, d = this.instance.get_property("$groups") || [], u = this.instance.get_property("$stored_group_properties") || {};
|
|
3597
|
+
for (var [p, h] of Object.entries(u)) c[p] = { id: d[p], type: p, properties: h };
|
|
3598
|
+
var { $set_once: _, $set: v } = e;
|
|
3599
|
+
return { event: f(f({}, an(e, yl)), {}, { properties: f(f(f({}, e.properties), v ? { $set: f(f({}, (t = (i = e.properties) === null || i === void 0 ? void 0 : i.$set) !== null && t !== void 0 ? t : {}), v) } : {}), _ ? { $set_once: f(f({}, (s = (n = e.properties) === null || n === void 0 ? void 0 : n.$set_once) !== null && s !== void 0 ? s : {}), _) } : {}), elements_chain: (o = (a = e.properties) === null || a === void 0 ? void 0 : a.$elements_chain) !== null && o !== void 0 ? o : "", distinct_id: (l = e.properties) === null || l === void 0 ? void 0 : l.distinct_id }), person: { properties: this.instance.get_property("$stored_person_properties") }, groups: c };
|
|
3600
|
+
}
|
|
3601
|
+
setupSiteApp(e) {
|
|
3602
|
+
var t = this.apps[e.id], i = () => {
|
|
3603
|
+
var a;
|
|
3604
|
+
!t.errored && this.bufferedInvocations.length && (Le.info("Processing ".concat(this.bufferedInvocations.length, " events for site app with id ").concat(e.id)), this.bufferedInvocations.forEach((l) => {
|
|
3605
|
+
var c;
|
|
3606
|
+
return (c = t.processEvent) === null || c === void 0 ? void 0 : c.call(t, l);
|
|
3607
|
+
}), t.processedBuffer = !0), Object.values(this.apps).every((l) => l.processedBuffer || l.errored) && ((a = this.stopBuffering) === null || a === void 0 || a.call(this));
|
|
3608
|
+
}, s = !1, n = (a) => {
|
|
3609
|
+
t.errored = !a, t.loaded = !0, Le.info("Site app with id ".concat(e.id, " ").concat(a ? "loaded" : "errored")), s && i();
|
|
3610
|
+
};
|
|
3611
|
+
try {
|
|
3612
|
+
var { processEvent: o } = e.init({ posthog: this.instance, callback: (a) => {
|
|
3613
|
+
n(a);
|
|
3614
|
+
} });
|
|
3615
|
+
o && (t.processEvent = o), s = !0;
|
|
3616
|
+
} catch (a) {
|
|
3617
|
+
Le.error("Error while initializing PostHog app with config id ".concat(e.id), a), n(!1);
|
|
3618
|
+
}
|
|
3619
|
+
if (s && t.loaded) try {
|
|
3620
|
+
i();
|
|
3621
|
+
} catch (a) {
|
|
3622
|
+
Le.error("Error while processing buffered events PostHog app with config id ".concat(e.id), a), t.errored = !0;
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
setupSiteApps() {
|
|
3626
|
+
var e = this.siteAppLoaders || [];
|
|
3627
|
+
for (var t of e) this.apps[t.id] = { id: t.id, loaded: !1, errored: !1, processedBuffer: !1 };
|
|
3628
|
+
for (var i of e) this.setupSiteApp(i);
|
|
3629
|
+
}
|
|
3630
|
+
onCapturedEvent(e) {
|
|
3631
|
+
if (Object.keys(this.apps).length !== 0) {
|
|
3632
|
+
var t = this.globalsForEvent(e);
|
|
3633
|
+
for (var i of Object.values(this.apps)) try {
|
|
3634
|
+
var s;
|
|
3635
|
+
(s = i.processEvent) === null || s === void 0 || s.call(i, t);
|
|
3636
|
+
} catch (n) {
|
|
3637
|
+
Le.error("Error while processing event ".concat(e.event, " for site app ").concat(i.id), n);
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
onRemoteConfig(e) {
|
|
3642
|
+
var t, i, s, n = this;
|
|
3643
|
+
if ((t = this.siteAppLoaders) !== null && t !== void 0 && t.length) return this.isEnabled ? (this.setupSiteApps(), void this.instance.on("eventCaptured", (c) => this.onCapturedEvent(c))) : void Le.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
|
|
3644
|
+
if ((i = this.stopBuffering) === null || i === void 0 || i.call(this), (s = e.siteApps) !== null && s !== void 0 && s.length) if (this.isEnabled) {
|
|
3645
|
+
var o = function(c, d) {
|
|
3646
|
+
var u, p;
|
|
3647
|
+
C["__$$ph_site_app_".concat(c)] = n.instance, (u = C.__PosthogExtensions__) === null || u === void 0 || (p = u.loadSiteApp) === null || p === void 0 || p.call(u, n.instance, d, (h) => {
|
|
3648
|
+
if (h) return Le.error("Error while initializing PostHog app with config id ".concat(c), h);
|
|
3649
|
+
});
|
|
3650
|
+
};
|
|
3651
|
+
for (var { id: a, url: l } of e.siteApps) o(a, l);
|
|
3652
|
+
} else Le.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
var Ke, wl = ["amazonbot", "amazonproductbot", "app.hypefactors.com", "applebot", "archive.org_bot", "awariobot", "backlinksextendedbot", "baiduspider", "bingbot", "bingpreview", "chrome-lighthouse", "dataforseobot", "deepscan", "duckduckbot", "facebookexternal", "facebookcatalog", "http://yandex.com/bots", "hubspot", "ia_archiver", "linkedinbot", "meta-externalagent", "mj12bot", "msnbot", "nessus", "petalbot", "pinterest", "prerender", "rogerbot", "screaming frog", "sebot-wa", "sitebulb", "slackbot", "slurp", "trendictionbot", "turnitin", "twitterbot", "vercelbot", "yahoo! slurp", "yandexbot", "zoombot", "bot.htm", "bot.php", "(bot;", "bot/", "crawler", "ahrefsbot", "ahrefssiteaudit", "semrushbot", "siteauditbot", "splitsignalbot", "gptbot", "oai-searchbot", "chatgpt-user", "perplexitybot", "better uptime bot", "sentryuptimebot", "uptimerobot", "headlesschrome", "cypress", "google-hoteladsverifier", "adsbot-google", "apis-google", "duplexweb-google", "feedfetcher-google", "google favicon", "google web preview", "google-read-aloud", "googlebot", "googleweblight", "mediapartners-google", "storebot-google", "bytespider"], Gs = function(r, e) {
|
|
3656
|
+
if (!r) return !1;
|
|
3657
|
+
var t = r.toLowerCase();
|
|
3658
|
+
return wl.concat(e || []).some((i) => {
|
|
3659
|
+
var s = i.toLowerCase();
|
|
3660
|
+
return t.indexOf(s) !== -1;
|
|
3661
|
+
});
|
|
3662
|
+
}, lo = function(r, e) {
|
|
3663
|
+
if (!r) return !1;
|
|
3664
|
+
var t = r.userAgent;
|
|
3665
|
+
if (t && Gs(t, e)) return !0;
|
|
3666
|
+
try {
|
|
3667
|
+
var i = r == null ? void 0 : r.userAgentData;
|
|
3668
|
+
if (i != null && i.brands && i.brands.some((s) => Gs(s == null ? void 0 : s.brand, e))) return !0;
|
|
3669
|
+
} catch {
|
|
3670
|
+
}
|
|
3671
|
+
return !!r.webdriver;
|
|
3672
|
+
};
|
|
3673
|
+
function Js(r, e, t) {
|
|
3674
|
+
return Ct({ distinct_id: r, userPropertiesToSet: e, userPropertiesToSetOnce: t });
|
|
3675
|
+
}
|
|
3676
|
+
(function(r) {
|
|
3677
|
+
r.US = "us", r.EU = "eu", r.CUSTOM = "custom";
|
|
3678
|
+
})(Ke || (Ke = {}));
|
|
3679
|
+
var Ys = "i.posthog.com";
|
|
3680
|
+
class kl {
|
|
3681
|
+
constructor(e) {
|
|
3682
|
+
w(this, "_regionCache", {}), this.instance = e;
|
|
3683
|
+
}
|
|
3684
|
+
get apiHost() {
|
|
3685
|
+
var e = this.instance.config.api_host.trim().replace(/\/$/, "");
|
|
3686
|
+
return e === "https://app.posthog.com" ? "https://us.i.posthog.com" : e;
|
|
3687
|
+
}
|
|
3688
|
+
get uiHost() {
|
|
3689
|
+
var e, t = (e = this.instance.config.ui_host) === null || e === void 0 ? void 0 : e.replace(/\/$/, "");
|
|
3690
|
+
return t || (t = this.apiHost.replace(".".concat(Ys), ".posthog.com")), t === "https://app.posthog.com" ? "https://us.posthog.com" : t;
|
|
3691
|
+
}
|
|
3692
|
+
get region() {
|
|
3693
|
+
return this._regionCache[this.apiHost] || (/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost) ? this._regionCache[this.apiHost] = Ke.US : /https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost) ? this._regionCache[this.apiHost] = Ke.EU : this._regionCache[this.apiHost] = Ke.CUSTOM), this._regionCache[this.apiHost];
|
|
3694
|
+
}
|
|
3695
|
+
endpointFor(e) {
|
|
3696
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
3697
|
+
if (t && (t = t[0] === "/" ? t : "/".concat(t)), e === "ui") return this.uiHost + t;
|
|
3698
|
+
if (this.region === Ke.CUSTOM) return this.apiHost + t;
|
|
3699
|
+
var i = Ys + t;
|
|
3700
|
+
switch (e) {
|
|
3701
|
+
case "assets":
|
|
3702
|
+
return "https://".concat(this.region, "-assets.").concat(i);
|
|
3703
|
+
case "api":
|
|
3704
|
+
return "https://".concat(this.region, ".").concat(i);
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
var Sl = { icontains: (r, e) => !!g && e.href.toLowerCase().indexOf(r.toLowerCase()) > -1, not_icontains: (r, e) => !!g && e.href.toLowerCase().indexOf(r.toLowerCase()) === -1, regex: (r, e) => !!g && gt(e.href, r), not_regex: (r, e) => !!g && !gt(e.href, r), exact: (r, e) => e.href === r, is_not: (r, e) => e.href !== r };
|
|
3709
|
+
class K {
|
|
3710
|
+
constructor(e) {
|
|
3711
|
+
var t = this;
|
|
3712
|
+
w(this, "getWebExperimentsAndEvaluateDisplayLogic", function() {
|
|
3713
|
+
var i = arguments.length > 0 && arguments[0] !== void 0 && arguments[0];
|
|
3714
|
+
t.getWebExperiments((s) => {
|
|
3715
|
+
K.logInfo("retrieved web experiments from the server"), t._flagToExperiments = /* @__PURE__ */ new Map(), s.forEach((n) => {
|
|
3716
|
+
if (n.feature_flag_key) {
|
|
3717
|
+
var o;
|
|
3718
|
+
t._flagToExperiments && (K.logInfo("setting flag key ", n.feature_flag_key, " to web experiment ", n), (o = t._flagToExperiments) === null || o === void 0 || o.set(n.feature_flag_key, n));
|
|
3719
|
+
var a = t.instance.getFeatureFlag(n.feature_flag_key);
|
|
3720
|
+
z(a) && n.variants[a] && t.applyTransforms(n.name, a, n.variants[a].transforms);
|
|
3721
|
+
} else if (n.variants) for (var l in n.variants) {
|
|
3722
|
+
var c = n.variants[l];
|
|
3723
|
+
K.matchesTestVariant(c) && t.applyTransforms(n.name, l, c.transforms);
|
|
3724
|
+
}
|
|
3725
|
+
});
|
|
3726
|
+
}, i);
|
|
3727
|
+
}), this.instance = e, this.instance.onFeatureFlags((i) => {
|
|
3728
|
+
this.onFeatureFlags(i);
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3731
|
+
onFeatureFlags(e) {
|
|
3732
|
+
if (this._is_bot()) K.logInfo("Refusing to render web experiment since the viewer is a likely bot");
|
|
3733
|
+
else if (!this.instance.config.disable_web_experiments) {
|
|
3734
|
+
if (R(this._flagToExperiments)) return this._flagToExperiments = /* @__PURE__ */ new Map(), this.loadIfEnabled(), void this.previewWebExperiment();
|
|
3735
|
+
K.logInfo("applying feature flags", e), e.forEach((t) => {
|
|
3736
|
+
var i;
|
|
3737
|
+
if (this._flagToExperiments && (i = this._flagToExperiments) !== null && i !== void 0 && i.has(t)) {
|
|
3738
|
+
var s, n = this.instance.getFeatureFlag(t), o = (s = this._flagToExperiments) === null || s === void 0 ? void 0 : s.get(t);
|
|
3739
|
+
n && o != null && o.variants[n] && this.applyTransforms(o.name, n, o.variants[n].transforms);
|
|
3740
|
+
}
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
previewWebExperiment() {
|
|
3745
|
+
var e = K.getWindowLocation();
|
|
3746
|
+
if (e != null && e.search) {
|
|
3747
|
+
var t = si(e == null ? void 0 : e.search, "__experiment_id"), i = si(e == null ? void 0 : e.search, "__experiment_variant");
|
|
3748
|
+
t && i && (K.logInfo("previewing web experiments ".concat(t, " && ").concat(i)), this.getWebExperiments((s) => {
|
|
3749
|
+
this.showPreviewWebExperiment(parseInt(t), i, s);
|
|
3750
|
+
}, !1, !0));
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
loadIfEnabled() {
|
|
3754
|
+
this.instance.config.disable_web_experiments || this.getWebExperimentsAndEvaluateDisplayLogic();
|
|
3755
|
+
}
|
|
3756
|
+
getWebExperiments(e, t, i) {
|
|
3757
|
+
if (this.instance.config.disable_web_experiments && !i) return e([]);
|
|
3758
|
+
var s = this.instance.get_property("$web_experiments");
|
|
3759
|
+
if (s && !t) return e(s);
|
|
3760
|
+
this.instance._send_request({ url: this.instance.requestRouter.endpointFor("api", "/api/web_experiments/?token=".concat(this.instance.config.token)), method: "GET", callback: (n) => {
|
|
3761
|
+
if (n.statusCode !== 200 || !n.json) return e([]);
|
|
3762
|
+
var o = n.json.experiments || [];
|
|
3763
|
+
return e(o);
|
|
3764
|
+
} });
|
|
3765
|
+
}
|
|
3766
|
+
showPreviewWebExperiment(e, t, i) {
|
|
3767
|
+
var s = i.filter((n) => n.id === e);
|
|
3768
|
+
s && s.length > 0 && (K.logInfo("Previewing web experiment [".concat(s[0].name, "] with variant [").concat(t, "]")), this.applyTransforms(s[0].name, t, s[0].variants[t].transforms));
|
|
3769
|
+
}
|
|
3770
|
+
static matchesTestVariant(e) {
|
|
3771
|
+
return !R(e.conditions) && K.matchUrlConditions(e) && K.matchUTMConditions(e);
|
|
3772
|
+
}
|
|
3773
|
+
static matchUrlConditions(e) {
|
|
3774
|
+
var t;
|
|
3775
|
+
if (R(e.conditions) || R((t = e.conditions) === null || t === void 0 ? void 0 : t.url)) return !0;
|
|
3776
|
+
var i, s, n, o = K.getWindowLocation();
|
|
3777
|
+
return !!o && ((i = e.conditions) === null || i === void 0 || !i.url || Sl[(s = (n = e.conditions) === null || n === void 0 ? void 0 : n.urlMatchType) !== null && s !== void 0 ? s : "icontains"](e.conditions.url, o));
|
|
3778
|
+
}
|
|
3779
|
+
static getWindowLocation() {
|
|
3780
|
+
return g == null ? void 0 : g.location;
|
|
3781
|
+
}
|
|
3782
|
+
static matchUTMConditions(e) {
|
|
3783
|
+
var t;
|
|
3784
|
+
if (R(e.conditions) || R((t = e.conditions) === null || t === void 0 ? void 0 : t.utm)) return !0;
|
|
3785
|
+
var i = A.campaignParams();
|
|
3786
|
+
if (i.utm_source) {
|
|
3787
|
+
var s, n, o, a, l, c, d, u, p, h, _, v, b, m, y, E, I = (s = e.conditions) === null || s === void 0 || (n = s.utm) === null || n === void 0 || !n.utm_campaign || ((o = e.conditions) === null || o === void 0 || (a = o.utm) === null || a === void 0 ? void 0 : a.utm_campaign) == i.utm_campaign, F = (l = e.conditions) === null || l === void 0 || (c = l.utm) === null || c === void 0 || !c.utm_source || ((d = e.conditions) === null || d === void 0 || (u = d.utm) === null || u === void 0 ? void 0 : u.utm_source) == i.utm_source, O = (p = e.conditions) === null || p === void 0 || (h = p.utm) === null || h === void 0 || !h.utm_medium || ((_ = e.conditions) === null || _ === void 0 || (v = _.utm) === null || v === void 0 ? void 0 : v.utm_medium) == i.utm_medium, L = (b = e.conditions) === null || b === void 0 || (m = b.utm) === null || m === void 0 || !m.utm_term || ((y = e.conditions) === null || y === void 0 || (E = y.utm) === null || E === void 0 ? void 0 : E.utm_term) == i.utm_term;
|
|
3788
|
+
return I && O && L && F;
|
|
3789
|
+
}
|
|
3790
|
+
return !1;
|
|
3791
|
+
}
|
|
3792
|
+
static logInfo(e) {
|
|
3793
|
+
for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++) i[s - 1] = arguments[s];
|
|
3794
|
+
x.info("[WebExperiments] ".concat(e), i);
|
|
3795
|
+
}
|
|
3796
|
+
applyTransforms(e, t, i) {
|
|
3797
|
+
this._is_bot() ? K.logInfo("Refusing to render web experiment since the viewer is a likely bot") : t !== "control" ? i.forEach((s) => {
|
|
3798
|
+
if (s.selector) {
|
|
3799
|
+
var n;
|
|
3800
|
+
K.logInfo("applying transform of variant ".concat(t, " for experiment ").concat(e, " "), s);
|
|
3801
|
+
var o = (n = document) === null || n === void 0 ? void 0 : n.querySelectorAll(s.selector);
|
|
3802
|
+
o == null || o.forEach((a) => {
|
|
3803
|
+
var l = a;
|
|
3804
|
+
s.html && (l.innerHTML = s.html), s.css && l.setAttribute("style", s.css);
|
|
3805
|
+
});
|
|
3806
|
+
}
|
|
3807
|
+
}) : K.logInfo("Control variants leave the page unmodified.");
|
|
3808
|
+
}
|
|
3809
|
+
_is_bot() {
|
|
3810
|
+
return oe && this.instance ? lo(oe, this.instance.config.custom_blocked_useragents) : void 0;
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
var Tt = {}, yr = () => {
|
|
3814
|
+
}, rt = "posthog", uo = !dl && (j == null ? void 0 : j.indexOf("MSIE")) === -1 && (j == null ? void 0 : j.indexOf("Mozilla")) === -1, Ks = () => {
|
|
3815
|
+
var r;
|
|
3816
|
+
return { api_host: "https://us.i.posthog.com", ui_host: null, token: "", autocapture: !0, rageclick: !0, cross_subdomain_cookie: Po(S == null ? void 0 : S.location), persistence: "localStorage+cookie", persistence_name: "", loaded: yr, save_campaign_params: !0, custom_campaign_params: [], custom_blocked_useragents: [], save_referrer: !0, capture_pageview: !0, capture_pageleave: "if_capture_pageview", debug: te && z(te == null ? void 0 : te.search) && te.search.indexOf("__posthog_debug=true") !== -1 || !1, cookie_expiration: 365, upgrade: !1, disable_session_recording: !1, disable_persistence: !1, disable_web_experiments: !0, disable_surveys: !1, disable_external_dependency_loading: !1, enable_recording_console_log: void 0, secure_cookie: (g == null || (r = g.location) === null || r === void 0 ? void 0 : r.protocol) === "https:", ip: !0, opt_out_capturing_by_default: !1, opt_out_persistence_by_default: !1, opt_out_useragent_filter: !1, opt_out_capturing_persistence_type: "localStorage", opt_out_capturing_cookie_prefix: null, opt_in_site_apps: !1, property_denylist: [], respect_dnt: !1, sanitize_properties: null, request_headers: {}, request_batching: !0, properties_string_max_length: 65535, session_recording: {}, mask_all_element_attributes: !1, mask_all_text: !1, mask_personal_data_properties: !1, custom_personal_data_properties: [], advanced_disable_decide: !1, advanced_disable_feature_flags: !1, advanced_disable_feature_flags_on_first_load: !1, advanced_disable_toolbar_metrics: !1, feature_flag_request_timeout_ms: 3e3, surveys_request_timeout_ms: 1e4, on_request_error: (e) => {
|
|
3817
|
+
var t = "Bad HTTP status: " + e.statusCode + " " + e.text;
|
|
3818
|
+
x.error(t);
|
|
3819
|
+
}, get_device_id: (e) => e, capture_performance: void 0, name: "posthog", bootstrap: {}, disable_compression: !1, session_idle_timeout_seconds: 1800, person_profiles: "identified_only", before_send: void 0, request_queue_config: { flush_interval_ms: mr }, _onCapture: yr };
|
|
3820
|
+
}, Qs = (r) => {
|
|
3821
|
+
var e = {};
|
|
3822
|
+
k(r.process_person) || (e.person_profiles = r.process_person), k(r.xhr_headers) || (e.request_headers = r.xhr_headers), k(r.cookie_name) || (e.persistence_name = r.cookie_name), k(r.disable_cookie) || (e.disable_persistence = r.disable_cookie), k(r.store_google) || (e.save_campaign_params = r.store_google), k(r.verbose) || (e.debug = r.verbose);
|
|
3823
|
+
var t = H({}, e, r);
|
|
3824
|
+
return q(r.property_blacklist) && (k(r.property_denylist) ? t.property_denylist = r.property_blacklist : q(r.property_denylist) ? t.property_denylist = [...r.property_blacklist, ...r.property_denylist] : x.error("Invalid value for property_denylist config: " + r.property_denylist)), t;
|
|
3825
|
+
};
|
|
3826
|
+
class El {
|
|
3827
|
+
constructor() {
|
|
3828
|
+
w(this, "__forceAllowLocalhost", !1);
|
|
3829
|
+
}
|
|
3830
|
+
get _forceAllowLocalhost() {
|
|
3831
|
+
return this.__forceAllowLocalhost;
|
|
3832
|
+
}
|
|
3833
|
+
set _forceAllowLocalhost(e) {
|
|
3834
|
+
x.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"), this.__forceAllowLocalhost = e;
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3837
|
+
class vi {
|
|
3838
|
+
get decideEndpointWasHit() {
|
|
3839
|
+
var e, t;
|
|
3840
|
+
return (e = (t = this.featureFlags) === null || t === void 0 ? void 0 : t.hasLoadedFlags) !== null && e !== void 0 && e;
|
|
3841
|
+
}
|
|
3842
|
+
constructor() {
|
|
3843
|
+
w(this, "webPerformance", new El()), w(this, "_personProcessingSetOncePropertiesSent", !1), w(this, "version", Ie.LIB_VERSION), w(this, "_internalEventEmitter", new ao()), this.config = Ks(), this.SentryIntegration = $a, this.sentryIntegration = (e) => function(t, i) {
|
|
3844
|
+
var s = Mn(t, i);
|
|
3845
|
+
return { name: Ln, processEvent: (n) => s(n) };
|
|
3846
|
+
}(this, e), this.__request_queue = [], this.__loaded = !1, this.analyticsDefaultEndpoint = "/e/", this._initialPageviewCaptured = !1, this._initialPersonProfilesConfig = null, this._cachedPersonProperties = null, this.featureFlags = new Xa(this), this.toolbar = new La(this), this.scrollManager = new gl(this), this.pageViewManager = new Ba(this), this.surveys = new al(this), this.experiments = new K(this), this.exceptions = new Ha(this), this.rateLimiter = new ll(this), this.requestRouter = new kl(this), this.consent = new Qo(this), this.people = { set: (e, t, i) => {
|
|
3847
|
+
var s = z(e) ? { [e]: t } : e;
|
|
3848
|
+
this.setPersonProperties(s), i == null || i({});
|
|
3849
|
+
}, set_once: (e, t, i) => {
|
|
3850
|
+
var s = z(e) ? { [e]: t } : e;
|
|
3851
|
+
this.setPersonProperties(void 0, s), i == null || i({});
|
|
3852
|
+
} }, this.on("eventCaptured", (e) => x.info('send "'.concat(e == null ? void 0 : e.event, '"'), e));
|
|
3853
|
+
}
|
|
3854
|
+
init(e, t, i) {
|
|
3855
|
+
if (i && i !== rt) {
|
|
3856
|
+
var s, n = (s = Tt[i]) !== null && s !== void 0 ? s : new vi();
|
|
3857
|
+
return n._init(e, t, i), Tt[i] = n, Tt[rt][i] = n, n;
|
|
3858
|
+
}
|
|
3859
|
+
return this._init(e, t, i);
|
|
3860
|
+
}
|
|
3861
|
+
_init(e) {
|
|
3862
|
+
var t, i, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = arguments.length > 2 ? arguments[2] : void 0;
|
|
3863
|
+
if (k(e) || zi(e)) return x.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"), this;
|
|
3864
|
+
if (this.__loaded) return x.warn("You have already initialized PostHog! Re-initializing is a no-op"), this;
|
|
3865
|
+
this.__loaded = !0, this.config = {}, this._triggered_notifs = [], s.person_profiles && (this._initialPersonProfilesConfig = s.person_profiles), this.set_config(H({}, Ks(), Qs(s), { name: n, token: e })), this.config.on_xhr_error && x.error("on_xhr_error is deprecated. Use on_request_error instead"), this.compression = s.disable_compression ? void 0 : _e.GZipJS, this.persistence = new Ai(this.config), this.sessionPersistence = this.config.persistence === "sessionStorage" || this.config.persistence === "memory" ? this.persistence : new Ai(f(f({}, this.config), {}, { persistence: "sessionStorage" }));
|
|
3866
|
+
var o = f({}, this.persistence.props), a = f({}, this.sessionPersistence.props);
|
|
3867
|
+
if (this._requestQueue = new hl((m) => this._send_retriable_request(m), this.config.request_queue_config), this._retryQueue = new _l(this), this.__request_queue = [], this.config.__preview_experimental_cookieless_mode || (this.sessionManager = new ml(this), this.sessionPropsManager = new fl(this, this.sessionManager, this.persistence)), new Aa(this).startIfEnabledOrStop(), this.siteApps = new bl(this), (t = this.siteApps) === null || t === void 0 || t.init(), this.config.__preview_experimental_cookieless_mode || (this.sessionRecording = new Ta(this), this.sessionRecording.startIfEnabledOrStop()), this.config.disable_scroll_properties || this.scrollManager.startMeasuringScrollPosition(), this.autocapture = new Uo(this), this.autocapture.startIfEnabled(), this.surveys.loadIfEnabled(), this.heatmaps = new Na(this), this.heatmaps.startIfEnabled(), this.webVitalsAutocapture = new Da(this), this.exceptionObserver = new ea(this), this.exceptionObserver.startIfEnabled(), this.deadClicksAutocapture = new En(this, Xo), this.deadClicksAutocapture.startIfEnabled(), Ie.DEBUG = Ie.DEBUG || this.config.debug, Ie.DEBUG && x.info("Starting in debug mode", { this: this, config: s, thisC: f({}, this.config), p: o, s: a }), this._sync_opt_out_with_persistence(), ((i = s.bootstrap) === null || i === void 0 ? void 0 : i.distinctID) !== void 0) {
|
|
3868
|
+
var l, c, d = this.config.get_device_id(De()), u = (l = s.bootstrap) !== null && l !== void 0 && l.isIdentifiedID ? d : s.bootstrap.distinctID;
|
|
3869
|
+
this.persistence.set_property(Se, (c = s.bootstrap) !== null && c !== void 0 && c.isIdentifiedID ? "identified" : "anonymous"), this.register({ distinct_id: s.bootstrap.distinctID, $device_id: u });
|
|
3870
|
+
}
|
|
3871
|
+
if (this._hasBootstrappedFeatureFlags()) {
|
|
3872
|
+
var p, h, _ = Object.keys(((p = s.bootstrap) === null || p === void 0 ? void 0 : p.featureFlags) || {}).filter((m) => {
|
|
3873
|
+
var y, E;
|
|
3874
|
+
return !((y = s.bootstrap) === null || y === void 0 || (E = y.featureFlags) === null || E === void 0 || !E[m]);
|
|
3875
|
+
}).reduce((m, y) => {
|
|
3876
|
+
var E, I;
|
|
3877
|
+
return m[y] = ((E = s.bootstrap) === null || E === void 0 || (I = E.featureFlags) === null || I === void 0 ? void 0 : I[y]) || !1, m;
|
|
3878
|
+
}, {}), v = Object.keys(((h = s.bootstrap) === null || h === void 0 ? void 0 : h.featureFlagPayloads) || {}).filter((m) => _[m]).reduce((m, y) => {
|
|
3879
|
+
var E, I, F, O;
|
|
3880
|
+
return (E = s.bootstrap) !== null && E !== void 0 && (I = E.featureFlagPayloads) !== null && I !== void 0 && I[y] && (m[y] = (F = s.bootstrap) === null || F === void 0 || (O = F.featureFlagPayloads) === null || O === void 0 ? void 0 : O[y]), m;
|
|
3881
|
+
}, {});
|
|
3882
|
+
this.featureFlags.receivedFeatureFlags({ featureFlags: _, featureFlagPayloads: v });
|
|
3883
|
+
}
|
|
3884
|
+
if (this.config.__preview_experimental_cookieless_mode) this.register_once({ distinct_id: is, $device_id: null }, "");
|
|
3885
|
+
else if (!this.get_distinct_id()) {
|
|
3886
|
+
var b = this.config.get_device_id(De());
|
|
3887
|
+
this.register_once({ distinct_id: b, $device_id: b }, ""), this.persistence.set_property(Se, "anonymous");
|
|
3888
|
+
}
|
|
3889
|
+
return U(g, "onpagehide" in self ? "pagehide" : "unload", this._handle_unload.bind(this), { passive: !1 }), this.toolbar.maybeLoadToolbar(), s.segment ? Ra(this, () => this._loaded()) : this._loaded(), ge(this.config._onCapture) && this.config._onCapture !== yr && (x.warn("onCapture is deprecated. Please use `before_send` instead"), this.on("eventCaptured", (m) => this.config._onCapture(m.event, m))), this;
|
|
3890
|
+
}
|
|
3891
|
+
_onRemoteConfig(e) {
|
|
3892
|
+
var t, i, s, n, o, a, l, c;
|
|
3893
|
+
if (!S || !S.body) return x.info("document not ready yet, trying again in 500 milliseconds..."), void setTimeout(() => {
|
|
3894
|
+
this._onRemoteConfig(e);
|
|
3895
|
+
}, 500);
|
|
3896
|
+
this.compression = void 0, e.supportedCompression && !this.config.disable_compression && (this.compression = T(e.supportedCompression, _e.GZipJS) ? _e.GZipJS : T(e.supportedCompression, _e.Base64) ? _e.Base64 : void 0), (t = e.analytics) !== null && t !== void 0 && t.endpoint && (this.analyticsDefaultEndpoint = e.analytics.endpoint), this.set_config({ person_profiles: this._initialPersonProfilesConfig ? this._initialPersonProfilesConfig : "identified_only" }), (i = this.siteApps) === null || i === void 0 || i.onRemoteConfig(e), (s = this.sessionRecording) === null || s === void 0 || s.onRemoteConfig(e), (n = this.autocapture) === null || n === void 0 || n.onRemoteConfig(e), (o = this.heatmaps) === null || o === void 0 || o.onRemoteConfig(e), this.surveys.onRemoteConfig(e), (a = this.webVitalsAutocapture) === null || a === void 0 || a.onRemoteConfig(e), (l = this.exceptionObserver) === null || l === void 0 || l.onRemoteConfig(e), (c = this.deadClicksAutocapture) === null || c === void 0 || c.onRemoteConfig(e);
|
|
3897
|
+
}
|
|
3898
|
+
_loaded() {
|
|
3899
|
+
try {
|
|
3900
|
+
this.config.loaded(this);
|
|
3901
|
+
} catch (e) {
|
|
3902
|
+
x.critical("`loaded` function failed", e);
|
|
3903
|
+
}
|
|
3904
|
+
this._start_queue_if_opted_in(), this.config.capture_pageview && setTimeout(() => {
|
|
3905
|
+
this.consent.isOptedIn() && this._captureInitialPageview();
|
|
3906
|
+
}, 1), new ul(this).load(), this.featureFlags.decide();
|
|
3907
|
+
}
|
|
3908
|
+
_start_queue_if_opted_in() {
|
|
3909
|
+
var e;
|
|
3910
|
+
this.has_opted_out_capturing() || this.config.request_batching && ((e = this._requestQueue) === null || e === void 0 || e.enable());
|
|
3911
|
+
}
|
|
3912
|
+
_dom_loaded() {
|
|
3913
|
+
this.has_opted_out_capturing() || Ne(this.__request_queue, (e) => this._send_retriable_request(e)), this.__request_queue = [], this._start_queue_if_opted_in();
|
|
3914
|
+
}
|
|
3915
|
+
_handle_unload() {
|
|
3916
|
+
var e, t;
|
|
3917
|
+
this.config.request_batching ? (this._shouldCapturePageleave() && this.capture("$pageleave"), (e = this._requestQueue) === null || e === void 0 || e.unload(), (t = this._retryQueue) === null || t === void 0 || t.unload()) : this._shouldCapturePageleave() && this.capture("$pageleave", null, { transport: "sendBeacon" });
|
|
3918
|
+
}
|
|
3919
|
+
_send_request(e) {
|
|
3920
|
+
this.__loaded && (uo ? this.__request_queue.push(e) : this.rateLimiter.isServerRateLimited(e.batchKey) || (e.transport = e.transport || this.config.api_transport, e.url = di(e.url, { ip: this.config.ip ? 1 : 0 }), e.headers = f({}, this.config.request_headers), e.compression = e.compression === "best-available" ? this.compression : e.compression, e.fetchOptions = e.fetchOptions || this.config.fetch_options, ((t) => {
|
|
3921
|
+
var i, s, n, o = f({}, t);
|
|
3922
|
+
o.timeout = o.timeout || 6e4, o.url = di(o.url, { _: (/* @__PURE__ */ new Date()).getTime().toString(), ver: Ie.LIB_VERSION, compression: o.compression });
|
|
3923
|
+
var a = (i = o.transport) !== null && i !== void 0 ? i : "fetch", l = (s = (n = ln(Ft, (c) => c.transport === a)) === null || n === void 0 ? void 0 : n.method) !== null && s !== void 0 ? s : Ft[0].method;
|
|
3924
|
+
if (!l) throw new Error("No available transport method");
|
|
3925
|
+
l(o);
|
|
3926
|
+
})(f(f({}, e), {}, { callback: (t) => {
|
|
3927
|
+
var i, s, n;
|
|
3928
|
+
this.rateLimiter.checkForLimiting(t), t.statusCode >= 400 && ((s = (n = this.config).on_request_error) === null || s === void 0 || s.call(n, t)), (i = e.callback) === null || i === void 0 || i.call(e, t);
|
|
3929
|
+
} }))));
|
|
3930
|
+
}
|
|
3931
|
+
_send_retriable_request(e) {
|
|
3932
|
+
this._retryQueue ? this._retryQueue.retriableRequest(e) : this._send_request(e);
|
|
3933
|
+
}
|
|
3934
|
+
_execute_array(e) {
|
|
3935
|
+
var t, i = [], s = [], n = [];
|
|
3936
|
+
Ne(e, (a) => {
|
|
3937
|
+
a && (t = a[0], q(t) ? n.push(a) : ge(a) ? a.call(this) : q(a) && t === "alias" ? i.push(a) : q(a) && t.indexOf("capture") !== -1 && ge(this[t]) ? n.push(a) : s.push(a));
|
|
3938
|
+
});
|
|
3939
|
+
var o = function(a, l) {
|
|
3940
|
+
Ne(a, function(c) {
|
|
3941
|
+
if (q(c[0])) {
|
|
3942
|
+
var d = l;
|
|
3943
|
+
$(c, function(u) {
|
|
3944
|
+
d = d[u[0]].apply(d, u.slice(1));
|
|
3945
|
+
});
|
|
3946
|
+
} else this[c[0]].apply(this, c.slice(1));
|
|
3947
|
+
}, l);
|
|
3948
|
+
};
|
|
3949
|
+
o(i, this), o(s, this), o(n, this);
|
|
3950
|
+
}
|
|
3951
|
+
_hasBootstrappedFeatureFlags() {
|
|
3952
|
+
var e, t;
|
|
3953
|
+
return ((e = this.config.bootstrap) === null || e === void 0 ? void 0 : e.featureFlags) && Object.keys((t = this.config.bootstrap) === null || t === void 0 ? void 0 : t.featureFlags).length > 0 || !1;
|
|
3954
|
+
}
|
|
3955
|
+
push(e) {
|
|
3956
|
+
this._execute_array([e]);
|
|
3957
|
+
}
|
|
3958
|
+
capture(e, t, i) {
|
|
3959
|
+
var s;
|
|
3960
|
+
if (this.__loaded && this.persistence && this.sessionPersistence && this._requestQueue) {
|
|
3961
|
+
if (!this.consent.isOptedOut()) if (!k(e) && z(e)) {
|
|
3962
|
+
if (this.config.opt_out_useragent_filter || !this._is_bot()) {
|
|
3963
|
+
var n = i != null && i.skip_client_rate_limiting ? void 0 : this.rateLimiter.clientRateLimitContext();
|
|
3964
|
+
if (n == null || !n.isRateLimited) {
|
|
3965
|
+
t != null && t.$current_url && !z(t == null ? void 0 : t.$current_url) && (x.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."), t == null || delete t.$current_url), this.sessionPersistence.update_search_keyword(), this.config.save_campaign_params && this.sessionPersistence.update_campaign_params(), this.config.save_referrer && this.sessionPersistence.update_referrer_info(), (this.config.save_campaign_params || this.config.save_referrer) && this.persistence.set_initial_person_info();
|
|
3966
|
+
var o = /* @__PURE__ */ new Date(), a = (i == null ? void 0 : i.timestamp) || o, l = De(), c = { uuid: l, event: e, properties: this._calculate_event_properties(e, t || {}, a, l) };
|
|
3967
|
+
n && (c.properties.$lib_rate_limit_remaining_tokens = n.remainingTokens), i != null && i.$set && (c.$set = i == null ? void 0 : i.$set);
|
|
3968
|
+
var d = this._calculate_set_once_properties(i == null ? void 0 : i.$set_once);
|
|
3969
|
+
d && (c.$set_once = d), (c = Io(c, i != null && i._noTruncate ? null : this.config.properties_string_max_length)).timestamp = a, k(i == null ? void 0 : i.timestamp) || (c.properties.$event_time_override_provided = !0, c.properties.$event_time_override_system_time = o);
|
|
3970
|
+
var u = f(f({}, c.properties.$set), c.$set);
|
|
3971
|
+
if (st(u) || this.setPersonPropertiesForFlags(u), !R(this.config.before_send)) {
|
|
3972
|
+
var p = this._runBeforeSend(c);
|
|
3973
|
+
if (!p) return;
|
|
3974
|
+
c = p;
|
|
3975
|
+
}
|
|
3976
|
+
this._internalEventEmitter.emit("eventCaptured", c);
|
|
3977
|
+
var h = { method: "POST", url: (s = i == null ? void 0 : i._url) !== null && s !== void 0 ? s : this.requestRouter.endpointFor("api", this.analyticsDefaultEndpoint), data: c, compression: "best-available", batchKey: i == null ? void 0 : i._batchKey };
|
|
3978
|
+
return !this.config.request_batching || i && (i == null || !i._batchKey) || i != null && i.send_instantly ? this._send_retriable_request(h) : this._requestQueue.enqueue(h), c;
|
|
3979
|
+
}
|
|
3980
|
+
x.critical("This capture call is ignored due to client rate limiting.");
|
|
3981
|
+
}
|
|
3982
|
+
} else x.error("No event name provided to posthog.capture");
|
|
3983
|
+
} else x.uninitializedWarning("posthog.capture");
|
|
3984
|
+
}
|
|
3985
|
+
_addCaptureHook(e) {
|
|
3986
|
+
return this.on("eventCaptured", (t) => e(t.event, t));
|
|
3987
|
+
}
|
|
3988
|
+
_calculate_event_properties(e, t, i, s) {
|
|
3989
|
+
if (i = i || /* @__PURE__ */ new Date(), !this.persistence || !this.sessionPersistence) return t;
|
|
3990
|
+
var n = this.persistence.remove_event_timer(e), o = f({}, t);
|
|
3991
|
+
if (o.token = this.config.token, this.config.__preview_experimental_cookieless_mode && (o.$cookieless_mode = !0), e === "$snapshot") {
|
|
3992
|
+
var a = f(f({}, this.persistence.properties()), this.sessionPersistence.properties());
|
|
3993
|
+
return o.distinct_id = a.distinct_id, (!z(o.distinct_id) && !ee(o.distinct_id) || zi(o.distinct_id)) && x.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"), o;
|
|
3994
|
+
}
|
|
3995
|
+
var l, c = A.properties({ maskPersonalDataProperties: this.config.mask_personal_data_properties, customPersonalDataProperties: this.config.custom_personal_data_properties });
|
|
3996
|
+
if (this.sessionManager) {
|
|
3997
|
+
var { sessionId: d, windowId: u } = this.sessionManager.checkAndGetSessionAndWindowId();
|
|
3998
|
+
o.$session_id = d, o.$window_id = u;
|
|
3999
|
+
}
|
|
4000
|
+
this.sessionPropsManager && H(o, this.sessionPropsManager.getSessionProps());
|
|
4001
|
+
try {
|
|
4002
|
+
var p, h;
|
|
4003
|
+
this.sessionRecording && H(o, this.sessionRecording.sdkDebugProperties), o.$sdk_debug_retry_queue_size = (p = this._retryQueue) === null || p === void 0 || (h = p.queue) === null || h === void 0 ? void 0 : h.length;
|
|
4004
|
+
} catch (m) {
|
|
4005
|
+
o.$sdk_debug_error_capturing_properties = String(m);
|
|
4006
|
+
}
|
|
4007
|
+
if (this.requestRouter.region === Ke.CUSTOM && (o.$lib_custom_api_host = this.config.api_host), l = e === "$pageview" ? this.pageViewManager.doPageView(i, s) : e === "$pageleave" ? this.pageViewManager.doPageLeave(i) : this.pageViewManager.doEvent(), o = H(o, l), e === "$pageview" && S && (o.title = S.title), !k(n)) {
|
|
4008
|
+
var _ = i.getTime() - n;
|
|
4009
|
+
o.$duration = parseFloat((_ / 1e3).toFixed(3));
|
|
4010
|
+
}
|
|
4011
|
+
j && this.config.opt_out_useragent_filter && (o.$browser_type = this._is_bot() ? "bot" : "browser"), (o = H({}, c, this.persistence.properties(), this.sessionPersistence.properties(), o)).$is_identified = this._isIdentified(), q(this.config.property_denylist) ? $(this.config.property_denylist, function(m) {
|
|
4012
|
+
delete o[m];
|
|
4013
|
+
}) : x.error("Invalid value for property_denylist config: " + this.config.property_denylist + " or property_blacklist config: " + this.config.property_blacklist);
|
|
4014
|
+
var v = this.config.sanitize_properties;
|
|
4015
|
+
v && (x.error("sanitize_properties is deprecated. Use before_send instead"), o = v(o, e));
|
|
4016
|
+
var b = this._hasPersonProcessing();
|
|
4017
|
+
return o.$process_person_profile = b, b && this._requirePersonProcessing("_calculate_event_properties"), o;
|
|
4018
|
+
}
|
|
4019
|
+
_calculate_set_once_properties(e) {
|
|
4020
|
+
var t;
|
|
4021
|
+
if (!this.persistence || !this._hasPersonProcessing() || this._personProcessingSetOncePropertiesSent) return e;
|
|
4022
|
+
var i = this.persistence.get_initial_props(), s = (t = this.sessionPropsManager) === null || t === void 0 ? void 0 : t.getSetOnceProps(), n = H({}, i, s || {}, e || {}), o = this.config.sanitize_properties;
|
|
4023
|
+
return o && (x.error("sanitize_properties is deprecated. Use before_send instead"), n = o(n, "$set_once")), this._personProcessingSetOncePropertiesSent = !0, st(n) ? void 0 : n;
|
|
4024
|
+
}
|
|
4025
|
+
register(e, t) {
|
|
4026
|
+
var i;
|
|
4027
|
+
(i = this.persistence) === null || i === void 0 || i.register(e, t);
|
|
4028
|
+
}
|
|
4029
|
+
register_once(e, t, i) {
|
|
4030
|
+
var s;
|
|
4031
|
+
(s = this.persistence) === null || s === void 0 || s.register_once(e, t, i);
|
|
4032
|
+
}
|
|
4033
|
+
register_for_session(e) {
|
|
4034
|
+
var t;
|
|
4035
|
+
(t = this.sessionPersistence) === null || t === void 0 || t.register(e);
|
|
4036
|
+
}
|
|
4037
|
+
unregister(e) {
|
|
4038
|
+
var t;
|
|
4039
|
+
(t = this.persistence) === null || t === void 0 || t.unregister(e);
|
|
4040
|
+
}
|
|
4041
|
+
unregister_for_session(e) {
|
|
4042
|
+
var t;
|
|
4043
|
+
(t = this.sessionPersistence) === null || t === void 0 || t.unregister(e);
|
|
4044
|
+
}
|
|
4045
|
+
_register_single(e, t) {
|
|
4046
|
+
this.register({ [e]: t });
|
|
4047
|
+
}
|
|
4048
|
+
getFeatureFlag(e, t) {
|
|
4049
|
+
return this.featureFlags.getFeatureFlag(e, t);
|
|
4050
|
+
}
|
|
4051
|
+
getFeatureFlagPayload(e) {
|
|
4052
|
+
var t = this.featureFlags.getFeatureFlagPayload(e);
|
|
4053
|
+
try {
|
|
4054
|
+
return JSON.parse(t);
|
|
4055
|
+
} catch {
|
|
4056
|
+
return t;
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
isFeatureEnabled(e, t) {
|
|
4060
|
+
return this.featureFlags.isFeatureEnabled(e, t);
|
|
4061
|
+
}
|
|
4062
|
+
reloadFeatureFlags() {
|
|
4063
|
+
this.featureFlags.reloadFeatureFlags();
|
|
4064
|
+
}
|
|
4065
|
+
updateEarlyAccessFeatureEnrollment(e, t) {
|
|
4066
|
+
this.featureFlags.updateEarlyAccessFeatureEnrollment(e, t);
|
|
4067
|
+
}
|
|
4068
|
+
getEarlyAccessFeatures(e) {
|
|
4069
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1], i = arguments.length > 2 ? arguments[2] : void 0;
|
|
4070
|
+
return this.featureFlags.getEarlyAccessFeatures(e, t, i);
|
|
4071
|
+
}
|
|
4072
|
+
on(e, t) {
|
|
4073
|
+
return this._internalEventEmitter.on(e, t);
|
|
4074
|
+
}
|
|
4075
|
+
onFeatureFlags(e) {
|
|
4076
|
+
return this.featureFlags.onFeatureFlags(e);
|
|
4077
|
+
}
|
|
4078
|
+
onSurveysLoaded(e) {
|
|
4079
|
+
return this.surveys.onSurveysLoaded(e);
|
|
4080
|
+
}
|
|
4081
|
+
onSessionId(e) {
|
|
4082
|
+
var t, i;
|
|
4083
|
+
return (t = (i = this.sessionManager) === null || i === void 0 ? void 0 : i.onSessionId(e)) !== null && t !== void 0 ? t : () => {
|
|
4084
|
+
};
|
|
4085
|
+
}
|
|
4086
|
+
getSurveys(e) {
|
|
4087
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
4088
|
+
this.surveys.getSurveys(e, t);
|
|
4089
|
+
}
|
|
4090
|
+
getActiveMatchingSurveys(e) {
|
|
4091
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
|
|
4092
|
+
this.surveys.getActiveMatchingSurveys(e, t);
|
|
4093
|
+
}
|
|
4094
|
+
renderSurvey(e, t) {
|
|
4095
|
+
this.surveys.renderSurvey(e, t);
|
|
4096
|
+
}
|
|
4097
|
+
canRenderSurvey(e) {
|
|
4098
|
+
return this.surveys.canRenderSurvey(e);
|
|
4099
|
+
}
|
|
4100
|
+
identify(e, t, i) {
|
|
4101
|
+
if (!this.__loaded || !this.persistence) return x.uninitializedWarning("posthog.identify");
|
|
4102
|
+
if (ee(e) && (e = e.toString(), x.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")), e) {
|
|
4103
|
+
if (["distinct_id", "distinctid"].includes(e.toLowerCase())) x.critical('The string "'.concat(e, '" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));
|
|
4104
|
+
else if (this._requirePersonProcessing("posthog.identify")) {
|
|
4105
|
+
var s = this.get_distinct_id();
|
|
4106
|
+
if (this.register({ $user_id: e }), !this.get_property("$device_id")) {
|
|
4107
|
+
var n = s;
|
|
4108
|
+
this.register_once({ $had_persisted_distinct_id: !0, $device_id: n }, "");
|
|
4109
|
+
}
|
|
4110
|
+
e !== s && e !== this.get_property(wt) && (this.unregister(wt), this.register({ distinct_id: e }));
|
|
4111
|
+
var o = (this.persistence.get_property(Se) || "anonymous") === "anonymous";
|
|
4112
|
+
e !== s && o ? (this.persistence.set_property(Se, "identified"), this.setPersonPropertiesForFlags(f(f({}, i || {}), t || {}), !1), this.capture("$identify", { distinct_id: e, $anon_distinct_id: s }, { $set: t || {}, $set_once: i || {} }), this._cachedPersonProperties = Js(e, t, i), this.featureFlags.setAnonymousDistinctId(s)) : (t || i) && this.setPersonProperties(t, i), e !== s && (this.reloadFeatureFlags(), this.unregister(ti));
|
|
4113
|
+
}
|
|
4114
|
+
} else x.error("Unique user id has not been set in posthog.identify");
|
|
4115
|
+
}
|
|
4116
|
+
setPersonProperties(e, t) {
|
|
4117
|
+
if ((e || t) && this._requirePersonProcessing("posthog.setPersonProperties")) {
|
|
4118
|
+
var i = Js(this.get_distinct_id(), e, t);
|
|
4119
|
+
this._cachedPersonProperties !== i ? (this.setPersonPropertiesForFlags(f(f({}, t || {}), e || {})), this.capture("$set", { $set: e || {}, $set_once: t || {} }), this._cachedPersonProperties = i) : x.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.");
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
group(e, t, i) {
|
|
4123
|
+
if (e && t) {
|
|
4124
|
+
if (this._requirePersonProcessing("posthog.group")) {
|
|
4125
|
+
var s = this.getGroups();
|
|
4126
|
+
s[e] !== t && this.resetGroupPropertiesForFlags(e), this.register({ $groups: f(f({}, s), {}, { [e]: t }) }), i && (this.capture("$groupidentify", { $group_type: e, $group_key: t, $group_set: i }), this.setGroupPropertiesForFlags({ [e]: i })), s[e] === t || i || this.reloadFeatureFlags();
|
|
4127
|
+
}
|
|
4128
|
+
} else x.error("posthog.group requires a group type and group key");
|
|
4129
|
+
}
|
|
4130
|
+
resetGroups() {
|
|
4131
|
+
this.register({ $groups: {} }), this.resetGroupPropertiesForFlags(), this.reloadFeatureFlags();
|
|
4132
|
+
}
|
|
4133
|
+
setPersonPropertiesForFlags(e) {
|
|
4134
|
+
var t = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
|
|
4135
|
+
this.featureFlags.setPersonPropertiesForFlags(e, t);
|
|
4136
|
+
}
|
|
4137
|
+
resetPersonPropertiesForFlags() {
|
|
4138
|
+
this.featureFlags.resetPersonPropertiesForFlags();
|
|
4139
|
+
}
|
|
4140
|
+
setGroupPropertiesForFlags(e) {
|
|
4141
|
+
var t = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
|
|
4142
|
+
this._requirePersonProcessing("posthog.setGroupPropertiesForFlags") && this.featureFlags.setGroupPropertiesForFlags(e, t);
|
|
4143
|
+
}
|
|
4144
|
+
resetGroupPropertiesForFlags(e) {
|
|
4145
|
+
this.featureFlags.resetGroupPropertiesForFlags(e);
|
|
4146
|
+
}
|
|
4147
|
+
reset(e) {
|
|
4148
|
+
var t, i, s, n;
|
|
4149
|
+
if (x.info("reset"), !this.__loaded) return x.uninitializedWarning("posthog.reset");
|
|
4150
|
+
var o = this.get_property("$device_id");
|
|
4151
|
+
if (this.consent.reset(), (t = this.persistence) === null || t === void 0 || t.clear(), (i = this.sessionPersistence) === null || i === void 0 || i.clear(), this.surveys.reset(), (s = this.persistence) === null || s === void 0 || s.set_property(Se, "anonymous"), (n = this.sessionManager) === null || n === void 0 || n.resetSessionId(), this._cachedPersonProperties = null, this.config.__preview_experimental_cookieless_mode) this.register_once({ distinct_id: is, $device_id: null }, "");
|
|
4152
|
+
else {
|
|
4153
|
+
var a = this.config.get_device_id(De());
|
|
4154
|
+
this.register_once({ distinct_id: a, $device_id: e ? a : o }, "");
|
|
4155
|
+
}
|
|
4156
|
+
this.register({ $last_posthog_reset: (/* @__PURE__ */ new Date()).toISOString() }, 1);
|
|
4157
|
+
}
|
|
4158
|
+
get_distinct_id() {
|
|
4159
|
+
return this.get_property("distinct_id");
|
|
4160
|
+
}
|
|
4161
|
+
getGroups() {
|
|
4162
|
+
return this.get_property("$groups") || {};
|
|
4163
|
+
}
|
|
4164
|
+
get_session_id() {
|
|
4165
|
+
var e, t;
|
|
4166
|
+
return (e = (t = this.sessionManager) === null || t === void 0 ? void 0 : t.checkAndGetSessionAndWindowId(!0).sessionId) !== null && e !== void 0 ? e : "";
|
|
4167
|
+
}
|
|
4168
|
+
get_session_replay_url(e) {
|
|
4169
|
+
if (!this.sessionManager) return "";
|
|
4170
|
+
var { sessionId: t, sessionStartTimestamp: i } = this.sessionManager.checkAndGetSessionAndWindowId(!0), s = this.requestRouter.endpointFor("ui", "/project/".concat(this.config.token, "/replay/").concat(t));
|
|
4171
|
+
if (e != null && e.withTimestamp && i) {
|
|
4172
|
+
var n, o = (n = e.timestampLookBack) !== null && n !== void 0 ? n : 10;
|
|
4173
|
+
if (!i) return s;
|
|
4174
|
+
var a = Math.max(Math.floor(((/* @__PURE__ */ new Date()).getTime() - i) / 1e3) - o, 0);
|
|
4175
|
+
s += "?t=".concat(a);
|
|
4176
|
+
}
|
|
4177
|
+
return s;
|
|
4178
|
+
}
|
|
4179
|
+
alias(e, t) {
|
|
4180
|
+
return e === this.get_property(un) ? (x.critical("Attempting to create alias for existing People user - aborting."), -2) : this._requirePersonProcessing("posthog.alias") ? (k(t) && (t = this.get_distinct_id()), e !== t ? (this._register_single(wt, e), this.capture("$create_alias", { alias: e, distinct_id: t })) : (x.warn("alias matches current distinct_id - skipping api call."), this.identify(e), -1)) : void 0;
|
|
4181
|
+
}
|
|
4182
|
+
set_config(e) {
|
|
4183
|
+
var t, i, s, n, o = f({}, this.config);
|
|
4184
|
+
N(e) && (H(this.config, Qs(e)), (t = this.persistence) === null || t === void 0 || t.update_config(this.config, o), this.sessionPersistence = this.config.persistence === "sessionStorage" || this.config.persistence === "memory" ? this.persistence : new Ai(f(f({}, this.config), {}, { persistence: "sessionStorage" })), W.is_supported() && W.get("ph_debug") === "true" && (this.config.debug = !0), this.config.debug && (Ie.DEBUG = !0, x.info("set_config", JSON.stringify({ config: e, oldConfig: o, newConfig: f({}, this.config) }, null, 2))), (i = this.sessionRecording) === null || i === void 0 || i.startIfEnabledOrStop(), (s = this.autocapture) === null || s === void 0 || s.startIfEnabled(), (n = this.heatmaps) === null || n === void 0 || n.startIfEnabled(), this.surveys.loadIfEnabled(), this._sync_opt_out_with_persistence());
|
|
4185
|
+
}
|
|
4186
|
+
startSessionRecording(e) {
|
|
4187
|
+
var t = e === !0, i = { sampling: t || !(e == null || !e.sampling), linked_flag: t || !(e == null || !e.linked_flag), url_trigger: t || !(e == null || !e.url_trigger), event_trigger: t || !(e == null || !e.event_trigger) };
|
|
4188
|
+
if (Object.values(i).some(Boolean)) {
|
|
4189
|
+
var s, n, o, a, l;
|
|
4190
|
+
(s = this.sessionManager) === null || s === void 0 || s.checkAndGetSessionAndWindowId(), i.sampling && ((n = this.sessionRecording) === null || n === void 0 || n.overrideSampling()), i.linked_flag && ((o = this.sessionRecording) === null || o === void 0 || o.overrideLinkedFlag()), i.url_trigger && ((a = this.sessionRecording) === null || a === void 0 || a.overrideTrigger("url")), i.event_trigger && ((l = this.sessionRecording) === null || l === void 0 || l.overrideTrigger("event"));
|
|
4191
|
+
}
|
|
4192
|
+
this.set_config({ disable_session_recording: !1 });
|
|
4193
|
+
}
|
|
4194
|
+
stopSessionRecording() {
|
|
4195
|
+
this.set_config({ disable_session_recording: !0 });
|
|
4196
|
+
}
|
|
4197
|
+
sessionRecordingStarted() {
|
|
4198
|
+
var e;
|
|
4199
|
+
return !((e = this.sessionRecording) === null || e === void 0 || !e.started);
|
|
4200
|
+
}
|
|
4201
|
+
captureException(e, t) {
|
|
4202
|
+
var i = new Error("PostHog syntheticException");
|
|
4203
|
+
this.exceptions.sendExceptionEvent(f(f({}, ha(((s) => s instanceof Error)(e) ? { error: e, event: e.message } : { event: e }, { syntheticException: i })), t));
|
|
4204
|
+
}
|
|
4205
|
+
loadToolbar(e) {
|
|
4206
|
+
return this.toolbar.loadToolbar(e);
|
|
4207
|
+
}
|
|
4208
|
+
get_property(e) {
|
|
4209
|
+
var t;
|
|
4210
|
+
return (t = this.persistence) === null || t === void 0 ? void 0 : t.props[e];
|
|
4211
|
+
}
|
|
4212
|
+
getSessionProperty(e) {
|
|
4213
|
+
var t;
|
|
4214
|
+
return (t = this.sessionPersistence) === null || t === void 0 ? void 0 : t.props[e];
|
|
4215
|
+
}
|
|
4216
|
+
toString() {
|
|
4217
|
+
var e, t = (e = this.config.name) !== null && e !== void 0 ? e : rt;
|
|
4218
|
+
return t !== rt && (t = rt + "." + t), t;
|
|
4219
|
+
}
|
|
4220
|
+
_isIdentified() {
|
|
4221
|
+
var e, t;
|
|
4222
|
+
return ((e = this.persistence) === null || e === void 0 ? void 0 : e.get_property(Se)) === "identified" || ((t = this.sessionPersistence) === null || t === void 0 ? void 0 : t.get_property(Se)) === "identified";
|
|
4223
|
+
}
|
|
4224
|
+
_hasPersonProcessing() {
|
|
4225
|
+
var e, t, i, s;
|
|
4226
|
+
return !(this.config.person_profiles === "never" || this.config.person_profiles === "identified_only" && !this._isIdentified() && st(this.getGroups()) && ((e = this.persistence) === null || e === void 0 || (t = e.props) === null || t === void 0 || !t[wt]) && ((i = this.persistence) === null || i === void 0 || (s = i.props) === null || s === void 0 || !s[ii]));
|
|
4227
|
+
}
|
|
4228
|
+
_shouldCapturePageleave() {
|
|
4229
|
+
return this.config.capture_pageleave === !0 || this.config.capture_pageleave === "if_capture_pageview" && this.config.capture_pageview;
|
|
4230
|
+
}
|
|
4231
|
+
createPersonProfile() {
|
|
4232
|
+
this._hasPersonProcessing() || this._requirePersonProcessing("posthog.createPersonProfile") && this.setPersonProperties({}, {});
|
|
4233
|
+
}
|
|
4234
|
+
_requirePersonProcessing(e) {
|
|
4235
|
+
return this.config.person_profiles === "never" ? (x.error(e + ' was called, but process_person is set to "never". This call will be ignored.'), !1) : (this._register_single(ii, !0), !0);
|
|
4236
|
+
}
|
|
4237
|
+
_sync_opt_out_with_persistence() {
|
|
4238
|
+
var e, t, i, s, n = this.consent.isOptedOut(), o = this.config.opt_out_persistence_by_default, a = this.config.disable_persistence || n && !!o;
|
|
4239
|
+
((e = this.persistence) === null || e === void 0 ? void 0 : e.disabled) !== a && ((i = this.persistence) === null || i === void 0 || i.set_disabled(a)), ((t = this.sessionPersistence) === null || t === void 0 ? void 0 : t.disabled) !== a && ((s = this.sessionPersistence) === null || s === void 0 || s.set_disabled(a));
|
|
4240
|
+
}
|
|
4241
|
+
opt_in_capturing(e) {
|
|
4242
|
+
var t;
|
|
4243
|
+
this.consent.optInOut(!0), this._sync_opt_out_with_persistence(), (k(e == null ? void 0 : e.captureEventName) || e != null && e.captureEventName) && this.capture((t = e == null ? void 0 : e.captureEventName) !== null && t !== void 0 ? t : "$opt_in", e == null ? void 0 : e.captureProperties, { send_instantly: !0 }), this.config.capture_pageview && this._captureInitialPageview();
|
|
4244
|
+
}
|
|
4245
|
+
opt_out_capturing() {
|
|
4246
|
+
this.consent.optInOut(!1), this._sync_opt_out_with_persistence();
|
|
4247
|
+
}
|
|
4248
|
+
has_opted_in_capturing() {
|
|
4249
|
+
return this.consent.isOptedIn();
|
|
4250
|
+
}
|
|
4251
|
+
has_opted_out_capturing() {
|
|
4252
|
+
return this.consent.isOptedOut();
|
|
4253
|
+
}
|
|
4254
|
+
clear_opt_in_out_capturing() {
|
|
4255
|
+
this.consent.reset(), this._sync_opt_out_with_persistence();
|
|
4256
|
+
}
|
|
4257
|
+
_is_bot() {
|
|
4258
|
+
return oe ? lo(oe, this.config.custom_blocked_useragents) : void 0;
|
|
4259
|
+
}
|
|
4260
|
+
_captureInitialPageview() {
|
|
4261
|
+
S && !this._initialPageviewCaptured && (this._initialPageviewCaptured = !0, this.capture("$pageview", { title: S.title }, { send_instantly: !0 }));
|
|
4262
|
+
}
|
|
4263
|
+
debug(e) {
|
|
4264
|
+
e === !1 ? (g == null || g.console.log("You've disabled debug mode."), localStorage && localStorage.removeItem("ph_debug"), this.set_config({ debug: !1 })) : (g == null || g.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."), localStorage && localStorage.setItem("ph_debug", "true"), this.set_config({ debug: !0 }));
|
|
4265
|
+
}
|
|
4266
|
+
_runBeforeSend(e) {
|
|
4267
|
+
if (R(this.config.before_send)) return e;
|
|
4268
|
+
var t = q(this.config.before_send) ? this.config.before_send : [this.config.before_send], i = e;
|
|
4269
|
+
for (var s of t) {
|
|
4270
|
+
if (i = s(i), R(i)) {
|
|
4271
|
+
var n = "Event '".concat(e.event, "' was rejected in beforeSend function");
|
|
4272
|
+
return So(e.event) ? x.warn("".concat(n, ". This can cause unexpected behavior.")) : x.info(n), null;
|
|
4273
|
+
}
|
|
4274
|
+
i.properties && !st(i.properties) || x.warn("Event '".concat(e.event, "' has no properties after beforeSend function, this is likely an error."));
|
|
4275
|
+
}
|
|
4276
|
+
return i;
|
|
4277
|
+
}
|
|
4278
|
+
getPageViewId() {
|
|
4279
|
+
var e;
|
|
4280
|
+
return (e = this.pageViewManager._currentPageview) === null || e === void 0 ? void 0 : e.pageViewId;
|
|
4281
|
+
}
|
|
4282
|
+
captureTraceFeedback(e, t) {
|
|
4283
|
+
this.capture("$ai_feedback", { $ai_trace_id: String(e), $ai_feedback_text: t });
|
|
4284
|
+
}
|
|
4285
|
+
captureTraceMetric(e, t, i) {
|
|
4286
|
+
this.capture("$ai_metric", { $ai_trace_id: String(e), $ai_metric_name: t, $ai_metric_value: String(i) });
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
(function(r, e) {
|
|
4290
|
+
for (var t = 0; t < e.length; t++) r.prototype[e[t]] = xo(r.prototype[e[t]]);
|
|
4291
|
+
})(vi, ["identify"]);
|
|
4292
|
+
var Zs;
|
|
4293
|
+
Zs = Tt[rt] = new vi(), function() {
|
|
4294
|
+
function r() {
|
|
4295
|
+
r.done || (r.done = !0, uo = !1, $(Tt, function(e) {
|
|
4296
|
+
e._dom_loaded();
|
|
4297
|
+
}));
|
|
4298
|
+
}
|
|
4299
|
+
S != null && S.addEventListener ? S.readyState === "complete" ? r() : U(S, "DOMContentLoaded", r, { capture: !1 }) : g && x.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized");
|
|
4300
|
+
}();
|
|
4301
|
+
var Xs;
|
|
4302
|
+
(function(r) {
|
|
4303
|
+
r.USER_ADDED_TO_CART = "user_added_to_cart", r.USER_SUBMITTED_CHECKOUT = "user_submitted_checkout";
|
|
4304
|
+
})(Xs || (Xs = {}));
|
|
4305
|
+
const xl = { class: "dialog-block-header-container" }, Il = { class: "dialog-block-title" }, Cl = { class: "dialog-block-description" }, Pl = /* @__PURE__ */ vt({
|
|
4306
|
+
__name: "DialogBlockHeader",
|
|
4307
|
+
props: {
|
|
4308
|
+
title: {},
|
|
4309
|
+
description: {}
|
|
4310
|
+
},
|
|
4311
|
+
setup(r) {
|
|
4312
|
+
const e = r;
|
|
4313
|
+
return (t, i) => (Ce(), ct("div", xl, [
|
|
4314
|
+
ne("div", Il, Ni(e.title ?? "Your expert"), 1),
|
|
4315
|
+
ne("div", Cl, Ni(e.description ?? "A question about this product?"), 1)
|
|
4316
|
+
]));
|
|
4317
|
+
}
|
|
4318
|
+
}), Dt = (r, e) => {
|
|
4319
|
+
const t = r.__vccOpts || r;
|
|
4320
|
+
for (const [i, s] of e)
|
|
4321
|
+
t[i] = s;
|
|
4322
|
+
return t;
|
|
4323
|
+
}, Fl = /* @__PURE__ */ Dt(Pl, [["__scopeId", "data-v-260a102d"]]), Tl = {
|
|
4324
|
+
width: "20",
|
|
4325
|
+
height: "20",
|
|
4326
|
+
viewBox: "0 0 20 20",
|
|
4327
|
+
fill: "none",
|
|
4328
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4329
|
+
}, Rl = { "clip-path": "url(#clip0_466_934)" }, $l = ["stroke"], Ol = ["stroke"], Ll = /* @__PURE__ */ vt({
|
|
4330
|
+
__name: "AiStarsIcon",
|
|
4331
|
+
props: {
|
|
4332
|
+
color: {}
|
|
4333
|
+
},
|
|
4334
|
+
setup(r) {
|
|
4335
|
+
const e = r;
|
|
4336
|
+
return (t, i) => (Ce(), ct("svg", Tl, [
|
|
4337
|
+
ne("g", Rl, [
|
|
4338
|
+
ne("path", {
|
|
4339
|
+
d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
|
|
4340
|
+
12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
|
|
4341
|
+
13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
|
|
4342
|
+
15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232
|
|
4343
|
+
16.3622 6.2917 16.5834 6.07046 17.0259L5.41675 18.3333L4.76303 17.0259C4.54179
|
|
4344
|
+
16.5834 4.43117 16.3622 4.28339 16.1704C4.15225 16.0003 3.99974 15.8478 3.82962
|
|
4345
|
+
15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418
|
|
4346
|
+
13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225
|
|
4347
|
+
13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675
|
|
4348
|
+
10.8333Z`,
|
|
4349
|
+
stroke: e.color || "#181825",
|
|
4350
|
+
"stroke-width": "1.5",
|
|
4351
|
+
"stroke-linecap": "round",
|
|
4352
|
+
"stroke-linejoin": "round"
|
|
4353
|
+
}, null, 8, $l),
|
|
4354
|
+
ne("path", {
|
|
4355
|
+
d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
|
|
4356
|
+
5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
|
|
4357
|
+
6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
|
|
4358
|
+
8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348
|
|
4359
|
+
9.8631 13.7173 10.1686 13.4823 10.7796L12.5001 13.3333L11.5179 10.7796C11.2829
|
|
4360
|
+
10.1686 11.1654 9.8631 10.9827 9.60612C10.8207 9.37836 10.6217 9.17937 10.3939
|
|
4361
|
+
9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043
|
|
4362
|
+
6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207
|
|
4363
|
+
5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001
|
|
4364
|
+
1.66666Z`,
|
|
4365
|
+
stroke: e.color || "#181825",
|
|
4366
|
+
"stroke-width": "1.5",
|
|
4367
|
+
"stroke-linecap": "round",
|
|
4368
|
+
"stroke-linejoin": "round"
|
|
4369
|
+
}, null, 8, Ol)
|
|
4370
|
+
]),
|
|
4371
|
+
i[0] || (i[0] = ne("defs", null, [
|
|
4372
|
+
ne("clipPath", { id: "clip0_466_934" }, [
|
|
4373
|
+
ne("rect", {
|
|
4374
|
+
width: "20",
|
|
4375
|
+
height: "20",
|
|
4376
|
+
fill: "white"
|
|
4377
|
+
})
|
|
4378
|
+
])
|
|
4379
|
+
], -1))
|
|
4380
|
+
]));
|
|
4381
|
+
}
|
|
4382
|
+
}), Ml = ["onClick"], Al = { class: "dialog-block-suggestions-item-label" }, Dl = /* @__PURE__ */ vt({
|
|
4383
|
+
__name: "DialogBlockSuggestions",
|
|
4384
|
+
props: {
|
|
4385
|
+
client: {},
|
|
4386
|
+
questions: {},
|
|
4387
|
+
productId: {},
|
|
4388
|
+
productTitle: {},
|
|
4389
|
+
selectedVariantId: {}
|
|
4390
|
+
},
|
|
4391
|
+
setup(r) {
|
|
4392
|
+
const e = r, t = (i) => {
|
|
4393
|
+
e.client.sendProductMessage({
|
|
4394
|
+
productId: e.productId,
|
|
4395
|
+
productTitle: e.productTitle,
|
|
4396
|
+
selectedVariantId: e.selectedVariantId,
|
|
4397
|
+
question: i,
|
|
4398
|
+
fromQuestionSuggestion: !0
|
|
4399
|
+
});
|
|
4400
|
+
};
|
|
4401
|
+
return (i, s) => (Ce(!0), ct(en, null, go(e.questions, (n) => (Ce(), ct("button", {
|
|
4402
|
+
key: n.question,
|
|
4403
|
+
class: "dialog-block-suggestions-item",
|
|
4404
|
+
onClick: (o) => t(n.question)
|
|
4405
|
+
}, [
|
|
4406
|
+
Bi(Ll, {
|
|
4407
|
+
class: "dialog-block-suggestions-item-icon",
|
|
4408
|
+
color: e.client.theme.primaryColor
|
|
4409
|
+
}, null, 8, ["color"]),
|
|
4410
|
+
ne("span", Al, Ni(n.question), 1)
|
|
4411
|
+
], 8, Ml))), 128));
|
|
4412
|
+
}
|
|
4413
|
+
}), ql = /* @__PURE__ */ Dt(Dl, [["__scopeId", "data-v-7c92730d"]]), Nl = {};
|
|
4414
|
+
function Bl(r, e) {
|
|
4415
|
+
return Ce(), ct(en, null, [
|
|
4416
|
+
e[0] || (e[0] = ne("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
|
|
4417
|
+
e[1] || (e[1] = ne("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
|
|
4418
|
+
e[2] || (e[2] = ne("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
|
|
4419
|
+
], 64);
|
|
4420
|
+
}
|
|
4421
|
+
const Hl = /* @__PURE__ */ Dt(Nl, [["render", Bl], ["__scopeId", "data-v-26a64b58"]]), Ul = { class: "dialog-block-suggestions-container" }, jl = /* @__PURE__ */ vt({
|
|
4422
|
+
__name: "DialogBlockSuggestionsContainer",
|
|
4423
|
+
props: {
|
|
4424
|
+
client: {},
|
|
4425
|
+
questions: {},
|
|
4426
|
+
isLoading: { type: Boolean },
|
|
4427
|
+
productId: {},
|
|
4428
|
+
productTitle: {},
|
|
4429
|
+
selectedVariantId: {}
|
|
4430
|
+
},
|
|
4431
|
+
setup(r) {
|
|
4432
|
+
const e = r;
|
|
4433
|
+
return (t, i) => (Ce(), ct("div", Ul, [
|
|
4434
|
+
e.isLoading || !e.questions ? (Ce(), Hi(Hl, { key: 0 })) : (Ce(), Hi(ql, {
|
|
4435
|
+
key: 1,
|
|
4436
|
+
client: e.client,
|
|
4437
|
+
questions: e.questions,
|
|
4438
|
+
"product-id": e.productId,
|
|
4439
|
+
"product-title": e.productTitle,
|
|
4440
|
+
"selected-variant-id": e.selectedVariantId
|
|
4441
|
+
}, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
|
|
4442
|
+
]));
|
|
4443
|
+
}
|
|
4444
|
+
}), zl = /* @__PURE__ */ Dt(jl, [["__scopeId", "data-v-402900df"]]), Wl = /* @__PURE__ */ vt({
|
|
4445
|
+
__name: "ThemeProvider",
|
|
4446
|
+
props: {
|
|
4447
|
+
theme: {}
|
|
4448
|
+
},
|
|
4449
|
+
setup(r) {
|
|
4450
|
+
const e = r, t = document.body, i = (n) => n.replace(/([A-Z])/g, "-$1").toLowerCase(), s = (n) => {
|
|
4451
|
+
n && Object.keys(n).forEach((o) => {
|
|
4452
|
+
const a = o, l = i(o);
|
|
4453
|
+
n[a] !== void 0 && t.style.setProperty(
|
|
4454
|
+
`--dialog-theme-${l}`,
|
|
4455
|
+
n[a].toString()
|
|
4456
|
+
);
|
|
4457
|
+
});
|
|
4458
|
+
};
|
|
4459
|
+
return tn(() => {
|
|
4460
|
+
e.theme && s(e.theme);
|
|
4461
|
+
}), vo(
|
|
4462
|
+
() => e.theme,
|
|
4463
|
+
(n) => {
|
|
4464
|
+
n && s(n);
|
|
4465
|
+
},
|
|
4466
|
+
{ deep: !0 }
|
|
4467
|
+
), (n, o) => fo(n.$slots, "default");
|
|
4468
|
+
}
|
|
4469
|
+
}), Vl = { class: "dialog-block-container" }, Gl = /* @__PURE__ */ vt({
|
|
4470
|
+
__name: "DialogProductBlock",
|
|
4471
|
+
props: {
|
|
4472
|
+
client: {},
|
|
4473
|
+
productId: {},
|
|
4474
|
+
productTitle: {},
|
|
4475
|
+
selectedVariantId: {}
|
|
4476
|
+
},
|
|
4477
|
+
setup(r) {
|
|
4478
|
+
const e = r, t = Ar(!0), i = Ar(void 0), s = Dr(() => {
|
|
4479
|
+
var a;
|
|
4480
|
+
return (a = i.value) == null ? void 0 : a.assistantName;
|
|
4481
|
+
}), n = Dr(() => {
|
|
4482
|
+
var a;
|
|
4483
|
+
return (a = i.value) == null ? void 0 : a.description;
|
|
4484
|
+
}), o = async () => {
|
|
4485
|
+
try {
|
|
4486
|
+
const a = await e.client.getSuggestions(e.productId);
|
|
4487
|
+
i.value = a, t.value = !1;
|
|
4488
|
+
} catch (a) {
|
|
4489
|
+
console.error("error", a);
|
|
4490
|
+
}
|
|
4491
|
+
};
|
|
4492
|
+
return tn(async () => {
|
|
4493
|
+
await o();
|
|
4494
|
+
}), (a, l) => (Ce(), Hi(Wl, {
|
|
4495
|
+
theme: e.client.theme
|
|
4496
|
+
}, {
|
|
4497
|
+
default: mo(() => {
|
|
4498
|
+
var c;
|
|
4499
|
+
return [
|
|
4500
|
+
ne("div", Vl, [
|
|
4501
|
+
Bi(Fl, {
|
|
4502
|
+
title: s.value,
|
|
4503
|
+
description: n.value
|
|
4504
|
+
}, null, 8, ["title", "description"]),
|
|
4505
|
+
Bi(zl, {
|
|
4506
|
+
client: e.client,
|
|
4507
|
+
questions: (c = i.value) == null ? void 0 : c.questions,
|
|
4508
|
+
"is-loading": t.value,
|
|
4509
|
+
"product-id": e.productId,
|
|
4510
|
+
"product-title": e.productTitle,
|
|
4511
|
+
"selected-variant-id": e == null ? void 0 : e.selectedVariantId
|
|
4512
|
+
}, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"])
|
|
4513
|
+
])
|
|
4514
|
+
];
|
|
4515
|
+
}),
|
|
4516
|
+
_: 1
|
|
4517
|
+
}, 8, ["theme"]));
|
|
4518
|
+
}
|
|
4519
|
+
}), Yl = /* @__PURE__ */ Dt(Gl, [["__scopeId", "data-v-7b38f871"]]);
|
|
4520
|
+
export {
|
|
4521
|
+
Yl as DialogProductBlock
|
|
4522
|
+
};
|