@sailfish-ai/sf-veritas 0.1.35 → 0.2.2

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.
Files changed (34) hide show
  1. package/dist/funcSpanTransformer-CTddGtUV.cjs +1 -0
  2. package/dist/funcSpanTransformer-coYDqcrs.js +136 -0
  3. package/dist/plugins/funcspanEsbuildPlugin.cjs +1 -0
  4. package/dist/plugins/funcspanEsbuildPlugin.mjs +21 -0
  5. package/dist/plugins/funcspanRollupPlugin.cjs +1 -0
  6. package/dist/plugins/funcspanRollupPlugin.mjs +18 -0
  7. package/dist/plugins/funcspanTscPlugin.cjs +1 -0
  8. package/dist/plugins/funcspanTscPlugin.mjs +39 -0
  9. package/dist/plugins/funcspanVitePlugin.cjs +1 -0
  10. package/dist/plugins/funcspanVitePlugin.mjs +17 -0
  11. package/dist/plugins/funcspanWebpackLoader.cjs +1 -0
  12. package/dist/plugins/funcspanWebpackLoader.mjs +15 -0
  13. package/dist/plugins/funcspanWebpackPlugin.cjs +1 -0
  14. package/dist/plugins/funcspanWebpackPlugin.mjs +28 -0
  15. package/dist/sf-veritas.cjs +38 -20
  16. package/dist/sf-veritas.mjs +850 -1239
  17. package/dist/source-map-Cr6YkjTd.js +631 -0
  18. package/dist/source-map-rHHEdpre.cjs +1 -0
  19. package/dist/types/baseTransmitter.d.ts +2 -1
  20. package/dist/types/contextManager.d.ts +23 -0
  21. package/dist/types/exceptionTransmitter.d.ts +1 -1
  22. package/dist/types/funcSpanCapture.d.ts +24 -0
  23. package/dist/types/funcSpanConfig.d.ts +83 -0
  24. package/dist/types/funcSpanConfigLoader.d.ts +70 -0
  25. package/dist/types/index.d.ts +4 -1
  26. package/dist/types/networkRequestTransmitter.d.ts +1 -0
  27. package/dist/types/plugins/funcSpanTransformer.d.ts +31 -0
  28. package/dist/types/plugins/funcspanEsbuildPlugin.d.ts +28 -0
  29. package/dist/types/plugins/funcspanRollupPlugin.d.ts +28 -0
  30. package/dist/types/plugins/funcspanTscPlugin.d.ts +35 -0
  31. package/dist/types/plugins/funcspanVitePlugin.d.ts +27 -0
  32. package/dist/types/plugins/funcspanWebpackLoader.d.ts +1 -0
  33. package/dist/types/plugins/funcspanWebpackPlugin.d.ts +32 -0
  34. package/package.json +49 -3
