import ReactDOM from 'react-dom';
import React from 'react';
import { useBehaviorSubject } from '@rcp/use.behaviorsubject';
import { DndLayout } from '../mometa/runtime/dnd';
import { iframeWindowsSubject } from './config/const';
export const floatingRender = (container) => {
    ReactDOM.render(React.createElement(DndLayoutManager, null), container);
    return () => {
        ReactDOM.unmountComponentAtNode(container);
    };
};
export function DndLayoutManager() {
    const [wins] = useBehaviorSubject(iframeWindowsSubject);
    const doms = React.useMemo(() => {
        return wins === null || wins === void 0 ? void 0 : wins.map((w) => w.document.body).filter((x) => x && x.parentNode);
    }, [wins]);
    return (React.createElement(React.Fragment, null, doms === null || doms === void 0 ? void 0 : doms.map((dom, i) => (React.createElement(DndLayout, { dom: dom, key: i })))));
}
//# sourceMappingURL=render-floating.js.map