const EXTENSION_HOST_FAMILIES = [
  "generic",
  "menu",
  "data-table",
  "crud-form",
  "detail",
  "portal-page",
  "component-handle",
  "entity",
  "api-route",
  "command",
  "event",
  "query-lifecycle",
  "dashboard",
  "notification",
  "integration",
  "specialized-registry",
  "module-override"
];
const EXTENSION_HOST_CAPABILITIES = [
  "render-widget",
  "headless-widget",
  "menu-item",
  "column-widget",
  "row-action",
  "bulk-action",
  "filter-widget",
  "toolbar-widget",
  "field-widget",
  "lifecycle-handler",
  "component-replacement",
  "response-enricher",
  "query-enricher",
  "api-interceptor",
  "command-interceptor",
  "mutation-guard",
  "entity-extension",
  "async-subscriber",
  "sync-subscriber",
  "browser-client",
  "browser-portal",
  "registry-contribution",
  "module-override"
];
const EXTENSION_HOST_ACTIVATIONS = ["always", "host-opt-in", "caller-opt-in", "feature-gated"];
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 DATA_TABLE_EXTENSION_SURFACE_KEYS = DATA_TABLE_EXTENSION_SURFACES.map((surface) => surface.key);
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_EXTENSION_SURFACE_KEYS = CRUD_FORM_EXTENSION_SURFACES.map((surface) => surface.key);
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);
}
const MODULE_EXTENSION_CONTRIBUTION_KINDS = [
  "widget",
  "data-table",
  "crud-form",
  "component-override",
  "response-enricher",
  "api-interceptor",
  "command-interceptor",
  "mutation-guard",
  "entity-extension",
  "subscriber",
  "browser-reaction",
  "specialized-registry",
  "module-override"
];
const MODULE_EXTENSION_ACTIVATION_KINDS = [
  "crud-response-enricher",
  "query-enricher",
  "mutation-guard",
  "api-interceptor-bridge",
  "command-interceptor-bridge",
  "widget-injection-consumer",
  "component-extension-consumer",
  "dashboard-host-consumer"
];
const MODULE_EXTENSION_TARGET_KINDS = [
  "module",
  "entity",
  "api-route",
  "command",
  "widget-spot",
  "component",
  "event",
  "notification",
  "wildcard"
];
const MODULE_EXTENSION_RESOLUTIONS = [
  "bound",
  "capability-only",
  "optional-target-missing",
  "wildcard",
  "unresolved"
];
const MODULE_EXTENSION_HOST_RESOLUTIONS = ["exact", "pattern", "framework", "fact-ref"];
const MODULE_EXTENSION_TARGET_RESOLUTIONS = [
  "exact",
  "pattern",
  "framework",
  "fact-ref",
  "optional-external",
  "unresolved"
];
const MODULE_SPECIALIZED_REGISTRIES = [
  "notification",
  "integration",
  "search",
  "vector",
  "ai",
  "payment",
  "shipping",
  "currency",
  "workflow"
];
const COMPONENT_OVERRIDE_MODES = ["replace", "wrapper", "props"];
const MODULE_EXTENSION_UNRESOLVED_REASONS = [
  "unclassified-binding",
  "unbound-declaration",
  "dynamic-without-pattern",
  "unresolved-first-party-target"
];
export {
  COMPONENT_OVERRIDE_MODES,
  CRUD_FORM_EXTENSION_SURFACES,
  CRUD_FORM_EXTENSION_SURFACE_KEYS,
  CRUD_FORM_LIFECYCLE_PHASES,
  CRUD_FORM_OPERATIONS,
  DATA_TABLE_EXTENSION_SURFACES,
  DATA_TABLE_EXTENSION_SURFACE_KEYS,
  EXTENSION_HOST_ACTIVATIONS,
  EXTENSION_HOST_CAPABILITIES,
  EXTENSION_HOST_FAMILIES,
  MODULE_EXTENSION_ACTIVATION_KINDS,
  MODULE_EXTENSION_CONTRIBUTION_KINDS,
  MODULE_EXTENSION_HOST_RESOLUTIONS,
  MODULE_EXTENSION_RESOLUTIONS,
  MODULE_EXTENSION_TARGET_KINDS,
  MODULE_EXTENSION_TARGET_RESOLUTIONS,
  MODULE_EXTENSION_UNRESOLVED_REASONS,
  MODULE_SPECIALIZED_REGISTRIES,
  componentExtensionHost,
  crudFormExtensionHost,
  crudFormExtensionSpotId,
  dataTableExtensionHost,
  dataTableExtensionSpotId,
  defineModuleExtensionPoints,
  extensionSpotChildId,
  injectionExtensionHost,
  resolveExtensionPointPattern
};
//# sourceMappingURL=extension-points.js.map
