import { j as e } from "../../../../../_virtual/jsx-runtime.js";
import { a as p } from "../../../../sdk/dist/shared/chunk-PXI7AHWS.js";
import "../../../../sdk/dist/shared/chunk-3YVJ2ELD.js";
import "../../../../sdk/dist/shared/chunk-AFVJZPLS.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-A3GF4PYW.js";
import "../../../../sdk/dist/shared/chunk-W33JMRRN.js";
import s from "../components/TextContent.js";
import { tx as o } from "../../../../style-system/dist/twind.js";
import { useBrickStyle as d } from "../hooks/use-brick-style.js";
import x from "../components/BrickRoot.js";
import { useBrickProps as g } from "../hooks/use-brick-props.js";
import { useState as f } from "react";
function B(a) {
  const { brick: r, editable: i } = a, t = g(a), n = d(r), m = Object.values(n), [l, c] = f(!0);
  return /* @__PURE__ */ e.jsxs(
    x,
    {
      brick: r,
      editable: i,
      manifest: p,
      className: o(
        "flex relative overflow-hidden !flex-nowrap",
        t.imagePosition === "left" || t.imagePosition === "right" ? "flex-row" : "flex-col",
        m
      ),
      children: [
        /* @__PURE__ */ e.jsxs(
          "div",
          {
            className: o(
              "card-inner-wrapper",
              t.imagePosition === "top" ? "order-2" : t.imagePosition === "left" ? "order-last" : "order-1"
            ),
            children: [
              !t.noTitle && /* @__PURE__ */ e.jsx("div", { className: o("text-[120%] font-semibold z-auto my-4 mx-4"), children: /* @__PURE__ */ e.jsx(
                s,
                {
                  propPath: "title.content",
                  className: o("flex-1"),
                  brickId: r.id,
                  content: t.title,
                  rawContent: r.props.title,
                  editable: i,
                  inline: !0
                }
              ) }),
              t.imagePosition !== "middle" && /* @__PURE__ */ e.jsx("div", { className: o("z-auto p-4", !t.noTitle && "pt-0"), children: /* @__PURE__ */ e.jsx(
                s,
                {
                  propPath: "text.content",
                  className: o("flex-grow"),
                  brickId: r.id,
                  content: t.text,
                  rawContent: r.props.text,
                  editable: i
                }
              ) })
            ]
          }
        ),
        t.cardImage?.src && l && /* @__PURE__ */ e.jsx(
          "img",
          {
            onError: () => c(!1),
            className: o(
              " select-none pointer-events-none bg-transparent",
              t.cardImage.position ?? "object-center",
              t.cardImage.fit ?? "object-cover",
              t.imagePosition === "left" && "order-1",
              t.imagePosition === "right" && "order-last",
              t.imagePosition === "middle" && "order-2",
              t.imagePosition === "top" && "order-first",
              t.imagePosition === "bottom" && "order-last mt-auto",
              t.imagePosition === "left" || t.imagePosition === "right" ? "h-auto w-[clamp(100px,40%,400px)]" : "w-inherit h-[clamp(100px,50%,250px)]"
            ),
            src: t.cardImage.src,
            alt: t.cardImage.alt || "Card Image"
          }
        ),
        t.text && t.imagePosition === "middle" && /* @__PURE__ */ e.jsx("div", { className: o("z-auto p-4 order-last"), children: /* @__PURE__ */ e.jsx(
          s,
          {
            propPath: "text.content",
            className: o("flex-1 prose lg:prose-lg"),
            brickId: r.id,
            content: t.text,
            rawContent: r.props.text,
            editable: i
          }
        ) })
      ]
    }
  );
}
export {
  B as default
};
//# sourceMappingURL=card.js.map
