{"version":3,"file":"utils.mjs","sources":["../../src/core/utils.ts"],"sourcesContent":["import type { SDKTypes, Room as ServerRoom } from '@colyseus/core';\n\nexport function now(): number {\n    return typeof(performance) !== 'undefined' ? performance.now() : Date.now();\n}\n\n/**\n * Infer the room constructor from ServerType based on the instance type.\n * This allows proper type inference for SDK Room methods like `send()` and `onMessage()`.\n */\nexport type InferRoomConstructor<ServerType extends SDKTypes, Instance> =\n  // First, try to find a matching room constructor in ServerType['~rooms']\n  ServerType extends SDKTypes<infer Rooms>\n    ? {\n        [K in keyof Rooms]: Instance extends InstanceType<Rooms[K]['~room']>\n          ? Rooms[K]['~room']\n          : never\n      }[keyof Rooms]\n    : // Fallback: create a synthetic constructor type from the instance\n      (typeof ServerRoom) & { prototype: Instance };"],"names":[],"mappings":";;;;;;SAEgB,GAAG,GAAA;IACf,OAAO,QAAO,WAAW,CAAC,KAAK,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE;AAC/E;;;;"}