@@ -1,50 +1,54 @@
1
- var xe = Object.defineProperty;
2
- var ze = (i, n, s) => n in i ? xe(i, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[n] = s;
3
- var y = (i, n, s) => ze(i, typeof n != "symbol" ? n + "" : n, s);
4
- import { AsyncLocalStorage as Ye } from "async_hooks";
5
- import { readFileSync as Ue } from "fs";
6
- import { Worker as ke } from "worker_threads";
7
- const G = [];
8
- for (let i = 0; i < 256; ++i) G.push((i + 256).toString(16).slice(1));
9
- let te;
10
- const $e = new Uint8Array(16), Ie = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
11
- function J(i, n, s) {
12
- if (Ie.randomUUID && !i) return Ie.randomUUID();
13
- const l = (i = i || {}).random ?? i.rng?.() ?? (function() {
14
- if (!te) {
1
+ var fe = Object.defineProperty;
2
+ var ye = (s, e, t) => e in s ? fe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var u = (s, e, t) => ye(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { AsyncLocalStorage as te } from "async_hooks";
5
+ import * as $ from "fs";
6
+ import { readFileSync as ue } from "fs";
7
+ import { s as Ce } from "./source-map-Cr6YkjTd.js";
8
+ import { Worker as Se } from "worker_threads";
9
+ import * as v from "path";
10
+ import { glob as Ze } from "glob";
11
+ const S = [];
12
+ for (let s = 0; s < 256; ++s) S.push((s + 256).toString(16).slice(1));
13
+ let k;
14
+ const Ge = new Uint8Array(16), oe = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
15
+ function H(s, e, t) {
16
+ if (oe.randomUUID && !s) return oe.randomUUID();
17
+ const i = (s = s || {}).random ?? s.rng?.() ?? (function() {
18
+ if (!k) {
15
19
  if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
16
- te = crypto.getRandomValues.bind(crypto);
20
+ k = crypto.getRandomValues.bind(crypto);
17
21
  }
18
- return te($e);
22
+ return k(Ge);
19
23
  })();
20
- if (l.length < 16) throw new Error("Random bytes length must be >= 16");
21
- return l[6] = 15 & l[6] | 64, l[8] = 63 & l[8] | 128, (function(a, t = 0) {
22
- return (G[a[t + 0]] + G[a[t + 1]] + G[a[t + 2]] + G[a[t + 3]] + "-" + G[a[t + 4]] + G[a[t + 5]] + "-" + G[a[t + 6]] + G[a[t + 7]] + "-" + G[a[t + 8]] + G[a[t + 9]] + "-" + G[a[t + 10]] + G[a[t + 11]] + G[a[t + 12]] + G[a[t + 13]] + G[a[t + 14]] + G[a[t + 15]]).toLowerCase();
23
- })(l);
24
+ if (i.length < 16) throw new Error("Random bytes length must be >= 16");
25
+ return i[6] = 15 & i[6] | 64, i[8] = 63 & i[8] | 128, (function(n, o = 0) {
26
+ return (S[n[o + 0]] + S[n[o + 1]] + S[n[o + 2]] + S[n[o + 3]] + "-" + S[n[o + 4]] + S[n[o + 5]] + "-" + S[n[o + 6]] + S[n[o + 7]] + "-" + S[n[o + 8]] + S[n[o + 9]] + "-" + S[n[o + 10]] + S[n[o + 11]] + S[n[o + 12]] + S[n[o + 13]] + S[n[o + 14]] + S[n[o + 15]]).toLowerCase();
27
+ })(i);
24
28
  }
25
- class Pe {
26
- constructor(n) {
27
- y(this, "apiKey");
28
- y(this, "apiGraphqlEndpoint");
29
- y(this, "sfDebug");
30
- y(this, "serviceIdentifier");
31
- y(this, "serviceVersion");
32
- y(this, "serviceUUID");
33
- y(this, "serviceAdditionalMetadata");
34
- y(this, "profilingModeEnabled");
35
- y(this, "profilingMaxDepth");
36
- y(this, "profilingMaxVariableSizeKb");
37
- y(this, "domainsToNotPropagateHeadersTo");
38
- y(this, "nodeModulesToCollectLocalVariablesOn");
39
- y(this, "printConfigurationStatuses");
40
- y(this, "logLevel");
41
- y(this, "stackDepthLocals");
42
- y(this, "stackDepthCodeTraceDepth");
43
- y(this, "packageLibraryType");
44
- y(this, "version");
45
- y(this, "gitSha");
46
- y(this, "_serviceIdentificationReceived", !1);
47
- this.apiKey = n.apiKey, this.apiGraphqlEndpoint = n?.apiGraphqlEndpoint || process.env.SAILFISH_GRAPHQL_ENDPOINT || "https://api-service.sailfishqa.com/graphql/", this.sfDebug = n?.debug === !0 || process.env.SF_DEBUG === "true", this.serviceIdentifier = n?.serviceIdentifier || process.env.SERVICE_IDENTIFIER, this.serviceUUID = J(), this.serviceVersion = n?.serviceVersion || process.env.SERVICE_VERSION, this.gitSha = n?.gitSha || process.env.GIT_SHA || process.env.VERCEL_GIT_COMMIT_SHA, this.serviceAdditionalMetadata = n?.serviceAdditionalMetadata || {}, this.profilingModeEnabled = n?.profilingModeEnabled ?? !1, this.profilingMaxDepth = n?.profilingMaxDepth ?? 5, this.profilingMaxVariableSizeKb = n?.profilingMaxVariableSizeKb ?? 25, this.domainsToNotPropagateHeadersTo = n?.domainsToNotPropagateHeadersTo || [], this.nodeModulesToCollectLocalVariablesOn = n?.nodeModulesToCollectLocalVariablesOn || ["_all_"], this.printConfigurationStatuses = process.env.PRINT_CONFIGURATION_STATUSES || "true", this.logLevel = process.env.LOG_LEVEL || "INFO", this.stackDepthLocals = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS, 10) : 5, isNaN(this.stackDepthLocals) && (this.stackDepthLocals = -1), this.stackDepthCodeTraceDepth = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH, 10) : -1, isNaN(this.stackDepthCodeTraceDepth) && (this.stackDepthCodeTraceDepth = -1), this.packageLibraryType = "JS/TS BACKEND", this.version = this.getPackageVersion();
29
+ class ve {
30
+ constructor(e) {
31
+ u(this, "apiKey");
32
+ u(this, "apiGraphqlEndpoint");
33
+ u(this, "sfDebug");
34
+ u(this, "serviceIdentifier");
35
+ u(this, "serviceVersion");
36
+ u(this, "serviceUUID");
37
+ u(this, "serviceAdditionalMetadata");
38
+ u(this, "profilingModeEnabled");
39
+ u(this, "profilingMaxDepth");
40
+ u(this, "profilingMaxVariableSizeKb");
41
+ u(this, "domainsToNotPropagateHeadersTo");
42
+ u(this, "nodeModulesToCollectLocalVariablesOn");
43
+ u(this, "printConfigurationStatuses");
44
+ u(this, "logLevel");
45
+ u(this, "stackDepthLocals");
46
+ u(this, "stackDepthCodeTraceDepth");
47
+ u(this, "packageLibraryType");
48
+ u(this, "version");
49
+ u(this, "gitSha");
50
+ u(this, "_serviceIdentificationReceived", !1);
51
+ this.apiKey = e.apiKey, this.apiGraphqlEndpoint = e?.apiGraphqlEndpoint || process.env.SAILFISH_GRAPHQL_ENDPOINT || "https://api-service.sailfishqa.com/graphql/", this.sfDebug = e?.debug === !0 || process.env.SF_DEBUG === "true", this.serviceIdentifier = e?.serviceIdentifier || process.env.SERVICE_IDENTIFIER, this.serviceUUID = H(), this.serviceVersion = e?.serviceVersion || process.env.SERVICE_VERSION, this.gitSha = e?.gitSha || process.env.GIT_SHA || process.env.VERCEL_GIT_COMMIT_SHA, this.serviceAdditionalMetadata = e?.serviceAdditionalMetadata || {}, this.profilingModeEnabled = e?.profilingModeEnabled ?? !1, this.profilingMaxDepth = e?.profilingMaxDepth ?? 5, this.profilingMaxVariableSizeKb = e?.profilingMaxVariableSizeKb ?? 25, this.domainsToNotPropagateHeadersTo = e?.domainsToNotPropagateHeadersTo || [], this.nodeModulesToCollectLocalVariablesOn = e?.nodeModulesToCollectLocalVariablesOn || ["_all_"], this.printConfigurationStatuses = process.env.PRINT_CONFIGURATION_STATUSES || "true", this.logLevel = process.env.LOG_LEVEL || "INFO", this.stackDepthLocals = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_LOCALS, 10) : 5, isNaN(this.stackDepthLocals) && (this.stackDepthLocals = -1), this.stackDepthCodeTraceDepth = process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH !== void 0 ? parseInt(process.env.SAILFISH_EXCEPTION_STACK_DEPTH_CODE_TRACE_DEPTH, 10) : -1, isNaN(this.stackDepthCodeTraceDepth) && (this.stackDepthCodeTraceDepth = -1), this.packageLibraryType = "JS/TS BACKEND", this.version = this.getPackageVersion();
48
52
  }
49
53
  getPackageVersion() {
50
54
  return "0.1.15";
@@ -52,71 +56,71 @@ class Pe {
52
56
  get serviceIdentificationReceived() {
53
57
  return this._serviceIdentificationReceived;
54
58
  }
55
- setServiceIdentificationReceived(n) {
56
- this._serviceIdentificationReceived = n;
59
+ setServiceIdentificationReceived(e) {
60
+ this._serviceIdentificationReceived = e;
57
61
  }
58
62
  }
59
- const Fe = Symbol.for("sailfish.sf_config");
60
- function Ke() {
61
- return globalThis[Fe];
63
+ const pe = Symbol.for("sailfish.sf_config");
64
+ function he() {
65
+ return globalThis[pe];
62
66
  }
63
- function je(i) {
64
- const n = Ke();
65
- if (n) return { config: n };
66
- const s = new Pe(i);
67
- return (function(l) {
68
- globalThis[Fe] = l;
69
- })(s), s.sfDebug && console.log("[[getOrCreateConfig]] Created global config:", s), { config: s };
67
+ function Be(s) {
68
+ const e = he();
69
+ if (e) return { config: e };
70
+ const t = new ve(s);
71
+ return (function(i) {
72
+ globalThis[pe] = i;
73
+ })(t), t.sfDebug && console.log("[[getOrCreateConfig]] Created global config:", t), { config: t };
70
74
  }
71
- function A() {
72
- const i = Ke();
73
- if (!i) throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");
74
- return i;
75
+ function l() {
76
+ const s = he();
77
+ if (!s) throw new Error("Configuration has not been initialized. Call getOrCreateConfig(options) first.");
78
+ return s;
75
79
  }
76
- const pe = Symbol.for("sf.ctx.storeAls"), _ = globalThis, ne = _[pe] ?? (_[pe] = new Ye()), Xe = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"], he = Symbol.for("sf.ctx.als"), X = _[he] ?? (_[he] = new Ye()), Ce = Symbol.for("sf.ctx.sessionRegistry"), U = _[Ce] ?? (_[Ce] = /* @__PURE__ */ new Map()), z = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1, excludedDomains: new Set(Xe), supportedDomains: /* @__PURE__ */ new Set() }, L = class L {
80
+ const se = Symbol.for("sf.ctx.storeAls"), W = globalThis, O = W[se] ?? (W[se] = new te()), Ae = ["identitytoolkit.googleapis.com", "t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com"], re = Symbol.for("sf.ctx.als"), U = W[re] ?? (W[re] = new te()), ae = Symbol.for("sf.ctx.sessionRegistry"), Y = W[ae] ?? (W[ae] = /* @__PURE__ */ new Map()), _ = { handledExceptions: /* @__PURE__ */ new Set(), reentrancyGuardLoggingActive: !1, reentrancyGuardLoggingPreActive: !1, reentrancyGuardPrintActive: !1, reentrancyGuardPrintPreActive: !1, reentrancyGuardExceptionActive: !1, reentrancyGuardExceptionPreActive: !1, excludedDomains: new Set(Ae), supportedDomains: /* @__PURE__ */ new Set() }, V = class V {
77
81
  constructor() {
78
82
  }
79
83
  current() {
80
- return ne.getStore();
84
+ return O.getStore();
81
85
  }
82
86
  ensureStore() {
83
- const n = this.current();
84
- if (n) return n;
85
- const s = /* @__PURE__ */ new Map();
86
- return ne.enterWith(s), s;
87
+ const e = this.current();
88
+ if (e) return e;
89
+ const t = /* @__PURE__ */ new Map();
90
+ return O.enterWith(t), t;
87
91
  }
88
- runWith(n, s) {
89
- const l = this.current() ?? /* @__PURE__ */ new Map(), a = new Map(l);
90
- for (const [t, o] of Object.entries(n)) a.set(t, o);
91
- return ne.run(a, s);
92
+ runWith(e, t) {
93
+ const i = this.current() ?? /* @__PURE__ */ new Map(), n = new Map(i);
94
+ for (const [o, a] of Object.entries(e)) n.set(o, a);
95
+ return O.run(n, t);
92
96
  }
93
97
  static getInstance() {
94
- return _[L.GLOBAL_MANAGER_SYMBOL] || (_[L.GLOBAL_MANAGER_SYMBOL] = new L()), _[L.GLOBAL_MANAGER_SYMBOL];
98
+ return W[V.GLOBAL_MANAGER_SYMBOL] || (W[V.GLOBAL_MANAGER_SYMBOL] = new V()), W[V.GLOBAL_MANAGER_SYMBOL];
95
99
  }
96
100
  getCurrentContext() {
97
- return X.getStore() || z;
101
+ return U.getStore() || _;
98
102
  }
99
- setCurrentContext(n) {
100
- const s = X.getStore() || z;
101
- X.enterWith({ ...s, ...n });
103
+ setCurrentContext(e) {
104
+ const t = U.getStore() || _;
105
+ U.enterWith({ ...t, ...e });
102
106
  }
103
- ensureSession(n) {
104
- let s = U.get(n);
105
- return s || (s = { ...z }, U.set(n, s)), s;
107
+ ensureSession(e) {
108
+ let t = Y.get(e);
109
+ return t || (t = { ..._ }, Y.set(e, t)), t;
106
110
  }
107
- getContextFor(n) {
108
- return U.get(n) ?? z;
111
+ getContextFor(e) {
112
+ return Y.get(e) ?? _;
109
113
  }
110
- updateContextFor(n, s) {
111
- const l = this.ensureSession(n);
112
- U.set(n, { ...l, ...s });
114
+ updateContextFor(e, t) {
115
+ const i = this.ensureSession(e);
116
+ Y.set(e, { ...i, ...t });
113
117
  }
114
- runWithSession(n, s) {
115
- const l = { ...this.ensureSession(n) };
116
- return X.run(l, s);
118
+ runWithSession(e, t) {
119
+ const i = { ...this.ensureSession(e) };
120
+ return U.run(i, t);
117
121
  }
118
- deleteSession(n) {
119
- U.delete(n);
122
+ deleteSession(e) {
123
+ Y.delete(e);
120
124
  }
121
125
  getTraceId() {
122
126
  return this.getCurrentContext().traceId;
@@ -124,29 +128,38 @@ const pe = Symbol.for("sf.ctx.storeAls"), _ = globalThis, ne = _[pe] ?? (_[pe] =
124
128
  getPageVisitUUID() {
125
129
  return this.getCurrentContext().pageVisitUUID;
126
130
  }
127
- setTraceId(n) {
128
- this.setCurrentContext({ traceId: n });
131
+ setTraceId(e) {
132
+ this.setCurrentContext({ traceId: e });
133
+ }
134
+ setPageVisitUUID(e) {
135
+ this.setCurrentContext({ pageVisitUUID: e });
136
+ }
137
+ getCurrentFunctionSpanId() {
138
+ return this.getCurrentContext().currentFunctionSpanId;
139
+ }
140
+ setCurrentFunctionSpanId(e) {
141
+ this.setCurrentContext({ currentFunctionSpanId: e });
129
142
  }
130
- setPageVisitUUID(n) {
131
- this.setCurrentContext({ pageVisitUUID: n });
143
+ clearCurrentFunctionSpanId() {
144
+ this.setCurrentContext({ currentFunctionSpanId: void 0 });
132
145
  }
133
- getOrSetSfTraceId(n, s = !1) {
134
- let l = this.getTraceId();
135
- return l || (l = n || (s ? J() : `nonsession-applogs-v3/${A().apiKey}/${J()}`), this.setTraceId(l), A().sfDebug && console.log(" Created new trace ID:", l), l);
146
+ getOrSetSfTraceId(e, t = !1) {
147
+ let i = this.getTraceId();
148
+ return i || (i = e || (t ? H() : `nonsession-applogs-v3/${l().apiKey}/${H()}`), this.setTraceId(i), l().sfDebug && console.log(" Created new trace ID:", i), i);
136
149
  }
137
150
  getOrSetPageVisitUUID() {
138
- let n = this.getPageVisitUUID();
139
- return n || (n = J(), this.setPageVisitUUID(n), A().sfDebug && console.log(" Created new page visit UUID:", n), n);
151
+ let e = this.getPageVisitUUID();
152
+ return e || (e = H(), this.setPageVisitUUID(e), l().sfDebug && console.log(" Created new page visit UUID:", e), e);
140
153
  }
141
154
  getHandledExceptions() {
142
155
  return this.getCurrentContext().handledExceptions;
143
156
  }
144
- markExceptionHandled(n) {
145
- const s = this.getHandledExceptions();
146
- s.add(n), this.setCurrentContext({ handledExceptions: s });
157
+ markExceptionHandled(e) {
158
+ const t = this.getHandledExceptions();
159
+ t.add(e), this.setCurrentContext({ handledExceptions: t });
147
160
  }
148
- hasHandledException(n) {
149
- return this.getHandledExceptions().has(n);
161
+ hasHandledException(e) {
162
+ return this.getHandledExceptions().has(e);
150
163
  }
151
164
  resetHandledExceptions() {
152
165
  this.setCurrentContext({ handledExceptions: /* @__PURE__ */ new Set() });
@@ -157,94 +170,97 @@ const pe = Symbol.for("sf.ctx.storeAls"), _ = globalThis, ne = _[pe] ?? (_[pe] =
157
170
  getSupportedDomains() {
158
171
  return this.getCurrentContext().supportedDomains;
159
172
  }
160
- addSupportedDomains(n) {
161
- this.getCurrentContext().supportedDomains.add(n.toLowerCase().trim());
173
+ addSupportedDomains(e) {
174
+ this.getCurrentContext().supportedDomains.add(e.toLowerCase().trim());
162
175
  }
163
- setTraceIdFor(n, s) {
164
- this.updateContextFor(n, { traceId: s });
176
+ setTraceIdFor(e, t) {
177
+ this.updateContextFor(e, { traceId: t });
165
178
  }
166
- setPageVisitUUIDFor(n, s) {
167
- this.updateContextFor(n, { pageVisitUUID: s });
179
+ setPageVisitUUIDFor(e, t) {
180
+ this.updateContextFor(e, { pageVisitUUID: t });
168
181
  }
169
182
  };
170
- y(L, "GLOBAL_MANAGER_SYMBOL", Symbol.for("sf.ctx.manager"));
171
- let N = L;
172
- function ft(i) {
173
- const n = { ...N.getInstance().getCurrentContext() };
174
- X.run(n, () => {
175
- i();
183
+ u(V, "GLOBAL_MANAGER_SYMBOL", Symbol.for("sf.ctx.manager"));
184
+ let G = V;
185
+ function Ne(s) {
186
+ const e = { ...G.getInstance().getCurrentContext() };
187
+ U.run(e, () => {
188
+ s();
176
189
  });
177
190
  }
178
- class E {
191
+ function P() {
192
+ return G.getInstance().getCurrentFunctionSpanId();
193
+ }
194
+ class R {
179
195
  constructor() {
180
- y(this, "apiKey");
181
- y(this, "endpoint");
182
- y(this, "queryType", "mutation");
183
- y(this, "operationName", "");
184
- y(this, "serviceUUID", A().serviceUUID);
185
- y(this, "contextManager");
186
- this.apiKey = A().apiKey, this.endpoint = A().apiGraphqlEndpoint, this.contextManager = N.getInstance();
196
+ u(this, "apiKey");
197
+ u(this, "endpoint");
198
+ u(this, "queryType", "mutation");
199
+ u(this, "operationName", "");
200
+ u(this, "serviceUUID", l().serviceUUID);
201
+ u(this, "contextManager");
202
+ this.apiKey = l().apiKey, this.endpoint = l().apiGraphqlEndpoint, this.contextManager = G.getInstance();
187
203
  }
188
204
  get queryName() {
189
205
  return this.operationName ? this.operationName.charAt(0).toLowerCase() + this.operationName.slice(1) : "";
190
206
  }
191
207
  getDefaultVariables() {
192
- const n = Date.now().toString(), s = this.contextManager.getOrSetSfTraceId();
193
- return { apiKey: this.apiKey, serviceUuid: this.serviceUUID, sessionId: s, timestampMs: n };
208
+ const e = Date.now().toString(), t = this.contextManager.getOrSetSfTraceId(), i = this.contextManager.getCurrentFunctionSpanId();
209
+ return { apiKey: this.apiKey, serviceUuid: this.serviceUUID, sessionId: t, timestampMs: e, parentSpanId: i };
194
210
  }
195
- getVariables(n = {}) {
196
- return { ...this.getDefaultVariables(), ...n };
211
+ getVariables(e = {}) {
212
+ return { ...this.getDefaultVariables(), ...e };
197
213
  }
198
- setOperationName(n) {
199
- this.operationName = n;
214
+ setOperationName(e) {
215
+ this.operationName = e;
200
216
  }
201
- setEndpoint(n) {
202
- this.endpoint = n;
217
+ setEndpoint(e) {
218
+ this.endpoint = e;
203
219
  }
204
- setServiceUUID(n) {
205
- this.serviceUUID = n;
220
+ setServiceUUID(e) {
221
+ this.serviceUUID = e;
206
222
  }
207
223
  }
208
- const Qe = fetch;
209
- async function H(i, n, s, l) {
224
+ const We = fetch;
225
+ async function F(s, e, t, i) {
210
226
  try {
211
- const a = A();
212
- let t;
227
+ const n = l();
228
+ let o;
213
229
  try {
214
- t = JSON.stringify({ query: s, variables: l, operationName: n });
230
+ o = JSON.stringify({ query: t, variables: i, operationName: e });
215
231
  } catch {
216
- t = JSON.stringify({ query: s, operationName: n });
232
+ o = JSON.stringify({ query: t, operationName: e });
217
233
  }
218
- Qe(i, { method: "POST", headers: { "Content-Type": "application/json" }, body: t }).then(async (o) => {
219
- if (!o.ok) return void (a.sfDebug && console.error(`GraphQL request failed with status ${o.status} for ${n}`));
220
- const c = await o.json();
221
- c.errors?.length ? (function(d, p, C) {
222
- const g = d && typeof d == "object" && !Array.isArray(d) ? Object.keys(d)[0] : void 0;
223
- console.error(g === "identifyServiceDetails" ? `IdentifyServiceDetails NOT sent successfully for service: UUID=${C.serviceUUID}` : `GraphQL request failed with errors: ${JSON.stringify(p)} for operation key ${g}`);
224
- })(c.data, c.errors, a) : a.sfDebug && (function(d, p, C) {
225
- const g = d && typeof d == "object" && !Array.isArray(d) ? Object.keys(d)[0] : void 0, I = d[g] || !1;
226
- g === "identifyServiceDetails" && (C.setServiceIdentificationReceived(I), A().sfDebug && console.log(`IdentifyServiceDetails sent successfully for service: UUID=${C.serviceUUID}; serviceIdentificationReceived=${g === "identifyServiceDetails" ? I : "N/A"}`));
227
- })(c.data, 0, a);
228
- }).catch((o) => {
229
- a.sfDebug && console.error("Fetch error:", o);
234
+ We(s, { method: "POST", headers: { "Content-Type": "application/json" }, body: o }).then(async (a) => {
235
+ if (!a.ok) return void (n.sfDebug && console.error(`GraphQL request failed with status ${a.status} for ${e}`));
236
+ const r = await a.json();
237
+ r.errors?.length ? (function(g, c, I) {
238
+ const d = g && typeof g == "object" && !Array.isArray(g) ? Object.keys(g)[0] : void 0;
239
+ console.error(d === "identifyServiceDetails" ? `IdentifyServiceDetails NOT sent successfully for service: UUID=${I.serviceUUID}` : `GraphQL request failed with errors: ${JSON.stringify(c)} for operation key ${d}`);
240
+ })(r.data, r.errors, n) : n.sfDebug && (function(g, c, I) {
241
+ const d = g && typeof g == "object" && !Array.isArray(g) ? Object.keys(g)[0] : void 0, C = g[d] || !1;
242
+ d === "identifyServiceDetails" && (I.setServiceIdentificationReceived(C), l().sfDebug && console.log(`IdentifyServiceDetails sent successfully for service: UUID=${I.serviceUUID}; serviceIdentificationReceived=${d === "identifyServiceDetails" ? C : "N/A"}`));
243
+ })(r.data, 0, n);
244
+ }).catch((a) => {
245
+ n.sfDebug && console.error("Fetch error:", a);
230
246
  });
231
- } catch (a) {
232
- A().sfDebug && console.error("Error sending data to GraphQL server:", a);
247
+ } catch (n) {
248
+ l().sfDebug && console.error("Error sending data to GraphQL server:", n);
233
249
  }
234
250
  }
235
- class D extends E {
251
+ class T extends R {
236
252
  constructor() {
237
253
  super(), this.setOperationName("IdentifyServiceDetails");
238
254
  }
239
- async doSend(n) {
240
- if (!A().serviceIdentificationReceived) try {
255
+ async doSend(e) {
256
+ if (!l().serviceIdentificationReceived) try {
241
257
  this.send();
242
- } catch (s) {
243
- A().sfDebug && console.error(" Error during service identification:", s);
258
+ } catch (t) {
259
+ l().sfDebug && console.error(" Error during service identification:", t);
244
260
  }
245
261
  }
246
262
  async send() {
247
- const n = `
263
+ const e = `
248
264
  ${this.queryType} ${this.operationName}(
249
265
  $apiKey: String!,
250
266
  $timestampMs: String!,
@@ -268,42 +284,42 @@ class D extends E {
268
284
  gitSha: $gitSha,
269
285
  )
270
286
  }
271
- `, s = this.getVariables({ serviceIdentifier: A().serviceIdentifier, serviceVersion: A().serviceVersion, library: A().packageLibraryType, version: A().version, serviceAdditionalMetadata: A().serviceAdditionalMetadata, gitSha: A().gitSha || "" });
272
- H(this.endpoint, this.operationName, n, s);
287
+ `, t = this.getVariables({ serviceIdentifier: l().serviceIdentifier, serviceVersion: l().serviceVersion, library: l().packageLibraryType, version: l().version, serviceAdditionalMetadata: l().serviceAdditionalMetadata, gitSha: l().gitSha || "" });
288
+ F(this.endpoint, this.operationName, e, t);
273
289
  }
274
290
  }
275
- function qe(i) {
291
+ function Fe(s) {
276
292
  try {
277
- return JSON.stringify(i), !0;
293
+ return JSON.stringify(s), !0;
278
294
  } catch {
279
295
  return !1;
280
296
  }
281
297
  }
282
- class et extends E {
298
+ class Ve extends R {
283
299
  constructor() {
284
300
  super();
285
- y(this, "serviceIdentifier", new D());
301
+ u(this, "serviceIdentifier", new T());
286
302
  this.setOperationName("CollectMetadata");
287
303
  }
288
304
  async sendAppIdentifier() {
289
305
  this.serviceIdentifier.doSend({});
290
306
  }
291
- async doSend(s, l, a, t) {
292
- this.sendAppIdentifier(), this.send(s, l, a, t);
293
- }
294
- async send(s, l, a, t) {
295
- if (!l && !t) throw new Error('Must pass in either traits or traits_json to "add_or_update_traits"');
296
- let o = [];
297
- if (!t) {
298
- const d = (function(p) {
299
- const C = {}, g = [];
300
- if (p) for (const [I, e] of Object.entries(p)) qe(e) ? C[I] = e : g.push(I);
301
- return { traitsJson: JSON.stringify(C), excludedFields: g };
302
- })(l);
303
- t = d.traitsJson, o = d.excludedFields;
307
+ async doSend(t, i, n, o) {
308
+ this.sendAppIdentifier(), this.send(t, i, n, o);
309
+ }
310
+ async send(t, i, n, o) {
311
+ if (!i && !o) throw new Error('Must pass in either traits or traits_json to "add_or_update_traits"');
312
+ let a = [];
313
+ if (!o) {
314
+ const g = (function(c) {
315
+ const I = {}, d = [];
316
+ if (c) for (const [C, p] of Object.entries(c)) Fe(p) ? I[C] = p : d.push(C);
317
+ return { traitsJson: JSON.stringify(I), excludedFields: d };
318
+ })(i);
319
+ o = g.traitsJson, a = g.excludedFields;
304
320
  }
305
- const c = this.getVariables({ userId: s, traitsJson: t, excludedFields: o, override: a, library: A().packageLibraryType, version: A().version });
306
- H(this.endpoint, this.operationName, this.getQuery(), c);
321
+ const r = this.getVariables({ userId: t, traitsJson: o, excludedFields: a, override: n, library: l().packageLibraryType, version: l().version });
322
+ F(this.endpoint, this.operationName, this.getQuery(), r);
307
323
  }
308
324
  getQuery() {
309
325
  return `
@@ -313,905 +329,293 @@ class et extends E {
313
329
  `;
314
330
  }
315
331
  }
316
- class Je {
317
- constructor(n) {
318
- y(this, "metadataTransmitter");
319
- this.apiKey = n, this.metadataTransmitter = new et();
332
+ class me {
333
+ constructor(e) {
334
+ u(this, "metadataTransmitter");
335
+ this.apiKey = e, this.metadataTransmitter = new Ve();
320
336
  }
321
- identify(n, s, l, a = !1) {
322
- s || l ? this.addOrUpdateMetadata(n, s, l, a) : this.addOrUpdateMetadata(n, {}, void 0, a);
337
+ identify(e, t, i, n = !1) {
338
+ t || i ? this.addOrUpdateMetadata(e, t, i, n) : this.addOrUpdateMetadata(e, {}, void 0, n);
323
339
  }
324
- addOrUpdateMetadata(n, s = {}, l, a = !1) {
325
- if (!s && !l) throw new Error('Must pass in either traits or traitsJson to "addOrUpdateMetadata"');
326
- A().sfDebug && console.log(" [[DEBUG - addOrUpdateMetadata]] Starting operation"), A().sfDebug && console.log(" addOrUpdateMetadata...SENDING DATA...", n, s, l), this.metadataTransmitter.doSend(n, s, a, l);
340
+ addOrUpdateMetadata(e, t = {}, i, n = !1) {
341
+ if (!t && !i) throw new Error('Must pass in either traits or traitsJson to "addOrUpdateMetadata"');
342
+ l().sfDebug && console.log(" [[DEBUG - addOrUpdateMetadata]] Starting operation"), l().sfDebug && console.log(" addOrUpdateMetadata...SENDING DATA...", e, t, i), this.metadataTransmitter.doSend(e, t, n, i);
327
343
  }
328
344
  }
329
- class de extends E {
345
+ class ne extends R {
330
346
  constructor() {
331
347
  super();
332
- y(this, "serviceIdentifier", new D());
348
+ u(this, "serviceIdentifier", new T());
333
349
  }
334
350
  async sendAppIdentifier() {
335
351
  this.serviceIdentifier.doSend({});
336
352
  }
337
- async doSend(s) {
338
- this.sendAppIdentifier(), this.send(s);
353
+ async doSend(t) {
354
+ this.sendAppIdentifier(), this.send(t);
339
355
  }
340
- async send(s) {
356
+ async send(t) {
341
357
  try {
342
- const l = Array.isArray(s) ? s : [s, "default"], a = this.getVariables({ contents: l[0], level: l[1] });
343
- H(this.endpoint, this.operationName, this.getQuery(), a);
344
- } catch (l) {
345
- A().sfDebug && console.error("🚨 Error in send():", l);
358
+ const i = Array.isArray(t) ? t : [t, "default"], n = this.getVariables({ contents: i[0], level: i[1] });
359
+ F(this.endpoint, this.operationName, this.getQuery(), n);
360
+ } catch (i) {
361
+ l().sfDebug && console.error("🚨 Error in send():", i);
346
362
  }
347
363
  }
348
364
  getQuery() {
349
365
  return `
350
- ${this.queryType} ${this.operationName}($apiKey: String!, $serviceUuid: String!, $sessionId: String!, $timestampMs: String!, $level: String!, $contents: String!) {
351
- ${this.queryName}(apiKey: $apiKey, serviceUuid: $serviceUuid, sessionId: $sessionId, timestampMs: $timestampMs, level: $level, contents: $contents)
366
+ ${this.queryType} ${this.operationName}(
367
+ $apiKey: String!,
368
+ $serviceUuid: String!,
369
+ $sessionId: String!,
370
+ $timestampMs: String!,
371
+ $level: String!,
372
+ $contents: String!,
373
+ $parentSpanId: String
374
+ ) {
375
+ ${this.queryName}(
376
+ apiKey: $apiKey,
377
+ serviceUuid: $serviceUuid,
378
+ sessionId: $sessionId,
379
+ timestampMs: $timestampMs,
380
+ level: $level,
381
+ contents: $contents,
382
+ parentSpanId: $parentSpanId
383
+ )
352
384
  }
353
385
  `;
354
386
  }
355
387
  }
356
- const w = {};
357
- var me, Ae, k = {}, re = {}, $ = {}, P = {};
358
- function tt() {
359
- if (me) return P;
360
- me = 1;
361
- var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
362
- return P.encode = function(n) {
363
- if (0 <= n && n < i.length) return i[n];
364
- throw new TypeError("Must be between 0 and 63: " + n);
365
- }, P.decode = function(n) {
366
- return 65 <= n && n <= 90 ? n - 65 : 97 <= n && n <= 122 ? n - 97 + 26 : 48 <= n && n <= 57 ? n - 48 + 52 : n == 43 ? 62 : n == 47 ? 63 : -1;
367
- }, P;
368
- }
369
- function Te() {
370
- if (Ae) return $;
371
- Ae = 1;
372
- var i = tt();
373
- return $.encode = function(n) {
374
- var s, l = "", a = (function(t) {
375
- return t < 0 ? 1 + (-t << 1) : 0 + (t << 1);
376
- })(n);
377
- do
378
- s = 31 & a, (a >>>= 5) > 0 && (s |= 32), l += i.encode(s);
379
- while (a > 0);
380
- return l;
381
- }, $.decode = function(n, s, l) {
382
- var a, t, o, c, d = n.length, p = 0, C = 0;
383
- do {
384
- if (s >= d) throw new Error("Expected more digits in base 64 VLQ value.");
385
- if ((t = i.decode(n.charCodeAt(s++))) === -1) throw new Error("Invalid base64 digit: " + n.charAt(s - 1));
386
- a = !!(32 & t), p += (t &= 31) << C, C += 5;
387
- } while (a);
388
- l.value = (c = (o = p) >> 1, 1 & ~o ? c : -c), l.rest = s;
389
- }, $;
390
- }
391
- var fe, be = {};
392
- function M() {
393
- return fe || (fe = 1, (function(i) {
394
- i.getArg = function(e, r, h) {
395
- if (r in e) return e[r];
396
- if (arguments.length === 3) return h;
397
- throw new Error('"' + r + '" is a required argument.');
398
- };
399
- var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, s = /^data:.+\,.+$/;
400
- function l(e) {
401
- var r = e.match(n);
402
- return r ? { scheme: r[1], auth: r[2], host: r[3], port: r[4], path: r[5] } : null;
403
- }
404
- function a(e) {
405
- var r = "";
406
- return e.scheme && (r += e.scheme + ":"), r += "//", e.auth && (r += e.auth + "@"), e.host && (r += e.host), e.port && (r += ":" + e.port), e.path && (r += e.path), r;
407
- }
408
- i.urlParse = l, i.urlGenerate = a;
409
- var t, o, c = (t = function(e) {
410
- var r = e, h = l(e);
411
- if (h) {
412
- if (!h.path) return e;
413
- r = h.path;
414
- }
415
- for (var u = i.isAbsolute(r), m = [], f = 0, b = 0; ; ) {
416
- if (f = b, (b = r.indexOf("/", f)) === -1) {
417
- m.push(r.slice(f));
418
- break;
419
- }
420
- for (m.push(r.slice(f, b)); b < r.length && r[b] === "/"; ) b++;
421
- }
422
- var v, S = 0;
423
- for (b = m.length - 1; b >= 0; b--) (v = m[b]) === "." ? m.splice(b, 1) : v === ".." ? S++ : S > 0 && (v === "" ? (m.splice(b + 1, S), S = 0) : (m.splice(b, 2), S--));
424
- return (r = m.join("/")) === "" && (r = u ? "/" : "."), h ? (h.path = r, a(h)) : r;
425
- }, o = [], function(e) {
426
- for (var r = 0; r < o.length; r++) if (o[r].input === e) {
427
- var h = o[0];
428
- return o[0] = o[r], o[r] = h, o[0].result;
429
- }
430
- var u = t(e);
431
- return o.unshift({ input: e, result: u }), o.length > 32 && o.pop(), u;
432
- });
433
- function d(e, r) {
434
- e === "" && (e = "."), r === "" && (r = ".");
435
- var h = l(r), u = l(e);
436
- if (u && (e = u.path || "/"), h && !h.scheme) return u && (h.scheme = u.scheme), a(h);
437
- if (h || r.match(s)) return r;
438
- if (u && !u.host && !u.path) return u.host = r, a(u);
439
- var m = r.charAt(0) === "/" ? r : c(e.replace(/\/+$/, "") + "/" + r);
440
- return u ? (u.path = m, a(u)) : m;
441
- }
442
- i.normalize = c, i.join = d, i.isAbsolute = function(e) {
443
- return e.charAt(0) === "/" || n.test(e);
444
- }, i.relative = function(e, r) {
445
- e === "" && (e = "."), e = e.replace(/\/$/, "");
446
- for (var h = 0; r.indexOf(e + "/") !== 0; ) {
447
- var u = e.lastIndexOf("/");
448
- if (u < 0 || (e = e.slice(0, u)).match(/^([^\/]+:\/)?\/*$/)) return r;
449
- ++h;
450
- }
451
- return Array(h + 1).join("../") + r.substr(e.length + 1);
452
- };
453
- var p = !("__proto__" in /* @__PURE__ */ Object.create(null));
454
- function C(e) {
455
- return e;
456
- }
457
- function g(e) {
458
- if (!e) return !1;
459
- var r = e.length;
460
- if (r < 9 || e.charCodeAt(r - 1) !== 95 || e.charCodeAt(r - 2) !== 95 || e.charCodeAt(r - 3) !== 111 || e.charCodeAt(r - 4) !== 116 || e.charCodeAt(r - 5) !== 111 || e.charCodeAt(r - 6) !== 114 || e.charCodeAt(r - 7) !== 112 || e.charCodeAt(r - 8) !== 95 || e.charCodeAt(r - 9) !== 95) return !1;
461
- for (var h = r - 10; h >= 0; h--) if (e.charCodeAt(h) !== 36) return !1;
462
- return !0;
463
- }
464
- function I(e, r) {
465
- return e === r ? 0 : e === null ? 1 : r === null ? -1 : e > r ? 1 : -1;
466
- }
467
- i.toSetString = p ? C : function(e) {
468
- return g(e) ? "$" + e : e;
469
- }, i.fromSetString = p ? C : function(e) {
470
- return g(e) ? e.slice(1) : e;
471
- }, i.compareByOriginalPositions = function(e, r, h) {
472
- var u = I(e.source, r.source);
473
- return u !== 0 || (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 || h || (u = e.generatedColumn - r.generatedColumn) !== 0 || (u = e.generatedLine - r.generatedLine) !== 0 ? u : I(e.name, r.name);
474
- }, i.compareByOriginalPositionsNoSource = function(e, r, h) {
475
- var u;
476
- return (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 || h || (u = e.generatedColumn - r.generatedColumn) !== 0 || (u = e.generatedLine - r.generatedLine) !== 0 ? u : I(e.name, r.name);
477
- }, i.compareByGeneratedPositionsDeflated = function(e, r, h) {
478
- var u = e.generatedLine - r.generatedLine;
479
- return u !== 0 || (u = e.generatedColumn - r.generatedColumn) !== 0 || h || (u = I(e.source, r.source)) !== 0 || (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 ? u : I(e.name, r.name);
480
- }, i.compareByGeneratedPositionsDeflatedNoLine = function(e, r, h) {
481
- var u = e.generatedColumn - r.generatedColumn;
482
- return u !== 0 || h || (u = I(e.source, r.source)) !== 0 || (u = e.originalLine - r.originalLine) !== 0 || (u = e.originalColumn - r.originalColumn) !== 0 ? u : I(e.name, r.name);
483
- }, i.compareByGeneratedPositionsInflated = function(e, r) {
484
- var h = e.generatedLine - r.generatedLine;
485
- return h !== 0 || (h = e.generatedColumn - r.generatedColumn) !== 0 || (h = I(e.source, r.source)) !== 0 || (h = e.originalLine - r.originalLine) !== 0 || (h = e.originalColumn - r.originalColumn) !== 0 ? h : I(e.name, r.name);
486
- }, i.parseSourceMapInput = function(e) {
487
- return JSON.parse(e.replace(/^\)]}'[^\n]*\n/, ""));
488
- }, i.computeSourceURL = function(e, r, h) {
489
- if (r = r || "", e && (e[e.length - 1] !== "/" && r[0] !== "/" && (e += "/"), r = e + r), h) {
490
- var u = l(h);
491
- if (!u) throw new Error("sourceMapURL could not be parsed");
492
- if (u.path) {
493
- var m = u.path.lastIndexOf("/");
494
- m >= 0 && (u.path = u.path.substring(0, m + 1));
495
- }
496
- r = d(a(u), r);
497
- }
498
- return c(r);
499
- };
500
- })(be)), be;
501
- }
502
- var ye, oe = {};
503
- function Me() {
504
- if (ye) return oe;
505
- ye = 1;
506
- var i = M(), n = Object.prototype.hasOwnProperty, s = typeof Map < "u";
507
- function l() {
508
- this._array = [], this._set = s ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
509
- }
510
- return l.fromArray = function(a, t) {
511
- for (var o = new l(), c = 0, d = a.length; c < d; c++) o.add(a[c], t);
512
- return o;
513
- }, l.prototype.size = function() {
514
- return s ? this._set.size : Object.getOwnPropertyNames(this._set).length;
515
- }, l.prototype.add = function(a, t) {
516
- var o = s ? a : i.toSetString(a), c = s ? this.has(a) : n.call(this._set, o), d = this._array.length;
517
- c && !t || this._array.push(a), c || (s ? this._set.set(a, d) : this._set[o] = d);
518
- }, l.prototype.has = function(a) {
519
- if (s) return this._set.has(a);
520
- var t = i.toSetString(a);
521
- return n.call(this._set, t);
522
- }, l.prototype.indexOf = function(a) {
523
- if (s) {
524
- var t = this._set.get(a);
525
- if (t >= 0) return t;
526
- } else {
527
- var o = i.toSetString(a);
528
- if (n.call(this._set, o)) return this._set[o];
529
- }
530
- throw new Error('"' + a + '" is not in the set.');
531
- }, l.prototype.at = function(a) {
532
- if (a >= 0 && a < this._array.length) return this._array[a];
533
- throw new Error("No element indexed by " + a);
534
- }, l.prototype.toArray = function() {
535
- return this._array.slice();
536
- }, oe.ArraySet = l, oe;
537
- }
538
- var ve, Se, ie = {};
539
- function nt() {
540
- if (ve) return ie;
541
- ve = 1;
542
- var i = M();
543
- function n() {
544
- this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 };
545
- }
546
- return n.prototype.unsortedForEach = function(s, l) {
547
- this._array.forEach(s, l);
548
- }, n.prototype.add = function(s) {
549
- var l, a, t, o, c, d;
550
- l = this._last, a = s, t = l.generatedLine, o = a.generatedLine, c = l.generatedColumn, d = a.generatedColumn, o > t || o == t && d >= c || i.compareByGeneratedPositionsInflated(l, a) <= 0 ? (this._last = s, this._array.push(s)) : (this._sorted = !1, this._array.push(s));
551
- }, n.prototype.toArray = function() {
552
- return this._sorted || (this._array.sort(i.compareByGeneratedPositionsInflated), this._sorted = !0), this._array;
553
- }, ie.MappingList = n, ie;
554
- }
555
- function Ge() {
556
- if (Se) return re;
557
- Se = 1;
558
- var i = Te(), n = M(), s = Me().ArraySet, l = nt().MappingList;
559
- function a(t) {
560
- t || (t = {}), this._file = n.getArg(t, "file", null), this._sourceRoot = n.getArg(t, "sourceRoot", null), this._skipValidation = n.getArg(t, "skipValidation", !1), this._ignoreInvalidMapping = n.getArg(t, "ignoreInvalidMapping", !1), this._sources = new s(), this._names = new s(), this._mappings = new l(), this._sourcesContents = null;
561
- }
562
- return a.prototype._version = 3, a.fromSourceMap = function(t, o) {
563
- var c = t.sourceRoot, d = new a(Object.assign(o || {}, { file: t.file, sourceRoot: c }));
564
- return t.eachMapping(function(p) {
565
- var C = { generated: { line: p.generatedLine, column: p.generatedColumn } };
566
- p.source != null && (C.source = p.source, c != null && (C.source = n.relative(c, C.source)), C.original = { line: p.originalLine, column: p.originalColumn }, p.name != null && (C.name = p.name)), d.addMapping(C);
567
- }), t.sources.forEach(function(p) {
568
- var C = p;
569
- c !== null && (C = n.relative(c, p)), d._sources.has(C) || d._sources.add(C);
570
- var g = t.sourceContentFor(p);
571
- g != null && d.setSourceContent(p, g);
572
- }), d;
573
- }, a.prototype.addMapping = function(t) {
574
- var o = n.getArg(t, "generated"), c = n.getArg(t, "original", null), d = n.getArg(t, "source", null), p = n.getArg(t, "name", null);
575
- (this._skipValidation || this._validateMapping(o, c, d, p) !== !1) && (d != null && (d = String(d), this._sources.has(d) || this._sources.add(d)), p != null && (p = String(p), this._names.has(p) || this._names.add(p)), this._mappings.add({ generatedLine: o.line, generatedColumn: o.column, originalLine: c != null && c.line, originalColumn: c != null && c.column, source: d, name: p }));
576
- }, a.prototype.setSourceContent = function(t, o) {
577
- var c = t;
578
- this._sourceRoot != null && (c = n.relative(this._sourceRoot, c)), o != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[n.toSetString(c)] = o) : this._sourcesContents && (delete this._sourcesContents[n.toSetString(c)], Object.keys(this._sourcesContents).length === 0 && (this._sourcesContents = null));
579
- }, a.prototype.applySourceMap = function(t, o, c) {
580
- var d = o;
581
- if (o == null) {
582
- if (t.file == null) throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);
583
- d = t.file;
584
- }
585
- var p = this._sourceRoot;
586
- p != null && (d = n.relative(p, d));
587
- var C = new s(), g = new s();
588
- this._mappings.unsortedForEach(function(I) {
589
- if (I.source === d && I.originalLine != null) {
590
- var e = t.originalPositionFor({ line: I.originalLine, column: I.originalColumn });
591
- e.source != null && (I.source = e.source, c != null && (I.source = n.join(c, I.source)), p != null && (I.source = n.relative(p, I.source)), I.originalLine = e.line, I.originalColumn = e.column, e.name != null && (I.name = e.name));
592
- }
593
- var r = I.source;
594
- r == null || C.has(r) || C.add(r);
595
- var h = I.name;
596
- h == null || g.has(h) || g.add(h);
597
- }, this), this._sources = C, this._names = g, t.sources.forEach(function(I) {
598
- var e = t.sourceContentFor(I);
599
- e != null && (c != null && (I = n.join(c, I)), p != null && (I = n.relative(p, I)), this.setSourceContent(I, e));
600
- }, this);
601
- }, a.prototype._validateMapping = function(t, o, c, d) {
602
- if (o && typeof o.line != "number" && typeof o.column != "number") {
603
- var p = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
604
- if (this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(p), !1;
605
- throw new Error(p);
606
- }
607
- if ((!(t && "line" in t && "column" in t && t.line > 0 && t.column >= 0) || o || c || d) && !(t && "line" in t && "column" in t && o && "line" in o && "column" in o && t.line > 0 && t.column >= 0 && o.line > 0 && o.column >= 0 && c)) {
608
- if (p = "Invalid mapping: " + JSON.stringify({ generated: t, source: c, original: o, name: d }), this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(p), !1;
609
- throw new Error(p);
610
- }
611
- }, a.prototype._serializeMappings = function() {
612
- for (var t, o, c, d, p = 0, C = 1, g = 0, I = 0, e = 0, r = 0, h = "", u = this._mappings.toArray(), m = 0, f = u.length; m < f; m++) {
613
- if (t = "", (o = u[m]).generatedLine !== C) for (p = 0; o.generatedLine !== C; ) t += ";", C++;
614
- else if (m > 0) {
615
- if (!n.compareByGeneratedPositionsInflated(o, u[m - 1])) continue;
616
- t += ",";
617
- }
618
- t += i.encode(o.generatedColumn - p), p = o.generatedColumn, o.source != null && (d = this._sources.indexOf(o.source), t += i.encode(d - r), r = d, t += i.encode(o.originalLine - 1 - I), I = o.originalLine - 1, t += i.encode(o.originalColumn - g), g = o.originalColumn, o.name != null && (c = this._names.indexOf(o.name), t += i.encode(c - e), e = c)), h += t;
619
- }
620
- return h;
621
- }, a.prototype._generateSourcesContent = function(t, o) {
622
- return t.map(function(c) {
623
- if (!this._sourcesContents) return null;
624
- o != null && (c = n.relative(o, c));
625
- var d = n.toSetString(c);
626
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, d) ? this._sourcesContents[d] : null;
627
- }, this);
628
- }, a.prototype.toJSON = function() {
629
- var t = { version: this._version, sources: this._sources.toArray(), names: this._names.toArray(), mappings: this._serializeMappings() };
630
- return this._file != null && (t.file = this._file), this._sourceRoot != null && (t.sourceRoot = this._sourceRoot), this._sourcesContents && (t.sourcesContent = this._generateSourcesContent(t.sources, t.sourceRoot)), t;
631
- }, a.prototype.toString = function() {
632
- return JSON.stringify(this.toJSON());
633
- }, re.SourceMapGenerator = a, re;
634
- }
635
- var Ze, F = {}, Be = {};
636
- function rt() {
637
- return Ze || (Ze = 1, (function(i) {
638
- function n(s, l, a, t, o, c) {
639
- var d = Math.floor((l - s) / 2) + s, p = o(a, t[d], !0);
640
- return p === 0 ? d : p > 0 ? l - d > 1 ? n(d, l, a, t, o, c) : c == i.LEAST_UPPER_BOUND ? l < t.length ? l : -1 : d : d - s > 1 ? n(s, d, a, t, o, c) : c == i.LEAST_UPPER_BOUND ? d : s < 0 ? -1 : s;
641
- }
642
- i.GREATEST_LOWER_BOUND = 1, i.LEAST_UPPER_BOUND = 2, i.search = function(s, l, a, t) {
643
- if (l.length === 0) return -1;
644
- var o = n(-1, l.length, s, l, a, t || i.GREATEST_LOWER_BOUND);
645
- if (o < 0) return -1;
646
- for (; o - 1 >= 0 && a(l[o], l[o - 1], !0) === 0; ) --o;
647
- return o;
648
- };
649
- })(Be)), Be;
650
- }
651
- var We, we, se = {};
652
- function ot() {
653
- if (We) return se;
654
- function i(s) {
655
- function l(a, t, o) {
656
- var c = a[t];
657
- a[t] = a[o], a[o] = c;
658
- }
659
- return function a(t, o, c, d) {
660
- if (c < d) {
661
- var p = c - 1;
662
- l(t, (e = c, r = d, Math.round(e + Math.random() * (r - e))), d);
663
- for (var C = t[d], g = c; g < d; g++) o(t[g], C, !1) <= 0 && l(t, p += 1, g);
664
- l(t, p + 1, g);
665
- var I = p + 1;
666
- a(t, o, c, I - 1), a(t, o, I + 1, d);
667
- }
668
- var e, r;
669
- };
670
- }
671
- We = 1;
672
- let n = /* @__PURE__ */ new WeakMap();
673
- return se.quickSort = function(s, l, a = 0) {
674
- let t = n.get(l);
675
- t === void 0 && (t = (function(o) {
676
- let c = i.toString();
677
- return new Function(`return ${c}`)()(o);
678
- })(l), n.set(l, t)), t(s, l, a, s.length - 1);
679
- }, se;
680
- }
681
- var Ne, Re, ae = {}, De = (Re || (Re = 1, k.SourceMapGenerator = Ge().SourceMapGenerator, k.SourceMapConsumer = (function() {
682
- if (we) return F;
683
- we = 1;
684
- var i = M(), n = rt(), s = Me().ArraySet, l = Te(), a = ot().quickSort;
685
- function t(g, I) {
686
- var e = g;
687
- return typeof g == "string" && (e = i.parseSourceMapInput(g)), e.sections != null ? new C(e, I) : new o(e, I);
688
- }
689
- function o(g, I) {
690
- var e = g;
691
- typeof g == "string" && (e = i.parseSourceMapInput(g));
692
- var r = i.getArg(e, "version"), h = i.getArg(e, "sources"), u = i.getArg(e, "names", []), m = i.getArg(e, "sourceRoot", null), f = i.getArg(e, "sourcesContent", null), b = i.getArg(e, "mappings"), v = i.getArg(e, "file", null);
693
- if (r != this._version) throw new Error("Unsupported version: " + r);
694
- m && (m = i.normalize(m)), h = h.map(String).map(i.normalize).map(function(S) {
695
- return m && i.isAbsolute(m) && i.isAbsolute(S) ? i.relative(m, S) : S;
696
- }), this._names = s.fromArray(u.map(String), !0), this._sources = s.fromArray(h, !0), this._absoluteSources = this._sources.toArray().map(function(S) {
697
- return i.computeSourceURL(m, S, I);
698
- }), this.sourceRoot = m, this.sourcesContent = f, this._mappings = b, this._sourceMapURL = I, this.file = v;
699
- }
700
- function c() {
701
- this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null;
702
- }
703
- t.fromSourceMap = function(g, I) {
704
- return o.fromSourceMap(g, I);
705
- }, t.prototype._version = 3, t.prototype.__generatedMappings = null, Object.defineProperty(t.prototype, "_generatedMappings", { configurable: !0, enumerable: !0, get: function() {
706
- return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings;
707
- } }), t.prototype.__originalMappings = null, Object.defineProperty(t.prototype, "_originalMappings", { configurable: !0, enumerable: !0, get: function() {
708
- return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings;
709
- } }), t.prototype._charIsMappingSeparator = function(g, I) {
710
- var e = g.charAt(I);
711
- return e === ";" || e === ",";
712
- }, t.prototype._parseMappings = function(g, I) {
713
- throw new Error("Subclasses must implement _parseMappings");
714
- }, t.GENERATED_ORDER = 1, t.ORIGINAL_ORDER = 2, t.GREATEST_LOWER_BOUND = 1, t.LEAST_UPPER_BOUND = 2, t.prototype.eachMapping = function(g, I, e) {
715
- var r, h = I || null;
716
- switch (e || t.GENERATED_ORDER) {
717
- case t.GENERATED_ORDER:
718
- r = this._generatedMappings;
719
- break;
720
- case t.ORIGINAL_ORDER:
721
- r = this._originalMappings;
722
- break;
723
- default:
724
- throw new Error("Unknown order of iteration.");
725
- }
726
- for (var u = this.sourceRoot, m = g.bind(h), f = this._names, b = this._sources, v = this._sourceMapURL, S = 0, B = r.length; S < B; S++) {
727
- var W = r[S], Z = W.source === null ? null : b.at(W.source);
728
- Z !== null && (Z = i.computeSourceURL(u, Z, v)), m({ source: Z, generatedLine: W.generatedLine, generatedColumn: W.generatedColumn, originalLine: W.originalLine, originalColumn: W.originalColumn, name: W.name === null ? null : f.at(W.name) });
729
- }
730
- }, t.prototype.allGeneratedPositionsFor = function(g) {
731
- var I = i.getArg(g, "line"), e = { source: i.getArg(g, "source"), originalLine: I, originalColumn: i.getArg(g, "column", 0) };
732
- if (e.source = this._findSourceIndex(e.source), e.source < 0) return [];
733
- var r = [], h = this._findMapping(e, this._originalMappings, "originalLine", "originalColumn", i.compareByOriginalPositions, n.LEAST_UPPER_BOUND);
734
- if (h >= 0) {
735
- var u = this._originalMappings[h];
736
- if (g.column === void 0) for (var m = u.originalLine; u && u.originalLine === m; ) r.push({ line: i.getArg(u, "generatedLine", null), column: i.getArg(u, "generatedColumn", null), lastColumn: i.getArg(u, "lastGeneratedColumn", null) }), u = this._originalMappings[++h];
737
- else for (var f = u.originalColumn; u && u.originalLine === I && u.originalColumn == f; ) r.push({ line: i.getArg(u, "generatedLine", null), column: i.getArg(u, "generatedColumn", null), lastColumn: i.getArg(u, "lastGeneratedColumn", null) }), u = this._originalMappings[++h];
738
- }
739
- return r;
740
- }, F.SourceMapConsumer = t, o.prototype = Object.create(t.prototype), o.prototype.consumer = t, o.prototype._findSourceIndex = function(g) {
741
- var I, e = g;
742
- if (this.sourceRoot != null && (e = i.relative(this.sourceRoot, e)), this._sources.has(e)) return this._sources.indexOf(e);
743
- for (I = 0; I < this._absoluteSources.length; ++I) if (this._absoluteSources[I] == g) return I;
744
- return -1;
745
- }, o.fromSourceMap = function(g, I) {
746
- var e = Object.create(o.prototype), r = e._names = s.fromArray(g._names.toArray(), !0), h = e._sources = s.fromArray(g._sources.toArray(), !0);
747
- e.sourceRoot = g._sourceRoot, e.sourcesContent = g._generateSourcesContent(e._sources.toArray(), e.sourceRoot), e.file = g._file, e._sourceMapURL = I, e._absoluteSources = e._sources.toArray().map(function(W) {
748
- return i.computeSourceURL(e.sourceRoot, W, I);
749
- });
750
- for (var u = g._mappings.toArray().slice(), m = e.__generatedMappings = [], f = e.__originalMappings = [], b = 0, v = u.length; b < v; b++) {
751
- var S = u[b], B = new c();
752
- B.generatedLine = S.generatedLine, B.generatedColumn = S.generatedColumn, S.source && (B.source = h.indexOf(S.source), B.originalLine = S.originalLine, B.originalColumn = S.originalColumn, S.name && (B.name = r.indexOf(S.name)), f.push(B)), m.push(B);
753
- }
754
- return a(e.__originalMappings, i.compareByOriginalPositions), e;
755
- }, o.prototype._version = 3, Object.defineProperty(o.prototype, "sources", { get: function() {
756
- return this._absoluteSources.slice();
757
- } });
758
- const d = i.compareByGeneratedPositionsDeflatedNoLine;
759
- function p(g, I) {
760
- let e = g.length, r = g.length - I;
761
- if (!(r <= 1)) if (r == 2) {
762
- let h = g[I], u = g[I + 1];
763
- d(h, u) > 0 && (g[I] = u, g[I + 1] = h);
764
- } else if (r < 20) for (let h = I; h < e; h++) for (let u = h; u > I; u--) {
765
- let m = g[u - 1], f = g[u];
766
- if (d(m, f) <= 0) break;
767
- g[u - 1] = f, g[u] = m;
768
- }
769
- else a(g, d, I);
770
- }
771
- function C(g, I) {
772
- var e = g;
773
- typeof g == "string" && (e = i.parseSourceMapInput(g));
774
- var r = i.getArg(e, "version"), h = i.getArg(e, "sections");
775
- if (r != this._version) throw new Error("Unsupported version: " + r);
776
- this._sources = new s(), this._names = new s();
777
- var u = { line: -1, column: 0 };
778
- this._sections = h.map(function(m) {
779
- if (m.url) throw new Error("Support for url field in sections not implemented.");
780
- var f = i.getArg(m, "offset"), b = i.getArg(f, "line"), v = i.getArg(f, "column");
781
- if (b < u.line || b === u.line && v < u.column) throw new Error("Section offsets must be ordered and non-overlapping.");
782
- return u = f, { generatedOffset: { generatedLine: b + 1, generatedColumn: v + 1 }, consumer: new t(i.getArg(m, "map"), I) };
783
- });
784
- }
785
- return o.prototype._parseMappings = function(g, I) {
786
- var e, r, h, u, m = 1, f = 0, b = 0, v = 0, S = 0, B = 0, W = g.length, Z = 0, q = {}, R = [], Y = [];
787
- let ee = 0;
788
- for (; Z < W; ) if (g.charAt(Z) === ";") m++, Z++, f = 0, p(Y, ee), ee = Y.length;
789
- else if (g.charAt(Z) === ",") Z++;
790
- else {
791
- for ((e = new c()).generatedLine = m, h = Z; h < W && !this._charIsMappingSeparator(g, h); h++) ;
792
- for (g.slice(Z, h), r = []; Z < h; ) l.decode(g, Z, q), u = q.value, Z = q.rest, r.push(u);
793
- if (r.length === 2) throw new Error("Found a source, but no line and column");
794
- if (r.length === 3) throw new Error("Found a source and line, but no column");
795
- if (e.generatedColumn = f + r[0], f = e.generatedColumn, r.length > 1 && (e.source = S + r[1], S += r[1], e.originalLine = b + r[2], b = e.originalLine, e.originalLine += 1, e.originalColumn = v + r[3], v = e.originalColumn, r.length > 4 && (e.name = B + r[4], B += r[4])), Y.push(e), typeof e.originalLine == "number") {
796
- let x = e.source;
797
- for (; R.length <= x; ) R.push(null);
798
- R[x] === null && (R[x] = []), R[x].push(e);
799
- }
800
- }
801
- p(Y, ee), this.__generatedMappings = Y;
802
- for (var O = 0; O < R.length; O++) R[O] != null && a(R[O], i.compareByOriginalPositionsNoSource);
803
- this.__originalMappings = [].concat(...R);
804
- }, o.prototype._findMapping = function(g, I, e, r, h, u) {
805
- if (g[e] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + g[e]);
806
- if (g[r] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + g[r]);
807
- return n.search(g, I, h, u);
808
- }, o.prototype.computeColumnSpans = function() {
809
- for (var g = 0; g < this._generatedMappings.length; ++g) {
810
- var I = this._generatedMappings[g];
811
- if (g + 1 < this._generatedMappings.length) {
812
- var e = this._generatedMappings[g + 1];
813
- if (I.generatedLine === e.generatedLine) {
814
- I.lastGeneratedColumn = e.generatedColumn - 1;
815
- continue;
816
- }
817
- }
818
- I.lastGeneratedColumn = 1 / 0;
819
- }
820
- }, o.prototype.originalPositionFor = function(g) {
821
- var I = { generatedLine: i.getArg(g, "line"), generatedColumn: i.getArg(g, "column") }, e = this._findMapping(I, this._generatedMappings, "generatedLine", "generatedColumn", i.compareByGeneratedPositionsDeflated, i.getArg(g, "bias", t.GREATEST_LOWER_BOUND));
822
- if (e >= 0) {
823
- var r = this._generatedMappings[e];
824
- if (r.generatedLine === I.generatedLine) {
825
- var h = i.getArg(r, "source", null);
826
- h !== null && (h = this._sources.at(h), h = i.computeSourceURL(this.sourceRoot, h, this._sourceMapURL));
827
- var u = i.getArg(r, "name", null);
828
- return u !== null && (u = this._names.at(u)), { source: h, line: i.getArg(r, "originalLine", null), column: i.getArg(r, "originalColumn", null), name: u };
829
- }
830
- }
831
- return { source: null, line: null, column: null, name: null };
832
- }, o.prototype.hasContentsOfAllSources = function() {
833
- return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(g) {
834
- return g == null;
835
- });
836
- }, o.prototype.sourceContentFor = function(g, I) {
837
- if (!this.sourcesContent) return null;
838
- var e = this._findSourceIndex(g);
839
- if (e >= 0) return this.sourcesContent[e];
840
- var r, h = g;
841
- if (this.sourceRoot != null && (h = i.relative(this.sourceRoot, h)), this.sourceRoot != null && (r = i.urlParse(this.sourceRoot))) {
842
- var u = h.replace(/^file:\/\//, "");
843
- if (r.scheme == "file" && this._sources.has(u)) return this.sourcesContent[this._sources.indexOf(u)];
844
- if ((!r.path || r.path == "/") && this._sources.has("/" + h)) return this.sourcesContent[this._sources.indexOf("/" + h)];
845
- }
846
- if (I) return null;
847
- throw new Error('"' + h + '" is not in the SourceMap.');
848
- }, o.prototype.generatedPositionFor = function(g) {
849
- var I = i.getArg(g, "source");
850
- if ((I = this._findSourceIndex(I)) < 0) return { line: null, column: null, lastColumn: null };
851
- var e = { source: I, originalLine: i.getArg(g, "line"), originalColumn: i.getArg(g, "column") }, r = this._findMapping(e, this._originalMappings, "originalLine", "originalColumn", i.compareByOriginalPositions, i.getArg(g, "bias", t.GREATEST_LOWER_BOUND));
852
- if (r >= 0) {
853
- var h = this._originalMappings[r];
854
- if (h.source === e.source) return { line: i.getArg(h, "generatedLine", null), column: i.getArg(h, "generatedColumn", null), lastColumn: i.getArg(h, "lastGeneratedColumn", null) };
855
- }
856
- return { line: null, column: null, lastColumn: null };
857
- }, F.BasicSourceMapConsumer = o, C.prototype = Object.create(t.prototype), C.prototype.constructor = t, C.prototype._version = 3, Object.defineProperty(C.prototype, "sources", { get: function() {
858
- for (var g = [], I = 0; I < this._sections.length; I++) for (var e = 0; e < this._sections[I].consumer.sources.length; e++) g.push(this._sections[I].consumer.sources[e]);
859
- return g;
860
- } }), C.prototype.originalPositionFor = function(g) {
861
- var I = { generatedLine: i.getArg(g, "line"), generatedColumn: i.getArg(g, "column") }, e = n.search(I, this._sections, function(h, u) {
862
- return h.generatedLine - u.generatedOffset.generatedLine || h.generatedColumn - u.generatedOffset.generatedColumn;
863
- }), r = this._sections[e];
864
- return r ? r.consumer.originalPositionFor({ line: I.generatedLine - (r.generatedOffset.generatedLine - 1), column: I.generatedColumn - (r.generatedOffset.generatedLine === I.generatedLine ? r.generatedOffset.generatedColumn - 1 : 0), bias: g.bias }) : { source: null, line: null, column: null, name: null };
865
- }, C.prototype.hasContentsOfAllSources = function() {
866
- return this._sections.every(function(g) {
867
- return g.consumer.hasContentsOfAllSources();
868
- });
869
- }, C.prototype.sourceContentFor = function(g, I) {
870
- for (var e = 0; e < this._sections.length; e++) {
871
- var r = this._sections[e].consumer.sourceContentFor(g, !0);
872
- if (r || r === "") return r;
873
- }
874
- if (I) return null;
875
- throw new Error('"' + g + '" is not in the SourceMap.');
876
- }, C.prototype.generatedPositionFor = function(g) {
877
- for (var I = 0; I < this._sections.length; I++) {
878
- var e = this._sections[I];
879
- if (e.consumer._findSourceIndex(i.getArg(g, "source")) !== -1) {
880
- var r = e.consumer.generatedPositionFor(g);
881
- if (r) return { line: r.line + (e.generatedOffset.generatedLine - 1), column: r.column + (e.generatedOffset.generatedLine === r.line ? e.generatedOffset.generatedColumn - 1 : 0) };
882
- }
883
- }
884
- return { line: null, column: null };
885
- }, C.prototype._parseMappings = function(g, I) {
886
- this.__generatedMappings = [], this.__originalMappings = [];
887
- for (var e = 0; e < this._sections.length; e++) for (var r = this._sections[e], h = r.consumer._generatedMappings, u = 0; u < h.length; u++) {
888
- var m = h[u], f = r.consumer._sources.at(m.source);
889
- f !== null && (f = i.computeSourceURL(r.consumer.sourceRoot, f, this._sourceMapURL)), this._sources.add(f), f = this._sources.indexOf(f);
890
- var b = null;
891
- m.name && (b = r.consumer._names.at(m.name), this._names.add(b), b = this._names.indexOf(b));
892
- var v = { source: f, generatedLine: m.generatedLine + (r.generatedOffset.generatedLine - 1), generatedColumn: m.generatedColumn + (r.generatedOffset.generatedLine === m.generatedLine ? r.generatedOffset.generatedColumn - 1 : 0), originalLine: m.originalLine, originalColumn: m.originalColumn, name: b };
893
- this.__generatedMappings.push(v), typeof v.originalLine == "number" && this.__originalMappings.push(v);
894
- }
895
- a(this.__generatedMappings, i.compareByGeneratedPositionsDeflated), a(this.__originalMappings, i.compareByOriginalPositions);
896
- }, F.IndexedSourceMapConsumer = C, F;
897
- })().SourceMapConsumer, k.SourceNode = (function() {
898
- if (Ne) return ae;
899
- Ne = 1;
900
- var i = Ge().SourceMapGenerator, n = M(), s = /(\r?\n)/, l = "$$$isSourceNode$$$";
901
- function a(t, o, c, d, p) {
902
- this.children = [], this.sourceContents = {}, this.line = t ?? null, this.column = o ?? null, this.source = c ?? null, this.name = p ?? null, this[l] = !0, d != null && this.add(d);
903
- }
904
- return a.fromStringWithSourceMap = function(t, o, c) {
905
- var d = new a(), p = t.split(s), C = 0, g = function() {
906
- return u() + (u() || "");
907
- function u() {
908
- return C < p.length ? p[C++] : void 0;
909
- }
910
- }, I = 1, e = 0, r = null;
911
- return o.eachMapping(function(u) {
912
- if (r !== null) {
913
- if (!(I < u.generatedLine)) {
914
- var m = (f = p[C] || "").substr(0, u.generatedColumn - e);
915
- return p[C] = f.substr(u.generatedColumn - e), e = u.generatedColumn, h(r, m), void (r = u);
916
- }
917
- h(r, g()), I++, e = 0;
918
- }
919
- for (; I < u.generatedLine; ) d.add(g()), I++;
920
- if (e < u.generatedColumn) {
921
- var f = p[C] || "";
922
- d.add(f.substr(0, u.generatedColumn)), p[C] = f.substr(u.generatedColumn), e = u.generatedColumn;
923
- }
924
- r = u;
925
- }, this), C < p.length && (r && h(r, g()), d.add(p.splice(C).join(""))), o.sources.forEach(function(u) {
926
- var m = o.sourceContentFor(u);
927
- m != null && (c != null && (u = n.join(c, u)), d.setSourceContent(u, m));
928
- }), d;
929
- function h(u, m) {
930
- if (u === null || u.source === void 0) d.add(m);
931
- else {
932
- var f = c ? n.join(c, u.source) : u.source;
933
- d.add(new a(u.originalLine, u.originalColumn, f, m, u.name));
934
- }
935
- }
936
- }, a.prototype.add = function(t) {
937
- if (Array.isArray(t)) t.forEach(function(o) {
938
- this.add(o);
939
- }, this);
940
- else {
941
- if (!t[l] && typeof t != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + t);
942
- t && this.children.push(t);
943
- }
944
- return this;
945
- }, a.prototype.prepend = function(t) {
946
- if (Array.isArray(t)) for (var o = t.length - 1; o >= 0; o--) this.prepend(t[o]);
947
- else {
948
- if (!t[l] && typeof t != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + t);
949
- this.children.unshift(t);
950
- }
951
- return this;
952
- }, a.prototype.walk = function(t) {
953
- for (var o, c = 0, d = this.children.length; c < d; c++) (o = this.children[c])[l] ? o.walk(t) : o !== "" && t(o, { source: this.source, line: this.line, column: this.column, name: this.name });
954
- }, a.prototype.join = function(t) {
955
- var o, c, d = this.children.length;
956
- if (d > 0) {
957
- for (o = [], c = 0; c < d - 1; c++) o.push(this.children[c]), o.push(t);
958
- o.push(this.children[c]), this.children = o;
959
- }
960
- return this;
961
- }, a.prototype.replaceRight = function(t, o) {
962
- var c = this.children[this.children.length - 1];
963
- return c[l] ? c.replaceRight(t, o) : typeof c == "string" ? this.children[this.children.length - 1] = c.replace(t, o) : this.children.push("".replace(t, o)), this;
964
- }, a.prototype.setSourceContent = function(t, o) {
965
- this.sourceContents[n.toSetString(t)] = o;
966
- }, a.prototype.walkSourceContents = function(t) {
967
- for (var o = 0, c = this.children.length; o < c; o++) this.children[o][l] && this.children[o].walkSourceContents(t);
968
- var d = Object.keys(this.sourceContents);
969
- for (o = 0, c = d.length; o < c; o++) t(n.fromSetString(d[o]), this.sourceContents[d[o]]);
970
- }, a.prototype.toString = function() {
971
- var t = "";
972
- return this.walk(function(o) {
973
- t += o;
974
- }), t;
975
- }, a.prototype.toStringWithSourceMap = function(t) {
976
- var o = { code: "", line: 1, column: 0 }, c = new i(t), d = !1, p = null, C = null, g = null, I = null;
977
- return this.walk(function(e, r) {
978
- o.code += e, r.source !== null && r.line !== null && r.column !== null ? (p === r.source && C === r.line && g === r.column && I === r.name || c.addMapping({ source: r.source, original: { line: r.line, column: r.column }, generated: { line: o.line, column: o.column }, name: r.name }), p = r.source, C = r.line, g = r.column, I = r.name, d = !0) : d && (c.addMapping({ generated: { line: o.line, column: o.column } }), p = null, d = !1);
979
- for (var h = 0, u = e.length; h < u; h++) e.charCodeAt(h) === 10 ? (o.line++, o.column = 0, h + 1 === u ? (p = null, d = !1) : d && c.addMapping({ source: r.source, original: { line: r.line, column: r.column }, generated: { line: o.line, column: o.column }, name: r.name })) : o.column++;
980
- }), this.walkSourceContents(function(e, r) {
981
- c.setSourceContent(e, r);
982
- }), { code: o.code, map: c };
983
- }, ae.SourceNode = a, ae;
984
- })().SourceNode), k);
985
- class T {
986
- constructor({ file: n, line: s, function: l, code: a, locals: t = {}, offender: o = !1, column: c }) {
987
- y(this, "file");
988
- y(this, "line");
989
- y(this, "function");
990
- y(this, "code");
991
- y(this, "locals");
992
- y(this, "offender");
993
- y(this, "column");
994
- this.file = n, this.line = s, this.function = l, this.code = a, this.locals = t, this.offender = o, this.column = c;
388
+ const B = {};
389
+ class X {
390
+ constructor({ file: e, line: t, function: i, code: n, locals: o = {}, offender: a = !1, column: r }) {
391
+ u(this, "file");
392
+ u(this, "line");
393
+ u(this, "function");
394
+ u(this, "code");
395
+ u(this, "locals");
396
+ u(this, "offender");
397
+ u(this, "column");
398
+ this.file = e, this.line = t, this.function = i, this.code = n, this.locals = o, this.offender = a, this.column = r;
995
399
  }
996
400
  toDict() {
997
- const n = { file: this.file, line: this.line, function: this.function, code: this.code, locals: Object.fromEntries(Object.entries(this.locals).map(([s, l]) => [s, String(l)])) };
998
- return this.offender && (n.offender = this.offender), this.column !== void 0 && (n.column = this.column), n;
401
+ const e = { file: this.file, line: this.line, function: this.function, code: this.code, locals: Object.fromEntries(Object.entries(this.locals).map(([t, i]) => [t, String(i)])) };
402
+ return this.offender && (e.offender = this.offender), this.column !== void 0 && (e.column = this.column), e;
999
403
  }
1000
404
  toJson() {
1001
405
  return JSON.stringify(this.toDict());
1002
406
  }
1003
407
  }
1004
- class Q {
1005
- static encode(n) {
1006
- return n instanceof T ? n.toDict() : Array.isArray(n) ? n.map((s) => Q.encode(s)) : typeof n == "object" && n !== null ? JSON.stringify(n) : n;
408
+ class z {
409
+ static encode(e) {
410
+ return e instanceof X ? e.toDict() : Array.isArray(e) ? e.map((t) => z.encode(t)) : typeof e == "object" && e !== null ? JSON.stringify(e) : e;
1007
411
  }
1008
- static stringify(n) {
1009
- return JSON.stringify(Q.encode(n), (s, l) => l instanceof T ? l.toDict() : l);
412
+ static stringify(e) {
413
+ return JSON.stringify(z.encode(e), (t, i) => i instanceof X ? i.toDict() : i);
1010
414
  }
1011
415
  }
1012
- let V, K = 0;
1013
- function it(i) {
1014
- A().sfDebug && console.log("Initializing Exception Interceptor...");
416
+ let N, K = 0;
417
+ function we(s) {
418
+ l().sfDebug && console.log("Initializing Exception Interceptor...");
1015
419
  try {
1016
- const c = (function() {
1017
- if (V !== void 0) return V;
1018
- const d = process.env || {}, p = He(d.SF_IS_LOCAL);
1019
- if (p !== void 0) return V = p;
1020
- const C = (d.SF_ENV || d.NODE_ENV || "").toLowerCase();
1021
- if (["local", "dev", "development"].includes(C)) return V = !0;
1022
- if (["KUBERNETES_SERVICE_HOST", "AWS_EXECUTION_ENV", "ECS_CONTAINER_METADATA_URI", "ECS_CONTAINER_METADATA_URI_V4", "GAE_ENV", "K_SERVICE", "GOOGLE_CLOUD_PROJECT", "WEBSITE_INSTANCE_ID", "VERCEL", "NETLIFY", "DYNO", "RENDER", "FLY_APP_NAME", "RAILWAY_STATIC_URL", "CF_PAGES", "CLOUDFLARE"].some((I) => !!d[I])) return V = !1;
1023
- const g = (w.hostname?.() || d.HOSTNAME || "").toLowerCase();
1024
- return g === "localhost" || g.endsWith(".local") || g.includes("local") ? V = !0 : V = !1;
420
+ const r = (function() {
421
+ if (N !== void 0) return N;
422
+ const g = process.env || {}, c = le(g.SF_IS_LOCAL);
423
+ if (c !== void 0) return N = c;
424
+ const I = (g.SF_ENV || g.NODE_ENV || "").toLowerCase();
425
+ if (["local", "dev", "development"].includes(I)) return N = !0;
426
+ if (["KUBERNETES_SERVICE_HOST", "AWS_EXECUTION_ENV", "ECS_CONTAINER_METADATA_URI", "ECS_CONTAINER_METADATA_URI_V4", "GAE_ENV", "K_SERVICE", "GOOGLE_CLOUD_PROJECT", "WEBSITE_INSTANCE_ID", "VERCEL", "NETLIFY", "DYNO", "RENDER", "FLY_APP_NAME", "RAILWAY_STATIC_URL", "CF_PAGES", "CLOUDFLARE"].some((C) => !!g[C])) return N = !1;
427
+ const d = (B.hostname?.() || g.HOSTNAME || "").toLowerCase();
428
+ return d === "localhost" || d.endsWith(".local") || d.includes("local") ? N = !0 : N = !1;
1025
429
  })();
1026
- i?.setSupplementalFields?.({ isFromLocalService: c }), (async function(d) {
1027
- if (_e) return;
1028
- _e = !0;
1029
- const p = process.env || {};
1030
- if (He(p.SF_IS_LOCAL) === void 0)
430
+ s?.setSupplementalFields?.({ isFromLocalService: r }), (async function(g) {
431
+ if (ge) return;
432
+ ge = !0;
433
+ const c = process.env || {};
434
+ if (le(c.SF_IS_LOCAL) === void 0)
1031
435
  try {
1032
- await (async function(C) {
1033
- const g = ce("http://169.254.169.254/latest/meta-data/", {}, C), I = ce("http://metadata.google.internal/computeMetadata/v1/instance/", { "Metadata-Flavor": "Google" }, C), e = ce("http://169.254.169.254/metadata/instance?api-version=2021-02-01", { Metadata: "true" }, C);
1034
- return (await Promise.allSettled([g, I, e])).some((r) => r.status === "fulfilled" && (r.value === "ok" || r.value === "http_error"));
1035
- })(150) && V && (V = !1, d?.setSupplementalFields?.({ isFromLocalService: !1 }));
436
+ await (async function(I) {
437
+ const d = M("http://169.254.169.254/latest/meta-data/", {}, I), C = M("http://metadata.google.internal/computeMetadata/v1/instance/", { "Metadata-Flavor": "Google" }, I), p = M("http://169.254.169.254/metadata/instance?api-version=2021-02-01", { Metadata: "true" }, I);
438
+ return (await Promise.allSettled([d, C, p])).some((h) => h.status === "fulfilled" && (h.value === "ok" || h.value === "http_error"));
439
+ })(150) && N && (N = !1, g?.setSupplementalFields?.({ isFromLocalService: !1 }));
1036
440
  } catch {
1037
441
  }
1038
- })(i).catch(() => {
442
+ })(s).catch(() => {
1039
443
  });
1040
444
  } catch {
1041
445
  }
1042
- const n = new ke(new URL("data:application/javascript;base64,aW1wb3J0IHsgU2Vzc2lvbiB9IGZyb20gImluc3BlY3Rvci9wcm9taXNlcyI7CmltcG9ydCB7IHBhcmVudFBvcnQsIHdvcmtlckRhdGEgfSBmcm9tICJ3b3JrZXJfdGhyZWFkcyI7CgpnbG9iYWwuc2ZEZWJ1ZyA9IHVuZGVmaW5lZDsKZ2xvYmFsLnN0YWNrRGVwdGhMb2NhbHMgPSB1bmRlZmluZWQ7Cmdsb2JhbC5ub2RlTW9kdWxlc1RvQ29sbGVjdExvY2FsVmFyaWFibGVzT24gPSB1bmRlZmluZWQ7CgovKioKICogUHJvY2Vzc2VzIGNhbGwgZnJhbWVzIGZyb20gYW4gZXhjZXB0aW9uIGFuZCBwb3N0cyB0aGVtIHZpYSB0aGUgV29ya2Vy4oCZcyBwYXJlbnRQb3J0LgogKgogKiBAcGFyYW0gc2Vzc2lvbiAtIFRoZSBEZXZUb29scyBzZXNzaW9uIG9yIHNpbWlsYXIgb2JqZWN0IHlvdSB1c2UgdG8gcXVlcnkgZm9yIHNjcmlwdCBzb3VyY2VzLgogKiBAcGFyYW0gY2FsbEZyYW1lcyAtIEFuIGFycmF5IG9mIGNhbGwgZnJhbWUgb2JqZWN0cy4KICogQHBhcmFtIGRlc2NyaXB0aW9uTGluZXMgLSBBbiBhcnJheSBvZiBsaW5lcyBmcm9tIHRoZSBlcnJvcuKAmXMgZGVzY3JpcHRpb24sIGVhY2ggdHlwaWNhbGx5IGJlZ2lubmluZyB3aXRoICJhdCAiLgogKiBAcmV0dXJucyB7UHJvbWlzZTx2b2lkPn0KICovCmV4cG9ydCBhc3luYyBmdW5jdGlvbiBwcm9jZXNzQ2FsbEZyYW1lcyhzZXNzaW9uLCBjYWxsRnJhbWVzLCBkZXNjcmlwdGlvbkxpbmVzKSB7CiAgLyoqCiAgICogTGltaXQgdGhlIGNhbG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FsU2NvcGUub2JqZWN0Lm9iamVjdElkKQogICAgICAgICAgOiB7fTsKCiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGZ1bmN0aW9uOiBmdW5jdGlvbk5hbWUgfHwgIjxhbm9ueW1vdXM+IiwKICAgICAgICAgIGxvY2FscywKICAgICAgICAgIGZpbGUsCiAgICAgICAgICBsaW5lOiBsb2NhdGlvbj8ubGluZU51bWJlciB8fCAwLAogICAgICAgICAgY29kZSwKICAgICAgICB9OwogICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgIGlmIChnbG9iYWwuc2ZEZWJ1ZykgewogICAgICAgICAgY29uc29sZS5lcnJvcigiW1dvcmtlcl0gRXJyb3IgcHJvY2Vzc2luZyBjYWxsIGZyYW1lOiIsIGVycm9yKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGZ1bmN0aW9uOiAiPGVycm9yPiIsCiAgICAgICAgICBsb2NhbHM6IHt9LAogICAgICAgICAgZmlsZTogIjx1bmtub3duPiIsCiAgICAgICAgICBsaW5lOiAwLAogICAgICAgICAgY29kZTogIjxub3QgY2FwdHVyZWQ+IiwKICAgICAgICB9OwogICAgICB9CiAgICB9KSwKICApOwogIC8vIFBvc3QgZXhjZXB0aW9uIGRhdGEKICBwYXJlbnRQb3J0Py5wb3N0TWVzc2FnZSh7IHR5cGU6ICJleGNlcHRpb24iLCBmcmFtZXMgfSk7Cn0KCi8qKgogKiBIYW5kbGVzIHRoZSAicGF1c2VkIiBzdGF0ZSBvZiB0aGUgZGVidWdnZXIgYW5kIHByb2Nlc3NlcyBleGNlcHRpb25zIG9yIHByb21pc2UgcmVqZWN0aW9ucy4KICogQHBhcmFtIHtTZXNzaW9ufSBzZXNzaW9uIC0gVGhlIGRlYnVnZ2luZyBzZXNzaW9uIGluc3RhbmNlLgogKiBAcGFyYW0ge29iamVjdH0gcGFyYW1zIC0gUGFyYW1ldGVycyBmcm9tIHRoZSAicGF1c2VkIiBldmVudC4KICov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ibGVzKTsKICAgICAgICB9IGVsc2UgaWYgKHByb3A/LnZhbHVlKSB7CiAgICAgICAgICB1bnJvbGxPdGhlcihwcm9wLCB2YXJpYWJsZXMpOwogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gdmFyaWFibGVzOwogICAgfQogIH0gY2F0Y2ggKGVycikgewogICAgaWYgKGdsb2JhbC5zZkRlYnVnKSB7CiAgICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBmZXRjaCBsb2NhbCB2YXJpYWJsZXM6IiwgZXJyKTsKICAgIH0KICAgIHJldHVybiB7fTsKICB9Cn0KCnN0YXJ0RGVidWdnZXIoKS5jYXRjaCgoZXJyb3IpID0+IHsKICBpZiAoZ2xvYmFsLnNmRGVidWcpIHsKICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlcjoiLCBlcnJvcik7CiAgfQp9KTsKCi8vIEtlZXAgdGhlIHdvcmtlciBhbGl2ZQpzZXRJbnRlcnZhbCgoKSA9PiB7fSwgMTAwMDApOwo="), { workerData: { captureAllExceptions: !0 } });
1043
- let s = null;
1044
- const l = /* @__PURE__ */ new WeakMap();
1045
- n.on("message", (c) => {
1046
- if (typeof c == "string" && A().sfDebug && console.log(`[Worker] ${c}`), c.readyToGetParameters && n.postMessage({ sfDebug: A().sfDebug, stackDepthLocals: A().stackDepthLocals, nodeModulesToCollectLocalVariablesOn: A().nodeModulesToCollectLocalVariablesOn }), c.type === "exception") {
1047
- const { frames: d } = c, p = s;
1048
- if (!p) return;
1049
- const C = l.get(p), g = (function(e) {
1050
- return e ? e.split(`
1051
- `).slice(1).map((r) => {
1052
- const h = /at (.+?) \((.+):(\d+):(\d+)\)/.exec(r) || /at (.+):(\d+):(\d+)/.exec(r);
1053
- if (h) {
1054
- const [, u, m, f, b] = h;
1055
- return new T({ function: u || "<anonymous>", locals: {}, file: m || "<unknown>", line: parseInt(f, 10) || 0,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Byb3A/LnZhbHVlKSB7CiAgICAgICAgICB1bnJvbGxPdGhlcihwcm9wLCB2YXJpYWJsZXMpOwogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gdmFyaWFibGVzOwogICAgfQogIH0gY2F0Y2ggKGVycikgewogICAgaWYgKGdsb2JhbC5zZkRlYnVnKSB7CiAgICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBmZXRjaCBsb2NhbCB2YXJpYWJsZXM6IiwgZXJyKTsKICAgIH0KICAgIHJldHVybiB7fTsKICB9Cn0KCnN0YXJ0RGVidWdnZXIoKS5jYXRjaCgoZXJyb3IpID0+IHsKICBpZiAoZ2xvYmFsLnNmRGVidWcpIHsKICAgIGNvbnNvbGUuZXJyb3IoIltXb3JrZXJdIEZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlcjoiLCBlcnJvcik7CiAgfQp9KTsKCi8vIEtlZXAgdGhlIHdvcmtlciBhbGl2ZQpzZXRJbnRlcnZhbCgoKSA9PiB7fSwgMTAwMDApOwo="), { workerData: { captureAllExceptions: !0 } });
447
+ let t = null;
448
+ const i = /* @__PURE__ */ new WeakMap();
449
+ e.on("message", (r) => {
450
+ if (typeof r == "string" && l().sfDebug && console.log(`[Worker] ${r}`), r.readyToGetParameters && e.postMessage({ sfDebug: l().sfDebug, stackDepthLocals: l().stackDepthLocals, nodeModulesToCollectLocalVariablesOn: l().nodeModulesToCollectLocalVariablesOn }), r.type === "exception") {
451
+ const { frames: g } = r, c = t;
452
+ if (!c) return;
453
+ const I = i.get(c), d = (function(p) {
454
+ return p ? p.split(`
455
+ `).slice(1).map((h) => {
456
+ const A = /at (.+?) \((.+):(\d+):(\d+)\)/.exec(h) || /at (.+):(\d+):(\d+)/.exec(h);
457
+ if (A) {
458
+ const [, b, Z, f, m] = A;
459
+ return new X({ function: b || "<anonymous>", locals: {}, file: Z || "<unknown>", line: parseInt(f, 10) || 0, code: "<not captured>", column: parseInt(m) || 0 });
1056
460
  }
1057
- return new T({ function: "<unknown>", locals: {}, file: "<unknown>", line: 0, code: "<not captured>", column: 0 });
461
+ return new X({ function: "<unknown>", locals: {}, file: "<unknown>", line: 0, code: "<not captured>", column: 0 });
1058
462
  }) : [];
1059
- })(p.stack), I = (function(e, r) {
1060
- const h = [];
1061
- let u = -1, m = -1;
1062
- for (let f = 0; f < e.length; f++) {
1063
- const b = at(e[f].file);
1064
- if (m = f, b !== "<unknown>") {
1065
- for (let v = 0; v < r.length; v++) {
1066
- const S = r[v];
1067
- if (Oe(S, b) || typeof S.file == "string" && S.file.includes(b)) {
1068
- u = v, K = 0, A().sfDebug && console.log(`✅ Matched Frame Found: ${b} @ Debugger Frame ${v}`);
463
+ })(c.stack), C = (function(p, h) {
464
+ const A = [];
465
+ let b = -1, Z = -1;
466
+ for (let f = 0; f < p.length; f++) {
467
+ const m = Re(p[f].file);
468
+ if (Z = f, m !== "<unknown>") {
469
+ for (let y = 0; y < h.length; y++) {
470
+ const x = h[y];
471
+ if (be(x, m) || typeof x.file == "string" && x.file.includes(m)) {
472
+ b = y, K = 0, l().sfDebug && console.log(`✅ Matched Frame Found: ${m} @ Debugger Frame ${y}`);
1069
473
  break;
1070
474
  }
1071
475
  }
1072
- if (u !== -1) break;
476
+ if (b !== -1) break;
1073
477
  }
1074
478
  }
1075
- if (u === -1) return K === 10 ? (K = 0, e) : (++K, A().sfDebug && console.log(`"❌ No matching frame found. Checking once again, Attempt N ${K}"`), []);
1076
- A().sfDebug && console.log(`🔄 Merging from matched index ${u} onward...`);
1077
- for (let f = 0; f < r.length; f++) {
1078
- const b = e[m + f], v = r[u + f];
1079
- h.push(new T({ function: v?.function || b?.function || "<anonymous>", locals: v?.locals || b?.locals || {}, file: b?.file || v?.file || "<unknown>", line: v?.line || b?.line || 0, code: v?.code || b?.code || "<not captured>" }));
479
+ if (b === -1) return K === 10 ? (K = 0, p) : (++K, l().sfDebug && console.log(`"❌ No matching frame found. Checking once again, Attempt N ${K}"`), []);
480
+ l().sfDebug && console.log(`🔄 Merging from matched index ${b} onward...`);
481
+ for (let f = 0; f < h.length; f++) {
482
+ const m = p[Z + f], y = h[b + f];
483
+ A.push(new X({ function: y?.function || m?.function || "<anonymous>", locals: y?.locals || m?.locals || {}, file: m?.file || y?.file || "<unknown>", line: y?.line || m?.line || 0, code: y?.code || m?.code || "<not captured>" }));
1080
484
  }
1081
- return h;
1082
- })(g, d || []);
1083
- if (I.length !== 0) {
1084
- s = null;
1085
- const e = A().stackDepthCodeTraceDepth, r = e === -1 ? I : I.slice(0, e + 1), h = Math.min(r.length, g.length);
1086
- for (let b = 0; b < h; b++) (async () => {
1087
- const v = st(r[b].file, g[b].line, g[b].column);
1088
- v && (v.content != null && (r[b].code = v.content), v.file != null && (r[b].file = v.file));
485
+ return A;
486
+ })(d, g || []);
487
+ if (C.length !== 0) {
488
+ t = null;
489
+ const p = l().stackDepthCodeTraceDepth, h = p === -1 ? C : C.slice(0, p + 1), A = Math.min(h.length, d.length);
490
+ for (let m = 0; m < A; m++) (async () => {
491
+ const y = He(h[m].file, d[m].line, d[m].column);
492
+ y && (y.content != null && (h[m].code = y.content), y.file != null && (h[m].file = y.file));
1089
493
  })();
1090
- i.setOperationName("CollectExceptions");
1091
- const u = p.message ? `${p.name}: ${p.message}` : p.name;
1092
- A().sfDebug && console.log("error message is : ", u);
1093
- const m = N.getInstance(), f = l.get(p);
1094
- f ? (m.setTraceIdFor(f, f), m.runWithSession(f, () => {
1095
- m.setTraceId(f), i.doSend(u, r);
1096
- })) : i.doSend(u, r), C ? N.getInstance().runWithSession(C, () => {
1097
- i.doSend(u, r);
1098
- }) : i.doSend(u, r);
494
+ s.setOperationName("CollectExceptions");
495
+ const b = c.message ? `${c.name}: ${c.message}` : c.name;
496
+ l().sfDebug && console.log("error message is : ", b);
497
+ const Z = G.getInstance(), f = i.get(c);
498
+ f ? (Z.setTraceIdFor(f, f), Z.runWithSession(f, () => {
499
+ Z.setTraceId(f), s.doSend(b, h);
500
+ })) : s.doSend(b, h), I ? G.getInstance().runWithSession(I, () => {
501
+ s.doSend(b, h);
502
+ }) : s.doSend(b, h);
1099
503
  }
1100
504
  }
1101
- }), n.on("error", (c) => {
1102
- console.error("[Worker Error]", c);
1103
- }), n.on("exit", (c) => {
1104
- console.error(`[Worker] Exited with code ${c}`);
1105
- }), n.unref();
1106
- const a = Error, t = /* @__PURE__ */ new Set();
1107
- function o(...c) {
1108
- const d = Reflect.construct(a, c);
1109
- Reflect.setPrototypeOf(d, o.prototype);
505
+ }), e.on("error", (r) => {
506
+ console.error("[Worker Error]", r);
507
+ }), e.on("exit", (r) => {
508
+ console.error(`[Worker] Exited with code ${r}`);
509
+ }), e.unref();
510
+ const n = Error, o = /* @__PURE__ */ new Set();
511
+ function a(...r) {
512
+ const g = Reflect.construct(n, r);
513
+ Reflect.setPrototypeOf(g, a.prototype);
1110
514
  try {
1111
- const C = N.getInstance().getTraceId();
1112
- l.set(d, C);
515
+ const I = G.getInstance().getTraceId();
516
+ i.set(g, I);
1113
517
  } catch {
1114
518
  }
1115
- a.captureStackTrace && a.captureStackTrace(d, o);
1116
- const p = `${d.message}:${d.stack?.split(`
519
+ n.captureStackTrace && n.captureStackTrace(g, a);
520
+ const c = `${g.message}:${g.stack?.split(`
1117
521
  `)[1]?.trim()}`;
1118
- if (!t.has(p)) {
1119
- t.add(p), s = d;
1120
- const C = N.getInstance().getTraceId();
1121
- l.set(d, C), n.postMessage({ type: "processException", error: d.message });
522
+ if (!o.has(c)) {
523
+ o.add(c), t = g;
524
+ const I = G.getInstance().getTraceId();
525
+ i.set(g, I), e.postMessage({ type: "processException", error: g.message });
1122
526
  }
1123
- return d;
527
+ return g;
1124
528
  }
1125
- o.prototype = Object.create(a.prototype, { constructor: { value: o, enumerable: !1, writable: !0, configurable: !0 } }), Object.setPrototypeOf(o, a), globalThis.Error = o;
529
+ a.prototype = Object.create(n.prototype, { constructor: { value: a, enumerable: !1, writable: !0, configurable: !0 } }), Object.setPrototypeOf(a, n), globalThis.Error = a;
1126
530
  }
1127
- function Ve(i) {
1128
- return i = (i = (i = i.replace(/^webpack:\/\/[^\/]+\/\.?\//, "")).replace(/^.*\/pages\//, "pages/")).replace(/\.(js|ts)$/, "");
531
+ function ce(s) {
532
+ return s = (s = (s = s.replace(/^webpack:\/\/[^\/]+\/\.?\//, "")).replace(/^.*\/pages\//, "pages/")).replace(/\.(js|ts)$/, "");
1129
533
  }
1130
- function st(i, n, s) {
1131
- const l = (function(t) {
1132
- t.startsWith("at ") && (t = t.slice(3).trim());
1133
- const o = t.match(/^(.*?)(:\d+)+(\.map)?$/);
1134
- return o ? o[1] : t;
1135
- })(i);
1136
- if (!l || l === "<unknown>") return null;
1137
- const a = l + ".map";
534
+ function He(s, e, t) {
535
+ const i = (function(o) {
536
+ o.startsWith("at ") && (o = o.slice(3).trim());
537
+ const a = o.match(/^(.*?)(:\d+)+(\.map)?$/);
538
+ return a ? a[1] : o;
539
+ })(s);
540
+ if (!i || i === "<unknown>") return null;
541
+ const n = i + ".map";
1138
542
  try {
1139
- const t = Ue(a, "utf-8");
1140
- if (t) {
1141
- const o = JSON.parse(t);
1142
- let c = new De.SourceMapConsumer(o).originalPositionFor({ line: n, column: s });
1143
- if (l && c.source) {
1144
- const d = Ve(l), p = o.sources.findIndex((C) => Ve(C) === d);
1145
- if (p === -1) A().sfDebug && console.log(`Source file "${l}" not found in the source map.`);
543
+ const o = ue(n, "utf-8");
544
+ if (o) {
545
+ const a = JSON.parse(o);
546
+ let r = new Ce.SourceMapConsumer(a).originalPositionFor({ line: e, column: t });
547
+ if (i && r.source) {
548
+ const g = ce(i), c = a.sources.findIndex((I) => ce(I) === g);
549
+ if (c === -1) l().sfDebug && console.log(`Source file "${i}" not found in the source map.`);
1146
550
  else {
1147
- const C = o.sourcesContent[p], g = o.names.join(",");
1148
- if (C)
1149
- return { content: C.split(`
1150
- `).slice(c.line - 1, c.line + 20).join(`
1151
- `), name: g, file: c.source };
1152
- A().sfDebug && console.log(`No source content available for file "${l}".`);
551
+ const I = a.sourcesContent[c], d = a.names.join(",");
552
+ if (I)
553
+ return { content: I.split(`
554
+ `).slice(r.line - 1, r.line + 20).join(`
555
+ `), name: d, file: r.source };
556
+ l().sfDebug && console.log(`No source content available for file "${i}".`);
1153
557
  }
1154
558
  }
1155
- return { content: o.sourcesContent[0], name: o.names[0], file: o.file };
559
+ return { content: a.sourcesContent[0], name: a.names[0], file: a.file };
1156
560
  }
1157
- } catch (t) {
1158
- A().sfDebug && console.log(`Cant read/parse "${a}: Error - ".`, t);
561
+ } catch (o) {
562
+ l().sfDebug && console.log(`Cant read/parse "${n}: Error - ".`, o);
1159
563
  }
1160
564
  return null;
1161
565
  }
1162
- function at(i) {
1163
- return i?.split("/").pop() || "<unknown>";
566
+ function Re(s) {
567
+ return s?.split("/").pop() || "<unknown>";
1164
568
  }
1165
- function Oe(i, n) {
1166
- if (!i || typeof i != "object") return !1;
1167
- for (const s of Object.values(i))
1168
- if (typeof s == "string" && s.includes(n) || typeof s == "object" && Oe(s, n)) return !0;
569
+ function be(s, e) {
570
+ if (!s || typeof s != "object") return !1;
571
+ for (const t of Object.values(s))
572
+ if (typeof t == "string" && t.includes(e) || typeof t == "object" && be(t, e)) return !0;
1169
573
  return !1;
1170
574
  }
1171
- let _e = !1;
1172
- function He(i) {
1173
- if (!i) return;
1174
- const n = i.toLowerCase().trim();
1175
- return !!["1", "true", "yes", "on"].includes(n) || !["0", "false", "no", "off"].includes(n) && void 0;
575
+ let ge = !1;
576
+ function le(s) {
577
+ if (!s) return;
578
+ const e = s.toLowerCase().trim();
579
+ return !!["1", "true", "yes", "on"].includes(e) || !["0", "false", "no", "off"].includes(e) && void 0;
1176
580
  }
1177
- function ce(i, n, s) {
1178
- return new Promise((l) => {
581
+ function M(s, e, t) {
582
+ return new Promise((i) => {
1179
583
  try {
1180
- const a = new URL(i), t = (a.protocol, w).request({ method: "GET", hostname: a.hostname, port: a.port || (a.protocol === "https:" ? 443 : 80), path: a.pathname + (a.search || ""), headers: n }, (o) => {
1181
- o.resume(), o.statusCode && o.statusCode >= 200 && o.statusCode < 400 ? l("ok") : l("http_error");
584
+ const n = new URL(s), o = (n.protocol, B).request({ method: "GET", hostname: n.hostname, port: n.port || (n.protocol === "https:" ? 443 : 80), path: n.pathname + (n.search || ""), headers: e }, (a) => {
585
+ a.resume(), a.statusCode && a.statusCode >= 200 && a.statusCode < 400 ? i("ok") : i("http_error");
1182
586
  });
1183
- t.on("error", () => l("error")), t.setTimeout(s, () => {
1184
- t.destroy(), l("timeout");
1185
- }), t.end();
587
+ o.on("error", () => i("error")), o.setTimeout(t, () => {
588
+ o.destroy(), i("timeout");
589
+ }), o.end();
1186
590
  } catch {
1187
- l("error");
591
+ i("error");
1188
592
  }
1189
593
  });
1190
594
  }
1191
- class ct extends E {
595
+ class Ye extends R {
1192
596
  constructor() {
1193
597
  super();
1194
- y(this, "serviceIdentifier", new D());
1195
- y(this, "supplementalFields", {});
598
+ u(this, "serviceIdentifier", new T());
599
+ u(this, "supplementalFields", {});
1196
600
  this.setOperationName("CollectExceptions");
1197
601
  }
1198
- setSupplementalFields(s) {
1199
- this.supplementalFields = { ...this.supplementalFields, ...s };
602
+ setSupplementalFields(t) {
603
+ this.supplementalFields = { ...this.supplementalFields, ...t };
1200
604
  }
1201
605
  normalizedSupplementalForGraphQL() {
1202
- const { isFromLocalService: s } = this.supplementalFields, l = {};
1203
- return s !== void 0 && (l.isFromLocalService = s), l;
606
+ const { isFromLocalService: t } = this.supplementalFields, i = {};
607
+ return t !== void 0 && (i.isFromLocalService = t), i;
1204
608
  }
1205
609
  async sendAppIdentifier() {
1206
610
  this.serviceIdentifier.doSend({});
1207
611
  }
1208
- async doSend(s, l) {
1209
- this.sendAppIdentifier(), this.send(s, l);
612
+ async doSend(t, i) {
613
+ this.sendAppIdentifier(), this.send(t, i);
1210
614
  }
1211
- async send(s, l) {
1212
- A().sfDebug && console.log(" SENDING EXCEPTION...");
1213
- const a = JSON.stringify(Q.encode(l)), t = this.normalizedSupplementalForGraphQL(), o = this.getVariables({ exceptionMessage: s, traceJson: a, reentrancyGuardPreactive: !1, library: A().packageLibraryType, version: A().version, ...t });
1214
- H(this.endpoint, this.operationName, this.getQuery(), o);
615
+ async send(t, i) {
616
+ l().sfDebug && console.log(" SENDING EXCEPTION...");
617
+ const n = JSON.stringify(z.encode(i)), o = this.normalizedSupplementalForGraphQL(), a = this.getVariables({ exceptionMessage: t, traceJson: n, reentrancyGuardPreactive: !1, library: l().packageLibraryType, version: l().version, ...o });
618
+ F(this.endpoint, this.operationName, this.getQuery(), a);
1215
619
  }
1216
620
  getQuery() {
1217
621
  return `
@@ -1225,7 +629,8 @@ class ct extends E {
1225
629
  $library: String!,
1226
630
  $timestampMs: String!,
1227
631
  $version: String!,
1228
- $isFromLocalService: Boolean
632
+ $isFromLocalService: Boolean,
633
+ $parentSpanId: String
1229
634
  ) {
1230
635
  ${this.queryName}(
1231
636
  apiKey: $apiKey,
@@ -1237,58 +642,59 @@ class ct extends E {
1237
642
  library: $library,
1238
643
  timestampMs: $timestampMs,
1239
644
  version: $version,
1240
- isFromLocalService: $isFromLocalService
645
+ isFromLocalService: $isFromLocalService,
646
+ parentSpanId: $parentSpanId
1241
647
  )
1242
648
  }
1243
649
  `;
1244
650
  }
1245
651
  }
1246
- const Le = "getting request source code";
1247
- var j = ((i) => (i.UNKNOWN = "unknown", i.ANONYMOUS = "anonymous", i.NOT_CAPTURED = "not captured", i))(j || {});
1248
- const le = "http:", ge = "https:";
1249
- let Ee = !1;
1250
- function lt() {
1251
- const i = A().sfDebug;
1252
- if (Ee) return void (i && console.log("[patchNodeHttpInbound] Already installed, skipping."));
1253
- let n;
1254
- Ee = !0;
652
+ const Ie = "getting request source code";
653
+ var L = ((s) => (s.UNKNOWN = "unknown", s.ANONYMOUS = "anonymous", s.NOT_CAPTURED = "not captured", s))(L || {});
654
+ const j = "http:", Q = "https:";
655
+ let de = !1;
656
+ function Ke() {
657
+ const s = l().sfDebug;
658
+ if (de) return void (s && console.log("[patchNodeHttpInbound] Already installed, skipping."));
659
+ let e;
660
+ de = !0;
1255
661
  try {
1256
- n = require("node:http"), i && console.log("[patchNodeHttpInbound] node:http required successfully.");
1257
- } catch (a) {
1258
- return void console.error("Failed to require node:http:", a);
1259
- }
1260
- if (!n?.Server?.prototype) return void (i && console.log("[patchNodeHttpInbound] http.Server.prototype not found."));
1261
- const s = n.Server.prototype, l = s.emit;
1262
- l && !s.__sf_inbound_patched__ ? (Object.defineProperty(s, "__sf_inbound_patched__", { value: !0, enumerable: !1, configurable: !1, writable: !1 }), i && console.log("[patchNodeHttpInbound] Patching http.Server.prototype.emit."), s.emit = function(a, ...t) {
1263
- if (a !== "request") return i && console.log(`[patchNodeHttpInbound] Passing through event: ${a}`), l.call(this, a, ...t);
1264
- const o = t[0], c = t[1], d = (function(I) {
1265
- const e = {};
1266
- if (!I) return e;
1267
- for (const [r, h] of Object.entries(I)) h != null && (Array.isArray(h) ? e[r.toLowerCase()] = h.join(", ") : e[r.toLowerCase()] = String(h));
1268
- return e;
1269
- })(o?.headers), p = d["x-sf3-rid"];
1270
- i && (console.log("[patchNodeHttpInbound] Intercepted request event."), console.log("[patchNodeHttpInbound] Inbound headers:", d), console.log("[patchNodeHttpInbound] Trace header:", p));
1271
- const C = N.getInstance();
1272
- C.setTraceId(p);
1273
- const g = C.getTraceId();
1274
- return i && console.log("[patchNodeHttpInbound] Context traceId set:", g), C.runWith({ inboundHeaders: d, ...p ? { traceId: p } : {} }, () => {
1275
- p && C.setTraceId(p), i && console.log("[patchNodeHttpInbound] Running request handler in context.");
1276
- const I = () => {
1277
- i && console.log("[patchNodeHttpInbound] Response finished/closed for traceId:", C.getTraceId());
662
+ e = require("node:http"), s && console.log("[patchNodeHttpInbound] node:http required successfully.");
663
+ } catch (n) {
664
+ return void console.error("Failed to require node:http:", n);
665
+ }
666
+ if (!e?.Server?.prototype) return void (s && console.log("[patchNodeHttpInbound] http.Server.prototype not found."));
667
+ const t = e.Server.prototype, i = t.emit;
668
+ i && !t.__sf_inbound_patched__ ? (Object.defineProperty(t, "__sf_inbound_patched__", { value: !0, enumerable: !1, configurable: !1, writable: !1 }), s && console.log("[patchNodeHttpInbound] Patching http.Server.prototype.emit."), t.emit = function(n, ...o) {
669
+ if (n !== "request") return s && console.log(`[patchNodeHttpInbound] Passing through event: ${n}`), i.call(this, n, ...o);
670
+ const a = o[0], r = o[1], g = (function(C) {
671
+ const p = {};
672
+ if (!C) return p;
673
+ for (const [h, A] of Object.entries(C)) A != null && (Array.isArray(A) ? p[h.toLowerCase()] = A.join(", ") : p[h.toLowerCase()] = String(A));
674
+ return p;
675
+ })(a?.headers), c = g["x-sf3-rid"];
676
+ s && (console.log("[patchNodeHttpInbound] Intercepted request event."), console.log("[patchNodeHttpInbound] Inbound headers:", g), console.log("[patchNodeHttpInbound] Trace header:", c));
677
+ const I = G.getInstance();
678
+ I.setTraceId(c);
679
+ const d = I.getTraceId();
680
+ return s && console.log("[patchNodeHttpInbound] Context traceId set:", d), I.runWith({ inboundHeaders: g, ...c ? { traceId: c } : {} }, () => {
681
+ c && I.setTraceId(c), s && console.log("[patchNodeHttpInbound] Running request handler in context.");
682
+ const C = () => {
683
+ s && console.log("[patchNodeHttpInbound] Response finished/closed for traceId:", I.getTraceId());
1278
684
  };
1279
- return c.on("finish", I), c.on("close", I), l.call(this, a, o, c);
685
+ return r.on("finish", C), r.on("close", C), i.call(this, n, a, r);
1280
686
  });
1281
- }) : i && console.log("[patchNodeHttpInbound] Already patched, skipping.");
687
+ }) : s && console.log("[patchNodeHttpInbound] Already patched, skipping.");
1282
688
  }
1283
- class gt extends de {
689
+ class Ue extends ne {
1284
690
  constructor() {
1285
691
  super(), this.setOperationName("DomainsToNotPassHeaderTo");
1286
692
  }
1287
- async doSend(n) {
1288
- this.sendAppIdentifier(), this.send(n);
693
+ async doSend(e) {
694
+ this.sendAppIdentifier(), this.send(e);
1289
695
  }
1290
- async send(n) {
1291
- const s = `
696
+ async send(e) {
697
+ const t = `
1292
698
  ${this.queryType} ${this.operationName}(
1293
699
  $apiKey: String!,
1294
700
  $serviceUuid: String!,
@@ -1300,25 +706,25 @@ class gt extends de {
1300
706
  domains: $domains
1301
707
  )
1302
708
  }
1303
- `, l = { apiKey: this.apiKey, serviceUuid: this.serviceUUID, domains: n };
1304
- H(this.endpoint, this.operationName, s, l);
709
+ `, i = { apiKey: this.apiKey, serviceUuid: this.serviceUUID, domains: e };
710
+ F(this.endpoint, this.operationName, t, i);
1305
711
  }
1306
712
  }
1307
- class ut extends E {
713
+ class Xe extends R {
1308
714
  constructor() {
1309
715
  super();
1310
- y(this, "serviceIdentifier", new D());
716
+ u(this, "serviceIdentifier", new T());
1311
717
  this.setOperationName("CollectNetworkHops");
1312
718
  }
1313
719
  async sendAppIdentifier() {
1314
720
  this.serviceIdentifier.doSend({});
1315
721
  }
1316
- async doSend(s) {
1317
- this.sendAppIdentifier(), this.send(s);
722
+ async doSend(t) {
723
+ this.sendAppIdentifier(), this.send(t);
1318
724
  }
1319
- async send(s) {
1320
- const { name: l, column: a, line: t, entrypoint: o, retryWithoutTraceId: c } = s, d = this.getVariables({ name: l, column: a, line: t, entrypoint: o, retryWithoutTraceId: c });
1321
- H(this.endpoint, this.operationName, this.getQuery(), d);
725
+ async send(t) {
726
+ const { name: i, column: n, line: o, entrypoint: a, retryWithoutTraceId: r } = t, g = this.getVariables({ name: i, column: n, line: o, entrypoint: a, retryWithoutTraceId: r });
727
+ F(this.endpoint, this.operationName, this.getQuery(), g);
1322
728
  }
1323
729
  getQuery() {
1324
730
  return `
@@ -1348,17 +754,17 @@ class ut extends E {
1348
754
  `;
1349
755
  }
1350
756
  }
1351
- class dt extends E {
757
+ class Je extends R {
1352
758
  constructor() {
1353
759
  super();
1354
- y(this, "serviceIdentifier", new D());
760
+ u(this, "serviceIdentifier", new T());
1355
761
  this.setOperationName("CollectNetworkRequest");
1356
762
  }
1357
763
  async sendAppIdentifier() {
1358
764
  this.serviceIdentifier.doSend({});
1359
765
  }
1360
- async doSend(s) {
1361
- this.sendAppIdentifier(), this.send(s);
766
+ async doSend(t) {
767
+ this.sendAppIdentifier(), this.send(t);
1362
768
  }
1363
769
  getQuery() {
1364
770
  return `
@@ -1370,182 +776,182 @@ class dt extends E {
1370
776
  }
1371
777
  `;
1372
778
  }
1373
- async send(s) {
1374
- const l = { data: { ...s } };
1375
- await H(this.endpoint, this.operationName, this.getQuery(), l);
779
+ async send(t) {
780
+ const i = { data: { ...t } };
781
+ await F(this.endpoint, this.operationName, this.getQuery(), i);
1376
782
  }
1377
783
  }
1378
- const ue = [400, 403];
1379
- class It {
1380
- constructor(n = []) {
1381
- y(this, "HEADER_TRACING", "X-Sf3-Rid");
1382
- y(this, "HEADER_LOG_GUARD", "reentrancy_guard_logging_preactive");
1383
- y(this, "HEADER_PRINT_GUARD", "reentrancy_guard_print_preactive");
1384
- y(this, "HEADER_EXCEPTION_GUARD", "reentrancy_guard_exception_preactive");
1385
- y(this, "contextManager");
1386
- this.contextManager = N.getInstance(), n?.forEach((s) => {
1387
- typeof s == "string" && s.trim() && this.contextManager.getExcludedDomains().add(s);
1388
- }), A().sfDebug && console.log("[RequestInterceptor] Initialized with static excluded domains.");
1389
- }
1390
- extractIdsFromTraceHeader(n, s = this.HEADER_TRACING) {
1391
- let l;
1392
- if (n instanceof Headers) l = n.get(s) ?? void 0;
784
+ const q = [400, 403];
785
+ class Te {
786
+ constructor(e = []) {
787
+ u(this, "HEADER_TRACING", "X-Sf3-Rid");
788
+ u(this, "HEADER_LOG_GUARD", "reentrancy_guard_logging_preactive");
789
+ u(this, "HEADER_PRINT_GUARD", "reentrancy_guard_print_preactive");
790
+ u(this, "HEADER_EXCEPTION_GUARD", "reentrancy_guard_exception_preactive");
791
+ u(this, "contextManager");
792
+ this.contextManager = G.getInstance(), e?.forEach((t) => {
793
+ typeof t == "string" && t.trim() && this.contextManager.getExcludedDomains().add(t);
794
+ }), l().sfDebug && console.log("[RequestInterceptor] Initialized with static excluded domains.");
795
+ }
796
+ extractIdsFromTraceHeader(e, t = this.HEADER_TRACING) {
797
+ let i;
798
+ if (e instanceof Headers) i = e.get(t) ?? void 0;
1393
799
  else {
1394
- const t = s.toLowerCase();
1395
- for (const [o, c] of Object.entries(n)) if (o.toLowerCase() === t) {
1396
- l = c;
800
+ const o = t.toLowerCase();
801
+ for (const [a, r] of Object.entries(e)) if (a.toLowerCase() === o) {
802
+ i = r;
1397
803
  break;
1398
804
  }
1399
805
  }
1400
- if (!l) return {};
1401
- const a = l.split("/").filter(Boolean);
1402
- return a.length < 3 ? {} : { sessionId: a[0], pageVisitId: a[1], requestId: a[a.length - 1] };
1403
- }
1404
- parseStackFrame(n) {
1405
- const s = /\((.*):(\d+):(\d+)\)$/.exec(n.trim());
1406
- if (!s) return null;
1407
- const [, l, a, t] = s;
1408
- return { filePath: l, line: parseInt(a, 10), column: parseInt(t, 10) };
1409
- }
1410
- async getOriginalPosition(n, s, l) {
1411
- let a = { source: n, line: s, column: l, name: null };
1412
- const t = n + ".map";
806
+ if (!i) return {};
807
+ const n = i.split("/").filter(Boolean);
808
+ return n.length < 3 ? {} : { sessionId: n[0], pageVisitId: n[1], requestId: n[n.length - 1] };
809
+ }
810
+ parseStackFrame(e) {
811
+ const t = /\((.*):(\d+):(\d+)\)$/.exec(e.trim());
812
+ if (!t) return null;
813
+ const [, i, n, o] = t;
814
+ return { filePath: i, line: parseInt(n, 10), column: parseInt(o, 10) };
815
+ }
816
+ async getOriginalPosition(e, t, i) {
817
+ let n = { source: e, line: t, column: i, name: null };
818
+ const o = e + ".map";
1413
819
  try {
1414
- const o = JSON.parse(Ue(t, "utf-8"));
1415
- let c = (await new De.SourceMapConsumer(o)).originalPositionFor({ line: s, column: l });
1416
- c.source && (a = c);
1417
- } catch (o) {
1418
- A().sfDebug && console.error(`Could not read/parse map file at ${t}:`, o);
820
+ const a = JSON.parse(ue(o, "utf-8"));
821
+ let r = (await new Ce.SourceMapConsumer(a)).originalPositionFor({ line: t, column: i });
822
+ r.source && (n = r);
823
+ } catch (a) {
824
+ l().sfDebug && console.error(`Could not read/parse map file at ${o}:`, a);
1419
825
  }
1420
- return { originalPos: a };
1421
- }
1422
- captureFirstUserLines(n, s = 10, l = !1) {
1423
- const a = A().sfDebug ? 10 : s, t = Error.stackTraceLimit;
1424
- Error.stackTraceLimit = Math.max(t, a);
1425
- const o = new Error(Le);
1426
- Le in Error && Error.captureStackTrace(o, this.captureFirstUserLines);
1427
- const c = o.stack || "";
1428
- Error.stackTraceLimit = t;
1429
- const d = c.split(`
1430
- `).slice(1), p = [];
1431
- for (const C of d)
1432
- if (!(C.includes("node:internal") || C.includes("internal/modules") || C.includes("internal/process") || C.includes("node_modules") || C.includes(".next/server/chunks") || C.includes("RequestInterceptor") || C.includes("contextManager") || C.includes("setupConfig")) && (p.push(C.trim()), p.length >= s)) break;
1433
- for (const C of p) {
1434
- const g = this.parseStackFrame(C);
1435
- g ? (async () => {
1436
- const { originalPos: I } = await this.getOriginalPosition(g.filePath, g.line, g.column);
1437
- if (I) {
1438
- A().sfDebug && console.log("[RequestInterceptor] First user code line:", I);
1439
- const e = { line: I.line?.toString() || j.UNKNOWN, column: I.column?.toString() || j.NOT_CAPTURED, name: I.name || j.NOT_CAPTURED, entrypoint: I.source, retryWithoutTraceId: l };
1440
- n.doSend(e);
826
+ return { originalPos: n };
827
+ }
828
+ captureFirstUserLines(e, t = 10, i = !1) {
829
+ const n = l().sfDebug ? 10 : t, o = Error.stackTraceLimit;
830
+ Error.stackTraceLimit = Math.max(o, n);
831
+ const a = new Error(Ie);
832
+ Ie in Error && Error.captureStackTrace(a, this.captureFirstUserLines);
833
+ const r = a.stack || "";
834
+ Error.stackTraceLimit = o;
835
+ const g = r.split(`
836
+ `).slice(1), c = [];
837
+ for (const I of g)
838
+ if (!(I.includes("node:internal") || I.includes("internal/modules") || I.includes("internal/process") || I.includes("node_modules") || I.includes(".next/server/chunks") || I.includes("RequestInterceptor") || I.includes("contextManager") || I.includes("setupConfig")) && (c.push(I.trim()), c.length >= t)) break;
839
+ for (const I of c) {
840
+ const d = this.parseStackFrame(I);
841
+ d ? (async () => {
842
+ const { originalPos: C } = await this.getOriginalPosition(d.filePath, d.line, d.column);
843
+ if (C) {
844
+ l().sfDebug && console.log("[RequestInterceptor] First user code line:", C);
845
+ const p = { line: C.line?.toString() || L.UNKNOWN, column: C.column?.toString() || L.NOT_CAPTURED, name: C.name || L.NOT_CAPTURED, entrypoint: C.source, retryWithoutTraceId: i };
846
+ e.doSend(p);
1441
847
  }
1442
- })() : A().sfDebug && console.error("Could not parse stack line:", C);
848
+ })() : l().sfDebug && console.error("Could not parse stack line:", I);
1443
849
  }
1444
850
  }
1445
- addReentrancyGuardHeaders(n) {
1446
- n.set(this.HEADER_LOG_GUARD, "true"), n.set(this.HEADER_PRINT_GUARD, "true"), n.set(this.HEADER_EXCEPTION_GUARD, "true");
1447
- }
1448
- shouldPropagateHeaders(n) {
1449
- return !Xe.some((s) => new RegExp(`^${s.replace(/\*/g, ".*")}$`).test(n));
1450
- }
1451
- addTracingHeaders(n, s) {
1452
- const l = new URL(s).hostname, a = this.shouldPropagateHeaders(l);
1453
- return a ? this.addTracingHeader(n, s) : A().sfDebug && console.error(`[RequestInterceptor] Excluded domain: ${l}`), a;
1454
- }
1455
- addTracingHeader(n, s) {
1456
- const l = this.contextManager.getOrSetSfTraceId(), a = this.contextManager.getOrSetPageVisitUUID(), t = J();
1457
- n.set(this.HEADER_TRACING, `${l}/${a}/${t}`), A().sfDebug && console.log(`[RequestInterceptor] Added tracing header for ${s}`);
1458
- }
1459
- patchFetch(n, s) {
1460
- const l = globalThis.fetch;
1461
- typeof l == "function" ? globalThis.fetch = async (a, t) => {
1462
- this.captureFirstUserLines(n);
1463
- const o = Date.now(), c = new Headers(t?.headers);
1464
- let d;
1465
- typeof a == "string" || a instanceof URL ? d = a.toString() : a instanceof Request ? (d = a.url, a.headers.forEach((r, h) => {
1466
- c.set(h, r);
1467
- })) : A().sfDebug && console.error("[Sailfish RequestInterceptor] Invalid fetch input."), A().sfDebug && console.log("[RequestInterceptor] Fetching request to:", d);
1468
- const p = new URL(d).hostname, C = new Headers(c), g = this.addTracingHeaders(c, d), I = { ...t, headers: c };
1469
- let e;
851
+ addReentrancyGuardHeaders(e) {
852
+ e.set(this.HEADER_LOG_GUARD, "true"), e.set(this.HEADER_PRINT_GUARD, "true"), e.set(this.HEADER_EXCEPTION_GUARD, "true");
853
+ }
854
+ shouldPropagateHeaders(e) {
855
+ return !Ae.some((t) => new RegExp(`^${t.replace(/\*/g, ".*")}$`).test(e));
856
+ }
857
+ addTracingHeaders(e, t) {
858
+ const i = new URL(t).hostname, n = this.shouldPropagateHeaders(i);
859
+ return n ? this.addTracingHeader(e, t) : l().sfDebug && console.error(`[RequestInterceptor] Excluded domain: ${i}`), n;
860
+ }
861
+ addTracingHeader(e, t) {
862
+ const i = this.contextManager.getOrSetSfTraceId(), n = this.contextManager.getOrSetPageVisitUUID(), o = H();
863
+ e.set(this.HEADER_TRACING, `${i}/${n}/${o}`), l().sfDebug && console.log(`[RequestInterceptor] Added tracing header for ${t}`);
864
+ }
865
+ patchFetch(e, t) {
866
+ const i = globalThis.fetch;
867
+ typeof i == "function" ? globalThis.fetch = async (n, o) => {
868
+ this.captureFirstUserLines(e);
869
+ const a = Date.now(), r = new Headers(o?.headers);
870
+ let g;
871
+ typeof n == "string" || n instanceof URL ? g = n.toString() : n instanceof Request ? (g = n.url, n.headers.forEach((h, A) => {
872
+ r.set(A, h);
873
+ })) : l().sfDebug && console.error("[Sailfish RequestInterceptor] Invalid fetch input."), l().sfDebug && console.log("[RequestInterceptor] Fetching request to:", g);
874
+ const c = new URL(g).hostname, I = new Headers(r), d = this.addTracingHeaders(r, g), C = { ...o, headers: r };
875
+ let p;
1470
876
  try {
1471
- let r = !1;
1472
- this.addTracingHeaders(C, d), e = await l(d, I), g && ue.includes(e.status) ? (e = await l(d, { ...t, headers: C }), r = !0, this.captureFirstUserLines(n, 10, r)) : this.contextManager.addSupportedDomains(p);
1473
- const h = Date.now();
1474
- A().sfDebug && console.log(`[RequestInterceptor] Fetch completed: ${d}, Status: ${e.status}, Duration: ${h - o}ms`);
1475
- const { sessionId: u, pageVisitId: m, requestId: f } = this.extractIdsFromTraceHeader(c);
1476
- return s.doSend({ apiKey: A().apiKey, requestId: f, pageVisitId: m, recordingSessionId: u, serviceUuid: A().serviceUUID, timestampStart: o.toString(), timestampEnd: h.toString(), responseCode: e.status, success: !0, error: null, url: d, method: I.method || "GET", retryWithoutTraceId: r }), e;
1477
- } catch (r) {
1478
- const h = Date.now();
1479
- A().sfDebug && console.error(`[RequestInterceptor] Fetch failed: ${d}, Error: ${r}, Duration: ${h - o}ms`);
877
+ let h = !1;
878
+ this.addTracingHeaders(I, g), p = await i(g, C), d && q.includes(p.status) ? (p = await i(g, { ...o, headers: I }), h = !0, this.captureFirstUserLines(e, 10, h)) : this.contextManager.addSupportedDomains(c);
879
+ const A = Date.now();
880
+ l().sfDebug && console.log(`[RequestInterceptor] Fetch completed: ${g}, Status: ${p.status}, Duration: ${A - a}ms`);
881
+ const { sessionId: b, pageVisitId: Z, requestId: f } = this.extractIdsFromTraceHeader(r);
882
+ return t.doSend({ apiKey: l().apiKey, requestId: f, pageVisitId: Z, recordingSessionId: b, serviceUuid: l().serviceUUID, timestampStart: a.toString(), timestampEnd: A.toString(), responseCode: p.status, success: !0, error: null, url: g, method: C.method || "GET", retryWithoutTraceId: h, parentSpanId: P() }), p;
883
+ } catch (h) {
884
+ const A = Date.now();
885
+ l().sfDebug && console.error(`[RequestInterceptor] Fetch failed: ${g}, Error: ${h}, Duration: ${A - a}ms`);
1480
886
  }
1481
- } : A().sfDebug && console.error("[RequestInterceptor] Fetch not available.");
887
+ } : l().sfDebug && console.error("[RequestInterceptor] Fetch not available.");
1482
888
  }
1483
- patchHttp(n, s) {
1484
- if (A().sfDebug && console.log("[RequestInterceptor] Initializing HTTP/HTTPS request patch..."), !w || typeof w.request != "function") return void (A().sfDebug && console.log("[RequestInterceptor] HTTP/HTTPS not available."));
1485
- const l = w.request.bind(w), a = w.request.bind(w);
1486
- w.request = function(t, o) {
1487
- let c;
889
+ patchHttp(e, t) {
890
+ if (l().sfDebug && console.log("[RequestInterceptor] Initializing HTTP/HTTPS request patch..."), !B || typeof B.request != "function") return void (l().sfDebug && console.log("[RequestInterceptor] HTTP/HTTPS not available."));
891
+ const i = B.request.bind(B), n = B.request.bind(B);
892
+ B.request = function(o, a) {
893
+ let r;
1488
894
  try {
1489
- if (typeof t == "string") {
1490
- const p = new URL(t);
1491
- c = { protocol: p.protocol || le, hostname: p.hostname, path: p.pathname + p.search, headers: {} };
1492
- } else t instanceof URL ? c = { protocol: t.protocol || le, hostname: t.hostname, path: t.pathname + t.search, headers: {} } : (c = { ...t }, c.protocol || (c.protocol = le));
1493
- if (c.headers) {
1494
- const p = `${c.protocol}//${c.hostname}`;
1495
- this.addTracingHeaders(c.headers, p), this.captureFirstUserLines(n);
1496
- } else A().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTP request options. Skipping header addition.");
1497
- } catch (p) {
1498
- throw A().sfDebug && console.error("[RequestInterceptor] Error while processing HTTP request options:", p), p;
895
+ if (typeof o == "string") {
896
+ const c = new URL(o);
897
+ r = { protocol: c.protocol || j, hostname: c.hostname, path: c.pathname + c.search, headers: {} };
898
+ } else o instanceof URL ? r = { protocol: o.protocol || j, hostname: o.hostname, path: o.pathname + o.search, headers: {} } : (r = { ...o }, r.protocol || (r.protocol = j));
899
+ if (r.headers) {
900
+ const c = `${r.protocol}//${r.hostname}`;
901
+ this.addTracingHeaders(r.headers, c), this.captureFirstUserLines(e);
902
+ } else l().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTP request options. Skipping header addition.");
903
+ } catch (c) {
904
+ throw l().sfDebug && console.error("[RequestInterceptor] Error while processing HTTP request options:", c), c;
1499
905
  }
1500
- let d = !1;
1501
- return l(c, (p) => {
1502
- const C = `${c.protocol}//${c.hostname}`;
1503
- if (c.headers && this.shouldPropagateHeaders(new URL(C).hostname) && ue.includes(p.statusCode || 0)) {
1504
- c.hostname;
1505
- const r = { ...c, headers: { ...c.headers } };
1506
- delete r.headers[this.HEADER_TRACING], l(r, o), d = !0, this.captureFirstUserLines(n, 10, d);
906
+ let g = !1;
907
+ return i(r, (c) => {
908
+ const I = `${r.protocol}//${r.hostname}`;
909
+ if (r.headers && this.shouldPropagateHeaders(new URL(I).hostname) && q.includes(c.statusCode || 0)) {
910
+ r.hostname;
911
+ const h = { ...r, headers: { ...r.headers } };
912
+ delete h.headers[this.HEADER_TRACING], i(h, a), g = !0, this.captureFirstUserLines(e, 10, g);
1507
913
  }
1508
- const { sessionId: g, pageVisitId: I, requestId: e } = this.extractIdsFromTraceHeader(c.headers);
1509
- s.doSend({ apiKey: A().apiKey, requestId: e, pageVisitId: I, recordingSessionId: g, serviceUuid: A().serviceUUID, timestampStart: Date.now().toString(), timestampEnd: Date.now().toString(), responseCode: p.statusCode || 0, success: !!p.statusCode && p.statusCode < 400, error: null, url: C, method: c.method || "GET", retryWithoutTraceId: d }), o?.(p);
914
+ const { sessionId: d, pageVisitId: C, requestId: p } = this.extractIdsFromTraceHeader(r.headers);
915
+ t.doSend({ apiKey: l().apiKey, requestId: p, pageVisitId: C, recordingSessionId: d, serviceUuid: l().serviceUUID, timestampStart: Date.now().toString(), timestampEnd: Date.now().toString(), responseCode: c.statusCode || 0, success: !!c.statusCode && c.statusCode < 400, error: null, url: I, method: r.method || "GET", retryWithoutTraceId: g, parentSpanId: P() }), a?.(c);
1510
916
  });
1511
- }, w.request = function(t, o) {
1512
- let c;
917
+ }, B.request = function(o, a) {
918
+ let r;
1513
919
  try {
1514
- if (typeof t == "string") {
1515
- const p = new URL(t);
1516
- c = { protocol: p.protocol || ge, hostname: p.hostname, path: p.pathname + p.search, headers: {} };
1517
- } else t instanceof URL ? c = { protocol: t.protocol || ge, hostname: t.hostname, path: t.pathname + t.search, headers: {} } : (c = { ...t }, c.protocol || (c.protocol = ge));
1518
- if (c.headers) {
1519
- const p = `${c.protocol}//${c.hostname}`;
1520
- this.addTracingHeaders(c.headers, p);
1521
- } else A().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTPS request options. Skipping header addition.");
1522
- } catch (p) {
1523
- throw A().sfDebug && console.error("[RequestInterceptor] Error while processing HTTPS request options:", p), p;
920
+ if (typeof o == "string") {
921
+ const c = new URL(o);
922
+ r = { protocol: c.protocol || Q, hostname: c.hostname, path: c.pathname + c.search, headers: {} };
923
+ } else o instanceof URL ? r = { protocol: o.protocol || Q, hostname: o.hostname, path: o.pathname + o.search, headers: {} } : (r = { ...o }, r.protocol || (r.protocol = Q));
924
+ if (r.headers) {
925
+ const c = `${r.protocol}//${r.hostname}`;
926
+ this.addTracingHeaders(r.headers, c);
927
+ } else l().sfDebug && console.warn("[RequestInterceptor] No headers found in HTTPS request options. Skipping header addition.");
928
+ } catch (c) {
929
+ throw l().sfDebug && console.error("[RequestInterceptor] Error while processing HTTPS request options:", c), c;
1524
930
  }
1525
- let d = !1;
1526
- return a(c, (p) => {
1527
- const C = `${c.protocol}//${c.hostname}`;
1528
- if (c.headers && this.shouldPropagateHeaders(new URL(C).hostname) && ue.includes(p.statusCode || 0)) {
1529
- const r = { ...c, headers: { ...c.headers } };
1530
- delete r.headers[this.HEADER_TRACING], a(r, o), d = !0, this.captureFirstUserLines(n, 10, d);
931
+ let g = !1;
932
+ return n(r, (c) => {
933
+ const I = `${r.protocol}//${r.hostname}`;
934
+ if (r.headers && this.shouldPropagateHeaders(new URL(I).hostname) && q.includes(c.statusCode || 0)) {
935
+ const h = { ...r, headers: { ...r.headers } };
936
+ delete h.headers[this.HEADER_TRACING], n(h, a), g = !0, this.captureFirstUserLines(e, 10, g);
1531
937
  }
1532
- const { sessionId: g, pageVisitId: I, requestId: e } = this.extractIdsFromTraceHeader(c.headers);
1533
- s.doSend({ apiKey: A().apiKey, requestId: e, pageVisitId: I, recordingSessionId: g, serviceUuid: A().serviceUUID, timestampStart: Date.now().toString(), timestampEnd: Date.now().toString(), responseCode: p.statusCode || 0, success: !!p.statusCode && p.statusCode < 400, error: null, url: C, method: c.method || "GET", retryWithoutTraceId: d }), o?.(p);
938
+ const { sessionId: d, pageVisitId: C, requestId: p } = this.extractIdsFromTraceHeader(r.headers);
939
+ t.doSend({ apiKey: l().apiKey, requestId: p, pageVisitId: C, recordingSessionId: d, serviceUuid: l().serviceUUID, timestampStart: Date.now().toString(), timestampEnd: Date.now().toString(), responseCode: c.statusCode || 0, success: !!c.statusCode && c.statusCode < 400, error: null, url: I, method: r.method || "GET", retryWithoutTraceId: g, parentSpanId: P() }), a?.(c);
1534
940
  });
1535
- }, A().sfDebug && console.log("✅ HTTP and HTTPS request methods patched globally.");
941
+ }, l().sfDebug && console.log("✅ HTTP and HTTPS request methods patched globally.");
1536
942
  }
1537
- tryPatch(n, s) {
943
+ tryPatch(e, t) {
1538
944
  try {
1539
- require.resolve(s), n(), console.log(`[RequestInterceptor] Patched ${s}`);
1540
- } catch (l) {
1541
- console.warn(`[RequestInterceptor] Could not patch ${s}: ${l.message}`);
945
+ require.resolve(t), e(), console.log(`[RequestInterceptor] Patched ${t}`);
946
+ } catch (i) {
947
+ console.warn(`[RequestInterceptor] Could not patch ${t}: ${i.message}`);
1542
948
  }
1543
949
  }
1544
950
  getExcludedDomains() {
1545
951
  return [...this.contextManager.getExcludedDomains()];
1546
952
  }
1547
953
  }
1548
- class pt extends de {
954
+ class _e extends ne {
1549
955
  constructor() {
1550
956
  super(), this.setOperationName("UpdateServiceDetails");
1551
957
  }
@@ -1553,7 +959,7 @@ class pt extends de {
1553
959
  this.sendAppIdentifier(), this.send();
1554
960
  }
1555
961
  async send() {
1556
- const n = `
962
+ const e = `
1557
963
  ${this.queryType} ${this.operationName}(
1558
964
  $apiKey: String!,
1559
965
  $serviceUuid: String!,
@@ -1561,7 +967,7 @@ class pt extends de {
1561
967
  $serviceIdentifier: String,
1562
968
  $serviceVersion: String,
1563
969
  $serviceAdditionalMetadata: JSON,
1564
-
970
+ $gitSha: String!,
1565
971
  ) {
1566
972
  ${this.queryName}(
1567
973
  apiKey: $apiKey,
@@ -1570,61 +976,266 @@ class pt extends de {
1570
976
  serviceIdentifier: $serviceIdentifier,
1571
977
  serviceVersion: $serviceVersion,
1572
978
  serviceAdditionalMetadata: $serviceAdditionalMetadata,
1573
-
979
+ gitSha: $gitSha,
1574
980
  )
1575
981
  }
1576
- `, s = this.getVariables({ serviceIdentifier: A().serviceIdentifier, serviceVersion: A().serviceVersion, serviceAdditionalMetadata: A().serviceAdditionalMetadata });
1577
- H(this.endpoint, this.operationName, n, s);
982
+ `, t = this.getVariables({ serviceIdentifier: l().serviceIdentifier, serviceVersion: l().serviceVersion, serviceAdditionalMetadata: l().serviceAdditionalMetadata, gitSha: l().gitSha || "" });
983
+ F(this.endpoint, this.operationName, e, t);
984
+ }
985
+ }
986
+ function Ee() {
987
+ return { capture_arguments: w(process.env.SF_FUNCSPAN_CAPTURE_ARGUMENTS, !0), capture_return_value: w(process.env.SF_FUNCSPAN_CAPTURE_RETURN_VALUE, !0), arg_limit_mb: parseInt(process.env.SF_FUNCSPAN_ARG_LIMIT_MB || "1", 10), return_limit_mb: parseInt(process.env.SF_FUNCSPAN_RETURN_LIMIT_MB || "1", 10), autocapture_all_child_functions: w(process.env.SF_FUNCSPAN_AUTOCAPTURE_ALL_CHILD_FUNCTIONS, !1), sample_rate: parseFloat(process.env.SF_FUNCSPAN_SAMPLE_RATE || "1.0"), enable_sampling: w(process.env.SF_FUNCSPAN_ENABLE_SAMPLING, !1), capture_sf_veritas: w(process.env.SF_FUNCSPAN_CAPTURE_SF_VERITAS, !1), parse_json_strings: w(process.env.SF_FUNCSPAN_PARSE_JSON_STRINGS, !1) };
988
+ }
989
+ function et() {
990
+ return { capture_arguments: !1, capture_return_value: !1, arg_limit_mb: 1, return_limit_mb: 1, autocapture_all_child_functions: !1, sample_rate: 0, enable_sampling: !1, capture_sf_veritas: !1, parse_json_strings: !1 };
991
+ }
992
+ function De(s) {
993
+ try {
994
+ const e = s.split("-");
995
+ return e.length !== 9 ? (console.error(`[FuncSpan] Invalid header format: expected 9 parts, got ${e.length}`), null) : { capture_arguments: e[0] === "1", capture_return_value: e[1] === "1", arg_limit_mb: parseInt(e[2], 10), return_limit_mb: parseInt(e[3], 10), autocapture_all_child_functions: e[4] === "1", sample_rate: parseFloat(e[5]), enable_sampling: e[6] === "1", capture_sf_veritas: e[7] === "1", parse_json_strings: e[8] === "1" };
996
+ } catch (e) {
997
+ return console.error(`[FuncSpan] Failed to parse header override "${s}":`, e), null;
1578
998
  }
1579
999
  }
1580
- function bt(i) {
1581
- if (!i || !i.apiKey) {
1582
- const a = `The required API Key is not provided: ${JSON.stringify(i)}`;
1583
- console.error(a);
1584
- }
1585
- const { config: n } = je(i);
1586
- if (n.sfDebug && console.log("Updated configuration after applying options:", n), !n.apiKey || !n.apiGraphqlEndpoint) {
1587
- const a = `The required config is not provided: ${JSON.stringify(n)}`;
1588
- throw console.error(a), new Error(a);
1589
- }
1590
- const s = new de();
1591
- s.setServiceUUID(n.serviceUUID), (function(a) {
1592
- function t(g, I) {
1593
- a.setOperationName("CollectLogs"), a.doSend([I, g]);
1000
+ function w(s, e) {
1001
+ if (!s) return e;
1002
+ const t = s.toLowerCase();
1003
+ return t === "true" || t === "1" || t === "yes";
1004
+ }
1005
+ const ie = new te();
1006
+ function tt(s) {
1007
+ ie.enterWith(s);
1008
+ }
1009
+ function Le() {
1010
+ return ie.getStore();
1011
+ }
1012
+ function nt() {
1013
+ ie.enterWith(void 0);
1014
+ }
1015
+ function E(...s) {
1016
+ const e = {};
1017
+ for (const t of s) for (const i in t) t[i] !== void 0 && (e[i] = t[i]);
1018
+ return e;
1019
+ }
1020
+ function ee(s, e) {
1021
+ try {
1022
+ const t = JSON.stringify(s).length / 1048576;
1023
+ return t <= e ? s : { _truncated: !0, _originalSizeMB: t.toFixed(2), _limitMB: e, _preview: JSON.stringify(s).substring(0, 500) + "..." };
1024
+ } catch {
1025
+ return { _error: "Failed to serialize data", _type: typeof s };
1026
+ }
1027
+ }
1028
+ class ze {
1029
+ constructor(e = [process.cwd()], t = !1) {
1030
+ u(this, "rootPaths");
1031
+ u(this, "fileConfigs", /* @__PURE__ */ new Map());
1032
+ u(this, "functionConfigs", /* @__PURE__ */ new Map());
1033
+ u(this, "directoryConfigs", /* @__PURE__ */ new Map());
1034
+ u(this, "hasSailfishFiles", !1);
1035
+ u(this, "debug");
1036
+ this.rootPaths = e, this.debug = t || process.env.SF_DEBUG === "true";
1037
+ }
1038
+ async loadAllConfigs() {
1039
+ this.debug && console.log("[FuncSpan ConfigLoader] Scanning for .sailfish files in:", this.rootPaths);
1040
+ const e = [];
1041
+ for (const t of this.rootPaths) $.existsSync(t) ? await this._walkDirectory(t, e) : this.debug && console.log(`[FuncSpan ConfigLoader] Root path does not exist: ${t}`);
1042
+ e.length > 0 ? (this.hasSailfishFiles = !0, this.debug && (console.log(`[FuncSpan ConfigLoader] Found ${e.length} .sailfish files:`), e.forEach((t) => console.log(`[FuncSpan ConfigLoader] - ${t}`)))) : this.debug && console.log("[FuncSpan ConfigLoader] No .sailfish files found - function spans disabled by default");
1043
+ for (const t of e) await this._loadConfigFile(t);
1044
+ await this._resolveInheritance(), this.debug && console.log(`[FuncSpan ConfigLoader] Loaded ${this.fileConfigs.size} file configs, ${this.functionConfigs.size} function configs`);
1045
+ }
1046
+ getConfig(e, t) {
1047
+ const i = this.hasSailfishFiles ? Ee() : { capture_arguments: !1, capture_return_value: !1, arg_limit_mb: 1, return_limit_mb: 1, autocapture_all_child_functions: !1, sample_rate: 0, enable_sampling: !1, capture_sf_veritas: !1, parse_json_strings: !1 }, n = this._getDirectoryConfig(e), o = v.normalize(e), a = this.fileConfigs.get(o) || {};
1048
+ let r = {};
1049
+ if (t) {
1050
+ const g = this.functionConfigs.get(o);
1051
+ g && (r = g.get(t) || {});
1594
1052
  }
1595
- const o = console.log.bind(console), c = console.error.bind(console), d = console.warn.bind(console), p = console.info.bind(console), C = console.debug.bind(console);
1596
- console.log = (...g) => {
1597
- t("INFO", g.join(" ")), o(...g);
1598
- }, console.error = (...g) => {
1599
- t("ERROR", g.join(" ")), c(...g);
1600
- }, console.warn = (...g) => {
1601
- t("WARN", g.join(" ")), d(...g);
1602
- }, console.info = (...g) => {
1603
- t("INFO", g.join(" ")), p(...g);
1604
- }, A().logLevel === "DEBUG" && (console.debug = (...g) => {
1605
- t("DEBUG", g.join(" ")), C(...g);
1053
+ return E(i, n, a, r);
1054
+ }
1055
+ async _walkDirectory(e, t) {
1056
+ try {
1057
+ const i = $.readdirSync(e, { withFileTypes: !0 });
1058
+ for (const n of i) {
1059
+ const o = v.join(e, n.name);
1060
+ n.name === "node_modules" || n.name === ".git" || n.name.startsWith(".") || (n.isDirectory() ? await this._walkDirectory(o, t) : n.name === ".sailfish" && t.push(o));
1061
+ }
1062
+ } catch (i) {
1063
+ this.debug && console.error(`[FuncSpan ConfigLoader] Error walking directory ${e}:`, i);
1064
+ }
1065
+ }
1066
+ async _loadConfigFile(e) {
1067
+ try {
1068
+ const t = $.readFileSync(e, "utf-8"), i = v.dirname(e);
1069
+ let n = null;
1070
+ try {
1071
+ n = JSON.parse(t);
1072
+ } catch {
1073
+ try {
1074
+ n = require("js-yaml").load(t);
1075
+ } catch (o) {
1076
+ return void (this.debug && console.error(`[FuncSpan ConfigLoader] Failed to parse ${e} as JSON or YAML:`, o));
1077
+ }
1078
+ }
1079
+ if (!n) return;
1080
+ n.default && this.directoryConfigs.set(i, n.default), n.files && await this._expandFileGlobs(i, n.files, n.default || {}), n.functions && this._storeFunctionConfigs(i, n.functions, n.default || {}), this.debug && (console.log(`[FuncSpan ConfigLoader] Loaded config from ${e}`), console.log(`[FuncSpan ConfigLoader] Directory: ${i}`), console.log(`[FuncSpan ConfigLoader] Has default: ${!!n.default}`), console.log(`[FuncSpan ConfigLoader] File patterns: ${Object.keys(n.files || {}).length}`), console.log(`[FuncSpan ConfigLoader] Functions: ${Object.keys(n.functions || {}).length}`));
1081
+ } catch (t) {
1082
+ this.debug && console.error(`[FuncSpan ConfigLoader] Error loading ${e}:`, t);
1083
+ }
1084
+ }
1085
+ async _expandFileGlobs(e, t, i) {
1086
+ for (const [n, o] of Object.entries(t)) try {
1087
+ const a = v.join(e, n), r = await Ze(a, { absolute: !0, nodir: !0, ignore: ["**/node_modules/**", "**/.git/**"] });
1088
+ this.debug && console.log(`[FuncSpan ConfigLoader] Pattern '${n}' matched ${r.length} files`);
1089
+ for (const g of r) {
1090
+ const c = v.normalize(g), I = E(i, o);
1091
+ this.fileConfigs.set(c, I), this.debug && r.length <= 5 && console.log(`[FuncSpan ConfigLoader] - ${g}`);
1092
+ }
1093
+ } catch (a) {
1094
+ this.debug && console.error(`[FuncSpan ConfigLoader] Error expanding glob '${n}':`, a);
1095
+ }
1096
+ }
1097
+ _storeFunctionConfigs(e, t, i) {
1098
+ for (const [n, o] of Object.entries(t)) {
1099
+ const a = n.split("::");
1100
+ if (a.length !== 2) {
1101
+ this.debug && console.warn(`[FuncSpan ConfigLoader] Invalid function pattern '${n}' (expected format: 'file.ts::functionName')`);
1102
+ continue;
1103
+ }
1104
+ const [r, g] = a, c = v.normalize(v.join(e, r));
1105
+ this.functionConfigs.has(c) || this.functionConfigs.set(c, /* @__PURE__ */ new Map());
1106
+ const I = this.functionConfigs.get(c), d = E(i, o);
1107
+ I.set(g, d), this.debug && console.log(`[FuncSpan ConfigLoader] Function config: ${c}::${g}`);
1108
+ }
1109
+ }
1110
+ async _resolveInheritance() {
1111
+ }
1112
+ _getDirectoryConfig(e) {
1113
+ let t = v.dirname(v.normalize(e));
1114
+ const i = [];
1115
+ for (; t && t !== v.dirname(t); ) {
1116
+ const n = this.directoryConfigs.get(t);
1117
+ n && i.unshift(n), t = v.dirname(t);
1118
+ }
1119
+ return i.reduce((n, o) => E(n, o), {});
1120
+ }
1121
+ }
1122
+ let J = null;
1123
+ async function xe(s, e) {
1124
+ J = new ze(s, e), await J.loadAllConfigs();
1125
+ }
1126
+ function $e(s, e) {
1127
+ return J ? J.getConfig(s, e) : { capture_arguments: !1, capture_return_value: !1, arg_limit_mb: 1, return_limit_mb: 1, autocapture_all_child_functions: !1, sample_rate: 0, enable_sampling: !1, capture_sf_veritas: !1, parse_json_strings: !1 };
1128
+ }
1129
+ function ke() {
1130
+ return J !== null;
1131
+ }
1132
+ function it(s) {
1133
+ if (!s || !s.apiKey) {
1134
+ const n = `The required API Key is not provided: ${JSON.stringify(s)}`;
1135
+ console.error(n);
1136
+ }
1137
+ const { config: e } = Be(s);
1138
+ if (e.sfDebug && console.log("Updated configuration after applying options:", e), !e.apiKey || !e.apiGraphqlEndpoint) {
1139
+ const n = `The required config is not provided: ${JSON.stringify(e)}`;
1140
+ throw console.error(n), new Error(n);
1141
+ }
1142
+ ke() || xe(void 0, e.sfDebug).catch((n) => {
1143
+ e.sfDebug && console.error("[FuncSpan] Failed to initialize config loader:", n);
1144
+ });
1145
+ const t = new ne();
1146
+ t.setServiceUUID(e.serviceUUID), (function(n) {
1147
+ function o(d, C) {
1148
+ n.setOperationName("CollectLogs"), n.doSend([C, d]);
1149
+ }
1150
+ const a = console.log.bind(console), r = console.error.bind(console), g = console.warn.bind(console), c = console.info.bind(console), I = console.debug.bind(console);
1151
+ console.log = (...d) => {
1152
+ o("INFO", d.join(" ")), a(...d);
1153
+ }, console.error = (...d) => {
1154
+ o("ERROR", d.join(" ")), r(...d);
1155
+ }, console.warn = (...d) => {
1156
+ o("WARN", d.join(" ")), g(...d);
1157
+ }, console.info = (...d) => {
1158
+ o("INFO", d.join(" ")), c(...d);
1159
+ }, l().logLevel === "DEBUG" && (console.debug = (...d) => {
1160
+ o("DEBUG", d.join(" ")), I(...d);
1606
1161
  });
1607
- })(s), (function(a = []) {
1608
- const t = new It(a);
1609
- new gt().doSend(t.getExcludedDomains());
1610
- const o = new ut(), c = new dt();
1611
- t.patchFetch(o, c), t.patchHttp(o, c);
1612
- })(n.domainsToNotPropagateHeadersTo);
1613
- const l = new ct();
1614
- l.setServiceUUID(n.serviceUUID), it(l), lt(), new pt().send();
1162
+ })(t), (function(n = []) {
1163
+ const o = new Te(n);
1164
+ new Ue().doSend(o.getExcludedDomains());
1165
+ const a = new Xe(), r = new Je();
1166
+ o.patchFetch(a, r), o.patchHttp(a, r);
1167
+ })(e.domainsToNotPropagateHeadersTo);
1168
+ const i = new Ye();
1169
+ i.setServiceUUID(e.serviceUUID), we(i), Ke(), new _e().send();
1615
1170
  }
1616
- function yt(i, n, s, l = !1) {
1617
- const a = A();
1618
- new Je(a.apiKey).identify(i, n, s, l);
1171
+ function ot(s, e, t, i = !1) {
1172
+ const n = l();
1173
+ new me(n.apiKey).identify(s, e, t, i);
1619
1174
  }
1620
- function vt(i, n = {}, s, l = !1) {
1621
- const a = A();
1622
- new Je(a.apiKey).addOrUpdateMetadata(i, n, s, l);
1175
+ function st(s, e = {}, t, i = !1) {
1176
+ const n = l();
1177
+ new me(n.apiKey).addOrUpdateMetadata(s, e, t, i);
1178
+ }
1179
+ function rt(s, e, t, i) {
1180
+ const n = function(...o) {
1181
+ const a = (function(C, p) {
1182
+ const h = Le();
1183
+ if (h) {
1184
+ const A = De(h);
1185
+ if (A) return process.env.SF_DEBUG === "true" && console.log(`[FuncSpan] Using HTTP header override for ${C}::${p}`), A;
1186
+ }
1187
+ return $e(C, p);
1188
+ })(t, e);
1189
+ if (a.enable_sampling && a.sample_rate < 1 && Math.random() > a.sample_rate) return s.apply(this, o);
1190
+ if (a.sample_rate === 0) return s.apply(this, o);
1191
+ const r = G.getInstance(), g = r.getCurrentFunctionSpanId(), c = H();
1192
+ r.setCurrentFunctionSpanId(c);
1193
+ const I = Date.now();
1194
+ let d = null;
1195
+ a.capture_arguments && (d = {}, i.paramNames.forEach((C, p) => {
1196
+ p < o.length && (d[C] = o[p]);
1197
+ }), d && a.arg_limit_mb > 0 && (d = ee(d, a.arg_limit_mb)));
1198
+ try {
1199
+ const C = s.apply(this, o);
1200
+ if (C && typeof C.then == "function") return C.then((A) => {
1201
+ const b = Date.now();
1202
+ let Z = null;
1203
+ return a.capture_return_value && a.return_limit_mb > 0 && (Z = ee(A, a.return_limit_mb)), D({ functionName: e, filePath: t, metadata: i, args: d, result: Z, error: null, duration: b - I, async: !0, spanId: c }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), A;
1204
+ }, (A) => {
1205
+ const b = Date.now();
1206
+ throw D({ functionName: e, filePath: t, metadata: i, args: d, result: null, error: A?.message || String(A), duration: b - I, async: !0, spanId: c }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), A;
1207
+ });
1208
+ const p = Date.now();
1209
+ let h = null;
1210
+ return a.capture_return_value && a.return_limit_mb > 0 && (h = ee(C, a.return_limit_mb)), D({ functionName: e, filePath: t, metadata: i, args: d, result: h, error: null, duration: p - I, async: !1, spanId: c }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), C;
1211
+ } catch (C) {
1212
+ const p = Date.now();
1213
+ throw D({ functionName: e, filePath: t, error: C?.message || String(C), duration: p - I, async: !1 }), g ? r.setCurrentFunctionSpanId(g) : r.clearCurrentFunctionSpanId(), C;
1214
+ }
1215
+ };
1216
+ Object.defineProperty(n, "name", { value: e, writable: !1 });
1217
+ for (const o in s) s.hasOwnProperty(o) && (n[o] = s[o]);
1218
+ return n;
1219
+ }
1220
+ function D(s) {
1221
+ process.env.SF_VERITAS_DEBUG === "true" && console.log("[FuncSpan Capture]", { function: s.functionName, file: s.filePath, duration: `${s.duration}ms`, async: s.async, error: s.error }), Ne(() => {
1222
+ });
1623
1223
  }
1624
1224
  export {
1625
- N as ContextManager,
1626
- vt as addOrUpdateMetadata,
1627
- yt as identify,
1628
- ft as runWithContext,
1629
- bt as setupInterceptors
1225
+ G as ContextManager,
1226
+ st as addOrUpdateMetadata,
1227
+ rt as captureFunctionSpan,
1228
+ nt as clearFuncspanOverride,
1229
+ P as getCurrentFunctionSpanId,
1230
+ et as getDefaultConfig,
1231
+ Ee as getEnvConfig,
1232
+ Le as getFuncspanOverride,
1233
+ $e as getGlobalConfig,
1234
+ ot as identify,
1235
+ xe as initializeConfigLoader,
1236
+ ke as isConfigLoaderInitialized,
1237
+ De as parseHeaderOverride,
1238
+ Ne as runWithContext,
1239
+ tt as setFuncspanOverride,
1240
+ it as setupInterceptors
1630
1241
  };