import e from "react";
//#region node_modules/zustand/esm/vanilla.mjs
var t = (e) => {
	let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
		let i = typeof e == "function" ? e(t) : e;
		if (!Object.is(i, t)) {
			let e = t;
			t = r ?? (typeof i != "object" || !i) ? i : Object.assign({}, t, i), n.forEach((n) => n(t, e));
		}
	}, i = () => t, a = {
		setState: r,
		getState: i,
		getInitialState: () => o,
		subscribe: (e) => (n.add(e), () => n.delete(e))
	}, o = t = e(r, i, a);
	return a;
}, n = ((e) => e ? t(e) : t), r = (e) => e;
function i(t, n = r) {
	let i = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
	return e.useDebugValue(i), i;
}
var a = (e) => {
	let t = n(e), r = (e) => i(t, e);
	return Object.assign(r, t), r;
}, o = ((e) => e ? a(e) : a), s = /* @__PURE__ */ new Map(), c = {}, l = o((e) => ({
	playerState: {
		presence: "preinit",
		progress: {}
	},
	sortedTopics: [],
	datatypes: c,
	subscriptions: [],
	publishersByTopic: s,
	setPlayerState: (t) => e((e) => {
		let n = t.activeData;
		return n ? {
			playerState: t,
			sortedTopics: n.topics === e.sortedTopics ? e.sortedTopics : n.topics,
			datatypes: n.datatypes === e.datatypes ? e.datatypes : n.datatypes,
			publishersByTopic: n.publishersByTopic === e.publishersByTopic ? e.publishersByTopic : n.publishersByTopic
		} : {
			playerState: t,
			sortedTopics: e.sortedTopics.length === 0 ? e.sortedTopics : [],
			datatypes: c,
			publishersByTopic: s
		};
	}),
	setSubscriptions: (t) => e({ subscriptions: t })
}));
//#endregion
//#region src/core/pipeline/useMessagePipeline.ts
function u(e) {
	return l(e);
}
//#endregion
export { l as n, o as r, u as t };
