"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var react_runtime_core_exports = {};
__export(react_runtime_core_exports, {
  ReactRuntimeCore: () => ReactRuntimeCore
});
module.exports = __toCommonJS(react_runtime_core_exports);
var import_activity_with_fallback = require("./components/activity-with-fallback");
var import_internal = require("../../state/actions/internal");
var import_components_meta = require("../../state/modules/components-meta");
var import_runtime_core = require("./runtime-core");
function validateComponentType(type, component) {
  const componentName = component?.name ?? "Component";
  if (typeof type !== "string" || type === "") {
    throw new Error(
      `${componentName}: A non-empty string \`type\` is required for component registration, got ${type}`
    );
  }
}
class ReactRuntimeCore extends import_runtime_core.RuntimeCore {
  registerComponent(component, {
    type,
    label,
    icon = import_components_meta.ComponentIcon.Cube,
    hidden = false,
    description,
    builtinSuspense,
    props
  }) {
    validateComponentType(type, component);
    const unregisterComponent = this.store.dispatch(
      (0, import_internal.registerComponentEffect)(
        type,
        { label, icon, hidden, description, builtinSuspense },
        props ?? {}
      )
    );
    if ((0, import_activity_with_fallback.supportsActivity)() && builtinSuspense !== void 0) {
      console.warn(
        "builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>."
      );
    }
    const unregisterReactComponent = this.store.dispatch(
      (0, import_internal.registerReactComponentEffect)(type, component)
    );
    return () => {
      unregisterComponent();
      unregisterReactComponent();
    };
  }
  constructor({ breakpoints } = {}) {
    super({ breakpoints });
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ReactRuntimeCore
});
//# sourceMappingURL=react-runtime-core.js.map