var X = Object.defineProperty, Y = Object.defineProperties;
var T = Object.getOwnPropertyDescriptors;
var H = Object.getOwnPropertySymbols;
var A = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable;
var I = (r, e, t) => e in r ? X(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, y = (r, e) => {
  for (var t in e || (e = {}))
    A.call(e, t) && I(r, t, e[t]);
  if (H)
    for (var t of H(e))
      M.call(e, t) && I(r, t, e[t]);
  return r;
}, S = (r, e) => Y(r, T(e));
var $ = (r, e) => {
  var t = {};
  for (var n in r)
    A.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
  if (r != null && H)
    for (var n of H(r))
      e.indexOf(n) < 0 && M.call(r, n) && (t[n] = r[n]);
  return t;
};
var h = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
var v = (r, e, t) => new Promise((n, i) => {
  var o = (a) => {
    try {
      g(t.next(a));
    } catch (l) {
      i(l);
    }
  }, s = (a) => {
    try {
      g(t.throw(a));
    } catch (l) {
      i(l);
    }
  }, g = (a) => a.done ? n(a.value) : Promise.resolve(a.value).then(o, s);
  g((t = t.apply(r, e)).next());
});
import { X as Z, F as ee, C as te, E as re, s as ne, D as ie, a as oe, m as G, d as se, b as j, c as V, e as ce, g as Q } from "./observe-8IEDbvL-.js";
import { A as ae, s as le, a as de, L as ge, g as W, H as we, l as ue, G as he, b as ke } from "./common-TyzI476o.js";
import { f as fe, s as be, a as Re } from "./record-YrLd-o_q.js";
import "./LDObserve.js";
import "./LDRecord.js";
const me = (r, e, t) => {
  const n = window._highlightWebSocketRequestCallback;
  window._highlightWebSocketRequestCallback = r;
  const i = window._highlightWebSocketEventCallback;
  return window._highlightWebSocketEventCallback = (o) => {
    const w = o, { message: s, size: g } = w, a = $(w, ["message", "size"]), d = t.some((f) => o.name.toLowerCase().includes(f)) ? a : o;
    e(d);
  }, () => {
    window._highlightWebSocketRequestCallback = n, window._highlightWebSocketEventCallback = i;
  };
}, ye = ({ xhrCallback: r, fetchCallback: e, webSocketRequestCallback: t, webSocketEventCallback: n, disableWebSocketRecording: i, bodyKeysToRedact: o, highlightEndpoints: s, tracingOrigins: g, urlBlocklist: a, bodyKeysToRecord: l }) => {
  const d = Z(r, s, g, a, o, l), w = ee(e, s, g, a, o, l), f = i ? () => {
  } : me(t, n, a);
  return () => {
    d(), w(), f();
  };
};
class U {
  constructor(e) {
    h(this, "disableConsoleRecording");
    h(this, "reportConsoleErrors");
    h(this, "enablePromisePatch");
    h(this, "consoleMethodsToRecord");
    h(this, "listeners");
    h(this, "errors");
    h(this, "messages");
    // The properties below were added in 4.0.0 (Feb 2022), and are patched in by client via setupNetworkListeners()
    h(this, "options");
    h(this, "hasNetworkRecording", !0);
    h(this, "disableNetworkRecording");
    h(this, "enableRecordingNetworkContents");
    h(this, "xhrNetworkContents");
    h(this, "fetchNetworkContents");
    h(this, "disableRecordingWebSocketContents");
    h(this, "webSocketNetworkContents");
    h(this, "webSocketEventContents");
    h(this, "tracingOrigins");
    h(this, "networkHeadersToRedact");
    h(this, "networkBodyKeysToRedact");
    h(this, "networkBodyKeysToRecord");
    h(this, "networkHeaderKeysToRecord");
    h(this, "lastNetworkRequestTimestamp");
    h(this, "urlBlocklist");
    h(this, "highlightEndpoints");
    h(this, "requestResponseSanitizer");
    var t, n;
    this.options = e, this.disableConsoleRecording = !!e.disableConsoleRecording, this.reportConsoleErrors = (t = e.reportConsoleErrors) != null ? t : !1, this.enablePromisePatch = (n = e.enablePromisePatch) != null ? n : !1, this.consoleMethodsToRecord = e.consoleMethodsToRecord || [
      ...ae
    ], this.listeners = [], this.errors = [], this.messages = [], this.lastNetworkRequestTimestamp = 0;
  }
  isListening() {
    return this.listeners.length > 0;
  }
  startListening() {
    if (this.isListening())
      return;
    const e = this;
    this.disableConsoleRecording || this.listeners.push(te((t) => {
      var n, i, o;
      if (this.reportConsoleErrors && (t.type === "Error" || t.type === "error") && t.value && t.trace) {
        const s = le(t.value);
        if (j.includes(s) || V.some((g) => s.includes(g)))
          return;
        e.errors.push({
          event: s,
          type: "console.error",
          url: window.location.href,
          source: (n = t.trace[0]) != null && n.fileName ? t.trace[0].fileName : "",
          lineNumber: (i = t.trace[0]) != null && i.lineNumber ? t.trace[0].lineNumber : 0,
          columnNumber: (o = t.trace[0]) != null && o.columnNumber ? t.trace[0].columnNumber : 0,
          stackTrace: t.trace,
          timestamp: (/* @__PURE__ */ new Date()).toISOString()
        });
      }
      e.messages.push(t);
    }, S(y({}, se), {
      level: this.consoleMethodsToRecord
    }))), this.listeners.push(re((t) => {
      j.includes(t.event) || V.some((n) => t.event.includes(n)) || e.errors.push(t);
    }, { enablePromisePatch: this.enablePromisePatch })), this.listeners.push(ne), U.setupNetworkListener(this, this.options);
  }
  stopListening() {
    this.listeners.forEach((e) => e()), this.listeners = [];
  }
  // We define this as a static method because versions earlier than 4.0.0 (Feb 2022) don't have this code.
  // For those versions, calling this from client will monkey-patch the network listeners onto the old FirstLoadListener object.
  static setupNetworkListener(e, t) {
    var o, s, g, a, l, d, w, f, k, C, m, K;
    const n = (t == null ? void 0 : t.backendUrl) || void 0 || "https://pub.highlight.io", i = t.otlpEndpoint || "https://otel.highlight.io";
    e.highlightEndpoints = [
      n,
      `${i}/v1/traces`,
      `${i}/v1/logs`,
      `${i}/v1/metrics`
    ], e.xhrNetworkContents = [], e.fetchNetworkContents = [], e.webSocketNetworkContents = [], e.webSocketEventContents = [], e.networkHeadersToRedact = [], e.urlBlocklist = [], e.tracingOrigins = t.tracingOrigins || [], (t == null ? void 0 : t.disableNetworkRecording) !== void 0 ? (e.disableNetworkRecording = t == null ? void 0 : t.disableNetworkRecording, e.enableRecordingNetworkContents = !1, e.disableRecordingWebSocketContents = !0, e.networkHeadersToRedact = [], e.networkBodyKeysToRedact = [], e.urlBlocklist = [], e.networkBodyKeysToRecord = []) : typeof (t == null ? void 0 : t.networkRecording) == "boolean" ? (e.disableNetworkRecording = !t.networkRecording, e.enableRecordingNetworkContents = !1, e.disableRecordingWebSocketContents = !0, e.networkHeadersToRedact = [], e.networkBodyKeysToRedact = [], e.urlBlocklist = []) : (((o = t.networkRecording) == null ? void 0 : o.enabled) !== void 0 ? e.disableNetworkRecording = !t.networkRecording.enabled : e.disableNetworkRecording = !1, e.enableRecordingNetworkContents = ((s = t.networkRecording) == null ? void 0 : s.recordHeadersAndBody) || !1, e.disableRecordingWebSocketContents = ((g = t.networkRecording) == null ? void 0 : g.disableWebSocketEventRecordings) || !1, e.networkHeadersToRedact = ((l = (a = t.networkRecording) == null ? void 0 : a.networkHeadersToRedact) == null ? void 0 : l.map((b) => b.toLowerCase())) || [], e.networkBodyKeysToRedact = ((w = (d = t.networkRecording) == null ? void 0 : d.networkBodyKeysToRedact) == null ? void 0 : w.map((b) => b.toLowerCase())) || [], e.urlBlocklist = ((k = (f = t.networkRecording) == null ? void 0 : f.urlBlocklist) == null ? void 0 : k.map((b) => b.toLowerCase())) || [], e.urlBlocklist = [
      ...e.urlBlocklist,
      ...ie
    ], e.requestResponseSanitizer = (C = t.networkRecording) == null ? void 0 : C.requestResponseSanitizer, e.networkHeaderKeysToRecord = (m = t.networkRecording) == null ? void 0 : m.headerKeysToRecord, e.networkHeaderKeysToRecord && (e.networkHeadersToRedact = [], e.networkHeaderKeysToRecord = e.networkHeaderKeysToRecord.map((b) => b.toLocaleLowerCase())), e.networkBodyKeysToRecord = (K = t.networkRecording) == null ? void 0 : K.bodyKeysToRecord, e.networkBodyKeysToRecord && (e.networkBodyKeysToRedact = [], e.networkBodyKeysToRecord = e.networkBodyKeysToRecord.map((b) => b.toLocaleLowerCase()))), !e.disableNetworkRecording && e.enableRecordingNetworkContents && e.listeners.push(ye({
      xhrCallback: (b) => {
        e.xhrNetworkContents.push(b);
      },
      fetchCallback: (b) => {
        e.fetchNetworkContents.push(b);
      },
      webSocketRequestCallback: (b) => {
        e.webSocketNetworkContents && e.webSocketNetworkContents.push(b);
      },
      webSocketEventCallback: (b) => {
        e.webSocketEventContents.push(b);
      },
      disableWebSocketRecording: e.disableRecordingWebSocketContents,
      bodyKeysToRedact: e.networkBodyKeysToRedact,
      highlightEndpoints: e.highlightEndpoints,
      tracingOrigins: e.tracingOrigins,
      urlBlocklist: e.urlBlocklist,
      bodyKeysToRecord: e.networkBodyKeysToRecord
    }));
  }
  static getRecordedNetworkResources(e, t) {
    var o, s;
    let n = [], i = [];
    if (!e.disableNetworkRecording) {
      const g = ((o = window == null ? void 0 : window.performance) == null ? void 0 : o.timeOrigin) || 0;
      n = performance.getEntriesByType("resource");
      const a = (t - g) * 2;
      if (n = n.filter((l) => l.responseEnd < e.lastNetworkRequestTimestamp ? !1 : oe(l.name, e.highlightEndpoints)).map((l) => S(y({}, l.toJSON()), {
        offsetStartTime: l.startTime - a,
        offsetResponseEnd: l.responseEnd - a,
        offsetFetchStart: l.fetchStart - a
      })), e.lastNetworkRequestTimestamp = ((s = n.at(-1)) == null ? void 0 : s.responseEnd) || e.lastNetworkRequestTimestamp, e.enableRecordingNetworkContents) {
        const l = {
          headersToRedact: e.networkHeadersToRedact,
          headersToRecord: e.networkHeaderKeysToRecord,
          requestResponseSanitizer: e.requestResponseSanitizer
        };
        n = G(n, e.xhrNetworkContents, "xmlhttprequest", l), n = G(n, e.fetchNetworkContents, "fetch", l);
      }
    }
    return e.disableRecordingWebSocketContents || (i = e.webSocketNetworkContents || []), [...n, ...i];
  }
  static getRecordedWebSocketEvents(e) {
    let t = [];
    return !e.disableNetworkRecording && !e.disableRecordingWebSocketContents && (t = e.webSocketEventContents), t;
  }
  static clearRecordedNetworkResources(e) {
    e.disableNetworkRecording || (e.xhrNetworkContents = [], e.fetchNetworkContents = [], e.webSocketNetworkContents = [], e.webSocketEventContents = [], performance.clearResourceTimings());
  }
}
const Se = () => {
  var r, e;
  typeof chrome != "undefined" && ((r = chrome == null ? void 0 : chrome.runtime) != null && r.onMessage) && ((e = chrome == null ? void 0 : chrome.runtime) == null || e.onMessage.addListener((t, n, i) => {
    const o = t.action;
    switch (console.log(`[highlight] received '${o}' event from extension.`), o) {
      case "init": {
        u.init(1, {
          debug: !0
        }), u.getSessionURL().then((s) => {
          i({ url: s });
        });
        break;
      }
      case "stop": {
        u.stop(), i({ success: !0 });
        break;
      }
    }
    return !0;
  }));
};
function Ie(r) {
  var e;
  r.on && ((e = r.webContents) != null && e.send) && (r.on("focus", () => {
    r.webContents.send("highlight.run", { visible: !0 });
  }), r.on("blur", () => {
    r.webContents.send("highlight.run", { visible: !1 });
  }), r.on("close", () => {
    r.webContents.send("highlight.run", { visible: !1 });
  }));
}
const We = ({ next: r, payload: e }) => {
  if (typeof window != "undefined" && typeof document != "undefined" && "H" in window) {
    if (e.obj.type === "track") {
      const t = e.obj.event, n = e.obj.properties;
      window.H.track(t, n);
    } else if (e.obj.type === "identify") {
      const t = e.obj.userId;
      if (t != null && t.length) {
        const n = e.obj.traits;
        window.H.identify(t, n);
      }
    }
  }
  r(e);
}, _ = () => {
  if (typeof window != "undefined") {
    if (typeof window._highlightFetchPatch != "undefined")
      return;
    window._originalFetch = window.fetch, window._fetchProxy = (r, e) => window._originalFetch(r, e), window._highlightFetchPatch = (r, e) => window._fetchProxy.call(window || global, r, e), window.fetch = window._highlightFetchPatch;
  }
}, J = () => null, P = () => {
  if (typeof window != "undefined") {
    if (typeof window._highlightWebSocketRequestCallback != "undefined")
      return;
    window._highlightWebSocketRequestCallback = J, window._highlightWebSocketEventCallback = J;
    const r = new Proxy(window.WebSocket, {
      construct(e, t) {
        const [, n] = ce(), i = new e(...t), o = (d) => {
          window._highlightWebSocketRequestCallback({
            socketId: n,
            initiatorType: "websocket",
            type: "open",
            name: i.url,
            startTimeAbs: performance.timeOrigin + d.timeStamp
          });
        }, s = (d) => {
          window._highlightWebSocketRequestCallback({
            socketId: n,
            initiatorType: "websocket",
            type: "close",
            name: i.url,
            responseEndAbs: performance.timeOrigin + d.timeStamp
          }), i.removeEventListener("open", o), i.removeEventListener("error", a), i.removeEventListener("message", g), i.removeEventListener("close", s);
        }, g = (d) => {
          const { data: w } = d, f = typeof w == "string" ? d.data : void 0;
          let k;
          typeof w == "string" ? k = w.length : w instanceof Blob ? k = w.size : k = w.byteLength || 0, window._highlightWebSocketEventCallback({
            socketId: n,
            type: "received",
            name: i.url,
            timeStamp: performance.timeOrigin + d.timeStamp,
            size: k,
            message: f
          });
        }, a = (d) => {
          window._highlightWebSocketEventCallback({
            socketId: n,
            type: "error",
            name: i.url,
            timeStamp: performance.timeOrigin + d.timeStamp,
            size: 0
          });
        };
        i.addEventListener("open", o), i.addEventListener("error", a), i.addEventListener("message", g), i.addEventListener("close", s);
        const l = new Proxy(i.send, {
          apply: function(d, w, f) {
            const k = f[0], C = typeof k == "string" ? k : void 0;
            let m;
            typeof k == "string" ? m = k.length : k instanceof Blob ? m = k.size : m = k.byteLength || 0, window._highlightWebSocketEventCallback({
              socketId: n,
              type: "sent",
              name: i.url,
              timeStamp: performance.timeOrigin + performance.now(),
              size: m,
              message: C
            }), d.apply(w, f);
          }
        });
        return i.send = l, i;
      }
    });
    window.WebSocket = r;
  }
};
var B;
(function(r) {
  r.Device = "Device", r.WebVital = "WebVital", r.Frontend = "Frontend", r.Backend = "Backend";
})(B || (B = {}));
const R = (r, e) => {
  console.warn(`highlight.run warning: (${r}): `, e);
}, Ce = 200;
let E = [], L, c, N, O = [], D = !1, p;
const u = {
  options: void 0,
  init: (r, e) => {
    var t, n, i, o, s, g, a, l;
    try {
      if (u.options = e, typeof window == "undefined" || typeof document == "undefined")
        return;
      if (!r) {
        console.info("Highlight is not initializing because projectID was passed undefined.");
        return;
      }
      e != null && e.sessionCookie ? ue() : ke(!1);
      let d = W(), w = he();
      if (d != null && d.sessionSecureID && (w = d.sessionSecureID), D)
        return { sessionSecureID: w };
      D = !0, _(), P(), import("./index-CBVb9hsF.js").then((K) => v(void 0, [K], function* ({ Highlight: k, setupBrowserTracing: C, getTracer: m }) {
        var b, q, x, F, z;
        C({
          backendUrl: (b = e == null ? void 0 : e.backendUrl) != null ? b : "https://pub.highlight.io",
          otlpEndpoint: (q = e == null ? void 0 : e.otlpEndpoint) != null ? q : "https://otel.highlight.io",
          projectId: r,
          sessionSecureId: w,
          environment: (x = e == null ? void 0 : e.environment) != null ? x : "production",
          networkRecordingOptions: typeof (e == null ? void 0 : e.networkRecording) == "object" ? e.networkRecording : void 0,
          tracingOrigins: e == null ? void 0 : e.tracingOrigins,
          serviceName: (F = e == null ? void 0 : e.serviceName) != null ? F : "highlight-browser",
          instrumentations: (z = e == null ? void 0 : e.otel) == null ? void 0 : z.instrumentations,
          getIntegrations: () => [...O]
        }), p = m, c = new k(f, N), _(), P(), e != null && e.manualStart || (yield c.initialize());
      }));
      const f = S(y({}, e), {
        organizationID: r,
        firstloadVersion: fe,
        environment: (e == null ? void 0 : e.environment) || "production",
        appVersion: e == null ? void 0 : e.version,
        sessionSecureID: w
      });
      return N = new U(f), e != null && e.manualStart || N.startListening(), !((n = (t = e == null ? void 0 : e.integrations) == null ? void 0 : t.mixpanel) != null && n.disabled) && ((o = (i = e == null ? void 0 : e.integrations) == null ? void 0 : i.mixpanel) != null && o.projectToken) && be(e.integrations.mixpanel), !((g = (s = e == null ? void 0 : e.integrations) == null ? void 0 : s.amplitude) != null && g.disabled) && ((l = (a = e == null ? void 0 : e.integrations) == null ? void 0 : a.amplitude) != null && l.apiKey) && Re(e.integrations.amplitude), { sessionSecureID: w };
    } catch (d) {
      R("init", d);
    }
  },
  snapshot: (r) => v(void 0, null, function* () {
    try {
      if (c && c.ready)
        return yield c.snapshot(r);
    } catch (e) {
      R("snapshot", e);
    }
  }),
  addSessionFeedback: ({ verbatim: r, userName: e, userEmail: t, timestampOverride: n }) => {
    try {
      u.onHighlightReady(() => c.addSessionFeedback({
        verbatim: r,
        timestamp: n || (/* @__PURE__ */ new Date()).toISOString(),
        user_email: t,
        user_name: e
      }));
    } catch (i) {
      R("error", i);
    }
  },
  consumeError: (r, e, t) => {
    try {
      u.onHighlightReady(() => c.consumeCustomError(r, e, JSON.stringify(t)));
    } catch (n) {
      R("error", n);
    }
  },
  consume: (r, e) => {
    try {
      u.onHighlightReady(() => c.consumeError(r, e));
    } catch (t) {
      R("error", t);
    }
  },
  error: (r, e) => {
    try {
      u.onHighlightReady(() => c.pushCustomError(r, JSON.stringify(e)));
    } catch (t) {
      R("error", t);
    }
  },
  track: (r, e = {}) => {
    var t, n, i, o, s, g, a, l, d, w, f;
    try {
      u.onHighlightReady(() => {
        c.addProperties(S(y({}, e), { event: r })), c.log("H.track", "INFO", S(y({}, e != null ? e : {}), {
          event: r
        }));
      });
      const k = c == null ? void 0 : c.getCurrentSessionURL();
      (i = (n = (t = u.options) == null ? void 0 : t.integrations) == null ? void 0 : n.mixpanel) != null && i.disabled || (o = window.mixpanel) != null && o.track && window.mixpanel.track(r, S(y({}, e), {
        highlightSessionURL: k
      })), (a = (g = (s = u.options) == null ? void 0 : s.integrations) == null ? void 0 : g.amplitude) != null && a.disabled || (l = window.amplitude) != null && l.getInstance && window.amplitude.getInstance().logEvent(r, S(y({}, e), {
        highlightSessionURL: k
      })), (f = (w = (d = u.options) == null ? void 0 : d.integrations) == null ? void 0 : w.intercom) != null && f.disabled || window.Intercom && window.Intercom("trackEvent", r, e);
    } catch (k) {
      R("track", k);
    }
  },
  log: (r, e, t) => {
    try {
      u.onHighlightReady(() => c.log(r, e, t != null ? t : {}));
    } catch (n) {
      R("log", n);
    }
  },
  start: (r) => {
    (c == null ? void 0 : c.state) === "Recording" && !(r != null && r.forceNew) ? r != null && r.silent || console.warn("Highlight is already recording. Please `H.stop()` the current session before starting a new one.") : (N.startListening(), u.onHighlightReady(() => v(void 0, null, function* () {
      yield c.initialize(r);
    }), { waitForReady: !1 }));
  },
  stop: (r) => {
    (c == null ? void 0 : c.state) !== "Recording" ? r != null && r.silent || console.warn("Highlight is already stopped. Please call `H.start()`.") : u.onHighlightReady(() => c.stopRecording(!0));
  },
  identify: (r, e = {}, t) => {
    var n, i, o, s, g, a, l, d;
    try {
      u.onHighlightReady(() => c.identify(r, e, t));
    } catch (w) {
      R("identify", w);
    }
    if ((o = (i = (n = u.options) == null ? void 0 : n.integrations) == null ? void 0 : i.mixpanel) != null && o.disabled || (s = window.mixpanel) != null && s.identify && (window.mixpanel.identify(typeof (e == null ? void 0 : e.email) == "string" ? e == null ? void 0 : e.email : r), e && (window.mixpanel.track("identify", e), window.mixpanel.people.set(e))), !((l = (a = (g = u.options) == null ? void 0 : g.integrations) == null ? void 0 : a.amplitude) != null && l.disabled) && (d = window.amplitude) != null && d.getInstance && (window.amplitude.getInstance().setUserId(r), Object.keys(e).length > 0)) {
      const w = Object.keys(e).reduce((f, k) => (f.set(k, e[k]), f), new window.amplitude.Identify());
      window.amplitude.getInstance().identify(w);
    }
  },
  metrics: (r) => {
    try {
      for (const e of r)
        u.recordMetric(e);
    } catch (e) {
      R("metrics", e);
    }
  },
  recordMetric: (r) => {
    try {
      u.onHighlightReady(() => {
        var e;
        c.recordGauge(S(y({}, r), {
          tags: (e = r.tags) != null ? e : [],
          group: window.location.href,
          category: B.Frontend
        }));
      });
    } catch (e) {
      R("recordMetric", e);
    }
  },
  recordCount: (r) => {
    try {
      u.onHighlightReady(() => {
        c.recordCount(r);
      });
    } catch (e) {
      R("recordCount", e);
    }
  },
  recordIncr: (r) => {
    try {
      u.onHighlightReady(() => {
        c.recordIncr(r);
      });
    } catch (e) {
      R("recordIncr", e);
    }
  },
  recordHistogram: (r) => {
    try {
      u.onHighlightReady(() => {
        c.recordHistogram(r);
      });
    } catch (e) {
      R("recordHistogram", e);
    }
  },
  recordUpDownCounter: (r) => {
    try {
      u.onHighlightReady(() => {
        c.recordUpDownCounter(r);
      });
    } catch (e) {
      R("recordUpDownCounter", e);
    }
  },
  startSpan: (r, e, t, n) => {
    const i = typeof p == "function" ? p() : void 0;
    if (!i) {
      const s = Q();
      return n === void 0 && t === void 0 ? e(s) : n === void 0 ? t(s) : n(s);
    }
    const o = (s, g) => {
      const a = g(s);
      return a instanceof Promise ? a.finally(() => s.end()) : (s.end(), a);
    };
    return n === void 0 && t === void 0 ? i.startActiveSpan(r, (s) => o(s, e)) : n === void 0 ? i.startActiveSpan(r, e, (s) => o(s, t)) : i.startActiveSpan(r, e, t, (s) => o(s, n));
  },
  startManualSpan: (r, e, t, n) => {
    const i = typeof p == "function" ? p() : void 0;
    if (!i) {
      const o = Q();
      return n === void 0 && t === void 0 ? e(o) : n === void 0 ? t(o) : n(o);
    }
    return n === void 0 && t === void 0 ? i.startActiveSpan(r, e) : n === void 0 ? i.startActiveSpan(r, e, t) : i.startActiveSpan(r, e, t, n);
  },
  getSessionURL: () => new Promise((r, e) => {
    u.onHighlightReady(() => {
      const t = c.sessionData.sessionSecureID, n = W(t);
      n ? r(`https://${we}/${n.projectID}/sessions/${t}`) : e(new Error(`Unable to get session URL: ${t}`));
    });
  }),
  getSessionDetails: () => new Promise((r, e) => {
    u.onHighlightReady(() => v(void 0, null, function* () {
      try {
        const t = yield u.getSessionURL();
        if (!t)
          throw new Error("Could not get session URL");
        const n = c.sessionData.sessionSecureID, i = W(n), o = i == null ? void 0 : i.sessionStartTime;
        if (!o)
          throw new Error("Could not get session start timestamp");
        const s = (/* @__PURE__ */ new Date()).getTime(), g = new URL(t), a = new URL(t);
        a.searchParams.set("ts", ((s - o) / 1e3).toString()), r({
          url: g.toString(),
          urlWithTimestamp: a.toString(),
          sessionSecureID: n
        });
      } catch (t) {
        e(t);
      }
    }));
  }),
  getRecordingState: () => {
    var r;
    return (r = c == null ? void 0 : c.state) != null ? r : "NotRecording";
  },
  onHighlightReady: (r, e) => {
    if (c && c.ready) {
      r();
      return;
    }
    if (E.push({ options: e, func: r }), L !== void 0)
      return;
    const t = () => {
      E = E.filter((i) => {
        var o;
        return !c || ((o = i.options) == null ? void 0 : o.waitForReady) !== !1 && !c.ready ? !0 : (i.func(), !1);
      }), L = void 0, E.length > 0 && (L = setTimeout(t, Ce));
    };
    t();
  },
  registerLD(r) {
    O.length || (u.onHighlightReady(() => {
      c.registerLD(r);
    }), de(this, r), O.push(new ge(r)));
  }
};
typeof window != "undefined" && (window.H = u);
Se();
_();
P();
const Oe = {
  reset: () => {
    D = !1, c = void 0, E = [], L = void 0, N = void 0;
  },
  setHighlightObj: (r) => {
    c = r;
  }
};
export {
  U as F,
  u as H,
  B as M,
  Oe as _,
  We as a,
  Ie as c
};
//# sourceMappingURL=index-CJboPLn8.js.map
