import { g as defaultBaseState, p as createBaseState, t as PHDocumentController } from "./dist-Dacf6lFH.js";
import { a as utils, d as isVoiceDocument, l as assertIsVoiceDocument, t as Voice } from "./module-C7GnPjtv.js";
import { a as useDocumentsInSelectedDrive, c as useSelectedDocument, i as useDocumentById, o as useDocumentsInSelectedFolder } from "./dist-rER8Mj9l.js";
//#region document-models/voice/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		channelId: null,
		activeParticipants: [],
		maxParticipants: null
	};
}
function defaultLocalState() {
	return {};
}
function defaultPHState() {
	return {
		...defaultBaseState(),
		global: defaultGlobalState(),
		local: defaultLocalState()
	};
}
function createGlobalState(state) {
	return {
		...defaultGlobalState(),
		...state || {}
	};
}
function createLocalState(state) {
	return {
		...defaultLocalState(),
		...state || {}
	};
}
function createState(baseState, globalState, localState) {
	return {
		...createBaseState(baseState?.auth, baseState?.document),
		global: createGlobalState(globalState),
		local: createLocalState(localState)
	};
}
/**
* Creates a VoiceDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createVoiceDocument(state) {
	return utils.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/voice/v1/gen/controller.ts
const VoiceController = PHDocumentController.forDocumentModel(Voice);
//#endregion
//#region document-models/voice/v1/hooks.ts
/** Hook to get a Voice document by its id */
function useVoiceDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isVoiceDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected Voice document */
function useSelectedVoiceDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsVoiceDocument(document);
	return [document, dispatch];
}
/** Hook to get all Voice documents in the selected drive */
function useVoiceDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isVoiceDocument);
}
/** Hook to get all Voice documents in the selected folder */
function useVoiceDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isVoiceDocument);
}
//#endregion
export { VoiceController as a, defaultGlobalState as c, useVoiceDocumentsInSelectedFolder as i, defaultLocalState as l, useVoiceDocumentById as n, createState as o, useVoiceDocumentsInSelectedDrive as r, createVoiceDocument as s, useSelectedVoiceDocument as t, defaultPHState as u };

//# sourceMappingURL=voice-CChVzqwg.js.map