mem0ai 1.0.39 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -333
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4474 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -92
- package/dist/index.mjs.map +1 -1
- package/dist/module-QI3FML2A.mjs +4314 -0
- package/dist/module-QI3FML2A.mjs.map +1 -0
- package/dist/oss/index.d.mts +421 -0
- package/dist/oss/index.d.ts +421 -0
- package/dist/oss/index.js +1726 -0
- package/dist/oss/index.js.map +1 -0
- package/dist/oss/index.mjs +1677 -0
- package/dist/oss/index.mjs.map +1 -0
- package/package.json +109 -77
|
@@ -0,0 +1,4314 @@
|
|
|
1
|
+
// node_modules/.pnpm/posthog-js@1.224.1_@rrweb+types@2.0.0-alpha.17/node_modules/posthog-js/dist/module.js
|
|
2
|
+
var e;
|
|
3
|
+
var t = "undefined" != typeof window ? window : void 0;
|
|
4
|
+
var i = "undefined" != typeof globalThis ? globalThis : t;
|
|
5
|
+
var r = Array.prototype;
|
|
6
|
+
var s = r.forEach;
|
|
7
|
+
var n = r.indexOf;
|
|
8
|
+
var o = null == i ? void 0 : i.navigator;
|
|
9
|
+
var a = null == i ? void 0 : i.document;
|
|
10
|
+
var l = null == i ? void 0 : i.location;
|
|
11
|
+
var c = null == i ? void 0 : i.fetch;
|
|
12
|
+
var u = null != i && i.XMLHttpRequest && "withCredentials" in new i.XMLHttpRequest() ? i.XMLHttpRequest : void 0;
|
|
13
|
+
var d = null == i ? void 0 : i.AbortController;
|
|
14
|
+
var h = null == o ? void 0 : o.userAgent;
|
|
15
|
+
var _ = null != t ? t : {};
|
|
16
|
+
var p = { DEBUG: false, LIB_VERSION: "1.224.1" };
|
|
17
|
+
var g = "$copy_autocapture";
|
|
18
|
+
var v = ["$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"];
|
|
19
|
+
!function(e2) {
|
|
20
|
+
e2.GZipJS = "gzip-js", e2.Base64 = "base64";
|
|
21
|
+
}(e || (e = {}));
|
|
22
|
+
var f = ["fatal", "error", "warning", "log", "info", "debug"];
|
|
23
|
+
function m(e2, t2) {
|
|
24
|
+
return -1 !== e2.indexOf(t2);
|
|
25
|
+
}
|
|
26
|
+
var y = function(e2) {
|
|
27
|
+
return e2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
28
|
+
};
|
|
29
|
+
var b = function(e2) {
|
|
30
|
+
return e2.replace(/^\$/, "");
|
|
31
|
+
};
|
|
32
|
+
var w = Array.isArray;
|
|
33
|
+
var S = Object.prototype;
|
|
34
|
+
var k = S.hasOwnProperty;
|
|
35
|
+
var E = S.toString;
|
|
36
|
+
var x = w || function(e2) {
|
|
37
|
+
return "[object Array]" === E.call(e2);
|
|
38
|
+
};
|
|
39
|
+
var I = (e2) => "function" == typeof e2;
|
|
40
|
+
var P = (e2) => e2 === Object(e2) && !x(e2);
|
|
41
|
+
var C = (e2) => {
|
|
42
|
+
if (P(e2)) {
|
|
43
|
+
for (var t2 in e2) if (k.call(e2, t2)) return false;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
};
|
|
48
|
+
var F = (e2) => void 0 === e2;
|
|
49
|
+
var R = (e2) => "[object String]" == E.call(e2);
|
|
50
|
+
var T = (e2) => R(e2) && 0 === e2.trim().length;
|
|
51
|
+
var $ = (e2) => null === e2;
|
|
52
|
+
var O = (e2) => F(e2) || $(e2);
|
|
53
|
+
var M = (e2) => "[object Number]" == E.call(e2);
|
|
54
|
+
var A = (e2) => "[object Boolean]" === E.call(e2);
|
|
55
|
+
var L = (e2) => e2 instanceof FormData;
|
|
56
|
+
var D = (e2) => e2 instanceof Error;
|
|
57
|
+
var q = (e2) => m(v, e2);
|
|
58
|
+
var N = (e2) => {
|
|
59
|
+
var i2 = { _log: function(i3) {
|
|
60
|
+
if (t && (p.DEBUG || _.POSTHOG_DEBUG) && !F(t.console) && t.console) {
|
|
61
|
+
for (var r2 = ("__rrweb_original__" in t.console[i3]) ? t.console[i3].__rrweb_original__ : t.console[i3], s2 = arguments.length, n2 = new Array(s2 > 1 ? s2 - 1 : 0), o2 = 1; o2 < s2; o2++) n2[o2 - 1] = arguments[o2];
|
|
62
|
+
r2(e2, ...n2);
|
|
63
|
+
}
|
|
64
|
+
}, info: function() {
|
|
65
|
+
for (var e3 = arguments.length, t2 = new Array(e3), r2 = 0; r2 < e3; r2++) t2[r2] = arguments[r2];
|
|
66
|
+
i2._log("log", ...t2);
|
|
67
|
+
}, warn: function() {
|
|
68
|
+
for (var e3 = arguments.length, t2 = new Array(e3), r2 = 0; r2 < e3; r2++) t2[r2] = arguments[r2];
|
|
69
|
+
i2._log("warn", ...t2);
|
|
70
|
+
}, error: function() {
|
|
71
|
+
for (var e3 = arguments.length, t2 = new Array(e3), r2 = 0; r2 < e3; r2++) t2[r2] = arguments[r2];
|
|
72
|
+
i2._log("error", ...t2);
|
|
73
|
+
}, critical: function() {
|
|
74
|
+
for (var t2 = arguments.length, i3 = new Array(t2), r2 = 0; r2 < t2; r2++) i3[r2] = arguments[r2];
|
|
75
|
+
console.error(e2, ...i3);
|
|
76
|
+
}, uninitializedWarning: (e3) => {
|
|
77
|
+
i2.error("You must initialize PostHog before calling ".concat(e3));
|
|
78
|
+
}, createLogger: (t2) => N("".concat(e2, " ").concat(t2)) };
|
|
79
|
+
return i2;
|
|
80
|
+
};
|
|
81
|
+
var B = N("[PostHog.js]");
|
|
82
|
+
var H = B.createLogger;
|
|
83
|
+
var U = H("[ExternalScriptsLoader]");
|
|
84
|
+
var z = (e2, t2, i2) => {
|
|
85
|
+
if (e2.config.disable_external_dependency_loading) return U.warn("".concat(t2, " was requested but loading of external scripts is disabled.")), i2("Loading of external scripts is disabled");
|
|
86
|
+
var r2 = () => {
|
|
87
|
+
if (!a) return i2("document not found");
|
|
88
|
+
var r3 = a.createElement("script");
|
|
89
|
+
if (r3.type = "text/javascript", r3.crossOrigin = "anonymous", r3.src = t2, r3.onload = (e3) => i2(void 0, e3), r3.onerror = (e3) => i2(e3), e2.config.prepare_external_dependency_script && (r3 = e2.config.prepare_external_dependency_script(r3)), !r3) return i2("prepare_external_dependency_script returned null");
|
|
90
|
+
var s2, n2 = a.querySelectorAll("body > script");
|
|
91
|
+
n2.length > 0 ? null === (s2 = n2[0].parentNode) || void 0 === s2 || s2.insertBefore(r3, n2[0]) : a.body.appendChild(r3);
|
|
92
|
+
};
|
|
93
|
+
null != a && a.body ? r2() : null == a || a.addEventListener("DOMContentLoaded", r2);
|
|
94
|
+
};
|
|
95
|
+
function j(e2, t2) {
|
|
96
|
+
var i2 = Object.keys(e2);
|
|
97
|
+
if (Object.getOwnPropertySymbols) {
|
|
98
|
+
var r2 = Object.getOwnPropertySymbols(e2);
|
|
99
|
+
t2 && (r2 = r2.filter(function(t3) {
|
|
100
|
+
return Object.getOwnPropertyDescriptor(e2, t3).enumerable;
|
|
101
|
+
})), i2.push.apply(i2, r2);
|
|
102
|
+
}
|
|
103
|
+
return i2;
|
|
104
|
+
}
|
|
105
|
+
function W(e2) {
|
|
106
|
+
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
107
|
+
var i2 = null != arguments[t2] ? arguments[t2] : {};
|
|
108
|
+
t2 % 2 ? j(Object(i2), true).forEach(function(t3) {
|
|
109
|
+
V(e2, t3, i2[t3]);
|
|
110
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(i2)) : j(Object(i2)).forEach(function(t3) {
|
|
111
|
+
Object.defineProperty(e2, t3, Object.getOwnPropertyDescriptor(i2, t3));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return e2;
|
|
115
|
+
}
|
|
116
|
+
function V(e2, t2, i2) {
|
|
117
|
+
return t2 in e2 ? Object.defineProperty(e2, t2, { value: i2, enumerable: true, configurable: true, writable: true }) : e2[t2] = i2, e2;
|
|
118
|
+
}
|
|
119
|
+
function G(e2, t2) {
|
|
120
|
+
if (null == e2) return {};
|
|
121
|
+
var i2, r2, s2 = function(e3, t3) {
|
|
122
|
+
if (null == e3) return {};
|
|
123
|
+
var i3, r3, s3 = {}, n3 = Object.keys(e3);
|
|
124
|
+
for (r3 = 0; r3 < n3.length; r3++) i3 = n3[r3], t3.indexOf(i3) >= 0 || (s3[i3] = e3[i3]);
|
|
125
|
+
return s3;
|
|
126
|
+
}(e2, t2);
|
|
127
|
+
if (Object.getOwnPropertySymbols) {
|
|
128
|
+
var n2 = Object.getOwnPropertySymbols(e2);
|
|
129
|
+
for (r2 = 0; r2 < n2.length; r2++) i2 = n2[r2], t2.indexOf(i2) >= 0 || Object.prototype.propertyIsEnumerable.call(e2, i2) && (s2[i2] = e2[i2]);
|
|
130
|
+
}
|
|
131
|
+
return s2;
|
|
132
|
+
}
|
|
133
|
+
_.__PosthogExtensions__ = _.__PosthogExtensions__ || {}, _.__PosthogExtensions__.loadExternalDependency = (e2, t2, i2) => {
|
|
134
|
+
var r2 = "/static/".concat(t2, ".js") + "?v=".concat(e2.version);
|
|
135
|
+
if ("remote-config" === t2 && (r2 = "/array/".concat(e2.config.token, "/config.js")), "toolbar" === t2) {
|
|
136
|
+
var s2 = 3e5, n2 = Math.floor(Date.now() / s2) * s2;
|
|
137
|
+
r2 = "".concat(r2, "&t=").concat(n2);
|
|
138
|
+
}
|
|
139
|
+
var o2 = e2.requestRouter.endpointFor("assets", r2);
|
|
140
|
+
z(e2, o2, i2);
|
|
141
|
+
}, _.__PosthogExtensions__.loadSiteApp = (e2, t2, i2) => {
|
|
142
|
+
var r2 = e2.requestRouter.endpointFor("api", t2);
|
|
143
|
+
z(e2, r2, i2);
|
|
144
|
+
};
|
|
145
|
+
var J = {};
|
|
146
|
+
function Y(e2, t2, i2) {
|
|
147
|
+
if (x(e2)) {
|
|
148
|
+
if (s && e2.forEach === s) e2.forEach(t2, i2);
|
|
149
|
+
else if ("length" in e2 && e2.length === +e2.length) {
|
|
150
|
+
for (var r2 = 0, n2 = e2.length; r2 < n2; r2++) if (r2 in e2 && t2.call(i2, e2[r2], r2) === J) return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function K(e2, t2, i2) {
|
|
155
|
+
if (!O(e2)) {
|
|
156
|
+
if (x(e2)) return Y(e2, t2, i2);
|
|
157
|
+
if (L(e2)) {
|
|
158
|
+
for (var r2 of e2.entries()) if (t2.call(i2, r2[1], r2[0]) === J) return;
|
|
159
|
+
} else for (var s2 in e2) if (k.call(e2, s2) && t2.call(i2, e2[s2], s2) === J) return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
var X = function(e2) {
|
|
163
|
+
for (var t2 = arguments.length, i2 = new Array(t2 > 1 ? t2 - 1 : 0), r2 = 1; r2 < t2; r2++) i2[r2 - 1] = arguments[r2];
|
|
164
|
+
return Y(i2, function(t3) {
|
|
165
|
+
for (var i3 in t3) void 0 !== t3[i3] && (e2[i3] = t3[i3]);
|
|
166
|
+
}), e2;
|
|
167
|
+
};
|
|
168
|
+
var Q = function(e2) {
|
|
169
|
+
for (var t2 = arguments.length, i2 = new Array(t2 > 1 ? t2 - 1 : 0), r2 = 1; r2 < t2; r2++) i2[r2 - 1] = arguments[r2];
|
|
170
|
+
return Y(i2, function(t3) {
|
|
171
|
+
Y(t3, function(t4) {
|
|
172
|
+
e2.push(t4);
|
|
173
|
+
});
|
|
174
|
+
}), e2;
|
|
175
|
+
};
|
|
176
|
+
function Z(e2) {
|
|
177
|
+
for (var t2 = Object.keys(e2), i2 = t2.length, r2 = new Array(i2); i2--; ) r2[i2] = [t2[i2], e2[t2[i2]]];
|
|
178
|
+
return r2;
|
|
179
|
+
}
|
|
180
|
+
var ee = function(e2) {
|
|
181
|
+
try {
|
|
182
|
+
return e2();
|
|
183
|
+
} catch (e3) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
var te = function(e2) {
|
|
188
|
+
return function() {
|
|
189
|
+
try {
|
|
190
|
+
for (var t2 = arguments.length, i2 = new Array(t2), r2 = 0; r2 < t2; r2++) i2[r2] = arguments[r2];
|
|
191
|
+
return e2.apply(this, i2);
|
|
192
|
+
} catch (e3) {
|
|
193
|
+
B.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."), B.critical(e3);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
var ie = function(e2) {
|
|
198
|
+
var t2 = {};
|
|
199
|
+
return K(e2, function(e3, i2) {
|
|
200
|
+
R(e3) && e3.length > 0 && (t2[i2] = e3);
|
|
201
|
+
}), t2;
|
|
202
|
+
};
|
|
203
|
+
function re(e2, t2) {
|
|
204
|
+
return i2 = e2, r2 = (e3) => R(e3) && !$(t2) ? e3.slice(0, t2) : e3, s2 = /* @__PURE__ */ new Set(), function e3(t3, i3) {
|
|
205
|
+
return t3 !== Object(t3) ? r2 ? r2(t3, i3) : t3 : s2.has(t3) ? void 0 : (s2.add(t3), x(t3) ? (n2 = [], Y(t3, (t4) => {
|
|
206
|
+
n2.push(e3(t4));
|
|
207
|
+
})) : (n2 = {}, K(t3, (t4, i4) => {
|
|
208
|
+
s2.has(t4) || (n2[i4] = e3(t4, i4));
|
|
209
|
+
})), n2);
|
|
210
|
+
var n2;
|
|
211
|
+
}(i2);
|
|
212
|
+
var i2, r2, s2;
|
|
213
|
+
}
|
|
214
|
+
var se = ["herokuapp.com", "vercel.app", "netlify.app"];
|
|
215
|
+
function ne(e2) {
|
|
216
|
+
var t2 = null == e2 ? void 0 : e2.hostname;
|
|
217
|
+
if (!R(t2)) return false;
|
|
218
|
+
var i2 = t2.split(".").slice(-2).join(".");
|
|
219
|
+
for (var r2 of se) if (i2 === r2) return false;
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
function oe(e2, t2) {
|
|
223
|
+
for (var i2 = 0; i2 < e2.length; i2++) if (t2(e2[i2])) return e2[i2];
|
|
224
|
+
}
|
|
225
|
+
function ae(e2, t2, i2, r2) {
|
|
226
|
+
var { capture: s2 = false, passive: n2 = true } = null != r2 ? r2 : {};
|
|
227
|
+
null == e2 || e2.addEventListener(t2, i2, { capture: s2, passive: n2 });
|
|
228
|
+
}
|
|
229
|
+
var le = "$people_distinct_id";
|
|
230
|
+
var ce = "__alias";
|
|
231
|
+
var ue = "__timers";
|
|
232
|
+
var de = "$autocapture_disabled_server_side";
|
|
233
|
+
var he = "$heatmaps_enabled_server_side";
|
|
234
|
+
var _e = "$exception_capture_enabled_server_side";
|
|
235
|
+
var pe = "$web_vitals_enabled_server_side";
|
|
236
|
+
var ge = "$dead_clicks_enabled_server_side";
|
|
237
|
+
var ve = "$web_vitals_allowed_metrics";
|
|
238
|
+
var fe = "$session_recording_enabled_server_side";
|
|
239
|
+
var me = "$console_log_recording_enabled_server_side";
|
|
240
|
+
var ye = "$session_recording_network_payload_capture";
|
|
241
|
+
var be = "$session_recording_canvas_recording";
|
|
242
|
+
var we = "$replay_sample_rate";
|
|
243
|
+
var Se = "$replay_minimum_duration";
|
|
244
|
+
var ke = "$replay_script_config";
|
|
245
|
+
var Ee = "$sesid";
|
|
246
|
+
var xe = "$session_is_sampled";
|
|
247
|
+
var Ie = "$session_recording_url_trigger_activated_session";
|
|
248
|
+
var Pe = "$session_recording_event_trigger_activated_session";
|
|
249
|
+
var Ce = "$enabled_feature_flags";
|
|
250
|
+
var Fe = "$early_access_features";
|
|
251
|
+
var Re = "$stored_person_properties";
|
|
252
|
+
var Te = "$stored_group_properties";
|
|
253
|
+
var $e = "$surveys";
|
|
254
|
+
var Oe = "$surveys_activated";
|
|
255
|
+
var Me = "$flag_call_reported";
|
|
256
|
+
var Ae = "$user_state";
|
|
257
|
+
var Le = "$client_session_props";
|
|
258
|
+
var De = "$capture_rate_limit";
|
|
259
|
+
var qe = "$initial_campaign_params";
|
|
260
|
+
var Ne = "$initial_referrer_info";
|
|
261
|
+
var Be = "$initial_person_info";
|
|
262
|
+
var He = "$epp";
|
|
263
|
+
var Ue = "__POSTHOG_TOOLBAR__";
|
|
264
|
+
var ze = "$posthog_cookieless";
|
|
265
|
+
var je = [le, ce, "__cmpns", ue, fe, he, Ee, Ce, Ae, Fe, Te, Re, $e, Me, Le, De, qe, Ne, He];
|
|
266
|
+
function We(e2) {
|
|
267
|
+
var t2;
|
|
268
|
+
return e2 instanceof Element && (e2.id === Ue || !(null === (t2 = e2.closest) || void 0 === t2 || !t2.call(e2, ".toolbar-global-fade-container")));
|
|
269
|
+
}
|
|
270
|
+
function Ve(e2) {
|
|
271
|
+
return !!e2 && 1 === e2.nodeType;
|
|
272
|
+
}
|
|
273
|
+
function Ge(e2, t2) {
|
|
274
|
+
return !!e2 && !!e2.tagName && e2.tagName.toLowerCase() === t2.toLowerCase();
|
|
275
|
+
}
|
|
276
|
+
function Je(e2) {
|
|
277
|
+
return !!e2 && 3 === e2.nodeType;
|
|
278
|
+
}
|
|
279
|
+
function Ye(e2) {
|
|
280
|
+
return !!e2 && 11 === e2.nodeType;
|
|
281
|
+
}
|
|
282
|
+
function Ke(e2) {
|
|
283
|
+
return e2 ? y(e2).split(/\s+/) : [];
|
|
284
|
+
}
|
|
285
|
+
function Xe(e2) {
|
|
286
|
+
var i2 = null == t ? void 0 : t.location.href;
|
|
287
|
+
return !!(i2 && e2 && e2.some((e3) => i2.match(e3)));
|
|
288
|
+
}
|
|
289
|
+
function Qe(e2) {
|
|
290
|
+
var t2 = "";
|
|
291
|
+
switch (typeof e2.className) {
|
|
292
|
+
case "string":
|
|
293
|
+
t2 = e2.className;
|
|
294
|
+
break;
|
|
295
|
+
case "object":
|
|
296
|
+
t2 = (e2.className && "baseVal" in e2.className ? e2.className.baseVal : null) || e2.getAttribute("class") || "";
|
|
297
|
+
break;
|
|
298
|
+
default:
|
|
299
|
+
t2 = "";
|
|
300
|
+
}
|
|
301
|
+
return Ke(t2);
|
|
302
|
+
}
|
|
303
|
+
function Ze(e2) {
|
|
304
|
+
return O(e2) ? null : y(e2).split(/(\s+)/).filter((e3) => _t(e3)).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255);
|
|
305
|
+
}
|
|
306
|
+
function et(e2) {
|
|
307
|
+
var t2 = "";
|
|
308
|
+
return nt(e2) && !ot(e2) && e2.childNodes && e2.childNodes.length && K(e2.childNodes, function(e3) {
|
|
309
|
+
var i2;
|
|
310
|
+
Je(e3) && e3.textContent && (t2 += null !== (i2 = Ze(e3.textContent)) && void 0 !== i2 ? i2 : "");
|
|
311
|
+
}), y(t2);
|
|
312
|
+
}
|
|
313
|
+
function tt(e2) {
|
|
314
|
+
return F(e2.target) ? e2.srcElement || null : null !== (t2 = e2.target) && void 0 !== t2 && t2.shadowRoot ? e2.composedPath()[0] || null : e2.target || null;
|
|
315
|
+
var t2;
|
|
316
|
+
}
|
|
317
|
+
var it = ["a", "button", "form", "input", "select", "textarea", "label"];
|
|
318
|
+
function rt(e2) {
|
|
319
|
+
var t2 = e2.parentNode;
|
|
320
|
+
return !(!t2 || !Ve(t2)) && t2;
|
|
321
|
+
}
|
|
322
|
+
function st(e2, i2) {
|
|
323
|
+
var r2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0, s2 = arguments.length > 3 ? arguments[3] : void 0, n2 = arguments.length > 4 ? arguments[4] : void 0;
|
|
324
|
+
if (!t || !e2 || Ge(e2, "html") || !Ve(e2)) return false;
|
|
325
|
+
if (null != r2 && r2.url_allowlist && !Xe(r2.url_allowlist)) return false;
|
|
326
|
+
if (null != r2 && r2.url_ignorelist && Xe(r2.url_ignorelist)) return false;
|
|
327
|
+
if (null != r2 && r2.dom_event_allowlist) {
|
|
328
|
+
var o2 = r2.dom_event_allowlist;
|
|
329
|
+
if (o2 && !o2.some((e3) => i2.type === e3)) return false;
|
|
330
|
+
}
|
|
331
|
+
for (var a2 = false, l2 = [e2], c2 = true, u2 = e2; u2.parentNode && !Ge(u2, "body"); ) if (Ye(u2.parentNode)) l2.push(u2.parentNode.host), u2 = u2.parentNode.host;
|
|
332
|
+
else {
|
|
333
|
+
if (!(c2 = rt(u2))) break;
|
|
334
|
+
if (s2 || it.indexOf(c2.tagName.toLowerCase()) > -1) a2 = true;
|
|
335
|
+
else {
|
|
336
|
+
var d2 = t.getComputedStyle(c2);
|
|
337
|
+
d2 && "pointer" === d2.getPropertyValue("cursor") && (a2 = true);
|
|
338
|
+
}
|
|
339
|
+
l2.push(c2), u2 = c2;
|
|
340
|
+
}
|
|
341
|
+
if (!function(e3, t2) {
|
|
342
|
+
var i3 = null == t2 ? void 0 : t2.element_allowlist;
|
|
343
|
+
if (F(i3)) return true;
|
|
344
|
+
var r3 = function(e4) {
|
|
345
|
+
if (i3.some((t3) => e4.tagName.toLowerCase() === t3)) return { v: true };
|
|
346
|
+
};
|
|
347
|
+
for (var s3 of e3) {
|
|
348
|
+
var n3 = r3(s3);
|
|
349
|
+
if ("object" == typeof n3) return n3.v;
|
|
350
|
+
}
|
|
351
|
+
return false;
|
|
352
|
+
}(l2, r2)) return false;
|
|
353
|
+
if (!function(e3, t2) {
|
|
354
|
+
var i3 = null == t2 ? void 0 : t2.css_selector_allowlist;
|
|
355
|
+
if (F(i3)) return true;
|
|
356
|
+
var r3 = function(e4) {
|
|
357
|
+
if (i3.some((t3) => e4.matches(t3))) return { v: true };
|
|
358
|
+
};
|
|
359
|
+
for (var s3 of e3) {
|
|
360
|
+
var n3 = r3(s3);
|
|
361
|
+
if ("object" == typeof n3) return n3.v;
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
}(l2, r2)) return false;
|
|
365
|
+
var h2 = t.getComputedStyle(e2);
|
|
366
|
+
if (h2 && "pointer" === h2.getPropertyValue("cursor") && "click" === i2.type) return true;
|
|
367
|
+
var _2 = e2.tagName.toLowerCase();
|
|
368
|
+
switch (_2) {
|
|
369
|
+
case "html":
|
|
370
|
+
return false;
|
|
371
|
+
case "form":
|
|
372
|
+
return (n2 || ["submit"]).indexOf(i2.type) >= 0;
|
|
373
|
+
case "input":
|
|
374
|
+
case "select":
|
|
375
|
+
case "textarea":
|
|
376
|
+
return (n2 || ["change", "click"]).indexOf(i2.type) >= 0;
|
|
377
|
+
default:
|
|
378
|
+
return a2 ? (n2 || ["click"]).indexOf(i2.type) >= 0 : (n2 || ["click"]).indexOf(i2.type) >= 0 && (it.indexOf(_2) > -1 || "true" === e2.getAttribute("contenteditable"));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function nt(e2) {
|
|
382
|
+
for (var t2 = e2; t2.parentNode && !Ge(t2, "body"); t2 = t2.parentNode) {
|
|
383
|
+
var i2 = Qe(t2);
|
|
384
|
+
if (m(i2, "ph-sensitive") || m(i2, "ph-no-capture")) return false;
|
|
385
|
+
}
|
|
386
|
+
if (m(Qe(e2), "ph-include")) return true;
|
|
387
|
+
var r2 = e2.type || "";
|
|
388
|
+
if (R(r2)) switch (r2.toLowerCase()) {
|
|
389
|
+
case "hidden":
|
|
390
|
+
case "password":
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
var s2 = e2.name || e2.id || "";
|
|
394
|
+
if (R(s2)) {
|
|
395
|
+
if (/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s2.replace(/[^a-zA-Z0-9]/g, ""))) return false;
|
|
396
|
+
}
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
function ot(e2) {
|
|
400
|
+
return !!(Ge(e2, "input") && !["button", "checkbox", "submit", "reset"].includes(e2.type) || Ge(e2, "select") || Ge(e2, "textarea") || "true" === e2.getAttribute("contenteditable"));
|
|
401
|
+
}
|
|
402
|
+
var at = "(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})";
|
|
403
|
+
var lt = new RegExp("^(?:".concat(at, ")$"));
|
|
404
|
+
var ct = new RegExp(at);
|
|
405
|
+
var ut = "\\d{3}-?\\d{2}-?\\d{4}";
|
|
406
|
+
var dt = new RegExp("^(".concat(ut, ")$"));
|
|
407
|
+
var ht = new RegExp("(".concat(ut, ")"));
|
|
408
|
+
function _t(e2) {
|
|
409
|
+
var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
|
|
410
|
+
if (O(e2)) return false;
|
|
411
|
+
if (R(e2)) {
|
|
412
|
+
if (e2 = y(e2), (t2 ? lt : ct).test((e2 || "").replace(/[- ]/g, ""))) return false;
|
|
413
|
+
if ((t2 ? dt : ht).test(e2)) return false;
|
|
414
|
+
}
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
function pt(e2) {
|
|
418
|
+
var t2 = et(e2);
|
|
419
|
+
return _t(t2 = "".concat(t2, " ").concat(gt(e2)).trim()) ? t2 : "";
|
|
420
|
+
}
|
|
421
|
+
function gt(e2) {
|
|
422
|
+
var t2 = "";
|
|
423
|
+
return e2 && e2.childNodes && e2.childNodes.length && K(e2.childNodes, function(e3) {
|
|
424
|
+
var i2;
|
|
425
|
+
if (e3 && "span" === (null === (i2 = e3.tagName) || void 0 === i2 ? void 0 : i2.toLowerCase())) try {
|
|
426
|
+
var r2 = et(e3);
|
|
427
|
+
t2 = "".concat(t2, " ").concat(r2).trim(), e3.childNodes && e3.childNodes.length && (t2 = "".concat(t2, " ").concat(gt(e3)).trim());
|
|
428
|
+
} catch (e4) {
|
|
429
|
+
B.error("[AutoCapture]", e4);
|
|
430
|
+
}
|
|
431
|
+
}), t2;
|
|
432
|
+
}
|
|
433
|
+
function vt(e2) {
|
|
434
|
+
return function(e3) {
|
|
435
|
+
var t2 = e3.map((e4) => {
|
|
436
|
+
var t3, i2, r2 = "";
|
|
437
|
+
if (e4.tag_name && (r2 += e4.tag_name), e4.attr_class) for (var s2 of (e4.attr_class.sort(), e4.attr_class)) r2 += ".".concat(s2.replace(/"/g, ""));
|
|
438
|
+
var n2 = W(W(W(W({}, e4.text ? { text: e4.text } : {}), {}, { "nth-child": null !== (t3 = e4.nth_child) && void 0 !== t3 ? t3 : 0, "nth-of-type": null !== (i2 = e4.nth_of_type) && void 0 !== i2 ? i2 : 0 }, e4.href ? { href: e4.href } : {}), e4.attr_id ? { attr_id: e4.attr_id } : {}), e4.attributes), o2 = {};
|
|
439
|
+
return Z(n2).sort((e5, t4) => {
|
|
440
|
+
var [i3] = e5, [r3] = t4;
|
|
441
|
+
return i3.localeCompare(r3);
|
|
442
|
+
}).forEach((e5) => {
|
|
443
|
+
var [t4, i3] = e5;
|
|
444
|
+
return o2[ft(t4.toString())] = ft(i3.toString());
|
|
445
|
+
}), r2 += ":", r2 += Z(n2).map((e5) => {
|
|
446
|
+
var [t4, i3] = e5;
|
|
447
|
+
return "".concat(t4, '="').concat(i3, '"');
|
|
448
|
+
}).join("");
|
|
449
|
+
});
|
|
450
|
+
return t2.join(";");
|
|
451
|
+
}(function(e3) {
|
|
452
|
+
return e3.map((e4) => {
|
|
453
|
+
var t2, i2, r2 = { text: null === (t2 = e4.$el_text) || void 0 === t2 ? void 0 : t2.slice(0, 400), tag_name: e4.tag_name, href: null === (i2 = e4.attr__href) || void 0 === i2 ? void 0 : i2.slice(0, 2048), attr_class: mt(e4), attr_id: e4.attr__id, nth_child: e4.nth_child, nth_of_type: e4.nth_of_type, attributes: {} };
|
|
454
|
+
return Z(e4).filter((e5) => {
|
|
455
|
+
var [t3] = e5;
|
|
456
|
+
return 0 === t3.indexOf("attr__");
|
|
457
|
+
}).forEach((e5) => {
|
|
458
|
+
var [t3, i3] = e5;
|
|
459
|
+
return r2.attributes[t3] = i3;
|
|
460
|
+
}), r2;
|
|
461
|
+
});
|
|
462
|
+
}(e2));
|
|
463
|
+
}
|
|
464
|
+
function ft(e2) {
|
|
465
|
+
return e2.replace(/"|\\"/g, '\\"');
|
|
466
|
+
}
|
|
467
|
+
function mt(e2) {
|
|
468
|
+
var t2 = e2.attr__class;
|
|
469
|
+
return t2 ? x(t2) ? t2 : Ke(t2) : void 0;
|
|
470
|
+
}
|
|
471
|
+
var yt = class {
|
|
472
|
+
constructor() {
|
|
473
|
+
this.clicks = [];
|
|
474
|
+
}
|
|
475
|
+
isRageClick(e2, t2, i2) {
|
|
476
|
+
var r2 = this.clicks[this.clicks.length - 1];
|
|
477
|
+
if (r2 && Math.abs(e2 - r2.x) + Math.abs(t2 - r2.y) < 30 && i2 - r2.timestamp < 1e3) {
|
|
478
|
+
if (this.clicks.push({ x: e2, y: t2, timestamp: i2 }), 3 === this.clicks.length) return true;
|
|
479
|
+
} else this.clicks = [{ x: e2, y: t2, timestamp: i2 }];
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
var bt = ["localhost", "127.0.0.1"];
|
|
484
|
+
var wt = (e2) => {
|
|
485
|
+
var t2 = null == a ? void 0 : a.createElement("a");
|
|
486
|
+
return F(t2) ? null : (t2.href = e2, t2);
|
|
487
|
+
};
|
|
488
|
+
var St = function(e2) {
|
|
489
|
+
var t2, i2, r2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "&", s2 = [];
|
|
490
|
+
return K(e2, function(e3, r3) {
|
|
491
|
+
F(e3) || F(r3) || "undefined" === r3 || (t2 = encodeURIComponent(((e4) => e4 instanceof File)(e3) ? e3.name : e3.toString()), i2 = encodeURIComponent(r3), s2[s2.length] = i2 + "=" + t2);
|
|
492
|
+
}), s2.join(r2);
|
|
493
|
+
};
|
|
494
|
+
var kt = function(e2, t2) {
|
|
495
|
+
for (var i2, r2 = ((e2.split("#")[0] || "").split("?")[1] || "").split("&"), s2 = 0; s2 < r2.length; s2++) {
|
|
496
|
+
var n2 = r2[s2].split("=");
|
|
497
|
+
if (n2[0] === t2) {
|
|
498
|
+
i2 = n2;
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if (!x(i2) || i2.length < 2) return "";
|
|
503
|
+
var o2 = i2[1];
|
|
504
|
+
try {
|
|
505
|
+
o2 = decodeURIComponent(o2);
|
|
506
|
+
} catch (e3) {
|
|
507
|
+
B.error("Skipping decoding for malformed query param: " + o2);
|
|
508
|
+
}
|
|
509
|
+
return o2.replace(/\+/g, " ");
|
|
510
|
+
};
|
|
511
|
+
var Et = function(e2, t2, i2) {
|
|
512
|
+
if (!e2 || !t2 || !t2.length) return e2;
|
|
513
|
+
for (var r2 = e2.split("#"), s2 = r2[0] || "", n2 = r2[1], o2 = s2.split("?"), a2 = o2[1], l2 = o2[0], c2 = (a2 || "").split("&"), u2 = [], d2 = 0; d2 < c2.length; d2++) {
|
|
514
|
+
var h2 = c2[d2].split("=");
|
|
515
|
+
x(h2) && (t2.includes(h2[0]) ? u2.push(h2[0] + "=" + i2) : u2.push(c2[d2]));
|
|
516
|
+
}
|
|
517
|
+
var _2 = l2;
|
|
518
|
+
return null != a2 && (_2 += "?" + u2.join("&")), null != n2 && (_2 += "#" + n2), _2;
|
|
519
|
+
};
|
|
520
|
+
var xt = function(e2, t2) {
|
|
521
|
+
var i2 = e2.match(new RegExp(t2 + "=([^&]*)"));
|
|
522
|
+
return i2 ? i2[1] : null;
|
|
523
|
+
};
|
|
524
|
+
var It = H("[AutoCapture]");
|
|
525
|
+
function Pt(e2, t2) {
|
|
526
|
+
return t2.length > e2 ? t2.slice(0, e2) + "..." : t2;
|
|
527
|
+
}
|
|
528
|
+
function Ct(e2) {
|
|
529
|
+
if (e2.previousElementSibling) return e2.previousElementSibling;
|
|
530
|
+
var t2 = e2;
|
|
531
|
+
do {
|
|
532
|
+
t2 = t2.previousSibling;
|
|
533
|
+
} while (t2 && !Ve(t2));
|
|
534
|
+
return t2;
|
|
535
|
+
}
|
|
536
|
+
function Ft(e2, t2, i2, r2) {
|
|
537
|
+
var s2 = e2.tagName.toLowerCase(), n2 = { tag_name: s2 };
|
|
538
|
+
it.indexOf(s2) > -1 && !i2 && ("a" === s2.toLowerCase() || "button" === s2.toLowerCase() ? n2.$el_text = Pt(1024, pt(e2)) : n2.$el_text = Pt(1024, et(e2)));
|
|
539
|
+
var o2 = Qe(e2);
|
|
540
|
+
o2.length > 0 && (n2.classes = o2.filter(function(e3) {
|
|
541
|
+
return "" !== e3;
|
|
542
|
+
})), K(e2.attributes, function(i3) {
|
|
543
|
+
var s3;
|
|
544
|
+
if ((!ot(e2) || -1 !== ["name", "id", "class", "aria-label"].indexOf(i3.name)) && ((null == r2 || !r2.includes(i3.name)) && !t2 && _t(i3.value) && (s3 = i3.name, !R(s3) || "_ngcontent" !== s3.substring(0, 10) && "_nghost" !== s3.substring(0, 7)))) {
|
|
545
|
+
var o3 = i3.value;
|
|
546
|
+
"class" === i3.name && (o3 = Ke(o3).join(" ")), n2["attr__" + i3.name] = Pt(1024, o3);
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
for (var a2 = 1, l2 = 1, c2 = e2; c2 = Ct(c2); ) a2++, c2.tagName === e2.tagName && l2++;
|
|
550
|
+
return n2.nth_child = a2, n2.nth_of_type = l2, n2;
|
|
551
|
+
}
|
|
552
|
+
function Rt(e2, i2) {
|
|
553
|
+
for (var r2, s2, { e: n2, maskAllElementAttributes: o2, maskAllText: a2, elementAttributeIgnoreList: l2, elementsChainAsString: c2 } = i2, u2 = [e2], d2 = e2; d2.parentNode && !Ge(d2, "body"); ) Ye(d2.parentNode) ? (u2.push(d2.parentNode.host), d2 = d2.parentNode.host) : (u2.push(d2.parentNode), d2 = d2.parentNode);
|
|
554
|
+
var h2, _2 = [], p2 = {}, g2 = false, v2 = false;
|
|
555
|
+
if (K(u2, (e3) => {
|
|
556
|
+
var t2 = nt(e3);
|
|
557
|
+
"a" === e3.tagName.toLowerCase() && (g2 = e3.getAttribute("href"), g2 = t2 && g2 && _t(g2) && g2), m(Qe(e3), "ph-no-capture") && (v2 = true), _2.push(Ft(e3, o2, a2, l2));
|
|
558
|
+
var i3 = function(e4) {
|
|
559
|
+
if (!nt(e4)) return {};
|
|
560
|
+
var t3 = {};
|
|
561
|
+
return K(e4.attributes, function(e5) {
|
|
562
|
+
if (e5.name && 0 === e5.name.indexOf("data-ph-capture-attribute")) {
|
|
563
|
+
var i4 = e5.name.replace("data-ph-capture-attribute-", ""), r3 = e5.value;
|
|
564
|
+
i4 && r3 && _t(r3) && (t3[i4] = r3);
|
|
565
|
+
}
|
|
566
|
+
}), t3;
|
|
567
|
+
}(e3);
|
|
568
|
+
X(p2, i3);
|
|
569
|
+
}), v2) return { props: {}, explicitNoCapture: v2 };
|
|
570
|
+
if (a2 || ("a" === e2.tagName.toLowerCase() || "button" === e2.tagName.toLowerCase() ? _2[0].$el_text = pt(e2) : _2[0].$el_text = et(e2)), g2) {
|
|
571
|
+
var f2, y2;
|
|
572
|
+
_2[0].attr__href = g2;
|
|
573
|
+
var b2 = null === (f2 = wt(g2)) || void 0 === f2 ? void 0 : f2.host, w2 = null == t || null === (y2 = t.location) || void 0 === y2 ? void 0 : y2.host;
|
|
574
|
+
b2 && w2 && b2 !== w2 && (h2 = g2);
|
|
575
|
+
}
|
|
576
|
+
return { props: X({ $event_type: n2.type, $ce_version: 1 }, c2 ? {} : { $elements: _2 }, { $elements_chain: vt(_2) }, null !== (r2 = _2[0]) && void 0 !== r2 && r2.$el_text ? { $el_text: null === (s2 = _2[0]) || void 0 === s2 ? void 0 : s2.$el_text } : {}, h2 && "click" === n2.type ? { $external_click_url: h2 } : {}, p2) };
|
|
577
|
+
}
|
|
578
|
+
var Tt = class {
|
|
579
|
+
constructor(e2) {
|
|
580
|
+
V(this, "_initialized", false), V(this, "_isDisabledServerSide", null), V(this, "rageclicks", new yt()), V(this, "_elementsChainAsString", false), this.instance = e2, this._elementSelectors = null;
|
|
581
|
+
}
|
|
582
|
+
get config() {
|
|
583
|
+
var e2, t2, i2 = P(this.instance.config.autocapture) ? this.instance.config.autocapture : {};
|
|
584
|
+
return i2.url_allowlist = null === (e2 = i2.url_allowlist) || void 0 === e2 ? void 0 : e2.map((e3) => new RegExp(e3)), i2.url_ignorelist = null === (t2 = i2.url_ignorelist) || void 0 === t2 ? void 0 : t2.map((e3) => new RegExp(e3)), i2;
|
|
585
|
+
}
|
|
586
|
+
_addDomEventHandlers() {
|
|
587
|
+
if (this.isBrowserSupported()) {
|
|
588
|
+
if (t && a) {
|
|
589
|
+
var e2 = (e3) => {
|
|
590
|
+
e3 = e3 || (null == t ? void 0 : t.event);
|
|
591
|
+
try {
|
|
592
|
+
this._captureEvent(e3);
|
|
593
|
+
} catch (e4) {
|
|
594
|
+
It.error("Failed to capture event", e4);
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
if (ae(a, "submit", e2, { capture: true }), ae(a, "change", e2, { capture: true }), ae(a, "click", e2, { capture: true }), this.config.capture_copied_text) {
|
|
598
|
+
var i2 = (e3) => {
|
|
599
|
+
e3 = e3 || (null == t ? void 0 : t.event), this._captureEvent(e3, g);
|
|
600
|
+
};
|
|
601
|
+
ae(a, "copy", i2, { capture: true }), ae(a, "cut", i2, { capture: true });
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
} else It.info("Disabling Automatic Event Collection because this browser is not supported");
|
|
605
|
+
}
|
|
606
|
+
startIfEnabled() {
|
|
607
|
+
this.isEnabled && !this._initialized && (this._addDomEventHandlers(), this._initialized = true);
|
|
608
|
+
}
|
|
609
|
+
onRemoteConfig(e2) {
|
|
610
|
+
e2.elementsChainAsString && (this._elementsChainAsString = e2.elementsChainAsString), this.instance.persistence && this.instance.persistence.register({ [de]: !!e2.autocapture_opt_out }), this._isDisabledServerSide = !!e2.autocapture_opt_out, this.startIfEnabled();
|
|
611
|
+
}
|
|
612
|
+
setElementSelectors(e2) {
|
|
613
|
+
this._elementSelectors = e2;
|
|
614
|
+
}
|
|
615
|
+
getElementSelectors(e2) {
|
|
616
|
+
var t2, i2 = [];
|
|
617
|
+
return null === (t2 = this._elementSelectors) || void 0 === t2 || t2.forEach((t3) => {
|
|
618
|
+
var r2 = null == a ? void 0 : a.querySelectorAll(t3);
|
|
619
|
+
null == r2 || r2.forEach((r3) => {
|
|
620
|
+
e2 === r3 && i2.push(t3);
|
|
621
|
+
});
|
|
622
|
+
}), i2;
|
|
623
|
+
}
|
|
624
|
+
get isEnabled() {
|
|
625
|
+
var e2, t2, i2 = null === (e2 = this.instance.persistence) || void 0 === e2 ? void 0 : e2.props[de], r2 = this._isDisabledServerSide;
|
|
626
|
+
if ($(r2) && !A(i2) && !this.instance.config.advanced_disable_decide) return false;
|
|
627
|
+
var s2 = null !== (t2 = this._isDisabledServerSide) && void 0 !== t2 ? t2 : !!i2;
|
|
628
|
+
return !!this.instance.config.autocapture && !s2;
|
|
629
|
+
}
|
|
630
|
+
_captureEvent(e2) {
|
|
631
|
+
var i2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "$autocapture";
|
|
632
|
+
if (this.isEnabled) {
|
|
633
|
+
var r2, s2 = tt(e2);
|
|
634
|
+
if (Je(s2) && (s2 = s2.parentNode || null), "$autocapture" === i2 && "click" === e2.type && e2 instanceof MouseEvent) this.instance.config.rageclick && null !== (r2 = this.rageclicks) && void 0 !== r2 && r2.isRageClick(e2.clientX, e2.clientY, (/* @__PURE__ */ new Date()).getTime()) && this._captureEvent(e2, "$rageclick");
|
|
635
|
+
var n2 = i2 === g;
|
|
636
|
+
if (s2 && st(s2, e2, this.config, n2, n2 ? ["copy", "cut"] : void 0)) {
|
|
637
|
+
var { props: o2, explicitNoCapture: a2 } = Rt(s2, { e: e2, maskAllElementAttributes: this.instance.config.mask_all_element_attributes, maskAllText: this.instance.config.mask_all_text, elementAttributeIgnoreList: this.config.element_attribute_ignorelist, elementsChainAsString: this._elementsChainAsString });
|
|
638
|
+
if (a2) return false;
|
|
639
|
+
var l2 = this.getElementSelectors(s2);
|
|
640
|
+
if (l2 && l2.length > 0 && (o2.$element_selectors = l2), i2 === g) {
|
|
641
|
+
var c2, u2 = Ze(null == t || null === (c2 = t.getSelection()) || void 0 === c2 ? void 0 : c2.toString()), d2 = e2.type || "clipboard";
|
|
642
|
+
if (!u2) return false;
|
|
643
|
+
o2.$selected_content = u2, o2.$copy_type = d2;
|
|
644
|
+
}
|
|
645
|
+
return this.instance.capture(i2, o2), true;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
isBrowserSupported() {
|
|
650
|
+
return I(null == a ? void 0 : a.querySelectorAll);
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
Math.trunc || (Math.trunc = function(e2) {
|
|
654
|
+
return e2 < 0 ? Math.ceil(e2) : Math.floor(e2);
|
|
655
|
+
}), Number.isInteger || (Number.isInteger = function(e2) {
|
|
656
|
+
return M(e2) && isFinite(e2) && Math.floor(e2) === e2;
|
|
657
|
+
});
|
|
658
|
+
var $t = "0123456789abcdef";
|
|
659
|
+
var Ot = class _Ot {
|
|
660
|
+
constructor(e2) {
|
|
661
|
+
if (this.bytes = e2, 16 !== e2.length) throw new TypeError("not 128-bit length");
|
|
662
|
+
}
|
|
663
|
+
static fromFieldsV7(e2, t2, i2, r2) {
|
|
664
|
+
if (!Number.isInteger(e2) || !Number.isInteger(t2) || !Number.isInteger(i2) || !Number.isInteger(r2) || e2 < 0 || t2 < 0 || i2 < 0 || r2 < 0 || e2 > 281474976710655 || t2 > 4095 || i2 > 1073741823 || r2 > 4294967295) throw new RangeError("invalid field value");
|
|
665
|
+
var s2 = new Uint8Array(16);
|
|
666
|
+
return s2[0] = e2 / Math.pow(2, 40), s2[1] = e2 / Math.pow(2, 32), s2[2] = e2 / Math.pow(2, 24), s2[3] = e2 / Math.pow(2, 16), s2[4] = e2 / Math.pow(2, 8), s2[5] = e2, s2[6] = 112 | t2 >>> 8, s2[7] = t2, s2[8] = 128 | i2 >>> 24, s2[9] = i2 >>> 16, s2[10] = i2 >>> 8, s2[11] = i2, s2[12] = r2 >>> 24, s2[13] = r2 >>> 16, s2[14] = r2 >>> 8, s2[15] = r2, new _Ot(s2);
|
|
667
|
+
}
|
|
668
|
+
toString() {
|
|
669
|
+
for (var e2 = "", t2 = 0; t2 < this.bytes.length; t2++) e2 = e2 + $t.charAt(this.bytes[t2] >>> 4) + $t.charAt(15 & this.bytes[t2]), 3 !== t2 && 5 !== t2 && 7 !== t2 && 9 !== t2 || (e2 += "-");
|
|
670
|
+
if (36 !== e2.length) throw new Error("Invalid UUIDv7 was generated");
|
|
671
|
+
return e2;
|
|
672
|
+
}
|
|
673
|
+
clone() {
|
|
674
|
+
return new _Ot(this.bytes.slice(0));
|
|
675
|
+
}
|
|
676
|
+
equals(e2) {
|
|
677
|
+
return 0 === this.compareTo(e2);
|
|
678
|
+
}
|
|
679
|
+
compareTo(e2) {
|
|
680
|
+
for (var t2 = 0; t2 < 16; t2++) {
|
|
681
|
+
var i2 = this.bytes[t2] - e2.bytes[t2];
|
|
682
|
+
if (0 !== i2) return Math.sign(i2);
|
|
683
|
+
}
|
|
684
|
+
return 0;
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
var Mt = class {
|
|
688
|
+
constructor() {
|
|
689
|
+
V(this, "timestamp", 0), V(this, "counter", 0), V(this, "random", new Dt());
|
|
690
|
+
}
|
|
691
|
+
generate() {
|
|
692
|
+
var e2 = this.generateOrAbort();
|
|
693
|
+
if (F(e2)) {
|
|
694
|
+
this.timestamp = 0;
|
|
695
|
+
var t2 = this.generateOrAbort();
|
|
696
|
+
if (F(t2)) throw new Error("Could not generate UUID after timestamp reset");
|
|
697
|
+
return t2;
|
|
698
|
+
}
|
|
699
|
+
return e2;
|
|
700
|
+
}
|
|
701
|
+
generateOrAbort() {
|
|
702
|
+
var e2 = Date.now();
|
|
703
|
+
if (e2 > this.timestamp) this.timestamp = e2, this.resetCounter();
|
|
704
|
+
else {
|
|
705
|
+
if (!(e2 + 1e4 > this.timestamp)) return;
|
|
706
|
+
this.counter++, this.counter > 4398046511103 && (this.timestamp++, this.resetCounter());
|
|
707
|
+
}
|
|
708
|
+
return Ot.fromFieldsV7(this.timestamp, Math.trunc(this.counter / Math.pow(2, 30)), this.counter & Math.pow(2, 30) - 1, this.random.nextUint32());
|
|
709
|
+
}
|
|
710
|
+
resetCounter() {
|
|
711
|
+
this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
var At;
|
|
715
|
+
var Lt = (e2) => {
|
|
716
|
+
if ("undefined" != typeof UUIDV7_DENY_WEAK_RNG && UUIDV7_DENY_WEAK_RNG) throw new Error("no cryptographically strong RNG available");
|
|
717
|
+
for (var t2 = 0; t2 < e2.length; t2++) e2[t2] = 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random());
|
|
718
|
+
return e2;
|
|
719
|
+
};
|
|
720
|
+
t && !F(t.crypto) && crypto.getRandomValues && (Lt = (e2) => crypto.getRandomValues(e2));
|
|
721
|
+
var Dt = class {
|
|
722
|
+
constructor() {
|
|
723
|
+
V(this, "buffer", new Uint32Array(8)), V(this, "cursor", 1 / 0);
|
|
724
|
+
}
|
|
725
|
+
nextUint32() {
|
|
726
|
+
return this.cursor >= this.buffer.length && (Lt(this.buffer), this.cursor = 0), this.buffer[this.cursor++];
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
var qt = () => Nt().toString();
|
|
730
|
+
var Nt = () => (At || (At = new Mt())).generate();
|
|
731
|
+
var Bt = "Thu, 01 Jan 1970 00:00:00 GMT";
|
|
732
|
+
var Ht = "";
|
|
733
|
+
var Ut = /[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;
|
|
734
|
+
function zt(e2, t2) {
|
|
735
|
+
if (t2) {
|
|
736
|
+
var i2 = function(e3) {
|
|
737
|
+
var t3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : a;
|
|
738
|
+
if (Ht) return Ht;
|
|
739
|
+
if (!t3) return "";
|
|
740
|
+
if (["localhost", "127.0.0.1"].includes(e3)) return "";
|
|
741
|
+
for (var i3 = e3.split("."), r3 = Math.min(i3.length, 8), s2 = "dmn_chk_" + qt(), n2 = new RegExp("(^|;)\\s*" + s2 + "=1"); !Ht && r3--; ) {
|
|
742
|
+
var o2 = i3.slice(r3).join("."), l2 = s2 + "=1;domain=." + o2;
|
|
743
|
+
t3.cookie = l2, n2.test(t3.cookie) && (t3.cookie = l2 + ";expires=" + Bt, Ht = o2);
|
|
744
|
+
}
|
|
745
|
+
return Ht;
|
|
746
|
+
}(e2);
|
|
747
|
+
if (!i2) {
|
|
748
|
+
var r2 = ((e3) => {
|
|
749
|
+
var t3 = e3.match(Ut);
|
|
750
|
+
return t3 ? t3[0] : "";
|
|
751
|
+
})(e2);
|
|
752
|
+
r2 !== i2 && B.info("Warning: cookie subdomain discovery mismatch", r2, i2), i2 = r2;
|
|
753
|
+
}
|
|
754
|
+
return i2 ? "; domain=." + i2 : "";
|
|
755
|
+
}
|
|
756
|
+
return "";
|
|
757
|
+
}
|
|
758
|
+
var jt;
|
|
759
|
+
var Wt = { is_supported: () => !!a, error: function(e2) {
|
|
760
|
+
B.error("cookieStore error: " + e2);
|
|
761
|
+
}, get: function(e2) {
|
|
762
|
+
if (a) {
|
|
763
|
+
try {
|
|
764
|
+
for (var t2 = e2 + "=", i2 = a.cookie.split(";").filter((e3) => e3.length), r2 = 0; r2 < i2.length; r2++) {
|
|
765
|
+
for (var s2 = i2[r2]; " " == s2.charAt(0); ) s2 = s2.substring(1, s2.length);
|
|
766
|
+
if (0 === s2.indexOf(t2)) return decodeURIComponent(s2.substring(t2.length, s2.length));
|
|
767
|
+
}
|
|
768
|
+
} catch (e3) {
|
|
769
|
+
}
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
}, parse: function(e2) {
|
|
773
|
+
var t2;
|
|
774
|
+
try {
|
|
775
|
+
t2 = JSON.parse(Wt.get(e2)) || {};
|
|
776
|
+
} catch (e3) {
|
|
777
|
+
}
|
|
778
|
+
return t2;
|
|
779
|
+
}, set: function(e2, t2, i2, r2, s2) {
|
|
780
|
+
if (a) try {
|
|
781
|
+
var n2 = "", o2 = "", l2 = zt(a.location.hostname, r2);
|
|
782
|
+
if (i2) {
|
|
783
|
+
var c2 = /* @__PURE__ */ new Date();
|
|
784
|
+
c2.setTime(c2.getTime() + 24 * i2 * 60 * 60 * 1e3), n2 = "; expires=" + c2.toUTCString();
|
|
785
|
+
}
|
|
786
|
+
s2 && (o2 = "; secure");
|
|
787
|
+
var u2 = e2 + "=" + encodeURIComponent(JSON.stringify(t2)) + n2 + "; SameSite=Lax; path=/" + l2 + o2;
|
|
788
|
+
return u2.length > 3686.4 && B.warn("cookieStore warning: large cookie, len=" + u2.length), a.cookie = u2, u2;
|
|
789
|
+
} catch (e3) {
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
}, remove: function(e2, t2) {
|
|
793
|
+
try {
|
|
794
|
+
Wt.set(e2, "", -1, t2);
|
|
795
|
+
} catch (e3) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
} };
|
|
799
|
+
var Vt = null;
|
|
800
|
+
var Gt = { is_supported: function() {
|
|
801
|
+
if (!$(Vt)) return Vt;
|
|
802
|
+
var e2 = true;
|
|
803
|
+
if (F(t)) e2 = false;
|
|
804
|
+
else try {
|
|
805
|
+
var i2 = "__mplssupport__";
|
|
806
|
+
Gt.set(i2, "xyz"), '"xyz"' !== Gt.get(i2) && (e2 = false), Gt.remove(i2);
|
|
807
|
+
} catch (t2) {
|
|
808
|
+
e2 = false;
|
|
809
|
+
}
|
|
810
|
+
return e2 || B.error("localStorage unsupported; falling back to cookie store"), Vt = e2, e2;
|
|
811
|
+
}, error: function(e2) {
|
|
812
|
+
B.error("localStorage error: " + e2);
|
|
813
|
+
}, get: function(e2) {
|
|
814
|
+
try {
|
|
815
|
+
return null == t ? void 0 : t.localStorage.getItem(e2);
|
|
816
|
+
} catch (e3) {
|
|
817
|
+
Gt.error(e3);
|
|
818
|
+
}
|
|
819
|
+
return null;
|
|
820
|
+
}, parse: function(e2) {
|
|
821
|
+
try {
|
|
822
|
+
return JSON.parse(Gt.get(e2)) || {};
|
|
823
|
+
} catch (e3) {
|
|
824
|
+
}
|
|
825
|
+
return null;
|
|
826
|
+
}, set: function(e2, i2) {
|
|
827
|
+
try {
|
|
828
|
+
null == t || t.localStorage.setItem(e2, JSON.stringify(i2));
|
|
829
|
+
} catch (e3) {
|
|
830
|
+
Gt.error(e3);
|
|
831
|
+
}
|
|
832
|
+
}, remove: function(e2) {
|
|
833
|
+
try {
|
|
834
|
+
null == t || t.localStorage.removeItem(e2);
|
|
835
|
+
} catch (e3) {
|
|
836
|
+
Gt.error(e3);
|
|
837
|
+
}
|
|
838
|
+
} };
|
|
839
|
+
var Jt = ["distinct_id", Ee, xe, He, Be];
|
|
840
|
+
var Yt = W(W({}, Gt), {}, { parse: function(e2) {
|
|
841
|
+
try {
|
|
842
|
+
var t2 = {};
|
|
843
|
+
try {
|
|
844
|
+
t2 = Wt.parse(e2) || {};
|
|
845
|
+
} catch (e3) {
|
|
846
|
+
}
|
|
847
|
+
var i2 = X(t2, JSON.parse(Gt.get(e2) || "{}"));
|
|
848
|
+
return Gt.set(e2, i2), i2;
|
|
849
|
+
} catch (e3) {
|
|
850
|
+
}
|
|
851
|
+
return null;
|
|
852
|
+
}, set: function(e2, t2, i2, r2, s2, n2) {
|
|
853
|
+
try {
|
|
854
|
+
Gt.set(e2, t2, void 0, void 0, n2);
|
|
855
|
+
var o2 = {};
|
|
856
|
+
Jt.forEach((e3) => {
|
|
857
|
+
t2[e3] && (o2[e3] = t2[e3]);
|
|
858
|
+
}), Object.keys(o2).length && Wt.set(e2, o2, i2, r2, s2, n2);
|
|
859
|
+
} catch (e3) {
|
|
860
|
+
Gt.error(e3);
|
|
861
|
+
}
|
|
862
|
+
}, remove: function(e2, i2) {
|
|
863
|
+
try {
|
|
864
|
+
null == t || t.localStorage.removeItem(e2), Wt.remove(e2, i2);
|
|
865
|
+
} catch (e3) {
|
|
866
|
+
Gt.error(e3);
|
|
867
|
+
}
|
|
868
|
+
} });
|
|
869
|
+
var Kt = {};
|
|
870
|
+
var Xt = { is_supported: function() {
|
|
871
|
+
return true;
|
|
872
|
+
}, error: function(e2) {
|
|
873
|
+
B.error("memoryStorage error: " + e2);
|
|
874
|
+
}, get: function(e2) {
|
|
875
|
+
return Kt[e2] || null;
|
|
876
|
+
}, parse: function(e2) {
|
|
877
|
+
return Kt[e2] || null;
|
|
878
|
+
}, set: function(e2, t2) {
|
|
879
|
+
Kt[e2] = t2;
|
|
880
|
+
}, remove: function(e2) {
|
|
881
|
+
delete Kt[e2];
|
|
882
|
+
} };
|
|
883
|
+
var Qt = null;
|
|
884
|
+
var Zt = { is_supported: function() {
|
|
885
|
+
if (!$(Qt)) return Qt;
|
|
886
|
+
if (Qt = true, F(t)) Qt = false;
|
|
887
|
+
else try {
|
|
888
|
+
var e2 = "__support__";
|
|
889
|
+
Zt.set(e2, "xyz"), '"xyz"' !== Zt.get(e2) && (Qt = false), Zt.remove(e2);
|
|
890
|
+
} catch (e3) {
|
|
891
|
+
Qt = false;
|
|
892
|
+
}
|
|
893
|
+
return Qt;
|
|
894
|
+
}, error: function(e2) {
|
|
895
|
+
B.error("sessionStorage error: ", e2);
|
|
896
|
+
}, get: function(e2) {
|
|
897
|
+
try {
|
|
898
|
+
return null == t ? void 0 : t.sessionStorage.getItem(e2);
|
|
899
|
+
} catch (e3) {
|
|
900
|
+
Zt.error(e3);
|
|
901
|
+
}
|
|
902
|
+
return null;
|
|
903
|
+
}, parse: function(e2) {
|
|
904
|
+
try {
|
|
905
|
+
return JSON.parse(Zt.get(e2)) || null;
|
|
906
|
+
} catch (e3) {
|
|
907
|
+
}
|
|
908
|
+
return null;
|
|
909
|
+
}, set: function(e2, i2) {
|
|
910
|
+
try {
|
|
911
|
+
null == t || t.sessionStorage.setItem(e2, JSON.stringify(i2));
|
|
912
|
+
} catch (e3) {
|
|
913
|
+
Zt.error(e3);
|
|
914
|
+
}
|
|
915
|
+
}, remove: function(e2) {
|
|
916
|
+
try {
|
|
917
|
+
null == t || t.sessionStorage.removeItem(e2);
|
|
918
|
+
} catch (e3) {
|
|
919
|
+
Zt.error(e3);
|
|
920
|
+
}
|
|
921
|
+
} };
|
|
922
|
+
!function(e2) {
|
|
923
|
+
e2[e2.PENDING = -1] = "PENDING", e2[e2.DENIED = 0] = "DENIED", e2[e2.GRANTED = 1] = "GRANTED";
|
|
924
|
+
}(jt || (jt = {}));
|
|
925
|
+
var ei = class {
|
|
926
|
+
constructor(e2) {
|
|
927
|
+
this.instance = e2;
|
|
928
|
+
}
|
|
929
|
+
get config() {
|
|
930
|
+
return this.instance.config;
|
|
931
|
+
}
|
|
932
|
+
get consent() {
|
|
933
|
+
return this.getDnt() ? jt.DENIED : this.storedConsent;
|
|
934
|
+
}
|
|
935
|
+
isOptedOut() {
|
|
936
|
+
return this.consent === jt.DENIED || this.consent === jt.PENDING && this.config.opt_out_capturing_by_default;
|
|
937
|
+
}
|
|
938
|
+
isOptedIn() {
|
|
939
|
+
return !this.isOptedOut();
|
|
940
|
+
}
|
|
941
|
+
optInOut(e2) {
|
|
942
|
+
this.storage.set(this.storageKey, e2 ? 1 : 0, this.config.cookie_expiration, this.config.cross_subdomain_cookie, this.config.secure_cookie);
|
|
943
|
+
}
|
|
944
|
+
reset() {
|
|
945
|
+
this.storage.remove(this.storageKey, this.config.cross_subdomain_cookie);
|
|
946
|
+
}
|
|
947
|
+
get storageKey() {
|
|
948
|
+
var { token: e2, opt_out_capturing_cookie_prefix: t2 } = this.instance.config;
|
|
949
|
+
return (t2 || "__ph_opt_in_out_") + e2;
|
|
950
|
+
}
|
|
951
|
+
get storedConsent() {
|
|
952
|
+
var e2 = this.storage.get(this.storageKey);
|
|
953
|
+
return "1" === e2 ? jt.GRANTED : "0" === e2 ? jt.DENIED : jt.PENDING;
|
|
954
|
+
}
|
|
955
|
+
get storage() {
|
|
956
|
+
if (!this._storage) {
|
|
957
|
+
var e2 = this.config.opt_out_capturing_persistence_type;
|
|
958
|
+
this._storage = "localStorage" === e2 ? Gt : Wt;
|
|
959
|
+
var t2 = "localStorage" === e2 ? Wt : Gt;
|
|
960
|
+
t2.get(this.storageKey) && (this._storage.get(this.storageKey) || this.optInOut("1" === t2.get(this.storageKey)), t2.remove(this.storageKey, this.config.cross_subdomain_cookie));
|
|
961
|
+
}
|
|
962
|
+
return this._storage;
|
|
963
|
+
}
|
|
964
|
+
getDnt() {
|
|
965
|
+
return !!this.config.respect_dnt && !!oe([null == o ? void 0 : o.doNotTrack, null == o ? void 0 : o.msDoNotTrack, _.doNotTrack], (e2) => m([true, 1, "1", "yes"], e2));
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
var ti = H("[Dead Clicks]");
|
|
969
|
+
var ii = () => true;
|
|
970
|
+
var ri = (e2) => {
|
|
971
|
+
var t2, i2 = !(null === (t2 = e2.instance.persistence) || void 0 === t2 || !t2.get_property(ge)), r2 = e2.instance.config.capture_dead_clicks;
|
|
972
|
+
return A(r2) ? r2 : i2;
|
|
973
|
+
};
|
|
974
|
+
var si = class {
|
|
975
|
+
get lazyLoadedDeadClicksAutocapture() {
|
|
976
|
+
return this._lazyLoadedDeadClicksAutocapture;
|
|
977
|
+
}
|
|
978
|
+
constructor(e2, t2, i2) {
|
|
979
|
+
this.instance = e2, this.isEnabled = t2, this.onCapture = i2, this.startIfEnabled();
|
|
980
|
+
}
|
|
981
|
+
onRemoteConfig(e2) {
|
|
982
|
+
this.instance.persistence && this.instance.persistence.register({ [ge]: null == e2 ? void 0 : e2.captureDeadClicks }), this.startIfEnabled();
|
|
983
|
+
}
|
|
984
|
+
startIfEnabled() {
|
|
985
|
+
this.isEnabled(this) && this.loadScript(() => {
|
|
986
|
+
this.start();
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
loadScript(e2) {
|
|
990
|
+
var t2, i2, r2;
|
|
991
|
+
null !== (t2 = _.__PosthogExtensions__) && void 0 !== t2 && t2.initDeadClicksAutocapture && e2(), null === (i2 = _.__PosthogExtensions__) || void 0 === i2 || null === (r2 = i2.loadExternalDependency) || void 0 === r2 || r2.call(i2, this.instance, "dead-clicks-autocapture", (t3) => {
|
|
992
|
+
t3 ? ti.error("failed to load script", t3) : e2();
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
start() {
|
|
996
|
+
var e2;
|
|
997
|
+
if (a) {
|
|
998
|
+
if (!this._lazyLoadedDeadClicksAutocapture && null !== (e2 = _.__PosthogExtensions__) && void 0 !== e2 && e2.initDeadClicksAutocapture) {
|
|
999
|
+
var t2 = P(this.instance.config.capture_dead_clicks) ? this.instance.config.capture_dead_clicks : {};
|
|
1000
|
+
t2.__onCapture = this.onCapture, this._lazyLoadedDeadClicksAutocapture = _.__PosthogExtensions__.initDeadClicksAutocapture(this.instance, t2), this._lazyLoadedDeadClicksAutocapture.start(a), ti.info("starting...");
|
|
1001
|
+
}
|
|
1002
|
+
} else ti.error("`document` not found. Cannot start.");
|
|
1003
|
+
}
|
|
1004
|
+
stop() {
|
|
1005
|
+
this._lazyLoadedDeadClicksAutocapture && (this._lazyLoadedDeadClicksAutocapture.stop(), this._lazyLoadedDeadClicksAutocapture = void 0, ti.info("stopping..."));
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
var ni = H("[ExceptionAutocapture]");
|
|
1009
|
+
var oi = class {
|
|
1010
|
+
constructor(e2) {
|
|
1011
|
+
var i2;
|
|
1012
|
+
V(this, "startCapturing", () => {
|
|
1013
|
+
var e3, i3, r2, s2;
|
|
1014
|
+
if (t && this.isEnabled && !this.hasHandlers) {
|
|
1015
|
+
var n2 = null === (e3 = _.__PosthogExtensions__) || void 0 === e3 || null === (i3 = e3.errorWrappingFunctions) || void 0 === i3 ? void 0 : i3.wrapOnError, o2 = null === (r2 = _.__PosthogExtensions__) || void 0 === r2 || null === (s2 = r2.errorWrappingFunctions) || void 0 === s2 ? void 0 : s2.wrapUnhandledRejection;
|
|
1016
|
+
if (n2 && o2) try {
|
|
1017
|
+
this.unwrapOnError = n2(this.captureException.bind(this)), this.unwrapUnhandledRejection = o2(this.captureException.bind(this));
|
|
1018
|
+
} catch (e4) {
|
|
1019
|
+
ni.error("failed to start", e4), this.stopCapturing();
|
|
1020
|
+
}
|
|
1021
|
+
else ni.error("failed to load error wrapping functions - cannot start");
|
|
1022
|
+
}
|
|
1023
|
+
}), this.instance = e2, this.remoteEnabled = !(null === (i2 = this.instance.persistence) || void 0 === i2 || !i2.props[_e]), this.startIfEnabled();
|
|
1024
|
+
}
|
|
1025
|
+
get isEnabled() {
|
|
1026
|
+
var e2;
|
|
1027
|
+
return A(this.instance.config.capture_exceptions) ? this.instance.config.capture_exceptions : null !== (e2 = this.remoteEnabled) && void 0 !== e2 && e2;
|
|
1028
|
+
}
|
|
1029
|
+
get hasHandlers() {
|
|
1030
|
+
return !F(this.unwrapOnError);
|
|
1031
|
+
}
|
|
1032
|
+
startIfEnabled() {
|
|
1033
|
+
this.isEnabled && !this.hasHandlers && (ni.info("enabled, starting..."), this.loadScript(this.startCapturing));
|
|
1034
|
+
}
|
|
1035
|
+
loadScript(e2) {
|
|
1036
|
+
var t2, i2;
|
|
1037
|
+
this.hasHandlers && e2(), null === (t2 = _.__PosthogExtensions__) || void 0 === t2 || null === (i2 = t2.loadExternalDependency) || void 0 === i2 || i2.call(t2, this.instance, "exception-autocapture", (t3) => {
|
|
1038
|
+
if (t3) return ni.error("failed to load script", t3);
|
|
1039
|
+
e2();
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
stopCapturing() {
|
|
1043
|
+
var e2, t2;
|
|
1044
|
+
null === (e2 = this.unwrapOnError) || void 0 === e2 || e2.call(this), this.unwrapOnError = void 0, null === (t2 = this.unwrapUnhandledRejection) || void 0 === t2 || t2.call(this), this.unwrapUnhandledRejection = void 0;
|
|
1045
|
+
}
|
|
1046
|
+
onRemoteConfig(e2) {
|
|
1047
|
+
var t2 = e2.autocaptureExceptions;
|
|
1048
|
+
this.remoteEnabled = !!t2 || false, this.instance.persistence && this.instance.persistence.register({ [_e]: this.remoteEnabled }), this.startIfEnabled();
|
|
1049
|
+
}
|
|
1050
|
+
captureException(e2) {
|
|
1051
|
+
var t2 = this.instance.requestRouter.endpointFor("ui");
|
|
1052
|
+
e2.$exception_personURL = "".concat(t2, "/project/").concat(this.instance.config.token, "/person/").concat(this.instance.get_distinct_id()), this.instance.exceptions.sendExceptionEvent(e2);
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
function ai(e2) {
|
|
1056
|
+
var t2, i2;
|
|
1057
|
+
return (null === (t2 = JSON.stringify(e2, (i2 = [], function(e3, t3) {
|
|
1058
|
+
if (P(t3)) {
|
|
1059
|
+
for (; i2.length > 0 && i2[i2.length - 1] !== this; ) i2.pop();
|
|
1060
|
+
return i2.includes(t3) ? "[Circular]" : (i2.push(t3), t3);
|
|
1061
|
+
}
|
|
1062
|
+
return t3;
|
|
1063
|
+
}))) || void 0 === t2 ? void 0 : t2.length) || 0;
|
|
1064
|
+
}
|
|
1065
|
+
function li(e2) {
|
|
1066
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 66060288e-1;
|
|
1067
|
+
if (e2.size >= t2 && e2.data.length > 1) {
|
|
1068
|
+
var i2 = Math.floor(e2.data.length / 2), r2 = e2.data.slice(0, i2), s2 = e2.data.slice(i2);
|
|
1069
|
+
return [li({ size: ai(r2), data: r2, sessionId: e2.sessionId, windowId: e2.windowId }), li({ size: ai(s2), data: s2, sessionId: e2.sessionId, windowId: e2.windowId })].flatMap((e3) => e3);
|
|
1070
|
+
}
|
|
1071
|
+
return [e2];
|
|
1072
|
+
}
|
|
1073
|
+
var ci = ((e2) => (e2[e2.DomContentLoaded = 0] = "DomContentLoaded", e2[e2.Load = 1] = "Load", e2[e2.FullSnapshot = 2] = "FullSnapshot", e2[e2.IncrementalSnapshot = 3] = "IncrementalSnapshot", e2[e2.Meta = 4] = "Meta", e2[e2.Custom = 5] = "Custom", e2[e2.Plugin = 6] = "Plugin", e2))(ci || {});
|
|
1074
|
+
var ui = ((e2) => (e2[e2.Mutation = 0] = "Mutation", e2[e2.MouseMove = 1] = "MouseMove", e2[e2.MouseInteraction = 2] = "MouseInteraction", e2[e2.Scroll = 3] = "Scroll", e2[e2.ViewportResize = 4] = "ViewportResize", e2[e2.Input = 5] = "Input", e2[e2.TouchMove = 6] = "TouchMove", e2[e2.MediaInteraction = 7] = "MediaInteraction", e2[e2.StyleSheetRule = 8] = "StyleSheetRule", e2[e2.CanvasMutation = 9] = "CanvasMutation", e2[e2.Font = 10] = "Font", e2[e2.Log = 11] = "Log", e2[e2.Drag = 12] = "Drag", e2[e2.StyleDeclaration = 13] = "StyleDeclaration", e2[e2.Selection = 14] = "Selection", e2[e2.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", e2[e2.CustomElement = 16] = "CustomElement", e2))(ui || {});
|
|
1075
|
+
var di = "[SessionRecording]";
|
|
1076
|
+
var hi = "redacted";
|
|
1077
|
+
var _i = { initiatorTypes: ["audio", "beacon", "body", "css", "early-hint", "embed", "fetch", "frame", "iframe", "icon", "image", "img", "input", "link", "navigation", "object", "ping", "script", "track", "video", "xmlhttprequest"], maskRequestFn: (e2) => e2, recordHeaders: false, recordBody: false, recordInitialRequests: false, recordPerformance: false, performanceEntryTypeToObserve: ["first-input", "navigation", "paint", "resource"], payloadSizeLimitBytes: 1e6, payloadHostDenyList: [".lr-ingest.io", ".ingest.sentry.io", ".clarity.ms", "analytics.google.com"] };
|
|
1078
|
+
var pi = ["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"];
|
|
1079
|
+
var gi = ["password", "secret", "passwd", "api_key", "apikey", "auth", "credentials", "mysql_pwd", "privatekey", "private_key", "token"];
|
|
1080
|
+
var vi = ["/s/", "/e/", "/i/"];
|
|
1081
|
+
function fi(e2, t2, i2, r2) {
|
|
1082
|
+
if (O(e2)) return e2;
|
|
1083
|
+
var s2 = (null == t2 ? void 0 : t2["content-length"]) || function(e3) {
|
|
1084
|
+
return new Blob([e3]).size;
|
|
1085
|
+
}(e2);
|
|
1086
|
+
return R(s2) && (s2 = parseInt(s2)), s2 > i2 ? di + " ".concat(r2, " body too large to record (").concat(s2, " bytes)") : e2;
|
|
1087
|
+
}
|
|
1088
|
+
function mi(e2, t2) {
|
|
1089
|
+
if (O(e2)) return e2;
|
|
1090
|
+
var i2 = e2;
|
|
1091
|
+
return _t(i2, false) || (i2 = di + " " + t2 + " body " + hi), K(gi, (e3) => {
|
|
1092
|
+
var r2, s2;
|
|
1093
|
+
null !== (r2 = i2) && void 0 !== r2 && r2.length && -1 !== (null === (s2 = i2) || void 0 === s2 ? void 0 : s2.indexOf(e3)) && (i2 = di + " " + t2 + " body " + hi + " as might contain: " + e3);
|
|
1094
|
+
}), i2;
|
|
1095
|
+
}
|
|
1096
|
+
var yi = (e2, t2) => {
|
|
1097
|
+
var i2, r2, s2, n2 = { payloadSizeLimitBytes: _i.payloadSizeLimitBytes, performanceEntryTypeToObserve: [..._i.performanceEntryTypeToObserve], payloadHostDenyList: [...t2.payloadHostDenyList || [], ..._i.payloadHostDenyList] }, o2 = false !== e2.session_recording.recordHeaders && t2.recordHeaders, a2 = false !== e2.session_recording.recordBody && t2.recordBody, l2 = false !== e2.capture_performance && t2.recordPerformance, c2 = (i2 = n2, s2 = Math.min(1e6, null !== (r2 = i2.payloadSizeLimitBytes) && void 0 !== r2 ? r2 : 1e6), (e3) => (null != e3 && e3.requestBody && (e3.requestBody = fi(e3.requestBody, e3.requestHeaders, s2, "Request")), null != e3 && e3.responseBody && (e3.responseBody = fi(e3.responseBody, e3.responseHeaders, s2, "Response")), e3)), u2 = (t3) => {
|
|
1098
|
+
return c2(((e3, t4) => {
|
|
1099
|
+
var i4, r4 = wt(e3.name), s3 = 0 === t4.indexOf("http") ? null === (i4 = wt(t4)) || void 0 === i4 ? void 0 : i4.pathname : t4;
|
|
1100
|
+
"/" === s3 && (s3 = "");
|
|
1101
|
+
var n3 = null == r4 ? void 0 : r4.pathname.replace(s3 || "", "");
|
|
1102
|
+
if (!(r4 && n3 && vi.some((e4) => 0 === n3.indexOf(e4)))) return e3;
|
|
1103
|
+
})((r3 = (i3 = t3).requestHeaders, O(r3) || K(Object.keys(null != r3 ? r3 : {}), (e3) => {
|
|
1104
|
+
pi.includes(e3.toLowerCase()) && (r3[e3] = hi);
|
|
1105
|
+
}), i3), e2.api_host));
|
|
1106
|
+
var i3, r3;
|
|
1107
|
+
}, d2 = I(e2.session_recording.maskNetworkRequestFn);
|
|
1108
|
+
return d2 && I(e2.session_recording.maskCapturedNetworkRequestFn) && B.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."), d2 && (e2.session_recording.maskCapturedNetworkRequestFn = (t3) => {
|
|
1109
|
+
var i3 = e2.session_recording.maskNetworkRequestFn({ url: t3.name });
|
|
1110
|
+
return W(W({}, t3), {}, { name: null == i3 ? void 0 : i3.url });
|
|
1111
|
+
}), n2.maskRequestFn = I(e2.session_recording.maskCapturedNetworkRequestFn) ? (t3) => {
|
|
1112
|
+
var i3, r3, s3, n3 = u2(t3);
|
|
1113
|
+
return n3 && null !== (i3 = null === (r3 = (s3 = e2.session_recording).maskCapturedNetworkRequestFn) || void 0 === r3 ? void 0 : r3.call(s3, n3)) && void 0 !== i3 ? i3 : void 0;
|
|
1114
|
+
} : (e3) => function(e4) {
|
|
1115
|
+
if (!F(e4)) return e4.requestBody = mi(e4.requestBody, "Request"), e4.responseBody = mi(e4.responseBody, "Response"), e4;
|
|
1116
|
+
}(u2(e3)), W(W(W({}, _i), n2), {}, { recordHeaders: o2, recordBody: a2, recordPerformance: l2, recordInitialRequests: l2 });
|
|
1117
|
+
};
|
|
1118
|
+
function bi(e2, t2, i2, r2, s2) {
|
|
1119
|
+
return t2 > i2 && (B.warn("min cannot be greater than max."), t2 = i2), M(e2) ? e2 > i2 ? (r2 && B.warn(r2 + " cannot be greater than max: " + i2 + ". Using max value instead."), i2) : e2 < t2 ? (r2 && B.warn(r2 + " cannot be less than min: " + t2 + ". Using min value instead."), t2) : e2 : (r2 && B.warn(r2 + " must be a number. using max or fallback. max: " + i2 + ", fallback: " + s2), bi(s2 || i2, t2, i2, r2));
|
|
1120
|
+
}
|
|
1121
|
+
var wi = class {
|
|
1122
|
+
constructor(e2) {
|
|
1123
|
+
var t2, i2, r2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1124
|
+
V(this, "bucketSize", 100), V(this, "refillRate", 10), V(this, "mutationBuckets", {}), V(this, "loggedTracker", {}), V(this, "refillBuckets", () => {
|
|
1125
|
+
Object.keys(this.mutationBuckets).forEach((e3) => {
|
|
1126
|
+
this.mutationBuckets[e3] = this.mutationBuckets[e3] + this.refillRate, this.mutationBuckets[e3] >= this.bucketSize && delete this.mutationBuckets[e3];
|
|
1127
|
+
});
|
|
1128
|
+
}), V(this, "getNodeOrRelevantParent", (e3) => {
|
|
1129
|
+
var t3 = this.rrweb.mirror.getNode(e3);
|
|
1130
|
+
if ("svg" !== (null == t3 ? void 0 : t3.nodeName) && t3 instanceof Element) {
|
|
1131
|
+
var i3 = t3.closest("svg");
|
|
1132
|
+
if (i3) return [this.rrweb.mirror.getId(i3), i3];
|
|
1133
|
+
}
|
|
1134
|
+
return [e3, t3];
|
|
1135
|
+
}), V(this, "numberOfChanges", (e3) => {
|
|
1136
|
+
var t3, i3, r3, s2, n2, o2, a2, l2;
|
|
1137
|
+
return (null !== (t3 = null === (i3 = e3.removes) || void 0 === i3 ? void 0 : i3.length) && void 0 !== t3 ? t3 : 0) + (null !== (r3 = null === (s2 = e3.attributes) || void 0 === s2 ? void 0 : s2.length) && void 0 !== r3 ? r3 : 0) + (null !== (n2 = null === (o2 = e3.texts) || void 0 === o2 ? void 0 : o2.length) && void 0 !== n2 ? n2 : 0) + (null !== (a2 = null === (l2 = e3.adds) || void 0 === l2 ? void 0 : l2.length) && void 0 !== a2 ? a2 : 0);
|
|
1138
|
+
}), V(this, "throttleMutations", (e3) => {
|
|
1139
|
+
if (3 !== e3.type || 0 !== e3.data.source) return e3;
|
|
1140
|
+
var t3 = e3.data, i3 = this.numberOfChanges(t3);
|
|
1141
|
+
t3.attributes && (t3.attributes = t3.attributes.filter((e4) => {
|
|
1142
|
+
var t4, i4, r4, [s2, n2] = this.getNodeOrRelevantParent(e4.id);
|
|
1143
|
+
if (0 === this.mutationBuckets[s2]) return false;
|
|
1144
|
+
(this.mutationBuckets[s2] = null !== (t4 = this.mutationBuckets[s2]) && void 0 !== t4 ? t4 : this.bucketSize, this.mutationBuckets[s2] = Math.max(this.mutationBuckets[s2] - 1, 0), 0 === this.mutationBuckets[s2]) && (this.loggedTracker[s2] || (this.loggedTracker[s2] = true, null === (i4 = (r4 = this.options).onBlockedNode) || void 0 === i4 || i4.call(r4, s2, n2)));
|
|
1145
|
+
return e4;
|
|
1146
|
+
}));
|
|
1147
|
+
var r3 = this.numberOfChanges(t3);
|
|
1148
|
+
return 0 !== r3 || i3 === r3 ? e3 : void 0;
|
|
1149
|
+
}), this.rrweb = e2, this.options = r2, this.refillRate = bi(null !== (t2 = this.options.refillRate) && void 0 !== t2 ? t2 : this.refillRate, 0, 100, "mutation throttling refill rate"), this.bucketSize = bi(null !== (i2 = this.options.bucketSize) && void 0 !== i2 ? i2 : this.bucketSize, 0, 100, "mutation throttling bucket size"), setInterval(() => {
|
|
1150
|
+
this.refillBuckets();
|
|
1151
|
+
}, 1e3);
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
var Si = Uint8Array;
|
|
1155
|
+
var ki = Uint16Array;
|
|
1156
|
+
var Ei = Uint32Array;
|
|
1157
|
+
var xi = new Si([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]);
|
|
1158
|
+
var Ii = new Si([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]);
|
|
1159
|
+
var Pi = new Si([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
1160
|
+
var Ci = function(e2, t2) {
|
|
1161
|
+
for (var i2 = new ki(31), r2 = 0; r2 < 31; ++r2) i2[r2] = t2 += 1 << e2[r2 - 1];
|
|
1162
|
+
var s2 = new Ei(i2[30]);
|
|
1163
|
+
for (r2 = 1; r2 < 30; ++r2) for (var n2 = i2[r2]; n2 < i2[r2 + 1]; ++n2) s2[n2] = n2 - i2[r2] << 5 | r2;
|
|
1164
|
+
return [i2, s2];
|
|
1165
|
+
};
|
|
1166
|
+
var Fi = Ci(xi, 2);
|
|
1167
|
+
var Ri = Fi[0];
|
|
1168
|
+
var Ti = Fi[1];
|
|
1169
|
+
Ri[28] = 258, Ti[258] = 28;
|
|
1170
|
+
for ($i = Ci(Ii, 0)[1], Oi = new ki(32768), Mi = 0; Mi < 32768; ++Mi) {
|
|
1171
|
+
Ai = (43690 & Mi) >>> 1 | (21845 & Mi) << 1;
|
|
1172
|
+
Ai = (61680 & (Ai = (52428 & Ai) >>> 2 | (13107 & Ai) << 2)) >>> 4 | (3855 & Ai) << 4, Oi[Mi] = ((65280 & Ai) >>> 8 | (255 & Ai) << 8) >>> 1;
|
|
1173
|
+
}
|
|
1174
|
+
var Ai;
|
|
1175
|
+
var $i;
|
|
1176
|
+
var Oi;
|
|
1177
|
+
var Mi;
|
|
1178
|
+
var Li = function(e2, t2, i2) {
|
|
1179
|
+
for (var r2 = e2.length, s2 = 0, n2 = new ki(t2); s2 < r2; ++s2) ++n2[e2[s2] - 1];
|
|
1180
|
+
var o2, a2 = new ki(t2);
|
|
1181
|
+
for (s2 = 0; s2 < t2; ++s2) a2[s2] = a2[s2 - 1] + n2[s2 - 1] << 1;
|
|
1182
|
+
if (i2) {
|
|
1183
|
+
o2 = new ki(1 << t2);
|
|
1184
|
+
var l2 = 15 - t2;
|
|
1185
|
+
for (s2 = 0; s2 < r2; ++s2) if (e2[s2]) for (var c2 = s2 << 4 | e2[s2], u2 = t2 - e2[s2], d2 = a2[e2[s2] - 1]++ << u2, h2 = d2 | (1 << u2) - 1; d2 <= h2; ++d2) o2[Oi[d2] >>> l2] = c2;
|
|
1186
|
+
} else for (o2 = new ki(r2), s2 = 0; s2 < r2; ++s2) o2[s2] = Oi[a2[e2[s2] - 1]++] >>> 15 - e2[s2];
|
|
1187
|
+
return o2;
|
|
1188
|
+
};
|
|
1189
|
+
var Di = new Si(288);
|
|
1190
|
+
for (Mi = 0; Mi < 144; ++Mi) Di[Mi] = 8;
|
|
1191
|
+
for (Mi = 144; Mi < 256; ++Mi) Di[Mi] = 9;
|
|
1192
|
+
for (Mi = 256; Mi < 280; ++Mi) Di[Mi] = 7;
|
|
1193
|
+
for (Mi = 280; Mi < 288; ++Mi) Di[Mi] = 8;
|
|
1194
|
+
var qi = new Si(32);
|
|
1195
|
+
for (Mi = 0; Mi < 32; ++Mi) qi[Mi] = 5;
|
|
1196
|
+
var Ni = Li(Di, 9, 0);
|
|
1197
|
+
var Bi = Li(qi, 5, 0);
|
|
1198
|
+
var Hi = function(e2) {
|
|
1199
|
+
return (e2 / 8 >> 0) + (7 & e2 && 1);
|
|
1200
|
+
};
|
|
1201
|
+
var Ui = function(e2, t2, i2) {
|
|
1202
|
+
(null == i2 || i2 > e2.length) && (i2 = e2.length);
|
|
1203
|
+
var r2 = new (e2 instanceof ki ? ki : e2 instanceof Ei ? Ei : Si)(i2 - t2);
|
|
1204
|
+
return r2.set(e2.subarray(t2, i2)), r2;
|
|
1205
|
+
};
|
|
1206
|
+
var zi = function(e2, t2, i2) {
|
|
1207
|
+
i2 <<= 7 & t2;
|
|
1208
|
+
var r2 = t2 / 8 >> 0;
|
|
1209
|
+
e2[r2] |= i2, e2[r2 + 1] |= i2 >>> 8;
|
|
1210
|
+
};
|
|
1211
|
+
var ji = function(e2, t2, i2) {
|
|
1212
|
+
i2 <<= 7 & t2;
|
|
1213
|
+
var r2 = t2 / 8 >> 0;
|
|
1214
|
+
e2[r2] |= i2, e2[r2 + 1] |= i2 >>> 8, e2[r2 + 2] |= i2 >>> 16;
|
|
1215
|
+
};
|
|
1216
|
+
var Wi = function(e2, t2) {
|
|
1217
|
+
for (var i2 = [], r2 = 0; r2 < e2.length; ++r2) e2[r2] && i2.push({ s: r2, f: e2[r2] });
|
|
1218
|
+
var s2 = i2.length, n2 = i2.slice();
|
|
1219
|
+
if (!s2) return [new Si(0), 0];
|
|
1220
|
+
if (1 == s2) {
|
|
1221
|
+
var o2 = new Si(i2[0].s + 1);
|
|
1222
|
+
return o2[i2[0].s] = 1, [o2, 1];
|
|
1223
|
+
}
|
|
1224
|
+
i2.sort(function(e3, t3) {
|
|
1225
|
+
return e3.f - t3.f;
|
|
1226
|
+
}), i2.push({ s: -1, f: 25001 });
|
|
1227
|
+
var a2 = i2[0], l2 = i2[1], c2 = 0, u2 = 1, d2 = 2;
|
|
1228
|
+
for (i2[0] = { s: -1, f: a2.f + l2.f, l: a2, r: l2 }; u2 != s2 - 1; ) a2 = i2[i2[c2].f < i2[d2].f ? c2++ : d2++], l2 = i2[c2 != u2 && i2[c2].f < i2[d2].f ? c2++ : d2++], i2[u2++] = { s: -1, f: a2.f + l2.f, l: a2, r: l2 };
|
|
1229
|
+
var h2 = n2[0].s;
|
|
1230
|
+
for (r2 = 1; r2 < s2; ++r2) n2[r2].s > h2 && (h2 = n2[r2].s);
|
|
1231
|
+
var _2 = new ki(h2 + 1), p2 = Vi(i2[u2 - 1], _2, 0);
|
|
1232
|
+
if (p2 > t2) {
|
|
1233
|
+
r2 = 0;
|
|
1234
|
+
var g2 = 0, v2 = p2 - t2, f2 = 1 << v2;
|
|
1235
|
+
for (n2.sort(function(e3, t3) {
|
|
1236
|
+
return _2[t3.s] - _2[e3.s] || e3.f - t3.f;
|
|
1237
|
+
}); r2 < s2; ++r2) {
|
|
1238
|
+
var m2 = n2[r2].s;
|
|
1239
|
+
if (!(_2[m2] > t2)) break;
|
|
1240
|
+
g2 += f2 - (1 << p2 - _2[m2]), _2[m2] = t2;
|
|
1241
|
+
}
|
|
1242
|
+
for (g2 >>>= v2; g2 > 0; ) {
|
|
1243
|
+
var y2 = n2[r2].s;
|
|
1244
|
+
_2[y2] < t2 ? g2 -= 1 << t2 - _2[y2]++ - 1 : ++r2;
|
|
1245
|
+
}
|
|
1246
|
+
for (; r2 >= 0 && g2; --r2) {
|
|
1247
|
+
var b2 = n2[r2].s;
|
|
1248
|
+
_2[b2] == t2 && (--_2[b2], ++g2);
|
|
1249
|
+
}
|
|
1250
|
+
p2 = t2;
|
|
1251
|
+
}
|
|
1252
|
+
return [new Si(_2), p2];
|
|
1253
|
+
};
|
|
1254
|
+
var Vi = function(e2, t2, i2) {
|
|
1255
|
+
return -1 == e2.s ? Math.max(Vi(e2.l, t2, i2 + 1), Vi(e2.r, t2, i2 + 1)) : t2[e2.s] = i2;
|
|
1256
|
+
};
|
|
1257
|
+
var Gi = function(e2) {
|
|
1258
|
+
for (var t2 = e2.length; t2 && !e2[--t2]; ) ;
|
|
1259
|
+
for (var i2 = new ki(++t2), r2 = 0, s2 = e2[0], n2 = 1, o2 = function(e3) {
|
|
1260
|
+
i2[r2++] = e3;
|
|
1261
|
+
}, a2 = 1; a2 <= t2; ++a2) if (e2[a2] == s2 && a2 != t2) ++n2;
|
|
1262
|
+
else {
|
|
1263
|
+
if (!s2 && n2 > 2) {
|
|
1264
|
+
for (; n2 > 138; n2 -= 138) o2(32754);
|
|
1265
|
+
n2 > 2 && (o2(n2 > 10 ? n2 - 11 << 5 | 28690 : n2 - 3 << 5 | 12305), n2 = 0);
|
|
1266
|
+
} else if (n2 > 3) {
|
|
1267
|
+
for (o2(s2), --n2; n2 > 6; n2 -= 6) o2(8304);
|
|
1268
|
+
n2 > 2 && (o2(n2 - 3 << 5 | 8208), n2 = 0);
|
|
1269
|
+
}
|
|
1270
|
+
for (; n2--; ) o2(s2);
|
|
1271
|
+
n2 = 1, s2 = e2[a2];
|
|
1272
|
+
}
|
|
1273
|
+
return [i2.subarray(0, r2), t2];
|
|
1274
|
+
};
|
|
1275
|
+
var Ji = function(e2, t2) {
|
|
1276
|
+
for (var i2 = 0, r2 = 0; r2 < t2.length; ++r2) i2 += e2[r2] * t2[r2];
|
|
1277
|
+
return i2;
|
|
1278
|
+
};
|
|
1279
|
+
var Yi = function(e2, t2, i2) {
|
|
1280
|
+
var r2 = i2.length, s2 = Hi(t2 + 2);
|
|
1281
|
+
e2[s2] = 255 & r2, e2[s2 + 1] = r2 >>> 8, e2[s2 + 2] = 255 ^ e2[s2], e2[s2 + 3] = 255 ^ e2[s2 + 1];
|
|
1282
|
+
for (var n2 = 0; n2 < r2; ++n2) e2[s2 + n2 + 4] = i2[n2];
|
|
1283
|
+
return 8 * (s2 + 4 + r2);
|
|
1284
|
+
};
|
|
1285
|
+
var Ki = function(e2, t2, i2, r2, s2, n2, o2, a2, l2, c2, u2) {
|
|
1286
|
+
zi(t2, u2++, i2), ++s2[256];
|
|
1287
|
+
for (var d2 = Wi(s2, 15), h2 = d2[0], _2 = d2[1], p2 = Wi(n2, 15), g2 = p2[0], v2 = p2[1], f2 = Gi(h2), m2 = f2[0], y2 = f2[1], b2 = Gi(g2), w2 = b2[0], S2 = b2[1], k2 = new ki(19), E2 = 0; E2 < m2.length; ++E2) k2[31 & m2[E2]]++;
|
|
1288
|
+
for (E2 = 0; E2 < w2.length; ++E2) k2[31 & w2[E2]]++;
|
|
1289
|
+
for (var x2 = Wi(k2, 7), I2 = x2[0], P2 = x2[1], C2 = 19; C2 > 4 && !I2[Pi[C2 - 1]]; --C2) ;
|
|
1290
|
+
var F2, R2, T2, $2, O2 = c2 + 5 << 3, M2 = Ji(s2, Di) + Ji(n2, qi) + o2, A2 = Ji(s2, h2) + Ji(n2, g2) + o2 + 14 + 3 * C2 + Ji(k2, I2) + (2 * k2[16] + 3 * k2[17] + 7 * k2[18]);
|
|
1291
|
+
if (O2 <= M2 && O2 <= A2) return Yi(t2, u2, e2.subarray(l2, l2 + c2));
|
|
1292
|
+
if (zi(t2, u2, 1 + (A2 < M2)), u2 += 2, A2 < M2) {
|
|
1293
|
+
F2 = Li(h2, _2, 0), R2 = h2, T2 = Li(g2, v2, 0), $2 = g2;
|
|
1294
|
+
var L2 = Li(I2, P2, 0);
|
|
1295
|
+
zi(t2, u2, y2 - 257), zi(t2, u2 + 5, S2 - 1), zi(t2, u2 + 10, C2 - 4), u2 += 14;
|
|
1296
|
+
for (E2 = 0; E2 < C2; ++E2) zi(t2, u2 + 3 * E2, I2[Pi[E2]]);
|
|
1297
|
+
u2 += 3 * C2;
|
|
1298
|
+
for (var D2 = [m2, w2], q2 = 0; q2 < 2; ++q2) {
|
|
1299
|
+
var N2 = D2[q2];
|
|
1300
|
+
for (E2 = 0; E2 < N2.length; ++E2) {
|
|
1301
|
+
var B2 = 31 & N2[E2];
|
|
1302
|
+
zi(t2, u2, L2[B2]), u2 += I2[B2], B2 > 15 && (zi(t2, u2, N2[E2] >>> 5 & 127), u2 += N2[E2] >>> 12);
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
} else F2 = Ni, R2 = Di, T2 = Bi, $2 = qi;
|
|
1306
|
+
for (E2 = 0; E2 < a2; ++E2) if (r2[E2] > 255) {
|
|
1307
|
+
B2 = r2[E2] >>> 18 & 31;
|
|
1308
|
+
ji(t2, u2, F2[B2 + 257]), u2 += R2[B2 + 257], B2 > 7 && (zi(t2, u2, r2[E2] >>> 23 & 31), u2 += xi[B2]);
|
|
1309
|
+
var H2 = 31 & r2[E2];
|
|
1310
|
+
ji(t2, u2, T2[H2]), u2 += $2[H2], H2 > 3 && (ji(t2, u2, r2[E2] >>> 5 & 8191), u2 += Ii[H2]);
|
|
1311
|
+
} else ji(t2, u2, F2[r2[E2]]), u2 += R2[r2[E2]];
|
|
1312
|
+
return ji(t2, u2, F2[256]), u2 + R2[256];
|
|
1313
|
+
};
|
|
1314
|
+
var Xi = new Ei([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
|
|
1315
|
+
var Qi = function() {
|
|
1316
|
+
for (var e2 = new Ei(256), t2 = 0; t2 < 256; ++t2) {
|
|
1317
|
+
for (var i2 = t2, r2 = 9; --r2; ) i2 = (1 & i2 && 3988292384) ^ i2 >>> 1;
|
|
1318
|
+
e2[t2] = i2;
|
|
1319
|
+
}
|
|
1320
|
+
return e2;
|
|
1321
|
+
}();
|
|
1322
|
+
var Zi = function() {
|
|
1323
|
+
var e2 = 4294967295;
|
|
1324
|
+
return { p: function(t2) {
|
|
1325
|
+
for (var i2 = e2, r2 = 0; r2 < t2.length; ++r2) i2 = Qi[255 & i2 ^ t2[r2]] ^ i2 >>> 8;
|
|
1326
|
+
e2 = i2;
|
|
1327
|
+
}, d: function() {
|
|
1328
|
+
return 4294967295 ^ e2;
|
|
1329
|
+
} };
|
|
1330
|
+
};
|
|
1331
|
+
var er = function(e2, t2, i2, r2, s2) {
|
|
1332
|
+
return function(e3, t3, i3, r3, s3, n2) {
|
|
1333
|
+
var o2 = e3.length, a2 = new Si(r3 + o2 + 5 * (1 + Math.floor(o2 / 7e3)) + s3), l2 = a2.subarray(r3, a2.length - s3), c2 = 0;
|
|
1334
|
+
if (!t3 || o2 < 8) for (var u2 = 0; u2 <= o2; u2 += 65535) {
|
|
1335
|
+
var d2 = u2 + 65535;
|
|
1336
|
+
d2 < o2 ? c2 = Yi(l2, c2, e3.subarray(u2, d2)) : (l2[u2] = n2, c2 = Yi(l2, c2, e3.subarray(u2, o2)));
|
|
1337
|
+
}
|
|
1338
|
+
else {
|
|
1339
|
+
for (var h2 = Xi[t3 - 1], _2 = h2 >>> 13, p2 = 8191 & h2, g2 = (1 << i3) - 1, v2 = new ki(32768), f2 = new ki(g2 + 1), m2 = Math.ceil(i3 / 3), y2 = 2 * m2, b2 = function(t4) {
|
|
1340
|
+
return (e3[t4] ^ e3[t4 + 1] << m2 ^ e3[t4 + 2] << y2) & g2;
|
|
1341
|
+
}, w2 = new Ei(25e3), S2 = new ki(288), k2 = new ki(32), E2 = 0, x2 = 0, I2 = (u2 = 0, 0), P2 = 0, C2 = 0; u2 < o2; ++u2) {
|
|
1342
|
+
var F2 = b2(u2), R2 = 32767 & u2, T2 = f2[F2];
|
|
1343
|
+
if (v2[R2] = T2, f2[F2] = R2, P2 <= u2) {
|
|
1344
|
+
var $2 = o2 - u2;
|
|
1345
|
+
if ((E2 > 7e3 || I2 > 24576) && $2 > 423) {
|
|
1346
|
+
c2 = Ki(e3, l2, 0, w2, S2, k2, x2, I2, C2, u2 - C2, c2), I2 = E2 = x2 = 0, C2 = u2;
|
|
1347
|
+
for (var O2 = 0; O2 < 286; ++O2) S2[O2] = 0;
|
|
1348
|
+
for (O2 = 0; O2 < 30; ++O2) k2[O2] = 0;
|
|
1349
|
+
}
|
|
1350
|
+
var M2 = 2, A2 = 0, L2 = p2, D2 = R2 - T2 & 32767;
|
|
1351
|
+
if ($2 > 2 && F2 == b2(u2 - D2)) for (var q2 = Math.min(_2, $2) - 1, N2 = Math.min(32767, u2), B2 = Math.min(258, $2); D2 <= N2 && --L2 && R2 != T2; ) {
|
|
1352
|
+
if (e3[u2 + M2] == e3[u2 + M2 - D2]) {
|
|
1353
|
+
for (var H2 = 0; H2 < B2 && e3[u2 + H2] == e3[u2 + H2 - D2]; ++H2) ;
|
|
1354
|
+
if (H2 > M2) {
|
|
1355
|
+
if (M2 = H2, A2 = D2, H2 > q2) break;
|
|
1356
|
+
var U2 = Math.min(D2, H2 - 2), z2 = 0;
|
|
1357
|
+
for (O2 = 0; O2 < U2; ++O2) {
|
|
1358
|
+
var j2 = u2 - D2 + O2 + 32768 & 32767, W2 = j2 - v2[j2] + 32768 & 32767;
|
|
1359
|
+
W2 > z2 && (z2 = W2, T2 = j2);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
D2 += (R2 = T2) - (T2 = v2[R2]) + 32768 & 32767;
|
|
1364
|
+
}
|
|
1365
|
+
if (A2) {
|
|
1366
|
+
w2[I2++] = 268435456 | Ti[M2] << 18 | $i[A2];
|
|
1367
|
+
var V2 = 31 & Ti[M2], G2 = 31 & $i[A2];
|
|
1368
|
+
x2 += xi[V2] + Ii[G2], ++S2[257 + V2], ++k2[G2], P2 = u2 + M2, ++E2;
|
|
1369
|
+
} else w2[I2++] = e3[u2], ++S2[e3[u2]];
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
c2 = Ki(e3, l2, n2, w2, S2, k2, x2, I2, C2, u2 - C2, c2);
|
|
1373
|
+
}
|
|
1374
|
+
return Ui(a2, 0, r3 + Hi(c2) + s3);
|
|
1375
|
+
}(e2, null == t2.level ? 6 : t2.level, null == t2.mem ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(e2.length)))) : 12 + t2.mem, i2, r2, !s2);
|
|
1376
|
+
};
|
|
1377
|
+
var tr = function(e2, t2, i2) {
|
|
1378
|
+
for (; i2; ++t2) e2[t2] = i2, i2 >>>= 8;
|
|
1379
|
+
};
|
|
1380
|
+
var ir = function(e2, t2) {
|
|
1381
|
+
var i2 = t2.filename;
|
|
1382
|
+
if (e2[0] = 31, e2[1] = 139, e2[2] = 8, e2[8] = t2.level < 2 ? 4 : 9 == t2.level ? 2 : 0, e2[9] = 3, 0 != t2.mtime && tr(e2, 4, Math.floor(new Date(t2.mtime || Date.now()) / 1e3)), i2) {
|
|
1383
|
+
e2[3] = 8;
|
|
1384
|
+
for (var r2 = 0; r2 <= i2.length; ++r2) e2[r2 + 10] = i2.charCodeAt(r2);
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
var rr = function(e2) {
|
|
1388
|
+
return 10 + (e2.filename && e2.filename.length + 1 || 0);
|
|
1389
|
+
};
|
|
1390
|
+
function sr(e2, t2) {
|
|
1391
|
+
void 0 === t2 && (t2 = {});
|
|
1392
|
+
var i2 = Zi(), r2 = e2.length;
|
|
1393
|
+
i2.p(e2);
|
|
1394
|
+
var s2 = er(e2, t2, rr(t2), 8), n2 = s2.length;
|
|
1395
|
+
return ir(s2, t2), tr(s2, n2 - 8, i2.d()), tr(s2, n2 - 4, r2), s2;
|
|
1396
|
+
}
|
|
1397
|
+
function nr(e2, t2) {
|
|
1398
|
+
var i2 = e2.length;
|
|
1399
|
+
if ("undefined" != typeof TextEncoder) return new TextEncoder().encode(e2);
|
|
1400
|
+
for (var r2 = new Si(e2.length + (e2.length >>> 1)), s2 = 0, n2 = function(e3) {
|
|
1401
|
+
r2[s2++] = e3;
|
|
1402
|
+
}, o2 = 0; o2 < i2; ++o2) {
|
|
1403
|
+
if (s2 + 5 > r2.length) {
|
|
1404
|
+
var a2 = new Si(s2 + 8 + (i2 - o2 << 1));
|
|
1405
|
+
a2.set(r2), r2 = a2;
|
|
1406
|
+
}
|
|
1407
|
+
var l2 = e2.charCodeAt(o2);
|
|
1408
|
+
l2 < 128 || t2 ? n2(l2) : l2 < 2048 ? (n2(192 | l2 >>> 6), n2(128 | 63 & l2)) : l2 > 55295 && l2 < 57344 ? (n2(240 | (l2 = 65536 + (1047552 & l2) | 1023 & e2.charCodeAt(++o2)) >>> 18), n2(128 | l2 >>> 12 & 63), n2(128 | l2 >>> 6 & 63), n2(128 | 63 & l2)) : (n2(224 | l2 >>> 12), n2(128 | l2 >>> 6 & 63), n2(128 | 63 & l2));
|
|
1409
|
+
}
|
|
1410
|
+
return Ui(r2, 0, s2);
|
|
1411
|
+
}
|
|
1412
|
+
function or(e2, t2) {
|
|
1413
|
+
return function(e3) {
|
|
1414
|
+
for (var t3 = 0, i2 = 0; i2 < e3.length; i2++) t3 = (t3 << 5) - t3 + e3.charCodeAt(i2), t3 |= 0;
|
|
1415
|
+
return Math.abs(t3);
|
|
1416
|
+
}(e2) % 100 < bi(100 * t2, 0, 100);
|
|
1417
|
+
}
|
|
1418
|
+
var ar = "[SessionRecording]";
|
|
1419
|
+
var lr = H(ar);
|
|
1420
|
+
var cr = 3e5;
|
|
1421
|
+
var ur = [ui.MouseMove, ui.MouseInteraction, ui.Scroll, ui.ViewportResize, ui.Input, ui.TouchMove, ui.MediaInteraction, ui.Drag];
|
|
1422
|
+
var dr = (e2) => ({ rrwebMethod: e2, enqueuedAt: Date.now(), attempt: 1 });
|
|
1423
|
+
function hr(e2) {
|
|
1424
|
+
return function(e3, t2) {
|
|
1425
|
+
for (var i2 = "", r2 = 0; r2 < e3.length; ) {
|
|
1426
|
+
var s2 = e3[r2++];
|
|
1427
|
+
s2 < 128 || t2 ? i2 += String.fromCharCode(s2) : s2 < 224 ? i2 += String.fromCharCode((31 & s2) << 6 | 63 & e3[r2++]) : s2 < 240 ? i2 += String.fromCharCode((15 & s2) << 12 | (63 & e3[r2++]) << 6 | 63 & e3[r2++]) : (s2 = ((15 & s2) << 18 | (63 & e3[r2++]) << 12 | (63 & e3[r2++]) << 6 | 63 & e3[r2++]) - 65536, i2 += String.fromCharCode(55296 | s2 >> 10, 56320 | 1023 & s2));
|
|
1428
|
+
}
|
|
1429
|
+
return i2;
|
|
1430
|
+
}(sr(nr(JSON.stringify(e2))), true);
|
|
1431
|
+
}
|
|
1432
|
+
function _r(e2) {
|
|
1433
|
+
return e2.type === ci.Custom && "sessionIdle" === e2.data.tag;
|
|
1434
|
+
}
|
|
1435
|
+
function pr(e2, t2) {
|
|
1436
|
+
return t2.some((t3) => "regex" === t3.matching && new RegExp(t3.url).test(e2));
|
|
1437
|
+
}
|
|
1438
|
+
var gr = class {
|
|
1439
|
+
get sessionIdleThresholdMilliseconds() {
|
|
1440
|
+
return this.instance.config.session_recording.session_idle_threshold_ms || 3e5;
|
|
1441
|
+
}
|
|
1442
|
+
get rrwebRecord() {
|
|
1443
|
+
var e2, t2;
|
|
1444
|
+
return null == _ || null === (e2 = _.__PosthogExtensions__) || void 0 === e2 || null === (t2 = e2.rrweb) || void 0 === t2 ? void 0 : t2.record;
|
|
1445
|
+
}
|
|
1446
|
+
get started() {
|
|
1447
|
+
return this._captureStarted;
|
|
1448
|
+
}
|
|
1449
|
+
get sessionManager() {
|
|
1450
|
+
if (!this.instance.sessionManager) throw new Error(ar + " must be started with a valid sessionManager.");
|
|
1451
|
+
return this.instance.sessionManager;
|
|
1452
|
+
}
|
|
1453
|
+
get fullSnapshotIntervalMillis() {
|
|
1454
|
+
var e2, t2;
|
|
1455
|
+
return "trigger_pending" === this.triggerStatus ? 6e4 : null !== (e2 = null === (t2 = this.instance.config.session_recording) || void 0 === t2 ? void 0 : t2.full_snapshot_interval_millis) && void 0 !== e2 ? e2 : cr;
|
|
1456
|
+
}
|
|
1457
|
+
get isSampled() {
|
|
1458
|
+
var e2 = this.instance.get_property(xe);
|
|
1459
|
+
return A(e2) ? e2 : null;
|
|
1460
|
+
}
|
|
1461
|
+
get sessionDuration() {
|
|
1462
|
+
var e2, t2, i2 = null === (e2 = this.buffer) || void 0 === e2 ? void 0 : e2.data[(null === (t2 = this.buffer) || void 0 === t2 ? void 0 : t2.data.length) - 1], { sessionStartTimestamp: r2 } = this.sessionManager.checkAndGetSessionAndWindowId(true);
|
|
1463
|
+
return i2 ? i2.timestamp - r2 : null;
|
|
1464
|
+
}
|
|
1465
|
+
get isRecordingEnabled() {
|
|
1466
|
+
var e2 = !!this.instance.get_property(fe), i2 = !this.instance.config.disable_session_recording;
|
|
1467
|
+
return t && e2 && i2;
|
|
1468
|
+
}
|
|
1469
|
+
get isConsoleLogCaptureEnabled() {
|
|
1470
|
+
var e2 = !!this.instance.get_property(me), t2 = this.instance.config.enable_recording_console_log;
|
|
1471
|
+
return null != t2 ? t2 : e2;
|
|
1472
|
+
}
|
|
1473
|
+
get canvasRecording() {
|
|
1474
|
+
var e2, t2, i2, r2, s2, n2, o2 = this.instance.config.session_recording.captureCanvas, a2 = this.instance.get_property(be), l2 = null !== (e2 = null !== (t2 = null == o2 ? void 0 : o2.recordCanvas) && void 0 !== t2 ? t2 : null == a2 ? void 0 : a2.enabled) && void 0 !== e2 && e2, c2 = null !== (i2 = null !== (r2 = null == o2 ? void 0 : o2.canvasFps) && void 0 !== r2 ? r2 : null == a2 ? void 0 : a2.fps) && void 0 !== i2 ? i2 : 4, u2 = null !== (s2 = null !== (n2 = null == o2 ? void 0 : o2.canvasQuality) && void 0 !== n2 ? n2 : null == a2 ? void 0 : a2.quality) && void 0 !== s2 ? s2 : 0.4;
|
|
1475
|
+
if ("string" == typeof u2) {
|
|
1476
|
+
var d2 = parseFloat(u2);
|
|
1477
|
+
u2 = isNaN(d2) ? 0.4 : d2;
|
|
1478
|
+
}
|
|
1479
|
+
return { enabled: l2, fps: bi(c2, 0, 12, "canvas recording fps", 4), quality: bi(u2, 0, 1, "canvas recording quality", 0.4) };
|
|
1480
|
+
}
|
|
1481
|
+
get networkPayloadCapture() {
|
|
1482
|
+
var e2, t2, i2 = this.instance.get_property(ye), r2 = { recordHeaders: null === (e2 = this.instance.config.session_recording) || void 0 === e2 ? void 0 : e2.recordHeaders, recordBody: null === (t2 = this.instance.config.session_recording) || void 0 === t2 ? void 0 : t2.recordBody }, s2 = (null == r2 ? void 0 : r2.recordHeaders) || (null == i2 ? void 0 : i2.recordHeaders), n2 = (null == r2 ? void 0 : r2.recordBody) || (null == i2 ? void 0 : i2.recordBody), o2 = P(this.instance.config.capture_performance) ? this.instance.config.capture_performance.network_timing : this.instance.config.capture_performance, a2 = !!(A(o2) ? o2 : null == i2 ? void 0 : i2.capturePerformance);
|
|
1483
|
+
return s2 || n2 || a2 ? { recordHeaders: s2, recordBody: n2, recordPerformance: a2 } : void 0;
|
|
1484
|
+
}
|
|
1485
|
+
get sampleRate() {
|
|
1486
|
+
var e2 = this.instance.get_property(we);
|
|
1487
|
+
return M(e2) ? e2 : null;
|
|
1488
|
+
}
|
|
1489
|
+
get minimumDuration() {
|
|
1490
|
+
var e2 = this.instance.get_property(Se);
|
|
1491
|
+
return M(e2) ? e2 : null;
|
|
1492
|
+
}
|
|
1493
|
+
get status() {
|
|
1494
|
+
return this.receivedDecide ? this.isRecordingEnabled ? false === this.isSampled ? "disabled" : this._urlBlocked ? "paused" : O(this._linkedFlag) || this._linkedFlagSeen ? "trigger_pending" === this.triggerStatus ? "buffering" : A(this.isSampled) ? this.isSampled ? "sampled" : "disabled" : "active" : "buffering" : "disabled" : "buffering";
|
|
1495
|
+
}
|
|
1496
|
+
get urlTriggerStatus() {
|
|
1497
|
+
var e2;
|
|
1498
|
+
return 0 === this._urlTriggers.length ? "trigger_disabled" : (null === (e2 = this.instance) || void 0 === e2 ? void 0 : e2.get_property(Ie)) === this.sessionId ? "trigger_activated" : "trigger_pending";
|
|
1499
|
+
}
|
|
1500
|
+
get eventTriggerStatus() {
|
|
1501
|
+
var e2;
|
|
1502
|
+
return 0 === this._eventTriggers.length ? "trigger_disabled" : (null === (e2 = this.instance) || void 0 === e2 ? void 0 : e2.get_property(Pe)) === this.sessionId ? "trigger_activated" : "trigger_pending";
|
|
1503
|
+
}
|
|
1504
|
+
get triggerStatus() {
|
|
1505
|
+
var e2 = "trigger_activated" === this.eventTriggerStatus || "trigger_activated" === this.urlTriggerStatus, t2 = "trigger_pending" === this.eventTriggerStatus || "trigger_pending" === this.urlTriggerStatus;
|
|
1506
|
+
return e2 ? "trigger_activated" : t2 ? "trigger_pending" : "trigger_disabled";
|
|
1507
|
+
}
|
|
1508
|
+
constructor(e2) {
|
|
1509
|
+
if (V(this, "queuedRRWebEvents", []), V(this, "isIdle", false), V(this, "_linkedFlagSeen", false), V(this, "_lastActivityTimestamp", Date.now()), V(this, "_linkedFlag", null), V(this, "_removePageViewCaptureHook", void 0), V(this, "_onSessionIdListener", void 0), V(this, "_persistDecideOnSessionListener", void 0), V(this, "_samplingSessionListener", void 0), V(this, "_urlTriggers", []), V(this, "_urlBlocklist", []), V(this, "_urlBlocked", false), V(this, "_eventTriggers", []), V(this, "_removeEventTriggerCaptureHook", void 0), V(this, "_forceAllowLocalhostNetworkCapture", false), V(this, "_onBeforeUnload", () => {
|
|
1510
|
+
this._flushBuffer();
|
|
1511
|
+
}), V(this, "_onOffline", () => {
|
|
1512
|
+
this._tryAddCustomEvent("browser offline", {});
|
|
1513
|
+
}), V(this, "_onOnline", () => {
|
|
1514
|
+
this._tryAddCustomEvent("browser online", {});
|
|
1515
|
+
}), V(this, "_onVisibilityChange", () => {
|
|
1516
|
+
if (null != a && a.visibilityState) {
|
|
1517
|
+
var e3 = "window " + a.visibilityState;
|
|
1518
|
+
this._tryAddCustomEvent(e3, {});
|
|
1519
|
+
}
|
|
1520
|
+
}), this.instance = e2, this._captureStarted = false, this._endpoint = "/s/", this.stopRrweb = void 0, this.receivedDecide = false, !this.instance.sessionManager) throw lr.error("started without valid sessionManager"), new Error(ar + " started without valid sessionManager. This is a bug.");
|
|
1521
|
+
if (this.instance.config.__preview_experimental_cookieless_mode) throw new Error(ar + " cannot be used with __preview_experimental_cookieless_mode.");
|
|
1522
|
+
var { sessionId: t2, windowId: i2 } = this.sessionManager.checkAndGetSessionAndWindowId();
|
|
1523
|
+
this.sessionId = t2, this.windowId = i2, this.buffer = this.clearBuffer(), this.sessionIdleThresholdMilliseconds >= this.sessionManager.sessionTimeoutMs && lr.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"));
|
|
1524
|
+
}
|
|
1525
|
+
startIfEnabledOrStop(e2) {
|
|
1526
|
+
this.isRecordingEnabled ? (this._startCapture(e2), ae(t, "beforeunload", this._onBeforeUnload), ae(t, "offline", this._onOffline), ae(t, "online", this._onOnline), ae(t, "visibilitychange", this._onVisibilityChange), this._setupSampling(), this._addEventTriggerListener(), O(this._removePageViewCaptureHook) && (this._removePageViewCaptureHook = this.instance.on("eventCaptured", (e3) => {
|
|
1527
|
+
try {
|
|
1528
|
+
if ("$pageview" === e3.event) {
|
|
1529
|
+
var t2 = null != e3 && e3.properties.$current_url ? this._maskUrl(null == e3 ? void 0 : e3.properties.$current_url) : "";
|
|
1530
|
+
if (!t2) return;
|
|
1531
|
+
this._tryAddCustomEvent("$pageview", { href: t2 });
|
|
1532
|
+
}
|
|
1533
|
+
} catch (e4) {
|
|
1534
|
+
lr.error("Could not add $pageview to rrweb session", e4);
|
|
1535
|
+
}
|
|
1536
|
+
})), this._onSessionIdListener || (this._onSessionIdListener = this.sessionManager.onSessionId((e3, t2, i2) => {
|
|
1537
|
+
var r2, s2, n2, o2;
|
|
1538
|
+
i2 && (this._tryAddCustomEvent("$session_id_change", { sessionId: e3, windowId: t2, changeReason: i2 }), null === (r2 = this.instance) || void 0 === r2 || null === (s2 = r2.persistence) || void 0 === s2 || s2.unregister(Pe), null === (n2 = this.instance) || void 0 === n2 || null === (o2 = n2.persistence) || void 0 === o2 || o2.unregister(Ie));
|
|
1539
|
+
}))) : this.stopRecording();
|
|
1540
|
+
}
|
|
1541
|
+
stopRecording() {
|
|
1542
|
+
var e2, i2, r2, s2;
|
|
1543
|
+
this._captureStarted && this.stopRrweb && (this.stopRrweb(), this.stopRrweb = void 0, this._captureStarted = false, null == t || t.removeEventListener("beforeunload", this._onBeforeUnload), null == t || t.removeEventListener("offline", this._onOffline), null == t || t.removeEventListener("online", this._onOnline), null == t || t.removeEventListener("visibilitychange", this._onVisibilityChange), this.clearBuffer(), clearInterval(this._fullSnapshotTimer), null === (e2 = this._removePageViewCaptureHook) || void 0 === e2 || e2.call(this), this._removePageViewCaptureHook = void 0, null === (i2 = this._removeEventTriggerCaptureHook) || void 0 === i2 || i2.call(this), this._removeEventTriggerCaptureHook = void 0, null === (r2 = this._onSessionIdListener) || void 0 === r2 || r2.call(this), this._onSessionIdListener = void 0, null === (s2 = this._samplingSessionListener) || void 0 === s2 || s2.call(this), this._samplingSessionListener = void 0, lr.info("stopped"));
|
|
1544
|
+
}
|
|
1545
|
+
makeSamplingDecision(e2) {
|
|
1546
|
+
var t2, i2 = this.sessionId !== e2, r2 = this.sampleRate;
|
|
1547
|
+
if (M(r2)) {
|
|
1548
|
+
var s2 = this.isSampled, n2 = i2 || !A(s2), o2 = n2 ? or(e2, r2) : s2;
|
|
1549
|
+
n2 && (o2 ? this._reportStarted("sampled") : lr.warn("Sample rate (".concat(r2, ") has determined that this sessionId (").concat(e2, ") will not be sent to the server.")), this._tryAddCustomEvent("samplingDecisionMade", { sampleRate: r2, isSampled: o2 })), null === (t2 = this.instance.persistence) || void 0 === t2 || t2.register({ [xe]: o2 });
|
|
1550
|
+
} else {
|
|
1551
|
+
var a2;
|
|
1552
|
+
null === (a2 = this.instance.persistence) || void 0 === a2 || a2.register({ [xe]: null });
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
onRemoteConfig(e2) {
|
|
1556
|
+
var t2, i2, r2, s2, n2, o2;
|
|
1557
|
+
(this._tryAddCustomEvent("$remote_config_received", e2), this._persistRemoteConfig(e2), this._linkedFlag = (null === (t2 = e2.sessionRecording) || void 0 === t2 ? void 0 : t2.linkedFlag) || null, null !== (i2 = e2.sessionRecording) && void 0 !== i2 && i2.endpoint) && (this._endpoint = null === (o2 = e2.sessionRecording) || void 0 === o2 ? void 0 : o2.endpoint);
|
|
1558
|
+
if (this._setupSampling(), !O(this._linkedFlag) && !this._linkedFlagSeen) {
|
|
1559
|
+
var a2 = R(this._linkedFlag) ? this._linkedFlag : this._linkedFlag.flag, l2 = R(this._linkedFlag) ? null : this._linkedFlag.variant;
|
|
1560
|
+
this.instance.onFeatureFlags((e3, t3) => {
|
|
1561
|
+
var i3 = P(t3) && a2 in t3, r3 = l2 ? t3[a2] === l2 : i3;
|
|
1562
|
+
r3 && this._reportStarted("linked_flag_matched", { linkedFlag: a2, linkedVariant: l2 }), this._linkedFlagSeen = r3;
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
null !== (r2 = e2.sessionRecording) && void 0 !== r2 && r2.urlTriggers && (this._urlTriggers = e2.sessionRecording.urlTriggers), null !== (s2 = e2.sessionRecording) && void 0 !== s2 && s2.urlBlocklist && (this._urlBlocklist = e2.sessionRecording.urlBlocklist), null !== (n2 = e2.sessionRecording) && void 0 !== n2 && n2.eventTriggers && (this._eventTriggers = e2.sessionRecording.eventTriggers), this.receivedDecide = true, this.startIfEnabledOrStop();
|
|
1566
|
+
}
|
|
1567
|
+
_setupSampling() {
|
|
1568
|
+
M(this.sampleRate) && O(this._samplingSessionListener) && (this._samplingSessionListener = this.sessionManager.onSessionId((e2) => {
|
|
1569
|
+
this.makeSamplingDecision(e2);
|
|
1570
|
+
}));
|
|
1571
|
+
}
|
|
1572
|
+
_persistRemoteConfig(e2) {
|
|
1573
|
+
if (this.instance.persistence) {
|
|
1574
|
+
var t2, i2 = this.instance.persistence, r2 = () => {
|
|
1575
|
+
var t3, r3, s2, n2, o2, a2, l2, c2, u2 = null === (t3 = e2.sessionRecording) || void 0 === t3 ? void 0 : t3.sampleRate, d2 = O(u2) ? null : parseFloat(u2), h2 = null === (r3 = e2.sessionRecording) || void 0 === r3 ? void 0 : r3.minimumDurationMilliseconds;
|
|
1576
|
+
i2.register({ [fe]: !!e2.sessionRecording, [me]: null === (s2 = e2.sessionRecording) || void 0 === s2 ? void 0 : s2.consoleLogRecordingEnabled, [ye]: W({ capturePerformance: e2.capturePerformance }, null === (n2 = e2.sessionRecording) || void 0 === n2 ? void 0 : n2.networkPayloadCapture), [be]: { enabled: null === (o2 = e2.sessionRecording) || void 0 === o2 ? void 0 : o2.recordCanvas, fps: null === (a2 = e2.sessionRecording) || void 0 === a2 ? void 0 : a2.canvasFps, quality: null === (l2 = e2.sessionRecording) || void 0 === l2 ? void 0 : l2.canvasQuality }, [we]: d2, [Se]: F(h2) ? null : h2, [ke]: null === (c2 = e2.sessionRecording) || void 0 === c2 ? void 0 : c2.scriptConfig });
|
|
1577
|
+
};
|
|
1578
|
+
r2(), null === (t2 = this._persistDecideOnSessionListener) || void 0 === t2 || t2.call(this), this._persistDecideOnSessionListener = this.sessionManager.onSessionId(r2);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
log(e2) {
|
|
1582
|
+
var t2, i2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "log";
|
|
1583
|
+
null === (t2 = this.instance.sessionRecording) || void 0 === t2 || t2.onRRwebEmit({ type: 6, data: { plugin: "rrweb/console@1", payload: { level: i2, trace: [], payload: [JSON.stringify(e2)] } }, timestamp: Date.now() });
|
|
1584
|
+
}
|
|
1585
|
+
_startCapture(e2) {
|
|
1586
|
+
if (!F(Object.assign) && !F(Array.from) && !(this._captureStarted || this.instance.config.disable_session_recording || this.instance.consent.isOptedOut())) {
|
|
1587
|
+
var t2, i2;
|
|
1588
|
+
if (this._captureStarted = true, this.sessionManager.checkAndGetSessionAndWindowId(), this.rrwebRecord) this._onScriptLoaded();
|
|
1589
|
+
else null === (t2 = _.__PosthogExtensions__) || void 0 === t2 || null === (i2 = t2.loadExternalDependency) || void 0 === i2 || i2.call(t2, this.instance, this.scriptName, (e3) => {
|
|
1590
|
+
if (e3) return lr.error("could not load recorder", e3);
|
|
1591
|
+
this._onScriptLoaded();
|
|
1592
|
+
});
|
|
1593
|
+
lr.info("starting"), "active" === this.status && this._reportStarted(e2 || "recording_initialized");
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
get scriptName() {
|
|
1597
|
+
var e2, t2, i2;
|
|
1598
|
+
return (null === (e2 = this.instance) || void 0 === e2 || null === (t2 = e2.persistence) || void 0 === t2 || null === (i2 = t2.get_property(ke)) || void 0 === i2 ? void 0 : i2.script) || "recorder";
|
|
1599
|
+
}
|
|
1600
|
+
isInteractiveEvent(e2) {
|
|
1601
|
+
var t2;
|
|
1602
|
+
return 3 === e2.type && -1 !== ur.indexOf(null === (t2 = e2.data) || void 0 === t2 ? void 0 : t2.source);
|
|
1603
|
+
}
|
|
1604
|
+
_updateWindowAndSessionIds(e2) {
|
|
1605
|
+
var t2 = this.isInteractiveEvent(e2);
|
|
1606
|
+
t2 || this.isIdle || e2.timestamp - this._lastActivityTimestamp > this.sessionIdleThresholdMilliseconds && (this.isIdle = true, clearInterval(this._fullSnapshotTimer), this._tryAddCustomEvent("sessionIdle", { eventTimestamp: e2.timestamp, lastActivityTimestamp: this._lastActivityTimestamp, threshold: this.sessionIdleThresholdMilliseconds, bufferLength: this.buffer.data.length, bufferSize: this.buffer.size }), this._flushBuffer());
|
|
1607
|
+
var i2 = false;
|
|
1608
|
+
if (t2 && (this._lastActivityTimestamp = e2.timestamp, this.isIdle && (this.isIdle = false, this._tryAddCustomEvent("sessionNoLongerIdle", { reason: "user activity", type: e2.type }), i2 = true)), !this.isIdle) {
|
|
1609
|
+
var { windowId: r2, sessionId: s2 } = this.sessionManager.checkAndGetSessionAndWindowId(!t2, e2.timestamp), n2 = this.sessionId !== s2, o2 = this.windowId !== r2;
|
|
1610
|
+
this.windowId = r2, this.sessionId = s2, n2 || o2 ? (this.stopRecording(), this.startIfEnabledOrStop("session_id_changed")) : i2 && this._scheduleFullSnapshot();
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
_tryRRWebMethod(e2) {
|
|
1614
|
+
try {
|
|
1615
|
+
return e2.rrwebMethod(), true;
|
|
1616
|
+
} catch (t2) {
|
|
1617
|
+
return this.queuedRRWebEvents.length < 10 ? this.queuedRRWebEvents.push({ enqueuedAt: e2.enqueuedAt || Date.now(), attempt: e2.attempt++, rrwebMethod: e2.rrwebMethod }) : lr.warn("could not emit queued rrweb event.", t2, e2), false;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
_tryAddCustomEvent(e2, t2) {
|
|
1621
|
+
return this._tryRRWebMethod(dr(() => this.rrwebRecord.addCustomEvent(e2, t2)));
|
|
1622
|
+
}
|
|
1623
|
+
_tryTakeFullSnapshot() {
|
|
1624
|
+
return this._tryRRWebMethod(dr(() => this.rrwebRecord.takeFullSnapshot()));
|
|
1625
|
+
}
|
|
1626
|
+
_onScriptLoaded() {
|
|
1627
|
+
var e2, t2 = { blockClass: "ph-no-capture", blockSelector: void 0, ignoreClass: "ph-ignore-input", maskTextClass: "ph-mask", maskTextSelector: void 0, maskTextFn: void 0, maskAllInputs: true, maskInputOptions: { password: true }, maskInputFn: void 0, slimDOMOptions: {}, collectFonts: false, inlineStylesheet: true, recordCrossOriginIframes: false }, i2 = this.instance.config.session_recording;
|
|
1628
|
+
for (var [r2, s2] of Object.entries(i2 || {})) r2 in t2 && ("maskInputOptions" === r2 ? t2.maskInputOptions = W({ password: true }, s2) : t2[r2] = s2);
|
|
1629
|
+
if (this.canvasRecording && this.canvasRecording.enabled && (t2.recordCanvas = true, t2.sampling = { canvas: this.canvasRecording.fps }, t2.dataURLOptions = { type: "image/webp", quality: this.canvasRecording.quality }), this.rrwebRecord) {
|
|
1630
|
+
this.mutationRateLimiter = null !== (e2 = this.mutationRateLimiter) && void 0 !== e2 ? e2 : new wi(this.rrwebRecord, { refillRate: this.instance.config.session_recording.__mutationRateLimiterRefillRate, bucketSize: this.instance.config.session_recording.__mutationRateLimiterBucketSize, onBlockedNode: (e3, t3) => {
|
|
1631
|
+
var i3 = "Too many mutations on node '".concat(e3, "'. Rate limiting. This could be due to SVG animations or something similar");
|
|
1632
|
+
lr.info(i3, { node: t3 }), this.log(ar + " " + i3, "warn");
|
|
1633
|
+
} });
|
|
1634
|
+
var n2 = this._gatherRRWebPlugins();
|
|
1635
|
+
this.stopRrweb = this.rrwebRecord(W({ emit: (e3) => {
|
|
1636
|
+
this.onRRwebEmit(e3);
|
|
1637
|
+
}, plugins: n2 }, t2)), this._lastActivityTimestamp = Date.now(), this.isIdle = false, this._tryAddCustomEvent("$session_options", { sessionRecordingOptions: t2, activePlugins: n2.map((e3) => null == e3 ? void 0 : e3.name) }), this._tryAddCustomEvent("$posthog_config", { config: this.instance.config });
|
|
1638
|
+
} else lr.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.");
|
|
1639
|
+
}
|
|
1640
|
+
_scheduleFullSnapshot() {
|
|
1641
|
+
if (this._fullSnapshotTimer && clearInterval(this._fullSnapshotTimer), !this.isIdle) {
|
|
1642
|
+
var e2 = this.fullSnapshotIntervalMillis;
|
|
1643
|
+
e2 && (this._fullSnapshotTimer = setInterval(() => {
|
|
1644
|
+
this._tryTakeFullSnapshot();
|
|
1645
|
+
}, e2));
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
_gatherRRWebPlugins() {
|
|
1649
|
+
var e2, t2, i2, r2, s2 = [], n2 = null === (e2 = _.__PosthogExtensions__) || void 0 === e2 || null === (t2 = e2.rrwebPlugins) || void 0 === t2 ? void 0 : t2.getRecordConsolePlugin;
|
|
1650
|
+
n2 && this.isConsoleLogCaptureEnabled && s2.push(n2());
|
|
1651
|
+
var o2 = null === (i2 = _.__PosthogExtensions__) || void 0 === i2 || null === (r2 = i2.rrwebPlugins) || void 0 === r2 ? void 0 : r2.getRecordNetworkPlugin;
|
|
1652
|
+
this.networkPayloadCapture && I(o2) && (!bt.includes(location.hostname) || this._forceAllowLocalhostNetworkCapture ? s2.push(o2(yi(this.instance.config, this.networkPayloadCapture))) : lr.info("NetworkCapture not started because we are on localhost."));
|
|
1653
|
+
return s2;
|
|
1654
|
+
}
|
|
1655
|
+
onRRwebEmit(e2) {
|
|
1656
|
+
var t2;
|
|
1657
|
+
if (this._processQueuedEvents(), e2 && P(e2)) {
|
|
1658
|
+
if (e2.type === ci.Meta) {
|
|
1659
|
+
var i2 = this._maskUrl(e2.data.href);
|
|
1660
|
+
if (this._lastHref = i2, !i2) return;
|
|
1661
|
+
e2.data.href = i2;
|
|
1662
|
+
} else this._pageViewFallBack();
|
|
1663
|
+
if (this._checkUrlTriggerConditions(), !this._urlBlocked || function(e3) {
|
|
1664
|
+
return e3.type === ci.Custom && "recording paused" === e3.data.tag;
|
|
1665
|
+
}(e2)) {
|
|
1666
|
+
e2.type === ci.FullSnapshot && this._scheduleFullSnapshot(), e2.type === ci.FullSnapshot && "trigger_pending" === this.triggerStatus && this.clearBuffer();
|
|
1667
|
+
var r2 = this.mutationRateLimiter ? this.mutationRateLimiter.throttleMutations(e2) : e2;
|
|
1668
|
+
if (r2) {
|
|
1669
|
+
var s2 = function(e3) {
|
|
1670
|
+
var t3 = e3;
|
|
1671
|
+
if (t3 && P(t3) && 6 === t3.type && P(t3.data) && "rrweb/console@1" === t3.data.plugin) {
|
|
1672
|
+
t3.data.payload.payload.length > 10 && (t3.data.payload.payload = t3.data.payload.payload.slice(0, 10), t3.data.payload.payload.push("...[truncated]"));
|
|
1673
|
+
for (var i3 = [], r3 = 0; r3 < t3.data.payload.payload.length; r3++) t3.data.payload.payload[r3] && t3.data.payload.payload[r3].length > 2e3 ? i3.push(t3.data.payload.payload[r3].slice(0, 2e3) + "...[truncated]") : i3.push(t3.data.payload.payload[r3]);
|
|
1674
|
+
return t3.data.payload.payload = i3, e3;
|
|
1675
|
+
}
|
|
1676
|
+
return e3;
|
|
1677
|
+
}(r2);
|
|
1678
|
+
if (this._updateWindowAndSessionIds(s2), !this.isIdle || _r(s2)) {
|
|
1679
|
+
if (_r(s2)) {
|
|
1680
|
+
var n2 = s2.data.payload;
|
|
1681
|
+
if (n2) {
|
|
1682
|
+
var o2 = n2.lastActivityTimestamp, a2 = n2.threshold;
|
|
1683
|
+
s2.timestamp = o2 + a2;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
var l2 = null === (t2 = this.instance.config.session_recording.compress_events) || void 0 === t2 || t2 ? function(e3) {
|
|
1687
|
+
if (ai(e3) < 1024) return e3;
|
|
1688
|
+
try {
|
|
1689
|
+
if (e3.type === ci.FullSnapshot) return W(W({}, e3), {}, { data: hr(e3.data), cv: "2024-10" });
|
|
1690
|
+
if (e3.type === ci.IncrementalSnapshot && e3.data.source === ui.Mutation) return W(W({}, e3), {}, { cv: "2024-10", data: W(W({}, e3.data), {}, { texts: hr(e3.data.texts), attributes: hr(e3.data.attributes), removes: hr(e3.data.removes), adds: hr(e3.data.adds) }) });
|
|
1691
|
+
if (e3.type === ci.IncrementalSnapshot && e3.data.source === ui.StyleSheetRule) return W(W({}, e3), {}, { cv: "2024-10", data: W(W({}, e3.data), {}, { adds: e3.data.adds ? hr(e3.data.adds) : void 0, removes: e3.data.removes ? hr(e3.data.removes) : void 0 }) });
|
|
1692
|
+
} catch (e4) {
|
|
1693
|
+
lr.error("could not compress event - will use uncompressed event", e4);
|
|
1694
|
+
}
|
|
1695
|
+
return e3;
|
|
1696
|
+
}(s2) : s2, c2 = { $snapshot_bytes: ai(l2), $snapshot_data: l2, $session_id: this.sessionId, $window_id: this.windowId };
|
|
1697
|
+
"disabled" !== this.status ? this._captureSnapshotBuffered(c2) : this.clearBuffer();
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
_pageViewFallBack() {
|
|
1704
|
+
if (!this.instance.config.capture_pageview && t) {
|
|
1705
|
+
var e2 = this._maskUrl(t.location.href);
|
|
1706
|
+
this._lastHref !== e2 && (this._tryAddCustomEvent("$url_changed", { href: e2 }), this._lastHref = e2);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
_processQueuedEvents() {
|
|
1710
|
+
if (this.queuedRRWebEvents.length) {
|
|
1711
|
+
var e2 = [...this.queuedRRWebEvents];
|
|
1712
|
+
this.queuedRRWebEvents = [], e2.forEach((e3) => {
|
|
1713
|
+
Date.now() - e3.enqueuedAt <= 2e3 && this._tryRRWebMethod(e3);
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
_maskUrl(e2) {
|
|
1718
|
+
var t2 = this.instance.config.session_recording;
|
|
1719
|
+
if (t2.maskNetworkRequestFn) {
|
|
1720
|
+
var i2, r2 = { url: e2 };
|
|
1721
|
+
return null === (i2 = r2 = t2.maskNetworkRequestFn(r2)) || void 0 === i2 ? void 0 : i2.url;
|
|
1722
|
+
}
|
|
1723
|
+
return e2;
|
|
1724
|
+
}
|
|
1725
|
+
clearBuffer() {
|
|
1726
|
+
return this.buffer = { size: 0, data: [], sessionId: this.sessionId, windowId: this.windowId }, this.buffer;
|
|
1727
|
+
}
|
|
1728
|
+
_flushBuffer() {
|
|
1729
|
+
this.flushBufferTimer && (clearTimeout(this.flushBufferTimer), this.flushBufferTimer = void 0);
|
|
1730
|
+
var e2 = this.minimumDuration, t2 = this.sessionDuration, i2 = M(t2) && t2 >= 0, r2 = M(e2) && i2 && t2 < e2;
|
|
1731
|
+
if ("buffering" === this.status || "paused" === this.status || "disabled" === this.status || r2) return this.flushBufferTimer = setTimeout(() => {
|
|
1732
|
+
this._flushBuffer();
|
|
1733
|
+
}, 2e3), this.buffer;
|
|
1734
|
+
this.buffer.data.length > 0 && li(this.buffer).forEach((e3) => {
|
|
1735
|
+
this._captureSnapshot({ $snapshot_bytes: e3.size, $snapshot_data: e3.data, $session_id: e3.sessionId, $window_id: e3.windowId, $lib: "web", $lib_version: p.LIB_VERSION });
|
|
1736
|
+
});
|
|
1737
|
+
return this.clearBuffer();
|
|
1738
|
+
}
|
|
1739
|
+
_captureSnapshotBuffered(e2) {
|
|
1740
|
+
var t2, i2 = 2 + ((null === (t2 = this.buffer) || void 0 === t2 ? void 0 : t2.data.length) || 0);
|
|
1741
|
+
!this.isIdle && (this.buffer.size + e2.$snapshot_bytes + i2 > 943718.4 || this.buffer.sessionId !== this.sessionId) && (this.buffer = this._flushBuffer()), this.buffer.size += e2.$snapshot_bytes, this.buffer.data.push(e2.$snapshot_data), this.flushBufferTimer || this.isIdle || (this.flushBufferTimer = setTimeout(() => {
|
|
1742
|
+
this._flushBuffer();
|
|
1743
|
+
}, 2e3));
|
|
1744
|
+
}
|
|
1745
|
+
_captureSnapshot(e2) {
|
|
1746
|
+
this.instance.capture("$snapshot", e2, { _url: this.instance.requestRouter.endpointFor("api", this._endpoint), _noTruncate: true, _batchKey: "recordings", skip_client_rate_limiting: true });
|
|
1747
|
+
}
|
|
1748
|
+
_checkUrlTriggerConditions() {
|
|
1749
|
+
if (void 0 !== t && t.location.href) {
|
|
1750
|
+
var e2 = t.location.href, i2 = this._urlBlocked, r2 = pr(e2, this._urlBlocklist);
|
|
1751
|
+
r2 && !i2 ? this._pauseRecording() : !r2 && i2 && this._resumeRecording(), pr(e2, this._urlTriggers) && this._activateTrigger("url");
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
_activateTrigger(e2) {
|
|
1755
|
+
var t2, i2;
|
|
1756
|
+
"trigger_pending" === this.triggerStatus && (null === (t2 = this.instance) || void 0 === t2 || null === (i2 = t2.persistence) || void 0 === i2 || i2.register({ ["url" === e2 ? Ie : Pe]: this.sessionId }), this._flushBuffer(), this._reportStarted(e2 + "_trigger_matched"));
|
|
1757
|
+
}
|
|
1758
|
+
_pauseRecording() {
|
|
1759
|
+
this._urlBlocked || (this._urlBlocked = true, clearInterval(this._fullSnapshotTimer), lr.info("recording paused due to URL blocker"), this._tryAddCustomEvent("recording paused", { reason: "url blocker" }));
|
|
1760
|
+
}
|
|
1761
|
+
_resumeRecording() {
|
|
1762
|
+
this._urlBlocked && (this._urlBlocked = false, this._tryTakeFullSnapshot(), this._scheduleFullSnapshot(), this._tryAddCustomEvent("recording resumed", { reason: "left blocked url" }), lr.info("recording resumed"));
|
|
1763
|
+
}
|
|
1764
|
+
_addEventTriggerListener() {
|
|
1765
|
+
0 !== this._eventTriggers.length && O(this._removeEventTriggerCaptureHook) && (this._removeEventTriggerCaptureHook = this.instance.on("eventCaptured", (e2) => {
|
|
1766
|
+
try {
|
|
1767
|
+
this._eventTriggers.includes(e2.event) && this._activateTrigger("event");
|
|
1768
|
+
} catch (e3) {
|
|
1769
|
+
lr.error("Could not activate event trigger", e3);
|
|
1770
|
+
}
|
|
1771
|
+
}));
|
|
1772
|
+
}
|
|
1773
|
+
overrideLinkedFlag() {
|
|
1774
|
+
this._linkedFlagSeen = true, this._tryTakeFullSnapshot(), this._reportStarted("linked_flag_overridden");
|
|
1775
|
+
}
|
|
1776
|
+
overrideSampling() {
|
|
1777
|
+
var e2;
|
|
1778
|
+
null === (e2 = this.instance.persistence) || void 0 === e2 || e2.register({ [xe]: true }), this._tryTakeFullSnapshot(), this._reportStarted("sampling_overridden");
|
|
1779
|
+
}
|
|
1780
|
+
overrideTrigger(e2) {
|
|
1781
|
+
this._activateTrigger(e2);
|
|
1782
|
+
}
|
|
1783
|
+
_reportStarted(e2, t2) {
|
|
1784
|
+
this.instance.register_for_session({ $session_recording_start_reason: e2 }), lr.info(e2.replace("_", " "), t2), m(["recording_initialized", "session_id_changed"], e2) || this._tryAddCustomEvent(e2, t2);
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
var vr = H("[SegmentIntegration]");
|
|
1788
|
+
function fr(e2, t2) {
|
|
1789
|
+
var i2 = e2.config.segment;
|
|
1790
|
+
if (!i2) return t2();
|
|
1791
|
+
!function(e3, t3) {
|
|
1792
|
+
var i3 = e3.config.segment;
|
|
1793
|
+
if (!i3) return t3();
|
|
1794
|
+
var r2 = (i4) => {
|
|
1795
|
+
var r3 = () => i4.anonymousId() || qt();
|
|
1796
|
+
e3.config.get_device_id = r3, i4.id() && (e3.register({ distinct_id: i4.id(), $device_id: r3() }), e3.persistence.set_property(Ae, "identified")), t3();
|
|
1797
|
+
}, s2 = i3.user();
|
|
1798
|
+
"then" in s2 && I(s2.then) ? s2.then((e4) => r2(e4)) : r2(s2);
|
|
1799
|
+
}(e2, () => {
|
|
1800
|
+
i2.register(((e3) => {
|
|
1801
|
+
Promise && Promise.resolve || vr.warn("This browser does not have Promise support, and can not use the segment integration");
|
|
1802
|
+
var t3 = (t4, i3) => {
|
|
1803
|
+
var r2;
|
|
1804
|
+
if (!i3) return t4;
|
|
1805
|
+
t4.event.userId || t4.event.anonymousId === e3.get_distinct_id() || (vr.info("No userId set, resetting PostHog"), e3.reset()), t4.event.userId && t4.event.userId !== e3.get_distinct_id() && (vr.info("UserId set, identifying with PostHog"), e3.identify(t4.event.userId));
|
|
1806
|
+
var s2 = e3._calculate_event_properties(i3, null !== (r2 = t4.event.properties) && void 0 !== r2 ? r2 : {}, /* @__PURE__ */ new Date());
|
|
1807
|
+
return t4.event.properties = Object.assign({}, s2, t4.event.properties), t4;
|
|
1808
|
+
};
|
|
1809
|
+
return { name: "PostHog JS", type: "enrichment", version: "1.0.0", isLoaded: () => true, load: () => Promise.resolve(), track: (e4) => t3(e4, e4.event.event), page: (e4) => t3(e4, "$pageview"), identify: (e4) => t3(e4, "$identify"), screen: (e4) => t3(e4, "$screen") };
|
|
1810
|
+
})(e2)).then(() => {
|
|
1811
|
+
t2();
|
|
1812
|
+
});
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
var mr = "posthog-js";
|
|
1816
|
+
function yr(e2) {
|
|
1817
|
+
var { organization: t2, projectId: i2, prefix: r2, severityAllowList: s2 = ["error"] } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
1818
|
+
return (n2) => {
|
|
1819
|
+
var o2, a2, l2, c2, u2;
|
|
1820
|
+
if (!("*" === s2 || s2.includes(n2.level)) || !e2.__loaded) return n2;
|
|
1821
|
+
n2.tags || (n2.tags = {});
|
|
1822
|
+
var d2 = e2.requestRouter.endpointFor("ui", "/project/".concat(e2.config.token, "/person/").concat(e2.get_distinct_id()));
|
|
1823
|
+
n2.tags["PostHog Person URL"] = d2, e2.sessionRecordingStarted() && (n2.tags["PostHog Recording URL"] = e2.get_session_replay_url({ withTimestamp: true }));
|
|
1824
|
+
var h2 = (null === (o2 = n2.exception) || void 0 === o2 ? void 0 : o2.values) || [];
|
|
1825
|
+
h2.forEach((e3) => {
|
|
1826
|
+
e3.stacktrace && (e3.stacktrace.type = "raw", e3.stacktrace.frames.forEach((e4) => {
|
|
1827
|
+
e4.platform = "web:javascript";
|
|
1828
|
+
}));
|
|
1829
|
+
});
|
|
1830
|
+
var _2 = { $exception_message: (null === (a2 = h2[0]) || void 0 === a2 ? void 0 : a2.value) || n2.message, $exception_type: null === (l2 = h2[0]) || void 0 === l2 ? void 0 : l2.type, $exception_personURL: d2, $exception_level: n2.level, $exception_list: h2, $sentry_event_id: n2.event_id, $sentry_exception: n2.exception, $sentry_exception_message: (null === (c2 = h2[0]) || void 0 === c2 ? void 0 : c2.value) || n2.message, $sentry_exception_type: null === (u2 = h2[0]) || void 0 === u2 ? void 0 : u2.type, $sentry_tags: n2.tags };
|
|
1831
|
+
return t2 && i2 && (_2.$sentry_url = (r2 || "https://sentry.io/organizations/") + t2 + "/issues/?project=" + i2 + "&query=" + n2.event_id), e2.exceptions.sendExceptionEvent(_2), n2;
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
var br = class {
|
|
1835
|
+
constructor(e2, t2, i2, r2, s2) {
|
|
1836
|
+
this.name = mr, this.setupOnce = function(n2) {
|
|
1837
|
+
n2(yr(e2, { organization: t2, projectId: i2, prefix: r2, severityAllowList: s2 }));
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
};
|
|
1841
|
+
var wr;
|
|
1842
|
+
var Sr = null != t && t.location ? xt(t.location.hash, "__posthog") || xt(location.hash, "state") : null;
|
|
1843
|
+
var kr = "_postHogToolbarParams";
|
|
1844
|
+
var Er = H("[Toolbar]");
|
|
1845
|
+
!function(e2) {
|
|
1846
|
+
e2[e2.UNINITIALIZED = 0] = "UNINITIALIZED", e2[e2.LOADING = 1] = "LOADING", e2[e2.LOADED = 2] = "LOADED";
|
|
1847
|
+
}(wr || (wr = {}));
|
|
1848
|
+
var xr = class {
|
|
1849
|
+
constructor(e2) {
|
|
1850
|
+
this.instance = e2;
|
|
1851
|
+
}
|
|
1852
|
+
setToolbarState(e2) {
|
|
1853
|
+
_.ph_toolbar_state = e2;
|
|
1854
|
+
}
|
|
1855
|
+
getToolbarState() {
|
|
1856
|
+
var e2;
|
|
1857
|
+
return null !== (e2 = _.ph_toolbar_state) && void 0 !== e2 ? e2 : wr.UNINITIALIZED;
|
|
1858
|
+
}
|
|
1859
|
+
maybeLoadToolbar() {
|
|
1860
|
+
var e2, i2, r2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0, s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0, n2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
|
|
1861
|
+
if (!t || !a) return false;
|
|
1862
|
+
r2 = null !== (e2 = r2) && void 0 !== e2 ? e2 : t.location, n2 = null !== (i2 = n2) && void 0 !== i2 ? i2 : t.history;
|
|
1863
|
+
try {
|
|
1864
|
+
if (!s2) {
|
|
1865
|
+
try {
|
|
1866
|
+
t.localStorage.setItem("test", "test"), t.localStorage.removeItem("test");
|
|
1867
|
+
} catch (e3) {
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
s2 = null == t ? void 0 : t.localStorage;
|
|
1871
|
+
}
|
|
1872
|
+
var o2, l2 = Sr || xt(r2.hash, "__posthog") || xt(r2.hash, "state"), c2 = l2 ? ee(() => JSON.parse(atob(decodeURIComponent(l2)))) || ee(() => JSON.parse(decodeURIComponent(l2))) : null;
|
|
1873
|
+
return c2 && "ph_authorize" === c2.action ? ((o2 = c2).source = "url", o2 && Object.keys(o2).length > 0 && (c2.desiredHash ? r2.hash = c2.desiredHash : n2 ? n2.replaceState(n2.state, "", r2.pathname + r2.search) : r2.hash = "")) : ((o2 = JSON.parse(s2.getItem(kr) || "{}")).source = "localstorage", delete o2.userIntent), !(!o2.token || this.instance.config.token !== o2.token) && (this.loadToolbar(o2), true);
|
|
1874
|
+
} catch (e3) {
|
|
1875
|
+
return false;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
_callLoadToolbar(e2) {
|
|
1879
|
+
var t2 = _.ph_load_toolbar || _.ph_load_editor;
|
|
1880
|
+
!O(t2) && I(t2) ? t2(e2, this.instance) : Er.warn("No toolbar load function found");
|
|
1881
|
+
}
|
|
1882
|
+
loadToolbar(e2) {
|
|
1883
|
+
var i2 = !(null == a || !a.getElementById(Ue));
|
|
1884
|
+
if (!t || i2) return false;
|
|
1885
|
+
var r2 = "custom" === this.instance.requestRouter.region && this.instance.config.advanced_disable_toolbar_metrics, s2 = W(W({ token: this.instance.config.token }, e2), {}, { apiURL: this.instance.requestRouter.endpointFor("ui") }, r2 ? { instrument: false } : {});
|
|
1886
|
+
if (t.localStorage.setItem(kr, JSON.stringify(W(W({}, s2), {}, { source: void 0 }))), this.getToolbarState() === wr.LOADED) this._callLoadToolbar(s2);
|
|
1887
|
+
else if (this.getToolbarState() === wr.UNINITIALIZED) {
|
|
1888
|
+
var n2, o2;
|
|
1889
|
+
this.setToolbarState(wr.LOADING), null === (n2 = _.__PosthogExtensions__) || void 0 === n2 || null === (o2 = n2.loadExternalDependency) || void 0 === o2 || o2.call(n2, this.instance, "toolbar", (e3) => {
|
|
1890
|
+
if (e3) return Er.error("[Toolbar] Failed to load", e3), void this.setToolbarState(wr.UNINITIALIZED);
|
|
1891
|
+
this.setToolbarState(wr.LOADED), this._callLoadToolbar(s2);
|
|
1892
|
+
}), ae(t, "turbolinks:load", () => {
|
|
1893
|
+
this.setToolbarState(wr.UNINITIALIZED), this.loadToolbar(s2);
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
return true;
|
|
1897
|
+
}
|
|
1898
|
+
_loadEditor(e2) {
|
|
1899
|
+
return this.loadToolbar(e2);
|
|
1900
|
+
}
|
|
1901
|
+
maybeLoadEditor() {
|
|
1902
|
+
var e2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0, t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0, i2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
|
|
1903
|
+
return this.maybeLoadToolbar(e2, t2, i2);
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1906
|
+
var Ir = H("[TracingHeaders]");
|
|
1907
|
+
var Pr = class {
|
|
1908
|
+
constructor(e2) {
|
|
1909
|
+
V(this, "_restoreXHRPatch", void 0), V(this, "_restoreFetchPatch", void 0), V(this, "_startCapturing", () => {
|
|
1910
|
+
var e3, t2, i2, r2;
|
|
1911
|
+
F(this._restoreXHRPatch) && (null === (e3 = _.__PosthogExtensions__) || void 0 === e3 || null === (t2 = e3.tracingHeadersPatchFns) || void 0 === t2 || t2._patchXHR(this.instance.sessionManager));
|
|
1912
|
+
F(this._restoreFetchPatch) && (null === (i2 = _.__PosthogExtensions__) || void 0 === i2 || null === (r2 = i2.tracingHeadersPatchFns) || void 0 === r2 || r2._patchFetch(this.instance.sessionManager));
|
|
1913
|
+
}), this.instance = e2;
|
|
1914
|
+
}
|
|
1915
|
+
_loadScript(e2) {
|
|
1916
|
+
var t2, i2, r2;
|
|
1917
|
+
null !== (t2 = _.__PosthogExtensions__) && void 0 !== t2 && t2.tracingHeadersPatchFns && e2(), null === (i2 = _.__PosthogExtensions__) || void 0 === i2 || null === (r2 = i2.loadExternalDependency) || void 0 === r2 || r2.call(i2, this.instance, "tracing-headers", (t3) => {
|
|
1918
|
+
if (t3) return Ir.error("failed to load script", t3);
|
|
1919
|
+
e2();
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
startIfEnabledOrStop() {
|
|
1923
|
+
var e2, t2;
|
|
1924
|
+
this.instance.config.__add_tracing_headers ? this._loadScript(this._startCapturing) : (null === (e2 = this._restoreXHRPatch) || void 0 === e2 || e2.call(this), null === (t2 = this._restoreFetchPatch) || void 0 === t2 || t2.call(this), this._restoreXHRPatch = void 0, this._restoreFetchPatch = void 0);
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
var Cr = H("[Web Vitals]");
|
|
1928
|
+
var Fr = 9e5;
|
|
1929
|
+
var Rr = class {
|
|
1930
|
+
constructor(e2) {
|
|
1931
|
+
var t2;
|
|
1932
|
+
V(this, "_enabledServerSide", false), V(this, "_initialized", false), V(this, "buffer", { url: void 0, metrics: [], firstMetricTimestamp: void 0 }), V(this, "_flushToCapture", () => {
|
|
1933
|
+
clearTimeout(this._delayedFlushTimer), 0 !== this.buffer.metrics.length && (this.instance.capture("$web_vitals", this.buffer.metrics.reduce((e3, t3) => W(W({}, e3), {}, { ["$web_vitals_".concat(t3.name, "_event")]: W({}, t3), ["$web_vitals_".concat(t3.name, "_value")]: t3.value }), {})), this.buffer = { url: void 0, metrics: [], firstMetricTimestamp: void 0 });
|
|
1934
|
+
}), V(this, "_addToBuffer", (e3) => {
|
|
1935
|
+
var t3, i2 = null === (t3 = this.instance.sessionManager) || void 0 === t3 ? void 0 : t3.checkAndGetSessionAndWindowId(true);
|
|
1936
|
+
if (F(i2)) Cr.error("Could not read session ID. Dropping metrics!");
|
|
1937
|
+
else {
|
|
1938
|
+
this.buffer = this.buffer || { url: void 0, metrics: [], firstMetricTimestamp: void 0 };
|
|
1939
|
+
var r2 = this._currentURL();
|
|
1940
|
+
if (!F(r2)) if (O(null == e3 ? void 0 : e3.name) || O(null == e3 ? void 0 : e3.value)) Cr.error("Invalid metric received", e3);
|
|
1941
|
+
else if (this._maxAllowedValue && e3.value >= this._maxAllowedValue) Cr.error("Ignoring metric with value >= " + this._maxAllowedValue, e3);
|
|
1942
|
+
else this.buffer.url !== r2 && (this._flushToCapture(), this._delayedFlushTimer = setTimeout(this._flushToCapture, this.flushToCaptureTimeoutMs)), F(this.buffer.url) && (this.buffer.url = r2), this.buffer.firstMetricTimestamp = F(this.buffer.firstMetricTimestamp) ? Date.now() : this.buffer.firstMetricTimestamp, e3.attribution && e3.attribution.interactionTargetElement && (e3.attribution.interactionTargetElement = void 0), this.buffer.metrics.push(W(W({}, e3), {}, { $current_url: r2, $session_id: i2.sessionId, $window_id: i2.windowId, timestamp: Date.now() })), this.buffer.metrics.length === this.allowedMetrics.length && this._flushToCapture();
|
|
1943
|
+
}
|
|
1944
|
+
}), V(this, "_startCapturing", () => {
|
|
1945
|
+
var e3, t3, i2, r2, s2 = _.__PosthogExtensions__;
|
|
1946
|
+
F(s2) || F(s2.postHogWebVitalsCallbacks) || ({ onLCP: e3, onCLS: t3, onFCP: i2, onINP: r2 } = s2.postHogWebVitalsCallbacks), e3 && t3 && i2 && r2 ? (this.allowedMetrics.indexOf("LCP") > -1 && e3(this._addToBuffer.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && t3(this._addToBuffer.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && i2(this._addToBuffer.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && r2(this._addToBuffer.bind(this)), this._initialized = true) : Cr.error("web vitals callbacks not loaded - not starting");
|
|
1947
|
+
}), this.instance = e2, this._enabledServerSide = !(null === (t2 = this.instance.persistence) || void 0 === t2 || !t2.props[pe]), this.startIfEnabled();
|
|
1948
|
+
}
|
|
1949
|
+
get allowedMetrics() {
|
|
1950
|
+
var e2, t2, i2 = P(this.instance.config.capture_performance) ? null === (e2 = this.instance.config.capture_performance) || void 0 === e2 ? void 0 : e2.web_vitals_allowed_metrics : void 0;
|
|
1951
|
+
return F(i2) ? (null === (t2 = this.instance.persistence) || void 0 === t2 ? void 0 : t2.props[ve]) || ["CLS", "FCP", "INP", "LCP"] : i2;
|
|
1952
|
+
}
|
|
1953
|
+
get flushToCaptureTimeoutMs() {
|
|
1954
|
+
return (P(this.instance.config.capture_performance) ? this.instance.config.capture_performance.web_vitals_delayed_flush_ms : void 0) || 5e3;
|
|
1955
|
+
}
|
|
1956
|
+
get _maxAllowedValue() {
|
|
1957
|
+
var e2 = P(this.instance.config.capture_performance) && M(this.instance.config.capture_performance.__web_vitals_max_value) ? this.instance.config.capture_performance.__web_vitals_max_value : Fr;
|
|
1958
|
+
return 0 < e2 && e2 <= 6e4 ? Fr : e2;
|
|
1959
|
+
}
|
|
1960
|
+
get isEnabled() {
|
|
1961
|
+
var e2 = P(this.instance.config.capture_performance) ? this.instance.config.capture_performance.web_vitals : void 0;
|
|
1962
|
+
return A(e2) ? e2 : this._enabledServerSide;
|
|
1963
|
+
}
|
|
1964
|
+
startIfEnabled() {
|
|
1965
|
+
this.isEnabled && !this._initialized && (Cr.info("enabled, starting..."), this.loadScript(this._startCapturing));
|
|
1966
|
+
}
|
|
1967
|
+
onRemoteConfig(e2) {
|
|
1968
|
+
var t2 = P(e2.capturePerformance) && !!e2.capturePerformance.web_vitals, i2 = P(e2.capturePerformance) ? e2.capturePerformance.web_vitals_allowed_metrics : void 0;
|
|
1969
|
+
this.instance.persistence && (this.instance.persistence.register({ [pe]: t2 }), this.instance.persistence.register({ [ve]: i2 })), this._enabledServerSide = t2, this.startIfEnabled();
|
|
1970
|
+
}
|
|
1971
|
+
loadScript(e2) {
|
|
1972
|
+
var t2, i2, r2;
|
|
1973
|
+
null !== (t2 = _.__PosthogExtensions__) && void 0 !== t2 && t2.postHogWebVitalsCallbacks && e2(), null === (i2 = _.__PosthogExtensions__) || void 0 === i2 || null === (r2 = i2.loadExternalDependency) || void 0 === r2 || r2.call(i2, this.instance, "web-vitals", (t3) => {
|
|
1974
|
+
t3 ? Cr.error("failed to load script", t3) : e2();
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
_currentURL() {
|
|
1978
|
+
var e2 = t ? t.location.href : void 0;
|
|
1979
|
+
return e2 || Cr.error("Could not determine current URL"), e2;
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
var Tr = H("[Heatmaps]");
|
|
1983
|
+
function $r(e2) {
|
|
1984
|
+
return P(e2) && "clientX" in e2 && "clientY" in e2 && M(e2.clientX) && M(e2.clientY);
|
|
1985
|
+
}
|
|
1986
|
+
var Or = class {
|
|
1987
|
+
constructor(e2) {
|
|
1988
|
+
var t2;
|
|
1989
|
+
V(this, "rageclicks", new yt()), V(this, "_enabledServerSide", false), V(this, "_initialized", false), V(this, "_flushInterval", null), this.instance = e2, this._enabledServerSide = !(null === (t2 = this.instance.persistence) || void 0 === t2 || !t2.props[he]);
|
|
1990
|
+
}
|
|
1991
|
+
get flushIntervalMilliseconds() {
|
|
1992
|
+
var e2 = 5e3;
|
|
1993
|
+
return P(this.instance.config.capture_heatmaps) && this.instance.config.capture_heatmaps.flush_interval_milliseconds && (e2 = this.instance.config.capture_heatmaps.flush_interval_milliseconds), e2;
|
|
1994
|
+
}
|
|
1995
|
+
get isEnabled() {
|
|
1996
|
+
return F(this.instance.config.capture_heatmaps) ? F(this.instance.config.enable_heatmaps) ? this._enabledServerSide : this.instance.config.enable_heatmaps : false !== this.instance.config.capture_heatmaps;
|
|
1997
|
+
}
|
|
1998
|
+
startIfEnabled() {
|
|
1999
|
+
if (this.isEnabled) {
|
|
2000
|
+
if (this._initialized) return;
|
|
2001
|
+
Tr.info("starting..."), this._setupListeners(), this._flushInterval = setInterval(this.flush.bind(this), this.flushIntervalMilliseconds);
|
|
2002
|
+
} else {
|
|
2003
|
+
var e2, t2;
|
|
2004
|
+
clearInterval(null !== (e2 = this._flushInterval) && void 0 !== e2 ? e2 : void 0), null === (t2 = this.deadClicksCapture) || void 0 === t2 || t2.stop(), this.getAndClearBuffer();
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
onRemoteConfig(e2) {
|
|
2008
|
+
var t2 = !!e2.heatmaps;
|
|
2009
|
+
this.instance.persistence && this.instance.persistence.register({ [he]: t2 }), this._enabledServerSide = t2, this.startIfEnabled();
|
|
2010
|
+
}
|
|
2011
|
+
getAndClearBuffer() {
|
|
2012
|
+
var e2 = this.buffer;
|
|
2013
|
+
return this.buffer = void 0, e2;
|
|
2014
|
+
}
|
|
2015
|
+
_onDeadClick(e2) {
|
|
2016
|
+
this._onClick(e2.originalEvent, "deadclick");
|
|
2017
|
+
}
|
|
2018
|
+
_setupListeners() {
|
|
2019
|
+
t && a && (ae(t, "beforeunload", this.flush.bind(this)), ae(a, "click", (e2) => this._onClick(e2 || (null == t ? void 0 : t.event)), { capture: true }), ae(a, "mousemove", (e2) => this._onMouseMove(e2 || (null == t ? void 0 : t.event)), { capture: true }), this.deadClicksCapture = new si(this.instance, ii, this._onDeadClick.bind(this)), this.deadClicksCapture.startIfEnabled(), this._initialized = true);
|
|
2020
|
+
}
|
|
2021
|
+
_getProperties(e2, i2) {
|
|
2022
|
+
var r2 = this.instance.scrollManager.scrollY(), s2 = this.instance.scrollManager.scrollX(), n2 = this.instance.scrollManager.scrollElement(), o2 = function(e3, i3, r3) {
|
|
2023
|
+
for (var s3 = e3; s3 && Ve(s3) && !Ge(s3, "body"); ) {
|
|
2024
|
+
if (s3 === r3) return false;
|
|
2025
|
+
if (m(i3, null == t ? void 0 : t.getComputedStyle(s3).position)) return true;
|
|
2026
|
+
s3 = rt(s3);
|
|
2027
|
+
}
|
|
2028
|
+
return false;
|
|
2029
|
+
}(tt(e2), ["fixed", "sticky"], n2);
|
|
2030
|
+
return { x: e2.clientX + (o2 ? 0 : s2), y: e2.clientY + (o2 ? 0 : r2), target_fixed: o2, type: i2 };
|
|
2031
|
+
}
|
|
2032
|
+
_onClick(e2) {
|
|
2033
|
+
var t2, i2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "click";
|
|
2034
|
+
if (!We(e2.target) && $r(e2)) {
|
|
2035
|
+
var r2 = this._getProperties(e2, i2);
|
|
2036
|
+
null !== (t2 = this.rageclicks) && void 0 !== t2 && t2.isRageClick(e2.clientX, e2.clientY, (/* @__PURE__ */ new Date()).getTime()) && this._capture(W(W({}, r2), {}, { type: "rageclick" })), this._capture(r2);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
_onMouseMove(e2) {
|
|
2040
|
+
!We(e2.target) && $r(e2) && (clearTimeout(this._mouseMoveTimeout), this._mouseMoveTimeout = setTimeout(() => {
|
|
2041
|
+
this._capture(this._getProperties(e2, "mousemove"));
|
|
2042
|
+
}, 500));
|
|
2043
|
+
}
|
|
2044
|
+
_capture(e2) {
|
|
2045
|
+
if (t) {
|
|
2046
|
+
var i2 = t.location.href;
|
|
2047
|
+
this.buffer = this.buffer || {}, this.buffer[i2] || (this.buffer[i2] = []), this.buffer[i2].push(e2);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
flush() {
|
|
2051
|
+
this.buffer && !C(this.buffer) && this.instance.capture("$$heatmap", { $heatmap_data: this.getAndClearBuffer() });
|
|
2052
|
+
}
|
|
2053
|
+
};
|
|
2054
|
+
var Mr = class {
|
|
2055
|
+
constructor(e2) {
|
|
2056
|
+
this._instance = e2;
|
|
2057
|
+
}
|
|
2058
|
+
doPageView(e2, i2) {
|
|
2059
|
+
var r2, s2 = this._previousPageViewProperties(e2, i2);
|
|
2060
|
+
return this._currentPageview = { pathname: null !== (r2 = null == t ? void 0 : t.location.pathname) && void 0 !== r2 ? r2 : "", pageViewId: i2, timestamp: e2 }, this._instance.scrollManager.resetContext(), s2;
|
|
2061
|
+
}
|
|
2062
|
+
doPageLeave(e2) {
|
|
2063
|
+
var t2;
|
|
2064
|
+
return this._previousPageViewProperties(e2, null === (t2 = this._currentPageview) || void 0 === t2 ? void 0 : t2.pageViewId);
|
|
2065
|
+
}
|
|
2066
|
+
doEvent() {
|
|
2067
|
+
var e2;
|
|
2068
|
+
return { $pageview_id: null === (e2 = this._currentPageview) || void 0 === e2 ? void 0 : e2.pageViewId };
|
|
2069
|
+
}
|
|
2070
|
+
_previousPageViewProperties(e2, t2) {
|
|
2071
|
+
var i2 = this._currentPageview;
|
|
2072
|
+
if (!i2) return { $pageview_id: t2 };
|
|
2073
|
+
var r2 = { $pageview_id: t2, $prev_pageview_id: i2.pageViewId }, s2 = this._instance.scrollManager.getContext();
|
|
2074
|
+
if (s2 && !this._instance.config.disable_scroll_properties) {
|
|
2075
|
+
var { maxScrollHeight: n2, lastScrollY: o2, maxScrollY: a2, maxContentHeight: l2, lastContentY: c2, maxContentY: u2 } = s2;
|
|
2076
|
+
if (!(F(n2) || F(o2) || F(a2) || F(l2) || F(c2) || F(u2))) {
|
|
2077
|
+
n2 = Math.ceil(n2), o2 = Math.ceil(o2), a2 = Math.ceil(a2), l2 = Math.ceil(l2), c2 = Math.ceil(c2), u2 = Math.ceil(u2);
|
|
2078
|
+
var d2 = n2 <= 1 ? 1 : bi(o2 / n2, 0, 1), h2 = n2 <= 1 ? 1 : bi(a2 / n2, 0, 1), _2 = l2 <= 1 ? 1 : bi(c2 / l2, 0, 1), p2 = l2 <= 1 ? 1 : bi(u2 / l2, 0, 1);
|
|
2079
|
+
r2 = X(r2, { $prev_pageview_last_scroll: o2, $prev_pageview_last_scroll_percentage: d2, $prev_pageview_max_scroll: a2, $prev_pageview_max_scroll_percentage: h2, $prev_pageview_last_content: c2, $prev_pageview_last_content_percentage: _2, $prev_pageview_max_content: u2, $prev_pageview_max_content_percentage: p2 });
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
return i2.pathname && (r2.$prev_pageview_pathname = i2.pathname), i2.timestamp && (r2.$prev_pageview_duration = (e2.getTime() - i2.timestamp.getTime()) / 1e3), r2;
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
var Ar = class {
|
|
2086
|
+
constructor(e2) {
|
|
2087
|
+
this.instance = e2;
|
|
2088
|
+
}
|
|
2089
|
+
sendExceptionEvent(e2) {
|
|
2090
|
+
this.instance.capture("$exception", e2, { _noTruncate: true, _batchKey: "exceptionEvent" });
|
|
2091
|
+
}
|
|
2092
|
+
};
|
|
2093
|
+
var Lr;
|
|
2094
|
+
var Dr = H("[FeatureFlags]");
|
|
2095
|
+
var qr = "$active_feature_flags";
|
|
2096
|
+
var Nr = "$override_feature_flags";
|
|
2097
|
+
var Br = "$feature_flag_payloads";
|
|
2098
|
+
var Hr = "$override_feature_flag_payloads";
|
|
2099
|
+
var Ur = (e2) => {
|
|
2100
|
+
var t2 = {};
|
|
2101
|
+
for (var [i2, r2] of Z(e2 || {})) r2 && (t2[i2] = r2);
|
|
2102
|
+
return t2;
|
|
2103
|
+
};
|
|
2104
|
+
!function(e2) {
|
|
2105
|
+
e2.FeatureFlags = "feature_flags", e2.Recordings = "recordings";
|
|
2106
|
+
}(Lr || (Lr = {}));
|
|
2107
|
+
var zr = class {
|
|
2108
|
+
constructor(e2) {
|
|
2109
|
+
V(this, "_override_warning", false), V(this, "_hasLoadedFlags", false), V(this, "_requestInFlight", false), V(this, "_reloadingDisabled", false), V(this, "_additionalReloadRequested", false), V(this, "_decideCalled", false), V(this, "_flagsLoadedFromRemote", false), this.instance = e2, this.featureFlagEventHandlers = [];
|
|
2110
|
+
}
|
|
2111
|
+
decide() {
|
|
2112
|
+
if (this.instance.config.__preview_remote_config) this._decideCalled = true;
|
|
2113
|
+
else {
|
|
2114
|
+
var e2 = !this._reloadDebouncer && (this.instance.config.advanced_disable_feature_flags || this.instance.config.advanced_disable_feature_flags_on_first_load);
|
|
2115
|
+
this._callDecideEndpoint({ disableFlags: e2 });
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
get hasLoadedFlags() {
|
|
2119
|
+
return this._hasLoadedFlags;
|
|
2120
|
+
}
|
|
2121
|
+
getFlags() {
|
|
2122
|
+
return Object.keys(this.getFlagVariants());
|
|
2123
|
+
}
|
|
2124
|
+
getFlagVariants() {
|
|
2125
|
+
var e2 = this.instance.get_property(Ce), t2 = this.instance.get_property(Nr);
|
|
2126
|
+
if (!t2) return e2 || {};
|
|
2127
|
+
for (var i2 = X({}, e2), r2 = Object.keys(t2), s2 = 0; s2 < r2.length; s2++) i2[r2[s2]] = t2[r2[s2]];
|
|
2128
|
+
return this._override_warning || (Dr.warn(" Overriding feature flags!", { enabledFlags: e2, overriddenFlags: t2, finalFlags: i2 }), this._override_warning = true), i2;
|
|
2129
|
+
}
|
|
2130
|
+
getFlagPayloads() {
|
|
2131
|
+
var e2 = this.instance.get_property(Br), t2 = this.instance.get_property(Hr);
|
|
2132
|
+
if (!t2) return e2 || {};
|
|
2133
|
+
for (var i2 = X({}, e2 || {}), r2 = Object.keys(t2), s2 = 0; s2 < r2.length; s2++) i2[r2[s2]] = t2[r2[s2]];
|
|
2134
|
+
return this._override_warning || (Dr.warn(" Overriding feature flag payloads!", { flagPayloads: e2, overriddenPayloads: t2, finalPayloads: i2 }), this._override_warning = true), i2;
|
|
2135
|
+
}
|
|
2136
|
+
reloadFeatureFlags() {
|
|
2137
|
+
this._reloadingDisabled || this.instance.config.advanced_disable_feature_flags || this._reloadDebouncer || (this._reloadDebouncer = setTimeout(() => {
|
|
2138
|
+
this._callDecideEndpoint();
|
|
2139
|
+
}, 5));
|
|
2140
|
+
}
|
|
2141
|
+
clearDebouncer() {
|
|
2142
|
+
clearTimeout(this._reloadDebouncer), this._reloadDebouncer = void 0;
|
|
2143
|
+
}
|
|
2144
|
+
ensureFlagsLoaded() {
|
|
2145
|
+
this._hasLoadedFlags || this._requestInFlight || this._reloadDebouncer || this.reloadFeatureFlags();
|
|
2146
|
+
}
|
|
2147
|
+
setAnonymousDistinctId(e2) {
|
|
2148
|
+
this.$anon_distinct_id = e2;
|
|
2149
|
+
}
|
|
2150
|
+
setReloadingPaused(e2) {
|
|
2151
|
+
this._reloadingDisabled = e2;
|
|
2152
|
+
}
|
|
2153
|
+
_callDecideEndpoint(t2) {
|
|
2154
|
+
if (this.clearDebouncer(), !this.instance.config.advanced_disable_decide) if (this._requestInFlight) this._additionalReloadRequested = true;
|
|
2155
|
+
else {
|
|
2156
|
+
var i2 = { 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: this.instance.get_property(Re), group_properties: this.instance.get_property(Te) };
|
|
2157
|
+
(null != t2 && t2.disableFlags || this.instance.config.advanced_disable_feature_flags) && (i2.disable_flags = true), this._requestInFlight = true, this.instance._send_request({ method: "POST", url: this.instance.requestRouter.endpointFor("api", "/decide/?v=3"), data: i2, compression: this.instance.config.disable_compression ? void 0 : e.Base64, timeout: this.instance.config.feature_flag_request_timeout_ms, callback: (e2) => {
|
|
2158
|
+
var t3, r2, s2, n2 = true;
|
|
2159
|
+
(200 === e2.statusCode && (this.$anon_distinct_id = void 0, n2 = false), this._requestInFlight = false, this._decideCalled) || (this._decideCalled = true, this.instance._onRemoteConfig(null !== (s2 = e2.json) && void 0 !== s2 ? s2 : {}));
|
|
2160
|
+
i2.disable_flags || (this._flagsLoadedFromRemote = !n2, e2.json && null !== (t3 = e2.json.quotaLimited) && void 0 !== t3 && t3.includes(Lr.FeatureFlags) ? Dr.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(null !== (r2 = e2.json) && void 0 !== r2 ? r2 : {}, n2), this._additionalReloadRequested && (this._additionalReloadRequested = false, this._callDecideEndpoint())));
|
|
2161
|
+
} });
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
getFeatureFlag(e2) {
|
|
2165
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
2166
|
+
if (this._hasLoadedFlags || this.getFlags() && this.getFlags().length > 0) {
|
|
2167
|
+
var i2, r2, s2, n2, o2, a2 = this.getFlagVariants()[e2], l2 = "".concat(a2), c2 = this.instance.get_property(Me) || {};
|
|
2168
|
+
if (t2.send_event || !("send_event" in t2)) {
|
|
2169
|
+
if (!(e2 in c2) || !c2[e2].includes(l2)) x(c2[e2]) ? c2[e2].push(l2) : c2[e2] = [l2], null === (i2 = this.instance.persistence) || void 0 === i2 || i2.register({ [Me]: c2 }), this.instance.capture("$feature_flag_called", { $feature_flag: e2, $feature_flag_response: a2, $feature_flag_payload: this.getFeatureFlagPayload(e2) || null, $feature_flag_bootstrapped_response: (null === (r2 = this.instance.config.bootstrap) || void 0 === r2 || null === (s2 = r2.featureFlags) || void 0 === s2 ? void 0 : s2[e2]) || null, $feature_flag_bootstrapped_payload: (null === (n2 = this.instance.config.bootstrap) || void 0 === n2 || null === (o2 = n2.featureFlagPayloads) || void 0 === o2 ? void 0 : o2[e2]) || null, $used_bootstrap_value: !this._flagsLoadedFromRemote });
|
|
2170
|
+
}
|
|
2171
|
+
return a2;
|
|
2172
|
+
}
|
|
2173
|
+
Dr.warn('getFeatureFlag for key "' + e2 + `" failed. Feature flags didn't load in time.`);
|
|
2174
|
+
}
|
|
2175
|
+
getFeatureFlagPayload(e2) {
|
|
2176
|
+
return this.getFlagPayloads()[e2];
|
|
2177
|
+
}
|
|
2178
|
+
getRemoteConfigPayload(t2, i2) {
|
|
2179
|
+
var r2 = this.instance.config.token;
|
|
2180
|
+
this.instance._send_request({ method: "POST", url: this.instance.requestRouter.endpointFor("api", "/decide/?v=3"), data: { distinct_id: this.instance.get_distinct_id(), token: r2 }, compression: this.instance.config.disable_compression ? void 0 : e.Base64, timeout: this.instance.config.feature_flag_request_timeout_ms, callback: (e2) => {
|
|
2181
|
+
var r3, s2 = null === (r3 = e2.json) || void 0 === r3 ? void 0 : r3.featureFlagPayloads;
|
|
2182
|
+
i2((null == s2 ? void 0 : s2[t2]) || void 0);
|
|
2183
|
+
} });
|
|
2184
|
+
}
|
|
2185
|
+
isFeatureEnabled(e2) {
|
|
2186
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
2187
|
+
if (this._hasLoadedFlags || this.getFlags() && this.getFlags().length > 0) return !!this.getFeatureFlag(e2, t2);
|
|
2188
|
+
Dr.warn('isFeatureEnabled for key "' + e2 + `" failed. Feature flags didn't load in time.`);
|
|
2189
|
+
}
|
|
2190
|
+
addFeatureFlagsHandler(e2) {
|
|
2191
|
+
this.featureFlagEventHandlers.push(e2);
|
|
2192
|
+
}
|
|
2193
|
+
removeFeatureFlagsHandler(e2) {
|
|
2194
|
+
this.featureFlagEventHandlers = this.featureFlagEventHandlers.filter((t2) => t2 !== e2);
|
|
2195
|
+
}
|
|
2196
|
+
receivedFeatureFlags(e2, t2) {
|
|
2197
|
+
if (this.instance.persistence) {
|
|
2198
|
+
this._hasLoadedFlags = true;
|
|
2199
|
+
var i2 = this.getFlagVariants(), r2 = this.getFlagPayloads();
|
|
2200
|
+
!function(e3, t3) {
|
|
2201
|
+
var i3 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, r3 = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}, s2 = e3.featureFlags, n2 = e3.featureFlagPayloads;
|
|
2202
|
+
if (s2) if (x(s2)) {
|
|
2203
|
+
var o2 = {};
|
|
2204
|
+
if (s2) for (var a2 = 0; a2 < s2.length; a2++) o2[s2[a2]] = true;
|
|
2205
|
+
t3 && t3.register({ [qr]: s2, [Ce]: o2 });
|
|
2206
|
+
} else {
|
|
2207
|
+
var l2 = s2, c2 = n2;
|
|
2208
|
+
e3.errorsWhileComputingFlags && (l2 = W(W({}, i3), l2), c2 = W(W({}, r3), c2)), t3 && t3.register({ [qr]: Object.keys(Ur(l2)), [Ce]: l2 || {}, [Br]: c2 || {} });
|
|
2209
|
+
}
|
|
2210
|
+
}(e2, this.instance.persistence, i2, r2), this._fireFeatureFlagsCallbacks(t2);
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
override(e2) {
|
|
2214
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
2215
|
+
Dr.warn("override is deprecated. Please use overrideFeatureFlags instead."), this.overrideFeatureFlags({ flags: e2, suppressWarning: t2 });
|
|
2216
|
+
}
|
|
2217
|
+
overrideFeatureFlags(e2) {
|
|
2218
|
+
if (!this.instance.__loaded || !this.instance.persistence) return Dr.uninitializedWarning("posthog.feature_flags.overrideFeatureFlags");
|
|
2219
|
+
if (false === e2) return this.instance.persistence.unregister(Nr), this.instance.persistence.unregister(Hr), void this._fireFeatureFlagsCallbacks();
|
|
2220
|
+
if (e2 && "object" == typeof e2 && ("flags" in e2 || "payloads" in e2)) {
|
|
2221
|
+
var t2, i2 = e2;
|
|
2222
|
+
if (this._override_warning = Boolean(null !== (t2 = i2.suppressWarning) && void 0 !== t2 && t2), "flags" in i2) {
|
|
2223
|
+
if (false === i2.flags) this.instance.persistence.unregister(Nr);
|
|
2224
|
+
else if (i2.flags) if (x(i2.flags)) {
|
|
2225
|
+
for (var r2 = {}, s2 = 0; s2 < i2.flags.length; s2++) r2[i2.flags[s2]] = true;
|
|
2226
|
+
this.instance.persistence.register({ [Nr]: r2 });
|
|
2227
|
+
} else this.instance.persistence.register({ [Nr]: i2.flags });
|
|
2228
|
+
}
|
|
2229
|
+
return "payloads" in i2 && (false === i2.payloads ? this.instance.persistence.unregister(Hr) : i2.payloads && this.instance.persistence.register({ [Hr]: i2.payloads })), void this._fireFeatureFlagsCallbacks();
|
|
2230
|
+
}
|
|
2231
|
+
this._fireFeatureFlagsCallbacks();
|
|
2232
|
+
}
|
|
2233
|
+
onFeatureFlags(e2) {
|
|
2234
|
+
if (this.addFeatureFlagsHandler(e2), this._hasLoadedFlags) {
|
|
2235
|
+
var { flags: t2, flagVariants: i2 } = this._prepareFeatureFlagsForCallbacks();
|
|
2236
|
+
e2(t2, i2);
|
|
2237
|
+
}
|
|
2238
|
+
return () => this.removeFeatureFlagsHandler(e2);
|
|
2239
|
+
}
|
|
2240
|
+
updateEarlyAccessFeatureEnrollment(e2, t2) {
|
|
2241
|
+
var i2, r2 = (this.instance.get_property(Fe) || []).find((t3) => t3.flagKey === e2), s2 = { ["$feature_enrollment/".concat(e2)]: t2 }, n2 = { $feature_flag: e2, $feature_enrollment: t2, $set: s2 };
|
|
2242
|
+
r2 && (n2.$early_access_feature_name = r2.name), this.instance.capture("$feature_enrollment_update", n2), this.setPersonPropertiesForFlags(s2, false);
|
|
2243
|
+
var o2 = W(W({}, this.getFlagVariants()), {}, { [e2]: t2 });
|
|
2244
|
+
null === (i2 = this.instance.persistence) || void 0 === i2 || i2.register({ [qr]: Object.keys(Ur(o2)), [Ce]: o2 }), this._fireFeatureFlagsCallbacks();
|
|
2245
|
+
}
|
|
2246
|
+
getEarlyAccessFeatures(e2) {
|
|
2247
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], i2 = this.instance.get_property(Fe);
|
|
2248
|
+
if (i2 && !t2) return e2(i2);
|
|
2249
|
+
this.instance._send_request({ url: this.instance.requestRouter.endpointFor("api", "/api/early_access_features/?token=".concat(this.instance.config.token)), method: "GET", callback: (t3) => {
|
|
2250
|
+
var i3;
|
|
2251
|
+
if (t3.json) {
|
|
2252
|
+
var r2 = t3.json.earlyAccessFeatures;
|
|
2253
|
+
return null === (i3 = this.instance.persistence) || void 0 === i3 || i3.register({ [Fe]: r2 }), e2(r2);
|
|
2254
|
+
}
|
|
2255
|
+
} });
|
|
2256
|
+
}
|
|
2257
|
+
_prepareFeatureFlagsForCallbacks() {
|
|
2258
|
+
var e2 = this.getFlags(), t2 = this.getFlagVariants();
|
|
2259
|
+
return { flags: e2.filter((e3) => t2[e3]), flagVariants: Object.keys(t2).filter((e3) => t2[e3]).reduce((e3, i2) => (e3[i2] = t2[i2], e3), {}) };
|
|
2260
|
+
}
|
|
2261
|
+
_fireFeatureFlagsCallbacks(e2) {
|
|
2262
|
+
var { flags: t2, flagVariants: i2 } = this._prepareFeatureFlagsForCallbacks();
|
|
2263
|
+
this.featureFlagEventHandlers.forEach((r2) => r2(t2, i2, { errorsLoading: e2 }));
|
|
2264
|
+
}
|
|
2265
|
+
setPersonPropertiesForFlags(e2) {
|
|
2266
|
+
var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i2 = this.instance.get_property(Re) || {};
|
|
2267
|
+
this.instance.register({ [Re]: W(W({}, i2), e2) }), t2 && this.instance.reloadFeatureFlags();
|
|
2268
|
+
}
|
|
2269
|
+
resetPersonPropertiesForFlags() {
|
|
2270
|
+
this.instance.unregister(Re);
|
|
2271
|
+
}
|
|
2272
|
+
setGroupPropertiesForFlags(e2) {
|
|
2273
|
+
var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], i2 = this.instance.get_property(Te) || {};
|
|
2274
|
+
0 !== Object.keys(i2).length && Object.keys(i2).forEach((t3) => {
|
|
2275
|
+
i2[t3] = W(W({}, i2[t3]), e2[t3]), delete e2[t3];
|
|
2276
|
+
}), this.instance.register({ [Te]: W(W({}, i2), e2) }), t2 && this.instance.reloadFeatureFlags();
|
|
2277
|
+
}
|
|
2278
|
+
resetGroupPropertiesForFlags(e2) {
|
|
2279
|
+
if (e2) {
|
|
2280
|
+
var t2 = this.instance.get_property(Te) || {};
|
|
2281
|
+
this.instance.register({ [Te]: W(W({}, t2), {}, { [e2]: {} }) });
|
|
2282
|
+
} else this.instance.unregister(Te);
|
|
2283
|
+
}
|
|
2284
|
+
};
|
|
2285
|
+
var jr = "Mobile";
|
|
2286
|
+
var Wr = "iOS";
|
|
2287
|
+
var Vr = "Android";
|
|
2288
|
+
var Gr = "Tablet";
|
|
2289
|
+
var Jr = Vr + " " + Gr;
|
|
2290
|
+
var Yr = "iPad";
|
|
2291
|
+
var Kr = "Apple";
|
|
2292
|
+
var Xr = Kr + " Watch";
|
|
2293
|
+
var Qr = "Safari";
|
|
2294
|
+
var Zr = "BlackBerry";
|
|
2295
|
+
var es = "Samsung";
|
|
2296
|
+
var ts = es + "Browser";
|
|
2297
|
+
var is = es + " Internet";
|
|
2298
|
+
var rs = "Chrome";
|
|
2299
|
+
var ss = rs + " OS";
|
|
2300
|
+
var ns = rs + " " + Wr;
|
|
2301
|
+
var os = "Internet Explorer";
|
|
2302
|
+
var as = os + " " + jr;
|
|
2303
|
+
var ls = "Opera";
|
|
2304
|
+
var cs = ls + " Mini";
|
|
2305
|
+
var us = "Edge";
|
|
2306
|
+
var ds = "Microsoft " + us;
|
|
2307
|
+
var hs = "Firefox";
|
|
2308
|
+
var _s = hs + " " + Wr;
|
|
2309
|
+
var ps = "Nintendo";
|
|
2310
|
+
var gs = "PlayStation";
|
|
2311
|
+
var vs = "Xbox";
|
|
2312
|
+
var fs = Vr + " " + jr;
|
|
2313
|
+
var ms = jr + " " + Qr;
|
|
2314
|
+
var ys = "Windows";
|
|
2315
|
+
var bs = ys + " Phone";
|
|
2316
|
+
var ws = "Nokia";
|
|
2317
|
+
var Ss = "Ouya";
|
|
2318
|
+
var ks = "Generic";
|
|
2319
|
+
var Es = ks + " " + jr.toLowerCase();
|
|
2320
|
+
var xs = ks + " " + Gr.toLowerCase();
|
|
2321
|
+
var Is = "Konqueror";
|
|
2322
|
+
var Ps = "(\\d+(\\.\\d+)?)";
|
|
2323
|
+
var Cs = new RegExp("Version/" + Ps);
|
|
2324
|
+
var Fs = new RegExp(vs, "i");
|
|
2325
|
+
var Rs = new RegExp(gs + " \\w+", "i");
|
|
2326
|
+
var Ts = new RegExp(ps + " \\w+", "i");
|
|
2327
|
+
var $s = new RegExp(Zr + "|PlayBook|BB10", "i");
|
|
2328
|
+
var Os = { "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" };
|
|
2329
|
+
var Ms = (e2, t2) => t2 && m(t2, Kr) || function(e3) {
|
|
2330
|
+
return m(e3, Qr) && !m(e3, rs) && !m(e3, Vr);
|
|
2331
|
+
}(e2);
|
|
2332
|
+
var As = function(e2, t2) {
|
|
2333
|
+
return t2 = t2 || "", m(e2, " OPR/") && m(e2, "Mini") ? cs : m(e2, " OPR/") ? ls : $s.test(e2) ? Zr : m(e2, "IE" + jr) || m(e2, "WPDesktop") ? as : m(e2, ts) ? is : m(e2, us) || m(e2, "Edg/") ? ds : m(e2, "FBIOS") ? "Facebook " + jr : m(e2, "UCWEB") || m(e2, "UCBrowser") ? "UC Browser" : m(e2, "CriOS") ? ns : m(e2, "CrMo") || m(e2, rs) ? rs : m(e2, Vr) && m(e2, Qr) ? fs : m(e2, "FxiOS") ? _s : m(e2.toLowerCase(), Is.toLowerCase()) ? Is : Ms(e2, t2) ? m(e2, jr) ? ms : Qr : m(e2, hs) ? hs : m(e2, "MSIE") || m(e2, "Trident/") ? os : m(e2, "Gecko") ? hs : "";
|
|
2334
|
+
};
|
|
2335
|
+
var Ls = { [as]: [new RegExp("rv:" + Ps)], [ds]: [new RegExp(us + "?\\/" + Ps)], [rs]: [new RegExp("(" + rs + "|CrMo)\\/" + Ps)], [ns]: [new RegExp("CriOS\\/" + Ps)], "UC Browser": [new RegExp("(UCBrowser|UCWEB)\\/" + Ps)], [Qr]: [Cs], [ms]: [Cs], [ls]: [new RegExp("(Opera|OPR)\\/" + Ps)], [hs]: [new RegExp(hs + "\\/" + Ps)], [_s]: [new RegExp("FxiOS\\/" + Ps)], [Is]: [new RegExp("Konqueror[:/]?" + Ps, "i")], [Zr]: [new RegExp(Zr + " " + Ps), Cs], [fs]: [new RegExp("android\\s" + Ps, "i")], [is]: [new RegExp(ts + "\\/" + Ps)], [os]: [new RegExp("(rv:|MSIE )" + Ps)], Mozilla: [new RegExp("rv:" + Ps)] };
|
|
2336
|
+
var Ds = [[new RegExp(vs + "; " + vs + " (.*?)[);]", "i"), (e2) => [vs, e2 && e2[1] || ""]], [new RegExp(ps, "i"), [ps, ""]], [new RegExp(gs, "i"), [gs, ""]], [$s, [Zr, ""]], [new RegExp(ys, "i"), (e2, t2) => {
|
|
2337
|
+
if (/Phone/.test(t2) || /WPDesktop/.test(t2)) return [bs, ""];
|
|
2338
|
+
if (new RegExp(jr).test(t2) && !/IEMobile\b/.test(t2)) return [ys + " " + jr, ""];
|
|
2339
|
+
var i2 = /Windows NT ([0-9.]+)/i.exec(t2);
|
|
2340
|
+
if (i2 && i2[1]) {
|
|
2341
|
+
var r2 = i2[1], s2 = Os[r2] || "";
|
|
2342
|
+
return /arm/i.test(t2) && (s2 = "RT"), [ys, s2];
|
|
2343
|
+
}
|
|
2344
|
+
return [ys, ""];
|
|
2345
|
+
}], [/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/, (e2) => {
|
|
2346
|
+
if (e2 && e2[3]) {
|
|
2347
|
+
var t2 = [e2[3], e2[4], e2[5] || "0"];
|
|
2348
|
+
return [Wr, t2.join(".")];
|
|
2349
|
+
}
|
|
2350
|
+
return [Wr, ""];
|
|
2351
|
+
}], [/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i, (e2) => {
|
|
2352
|
+
var t2 = "";
|
|
2353
|
+
return e2 && e2.length >= 3 && (t2 = F(e2[2]) ? e2[3] : e2[2]), ["watchOS", t2];
|
|
2354
|
+
}], [new RegExp("(" + Vr + " (\\d+)\\.(\\d+)\\.?(\\d+)?|" + Vr + ")", "i"), (e2) => {
|
|
2355
|
+
if (e2 && e2[2]) {
|
|
2356
|
+
var t2 = [e2[2], e2[3], e2[4] || "0"];
|
|
2357
|
+
return [Vr, t2.join(".")];
|
|
2358
|
+
}
|
|
2359
|
+
return [Vr, ""];
|
|
2360
|
+
}], [/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i, (e2) => {
|
|
2361
|
+
var t2 = ["Mac OS X", ""];
|
|
2362
|
+
if (e2 && e2[1]) {
|
|
2363
|
+
var i2 = [e2[1], e2[2], e2[3] || "0"];
|
|
2364
|
+
t2[1] = i2.join(".");
|
|
2365
|
+
}
|
|
2366
|
+
return t2;
|
|
2367
|
+
}], [/Mac/i, ["Mac OS X", ""]], [/CrOS/, [ss, ""]], [/Linux|debian/i, ["Linux", ""]]];
|
|
2368
|
+
var qs = function(e2) {
|
|
2369
|
+
return Ts.test(e2) ? ps : Rs.test(e2) ? gs : Fs.test(e2) ? vs : new RegExp(Ss, "i").test(e2) ? Ss : new RegExp("(" + bs + "|WPDesktop)", "i").test(e2) ? bs : /iPad/.test(e2) ? Yr : /iPod/.test(e2) ? "iPod Touch" : /iPhone/.test(e2) ? "iPhone" : /(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e2) ? Xr : $s.test(e2) ? Zr : /(kobo)\s(ereader|touch)/i.test(e2) ? "Kobo" : new RegExp(ws, "i").test(e2) ? ws : /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e2) || /(kf[a-z]+)( bui|\)).+silk\//i.test(e2) ? "Kindle Fire" : /(Android|ZTE)/i.test(e2) ? !new RegExp(jr).test(e2) || /(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e2) ? /pixel[\daxl ]{1,6}/i.test(e2) && !/pixel c/i.test(e2) || /(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e2) || /lmy47v/i.test(e2) && !/QTAQZ3/i.test(e2) ? Vr : Jr : Vr : new RegExp("(pda|" + jr + ")", "i").test(e2) ? Es : new RegExp(Gr, "i").test(e2) && !new RegExp(Gr + " pc", "i").test(e2) ? xs : "";
|
|
2370
|
+
};
|
|
2371
|
+
var Ns = "https?://(.*)";
|
|
2372
|
+
var Bs = ["gclid", "gclsrc", "dclid", "gbraid", "wbraid", "fbclid", "msclkid", "twclid", "li_fat_id", "igshid", "ttclid", "rdt_cid", "irclid", "_kx"];
|
|
2373
|
+
var Hs = Q(["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term", "gad_source", "mc_cid"], Bs);
|
|
2374
|
+
var Us = "<masked>";
|
|
2375
|
+
var zs = { campaignParams: function() {
|
|
2376
|
+
var { customTrackedParams: e2, maskPersonalDataProperties: t2, customPersonalDataProperties: i2 } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
2377
|
+
if (!a) return {};
|
|
2378
|
+
var r2 = t2 ? Q([], Bs, i2 || []) : [];
|
|
2379
|
+
return this._campaignParamsFromUrl(Et(a.URL, r2, Us), e2);
|
|
2380
|
+
}, _campaignParamsFromUrl: function(e2, t2) {
|
|
2381
|
+
var i2 = Hs.concat(t2 || []), r2 = {};
|
|
2382
|
+
return K(i2, function(t3) {
|
|
2383
|
+
var i3 = kt(e2, t3);
|
|
2384
|
+
r2[t3] = i3 || null;
|
|
2385
|
+
}), r2;
|
|
2386
|
+
}, _searchEngine: function(e2) {
|
|
2387
|
+
return e2 ? 0 === e2.search(Ns + "google.([^/?]*)") ? "google" : 0 === e2.search(Ns + "bing.com") ? "bing" : 0 === e2.search(Ns + "yahoo.com") ? "yahoo" : 0 === e2.search(Ns + "duckduckgo.com") ? "duckduckgo" : null : null;
|
|
2388
|
+
}, _searchInfoFromReferrer: function(e2) {
|
|
2389
|
+
var t2 = zs._searchEngine(e2), i2 = "yahoo" != t2 ? "q" : "p", r2 = {};
|
|
2390
|
+
if (!$(t2)) {
|
|
2391
|
+
r2.$search_engine = t2;
|
|
2392
|
+
var s2 = a ? kt(a.referrer, i2) : "";
|
|
2393
|
+
s2.length && (r2.ph_keyword = s2);
|
|
2394
|
+
}
|
|
2395
|
+
return r2;
|
|
2396
|
+
}, searchInfo: function() {
|
|
2397
|
+
var e2 = null == a ? void 0 : a.referrer;
|
|
2398
|
+
return e2 ? this._searchInfoFromReferrer(e2) : {};
|
|
2399
|
+
}, browser: As, browserVersion: function(e2, t2) {
|
|
2400
|
+
var i2 = As(e2, t2), r2 = Ls[i2];
|
|
2401
|
+
if (F(r2)) return null;
|
|
2402
|
+
for (var s2 = 0; s2 < r2.length; s2++) {
|
|
2403
|
+
var n2 = r2[s2], o2 = e2.match(n2);
|
|
2404
|
+
if (o2) return parseFloat(o2[o2.length - 2]);
|
|
2405
|
+
}
|
|
2406
|
+
return null;
|
|
2407
|
+
}, browserLanguage: function() {
|
|
2408
|
+
return navigator.language || navigator.userLanguage;
|
|
2409
|
+
}, browserLanguagePrefix: function() {
|
|
2410
|
+
var e2 = this.browserLanguage();
|
|
2411
|
+
return "string" == typeof e2 ? e2.split("-")[0] : void 0;
|
|
2412
|
+
}, os: function(e2) {
|
|
2413
|
+
for (var t2 = 0; t2 < Ds.length; t2++) {
|
|
2414
|
+
var [i2, r2] = Ds[t2], s2 = i2.exec(e2), n2 = s2 && (I(r2) ? r2(s2, e2) : r2);
|
|
2415
|
+
if (n2) return n2;
|
|
2416
|
+
}
|
|
2417
|
+
return ["", ""];
|
|
2418
|
+
}, device: qs, deviceType: function(e2) {
|
|
2419
|
+
var t2 = qs(e2);
|
|
2420
|
+
return t2 === Yr || t2 === Jr || "Kobo" === t2 || "Kindle Fire" === t2 || t2 === xs ? Gr : t2 === ps || t2 === vs || t2 === gs || t2 === Ss ? "Console" : t2 === Xr ? "Wearable" : t2 ? jr : "Desktop";
|
|
2421
|
+
}, referrer: function() {
|
|
2422
|
+
return (null == a ? void 0 : a.referrer) || "$direct";
|
|
2423
|
+
}, referringDomain: function() {
|
|
2424
|
+
var e2;
|
|
2425
|
+
return null != a && a.referrer && (null === (e2 = wt(a.referrer)) || void 0 === e2 ? void 0 : e2.host) || "$direct";
|
|
2426
|
+
}, referrerInfo: function() {
|
|
2427
|
+
return { $referrer: this.referrer(), $referring_domain: this.referringDomain() };
|
|
2428
|
+
}, personInfo: function() {
|
|
2429
|
+
var { maskPersonalDataProperties: e2, customPersonalDataProperties: t2 } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i2 = e2 ? Q([], Bs, t2 || []) : [], r2 = null == l ? void 0 : l.href.substring(0, 1e3);
|
|
2430
|
+
return { r: this.referrer().substring(0, 1e3), u: r2 ? Et(r2, i2, Us) : void 0 };
|
|
2431
|
+
}, personPropsFromInfo: function(e2) {
|
|
2432
|
+
var t2, { r: i2, u: r2 } = e2, s2 = { $referrer: i2, $referring_domain: null == i2 ? void 0 : "$direct" == i2 ? "$direct" : null === (t2 = wt(i2)) || void 0 === t2 ? void 0 : t2.host };
|
|
2433
|
+
if (r2) {
|
|
2434
|
+
s2.$current_url = r2;
|
|
2435
|
+
var n2 = wt(r2);
|
|
2436
|
+
s2.$host = null == n2 ? void 0 : n2.host, s2.$pathname = null == n2 ? void 0 : n2.pathname;
|
|
2437
|
+
var o2 = this._campaignParamsFromUrl(r2);
|
|
2438
|
+
X(s2, o2);
|
|
2439
|
+
}
|
|
2440
|
+
if (i2) {
|
|
2441
|
+
var a2 = this._searchInfoFromReferrer(i2);
|
|
2442
|
+
X(s2, a2);
|
|
2443
|
+
}
|
|
2444
|
+
return s2;
|
|
2445
|
+
}, initialPersonPropsFromInfo: function(e2) {
|
|
2446
|
+
var t2 = this.personPropsFromInfo(e2), i2 = {};
|
|
2447
|
+
return K(t2, function(e3, t3) {
|
|
2448
|
+
i2["$initial_".concat(b(t3))] = e3;
|
|
2449
|
+
}), i2;
|
|
2450
|
+
}, timezone: function() {
|
|
2451
|
+
try {
|
|
2452
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2453
|
+
} catch (e2) {
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
}, timezoneOffset: function() {
|
|
2457
|
+
try {
|
|
2458
|
+
return (/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
2459
|
+
} catch (e2) {
|
|
2460
|
+
return;
|
|
2461
|
+
}
|
|
2462
|
+
}, properties: function() {
|
|
2463
|
+
var { maskPersonalDataProperties: e2, customPersonalDataProperties: i2 } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
2464
|
+
if (!h) return {};
|
|
2465
|
+
var r2 = e2 ? Q([], Bs, i2 || []) : [], [s2, n2] = zs.os(h);
|
|
2466
|
+
return X(ie({ $os: s2, $os_version: n2, $browser: zs.browser(h, navigator.vendor), $device: zs.device(h), $device_type: zs.deviceType(h), $timezone: zs.timezone(), $timezone_offset: zs.timezoneOffset() }), { $current_url: Et(null == l ? void 0 : l.href, r2, Us), $host: null == l ? void 0 : l.host, $pathname: null == l ? void 0 : l.pathname, $raw_user_agent: h.length > 1e3 ? h.substring(0, 997) + "..." : h, $browser_version: zs.browserVersion(h, navigator.vendor), $browser_language: zs.browserLanguage(), $browser_language_prefix: zs.browserLanguagePrefix(), $screen_height: null == t ? void 0 : t.screen.height, $screen_width: null == t ? void 0 : t.screen.width, $viewport_height: null == t ? void 0 : t.innerHeight, $viewport_width: null == t ? void 0 : t.innerWidth, $lib: "web", $lib_version: p.LIB_VERSION, $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10), $time: Date.now() / 1e3 });
|
|
2467
|
+
}, people_properties: function() {
|
|
2468
|
+
if (!h) return {};
|
|
2469
|
+
var [e2, t2] = zs.os(h);
|
|
2470
|
+
return X(ie({ $os: e2, $os_version: t2, $browser: zs.browser(h, navigator.vendor) }), { $browser_version: zs.browserVersion(h, navigator.vendor) });
|
|
2471
|
+
} };
|
|
2472
|
+
var js = ["cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory"];
|
|
2473
|
+
var Ws = class {
|
|
2474
|
+
constructor(e2) {
|
|
2475
|
+
this.config = e2, this.props = {}, this.campaign_params_saved = false, this.name = ((e3) => {
|
|
2476
|
+
var t2 = "";
|
|
2477
|
+
return e3.token && (t2 = e3.token.replace(/\+/g, "PL").replace(/\//g, "SL").replace(/=/g, "EQ")), e3.persistence_name ? "ph_" + e3.persistence_name : "ph_" + t2 + "_posthog";
|
|
2478
|
+
})(e2), this.storage = this.buildStorage(e2), this.load(), e2.debug && B.info("Persistence loaded", e2.persistence, W({}, this.props)), this.update_config(e2, e2), this.save();
|
|
2479
|
+
}
|
|
2480
|
+
buildStorage(e2) {
|
|
2481
|
+
-1 === js.indexOf(e2.persistence.toLowerCase()) && (B.critical("Unknown persistence type " + e2.persistence + "; falling back to localStorage+cookie"), e2.persistence = "localStorage+cookie");
|
|
2482
|
+
var t2 = e2.persistence.toLowerCase();
|
|
2483
|
+
return "localstorage" === t2 && Gt.is_supported() ? Gt : "localstorage+cookie" === t2 && Yt.is_supported() ? Yt : "sessionstorage" === t2 && Zt.is_supported() ? Zt : "memory" === t2 ? Xt : "cookie" === t2 ? Wt : Yt.is_supported() ? Yt : Wt;
|
|
2484
|
+
}
|
|
2485
|
+
properties() {
|
|
2486
|
+
var e2 = {};
|
|
2487
|
+
return K(this.props, function(t2, i2) {
|
|
2488
|
+
if (i2 === Ce && P(t2)) for (var r2 = Object.keys(t2), s2 = 0; s2 < r2.length; s2++) e2["$feature/".concat(r2[s2])] = t2[r2[s2]];
|
|
2489
|
+
else a2 = i2, l2 = false, ($(o2 = je) ? l2 : n && o2.indexOf === n ? -1 != o2.indexOf(a2) : (K(o2, function(e3) {
|
|
2490
|
+
if (l2 || (l2 = e3 === a2)) return J;
|
|
2491
|
+
}), l2)) || (e2[i2] = t2);
|
|
2492
|
+
var o2, a2, l2;
|
|
2493
|
+
}), e2;
|
|
2494
|
+
}
|
|
2495
|
+
load() {
|
|
2496
|
+
if (!this.disabled) {
|
|
2497
|
+
var e2 = this.storage.parse(this.name);
|
|
2498
|
+
e2 && (this.props = X({}, e2));
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
save() {
|
|
2502
|
+
this.disabled || this.storage.set(this.name, this.props, this.expire_days, this.cross_subdomain, this.secure, this.config.debug);
|
|
2503
|
+
}
|
|
2504
|
+
remove() {
|
|
2505
|
+
this.storage.remove(this.name, false), this.storage.remove(this.name, true);
|
|
2506
|
+
}
|
|
2507
|
+
clear() {
|
|
2508
|
+
this.remove(), this.props = {};
|
|
2509
|
+
}
|
|
2510
|
+
register_once(e2, t2, i2) {
|
|
2511
|
+
if (P(e2)) {
|
|
2512
|
+
F(t2) && (t2 = "None"), this.expire_days = F(i2) ? this.default_expiry : i2;
|
|
2513
|
+
var r2 = false;
|
|
2514
|
+
if (K(e2, (e3, i3) => {
|
|
2515
|
+
this.props.hasOwnProperty(i3) && this.props[i3] !== t2 || (this.props[i3] = e3, r2 = true);
|
|
2516
|
+
}), r2) return this.save(), true;
|
|
2517
|
+
}
|
|
2518
|
+
return false;
|
|
2519
|
+
}
|
|
2520
|
+
register(e2, t2) {
|
|
2521
|
+
if (P(e2)) {
|
|
2522
|
+
this.expire_days = F(t2) ? this.default_expiry : t2;
|
|
2523
|
+
var i2 = false;
|
|
2524
|
+
if (K(e2, (t3, r2) => {
|
|
2525
|
+
e2.hasOwnProperty(r2) && this.props[r2] !== t3 && (this.props[r2] = t3, i2 = true);
|
|
2526
|
+
}), i2) return this.save(), true;
|
|
2527
|
+
}
|
|
2528
|
+
return false;
|
|
2529
|
+
}
|
|
2530
|
+
unregister(e2) {
|
|
2531
|
+
e2 in this.props && (delete this.props[e2], this.save());
|
|
2532
|
+
}
|
|
2533
|
+
update_campaign_params() {
|
|
2534
|
+
if (!this.campaign_params_saved) {
|
|
2535
|
+
var e2 = zs.campaignParams({ customTrackedParams: this.config.custom_campaign_params, maskPersonalDataProperties: this.config.mask_personal_data_properties, customPersonalDataProperties: this.config.custom_personal_data_properties });
|
|
2536
|
+
C(ie(e2)) || this.register(e2), this.campaign_params_saved = true;
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
update_search_keyword() {
|
|
2540
|
+
this.register(zs.searchInfo());
|
|
2541
|
+
}
|
|
2542
|
+
update_referrer_info() {
|
|
2543
|
+
this.register_once(zs.referrerInfo(), void 0);
|
|
2544
|
+
}
|
|
2545
|
+
set_initial_person_info() {
|
|
2546
|
+
this.props[qe] || this.props[Ne] || this.register_once({ [Be]: zs.personInfo({ maskPersonalDataProperties: this.config.mask_personal_data_properties, customPersonalDataProperties: this.config.custom_personal_data_properties }) }, void 0);
|
|
2547
|
+
}
|
|
2548
|
+
get_referrer_info() {
|
|
2549
|
+
return ie({ $referrer: this.props.$referrer, $referring_domain: this.props.$referring_domain });
|
|
2550
|
+
}
|
|
2551
|
+
get_initial_props() {
|
|
2552
|
+
var e2 = {};
|
|
2553
|
+
K([Ne, qe], (t3) => {
|
|
2554
|
+
var i3 = this.props[t3];
|
|
2555
|
+
i3 && K(i3, function(t4, i4) {
|
|
2556
|
+
e2["$initial_" + b(i4)] = t4;
|
|
2557
|
+
});
|
|
2558
|
+
});
|
|
2559
|
+
var t2 = this.props[Be];
|
|
2560
|
+
if (t2) {
|
|
2561
|
+
var i2 = zs.initialPersonPropsFromInfo(t2);
|
|
2562
|
+
X(e2, i2);
|
|
2563
|
+
}
|
|
2564
|
+
return e2;
|
|
2565
|
+
}
|
|
2566
|
+
safe_merge(e2) {
|
|
2567
|
+
return K(this.props, function(t2, i2) {
|
|
2568
|
+
i2 in e2 || (e2[i2] = t2);
|
|
2569
|
+
}), e2;
|
|
2570
|
+
}
|
|
2571
|
+
update_config(e2, t2) {
|
|
2572
|
+
if (this.default_expiry = this.expire_days = e2.cookie_expiration, this.set_disabled(e2.disable_persistence), this.set_cross_subdomain(e2.cross_subdomain_cookie), this.set_secure(e2.secure_cookie), e2.persistence !== t2.persistence) {
|
|
2573
|
+
var i2 = this.buildStorage(e2), r2 = this.props;
|
|
2574
|
+
this.clear(), this.storage = i2, this.props = r2, this.save();
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
set_disabled(e2) {
|
|
2578
|
+
this.disabled = e2, this.disabled ? this.remove() : this.save();
|
|
2579
|
+
}
|
|
2580
|
+
set_cross_subdomain(e2) {
|
|
2581
|
+
e2 !== this.cross_subdomain && (this.cross_subdomain = e2, this.remove(), this.save());
|
|
2582
|
+
}
|
|
2583
|
+
get_cross_subdomain() {
|
|
2584
|
+
return !!this.cross_subdomain;
|
|
2585
|
+
}
|
|
2586
|
+
set_secure(e2) {
|
|
2587
|
+
e2 !== this.secure && (this.secure = e2, this.remove(), this.save());
|
|
2588
|
+
}
|
|
2589
|
+
set_event_timer(e2, t2) {
|
|
2590
|
+
var i2 = this.props[ue] || {};
|
|
2591
|
+
i2[e2] = t2, this.props[ue] = i2, this.save();
|
|
2592
|
+
}
|
|
2593
|
+
remove_event_timer(e2) {
|
|
2594
|
+
var t2 = (this.props[ue] || {})[e2];
|
|
2595
|
+
return F(t2) || (delete this.props[ue][e2], this.save()), t2;
|
|
2596
|
+
}
|
|
2597
|
+
get_property(e2) {
|
|
2598
|
+
return this.props[e2];
|
|
2599
|
+
}
|
|
2600
|
+
set_property(e2, t2) {
|
|
2601
|
+
this.props[e2] = t2, this.save();
|
|
2602
|
+
}
|
|
2603
|
+
};
|
|
2604
|
+
var Vs;
|
|
2605
|
+
var Gs;
|
|
2606
|
+
var Js;
|
|
2607
|
+
var Ys;
|
|
2608
|
+
var Ks;
|
|
2609
|
+
var Xs;
|
|
2610
|
+
var Qs;
|
|
2611
|
+
var Zs;
|
|
2612
|
+
var en;
|
|
2613
|
+
var tn;
|
|
2614
|
+
var rn;
|
|
2615
|
+
var sn;
|
|
2616
|
+
var nn = {};
|
|
2617
|
+
var on = [];
|
|
2618
|
+
var an = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
2619
|
+
var ln = Array.isArray;
|
|
2620
|
+
function cn(e2, t2) {
|
|
2621
|
+
for (var i2 in t2) e2[i2] = t2[i2];
|
|
2622
|
+
return e2;
|
|
2623
|
+
}
|
|
2624
|
+
function un(e2) {
|
|
2625
|
+
var t2 = e2.parentNode;
|
|
2626
|
+
t2 && t2.removeChild(e2);
|
|
2627
|
+
}
|
|
2628
|
+
function dn(e2, t2, i2, r2, s2) {
|
|
2629
|
+
var n2 = { type: e2, props: t2, key: i2, ref: r2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: null == s2 ? ++Js : s2, __i: -1, __u: 0 };
|
|
2630
|
+
return null == s2 && null != Gs.vnode && Gs.vnode(n2), n2;
|
|
2631
|
+
}
|
|
2632
|
+
function hn(e2) {
|
|
2633
|
+
return e2.children;
|
|
2634
|
+
}
|
|
2635
|
+
function _n(e2, t2) {
|
|
2636
|
+
this.props = e2, this.context = t2;
|
|
2637
|
+
}
|
|
2638
|
+
function pn(e2, t2) {
|
|
2639
|
+
if (null == t2) return e2.__ ? pn(e2.__, e2.__i + 1) : null;
|
|
2640
|
+
for (var i2; t2 < e2.__k.length; t2++) if (null != (i2 = e2.__k[t2]) && null != i2.__e) return i2.__e;
|
|
2641
|
+
return "function" == typeof e2.type ? pn(e2) : null;
|
|
2642
|
+
}
|
|
2643
|
+
function gn(e2) {
|
|
2644
|
+
var t2, i2;
|
|
2645
|
+
if (null != (e2 = e2.__) && null != e2.__c) {
|
|
2646
|
+
for (e2.__e = e2.__c.base = null, t2 = 0; t2 < e2.__k.length; t2++) if (null != (i2 = e2.__k[t2]) && null != i2.__e) {
|
|
2647
|
+
e2.__e = e2.__c.base = i2.__e;
|
|
2648
|
+
break;
|
|
2649
|
+
}
|
|
2650
|
+
return gn(e2);
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
function vn(e2) {
|
|
2654
|
+
(!e2.__d && (e2.__d = true) && Ys.push(e2) && !fn.__r++ || Ks !== Gs.debounceRendering) && ((Ks = Gs.debounceRendering) || Xs)(fn);
|
|
2655
|
+
}
|
|
2656
|
+
function fn() {
|
|
2657
|
+
var e2, t2, i2, r2, s2, n2, o2, a2, l2;
|
|
2658
|
+
for (Ys.sort(Qs); e2 = Ys.shift(); ) e2.__d && (t2 = Ys.length, r2 = void 0, n2 = (s2 = (i2 = e2).__v).__e, a2 = [], l2 = [], (o2 = i2.__P) && ((r2 = cn({}, s2)).__v = s2.__v + 1, Gs.vnode && Gs.vnode(r2), In(o2, r2, s2, i2.__n, void 0 !== o2.ownerSVGElement, 32 & s2.__u ? [n2] : null, a2, null == n2 ? pn(s2) : n2, !!(32 & s2.__u), l2), r2.__.__k[r2.__i] = r2, Pn(a2, r2, l2), r2.__e != n2 && gn(r2)), Ys.length > t2 && Ys.sort(Qs));
|
|
2659
|
+
fn.__r = 0;
|
|
2660
|
+
}
|
|
2661
|
+
function mn(e2, t2, i2, r2, s2, n2, o2, a2, l2, c2, u2) {
|
|
2662
|
+
var d2, h2, _2, p2, g2, v2 = r2 && r2.__k || on, f2 = t2.length;
|
|
2663
|
+
for (i2.__d = l2, yn(i2, t2, v2), l2 = i2.__d, d2 = 0; d2 < f2; d2++) null != (_2 = i2.__k[d2]) && "boolean" != typeof _2 && "function" != typeof _2 && (h2 = -1 === _2.__i ? nn : v2[_2.__i] || nn, _2.__i = d2, In(e2, _2, h2, s2, n2, o2, a2, l2, c2, u2), p2 = _2.__e, _2.ref && h2.ref != _2.ref && (h2.ref && Fn(h2.ref, null, _2), u2.push(_2.ref, _2.__c || p2, _2)), null == g2 && null != p2 && (g2 = p2), 65536 & _2.__u || h2.__k === _2.__k ? l2 = bn(_2, l2, e2) : "function" == typeof _2.type && void 0 !== _2.__d ? l2 = _2.__d : p2 && (l2 = p2.nextSibling), _2.__d = void 0, _2.__u &= -196609);
|
|
2664
|
+
i2.__d = l2, i2.__e = g2;
|
|
2665
|
+
}
|
|
2666
|
+
function yn(e2, t2, i2) {
|
|
2667
|
+
var r2, s2, n2, o2, a2, l2 = t2.length, c2 = i2.length, u2 = c2, d2 = 0;
|
|
2668
|
+
for (e2.__k = [], r2 = 0; r2 < l2; r2++) null != (s2 = e2.__k[r2] = null == (s2 = t2[r2]) || "boolean" == typeof s2 || "function" == typeof s2 ? null : "string" == typeof s2 || "number" == typeof s2 || "bigint" == typeof s2 || s2.constructor == String ? dn(null, s2, null, null, s2) : ln(s2) ? dn(hn, { children: s2 }, null, null, null) : void 0 === s2.constructor && s2.__b > 0 ? dn(s2.type, s2.props, s2.key, s2.ref ? s2.ref : null, s2.__v) : s2) ? (s2.__ = e2, s2.__b = e2.__b + 1, a2 = wn(s2, i2, o2 = r2 + d2, u2), s2.__i = a2, n2 = null, -1 !== a2 && (u2--, (n2 = i2[a2]) && (n2.__u |= 131072)), null == n2 || null === n2.__v ? (-1 == a2 && d2--, "function" != typeof s2.type && (s2.__u |= 65536)) : a2 !== o2 && (a2 === o2 + 1 ? d2++ : a2 > o2 ? u2 > l2 - o2 ? d2 += a2 - o2 : d2-- : d2 = a2 < o2 && a2 == o2 - 1 ? a2 - o2 : 0, a2 !== r2 + d2 && (s2.__u |= 65536))) : (n2 = i2[r2]) && null == n2.key && n2.__e && (n2.__e == e2.__d && (e2.__d = pn(n2)), Rn(n2, n2, false), i2[r2] = null, u2--);
|
|
2669
|
+
if (u2) for (r2 = 0; r2 < c2; r2++) null != (n2 = i2[r2]) && 0 == (131072 & n2.__u) && (n2.__e == e2.__d && (e2.__d = pn(n2)), Rn(n2, n2));
|
|
2670
|
+
}
|
|
2671
|
+
function bn(e2, t2, i2) {
|
|
2672
|
+
var r2, s2;
|
|
2673
|
+
if ("function" == typeof e2.type) {
|
|
2674
|
+
for (r2 = e2.__k, s2 = 0; r2 && s2 < r2.length; s2++) r2[s2] && (r2[s2].__ = e2, t2 = bn(r2[s2], t2, i2));
|
|
2675
|
+
return t2;
|
|
2676
|
+
}
|
|
2677
|
+
return e2.__e != t2 && (i2.insertBefore(e2.__e, t2 || null), t2 = e2.__e), t2 && t2.nextSibling;
|
|
2678
|
+
}
|
|
2679
|
+
function wn(e2, t2, i2, r2) {
|
|
2680
|
+
var s2 = e2.key, n2 = e2.type, o2 = i2 - 1, a2 = i2 + 1, l2 = t2[i2];
|
|
2681
|
+
if (null === l2 || l2 && s2 == l2.key && n2 === l2.type) return i2;
|
|
2682
|
+
if (r2 > (null != l2 && 0 == (131072 & l2.__u) ? 1 : 0)) for (; o2 >= 0 || a2 < t2.length; ) {
|
|
2683
|
+
if (o2 >= 0) {
|
|
2684
|
+
if ((l2 = t2[o2]) && 0 == (131072 & l2.__u) && s2 == l2.key && n2 === l2.type) return o2;
|
|
2685
|
+
o2--;
|
|
2686
|
+
}
|
|
2687
|
+
if (a2 < t2.length) {
|
|
2688
|
+
if ((l2 = t2[a2]) && 0 == (131072 & l2.__u) && s2 == l2.key && n2 === l2.type) return a2;
|
|
2689
|
+
a2++;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
return -1;
|
|
2693
|
+
}
|
|
2694
|
+
function Sn(e2, t2, i2) {
|
|
2695
|
+
"-" === t2[0] ? e2.setProperty(t2, null == i2 ? "" : i2) : e2[t2] = null == i2 ? "" : "number" != typeof i2 || an.test(t2) ? i2 : i2 + "px";
|
|
2696
|
+
}
|
|
2697
|
+
function kn(e2, t2, i2, r2, s2) {
|
|
2698
|
+
var n2;
|
|
2699
|
+
e: if ("style" === t2) if ("string" == typeof i2) e2.style.cssText = i2;
|
|
2700
|
+
else {
|
|
2701
|
+
if ("string" == typeof r2 && (e2.style.cssText = r2 = ""), r2) for (t2 in r2) i2 && t2 in i2 || Sn(e2.style, t2, "");
|
|
2702
|
+
if (i2) for (t2 in i2) r2 && i2[t2] === r2[t2] || Sn(e2.style, t2, i2[t2]);
|
|
2703
|
+
}
|
|
2704
|
+
else if ("o" === t2[0] && "n" === t2[1]) n2 = t2 !== (t2 = t2.replace(/(PointerCapture)$|Capture$/, "$1")), t2 = t2.toLowerCase() in e2 ? t2.toLowerCase().slice(2) : t2.slice(2), e2.l || (e2.l = {}), e2.l[t2 + n2] = i2, i2 ? r2 ? i2.u = r2.u : (i2.u = Date.now(), e2.addEventListener(t2, n2 ? xn : En, n2)) : e2.removeEventListener(t2, n2 ? xn : En, n2);
|
|
2705
|
+
else {
|
|
2706
|
+
if (s2) t2 = t2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
2707
|
+
else if ("width" !== t2 && "height" !== t2 && "href" !== t2 && "list" !== t2 && "form" !== t2 && "tabIndex" !== t2 && "download" !== t2 && "rowSpan" !== t2 && "colSpan" !== t2 && "role" !== t2 && t2 in e2) try {
|
|
2708
|
+
e2[t2] = null == i2 ? "" : i2;
|
|
2709
|
+
break e;
|
|
2710
|
+
} catch (e3) {
|
|
2711
|
+
}
|
|
2712
|
+
"function" == typeof i2 || (null == i2 || false === i2 && "-" !== t2[4] ? e2.removeAttribute(t2) : e2.setAttribute(t2, i2));
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
function En(e2) {
|
|
2716
|
+
var t2 = this.l[e2.type + false];
|
|
2717
|
+
if (e2.t) {
|
|
2718
|
+
if (e2.t <= t2.u) return;
|
|
2719
|
+
} else e2.t = Date.now();
|
|
2720
|
+
return t2(Gs.event ? Gs.event(e2) : e2);
|
|
2721
|
+
}
|
|
2722
|
+
function xn(e2) {
|
|
2723
|
+
return this.l[e2.type + true](Gs.event ? Gs.event(e2) : e2);
|
|
2724
|
+
}
|
|
2725
|
+
function In(e2, t2, i2, r2, s2, n2, o2, a2, l2, c2) {
|
|
2726
|
+
var u2, d2, h2, _2, p2, g2, v2, f2, m2, y2, b2, w2, S2, k2, E2, x2 = t2.type;
|
|
2727
|
+
if (void 0 !== t2.constructor) return null;
|
|
2728
|
+
128 & i2.__u && (l2 = !!(32 & i2.__u), n2 = [a2 = t2.__e = i2.__e]), (u2 = Gs.__b) && u2(t2);
|
|
2729
|
+
e: if ("function" == typeof x2) try {
|
|
2730
|
+
if (f2 = t2.props, m2 = (u2 = x2.contextType) && r2[u2.__c], y2 = u2 ? m2 ? m2.props.value : u2.__ : r2, i2.__c ? v2 = (d2 = t2.__c = i2.__c).__ = d2.__E : ("prototype" in x2 && x2.prototype.render ? t2.__c = d2 = new x2(f2, y2) : (t2.__c = d2 = new _n(f2, y2), d2.constructor = x2, d2.render = Tn), m2 && m2.sub(d2), d2.props = f2, d2.state || (d2.state = {}), d2.context = y2, d2.__n = r2, h2 = d2.__d = true, d2.__h = [], d2._sb = []), null == d2.__s && (d2.__s = d2.state), null != x2.getDerivedStateFromProps && (d2.__s == d2.state && (d2.__s = cn({}, d2.__s)), cn(d2.__s, x2.getDerivedStateFromProps(f2, d2.__s))), _2 = d2.props, p2 = d2.state, d2.__v = t2, h2) null == x2.getDerivedStateFromProps && null != d2.componentWillMount && d2.componentWillMount(), null != d2.componentDidMount && d2.__h.push(d2.componentDidMount);
|
|
2731
|
+
else {
|
|
2732
|
+
if (null == x2.getDerivedStateFromProps && f2 !== _2 && null != d2.componentWillReceiveProps && d2.componentWillReceiveProps(f2, y2), !d2.__e && (null != d2.shouldComponentUpdate && false === d2.shouldComponentUpdate(f2, d2.__s, y2) || t2.__v === i2.__v)) {
|
|
2733
|
+
for (t2.__v !== i2.__v && (d2.props = f2, d2.state = d2.__s, d2.__d = false), t2.__e = i2.__e, t2.__k = i2.__k, t2.__k.forEach(function(e3) {
|
|
2734
|
+
e3 && (e3.__ = t2);
|
|
2735
|
+
}), b2 = 0; b2 < d2._sb.length; b2++) d2.__h.push(d2._sb[b2]);
|
|
2736
|
+
d2._sb = [], d2.__h.length && o2.push(d2);
|
|
2737
|
+
break e;
|
|
2738
|
+
}
|
|
2739
|
+
null != d2.componentWillUpdate && d2.componentWillUpdate(f2, d2.__s, y2), null != d2.componentDidUpdate && d2.__h.push(function() {
|
|
2740
|
+
d2.componentDidUpdate(_2, p2, g2);
|
|
2741
|
+
});
|
|
2742
|
+
}
|
|
2743
|
+
if (d2.context = y2, d2.props = f2, d2.__P = e2, d2.__e = false, w2 = Gs.__r, S2 = 0, "prototype" in x2 && x2.prototype.render) {
|
|
2744
|
+
for (d2.state = d2.__s, d2.__d = false, w2 && w2(t2), u2 = d2.render(d2.props, d2.state, d2.context), k2 = 0; k2 < d2._sb.length; k2++) d2.__h.push(d2._sb[k2]);
|
|
2745
|
+
d2._sb = [];
|
|
2746
|
+
} else do {
|
|
2747
|
+
d2.__d = false, w2 && w2(t2), u2 = d2.render(d2.props, d2.state, d2.context), d2.state = d2.__s;
|
|
2748
|
+
} while (d2.__d && ++S2 < 25);
|
|
2749
|
+
d2.state = d2.__s, null != d2.getChildContext && (r2 = cn(cn({}, r2), d2.getChildContext())), h2 || null == d2.getSnapshotBeforeUpdate || (g2 = d2.getSnapshotBeforeUpdate(_2, p2)), mn(e2, ln(E2 = null != u2 && u2.type === hn && null == u2.key ? u2.props.children : u2) ? E2 : [E2], t2, i2, r2, s2, n2, o2, a2, l2, c2), d2.base = t2.__e, t2.__u &= -161, d2.__h.length && o2.push(d2), v2 && (d2.__E = d2.__ = null);
|
|
2750
|
+
} catch (e3) {
|
|
2751
|
+
t2.__v = null, l2 || null != n2 ? (t2.__e = a2, t2.__u |= l2 ? 160 : 32, n2[n2.indexOf(a2)] = null) : (t2.__e = i2.__e, t2.__k = i2.__k), Gs.__e(e3, t2, i2);
|
|
2752
|
+
}
|
|
2753
|
+
else null == n2 && t2.__v === i2.__v ? (t2.__k = i2.__k, t2.__e = i2.__e) : t2.__e = Cn(i2.__e, t2, i2, r2, s2, n2, o2, l2, c2);
|
|
2754
|
+
(u2 = Gs.diffed) && u2(t2);
|
|
2755
|
+
}
|
|
2756
|
+
function Pn(e2, t2, i2) {
|
|
2757
|
+
t2.__d = void 0;
|
|
2758
|
+
for (var r2 = 0; r2 < i2.length; r2++) Fn(i2[r2], i2[++r2], i2[++r2]);
|
|
2759
|
+
Gs.__c && Gs.__c(t2, e2), e2.some(function(t3) {
|
|
2760
|
+
try {
|
|
2761
|
+
e2 = t3.__h, t3.__h = [], e2.some(function(e3) {
|
|
2762
|
+
e3.call(t3);
|
|
2763
|
+
});
|
|
2764
|
+
} catch (e3) {
|
|
2765
|
+
Gs.__e(e3, t3.__v);
|
|
2766
|
+
}
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
function Cn(e2, t2, i2, r2, s2, n2, o2, a2, l2) {
|
|
2770
|
+
var c2, u2, d2, h2, _2, p2, g2, v2 = i2.props, f2 = t2.props, m2 = t2.type;
|
|
2771
|
+
if ("svg" === m2 && (s2 = true), null != n2) {
|
|
2772
|
+
for (c2 = 0; c2 < n2.length; c2++) if ((_2 = n2[c2]) && "setAttribute" in _2 == !!m2 && (m2 ? _2.localName === m2 : 3 === _2.nodeType)) {
|
|
2773
|
+
e2 = _2, n2[c2] = null;
|
|
2774
|
+
break;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
if (null == e2) {
|
|
2778
|
+
if (null === m2) return document.createTextNode(f2);
|
|
2779
|
+
e2 = s2 ? document.createElementNS("http://www.w3.org/2000/svg", m2) : document.createElement(m2, f2.is && f2), n2 = null, a2 = false;
|
|
2780
|
+
}
|
|
2781
|
+
if (null === m2) v2 === f2 || a2 && e2.data === f2 || (e2.data = f2);
|
|
2782
|
+
else {
|
|
2783
|
+
if (n2 = n2 && Vs.call(e2.childNodes), v2 = i2.props || nn, !a2 && null != n2) for (v2 = {}, c2 = 0; c2 < e2.attributes.length; c2++) v2[(_2 = e2.attributes[c2]).name] = _2.value;
|
|
2784
|
+
for (c2 in v2) _2 = v2[c2], "children" == c2 || ("dangerouslySetInnerHTML" == c2 ? d2 = _2 : "key" === c2 || c2 in f2 || kn(e2, c2, null, _2, s2));
|
|
2785
|
+
for (c2 in f2) _2 = f2[c2], "children" == c2 ? h2 = _2 : "dangerouslySetInnerHTML" == c2 ? u2 = _2 : "value" == c2 ? p2 = _2 : "checked" == c2 ? g2 = _2 : "key" === c2 || a2 && "function" != typeof _2 || v2[c2] === _2 || kn(e2, c2, _2, v2[c2], s2);
|
|
2786
|
+
if (u2) a2 || d2 && (u2.__html === d2.__html || u2.__html === e2.innerHTML) || (e2.innerHTML = u2.__html), t2.__k = [];
|
|
2787
|
+
else if (d2 && (e2.innerHTML = ""), mn(e2, ln(h2) ? h2 : [h2], t2, i2, r2, s2 && "foreignObject" !== m2, n2, o2, n2 ? n2[0] : i2.__k && pn(i2, 0), a2, l2), null != n2) for (c2 = n2.length; c2--; ) null != n2[c2] && un(n2[c2]);
|
|
2788
|
+
a2 || (c2 = "value", void 0 !== p2 && (p2 !== e2[c2] || "progress" === m2 && !p2 || "option" === m2 && p2 !== v2[c2]) && kn(e2, c2, p2, v2[c2], false), c2 = "checked", void 0 !== g2 && g2 !== e2[c2] && kn(e2, c2, g2, v2[c2], false));
|
|
2789
|
+
}
|
|
2790
|
+
return e2;
|
|
2791
|
+
}
|
|
2792
|
+
function Fn(e2, t2, i2) {
|
|
2793
|
+
try {
|
|
2794
|
+
"function" == typeof e2 ? e2(t2) : e2.current = t2;
|
|
2795
|
+
} catch (e3) {
|
|
2796
|
+
Gs.__e(e3, i2);
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
function Rn(e2, t2, i2) {
|
|
2800
|
+
var r2, s2;
|
|
2801
|
+
if (Gs.unmount && Gs.unmount(e2), (r2 = e2.ref) && (r2.current && r2.current !== e2.__e || Fn(r2, null, t2)), null != (r2 = e2.__c)) {
|
|
2802
|
+
if (r2.componentWillUnmount) try {
|
|
2803
|
+
r2.componentWillUnmount();
|
|
2804
|
+
} catch (e3) {
|
|
2805
|
+
Gs.__e(e3, t2);
|
|
2806
|
+
}
|
|
2807
|
+
r2.base = r2.__P = null, e2.__c = void 0;
|
|
2808
|
+
}
|
|
2809
|
+
if (r2 = e2.__k) for (s2 = 0; s2 < r2.length; s2++) r2[s2] && Rn(r2[s2], t2, i2 || "function" != typeof e2.type);
|
|
2810
|
+
i2 || null == e2.__e || un(e2.__e), e2.__ = e2.__e = e2.__d = void 0;
|
|
2811
|
+
}
|
|
2812
|
+
function Tn(e2, t2, i2) {
|
|
2813
|
+
return this.constructor(e2, i2);
|
|
2814
|
+
}
|
|
2815
|
+
Vs = on.slice, Gs = { __e: function(e2, t2, i2, r2) {
|
|
2816
|
+
for (var s2, n2, o2; t2 = t2.__; ) if ((s2 = t2.__c) && !s2.__) try {
|
|
2817
|
+
if ((n2 = s2.constructor) && null != n2.getDerivedStateFromError && (s2.setState(n2.getDerivedStateFromError(e2)), o2 = s2.__d), null != s2.componentDidCatch && (s2.componentDidCatch(e2, r2 || {}), o2 = s2.__d), o2) return s2.__E = s2;
|
|
2818
|
+
} catch (t3) {
|
|
2819
|
+
e2 = t3;
|
|
2820
|
+
}
|
|
2821
|
+
throw e2;
|
|
2822
|
+
} }, Js = 0, _n.prototype.setState = function(e2, t2) {
|
|
2823
|
+
var i2;
|
|
2824
|
+
i2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = cn({}, this.state), "function" == typeof e2 && (e2 = e2(cn({}, i2), this.props)), e2 && cn(i2, e2), null != e2 && this.__v && (t2 && this._sb.push(t2), vn(this));
|
|
2825
|
+
}, _n.prototype.forceUpdate = function(e2) {
|
|
2826
|
+
this.__v && (this.__e = true, e2 && this.__h.push(e2), vn(this));
|
|
2827
|
+
}, _n.prototype.render = hn, Ys = [], Xs = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Qs = function(e2, t2) {
|
|
2828
|
+
return e2.__v.__b - t2.__v.__b;
|
|
2829
|
+
}, fn.__r = 0, Zs = 0, function(e2) {
|
|
2830
|
+
e2.Popover = "popover", e2.API = "api", e2.Widget = "widget";
|
|
2831
|
+
}(en || (en = {})), function(e2) {
|
|
2832
|
+
e2.Open = "open", e2.MultipleChoice = "multiple_choice", e2.SingleChoice = "single_choice", e2.Rating = "rating", e2.Link = "link";
|
|
2833
|
+
}(tn || (tn = {})), function(e2) {
|
|
2834
|
+
e2.NextQuestion = "next_question", e2.End = "end", e2.ResponseBased = "response_based", e2.SpecificQuestion = "specific_question";
|
|
2835
|
+
}(rn || (rn = {})), function(e2) {
|
|
2836
|
+
e2.Once = "once", e2.Recurring = "recurring", e2.Always = "always";
|
|
2837
|
+
}(sn || (sn = {}));
|
|
2838
|
+
!function(e2, t2) {
|
|
2839
|
+
var i2 = { __c: t2 = "__cC" + Zs++, __: e2, Consumer: function(e3, t3) {
|
|
2840
|
+
return e3.children(t3);
|
|
2841
|
+
}, Provider: function(e3) {
|
|
2842
|
+
var i3, r2;
|
|
2843
|
+
return this.getChildContext || (i3 = [], (r2 = {})[t2] = this, this.getChildContext = function() {
|
|
2844
|
+
return r2;
|
|
2845
|
+
}, this.shouldComponentUpdate = function(e4) {
|
|
2846
|
+
this.props.value !== e4.value && i3.some(function(e5) {
|
|
2847
|
+
e5.__e = true, vn(e5);
|
|
2848
|
+
});
|
|
2849
|
+
}, this.sub = function(e4) {
|
|
2850
|
+
i3.push(e4);
|
|
2851
|
+
var t3 = e4.componentWillUnmount;
|
|
2852
|
+
e4.componentWillUnmount = function() {
|
|
2853
|
+
i3.splice(i3.indexOf(e4), 1), t3 && t3.call(e4);
|
|
2854
|
+
};
|
|
2855
|
+
}), e3.children;
|
|
2856
|
+
} };
|
|
2857
|
+
i2.Provider.__ = i2.Consumer.contextType = i2;
|
|
2858
|
+
}({ isPreviewMode: false, previewPageIndex: 0, onPopupSurveyDismissed: () => {
|
|
2859
|
+
}, isPopup: true, onPreviewSubmit: () => {
|
|
2860
|
+
}, onPopupSurveySent: () => {
|
|
2861
|
+
} });
|
|
2862
|
+
var $n = function(e2, t2) {
|
|
2863
|
+
if (!function(e3) {
|
|
2864
|
+
try {
|
|
2865
|
+
new RegExp(e3);
|
|
2866
|
+
} catch (e4) {
|
|
2867
|
+
return false;
|
|
2868
|
+
}
|
|
2869
|
+
return true;
|
|
2870
|
+
}(t2)) return false;
|
|
2871
|
+
try {
|
|
2872
|
+
return new RegExp(t2).test(e2);
|
|
2873
|
+
} catch (e3) {
|
|
2874
|
+
return false;
|
|
2875
|
+
}
|
|
2876
|
+
};
|
|
2877
|
+
var On = class {
|
|
2878
|
+
constructor() {
|
|
2879
|
+
V(this, "events", {}), this.events = {};
|
|
2880
|
+
}
|
|
2881
|
+
on(e2, t2) {
|
|
2882
|
+
return this.events[e2] || (this.events[e2] = []), this.events[e2].push(t2), () => {
|
|
2883
|
+
this.events[e2] = this.events[e2].filter((e3) => e3 !== t2);
|
|
2884
|
+
};
|
|
2885
|
+
}
|
|
2886
|
+
emit(e2, t2) {
|
|
2887
|
+
for (var i2 of this.events[e2] || []) i2(t2);
|
|
2888
|
+
for (var r2 of this.events["*"] || []) r2(e2, t2);
|
|
2889
|
+
}
|
|
2890
|
+
};
|
|
2891
|
+
var Mn = class _Mn {
|
|
2892
|
+
constructor(e2) {
|
|
2893
|
+
V(this, "_debugEventEmitter", new On()), V(this, "checkStep", (e3, t2) => this.checkStepEvent(e3, t2) && this.checkStepUrl(e3, t2) && this.checkStepElement(e3, t2)), V(this, "checkStepEvent", (e3, t2) => null == t2 || !t2.event || (null == e3 ? void 0 : e3.event) === (null == t2 ? void 0 : t2.event)), this.instance = e2, this.actionEvents = /* @__PURE__ */ new Set(), this.actionRegistry = /* @__PURE__ */ new Set();
|
|
2894
|
+
}
|
|
2895
|
+
init() {
|
|
2896
|
+
var e2;
|
|
2897
|
+
if (!F(null === (e2 = this.instance) || void 0 === e2 ? void 0 : e2._addCaptureHook)) {
|
|
2898
|
+
var t2;
|
|
2899
|
+
null === (t2 = this.instance) || void 0 === t2 || t2._addCaptureHook((e3, t3) => {
|
|
2900
|
+
this.on(e3, t3);
|
|
2901
|
+
});
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
register(e2) {
|
|
2905
|
+
var t2, i2;
|
|
2906
|
+
if (!F(null === (t2 = this.instance) || void 0 === t2 ? void 0 : t2._addCaptureHook) && (e2.forEach((e3) => {
|
|
2907
|
+
var t3, i3;
|
|
2908
|
+
null === (t3 = this.actionRegistry) || void 0 === t3 || t3.add(e3), null === (i3 = e3.steps) || void 0 === i3 || i3.forEach((e4) => {
|
|
2909
|
+
var t4;
|
|
2910
|
+
null === (t4 = this.actionEvents) || void 0 === t4 || t4.add((null == e4 ? void 0 : e4.event) || "");
|
|
2911
|
+
});
|
|
2912
|
+
}), null !== (i2 = this.instance) && void 0 !== i2 && i2.autocapture)) {
|
|
2913
|
+
var r2, s2 = /* @__PURE__ */ new Set();
|
|
2914
|
+
e2.forEach((e3) => {
|
|
2915
|
+
var t3;
|
|
2916
|
+
null === (t3 = e3.steps) || void 0 === t3 || t3.forEach((e4) => {
|
|
2917
|
+
null != e4 && e4.selector && s2.add(null == e4 ? void 0 : e4.selector);
|
|
2918
|
+
});
|
|
2919
|
+
}), null === (r2 = this.instance) || void 0 === r2 || r2.autocapture.setElementSelectors(s2);
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
on(e2, t2) {
|
|
2923
|
+
var i2;
|
|
2924
|
+
null != t2 && 0 != e2.length && (this.actionEvents.has(e2) || this.actionEvents.has(null == t2 ? void 0 : t2.event)) && this.actionRegistry && (null === (i2 = this.actionRegistry) || void 0 === i2 ? void 0 : i2.size) > 0 && this.actionRegistry.forEach((e3) => {
|
|
2925
|
+
this.checkAction(t2, e3) && this._debugEventEmitter.emit("actionCaptured", e3.name);
|
|
2926
|
+
});
|
|
2927
|
+
}
|
|
2928
|
+
_addActionHook(e2) {
|
|
2929
|
+
this.onAction("actionCaptured", (t2) => e2(t2));
|
|
2930
|
+
}
|
|
2931
|
+
checkAction(e2, t2) {
|
|
2932
|
+
if (null == (null == t2 ? void 0 : t2.steps)) return false;
|
|
2933
|
+
for (var i2 of t2.steps) if (this.checkStep(e2, i2)) return true;
|
|
2934
|
+
return false;
|
|
2935
|
+
}
|
|
2936
|
+
onAction(e2, t2) {
|
|
2937
|
+
return this._debugEventEmitter.on(e2, t2);
|
|
2938
|
+
}
|
|
2939
|
+
checkStepUrl(e2, t2) {
|
|
2940
|
+
if (null != t2 && t2.url) {
|
|
2941
|
+
var i2, r2 = null == e2 || null === (i2 = e2.properties) || void 0 === i2 ? void 0 : i2.$current_url;
|
|
2942
|
+
if (!r2 || "string" != typeof r2) return false;
|
|
2943
|
+
if (!_Mn.matchString(r2, null == t2 ? void 0 : t2.url, (null == t2 ? void 0 : t2.url_matching) || "contains")) return false;
|
|
2944
|
+
}
|
|
2945
|
+
return true;
|
|
2946
|
+
}
|
|
2947
|
+
static matchString(e2, i2, r2) {
|
|
2948
|
+
switch (r2) {
|
|
2949
|
+
case "regex":
|
|
2950
|
+
return !!t && $n(e2, i2);
|
|
2951
|
+
case "exact":
|
|
2952
|
+
return i2 === e2;
|
|
2953
|
+
case "contains":
|
|
2954
|
+
var s2 = _Mn.escapeStringRegexp(i2).replace(/_/g, ".").replace(/%/g, ".*");
|
|
2955
|
+
return $n(e2, s2);
|
|
2956
|
+
default:
|
|
2957
|
+
return false;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
static escapeStringRegexp(e2) {
|
|
2961
|
+
return e2.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
2962
|
+
}
|
|
2963
|
+
checkStepElement(e2, t2) {
|
|
2964
|
+
if ((null != t2 && t2.href || null != t2 && t2.tag_name || null != t2 && t2.text) && !this.getElementsList(e2).some((e3) => !(null != t2 && t2.href && !_Mn.matchString(e3.href || "", null == t2 ? void 0 : t2.href, (null == t2 ? void 0 : t2.href_matching) || "exact")) && ((null == t2 || !t2.tag_name || e3.tag_name === (null == t2 ? void 0 : t2.tag_name)) && !(null != t2 && t2.text && !_Mn.matchString(e3.text || "", null == t2 ? void 0 : t2.text, (null == t2 ? void 0 : t2.text_matching) || "exact") && !_Mn.matchString(e3.$el_text || "", null == t2 ? void 0 : t2.text, (null == t2 ? void 0 : t2.text_matching) || "exact"))))) return false;
|
|
2965
|
+
if (null != t2 && t2.selector) {
|
|
2966
|
+
var i2, r2 = null == e2 || null === (i2 = e2.properties) || void 0 === i2 ? void 0 : i2.$element_selectors;
|
|
2967
|
+
if (!r2) return false;
|
|
2968
|
+
if (!r2.includes(null == t2 ? void 0 : t2.selector)) return false;
|
|
2969
|
+
}
|
|
2970
|
+
return true;
|
|
2971
|
+
}
|
|
2972
|
+
getElementsList(e2) {
|
|
2973
|
+
return null == (null == e2 ? void 0 : e2.properties.$elements) ? [] : null == e2 ? void 0 : e2.properties.$elements;
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
var An = class _An {
|
|
2977
|
+
constructor(e2) {
|
|
2978
|
+
this.instance = e2, this.eventToSurveys = /* @__PURE__ */ new Map(), this.actionToSurveys = /* @__PURE__ */ new Map();
|
|
2979
|
+
}
|
|
2980
|
+
register(e2) {
|
|
2981
|
+
var t2;
|
|
2982
|
+
F(null === (t2 = this.instance) || void 0 === t2 ? void 0 : t2._addCaptureHook) || (this.setupEventBasedSurveys(e2), this.setupActionBasedSurveys(e2));
|
|
2983
|
+
}
|
|
2984
|
+
setupActionBasedSurveys(e2) {
|
|
2985
|
+
var t2 = e2.filter((e3) => {
|
|
2986
|
+
var t3, i2, r2, s2;
|
|
2987
|
+
return (null === (t3 = e3.conditions) || void 0 === t3 ? void 0 : t3.actions) && (null === (i2 = e3.conditions) || void 0 === i2 || null === (r2 = i2.actions) || void 0 === r2 || null === (s2 = r2.values) || void 0 === s2 ? void 0 : s2.length) > 0;
|
|
2988
|
+
});
|
|
2989
|
+
if (0 !== t2.length) {
|
|
2990
|
+
if (null == this.actionMatcher) {
|
|
2991
|
+
this.actionMatcher = new Mn(this.instance), this.actionMatcher.init();
|
|
2992
|
+
this.actionMatcher._addActionHook((e3) => {
|
|
2993
|
+
this.onAction(e3);
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
t2.forEach((e3) => {
|
|
2997
|
+
var t3, i2, r2, s2, n2, o2, a2, l2, c2, u2;
|
|
2998
|
+
e3.conditions && null !== (t3 = e3.conditions) && void 0 !== t3 && t3.actions && null !== (i2 = e3.conditions) && void 0 !== i2 && null !== (r2 = i2.actions) && void 0 !== r2 && r2.values && (null === (s2 = e3.conditions) || void 0 === s2 || null === (n2 = s2.actions) || void 0 === n2 || null === (o2 = n2.values) || void 0 === o2 ? void 0 : o2.length) > 0 && (null === (a2 = this.actionMatcher) || void 0 === a2 || a2.register(e3.conditions.actions.values), null === (l2 = e3.conditions) || void 0 === l2 || null === (c2 = l2.actions) || void 0 === c2 || null === (u2 = c2.values) || void 0 === u2 || u2.forEach((t4) => {
|
|
2999
|
+
if (t4 && t4.name) {
|
|
3000
|
+
var i3 = this.actionToSurveys.get(t4.name);
|
|
3001
|
+
i3 && i3.push(e3.id), this.actionToSurveys.set(t4.name, i3 || [e3.id]);
|
|
3002
|
+
}
|
|
3003
|
+
}));
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
setupEventBasedSurveys(e2) {
|
|
3008
|
+
var t2;
|
|
3009
|
+
if (0 !== e2.filter((e3) => {
|
|
3010
|
+
var t3, i2, r2, s2;
|
|
3011
|
+
return (null === (t3 = e3.conditions) || void 0 === t3 ? void 0 : t3.events) && (null === (i2 = e3.conditions) || void 0 === i2 || null === (r2 = i2.events) || void 0 === r2 || null === (s2 = r2.values) || void 0 === s2 ? void 0 : s2.length) > 0;
|
|
3012
|
+
}).length) {
|
|
3013
|
+
null === (t2 = this.instance) || void 0 === t2 || t2._addCaptureHook((e3, t3) => {
|
|
3014
|
+
this.onEvent(e3, t3);
|
|
3015
|
+
}), e2.forEach((e3) => {
|
|
3016
|
+
var t3, i2, r2;
|
|
3017
|
+
null === (t3 = e3.conditions) || void 0 === t3 || null === (i2 = t3.events) || void 0 === i2 || null === (r2 = i2.values) || void 0 === r2 || r2.forEach((t4) => {
|
|
3018
|
+
if (t4 && t4.name) {
|
|
3019
|
+
var i3 = this.eventToSurveys.get(t4.name);
|
|
3020
|
+
i3 && i3.push(e3.id), this.eventToSurveys.set(t4.name, i3 || [e3.id]);
|
|
3021
|
+
}
|
|
3022
|
+
});
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
onEvent(e2, t2) {
|
|
3027
|
+
var i2, r2, s2 = (null === (i2 = this.instance) || void 0 === i2 || null === (r2 = i2.persistence) || void 0 === r2 ? void 0 : r2.props[Oe]) || [];
|
|
3028
|
+
if (_An.SURVEY_SHOWN_EVENT_NAME == e2 && t2 && s2.length > 0) {
|
|
3029
|
+
var n2, o2 = null == t2 || null === (n2 = t2.properties) || void 0 === n2 ? void 0 : n2.$survey_id;
|
|
3030
|
+
if (o2) {
|
|
3031
|
+
var a2 = s2.indexOf(o2);
|
|
3032
|
+
a2 >= 0 && (s2.splice(a2, 1), this._updateActivatedSurveys(s2));
|
|
3033
|
+
}
|
|
3034
|
+
} else this.eventToSurveys.has(e2) && this._updateActivatedSurveys(s2.concat(this.eventToSurveys.get(e2) || []));
|
|
3035
|
+
}
|
|
3036
|
+
onAction(e2) {
|
|
3037
|
+
var t2, i2, r2 = (null === (t2 = this.instance) || void 0 === t2 || null === (i2 = t2.persistence) || void 0 === i2 ? void 0 : i2.props[Oe]) || [];
|
|
3038
|
+
this.actionToSurveys.has(e2) && this._updateActivatedSurveys(r2.concat(this.actionToSurveys.get(e2) || []));
|
|
3039
|
+
}
|
|
3040
|
+
_updateActivatedSurveys(e2) {
|
|
3041
|
+
var t2, i2;
|
|
3042
|
+
null === (t2 = this.instance) || void 0 === t2 || null === (i2 = t2.persistence) || void 0 === i2 || i2.register({ [Oe]: [...new Set(e2)] });
|
|
3043
|
+
}
|
|
3044
|
+
getSurveys() {
|
|
3045
|
+
var e2, t2, i2 = null === (e2 = this.instance) || void 0 === e2 || null === (t2 = e2.persistence) || void 0 === t2 ? void 0 : t2.props[Oe];
|
|
3046
|
+
return i2 || [];
|
|
3047
|
+
}
|
|
3048
|
+
getEventToSurveys() {
|
|
3049
|
+
return this.eventToSurveys;
|
|
3050
|
+
}
|
|
3051
|
+
_getActionMatcher() {
|
|
3052
|
+
return this.actionMatcher;
|
|
3053
|
+
}
|
|
3054
|
+
};
|
|
3055
|
+
V(An, "SURVEY_SHOWN_EVENT_NAME", "survey shown");
|
|
3056
|
+
var Ln = H("[Surveys]");
|
|
3057
|
+
var Dn = { icontains: (e2, t2) => e2.some((e3) => t2.toLowerCase().includes(e3.toLowerCase())), not_icontains: (e2, t2) => e2.every((e3) => !t2.toLowerCase().includes(e3.toLowerCase())), regex: (e2, t2) => e2.some((e3) => $n(t2, e3)), not_regex: (e2, t2) => e2.every((e3) => !$n(t2, e3)), exact: (e2, t2) => e2.some((e3) => t2 === e3), is_not: (e2, t2) => e2.every((e3) => t2 !== e3) };
|
|
3058
|
+
function qn(e2) {
|
|
3059
|
+
return null != e2 ? e2 : "icontains";
|
|
3060
|
+
}
|
|
3061
|
+
var Nn = class {
|
|
3062
|
+
constructor(e2) {
|
|
3063
|
+
V(this, "_isFetchingSurveys", false), V(this, "_isInitializingSurveys", false), this.instance = e2, this._surveyEventReceiver = null;
|
|
3064
|
+
}
|
|
3065
|
+
onRemoteConfig(e2) {
|
|
3066
|
+
this._decideServerResponse = !!e2.surveys, Ln.info("decideServerResponse set to ".concat(this._decideServerResponse)), this.loadIfEnabled();
|
|
3067
|
+
}
|
|
3068
|
+
reset() {
|
|
3069
|
+
localStorage.removeItem("lastSeenSurveyDate");
|
|
3070
|
+
var e2 = (() => {
|
|
3071
|
+
for (var e3 = [], t2 = 0; t2 < localStorage.length; t2++) {
|
|
3072
|
+
var i2 = localStorage.key(t2);
|
|
3073
|
+
null != i2 && i2.startsWith("seenSurvey_") && e3.push(i2);
|
|
3074
|
+
}
|
|
3075
|
+
return e3;
|
|
3076
|
+
})();
|
|
3077
|
+
e2.forEach((e3) => localStorage.removeItem(e3));
|
|
3078
|
+
}
|
|
3079
|
+
loadIfEnabled() {
|
|
3080
|
+
if (!this._surveyManager) if (this._isInitializingSurveys) Ln.info("Already initializing surveys, skipping...");
|
|
3081
|
+
else if (this.instance.config.disable_surveys) Ln.info("Disabled. Not loading surveys.");
|
|
3082
|
+
else {
|
|
3083
|
+
var e2 = null == _ ? void 0 : _.__PosthogExtensions__;
|
|
3084
|
+
if (e2) if (this._decideServerResponse) {
|
|
3085
|
+
this._isInitializingSurveys = true;
|
|
3086
|
+
try {
|
|
3087
|
+
var t2 = e2.generateSurveys;
|
|
3088
|
+
if (t2) this._surveyManager = t2(this.instance), this._isInitializingSurveys = false, this._surveyEventReceiver = new An(this.instance), Ln.info("Surveys loaded successfully");
|
|
3089
|
+
else {
|
|
3090
|
+
var i2 = e2.loadExternalDependency;
|
|
3091
|
+
i2 ? i2(this.instance, "surveys", (t3) => {
|
|
3092
|
+
if (t3 || !e2.generateSurveys) return Ln.error("Could not load surveys script", t3), void (this._isInitializingSurveys = false);
|
|
3093
|
+
this._surveyManager = e2.generateSurveys(this.instance), this._isInitializingSurveys = false, this._surveyEventReceiver = new An(this.instance), Ln.info("Surveys loaded successfully");
|
|
3094
|
+
}) : (Ln.error("PostHog loadExternalDependency extension not found. Cannot load remote config."), this._isInitializingSurveys = false);
|
|
3095
|
+
}
|
|
3096
|
+
} catch (e3) {
|
|
3097
|
+
throw Ln.error("Error initializing surveys", e3), this._isInitializingSurveys = false, e3;
|
|
3098
|
+
}
|
|
3099
|
+
} else Ln.warn("Decide not loaded yet. Not loading surveys.");
|
|
3100
|
+
else Ln.error("PostHog Extensions not found.");
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
getSurveys(e2) {
|
|
3104
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
3105
|
+
if (this.instance.config.disable_surveys) return Ln.info("Disabled. Not loading surveys."), e2([]);
|
|
3106
|
+
var i2 = this.instance.get_property($e);
|
|
3107
|
+
if (i2 && !t2) return e2(i2);
|
|
3108
|
+
if (this._isFetchingSurveys) return e2([]);
|
|
3109
|
+
try {
|
|
3110
|
+
this._isFetchingSurveys = true, 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: (t3) => {
|
|
3111
|
+
var i3;
|
|
3112
|
+
this._isFetchingSurveys = false;
|
|
3113
|
+
var r2 = t3.statusCode;
|
|
3114
|
+
if (200 !== r2 || !t3.json) return Ln.error("Surveys API could not be loaded, status: ".concat(r2)), e2([]);
|
|
3115
|
+
var s2, n2 = t3.json.surveys || [], o2 = n2.filter((e3) => {
|
|
3116
|
+
var t4, i4, r3, s3, n3, o3, a2, l2, c2, u2, d2, h2;
|
|
3117
|
+
return (null === (t4 = e3.conditions) || void 0 === t4 ? void 0 : t4.events) && (null === (i4 = e3.conditions) || void 0 === i4 || null === (r3 = i4.events) || void 0 === r3 ? void 0 : r3.values) && (null === (s3 = e3.conditions) || void 0 === s3 || null === (n3 = s3.events) || void 0 === n3 || null === (o3 = n3.values) || void 0 === o3 ? void 0 : o3.length) > 0 || (null === (a2 = e3.conditions) || void 0 === a2 ? void 0 : a2.actions) && (null === (l2 = e3.conditions) || void 0 === l2 || null === (c2 = l2.actions) || void 0 === c2 ? void 0 : c2.values) && (null === (u2 = e3.conditions) || void 0 === u2 || null === (d2 = u2.actions) || void 0 === d2 || null === (h2 = d2.values) || void 0 === h2 ? void 0 : h2.length) > 0;
|
|
3118
|
+
});
|
|
3119
|
+
o2.length > 0 && (null === (s2 = this._surveyEventReceiver) || void 0 === s2 || s2.register(o2));
|
|
3120
|
+
return null === (i3 = this.instance.persistence) || void 0 === i3 || i3.register({ [$e]: n2 }), e2(n2);
|
|
3121
|
+
} });
|
|
3122
|
+
} catch (e3) {
|
|
3123
|
+
throw this._isFetchingSurveys = false, e3;
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
isSurveyFeatureFlagEnabled(e2) {
|
|
3127
|
+
return !e2 || this.instance.featureFlags.isFeatureEnabled(e2);
|
|
3128
|
+
}
|
|
3129
|
+
getActiveMatchingSurveys(e2) {
|
|
3130
|
+
var i2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
3131
|
+
this.getSurveys((i3) => {
|
|
3132
|
+
var r2, s2 = i3.filter((e3) => !(!e3.start_date || e3.end_date)).filter((e3) => {
|
|
3133
|
+
var i4;
|
|
3134
|
+
if (!e3.conditions) return true;
|
|
3135
|
+
var r3 = function(e4) {
|
|
3136
|
+
var i5, r4, s4;
|
|
3137
|
+
if (null === (i5 = e4.conditions) || void 0 === i5 || !i5.url) return true;
|
|
3138
|
+
var n4 = null == t || null === (r4 = t.location) || void 0 === r4 ? void 0 : r4.href;
|
|
3139
|
+
if (!n4) return false;
|
|
3140
|
+
var o3 = [e4.conditions.url];
|
|
3141
|
+
return Dn[qn(null === (s4 = e4.conditions) || void 0 === s4 ? void 0 : s4.urlMatchType)](o3, n4);
|
|
3142
|
+
}(e3), s3 = null === (i4 = e3.conditions) || void 0 === i4 || !i4.selector || (null == a ? void 0 : a.querySelector(e3.conditions.selector)), n3 = function(e4) {
|
|
3143
|
+
var t2, i5, r4;
|
|
3144
|
+
if (null === (t2 = e4.conditions) || void 0 === t2 || !t2.deviceTypes || 0 === (null === (i5 = e4.conditions) || void 0 === i5 ? void 0 : i5.deviceTypes.length)) return true;
|
|
3145
|
+
if (!h) return false;
|
|
3146
|
+
var s4 = zs.deviceType(h);
|
|
3147
|
+
return Dn[qn(null === (r4 = e4.conditions) || void 0 === r4 ? void 0 : r4.deviceTypesMatchType)](e4.conditions.deviceTypes, s4);
|
|
3148
|
+
}(e3);
|
|
3149
|
+
return r3 && s3 && n3;
|
|
3150
|
+
}), n2 = null === (r2 = this._surveyEventReceiver) || void 0 === r2 ? void 0 : r2.getSurveys(), o2 = s2.filter((e3) => {
|
|
3151
|
+
var t2, i4, r3, s3, o3, a2, l2, c2, u2;
|
|
3152
|
+
if (!(e3.linked_flag_key || e3.targeting_flag_key || e3.internal_targeting_flag_key || null !== (t2 = e3.feature_flag_keys) && void 0 !== t2 && t2.length)) return true;
|
|
3153
|
+
var d2 = this.isSurveyFeatureFlagEnabled(e3.linked_flag_key), h2 = this.isSurveyFeatureFlagEnabled(e3.targeting_flag_key), _2 = (null !== (i4 = null === (r3 = e3.conditions) || void 0 === r3 || null === (s3 = r3.events) || void 0 === s3 || null === (o3 = s3.values) || void 0 === o3 ? void 0 : o3.length) && void 0 !== i4 ? i4 : 0) > 0, p2 = (null !== (a2 = null === (l2 = e3.conditions) || void 0 === l2 || null === (c2 = l2.actions) || void 0 === c2 || null === (u2 = c2.values) || void 0 === u2 ? void 0 : u2.length) && void 0 !== a2 ? a2 : 0) > 0, g2 = !_2 && !p2 || (null == n2 ? void 0 : n2.includes(e3.id)), v2 = this._canActivateRepeatedly(e3) || this.isSurveyFeatureFlagEnabled(e3.internal_targeting_flag_key), f2 = this.checkFlags(e3);
|
|
3154
|
+
return d2 && h2 && v2 && g2 && f2;
|
|
3155
|
+
});
|
|
3156
|
+
return e2(o2);
|
|
3157
|
+
}, i2);
|
|
3158
|
+
}
|
|
3159
|
+
checkFlags(e2) {
|
|
3160
|
+
var t2;
|
|
3161
|
+
return null === (t2 = e2.feature_flag_keys) || void 0 === t2 || !t2.length || e2.feature_flag_keys.every((e3) => {
|
|
3162
|
+
var { key: t3, value: i2 } = e3;
|
|
3163
|
+
return !t3 || !i2 || this.instance.featureFlags.isFeatureEnabled(i2);
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
_canActivateRepeatedly(e2) {
|
|
3167
|
+
var t2;
|
|
3168
|
+
return O(null === (t2 = _.__PosthogExtensions__) || void 0 === t2 ? void 0 : t2.canActivateRepeatedly) ? (Ln.warn("init was not called"), false) : _.__PosthogExtensions__.canActivateRepeatedly(e2);
|
|
3169
|
+
}
|
|
3170
|
+
canRenderSurvey(e2) {
|
|
3171
|
+
O(this._surveyManager) ? Ln.warn("init was not called") : this.getSurveys((t2) => {
|
|
3172
|
+
var i2 = t2.filter((t3) => t3.id === e2)[0];
|
|
3173
|
+
this._surveyManager.canRenderSurvey(i2);
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
renderSurvey(e2, t2) {
|
|
3177
|
+
O(this._surveyManager) ? Ln.warn("init was not called") : this.getSurveys((i2) => {
|
|
3178
|
+
var r2 = i2.filter((t3) => t3.id === e2)[0];
|
|
3179
|
+
this._surveyManager.renderSurvey(r2, null == a ? void 0 : a.querySelector(t2));
|
|
3180
|
+
});
|
|
3181
|
+
}
|
|
3182
|
+
};
|
|
3183
|
+
var Bn = H("[RateLimiter]");
|
|
3184
|
+
var Hn = class {
|
|
3185
|
+
constructor(e2) {
|
|
3186
|
+
var t2, i2;
|
|
3187
|
+
V(this, "serverLimits", {}), V(this, "lastEventRateLimited", false), V(this, "checkForLimiting", (e3) => {
|
|
3188
|
+
var t3 = e3.text;
|
|
3189
|
+
if (t3 && t3.length) try {
|
|
3190
|
+
(JSON.parse(t3).quota_limited || []).forEach((e4) => {
|
|
3191
|
+
Bn.info("".concat(e4 || "events", " is quota limited.")), this.serverLimits[e4] = (/* @__PURE__ */ new Date()).getTime() + 6e4;
|
|
3192
|
+
});
|
|
3193
|
+
} catch (e4) {
|
|
3194
|
+
return void Bn.warn('could not rate limit - continuing. Error: "'.concat(null == e4 ? void 0 : e4.message, '"'), { text: t3 });
|
|
3195
|
+
}
|
|
3196
|
+
}), this.instance = e2, this.captureEventsPerSecond = (null === (t2 = e2.config.rate_limiting) || void 0 === t2 ? void 0 : t2.events_per_second) || 10, this.captureEventsBurstLimit = Math.max((null === (i2 = e2.config.rate_limiting) || void 0 === i2 ? void 0 : i2.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond), this.lastEventRateLimited = this.clientRateLimitContext(true).isRateLimited;
|
|
3197
|
+
}
|
|
3198
|
+
clientRateLimitContext() {
|
|
3199
|
+
var e2, t2, i2, r2 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], s2 = (/* @__PURE__ */ new Date()).getTime(), n2 = null !== (e2 = null === (t2 = this.instance.persistence) || void 0 === t2 ? void 0 : t2.get_property(De)) && void 0 !== e2 ? e2 : { tokens: this.captureEventsBurstLimit, last: s2 };
|
|
3200
|
+
n2.tokens += (s2 - n2.last) / 1e3 * this.captureEventsPerSecond, n2.last = s2, n2.tokens > this.captureEventsBurstLimit && (n2.tokens = this.captureEventsBurstLimit);
|
|
3201
|
+
var o2 = n2.tokens < 1;
|
|
3202
|
+
return o2 || r2 || (n2.tokens = Math.max(0, n2.tokens - 1)), !o2 || this.lastEventRateLimited || r2 || 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: true }), this.lastEventRateLimited = o2, null === (i2 = this.instance.persistence) || void 0 === i2 || i2.set_property(De, n2), { isRateLimited: o2, remainingTokens: n2.tokens };
|
|
3203
|
+
}
|
|
3204
|
+
isServerRateLimited(e2) {
|
|
3205
|
+
var t2 = this.serverLimits[e2 || "events"] || false;
|
|
3206
|
+
return false !== t2 && (/* @__PURE__ */ new Date()).getTime() < t2;
|
|
3207
|
+
}
|
|
3208
|
+
};
|
|
3209
|
+
var Un = H("[RemoteConfig]");
|
|
3210
|
+
var zn = class {
|
|
3211
|
+
constructor(e2) {
|
|
3212
|
+
this.instance = e2;
|
|
3213
|
+
}
|
|
3214
|
+
get remoteConfig() {
|
|
3215
|
+
var e2, t2;
|
|
3216
|
+
return null === (e2 = _._POSTHOG_REMOTE_CONFIG) || void 0 === e2 || null === (t2 = e2[this.instance.config.token]) || void 0 === t2 ? void 0 : t2.config;
|
|
3217
|
+
}
|
|
3218
|
+
_loadRemoteConfigJs(e2) {
|
|
3219
|
+
var t2, i2, r2;
|
|
3220
|
+
null !== (t2 = _.__PosthogExtensions__) && void 0 !== t2 && t2.loadExternalDependency ? null === (i2 = _.__PosthogExtensions__) || void 0 === i2 || null === (r2 = i2.loadExternalDependency) || void 0 === r2 || r2.call(i2, this.instance, "remote-config", () => e2(this.remoteConfig)) : (Un.error("PostHog Extensions not found. Cannot load remote config."), e2());
|
|
3221
|
+
}
|
|
3222
|
+
_loadRemoteConfigJSON(e2) {
|
|
3223
|
+
this.instance._send_request({ method: "GET", url: this.instance.requestRouter.endpointFor("assets", "/array/".concat(this.instance.config.token, "/config")), callback: (t2) => {
|
|
3224
|
+
e2(t2.json);
|
|
3225
|
+
} });
|
|
3226
|
+
}
|
|
3227
|
+
load() {
|
|
3228
|
+
try {
|
|
3229
|
+
if (this.remoteConfig) return Un.info("Using preloaded remote config", this.remoteConfig), void this.onRemoteConfig(this.remoteConfig);
|
|
3230
|
+
if (this.instance.config.advanced_disable_decide) return void Un.warn("Remote config is disabled. Falling back to local config.");
|
|
3231
|
+
this._loadRemoteConfigJs((e2) => {
|
|
3232
|
+
if (!e2) return Un.info("No config found after loading remote JS config. Falling back to JSON."), void this._loadRemoteConfigJSON((e3) => {
|
|
3233
|
+
this.onRemoteConfig(e3);
|
|
3234
|
+
});
|
|
3235
|
+
this.onRemoteConfig(e2);
|
|
3236
|
+
});
|
|
3237
|
+
} catch (e2) {
|
|
3238
|
+
Un.error("Error loading remote config", e2);
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
onRemoteConfig(e2) {
|
|
3242
|
+
e2 ? this.instance.config.__preview_remote_config ? (this.instance._onRemoteConfig(e2), false !== e2.hasFeatureFlags && this.instance.featureFlags.ensureFlagsLoaded()) : Un.info("__preview_remote_config is disabled. Logging config instead", e2) : Un.error("Failed to fetch remote config from PostHog.");
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
var jn = function(e2) {
|
|
3246
|
+
var t2, i2, r2, s2, n2 = "";
|
|
3247
|
+
for (t2 = i2 = 0, r2 = (e2 = (e2 + "").replace(/\r\n/g, "\n").replace(/\r/g, "\n")).length, s2 = 0; s2 < r2; s2++) {
|
|
3248
|
+
var o2 = e2.charCodeAt(s2), a2 = null;
|
|
3249
|
+
o2 < 128 ? i2++ : a2 = o2 > 127 && o2 < 2048 ? String.fromCharCode(o2 >> 6 | 192, 63 & o2 | 128) : String.fromCharCode(o2 >> 12 | 224, o2 >> 6 & 63 | 128, 63 & o2 | 128), $(a2) || (i2 > t2 && (n2 += e2.substring(t2, i2)), n2 += a2, t2 = i2 = s2 + 1);
|
|
3250
|
+
}
|
|
3251
|
+
return i2 > t2 && (n2 += e2.substring(t2, e2.length)), n2;
|
|
3252
|
+
};
|
|
3253
|
+
var Wn = !!u || !!c;
|
|
3254
|
+
var Vn = "text/plain";
|
|
3255
|
+
var Gn = (e2, t2) => {
|
|
3256
|
+
var [i2, r2] = e2.split("?"), s2 = W({}, t2);
|
|
3257
|
+
null == r2 || r2.split("&").forEach((e3) => {
|
|
3258
|
+
var [t3] = e3.split("=");
|
|
3259
|
+
delete s2[t3];
|
|
3260
|
+
});
|
|
3261
|
+
var n2 = St(s2);
|
|
3262
|
+
return n2 = n2 ? (r2 ? r2 + "&" : "") + n2 : r2, "".concat(i2, "?").concat(n2);
|
|
3263
|
+
};
|
|
3264
|
+
var Jn = (e2, t2) => JSON.stringify(e2, (e3, t3) => "bigint" == typeof t3 ? t3.toString() : t3, t2);
|
|
3265
|
+
var Yn = (t2) => {
|
|
3266
|
+
var { data: i2, compression: r2 } = t2;
|
|
3267
|
+
if (i2) {
|
|
3268
|
+
if (r2 === e.GZipJS) {
|
|
3269
|
+
var s2 = sr(nr(Jn(i2)), { mtime: 0 }), n2 = new Blob([s2], { type: Vn });
|
|
3270
|
+
return { contentType: Vn, body: n2, estimatedSize: n2.size };
|
|
3271
|
+
}
|
|
3272
|
+
if (r2 === e.Base64) {
|
|
3273
|
+
var o2 = function(e2) {
|
|
3274
|
+
var t3, i3, r3, s3, n3, o3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", a3 = 0, l3 = 0, c2 = "", u2 = [];
|
|
3275
|
+
if (!e2) return e2;
|
|
3276
|
+
e2 = jn(e2);
|
|
3277
|
+
do {
|
|
3278
|
+
t3 = (n3 = e2.charCodeAt(a3++) << 16 | e2.charCodeAt(a3++) << 8 | e2.charCodeAt(a3++)) >> 18 & 63, i3 = n3 >> 12 & 63, r3 = n3 >> 6 & 63, s3 = 63 & n3, u2[l3++] = o3.charAt(t3) + o3.charAt(i3) + o3.charAt(r3) + o3.charAt(s3);
|
|
3279
|
+
} while (a3 < e2.length);
|
|
3280
|
+
switch (c2 = u2.join(""), e2.length % 3) {
|
|
3281
|
+
case 1:
|
|
3282
|
+
c2 = c2.slice(0, -2) + "==";
|
|
3283
|
+
break;
|
|
3284
|
+
case 2:
|
|
3285
|
+
c2 = c2.slice(0, -1) + "=";
|
|
3286
|
+
}
|
|
3287
|
+
return c2;
|
|
3288
|
+
}(Jn(i2)), a2 = ((e2) => "data=" + encodeURIComponent("string" == typeof e2 ? e2 : Jn(e2)))(o2);
|
|
3289
|
+
return { contentType: "application/x-www-form-urlencoded", body: a2, estimatedSize: new Blob([a2]).size };
|
|
3290
|
+
}
|
|
3291
|
+
var l2 = Jn(i2);
|
|
3292
|
+
return { contentType: "application/json", body: l2, estimatedSize: new Blob([l2]).size };
|
|
3293
|
+
}
|
|
3294
|
+
};
|
|
3295
|
+
var Kn = [];
|
|
3296
|
+
c && Kn.push({ transport: "fetch", method: (e2) => {
|
|
3297
|
+
var t2, i2, { contentType: r2, body: s2, estimatedSize: n2 } = null !== (t2 = Yn(e2)) && void 0 !== t2 ? t2 : {}, o2 = new Headers();
|
|
3298
|
+
K(e2.headers, function(e3, t3) {
|
|
3299
|
+
o2.append(t3, e3);
|
|
3300
|
+
}), r2 && o2.append("Content-Type", r2);
|
|
3301
|
+
var a2 = e2.url, l2 = null;
|
|
3302
|
+
if (d) {
|
|
3303
|
+
var u2 = new d();
|
|
3304
|
+
l2 = { signal: u2.signal, timeout: setTimeout(() => u2.abort(), e2.timeout) };
|
|
3305
|
+
}
|
|
3306
|
+
c(a2, W({ method: (null == e2 ? void 0 : e2.method) || "GET", headers: o2, keepalive: "POST" === e2.method && (n2 || 0) < 52428.8, body: s2, signal: null === (i2 = l2) || void 0 === i2 ? void 0 : i2.signal }, e2.fetchOptions)).then((t3) => t3.text().then((i3) => {
|
|
3307
|
+
var r3, s3 = { statusCode: t3.status, text: i3 };
|
|
3308
|
+
if (200 === t3.status) try {
|
|
3309
|
+
s3.json = JSON.parse(i3);
|
|
3310
|
+
} catch (e3) {
|
|
3311
|
+
B.error(e3);
|
|
3312
|
+
}
|
|
3313
|
+
null === (r3 = e2.callback) || void 0 === r3 || r3.call(e2, s3);
|
|
3314
|
+
})).catch((t3) => {
|
|
3315
|
+
var i3;
|
|
3316
|
+
B.error(t3), null === (i3 = e2.callback) || void 0 === i3 || i3.call(e2, { statusCode: 0, text: t3 });
|
|
3317
|
+
}).finally(() => l2 ? clearTimeout(l2.timeout) : null);
|
|
3318
|
+
} }), u && Kn.push({ transport: "XHR", method: (e2) => {
|
|
3319
|
+
var t2, i2 = new u();
|
|
3320
|
+
i2.open(e2.method || "GET", e2.url, true);
|
|
3321
|
+
var { contentType: r2, body: s2 } = null !== (t2 = Yn(e2)) && void 0 !== t2 ? t2 : {};
|
|
3322
|
+
K(e2.headers, function(e3, t3) {
|
|
3323
|
+
i2.setRequestHeader(t3, e3);
|
|
3324
|
+
}), r2 && i2.setRequestHeader("Content-Type", r2), e2.timeout && (i2.timeout = e2.timeout), i2.withCredentials = true, i2.onreadystatechange = () => {
|
|
3325
|
+
if (4 === i2.readyState) {
|
|
3326
|
+
var t3, r3 = { statusCode: i2.status, text: i2.responseText };
|
|
3327
|
+
if (200 === i2.status) try {
|
|
3328
|
+
r3.json = JSON.parse(i2.responseText);
|
|
3329
|
+
} catch (e3) {
|
|
3330
|
+
}
|
|
3331
|
+
null === (t3 = e2.callback) || void 0 === t3 || t3.call(e2, r3);
|
|
3332
|
+
}
|
|
3333
|
+
}, i2.send(s2);
|
|
3334
|
+
} }), null != o && o.sendBeacon && Kn.push({ transport: "sendBeacon", method: (e2) => {
|
|
3335
|
+
var t2 = Gn(e2.url, { beacon: "1" });
|
|
3336
|
+
try {
|
|
3337
|
+
var i2, { contentType: r2, body: s2 } = null !== (i2 = Yn(e2)) && void 0 !== i2 ? i2 : {}, n2 = "string" == typeof s2 ? new Blob([s2], { type: r2 }) : s2;
|
|
3338
|
+
o.sendBeacon(t2, n2);
|
|
3339
|
+
} catch (e3) {
|
|
3340
|
+
}
|
|
3341
|
+
} });
|
|
3342
|
+
var Xn = 3e3;
|
|
3343
|
+
var Qn = class {
|
|
3344
|
+
constructor(e2, t2) {
|
|
3345
|
+
V(this, "isPaused", true), V(this, "queue", []), this.flushTimeoutMs = bi((null == t2 ? void 0 : t2.flush_interval_ms) || Xn, 250, 5e3, "flush interval", Xn), this.sendRequest = e2;
|
|
3346
|
+
}
|
|
3347
|
+
enqueue(e2) {
|
|
3348
|
+
this.queue.push(e2), this.flushTimeout || this.setFlushTimeout();
|
|
3349
|
+
}
|
|
3350
|
+
unload() {
|
|
3351
|
+
this.clearFlushTimeout();
|
|
3352
|
+
var e2 = this.queue.length > 0 ? this.formatQueue() : {}, t2 = Object.values(e2), i2 = [...t2.filter((e3) => 0 === e3.url.indexOf("/e")), ...t2.filter((e3) => 0 !== e3.url.indexOf("/e"))];
|
|
3353
|
+
i2.map((e3) => {
|
|
3354
|
+
this.sendRequest(W(W({}, e3), {}, { transport: "sendBeacon" }));
|
|
3355
|
+
});
|
|
3356
|
+
}
|
|
3357
|
+
enable() {
|
|
3358
|
+
this.isPaused = false, this.setFlushTimeout();
|
|
3359
|
+
}
|
|
3360
|
+
setFlushTimeout() {
|
|
3361
|
+
var e2 = this;
|
|
3362
|
+
this.isPaused || (this.flushTimeout = setTimeout(() => {
|
|
3363
|
+
if (this.clearFlushTimeout(), this.queue.length > 0) {
|
|
3364
|
+
var t2 = this.formatQueue(), i2 = function(i3) {
|
|
3365
|
+
var r3 = t2[i3], s2 = (/* @__PURE__ */ new Date()).getTime();
|
|
3366
|
+
r3.data && x(r3.data) && K(r3.data, (e3) => {
|
|
3367
|
+
e3.offset = Math.abs(e3.timestamp - s2), delete e3.timestamp;
|
|
3368
|
+
}), e2.sendRequest(r3);
|
|
3369
|
+
};
|
|
3370
|
+
for (var r2 in t2) i2(r2);
|
|
3371
|
+
}
|
|
3372
|
+
}, this.flushTimeoutMs));
|
|
3373
|
+
}
|
|
3374
|
+
clearFlushTimeout() {
|
|
3375
|
+
clearTimeout(this.flushTimeout), this.flushTimeout = void 0;
|
|
3376
|
+
}
|
|
3377
|
+
formatQueue() {
|
|
3378
|
+
var e2 = {};
|
|
3379
|
+
return K(this.queue, (t2) => {
|
|
3380
|
+
var i2, r2 = t2, s2 = (r2 ? r2.batchKey : null) || r2.url;
|
|
3381
|
+
F(e2[s2]) && (e2[s2] = W(W({}, r2), {}, { data: [] })), null === (i2 = e2[s2].data) || void 0 === i2 || i2.push(r2.data);
|
|
3382
|
+
}), this.queue = [], e2;
|
|
3383
|
+
}
|
|
3384
|
+
};
|
|
3385
|
+
var Zn = ["retriesPerformedSoFar"];
|
|
3386
|
+
var eo = class {
|
|
3387
|
+
constructor(e2) {
|
|
3388
|
+
V(this, "isPolling", false), V(this, "pollIntervalMs", 3e3), V(this, "queue", []), this.instance = e2, this.queue = [], this.areWeOnline = true, !F(t) && "onLine" in t.navigator && (this.areWeOnline = t.navigator.onLine, ae(t, "online", () => {
|
|
3389
|
+
this.areWeOnline = true, this.flush();
|
|
3390
|
+
}), ae(t, "offline", () => {
|
|
3391
|
+
this.areWeOnline = false;
|
|
3392
|
+
}));
|
|
3393
|
+
}
|
|
3394
|
+
retriableRequest(e2) {
|
|
3395
|
+
var { retriesPerformedSoFar: t2 } = e2, i2 = G(e2, Zn);
|
|
3396
|
+
M(t2) && t2 > 0 && (i2.url = Gn(i2.url, { retry_count: t2 })), this.instance._send_request(W(W({}, i2), {}, { callback: (e3) => {
|
|
3397
|
+
var r2;
|
|
3398
|
+
200 !== e3.statusCode && (e3.statusCode < 400 || e3.statusCode >= 500) && (null != t2 ? t2 : 0) < 10 ? this.enqueue(W({ retriesPerformedSoFar: t2 }, i2)) : null === (r2 = i2.callback) || void 0 === r2 || r2.call(i2, e3);
|
|
3399
|
+
} }));
|
|
3400
|
+
}
|
|
3401
|
+
enqueue(e2) {
|
|
3402
|
+
var t2 = e2.retriesPerformedSoFar || 0;
|
|
3403
|
+
e2.retriesPerformedSoFar = t2 + 1;
|
|
3404
|
+
var i2 = function(e3) {
|
|
3405
|
+
var t3 = 3e3 * Math.pow(2, e3), i3 = t3 / 2, r3 = Math.min(18e5, t3), s3 = (Math.random() - 0.5) * (r3 - i3);
|
|
3406
|
+
return Math.ceil(r3 + s3);
|
|
3407
|
+
}(t2), r2 = Date.now() + i2;
|
|
3408
|
+
this.queue.push({ retryAt: r2, requestOptions: e2 });
|
|
3409
|
+
var s2 = "Enqueued failed request for retry in ".concat(i2);
|
|
3410
|
+
navigator.onLine || (s2 += " (Browser is offline)"), B.warn(s2), this.isPolling || (this.isPolling = true, this.poll());
|
|
3411
|
+
}
|
|
3412
|
+
poll() {
|
|
3413
|
+
this.poller && clearTimeout(this.poller), this.poller = setTimeout(() => {
|
|
3414
|
+
this.areWeOnline && this.queue.length > 0 && this.flush(), this.poll();
|
|
3415
|
+
}, this.pollIntervalMs);
|
|
3416
|
+
}
|
|
3417
|
+
flush() {
|
|
3418
|
+
var e2 = Date.now(), t2 = [], i2 = this.queue.filter((i3) => i3.retryAt < e2 || (t2.push(i3), false));
|
|
3419
|
+
if (this.queue = t2, i2.length > 0) for (var { requestOptions: r2 } of i2) this.retriableRequest(r2);
|
|
3420
|
+
}
|
|
3421
|
+
unload() {
|
|
3422
|
+
for (var { requestOptions: e2 } of (this.poller && (clearTimeout(this.poller), this.poller = void 0), this.queue)) try {
|
|
3423
|
+
this.instance._send_request(W(W({}, e2), {}, { transport: "sendBeacon" }));
|
|
3424
|
+
} catch (e3) {
|
|
3425
|
+
B.error(e3);
|
|
3426
|
+
}
|
|
3427
|
+
this.queue = [];
|
|
3428
|
+
}
|
|
3429
|
+
};
|
|
3430
|
+
var to = class {
|
|
3431
|
+
constructor(e2) {
|
|
3432
|
+
V(this, "_updateScrollData", () => {
|
|
3433
|
+
var e3, t2, i2, r2;
|
|
3434
|
+
this.context || (this.context = {});
|
|
3435
|
+
var s2 = this.scrollElement(), n2 = this.scrollY(), o2 = s2 ? Math.max(0, s2.scrollHeight - s2.clientHeight) : 0, a2 = n2 + ((null == s2 ? void 0 : s2.clientHeight) || 0), l2 = (null == s2 ? void 0 : s2.scrollHeight) || 0;
|
|
3436
|
+
this.context.lastScrollY = Math.ceil(n2), this.context.maxScrollY = Math.max(n2, null !== (e3 = this.context.maxScrollY) && void 0 !== e3 ? e3 : 0), this.context.maxScrollHeight = Math.max(o2, null !== (t2 = this.context.maxScrollHeight) && void 0 !== t2 ? t2 : 0), this.context.lastContentY = a2, this.context.maxContentY = Math.max(a2, null !== (i2 = this.context.maxContentY) && void 0 !== i2 ? i2 : 0), this.context.maxContentHeight = Math.max(l2, null !== (r2 = this.context.maxContentHeight) && void 0 !== r2 ? r2 : 0);
|
|
3437
|
+
}), this.instance = e2;
|
|
3438
|
+
}
|
|
3439
|
+
getContext() {
|
|
3440
|
+
return this.context;
|
|
3441
|
+
}
|
|
3442
|
+
resetContext() {
|
|
3443
|
+
var e2 = this.context;
|
|
3444
|
+
return setTimeout(this._updateScrollData, 0), e2;
|
|
3445
|
+
}
|
|
3446
|
+
startMeasuringScrollPosition() {
|
|
3447
|
+
ae(t, "scroll", this._updateScrollData, { capture: true }), ae(t, "scrollend", this._updateScrollData, { capture: true }), ae(t, "resize", this._updateScrollData);
|
|
3448
|
+
}
|
|
3449
|
+
scrollElement() {
|
|
3450
|
+
if (!this.instance.config.scroll_root_selector) return null == t ? void 0 : t.document.documentElement;
|
|
3451
|
+
var e2 = x(this.instance.config.scroll_root_selector) ? this.instance.config.scroll_root_selector : [this.instance.config.scroll_root_selector];
|
|
3452
|
+
for (var i2 of e2) {
|
|
3453
|
+
var r2 = null == t ? void 0 : t.document.querySelector(i2);
|
|
3454
|
+
if (r2) return r2;
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
scrollY() {
|
|
3458
|
+
if (this.instance.config.scroll_root_selector) {
|
|
3459
|
+
var e2 = this.scrollElement();
|
|
3460
|
+
return e2 && e2.scrollTop || 0;
|
|
3461
|
+
}
|
|
3462
|
+
return t && (t.scrollY || t.pageYOffset || t.document.documentElement.scrollTop) || 0;
|
|
3463
|
+
}
|
|
3464
|
+
scrollX() {
|
|
3465
|
+
if (this.instance.config.scroll_root_selector) {
|
|
3466
|
+
var e2 = this.scrollElement();
|
|
3467
|
+
return e2 && e2.scrollLeft || 0;
|
|
3468
|
+
}
|
|
3469
|
+
return t && (t.scrollX || t.pageXOffset || t.document.documentElement.scrollLeft) || 0;
|
|
3470
|
+
}
|
|
3471
|
+
};
|
|
3472
|
+
var io = (e2) => zs.personInfo({ maskPersonalDataProperties: null == e2 ? void 0 : e2.config.mask_personal_data_properties, customPersonalDataProperties: null == e2 ? void 0 : e2.config.custom_personal_data_properties });
|
|
3473
|
+
var ro = class {
|
|
3474
|
+
constructor(e2, t2, i2, r2) {
|
|
3475
|
+
V(this, "_onSessionIdCallback", (e3) => {
|
|
3476
|
+
var t3 = this._getStored();
|
|
3477
|
+
if (!t3 || t3.sessionId !== e3) {
|
|
3478
|
+
var i3 = { sessionId: e3, props: this._sessionSourceParamGenerator(this.instance) };
|
|
3479
|
+
this._persistence.register({ [Le]: i3 });
|
|
3480
|
+
}
|
|
3481
|
+
}), this.instance = e2, this._sessionIdManager = t2, this._persistence = i2, this._sessionSourceParamGenerator = r2 || io, this._sessionIdManager.onSessionId(this._onSessionIdCallback);
|
|
3482
|
+
}
|
|
3483
|
+
_getStored() {
|
|
3484
|
+
return this._persistence.props[Le];
|
|
3485
|
+
}
|
|
3486
|
+
getSetOnceInitialSessionPropsProps() {
|
|
3487
|
+
var e2, t2 = null === (e2 = this._getStored()) || void 0 === e2 ? void 0 : e2.props;
|
|
3488
|
+
return t2 ? "r" in t2 ? zs.personPropsFromInfo(t2) : { $referring_domain: t2.referringDomain, $pathname: t2.initialPathName, utm_source: t2.utm_source, utm_campaign: t2.utm_campaign, utm_medium: t2.utm_medium, utm_content: t2.utm_content, utm_term: t2.utm_term } : {};
|
|
3489
|
+
}
|
|
3490
|
+
};
|
|
3491
|
+
var so = H("[SessionId]");
|
|
3492
|
+
var no = class {
|
|
3493
|
+
constructor(e2, t2, i2) {
|
|
3494
|
+
var r2;
|
|
3495
|
+
if (V(this, "_sessionIdChangedHandlers", []), !e2.persistence) throw new Error("SessionIdManager requires a PostHogPersistence instance");
|
|
3496
|
+
if (e2.config.__preview_experimental_cookieless_mode) throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");
|
|
3497
|
+
this.config = e2.config, this.persistence = e2.persistence, this._windowId = void 0, this._sessionId = void 0, this._sessionStartTimestamp = null, this._sessionActivityTimestamp = null, this._sessionIdGenerator = t2 || qt, this._windowIdGenerator = i2 || qt;
|
|
3498
|
+
var s2 = this.config.persistence_name || this.config.token, n2 = this.config.session_idle_timeout_seconds || 1800;
|
|
3499
|
+
if (this._sessionTimeoutMs = 1e3 * bi(n2, 60, 36e3, "session_idle_timeout_seconds", 1800), e2.register({ $configured_session_timeout_ms: this._sessionTimeoutMs }), this.resetIdleTimer(), this._window_id_storage_key = "ph_" + s2 + "_window_id", this._primary_window_exists_storage_key = "ph_" + s2 + "_primary_window_exists", this._canUseSessionStorage()) {
|
|
3500
|
+
var o2 = Zt.parse(this._window_id_storage_key), a2 = Zt.parse(this._primary_window_exists_storage_key);
|
|
3501
|
+
o2 && !a2 ? this._windowId = o2 : Zt.remove(this._window_id_storage_key), Zt.set(this._primary_window_exists_storage_key, true);
|
|
3502
|
+
}
|
|
3503
|
+
if (null !== (r2 = this.config.bootstrap) && void 0 !== r2 && r2.sessionID) try {
|
|
3504
|
+
var l2 = ((e3) => {
|
|
3505
|
+
var t3 = e3.replace(/-/g, "");
|
|
3506
|
+
if (32 !== t3.length) throw new Error("Not a valid UUID");
|
|
3507
|
+
if ("7" !== t3[12]) throw new Error("Not a UUIDv7");
|
|
3508
|
+
return parseInt(t3.substring(0, 12), 16);
|
|
3509
|
+
})(this.config.bootstrap.sessionID);
|
|
3510
|
+
this._setSessionId(this.config.bootstrap.sessionID, (/* @__PURE__ */ new Date()).getTime(), l2);
|
|
3511
|
+
} catch (e3) {
|
|
3512
|
+
so.error("Invalid sessionID in bootstrap", e3);
|
|
3513
|
+
}
|
|
3514
|
+
this._listenToReloadWindow();
|
|
3515
|
+
}
|
|
3516
|
+
get sessionTimeoutMs() {
|
|
3517
|
+
return this._sessionTimeoutMs;
|
|
3518
|
+
}
|
|
3519
|
+
onSessionId(e2) {
|
|
3520
|
+
return F(this._sessionIdChangedHandlers) && (this._sessionIdChangedHandlers = []), this._sessionIdChangedHandlers.push(e2), this._sessionId && e2(this._sessionId, this._windowId), () => {
|
|
3521
|
+
this._sessionIdChangedHandlers = this._sessionIdChangedHandlers.filter((t2) => t2 !== e2);
|
|
3522
|
+
};
|
|
3523
|
+
}
|
|
3524
|
+
_canUseSessionStorage() {
|
|
3525
|
+
return "memory" !== this.config.persistence && !this.persistence.disabled && Zt.is_supported();
|
|
3526
|
+
}
|
|
3527
|
+
_setWindowId(e2) {
|
|
3528
|
+
e2 !== this._windowId && (this._windowId = e2, this._canUseSessionStorage() && Zt.set(this._window_id_storage_key, e2));
|
|
3529
|
+
}
|
|
3530
|
+
_getWindowId() {
|
|
3531
|
+
return this._windowId ? this._windowId : this._canUseSessionStorage() ? Zt.parse(this._window_id_storage_key) : null;
|
|
3532
|
+
}
|
|
3533
|
+
_setSessionId(e2, t2, i2) {
|
|
3534
|
+
e2 === this._sessionId && t2 === this._sessionActivityTimestamp && i2 === this._sessionStartTimestamp || (this._sessionStartTimestamp = i2, this._sessionActivityTimestamp = t2, this._sessionId = e2, this.persistence.register({ [Ee]: [t2, e2, i2] }));
|
|
3535
|
+
}
|
|
3536
|
+
_getSessionId() {
|
|
3537
|
+
if (this._sessionId && this._sessionActivityTimestamp && this._sessionStartTimestamp) return [this._sessionActivityTimestamp, this._sessionId, this._sessionStartTimestamp];
|
|
3538
|
+
var e2 = this.persistence.props[Ee];
|
|
3539
|
+
return x(e2) && 2 === e2.length && e2.push(e2[0]), e2 || [0, null, 0];
|
|
3540
|
+
}
|
|
3541
|
+
resetSessionId() {
|
|
3542
|
+
this._setSessionId(null, null, null);
|
|
3543
|
+
}
|
|
3544
|
+
_listenToReloadWindow() {
|
|
3545
|
+
ae(t, "beforeunload", () => {
|
|
3546
|
+
this._canUseSessionStorage() && Zt.remove(this._primary_window_exists_storage_key);
|
|
3547
|
+
}, { capture: false });
|
|
3548
|
+
}
|
|
3549
|
+
checkAndGetSessionAndWindowId() {
|
|
3550
|
+
var e2 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
|
|
3551
|
+
if (this.config.__preview_experimental_cookieless_mode) throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");
|
|
3552
|
+
var i2 = t2 || (/* @__PURE__ */ new Date()).getTime(), [r2, s2, n2] = this._getSessionId(), o2 = this._getWindowId(), a2 = M(n2) && n2 > 0 && Math.abs(i2 - n2) > 864e5, l2 = false, c2 = !s2, u2 = !e2 && Math.abs(i2 - r2) > this.sessionTimeoutMs;
|
|
3553
|
+
c2 || u2 || a2 ? (s2 = this._sessionIdGenerator(), o2 = this._windowIdGenerator(), so.info("new session ID generated", { sessionId: s2, windowId: o2, changeReason: { noSessionId: c2, activityTimeout: u2, sessionPastMaximumLength: a2 } }), n2 = i2, l2 = true) : o2 || (o2 = this._windowIdGenerator(), l2 = true);
|
|
3554
|
+
var d2 = 0 === r2 || !e2 || a2 ? i2 : r2, h2 = 0 === n2 ? (/* @__PURE__ */ new Date()).getTime() : n2;
|
|
3555
|
+
return this._setWindowId(o2), this._setSessionId(s2, d2, h2), e2 || this.resetIdleTimer(), l2 && this._sessionIdChangedHandlers.forEach((e3) => e3(s2, o2, l2 ? { noSessionId: c2, activityTimeout: u2, sessionPastMaximumLength: a2 } : void 0)), { sessionId: s2, windowId: o2, sessionStartTimestamp: h2, changeReason: l2 ? { noSessionId: c2, activityTimeout: u2, sessionPastMaximumLength: a2 } : void 0, lastActivityTimestamp: r2 };
|
|
3556
|
+
}
|
|
3557
|
+
resetIdleTimer() {
|
|
3558
|
+
clearTimeout(this._enforceIdleTimeout), this._enforceIdleTimeout = setTimeout(() => {
|
|
3559
|
+
this.resetSessionId();
|
|
3560
|
+
}, 1.1 * this.sessionTimeoutMs);
|
|
3561
|
+
}
|
|
3562
|
+
};
|
|
3563
|
+
var oo = ["$set_once", "$set"];
|
|
3564
|
+
var ao = H("[SiteApps]");
|
|
3565
|
+
var lo = class {
|
|
3566
|
+
constructor(e2) {
|
|
3567
|
+
this.instance = e2, this.bufferedInvocations = [], this.apps = {};
|
|
3568
|
+
}
|
|
3569
|
+
get isEnabled() {
|
|
3570
|
+
return !!this.instance.config.opt_in_site_apps;
|
|
3571
|
+
}
|
|
3572
|
+
eventCollector(e2, t2) {
|
|
3573
|
+
if (t2) {
|
|
3574
|
+
var i2 = this.globalsForEvent(t2);
|
|
3575
|
+
this.bufferedInvocations.push(i2), this.bufferedInvocations.length > 1e3 && (this.bufferedInvocations = this.bufferedInvocations.slice(10));
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
get siteAppLoaders() {
|
|
3579
|
+
var e2, t2;
|
|
3580
|
+
return null === (e2 = _._POSTHOG_REMOTE_CONFIG) || void 0 === e2 || null === (t2 = e2[this.instance.config.token]) || void 0 === t2 ? void 0 : t2.siteApps;
|
|
3581
|
+
}
|
|
3582
|
+
init() {
|
|
3583
|
+
if (this.isEnabled) {
|
|
3584
|
+
var e2 = this.instance._addCaptureHook(this.eventCollector.bind(this));
|
|
3585
|
+
this.stopBuffering = () => {
|
|
3586
|
+
e2(), this.bufferedInvocations = [], this.stopBuffering = void 0;
|
|
3587
|
+
};
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
globalsForEvent(e2) {
|
|
3591
|
+
var t2, i2, r2, s2, n2, o2, a2;
|
|
3592
|
+
if (!e2) throw new Error("Event payload is required");
|
|
3593
|
+
var l2 = {}, c2 = this.instance.get_property("$groups") || [], u2 = this.instance.get_property("$stored_group_properties") || {};
|
|
3594
|
+
for (var [d2, h2] of Object.entries(u2)) l2[d2] = { id: c2[d2], type: d2, properties: h2 };
|
|
3595
|
+
var { $set_once: _2, $set: p2 } = e2;
|
|
3596
|
+
return { event: W(W({}, G(e2, oo)), {}, { properties: W(W(W({}, e2.properties), p2 ? { $set: W(W({}, null !== (t2 = null === (i2 = e2.properties) || void 0 === i2 ? void 0 : i2.$set) && void 0 !== t2 ? t2 : {}), p2) } : {}), _2 ? { $set_once: W(W({}, null !== (r2 = null === (s2 = e2.properties) || void 0 === s2 ? void 0 : s2.$set_once) && void 0 !== r2 ? r2 : {}), _2) } : {}), elements_chain: null !== (n2 = null === (o2 = e2.properties) || void 0 === o2 ? void 0 : o2.$elements_chain) && void 0 !== n2 ? n2 : "", distinct_id: null === (a2 = e2.properties) || void 0 === a2 ? void 0 : a2.distinct_id }), person: { properties: this.instance.get_property("$stored_person_properties") }, groups: l2 };
|
|
3597
|
+
}
|
|
3598
|
+
setupSiteApp(e2) {
|
|
3599
|
+
var t2 = { id: e2.id, loaded: false, errored: false };
|
|
3600
|
+
this.apps[e2.id] = t2;
|
|
3601
|
+
var i2 = (i3) => {
|
|
3602
|
+
var r3;
|
|
3603
|
+
for (var s2 of (this.apps[e2.id].errored = !i3, this.apps[e2.id].loaded = true, ao.info("Site app with id ".concat(e2.id, " ").concat(i3 ? "loaded" : "errored")), i3 && this.bufferedInvocations.length && (ao.info("Processing ".concat(this.bufferedInvocations.length, " events for site app with id ").concat(e2.id)), this.bufferedInvocations.forEach((e3) => {
|
|
3604
|
+
var i4;
|
|
3605
|
+
return null === (i4 = t2.processEvent) || void 0 === i4 ? void 0 : i4.call(t2, e3);
|
|
3606
|
+
})), Object.values(this.apps))) if (!s2.loaded) return;
|
|
3607
|
+
null === (r3 = this.stopBuffering) || void 0 === r3 || r3.call(this);
|
|
3608
|
+
};
|
|
3609
|
+
try {
|
|
3610
|
+
var { processEvent: r2 } = e2.init({ posthog: this.instance, callback: (e3) => {
|
|
3611
|
+
i2(e3);
|
|
3612
|
+
} });
|
|
3613
|
+
r2 && (t2.processEvent = r2);
|
|
3614
|
+
} catch (t3) {
|
|
3615
|
+
ao.error("Error while initializing PostHog app with config id ".concat(e2.id), t3), i2(false);
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
onCapturedEvent(e2) {
|
|
3619
|
+
if (0 !== Object.keys(this.apps).length) {
|
|
3620
|
+
var t2 = this.globalsForEvent(e2);
|
|
3621
|
+
for (var i2 of Object.values(this.apps)) try {
|
|
3622
|
+
var r2;
|
|
3623
|
+
null === (r2 = i2.processEvent) || void 0 === r2 || r2.call(i2, t2);
|
|
3624
|
+
} catch (t3) {
|
|
3625
|
+
ao.error("Error while processing event ".concat(e2.event, " for site app ").concat(i2.id), t3);
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
onRemoteConfig(e2) {
|
|
3630
|
+
var t2, i2, r2, s2 = this;
|
|
3631
|
+
if (null !== (t2 = this.siteAppLoaders) && void 0 !== t2 && t2.length) {
|
|
3632
|
+
if (!this.isEnabled) return void ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
|
|
3633
|
+
for (var n2 of this.siteAppLoaders) this.setupSiteApp(n2);
|
|
3634
|
+
this.instance.on("eventCaptured", (e3) => this.onCapturedEvent(e3));
|
|
3635
|
+
} else if (null === (i2 = this.stopBuffering) || void 0 === i2 || i2.call(this), null !== (r2 = e2.siteApps) && void 0 !== r2 && r2.length) if (this.isEnabled) {
|
|
3636
|
+
var o2 = function(e3, t3) {
|
|
3637
|
+
var i3, r3;
|
|
3638
|
+
_["__$$ph_site_app_".concat(e3)] = s2.instance, null === (i3 = _.__PosthogExtensions__) || void 0 === i3 || null === (r3 = i3.loadSiteApp) || void 0 === r3 || r3.call(i3, s2.instance, t3, (t4) => {
|
|
3639
|
+
if (t4) return ao.error("Error while initializing PostHog app with config id ".concat(e3), t4);
|
|
3640
|
+
});
|
|
3641
|
+
};
|
|
3642
|
+
for (var { id: a2, url: l2 } of e2.siteApps) o2(a2, l2);
|
|
3643
|
+
} else ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
|
|
3644
|
+
}
|
|
3645
|
+
};
|
|
3646
|
+
var co;
|
|
3647
|
+
var uo = ["ahrefsbot", "ahrefssiteaudit", "applebot", "baiduspider", "better uptime bot", "bingbot", "bingpreview", "bot.htm", "bot.php", "chrome-lighthouse", "crawler", "deepscan", "duckduckbot", "facebookexternal", "facebookcatalog", "http://yandex.com/bots", "hubspot", "ia_archiver", "linkedinbot", "mj12bot", "msnbot", "nessus", "petalbot", "pinterest", "prerender", "rogerbot", "screaming frog", "semrushbot", "sitebulb", "slurp", "turnitin", "twitterbot", "vercelbot", "yahoo! slurp", "yandexbot", "gptbot", "oai-searchbot", "chatgpt-user", "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;"];
|
|
3648
|
+
var ho = function(e2, t2) {
|
|
3649
|
+
if (!e2) return false;
|
|
3650
|
+
var i2 = e2.toLowerCase();
|
|
3651
|
+
return uo.concat(t2 || []).some((e3) => {
|
|
3652
|
+
var t3 = e3.toLowerCase();
|
|
3653
|
+
return -1 !== i2.indexOf(t3);
|
|
3654
|
+
});
|
|
3655
|
+
};
|
|
3656
|
+
var _o = function(e2, t2) {
|
|
3657
|
+
if (!e2) return false;
|
|
3658
|
+
var i2 = e2.userAgent;
|
|
3659
|
+
if (i2 && ho(i2, t2)) return true;
|
|
3660
|
+
try {
|
|
3661
|
+
var r2 = null == e2 ? void 0 : e2.userAgentData;
|
|
3662
|
+
if (null != r2 && r2.brands && r2.brands.some((e3) => ho(null == e3 ? void 0 : e3.brand, t2))) return true;
|
|
3663
|
+
} catch (e3) {
|
|
3664
|
+
}
|
|
3665
|
+
return !!e2.webdriver;
|
|
3666
|
+
};
|
|
3667
|
+
function po(e2, t2, i2) {
|
|
3668
|
+
return Jn({ distinct_id: e2, userPropertiesToSet: t2, userPropertiesToSetOnce: i2 });
|
|
3669
|
+
}
|
|
3670
|
+
!function(e2) {
|
|
3671
|
+
e2.US = "us", e2.EU = "eu", e2.CUSTOM = "custom";
|
|
3672
|
+
}(co || (co = {}));
|
|
3673
|
+
var go = "i.posthog.com";
|
|
3674
|
+
var vo = class {
|
|
3675
|
+
constructor(e2) {
|
|
3676
|
+
V(this, "_regionCache", {}), this.instance = e2;
|
|
3677
|
+
}
|
|
3678
|
+
get apiHost() {
|
|
3679
|
+
var e2 = this.instance.config.api_host.trim().replace(/\/$/, "");
|
|
3680
|
+
return "https://app.posthog.com" === e2 ? "https://us.i.posthog.com" : e2;
|
|
3681
|
+
}
|
|
3682
|
+
get uiHost() {
|
|
3683
|
+
var e2, t2 = null === (e2 = this.instance.config.ui_host) || void 0 === e2 ? void 0 : e2.replace(/\/$/, "");
|
|
3684
|
+
return t2 || (t2 = this.apiHost.replace(".".concat(go), ".posthog.com")), "https://app.posthog.com" === t2 ? "https://us.posthog.com" : t2;
|
|
3685
|
+
}
|
|
3686
|
+
get region() {
|
|
3687
|
+
return this._regionCache[this.apiHost] || (/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost) ? this._regionCache[this.apiHost] = co.US : /https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost) ? this._regionCache[this.apiHost] = co.EU : this._regionCache[this.apiHost] = co.CUSTOM), this._regionCache[this.apiHost];
|
|
3688
|
+
}
|
|
3689
|
+
endpointFor(e2) {
|
|
3690
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
|
|
3691
|
+
if (t2 && (t2 = "/" === t2[0] ? t2 : "/".concat(t2)), "ui" === e2) return this.uiHost + t2;
|
|
3692
|
+
if (this.region === co.CUSTOM) return this.apiHost + t2;
|
|
3693
|
+
var i2 = go + t2;
|
|
3694
|
+
switch (e2) {
|
|
3695
|
+
case "assets":
|
|
3696
|
+
return "https://".concat(this.region, "-assets.").concat(i2);
|
|
3697
|
+
case "api":
|
|
3698
|
+
return "https://".concat(this.region, ".").concat(i2);
|
|
3699
|
+
}
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
var fo = { icontains: (e2, i2) => !!t && i2.href.toLowerCase().indexOf(e2.toLowerCase()) > -1, not_icontains: (e2, i2) => !!t && -1 === i2.href.toLowerCase().indexOf(e2.toLowerCase()), regex: (e2, i2) => !!t && $n(i2.href, e2), not_regex: (e2, i2) => !!t && !$n(i2.href, e2), exact: (e2, t2) => t2.href === e2, is_not: (e2, t2) => t2.href !== e2 };
|
|
3703
|
+
var mo = class _mo {
|
|
3704
|
+
constructor(e2) {
|
|
3705
|
+
var t2 = this;
|
|
3706
|
+
V(this, "getWebExperimentsAndEvaluateDisplayLogic", function() {
|
|
3707
|
+
var e3 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
|
|
3708
|
+
t2.getWebExperiments((e4) => {
|
|
3709
|
+
_mo.logInfo("retrieved web experiments from the server"), t2._flagToExperiments = /* @__PURE__ */ new Map(), e4.forEach((e5) => {
|
|
3710
|
+
if (e5.feature_flag_key) {
|
|
3711
|
+
var i2;
|
|
3712
|
+
if (t2._flagToExperiments) _mo.logInfo("setting flag key ", e5.feature_flag_key, " to web experiment ", e5), null === (i2 = t2._flagToExperiments) || void 0 === i2 || i2.set(e5.feature_flag_key, e5);
|
|
3713
|
+
var r2 = t2.instance.getFeatureFlag(e5.feature_flag_key);
|
|
3714
|
+
R(r2) && e5.variants[r2] && t2.applyTransforms(e5.name, r2, e5.variants[r2].transforms);
|
|
3715
|
+
} else if (e5.variants) for (var s2 in e5.variants) {
|
|
3716
|
+
var n2 = e5.variants[s2];
|
|
3717
|
+
_mo.matchesTestVariant(n2) && t2.applyTransforms(e5.name, s2, n2.transforms);
|
|
3718
|
+
}
|
|
3719
|
+
});
|
|
3720
|
+
}, e3);
|
|
3721
|
+
}), this.instance = e2, this.instance.onFeatureFlags((e3) => {
|
|
3722
|
+
this.onFeatureFlags(e3);
|
|
3723
|
+
});
|
|
3724
|
+
}
|
|
3725
|
+
onFeatureFlags(e2) {
|
|
3726
|
+
if (this._is_bot()) _mo.logInfo("Refusing to render web experiment since the viewer is a likely bot");
|
|
3727
|
+
else if (!this.instance.config.disable_web_experiments) {
|
|
3728
|
+
if (O(this._flagToExperiments)) return this._flagToExperiments = /* @__PURE__ */ new Map(), this.loadIfEnabled(), void this.previewWebExperiment();
|
|
3729
|
+
_mo.logInfo("applying feature flags", e2), e2.forEach((e3) => {
|
|
3730
|
+
var t2;
|
|
3731
|
+
if (this._flagToExperiments && null !== (t2 = this._flagToExperiments) && void 0 !== t2 && t2.has(e3)) {
|
|
3732
|
+
var i2, r2 = this.instance.getFeatureFlag(e3), s2 = null === (i2 = this._flagToExperiments) || void 0 === i2 ? void 0 : i2.get(e3);
|
|
3733
|
+
r2 && null != s2 && s2.variants[r2] && this.applyTransforms(s2.name, r2, s2.variants[r2].transforms);
|
|
3734
|
+
}
|
|
3735
|
+
});
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
previewWebExperiment() {
|
|
3739
|
+
var e2 = _mo.getWindowLocation();
|
|
3740
|
+
if (null != e2 && e2.search) {
|
|
3741
|
+
var t2 = kt(null == e2 ? void 0 : e2.search, "__experiment_id"), i2 = kt(null == e2 ? void 0 : e2.search, "__experiment_variant");
|
|
3742
|
+
t2 && i2 && (_mo.logInfo("previewing web experiments ".concat(t2, " && ").concat(i2)), this.getWebExperiments((e3) => {
|
|
3743
|
+
this.showPreviewWebExperiment(parseInt(t2), i2, e3);
|
|
3744
|
+
}, false, true));
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
loadIfEnabled() {
|
|
3748
|
+
this.instance.config.disable_web_experiments || this.getWebExperimentsAndEvaluateDisplayLogic();
|
|
3749
|
+
}
|
|
3750
|
+
getWebExperiments(e2, t2, i2) {
|
|
3751
|
+
if (this.instance.config.disable_web_experiments && !i2) return e2([]);
|
|
3752
|
+
var r2 = this.instance.get_property("$web_experiments");
|
|
3753
|
+
if (r2 && !t2) return e2(r2);
|
|
3754
|
+
this.instance._send_request({ url: this.instance.requestRouter.endpointFor("api", "/api/web_experiments/?token=".concat(this.instance.config.token)), method: "GET", callback: (t3) => {
|
|
3755
|
+
if (200 !== t3.statusCode || !t3.json) return e2([]);
|
|
3756
|
+
var i3 = t3.json.experiments || [];
|
|
3757
|
+
return e2(i3);
|
|
3758
|
+
} });
|
|
3759
|
+
}
|
|
3760
|
+
showPreviewWebExperiment(e2, t2, i2) {
|
|
3761
|
+
var r2 = i2.filter((t3) => t3.id === e2);
|
|
3762
|
+
r2 && r2.length > 0 && (_mo.logInfo("Previewing web experiment [".concat(r2[0].name, "] with variant [").concat(t2, "]")), this.applyTransforms(r2[0].name, t2, r2[0].variants[t2].transforms));
|
|
3763
|
+
}
|
|
3764
|
+
static matchesTestVariant(e2) {
|
|
3765
|
+
return !O(e2.conditions) && (_mo.matchUrlConditions(e2) && _mo.matchUTMConditions(e2));
|
|
3766
|
+
}
|
|
3767
|
+
static matchUrlConditions(e2) {
|
|
3768
|
+
var t2;
|
|
3769
|
+
if (O(e2.conditions) || O(null === (t2 = e2.conditions) || void 0 === t2 ? void 0 : t2.url)) return true;
|
|
3770
|
+
var i2, r2, s2, n2 = _mo.getWindowLocation();
|
|
3771
|
+
return !!n2 && (null === (i2 = e2.conditions) || void 0 === i2 || !i2.url || fo[null !== (r2 = null === (s2 = e2.conditions) || void 0 === s2 ? void 0 : s2.urlMatchType) && void 0 !== r2 ? r2 : "icontains"](e2.conditions.url, n2));
|
|
3772
|
+
}
|
|
3773
|
+
static getWindowLocation() {
|
|
3774
|
+
return null == t ? void 0 : t.location;
|
|
3775
|
+
}
|
|
3776
|
+
static matchUTMConditions(e2) {
|
|
3777
|
+
var t2;
|
|
3778
|
+
if (O(e2.conditions) || O(null === (t2 = e2.conditions) || void 0 === t2 ? void 0 : t2.utm)) return true;
|
|
3779
|
+
var i2 = zs.campaignParams();
|
|
3780
|
+
if (i2.utm_source) {
|
|
3781
|
+
var r2, s2, n2, o2, a2, l2, c2, u2, d2, h2, _2, p2, g2, v2, f2, m2, y2 = null === (r2 = e2.conditions) || void 0 === r2 || null === (s2 = r2.utm) || void 0 === s2 || !s2.utm_campaign || (null === (n2 = e2.conditions) || void 0 === n2 || null === (o2 = n2.utm) || void 0 === o2 ? void 0 : o2.utm_campaign) == i2.utm_campaign, b2 = null === (a2 = e2.conditions) || void 0 === a2 || null === (l2 = a2.utm) || void 0 === l2 || !l2.utm_source || (null === (c2 = e2.conditions) || void 0 === c2 || null === (u2 = c2.utm) || void 0 === u2 ? void 0 : u2.utm_source) == i2.utm_source, w2 = null === (d2 = e2.conditions) || void 0 === d2 || null === (h2 = d2.utm) || void 0 === h2 || !h2.utm_medium || (null === (_2 = e2.conditions) || void 0 === _2 || null === (p2 = _2.utm) || void 0 === p2 ? void 0 : p2.utm_medium) == i2.utm_medium, S2 = null === (g2 = e2.conditions) || void 0 === g2 || null === (v2 = g2.utm) || void 0 === v2 || !v2.utm_term || (null === (f2 = e2.conditions) || void 0 === f2 || null === (m2 = f2.utm) || void 0 === m2 ? void 0 : m2.utm_term) == i2.utm_term;
|
|
3782
|
+
return y2 && w2 && S2 && b2;
|
|
3783
|
+
}
|
|
3784
|
+
return false;
|
|
3785
|
+
}
|
|
3786
|
+
static logInfo(e2) {
|
|
3787
|
+
for (var t2 = arguments.length, i2 = new Array(t2 > 1 ? t2 - 1 : 0), r2 = 1; r2 < t2; r2++) i2[r2 - 1] = arguments[r2];
|
|
3788
|
+
B.info("[WebExperiments] ".concat(e2), i2);
|
|
3789
|
+
}
|
|
3790
|
+
applyTransforms(e2, t2, i2) {
|
|
3791
|
+
this._is_bot() ? _mo.logInfo("Refusing to render web experiment since the viewer is a likely bot") : "control" !== t2 ? i2.forEach((i3) => {
|
|
3792
|
+
if (i3.selector) {
|
|
3793
|
+
var r2;
|
|
3794
|
+
_mo.logInfo("applying transform of variant ".concat(t2, " for experiment ").concat(e2, " "), i3);
|
|
3795
|
+
var s2 = null === (r2 = document) || void 0 === r2 ? void 0 : r2.querySelectorAll(i3.selector);
|
|
3796
|
+
null == s2 || s2.forEach((e3) => {
|
|
3797
|
+
var t3 = e3;
|
|
3798
|
+
i3.html && (t3.innerHTML = i3.html), i3.css && t3.setAttribute("style", i3.css);
|
|
3799
|
+
});
|
|
3800
|
+
}
|
|
3801
|
+
}) : _mo.logInfo("Control variants leave the page unmodified.");
|
|
3802
|
+
}
|
|
3803
|
+
_is_bot() {
|
|
3804
|
+
return o && this.instance ? _o(o, this.instance.config.custom_blocked_useragents) : void 0;
|
|
3805
|
+
}
|
|
3806
|
+
};
|
|
3807
|
+
var yo = {};
|
|
3808
|
+
var bo = () => {
|
|
3809
|
+
};
|
|
3810
|
+
var wo = "posthog";
|
|
3811
|
+
var So = !Wn && -1 === (null == h ? void 0 : h.indexOf("MSIE")) && -1 === (null == h ? void 0 : h.indexOf("Mozilla"));
|
|
3812
|
+
var ko = () => {
|
|
3813
|
+
var e2;
|
|
3814
|
+
return { api_host: "https://us.i.posthog.com", ui_host: null, token: "", autocapture: true, rageclick: true, cross_subdomain_cookie: ne(null == a ? void 0 : a.location), persistence: "localStorage+cookie", persistence_name: "", loaded: bo, save_campaign_params: true, custom_campaign_params: [], custom_blocked_useragents: [], save_referrer: true, capture_pageview: true, capture_pageleave: "if_capture_pageview", debug: l && R(null == l ? void 0 : l.search) && -1 !== l.search.indexOf("__posthog_debug=true") || false, cookie_expiration: 365, upgrade: false, disable_session_recording: false, disable_persistence: false, disable_web_experiments: true, disable_surveys: false, disable_external_dependency_loading: false, enable_recording_console_log: void 0, secure_cookie: "https:" === (null == t || null === (e2 = t.location) || void 0 === e2 ? void 0 : e2.protocol), ip: true, opt_out_capturing_by_default: false, opt_out_persistence_by_default: false, opt_out_useragent_filter: false, opt_out_capturing_persistence_type: "localStorage", opt_out_capturing_cookie_prefix: null, opt_in_site_apps: false, property_denylist: [], respect_dnt: false, sanitize_properties: null, request_headers: {}, request_batching: true, properties_string_max_length: 65535, session_recording: {}, mask_all_element_attributes: false, mask_all_text: false, mask_personal_data_properties: false, custom_personal_data_properties: [], advanced_disable_decide: false, advanced_disable_feature_flags: false, advanced_disable_feature_flags_on_first_load: false, advanced_disable_toolbar_metrics: false, feature_flag_request_timeout_ms: 3e3, surveys_request_timeout_ms: 1e4, on_request_error: (e3) => {
|
|
3815
|
+
var t2 = "Bad HTTP status: " + e3.statusCode + " " + e3.text;
|
|
3816
|
+
B.error(t2);
|
|
3817
|
+
}, get_device_id: (e3) => e3, capture_performance: void 0, name: "posthog", bootstrap: {}, disable_compression: false, session_idle_timeout_seconds: 1800, person_profiles: "identified_only", before_send: void 0, request_queue_config: { flush_interval_ms: Xn }, _onCapture: bo };
|
|
3818
|
+
};
|
|
3819
|
+
var Eo = (e2) => {
|
|
3820
|
+
var t2 = {};
|
|
3821
|
+
F(e2.process_person) || (t2.person_profiles = e2.process_person), F(e2.xhr_headers) || (t2.request_headers = e2.xhr_headers), F(e2.cookie_name) || (t2.persistence_name = e2.cookie_name), F(e2.disable_cookie) || (t2.disable_persistence = e2.disable_cookie), F(e2.store_google) || (t2.save_campaign_params = e2.store_google), F(e2.verbose) || (t2.debug = e2.verbose);
|
|
3822
|
+
var i2 = X({}, t2, e2);
|
|
3823
|
+
return x(e2.property_blacklist) && (F(e2.property_denylist) ? i2.property_denylist = e2.property_blacklist : x(e2.property_denylist) ? i2.property_denylist = [...e2.property_blacklist, ...e2.property_denylist] : B.error("Invalid value for property_denylist config: " + e2.property_denylist)), i2;
|
|
3824
|
+
};
|
|
3825
|
+
var xo = class {
|
|
3826
|
+
constructor() {
|
|
3827
|
+
V(this, "__forceAllowLocalhost", false);
|
|
3828
|
+
}
|
|
3829
|
+
get _forceAllowLocalhost() {
|
|
3830
|
+
return this.__forceAllowLocalhost;
|
|
3831
|
+
}
|
|
3832
|
+
set _forceAllowLocalhost(e2) {
|
|
3833
|
+
B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"), this.__forceAllowLocalhost = e2;
|
|
3834
|
+
}
|
|
3835
|
+
};
|
|
3836
|
+
var Io = class _Io {
|
|
3837
|
+
get decideEndpointWasHit() {
|
|
3838
|
+
var e2, t2;
|
|
3839
|
+
return null !== (e2 = null === (t2 = this.featureFlags) || void 0 === t2 ? void 0 : t2.hasLoadedFlags) && void 0 !== e2 && e2;
|
|
3840
|
+
}
|
|
3841
|
+
constructor() {
|
|
3842
|
+
V(this, "webPerformance", new xo()), V(this, "_personProcessingSetOncePropertiesSent", false), V(this, "version", p.LIB_VERSION), V(this, "_internalEventEmitter", new On()), this.config = ko(), this.SentryIntegration = br, this.sentryIntegration = (e2) => function(e3, t2) {
|
|
3843
|
+
var i2 = yr(e3, t2);
|
|
3844
|
+
return { name: mr, processEvent: (e4) => i2(e4) };
|
|
3845
|
+
}(this, e2), this.__request_queue = [], this.__loaded = false, this.analyticsDefaultEndpoint = "/e/", this._initialPageviewCaptured = false, this._initialPersonProfilesConfig = null, this._cachedIdentify = null, this.featureFlags = new zr(this), this.toolbar = new xr(this), this.scrollManager = new to(this), this.pageViewManager = new Mr(this), this.surveys = new Nn(this), this.experiments = new mo(this), this.exceptions = new Ar(this), this.rateLimiter = new Hn(this), this.requestRouter = new vo(this), this.consent = new ei(this), this.people = { set: (e2, t2, i2) => {
|
|
3846
|
+
var r2 = R(e2) ? { [e2]: t2 } : e2;
|
|
3847
|
+
this.setPersonProperties(r2), null == i2 || i2({});
|
|
3848
|
+
}, set_once: (e2, t2, i2) => {
|
|
3849
|
+
var r2 = R(e2) ? { [e2]: t2 } : e2;
|
|
3850
|
+
this.setPersonProperties(void 0, r2), null == i2 || i2({});
|
|
3851
|
+
} }, this.on("eventCaptured", (e2) => B.info('send "'.concat(null == e2 ? void 0 : e2.event, '"'), e2));
|
|
3852
|
+
}
|
|
3853
|
+
init(e2, t2, i2) {
|
|
3854
|
+
if (i2 && i2 !== wo) {
|
|
3855
|
+
var r2, s2 = null !== (r2 = yo[i2]) && void 0 !== r2 ? r2 : new _Io();
|
|
3856
|
+
return s2._init(e2, t2, i2), yo[i2] = s2, yo[wo][i2] = s2, s2;
|
|
3857
|
+
}
|
|
3858
|
+
return this._init(e2, t2, i2);
|
|
3859
|
+
}
|
|
3860
|
+
_init(i2) {
|
|
3861
|
+
var r2, s2, n2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, o2 = arguments.length > 2 ? arguments[2] : void 0;
|
|
3862
|
+
if (F(i2) || T(i2)) return B.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"), this;
|
|
3863
|
+
if (this.__loaded) return B.warn("You have already initialized PostHog! Re-initializing is a no-op"), this;
|
|
3864
|
+
this.__loaded = true, this.config = {}, this._triggered_notifs = [], n2.person_profiles && (this._initialPersonProfilesConfig = n2.person_profiles), this.set_config(X({}, ko(), Eo(n2), { name: o2, token: i2 })), this.config.on_xhr_error && B.error("on_xhr_error is deprecated. Use on_request_error instead"), this.compression = n2.disable_compression ? void 0 : e.GZipJS, this.persistence = new Ws(this.config), this.sessionPersistence = "sessionStorage" === this.config.persistence || "memory" === this.config.persistence ? this.persistence : new Ws(W(W({}, this.config), {}, { persistence: "sessionStorage" }));
|
|
3865
|
+
var a2 = W({}, this.persistence.props), l2 = W({}, this.sessionPersistence.props);
|
|
3866
|
+
if (this._requestQueue = new Qn((e2) => this._send_retriable_request(e2), this.config.request_queue_config), this._retryQueue = new eo(this), this.__request_queue = [], this.config.__preview_experimental_cookieless_mode || (this.sessionManager = new no(this), this.sessionPropsManager = new ro(this, this.sessionManager, this.persistence)), new Pr(this).startIfEnabledOrStop(), this.siteApps = new lo(this), null === (r2 = this.siteApps) || void 0 === r2 || r2.init(), this.config.__preview_experimental_cookieless_mode || (this.sessionRecording = new gr(this), this.sessionRecording.startIfEnabledOrStop()), this.config.disable_scroll_properties || this.scrollManager.startMeasuringScrollPosition(), this.autocapture = new Tt(this), this.autocapture.startIfEnabled(), this.surveys.loadIfEnabled(), this.heatmaps = new Or(this), this.heatmaps.startIfEnabled(), this.webVitalsAutocapture = new Rr(this), this.exceptionObserver = new oi(this), this.exceptionObserver.startIfEnabled(), this.deadClicksAutocapture = new si(this, ri), this.deadClicksAutocapture.startIfEnabled(), p.DEBUG = p.DEBUG || this.config.debug, p.DEBUG && B.info("Starting in debug mode", { this: this, config: n2, thisC: W({}, this.config), p: a2, s: l2 }), this._sync_opt_out_with_persistence(), void 0 !== (null === (s2 = n2.bootstrap) || void 0 === s2 ? void 0 : s2.distinctID)) {
|
|
3867
|
+
var c2, u2, d2 = this.config.get_device_id(qt()), h2 = null !== (c2 = n2.bootstrap) && void 0 !== c2 && c2.isIdentifiedID ? d2 : n2.bootstrap.distinctID;
|
|
3868
|
+
this.persistence.set_property(Ae, null !== (u2 = n2.bootstrap) && void 0 !== u2 && u2.isIdentifiedID ? "identified" : "anonymous"), this.register({ distinct_id: n2.bootstrap.distinctID, $device_id: h2 });
|
|
3869
|
+
}
|
|
3870
|
+
if (this._hasBootstrappedFeatureFlags()) {
|
|
3871
|
+
var _2, g2, v2 = Object.keys((null === (_2 = n2.bootstrap) || void 0 === _2 ? void 0 : _2.featureFlags) || {}).filter((e2) => {
|
|
3872
|
+
var t2, i3;
|
|
3873
|
+
return !(null === (t2 = n2.bootstrap) || void 0 === t2 || null === (i3 = t2.featureFlags) || void 0 === i3 || !i3[e2]);
|
|
3874
|
+
}).reduce((e2, t2) => {
|
|
3875
|
+
var i3, r3;
|
|
3876
|
+
return e2[t2] = (null === (i3 = n2.bootstrap) || void 0 === i3 || null === (r3 = i3.featureFlags) || void 0 === r3 ? void 0 : r3[t2]) || false, e2;
|
|
3877
|
+
}, {}), f2 = Object.keys((null === (g2 = n2.bootstrap) || void 0 === g2 ? void 0 : g2.featureFlagPayloads) || {}).filter((e2) => v2[e2]).reduce((e2, t2) => {
|
|
3878
|
+
var i3, r3, s3, o3;
|
|
3879
|
+
null !== (i3 = n2.bootstrap) && void 0 !== i3 && null !== (r3 = i3.featureFlagPayloads) && void 0 !== r3 && r3[t2] && (e2[t2] = null === (s3 = n2.bootstrap) || void 0 === s3 || null === (o3 = s3.featureFlagPayloads) || void 0 === o3 ? void 0 : o3[t2]);
|
|
3880
|
+
return e2;
|
|
3881
|
+
}, {});
|
|
3882
|
+
this.featureFlags.receivedFeatureFlags({ featureFlags: v2, featureFlagPayloads: f2 });
|
|
3883
|
+
}
|
|
3884
|
+
if (this.config.__preview_experimental_cookieless_mode) this.register_once({ distinct_id: ze, $device_id: null }, "");
|
|
3885
|
+
else if (!this.get_distinct_id()) {
|
|
3886
|
+
var m2 = this.config.get_device_id(qt());
|
|
3887
|
+
this.register_once({ distinct_id: m2, $device_id: m2 }, ""), this.persistence.set_property(Ae, "anonymous");
|
|
3888
|
+
}
|
|
3889
|
+
return ae(t, "onpagehide" in self ? "pagehide" : "unload", this._handle_unload.bind(this), { passive: false }), this.toolbar.maybeLoadToolbar(), n2.segment ? fr(this, () => this._loaded()) : this._loaded(), I(this.config._onCapture) && this.config._onCapture !== bo && (B.warn("onCapture is deprecated. Please use `before_send` instead"), this.on("eventCaptured", (e2) => this.config._onCapture(e2.event, e2))), this;
|
|
3890
|
+
}
|
|
3891
|
+
_onRemoteConfig(t2) {
|
|
3892
|
+
var i2, r2, s2, n2, o2, l2, c2, u2;
|
|
3893
|
+
if (!a || !a.body) return B.info("document not ready yet, trying again in 500 milliseconds..."), void setTimeout(() => {
|
|
3894
|
+
this._onRemoteConfig(t2);
|
|
3895
|
+
}, 500);
|
|
3896
|
+
this.compression = void 0, t2.supportedCompression && !this.config.disable_compression && (this.compression = m(t2.supportedCompression, e.GZipJS) ? e.GZipJS : m(t2.supportedCompression, e.Base64) ? e.Base64 : void 0), null !== (i2 = t2.analytics) && void 0 !== i2 && i2.endpoint && (this.analyticsDefaultEndpoint = t2.analytics.endpoint), this.set_config({ person_profiles: this._initialPersonProfilesConfig ? this._initialPersonProfilesConfig : "identified_only" }), null === (r2 = this.siteApps) || void 0 === r2 || r2.onRemoteConfig(t2), null === (s2 = this.sessionRecording) || void 0 === s2 || s2.onRemoteConfig(t2), null === (n2 = this.autocapture) || void 0 === n2 || n2.onRemoteConfig(t2), null === (o2 = this.heatmaps) || void 0 === o2 || o2.onRemoteConfig(t2), this.surveys.onRemoteConfig(t2), null === (l2 = this.webVitalsAutocapture) || void 0 === l2 || l2.onRemoteConfig(t2), null === (c2 = this.exceptionObserver) || void 0 === c2 || c2.onRemoteConfig(t2), null === (u2 = this.deadClicksAutocapture) || void 0 === u2 || u2.onRemoteConfig(t2);
|
|
3897
|
+
}
|
|
3898
|
+
_loaded() {
|
|
3899
|
+
try {
|
|
3900
|
+
this.config.loaded(this);
|
|
3901
|
+
} catch (e2) {
|
|
3902
|
+
B.critical("`loaded` function failed", e2);
|
|
3903
|
+
}
|
|
3904
|
+
this._start_queue_if_opted_in(), this.config.capture_pageview && setTimeout(() => {
|
|
3905
|
+
this.consent.isOptedIn() && this._captureInitialPageview();
|
|
3906
|
+
}, 1), new zn(this).load(), this.featureFlags.decide();
|
|
3907
|
+
}
|
|
3908
|
+
_start_queue_if_opted_in() {
|
|
3909
|
+
var e2;
|
|
3910
|
+
this.has_opted_out_capturing() || this.config.request_batching && (null === (e2 = this._requestQueue) || void 0 === e2 || e2.enable());
|
|
3911
|
+
}
|
|
3912
|
+
_dom_loaded() {
|
|
3913
|
+
this.has_opted_out_capturing() || Y(this.__request_queue, (e2) => this._send_retriable_request(e2)), this.__request_queue = [], this._start_queue_if_opted_in();
|
|
3914
|
+
}
|
|
3915
|
+
_handle_unload() {
|
|
3916
|
+
var e2, t2;
|
|
3917
|
+
this.config.request_batching ? (this._shouldCapturePageleave() && this.capture("$pageleave"), null === (e2 = this._requestQueue) || void 0 === e2 || e2.unload(), null === (t2 = this._retryQueue) || void 0 === t2 || t2.unload()) : this._shouldCapturePageleave() && this.capture("$pageleave", null, { transport: "sendBeacon" });
|
|
3918
|
+
}
|
|
3919
|
+
_send_request(e2) {
|
|
3920
|
+
this.__loaded && (So ? this.__request_queue.push(e2) : this.rateLimiter.isServerRateLimited(e2.batchKey) || (e2.transport = e2.transport || this.config.api_transport, e2.url = Gn(e2.url, { ip: this.config.ip ? 1 : 0 }), e2.headers = W({}, this.config.request_headers), e2.compression = "best-available" === e2.compression ? this.compression : e2.compression, e2.fetchOptions = e2.fetchOptions || this.config.fetch_options, ((e3) => {
|
|
3921
|
+
var t2, i2, r2, s2 = W({}, e3);
|
|
3922
|
+
s2.timeout = s2.timeout || 6e4, s2.url = Gn(s2.url, { _: (/* @__PURE__ */ new Date()).getTime().toString(), ver: p.LIB_VERSION, compression: s2.compression });
|
|
3923
|
+
var n2 = null !== (t2 = s2.transport) && void 0 !== t2 ? t2 : "fetch", o2 = null !== (i2 = null === (r2 = oe(Kn, (e4) => e4.transport === n2)) || void 0 === r2 ? void 0 : r2.method) && void 0 !== i2 ? i2 : Kn[0].method;
|
|
3924
|
+
if (!o2) throw new Error("No available transport method");
|
|
3925
|
+
o2(s2);
|
|
3926
|
+
})(W(W({}, e2), {}, { callback: (t2) => {
|
|
3927
|
+
var i2, r2, s2;
|
|
3928
|
+
(this.rateLimiter.checkForLimiting(t2), t2.statusCode >= 400) && (null === (r2 = (s2 = this.config).on_request_error) || void 0 === r2 || r2.call(s2, t2));
|
|
3929
|
+
null === (i2 = e2.callback) || void 0 === i2 || i2.call(e2, t2);
|
|
3930
|
+
} }))));
|
|
3931
|
+
}
|
|
3932
|
+
_send_retriable_request(e2) {
|
|
3933
|
+
this._retryQueue ? this._retryQueue.retriableRequest(e2) : this._send_request(e2);
|
|
3934
|
+
}
|
|
3935
|
+
_execute_array(e2) {
|
|
3936
|
+
var t2, i2 = [], r2 = [], s2 = [];
|
|
3937
|
+
Y(e2, (e3) => {
|
|
3938
|
+
e3 && (t2 = e3[0], x(t2) ? s2.push(e3) : I(e3) ? e3.call(this) : x(e3) && "alias" === t2 ? i2.push(e3) : x(e3) && -1 !== t2.indexOf("capture") && I(this[t2]) ? s2.push(e3) : r2.push(e3));
|
|
3939
|
+
});
|
|
3940
|
+
var n2 = function(e3, t3) {
|
|
3941
|
+
Y(e3, function(e4) {
|
|
3942
|
+
if (x(e4[0])) {
|
|
3943
|
+
var i3 = t3;
|
|
3944
|
+
K(e4, function(e5) {
|
|
3945
|
+
i3 = i3[e5[0]].apply(i3, e5.slice(1));
|
|
3946
|
+
});
|
|
3947
|
+
} else this[e4[0]].apply(this, e4.slice(1));
|
|
3948
|
+
}, t3);
|
|
3949
|
+
};
|
|
3950
|
+
n2(i2, this), n2(r2, this), n2(s2, this);
|
|
3951
|
+
}
|
|
3952
|
+
_hasBootstrappedFeatureFlags() {
|
|
3953
|
+
var e2, t2;
|
|
3954
|
+
return (null === (e2 = this.config.bootstrap) || void 0 === e2 ? void 0 : e2.featureFlags) && Object.keys(null === (t2 = this.config.bootstrap) || void 0 === t2 ? void 0 : t2.featureFlags).length > 0 || false;
|
|
3955
|
+
}
|
|
3956
|
+
push(e2) {
|
|
3957
|
+
this._execute_array([e2]);
|
|
3958
|
+
}
|
|
3959
|
+
capture(e2, t2, i2) {
|
|
3960
|
+
var r2;
|
|
3961
|
+
if (this.__loaded && this.persistence && this.sessionPersistence && this._requestQueue) {
|
|
3962
|
+
if (!this.consent.isOptedOut()) if (!F(e2) && R(e2)) {
|
|
3963
|
+
if (this.config.opt_out_useragent_filter || !this._is_bot()) {
|
|
3964
|
+
var s2 = null != i2 && i2.skip_client_rate_limiting ? void 0 : this.rateLimiter.clientRateLimitContext();
|
|
3965
|
+
if (null == s2 || !s2.isRateLimited) {
|
|
3966
|
+
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();
|
|
3967
|
+
var n2 = /* @__PURE__ */ new Date(), o2 = (null == i2 ? void 0 : i2.timestamp) || n2, a2 = qt(), l2 = { uuid: a2, event: e2, properties: this._calculate_event_properties(e2, t2 || {}, o2, a2) };
|
|
3968
|
+
s2 && (l2.properties.$lib_rate_limit_remaining_tokens = s2.remainingTokens), (null == i2 ? void 0 : i2.$set) && (l2.$set = null == i2 ? void 0 : i2.$set);
|
|
3969
|
+
var c2 = this._calculate_set_once_properties(null == i2 ? void 0 : i2.$set_once);
|
|
3970
|
+
c2 && (l2.$set_once = c2), (l2 = re(l2, null != i2 && i2._noTruncate ? null : this.config.properties_string_max_length)).timestamp = o2, F(null == i2 ? void 0 : i2.timestamp) || (l2.properties.$event_time_override_provided = true, l2.properties.$event_time_override_system_time = n2);
|
|
3971
|
+
var u2 = W(W({}, l2.properties.$set), l2.$set);
|
|
3972
|
+
if (C(u2) || this.setPersonPropertiesForFlags(u2), !O(this.config.before_send)) {
|
|
3973
|
+
var d2 = this._runBeforeSend(l2);
|
|
3974
|
+
if (!d2) return;
|
|
3975
|
+
l2 = d2;
|
|
3976
|
+
}
|
|
3977
|
+
this._internalEventEmitter.emit("eventCaptured", l2);
|
|
3978
|
+
var h2 = { method: "POST", url: null !== (r2 = null == i2 ? void 0 : i2._url) && void 0 !== r2 ? r2 : this.requestRouter.endpointFor("api", this.analyticsDefaultEndpoint), data: l2, compression: "best-available", batchKey: null == i2 ? void 0 : i2._batchKey };
|
|
3979
|
+
return !this.config.request_batching || i2 && (null == i2 || !i2._batchKey) || null != i2 && i2.send_instantly ? this._send_retriable_request(h2) : this._requestQueue.enqueue(h2), l2;
|
|
3980
|
+
}
|
|
3981
|
+
B.critical("This capture call is ignored due to client rate limiting.");
|
|
3982
|
+
}
|
|
3983
|
+
} else B.error("No event name provided to posthog.capture");
|
|
3984
|
+
} else B.uninitializedWarning("posthog.capture");
|
|
3985
|
+
}
|
|
3986
|
+
_addCaptureHook(e2) {
|
|
3987
|
+
return this.on("eventCaptured", (t2) => e2(t2.event, t2));
|
|
3988
|
+
}
|
|
3989
|
+
_calculate_event_properties(e2, t2, i2, r2) {
|
|
3990
|
+
if (i2 = i2 || /* @__PURE__ */ new Date(), !this.persistence || !this.sessionPersistence) return t2;
|
|
3991
|
+
var s2 = this.persistence.remove_event_timer(e2), n2 = W({}, t2);
|
|
3992
|
+
if (n2.token = this.config.token, this.config.__preview_experimental_cookieless_mode && (n2.$cookieless_mode = true), "$snapshot" === e2) {
|
|
3993
|
+
var o2 = W(W({}, this.persistence.properties()), this.sessionPersistence.properties());
|
|
3994
|
+
return n2.distinct_id = o2.distinct_id, (!R(n2.distinct_id) && !M(n2.distinct_id) || T(n2.distinct_id)) && B.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"), n2;
|
|
3995
|
+
}
|
|
3996
|
+
var l2, c2 = zs.properties({ maskPersonalDataProperties: this.config.mask_personal_data_properties, customPersonalDataProperties: this.config.custom_personal_data_properties });
|
|
3997
|
+
if (this.sessionManager) {
|
|
3998
|
+
var { sessionId: u2, windowId: d2 } = this.sessionManager.checkAndGetSessionAndWindowId();
|
|
3999
|
+
n2.$session_id = u2, n2.$window_id = d2;
|
|
4000
|
+
}
|
|
4001
|
+
try {
|
|
4002
|
+
var _2, p2;
|
|
4003
|
+
this.sessionRecording && (n2.$recording_status = this.sessionRecording.status, n2.$sdk_debug_replay_internal_buffer_length = this.sessionRecording.buffer.data.length, n2.$sdk_debug_replay_internal_buffer_size = this.sessionRecording.buffer.size), n2.$sdk_debug_retry_queue_size = null === (_2 = this._retryQueue) || void 0 === _2 || null === (p2 = _2.queue) || void 0 === p2 ? void 0 : p2.length;
|
|
4004
|
+
} catch (e3) {
|
|
4005
|
+
n2.$sdk_debug_error_capturing_properties = String(e3);
|
|
4006
|
+
}
|
|
4007
|
+
if (this.requestRouter.region === co.CUSTOM && (n2.$lib_custom_api_host = this.config.api_host), l2 = "$pageview" === e2 ? this.pageViewManager.doPageView(i2, r2) : "$pageleave" === e2 ? this.pageViewManager.doPageLeave(i2) : this.pageViewManager.doEvent(), n2 = X(n2, l2), "$pageview" === e2 && a && (n2.title = a.title), !F(s2)) {
|
|
4008
|
+
var g2 = i2.getTime() - s2;
|
|
4009
|
+
n2.$duration = parseFloat((g2 / 1e3).toFixed(3));
|
|
4010
|
+
}
|
|
4011
|
+
h && this.config.opt_out_useragent_filter && (n2.$browser_type = this._is_bot() ? "bot" : "browser"), (n2 = X({}, c2, this.persistence.properties(), this.sessionPersistence.properties(), n2)).$is_identified = this._isIdentified(), x(this.config.property_denylist) ? K(this.config.property_denylist, function(e3) {
|
|
4012
|
+
delete n2[e3];
|
|
4013
|
+
}) : B.error("Invalid value for property_denylist config: " + this.config.property_denylist + " or property_blacklist config: " + this.config.property_blacklist);
|
|
4014
|
+
var v2 = this.config.sanitize_properties;
|
|
4015
|
+
v2 && (B.error("sanitize_properties is deprecated. Use before_send instead"), n2 = v2(n2, e2));
|
|
4016
|
+
var f2 = this._hasPersonProcessing();
|
|
4017
|
+
return n2.$process_person_profile = f2, f2 && this._requirePersonProcessing("_calculate_event_properties"), n2;
|
|
4018
|
+
}
|
|
4019
|
+
_calculate_set_once_properties(e2) {
|
|
4020
|
+
var t2;
|
|
4021
|
+
if (!this.persistence || !this._hasPersonProcessing()) return e2;
|
|
4022
|
+
if (this._personProcessingSetOncePropertiesSent) return e2;
|
|
4023
|
+
var i2 = this.persistence.get_initial_props(), r2 = null === (t2 = this.sessionPropsManager) || void 0 === t2 ? void 0 : t2.getSetOnceInitialSessionPropsProps(), s2 = X({}, i2, r2 || {}, e2 || {}), n2 = this.config.sanitize_properties;
|
|
4024
|
+
return n2 && (B.error("sanitize_properties is deprecated. Use before_send instead"), s2 = n2(s2, "$set_once")), this._personProcessingSetOncePropertiesSent = true, C(s2) ? void 0 : s2;
|
|
4025
|
+
}
|
|
4026
|
+
register(e2, t2) {
|
|
4027
|
+
var i2;
|
|
4028
|
+
null === (i2 = this.persistence) || void 0 === i2 || i2.register(e2, t2);
|
|
4029
|
+
}
|
|
4030
|
+
register_once(e2, t2, i2) {
|
|
4031
|
+
var r2;
|
|
4032
|
+
null === (r2 = this.persistence) || void 0 === r2 || r2.register_once(e2, t2, i2);
|
|
4033
|
+
}
|
|
4034
|
+
register_for_session(e2) {
|
|
4035
|
+
var t2;
|
|
4036
|
+
null === (t2 = this.sessionPersistence) || void 0 === t2 || t2.register(e2);
|
|
4037
|
+
}
|
|
4038
|
+
unregister(e2) {
|
|
4039
|
+
var t2;
|
|
4040
|
+
null === (t2 = this.persistence) || void 0 === t2 || t2.unregister(e2);
|
|
4041
|
+
}
|
|
4042
|
+
unregister_for_session(e2) {
|
|
4043
|
+
var t2;
|
|
4044
|
+
null === (t2 = this.sessionPersistence) || void 0 === t2 || t2.unregister(e2);
|
|
4045
|
+
}
|
|
4046
|
+
_register_single(e2, t2) {
|
|
4047
|
+
this.register({ [e2]: t2 });
|
|
4048
|
+
}
|
|
4049
|
+
getFeatureFlag(e2, t2) {
|
|
4050
|
+
return this.featureFlags.getFeatureFlag(e2, t2);
|
|
4051
|
+
}
|
|
4052
|
+
getFeatureFlagPayload(e2) {
|
|
4053
|
+
var t2 = this.featureFlags.getFeatureFlagPayload(e2);
|
|
4054
|
+
try {
|
|
4055
|
+
return JSON.parse(t2);
|
|
4056
|
+
} catch (e3) {
|
|
4057
|
+
return t2;
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
isFeatureEnabled(e2, t2) {
|
|
4061
|
+
return this.featureFlags.isFeatureEnabled(e2, t2);
|
|
4062
|
+
}
|
|
4063
|
+
reloadFeatureFlags() {
|
|
4064
|
+
this.featureFlags.reloadFeatureFlags();
|
|
4065
|
+
}
|
|
4066
|
+
updateEarlyAccessFeatureEnrollment(e2, t2) {
|
|
4067
|
+
this.featureFlags.updateEarlyAccessFeatureEnrollment(e2, t2);
|
|
4068
|
+
}
|
|
4069
|
+
getEarlyAccessFeatures(e2) {
|
|
4070
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
4071
|
+
return this.featureFlags.getEarlyAccessFeatures(e2, t2);
|
|
4072
|
+
}
|
|
4073
|
+
on(e2, t2) {
|
|
4074
|
+
return this._internalEventEmitter.on(e2, t2);
|
|
4075
|
+
}
|
|
4076
|
+
onFeatureFlags(e2) {
|
|
4077
|
+
return this.featureFlags.onFeatureFlags(e2);
|
|
4078
|
+
}
|
|
4079
|
+
onSessionId(e2) {
|
|
4080
|
+
var t2, i2;
|
|
4081
|
+
return null !== (t2 = null === (i2 = this.sessionManager) || void 0 === i2 ? void 0 : i2.onSessionId(e2)) && void 0 !== t2 ? t2 : () => {
|
|
4082
|
+
};
|
|
4083
|
+
}
|
|
4084
|
+
getSurveys(e2) {
|
|
4085
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
4086
|
+
this.surveys.getSurveys(e2, t2);
|
|
4087
|
+
}
|
|
4088
|
+
getActiveMatchingSurveys(e2) {
|
|
4089
|
+
var t2 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
|
|
4090
|
+
this.surveys.getActiveMatchingSurveys(e2, t2);
|
|
4091
|
+
}
|
|
4092
|
+
renderSurvey(e2, t2) {
|
|
4093
|
+
this.surveys.renderSurvey(e2, t2);
|
|
4094
|
+
}
|
|
4095
|
+
canRenderSurvey(e2) {
|
|
4096
|
+
this.surveys.canRenderSurvey(e2);
|
|
4097
|
+
}
|
|
4098
|
+
identify(e2, t2, i2) {
|
|
4099
|
+
if (!this.__loaded || !this.persistence) return B.uninitializedWarning("posthog.identify");
|
|
4100
|
+
if (M(e2) && (e2 = e2.toString(), B.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")), e2) {
|
|
4101
|
+
if (["distinct_id", "distinctid"].includes(e2.toLowerCase())) B.critical('The string "'.concat(e2, '" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));
|
|
4102
|
+
else if (this._requirePersonProcessing("posthog.identify")) {
|
|
4103
|
+
var r2 = this.get_distinct_id();
|
|
4104
|
+
if (this.register({ $user_id: e2 }), !this.get_property("$device_id")) {
|
|
4105
|
+
var s2 = r2;
|
|
4106
|
+
this.register_once({ $had_persisted_distinct_id: true, $device_id: s2 }, "");
|
|
4107
|
+
}
|
|
4108
|
+
e2 !== r2 && e2 !== this.get_property(ce) && (this.unregister(ce), this.register({ distinct_id: e2 }));
|
|
4109
|
+
var n2 = "anonymous" === (this.persistence.get_property(Ae) || "anonymous");
|
|
4110
|
+
e2 !== r2 && n2 ? (this.persistence.set_property(Ae, "identified"), this.setPersonPropertiesForFlags(W(W({}, i2 || {}), t2 || {}), false), this.capture("$identify", { distinct_id: e2, $anon_distinct_id: r2 }, { $set: t2 || {}, $set_once: i2 || {} }), this.featureFlags.setAnonymousDistinctId(r2), this._cachedIdentify = po(e2, t2, i2)) : (t2 || i2) && (this._cachedIdentify !== po(e2, t2, i2) ? (this.setPersonProperties(t2, i2), this._cachedIdentify = po(e2, t2, i2)) : B.info("A duplicate posthog.identify call was made with the same properties. It has been ignored.")), e2 !== r2 && (this.reloadFeatureFlags(), this.unregister(Me));
|
|
4111
|
+
}
|
|
4112
|
+
} else B.error("Unique user id has not been set in posthog.identify");
|
|
4113
|
+
}
|
|
4114
|
+
setPersonProperties(e2, t2) {
|
|
4115
|
+
(e2 || t2) && this._requirePersonProcessing("posthog.setPersonProperties") && (this.setPersonPropertiesForFlags(W(W({}, t2 || {}), e2 || {})), this.capture("$set", { $set: e2 || {}, $set_once: t2 || {} }));
|
|
4116
|
+
}
|
|
4117
|
+
group(e2, t2, i2) {
|
|
4118
|
+
if (e2 && t2) {
|
|
4119
|
+
if (this._requirePersonProcessing("posthog.group")) {
|
|
4120
|
+
var r2 = this.getGroups();
|
|
4121
|
+
r2[e2] !== t2 && this.resetGroupPropertiesForFlags(e2), this.register({ $groups: W(W({}, r2), {}, { [e2]: t2 }) }), i2 && (this.capture("$groupidentify", { $group_type: e2, $group_key: t2, $group_set: i2 }), this.setGroupPropertiesForFlags({ [e2]: i2 })), r2[e2] === t2 || i2 || this.reloadFeatureFlags();
|
|
4122
|
+
}
|
|
4123
|
+
} else B.error("posthog.group requires a group type and group key");
|
|
4124
|
+
}
|
|
4125
|
+
resetGroups() {
|
|
4126
|
+
this.register({ $groups: {} }), this.resetGroupPropertiesForFlags(), this.reloadFeatureFlags();
|
|
4127
|
+
}
|
|
4128
|
+
setPersonPropertiesForFlags(e2) {
|
|
4129
|
+
var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
|
|
4130
|
+
this.featureFlags.setPersonPropertiesForFlags(e2, t2);
|
|
4131
|
+
}
|
|
4132
|
+
resetPersonPropertiesForFlags() {
|
|
4133
|
+
this.featureFlags.resetPersonPropertiesForFlags();
|
|
4134
|
+
}
|
|
4135
|
+
setGroupPropertiesForFlags(e2) {
|
|
4136
|
+
var t2 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
|
|
4137
|
+
this._requirePersonProcessing("posthog.setGroupPropertiesForFlags") && this.featureFlags.setGroupPropertiesForFlags(e2, t2);
|
|
4138
|
+
}
|
|
4139
|
+
resetGroupPropertiesForFlags(e2) {
|
|
4140
|
+
this.featureFlags.resetGroupPropertiesForFlags(e2);
|
|
4141
|
+
}
|
|
4142
|
+
reset(e2) {
|
|
4143
|
+
var t2, i2, r2, s2;
|
|
4144
|
+
if (B.info("reset"), !this.__loaded) return B.uninitializedWarning("posthog.reset");
|
|
4145
|
+
var n2 = this.get_property("$device_id");
|
|
4146
|
+
if (this.consent.reset(), null === (t2 = this.persistence) || void 0 === t2 || t2.clear(), null === (i2 = this.sessionPersistence) || void 0 === i2 || i2.clear(), this.surveys.reset(), null === (r2 = this.persistence) || void 0 === r2 || r2.set_property(Ae, "anonymous"), null === (s2 = this.sessionManager) || void 0 === s2 || s2.resetSessionId(), this._cachedIdentify = null, this.config.__preview_experimental_cookieless_mode) this.register_once({ distinct_id: ze, $device_id: null }, "");
|
|
4147
|
+
else {
|
|
4148
|
+
var o2 = this.config.get_device_id(qt());
|
|
4149
|
+
this.register_once({ distinct_id: o2, $device_id: e2 ? o2 : n2 }, "");
|
|
4150
|
+
}
|
|
4151
|
+
this.register({ $last_posthog_reset: (/* @__PURE__ */ new Date()).toISOString() }, 1);
|
|
4152
|
+
}
|
|
4153
|
+
get_distinct_id() {
|
|
4154
|
+
return this.get_property("distinct_id");
|
|
4155
|
+
}
|
|
4156
|
+
getGroups() {
|
|
4157
|
+
return this.get_property("$groups") || {};
|
|
4158
|
+
}
|
|
4159
|
+
get_session_id() {
|
|
4160
|
+
var e2, t2;
|
|
4161
|
+
return null !== (e2 = null === (t2 = this.sessionManager) || void 0 === t2 ? void 0 : t2.checkAndGetSessionAndWindowId(true).sessionId) && void 0 !== e2 ? e2 : "";
|
|
4162
|
+
}
|
|
4163
|
+
get_session_replay_url(e2) {
|
|
4164
|
+
if (!this.sessionManager) return "";
|
|
4165
|
+
var { sessionId: t2, sessionStartTimestamp: i2 } = this.sessionManager.checkAndGetSessionAndWindowId(true), r2 = this.requestRouter.endpointFor("ui", "/project/".concat(this.config.token, "/replay/").concat(t2));
|
|
4166
|
+
if (null != e2 && e2.withTimestamp && i2) {
|
|
4167
|
+
var s2, n2 = null !== (s2 = e2.timestampLookBack) && void 0 !== s2 ? s2 : 10;
|
|
4168
|
+
if (!i2) return r2;
|
|
4169
|
+
var o2 = Math.max(Math.floor(((/* @__PURE__ */ new Date()).getTime() - i2) / 1e3) - n2, 0);
|
|
4170
|
+
r2 += "?t=".concat(o2);
|
|
4171
|
+
}
|
|
4172
|
+
return r2;
|
|
4173
|
+
}
|
|
4174
|
+
alias(e2, t2) {
|
|
4175
|
+
return e2 === this.get_property(le) ? (B.critical("Attempting to create alias for existing People user - aborting."), -2) : this._requirePersonProcessing("posthog.alias") ? (F(t2) && (t2 = this.get_distinct_id()), e2 !== t2 ? (this._register_single(ce, e2), this.capture("$create_alias", { alias: e2, distinct_id: t2 })) : (B.warn("alias matches current distinct_id - skipping api call."), this.identify(e2), -1)) : void 0;
|
|
4176
|
+
}
|
|
4177
|
+
set_config(e2) {
|
|
4178
|
+
var t2, i2, r2, s2, n2 = W({}, this.config);
|
|
4179
|
+
P(e2) && (X(this.config, Eo(e2)), null === (t2 = this.persistence) || void 0 === t2 || t2.update_config(this.config, n2), this.sessionPersistence = "sessionStorage" === this.config.persistence || "memory" === this.config.persistence ? this.persistence : new Ws(W(W({}, this.config), {}, { persistence: "sessionStorage" })), Gt.is_supported() && "true" === Gt.get("ph_debug") && (this.config.debug = true), this.config.debug && (p.DEBUG = true, B.info("set_config", { config: e2, oldConfig: n2, newConfig: W({}, this.config) })), null === (i2 = this.sessionRecording) || void 0 === i2 || i2.startIfEnabledOrStop(), null === (r2 = this.autocapture) || void 0 === r2 || r2.startIfEnabled(), null === (s2 = this.heatmaps) || void 0 === s2 || s2.startIfEnabled(), this.surveys.loadIfEnabled(), this._sync_opt_out_with_persistence());
|
|
4180
|
+
}
|
|
4181
|
+
startSessionRecording(e2) {
|
|
4182
|
+
var t2 = true === e2, i2 = { sampling: t2 || !(null == e2 || !e2.sampling), linked_flag: t2 || !(null == e2 || !e2.linked_flag), url_trigger: t2 || !(null == e2 || !e2.url_trigger), event_trigger: t2 || !(null == e2 || !e2.event_trigger) };
|
|
4183
|
+
if (Object.values(i2).some(Boolean)) {
|
|
4184
|
+
var r2, s2, n2, o2, a2;
|
|
4185
|
+
if (null === (r2 = this.sessionManager) || void 0 === r2 || r2.checkAndGetSessionAndWindowId(), i2.sampling) null === (s2 = this.sessionRecording) || void 0 === s2 || s2.overrideSampling();
|
|
4186
|
+
if (i2.linked_flag) null === (n2 = this.sessionRecording) || void 0 === n2 || n2.overrideLinkedFlag();
|
|
4187
|
+
if (i2.url_trigger) null === (o2 = this.sessionRecording) || void 0 === o2 || o2.overrideTrigger("url");
|
|
4188
|
+
if (i2.event_trigger) null === (a2 = this.sessionRecording) || void 0 === a2 || a2.overrideTrigger("event");
|
|
4189
|
+
}
|
|
4190
|
+
this.set_config({ disable_session_recording: false });
|
|
4191
|
+
}
|
|
4192
|
+
stopSessionRecording() {
|
|
4193
|
+
this.set_config({ disable_session_recording: true });
|
|
4194
|
+
}
|
|
4195
|
+
sessionRecordingStarted() {
|
|
4196
|
+
var e2;
|
|
4197
|
+
return !(null === (e2 = this.sessionRecording) || void 0 === e2 || !e2.started);
|
|
4198
|
+
}
|
|
4199
|
+
captureException(e2, t2) {
|
|
4200
|
+
var i2, r2 = new Error("PostHog syntheticException"), s2 = I(null === (i2 = _.__PosthogExtensions__) || void 0 === i2 ? void 0 : i2.parseErrorAsProperties) ? W(W({}, _.__PosthogExtensions__.parseErrorAsProperties(D(e2) ? { error: e2, event: e2.message } : { event: e2 }, { syntheticException: r2 })), t2) : W({ $exception_level: "error", $exception_list: [{ type: D(e2) ? e2.name : "Error", value: D(e2) ? e2.message : e2, mechanism: { handled: true, synthetic: false } }] }, t2);
|
|
4201
|
+
this.exceptions.sendExceptionEvent(s2);
|
|
4202
|
+
}
|
|
4203
|
+
loadToolbar(e2) {
|
|
4204
|
+
return this.toolbar.loadToolbar(e2);
|
|
4205
|
+
}
|
|
4206
|
+
get_property(e2) {
|
|
4207
|
+
var t2;
|
|
4208
|
+
return null === (t2 = this.persistence) || void 0 === t2 ? void 0 : t2.props[e2];
|
|
4209
|
+
}
|
|
4210
|
+
getSessionProperty(e2) {
|
|
4211
|
+
var t2;
|
|
4212
|
+
return null === (t2 = this.sessionPersistence) || void 0 === t2 ? void 0 : t2.props[e2];
|
|
4213
|
+
}
|
|
4214
|
+
toString() {
|
|
4215
|
+
var e2, t2 = null !== (e2 = this.config.name) && void 0 !== e2 ? e2 : wo;
|
|
4216
|
+
return t2 !== wo && (t2 = wo + "." + t2), t2;
|
|
4217
|
+
}
|
|
4218
|
+
_isIdentified() {
|
|
4219
|
+
var e2, t2;
|
|
4220
|
+
return "identified" === (null === (e2 = this.persistence) || void 0 === e2 ? void 0 : e2.get_property(Ae)) || "identified" === (null === (t2 = this.sessionPersistence) || void 0 === t2 ? void 0 : t2.get_property(Ae));
|
|
4221
|
+
}
|
|
4222
|
+
_hasPersonProcessing() {
|
|
4223
|
+
var e2, t2, i2, r2;
|
|
4224
|
+
return !("never" === this.config.person_profiles || "identified_only" === this.config.person_profiles && !this._isIdentified() && C(this.getGroups()) && (null === (e2 = this.persistence) || void 0 === e2 || null === (t2 = e2.props) || void 0 === t2 || !t2[ce]) && (null === (i2 = this.persistence) || void 0 === i2 || null === (r2 = i2.props) || void 0 === r2 || !r2[He]));
|
|
4225
|
+
}
|
|
4226
|
+
_shouldCapturePageleave() {
|
|
4227
|
+
return true === this.config.capture_pageleave || "if_capture_pageview" === this.config.capture_pageleave && this.config.capture_pageview;
|
|
4228
|
+
}
|
|
4229
|
+
createPersonProfile() {
|
|
4230
|
+
this._hasPersonProcessing() || this._requirePersonProcessing("posthog.createPersonProfile") && this.setPersonProperties({}, {});
|
|
4231
|
+
}
|
|
4232
|
+
_requirePersonProcessing(e2) {
|
|
4233
|
+
return "never" === this.config.person_profiles ? (B.error(e2 + ' was called, but process_person is set to "never". This call will be ignored.'), false) : (this._register_single(He, true), true);
|
|
4234
|
+
}
|
|
4235
|
+
_sync_opt_out_with_persistence() {
|
|
4236
|
+
var e2, t2, i2, r2, s2 = this.consent.isOptedOut(), n2 = this.config.opt_out_persistence_by_default, o2 = this.config.disable_persistence || s2 && !!n2;
|
|
4237
|
+
(null === (e2 = this.persistence) || void 0 === e2 ? void 0 : e2.disabled) !== o2 && (null === (i2 = this.persistence) || void 0 === i2 || i2.set_disabled(o2));
|
|
4238
|
+
(null === (t2 = this.sessionPersistence) || void 0 === t2 ? void 0 : t2.disabled) !== o2 && (null === (r2 = this.sessionPersistence) || void 0 === r2 || r2.set_disabled(o2));
|
|
4239
|
+
}
|
|
4240
|
+
opt_in_capturing(e2) {
|
|
4241
|
+
var t2;
|
|
4242
|
+
(this.consent.optInOut(true), this._sync_opt_out_with_persistence(), F(null == e2 ? void 0 : e2.captureEventName) || null != e2 && e2.captureEventName) && this.capture(null !== (t2 = null == e2 ? void 0 : e2.captureEventName) && void 0 !== t2 ? t2 : "$opt_in", null == e2 ? void 0 : e2.captureProperties, { send_instantly: true });
|
|
4243
|
+
this.config.capture_pageview && this._captureInitialPageview();
|
|
4244
|
+
}
|
|
4245
|
+
opt_out_capturing() {
|
|
4246
|
+
this.consent.optInOut(false), 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 o ? _o(o, this.config.custom_blocked_useragents) : void 0;
|
|
4259
|
+
}
|
|
4260
|
+
_captureInitialPageview() {
|
|
4261
|
+
a && !this._initialPageviewCaptured && (this._initialPageviewCaptured = true, this.capture("$pageview", { title: a.title }, { send_instantly: true }));
|
|
4262
|
+
}
|
|
4263
|
+
debug(e2) {
|
|
4264
|
+
false === e2 ? (null == t || t.console.log("You've disabled debug mode."), localStorage && localStorage.removeItem("ph_debug"), this.set_config({ debug: false })) : (null == t || t.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: true }));
|
|
4265
|
+
}
|
|
4266
|
+
_runBeforeSend(e2) {
|
|
4267
|
+
if (O(this.config.before_send)) return e2;
|
|
4268
|
+
var t2 = x(this.config.before_send) ? this.config.before_send : [this.config.before_send], i2 = e2;
|
|
4269
|
+
for (var r2 of t2) {
|
|
4270
|
+
if (i2 = r2(i2), O(i2)) {
|
|
4271
|
+
var s2 = "Event '".concat(e2.event, "' was rejected in beforeSend function");
|
|
4272
|
+
return q(e2.event) ? B.warn("".concat(s2, ". This can cause unexpected behavior.")) : B.info(s2), null;
|
|
4273
|
+
}
|
|
4274
|
+
i2.properties && !C(i2.properties) || B.warn("Event '".concat(e2.event, "' has no properties after beforeSend function, this is likely an error."));
|
|
4275
|
+
}
|
|
4276
|
+
return i2;
|
|
4277
|
+
}
|
|
4278
|
+
getPageViewId() {
|
|
4279
|
+
var e2;
|
|
4280
|
+
return null === (e2 = this.pageViewManager._currentPageview) || void 0 === e2 ? void 0 : e2.pageViewId;
|
|
4281
|
+
}
|
|
4282
|
+
captureTraceFeedback(e2, t2) {
|
|
4283
|
+
this.capture("$ai_feedback", { $ai_trace_id: String(e2), $ai_feedback_text: t2 });
|
|
4284
|
+
}
|
|
4285
|
+
captureTraceMetric(e2, t2, i2) {
|
|
4286
|
+
this.capture("$ai_metric", { $ai_trace_id: String(e2), $ai_metric_name: t2, $ai_metric_value: String(i2) });
|
|
4287
|
+
}
|
|
4288
|
+
};
|
|
4289
|
+
!function(e2, t2) {
|
|
4290
|
+
for (var i2 = 0; i2 < t2.length; i2++) e2.prototype[t2[i2]] = te(e2.prototype[t2[i2]]);
|
|
4291
|
+
}(Io, ["identify"]);
|
|
4292
|
+
var Po;
|
|
4293
|
+
var Co = (Po = yo[wo] = new Io(), function() {
|
|
4294
|
+
function e2() {
|
|
4295
|
+
e2.done || (e2.done = true, So = false, K(yo, function(e3) {
|
|
4296
|
+
e3._dom_loaded();
|
|
4297
|
+
}));
|
|
4298
|
+
}
|
|
4299
|
+
null != a && a.addEventListener ? "complete" === a.readyState ? e2() : ae(a, "DOMContentLoaded", e2, { capture: false }) : t && B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized");
|
|
4300
|
+
}(), Po);
|
|
4301
|
+
export {
|
|
4302
|
+
g as COPY_AUTOCAPTURE_EVENT,
|
|
4303
|
+
e as Compression,
|
|
4304
|
+
Io as PostHog,
|
|
4305
|
+
rn as SurveyQuestionBranchingType,
|
|
4306
|
+
tn as SurveyQuestionType,
|
|
4307
|
+
sn as SurveySchedule,
|
|
4308
|
+
en as SurveyType,
|
|
4309
|
+
Co as default,
|
|
4310
|
+
v as knownUnsafeEditableEvent,
|
|
4311
|
+
Co as posthog,
|
|
4312
|
+
f as severityLevels
|
|
4313
|
+
};
|
|
4314
|
+
//# sourceMappingURL=module-QI3FML2A.mjs.map
|