@konnectio/core
Version:
Konnectio Core Frontend Integration.
948 lines (947 loc) • 31.5 kB
JavaScript
import { r as e, t } from "./chunk-BPfpcrXh.js";
import { F as n, K as r, P as i, bt as a, lt as o } from "./mitt-Dp_pykgV.js";
//#region node_modules/stackframe/stackframe.js
var s = /* @__PURE__ */ t(((e, t) => {
(function(n, r) {
/* istanbul ignore next */
typeof define == "function" && define.amd ? define("stackframe", [], r) : typeof e == "object" ? t.exports = r() : n.StackFrame = r();
})(e, function() {
function e(e) {
return !isNaN(parseFloat(e)) && isFinite(e);
}
function t(e) {
return e.charAt(0).toUpperCase() + e.substring(1);
}
function n(e) {
return function() {
return this[e];
};
}
var r = [
"isConstructor",
"isEval",
"isNative",
"isToplevel"
], i = ["columnNumber", "lineNumber"], a = [
"fileName",
"functionName",
"source"
], o = r.concat(i, a, ["args"], ["evalOrigin"]);
function s(e) {
if (e) for (var n = 0; n < o.length; n++) e[o[n]] !== void 0 && this["set" + t(o[n])](e[o[n]]);
}
s.prototype = {
getArgs: function() {
return this.args;
},
setArgs: function(e) {
if (Object.prototype.toString.call(e) !== "[object Array]") throw TypeError("Args must be an Array");
this.args = e;
},
getEvalOrigin: function() {
return this.evalOrigin;
},
setEvalOrigin: function(e) {
if (e instanceof s) this.evalOrigin = e;
else if (e instanceof Object) this.evalOrigin = new s(e);
else throw TypeError("Eval Origin must be an Object or StackFrame");
},
toString: function() {
var e = this.getFileName() || "", t = this.getLineNumber() || "", n = this.getColumnNumber() || "", r = this.getFunctionName() || "";
return this.getIsEval() ? e ? "[eval] (" + e + ":" + t + ":" + n + ")" : "[eval]:" + t + ":" + n : r ? r + " (" + e + ":" + t + ":" + n + ")" : e + ":" + t + ":" + n;
}
}, s.fromString = function(e) {
var t = e.indexOf("("), n = e.lastIndexOf(")"), r = e.substring(0, t), i = e.substring(t + 1, n).split(","), a = e.substring(n + 1);
if (a.indexOf("@") === 0) var o = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a, ""), c = o[1], l = o[2], u = o[3];
return new s({
functionName: r,
args: i || void 0,
fileName: c,
lineNumber: l || void 0,
columnNumber: u || void 0
});
};
for (var c = 0; c < r.length; c++) s.prototype["get" + t(r[c])] = n(r[c]), s.prototype["set" + t(r[c])] = (function(e) {
return function(t) {
this[e] = !!t;
};
})(r[c]);
for (var l = 0; l < i.length; l++) s.prototype["get" + t(i[l])] = n(i[l]), s.prototype["set" + t(i[l])] = (function(t) {
return function(n) {
if (!e(n)) throw TypeError(t + " must be a Number");
this[t] = Number(n);
};
})(i[l]);
for (var u = 0; u < a.length; u++) s.prototype["get" + t(a[u])] = n(a[u]), s.prototype["set" + t(a[u])] = (function(e) {
return function(t) {
this[e] = String(t);
};
})(a[u]);
return s;
});
})), c = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
(function(n, r) {
/* istanbul ignore next */
typeof define == "function" && define.amd ? define("error-stack-parser", ["stackframe"], r) : typeof e == "object" ? t.exports = r(s()) : n.ErrorStackParser = r(n.StackFrame);
})(e, function(e) {
var t = /(^|@)\S+:\d+/, n = /^\s*at .*(\S+:\d+|\(native\))/m, r = /^(eval@)?(\[native code])?$/;
return {
parse: function(e) {
if (e.stacktrace !== void 0 || e["opera#sourceloc"] !== void 0) return this.parseOpera(e);
if (e.stack && e.stack.match(n)) return this.parseV8OrIE(e);
if (e.stack) return this.parseFFOrSafari(e);
throw Error("Cannot parse given Error object");
},
extractLocation: function(e) {
if (e.indexOf(":") === -1) return [e];
var t = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g, ""));
return [
t[1],
t[2] || void 0,
t[3] || void 0
];
},
parseV8OrIE: function(t) {
return t.stack.split("\n").filter(function(e) {
return !!e.match(n);
}, this).map(function(t) {
t.indexOf("(eval ") > -1 && (t = t.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
var n = t.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), r = n.match(/ (\(.+\)$)/);
n = r ? n.replace(r[0], "") : n;
var i = this.extractLocation(r ? r[1] : n);
return new e({
functionName: r && n || void 0,
fileName: ["eval", "<anonymous>"].indexOf(i[0]) > -1 ? void 0 : i[0],
lineNumber: i[1],
columnNumber: i[2],
source: t
});
}, this);
},
parseFFOrSafari: function(t) {
return t.stack.split("\n").filter(function(e) {
return !e.match(r);
}, this).map(function(t) {
if (t.indexOf(" > eval") > -1 && (t = t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), t.indexOf("@") === -1 && t.indexOf(":") === -1) return new e({ functionName: t });
var n = /((.*".+"[^@]*)?[^@]*)(?:@)/, r = t.match(n), i = r && r[1] ? r[1] : void 0, a = this.extractLocation(t.replace(n, ""));
return new e({
functionName: i,
fileName: a[0],
lineNumber: a[1],
columnNumber: a[2],
source: t
});
}, this);
},
parseOpera: function(e) {
return !e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length ? this.parseOpera9(e) : e.stack ? this.parseOpera11(e) : this.parseOpera10(e);
},
parseOpera9: function(t) {
for (var n = /Line (\d+).*script (?:in )?(\S+)/i, r = t.message.split("\n"), i = [], a = 2, o = r.length; a < o; a += 2) {
var s = n.exec(r[a]);
s && i.push(new e({
fileName: s[2],
lineNumber: s[1],
source: r[a]
}));
}
return i;
},
parseOpera10: function(t) {
for (var n = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i, r = t.stacktrace.split("\n"), i = [], a = 0, o = r.length; a < o; a += 2) {
var s = n.exec(r[a]);
s && i.push(new e({
functionName: s[3] || void 0,
fileName: s[2],
lineNumber: s[1],
source: r[a]
}));
}
return i;
},
parseOpera11: function(n) {
return n.stack.split("\n").filter(function(e) {
return !!e.match(t) && !e.match(/^Error created at/);
}, this).map(function(t) {
var n = t.split("@"), r = this.extractLocation(n.pop()), i = n.shift() || "", a = i.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0, o;
return i.match(/\(([^)]*)\)/) && (o = i.replace(/^[^(]+\(([^)]*)\)$/, "$1")), new e({
functionName: a,
args: o === void 0 || o === "[arguments not available]" ? void 0 : o.split(","),
fileName: r[0],
lineNumber: r[1],
columnNumber: r[2],
source: t
});
}, this);
}
};
});
})))(), 1);
function l() {
typeof window > "u" || (window.addEventListener("error", (e) => {
let t = window.flare;
t && e.error instanceof Error && t.reportSilently(e.error);
}), window.addEventListener("unhandledrejection", (e) => {
let t = window.flare;
if (!t) return;
let n = e.reason;
if (n instanceof Error) {
t.reportSilently(n);
return;
}
if (d(n)) {
let e = Error(u(n));
e.stack = n.stack, t.reportSilently(e);
return;
}
Promise.resolve(t.reportUnhandledRejection(u(n))).catch(() => {});
}));
}
function u(e) {
if (typeof e == "string") return e;
if (e && typeof e == "object") {
let t = e.message;
if (typeof t == "string") return t;
try {
return JSON.stringify(e);
} catch {
return "Unhandled promise rejection (non-serializable reason)";
}
}
return String(e);
}
function d(e) {
return typeof e == "object" && !!e && "stack" in e && typeof e.stack == "string";
}
var f = typeof process < "u" ? "2.0.1" : "?", p = "5pqzBljrmDvquWZYSrSUKldIUREtPyB3", m = "\"4.5.7\"";
function h(e, t, n) {
return n && !e && console.error(`Flare JavaScript client v${f}: ${t}`), !!e;
}
function g(e) {
if (e instanceof Error) return e;
if (typeof e == "string") return Error(e);
if (typeof e == "object" && e) {
let t = e, n = typeof t.message == "string" ? t.message : String(e), r = Error(n);
return typeof t.stack == "string" && (r.stack = t.stack), typeof t.name == "string" && (r.name = t.name), r;
}
return Error(String(e));
}
function _(e, t) {
return h(e, "The client was not yet initialised with an API key. Run client.light('<flare-project-key>') when you initialise your app. If you are running in dev mode and didn't run the light command on purpose, you can ignore this error.", t);
}
var v = 64;
function y(e) {
let t = e.code;
if (!(typeof t != "string" || t.length === 0)) return t.slice(0, v);
}
function ee(e) {
return JSON.stringify(ne(e));
}
function te(e) {
if (typeof e != "object" || !e) return !1;
let t = Object.getPrototypeOf(e);
return t === Object.prototype || t === null;
}
function ne(e) {
let t = /* @__PURE__ */ new WeakSet();
function n(e) {
if (Array.isArray(e)) {
if (t.has(e)) return "[Circular]";
t.add(e);
let r = e.map(n);
return t.delete(e), r;
}
if (te(e)) {
if (t.has(e)) return "[Circular]";
t.add(e);
let r = {};
for (let [t, i] of Object.entries(e)) r[t] = n(i);
return t.delete(e), r;
}
return e;
}
return n(e);
}
function b(e) {
return e.map((e) => ({
type: "php_glow",
startTimeUnixNano: Math.round(e.microtime * 1e9),
endTimeUnixNano: null,
attributes: {
"glow.name": String(e.name),
"glow.level": e.messageLevel,
"glow.context": e.metaData ?? {}
}
}));
}
function x() {
return Math.round(Date.now() / 1e3);
}
var S = /password|passwd|pwd|token|secret|authorization|\bauth\b|bearer|oauth|credentials?|cookie|api[-_]?key|private[-_]?key|session|csrf|xsrf|\bpin\b|\bssn\b|card[-_]?number|\bcvv\b/i;
function C(e, t = !1, n = S) {
if (!e) return n;
if (t) {
let t = e.flags.replace(/[gy]/g, "");
return new RegExp(e.source, t);
}
let r = re(n.flags, e.flags);
return RegExp(`(?:${n.source})|(?:${e.source})`, r);
}
function re(e, t) {
let n = /* @__PURE__ */ new Set();
for (let r of e + t) r === "g" || r === "y" || n.add(r);
return [...n].join("");
}
function w(e, t = S) {
let n = e.indexOf("?");
if (n === -1) return e;
let r = e.indexOf("#", n), i = r === -1 ? e.length : r, a = e.slice(0, n + 1), o = e.slice(n + 1, i), s = e.slice(i);
return `${a}${o.split("&").map((e) => {
if (e === "") return e;
let n = e.indexOf("="), r = n === -1 ? e : e.slice(0, n), i = ie(r);
return t.test(i) ? n === -1 ? r : `${r}=[redacted]` : e;
}).join("&")}${s}`;
}
function ie(e) {
try {
return decodeURIComponent(e);
} catch {
return e;
}
}
var ae = class {
report(e, t, n, r, i = !1) {
return fetch(t, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"X-Api-Token": n ?? "",
"X-Report-Browser-Extension-Errors": JSON.stringify(r),
"X-Flare-Client-Version": "2"
},
body: ee(e)
}).then((e) => {
i && e.status !== 201 && console.error(`Received response with status ${e.status} from Flare`);
}, (e) => {
i && console.error(e);
});
}
};
function oe() {
if (!window.document.cookie) return {};
let e = {};
return window.document.cookie.split("; ").forEach((t) => {
let n = t.indexOf("=");
if (n === -1) {
e[t] = "";
return;
}
let r = t.slice(0, n);
e[r] = t.slice(n + 1);
}), { "http.request.cookies": e };
}
function se(e) {
return {
"url.full": w(window.location.href, e),
"user_agent.original": window.navigator.userAgent,
"http.request.referrer": w(window.document.referrer, e),
"document.ready_state": window.document.readyState
};
}
function T(e) {
return window.location.search ? { "url.query": w(window.location.search, e).replace(/^\?/, "") } : {};
}
function E(e) {
return typeof window > "u" ? {} : {
...se(e),
...T(e),
...oe()
};
}
var D = {};
function O(e, t, n) {
return new Promise((r) => {
if (!e || !t) return r({
codeSnippet: { 0: `Could not read from file: missing file URL or line number. URL: ${e} lineNumber: ${t}` },
trimmedColumnNumber: null
});
if (!k(e)) return r({
codeSnippet: { 0: `Could not read from file: unsupported URL scheme. URL: ${e}` },
trimmedColumnNumber: null
});
A(e).then((i) => r(i ? j(i, t, n) : {
codeSnippet: { 0: `Could not read from file: Error while opening file at URL ${e}` },
trimmedColumnNumber: null
}));
});
}
function k(e) {
return /^https?:\/\//i.test(e);
}
function A(e) {
return D[e] === void 0 ? fetch(e).then((e) => e.status === 200 ? e.text() : null).then((t) => (t !== null && (D[e] = t), t)).catch(() => null) : Promise.resolve(D[e]);
}
function j(e, t, n, r = 1e3, i = 40) {
let a = {}, o = null, s = e.split("\n"), c = t - 1, l = Math.floor(i / 2);
for (let e = -l; e <= l; e++) {
let i = c + e;
if (i < 0 || !s[i]) continue;
let l = i + 1, u = s[i];
if (u.length > r) {
if (n && n > r / 2) {
let e = n - Math.round(r / 2);
a[l] = u.slice(e, e + r), l === t && (o = Math.round(r / 2));
continue;
}
a[l] = u.slice(0, r) + "…";
continue;
}
a[l] = u;
}
return {
codeSnippet: a,
trimmedColumnNumber: o
};
}
function M(e, t) {
return new Promise((n) => {
if (!ce(e)) return n([N("stacktrace missing")]);
let r;
try {
r = c.default.parse(e);
} catch (r) {
return h(!1, "Couldn't parse stacktrace of below error:", t), t && (console.error(r), console.error(e)), n([N("stacktrace could not be parsed")]);
}
Promise.all(r.map((e) => O(e.fileName, e.lineNumber, e.columnNumber).then((t) => ({
lineNumber: e.lineNumber || 1,
columnNumber: e.columnNumber || 1,
method: e.functionName || "Anonymous or unknown function",
file: e.fileName || "Unknown file",
codeSnippet: t.codeSnippet,
class: "",
isApplicationFrame: le(e.fileName)
})))).then(n);
});
}
function N(e) {
return {
lineNumber: 0,
columnNumber: 0,
method: "unknown",
file: "unknown",
codeSnippet: { 0: `Could not read from file: ${e}` },
class: "unknown"
};
}
function ce(e) {
if (!e || typeof e != "object") return !1;
let t = e, n = t.stack ?? t.stacktrace ?? t["opera#sourceloc"];
return typeof n == "string" && n !== `${t.name}: ${t.message}`;
}
function le(e) {
return e ? !(/[/\\]node_modules[/\\]/.test(e) || /(^|[/\\])(vendor|vendors)[.~-][^/\\]*\.js/i.test(e)) : !0;
}
var ue = "@flareapp/js", P = new class {
_config = {
key: null,
version: "",
sourcemapVersionId: m,
stage: "",
maxGlowsPerReport: 30,
ingestUrl: "https://ingress.flareapp.io/v1/errors",
reportBrowserExtensionErrors: !1,
debug: !1,
urlDenylist: S,
replaceDefaultUrlDenylist: !1,
sampleRate: 1,
beforeEvaluate: (e) => e,
beforeSubmit: (e) => e
};
_glows = [];
pendingAttributes = {};
entryPoint = null;
sdkInfo = {
name: ue,
version: f
};
framework = null;
constructor(e = new ae()) {
this.api = e;
}
get config() {
return this._config;
}
get glows() {
return this._glows;
}
light(e = p, t) {
return this._config.key = e, t !== void 0 && (this._config.debug = t), this;
}
configure(e) {
return this._config = {
...this._config,
...e
}, e.sampleRate !== void 0 && (this._config.sampleRate = Math.max(0, Math.min(1, e.sampleRate))), this._config.urlDenylist = C(e.urlDenylist, e.replaceDefaultUrlDenylist ?? this._config.replaceDefaultUrlDenylist), this;
}
async test() {
let e = await this.createReportFromError(/* @__PURE__ */ Error("The Flare client is set up correctly!"));
if (e) return this.sendReport(e);
}
glow(e, t = "info", n = []) {
let r = x();
return this._glows.push({
name: e,
messageLevel: t,
metaData: n,
time: r,
microtime: r
}), this._glows.length > this._config.maxGlowsPerReport && (this._glows = this._glows.slice(this._glows.length - this._config.maxGlowsPerReport)), this;
}
clearGlows() {
return this._glows = [], this;
}
addContext(e, t) {
let n = this.pendingAttributes["context.custom"] ?? {};
return this.pendingAttributes["context.custom"] = {
...n,
[e]: t
}, this;
}
addContextGroup(e, t) {
return this.pendingAttributes[`context.${e}`] = t, this;
}
setEntryPoint(e) {
return this.entryPoint = e, this;
}
setSdkInfo(e) {
return this.sdkInfo = e, this;
}
setFramework(e) {
return this.framework = e, this.addContext("framework", e.name.toLowerCase()), this;
}
async report(e, t = {}) {
if (this._config.sampleRate < 1 && Math.random() >= this._config.sampleRate) return;
let n = Date.now() * 1e6, r = e instanceof Error ? e : Error(typeof e == "string" ? e : String(e)), i = await this._config.beforeEvaluate(r);
if (!i) return;
let a = await this.createReportFromError(i, t, n);
if (a) return this.sendReport(a);
}
reportSilently(e, t = {}) {
Promise.resolve(this.report(e, t)).catch(() => {});
}
async reportUnhandledRejection(e, t = {}) {
if (Math.random() >= this._config.sampleRate) return;
let n = Date.now() * 1e6, r = this.buildReport({
exceptionClass: "UnhandledRejection",
message: e,
stacktrace: [],
isLog: !1,
level: void 0,
extraAttributes: t,
code: void 0,
seenAtUnixNano: n
});
return this.sendReport(r);
}
async reportMessage(e, t, n = {}) {
if (this._config.sampleRate < 1 && Math.random() >= this._config.sampleRate) return;
let r = Date.now() * 1e6, i = await M(/* @__PURE__ */ Error(), this._config.debug);
i.shift();
let a = this.buildReport({
exceptionClass: "Log",
message: e,
stacktrace: i,
isLog: !0,
level: t,
extraAttributes: n,
code: void 0,
seenAtUnixNano: r
});
return this.sendReport(a);
}
async createReportFromError(e, t = {}, n = Date.now() * 1e6) {
if (!h(e, "No error provided.", this._config.debug)) return !1;
let r = await M(e, this._config.debug);
h(r.length, "Couldn't generate stacktrace of this error: " + e, this._config.debug);
let i = e.constructor && e.constructor.name ? e.constructor.name : "undefined";
return this.buildReport({
exceptionClass: i,
message: e.message,
stacktrace: r,
isLog: !1,
level: void 0,
extraAttributes: t,
code: y(e),
seenAtUnixNano: n
});
}
buildReport(e) {
let t = {
"telemetry.sdk.language": "javascript",
"telemetry.sdk.name": this.sdkInfo.name,
"telemetry.sdk.version": this.sdkInfo.version,
"flare.language.name": "javascript",
"flare.entry_point.type": "web"
};
typeof window < "u" && window?.location?.href && (t["flare.entry_point.value"] = w(window.location.href, this._config.urlDenylist));
let n = this.entryPoint?.identifier ?? (typeof window < "u" && window?.location?.pathname ? window.location.pathname : void 0), r = this.entryPoint?.type ?? (typeof window < "u" && window ? "browser" : void 0);
n !== void 0 && (t["flare.entry_point.handler.identifier"] = n), r !== void 0 && (t["flare.entry_point.handler.type"] = r), this.entryPoint?.name !== void 0 && (t["flare.entry_point.handler.name"] = this.entryPoint.name), this.framework?.name && (t["flare.framework.name"] = this.framework.name), this.framework?.version && (t["flare.framework.version"] = this.framework.version), this._config.stage && (t["service.stage"] = this._config.stage), this._config.version && (t["service.version"] = this._config.version);
let i = {
...t,
...E(this._config.urlDenylist),
...this.pendingAttributes,
...e.extraAttributes
}, a = this.pendingAttributes["context.custom"], o = e.extraAttributes["context.custom"];
a && o && typeof a == "object" && typeof o == "object" && !Array.isArray(a) && !Array.isArray(o) && (i["context.custom"] = {
...a,
...o
});
let s = {
exceptionClass: e.exceptionClass,
message: e.message,
seenAtUnixNano: e.seenAtUnixNano,
stacktrace: e.stacktrace,
events: b(this._glows),
attributes: i
};
return e.isLog && (s.isLog = !0), e.level !== void 0 && (s.level = e.level), this._config.sourcemapVersionId && (s.sourcemapVersionId = this._config.sourcemapVersionId), e.code !== void 0 && (s.code = e.code), s;
}
async sendReport(e) {
if (!_(this._config.key, this._config.debug)) return;
let t = await this._config.beforeSubmit(e);
if (t) return this.api.report(t, this._config.ingestUrl, this._config.key, this._config.reportBrowserExtensionErrors, this._config.debug);
}
}();
typeof window < "u" && window && (window.flare = P, l());
//#endregion
//#region src/plugins/flare.ts
var F = /* @__PURE__ */ "fancybox,jQuery,Modernizr,cssua,ScrollTrigger,calcSelectArrowDimensions,this.elements.$menu.smartmenus,woocommerce,elementor,avadaAddQuantityBoxes,fusion,FLBuilderAccordion,_initLayerSlider,Divi,gsap,Swiper,mailchimp,_AutofillCallbackHandler,$(...),imagesLoaded,accessing a cross-origin frame,scrollspy,No layout mode: packery,Vimeo,Network Error,Request aborted,timeout exceeded,Loading chunk,TrackerStorageType,Failed to load because no supported source was found.,The element has no supported sources.,grecaptcha,lightbox,priceCalcElement,AwesomeMenu,breakdance,Maximum call stack size exceeded.,Cookies is not defined,getUniqId,Cannot read properties of null (reading 'classList'),n.getModal,e.target.closest is not a function,Cannot read properties of undefined (reading 'Item'),refreshFsLightbox,fbq,Cannot assign to read only property 'push' of object '[object Array]',naturalWidth,Request failed with status code,Can't find variable: _,astraNavMenuTogglePro,The operation was aborted.,Failed to fetch dynamically imported module:,Importing a module script failed.,The request is not allowed by the user agent,this.Vi.close,The operation is insecure.,gformValidateFileSize,BreakdanceEntrance,Cannot read properties of undefined (reading '__'),The play() request was interrupted because video-only,Animation is interrupted by user input.,Animation is already playing.,Position \"NaN\" is not reachable.,Cannot redefine property: onbeforeunload,e.remove is not a function,Can't find variable: Cookies,Load failed,wp is not defined,Backbone,Invalid attempt to destructure non-iterable instance,Can't find variable: EmptyRanges,Cannot read properties of undefined (reading 'setLocaleData'),Function snaptr not implemented.,window.sbi_init is not a function".split(",");
P.light("5pqzBljrmDvquWZYSrSUKldIUREtPyB3"), P.addContext("version", "4.5.7"), P.beforeEvaluate = (e) => {
for (let t = 0; t < F.length; t++) if (e.message.includes(F[t])) return !1;
return e;
};
//#endregion
//#region node_modules/@flareapp/vue/dist/index.mjs
var I = typeof process < "u" && process.env?.PACKAGE_VERSION !== void 0 ? process.env.PACKAGE_VERSION : "?", L = 50, R = /password|passwd|pwd|token|secret|authorization|\bauth\b|bearer|oauth|credentials?|cookie|api[-_]?key|private[-_]?key|session|csrf|xsrf|\bpin\b|\bssn\b|card[-_]?number|\bcvv\b/i;
function z(e, t = !1) {
return C(e, t, R);
}
var B = 1e3, V = 100, H = 100, de = {
"setup function": "setup",
"render function": "render",
"component update": "render",
"watcher getter": "watcher",
"watcher callback": "watcher",
"watcher cleanup function": "watcher",
"native event handler": "event",
"component event handler": "event",
"beforeCreate hook": "lifecycle",
"created hook": "lifecycle",
"beforeMount hook": "lifecycle",
"mounted hook": "lifecycle",
"beforeUpdate hook": "lifecycle",
"updated hook": "lifecycle",
"beforeUnmount hook": "lifecycle",
"unmounted hook": "lifecycle",
"activated hook": "lifecycle",
"deactivated hook": "lifecycle",
"errorCaptured hook": "lifecycle",
"renderTracked hook": "lifecycle",
"renderTriggered hook": "lifecycle",
"serverPrefetch hook": "lifecycle",
"vnode hook": "lifecycle",
"directive hook": "lifecycle",
"transition hook": "lifecycle",
"ref function": "setup",
"async component loader": "setup",
"scheduler flush": "render",
"app errorHandler": "lifecycle",
"app warnHandler": "lifecycle",
"app unmount cleanup function": "lifecycle",
0: "setup",
1: "render",
2: "watcher",
3: "watcher",
4: "watcher",
5: "event",
6: "event",
7: "lifecycle",
8: "lifecycle",
9: "lifecycle",
10: "lifecycle",
11: "lifecycle",
12: "setup",
13: "setup",
14: "render",
15: "render",
16: "lifecycle",
sp: "lifecycle",
bc: "lifecycle",
c: "lifecycle",
bm: "lifecycle",
m: "lifecycle",
bu: "lifecycle",
u: "lifecycle",
bum: "lifecycle",
um: "lifecycle",
a: "lifecycle",
da: "lifecycle",
ec: "lifecycle",
rtc: "lifecycle",
rtg: "lifecycle"
};
function U(e) {
if (!e) return "AnonymousComponent";
let t = e.$options;
return t.__name || t.name || "AnonymousComponent";
}
function W(e) {
let t = [], n = e;
for (; n && t.length < L;) t.push(U(n)), n = n.$parent;
return t;
}
function G(e, t, n = R) {
return K(e, 0, t, /* @__PURE__ */ new WeakSet(), n);
}
function K(e, t, n, r, i) {
if (e === null) return null;
let a = typeof e;
if (a === "function") return "[Function]";
if (a === "symbol") return "[Symbol]";
if (a === "bigint") return e.toString();
if (a === "string") return fe(e);
if (a !== "object") return e;
if (r.has(e)) return "[Circular]";
if (Array.isArray(e)) {
if (t > n) return "[Array]";
r.add(e);
let a = (e.length > V ? e.slice(0, V) : e).map((e) => K(e, t + 1, n, r, i));
return e.length > V && a.push(`[… ${e.length - V} more items]`), r.delete(e), a;
}
if (!q(e) || t > n) return "[Object]";
r.add(e);
let o = {}, s = Object.keys(e), c = s.length > H ? s.slice(0, H) : s;
for (let a of c) {
if (i.test(a)) {
o[a] = "[redacted]";
continue;
}
o[a] = K(e[a], t + 1, n, r, i);
}
return s.length > H && (o["…"] = `[${s.length - H} more keys]`), r.delete(e), o;
}
function fe(e) {
return e.length <= B ? e : `${e.slice(0, B)}…[truncated ${e.length - B} chars]`;
}
function q(e) {
if (typeof e != "object" || !e) return !1;
let t = Object.getPrototypeOf(e);
return t === null || t === Object.prototype;
}
function J(e, t) {
let n = [], r = e;
for (; r && n.length < L;) {
let e = r.$options, i = {
component: U(r),
file: e.__file ?? null
};
t.attachProps && r.$props && (i.props = G(r.$props, t.propsMaxDepth, t.propsDenylist)), n.push(i), r = r.$parent;
}
return n;
}
function Y(e) {
return de[e] ?? "unknown";
}
var X = 2;
function Z(e, t = {}) {
if (!e || typeof e != "object" || !("currentRoute" in e)) return null;
let n = e.currentRoute;
if (!n || typeof n != "object" || !("value" in n)) return null;
let r = n.value;
if (!r || typeof r != "object") return null;
let i = r, a = i.name, o = t.denylist ?? R, s = i.params && typeof i.params == "object" ? i.params : {}, c = i.query && typeof i.query == "object" ? i.query : {};
return {
name: typeof a == "string" ? a : typeof a == "symbol" ? a.toString() : null,
path: typeof i.path == "string" ? i.path : "",
fullPath: typeof i.fullPath == "string" ? w(i.fullPath, o) : "",
params: G(s, X, o),
query: G(c, X, o),
hash: typeof i.hash == "string" ? i.hash : "",
matched: Array.isArray(i.matched) ? i.matched.map((e) => {
if (!e || typeof e != "object") return "unknown";
let t = e.name;
return typeof t == "string" ? t : typeof t == "symbol" ? t.toString() : "unknown";
}) : []
};
}
function Q(e) {
let t = {
info: e.vue.info,
errorOrigin: e.vue.errorOrigin,
componentName: e.vue.componentName,
componentHierarchy: e.vue.componentHierarchy,
componentHierarchyFrames: e.vue.componentHierarchyFrames
};
return e.vue.componentProps && (t.componentProps = e.vue.componentProps), e.vue.route && (t.route = e.vue.route), { "context.custom": { vue: t } };
}
function pe(e) {
let t = {
type: e.vue.type,
info: e.vue.info,
componentName: e.vue.componentName,
componentTrace: e.vue.componentTrace
};
return e.vue.route && (t.route = e.vue.route), { "context.custom": { vue: t } };
}
var $ = /* @__PURE__ */ new WeakSet(), me = (e, t) => {
if ($.has(e)) return;
$.add(e), P.setSdkInfo({
name: "@flareapp/vue",
version: I
}), P.setFramework({
name: "Vue",
version: e.version
});
let n = t?.attachProps ?? !1, r = t?.propsMaxDepth ?? 2, i = z(t?.propsDenylist, t?.replaceDefaultDenylist), a = e.config.errorHandler;
if (e.config.errorHandler = (o, s, c) => {
let l = g(o);
t?.beforeEvaluate?.({
error: l,
instance: s,
info: c
});
let u = Y(c), d = U(s), f = n && s?.$props ? G(s.$props, r, i) : void 0, p = W(s), m = J(s, {
attachProps: n,
propsMaxDepth: r,
propsDenylist: i
}), h = Z(e.config.globalProperties.$router, { denylist: i }), _ = { vue: {
info: c,
errorOrigin: u,
componentName: d,
...f && { componentProps: f },
componentHierarchy: p,
componentHierarchyFrames: m,
...h && { route: h }
} }, v = t?.beforeSubmit?.({
error: l,
instance: s,
info: c,
context: _
}) ?? _;
if (P.reportSilently(l, Q(v)), t?.afterSubmit?.({
error: l,
instance: s,
info: c,
context: v
}), typeof a == "function") {
a(o, s, c);
return;
}
console.error(o);
}, t?.captureWarnings) {
let t = e.config.warnHandler;
e.config.warnHandler = (n, r, a) => {
let o = U(r), s = Z(e.config.globalProperties.$router, { denylist: i }), c = { vue: {
type: "warning",
info: n,
componentName: o,
componentTrace: a,
...s && { route: s }
} };
Promise.resolve(P.reportMessage(n, "warning", pe(c))).catch(() => {}), typeof t == "function" && t(n, r, a);
};
}
};
i({
name: "FlareErrorBoundary",
props: {
beforeEvaluate: {
type: Function,
default: void 0
},
beforeSubmit: {
type: Function,
default: void 0
},
afterSubmit: {
type: Function,
default: void 0
},
onReset: {
type: Function,
default: void 0
},
resetKeys: {
type: Array,
default: void 0
},
attachProps: {
type: Boolean,
default: !1
},
propsMaxDepth: {
type: Number,
default: 2
},
propsDenylist: {
type: RegExp,
default: void 0
},
replaceDefaultDenylist: {
type: Boolean,
default: !1
}
},
setup(e, { slots: t }) {
let i = n(), s = a(null), c = a(void 0), l = a([]), u = a([]), d = () => {
e.onReset?.(s.value), s.value = null, c.value = void 0, l.value = [], u.value = [];
};
return o(() => e.resetKeys, (e, t) => {
if (s.value === null || !e || !t) return;
let n = t.length !== e.length, r = e.some((e, n) => !Object.is(e, t[n]));
(n || r) && d();
}), r((t, n, r) => {
let a = g(t);
e.beforeEvaluate?.({
error: a,
instance: n,
info: r
});
let o = z(e.propsDenylist, e.replaceDefaultDenylist), d = W(n), f = J(n, {
attachProps: e.attachProps,
propsMaxDepth: e.propsMaxDepth,
propsDenylist: o
}), p = U(n);
s.value = a;
let m = e.attachProps && n?.$props ? G(n.$props, e.propsMaxDepth, o) : void 0, h = Y(r), _ = Z(i?.appContext.config.globalProperties.$router, { denylist: o }), v = { vue: {
info: r,
errorOrigin: h,
..._ && { route: _ },
componentName: p,
...m && { componentProps: m },
componentHierarchy: d,
componentHierarchyFrames: f
} }, y = e.beforeSubmit?.({
error: a,
instance: n,
info: r,
context: v
}) ?? v;
return c.value = y.vue.componentProps, l.value = y.vue.componentHierarchy, u.value = y.vue.componentHierarchyFrames, P.reportSilently(a, Q(y)), e.afterSubmit?.({
error: a,
instance: n,
info: r,
context: y
}), !1;
}), () => s.value === null ? t.default?.() : t.fallback ? t.fallback({
error: s.value,
...c.value && { componentProps: c.value },
componentHierarchy: l.value,
componentHierarchyFrames: u.value,
resetErrorBoundary: d
}) : null;
}
});
//#endregion
export { me as t };