import { n as __exportAll } from "./chunk-YKewjYmz.js";
import { A as array, F as object, I as string, M as lazy, N as literal, O as _enum, P as number, R as datetime, _ as defaultBaseState, a as BaseDocumentStateSchema, c as baseLoadFromInput, d as createAction, h as createState, i as BaseDocumentHeaderSchema, k as any, l as baseSaveToFileHandle, m as createReducer, o as baseActions, s as baseCreateDocument, y as isDocumentAction, z as generateId } from "./dist-DZj99xX4.js";
//#region document-models/knowledge-note/v1/gen/schema/zod.ts
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
const definedNonNullAnySchema = any().refine((v) => isDefinedNonNullAny(v));
const LinkTypeSchema = _enum([
	"BUILDS_ON",
	"CONTRADICTS",
	"DERIVED_FROM",
	"RELATES_TO",
	"SUPERSEDES"
]);
const NoteStatusSchema = _enum([
	"ARCHIVED",
	"CANONICAL",
	"DRAFT",
	"IN_REVIEW"
]);
const SourceOriginSchema = _enum([
	"DERIVED",
	"IMPORT",
	"MANUAL",
	"SESSION_MINE"
]);
function AddLinkInputSchema() {
	return object({
		id: string(),
		linkType: LinkTypeSchema,
		targetDocumentId: string(),
		targetTitle: string().nullish()
	});
}
function AddTopicInputSchema() {
	return object({
		id: string(),
		name: string(),
		topicDocumentId: string().nullish()
	});
}
function ApproveNoteInputSchema() {
	return object({
		actor: string(),
		comment: string().nullish(),
		id: string(),
		timestamp: datetime()
	});
}
function ArchiveNoteInputSchema() {
	return object({
		actor: string(),
		comment: string(),
		id: string(),
		timestamp: datetime()
	});
}
function KnowledgeNoteLocalStateSchema() {
	return object({
		__typename: literal("KnowledgeNoteLocalState").optional(),
		lastViewedAt: datetime().nullish(),
		personalTags: array(lazy(() => PersonalTagSchema()))
	});
}
function KnowledgeNoteStateSchema() {
	return object({
		__typename: literal("KnowledgeNoteState").optional(),
		alternatives: array(string()),
		cardinality: string().nullish(),
		computes: string().nullish(),
		confidence: string().nullish(),
		consequences: array(string()),
		consumedBy: array(string()),
		content: string().nullish(),
		context: string().nullish(),
		correctPattern: string().nullish(),
		decisionStatus: string().nullish(),
		description: string().nullish(),
		dispatchTargets: array(string()),
		editor: string().nullish(),
		errorMessage: string().nullish(),
		filePath: string().nullish(),
		hooksUsed: array(string()),
		inputs: array(string()),
		lifecycleEvents: array(lazy(() => LifecycleEventSchema())),
		links: array(lazy(() => NoteLinkSchema())),
		model: string().nullish(),
		modelId: string().nullish(),
		models: array(string()),
		modules: array(string()),
		noteType: string().nullish(),
		outputs: array(string()),
		provenance: lazy(() => ProvenanceSchema().nullish()),
		relationType: string().nullish(),
		rootCause: string().nullish(),
		scope: string().nullish(),
		severity: string().nullish(),
		sourceType: string().nullish(),
		status: NoteStatusSchema.nullish(),
		targetType: string().nullish(),
		title: string().nullish(),
		topics: array(lazy(() => TopicSchema())),
		version: string().nullish()
	});
}
function LifecycleEventSchema() {
	return object({
		__typename: literal("LifecycleEvent").optional(),
		actor: string().nullish(),
		comment: string().nullish(),
		fromStatus: NoteStatusSchema.nullish(),
		id: string(),
		timestamp: datetime().nullish(),
		toStatus: NoteStatusSchema.nullish()
	});
}
function NoteLinkSchema() {
	return object({
		__typename: literal("NoteLink").optional(),
		id: string(),
		linkType: LinkTypeSchema.nullish(),
		targetDocumentId: string().nullish(),
		targetTitle: string().nullish()
	});
}
function PatchContentInputSchema() {
	return object({
		insert: string(),
		offset: number(),
		removeCount: number(),
		updatedAt: datetime()
	});
}
function PersonalTagSchema() {
	return object({
		__typename: literal("PersonalTag").optional(),
		id: string(),
		name: string()
	});
}
function ProvenanceSchema() {
	return object({
		__typename: literal("Provenance").optional(),
		author: string().nullish(),
		createdAt: datetime().nullish(),
		sessionId: string().nullish(),
		sourceOrigin: SourceOriginSchema.nullish(),
		updatedAt: datetime().nullish()
	});
}
function RejectNoteInputSchema() {
	return object({
		actor: string(),
		comment: string(),
		id: string(),
		timestamp: datetime()
	});
}
function RemoveLinkInputSchema() {
	return object({ id: string() });
}
function RemoveTopicInputSchema() {
	return object({ id: string() });
}
function RestoreNoteInputSchema() {
	return object({
		actor: string(),
		comment: string().nullish(),
		id: string(),
		timestamp: datetime()
	});
}
function SetContentInputSchema() {
	return object({
		content: string(),
		updatedAt: datetime()
	});
}
function SetDescriptionInputSchema() {
	return object({
		description: string(),
		updatedAt: datetime()
	});
}
function SetLastViewedInputSchema() {
	return object({ lastViewedAt: datetime() });
}
function SetMetadataFieldInputSchema() {
	return object({
		field: string(),
		updatedAt: datetime(),
		value: string().nullish()
	});
}
function SetMetadataListFieldInputSchema() {
	return object({
		field: string(),
		updatedAt: datetime(),
		values: array(string())
	});
}
function SetNoteTypeInputSchema() {
	return object({
		noteType: string(),
		updatedAt: datetime()
	});
}
function SetProvenanceInputSchema() {
	return object({
		author: string(),
		createdAt: datetime(),
		sessionId: string().nullish(),
		sourceOrigin: SourceOriginSchema
	});
}
function SetTitleInputSchema() {
	return object({
		title: string(),
		updatedAt: datetime()
	});
}
function SubmitForReviewInputSchema() {
	return object({
		actor: string(),
		comment: string().nullish(),
		id: string(),
		timestamp: datetime()
	});
}
function TopicSchema() {
	return object({
		__typename: literal("Topic").optional(),
		id: string(),
		name: string(),
		topicDocumentId: string().nullish()
	});
}
function UpdateLinkTypeInputSchema() {
	return object({
		id: string(),
		linkType: LinkTypeSchema
	});
}
//#endregion
//#region document-models/knowledge-note/v1/gen/content/creators.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
var creators_exports$4 = /* @__PURE__ */ __exportAll({
	patchContent: () => patchContent,
	setContent: () => setContent,
	setDescription: () => setDescription,
	setMetadataField: () => setMetadataField,
	setMetadataListField: () => setMetadataListField,
	setNoteType: () => setNoteType,
	setTitle: () => setTitle
});
const setTitle = (input) => createAction("SET_TITLE", { ...input }, void 0, SetTitleInputSchema, "global");
const setDescription = (input) => createAction("SET_DESCRIPTION", { ...input }, void 0, SetDescriptionInputSchema, "global");
const setNoteType = (input) => createAction("SET_NOTE_TYPE", { ...input }, void 0, SetNoteTypeInputSchema, "global");
const setContent = (input) => createAction("SET_CONTENT", { ...input }, void 0, SetContentInputSchema, "global");
const patchContent = (input) => createAction("PATCH_CONTENT", { ...input }, void 0, PatchContentInputSchema, "global");
const setMetadataField = (input) => createAction("SET_METADATA_FIELD", { ...input }, void 0, SetMetadataFieldInputSchema, "global");
const setMetadataListField = (input) => createAction("SET_METADATA_LIST_FIELD", { ...input }, void 0, SetMetadataListFieldInputSchema, "global");
//#endregion
//#region document-models/knowledge-note/v1/gen/lifecycle/creators.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
var creators_exports$3 = /* @__PURE__ */ __exportAll({
	approveNote: () => approveNote,
	archiveNote: () => archiveNote,
	rejectNote: () => rejectNote,
	restoreNote: () => restoreNote,
	submitForReview: () => submitForReview
});
const submitForReview = (input) => createAction("SUBMIT_FOR_REVIEW", { ...input }, void 0, SubmitForReviewInputSchema, "global");
const approveNote = (input) => createAction("APPROVE_NOTE", { ...input }, void 0, ApproveNoteInputSchema, "global");
const rejectNote = (input) => createAction("REJECT_NOTE", { ...input }, void 0, RejectNoteInputSchema, "global");
const archiveNote = (input) => createAction("ARCHIVE_NOTE", { ...input }, void 0, ArchiveNoteInputSchema, "global");
const restoreNote = (input) => createAction("RESTORE_NOTE", { ...input }, void 0, RestoreNoteInputSchema, "global");
//#endregion
//#region document-models/knowledge-note/v1/gen/linking/creators.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
var creators_exports$2 = /* @__PURE__ */ __exportAll({
	addLink: () => addLink,
	addTopic: () => addTopic,
	removeLink: () => removeLink,
	removeTopic: () => removeTopic,
	updateLinkType: () => updateLinkType
});
const addLink = (input) => createAction("ADD_LINK", { ...input }, void 0, AddLinkInputSchema, "global");
const removeLink = (input) => createAction("REMOVE_LINK", { ...input }, void 0, RemoveLinkInputSchema, "global");
const updateLinkType = (input) => createAction("UPDATE_LINK_TYPE", { ...input }, void 0, UpdateLinkTypeInputSchema, "global");
const addTopic = (input) => createAction("ADD_TOPIC", { ...input }, void 0, AddTopicInputSchema, "global");
const removeTopic = (input) => createAction("REMOVE_TOPIC", { ...input }, void 0, RemoveTopicInputSchema, "global");
//#endregion
//#region document-models/knowledge-note/v1/gen/local/creators.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
var creators_exports$1 = /* @__PURE__ */ __exportAll({ setLastViewed: () => setLastViewed });
const setLastViewed = (input) => createAction("SET_LAST_VIEWED", { ...input }, void 0, SetLastViewedInputSchema, "local");
//#endregion
//#region document-models/knowledge-note/v1/gen/provenance/creators.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
var creators_exports = /* @__PURE__ */ __exportAll({ setProvenance: () => setProvenance });
const setProvenance = (input) => createAction("SET_PROVENANCE", { ...input }, void 0, SetProvenanceInputSchema, "global");
//#endregion
//#region document-models/knowledge-note/v1/actions.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
/** Actions for the KnowledgeNote document model */
const actions = {
	...baseActions,
	...creators_exports$4,
	...creators_exports,
	...creators_exports$2,
	...creators_exports$3,
	...creators_exports$1
};
//#endregion
//#region document-models/knowledge-note/v1/gen/document-model.ts
const documentModel = {
	author: {
		name: "BAI",
		website: "https://bai.powerhouse.io/"
	},
	description: "Atomic knowledge note — the building block of team-wide institutional memory. Notes have typed content, structured links, lifecycle states, and provenance tracking.",
	extension: "",
	id: "bai/knowledge-note",
	name: "KnowledgeNote",
	specifications: [{
		changeLog: [],
		modules: [
			{
				description: "Core note editing",
				id: "content-module",
				name: "content",
				operations: [
					{
						description: "Set the note title",
						errors: [],
						examples: [],
						id: "set-title",
						name: "SET_TITLE",
						reducer: "state.title = action.input.title;\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.updatedAt;\n}",
						schema: "input SetTitleInput {\n    title: String!\n    updatedAt: DateTime!\n}",
						template: "Set the note title",
						scope: "global"
					},
					{
						description: "Set the note description (max 200 chars)",
						errors: [{
							code: "DESCRIPTION_TOO_LONG",
							description: "Description exceeds 200 characters",
							id: "err-description-too-long",
							name: "DescriptionTooLongError",
							template: ""
						}],
						examples: [],
						id: "set-description",
						name: "SET_DESCRIPTION",
						reducer: "if (action.input.description.length > 200) {\n    throw new DescriptionTooLongError(\"Description exceeds 200 characters\");\n}\nstate.description = action.input.description;\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.updatedAt;\n}",
						schema: "input SetDescriptionInput {\n    description: String!\n    updatedAt: DateTime!\n}",
						template: "Set the note description (max 200 chars)",
						scope: "global"
					},
					{
						description: "Set or change the note type",
						errors: [],
						examples: [],
						id: "set-note-type",
						name: "SET_NOTE_TYPE",
						reducer: "state.noteType = action.input.noteType;\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.updatedAt;\n}",
						schema: "input SetNoteTypeInput {\n    noteType: String!\n    updatedAt: DateTime!\n}",
						template: "Set or change the note type",
						scope: "global"
					},
					{
						description: "Replace the markdown content body",
						errors: [],
						examples: [],
						id: "set-content",
						name: "SET_CONTENT",
						reducer: "state.content = action.input.content;\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.updatedAt;\n}",
						schema: "input SetContentInput {\n    content: String!\n    updatedAt: DateTime!\n}",
						template: "Replace the markdown content body",
						scope: "global"
					},
					{
						description: "Surgical edit to content",
						errors: [{
							code: "PATCH_OUT_OF_BOUNDS",
							description: "Offset + removeCount exceeds content length",
							id: "err-patch-out-of-bounds",
							name: "PatchOutOfBoundsError",
							template: ""
						}],
						examples: [],
						id: "patch-content",
						name: "PATCH_CONTENT",
						reducer: "const content = state.content || \"\";\nconst { offset, removeCount, insert } = action.input;\nif (offset < 0 || offset + removeCount > content.length) {\n    throw new PatchOutOfBoundsError(\"Offset + removeCount exceeds content length\");\n}\nstate.content = content.slice(0, offset) + insert + content.slice(offset + removeCount);\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.updatedAt;\n}",
						schema: "input PatchContentInput {\n    offset: Int!\n    removeCount: Int!\n    insert: String!\n    updatedAt: DateTime!\n}",
						template: "Surgical edit to content",
						scope: "global"
					},
					{
						description: "Set any string metadata field by name",
						errors: [{
							code: "INVALID_METADATA_FIELD",
							description: "Field name is not a recognized string metadata field",
							id: "err-invalid-metadata-field",
							name: "InvalidMetadataFieldError",
							template: ""
						}],
						examples: [],
						id: "set-metadata-field",
						name: "SET_METADATA_FIELD",
						reducer: "const STRING_METADATA_FIELDS = [\n    \"scope\", \"confidence\", \"severity\", \"editor\", \"modelId\", \"version\",\n    \"filePath\", \"computes\", \"context\", \"decisionStatus\", \"model\",\n    \"sourceType\", \"targetType\", \"relationType\", \"cardinality\",\n    \"errorMessage\", \"rootCause\", \"correctPattern\"\n];\nconst { field, value } = action.input;\nif (!STRING_METADATA_FIELDS.includes(field)) {\n    throw new InvalidMetadataFieldError(`\"${field}\" is not a recognized string metadata field`);\n}\n(state as any)[field] = value || null;\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.updatedAt;\n}",
						schema: "input SetMetadataFieldInput {\n    field: String!\n    value: String\n    updatedAt: DateTime!\n}",
						template: "Set any string metadata field by name",
						scope: "global"
					},
					{
						description: "Set any string-array metadata field by name",
						errors: [{
							code: "INVALID_METADATA_LIST_FIELD",
							description: "Field name is not a recognized list metadata field",
							id: "err-invalid-metadata-list-field",
							name: "InvalidMetadataListFieldError",
							template: ""
						}],
						examples: [],
						id: "set-metadata-list-field",
						name: "SET_METADATA_LIST_FIELD",
						reducer: "const LIST_METADATA_FIELDS = [\n    \"models\", \"hooksUsed\", \"dispatchTargets\", \"modules\", \"inputs\",\n    \"outputs\", \"consumedBy\", \"alternatives\", \"consequences\"\n];\nconst { field, values } = action.input;\nif (!LIST_METADATA_FIELDS.includes(field)) {\n    throw new InvalidMetadataListFieldError(`\"${field}\" is not a recognized list metadata field`);\n}\n(state as any)[field] = values;\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.updatedAt;\n}",
						schema: "input SetMetadataListFieldInput {\n    field: String!\n    values: [String!]!\n    updatedAt: DateTime!\n}",
						template: "Set any string-array metadata field by name",
						scope: "global"
					}
				]
			},
			{
				description: "Source tracking",
				id: "provenance-module",
				name: "provenance",
				operations: [{
					description: "Record author, source origin, session ID, and creation timestamp",
					errors: [],
					examples: [],
					id: "set-provenance",
					name: "SET_PROVENANCE",
					reducer: "state.provenance = {\n    author: action.input.author,\n    sourceOrigin: action.input.sourceOrigin,\n    sessionId: action.input.sessionId || null,\n    createdAt: action.input.createdAt,\n    updatedAt: action.input.createdAt,\n};",
					schema: "input SetProvenanceInput {\n    author: String!\n    sourceOrigin: SourceOrigin!\n    sessionId: String\n    createdAt: DateTime!\n}",
					template: "Record author, source origin, session ID, and creation timestamp",
					scope: "global"
				}]
			},
			{
				description: "Knowledge graph edges",
				id: "linking-module",
				name: "linking",
				operations: [
					{
						description: "Create a typed link to another note",
						errors: [{
							code: "DUPLICATE_LINK_ID",
							description: "A link with this OID already exists",
							id: "err-duplicate-link-id",
							name: "DuplicateLinkIdError",
							template: ""
						}],
						examples: [],
						id: "add-link",
						name: "ADD_LINK",
						reducer: "const existing = state.links.find(l => l.id === action.input.id);\nif (existing) {\n    throw new DuplicateLinkIdError(\"A link with this OID already exists\");\n}\nstate.links.push({\n    id: action.input.id,\n    targetDocumentId: action.input.targetDocumentId,\n    targetTitle: action.input.targetTitle || null,\n    linkType: action.input.linkType,\n});",
						schema: "input AddLinkInput {\n    id: OID!\n    targetDocumentId: String!\n    targetTitle: String\n    linkType: LinkType!\n}",
						template: "Create a typed link to another note",
						scope: "global"
					},
					{
						description: "Remove a link by ID",
						errors: [{
							code: "LINK_NOT_FOUND",
							description: "No link with this OID",
							id: "err-link-not-found-remove",
							name: "LinkNotFoundError",
							template: ""
						}],
						examples: [],
						id: "remove-link",
						name: "REMOVE_LINK",
						reducer: "const index = state.links.findIndex(l => l.id === action.input.id);\nif (index === -1) {\n    throw new LinkNotFoundError(\"No link with this OID\");\n}\nstate.links.splice(index, 1);",
						schema: "input RemoveLinkInput {\n    id: OID!\n}",
						template: "Remove a link by ID",
						scope: "global"
					},
					{
						description: "Change a link's type",
						errors: [{
							code: "LINK_NOT_FOUND",
							description: "No link with this OID",
							id: "err-link-not-found-update",
							name: "LinkNotFoundError",
							template: ""
						}],
						examples: [],
						id: "update-link-type",
						name: "UPDATE_LINK_TYPE",
						reducer: "const link = state.links.find(l => l.id === action.input.id);\nif (!link) {\n    throw new LinkNotFoundError(\"No link with this OID\");\n}\nlink.linkType = action.input.linkType;",
						schema: "input UpdateLinkTypeInput {\n    id: OID!\n    linkType: LinkType!\n}",
						template: "Change a link's type",
						scope: "global"
					},
					{
						description: "Tag the note with a topic",
						errors: [{
							code: "DUPLICATE_TOPIC",
							description: "A topic with this name already exists on this note",
							id: "err-duplicate-topic",
							name: "DuplicateTopicError",
							template: ""
						}],
						examples: [],
						id: "add-topic",
						name: "ADD_TOPIC",
						reducer: "const duplicate = state.topics.find(t => t.name === action.input.name);\nif (duplicate) {\n    throw new DuplicateTopicError(\"A topic with this name already exists on this note\");\n}\nstate.topics.push({\n    id: action.input.id,\n    name: action.input.name,\n    topicDocumentId: action.input.topicDocumentId || null,\n});",
						schema: "input AddTopicInput {\n    id: OID!\n    name: String!\n    topicDocumentId: String\n}",
						template: "Tag the note with a topic",
						scope: "global"
					},
					{
						description: "Remove a topic tag by ID",
						errors: [{
							code: "TOPIC_NOT_FOUND",
							description: "No topic with this OID",
							id: "err-topic-not-found",
							name: "TopicNotFoundError",
							template: ""
						}],
						examples: [],
						id: "remove-topic",
						name: "REMOVE_TOPIC",
						reducer: "const index = state.topics.findIndex(t => t.id === action.input.id);\nif (index === -1) {\n    throw new TopicNotFoundError(\"No topic with this OID\");\n}\nstate.topics.splice(index, 1);",
						schema: "input RemoveTopicInput {\n    id: OID!\n}",
						template: "Remove a topic tag by ID",
						scope: "global"
					}
				]
			},
			{
				description: "Status transitions with audit trail",
				id: "lifecycle-module",
				name: "lifecycle",
				operations: [
					{
						description: "Transition DRAFT → IN_REVIEW",
						errors: [{
							code: "INVALID_STATUS_TRANSITION",
							description: "Current status doesn't allow this transition",
							id: "err-invalid-transition-submit",
							name: "InvalidStatusTransitionError",
							template: ""
						}],
						examples: [],
						id: "submit-for-review",
						name: "SUBMIT_FOR_REVIEW",
						reducer: "if (state.status !== \"DRAFT\") {\n    throw new InvalidStatusTransitionError(\"Can only submit for review from DRAFT status\");\n}\nstate.status = \"IN_REVIEW\";\nstate.lifecycleEvents.push({\n    id: action.input.id,\n    fromStatus: \"DRAFT\",\n    toStatus: \"IN_REVIEW\",\n    actor: action.input.actor,\n    timestamp: action.input.timestamp,\n    comment: action.input.comment || null,\n});\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.timestamp;\n}",
						schema: "input SubmitForReviewInput {\n    id: OID!\n    actor: String!\n    timestamp: DateTime!\n    comment: String\n}",
						template: "Transition DRAFT → IN_REVIEW",
						scope: "global"
					},
					{
						description: "Transition IN_REVIEW → CANONICAL (actor ≠ author)",
						errors: [{
							code: "INVALID_STATUS_TRANSITION",
							description: "Current status doesn't allow this transition",
							id: "err-invalid-transition-approve",
							name: "InvalidStatusTransitionError",
							template: ""
						}, {
							code: "SELF_APPROVAL",
							description: "Actor cannot approve their own note",
							id: "err-self-approval",
							name: "SelfApprovalError",
							template: ""
						}],
						examples: [],
						id: "approve-note",
						name: "APPROVE_NOTE",
						reducer: "if (state.status !== \"IN_REVIEW\") {\n    throw new InvalidStatusTransitionError(\"Can only approve from IN_REVIEW status\");\n}\nif (state.provenance && state.provenance.author === action.input.actor) {\n    throw new SelfApprovalError(\"Actor cannot approve their own note\");\n}\nstate.status = \"CANONICAL\";\nstate.lifecycleEvents.push({\n    id: action.input.id,\n    fromStatus: \"IN_REVIEW\",\n    toStatus: \"CANONICAL\",\n    actor: action.input.actor,\n    timestamp: action.input.timestamp,\n    comment: action.input.comment || null,\n});\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.timestamp;\n}",
						schema: "input ApproveNoteInput {\n    id: OID!\n    actor: String!\n    timestamp: DateTime!\n    comment: String\n}",
						template: "Transition IN_REVIEW → CANONICAL (actor ≠ author)",
						scope: "global"
					},
					{
						description: "Transition IN_REVIEW → DRAFT with feedback",
						errors: [{
							code: "INVALID_STATUS_TRANSITION",
							description: "Current status doesn't allow this transition",
							id: "err-invalid-transition-reject",
							name: "InvalidStatusTransitionError",
							template: ""
						}],
						examples: [],
						id: "reject-note",
						name: "REJECT_NOTE",
						reducer: "if (state.status !== \"IN_REVIEW\") {\n    throw new InvalidStatusTransitionError(\"Can only reject from IN_REVIEW status\");\n}\nstate.status = \"DRAFT\";\nstate.lifecycleEvents.push({\n    id: action.input.id,\n    fromStatus: \"IN_REVIEW\",\n    toStatus: \"DRAFT\",\n    actor: action.input.actor,\n    timestamp: action.input.timestamp,\n    comment: action.input.comment,\n});\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.timestamp;\n}",
						schema: "input RejectNoteInput {\n    id: OID!\n    actor: String!\n    timestamp: DateTime!\n    comment: String!\n}",
						template: "Transition IN_REVIEW → DRAFT with feedback",
						scope: "global"
					},
					{
						description: "Transition CANONICAL → ARCHIVED",
						errors: [{
							code: "INVALID_STATUS_TRANSITION",
							description: "Current status doesn't allow this transition",
							id: "err-invalid-transition-archive",
							name: "InvalidStatusTransitionError",
							template: ""
						}],
						examples: [],
						id: "archive-note",
						name: "ARCHIVE_NOTE",
						reducer: "if (state.status !== \"CANONICAL\") {\n    throw new InvalidStatusTransitionError(\"Can only archive from CANONICAL status\");\n}\nstate.status = \"ARCHIVED\";\nstate.lifecycleEvents.push({\n    id: action.input.id,\n    fromStatus: \"CANONICAL\",\n    toStatus: \"ARCHIVED\",\n    actor: action.input.actor,\n    timestamp: action.input.timestamp,\n    comment: action.input.comment,\n});\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.timestamp;\n}",
						schema: "input ArchiveNoteInput {\n    id: OID!\n    actor: String!\n    timestamp: DateTime!\n    comment: String!\n}",
						template: "Transition CANONICAL → ARCHIVED",
						scope: "global"
					},
					{
						description: "Transition ARCHIVED → DRAFT",
						errors: [{
							code: "INVALID_STATUS_TRANSITION",
							description: "Current status doesn't allow this transition",
							id: "err-invalid-transition-restore",
							name: "InvalidStatusTransitionError",
							template: ""
						}],
						examples: [],
						id: "restore-note",
						name: "RESTORE_NOTE",
						reducer: "if (state.status !== \"ARCHIVED\") {\n    throw new InvalidStatusTransitionError(\"Can only restore from ARCHIVED status\");\n}\nstate.status = \"DRAFT\";\nstate.lifecycleEvents.push({\n    id: action.input.id,\n    fromStatus: \"ARCHIVED\",\n    toStatus: \"DRAFT\",\n    actor: action.input.actor,\n    timestamp: action.input.timestamp,\n    comment: action.input.comment || null,\n});\nif (state.provenance) {\n    state.provenance.updatedAt = action.input.timestamp;\n}",
						schema: "input RestoreNoteInput {\n    id: OID!\n    actor: String!\n    timestamp: DateTime!\n    comment: String\n}",
						template: "Transition ARCHIVED → DRAFT",
						scope: "global"
					}
				]
			},
			{
				description: "Per-user local state",
				id: "local-module",
				name: "local",
				operations: [{
					description: "Update the local lastViewedAt timestamp",
					errors: [],
					examples: [],
					id: "set-last-viewed",
					name: "SET_LAST_VIEWED",
					reducer: "state.lastViewedAt = action.input.lastViewedAt;",
					schema: "input SetLastViewedInput {\n    lastViewedAt: DateTime!\n}",
					template: "Update the local lastViewedAt timestamp",
					scope: "local"
				}]
			}
		],
		state: {
			global: {
				examples: [],
				initialValue: "{\n    \"title\": null,\n    \"description\": null,\n    \"noteType\": null,\n    \"content\": null,\n    \"status\": \"DRAFT\",\n    \"provenance\": null,\n    \"links\": [],\n    \"topics\": [],\n    \"scope\": null,\n    \"confidence\": null,\n    \"severity\": null,\n    \"editor\": null,\n    \"models\": [],\n    \"hooksUsed\": [],\n    \"dispatchTargets\": [],\n    \"modelId\": null,\n    \"modules\": [],\n    \"version\": null,\n    \"filePath\": null,\n    \"computes\": null,\n    \"inputs\": [],\n    \"outputs\": [],\n    \"consumedBy\": [],\n    \"context\": null,\n    \"alternatives\": [],\n    \"consequences\": [],\n    \"decisionStatus\": null,\n    \"model\": null,\n    \"sourceType\": null,\n    \"targetType\": null,\n    \"relationType\": null,\n    \"cardinality\": null,\n    \"errorMessage\": null,\n    \"rootCause\": null,\n    \"correctPattern\": null,\n    \"lifecycleEvents\": []\n}",
				schema: "enum NoteStatus {\n    DRAFT\n    IN_REVIEW\n    CANONICAL\n    ARCHIVED\n}\n\nenum SourceOrigin {\n    MANUAL\n    SESSION_MINE\n    IMPORT\n    DERIVED\n}\n\nenum LinkType {\n    RELATES_TO\n    BUILDS_ON\n    CONTRADICTS\n    SUPERSEDES\n    DERIVED_FROM\n}\n\ntype KnowledgeNoteState {\n    title: String\n    description: String\n    noteType: String\n    content: String\n    status: NoteStatus\n    provenance: Provenance\n    links: [NoteLink!]!\n    topics: [Topic!]!\n    scope: String\n    confidence: String\n    severity: String\n    editor: String\n    models: [String!]!\n    hooksUsed: [String!]!\n    dispatchTargets: [String!]!\n    modelId: String\n    modules: [String!]!\n    version: String\n    filePath: String\n    computes: String\n    inputs: [String!]!\n    outputs: [String!]!\n    consumedBy: [String!]!\n    context: String\n    alternatives: [String!]!\n    consequences: [String!]!\n    decisionStatus: String\n    model: String\n    sourceType: String\n    targetType: String\n    relationType: String\n    cardinality: String\n    errorMessage: String\n    rootCause: String\n    correctPattern: String\n    lifecycleEvents: [LifecycleEvent!]!\n}\n\ntype Provenance {\n    author: String\n    sourceOrigin: SourceOrigin\n    sessionId: String\n    createdAt: DateTime\n    updatedAt: DateTime\n}\n\ntype NoteLink {\n    id: OID!\n    targetDocumentId: String\n    targetTitle: String\n    linkType: LinkType\n}\n\ntype Topic {\n    id: OID!\n    name: String!\n    topicDocumentId: String\n}\n\ntype LifecycleEvent {\n    id: OID!\n    fromStatus: NoteStatus\n    toStatus: NoteStatus\n    actor: String\n    timestamp: DateTime\n    comment: String\n}"
			},
			local: {
				examples: [],
				initialValue: "{\n    \"lastViewedAt\": null,\n    \"personalTags\": []\n}",
				schema: "type KnowledgeNoteLocalState {\n    lastViewedAt: DateTime\n    personalTags: [PersonalTag!]!\n}\n\ntype PersonalTag {\n    id: OID!\n    name: String!\n}"
			}
		},
		version: 1
	}]
};
//#endregion
//#region document-models/knowledge-note/v1/gen/content/error.ts
var DescriptionTooLongError = class extends Error {
	errorCode = "DescriptionTooLongError";
	constructor(message = "DescriptionTooLongError") {
		super(message);
	}
};
var PatchOutOfBoundsError = class extends Error {
	errorCode = "PatchOutOfBoundsError";
	constructor(message = "PatchOutOfBoundsError") {
		super(message);
	}
};
var InvalidMetadataFieldError = class extends Error {
	errorCode = "InvalidMetadataFieldError";
	constructor(message = "InvalidMetadataFieldError") {
		super(message);
	}
};
var InvalidMetadataListFieldError = class extends Error {
	errorCode = "InvalidMetadataListFieldError";
	constructor(message = "InvalidMetadataListFieldError") {
		super(message);
	}
};
//#endregion
//#region document-models/knowledge-note/v1/src/reducers/content.ts
const knowledgeNoteContentOperations = {
	setTitleOperation(state, action) {
		state.title = action.input.title;
		if (state.provenance) state.provenance.updatedAt = action.input.updatedAt;
	},
	setDescriptionOperation(state, action) {
		if (action.input.description.length > 200) throw new DescriptionTooLongError("Description exceeds 200 characters");
		state.description = action.input.description;
		if (state.provenance) state.provenance.updatedAt = action.input.updatedAt;
	},
	setNoteTypeOperation(state, action) {
		state.noteType = action.input.noteType;
		if (state.provenance) state.provenance.updatedAt = action.input.updatedAt;
	},
	setContentOperation(state, action) {
		state.content = action.input.content;
		if (state.provenance) state.provenance.updatedAt = action.input.updatedAt;
	},
	patchContentOperation(state, action) {
		const content = state.content || "";
		const { offset, removeCount, insert } = action.input;
		if (offset < 0 || offset + removeCount > content.length) throw new PatchOutOfBoundsError("Offset + removeCount exceeds content length");
		state.content = content.slice(0, offset) + insert + content.slice(offset + removeCount);
		if (state.provenance) state.provenance.updatedAt = action.input.updatedAt;
	},
	setMetadataFieldOperation(state, action) {
		const STRING_METADATA_FIELDS = [
			"scope",
			"confidence",
			"severity",
			"editor",
			"modelId",
			"version",
			"filePath",
			"computes",
			"context",
			"decisionStatus",
			"model",
			"sourceType",
			"targetType",
			"relationType",
			"cardinality",
			"errorMessage",
			"rootCause",
			"correctPattern"
		];
		const { field, value } = action.input;
		if (!STRING_METADATA_FIELDS.includes(field)) throw new InvalidMetadataFieldError(`"${field}" is not a recognized string metadata field`);
		state[field] = value || null;
		if (state.provenance) state.provenance.updatedAt = action.input.updatedAt;
	},
	setMetadataListFieldOperation(state, action) {
		const LIST_METADATA_FIELDS = [
			"models",
			"hooksUsed",
			"dispatchTargets",
			"modules",
			"inputs",
			"outputs",
			"consumedBy",
			"alternatives",
			"consequences"
		];
		const { field, values } = action.input;
		if (!LIST_METADATA_FIELDS.includes(field)) throw new InvalidMetadataListFieldError(`"${field}" is not a recognized list metadata field`);
		state[field] = values;
		if (state.provenance) state.provenance.updatedAt = action.input.updatedAt;
	}
};
//#endregion
//#region document-models/knowledge-note/v1/gen/lifecycle/error.ts
var InvalidStatusTransitionError = class extends Error {
	errorCode = "InvalidStatusTransitionError";
	constructor(message = "InvalidStatusTransitionError") {
		super(message);
	}
};
var SelfApprovalError = class extends Error {
	errorCode = "SelfApprovalError";
	constructor(message = "SelfApprovalError") {
		super(message);
	}
};
//#endregion
//#region document-models/knowledge-note/v1/src/reducers/lifecycle.ts
const knowledgeNoteLifecycleOperations = {
	submitForReviewOperation(state, action) {
		if (state.status !== "DRAFT") throw new InvalidStatusTransitionError("Can only submit for review from DRAFT status");
		state.status = "IN_REVIEW";
		state.lifecycleEvents.push({
			id: action.input.id,
			fromStatus: "DRAFT",
			toStatus: "IN_REVIEW",
			actor: action.input.actor,
			timestamp: action.input.timestamp,
			comment: action.input.comment || null
		});
		if (state.provenance) state.provenance.updatedAt = action.input.timestamp;
	},
	approveNoteOperation(state, action) {
		if (state.status !== "IN_REVIEW") throw new InvalidStatusTransitionError("Can only approve from IN_REVIEW status");
		if (state.provenance && state.provenance.author === action.input.actor) throw new SelfApprovalError("Actor cannot approve their own note");
		state.status = "CANONICAL";
		state.lifecycleEvents.push({
			id: action.input.id,
			fromStatus: "IN_REVIEW",
			toStatus: "CANONICAL",
			actor: action.input.actor,
			timestamp: action.input.timestamp,
			comment: action.input.comment || null
		});
		if (state.provenance) state.provenance.updatedAt = action.input.timestamp;
	},
	rejectNoteOperation(state, action) {
		if (state.status !== "IN_REVIEW") throw new InvalidStatusTransitionError("Can only reject from IN_REVIEW status");
		state.status = "DRAFT";
		state.lifecycleEvents.push({
			id: action.input.id,
			fromStatus: "IN_REVIEW",
			toStatus: "DRAFT",
			actor: action.input.actor,
			timestamp: action.input.timestamp,
			comment: action.input.comment
		});
		if (state.provenance) state.provenance.updatedAt = action.input.timestamp;
	},
	archiveNoteOperation(state, action) {
		if (state.status !== "CANONICAL") throw new InvalidStatusTransitionError("Can only archive from CANONICAL status");
		state.status = "ARCHIVED";
		state.lifecycleEvents.push({
			id: action.input.id,
			fromStatus: "CANONICAL",
			toStatus: "ARCHIVED",
			actor: action.input.actor,
			timestamp: action.input.timestamp,
			comment: action.input.comment
		});
		if (state.provenance) state.provenance.updatedAt = action.input.timestamp;
	},
	restoreNoteOperation(state, action) {
		if (state.status !== "ARCHIVED") throw new InvalidStatusTransitionError("Can only restore from ARCHIVED status");
		state.status = "DRAFT";
		state.lifecycleEvents.push({
			id: action.input.id,
			fromStatus: "ARCHIVED",
			toStatus: "DRAFT",
			actor: action.input.actor,
			timestamp: action.input.timestamp,
			comment: action.input.comment || null
		});
		if (state.provenance) state.provenance.updatedAt = action.input.timestamp;
	}
};
//#endregion
//#region document-models/knowledge-note/v1/gen/linking/error.ts
var DuplicateLinkIdError = class extends Error {
	errorCode = "DuplicateLinkIdError";
	constructor(message = "DuplicateLinkIdError") {
		super(message);
	}
};
var LinkNotFoundError = class extends Error {
	errorCode = "LinkNotFoundError";
	constructor(message = "LinkNotFoundError") {
		super(message);
	}
};
var DuplicateTopicError = class extends Error {
	errorCode = "DuplicateTopicError";
	constructor(message = "DuplicateTopicError") {
		super(message);
	}
};
var TopicNotFoundError = class extends Error {
	errorCode = "TopicNotFoundError";
	constructor(message = "TopicNotFoundError") {
		super(message);
	}
};
//#endregion
//#region document-models/knowledge-note/v1/src/reducers/linking.ts
const knowledgeNoteLinkingOperations = {
	addLinkOperation(state, action) {
		if (state.links.find((l) => l.id === action.input.id)) throw new DuplicateLinkIdError("A link with this OID already exists");
		state.links.push({
			id: action.input.id,
			targetDocumentId: action.input.targetDocumentId,
			targetTitle: action.input.targetTitle || null,
			linkType: action.input.linkType
		});
	},
	removeLinkOperation(state, action) {
		const index = state.links.findIndex((l) => l.id === action.input.id);
		if (index === -1) throw new LinkNotFoundError("No link with this OID");
		state.links.splice(index, 1);
	},
	updateLinkTypeOperation(state, action) {
		const link = state.links.find((l) => l.id === action.input.id);
		if (!link) throw new LinkNotFoundError("No link with this OID");
		link.linkType = action.input.linkType;
	},
	addTopicOperation(state, action) {
		if (state.topics.find((t) => t.name === action.input.name)) throw new DuplicateTopicError("A topic with this name already exists on this note");
		state.topics.push({
			id: action.input.id,
			name: action.input.name,
			topicDocumentId: action.input.topicDocumentId || null
		});
	},
	removeTopicOperation(state, action) {
		const index = state.topics.findIndex((t) => t.id === action.input.id);
		if (index === -1) throw new TopicNotFoundError("No topic with this OID");
		state.topics.splice(index, 1);
	}
};
//#endregion
//#region document-models/knowledge-note/v1/src/reducers/local.ts
const knowledgeNoteLocalOperations = { setLastViewedOperation(state, action) {
	state.lastViewedAt = action.input.lastViewedAt;
} };
//#endregion
//#region document-models/knowledge-note/v1/src/reducers/provenance.ts
const knowledgeNoteProvenanceOperations = { setProvenanceOperation(state, action) {
	state.provenance = {
		author: action.input.author,
		sourceOrigin: action.input.sourceOrigin,
		sessionId: action.input.sessionId || null,
		createdAt: action.input.createdAt,
		updatedAt: action.input.createdAt
	};
} };
//#endregion
//#region document-models/knowledge-note/v1/gen/reducer.ts
const stateReducer = (state, action, dispatch) => {
	if (isDocumentAction(action)) return state;
	switch (action.type) {
		case "SET_TITLE":
			SetTitleInputSchema().parse(action.input);
			knowledgeNoteContentOperations.setTitleOperation(state[action.scope], action, dispatch);
			break;
		case "SET_DESCRIPTION":
			SetDescriptionInputSchema().parse(action.input);
			knowledgeNoteContentOperations.setDescriptionOperation(state[action.scope], action, dispatch);
			break;
		case "SET_NOTE_TYPE":
			SetNoteTypeInputSchema().parse(action.input);
			knowledgeNoteContentOperations.setNoteTypeOperation(state[action.scope], action, dispatch);
			break;
		case "SET_CONTENT":
			SetContentInputSchema().parse(action.input);
			knowledgeNoteContentOperations.setContentOperation(state[action.scope], action, dispatch);
			break;
		case "PATCH_CONTENT":
			PatchContentInputSchema().parse(action.input);
			knowledgeNoteContentOperations.patchContentOperation(state[action.scope], action, dispatch);
			break;
		case "SET_METADATA_FIELD":
			SetMetadataFieldInputSchema().parse(action.input);
			knowledgeNoteContentOperations.setMetadataFieldOperation(state[action.scope], action, dispatch);
			break;
		case "SET_METADATA_LIST_FIELD":
			SetMetadataListFieldInputSchema().parse(action.input);
			knowledgeNoteContentOperations.setMetadataListFieldOperation(state[action.scope], action, dispatch);
			break;
		case "SET_PROVENANCE":
			SetProvenanceInputSchema().parse(action.input);
			knowledgeNoteProvenanceOperations.setProvenanceOperation(state[action.scope], action, dispatch);
			break;
		case "ADD_LINK":
			AddLinkInputSchema().parse(action.input);
			knowledgeNoteLinkingOperations.addLinkOperation(state[action.scope], action, dispatch);
			break;
		case "REMOVE_LINK":
			RemoveLinkInputSchema().parse(action.input);
			knowledgeNoteLinkingOperations.removeLinkOperation(state[action.scope], action, dispatch);
			break;
		case "UPDATE_LINK_TYPE":
			UpdateLinkTypeInputSchema().parse(action.input);
			knowledgeNoteLinkingOperations.updateLinkTypeOperation(state[action.scope], action, dispatch);
			break;
		case "ADD_TOPIC":
			AddTopicInputSchema().parse(action.input);
			knowledgeNoteLinkingOperations.addTopicOperation(state[action.scope], action, dispatch);
			break;
		case "REMOVE_TOPIC":
			RemoveTopicInputSchema().parse(action.input);
			knowledgeNoteLinkingOperations.removeTopicOperation(state[action.scope], action, dispatch);
			break;
		case "SUBMIT_FOR_REVIEW":
			SubmitForReviewInputSchema().parse(action.input);
			knowledgeNoteLifecycleOperations.submitForReviewOperation(state[action.scope], action, dispatch);
			break;
		case "APPROVE_NOTE":
			ApproveNoteInputSchema().parse(action.input);
			knowledgeNoteLifecycleOperations.approveNoteOperation(state[action.scope], action, dispatch);
			break;
		case "REJECT_NOTE":
			RejectNoteInputSchema().parse(action.input);
			knowledgeNoteLifecycleOperations.rejectNoteOperation(state[action.scope], action, dispatch);
			break;
		case "ARCHIVE_NOTE":
			ArchiveNoteInputSchema().parse(action.input);
			knowledgeNoteLifecycleOperations.archiveNoteOperation(state[action.scope], action, dispatch);
			break;
		case "RESTORE_NOTE":
			RestoreNoteInputSchema().parse(action.input);
			knowledgeNoteLifecycleOperations.restoreNoteOperation(state[action.scope], action, dispatch);
			break;
		case "SET_LAST_VIEWED":
			SetLastViewedInputSchema().parse(action.input);
			knowledgeNoteLocalOperations.setLastViewedOperation(state[action.scope], action, dispatch);
			break;
		default: return state;
	}
};
const reducer = createReducer(stateReducer);
//#endregion
//#region document-models/knowledge-note/v1/gen/document-type.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
const knowledgeNoteDocumentType = "bai/knowledge-note";
//#endregion
//#region document-models/knowledge-note/v1/gen/document-schema.ts
/**
* WARNING: DO NOT EDIT
* This file is auto-generated and updated by codegen
*/
/** Schema for validating the header object of a KnowledgeNote document */
const KnowledgeNoteDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: literal(knowledgeNoteDocumentType) });
/** Schema for validating the state object of a KnowledgeNote document */
const KnowledgeNotePHStateSchema = BaseDocumentStateSchema.extend({ global: KnowledgeNoteStateSchema() });
const KnowledgeNoteDocumentSchema = object({
	header: KnowledgeNoteDocumentHeaderSchema,
	state: KnowledgeNotePHStateSchema,
	initialState: KnowledgeNotePHStateSchema
});
/** Simple helper function to check if a state object is a KnowledgeNote document state object */
function isKnowledgeNoteState(state) {
	return KnowledgeNotePHStateSchema.safeParse(state).success;
}
/** Simple helper function to assert that a document state object is a KnowledgeNote document state object */
function assertIsKnowledgeNoteState(state) {
	KnowledgeNotePHStateSchema.parse(state);
}
/** Simple helper function to check if a document is a KnowledgeNote document */
function isKnowledgeNoteDocument(document) {
	return KnowledgeNoteDocumentSchema.safeParse(document).success;
}
/** Simple helper function to assert that a document is a KnowledgeNote document */
function assertIsKnowledgeNoteDocument(document) {
	KnowledgeNoteDocumentSchema.parse(document);
}
//#endregion
//#region document-models/knowledge-note/v1/gen/utils.ts
const initialGlobalState = {
	title: null,
	description: null,
	noteType: null,
	content: null,
	status: "DRAFT",
	provenance: null,
	links: [],
	topics: [],
	scope: null,
	confidence: null,
	severity: null,
	editor: null,
	models: [],
	hooksUsed: [],
	dispatchTargets: [],
	modelId: null,
	modules: [],
	version: null,
	filePath: null,
	computes: null,
	inputs: [],
	outputs: [],
	consumedBy: [],
	context: null,
	alternatives: [],
	consequences: [],
	decisionStatus: null,
	model: null,
	sourceType: null,
	targetType: null,
	relationType: null,
	cardinality: null,
	errorMessage: null,
	rootCause: null,
	correctPattern: null,
	lifecycleEvents: []
};
const initialLocalState = {
	lastViewedAt: null,
	personalTags: []
};
const utils$1 = {
	fileExtension: "",
	createState(state) {
		return {
			...defaultBaseState(),
			global: {
				...initialGlobalState,
				...state?.global
			},
			local: {
				...initialLocalState,
				...state?.local
			}
		};
	},
	createDocument(state) {
		const document = baseCreateDocument(utils$1.createState, state);
		document.header.documentType = knowledgeNoteDocumentType;
		document.header.id = generateId();
		return document;
	},
	saveToFileHandle(document, input) {
		return baseSaveToFileHandle(document, input);
	},
	loadFromInput(input) {
		return baseLoadFromInput(input, reducer);
	},
	isStateOfType(state) {
		return isKnowledgeNoteState(state);
	},
	assertIsStateOfType(state) {
		return assertIsKnowledgeNoteState(state);
	},
	isDocumentOfType(document) {
		return isKnowledgeNoteDocument(document);
	},
	assertIsDocumentOfType(document) {
		return assertIsKnowledgeNoteDocument(document);
	}
};
//#endregion
//#region document-models/knowledge-note/v1/src/utils.ts
var utils_exports = /* @__PURE__ */ __exportAll({});
//#endregion
//#region document-models/knowledge-note/v1/utils.ts
/** Utils for the KnowledgeNote document model */
const utils = {
	...utils$1,
	...utils_exports
};
//#endregion
//#region document-models/knowledge-note/v1/module.ts
/** Document model module for the KnowledgeNote document type */
const KnowledgeNote = {
	version: 1,
	reducer,
	actions,
	utils,
	documentModel: createState(defaultBaseState(), documentModel)
};
//#endregion
export { ProvenanceSchema as $, rejectNote as A, setTitle as B, creators_exports$2 as C, approveNote as D, updateLinkType as E, setContent as F, KnowledgeNoteLocalStateSchema as G, AddTopicInputSchema as H, setDescription as I, LinkTypeSchema as J, KnowledgeNoteStateSchema as K, setMetadataField as L, submitForReview as M, creators_exports$4 as N, archiveNote as O, patchContent as P, PersonalTagSchema as Q, setMetadataListField as R, addTopic as S, removeTopic as T, ApproveNoteInputSchema as U, AddLinkInputSchema as V, ArchiveNoteInputSchema as W, NoteStatusSchema as X, NoteLinkSchema as Y, PatchContentInputSchema as Z, creators_exports as _, isDefinedNonNullAny as _t, utils$1 as a, SetDescriptionInputSchema as at, setLastViewed as b, KnowledgeNotePHStateSchema as c, SetMetadataListFieldInputSchema as ct, isKnowledgeNoteDocument as d, SetTitleInputSchema as dt, RejectNoteInputSchema as et, isKnowledgeNoteState as f, SourceOriginSchema as ft, actions as g, definedNonNullAnySchema as gt, documentModel as h, UpdateLinkTypeInputSchema as ht, initialLocalState as i, SetContentInputSchema as it, restoreNote as j, creators_exports$3 as k, assertIsKnowledgeNoteDocument as l, SetNoteTypeInputSchema as lt, reducer as m, TopicSchema as mt, utils as n, RemoveTopicInputSchema as nt, KnowledgeNoteDocumentHeaderSchema as o, SetLastViewedInputSchema as ot, knowledgeNoteDocumentType as p, SubmitForReviewInputSchema as pt, LifecycleEventSchema as q, initialGlobalState as r, RestoreNoteInputSchema as rt, KnowledgeNoteDocumentSchema as s, SetMetadataFieldInputSchema as st, KnowledgeNote as t, RemoveLinkInputSchema as tt, assertIsKnowledgeNoteState as u, SetProvenanceInputSchema as ut, setProvenance as v, removeLink as w, addLink as x, creators_exports$1 as y, setNoteType as z };

//# sourceMappingURL=module-R5x2F9BE.js.map