function defineModuleExtensionPoints(declaration) {
  return Object.freeze({
    ...declaration,
    hosts: Object.freeze({ ...declaration.hosts })
  });
}
function injectionExtensionHost(declaration) {
  const hasExactId = typeof declaration.spotId === "string" && declaration.spotId.length > 0;
  const hasPattern = typeof declaration.pattern === "string" && declaration.pattern.length > 0;
  if (hasExactId === hasPattern) {
    throw new Error("[internal] injection extension hosts require exactly one of spotId or pattern");
  }
  if (hasPattern && (!declaration.parameters || Object.keys(declaration.parameters).length === 0)) {
    throw new Error("[internal] patterned injection extension hosts require named parameters");
  }
  return Object.freeze({ ...declaration });
}
function dataTableExtensionHost(declaration) {
  return Object.freeze({ family: "data-table", ...declaration });
}
function crudFormExtensionHost(declaration) {
  return Object.freeze({ family: "crud-form", ...declaration });
}
function componentExtensionHost(declaration) {
  return Object.freeze({ family: "component-handle", ...declaration });
}
const DATA_TABLE_EXTENSION_SURFACES = [
  { key: "header", suffix: "header", capabilities: ["render-widget"], bound: true },
  { key: "footer", suffix: "footer", capabilities: ["render-widget"], bound: true },
  { key: "toolbar", suffix: "toolbar", capabilities: ["toolbar-widget"], bound: true },
  { key: "searchTrailing", suffix: "search-trailing", capabilities: ["render-widget"], bound: true },
  { key: "columns", suffix: "columns", capabilities: ["column-widget"], bound: true },
  { key: "rowActions", suffix: "row-actions", capabilities: ["row-action"], bound: true },
  { key: "bulkActions", suffix: "bulk-actions", capabilities: ["bulk-action"], bound: true },
  { key: "filters", suffix: "filters", capabilities: ["filter-widget"], bound: true },
  { key: "replacement", suffix: null, capabilities: ["component-replacement"], bound: true },
  { key: "emptyState", suffix: "empty-state", capabilities: ["render-widget"], bound: false }
];
const CRUD_FORM_EXTENSION_SURFACES = [
  { key: "base", suffix: null, capabilities: ["render-widget", "lifecycle-handler"], bound: true },
  { key: "header", suffix: "header", capabilities: ["render-widget"], bound: true },
  { key: "fields", suffix: "fields", capabilities: ["field-widget"], bound: true },
  { key: "replacement", suffix: null, capabilities: ["component-replacement"], bound: true },
  { key: "beforeFields", suffix: "before-fields", capabilities: ["render-widget"], bound: false },
  { key: "afterFields", suffix: "after-fields", capabilities: ["render-widget"], bound: false },
  { key: "footer", suffix: "footer", capabilities: ["render-widget"], bound: false },
  { key: "sidebar", suffix: "sidebar", capabilities: ["render-widget"], bound: false },
  { key: "group", suffix: "group:{groupId}", capabilities: ["render-widget"], bound: false },
  { key: "fieldBefore", suffix: "field:{fieldId}:before", capabilities: ["render-widget"], bound: false },
  { key: "fieldAfter", suffix: "field:{fieldId}:after", capabilities: ["render-widget"], bound: false }
];
const CRUD_FORM_LIFECYCLE_PHASES = [
  "transformValidation",
  "transformDisplayData",
  "onBeforeNavigate",
  "onAppEvent",
  "onVisibilityChange",
  "onBeforeDelete",
  "onDelete",
  "onAfterDelete",
  "onDeleteError",
  "onFieldChange",
  "transformFormData",
  "onBeforeSave",
  "onSave",
  "onAfterSave"
];
const CRUD_FORM_OPERATIONS = ["create", "update", "delete"];
function dataTableExtensionSpotId(tableId, suffix) {
  return suffix ? `data-table:${tableId}:${suffix}` : `data-table:${tableId}`;
}
function crudFormExtensionSpotId(entityId, suffix) {
  return suffix ? `crud-form:${entityId}:${suffix}` : `crud-form:${entityId}`;
}
function extensionSpotChildId(spotId, suffix) {
  return `${spotId}:${suffix}`;
}
function resolveExtensionPointPattern(pattern, parameters) {
  return pattern.replace(/\{([^}]+)\}/g, (token, parameterName) => parameters[parameterName] ?? token);
}
export {
  CRUD_FORM_EXTENSION_SURFACES,
  CRUD_FORM_LIFECYCLE_PHASES,
  CRUD_FORM_OPERATIONS,
  DATA_TABLE_EXTENSION_SURFACES,
  componentExtensionHost,
  crudFormExtensionHost,
  crudFormExtensionSpotId,
  dataTableExtensionHost,
  dataTableExtensionSpotId,
  defineModuleExtensionPoints,
  extensionSpotChildId,
  injectionExtensionHost,
  resolveExtensionPointPattern
};
//# sourceMappingURL=extension-points.js.map
