import { _ as defaultBaseState, f as createBaseState, t as PHDocumentController } from "../../dist-DZj99xX4.js";
import { A as InitializeDerivationInputSchema, C as AddSignalInputSchema, D as DerivationStateSchema, E as DerivationSignalSchema, M as UpdateDimensionRationaleInputSchema, N as definedNonNullAnySchema, O as DimensionRationaleSchema, P as isDefinedNonNullAny, S as AddReseedEntryInputSchema, T as CoherenceCheckSchema, _ as addReseedEntry, a as utils$1, b as initializeDerivation, c as DerivationPHStateSchema, d as isDerivationDocument, f as isDerivationState, g as actions, h as documentModel, i as initialLocalState, j as ReseedEntrySchema, k as FeatureDecisionSchema, l as assertIsDerivationDocument, m as reducer, n as utils, o as DerivationDocumentHeaderSchema, p as derivationDocumentType, r as initialGlobalState, s as DerivationDocumentSchema, t as Derivation, u as assertIsDerivationState, v as addSignal, w as ClaimReferenceSchema, x as updateDimensionRationale, y as creators_exports } from "../../module-sJ_H4Bs3.js";
import { T as useDocumentById, c as useDocumentsInSelectedFolder, g as useSelectedDocument, s as useDocumentsInSelectedDrive } from "../../dist-DAY54QOk.js";
import { n as latestVersion, r as supportedVersions, t as derivationUpgradeManifest } from "../../upgrade-manifest-D6dMoEBI.js";
//#region document-models/derivation/v1/gen/controller.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
const DerivationController = PHDocumentController.forDocumentModel(Derivation);
//#endregion
//#region document-models/derivation/v1/gen/ph-factories.ts
function defaultGlobalState() {
	return {
		engineVersion: null,
		derivedAt: null,
		signals: [],
		dimensionRationale: [],
		claimReferences: [],
		featureDecisions: [],
		coherenceResults: [],
		reseedHistory: []
	};
}
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 DerivationDocument with custom global and local state
* This properly handles the PHBaseState requirements while allowing
* document-specific state to be set.
*/
function createDerivationDocument(state) {
	return utils$1.createDocument(state ? createState(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
}
//#endregion
//#region document-models/derivation/v1/hooks.ts
/** Hook to get a Derivation document by its id */
function useDerivationDocumentById(documentId) {
	const [document, dispatch] = useDocumentById(documentId);
	if (!isDerivationDocument(document)) return [void 0, void 0];
	return [document, dispatch];
}
/** Hook to get the selected Derivation document */
function useSelectedDerivationDocument() {
	const [document, dispatch] = useSelectedDocument();
	assertIsDerivationDocument(document);
	return [document, dispatch];
}
/** Hook to get all Derivation documents in the selected drive */
function useDerivationDocumentsInSelectedDrive() {
	return useDocumentsInSelectedDrive()?.filter(isDerivationDocument);
}
/** Hook to get all Derivation documents in the selected folder */
function useDerivationDocumentsInSelectedFolder() {
	return useDocumentsInSelectedFolder()?.filter(isDerivationDocument);
}
//#endregion
export { AddReseedEntryInputSchema, AddSignalInputSchema, ClaimReferenceSchema, CoherenceCheckSchema, Derivation, DerivationController, DerivationDocumentHeaderSchema, DerivationDocumentSchema, DerivationPHStateSchema, DerivationSignalSchema, DerivationStateSchema, DimensionRationaleSchema, FeatureDecisionSchema, InitializeDerivationInputSchema, ReseedEntrySchema, UpdateDimensionRationaleInputSchema, actions, addReseedEntry, addSignal, assertIsDerivationDocument, assertIsDerivationState, createDerivationDocument, createState, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, creators_exports as derivationDerivationManagementActions, derivationDocumentType, derivationUpgradeManifest, documentModel, initialGlobalState, initialLocalState, initializeDerivation, isDefinedNonNullAny, isDerivationDocument, isDerivationState, latestVersion, reducer, supportedVersions, updateDimensionRationale, useDerivationDocumentById, useDerivationDocumentsInSelectedDrive, useDerivationDocumentsInSelectedFolder, useSelectedDerivationDocument, utils };

//# sourceMappingURL=index.js.map