import {
  RichTextV1Definition,
  StableValue
} from "@makeswift/controls";
import { renderRichText } from "../../runtimes/react/controls/rich-text";
import { RichTextControl } from "./control";
class BaseDefinition extends RichTextV1Definition {
}
class Definition extends BaseDefinition {
  static deserialize(data) {
    if (data.type !== Definition.type) {
      throw new Error(`RichTextV1: expected type ${Definition.type}, got ${data.type}`);
    }
    return new class RichTextV1 extends Definition {
    }();
  }
  resolveValue(data, _resolver, _stylesheet, control) {
    const stableValue = StableValue({
      name: Definition.type,
      read: () => renderRichText(data, control ?? null)
    });
    return {
      ...stableValue,
      triggerResolve: async () => {
      }
    };
  }
  createInstance(sendMessage) {
    return new RichTextControl(sendMessage);
  }
}
export {
  RichTextControl as RichTextV1Control,
  Definition as RichTextV1Definition
};
//# sourceMappingURL=rich-text.js.map