"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var rich_text_exports = {};
__export(rich_text_exports, {
  RichTextV1Control: () => import_control.RichTextControl,
  RichTextV1Definition: () => Definition
});
module.exports = __toCommonJS(rich_text_exports);
var import_controls = require("@makeswift/controls");
var import_rich_text = require("../../runtimes/react/controls/rich-text");
var import_control = require("./control");
class BaseDefinition extends import_controls.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 = (0, import_controls.StableValue)({
      name: Definition.type,
      read: () => (0, import_rich_text.renderRichText)(data, control ?? null)
    });
    return {
      ...stableValue,
      triggerResolve: async () => {
      }
    };
  }
  createInstance(sendMessage) {
    return new import_control.RichTextControl(sendMessage);
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  RichTextV1Control,
  RichTextV1Definition
});
//# sourceMappingURL=rich-text.js.map