import { generateId } from "./../ricos-content/index.js";
import { HTMLData_Source } from "./../ricos-schema/next-schema/index.js";
import { openFloatingPromptInput } from "./tiptap/open-floating-prompt-input.js";
import { HTML_TYPE } from "./types.js";
async function insertAiWidgetBlockAndOpenPrompt(options) {
  if (options.useWixelWidgets && options.canProceed) {
    const canProceed = await options.canProceed();
    if (!canProceed) {
      return;
    }
  }
  const nodeId = generateId();
  const attrs = {
    id: nodeId,
    containerData: {
      alignment: "CENTER",
      height: {
        custom: "474"
      },
      width: {
        custom: "900"
      }
    },
    source: options.useWixelWidgets ? HTMLData_Source.AI_WIDGET : HTMLData_Source.AI,
    state: {
      status: "INITIAL"
    }
  };
  options.publicCommands.insertBlockWithBlankLines(HTML_TYPE, attrs, { updateSelection: false });
  openFloatingPromptInput({
    nodeId,
    editor: options.editor,
    modals: options.modals,
    getColorPalette: options.getColorPalette
  });
}
export {
  insertAiWidgetBlockAndOpenPrompt
};
//# sourceMappingURL=insert-ai-widget-block.js.map
