import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { Component, useField, SugaredField } from "@contember/binding";
import { FieldFallbackView } from "./FieldFallbackView.js";
const ImageFieldView = Component(
  ({
    srcField,
    altField,
    titleField,
    formatUrl,
    fallback,
    fallbackStyle,
    ...imgProps
  }) => {
    const srcAccessor = useField(srcField);
    const altAccessor = useField(altField);
    const titleAccessor = useField(titleField);
    if (srcAccessor.value === null) {
      return /* @__PURE__ */ jsxDEV(FieldFallbackView, { fallback, fallbackStyle }, void 0, false, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/ImageFieldView.tsx",
        lineNumber: 34,
        columnNumber: 11
      }, globalThis);
    }
    return (
      // The spread intentionally comes after alt and title so that it's possible to provide just static string values.
      /* @__PURE__ */ jsxDEV(
        "img",
        {
          src: formatUrl ? formatUrl(srcAccessor.value) : srcAccessor.value,
          alt: altAccessor?.value || void 0,
          title: titleAccessor?.value || void 0,
          ...imgProps
        },
        void 0,
        false,
        {
          fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/ImageFieldView.tsx",
          lineNumber: 38,
          columnNumber: 4
        },
        globalThis
      )
    );
  },
  ({ altField, srcField, titleField, fallback, fallbackStyle }) => /* @__PURE__ */ jsxDEV(Fragment, { children: [
    /* @__PURE__ */ jsxDEV(SugaredField, { field: srcField }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/ImageFieldView.tsx",
      lineNumber: 48,
      columnNumber: 4
    }, globalThis),
    altField && /* @__PURE__ */ jsxDEV(SugaredField, { field: altField }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/ImageFieldView.tsx",
      lineNumber: 49,
      columnNumber: 17
    }, globalThis),
    titleField && /* @__PURE__ */ jsxDEV(SugaredField, { field: titleField }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/ImageFieldView.tsx",
      lineNumber: 50,
      columnNumber: 19
    }, globalThis),
    /* @__PURE__ */ jsxDEV(FieldFallbackView, { fallback, fallbackStyle }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/ImageFieldView.tsx",
      lineNumber: 51,
      columnNumber: 4
    }, globalThis)
  ] }, void 0, true, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/fieldViews/ImageFieldView.tsx",
    lineNumber: 47,
    columnNumber: 3
  }, globalThis),
  "ImageFieldView"
);
export {
  ImageFieldView
};
//# sourceMappingURL=ImageFieldView.js.map
