var d = Object.defineProperty;
var l = (t, e, s) => e in t ? d(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
var n = (t, e, s) => l(t, typeof e != "symbol" ? e + "" : e, s);
import { pino as c } from "pino";
import "./sl-types.js";
import "nanostores";
import { S as o } from "./useStreamLayerApp2.js";
const v = c({
  level: "trace",
  enabled: typeof window < "u" && !!window.localStorage.getItem("SL_DEBUG"),
  browser: {
    write: (t) => {
      console.log(t);
    }
  }
}), w = (t, e) => v.child({ name: t }, e);
class E extends Event {
  constructor(s, i) {
    super(s);
    n(this, "slEventBus");
    this.slEventBus = i;
  }
}
const m = w("event-bus");
class T {
  constructor(e = "sl-event-bus") {
    n(this, "name");
    n(this, "listeners");
    n(this, "emit", (e, s) => {
      const i = new E(this.name, { ...s, type: e });
      m.debug(i, "Emitting event"), window.dispatchEvent(i);
    });
    n(this, "destroy", () => {
      this.listeners.forEach((e) => {
        window.removeEventListener(this.name, e), this.listeners.delete(e);
      }), this.listeners.clear();
    });
    this.name = e, this.listeners = /* @__PURE__ */ new Set();
  }
  listen(e) {
    return window.addEventListener(this.name, e), this.listeners.add(e), () => {
      this.off(e);
    };
  }
  off(e) {
    window.removeEventListener(this.name, e), this.listeners.delete(e);
  }
}
window.slStore = /* @__PURE__ */ Object.create(null);
var r;
(function(t) {
  t.ORGANIZATION = "ORGANIZATION", t.STREAM = "STREAM";
})(r || (r = {}));
o.BETTING + "", o.GAMES + "", o.PUBLIC_CHAT + "", o.TWITTER + "";
var a;
(function(t) {
  t.Ready = "ready", t.Suspended = "suspended";
})(a || (a = {}));
export {
  T as E,
  a as F,
  w as c
};
