"use client" import { forwardRef, useEffect, useImperativeHandle, useRef } from "react" import { DRAWIO_CONFIG, EMPTY_DRAWIO_DOCUMENT, } from "@/lib/drawio/drawio-config" import { attachEditor, detachEditor, watchForEditorUi, } from "@/lib/drawio/editor-bridge" export interface DrawioExportEvent { event: "export" format: string data: string xml: string message: { message?: string; [key: string]: unknown } } export interface DrawioFrameHandle { load: (data: { xml: string }) => void exportDiagram: (data: { format: string message?: string [key: string]: unknown }) => void } interface DrawioFrameProps { src: string /** * Theme CSS: sent with the configure message (works cross-origin too) * and, same origin, injected as a