@iblai/iblai-js 1.11.4 → 1.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59479,7 +59479,7 @@ const DialogContent = React.forwardRef(({ className, children, onInteractOutside
59479
59479
  }
59480
59480
  onInteractOutside === null || onInteractOutside === void 0 ? void 0 : onInteractOutside(event);
59481
59481
  };
59482
- return (jsxs(DialogPortal, { container: portalContainer !== null && portalContainer !== void 0 ? portalContainer : undefined, children: [jsx(DialogOverlay, { "data-iblai-dialog-interaction-layer": true }), jsxs(DialogPrimitive.Content, { ref: ref, "data-iblai-dialog-interaction-layer": true, className: cn('pointer-events-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', className), onInteractOutside: handleInteractOutside, ...props, children: [children, showCloseButton && (jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [jsx(X$1, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
59482
+ return (jsxs(DialogPortal, { container: portalContainer !== null && portalContainer !== void 0 ? portalContainer : undefined, children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, { ref: ref, "data-iblai-dialog-interaction-layer": true, className: cn('pointer-events-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', className), onInteractOutside: handleInteractOutside, ...props, children: [children, showCloseButton && (jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [jsx(X$1, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
59483
59483
  });
59484
59484
  DialogContent.displayName = DialogPrimitive.Content.displayName;
59485
59485
  const DialogHeader = ({ className, ...props }) => (jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
@@ -7,16 +7,16 @@ import Link$2 from 'next/link';
7
7
  import * as ReactDOM from 'react-dom';
8
8
  import ReactDOM__default from 'react-dom';
9
9
  import { z as z$3 } from 'zod';
10
- import { useGetUserMetadataQuery, useGetUserMetadataEdxQuery, useUpdateUserMetadataMutation, useUpdateUserMetadataEdxMutation, useUploadProfileImageMutation, useResetPasswordMutation, useSelfRetireMutation, useCreateUserInstitutionMutation, useGetUserInstitutionsQuery, useCreateUserEducationMutation, useUpdateUserEducationMutation, useDeleteUserEducationMutation, useGetUserEducationQuery, useCreateUserCompanyMutation, useGetUserCompaniesQuery, useCreateUserExperienceMutation, useUpdateUserExperienceMutation, useDeleteUserExperienceMutation, useGetUserExperienceQuery, useGetUserResumeQuery, useCreateUserResumeMutation, useGetMySubscriptionsQuery, useGetItemSubscriptionQuery, useCancelSubscriptionMutation, useCreateGlobalMemoryMutation, useGetMemsearchStatusQuery, useGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useDeleteGlobalMemoryMutation, useInviteUserMutation, usePlatformInvitationsQuery, useCreateCatalogInvitationCourseBulkMutation, useGetCatalogInvitationsCourseQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, useGetPersonnalizedSearchQuery, useCreateCatalogInvitationProgramBulkMutation, useGetCatalogInvitationsProgramQuery, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useGetAccountBillingInfoQuery, useUpdateAutoRechargeInfoMutation, useTriggerAutoRechargeMutation, useUpdateUserRoleMutation, useUpdateUserStatusMutation, useUpdatePlatformUserRoleWithPoliciesMutation, usePlatformUsersQuery, isPoliciesResponse, platformApiSlice, featureTags, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation, useGetRbacGroupsQuery, usePlatformUserGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetRbacGroupDetailsQuery, useGetPlatformUserGroupDetailsQuery, useGetRbacPermissionsMutation, useGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetWatchedGroupsQuery, useCreateWatchedGroupMutation, useUpdateWatchedGroupMutation, useDeleteWatchedGroupMutation, useAddWatchedUserMutation, useRemoveWatchedUserMutation, useAddWatcherMutation, useUpdateWatcherMutation, useDeleteWatcherMutation, useGetWatchedUsersQuery, useGetWatchersQuery, WATCHER_NOTIFICATION_EVENTS, WATCHER_NOTIFICATION_EVENT_LABELS, useUploadLightLogoMutation, useUploadDarkLogoMutation, useUpdatePlatformInfoMutation, useUpdateTenantMetadataMutation, LOGO_ENDPOINTS, useDeleteApiKeyMutation, useGetApiKeysQuery, useCreateApiKeyMutation, useCreateLLMCredentialMutation, useGetCredentialsSchemaQuery, useGetMaskedLLMCredentialsQuery, useGetLlmsQuery, useDeleteIntegrationCredentialMutation, useDeleteCredentialMutation, useCreateIntegrationCredentialMutation, useGetIntegrationCredentialsSchemaQuery, useGetMaskedIntegrationCredentialsQuery, useCreateStripeCustomerPortalMutation, useSetPlatformConfigurationsMutation, useGetPlatformConfigurationsQuery, useUpdatePlatformMembershipMutation, useGetPlatformMembershipQuery, useGetCustomDomainsQuery, useCreateCustomDomainMutation, useDeleteCustomDomainMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, coreApiSlice, recommendationPromptTypeEnum, useGetRecommendedPromptsListQuery, useCreateRecommendedPromptMutation, useUpdateRecommendedPromptMutation, useDeleteRecommendedPromptMutation, useLazyGetPublicPlatformImageAssetFileUrlQuery, useCreatePlatformImageAssetMutation, useGetProviderConfigQuery, useCreateProviderConfigMutation, useDeleteProviderConfigMutation, useGetExternalMappingQuery, useGetCredentialsListQuery, useCreateExternalMappingMutation, useDeleteExternalMappingMutation, useGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetCustomMentorsQuery, useGetStripeConnectStatusQuery, useStartStripeConnectOnboardingMutation, useLazyGetStripeConnectDashboardQuery, useGetAiSearchMentorsQuery, useListPaywallsQuery, useListPricesQuery, useCreatePriceMutation, useUpdatePriceMutation, useDeletePriceMutation, useGetPaywallConfigQuery, useEnablePaywallMutation, useUpdatePaywallMutation, useCreateSessionIdMutation, useGetMentorCategoriesQuery, useGetMentorSettingsQuery, useEditMentorMutation, useDeleteMentorMutation, useForkMentorMutation, useGetToolsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetMCPServersQuery, useOauthFindMutation, useLazyStartOAuthFlowQuery, useCreateMCPServerMutation, usePartialUpdateMCPServerMutation, useCreateMCPServerConnectionMutation, usePatchMCPServerConnectionMutation, useGetConnectedServicesQuery, useGetMCPServersQuery, useGetMCPServerConnectionsQuery, useUpdateMCPServerMutation, useDeleteMCPServerMutation, useEditMentorJsonMutation, useDisconnectServiceMutation, useGetPromptCategoriesQuery, PRIVACY_ACTIONS, PRIVACY_ENTITY_TYPES, useGetMentorPublicSettingsQuery, useGetChatHistoryFilterQuery, useGetChatHistoryQuery, useGetMentorSummariesQuery, useGetConversationMemoriesQuery, useEditTrainingDocumentMutation, useGetTrainingDocumentsQuery, useCreatePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useCreateRedirectTokenMutation, useGetShareableLinkQuery, useCreateShareableLinkMutation, useUpdateShareableLinkMutation, useCreateDisclaimerMutation, useUpdateDisclaimerMutation, useGetDisclaimersQuery, useUpdateRbacMentorAccessMutation, useGetRbacMentorAccessListQuery, useStarMentorMutation, useUnstarMentorMutation, useGetPersonnalizedMentorsQuery, useGetVectorDocumentsQuery, useLazyGetConnectedServiceAuthUrlQuery, useCreateCallCredentialsMutation, useGetGuidedPromptsQuery, useUpdateChatSessionSharedMutation, useUpdateMessageFeedbackMutation, useLazyGetPromptsSearchQuery, useLazyGetGuidedPromptsQuery, useGetPublicMentorsQuery, useUpdateUserProjectMutation, useGetUserProjectDetailsQuery, useGetPeriodicAgentsQuery, useGetPeriodicAgentLogsListQuery, useCreatePeriodicAgentMutation, useDeletePeriodicAgentMutation, useCreateMemoryCategoryMutation, useUpdateMemoryCategoryMutation, useDeleteMemoryCategoryMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation, useDeletePromptMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useGetMentorsQuery, useUpdateArtifactMutation, useLazyGetArtifactVersionQuery, useLazyListArtifactVersionsQuery, useSetCurrentVersionMutation, useListArtifactVersionsQuery, useLazyGetArtifactQuery, useLazyListArtifactsQuery, useEditSessionMutation } from '@iblai/data-layer';
10
+ import { useGetUserMetadataQuery, useGetUserMetadataEdxQuery, useUpdateUserMetadataMutation, useUpdateUserMetadataEdxMutation, useUploadProfileImageMutation, useResetPasswordMutation, useSelfRetireMutation, useCreateUserInstitutionMutation, useGetUserInstitutionsQuery, useCreateUserEducationMutation, useUpdateUserEducationMutation, useDeleteUserEducationMutation, useGetUserEducationQuery, useCreateUserCompanyMutation, useGetUserCompaniesQuery, useCreateUserExperienceMutation, useUpdateUserExperienceMutation, useDeleteUserExperienceMutation, useGetUserExperienceQuery, useGetUserResumeQuery, useCreateUserResumeMutation, useGetMySubscriptionsQuery, useGetItemSubscriptionQuery, useCancelSubscriptionMutation, useCreateGlobalMemoryMutation, useGetMemsearchStatusQuery, useGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useDeleteGlobalMemoryMutation, useInviteUserMutation, usePlatformInvitationsQuery, useCreateCatalogInvitationCourseBulkMutation, useGetCatalogInvitationsCourseQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, useGetPersonnalizedSearchQuery, useCreateCatalogInvitationProgramBulkMutation, useGetCatalogInvitationsProgramQuery, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useGetAccountBillingInfoQuery, useUpdateAutoRechargeInfoMutation, useTriggerAutoRechargeMutation, useUpdateUserRoleMutation, useUpdateUserStatusMutation, useUpdatePlatformUserRoleWithPoliciesMutation, usePlatformUsersQuery, isPoliciesResponse, platformApiSlice, featureTags, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation, useGetRbacGroupsQuery, usePlatformUserGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetRbacGroupDetailsQuery, useGetPlatformUserGroupDetailsQuery, useGetRbacPermissionsMutation, useGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetWatchedGroupsQuery, useCreateWatchedGroupMutation, useUpdateWatchedGroupMutation, useDeleteWatchedGroupMutation, useAddWatchedUserMutation, useRemoveWatchedUserMutation, useAddWatcherMutation, useUpdateWatcherMutation, useDeleteWatcherMutation, useGetWatchedUsersQuery, useGetWatchersQuery, WATCHER_NOTIFICATION_EVENTS, WATCHER_NOTIFICATION_EVENT_LABELS, useUploadLightLogoMutation, useUploadDarkLogoMutation, useUpdatePlatformInfoMutation, useUpdateTenantMetadataMutation, LOGO_ENDPOINTS, useDeleteApiKeyMutation, useGetApiKeysQuery, useCreateApiKeyMutation, useCreateLLMCredentialMutation, useGetCredentialsSchemaQuery, useGetMaskedLLMCredentialsQuery, useGetLlmsQuery, useDeleteIntegrationCredentialMutation, useDeleteCredentialMutation, useCreateIntegrationCredentialMutation, useGetIntegrationCredentialsSchemaQuery, useGetMaskedIntegrationCredentialsQuery, useCreateStripeCustomerPortalMutation, useSetPlatformConfigurationsMutation, useGetPlatformConfigurationsQuery, useUpdatePlatformMembershipMutation, useGetPlatformMembershipQuery, useGetCustomDomainsQuery, useCreateCustomDomainMutation, useDeleteCustomDomainMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, coreApiSlice, recommendationPromptTypeEnum, useGetRecommendedPromptsListQuery, useCreateRecommendedPromptMutation, useUpdateRecommendedPromptMutation, useDeleteRecommendedPromptMutation, useLazyGetPublicPlatformImageAssetFileUrlQuery, useCreatePlatformImageAssetMutation, useGetProviderConfigQuery, useCreateProviderConfigMutation, useDeleteProviderConfigMutation, useGetExternalMappingQuery, useGetCredentialsListQuery, useCreateExternalMappingMutation, useDeleteExternalMappingMutation, useGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetCustomMentorsQuery, useGetStripeConnectStatusQuery, useStartStripeConnectOnboardingMutation, useLazyGetStripeConnectDashboardQuery, useGetAiSearchMentorsQuery, useListPaywallsQuery, useListPricesQuery, useCreatePriceMutation, useUpdatePriceMutation, useDeletePriceMutation, useGetPaywallConfigQuery, useEnablePaywallMutation, useUpdatePaywallMutation, useGetUserProjectsQuery, useGetMentorsQuery, useGetPublicMentorsQuery, useCreateUserProjectMutation, useUpdateUserProjectMutation, useDeleteUserProjectMutation, useCreateSessionIdMutation, useGetMentorCategoriesQuery, useGetMentorSettingsQuery, useEditMentorMutation, useDeleteMentorMutation, useForkMentorMutation, useGetToolsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetMCPServersQuery, useOauthFindMutation, useLazyStartOAuthFlowQuery, useCreateMCPServerMutation, usePartialUpdateMCPServerMutation, useCreateMCPServerConnectionMutation, usePatchMCPServerConnectionMutation, useGetConnectedServicesQuery, useGetMCPServersQuery, useGetMCPServerConnectionsQuery, useUpdateMCPServerMutation, useDeleteMCPServerMutation, useEditMentorJsonMutation, useDisconnectServiceMutation, useGetPromptCategoriesQuery, PRIVACY_ACTIONS, PRIVACY_ENTITY_TYPES, useGetMentorPublicSettingsQuery, useGetChatHistoryFilterQuery, useGetChatHistoryQuery, useGetMentorSummariesQuery, useGetConversationMemoriesQuery, useEditTrainingDocumentMutation, useGetTrainingDocumentsQuery, useCreatePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useCreateRedirectTokenMutation, useGetShareableLinkQuery, useCreateShareableLinkMutation, useUpdateShareableLinkMutation, useCreateDisclaimerMutation, useUpdateDisclaimerMutation, useGetDisclaimersQuery, useUpdateRbacMentorAccessMutation, useGetRbacMentorAccessListQuery, useStarMentorMutation, useUnstarMentorMutation, useGetPersonnalizedMentorsQuery, useGetVectorDocumentsQuery, useLazyGetConnectedServiceAuthUrlQuery, useCreateCallCredentialsMutation, useGetGuidedPromptsQuery, useUpdateChatSessionSharedMutation, useUpdateMessageFeedbackMutation, useLazyGetPromptsSearchQuery, useLazyGetGuidedPromptsQuery, useGetUserProjectDetailsQuery, useGetPeriodicAgentsQuery, useGetPeriodicAgentLogsListQuery, useCreatePeriodicAgentMutation, useDeletePeriodicAgentMutation, useCreateMemoryCategoryMutation, useUpdateMemoryCategoryMutation, useDeleteMemoryCategoryMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation, useDeletePromptMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useUpdateArtifactMutation, useLazyGetArtifactVersionQuery, useLazyListArtifactVersionsQuery, useSetCurrentVersionMutation, useListArtifactVersionsQuery, useLazyGetArtifactQuery, useLazyListArtifactsQuery, useEditSessionMutation } from '@iblai/data-layer';
11
11
  import { toast, Toaster as Toaster$1 } from 'sonner';
12
- import { getInitials, useTenantMetadata, isAlphaNumeric32, checkRbacPermission, WithPermissions, useTenantContext, useStripeUpgrade, CHAT_AREA_SIZE, TimeTracker, advancedTabsProperties, defaultSessionIds, chatActions, WithFormPermissions, selectNumberOfActiveChatMessages, useUsername, selectStreaming, isLoggedIn, TOOLS, isSafariBrowser, useShowAttachment, useShowVoiceCall, useShowVoiceRecorder, useMentorSettings, selectShowingSharedChat, selectRbacPermissions, useShowFreeTrialDialog, useEmbedMode, chatInputSliceSelectors, useResponsive, useAccessingPublicRoute, useVisitingTenant, useModelFileUploadCapabilities, useChatFileUpload, useVoiceChat, selectAttachedFiles, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, removeFile, chatInputSliceActions, ANONYMOUS_USERNAME as ANONYMOUS_USERNAME$2, redirectToAuthSpaJoinTenant, selectActiveTab, useAxdToken, useWelcomeMessage, markdownToPlainText, useCachedSessionId, use402ErrorCheck, selectTokenEnabled, selectToken, useServiceWorker, useUserAgreement, useAdvancedChat, sendMessageToParentWebsite, useMentorTools, useFileDragDrop, eventBus, RemoteEvents, selectEnableChatActionsPopup, advancedTabs, isInIframe, getAuthSpaJoinUrl, addMessage, clearFiles, MENTOR_VISIBILITY } from '@iblai/web-utils';
12
+ import { getInitials, useTenantMetadata, isAlphaNumeric32, checkRbacPermission, WithPermissions, useTenantContext, useStripeUpgrade, CHAT_AREA_SIZE, useUsername, chatActions, TimeTracker, advancedTabsProperties, defaultSessionIds, WithFormPermissions, selectNumberOfActiveChatMessages, selectStreaming, isLoggedIn, TOOLS, isSafariBrowser, useShowAttachment, useShowVoiceCall, useShowVoiceRecorder, useMentorSettings, selectShowingSharedChat, selectRbacPermissions, useShowFreeTrialDialog, useEmbedMode, chatInputSliceSelectors, useResponsive, useAccessingPublicRoute, useVisitingTenant, useModelFileUploadCapabilities, useChatFileUpload, useVoiceChat, selectAttachedFiles, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, removeFile, chatInputSliceActions, ANONYMOUS_USERNAME as ANONYMOUS_USERNAME$2, redirectToAuthSpaJoinTenant, selectActiveTab, useAxdToken, useWelcomeMessage, markdownToPlainText, useCachedSessionId, use402ErrorCheck, selectTokenEnabled, selectToken, useServiceWorker, useUserAgreement, useAdvancedChat, sendMessageToParentWebsite, useMentorTools, useFileDragDrop, eventBus, RemoteEvents, selectEnableChatActionsPopup, advancedTabs, isInIframe, getAuthSpaJoinUrl, addMessage, clearFiles, MENTOR_VISIBILITY } from '@iblai/web-utils';
13
13
  import { MentorVisibilityEnum, TransportEnum, PromptVisibilityEnum } from '@iblai/iblai-api';
14
14
  import '@reduxjs/toolkit/query';
15
15
  import * as DialogPrimitive from '@radix-ui/react-dialog';
16
16
  import { createDialogScope } from '@radix-ui/react-dialog';
17
17
  import { useDispatch, useSelector } from 'react-redux';
18
- import { useRouter } from 'next/router';
19
18
  import dynamic from 'next/dynamic';
19
+ import { useRouter } from 'next/router';
20
20
  import { Room, RoomEvent, ConnectionState, VideoPresets, Track, ParticipantEvent } from 'livekit-client';
21
21
  import { RoomContext, RoomAudioRenderer, VideoConference, formatChatMessageLinks, useRoomContext } from '@livekit/components-react';
22
22
  import { createRoot } from 'react-dom/client';
@@ -97522,7 +97522,7 @@ const DialogContent = React.forwardRef(({ className, children, onInteractOutside
97522
97522
  }
97523
97523
  onInteractOutside === null || onInteractOutside === void 0 ? void 0 : onInteractOutside(event);
97524
97524
  };
97525
- return (jsxs(DialogPortal, { container: portalContainer !== null && portalContainer !== void 0 ? portalContainer : undefined, children: [jsx(DialogOverlay, { "data-iblai-dialog-interaction-layer": true }), jsxs(DialogPrimitive.Content, { ref: ref, "data-iblai-dialog-interaction-layer": true, className: cn('pointer-events-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', className), onInteractOutside: handleInteractOutside, ...props, children: [children, showCloseButton && (jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [jsx(X$2, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
97525
+ return (jsxs(DialogPortal, { container: portalContainer !== null && portalContainer !== void 0 ? portalContainer : undefined, children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, { ref: ref, "data-iblai-dialog-interaction-layer": true, className: cn('pointer-events-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', className), onInteractOutside: handleInteractOutside, ...props, children: [children, showCloseButton && (jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [jsx(X$2, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
97526
97526
  });
97527
97527
  DialogContent.displayName = DialogPrimitive.Content.displayName;
97528
97528
  const DialogHeader = ({ className, ...props }) => (jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
@@ -204365,7 +204365,12 @@ function useIsMobile() {
204365
204365
  return !!isMobile;
204366
204366
  }
204367
204367
 
204368
+ const SIDEBAR_COOKIE_NAME = 'sidebar_state';
204369
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
204370
+ const SIDEBAR_WIDTH = '16rem';
204368
204371
  const SIDEBAR_WIDTH_MOBILE = '18rem';
204372
+ const SIDEBAR_WIDTH_ICON = '4rem';
204373
+ const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
204369
204374
  const SidebarContext = React.createContext(null);
204370
204375
  function useSidebar() {
204371
204376
  const context = React.useContext(SidebarContext);
@@ -204374,6 +204379,57 @@ function useSidebar() {
204374
204379
  }
204375
204380
  return context;
204376
204381
  }
204382
+ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
204383
+ const isMobile = useIsMobile();
204384
+ const [openMobile, setOpenMobile] = React.useState(false);
204385
+ // This is the internal state of the sidebar.
204386
+ // We use openProp and setOpenProp for control from outside the component.
204387
+ const [_open, _setOpen] = React.useState(defaultOpen);
204388
+ const open = openProp !== null && openProp !== void 0 ? openProp : _open;
204389
+ const setOpen = React.useCallback((value) => {
204390
+ const openState = typeof value === 'function' ? value(open) : value;
204391
+ if (setOpenProp) {
204392
+ setOpenProp(openState);
204393
+ }
204394
+ else {
204395
+ _setOpen(openState);
204396
+ }
204397
+ // This sets the cookie to keep the sidebar state.
204398
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
204399
+ }, [setOpenProp, open]);
204400
+ // Helper to toggle the sidebar.
204401
+ const toggleSidebar = React.useCallback(() => {
204402
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
204403
+ }, [isMobile, setOpen, setOpenMobile]);
204404
+ // Adds a keyboard shortcut to toggle the sidebar.
204405
+ React.useEffect(() => {
204406
+ const handleKeyDown = (event) => {
204407
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
204408
+ event.preventDefault();
204409
+ toggleSidebar();
204410
+ }
204411
+ };
204412
+ window.addEventListener('keydown', handleKeyDown);
204413
+ return () => window.removeEventListener('keydown', handleKeyDown);
204414
+ }, [toggleSidebar]);
204415
+ // We add a state so that we can do data-state="expanded" or "collapsed".
204416
+ // This makes it easier to style the sidebar with Tailwind classes.
204417
+ const state = open ? 'expanded' : 'collapsed';
204418
+ const contextValue = React.useMemo(() => ({
204419
+ state,
204420
+ open,
204421
+ setOpen,
204422
+ isMobile,
204423
+ openMobile,
204424
+ setOpenMobile,
204425
+ toggleSidebar,
204426
+ }), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
204427
+ return (jsx(SidebarContext.Provider, { value: contextValue, children: jsx(TooltipProvider, { delayDuration: 0, children: jsx("div", { "data-slot": "sidebar-wrapper", style: {
204428
+ '--sidebar-width': SIDEBAR_WIDTH,
204429
+ '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
204430
+ ...style,
204431
+ }, className: cn('group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full', className), ...props, children: children }) }) }));
204432
+ }
204377
204433
  function Sidebar({ side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, sidebarInnerClassName, children, ...props }) {
204378
204434
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
204379
204435
  if (collapsible === 'none') {
@@ -204401,6 +204457,10 @@ function SidebarTrigger({ className, onClick, ...props }) {
204401
204457
  toggleSidebar();
204402
204458
  }, ...props, children: [jsx(PanelLeft, {}), jsx("span", { className: "sr-only", children: "Toggle Sidebar" })] }));
204403
204459
  }
204460
+ function SidebarInset({ className, asChild = false, ...props }) {
204461
+ const Comp = asChild ? Slot$4 : 'main';
204462
+ return (jsx(Comp, { "data-slot": "sidebar-inset", className: cn('bg-background relative flex w-full flex-1 flex-col', 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2', className), ...props }));
204463
+ }
204404
204464
  function SidebarHeader({ className, ...props }) {
204405
204465
  return (jsx("div", { "data-slot": "sidebar-header", "data-sidebar": "header", className: cn('flex flex-col gap-2 p-2', className), ...props }));
204406
204466
  }
@@ -204481,7 +204541,103 @@ const AppSidebarContent = ({ contentItems, isMobile, open, openMobile, setOpenMo
204481
204541
  }, children: [jsx(item.icon, { className: "h-5 w-5" }), jsx("span", { children: item.label })] }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", side: "right", children: item.label })] })) }, item.label))) }));
204482
204542
  };
204483
204543
 
204484
- function AppSidebar({ logo, contentItems, footerItems, showProjects = false, showPinnedMessages = false, showRecentMessages = false, }) {
204544
+ function ProjectItem({ project, isActive = false, onClick, isOpen = false, onRename, onDelete, }) {
204545
+ const [isHovered, setIsHovered] = useState(false);
204546
+ const [showMenu, setShowMenu] = useState(false);
204547
+ const handleRename = (e) => {
204548
+ e.stopPropagation();
204549
+ onRename(project.id, project.title);
204550
+ setShowMenu(false);
204551
+ };
204552
+ const handleDelete = (e) => {
204553
+ e.stopPropagation();
204554
+ onDelete(project.id, project.title);
204555
+ setShowMenu(false);
204556
+ };
204557
+ return (jsxs("div", { className: "group relative", "data-testid": "project-item", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => {
204558
+ if (!showMenu) {
204559
+ setIsHovered(false);
204560
+ }
204561
+ }, children: [jsxs(Button$1, { variant: "ghost", className: cn('flex h-8 w-full items-center justify-start gap-2 rounded-md px-2 py-1 hover:bg-[#c9d8f8]', isHovered || showMenu ? 'bg-[#c9d8f8]' : 'hover:bg-[#c9d8f8]', isActive ? 'text-blue-600' : 'text-gray-700'), onClick: onClick, children: [jsx("div", { className: "flex flex-shrink-0 items-center justify-center", children: isOpen ? (jsx(Image$4, { src: "/icons/open-folder.svg", alt: "Open Folder", width: 16, height: 16, className: cn(isActive ? 'text-blue-600' : 'text-gray-500') })) : (jsx(Image$4, { src: "/icons/projects.svg", alt: "Close Folder", width: 16, height: 16, className: cn(isActive ? 'text-blue-600' : 'text-gray-500') })) }), jsx("span", { className: cn('flex-1 truncate text-left text-sm', isActive ? 'font-medium text-blue-600' : 'text-gray-700', isHovered || showMenu || isActive ? 'pr-8' : 'pr-2'), children: project.title })] }), (isHovered || showMenu || isActive) && (jsx("div", { className: "absolute top-1/2 right-2 z-10 -translate-y-1/2", children: jsxs(DropdownMenu, { open: showMenu, onOpenChange: (open) => {
204562
+ setShowMenu(open);
204563
+ if (!open) {
204564
+ setIsHovered(false);
204565
+ }
204566
+ }, children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsx(Button$1, { variant: "ghost", size: "icon", className: "h-6 w-6 p-0 hover:bg-gray-200/50", onClick: (e) => {
204567
+ e.stopPropagation();
204568
+ }, onMouseEnter: () => setIsHovered(true), children: jsx(Ellipsis, { className: "h-4 w-4 text-gray-500" }) }) }), jsxs(DropdownMenuContent, { align: "end", className: "z-50", children: [jsxs(DropdownMenuItem, { onClick: handleRename, children: [jsx(SquarePen, { className: "mr-2 h-4 w-4" }), jsx("span", { children: "Rename Project" })] }), jsxs(DropdownMenuItem, { onClick: handleDelete, children: [jsx(Trash2, { className: "mr-2 h-4 w-4" }), jsx("span", { children: "Delete Project" })] })] })] }) }))] }));
204569
+ }
204570
+
204571
+ function ProjectChatItem({ title, avatar, onClick, isActive = false, }) {
204572
+ return (jsxs(Button$1, { variant: "ghost", className: cn('flex h-8 w-full items-center gap-2 rounded-md px-2 py-1 pl-4 hover:bg-[#c9d8f8]', isActive && 'bg-[#c9d8f8] hover:bg-[#c9d8f8]'), onClick: onClick, "data-testid": "project-chat-item", children: [jsxs(Avatar, { className: "h-4 w-4", children: [jsx(AvatarImage, { src: avatar, alt: title }), jsx(AvatarFallback, { className: "text-[0.625rem]", children: title.substring(0, 2) })] }), jsx("span", { className: "flex-1 overflow-hidden pr-8 text-left text-sm text-ellipsis whitespace-nowrap text-gray-700", children: title })] }));
204573
+ }
204574
+
204575
+ const CreateProjectModal$1 = dynamic(() => Promise.resolve().then(function () { return createProjectModal; }).then((mod) => mod.CreateProjectModal), {
204576
+ ssr: false,
204577
+ });
204578
+ const RenameProjectModal$1 = dynamic(() => Promise.resolve().then(function () { return renameProjectModal; }).then((mod) => mod.RenameProjectModal), {
204579
+ ssr: false,
204580
+ });
204581
+ const DeleteProjectModal$1 = dynamic(() => Promise.resolve().then(function () { return deleteProjectModal; }).then((mod) => mod.DeleteProjectModal), {
204582
+ ssr: false,
204583
+ });
204584
+ function ProjectsSidebarDropdown({ tenantKey, username, isLoggedIn, activeProjectId, activeMentorId, navigateToProject, navigateToMentorInProject, executeWithTrialCheck, renderUnauthenticatedTrigger, }) {
204585
+ var _a;
204586
+ const gateAction = React__default.useCallback((action) => {
204587
+ if (executeWithTrialCheck) {
204588
+ executeWithTrialCheck(action);
204589
+ }
204590
+ else {
204591
+ action();
204592
+ }
204593
+ }, [executeWithTrialCheck]);
204594
+ const [isCreateProjectModalOpen, setIsCreateProjectModalOpen] = React__default.useState(false);
204595
+ const [renameModalData, setRenameModalData] = React__default.useState({ isOpen: false, projectId: '', currentName: '' });
204596
+ const [deleteModalData, setDeleteModalData] = React__default.useState({ isOpen: false, projectId: '', projectName: '' });
204597
+ const { data: projectsData } = useGetUserProjectsQuery({
204598
+ tenantKey: tenantKey,
204599
+ username: username,
204600
+ params: {
204601
+ limit: 50,
204602
+ },
204603
+ }, {
204604
+ skip: !username || !tenantKey,
204605
+ });
204606
+ const projects = (projectsData === null || projectsData === void 0 ? void 0 : projectsData.results) || [];
204607
+ const handleSelectProject = (projectId, mentorUniqueId) => {
204608
+ navigateToProject(projectId, mentorUniqueId);
204609
+ };
204610
+ const handleRenameProject = (projectId, currentName) => {
204611
+ setRenameModalData({
204612
+ isOpen: true,
204613
+ projectId,
204614
+ currentName,
204615
+ });
204616
+ };
204617
+ const handleCloseRenameModal = () => {
204618
+ setRenameModalData({ isOpen: false, projectId: '', currentName: '' });
204619
+ };
204620
+ const handleDeleteProject = (projectId, projectName) => {
204621
+ setDeleteModalData({
204622
+ isOpen: true,
204623
+ projectId,
204624
+ projectName,
204625
+ });
204626
+ };
204627
+ const handleCloseDeleteModal = () => {
204628
+ setDeleteModalData({ isOpen: false, projectId: '', projectName: '' });
204629
+ };
204630
+ const newProjectTrigger = (jsx(Button$1, { variant: "ghost", className: cn('h-8 w-full justify-start gap-2 px-2 text-gray-700 hover:bg-[#c9d8f8]'), onClick: isLoggedIn ? () => gateAction(() => setIsCreateProjectModalOpen(true)) : undefined, "data-testid": "new-project-button", children: jsxs("div", { className: "flex items-center gap-2.5", children: [jsx(Image$4, { src: "/icons/new-project.svg", alt: "New Project", width: 18, height: 18, className: "flex-shrink-0" }), jsx("span", { className: "flex-1 text-left", children: "New Project" })] }) }));
204631
+ return (jsxs(Fragment$1, { children: [jsxs("div", { children: [isLoggedIn
204632
+ ? newProjectTrigger
204633
+ : ((_a = renderUnauthenticatedTrigger === null || renderUnauthenticatedTrigger === void 0 ? void 0 : renderUnauthenticatedTrigger(newProjectTrigger)) !== null && _a !== void 0 ? _a : newProjectTrigger), jsx("div", { className: "ml-4 space-y-1 border-l border-[#D0E0FF]", children: projects.map((project) => (jsxs("div", { children: [jsx(ProjectItem, { project: { id: String(project.id), title: project.name }, isActive: activeProjectId === String(project.id), onClick: () => gateAction(() => { var _a; return handleSelectProject(String(project.id), (_a = project.mentors[0]) === null || _a === void 0 ? void 0 : _a.unique_id); }), isOpen: activeProjectId === String(project.id), onRename: (projectId, currentName) => {
204634
+ gateAction(() => handleRenameProject(projectId, currentName));
204635
+ }, onDelete: (projectId, projectName) => {
204636
+ gateAction(() => handleDeleteProject(projectId, projectName));
204637
+ } }), activeProjectId === String(project.id) && (jsx("div", { className: "mt-1 ml-4 space-y-1", children: project.mentors.map((mentor) => (jsx(ProjectChatItem, { title: mentor.name, onClick: () => gateAction(() => handleSelectProject(String(project.id), mentor.unique_id)), isActive: mentor.unique_id === activeMentorId, avatar: mentor.profile_image }, mentor.id))) }))] }, project.id))) })] }), isCreateProjectModalOpen && (jsx(CreateProjectModal$1, { isOpen: isCreateProjectModalOpen, onClose: () => setIsCreateProjectModalOpen(false), tenantKey: tenantKey, username: username, navigateToMentorInProject: navigateToMentorInProject })), renameModalData.isOpen && (jsx(RenameProjectModal$1, { isOpen: renameModalData.isOpen, onClose: handleCloseRenameModal, projectId: renameModalData.projectId, currentName: renameModalData.currentName, tenantKey: tenantKey, username: username })), deleteModalData.isOpen && (jsx(DeleteProjectModal$1, { isOpen: deleteModalData.isOpen, onClose: handleCloseDeleteModal, projectId: deleteModalData.projectId, projectName: deleteModalData.projectName, tenantKey: tenantKey, username: username }))] }));
204638
+ }
204639
+
204640
+ function AppSidebar({ logo, contentItems, footerItems, showProjects = false, showPinnedMessages = false, showRecentMessages = false, projectsConfig, }) {
204485
204641
  const { open, openMobile, isMobile, setOpenMobile } = useSidebar();
204486
204642
  const isSidebarOpen = (isMobile && openMobile) || (!isMobile && open);
204487
204643
  return (jsxs(Sidebar, { collapsible: "icon", variant: "sidebar", className: cn('flex flex-col border-r border-[#D0E0FF] transition-all duration-300'), sidebarInnerClassName: cn('bg-white'), children: [jsx(SidebarHeader, { className: cn('h-16 flex justify-center flex-none border-b border-[#D0E0FF]'), children: jsxs("div", { className: cn('flex w-full items-center', {
@@ -204491,13 +204647,266 @@ function AppSidebar({ logo, contentItems, footerItems, showProjects = false, sho
204491
204647
  flex: isSidebarOpen,
204492
204648
  }), children: logo }))] }) }), jsxs(SidebarContent, { className: "!overflow-visible p-4 flex-grow px-0", children: [jsx(SidebarMenu, { className: cn('flex-none px-4 gap-0', {
204493
204649
  'place-content-center': !open && !openMobile,
204494
- }), children: jsx(AppSidebarContent, { contentItems: contentItems, isMobile: isMobile, open: open, openMobile: openMobile, setOpenMobile: setOpenMobile }) }), jsx("div", { className: "border-t border-[#D0E0FF] mb-2" }), jsx(SidebarMenu, { className: "flex-1 overflow-auto h-full scrollbar-thin px-4", children: jsx(SidebarMenuItem, { className: "overflow-y-auto h-full scrollbar-thin", children: isSidebarOpen && showProjects && (jsxs("div", { className: "flex max-h-fit flex-col overflow-y-auto", children: [showPinnedMessages && jsx("div", { children: "Pinned Messages" }), showRecentMessages && jsx("div", { children: "Recent Messages" })] })) }) })] }), jsx("div", { className: "border-t border-[#D0E0FF] mb-2" }), jsx(AppSidebarFooter, { footerItems: footerItems, isMobile: isMobile, open: open, openMobile: openMobile, setOpenMobile: setOpenMobile })] }));
204650
+ }), children: jsx(AppSidebarContent, { contentItems: contentItems, isMobile: isMobile, open: open, openMobile: openMobile, setOpenMobile: setOpenMobile }) }), jsx("div", { className: "border-t border-[#D0E0FF] mb-2" }), jsx(SidebarMenu, { className: "flex-1 overflow-auto h-full scrollbar-thin px-4", children: jsx(SidebarMenuItem, { className: "overflow-y-auto h-full scrollbar-thin", children: isSidebarOpen && showProjects && (jsxs("div", { className: "flex max-h-fit flex-col overflow-y-auto", children: [projectsConfig ? jsx(ProjectsSidebarDropdown, { ...projectsConfig }) : null, showPinnedMessages && jsx("div", { children: "Pinned Messages" }), showRecentMessages && jsx("div", { children: "Recent Messages" })] })) }) })] }), jsx("div", { className: "border-t border-[#D0E0FF] mb-2" }), jsx(AppSidebarFooter, { footerItems: footerItems, isMobile: isMobile, open: open, openMobile: openMobile, setOpenMobile: setOpenMobile })] }));
204495
204651
  }
204496
204652
 
204497
204653
  function NavBar({ username, isAuthenticated = false, onNewChat, onSettings, onLogout, onLogin, mentorName, showMentorDropdown = false, additionalMenuItems = [], }) {
204498
204654
  return (jsxs("header", { className: "flex h-20 shrink-0 items-center gap-2 bg-white px-4 border-b border-[#D0E0FF]", children: [jsx(SidebarTrigger, { className: "-ml-1" }), mentorName && !showMentorDropdown && (jsx("div", { className: "flex items-center gap-2 ml-4", children: jsx("h1", { className: "text-lg font-semibold text-gray-900", children: mentorName }) })), mentorName && showMentorDropdown && (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsxs(Button$1, { variant: "ghost", className: "gap-2 text-gray-900 hover:bg-gray-100 ml-4", children: [jsx("span", { className: "font-semibold", children: mentorName }), jsx(ChevronDown, { className: "h-4 w-4" })] }) }), jsxs(DropdownMenuContent, { align: "start", className: "w-[200px]", children: [jsx(DropdownMenuItem, { children: "Switch Mentor" }), jsx(DropdownMenuItem, { children: "Explore Mentors" })] })] })), jsxs("div", { className: "flex items-center gap-2 ml-auto", children: [onNewChat && (jsxs(Button$1, { variant: "ghost", size: "sm", onClick: onNewChat, className: "gap-2 text-[#646464] hover:text-[#484848] hover:bg-transparent", children: [jsx(MessageSquare, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "New Chat" })] })), isAuthenticated ? (jsxs(DropdownMenu, { children: [jsx(DropdownMenuTrigger, { asChild: true, children: jsxs(Button$1, { variant: "ghost", size: "sm", className: "gap-2 text-[#646464] hover:text-[#484848] hover:bg-transparent", children: [jsxs(Avatar, { className: "h-6 w-6", children: [jsx(AvatarImage, { src: `https://api.dicebear.com/7.x/initials/svg?seed=${username}` }), jsx(AvatarFallback, { children: username === null || username === void 0 ? void 0 : username.charAt(0).toUpperCase() })] }), jsx("span", { className: "hidden sm:inline", children: username })] }) }), jsxs(DropdownMenuContent, { align: "end", className: "w-[180px] rounded-md border border-gray-200 bg-white p-2 shadow-lg", children: [additionalMenuItems.map((item, index) => (jsxs(React__default.Fragment, { children: [item.separator && jsx(DropdownMenuSeparator, {}), jsxs(DropdownMenuItem, { onClick: item.onClick, className: "flex cursor-pointer items-center rounded-md px-3 py-2 text-sm text-gray-700 hover:bg-gray-100", children: [jsx(item.icon, { className: "mr-3 h-4 w-4 text-gray-600" }), item.label] })] }, item.label))), onSettings && (jsxs(DropdownMenuItem, { onClick: onSettings, className: "flex cursor-pointer items-center rounded-md px-3 py-2 text-sm text-gray-700 hover:bg-gray-100", children: [jsx(Settings$1, { className: "mr-3 h-4 w-4 text-gray-600" }), "Settings"] })), onLogout && (jsxs(Fragment$1, { children: [jsx(DropdownMenuSeparator, {}), jsxs(DropdownMenuItem, { onClick: onLogout, className: "flex cursor-pointer items-center rounded-md px-3 py-2 text-sm text-gray-700 hover:bg-gray-100", children: [jsx(LogOut, { className: "mr-3 h-4 w-4 text-gray-600" }), "Logout"] })] }))] })] })) : (onLogin && (jsxs(Button$1, { onClick: onLogin, size: "sm", className: "gap-2", children: [jsx(LogIn, { className: "h-4 w-4" }), "Login"] })))] })] }));
204499
204655
  }
204500
204656
 
204657
+ function c$3(e,u,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),v=useRef(),m=useRef(),d=useRef(e),g=useRef(true);d.current=e;var p="undefined"!=typeof window,w=!u&&0!==u&&p;if("function"!=typeof e)throw new TypeError("Expected a function");u=+u||0;var s=!!(c=c||{}).leading,x=!("trailing"in c)||!!c.trailing,h="maxWait"in c,y="debounceOnServer"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;useEffect(function(){return g.current=true,function(){g.current=false;}},[]);var A=useMemo(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!g.current)return false;var n=r-a.current;return !a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f);}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null;},A.isPending=function(){return !!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i$8(r,n){return r===n}function a$3(n,t,a){var o=i$8,f=useRef(n),l=useState({})[1],v=c$3(useCallback(function(r){f.current=r,l({});},[l]),t,a),m=useRef(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}
204658
+
204659
+ function useMentorsWithPagination({ tenantKey, itemsPerPage = 5, }) {
204660
+ const username = useUsername();
204661
+ const [searchQuery, setSearchQuery] = React__default.useState('');
204662
+ const [debouncedSearchQuery] = a$3(searchQuery, 500);
204663
+ const [currentPage, setCurrentPage] = React__default.useState(1);
204664
+ const [queryParams, setQueryParams] = React__default.useState({
204665
+ limit: itemsPerPage,
204666
+ offset: 0,
204667
+ query: debouncedSearchQuery,
204668
+ orderBy: 'created_at',
204669
+ orderDirection: 'desc',
204670
+ });
204671
+ const { data: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, error: mentorsError, } = useGetMentorsQuery({
204672
+ org: tenantKey,
204673
+ username: username !== null && username !== void 0 ? username : '',
204674
+ ...queryParams,
204675
+ }, {
204676
+ skip: !tenantKey || !username,
204677
+ refetchOnMountOrArgChange: true,
204678
+ });
204679
+ const { data: publicMentors, isLoading: isPublicMentorsLoading, isFetching: isPublicMentorsFetching, error: publicMentorsError, } = useGetPublicMentorsQuery({ ...queryParams }, {
204680
+ skip: !!username,
204681
+ refetchOnMountOrArgChange: true,
204682
+ });
204683
+ // Effect to update offset when page changes
204684
+ React__default.useEffect(() => {
204685
+ setQueryParams((prev) => ({
204686
+ ...prev,
204687
+ offset: (currentPage - 1) * itemsPerPage,
204688
+ }));
204689
+ }, [currentPage, itemsPerPage]);
204690
+ // Effect to update query parameter when search changes
204691
+ React__default.useEffect(() => {
204692
+ setQueryParams((prev) => ({
204693
+ ...prev,
204694
+ query: debouncedSearchQuery,
204695
+ offset: 0, // Reset to first page when search changes
204696
+ }));
204697
+ setCurrentPage(1); // Also reset current page state
204698
+ }, [debouncedSearchQuery]);
204699
+ const handlePageChange = (newPage) => {
204700
+ setCurrentPage(newPage);
204701
+ // Scroll to top of the list when changing pages
204702
+ window.scrollTo({ top: 0, behavior: 'smooth' });
204703
+ };
204704
+ // Calculate total pages based on count and limit
204705
+ const mentorsTotalPages = mentors ? Math.ceil(mentors.count / itemsPerPage) : 0;
204706
+ const publicMentorsTotalPages = publicMentors ? Math.ceil(publicMentors.count / itemsPerPage) : 0;
204707
+ const totalPages = username ? mentorsTotalPages : publicMentorsTotalPages;
204708
+ return {
204709
+ mentors: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.results) || [] : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.results) || [],
204710
+ totalCount: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.count) || 0 : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.count) || 0,
204711
+ isLoading: username ? isMentorsLoading : isPublicMentorsLoading,
204712
+ isFetching: username ? isMentorsFetching : isPublicMentorsFetching,
204713
+ error: username ? mentorsError : publicMentorsError,
204714
+ searchQuery,
204715
+ setSearchQuery,
204716
+ currentPage,
204717
+ totalPages,
204718
+ handlePageChange,
204719
+ queryParams,
204720
+ itemsPerPage,
204721
+ };
204722
+ }
204723
+
204724
+ function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
204725
+ const { mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } = useMentorsWithPagination({ tenantKey, itemsPerPage });
204726
+ // Update search query with debounce effect handled by the hook
204727
+ React__default.useEffect(() => {
204728
+ setMentorSearch(searchQuery);
204729
+ }, [searchQuery]);
204730
+ const isMentorSelected = (mentorId) => {
204731
+ return selectedMentorIds.includes(mentorId);
204732
+ };
204733
+ return (jsxs("div", { className: "space-y-4", children: [showSearch && (jsxs("div", { className: "relative", children: [isMentorsFetching ? (jsx(Spinner, { className: "absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-gray-400" })) : (jsx(Search, { className: "absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-gray-400" })), jsx(Input, { placeholder: "Search Agents", value: searchQuery, onChange: (e) => onSearchChange(e.target.value), className: "h-10 border-gray-200 pl-10 focus:border-blue-500 focus:ring-0" })] })), jsxs("div", { className: "space-y-4", children: [jsx("div", { className: "grid max-h-96 auto-rows-min grid-cols-1 items-start gap-3 overflow-y-auto rounded-lg border border-gray-200 p-4 md:max-h-none md:grid-cols-2", style: { minHeight }, children: isMentorsLoading ? (jsx("div", { className: "col-span-full py-8 text-center text-gray-500", children: "Loading agents..." })) : mentors.length === 0 ? (jsx("div", { className: "col-span-full py-8 text-center text-gray-500", children: "No agents found matching your search." })) : (mentors.map((mentor) => {
204734
+ const isSelected = isMentorSelected(mentor.unique_id || '');
204735
+ const isAlreadyAdded = selectedMentorIds.includes(mentor.unique_id || '');
204736
+ return (jsxs("button", { onClick: () => onMentorSelect(mentor), className: `flex cursor-pointer items-center gap-3 rounded-lg border-2 p-3 transition-all ${isSelected
204737
+ ? 'border-blue-500 bg-blue-50'
204738
+ : isAlreadyAdded
204739
+ ? 'bg-blue-25 border-blue-300'
204740
+ : 'border-gray-200 hover:border-gray-300 hover:bg-gray-50'}`, children: [jsxs(Avatar, { className: "h-12 w-12 flex-shrink-0", children: [jsx(AvatarImage, { src: mentor.profile_image || '/placeholder.svg', alt: mentor.name }), jsx(AvatarFallback, { children: mentor.name.substring(0, 2) })] }), jsxs("div", { className: "flex min-w-0 flex-1 flex-col justify-start text-left", children: [jsx("h4", { className: "truncate text-sm font-medium text-gray-900", children: mentor.name }), jsx("p", { className: "line-clamp-2 text-xs text-gray-600", children: mentor.description })] }), isSelected && (jsx("div", { className: "flex-shrink-0", children: jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-blue-600", children: jsx(Check, { className: "h-4 w-4 text-white" }) }) })), isAlreadyAdded && !isSelected && (jsx("div", { className: "flex-shrink-0", children: jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-blue-400", children: jsx(Check, { className: "h-4 w-4 text-white" }) }) }))] }, mentor.unique_id));
204741
+ })) }), jsx(IblPagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: handlePageChange, disabled: isMentorsFetching || isMentorsLoading })] })] }));
204742
+ }
204743
+
204744
+ function CreateProjectModal({ isOpen, onClose, tenantKey, username, navigateToMentorInProject, }) {
204745
+ const dispatch = useDispatch();
204746
+ const [projectName, setProjectName] = useState('');
204747
+ const [searchQuery, setSearchQuery] = useState('');
204748
+ const [selectedMentors, setSelectedMentors] = useState([]);
204749
+ const [createUserProject, { isLoading }] = useCreateUserProjectMutation();
204750
+ const toggleMentorSelection = (mentor) => {
204751
+ setSelectedMentors((prev) => {
204752
+ const isSelected = prev.some((m) => m.unique_id === mentor.unique_id);
204753
+ if (isSelected) {
204754
+ return prev.filter((m) => m.unique_id !== mentor.unique_id);
204755
+ }
204756
+ else {
204757
+ return [...prev, mentor];
204758
+ }
204759
+ });
204760
+ };
204761
+ const handleCreate = async () => {
204762
+ var _a;
204763
+ if (projectName.trim() && selectedMentors.length > 0 && username && tenantKey) {
204764
+ try {
204765
+ const project = await createUserProject({
204766
+ tenantKey,
204767
+ username,
204768
+ data: {
204769
+ name: projectName.trim(),
204770
+ description: '',
204771
+ shared: false,
204772
+ mentors_to_add: selectedMentors.map((mentor) => mentor.unique_id),
204773
+ },
204774
+ }).unwrap();
204775
+ // Reset form
204776
+ setProjectName('');
204777
+ setSelectedMentors([]);
204778
+ setSearchQuery('');
204779
+ onClose();
204780
+ toast.success('Project created successfully');
204781
+ dispatch(chatActions.setShouldStartNewChat(true));
204782
+ navigateToMentorInProject((_a = project.mentors[0]) === null || _a === void 0 ? void 0 : _a.unique_id, String(project.id));
204783
+ }
204784
+ catch (error) {
204785
+ toast.error('Failed to create project');
204786
+ console.error(JSON.stringify({ tenant: tenantKey, error }));
204787
+ }
204788
+ }
204789
+ };
204790
+ const handleCancel = () => {
204791
+ setProjectName('');
204792
+ setSelectedMentors([]);
204793
+ setSearchQuery('');
204794
+ onClose();
204795
+ };
204796
+ return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "w-[95vw] max-w-4xl gap-0 overflow-hidden p-0", style: {
204797
+ height: 'auto',
204798
+ maxHeight: '90vh',
204799
+ display: 'flex',
204800
+ flexDirection: 'column',
204801
+ }, children: [jsx(DialogHeader, { className: "flex-shrink-0 border-b border-gray-200 bg-white px-6 py-4", children: jsx(DialogTitle, { className: "text-xl font-semibold text-gray-900", children: "New Project" }) }), jsxs("div", { className: "flex-1 space-y-6 px-6 py-6", style: {
204802
+ overflowY: 'auto',
204803
+ overflowX: 'hidden',
204804
+ }, children: [jsxs("div", { children: [jsx("label", { className: "mb-2 block text-sm font-medium text-gray-700", children: "Project Name" }), jsx(Input, { placeholder: "Project Name", value: projectName, onChange: (e) => setProjectName(e.target.value), className: "h-12 rounded-lg border-2 border-gray-200 px-4 text-base focus:border-gray-200 focus:ring-0 focus:outline-none", onKeyDown: (e) => {
204805
+ if (e.key === 'Enter') {
204806
+ handleCreate();
204807
+ }
204808
+ } })] }), jsxs("div", { children: [jsxs("label", { className: "mb-3 block text-sm font-medium text-gray-700", children: ["Select Agents ", jsx("span", { className: "text-red-500", children: "*" }), selectedMentors.length > 0 && (jsxs("span", { className: "ml-2 font-normal text-blue-600", children: ["(", selectedMentors.length, " selected)"] }))] }), jsx(MentorSelectionGrid, { selectedMentorIds: selectedMentors.map((m) => m.unique_id), onMentorSelect: toggleMentorSelection, searchQuery: searchQuery, onSearchChange: setSearchQuery, tenantKey: tenantKey, itemsPerPage: 8, showSearch: true, minHeight: "400px" })] })] }), jsxs("div", { className: "flex flex-shrink-0 justify-end gap-3 border-t border-gray-200 bg-gray-50 px-6 py-4", children: [jsx(Button$1, { variant: "outline", onClick: handleCancel, className: "bg-transparent px-6", children: "Cancel" }), jsx(Button$1, { onClick: handleCreate, disabled: !projectName.trim() || selectedMentors.length === 0 || isLoading, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] px-6 text-white hover:opacity-90", children: isLoading ? 'Creating...' : 'Save' })] })] }) }));
204809
+ }
204810
+
204811
+ var createProjectModal = /*#__PURE__*/Object.freeze({
204812
+ __proto__: null,
204813
+ CreateProjectModal: CreateProjectModal
204814
+ });
204815
+
204816
+ function RenameProjectModal({ isOpen, onClose, projectId, currentName, tenantKey, username, onSuccess, }) {
204817
+ const [projectName, setProjectName] = useState(currentName);
204818
+ const [updateProject, { isLoading }] = useUpdateUserProjectMutation();
204819
+ React__default.useEffect(() => {
204820
+ if (isOpen) {
204821
+ setProjectName(currentName);
204822
+ }
204823
+ }, [isOpen, currentName]);
204824
+ const handleRename = async () => {
204825
+ if (projectName.trim() && username && tenantKey) {
204826
+ try {
204827
+ await updateProject({
204828
+ tenantKey,
204829
+ username,
204830
+ id: parseInt(projectId),
204831
+ data: {
204832
+ name: projectName.trim(),
204833
+ },
204834
+ }).unwrap();
204835
+ setProjectName('');
204836
+ onClose();
204837
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
204838
+ toast.success('Project renamed successfully');
204839
+ }
204840
+ catch (error) {
204841
+ toast.error('Failed to rename project');
204842
+ console.error(JSON.stringify({ tenant: tenantKey, error }));
204843
+ }
204844
+ }
204845
+ };
204846
+ const handleCancel = () => {
204847
+ setProjectName(currentName);
204848
+ onClose();
204849
+ };
204850
+ return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "w-[95vw] max-w-2xl gap-0 overflow-hidden p-0", style: {
204851
+ height: 'auto',
204852
+ maxHeight: '90vh',
204853
+ display: 'flex',
204854
+ flexDirection: 'column',
204855
+ }, children: [jsx(DialogHeader, { className: "flex-shrink-0 border-b border-gray-200 bg-white px-6 py-4", children: jsx(DialogTitle, { className: "text-xl font-semibold text-gray-900", children: "Rename Project" }) }), jsx("div", { className: "flex-1 px-6 py-6", children: jsxs("div", { children: [jsx("label", { className: "mb-2 block text-sm font-medium text-gray-700", children: "Project Name" }), jsx(Input, { placeholder: "Enter new project name", value: projectName, onChange: (e) => setProjectName(e.target.value), className: "h-12 rounded-lg border-2 border-gray-200 px-4 text-base focus:border-blue-500 focus:ring-0", onKeyDown: (e) => {
204856
+ if (e.key === 'Enter' && !e.shiftKey) {
204857
+ e.preventDefault();
204858
+ handleRename();
204859
+ }
204860
+ else if (e.key === 'Escape') {
204861
+ handleCancel();
204862
+ }
204863
+ }, autoFocus: true })] }) }), jsxs("div", { className: "flex flex-shrink-0 justify-end gap-3 border-t border-gray-200 bg-gray-50 px-6 py-4", children: [jsx(Button$1, { variant: "outline", onClick: handleCancel, disabled: isLoading, className: "bg-transparent px-6", children: "Cancel" }), jsx(Button$1, { onClick: handleRename, disabled: !projectName.trim() || isLoading || projectName.trim() === currentName, className: "ibl-button-primary", children: isLoading ? 'Renaming...' : 'Rename Project' })] })] }) }));
204864
+ }
204865
+
204866
+ var renameProjectModal = /*#__PURE__*/Object.freeze({
204867
+ __proto__: null,
204868
+ RenameProjectModal: RenameProjectModal
204869
+ });
204870
+
204871
+ function DeleteProjectModal({ isOpen, onClose, projectId, projectName, tenantKey, username, onSuccess, onDeletedActiveProject, }) {
204872
+ const [deleteProject, { isLoading }] = useDeleteUserProjectMutation();
204873
+ const handleDelete = async () => {
204874
+ if (!username || !tenantKey)
204875
+ return;
204876
+ try {
204877
+ await deleteProject({
204878
+ tenantKey,
204879
+ username,
204880
+ id: parseInt(projectId),
204881
+ }).unwrap();
204882
+ onClose();
204883
+ // Wait for the modal to close to avoid race conditions
204884
+ await new Promise((resolve) => setTimeout(resolve, 10));
204885
+ toast.success('Project deleted successfully');
204886
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
204887
+ // If we're currently viewing the deleted project, let the host redirect
204888
+ if (typeof window !== 'undefined' &&
204889
+ window.location.pathname.includes(`/projects/${projectId}`)) {
204890
+ onDeletedActiveProject === null || onDeletedActiveProject === void 0 ? void 0 : onDeletedActiveProject();
204891
+ }
204892
+ }
204893
+ catch (error) {
204894
+ console.error(JSON.stringify(error));
204895
+ toast.error('Failed to delete project');
204896
+ console.error(JSON.stringify({ tenant: tenantKey, error }));
204897
+ }
204898
+ };
204899
+ return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "space-y-1", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { className: "mb-4", children: "Delete Project" }), jsxs(DialogDescription, { children: ["Are you sure you want to delete \"", projectName, "\"? This action cannot be undone and will permanently remove the project and all associated data including chats, files, and settings."] })] }), jsxs(DialogFooter, { children: [jsx(Button$1, { variant: "outline", onClick: onClose, disabled: isLoading, className: "ibl-button-primary", children: "Cancel" }), jsx(Button$1, { variant: "outline", onClick: async (event) => {
204900
+ event.preventDefault();
204901
+ await handleDelete();
204902
+ }, disabled: isLoading, className: "border-input bg-background text-accent-foreground hover:bg-accent hover:text-accent-foreground border", children: isLoading ? 'Deleting...' : 'Delete Project' })] })] }) }));
204903
+ }
204904
+
204905
+ var deleteProjectModal = /*#__PURE__*/Object.freeze({
204906
+ __proto__: null,
204907
+ DeleteProjectModal: DeleteProjectModal
204908
+ });
204909
+
204501
204910
  function useTimeTracker(config) {
204502
204911
  var _a;
204503
204912
  const router = useRouter();
@@ -209258,8 +209667,6 @@ function DatasetItemList({ datasets, onSelect, selectedDatasetId, labels }) {
209258
209667
  return (jsx(TableBody, { children: (datasets === null || datasets === void 0 ? void 0 : datasets.length) > 0 ? (datasets === null || datasets === void 0 ? void 0 : datasets.map((dataset) => (jsx(DatasetItem, { dataset: dataset, onSelect: onSelect, isSelected: selectedDatasetId === dataset.id, labels: labels }, dataset.id)))) : (jsx(TableRow$1, { children: jsx(TableCell$1, { colSpan: 6, className: "p-4 text-center text-[#646464]", children: labels.table.emptyState }) })) }));
209259
209668
  }
209260
209669
 
209261
- function c$3(e,u,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),v=useRef(),m=useRef(),d=useRef(e),g=useRef(true);d.current=e;var p="undefined"!=typeof window,w=!u&&0!==u&&p;if("function"!=typeof e)throw new TypeError("Expected a function");u=+u||0;var s=!!(c=c||{}).leading,x=!("trailing"in c)||!!c.trailing,h="maxWait"in c,y="debounceOnServer"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;useEffect(function(){return g.current=true,function(){g.current=false;}},[]);var A=useMemo(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!g.current)return false;var n=r-a.current;return !a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f);}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null;},A.isPending=function(){return !!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i$8(r,n){return r===n}function a$3(n,t,a){var o=i$8,f=useRef(n),l=useState({})[1],v=c$3(useCallback(function(r){f.current=r,l({});},[l]),t,a),m=useRef(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}
209262
-
209263
209670
  function useDatasetsWithPagination(itemsPerPage = 5) {
209264
209671
  const { tenantKey, mentorId, username } = useAgentSettings();
209265
209672
  const [searchQuery, setSearchQuery] = React__default.useState('');
@@ -217307,14 +217714,14 @@ function ProjectActionButtonsInner({ onFilesClick, onInstructionsClick, instruct
217307
217714
  const ProjectInstructionsModal$1 = dynamic(() => Promise.resolve().then(function () { return projectInstructionsModal; }).then((mod) => mod.ProjectInstructionsModal), { ssr: false });
217308
217715
  const ProjectFilesModal$1 = dynamic(() => Promise.resolve().then(function () { return projectFilesModal; }).then((mod) => mod.ProjectFilesModal), { ssr: false });
217309
217716
  const AddMentorToProjectModal$1 = dynamic(() => Promise.resolve().then(function () { return addMentorToProjectModal; }).then((mod) => mod.AddMentorToProjectModal), { ssr: false });
217310
- function ProjectLandingPage({ project, sessionId, onSubmit, onScreenSharingClick, isScreenSharingModalOpen, onPhoneCallClick, stopGenerating, tenantKey, username, enableSafetyDisclaimer, enableWebBrowsing, isStreaming, updateSessionTools, setSessionTools, activeTools, screenSharing, deepResearch, studyMode, imageGeneration, codeInterpreter, promptsIsEnabled, isPreviewMode, setMessage, mentorId, mentorUniqueId, projectId, googleSlidesIsEnabled, googleDocumentIsEnabled, artifactsEnabled, userIsStudent, isPublicRoute, navigateToProject, }) {
217717
+ function ProjectLandingPage({ project, sessionId, onSubmit, onScreenSharingClick, isScreenSharingModalOpen, onPhoneCallClick, stopGenerating, tenantKey, username, enableSafetyDisclaimer, enableWebBrowsing, isStreaming, updateSessionTools, setSessionTools, activeTools, screenSharing, deepResearch, studyMode, imageGeneration, codeInterpreter, promptsIsEnabled, isPreviewMode, setMessage, mentorId, mentorUniqueId, projectId, googleSlidesIsEnabled, googleDocumentIsEnabled, artifactsEnabled, userIsStudent, isPublicRoute, navigateToProject, showExploreMentors = false, }) {
217311
217718
  var _a;
217312
217719
  const [isInstructionsModalOpen, setIsInstructionsModalOpen] = useState(false);
217313
217720
  const [isFilesModalOpen, setIsFilesModalOpen] = useState(false);
217314
217721
  const [isAddMentorModalOpen, setIsAddMentorModalOpen] = useState(false);
217315
217722
  // Hide "Add files" and "Add project instructions" if user is logged in and NOT a student
217316
217723
  const shouldHideFileAndInstructionSection = isLoggedIn() && !userIsStudent;
217317
- return (jsxs(Fragment$1, { children: [jsxs("div", { className: "mx-auto flex h-full w-full max-w-4xl flex-col", children: [jsxs("div", { className: "flex items-center justify-center gap-3 border-b border-gray-200 px-6 py-6", children: [jsx(OpenFolderIcon, { className: "h-7 w-7" }), jsx("h1", { className: "line-clamp-1 text-2xl font-semibold text-gray-900", children: project.name })] }), jsxs("div", { className: "flex-1 space-y-8 overflow-y-auto py-6", children: [jsx("div", { className: "w-full max-w-4xl", children: jsx(ChatInputForm, { sessionId: sessionId, onSubmit: onSubmit, stopGenerating: stopGenerating, onScreenSharingClick: onScreenSharingClick, isScreenSharingModalOpen: isScreenSharingModalOpen, onPhoneCallClick: onPhoneCallClick, mentorId: mentorId, tenantKey: tenantKey, username: username !== null && username !== void 0 ? username : '', isPublicRoute: isPublicRoute, userIsStudent: userIsStudent, setMessage: setMessage, enableSafetyDisclaimer: enableSafetyDisclaimer, isPreviewMode: isPreviewMode, enableWebBrowsing: enableWebBrowsing, isStreaming: isStreaming, updateSessionTools: updateSessionTools, setSessionTools: setSessionTools, activeTools: activeTools, screenSharing: screenSharing, deepResearch: deepResearch, studyMode: studyMode, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, promptsIsEnabled: promptsIsEnabled, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, artifactsEnabled: artifactsEnabled }) }), jsxs("div", { className: "space-y-8 rounded-lg bg-[#FBFBFB] p-6", children: [shouldHideFileAndInstructionSection && (jsx(ProjectActionButtons, { onFilesClick: () => setIsFilesModalOpen(true), onInstructionsClick: () => setIsInstructionsModalOpen(true), instructions: project.instructions, tenantKey: tenantKey, mentorId: mentorId, username: username })), project.mentors && project.mentors.length > 0 && (jsx(ProjectMentorsList, { projectMentors: (_a = project.mentors) === null || _a === void 0 ? void 0 : _a.map((mentor) => ({
217724
+ return (jsxs(Fragment$1, { children: [jsxs("div", { className: "mx-auto flex h-full w-full max-w-4xl flex-col", children: [jsxs("div", { className: "flex items-center justify-center gap-3 border-b border-gray-200 px-6 py-6", children: [jsx(OpenFolderIcon, { className: "h-7 w-7" }), jsx("h1", { className: "line-clamp-1 text-2xl font-semibold text-gray-900", children: project.name })] }), jsxs("div", { className: "flex-1 space-y-8 overflow-y-auto py-6", children: [jsx("div", { className: "w-full max-w-4xl", children: jsx(ChatInputForm, { sessionId: sessionId, onSubmit: onSubmit, stopGenerating: stopGenerating, onScreenSharingClick: onScreenSharingClick, isScreenSharingModalOpen: isScreenSharingModalOpen, onPhoneCallClick: onPhoneCallClick, mentorId: mentorId, tenantKey: tenantKey, username: username !== null && username !== void 0 ? username : '', isPublicRoute: isPublicRoute, userIsStudent: userIsStudent, setMessage: setMessage, enableSafetyDisclaimer: enableSafetyDisclaimer, isPreviewMode: isPreviewMode, enableWebBrowsing: enableWebBrowsing, isStreaming: isStreaming, updateSessionTools: updateSessionTools, setSessionTools: setSessionTools, activeTools: activeTools, screenSharing: screenSharing, deepResearch: deepResearch, studyMode: studyMode, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, promptsIsEnabled: promptsIsEnabled, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, artifactsEnabled: artifactsEnabled }) }), jsxs("div", { className: "space-y-8 rounded-lg bg-[#FBFBFB] p-6", children: [shouldHideFileAndInstructionSection && (jsx(ProjectActionButtons, { onFilesClick: () => setIsFilesModalOpen(true), onInstructionsClick: () => setIsInstructionsModalOpen(true), instructions: project.instructions, tenantKey: tenantKey, mentorId: mentorId, username: username })), showExploreMentors && project.mentors && project.mentors.length > 0 && (jsx(ProjectMentorsList, { projectMentors: (_a = project.mentors) === null || _a === void 0 ? void 0 : _a.map((mentor) => ({
217318
217725
  id: mentor.id.toString(),
217319
217726
  unique_id: mentor.unique_id,
217320
217727
  name: mentor.name,
@@ -217323,7 +217730,7 @@ function ProjectLandingPage({ project, sessionId, onSubmit, onScreenSharingClick
217323
217730
  })), onAddMentorClick: () => setIsAddMentorModalOpen(true), showTitle: true, tenantKey: tenantKey, mentorId: mentorId, projectId: projectId, username: username, navigateToProject: navigateToProject }))] })] })] }), isInstructionsModalOpen && (jsx(ProjectInstructionsModal$1, { isOpen: isInstructionsModalOpen, onClose: () => setIsInstructionsModalOpen(false), tenantKey: tenantKey, projectId: projectId, username: username })), isFilesModalOpen && (jsx(ProjectFilesModal$1, { isOpen: isFilesModalOpen, onClose: () => setIsFilesModalOpen(false), tenantKey: tenantKey, mentorId: mentorId, username: username })), isAddMentorModalOpen && (jsx(AddMentorToProjectModal$1, { isOpen: isAddMentorModalOpen, onClose: () => setIsAddMentorModalOpen(false), projectName: project.name, tenantKey: tenantKey, projectId: projectId, username: username, isPublicRoute: isPublicRoute }))] }));
217324
217731
  }
217325
217732
 
217326
- function WelcomeChatNew({ mentorName, sessionId, enabledGuidedPrompts, onSubmit, onScreenSharingClick, isScreenSharingModalOpen, onPhoneCallClick, stopGenerating, tenantKey, mainTenantKey, username, enableWebBrowsing, setMessage, isStreaming, enableSafetyDisclaimer, isPreviewMode, updateSessionTools, setSessionTools, activeTools, screenSharing, deepResearch, studyMode, imageGeneration, codeInterpreter, mentorId, mentorUniqueId, projectId, profileImage, promptsIsEnabled, googleSlidesIsEnabled, googleDocumentIsEnabled, artifactsEnabled, userIsStudent, welcomeWsUrl, isPublicRoute, appSyncBanner, onBrowseAllMentors, onSelectMentor, projectNavigation, chatAreaMaxWidth = CHAT_AREA_SIZE.DEFAULT, isNewSession = true, aiWelcomeMessage = '', isConnecting = false, compactMode = false, showConversationStarters = true, showExploreMentors = true, }) {
217733
+ function WelcomeChatNew({ mentorName, sessionId, enabledGuidedPrompts, onSubmit, onScreenSharingClick, isScreenSharingModalOpen, onPhoneCallClick, stopGenerating, tenantKey, mainTenantKey, username, enableWebBrowsing, setMessage, isStreaming, enableSafetyDisclaimer, isPreviewMode, updateSessionTools, setSessionTools, activeTools, screenSharing, deepResearch, studyMode, imageGeneration, codeInterpreter, mentorId, mentorUniqueId, projectId, profileImage, promptsIsEnabled, googleSlidesIsEnabled, googleDocumentIsEnabled, artifactsEnabled, userIsStudent, welcomeWsUrl, isPublicRoute, appSyncBanner, onBrowseAllMentors, onSelectMentor, projectNavigation, chatAreaMaxWidth = CHAT_AREA_SIZE.DEFAULT, isNewSession = true, aiWelcomeMessage = '', isConnecting = false, compactMode = false, showConversationStarters = false, showExploreMentors = false, }) {
217327
217734
  var _a;
217328
217735
  const embedMode = useEmbedMode();
217329
217736
  const axdToken = useAxdToken();
@@ -217341,7 +217748,7 @@ function WelcomeChatNew({ mentorName, sessionId, enabledGuidedPrompts, onSubmit,
217341
217748
  if (!project) {
217342
217749
  return null;
217343
217750
  }
217344
- return (jsx(ProjectLandingPage, { project: project, mentorName: mentorName, sessionId: sessionId, enabledGuidedPrompts: enabledGuidedPrompts, onSubmit: onSubmit, onScreenSharingClick: onScreenSharingClick, isScreenSharingModalOpen: isScreenSharingModalOpen, onPhoneCallClick: onPhoneCallClick, stopGenerating: stopGenerating, tenantKey: tenantKey, username: username, enableSafetyDisclaimer: enableSafetyDisclaimer, enableWebBrowsing: enableWebBrowsing, isStreaming: isStreaming, updateSessionTools: updateSessionTools, setSessionTools: setSessionTools, activeTools: activeTools, screenSharing: screenSharing, deepResearch: deepResearch, studyMode: studyMode, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, promptsIsEnabled: promptsIsEnabled, isPreviewMode: isPreviewMode, setMessage: setMessage, mentorId: mentorId, mentorUniqueId: mentorUniqueId, projectId: projectId, profileImage: profileImage, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, artifactsEnabled: artifactsEnabled, userIsStudent: userIsStudent, isPublicRoute: isPublicRoute, navigateToProject: (_a = projectNavigation === null || projectNavigation === void 0 ? void 0 : projectNavigation.navigateToProject) !== null && _a !== void 0 ? _a : (() => { }) }));
217751
+ return (jsx(ProjectLandingPage, { project: project, mentorName: mentorName, sessionId: sessionId, enabledGuidedPrompts: enabledGuidedPrompts, onSubmit: onSubmit, onScreenSharingClick: onScreenSharingClick, isScreenSharingModalOpen: isScreenSharingModalOpen, onPhoneCallClick: onPhoneCallClick, stopGenerating: stopGenerating, tenantKey: tenantKey, username: username, enableSafetyDisclaimer: enableSafetyDisclaimer, enableWebBrowsing: enableWebBrowsing, isStreaming: isStreaming, updateSessionTools: updateSessionTools, setSessionTools: setSessionTools, activeTools: activeTools, screenSharing: screenSharing, deepResearch: deepResearch, studyMode: studyMode, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, promptsIsEnabled: promptsIsEnabled, isPreviewMode: isPreviewMode, setMessage: setMessage, mentorId: mentorId, mentorUniqueId: mentorUniqueId, projectId: projectId, showExploreMentors: showExploreMentors, profileImage: profileImage, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, artifactsEnabled: artifactsEnabled, userIsStudent: userIsStudent, isPublicRoute: isPublicRoute, navigateToProject: (_a = projectNavigation === null || projectNavigation === void 0 ? void 0 : projectNavigation.navigateToProject) !== null && _a !== void 0 ? _a : (() => { }) }));
217345
217752
  }
217346
217753
  return (jsx("div", { className: "overflow-y-auto", children: jsxs("div", { className: "w-full py-6", children: [tenantKey === mainTenantKey && appSyncBanner && (jsx(AppSyncBanner, { badge: appSyncBanner.badge, text: appSyncBanner.text, link: appSyncBanner.link, linkText: appSyncBanner.linkText })), jsxs("div", { className: "mb-8 flex flex-col items-center", children: [jsx("div", { className: "mb-6 flex items-center gap-3", children: jsx("h1", { className: "bg-gradient-to-r from-[#38A1E5] to-[#7284FF] bg-clip-text text-center text-3xl font-bold text-transparent", children: mentorName }) }), jsx("div", { className: "mb-6 text-center", children: jsx(WelcomeMessage, { aiWelcomeMessage: aiWelcomeMessage, sessionId: sessionId, username: username, tenantKey: tenantKey, mentorId: mentorId, mentorUniqueId: mentorUniqueId, token: axdToken, welcomeWsUrl: welcomeWsUrl, isPublicRoute: isPublicRoute, isNewSession: isNewSession }) }), jsx("div", { className: "w-full", style: { maxWidth: `${chatAreaMaxWidth}px` }, children: jsx(ChatInputForm, { sessionId: sessionId, onSubmit: onSubmit, stopGenerating: stopGenerating, onScreenSharingClick: onScreenSharingClick, isScreenSharingModalOpen: isScreenSharingModalOpen, onPhoneCallClick: onPhoneCallClick, mentorId: mentorId, tenantKey: tenantKey, username: username !== null && username !== void 0 ? username : '', isPublicRoute: isPublicRoute, userIsStudent: userIsStudent, setMessage: setMessage, enableSafetyDisclaimer: enableSafetyDisclaimer, isPreviewMode: isPreviewMode, enableWebBrowsing: enableWebBrowsing, isStreaming: isStreaming, updateSessionTools: updateSessionTools, setSessionTools: setSessionTools, activeTools: activeTools, screenSharing: screenSharing, deepResearch: deepResearch, studyMode: studyMode, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, promptsIsEnabled: promptsIsEnabled, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, artifactsEnabled: artifactsEnabled, isConnecting: isConnecting, compactMode: compactMode }) })] }), showConversationStarters && (jsx("div", { className: "mb-12", children: jsx(ConversationStarters, { onTemplateSelect: onSubmit, enabledGuidedPrompts: enabledGuidedPrompts, sessionId: sessionId, mentorId: mentorId, tenantKey: tenantKey, isPublicRoute: isPublicRoute }) })), showExploreMentors && (jsx("div", { className: "mb-12", children: jsx(ExploreMentors, { tenantKey: tenantKey, onBrowseAll: onBrowseAllMentors, onSelectMentor: onSelectMentor }) }))] }) }));
217347
217754
  }
@@ -217457,7 +217864,7 @@ const CODE_FILE_EXTENSIONS = new Set([
217457
217864
  'css',
217458
217865
  'sh',
217459
217866
  ]);
217460
- function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInCanvasView = false, config, redirectToAuthSpa, username, userTenants, visitingTenant, axdToken, mentorId, tenantKey, userIsStudent, isPublicRoute, showConversationStarters = true, showExploreMentors = true, }) {
217867
+ function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInCanvasView = false, config, redirectToAuthSpa, username, userTenants, visitingTenant, axdToken, mentorId, tenantKey, userIsStudent, isPublicRoute, showConversationStarters = false, showExploreMentors = false, projectId, }) {
217461
217868
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
217462
217869
  const { metadata } = useTenantContext();
217463
217870
  const isAccessingPublicRoute = useAccessingPublicRoute();
@@ -218462,7 +218869,7 @@ function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInC
218462
218869
  return;
218463
218870
  }
218464
218871
  setIsPhoneCallModalOpen(true);
218465
- }, stopGenerating: stopGenerating, tenantKey: tenantKey, username: username !== null && username !== void 0 ? username : '', enableWebBrowsing: enableWebBrowsing, setMessage: setMessage, isStreaming: isStreaming, enableSafetyDisclaimer: enableSafetyDisclaimer, isPreviewMode: isPreviewMode, updateSessionTools: updateSessionTools, setSessionTools: setSessionTools, activeTools: activeTools, screenSharing: screenSharing, deepResearch: deepResearch, studyMode: studyMode, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, mentorId: mentorId, mentorUniqueId: mentorId, mainTenantKey: config.mainTenantKey, welcomeWsUrl: `${config.baseWsUrl()}/ws/langflow/`, userIsStudent: userIsStudent, isPublicRoute: isPublicRoute, appSyncBanner: config.appSyncBanner, onBrowseAllMentors: config.navigateToExplore, onSelectMentor: config.navigateToMentor, profileImage: profileImage, promptsIsEnabled: promptsIsEnabled, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, artifactsEnabled: artifactsEnabled, chatAreaMaxWidth: chatAreaMaxWidth, isConnecting: !isConnected, compactMode: isCompactMode, showConversationStarters: showConversationStarters, showExploreMentors: showExploreMentors }))] }), isCanvasOpen && !isInCanvasView ? (
218872
+ }, stopGenerating: stopGenerating, tenantKey: tenantKey, username: username !== null && username !== void 0 ? username : '', enableWebBrowsing: enableWebBrowsing, setMessage: setMessage, isStreaming: isStreaming, enableSafetyDisclaimer: enableSafetyDisclaimer, isPreviewMode: isPreviewMode, updateSessionTools: updateSessionTools, setSessionTools: setSessionTools, activeTools: activeTools, screenSharing: screenSharing, deepResearch: deepResearch, studyMode: studyMode, imageGeneration: imageGeneration, codeInterpreter: codeInterpreter, mentorId: mentorId, mentorUniqueId: mentorId, projectId: projectId, mainTenantKey: config.mainTenantKey, welcomeWsUrl: `${config.baseWsUrl()}/ws/langflow/`, userIsStudent: userIsStudent, isPublicRoute: isPublicRoute, appSyncBanner: config.appSyncBanner, onBrowseAllMentors: config.navigateToExplore, onSelectMentor: config.navigateToMentor, profileImage: profileImage, promptsIsEnabled: promptsIsEnabled, googleSlidesIsEnabled: googleSlidesIsEnabled, googleDocumentIsEnabled: googleDocumentIsEnabled, artifactsEnabled: artifactsEnabled, chatAreaMaxWidth: chatAreaMaxWidth, isConnecting: !isConnected, compactMode: isCompactMode, showConversationStarters: showConversationStarters, showExploreMentors: showExploreMentors }))] }), isCanvasOpen && !isInCanvasView ? (
218466
218873
  /* Split layout when canvas is open */
218467
218874
  jsxs("div", { className: "relative flex flex-1 overflow-hidden", ref: resizeRef, style: { minHeight: 0, maxHeight: '100%', height: '100%' }, children: [jsxs("div", { className: "hidden flex-shrink-0 flex-col overflow-hidden border-r border-gray-200 md:flex", style: { width: `${chatWidth}%`, minHeight: 0, maxHeight: '100%' }, children: [jsx("div", { ref: chatContainerRef, onScroll: handleScroll, className: "flex-1 overflow-y-auto [scrollbar-gutter:stable]", children: jsx("div", { className: "px-3 py-4", children: jsxs(ErrorBoundary, { children: [messages.length > 0 ? (jsx(ChatMessages, { ref: lastAIMessageCopyButtonRef, messages: messages, highlightedMessageId: highlightedMessageId, profileImage: profileImage, mentorName: mentorName, sessionId: sessionId, mentorId: mentorId, tenantKey: tenantKey, supportEmail: (metadata === null || metadata === void 0 ? void 0 : metadata.support_email) || config.supportEmail(), authUrl: config.authUrl(), handleHighlightMessage: handleHighlightMessage, handleSubmit: handleSubmit, onReply: (message) => {
218468
218875
  setReplyingToMessage(message);
@@ -218661,7 +219068,10 @@ function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInC
218661
219068
  }
218662
219069
 
218663
219070
  function TasksTabToolbar({ taskDate, setTaskDate, setIsScheduleTaskDialogOpen, searchQuery, setSearchQuery, labels, }) {
218664
- return (jsxs("div", { className: "flex flex-col sm:flex-row items-center gap-4", children: [jsxs("div", { className: "relative flex-1 w-full", children: [jsx(Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500" }), jsx(Input, { className: "pl-10 w-full", placeholder: labels.toolbar.searchPlaceholder, value: searchQuery, onChange: (e) => setSearchQuery(e.target.value) })] }), jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "outline", className: "flex items-center gap-2 justify-start w-full sm:w-auto bg-transparent", children: [jsx(Calendar$1, { className: "h-4 w-4" }), jsx("span", { children: taskDate ? format(taskDate, 'MM/dd/yyyy') : labels.toolbar.selectDate })] }) }), jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: jsx(Calendar, { mode: "single", selected: taskDate, onSelect: setTaskDate, initialFocus: true }) })] }), jsxs(Button$1, { className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white font-medium w-full sm:w-auto", onClick: () => setIsScheduleTaskDialogOpen(true), children: [jsx(Plus, { className: "h-4 w-4 mr-2" }), labels.toolbar.scheduleTask] })] }));
219071
+ return (jsxs("div", { className: "flex flex-col sm:flex-row items-center gap-4", children: [jsxs("div", { className: "relative flex-1 w-full", children: [jsx(Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500" }), jsx(Input, { className: "pl-10 w-full", placeholder: labels.toolbar.searchPlaceholder, value: searchQuery, onChange: (e) => setSearchQuery(e.target.value) })] }), jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "outline", className: "flex items-center gap-2 justify-start w-full sm:w-auto bg-transparent", children: [jsx(Calendar$1, { className: "h-4 w-4" }), jsx("span", { children: taskDate ? format(taskDate, 'MM/dd/yyyy') : labels.toolbar.selectDate })] }) }), jsx(PopoverContent, { className: "w-auto p-0", align: "start", portalled: false, children: jsx(Calendar, { mode: "single", selected: taskDate, onSelect: setTaskDate, classNames: {
219072
+ day_button: 'data-[selected-single=true]:bg-[#2563EB] data-[selected-single=true]:text-white data-[range-start=true]:bg-[#2563EB] data-[range-start=true]:text-white data-[range-end=true]:bg-[#2563EB] data-[range-end=true]:text-white',
219073
+ today: 'bg-blue-50 text-[#2563EB] data-[selected=true]:bg-[#2563EB] data-[selected=true]:text-white',
219074
+ }, initialFocus: true }) })] }), jsxs(Button$1, { className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white font-medium w-full sm:w-auto", onClick: () => setIsScheduleTaskDialogOpen(true), children: [jsx(Plus, { className: "h-4 w-4 mr-2" }), labels.toolbar.scheduleTask] })] }));
218665
219075
  }
218666
219076
 
218667
219077
  function TaskMetricsCards({ tasksData, labels }) {
@@ -219116,6 +219526,21 @@ function combineDateAndTime(date, time) {
219116
219526
  result.setHours(hour, minute, 0, 0);
219117
219527
  return result;
219118
219528
  }
219529
+ const TASK_DATE_FILTER_FORMAT = 'yyyy-MM-dd';
219530
+ function formatTaskDateFilter(date) {
219531
+ return format(date, TASK_DATE_FILTER_FORMAT);
219532
+ }
219533
+ function getTaskDateFilterValue(task) {
219534
+ var _a, _b;
219535
+ const rawData = task.rawData;
219536
+ const rawDate = (_b = (_a = rawData === null || rawData === void 0 ? void 0 : rawData.task) === null || _a === void 0 ? void 0 : _a.start_time) !== null && _b !== void 0 ? _b : rawData === null || rawData === void 0 ? void 0 : rawData.created_at;
219537
+ if (!rawDate)
219538
+ return undefined;
219539
+ const date = new Date(rawDate);
219540
+ if (Number.isNaN(date.getTime()))
219541
+ return undefined;
219542
+ return formatTaskDateFilter(date);
219543
+ }
219119
219544
  function AgentTasksTab({ PaginationComponent = DefaultTasksPagination, labels: labelsOverride, }) {
219120
219545
  var _a, _b, _c;
219121
219546
  const { tenantKey, mentorId, username } = useAgentSettings();
@@ -219133,11 +219558,18 @@ function AgentTasksTab({ PaginationComponent = DefaultTasksPagination, labels: l
219133
219558
  const [debouncedSearchQuery] = a$3(searchQuery, 300);
219134
219559
  const tasksPerPage = 5;
219135
219560
  const logsPerPage = 5;
219561
+ const taskSearchFilterValue = debouncedSearchQuery.trim();
219562
+ const taskDateFilterValue = useMemo(() => (taskDate ? formatTaskDateFilter(taskDate) : undefined), [taskDate]);
219136
219563
  // Fetch periodic agents
219137
219564
  const { data: periodicAgentsData, isLoading } = useGetPeriodicAgentsQuery({
219138
219565
  org: tenantKey,
219139
219566
  // @ts-ignore - userId is not part of the generated query arg type
219140
219567
  userId: username,
219568
+ mentorId,
219569
+ ...(taskDateFilterValue
219570
+ ? { startDate: taskDateFilterValue, endDate: taskDateFilterValue }
219571
+ : {}),
219572
+ ...(taskSearchFilterValue ? { search: taskSearchFilterValue } : {}),
219141
219573
  }, {
219142
219574
  skip: !tenantKey || !username || !mentorId,
219143
219575
  });
@@ -219205,16 +219637,13 @@ function AgentTasksTab({ PaginationComponent = DefaultTasksPagination, labels: l
219205
219637
  rawData: agent,
219206
219638
  };
219207
219639
  })) || [];
219208
- // Filter tasks based on debounced search query
219640
+ // The text search is sent to the API; date filtering stays local as a
219641
+ // fallback for API responses that return the full page.
219209
219642
  const filteredTasks = useMemo(() => {
219210
- if (!debouncedSearchQuery.trim())
219211
- return tasksData;
219212
- const query = debouncedSearchQuery.toLowerCase();
219213
- return tasksData.filter((task) => task.name.toLowerCase().includes(query) ||
219214
- task.time.toLowerCase().includes(query) ||
219215
- task.repeat.toLowerCase().includes(query) ||
219216
- task.status.toLowerCase().includes(query));
219217
- }, [tasksData, debouncedSearchQuery]);
219643
+ return taskDateFilterValue
219644
+ ? tasksData.filter((task) => getTaskDateFilterValue(task) === taskDateFilterValue)
219645
+ : tasksData;
219646
+ }, [tasksData, taskDateFilterValue]);
219218
219647
  // Transform logs data for UI display
219219
219648
  const taskLogs = ((_b = periodicAgentLogsData === null || periodicAgentLogsData === void 0 ? void 0 : periodicAgentLogsData.results) === null || _b === void 0 ? void 0 : _b.map((log) => ({
219220
219649
  id: log.id.toString(),
@@ -219225,10 +219654,10 @@ function AgentTasksTab({ PaginationComponent = DefaultTasksPagination, labels: l
219225
219654
  startTime: log.start_time,
219226
219655
  endTime: log.end_time,
219227
219656
  }))) || [];
219228
- // Reset to page 1 when search query changes
219657
+ // Reset to page 1 when filters change
219229
219658
  useEffect(() => {
219230
219659
  setTasksCurrentPage(1);
219231
- }, [debouncedSearchQuery]);
219660
+ }, [taskSearchFilterValue, taskDateFilterValue]);
219232
219661
  // Reset logs pagination when the selected task changes
219233
219662
  useEffect(() => {
219234
219663
  setLogsCurrentPage(1);
@@ -221241,91 +221670,6 @@ var projectFilesModal = /*#__PURE__*/Object.freeze({
221241
221670
  ProjectFilesModal: ProjectFilesModal
221242
221671
  });
221243
221672
 
221244
- function useMentorsWithPagination({ tenantKey, itemsPerPage = 5, }) {
221245
- const username = useUsername();
221246
- const [searchQuery, setSearchQuery] = React__default.useState('');
221247
- const [debouncedSearchQuery] = a$3(searchQuery, 500);
221248
- const [currentPage, setCurrentPage] = React__default.useState(1);
221249
- const [queryParams, setQueryParams] = React__default.useState({
221250
- limit: itemsPerPage,
221251
- offset: 0,
221252
- query: debouncedSearchQuery,
221253
- orderBy: 'created_at',
221254
- orderDirection: 'desc',
221255
- });
221256
- const { data: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, error: mentorsError, } = useGetMentorsQuery({
221257
- org: tenantKey,
221258
- username: username !== null && username !== void 0 ? username : '',
221259
- ...queryParams,
221260
- }, {
221261
- skip: !tenantKey || !username,
221262
- refetchOnMountOrArgChange: true,
221263
- });
221264
- const { data: publicMentors, isLoading: isPublicMentorsLoading, isFetching: isPublicMentorsFetching, error: publicMentorsError, } = useGetPublicMentorsQuery({ ...queryParams }, {
221265
- skip: !!username,
221266
- refetchOnMountOrArgChange: true,
221267
- });
221268
- // Effect to update offset when page changes
221269
- React__default.useEffect(() => {
221270
- setQueryParams((prev) => ({
221271
- ...prev,
221272
- offset: (currentPage - 1) * itemsPerPage,
221273
- }));
221274
- }, [currentPage, itemsPerPage]);
221275
- // Effect to update query parameter when search changes
221276
- React__default.useEffect(() => {
221277
- setQueryParams((prev) => ({
221278
- ...prev,
221279
- query: debouncedSearchQuery,
221280
- offset: 0, // Reset to first page when search changes
221281
- }));
221282
- setCurrentPage(1); // Also reset current page state
221283
- }, [debouncedSearchQuery]);
221284
- const handlePageChange = (newPage) => {
221285
- setCurrentPage(newPage);
221286
- // Scroll to top of the list when changing pages
221287
- window.scrollTo({ top: 0, behavior: 'smooth' });
221288
- };
221289
- // Calculate total pages based on count and limit
221290
- const mentorsTotalPages = mentors ? Math.ceil(mentors.count / itemsPerPage) : 0;
221291
- const publicMentorsTotalPages = publicMentors ? Math.ceil(publicMentors.count / itemsPerPage) : 0;
221292
- const totalPages = username ? mentorsTotalPages : publicMentorsTotalPages;
221293
- return {
221294
- mentors: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.results) || [] : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.results) || [],
221295
- totalCount: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.count) || 0 : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.count) || 0,
221296
- isLoading: username ? isMentorsLoading : isPublicMentorsLoading,
221297
- isFetching: username ? isMentorsFetching : isPublicMentorsFetching,
221298
- error: username ? mentorsError : publicMentorsError,
221299
- searchQuery,
221300
- setSearchQuery,
221301
- currentPage,
221302
- totalPages,
221303
- handlePageChange,
221304
- queryParams,
221305
- itemsPerPage,
221306
- };
221307
- }
221308
-
221309
- function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
221310
- const { mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } = useMentorsWithPagination({ tenantKey, itemsPerPage });
221311
- // Update search query with debounce effect handled by the hook
221312
- React__default.useEffect(() => {
221313
- setMentorSearch(searchQuery);
221314
- }, [searchQuery]);
221315
- const isMentorSelected = (mentorId) => {
221316
- return selectedMentorIds.includes(mentorId);
221317
- };
221318
- return (jsxs("div", { className: "space-y-4", children: [showSearch && (jsxs("div", { className: "relative", children: [isMentorsFetching ? (jsx(Spinner, { className: "absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-gray-400" })) : (jsx(Search, { className: "absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-gray-400" })), jsx(Input, { placeholder: "Search Agents", value: searchQuery, onChange: (e) => onSearchChange(e.target.value), className: "h-10 border-gray-200 pl-10 focus:border-blue-500 focus:ring-0" })] })), jsxs("div", { className: "space-y-4", children: [jsx("div", { className: "grid max-h-96 auto-rows-min grid-cols-1 items-start gap-3 overflow-y-auto rounded-lg border border-gray-200 p-4 md:max-h-none md:grid-cols-2", style: { minHeight }, children: isMentorsLoading ? (jsx("div", { className: "col-span-full py-8 text-center text-gray-500", children: "Loading agents..." })) : mentors.length === 0 ? (jsx("div", { className: "col-span-full py-8 text-center text-gray-500", children: "No agents found matching your search." })) : (mentors.map((mentor) => {
221319
- const isSelected = isMentorSelected(mentor.unique_id || '');
221320
- const isAlreadyAdded = selectedMentorIds.includes(mentor.unique_id || '');
221321
- return (jsxs("button", { onClick: () => onMentorSelect(mentor), className: `flex cursor-pointer items-center gap-3 rounded-lg border-2 p-3 transition-all ${isSelected
221322
- ? 'border-blue-500 bg-blue-50'
221323
- : isAlreadyAdded
221324
- ? 'bg-blue-25 border-blue-300'
221325
- : 'border-gray-200 hover:border-gray-300 hover:bg-gray-50'}`, children: [jsxs(Avatar, { className: "h-12 w-12 flex-shrink-0", children: [jsx(AvatarImage, { src: mentor.profile_image || '/placeholder.svg', alt: mentor.name }), jsx(AvatarFallback, { children: mentor.name.substring(0, 2) })] }), jsxs("div", { className: "flex min-w-0 flex-1 flex-col justify-start text-left", children: [jsx("h4", { className: "truncate text-sm font-medium text-gray-900", children: mentor.name }), jsx("p", { className: "line-clamp-2 text-xs text-gray-600", children: mentor.description })] }), isSelected && (jsx("div", { className: "flex-shrink-0", children: jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-blue-600", children: jsx(Check, { className: "h-4 w-4 text-white" }) }) })), isAlreadyAdded && !isSelected && (jsx("div", { className: "flex-shrink-0", children: jsx("div", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-blue-400", children: jsx(Check, { className: "h-4 w-4 text-white" }) }) }))] }, mentor.unique_id));
221326
- })) }), jsx(IblPagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: handlePageChange, disabled: isMentorsFetching || isMentorsLoading })] })] }));
221327
- }
221328
-
221329
221673
  function AddMentorToProjectModal({ isOpen, onClose, projectName, tenantKey, projectId, username, }) {
221330
221674
  var _a;
221331
221675
  const [updateProject] = useUpdateUserProjectMutation();
@@ -268371,5 +268715,5 @@ var index_es = /*#__PURE__*/Object.freeze({
268371
268715
  vectorsRatio: vectorsRatio
268372
268716
  });
268373
268717
 
268374
- export { AGENT_ACCESS_TAB_LABELS, AGENT_API_TAB_LABELS, AGENT_DATASETS_TAB_LABELS, AGENT_DISCLAIMERS_TAB_LABELS, AGENT_EMBED_TAB_LABELS, AGENT_HISTORY_TAB_LABELS, AGENT_LLM_TAB_LABELS, AGENT_MEMORY_TAB_LABELS, AGENT_PICKER_LABELS, AGENT_PRIVACY_TAB_LABELS, AGENT_PROMPTS_TAB_LABELS, AGENT_SAFETY_TAB_LABELS, AGENT_SEARCH_LABELS, AGENT_SETTINGS_TAB_LABELS, AGENT_TASKS_TAB_LABELS, AGENT_TOOLS_TAB_LABELS, Account, AgentAccessTab, AgentApiTab, AgentCard, AgentDatasetsTab, AgentDisclaimersTab, AgentEmbedTab, AgentEmptyState, AgentHistoryTab, AgentLLMTab, AgentMemoryTab, AgentPrivacyTab, AgentPromptsTab, AgentSafetyTab, AgentSearch, AgentSearchFilters, AgentSearchInput, AgentSettingsProvider, AgentSettingsTab, AgentTasksTab, AgentToolsTab, AppSidebar, Chat, ClientErrorPage, ConversationStarters$1 as ConversationStarters, CopyButton, CopyMentorModal, CourseBox, CourseContentLayout, CourseContentTabPage, CreatePathwayModal, CredentialDetailModal, CredentialMiniBox, DeleteMentorModal, EMPTY_PROGRAM_SETTINGS_FORM, EdxIframe, ErrorPage, GreetingMethod, McpTab, MediaBox, NavBar, OrganizationTab, PathwayDetailModal, ProfileInfoCards, ProfileTabs, ProgramDetailModal, SsoLogin, StarButton, UserProfileDropdown, UserProfileModal, formatDateString, getLLMProviderDetails, initializeLocalStorageWithObject, resolveAgentPickerLabels, resolveAgentSearchLabels, resolveSettingsTabLabels, useAgentSearch, useAgentSearchWithPagination, useAgentSettings, useAgentStar, useGetChatDetails, useTimeTracker };
268718
+ export { AGENT_ACCESS_TAB_LABELS, AGENT_API_TAB_LABELS, AGENT_DATASETS_TAB_LABELS, AGENT_DISCLAIMERS_TAB_LABELS, AGENT_EMBED_TAB_LABELS, AGENT_HISTORY_TAB_LABELS, AGENT_LLM_TAB_LABELS, AGENT_MEMORY_TAB_LABELS, AGENT_PICKER_LABELS, AGENT_PRIVACY_TAB_LABELS, AGENT_PROMPTS_TAB_LABELS, AGENT_SAFETY_TAB_LABELS, AGENT_SEARCH_LABELS, AGENT_SETTINGS_TAB_LABELS, AGENT_TASKS_TAB_LABELS, AGENT_TOOLS_TAB_LABELS, Account, AgentAccessTab, AgentApiTab, AgentCard, AgentDatasetsTab, AgentDisclaimersTab, AgentEmbedTab, AgentEmptyState, AgentHistoryTab, AgentLLMTab, AgentMemoryTab, AgentPrivacyTab, AgentPromptsTab, AgentSafetyTab, AgentSearch, AgentSearchFilters, AgentSearchInput, AgentSettingsProvider, AgentSettingsTab, AgentTasksTab, AgentToolsTab, AppSidebar, Chat, ClientErrorPage, ConversationStarters$1 as ConversationStarters, CopyButton, CopyMentorModal, CourseBox, CourseContentLayout, CourseContentTabPage, CreatePathwayModal, CreateProjectModal, CredentialDetailModal, CredentialMiniBox, DeleteMentorModal, DeleteProjectModal, EMPTY_PROGRAM_SETTINGS_FORM, EdxIframe, ErrorPage, GreetingMethod, McpTab, MediaBox, MentorSelectionGrid, NavBar, OrganizationTab, PathwayDetailModal, ProfileInfoCards, ProfileTabs, ProgramDetailModal, ProjectsSidebarDropdown, RenameProjectModal, SidebarInset, SidebarProvider, SidebarTrigger, SsoLogin, StarButton, UserProfileDropdown, UserProfileModal, formatDateString, getLLMProviderDetails, initializeLocalStorageWithObject, resolveAgentPickerLabels, resolveAgentSearchLabels, resolveSettingsTabLabels, useAgentSearch, useAgentSearchWithPagination, useAgentSettings, useAgentStar, useGetChatDetails, useSidebar, useTimeTracker };
268375
268719
  //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/iblai-js",
3
- "version": "1.11.4",
3
+ "version": "1.11.7",
4
4
  "description": "Unified JavaScript SDK for IBL.ai — re-exports data-layer, web-containers, and web-utils under a single package",
5
5
  "type": "module",
6
6
  "engines": {
@@ -61,10 +61,10 @@
61
61
  "axios": "1.13.6",
62
62
  "dotenv": "16.6.1",
63
63
  "winston": "3.19.0",
64
- "@iblai/mcp": "1.4.14",
65
- "@iblai/data-layer": "1.5.10",
66
- "@iblai/web-containers": "1.7.4",
67
- "@iblai/web-utils": "1.7.1"
64
+ "@iblai/web-containers": "1.7.7",
65
+ "@iblai/web-utils": "1.7.1",
66
+ "@iblai/data-layer": "1.5.11",
67
+ "@iblai/mcp": "1.4.14"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@radix-ui/react-dialog": "^1.1.7",