'use strict';
import { c } from 'react/compiler-runtime';
import { jsx, jsxs } from 'react/jsx-runtime';
import React, { Suspense } from 'react';
import { useFormField, FormControl, FormMessage } from '../../../fd-component-toolbox/form/Form.js';
import { LoadingIndicator } from '../../../fd-component-toolbox/loading/LoadingIndicator.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
const RichText = React.lazy(async () => {
  const richTextModule = await import('../../../fd-component-toolbox/rich-text/RichText.js');
  return {
    default: richTextModule.RichText
  };
});
function EditResourceRichTextField(t0) {
  const $ = c(8);
  const {
    onChange,
    value,
    label,
    defaultValue,
    id,
    onBlur
  } = t0;
  const {
    error
  } = useFormField();
  let t1;
  if ($[0] !== defaultValue || $[1] !== error || $[2] !== id || $[3] !== label || $[4] !== onBlur || $[5] !== onChange || $[6] !== value) {
    t1 = jsx(FormControl, {
      children: jsxs(Suspense, {
        fallback: jsx(LoadingIndicator, {}),
        children: [jsx(RichText, {
          value,
          onChange,
          placeholder: "Start typing...",
          debounceTime: 500,
          defaultValue: defaultValue ?? "",
          label,
          invalid: !!error,
          onBlur,
          id
        }), jsx(FormMessage, {})]
      })
    });
    $[0] = defaultValue;
    $[1] = error;
    $[2] = id;
    $[3] = label;
    $[4] = onBlur;
    $[5] = onChange;
    $[6] = value;
    $[7] = t1;
  } else {
    t1 = $[7];
  }
  return t1;
}
__name(EditResourceRichTextField, "EditResourceRichTextField");

export { EditResourceRichTextField };
