const require_rolldown_runtime = require("./rolldown-runtime-C34Jxks9.cjs");
const require_create_headless_toolbar = require("./create-headless-toolbar-BUr9TmNG.cjs");
let vue = require("vue");
var EMPTY_SNAPSHOT = {
	context: null,
	commands: {}
};
function useHeadlessToolbar(superdoc, commands) {
	if (!superdoc) return {
		snapshot: (0, vue.shallowRef)(EMPTY_SNAPSHOT),
		execute: () => false
	};
	const controller = require_create_headless_toolbar.createHeadlessToolbar({
		superdoc,
		commands
	});
	const snapshot = (0, vue.shallowRef)(controller.getSnapshot());
	const unsub = controller.subscribe(({ snapshot: s }) => {
		snapshot.value = s;
	});
	(0, vue.onBeforeUnmount)(() => {
		unsub();
		controller.destroy();
	});
	const execute = ((...args) => {
		return controller.execute(...args);
	});
	return {
		snapshot,
		execute
	};
}
Object.defineProperty(exports, "useHeadlessToolbar", {
	enumerable: true,
	get: function() {
		return useHeadlessToolbar;
	}
});
