import "./chunks/SuperConverter-CEo_K44C.es.js";
import "./chunks/jszip-C49i9kUs.es.js";
import "./chunks/xml-js-CqGKpaft.es.js";
import { t as createHeadlessToolbar } from "./chunks/create-headless-toolbar-D_0tIvYE.es.js";
import "./chunks/constants-DrU4EASo.es.js";
import "./chunks/dist-B8HfvhaK.es.js";
import "./chunks/unified-Dsuw2be5.es.js";
import { onBeforeUnmount, shallowRef } from "vue";
var EMPTY_SNAPSHOT = {
	context: null,
	commands: {}
};
function useHeadlessToolbar(superdoc, commands) {
	if (!superdoc) return {
		snapshot: shallowRef(EMPTY_SNAPSHOT),
		execute: () => false
	};
	const controller = createHeadlessToolbar({
		superdoc,
		commands
	});
	const snapshot = shallowRef(controller.getSnapshot());
	const unsub = controller.subscribe(({ snapshot: s }) => {
		snapshot.value = s;
	});
	onBeforeUnmount(() => {
		unsub();
		controller.destroy();
	});
	const execute = ((...args) => {
		return controller.execute(...args);
	});
	return {
		snapshot,
		execute
	};
}
export { useHeadlessToolbar };
