@hydralms/components 0.3.0 → 0.3.1
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.
- package/dist/StudentProfile-BPsZBaJj.cjs +1 -0
- package/dist/{StudentProfile-DeMxdrL3.js → StudentProfile-Cw2p-RZn.js} +577 -579
- package/dist/index.cjs +1 -1
- package/dist/index.js +172 -166
- package/dist/license/index.d.ts +2 -2
- package/dist/license/tiers.d.ts +3 -0
- package/dist/modules.cjs +1 -1
- package/dist/modules.js +111 -110
- package/dist/sections/AdaptiveLearningPath/AdaptiveLearningPath.d.ts +5 -0
- package/dist/sections/AdaptiveLearningPath/path-connector.d.ts +8 -0
- package/dist/sections/AdaptiveLearningPath/path-milestone-marker.d.ts +7 -0
- package/dist/sections/AdaptiveLearningPath/path-node-card.d.ts +10 -0
- package/dist/sections/AdaptiveLearningPath/path-skill-bar.d.ts +8 -0
- package/dist/sections/AdaptiveLearningPath/types.d.ts +136 -0
- package/dist/sections/ContentAuthoringStudio/ContentAuthoringStudio.d.ts +5 -0
- package/dist/sections/ContentAuthoringStudio/block-editor-item.d.ts +14 -0
- package/dist/sections/ContentAuthoringStudio/block-type-picker.d.ts +12 -0
- package/dist/sections/ContentAuthoringStudio/types.d.ts +67 -0
- package/dist/sections/index.d.ts +4 -0
- package/dist/sections.cjs +1 -1
- package/dist/sections.js +1325 -232
- package/dist/withProGate-BJdu1T9Y.cjs +2 -0
- package/dist/withProGate-BvFc7Jwy.js +4975 -0
- package/package.json +24 -7
- package/src/license/index.ts +2 -2
- package/src/license/tiers.ts +12 -2
- package/src/modules/CoursePlayer/CoursePlayer.tsx +3 -1
- package/src/progress/stat-card.tsx +10 -5
- package/src/sections/AdaptiveLearningPath/AdaptiveLearningPath.tsx +251 -0
- package/src/sections/AdaptiveLearningPath/path-connector.tsx +27 -0
- package/src/sections/AdaptiveLearningPath/path-milestone-marker.tsx +50 -0
- package/src/sections/AdaptiveLearningPath/path-node-card.tsx +166 -0
- package/src/sections/AdaptiveLearningPath/path-skill-bar.tsx +49 -0
- package/src/sections/AdaptiveLearningPath/types.ts +159 -0
- package/src/sections/ContentAuthoringStudio/ContentAuthoringStudio.tsx +289 -0
- package/src/sections/ContentAuthoringStudio/block-editor-item.tsx +487 -0
- package/src/sections/ContentAuthoringStudio/block-type-picker.tsx +123 -0
- package/src/sections/ContentAuthoringStudio/types.ts +67 -0
- package/src/sections/ForumBoard/ForumBoard.tsx +8 -6
- package/src/sections/LessonPage/LessonPage.tsx +4 -7
- package/src/sections/index.ts +18 -0
- package/src/video/video-player.tsx +14 -5
- package/dist/StudentProfile-BVfZMbnV.cjs +0 -1
- package/dist/tabs-BsfVo2Bl.cjs +0 -173
- package/dist/tabs-BuY1iNJE.js +0 -22305
- package/dist/withProGate-BWqcKdPM.js +0 -137
- package/dist/withProGate-DX6XqKLp.cjs +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PathNodeStatus } from './types';
|
|
2
|
+
interface PathConnectorProps {
|
|
3
|
+
/** Status of the node above this connector */
|
|
4
|
+
fromStatus: PathNodeStatus;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function PathConnector({ fromStatus, className }: PathConnectorProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PathMilestone } from './types';
|
|
2
|
+
interface PathMilestoneMarkerProps {
|
|
3
|
+
milestone: PathMilestone;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function PathMilestoneMarker({ milestone, className, }: PathMilestoneMarkerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PathNode } from './types';
|
|
2
|
+
interface PathNodeCardProps {
|
|
3
|
+
node: PathNode;
|
|
4
|
+
onClick?: (uid: string) => void;
|
|
5
|
+
onStart?: (uid: string) => void;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const PathNodeCard: import('react').NamedExoticComponent<PathNodeCardProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Status of a single node in the learning path.
|
|
4
|
+
* - `locked` — prerequisites not met, node is inaccessible
|
|
5
|
+
* - `available` — prerequisites met, learner can start
|
|
6
|
+
* - `in_progress` — learner is currently working on this node
|
|
7
|
+
* - `completed` — learner finished but below mastery threshold
|
|
8
|
+
* - `mastered` — learner finished and reached the mastery threshold
|
|
9
|
+
* - `skipped` — node was bypassed by the adaptive engine
|
|
10
|
+
*/
|
|
11
|
+
export type PathNodeStatus = "locked" | "available" | "in_progress" | "completed" | "mastered" | "skipped";
|
|
12
|
+
/**
|
|
13
|
+
* The type of learning activity a path node represents.
|
|
14
|
+
* Aligns with LearningObjectIcon type strings.
|
|
15
|
+
*/
|
|
16
|
+
export type PathNodeType = "lesson" | "quiz" | "assignment" | "video" | "discussion" | "document" | "assessment" | "audio" | "link";
|
|
17
|
+
/** A skill or competency area that the learning path develops. */
|
|
18
|
+
export interface PathSkill {
|
|
19
|
+
uid: string;
|
|
20
|
+
name: string;
|
|
21
|
+
/** Current proficiency level 0–100 */
|
|
22
|
+
proficiency: number;
|
|
23
|
+
/** Target proficiency level 0–100 */
|
|
24
|
+
targetProficiency?: number;
|
|
25
|
+
}
|
|
26
|
+
/** A milestone marker along the learning path. */
|
|
27
|
+
export interface PathMilestone {
|
|
28
|
+
uid: string;
|
|
29
|
+
title: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Whether the milestone has been reached */
|
|
32
|
+
reached: boolean;
|
|
33
|
+
/** Index of the node after which this milestone appears (zero-based) */
|
|
34
|
+
afterNodeIndex: number;
|
|
35
|
+
variant?: "default" | "gold" | "silver" | "bronze";
|
|
36
|
+
}
|
|
37
|
+
/** A single node in the adaptive learning path. */
|
|
38
|
+
export interface PathNode {
|
|
39
|
+
uid: string;
|
|
40
|
+
title: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
/** Learning activity type — used for icon selection via LearningObjectIcon */
|
|
43
|
+
type: PathNodeType;
|
|
44
|
+
status: PathNodeStatus;
|
|
45
|
+
/** Estimated duration in seconds */
|
|
46
|
+
estimatedDuration?: number;
|
|
47
|
+
/** Performance score if completed (0–100) */
|
|
48
|
+
score?: number;
|
|
49
|
+
/** Whether this node is recommended as the next step */
|
|
50
|
+
recommended?: boolean;
|
|
51
|
+
/** Skill UIDs that this node develops */
|
|
52
|
+
skillUids?: string[];
|
|
53
|
+
/** UIDs of prerequisite nodes */
|
|
54
|
+
prerequisites?: string[];
|
|
55
|
+
/** Optional custom icon (overrides type-based icon) */
|
|
56
|
+
icon?: ReactNode;
|
|
57
|
+
}
|
|
58
|
+
/** A branch point where the adaptive engine may redirect the learner. */
|
|
59
|
+
export interface PathBranch {
|
|
60
|
+
uid: string;
|
|
61
|
+
/** UID of the node where the branch originates */
|
|
62
|
+
fromNodeUid: string;
|
|
63
|
+
/** Label for this branch (e.g., "Review Fundamentals") */
|
|
64
|
+
label: string;
|
|
65
|
+
/** UIDs of nodes in this branch path */
|
|
66
|
+
nodeUids: string[];
|
|
67
|
+
/** Whether this branch is the active/chosen branch */
|
|
68
|
+
active?: boolean;
|
|
69
|
+
/** Condition description (e.g., "Score below 70%") */
|
|
70
|
+
condition?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Overall progress summary for the path. */
|
|
73
|
+
export interface PathProgress {
|
|
74
|
+
/** Percentage of path completed (0–100) */
|
|
75
|
+
completionPercentage: number;
|
|
76
|
+
completedNodes: number;
|
|
77
|
+
totalNodes: number;
|
|
78
|
+
/** Total time spent in seconds */
|
|
79
|
+
totalTimeSpent: number;
|
|
80
|
+
/** Average score across completed nodes (0–100) */
|
|
81
|
+
averageScore?: number;
|
|
82
|
+
/** Current streak in days */
|
|
83
|
+
currentStreak?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* AdaptiveLearningPath section — a premium visualization of a personalized
|
|
87
|
+
* learning sequence that adapts based on learner performance.
|
|
88
|
+
*
|
|
89
|
+
* Shows a visual path map with nodes, connectors, milestones, skill bars,
|
|
90
|
+
* and summary stats. Each node represents a learning activity with status,
|
|
91
|
+
* score, and recommended-next indicators.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* <AdaptiveLearningPath
|
|
95
|
+
* title="React Mastery Path"
|
|
96
|
+
* description="A personalized journey for mastering React"
|
|
97
|
+
* nodes={pathNodes}
|
|
98
|
+
* progress={pathProgress}
|
|
99
|
+
* onNodeClick={(uid) => navigate(`/activity/${uid}`)}
|
|
100
|
+
* onNodeStart={(uid) => startActivity(uid)}
|
|
101
|
+
* />
|
|
102
|
+
*/
|
|
103
|
+
export interface AdaptiveLearningPathProps {
|
|
104
|
+
/** Path title */
|
|
105
|
+
title: string;
|
|
106
|
+
/** Optional path description */
|
|
107
|
+
description?: string;
|
|
108
|
+
/** Difficulty level displayed in the header */
|
|
109
|
+
difficulty?: "beginner" | "intermediate" | "advanced";
|
|
110
|
+
/** Ordered list of learning path nodes */
|
|
111
|
+
nodes: PathNode[];
|
|
112
|
+
/** Overall path progress data */
|
|
113
|
+
progress: PathProgress;
|
|
114
|
+
/** Skill/competency areas covered by this path */
|
|
115
|
+
skills?: PathSkill[];
|
|
116
|
+
/** Milestones along the path */
|
|
117
|
+
milestones?: PathMilestone[];
|
|
118
|
+
/** Branch points for adaptive routing */
|
|
119
|
+
branches?: PathBranch[];
|
|
120
|
+
/** Called when the user clicks a node */
|
|
121
|
+
onNodeClick?: (nodeUid: string) => void;
|
|
122
|
+
/** Called when the user starts a recommended or available activity */
|
|
123
|
+
onNodeStart?: (nodeUid: string) => void;
|
|
124
|
+
/** Called when the user clicks a skill */
|
|
125
|
+
onSkillClick?: (skillUid: string) => void;
|
|
126
|
+
/** When true, disables all interactive elements. @default false */
|
|
127
|
+
readOnly?: boolean;
|
|
128
|
+
/** Render skeleton placeholders instead of content */
|
|
129
|
+
isLoading?: boolean;
|
|
130
|
+
/** Error message — renders an error state with optional retry */
|
|
131
|
+
error?: string | null;
|
|
132
|
+
/** Called when the user clicks retry in the error state */
|
|
133
|
+
onRetry?: () => void;
|
|
134
|
+
className?: string;
|
|
135
|
+
style?: React.CSSProperties;
|
|
136
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LessonBlock } from '../../content/types';
|
|
2
|
+
import { AuthoringBlock } from './types';
|
|
3
|
+
interface BlockEditorItemProps {
|
|
4
|
+
item: AuthoringBlock;
|
|
5
|
+
onChange: (id: string, block: LessonBlock) => void;
|
|
6
|
+
onRemove: (id: string) => void;
|
|
7
|
+
onDuplicate: (id: string) => void;
|
|
8
|
+
onToggleCollapse: (id: string) => void;
|
|
9
|
+
dragProps: Record<string, unknown>;
|
|
10
|
+
isDragging: boolean;
|
|
11
|
+
isDragOver: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const BlockEditorItem: import('react').NamedExoticComponent<BlockEditorItemProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LessonBlock } from '../../content/types';
|
|
2
|
+
export declare function getBlockIcon(type: string): import('react').ComponentType<{
|
|
3
|
+
className?: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare function getBlockLabel(type: string): string;
|
|
6
|
+
interface BlockTypePickerProps {
|
|
7
|
+
onSelect: (type: LessonBlock["type"]) => void;
|
|
8
|
+
allowedTypes?: LessonBlock["type"][];
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function BlockTypePicker({ onSelect, allowedTypes, className, }: BlockTypePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LessonBlock } from '../../content/types';
|
|
2
|
+
/**
|
|
3
|
+
* A single authoring block wrapping a LessonBlock with editor metadata.
|
|
4
|
+
*/
|
|
5
|
+
export interface AuthoringBlock {
|
|
6
|
+
/** Unique identifier for keying and drag operations */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The underlying content block data */
|
|
9
|
+
block: LessonBlock;
|
|
10
|
+
/** Whether this block is collapsed in the editor UI */
|
|
11
|
+
collapsed?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Metadata for a block type option in the picker.
|
|
15
|
+
*/
|
|
16
|
+
export interface BlockTypeOption {
|
|
17
|
+
type: LessonBlock["type"];
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ContentAuthoringStudio is a premium block-based content editor
|
|
23
|
+
* for creating lessons. It produces the same `LessonBlock[]` data
|
|
24
|
+
* model that `LessonPage` renders, providing a WYSIWYG authoring
|
|
25
|
+
* experience with drag-and-drop reordering, per-block editors,
|
|
26
|
+
* and live preview.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <ContentAuthoringStudio
|
|
30
|
+
* title="React Hooks Deep Dive"
|
|
31
|
+
* blocks={lessonBlocks}
|
|
32
|
+
* onBlocksChange={setLessonBlocks}
|
|
33
|
+
* onTitleChange={setTitle}
|
|
34
|
+
* onSave={({ title, blocks }) => api.saveLesson(title, blocks)}
|
|
35
|
+
* />
|
|
36
|
+
*/
|
|
37
|
+
export interface ContentAuthoringStudioProps {
|
|
38
|
+
/** Lesson title (editable in edit mode) */
|
|
39
|
+
title?: string;
|
|
40
|
+
/** Initial content blocks */
|
|
41
|
+
blocks?: LessonBlock[];
|
|
42
|
+
/** Called when blocks change (add, edit, remove, reorder) */
|
|
43
|
+
onBlocksChange?: (blocks: LessonBlock[]) => void;
|
|
44
|
+
/** Called when the title changes */
|
|
45
|
+
onTitleChange?: (title: string) => void;
|
|
46
|
+
/** Called when the user clicks Save */
|
|
47
|
+
onSave?: (data: {
|
|
48
|
+
title: string;
|
|
49
|
+
blocks: LessonBlock[];
|
|
50
|
+
}) => void;
|
|
51
|
+
/** Show the edit/preview toggle. @default true */
|
|
52
|
+
showPreviewToggle?: boolean;
|
|
53
|
+
/** Restrict available block types. Defaults to all types. */
|
|
54
|
+
allowedBlockTypes?: LessonBlock["type"][];
|
|
55
|
+
/** When true, shows preview only (no editing controls). @default false */
|
|
56
|
+
readOnly?: boolean;
|
|
57
|
+
/** Render skeleton placeholders instead of content */
|
|
58
|
+
isLoading?: boolean;
|
|
59
|
+
/** Error message — renders an error state with optional retry */
|
|
60
|
+
error?: string | null;
|
|
61
|
+
/** Called when the user clicks retry in the error state */
|
|
62
|
+
onRetry?: () => void;
|
|
63
|
+
/** CSS class name for the root element */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Inline styles for the root element */
|
|
66
|
+
style?: React.CSSProperties;
|
|
67
|
+
}
|
package/dist/sections/index.d.ts
CHANGED
|
@@ -44,3 +44,7 @@ export { CourseCatalog } from './CourseCatalog/CourseCatalog';
|
|
|
44
44
|
export type { CourseCatalogProps, CourseInfo, } from './CourseCatalog/types';
|
|
45
45
|
export { StudentProfile } from './StudentProfile/StudentProfile';
|
|
46
46
|
export type { StudentProfileProps, StudentInfo, EnrolledCourse, ProfileAchievement, ProfileCertificate, } from './StudentProfile/types';
|
|
47
|
+
export { ContentAuthoringStudio } from './ContentAuthoringStudio/ContentAuthoringStudio';
|
|
48
|
+
export type { ContentAuthoringStudioProps, AuthoringBlock, } from './ContentAuthoringStudio/types';
|
|
49
|
+
export { AdaptiveLearningPath } from './AdaptiveLearningPath/AdaptiveLearningPath';
|
|
50
|
+
export type { AdaptiveLearningPathProps, PathNode, PathNodeStatus, PathNodeType, PathSkill, PathMilestone, PathBranch, PathProgress, } from './AdaptiveLearningPath/types';
|
package/dist/sections.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./StudentProfile-BVfZMbnV.cjs"),e=require("react/jsx-runtime"),a=require("react"),s=require("./tabs-BsfVo2Bl.cjs"),Q=require("lucide-react"),V=[];function D({questions:o,initialAnswers:S=[],onSubmit:d,onAnswerChange:N,showNavigator:E=!0,showQuestionNumbers:F=!0,questionGroups:j,isSubmitting:z=!1,readOnly:f=!1,isLoading:B,error:k,onRetry:L,className:u,style:p}){var c;const[y,b]=a.useState(S),[T,C]=a.useState(((c=o[0])==null?void 0:c.uid)??null),x=a.useRef(new Map),g=a.useMemo(()=>{const i=new Map;for(const n of y){const l=i.get(n.uid);l?l.push(n):i.set(n.uid,[n])}return i},[y]),v=a.useMemo(()=>o.filter(i=>g.has(i.uid)).length,[o,g]);a.useEffect(()=>{const i=new IntersectionObserver(n=>{for(const l of n)l.isIntersecting&&C(l.target.getAttribute("data-question-uid"))},{rootMargin:"-20% 0px -60% 0px"});return x.current.forEach(n=>i.observe(n)),()=>i.disconnect()},[o]);const P=a.useCallback((i,n)=>{n?x.current.set(i,n):x.current.delete(i)},[]),w=a.useRef(N);w.current=N;const M=a.useCallback((i,n)=>{b(l=>r.mergeSessionAnswers(l,i,n,w.current))},[]);function h(i){var n;(n=x.current.get(i))==null||n.scrollIntoView({behavior:"smooth",block:"center"})}const I=a.useMemo(()=>{if(!j)return[{label:null,questions:o}];const i=j.map(m=>({label:m.label,questions:m.questionUids.map(A=>o.find(R=>R.uid===A)).filter(Boolean)})),n=new Set(j.flatMap(m=>m.questionUids)),l=o.filter(m=>!n.has(m.uid));return l.length>0&&i.push({label:null,questions:l}),i},[o,j]);let t=0;return e.jsx(r.SectionShell,{isLoading:B,error:k,onRetry:L,className:u,style:p,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(s.Skeleton,{className:"h-32 w-full"}),e.jsx(s.Skeleton,{className:"h-32 w-full"}),e.jsx(s.Skeleton,{className:"h-32 w-full"})]}),children:e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[I.map((i,n)=>e.jsxs("div",{children:[i.label&&e.jsx("p",{className:s.cn("text-lg font-semibold mb-2 text-foreground",n>0&&"mt-4"),children:i.label}),i.questions.map(l=>{const m=t++;return e.jsx(s.Card,{ref:A=>P(l.uid,A),"data-question-uid":l.uid,className:"mb-2",children:e.jsxs(s.CardContent,{className:"pt-6",children:[F&&e.jsxs("p",{className:"font-semibold text-sm text-muted-foreground mb-1",children:["Question ",m+1]}),e.jsx(s.QuestionRenderer,{question:l,sessionAnswers:g.get(l.uid)??V,onAnswer:A=>M(l.uid,A),readOnly:f})]})},l.uid)})]},i.label??`ungrouped-${n}`)),e.jsx(s.Separator,{className:"my-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[v," of ",o.length," answered"]}),e.jsx(s.Button,{onClick:()=>d(y),disabled:z||f,children:z?"Submitting...":"Submit"})]})]}),E&&e.jsx(s.Card,{className:"hidden md:block w-50 shrink-0 sticky top-4 self-start",children:e.jsxs(s.CardContent,{className:"p-3",children:[e.jsx("p",{className:"font-semibold text-sm mb-1 text-foreground",children:"Questions"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:o.map((i,n)=>{const l=g.has(i.uid),m=T===i.uid;return e.jsx("button",{type:"button",className:s.cn("inline-flex items-center justify-center text-xs font-medium min-w-9 px-1 py-0.5 rounded-full cursor-pointer border transition-colors",m?"bg-primary border-primary text-primary-foreground":l?"border-success text-success bg-transparent":"border-border text-foreground bg-transparent hover:bg-muted"),onClick:()=>h(i.uid),children:n+1},i.uid)})})]})})]})})}const U={pdf:"document",document:"document",video:"video",link:"link",image:"document",archive:"document",other:"document"};function _({resources:o,categories:S,onResourceClick:d,onDownload:N,viewMode:E="list",allowViewToggle:F=!0,showSearch:j=!0,emptyMessage:z="No resources found",readOnly:f=!1,isLoading:B,error:k,onRetry:L,pageSize:u,currentPage:p=1,totalItems:y,onPageChange:b,className:T,style:C}){const[x,g]=a.useState(""),[v,P]=a.useState(null),[w,M]=a.useState(E),h=a.useMemo(()=>{let t=o;if(v&&(t=t.filter(c=>c.categoryUid===v)),x.trim()){const c=x.toLowerCase();t=t.filter(i=>{var n;return i.name.toLowerCase().includes(c)||((n=i.description)==null?void 0:n.toLowerCase().includes(c))})}return t},[o,v,x]);if(B)return e.jsxs("div",{className:s.cn("space-y-4",T),style:C,children:[e.jsx(s.Skeleton,{className:"h-9 w-full"}),e.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:6}).map((t,c)=>e.jsx(s.Skeleton,{className:"h-32 w-full rounded-lg"},c))})]});if(k)return e.jsx("div",{className:s.cn("py-12",T),style:C,children:e.jsx(s.EmptyState,{icon:e.jsx(Q.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:k,action:L?e.jsx(s.Button,{variant:"outline",onClick:L,children:"Retry"}):void 0})});function I(t){const c=U[t.type]??"document";return e.jsxs("div",{className:s.cn("flex items-center gap-3 px-3 py-2",!f&&d&&"cursor-pointer hover:bg-muted",(f||!d)&&"opacity-70"),onClick:()=>!f&&(d==null?void 0:d(t)),children:[e.jsx("div",{className:"min-w-10",children:e.jsx(s.LearningObjectIcon,{type:c,size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground",children:t.name}),(t.description||t.fileSize!=null)&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:[t.description,t.fileSize!=null&&s.formatFileSize(t.fileSize)].filter(Boolean).join(" · ")})]}),N&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsx(s.Button,{variant:"ghost",size:"icon-xs","aria-label":"Download",onClick:i=>{i.stopPropagation(),N(t)},children:e.jsx(Q.Download,{size:16})})}),e.jsx(s.TooltipContent,{children:"Download"})]})]},t.uid)}return e.jsxs("div",{className:T,style:C,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-2",children:[j&&e.jsx("div",{className:"flex-1 max-w-80",children:e.jsx(s.SearchInput,{value:x,onChange:g,placeholder:"Search resources...",size:"small"})}),F&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsx(s.Button,{variant:"ghost",size:"icon-xs","aria-label":"List view",className:s.cn(w==="list"&&"text-primary"),onClick:()=>M("list"),children:e.jsx(Q.List,{size:18})})}),e.jsx(s.TooltipContent,{children:"List view"})]}),e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{children:e.jsx(s.Button,{variant:"ghost",size:"icon-xs","aria-label":"Grid view",className:s.cn(w==="grid"&&"text-primary"),onClick:()=>M("grid"),children:e.jsx(Q.Grid,{size:18})})}),e.jsx(s.TooltipContent,{children:"Grid view"})]})]})]}),S&&S.length>0&&e.jsx(s.Tabs,{value:v??"all",onValueChange:t=>P(t==="all"?null:t),className:"mb-2",children:e.jsxs(s.TabsList,{children:[e.jsx(s.TabsTrigger,{value:"all",children:"All"}),S.map(t=>e.jsx(s.TabsTrigger,{value:t.uid,children:t.label},t.uid))]})}),h.length===0?e.jsx(s.EmptyState,{title:z,description:"Try adjusting your search or filter."}):w==="list"?e.jsx(s.Card,{children:(b&&u?h.slice((p-1)*u,p*u):h).map(I)}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2",children:(b&&u?h.slice((p-1)*u,p*u):h).map(t=>e.jsx(s.Card,{className:s.cn("transition-colors",!f&&d&&"cursor-pointer hover:border-primary"),onClick:()=>!f&&(d==null?void 0:d(t)),children:e.jsxs(s.CardContent,{className:"pt-4 pb-4",children:[e.jsxs("div",{className:"flex gap-1 items-center mb-1",children:[e.jsx(s.LearningObjectIcon,{type:U[t.type]??"document",size:20}),e.jsx("span",{className:"font-semibold text-sm text-foreground truncate",children:t.name})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-1 truncate",children:t.description}),t.fileSize!=null&&e.jsx("span",{className:"text-xs text-muted-foreground",children:s.formatFileSize(t.fileSize)})]})},t.uid))}),b&&u&&h.length>0&&e.jsx(s.Pagination,{currentPage:p,totalPages:Math.ceil((y??h.length)/u),onPageChange:b,className:"mt-4"})]})}exports.AnnouncementFeed=r.AnnouncementFeed;exports.AssessmentReview=r.AssessmentReview;exports.AssignmentSubmission=r.AssignmentSubmission;exports.CertificateViewer=r.CertificateViewer;exports.CourseCatalog=r.CourseCatalog;exports.CourseOutline=r.CourseOutline;exports.DiscussionThread=r.DiscussionThread;exports.EnrollmentWizard=r.EnrollmentWizard;exports.ExamSession=r.ExamSession;exports.FlashcardStudySession=r.FlashcardStudySession;exports.ForumBoard=r.ForumBoard;exports.GradebookTable=r.GradebookTable;exports.LecturePlayer=r.LecturePlayer;exports.LessonPage=r.LessonPage;exports.PracticeQuiz=r.PracticeQuiz;exports.ProgressDashboard=r.ProgressDashboard;exports.QuizSession=r.QuizSession;exports.RequirementsChecklist=r.RequirementsChecklist;exports.RubricView=r.RubricView;exports.StudentProfile=r.StudentProfile;exports.SurveyForm=r.SurveyForm;exports.ResourceLibrary=_;exports.ScrollableQuiz=D;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./StudentProfile-BPsZBaJj.cjs"),e=require("react/jsx-runtime"),c=require("react"),t=require("./withProGate-BJdu1T9Y.cjs"),n=require("lucide-react"),X=[];function Z({questions:s,initialAnswers:r=[],onSubmit:a,onAnswerChange:i,showNavigator:l=!0,showQuestionNumbers:T=!0,questionGroups:N,isSubmitting:h=!1,readOnly:g=!1,isLoading:y,error:A,onRetry:x,className:d,style:u}){var B;const[S,v]=c.useState(r),[L,C]=c.useState(((B=s[0])==null?void 0:B.uid)??null),k=c.useRef(new Map),I=c.useMemo(()=>{const m=new Map;for(const f of S){const w=m.get(f.uid);w?w.push(f):m.set(f.uid,[f])}return m},[S]),j=c.useMemo(()=>s.filter(m=>I.has(m.uid)).length,[s,I]);c.useEffect(()=>{const m=new IntersectionObserver(f=>{for(const w of f)w.isIntersecting&&C(w.target.getAttribute("data-question-uid"))},{rootMargin:"-20% 0px -60% 0px"});return k.current.forEach(f=>m.observe(f)),()=>m.disconnect()},[s]);const D=c.useCallback((m,f)=>{f?k.current.set(m,f):k.current.delete(m)},[]),F=c.useRef(i);F.current=i;const _=c.useCallback((m,f)=>{v(w=>b.mergeSessionAnswers(w,m,f,F.current))},[]);function R(m){var f;(f=k.current.get(m))==null||f.scrollIntoView({behavior:"smooth",block:"center"})}const U=c.useMemo(()=>{if(!N)return[{label:null,questions:s}];const m=N.map(E=>({label:E.label,questions:E.questionUids.map(M=>s.find(p=>p.uid===M)).filter(Boolean)})),f=new Set(N.flatMap(E=>E.questionUids)),w=s.filter(E=>!f.has(E.uid));return w.length>0&&m.push({label:null,questions:w}),m},[s,N]);let o=0;return e.jsx(b.SectionShell,{isLoading:y,error:A,onRetry:x,className:d,style:u,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(t.Skeleton,{className:"h-32 w-full"}),e.jsx(t.Skeleton,{className:"h-32 w-full"}),e.jsx(t.Skeleton,{className:"h-32 w-full"})]}),children:e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[U.map((m,f)=>e.jsxs("div",{children:[m.label&&e.jsx("p",{className:t.cn("text-lg font-semibold mb-2 text-foreground",f>0&&"mt-4"),children:m.label}),m.questions.map(w=>{const E=o++;return e.jsx(t.Card,{ref:M=>D(w.uid,M),"data-question-uid":w.uid,className:"mb-2",children:e.jsxs(t.CardContent,{className:"pt-6",children:[T&&e.jsxs("p",{className:"font-semibold text-sm text-muted-foreground mb-1",children:["Question ",E+1]}),e.jsx(t.QuestionRenderer,{question:w,sessionAnswers:I.get(w.uid)??X,onAnswer:M=>_(w.uid,M),readOnly:g})]})},w.uid)})]},m.label??`ungrouped-${f}`)),e.jsx(t.Separator,{className:"my-3"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[j," of ",s.length," answered"]}),e.jsx(t.Button,{onClick:()=>a(S),disabled:h||g,children:h?"Submitting...":"Submit"})]})]}),l&&e.jsx(t.Card,{className:"hidden md:block w-50 shrink-0 sticky top-4 self-start",children:e.jsxs(t.CardContent,{className:"p-3",children:[e.jsx("p",{className:"font-semibold text-sm mb-1 text-foreground",children:"Questions"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.map((m,f)=>{const w=I.has(m.uid),E=L===m.uid;return e.jsx("button",{type:"button",className:t.cn("inline-flex items-center justify-center text-xs font-medium min-w-9 px-1 py-0.5 rounded-full cursor-pointer border transition-colors",E?"bg-primary border-primary text-primary-foreground":w?"border-success text-success bg-transparent":"border-border text-foreground bg-transparent hover:bg-muted"),onClick:()=>R(m.uid),children:f+1},m.uid)})})]})})]})})}const G={pdf:"document",document:"document",video:"video",link:"link",image:"document",archive:"document",other:"document"};function ee({resources:s,categories:r,onResourceClick:a,onDownload:i,viewMode:l="list",allowViewToggle:T=!0,showSearch:N=!0,emptyMessage:h="No resources found",readOnly:g=!1,isLoading:y,error:A,onRetry:x,pageSize:d,currentPage:u=1,totalItems:S,onPageChange:v,className:L,style:C}){const[k,I]=c.useState(""),[j,D]=c.useState(null),[F,_]=c.useState(l),R=c.useMemo(()=>{let o=s;if(j&&(o=o.filter(B=>B.categoryUid===j)),k.trim()){const B=k.toLowerCase();o=o.filter(m=>{var f;return m.name.toLowerCase().includes(B)||((f=m.description)==null?void 0:f.toLowerCase().includes(B))})}return o},[s,j,k]);if(y)return e.jsxs("div",{className:t.cn("space-y-4",L),style:C,children:[e.jsx(t.Skeleton,{className:"h-9 w-full"}),e.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:6}).map((o,B)=>e.jsx(t.Skeleton,{className:"h-32 w-full rounded-lg"},B))})]});if(A)return e.jsx("div",{className:t.cn("py-12",L),style:C,children:e.jsx(t.EmptyState,{icon:e.jsx(n.AlertCircle,{className:"size-10 text-destructive"}),title:"Something went wrong",description:A,action:x?e.jsx(t.Button,{variant:"outline",onClick:x,children:"Retry"}):void 0})});function U(o){const B=G[o.type]??"document";return e.jsxs("div",{className:t.cn("flex items-center gap-3 px-3 py-2",!g&&a&&"cursor-pointer hover:bg-muted",(g||!a)&&"opacity-70"),onClick:()=>!g&&(a==null?void 0:a(o)),children:[e.jsx("div",{className:"min-w-10",children:e.jsx(t.LearningObjectIcon,{type:B,size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground",children:o.name}),(o.description||o.fileSize!=null)&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:[o.description,o.fileSize!=null&&t.formatFileSize(o.fileSize)].filter(Boolean).join(" · ")})]}),i&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"Download",onClick:m=>{m.stopPropagation(),i(o)},children:e.jsx(n.Download,{size:16})})}),e.jsx(t.TooltipContent,{children:"Download"})]})]},o.uid)}return e.jsxs("div",{className:L,style:C,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-2",children:[N&&e.jsx("div",{className:"flex-1 max-w-80",children:e.jsx(t.SearchInput,{value:k,onChange:I,placeholder:"Search resources...",size:"small"})}),T&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"List view",className:t.cn(F==="list"&&"text-primary"),onClick:()=>_("list"),children:e.jsx(n.List,{size:18})})}),e.jsx(t.TooltipContent,{children:"List view"})]}),e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"Grid view",className:t.cn(F==="grid"&&"text-primary"),onClick:()=>_("grid"),children:e.jsx(n.Grid,{size:18})})}),e.jsx(t.TooltipContent,{children:"Grid view"})]})]})]}),r&&r.length>0&&e.jsx(t.Tabs,{value:j??"all",onValueChange:o=>D(o==="all"?null:o),className:"mb-2",children:e.jsxs(t.TabsList,{children:[e.jsx(t.TabsTrigger,{value:"all",children:"All"}),r.map(o=>e.jsx(t.TabsTrigger,{value:o.uid,children:o.label},o.uid))]})}),R.length===0?e.jsx(t.EmptyState,{title:h,description:"Try adjusting your search or filter."}):F==="list"?e.jsx(t.Card,{children:(v&&d?R.slice((u-1)*d,u*d):R).map(U)}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2",children:(v&&d?R.slice((u-1)*d,u*d):R).map(o=>e.jsx(t.Card,{className:t.cn("transition-colors",!g&&a&&"cursor-pointer hover:border-primary"),onClick:()=>!g&&(a==null?void 0:a(o)),children:e.jsxs(t.CardContent,{className:"pt-4 pb-4",children:[e.jsxs("div",{className:"flex gap-1 items-center mb-1",children:[e.jsx(t.LearningObjectIcon,{type:G[o.type]??"document",size:20}),e.jsx("span",{className:"font-semibold text-sm text-foreground truncate",children:o.name})]}),o.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-1 truncate",children:o.description}),o.fileSize!=null&&e.jsx("span",{className:"text-xs text-muted-foreground",children:t.formatFileSize(o.fileSize)})]})},o.uid))}),v&&d&&R.length>0&&e.jsx(t.Pagination,{currentPage:u,totalPages:Math.ceil((S??R.length)/d),onPageChange:v,className:"mt-4"})]})}const $=[{type:"richtext",label:"Rich Text",description:"Formatted text content"},{type:"heading",label:"Heading",description:"Section heading"},{type:"image",label:"Image",description:"Image with caption"},{type:"video",label:"Video",description:"Video player"},{type:"code",label:"Code",description:"Code snippet"},{type:"callout",label:"Callout",description:"Info, warning, or tip"},{type:"audio",label:"Audio",description:"Audio player"},{type:"embed",label:"Embed",description:"External embed"},{type:"table",label:"Table",description:"Data table"},{type:"file",label:"Files",description:"File attachments"},{type:"divider",label:"Divider",description:"Horizontal separator"}],q={richtext:n.Type,heading:n.Heading,image:n.Image,video:n.Video,code:n.Code,callout:n.MessageSquare,audio:n.Music,embed:n.Globe,table:n.Table,file:n.Paperclip,divider:n.Minus};function te(s){return q[s]??n.Type}function se(s){var r;return((r=$.find(a=>a.type===s))==null?void 0:r.label)??s}function H({onSelect:s,allowedTypes:r,className:a}){const[i,l]=c.useState(!1),T=c.useRef(null),N=r?$.filter(h=>r.includes(h.type)):$;return c.useEffect(()=>{if(!i)return;function h(g){T.current&&!T.current.contains(g.target)&&l(!1)}return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]),e.jsxs("div",{className:t.cn("relative",a),ref:T,children:[e.jsxs(t.Button,{variant:"ghost",size:"sm",onClick:()=>l(!i),className:"text-muted-foreground hover:text-foreground gap-1 h-7 text-xs",children:[e.jsx(n.Plus,{className:"size-3.5"}),"Add block"]}),i&&e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 top-full mt-1 z-50 w-72 rounded-lg border border-border bg-background shadow-lg p-2",children:e.jsx("div",{className:"grid grid-cols-3 gap-1",children:N.map(({type:h,label:g})=>{const y=q[h]??n.Type;return e.jsxs("button",{type:"button",onClick:()=>{s(h),l(!1)},className:"flex flex-col items-center gap-1 rounded-md p-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",children:[e.jsx(y,{className:"size-4"}),e.jsx("span",{children:g})]},h)})})})]})}const ae=c.memo(function({item:r,onChange:a,onRemove:i,onDuplicate:l,onToggleCollapse:T,dragProps:N,isDragging:h,isDragOver:g}){const{id:y,block:A,collapsed:x}=r,d=te(A.type),u=se(A.type),S=c.useCallback(k=>a(y,k),[y,a]),v=c.useCallback(()=>i(y),[y,i]),L=c.useCallback(()=>l(y),[y,l]),C=c.useCallback(()=>T(y),[y,T]);return e.jsxs("div",{...N,className:t.cn("group rounded-lg border border-border bg-background transition-all",h&&"opacity-50",g&&"border-primary shadow-sm"),children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[e.jsx("span",{className:"cursor-grab text-muted-foreground/50 hover:text-muted-foreground","aria-label":"Drag to reorder",children:e.jsx(n.GripVertical,{className:"size-4"})}),e.jsx("button",{type:"button",onClick:C,className:"text-muted-foreground hover:text-foreground p-0.5",children:x?e.jsx(n.ChevronRight,{className:"size-3.5"}):e.jsx(n.ChevronDown,{className:"size-3.5"})}),e.jsxs(t.Badge,{variant:"secondary",className:"text-[10px] gap-1 px-1.5 py-0",children:[e.jsx(d,{className:"size-3"}),u]}),e.jsx("div",{className:"flex-1"}),e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:L,className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-muted-foreground",children:e.jsx(n.Copy,{className:"size-3"})}),e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:v,className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-destructive",children:e.jsx(n.Trash2,{className:"size-3"})})]}),!x&&e.jsx("div",{className:"p-3",children:e.jsx(re,{block:A,onChange:S})})]})});function re({block:s,onChange:r}){switch(s.type){case"richtext":return e.jsx(t.RichTextEditor,{value:s.html,onChange:a=>r({...s,html:a}),placeholder:"Write your content..."});case"heading":return e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{value:s.level??2,onChange:a=>r({...s,level:Number(a.target.value)}),className:"h-9 rounded-md border border-input bg-transparent px-2 text-sm",children:[e.jsx("option",{value:1,children:"H1"}),e.jsx("option",{value:2,children:"H2"}),e.jsx("option",{value:3,children:"H3"})]}),e.jsx(t.Input,{value:s.text,onChange:a=>r({...s,text:a.target.value}),placeholder:"Heading text...",className:"flex-1"})]});case"image":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Input,{value:s.src,onChange:a=>r({...s,src:a.target.value}),placeholder:"Image URL..."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t.Input,{value:s.alt??"",onChange:a=>r({...s,alt:a.target.value}),placeholder:"Alt text...",className:"flex-1"}),e.jsx(t.Input,{value:s.caption??"",onChange:a=>r({...s,caption:a.target.value}),placeholder:"Caption...",className:"flex-1"})]}),s.src&&e.jsx("img",{src:s.src,alt:s.alt??"",className:"max-h-40 rounded-md object-cover"})]});case"video":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Input,{value:s.video.src??"",onChange:a=>r({...s,video:{...s.video,src:a.target.value}}),placeholder:"Video URL..."}),e.jsx(t.Input,{value:s.video.title??"",onChange:a=>r({...s,video:{...s.video,title:a.target.value}}),placeholder:"Video title..."})]});case"code":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t.Input,{value:s.language??"",onChange:a=>r({...s,language:a.target.value}),placeholder:"Language (e.g. javascript)",className:"w-40"}),e.jsx(t.Input,{value:s.filename??"",onChange:a=>r({...s,filename:a.target.value}),placeholder:"Filename (optional)",className:"flex-1"})]}),e.jsx("textarea",{value:s.code,onChange:a=>r({...s,code:a.target.value}),placeholder:"Paste your code...",className:"w-full min-h-24 rounded-md border border-input bg-muted p-3 font-mono text-sm resize-y focus:outline-none focus:ring-2 focus:ring-ring",spellCheck:!1})]});case"callout":return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:s.variant??"info",onChange:a=>r({...s,variant:a.target.value}),className:"h-9 rounded-md border border-input bg-transparent px-2 text-sm",children:[e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warning",children:"Warning"}),e.jsx("option",{value:"tip",children:"Tip"})]}),e.jsx(t.Input,{value:s.content,onChange:a=>r({...s,content:a.target.value}),placeholder:"Callout text..."})]});case"audio":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Input,{value:s.src,onChange:a=>r({...s,src:a.target.value}),placeholder:"Audio URL..."}),e.jsx(t.Input,{value:s.title??"",onChange:a=>r({...s,title:a.target.value}),placeholder:"Title (optional)"})]});case"embed":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Input,{value:s.src,onChange:a=>r({...s,src:a.target.value}),placeholder:"Embed URL..."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t.Input,{value:s.title??"",onChange:a=>r({...s,title:a.target.value}),placeholder:"Title (optional)",className:"flex-1"}),e.jsxs("select",{value:s.aspectRatio??"16/9",onChange:a=>r({...s,aspectRatio:a.target.value}),className:"h-9 rounded-md border border-input bg-transparent px-2 text-sm",children:[e.jsx("option",{value:"16/9",children:"16:9"}),e.jsx("option",{value:"4/3",children:"4:3"}),e.jsx("option",{value:"1/1",children:"1:1"})]})]})]});case"table":return e.jsx(ne,{block:s,onChange:r});case"file":return e.jsxs("p",{className:"text-sm text-muted-foreground",children:["File attachments are managed via the ",e.jsx("code",{className:"text-xs",children:"files"})," prop.",s.files.length>0&&e.jsxs("span",{className:"ml-1",children:["(",s.files.length," file",s.files.length!==1&&"s"," attached)"]})]});case"divider":return e.jsx(t.Separator,{});case"question":case"flashcards":return e.jsxs("p",{className:"text-sm text-muted-foreground italic",children:["Interactive ",s.type," blocks are configured via props."]});case"custom":return e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Custom blocks are not editable in the authoring studio."});default:return null}}function ne({block:s,onChange:r}){const{headers:a,rows:i,caption:l}=s;function T(x,d){const u=[...a];u[x]=d,r({...s,headers:u})}function N(x,d,u){const S=i.map(v=>[...v]);S[x][d]=u,r({...s,rows:S})}function h(){r({...s,headers:[...a,""],rows:i.map(x=>[...x,""])})}function g(x){a.length<=1||r({...s,headers:a.filter((d,u)=>u!==x),rows:i.map(d=>d.filter((u,S)=>S!==x))})}function y(){r({...s,rows:[...i,a.map(()=>"")]})}function A(x){r({...s,rows:i.filter((d,u)=>u!==x)})}return e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Input,{value:l??"",onChange:x=>r({...s,caption:x.target.value}),placeholder:"Table caption (optional)",className:"text-sm"}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[a.map((x,d)=>e.jsx("th",{className:"p-1",children:e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(t.Input,{value:x,onChange:u=>T(d,u.target.value),placeholder:`Col ${d+1}`,className:"h-7 text-xs font-semibold"}),a.length>1&&e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:()=>g(d),className:"h-7 w-7 p-0 text-destructive shrink-0",children:e.jsx(n.Trash2,{className:"size-3"})})]})},d)),e.jsx("th",{className:"p-1 w-8",children:e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:h,className:"h-7 w-7 p-0 text-muted-foreground",children:"+"})})]})}),e.jsx("tbody",{children:i.map((x,d)=>e.jsxs("tr",{children:[x.map((u,S)=>e.jsx("td",{className:"p-1",children:e.jsx(t.Input,{value:u,onChange:v=>N(d,S,v.target.value),className:"h-7 text-xs"})},S)),e.jsx("td",{className:"p-1",children:e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:()=>A(d),className:"h-7 w-7 p-0 text-destructive",children:e.jsx(n.Trash2,{className:"size-3"})})})]},d))})]})}),e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:y,className:"text-xs text-muted-foreground",children:"+ Add row"})]})}let ie=0;function V(){return`ab_${++ie}_${Date.now().toString(36)}`}function le(s){return s.map(r=>({id:V(),block:r}))}function ce(s){switch(s){case"richtext":return{type:"richtext",html:""};case"heading":return{type:"heading",text:"",level:2};case"image":return{type:"image",src:"",alt:""};case"video":return{type:"video",video:{src:""}};case"code":return{type:"code",code:"",language:"javascript"};case"callout":return{type:"callout",content:"",variant:"info"};case"audio":return{type:"audio",src:""};case"embed":return{type:"embed",src:""};case"table":return{type:"table",headers:["Column 1","Column 2"],rows:[["",""]]};case"file":return{type:"file",files:[]};case"divider":return{type:"divider"};case"question":return{type:"question",question:{uid:V(),type:"multiple_choice",content:"",answers:[]}};case"flashcards":return{type:"flashcards",cards:[]};case"custom":return{type:"custom",render:null};default:return{type:"richtext",html:""}}}function oe({title:s="",blocks:r,onBlocksChange:a,onTitleChange:i,onSave:l,showPreviewToggle:T=!0,allowedBlockTypes:N,readOnly:h=!1,isLoading:g,error:y,onRetry:A,className:x,style:d}){const[u,S]=c.useState(s),[v,L]=c.useState(()=>le(r??[])),[C,k]=c.useState(h?"preview":"edit"),I=c.useMemo(()=>v.map(p=>p.block),[v]),j=c.useCallback(p=>{L(p),a==null||a(p.map(z=>z.block))},[a]),D=c.useRef(v);D.current=v;function F(p,z){const P={id:V(),block:ce(p)},Q=[...v];Q.splice(z,0,P),j(Q)}const _=c.useCallback((p,z)=>{j(D.current.map(P=>P.id===p?{...P,block:z}:P))},[j]),R=c.useCallback(p=>{j(D.current.filter(z=>z.id!==p))},[j]),U=c.useCallback(p=>{const z=D.current,P=z.findIndex(J=>J.id===p);if(P===-1)return;const Q={id:V(),block:structuredClone(z[P].block)},O=[...z];O.splice(P+1,0,Q),j(O)},[j]),o=c.useCallback(p=>{L(z=>z.map(P=>P.id===p?{...P,collapsed:!P.collapsed}:P))},[]);function B(p){S(p),i==null||i(p)}function m(){l==null||l({title:u,blocks:I})}const{getDragProps:f,dragIndex:w,dragOverIndex:E}=t.useDragReorder({items:v,onReorder:j,disabled:h||C==="preview"}),M=C==="edit"&&!h;return e.jsx(b.SectionShell,{isLoading:g,error:y,onRetry:A,className:x,style:d,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(t.Skeleton,{className:"h-10 w-64"}),e.jsx(t.Skeleton,{className:"h-6 w-32"}),e.jsx(t.Skeleton,{className:"h-32 w-full"}),e.jsx(t.Skeleton,{className:"h-24 w-full"}),e.jsx(t.Skeleton,{className:"h-32 w-full"})]}),children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[M?e.jsx(t.Input,{value:u,onChange:p=>B(p.target.value),placeholder:"Lesson title...",className:"text-lg font-semibold flex-1 h-10"}):e.jsx("h2",{className:"text-xl font-bold flex-1 text-foreground",children:u||"Untitled Lesson"}),T&&!h&&e.jsx(t.Button,{variant:"outline",size:"sm",onClick:()=>k(C==="edit"?"preview":"edit"),className:"gap-1.5",children:C==="edit"?e.jsxs(e.Fragment,{children:[e.jsx(n.Eye,{className:"size-3.5"})," Preview"]}):e.jsxs(e.Fragment,{children:[e.jsx(n.Pencil,{className:"size-3.5"})," Edit"]})}),l&&!h&&e.jsxs(t.Button,{size:"sm",onClick:m,className:"gap-1.5",children:[e.jsx(n.Save,{className:"size-3.5"})," Save"]})]}),M?e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex justify-center py-1",children:e.jsx(H,{onSelect:p=>F(p,0),allowedTypes:N})}),v.length===0&&e.jsx(t.EmptyState,{title:"No content blocks",description:"Click 'Add block' above to start building your lesson."}),v.map((p,z)=>e.jsxs("div",{children:[e.jsx(ae,{item:p,onChange:_,onRemove:R,onDuplicate:U,onToggleCollapse:o,dragProps:f(z),isDragging:w===z,isDragOver:E===z}),e.jsx("div",{className:"flex justify-center py-1",children:e.jsx(H,{onSelect:P=>F(P,z+1),allowedTypes:N})})]},p.id))]}):e.jsx("div",{className:"flex flex-col gap-3",children:v.length>0?v.map(p=>e.jsx(t.ContentBlock,{block:p.block,readOnly:!0},p.id)):e.jsx(t.EmptyState,{title:"No content yet",description:"Switch to edit mode to add content blocks."})})]})})}const de=t.withProGate(oe,"ContentAuthoringStudio"),ue={mastered:{label:"Mastered",variant:"success",icon:n.ShieldCheck},completed:{label:"Completed",variant:"success",icon:n.CheckCircle2},in_progress:{label:"In Progress",variant:"info",icon:n.Play},available:{label:"Available",variant:"secondary"},locked:{label:"Locked",variant:"muted",icon:n.Lock},skipped:{label:"Skipped",variant:"muted",icon:n.SkipForward}},me=c.memo(function({node:r,onClick:a,onStart:i,readOnly:l=!1,className:T}){const N=ue[r.status],h=N.icon,g=r.status!=="locked"&&!l,y=!l&&(r.status==="available"||r.recommended)&&r.status!=="locked"&&r.status!=="completed"&&r.status!=="mastered"&&i,A=c.useCallback(()=>{g&&a&&a(r.uid)},[g,a,r.uid]),x=c.useCallback(u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a==null||a(r.uid))},[a,r.uid]),d=c.useCallback(u=>{u.stopPropagation(),i==null||i(r.uid)},[i,r.uid]);return e.jsx(t.Card,{className:t.cn("transition-all",g&&a&&"cursor-pointer hover:border-primary/50 hover:shadow-md",r.status==="in_progress"&&"border-primary ring-1 ring-primary/20",r.status==="locked"&&"opacity-60",r.status==="skipped"&&"opacity-50",r.recommended&&r.status!=="locked"&&"border-primary/40",T),onClick:g&&a?A:void 0,role:g&&a?"button":void 0,tabIndex:g&&a?0:void 0,onKeyDown:g&&a?x:void 0,children:e.jsx(t.CardContent,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:t.cn("shrink-0 w-9 h-9 rounded-lg flex items-center justify-center",r.status==="locked"?"bg-muted text-muted-foreground":"bg-primary/10 text-primary"),children:r.icon??e.jsx(t.LearningObjectIcon,{type:r.type,size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h4",{className:"text-sm font-semibold text-foreground truncate",children:r.title}),r.recommended&&r.status!=="locked"&&e.jsxs(t.Badge,{variant:"default",className:"text-[10px] px-1.5 h-5 gap-0.5",children:[e.jsx(n.Sparkles,{size:10}),"Recommended"]})]}),r.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:r.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 flex-wrap",children:[e.jsxs(t.Badge,{variant:N.variant,className:"text-[10px] px-1.5 h-5 gap-0.5",children:[h&&e.jsx(h,{size:10}),N.label]}),r.estimatedDuration!=null&&r.estimatedDuration>0&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(n.Clock,{size:12}),t.formatDuration(r.estimatedDuration)]}),r.score!=null&&e.jsxs("span",{className:"text-xs font-medium tabular-nums text-foreground",children:[r.score,"%"]})]})]}),y&&e.jsx(t.Button,{size:"sm",variant:r.recommended?"default":"outline",className:"shrink-0",onClick:d,children:r.status==="in_progress"?"Continue":"Start"})]})})})});function W({fromStatus:s,className:r}){const a=s==="mastered"||s==="completed",i=s==="in_progress";return e.jsx("div",{className:t.cn("flex justify-center",r),children:e.jsx("div",{className:t.cn("w-0.5 h-8",a&&"bg-success",i&&"bg-primary",!a&&!i&&"bg-border",s==="skipped"&&"border-l border-dashed border-muted-foreground bg-transparent")})})}const xe={default:"text-primary",gold:"text-palette-3",silver:"text-muted-foreground",bronze:"text-palette-3/70"};function K({milestone:s,className:r}){const a=s.variant??"default";return e.jsxs("div",{className:t.cn("flex items-center gap-3 py-2 px-4",!s.reached&&"opacity-50",r),children:[e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.reached?e.jsx(n.Trophy,{size:16,className:xe[a]}):e.jsx(n.Lock,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:t.cn("text-xs font-semibold whitespace-nowrap",s.reached?"text-foreground":"text-muted-foreground"),children:s.title})]}),e.jsx("div",{className:"flex-1 h-px bg-border"})]})}const pe=c.memo(function({skill:r,onClick:a,className:i}){const l=r.targetProficiency??100;return e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsxs("button",{type:"button",onClick:a?()=>a(r.uid):void 0,disabled:!a,className:t.cn("flex items-center gap-2 min-w-0 text-left",a&&"cursor-pointer hover:opacity-80",!a&&"cursor-default",i),children:[e.jsx("span",{className:"text-xs font-medium text-foreground whitespace-nowrap truncate min-w-16",children:r.name}),e.jsx(t.Progress,{value:r.proficiency,max:l,size:"sm",className:"flex-1 min-w-20"}),e.jsxs("span",{className:"text-xs tabular-nums text-muted-foreground whitespace-nowrap",children:[r.proficiency,"%"]})]})}),e.jsxs(t.TooltipContent,{children:[r.name,": ",r.proficiency,"%",l<100?` / ${l}% target`:""]})]})}),Y={beginner:{label:"Beginner",variant:"success"},intermediate:{label:"Intermediate",variant:"warning"},advanced:{label:"Advanced",variant:"destructive"}};function he({title:s,description:r,difficulty:a,nodes:i=[],progress:l,skills:T,milestones:N,onNodeClick:h,onNodeStart:g,onSkillClick:y,readOnly:A=!1,isLoading:x,error:d,onRetry:u,className:S,style:v}){const L=c.useMemo(()=>{const I=new Map;if(N)for(const j of N)I.set(j.afterNodeIndex,j);return I},[N]),C=Array.isArray(i)?i:[],k=Array.isArray(T)?T:[];return e.jsx(b.SectionShell,{isLoading:x,error:d,onRetry:u,className:S,style:v,skeleton:e.jsxs(e.Fragment,{children:[e.jsx(t.Skeleton,{className:"h-8 w-64"}),e.jsx(t.Skeleton,{className:"h-4 w-96 mt-2"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mt-6",children:Array.from({length:4},(I,j)=>e.jsx(t.Skeleton,{className:"h-28"},j))}),e.jsx("div",{className:"mt-8 space-y-3",children:Array.from({length:5},(I,j)=>e.jsx(t.Skeleton,{className:"h-20"},j))})]}),children:e.jsxs("div",{className:S,style:v,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(t.ProgressRing,{value:l.completionPercentage,size:64,strokeWidth:5,className:"shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:s}),r&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r})]})]}),a&&e.jsx(t.Badge,{variant:Y[a].variant,children:Y[a].label})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mt-6",children:[e.jsx(t.StatCard,{icon:e.jsx(n.Target,{}),label:"Progress",value:`${Math.round(l.completionPercentage)}%`,subtitle:"of path completed",accent:"var(--primary)"}),e.jsx(t.StatCard,{icon:e.jsx(n.BookOpen,{}),label:"Completed",value:`${l.completedNodes}/${l.totalNodes}`,subtitle:"activities",accent:"var(--success)"}),e.jsx(t.StatCard,{icon:e.jsx(n.Clock,{}),label:"Time Spent",value:t.formatDuration(l.totalTimeSpent),subtitle:"total",accent:"var(--info)"}),l.averageScore!=null?e.jsx(t.StatCard,{icon:e.jsx(n.TrendingUp,{}),label:"Avg Score",value:`${Math.round(l.averageScore)}%`,subtitle:"across activities",accent:"var(--warning)"}):l.currentStreak!=null?e.jsx(t.StatCard,{icon:e.jsx(n.Flame,{}),label:"Streak",value:`${l.currentStreak}`,subtitle:"days",accent:"var(--warning)"}):e.jsx(t.StatCard,{icon:e.jsx(n.TrendingUp,{}),label:"Remaining",value:`${l.totalNodes-l.completedNodes}`,subtitle:"activities left",accent:"var(--warning)"})]}),k.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(t.Separator,{className:"my-5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Skills"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-6 gap-y-2",children:k.map(I=>e.jsx(pe,{skill:I,onClick:y},I.uid))})]})]}),e.jsx(t.Separator,{className:"my-5"}),e.jsxs("div",{className:"relative",role:"list","aria-label":`Learning path: ${l.completedNodes} of ${l.totalNodes} completed`,children:[C.map((I,j)=>e.jsxs("div",{role:"listitem",children:[j>0&&e.jsx(W,{fromStatus:C[j-1].status}),L.has(j-1)&&e.jsx(K,{milestone:L.get(j-1),className:"my-1"}),e.jsx(me,{node:I,onClick:h,onStart:g,readOnly:A})]},I.uid)),C.length>0&&L.has(C.length-1)&&e.jsxs(e.Fragment,{children:[e.jsx(W,{fromStatus:C[C.length-1].status}),e.jsx(K,{milestone:L.get(C.length-1),className:"my-1"})]})]})]})})}const ge=t.withProGate(he,"AdaptiveLearningPath");exports.AnnouncementFeed=b.AnnouncementFeed;exports.AssessmentReview=b.AssessmentReview;exports.AssignmentSubmission=b.AssignmentSubmission;exports.CertificateViewer=b.CertificateViewer;exports.CourseCatalog=b.CourseCatalog;exports.CourseOutline=b.CourseOutline;exports.DiscussionThread=b.DiscussionThread;exports.EnrollmentWizard=b.EnrollmentWizard;exports.ExamSession=b.ExamSession;exports.FlashcardStudySession=b.FlashcardStudySession;exports.ForumBoard=b.ForumBoard;exports.GradebookTable=b.GradebookTable;exports.LecturePlayer=b.LecturePlayer;exports.LessonPage=b.LessonPage;exports.PracticeQuiz=b.PracticeQuiz;exports.ProgressDashboard=b.ProgressDashboard;exports.QuizSession=b.QuizSession;exports.RequirementsChecklist=b.RequirementsChecklist;exports.RubricView=b.RubricView;exports.StudentProfile=b.StudentProfile;exports.SurveyForm=b.SurveyForm;exports.AdaptiveLearningPath=ge;exports.ContentAuthoringStudio=de;exports.ResourceLibrary=ee;exports.ScrollableQuiz=Z;
|