import { defineExtension, safeCast, shallowMergeConfig } from "lexical";
const BylineFloatingUIExtension = defineExtension({
    name: '@byline/richtext-lexical/FloatingUI',
    config: safeCast({
        items: []
    }),
    mergeConfig (a, b) {
        const merged = shallowMergeConfig(a, b);
        if (b.items && b.items.length > 0) merged.items = [
            ...a.items,
            ...b.items
        ];
        return merged;
    }
});
function selectFloatingUIItems(items) {
    return items.slice().sort((a, b)=>(a.order ?? 0) - (b.order ?? 0));
}
export { BylineFloatingUIExtension, selectFloatingUIItems };
