"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// modules/react/sockets/index.ts
var sockets_exports = {};
__export(sockets_exports, {
  lolySocket: () => lolySocket
});
module.exports = __toCommonJS(sockets_exports);
var import_socket = require("socket.io-client");
var lolySocket = (namespace, opts) => {
  if (typeof window === "undefined") {
    throw new Error(
      "[loly:socket] lolySocket can only be called on the client side."
    );
  }
  const normalizedNamespace = namespace.startsWith("/") ? namespace : `/${namespace}`;
  const socket = (0, import_socket.io)(normalizedNamespace, {
    path: "/wss",
    transports: ["websocket", "polling"],
    autoConnect: true,
    ...opts
  });
  return socket;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  lolySocket
});
//# sourceMappingURL=sockets.cjs.map