import { a as g } from "./chunk-CCI4C3TM.js";
import { e as d$1, c as u$1 } from "./chunk-A3GF4PYW.js";
import { a as a$3 } from "./chunk-QWGUMKZC.js";
import { a as f, e as d$2 } from "./chunk-5YRC3IT3.js";
import { a as n$1 } from "./chunk-GACHLACT.js";
import { a as d, c as r$1 } from "./chunk-4BTB3MU2.js";
import { a as u, c as l } from "./chunk-DHI3IBOD.js";
import { c as a, a as p } from "./chunk-ZTZJHY4E.js";
import { b as d$3 } from "./chunk-CZRCW5EN.js";
import { a as s, c as a$2 } from "./chunk-NM5MMPCF.js";
import { a as a$1 } from "./chunk-W33JMRRN.js";
import { a as r, c as l$1, e as o } from "./chunk-SWLUQVK7.js";
import { b as p$1 } from "./chunk-OHNYCXPX.js";
import { a as n } from "./chunk-KFM6KXSE.js";
import { a as i } from "./chunk-JMN3HTZU.js";
import ne from "../../../../_virtual/ajv.js";
import le from "../../../../_virtual/index2.js";
import { Type } from "@sinclair/typebox";
import "lodash-es";
/*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
Type.Union([Type.Literal("internal")]);
var H = Type.Object({ id: Type.String({ title: "ID", description: "Unique identifier of the datasource. Used to reference the datasource in the system. Use a url-safe string like a slug." }), label: Type.String({ title: "Label", description: "Label of the datasource displayed in the UI" }), provider: Type.Literal("internal", { title: "Internal", description: "Internal datasource saved locally in Upstart." }), schema: Type.Any({ title: "Schema", description: "JSON Schema of datasource. MUST Always an array of objects." }), indexes: Type.Optional(Type.Array(Type.Object({ name: Type.String({ title: "Index name" }), fields: Type.Array(Type.String(), { title: "Fields to index" }), unique: Type.Optional(Type.Boolean({ title: "Unique index", default: false })) }), { title: "Indexes", description: "IMPORTANT: Indexes to create on the datasource. use it to enforce uniqueness or improve query performance." })) }, { examples: [{ id: "customers", label: "Customers", provider: "internal", schema: { type: "array", items: { type: "object", properties: { name: { type: "string", title: "Name" }, email: { type: "string", title: "Email", format: "email" } }, required: ["name", "email"], title: "Customer", examples: [{ name: "John Doe", email: "john.doe@example.com" }, { name: "Jane Smith", email: "jane.smith@example.com" }, { name: "Alice Johnson", email: "alice.johnson@example.com" }, { name: "Bob Brown", email: "bob.brown@example.com" }, { name: "Charlie Davis", email: "charlie.davis@example.com" }] } }, indexes: [{ name: "idx_customers_email", fields: ["email"], unique: true }] }, { id: "blog_posts", label: "Blog Posts", provider: "internal", schema: { type: "array", items: { type: "object", properties: { title: { type: "string", title: "Title" }, content: { type: "string", title: "Content" }, author: { type: "string", title: "Author" } }, required: ["title", "content", "author"], title: "Blog Post", examples: [{ title: "My First Blog Post", content: "This is the content of my first blog post.", author: "John Doe" }, { title: "Exploring the Cosmos", content: "A journey through the stars and galaxies.", author: "Jane Smith" }, { title: "The Art of Cooking", content: "Delicious recipes and cooking tips.", author: "Alice Johnson" }, { title: "Traveling the World", content: "My adventures in different countries.", author: "Bob Brown" }, { title: "Technology Trends", content: "The latest trends in technology.", author: "Charlie Davis" }] } }, indexes: [{ name: "idx_blog_posts_title", fields: ["title"], unique: true }] }] }), Q = H;
Type.Array(Q);
var X = Type.Object({ field: Type.String(), op: Type.Union([Type.Literal("eq"), Type.Literal("ne"), Type.Literal("contains"), Type.Literal("notContains"), Type.Literal("startsWith"), Type.Literal("notStartsWith"), Type.Literal("endsWith"), Type.Literal("notEndsWith")]), value: Type.String() }), ee = Type.Object({ field: Type.String(), op: Type.Union([Type.Literal("eq"), Type.Literal("ne"), Type.Literal("lt"), Type.Literal("lte"), Type.Literal("gt"), Type.Literal("gte")]), value: Type.Number() }), te = Type.Object({ field: Type.String(), op: Type.Union([Type.Literal("before"), Type.Literal("after")]), value: Type.String() }), re = Type.Object({ field: Type.String(), op: Type.Union([Type.Literal("beforeNow"), Type.Literal("afterNow")]), value: Type.Null() }), ie = Type.Object({ field: Type.String(), op: Type.Union([Type.Literal("contains"), Type.Literal("notContains"), Type.Literal("containsAll"), Type.Literal("containsAny"), Type.Literal("notContainsAny")]), value: Type.Array(Type.String()) }), oe = Type.Object({ field: Type.String(), op: Type.Literal("eq"), value: Type.Boolean() }), S = Type.Union([X, ee, te, re, ie, oe]), ae = Type.Recursive((t) => Type.Union([Type.Object({ op: Type.Literal("and"), fields: Type.Array(Type.Union([S, t]), { title: "Indexed Fields" }) }), Type.Object({ op: Type.Literal("or"), fields: Type.Array(Type.Union([S, t])) })], { default: { op: "and", fields: [] }, examples: [{ op: "and", fields: [{ field: "$id", op: "eq", value: "123" }, { field: "$publicationDate", op: "beforeNow" }] }] }), { title: "Filter Expression", description: "Expression used to filter query results. Can be a combination of and/or conditions." }), Se = Type.Object({ id: Type.String({ title: "Query ID", description: "Unique identifier for the query. Used to reference the query in the system. URL-safe string like a slug." }), label: Type.String({ title: "Label", maxLength: 100, description: "Label of the query displayed in the UI" }), datasourceId: Type.String({ title: "Database", description: "ID of the datasource to query" }), limit: Type.Number({ title: "Limit", description: "Limit the number of records to fetch from the datasource.", minimum: 1, default: 10 }), sortDirection: Type.Optional(i(["asc", "desc"], { title: "Sort", enumNames: ["Ascending", "Descending"], description: "Direction to sort the records by", default: "desc" })), sortField: Type.Optional(Type.String({ title: "Sort Field", description: "Field to sort by (must be an indexed field)", default: "$publicationDate" })), filters: Type.Optional(ae), parameters: Type.Optional(Type.Array(Type.Object({ field: Type.String({ title: "Field", description: "Field name to use as parameter" }), op: Type.Union([Type.Literal("eq"), Type.Literal("ne"), Type.Literal("contains"), Type.Literal("notContains"), Type.Literal("startsWith"), Type.Literal("notStartsWith"), Type.Literal("endsWith"), Type.Literal("notEndsWith"), Type.Literal("lt"), Type.Literal("lte"), Type.Literal("gt"), Type.Literal("gte"), Type.Literal("before"), Type.Literal("after"), Type.Literal("beforeNow"), Type.Literal("afterNow"), Type.Literal("containsAll"), Type.Literal("containsAny"), Type.Literal("notContainsAny")], { title: "Operator", description: "Operator to use for the parameter" }) }), { title: "Parameters", description: "Field name and operator that will be used as parameters when using the query in pages. Only indexed fields can be used as parameters.", default: [], examples: [[{ field: "$slug", op: "eq" }], [{ field: "category", op: "eq" }], [{ field: "tags", op: "containsAny" }], [{ field: "author", op: "eq" }], [{ field: "title", op: "contains" }]] })) }, { examples: [{ id: "latest-posts", label: "Latest posts", datasourceId: "blog_posts", limit: 5, sortDirection: "desc", sortField: "$publicationDate" }, { id: "posts-by-category", label: "Posts by category", datasourceId: "blog_posts", limit: 10, sortDirection: "desc", sortField: "$publicationDate", parameters: [{ field: "category", op: "eq" }] }, { id: "posts-by-tag", label: "Posts by tag", datasourceId: "blog_posts", limit: 10, sortDirection: "desc", sortField: "$publicationDate", parameters: [{ field: "tags", op: "containsAny" }] }, { id: "author-posts", label: "Author posts", datasourceId: "blog_posts", limit: 10, sortDirection: "desc", sortField: "$publicationDate", parameters: [{ field: "author", op: "eq" }] }, { id: "search-posts", label: "Search posts", datasourceId: "blog_posts", limit: 10, sortDirection: "desc", sortField: "$publicationDate", parameters: [{ field: "title", op: "contains" }] }] });
function Z() {
  return Type.Object({ queryId: Type.String({ description: "The Site Query ID to use." }), alias: Type.String({ title: "Alias", minLength: 1, maxLength: 100, pattern: "^[a-zA-Z0-9_]+$", description: "Alias for the query results, used in dynamic content. Use a simple keyword without spaces or special characters. Aliases are unique across the page.", "ai:instructions": "Use a simple keyword without spaces or special characters. Aliases are unique across the page. You can use the same query several times with different aliases in order to, for example, apply different parameters to the same query." }), params: Type.Optional(Type.Array(S, { description: "Additional query parameters/filters to apply to the query. One can use placeholders in values like ':slug' to reference URL parameters.", title: "Query Parameters", default: [] })) }, { title: "Query", description: "When set, this brick will loop through the results of the query and render the content for each item.", "ui:field": "query", metadata: { category: "content" }, examples: [{ queryId: "get-latest-posts", alias: "latestPosts" }, { queryId: "get-user-profile", alias: "userProfile", params: [{ field: "userId", op: "eq", value: ":slug" }] }, { queryId: "get-posts-by-category", alias: "postsByCategory", params: [{ field: "category", op: "eq", value: ":slug" }] }] });
}
var Oe = se();
function se(t = {}) {
  return n("content:queryUse", t);
}
function V(t = {}) {
  return Type.Object({ over: Type.String({ title: "Over", description: "The query alias to loop over. If not set, the brick will be rendered only once.", "ai:instructions": "Specify the Query Alias to loop over the results." }), overrideLimit: Type.Optional(Type.Number({ minimum: 1, description: "Override the limit of items to loop through. If not set, it will use the default limit of the query. If set to 1, it will not loop and will render only the first item." })) }, { title: "Repeat over", description: "Repeat this brick for each item in the specified query results.", "ui:field": "loop", "ui:hidden-if": "no-page-queries", metadata: { category: "content" }, examples: [{ over: "latestBlogPosts", overrideLimit: 5 }, { over: "featuredProducts", overrideLimit: 3 }, { over: "popularProducts" }], ...t });
}
function qe(t = {}) {
  return n("content:loop", t);
}
var ce = ["date-time", "date", "email", "url"];
function x() {
  let t = new ne({ useDefaults: true, strictSchema: false, validateSchema: false, coerceTypes: true, allErrors: true, inlineRefs: true });
  return t.addSchema(u(), "styles:background"), t.addSchema(l(), "styles:backgroundColor"), t.addSchema(r(), "styles:justifyContent"), t.addSchema(l$1(), "styles:alignItems"), t.addSchema(o(), "styles:alignSelf"), t.addSchema(a(), "styles:rounding"), t.addSchema(f(), "styles:fontSize"), t.addSchema(a$1(), "styles:hidden"), t.addSchema(n$1(), "styles:direction"), t.addSchema(p(), "styles:border"), t.addSchema(s(), "styles:color"), t.addSchema(a$2(), "styles:borderColor"), t.addSchema(d(), "styles:shadow"), t.addSchema(r$1(), "styles:textShadow"), t.addSchema(p$1(), "styles:cssLength"), t.addSchema(g(), "assets:image"), t.addSchema(d$1(), "assets:icon"), t.addSchema(d$2(), "content:text"), t.addSchema(u$1(), "content:urlOrPageId"), t.addSchema(V(), "content:loop"), t.addSchema(Z(), "content:queryUse"), t.addSchema(d$3(), "presets:color"), t.addSchema(a$3(), "content:tags"), le(t, [...ce]), t.addFormat("slug", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t.addFormat("image", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t.addFormat("file", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t.addFormat("nanoid", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t.addFormat("richtext", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t.addFormat("markdown", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t.addFormat("multiline", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t.addFormat("password", { validate: (r2) => typeof r2 == "string", async: false, type: "string" }), t;
}
var Me = x();
export {
  Q as d,
  S as g,
  Se as h,
  Z as i,
  Oe as j,
  se as k,
  V as l,
  qe as m,
  ce as n,
  x as o,
  Me as p
};
//# sourceMappingURL=chunk-AFVJZPLS.js.map
