'use client' import { useMemo, } from 'react' import { SupportUploadFileTypes, } from '@/app/components/workflow/types' import { useWorkflowInit, } from './hooks/use-workflow-init' import { initialEdges, initialNodes, } from '@/app/components/workflow/utils' import Loading from '@/app/components/base/loading' import { FeaturesProvider } from '@/app/components/base/features' import type { Features as FeaturesData } from '@/app/components/base/features/types' import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants' import { useAppContext } from '@/context/app-context' import WorkflowWithDefaultContext from '@/app/components/workflow' import { WorkflowContextProvider, } from '@/app/components/workflow/context' import type { InjectWorkflowStoreSliceFn } from '@/app/components/workflow/store' import { createWorkflowSlice } from './store/workflow/workflow-slice' import WorkflowAppMain from './components/workflow-main' import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager' const WorkflowAppWithAdditionalContext = () => { const { data, isLoading, fileUploadConfigResponse, } = useWorkflowInit() const { isLoadingCurrentWorkspace, currentWorkspace } = useAppContext() const nodesData = useMemo(() => { if (data) { const processedNodes = initialNodes(data.graph.nodes, data.graph.edges) collaborationManager.setNodes([], processedNodes) return processedNodes } return [] }, [data]) const edgesData = useMemo(() => { if (data) { const processedEdges = initialEdges(data.graph.edges, data.graph.nodes) collaborationManager.setEdges([], processedEdges) return processedEdges } return [] }, [data]) if (!data || isLoading || isLoadingCurrentWorkspace || !currentWorkspace.id) { return (