import { COMMON_PACKAGE_ID } from "@powerhousedao/reactor-browser";
import { driveDocumentModelModule } from "document-drive";
import { createState, documentModelDocumentModelModule } from "document-model";
import { defaultBaseState } from "document-model/core";
import { loadDocumentModelEditor, loadGenericDriveExplorerEditorModule, } from "./editor.js";
async function loadDocumentModelDocumentModelModule() {
    const global = documentModelDocumentModelModule.documentModel.global;
    const name = global.name;
    const documentType = global.id;
    const unsafeIdFromDocumentType = documentType;
    const extension = global.extension;
    const specifications = global.specifications;
    const reducer = documentModelDocumentModelModule.reducer;
    const actions = documentModelDocumentModelModule.actions;
    const utils = documentModelDocumentModelModule.utils;
    const vetraDocumentModelModule = {
        id: unsafeIdFromDocumentType,
        name,
        documentType,
        extension,
        specifications,
        reducer,
        actions,
        utils,
        documentModel: createState(defaultBaseState(), global),
    };
    return vetraDocumentModelModule;
}
async function loadDriveDocumentModelModule() {
    const global = driveDocumentModelModule.documentModel.global;
    const name = global.name;
    const documentType = global.id;
    const unsafeIdFromDocumentType = documentType;
    const extension = global.extension;
    const specifications = global.specifications;
    const reducer = driveDocumentModelModule.reducer;
    const actions = driveDocumentModelModule.actions;
    const utils = driveDocumentModelModule.utils;
    const vetraDocumentModelModule = {
        id: unsafeIdFromDocumentType,
        name,
        documentType,
        extension,
        specifications,
        reducer,
        actions,
        utils,
        documentModel: createState(defaultBaseState(), global),
    };
    return vetraDocumentModelModule;
}
export async function loadCommonPackage() {
    const documentModelDocumentModelModule = await loadDocumentModelDocumentModelModule();
    const driveDocumentModelModule = await loadDriveDocumentModelModule();
    const documentModelEditorModule = loadDocumentModelEditor();
    const genericDriveExplorerEditorModule = loadGenericDriveExplorerEditorModule();
    const vetraPackage = {
        id: COMMON_PACKAGE_ID,
        name: "Common",
        description: "Common",
        category: "Common",
        author: {
            name: "Powerhouse",
            website: "https://powerhousedao.com",
        },
        modules: {
            documentModelModules: [
                documentModelDocumentModelModule,
                driveDocumentModelModule,
            ],
            editorModules: [
                documentModelEditorModule,
                genericDriveExplorerEditorModule,
            ],
        },
    };
    return vetraPackage;
}
//# sourceMappingURL=document-model.js.map