// behaviors/data-dir.ts
var cached = null;
async function resolveStdDataDir() {
  if (cached !== null) return cached;
  const override = typeof process !== "undefined" && process.env?.ALMADAR_STD_DATA_DIR || "";
  if (override) return cached = override;
  if (typeof process === "undefined" || !process.versions?.node) return cached = "";
  const [{ createRequire }, nodePath, nodeUrl] = await Promise.all([
    import('module'),
    import('path'),
    import('url')
  ]);
  try {
    const req = createRequire(import.meta.url);
    return cached = nodePath.resolve(nodePath.dirname(req.resolve("@almadar/std/package.json")), "dist");
  } catch {
  }
  return cached = nodePath.dirname(nodeUrl.fileURLToPath(import.meta.url));
}

// behaviors/factory-signatures.ts
var cache = null;
async function loadCatalog() {
  if (cache) return cache;
  try {
    const { readFileSync } = await import('fs');
    const { resolve } = await import('path');
    const dir = await resolveStdDataDir();
    const raw = readFileSync(resolve(dir, "registry", "factory-signatures.json"), "utf-8");
    const parsed = JSON.parse(raw);
    if (typeof parsed?.generatedFromStdVersion !== "string" || !Array.isArray(parsed?.signatures)) {
      return null;
    }
    cache = parsed;
    return cache;
  } catch {
    return null;
  }
}
async function getFactorySignatureCatalog() {
  return loadCatalog();
}

export { getFactorySignatureCatalog };
//# sourceMappingURL=factory-signatures.js.map
//# sourceMappingURL=factory-signatures.js.map