import { existsSync, readFileSync } from 'node:fs';
import process__default from 'node:process';
import { fileURLToPath } from 'node:url';
import { d as dirname, j as join } from './ccjk.bQ7Dh1g4.mjs';

let cachedMetadata = null;
function readRuntimePackageMetadata() {
  if (cachedMetadata) {
    return cachedMetadata;
  }
  const currentDir = dirname(fileURLToPath(import.meta.url));
  const candidatePaths = [
    join(currentDir, "../../package.json"),
    join(currentDir, "../package.json"),
    join(process__default.cwd(), "package.json")
  ];
  for (const packagePath of candidatePaths) {
    if (!existsSync(packagePath)) {
      continue;
    }
    try {
      const parsed = JSON.parse(readFileSync(packagePath, "utf-8"));
      cachedMetadata = parsed;
      return parsed;
    } catch {
    }
  }
  cachedMetadata = {};
  return cachedMetadata;
}
function getRuntimeVersion() {
  return readRuntimePackageMetadata().version || "0.0.0";
}
function getRuntimeHomepage() {
  return readRuntimePackageMetadata().homepage || "https://github.com/miounet11/ccjk";
}

export { getRuntimeHomepage as a, getRuntimeVersion as g };
