import { jsx } from "react/jsx-runtime";
import { memo, useState } from "react";
import frameHtml from "./iframe.html?resource";
import { IFrame } from "./iframe/index.js";
import { useFrameLoaded } from "./use-frame-loaded.js";
import {
  useAppWillRender
} from "../micro-app/use-app-will-render.js";
const App = memo(
  ({ id, uuid, dispose, onUnloadComplete, ...rest }) => {
    const [documentEle, setDocumentEle] = useState(null);
    useFrameLoaded({ id, documentEle, ...rest });
    useAppWillRender({
      id,
      uuid,
      documentEle: dispose ? null : documentEle,
      onUnloadComplete,
      ...rest
    });
    return /* @__PURE__ */ jsx(
      IFrame,
      {
        id,
        src: frameHtml,
        ...rest,
        onFrameReady: setDocumentEle
      }
    );
  }
);
export {
  App
};
