import { j as jsxRuntimeExports } from "../../../../../_virtual/jsx-runtime.js";
import { Suspense, lazy } from "react";
import { useSelectedBrickId } from "../../../../../use-editor.js";
const bricks = /* @__PURE__ */ Object.assign({ "../bricks/accordion.tsx": () => import("../bricks/accordion.js"), "../bricks/box.tsx": () => import("../bricks/box.js"), "../bricks/button.tsx": () => import("../bricks/button.js"), "../bricks/card.tsx": () => import("../bricks/card.js"), "../bricks/carousel.tsx": () => import("../bricks/carousel.js"), "../bricks/footer.tsx": () => import("../bricks/footer.js"), "../bricks/form.tsx": () => import("../bricks/form.js"), "../bricks/hero.tsx": () => import("../bricks/hero.js"), "../bricks/html.tsx": () => import("../bricks/html.js"), "../bricks/icon.tsx": () => import("../bricks/icon.js"), "../bricks/image.tsx": () => import("../bricks/image.js"), "../bricks/images-gallery.tsx": () => import("../bricks/images-gallery.js"), "../bricks/map.tsx": () => import("../bricks/map.js"), "../bricks/navbar.tsx": () => import("../bricks/navbar.js"), "../bricks/sidebar.tsx": () => import("../bricks/sidebar.js"), "../bricks/social-links.tsx": () => import("../bricks/social-links.js"), "../bricks/spacer.tsx": () => import("../bricks/spacer.js"), "../bricks/testimonials.tsx": () => import("../bricks/testimonials.js"), "../bricks/text.tsx": () => import("../bricks/text.js"), "../bricks/video.tsx": () => import("../bricks/video.js") });
const bricksMap = Object.entries(bricks).reduce(
  (acc, [path, importFn]) => {
    const componentName = path.match(/\.\/bricks\/(.*)\.(j|t)sx?$/)[1];
    acc[componentName] = lazy(importFn);
    return acc;
  },
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
  {}
);
const BrickComponent = ({
  brick,
  editable,
  isDynamicPreview,
  iterationIndex
}) => {
  const selectedBrickId = useSelectedBrickId();
  const BrickModule = bricksMap[brick.type];
  if (!BrickModule) {
    console.warn("Brick not found", brick.type);
    return null;
  }
  const brickProps = {
    brick,
    editable,
    isDynamicPreview,
    selected: brick.id === selectedBrickId,
    iterationIndex
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BrickModule, { ...brickProps }) });
};
export {
  BrickComponent as default
};
//# sourceMappingURL=BrickComponent.js.map
