import { at as i } from "./use-page-data.BYLN5MSa.js";
import "lodash-es";
function a(e) {
  return {
    ...e,
    provider: "internal",
    schema: s(e.schema)
  };
}
function s(e) {
  const { items: t, ...r } = e;
  return {
    ...r,
    items: {
      ...t,
      type: "object",
      properties: {
        ...t.properties,
        ...i.properties
      },
      required: Array.from(/* @__PURE__ */ new Set([
        "$id",
        "$slug",
        "$lastModificationDate",
        ...t.required
      ]))
    }
  };
}
function p(e) {
  if (!("indexes" in e))
    return console.error("no datasource or indexes found", e), [];
  const t = e.schema?.items?.properties || {};
  return Array.from(new Set(e.indexes?.map((r) => r.fields[0]) ?? [])).map((r) => ({
    value: r,
    title: t[r]?.title || r
  }));
}
export {
  a as d,
  p as g
};
