import "./chunk-MKBO26DX.js";

// src/index.ts
function isGeneratedColumn(c, primaryKeyColumns) {
  return c.isGenerated || primaryKeyColumns.includes(c.name);
}
function insertColumns(table) {
  const pkCols = table.primaryKey?.columns ?? [];
  return table.columns.filter((c) => !isGeneratedColumn(c, pkCols));
}
function updateColumns(table) {
  const pkCols = table.primaryKey?.columns ?? [];
  return table.columns.filter((c) => !pkCols.includes(c.name));
}
function selectColumns(table) {
  return table.columns;
}
async function formatCode(code, filePath, fmt) {
  if (fmt && fmt.enabled === false) return code;
  const engine = fmt?.engine ?? "auto";
  try {
    if (engine === "prettier" || engine === "auto") {
      const prettier = await import("./prettier-Y62OQ7O7.js");
      const cfgRef = fmt?.configPath ?? filePath;
      const cfg = await prettier.resolveConfig(cfgRef).catch(() => null);
      return prettier.format(code, { ...cfg ?? {}, parser: "typescript", filepath: filePath });
    }
  } catch {
  }
  try {
    if (engine === "biome" || engine === "auto") {
      const dynamicImport = Function("s", "return import(s)");
      const biome = await dynamicImport("@biomejs/biome").catch(() => null);
      if (biome?.formatContent) {
        const res = await biome.formatContent(code, { filePath });
        return (res && (res.content || res.formatted)) ?? code;
      }
    }
  } catch {
  }
  return code;
}
export {
  formatCode,
  insertColumns,
  isGeneratedColumn,
  selectColumns,
  updateColumns
};
