analytica-frontend-lib 1.1.9 → 1.1.11

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/index.mjs CHANGED
@@ -6772,7 +6772,12 @@ var NotFound = ({
6772
6772
  var NotFound_default = NotFound;
6773
6773
 
6774
6774
  // src/components/VideoPlayer/VideoPlayer.tsx
6775
- import { useRef as useRef9, useState as useState13, useEffect as useEffect11, useCallback } from "react";
6775
+ import {
6776
+ useRef as useRef9,
6777
+ useState as useState13,
6778
+ useEffect as useEffect11,
6779
+ useCallback
6780
+ } from "react";
6776
6781
  import {
6777
6782
  Play as Play2,
6778
6783
  Pause,
@@ -6790,6 +6795,85 @@ var formatTime = (seconds) => {
6790
6795
  const secs = Math.floor(seconds % 60);
6791
6796
  return `${mins}:${secs.toString().padStart(2, "0")}`;
6792
6797
  };
6798
+ var ProgressBar2 = ({
6799
+ currentTime,
6800
+ duration,
6801
+ progressPercentage,
6802
+ onSeek
6803
+ }) => /* @__PURE__ */ jsx36("div", { className: "px-4 pb-2", children: /* @__PURE__ */ jsx36(
6804
+ "input",
6805
+ {
6806
+ type: "range",
6807
+ min: 0,
6808
+ max: duration || 100,
6809
+ value: currentTime,
6810
+ onChange: (e) => onSeek(parseFloat(e.target.value)),
6811
+ className: "w-full h-1 bg-neutral-600 rounded-full appearance-none cursor-pointer slider:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-primary-500",
6812
+ "aria-label": "Video progress",
6813
+ style: {
6814
+ background: `linear-gradient(to right, var(--color-primary-700) ${progressPercentage}%, var(--color-secondary-300) ${progressPercentage}%)`
6815
+ }
6816
+ }
6817
+ ) });
6818
+ var VolumeControls = ({
6819
+ volume,
6820
+ isMuted,
6821
+ onVolumeChange,
6822
+ onToggleMute
6823
+ }) => /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
6824
+ /* @__PURE__ */ jsx36(
6825
+ IconButton_default,
6826
+ {
6827
+ icon: isMuted ? /* @__PURE__ */ jsx36(SpeakerSlash, { size: 24 }) : /* @__PURE__ */ jsx36(SpeakerHigh2, { size: 24 }),
6828
+ onClick: onToggleMute,
6829
+ "aria-label": isMuted ? "Unmute" : "Mute",
6830
+ className: "!bg-transparent !text-white hover:!bg-white/20"
6831
+ }
6832
+ ),
6833
+ /* @__PURE__ */ jsx36(
6834
+ "input",
6835
+ {
6836
+ type: "range",
6837
+ min: 0,
6838
+ max: 100,
6839
+ value: Math.round(volume * 100),
6840
+ onChange: (e) => onVolumeChange(parseInt(e.target.value)),
6841
+ className: "w-20 h-1 bg-neutral-600 rounded-full appearance-none cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-500",
6842
+ "aria-label": "Volume control",
6843
+ style: {
6844
+ background: `linear-gradient(to right, var(--color-primary-700) ${volume * 100}%, var(--color-secondary-300) ${volume * 100}%)`
6845
+ }
6846
+ }
6847
+ )
6848
+ ] });
6849
+ var SpeedMenu = ({
6850
+ showSpeedMenu,
6851
+ playbackRate,
6852
+ onToggleMenu,
6853
+ onSpeedChange
6854
+ }) => /* @__PURE__ */ jsxs30("div", { className: "relative", children: [
6855
+ /* @__PURE__ */ jsx36(
6856
+ IconButton_default,
6857
+ {
6858
+ icon: /* @__PURE__ */ jsx36(DotsThreeVertical2, { size: 24 }),
6859
+ onClick: onToggleMenu,
6860
+ "aria-label": "Playback speed",
6861
+ className: "!bg-transparent !text-white hover:!bg-white/20"
6862
+ }
6863
+ ),
6864
+ showSpeedMenu && /* @__PURE__ */ jsx36("div", { className: "absolute bottom-12 right-0 bg-black/90 rounded-lg p-2 min-w-20", children: [0.5, 0.75, 1, 1.25, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs30(
6865
+ "button",
6866
+ {
6867
+ onClick: () => onSpeedChange(speed),
6868
+ className: `block w-full text-left px-3 py-1 text-sm rounded hover:bg-white/20 transition-colors ${playbackRate === speed ? "text-primary-400" : "text-white"}`,
6869
+ children: [
6870
+ speed,
6871
+ "x"
6872
+ ]
6873
+ },
6874
+ speed
6875
+ )) })
6876
+ ] });
6793
6877
  var VideoPlayer = ({
6794
6878
  src,
6795
6879
  poster,
@@ -6814,10 +6898,51 @@ var VideoPlayer = ({
6814
6898
  const [showControls, setShowControls] = useState13(true);
6815
6899
  const [hasCompleted, setHasCompleted] = useState13(false);
6816
6900
  const [showCaptions, setShowCaptions] = useState13(false);
6901
+ useEffect11(() => {
6902
+ setHasCompleted(false);
6903
+ }, [src]);
6817
6904
  const [playbackRate, setPlaybackRate] = useState13(1);
6818
6905
  const [showSpeedMenu, setShowSpeedMenu] = useState13(false);
6819
6906
  const lastSaveTimeRef = useRef9(0);
6820
6907
  const trackRef = useRef9(null);
6908
+ const controlsTimeoutRef = useRef9(null);
6909
+ const lastMousePositionRef = useRef9({ x: 0, y: 0 });
6910
+ const mouseMoveTimeoutRef = useRef9(null);
6911
+ const clearControlsTimeout = useCallback(() => {
6912
+ if (controlsTimeoutRef.current) {
6913
+ clearTimeout(controlsTimeoutRef.current);
6914
+ controlsTimeoutRef.current = null;
6915
+ }
6916
+ }, []);
6917
+ const clearMouseMoveTimeout = useCallback(() => {
6918
+ if (mouseMoveTimeoutRef.current) {
6919
+ clearTimeout(mouseMoveTimeoutRef.current);
6920
+ mouseMoveTimeoutRef.current = null;
6921
+ }
6922
+ }, []);
6923
+ const showControlsWithTimer = useCallback(() => {
6924
+ setShowControls(true);
6925
+ clearControlsTimeout();
6926
+ if (isPlaying) {
6927
+ const timeout = isFullscreen ? 2e3 : 3e3;
6928
+ controlsTimeoutRef.current = window.setTimeout(() => {
6929
+ setShowControls(false);
6930
+ }, timeout);
6931
+ }
6932
+ }, [isPlaying, isFullscreen, clearControlsTimeout]);
6933
+ const handleMouseMove = useCallback(
6934
+ (event) => {
6935
+ const currentX = event.clientX;
6936
+ const currentY = event.clientY;
6937
+ const lastPos = lastMousePositionRef.current;
6938
+ const hasMoved = Math.abs(currentX - lastPos.x) > 5 || Math.abs(currentY - lastPos.y) > 5;
6939
+ if (hasMoved) {
6940
+ lastMousePositionRef.current = { x: currentX, y: currentY };
6941
+ showControlsWithTimer();
6942
+ }
6943
+ },
6944
+ [showControlsWithTimer]
6945
+ );
6821
6946
  useEffect11(() => {
6822
6947
  if (videoRef.current) {
6823
6948
  videoRef.current.volume = volume;
@@ -6825,84 +6950,129 @@ var VideoPlayer = ({
6825
6950
  }
6826
6951
  }, [volume, isMuted]);
6827
6952
  useEffect11(() => {
6828
- if (!autoSave || !storageKey) return;
6829
- const raw = localStorage.getItem(`${storageKey}-${src}`);
6830
- const saved = raw !== null ? Number(raw) : NaN;
6831
- const hasValidSaved = Number.isFinite(saved) && saved >= 0;
6832
- const hasValidInitial = Number.isFinite(initialTime) && initialTime >= 0;
6833
- let start;
6834
- if (hasValidInitial) {
6835
- start = initialTime;
6836
- } else if (hasValidSaved) {
6837
- start = saved;
6953
+ const video = videoRef.current;
6954
+ if (!video) return;
6955
+ const onPlay = () => setIsPlaying(true);
6956
+ const onPause = () => setIsPlaying(false);
6957
+ const onEnded = () => setIsPlaying(false);
6958
+ video.addEventListener("play", onPlay);
6959
+ video.addEventListener("pause", onPause);
6960
+ video.addEventListener("ended", onEnded);
6961
+ return () => {
6962
+ video.removeEventListener("play", onPlay);
6963
+ video.removeEventListener("pause", onPause);
6964
+ video.removeEventListener("ended", onEnded);
6965
+ };
6966
+ }, []);
6967
+ useEffect11(() => {
6968
+ if (isPlaying) {
6969
+ showControlsWithTimer();
6838
6970
  } else {
6839
- start = void 0;
6971
+ clearControlsTimeout();
6972
+ setShowControls(true);
6973
+ }
6974
+ }, [isPlaying, showControlsWithTimer, clearControlsTimeout]);
6975
+ useEffect11(() => {
6976
+ const handleFullscreenChange = () => {
6977
+ const isCurrentlyFullscreen = !!document.fullscreenElement;
6978
+ setIsFullscreen(isCurrentlyFullscreen);
6979
+ if (isCurrentlyFullscreen) {
6980
+ showControlsWithTimer();
6981
+ }
6982
+ };
6983
+ document.addEventListener("fullscreenchange", handleFullscreenChange);
6984
+ return () => {
6985
+ document.removeEventListener("fullscreenchange", handleFullscreenChange);
6986
+ };
6987
+ }, [showControlsWithTimer]);
6988
+ const getInitialTime = useCallback(() => {
6989
+ if (!autoSave || !storageKey) {
6990
+ return Number.isFinite(initialTime) && initialTime >= 0 ? initialTime : void 0;
6840
6991
  }
6992
+ const saved = Number(localStorage.getItem(`${storageKey}-${src}`) || NaN);
6993
+ const hasValidInitial = Number.isFinite(initialTime) && initialTime >= 0;
6994
+ const hasValidSaved = Number.isFinite(saved) && saved >= 0;
6995
+ if (hasValidInitial) return initialTime;
6996
+ if (hasValidSaved) return saved;
6997
+ return void 0;
6998
+ }, [autoSave, storageKey, src, initialTime]);
6999
+ useEffect11(() => {
7000
+ const start = getInitialTime();
6841
7001
  if (start !== void 0 && videoRef.current) {
6842
7002
  videoRef.current.currentTime = start;
6843
7003
  setCurrentTime(start);
6844
7004
  }
6845
- }, [src, storageKey, autoSave, initialTime]);
6846
- const saveProgress = useCallback(() => {
6847
- if (!autoSave || !storageKey) return;
6848
- const now = Date.now();
6849
- if (now - lastSaveTimeRef.current > 5e3) {
6850
- localStorage.setItem(`${storageKey}-${src}`, currentTime.toString());
6851
- lastSaveTimeRef.current = now;
6852
- }
6853
- }, [autoSave, storageKey, src, currentTime]);
6854
- const togglePlayPause = useCallback(() => {
6855
- if (videoRef.current) {
6856
- if (isPlaying) {
6857
- videoRef.current.pause();
6858
- } else {
6859
- videoRef.current.play();
7005
+ }, [getInitialTime]);
7006
+ const saveProgress = useCallback(
7007
+ (time) => {
7008
+ if (!autoSave || !storageKey) return;
7009
+ const now = Date.now();
7010
+ if (now - lastSaveTimeRef.current > 5e3) {
7011
+ localStorage.setItem(`${storageKey}-${src}`, time.toString());
7012
+ lastSaveTimeRef.current = now;
6860
7013
  }
6861
- setIsPlaying(!isPlaying);
7014
+ },
7015
+ [autoSave, storageKey, src]
7016
+ );
7017
+ const togglePlayPause = useCallback(async () => {
7018
+ const video = videoRef.current;
7019
+ if (!video) return;
7020
+ if (!video.paused) {
7021
+ video.pause();
7022
+ return;
7023
+ }
7024
+ try {
7025
+ await video.play();
7026
+ } catch {
6862
7027
  }
6863
- }, [isPlaying]);
7028
+ }, []);
6864
7029
  const handleVolumeChange = useCallback(
6865
7030
  (newVolume) => {
6866
- if (videoRef.current) {
6867
- const volumeValue = newVolume / 100;
6868
- videoRef.current.volume = volumeValue;
6869
- setVolume(volumeValue);
6870
- if (volumeValue === 0) {
6871
- videoRef.current.muted = true;
6872
- setIsMuted(true);
6873
- } else if (isMuted) {
6874
- videoRef.current.muted = false;
6875
- setIsMuted(false);
6876
- }
7031
+ const video = videoRef.current;
7032
+ if (!video) return;
7033
+ const volumeValue = newVolume / 100;
7034
+ video.volume = volumeValue;
7035
+ setVolume(volumeValue);
7036
+ const shouldMute = volumeValue === 0;
7037
+ const shouldUnmute = volumeValue > 0 && isMuted;
7038
+ if (shouldMute) {
7039
+ video.muted = true;
7040
+ setIsMuted(true);
7041
+ } else if (shouldUnmute) {
7042
+ video.muted = false;
7043
+ setIsMuted(false);
6877
7044
  }
6878
7045
  },
6879
7046
  [isMuted]
6880
7047
  );
6881
7048
  const toggleMute = useCallback(() => {
6882
- if (videoRef.current) {
6883
- if (isMuted) {
6884
- const restoreVolume = volume > 0 ? volume : 0.5;
6885
- videoRef.current.volume = restoreVolume;
6886
- videoRef.current.muted = false;
6887
- setVolume(restoreVolume);
6888
- setIsMuted(false);
6889
- } else {
6890
- videoRef.current.muted = true;
6891
- setIsMuted(true);
6892
- }
7049
+ const video = videoRef.current;
7050
+ if (!video) return;
7051
+ if (isMuted) {
7052
+ const restoreVolume = volume > 0 ? volume : 0.5;
7053
+ video.volume = restoreVolume;
7054
+ video.muted = false;
7055
+ setVolume(restoreVolume);
7056
+ setIsMuted(false);
7057
+ } else {
7058
+ video.muted = true;
7059
+ setIsMuted(true);
6893
7060
  }
6894
7061
  }, [isMuted, volume]);
7062
+ const handleSeek = useCallback((newTime) => {
7063
+ const video = videoRef.current;
7064
+ if (video) {
7065
+ video.currentTime = newTime;
7066
+ }
7067
+ }, []);
6895
7068
  const toggleFullscreen = useCallback(() => {
6896
7069
  const container = videoRef.current?.parentElement;
6897
7070
  if (!container) return;
6898
- if (!isFullscreen) {
6899
- if (container.requestFullscreen) {
6900
- container.requestFullscreen();
6901
- }
6902
- } else if (document.exitFullscreen) {
7071
+ if (!isFullscreen && container.requestFullscreen) {
7072
+ container.requestFullscreen();
7073
+ } else if (isFullscreen && document.exitFullscreen) {
6903
7074
  document.exitFullscreen();
6904
7075
  }
6905
- setIsFullscreen(!isFullscreen);
6906
7076
  }, [isFullscreen]);
6907
7077
  const handleSpeedChange = useCallback((speed) => {
6908
7078
  if (videoRef.current) {
@@ -6915,39 +7085,43 @@ var VideoPlayer = ({
6915
7085
  setShowSpeedMenu(!showSpeedMenu);
6916
7086
  }, [showSpeedMenu]);
6917
7087
  const toggleCaptions = useCallback(() => {
6918
- if (!trackRef.current?.track) return;
7088
+ if (!trackRef.current?.track || !subtitles) return;
6919
7089
  const newShowCaptions = !showCaptions;
6920
7090
  setShowCaptions(newShowCaptions);
6921
- trackRef.current.track.mode = newShowCaptions ? "showing" : "hidden";
6922
- }, [showCaptions]);
6923
- const handleTimeUpdate = useCallback(() => {
6924
- if (videoRef.current) {
6925
- const current = videoRef.current.currentTime;
6926
- setCurrentTime(current);
6927
- saveProgress();
6928
- onTimeUpdate?.(current);
6929
- if (duration > 0) {
6930
- const progressPercent = current / duration * 100;
6931
- onProgress?.(progressPercent);
6932
- if (progressPercent >= 95 && !hasCompleted) {
6933
- setHasCompleted(true);
6934
- onVideoComplete?.();
6935
- }
7091
+ trackRef.current.track.mode = newShowCaptions && subtitles ? "showing" : "hidden";
7092
+ }, [showCaptions, subtitles]);
7093
+ const checkVideoCompletion = useCallback(
7094
+ (progressPercent) => {
7095
+ if (progressPercent >= 95 && !hasCompleted) {
7096
+ setHasCompleted(true);
7097
+ onVideoComplete?.();
6936
7098
  }
7099
+ },
7100
+ [hasCompleted, onVideoComplete]
7101
+ );
7102
+ const handleTimeUpdate = useCallback(() => {
7103
+ const video = videoRef.current;
7104
+ if (!video) return;
7105
+ const current = video.currentTime;
7106
+ setCurrentTime(current);
7107
+ saveProgress(current);
7108
+ onTimeUpdate?.(current);
7109
+ if (duration > 0) {
7110
+ const progressPercent = current / duration * 100;
7111
+ onProgress?.(progressPercent);
7112
+ checkVideoCompletion(progressPercent);
6937
7113
  }
6938
- }, [
6939
- duration,
6940
- saveProgress,
6941
- onTimeUpdate,
6942
- onProgress,
6943
- onVideoComplete,
6944
- hasCompleted
6945
- ]);
7114
+ }, [duration, saveProgress, onTimeUpdate, onProgress, checkVideoCompletion]);
6946
7115
  const handleLoadedMetadata = useCallback(() => {
6947
7116
  if (videoRef.current) {
6948
7117
  setDuration(videoRef.current.duration);
6949
7118
  }
6950
7119
  }, []);
7120
+ useEffect11(() => {
7121
+ if (trackRef.current?.track) {
7122
+ trackRef.current.track.mode = showCaptions && subtitles ? "showing" : "hidden";
7123
+ }
7124
+ }, [subtitles, showCaptions]);
6951
7125
  useEffect11(() => {
6952
7126
  const handleVisibilityChange = () => {
6953
7127
  if (document.hidden && isPlaying && videoRef.current) {
@@ -6966,9 +7140,78 @@ var VideoPlayer = ({
6966
7140
  return () => {
6967
7141
  document.removeEventListener("visibilitychange", handleVisibilityChange);
6968
7142
  window.removeEventListener("blur", handleBlur);
7143
+ clearControlsTimeout();
7144
+ clearMouseMoveTimeout();
6969
7145
  };
6970
- }, [isPlaying]);
7146
+ }, [isPlaying, clearControlsTimeout, clearMouseMoveTimeout]);
6971
7147
  const progressPercentage = duration > 0 ? currentTime / duration * 100 : 0;
7148
+ const getTopControlsOpacity = useCallback(() => {
7149
+ if (isFullscreen) {
7150
+ return showControls ? "opacity-100" : "opacity-0";
7151
+ }
7152
+ return !isPlaying || showControls ? "opacity-100" : "opacity-0 group-hover:opacity-100";
7153
+ }, [isFullscreen, showControls, isPlaying]);
7154
+ const getBottomControlsOpacity = useCallback(() => {
7155
+ if (isFullscreen) {
7156
+ return showControls ? "opacity-100" : "opacity-0";
7157
+ }
7158
+ return !isPlaying || showControls ? "opacity-100" : "opacity-0 group-hover:opacity-100";
7159
+ }, [isFullscreen, showControls, isPlaying]);
7160
+ const handleVideoKeyDown = useCallback(
7161
+ (e) => {
7162
+ if (e.key) {
7163
+ e.stopPropagation();
7164
+ showControlsWithTimer();
7165
+ }
7166
+ switch (e.key) {
7167
+ case " ":
7168
+ case "Enter":
7169
+ e.preventDefault();
7170
+ togglePlayPause();
7171
+ break;
7172
+ case "ArrowLeft":
7173
+ e.preventDefault();
7174
+ if (videoRef.current) {
7175
+ videoRef.current.currentTime -= 10;
7176
+ }
7177
+ break;
7178
+ case "ArrowRight":
7179
+ e.preventDefault();
7180
+ if (videoRef.current) {
7181
+ videoRef.current.currentTime += 10;
7182
+ }
7183
+ break;
7184
+ case "ArrowUp":
7185
+ e.preventDefault();
7186
+ handleVolumeChange(Math.min(100, volume * 100 + 10));
7187
+ break;
7188
+ case "ArrowDown":
7189
+ e.preventDefault();
7190
+ handleVolumeChange(Math.max(0, volume * 100 - 10));
7191
+ break;
7192
+ case "m":
7193
+ case "M":
7194
+ e.preventDefault();
7195
+ toggleMute();
7196
+ break;
7197
+ case "f":
7198
+ case "F":
7199
+ e.preventDefault();
7200
+ toggleFullscreen();
7201
+ break;
7202
+ default:
7203
+ break;
7204
+ }
7205
+ },
7206
+ [
7207
+ showControlsWithTimer,
7208
+ togglePlayPause,
7209
+ handleVolumeChange,
7210
+ volume,
7211
+ toggleMute,
7212
+ toggleFullscreen
7213
+ ]
7214
+ );
6972
7215
  return /* @__PURE__ */ jsxs30("div", { className: cn("flex flex-col", className), children: [
6973
7216
  (title || subtitleText) && /* @__PURE__ */ jsx36("div", { className: "bg-subject-1 rounded-t-xl px-8 py-4 flex items-end justify-between min-h-20", children: /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", children: [
6974
7217
  title && /* @__PURE__ */ jsx36(
@@ -6995,12 +7238,17 @@ var VideoPlayer = ({
6995
7238
  )
6996
7239
  ] }) }),
6997
7240
  /* @__PURE__ */ jsxs30(
6998
- "div",
7241
+ "section",
6999
7242
  {
7000
7243
  className: cn(
7001
7244
  "relative w-full bg-background overflow-hidden group",
7002
- title || subtitleText ? "rounded-b-xl" : "rounded-xl"
7245
+ title || subtitleText ? "rounded-b-xl" : "rounded-xl",
7246
+ // Hide cursor when controls are hidden and video is playing in fullscreen
7247
+ isFullscreen && isPlaying && !showControls ? "cursor-none" : "cursor-default"
7003
7248
  ),
7249
+ "aria-label": title ? `Video player: ${title}` : "Video player",
7250
+ onMouseMove: isFullscreen ? handleMouseMove : showControlsWithTimer,
7251
+ onMouseEnter: showControlsWithTimer,
7004
7252
  children: [
7005
7253
  /* @__PURE__ */ jsx36(
7006
7254
  "video",
@@ -7013,39 +7261,7 @@ var VideoPlayer = ({
7013
7261
  onTimeUpdate: handleTimeUpdate,
7014
7262
  onLoadedMetadata: handleLoadedMetadata,
7015
7263
  onClick: togglePlayPause,
7016
- onKeyDown: (e) => {
7017
- if (e.key) {
7018
- setShowControls(true);
7019
- }
7020
- if (e.key === " " || e.key === "Enter") {
7021
- e.preventDefault();
7022
- togglePlayPause();
7023
- }
7024
- if (e.key === "ArrowLeft" && videoRef.current) {
7025
- e.preventDefault();
7026
- videoRef.current.currentTime -= 10;
7027
- }
7028
- if (e.key === "ArrowRight" && videoRef.current) {
7029
- e.preventDefault();
7030
- videoRef.current.currentTime += 10;
7031
- }
7032
- if (e.key === "ArrowUp") {
7033
- e.preventDefault();
7034
- handleVolumeChange(Math.min(100, volume * 100 + 10));
7035
- }
7036
- if (e.key === "ArrowDown") {
7037
- e.preventDefault();
7038
- handleVolumeChange(Math.max(0, volume * 100 - 10));
7039
- }
7040
- if (e.key === "m" || e.key === "M") {
7041
- e.preventDefault();
7042
- toggleMute();
7043
- }
7044
- if (e.key === "f" || e.key === "F") {
7045
- e.preventDefault();
7046
- toggleFullscreen();
7047
- }
7048
- },
7264
+ onKeyDown: handleVideoKeyDown,
7049
7265
  tabIndex: 0,
7050
7266
  "aria-label": title ? `Video: ${title}` : "Video player",
7051
7267
  children: /* @__PURE__ */ jsx36(
@@ -7053,9 +7269,9 @@ var VideoPlayer = ({
7053
7269
  {
7054
7270
  ref: trackRef,
7055
7271
  kind: "captions",
7056
- src: subtitles || "data:text/vtt;charset=utf-8,WEBVTT%0A%0ANOTE%20No%20captions%20available",
7057
- srcLang: "en",
7058
- label: subtitles ? "Subtitles" : "No captions available",
7272
+ src: subtitles || "data:text/vtt;charset=utf-8,WEBVTT",
7273
+ srcLang: "pt-br",
7274
+ label: subtitles ? "Legendas em Portugu\xEAs" : "Sem legendas dispon\xEDveis",
7059
7275
  default: false
7060
7276
  }
7061
7277
  )
@@ -7075,9 +7291,9 @@ var VideoPlayer = ({
7075
7291
  {
7076
7292
  className: cn(
7077
7293
  "absolute top-0 left-0 right-0 p-4 bg-gradient-to-b from-black/70 to-transparent transition-opacity",
7078
- !isPlaying || showControls ? "opacity-100" : "opacity-0 group-hover:opacity-100"
7294
+ getTopControlsOpacity()
7079
7295
  ),
7080
- children: /* @__PURE__ */ jsx36("div", { className: "ml-auto block", children: /* @__PURE__ */ jsx36(
7296
+ children: /* @__PURE__ */ jsx36("div", { className: "flex justify-start", children: /* @__PURE__ */ jsx36(
7081
7297
  IconButton_default,
7082
7298
  {
7083
7299
  icon: isFullscreen ? /* @__PURE__ */ jsx36(ArrowsInSimple, { size: 24 }) : /* @__PURE__ */ jsx36(ArrowsOutSimple, { size: 24 }),
@@ -7093,29 +7309,18 @@ var VideoPlayer = ({
7093
7309
  {
7094
7310
  className: cn(
7095
7311
  "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/90 to-transparent transition-opacity",
7096
- !isPlaying || showControls ? "opacity-100" : "opacity-0 group-hover:opacity-100"
7312
+ getBottomControlsOpacity()
7097
7313
  ),
7098
7314
  children: [
7099
- /* @__PURE__ */ jsx36("div", { className: "px-4 pb-2", children: /* @__PURE__ */ jsx36(
7100
- "input",
7315
+ /* @__PURE__ */ jsx36(
7316
+ ProgressBar2,
7101
7317
  {
7102
- type: "range",
7103
- min: 0,
7104
- max: duration || 100,
7105
- value: currentTime,
7106
- onChange: (e) => {
7107
- const newTime = parseFloat(e.target.value);
7108
- if (videoRef.current) {
7109
- videoRef.current.currentTime = newTime;
7110
- }
7111
- },
7112
- className: "w-full h-1 bg-neutral-600 rounded-full appearance-none cursor-pointer slider:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-primary-500",
7113
- "aria-label": "Video progress",
7114
- style: {
7115
- background: `linear-gradient(to right, #2271C4 ${progressPercentage}%, #D5D4D4 ${progressPercentage}%)`
7116
- }
7318
+ currentTime,
7319
+ duration,
7320
+ progressPercentage,
7321
+ onSeek: handleSeek
7117
7322
  }
7118
- ) }),
7323
+ ),
7119
7324
  /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between px-4 pb-4", children: [
7120
7325
  /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-4", children: [
7121
7326
  /* @__PURE__ */ jsx36(
@@ -7127,32 +7332,15 @@ var VideoPlayer = ({
7127
7332
  className: "!bg-transparent !text-white hover:!bg-white/20"
7128
7333
  }
7129
7334
  ),
7130
- /* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
7131
- /* @__PURE__ */ jsx36(
7132
- IconButton_default,
7133
- {
7134
- icon: isMuted ? /* @__PURE__ */ jsx36(SpeakerSlash, { size: 24 }) : /* @__PURE__ */ jsx36(SpeakerHigh2, { size: 24 }),
7135
- onClick: toggleMute,
7136
- "aria-label": isMuted ? "Unmute" : "Mute",
7137
- className: "!bg-transparent !text-white hover:!bg-white/20"
7138
- }
7139
- ),
7140
- /* @__PURE__ */ jsx36(
7141
- "input",
7142
- {
7143
- type: "range",
7144
- min: 0,
7145
- max: 100,
7146
- value: Math.round(volume * 100),
7147
- onChange: (e) => handleVolumeChange(parseInt(e.target.value)),
7148
- className: "w-20 h-1 bg-neutral-600 rounded-full appearance-none cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-500",
7149
- "aria-label": "Volume control",
7150
- style: {
7151
- background: `linear-gradient(to right, #2271C4 ${volume * 100}%, #D5D4D4 ${volume * 100}%)`
7152
- }
7153
- }
7154
- )
7155
- ] }),
7335
+ /* @__PURE__ */ jsx36(
7336
+ VolumeControls,
7337
+ {
7338
+ volume,
7339
+ isMuted,
7340
+ onVolumeChange: handleVolumeChange,
7341
+ onToggleMute: toggleMute
7342
+ }
7343
+ ),
7156
7344
  subtitles && /* @__PURE__ */ jsx36(
7157
7345
  IconButton_default,
7158
7346
  {
@@ -7171,29 +7359,15 @@ var VideoPlayer = ({
7171
7359
  formatTime(duration)
7172
7360
  ] })
7173
7361
  ] }),
7174
- /* @__PURE__ */ jsx36("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs30("div", { className: "relative", children: [
7175
- /* @__PURE__ */ jsx36(
7176
- IconButton_default,
7177
- {
7178
- icon: /* @__PURE__ */ jsx36(DotsThreeVertical2, { size: 24 }),
7179
- onClick: toggleSpeedMenu,
7180
- "aria-label": "Playback speed",
7181
- className: "!bg-transparent !text-white hover:!bg-white/20"
7182
- }
7183
- ),
7184
- showSpeedMenu && /* @__PURE__ */ jsx36("div", { className: "absolute bottom-12 right-0 bg-black/90 rounded-lg p-2 min-w-20", children: [0.5, 0.75, 1, 1.25, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs30(
7185
- "button",
7186
- {
7187
- onClick: () => handleSpeedChange(speed),
7188
- className: `block w-full text-left px-3 py-1 text-sm rounded hover:bg-white/20 transition-colors ${playbackRate === speed ? "text-primary-400" : "text-white"}`,
7189
- children: [
7190
- speed,
7191
- "x"
7192
- ]
7193
- },
7194
- speed
7195
- )) })
7196
- ] }) })
7362
+ /* @__PURE__ */ jsx36("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx36(
7363
+ SpeedMenu,
7364
+ {
7365
+ showSpeedMenu,
7366
+ playbackRate,
7367
+ onToggleMenu: toggleSpeedMenu,
7368
+ onSpeedChange: handleSpeedChange
7369
+ }
7370
+ ) })
7197
7371
  ] })
7198
7372
  ]
7199
7373
  }
@@ -7699,6 +7873,8 @@ var useQuizStore = create7()(
7699
7873
  isFinished: false,
7700
7874
  userId: "",
7701
7875
  variant: "default",
7876
+ questionsResult: null,
7877
+ currentQuestionResult: null,
7702
7878
  // Setters
7703
7879
  setBySimulated: (simulado) => set({ bySimulated: simulado }),
7704
7880
  setByActivity: (atividade) => set({ byActivity: atividade }),
@@ -7707,6 +7883,7 @@ var useQuizStore = create7()(
7707
7883
  setUserAnswers: (userAnswers) => set({ userAnswers }),
7708
7884
  getUserId: () => get().userId,
7709
7885
  setVariant: (variant) => set({ variant }),
7886
+ setQuestionResult: (questionsResult) => set({ questionsResult }),
7710
7887
  // Navigation
7711
7888
  goToNextQuestion: () => {
7712
7889
  const { currentQuestionIndex, getTotalQuestions } = get();
@@ -7759,9 +7936,9 @@ var useQuizStore = create7()(
7759
7936
  questionId,
7760
7937
  activityId,
7761
7938
  userId,
7762
- answer: question.type === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId : null,
7763
- optionId: question.type === "DISSERTATIVA" /* DISSERTATIVA */ ? null : answerId,
7764
- questionType: question.type,
7939
+ answer: question.questionType === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId : null,
7940
+ optionId: question.questionType === "DISSERTATIVA" /* DISSERTATIVA */ ? null : answerId,
7941
+ questionType: question.questionType,
7765
7942
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7766
7943
  };
7767
7944
  let updatedUserAnswers;
@@ -7801,7 +7978,7 @@ var useQuizStore = create7()(
7801
7978
  // selectMultipleAnswer is for non-dissertative questions
7802
7979
  optionId: answerId,
7803
7980
  // selectMultipleAnswer should only set optionId
7804
- questionType: question.type,
7981
+ questionType: question.questionType,
7805
7982
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7806
7983
  })
7807
7984
  );
@@ -7828,7 +8005,7 @@ var useQuizStore = create7()(
7828
8005
  const question = activeQuiz.quiz.questions.find(
7829
8006
  (q) => q.id === questionId
7830
8007
  );
7831
- if (!question || question.type !== "DISSERTATIVA" /* DISSERTATIVA */) {
8008
+ if (!question || question.questionType !== "DISSERTATIVA" /* DISSERTATIVA */) {
7832
8009
  console.warn(
7833
8010
  "selectDissertativeAnswer called for non-dissertative question"
7834
8011
  );
@@ -7878,7 +8055,7 @@ var useQuizStore = create7()(
7878
8055
  userId,
7879
8056
  answer: null,
7880
8057
  optionId: null,
7881
- questionType: currentQuestion.type,
8058
+ questionType: currentQuestion.questionType,
7882
8059
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7883
8060
  };
7884
8061
  let updatedUserAnswers;
@@ -7914,9 +8091,9 @@ var useQuizStore = create7()(
7914
8091
  questionId,
7915
8092
  activityId,
7916
8093
  userId,
7917
- answer: question.type === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
7918
- optionId: question.type !== "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
7919
- questionType: question.type,
8094
+ answer: question.questionType === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
8095
+ optionId: question.questionType !== "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
8096
+ questionType: question.questionType,
7920
8097
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7921
8098
  };
7922
8099
  if (existingAnswerIndex !== -1) {
@@ -7944,7 +8121,10 @@ var useQuizStore = create7()(
7944
8121
  timeElapsed: 0,
7945
8122
  isStarted: false,
7946
8123
  isFinished: false,
7947
- userId: ""
8124
+ userId: "",
8125
+ variant: "default",
8126
+ questionsResult: null,
8127
+ currentQuestionResult: null
7948
8128
  });
7949
8129
  },
7950
8130
  // Timer
@@ -8146,6 +8326,31 @@ var useQuizStore = create7()(
8146
8326
  (q) => q.id === questionId
8147
8327
  );
8148
8328
  return questionIndex + 1;
8329
+ },
8330
+ // Question Result
8331
+ getQuestionResultByQuestionId: (questionId) => {
8332
+ const { questionsResult } = get();
8333
+ return questionsResult?.answers.find(
8334
+ (answer) => answer.questionId === questionId
8335
+ ) || null;
8336
+ },
8337
+ getQuestionResultStatistics: () => {
8338
+ const { questionsResult } = get();
8339
+ return questionsResult?.statistics || null;
8340
+ },
8341
+ getQuestionResult: () => {
8342
+ const { questionsResult } = get();
8343
+ return questionsResult;
8344
+ },
8345
+ setQuestionsResult: (questionsResult) => {
8346
+ set({ questionsResult });
8347
+ },
8348
+ setCurrentQuestionResult: (currentQuestionResult) => {
8349
+ set({ currentQuestionResult });
8350
+ },
8351
+ getCurrentQuestionResult: () => {
8352
+ const { currentQuestionResult } = get();
8353
+ return currentQuestionResult;
8149
8354
  }
8150
8355
  };
8151
8356
  },
@@ -8201,18 +8406,21 @@ var Quiz = forwardRef19(({ children, className, variant = "default", ...props },
8201
8406
  });
8202
8407
  var QuizHeaderResult = forwardRef19(
8203
8408
  ({ className, ...props }, ref) => {
8204
- const { getAllCurrentAnswer } = useQuizStore();
8205
- const usersAnswer = getAllCurrentAnswer();
8409
+ const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
8206
8410
  const [isCorrect, setIsCorrect] = useState16(false);
8207
8411
  useEffect14(() => {
8208
- if (usersAnswer) {
8209
- setIsCorrect(
8210
- usersAnswer.length > 0 ? usersAnswer.map(
8211
- (answer) => answer.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */
8212
- ).every(Boolean) : false
8213
- );
8412
+ const cq = getCurrentQuestion();
8413
+ if (!cq) {
8414
+ setIsCorrect(false);
8415
+ return;
8214
8416
  }
8215
- }, [usersAnswer]);
8417
+ const qr = getQuestionResultByQuestionId(cq.id);
8418
+ setIsCorrect(qr?.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */);
8419
+ }, [
8420
+ getCurrentQuestion,
8421
+ getQuestionResultByQuestionId,
8422
+ getCurrentQuestion()?.id
8423
+ ]);
8216
8424
  return /* @__PURE__ */ jsxs32(
8217
8425
  "div",
8218
8426
  {
@@ -8295,7 +8503,7 @@ var QuizContainer = forwardRef19(({ children, className, ...props }, ref) => {
8295
8503
  );
8296
8504
  });
8297
8505
  var QuizContent = forwardRef19(({ paddingBottom }) => {
8298
- const { getCurrentQuestion, variant } = useQuizStore();
8506
+ const { getCurrentQuestion } = useQuizStore();
8299
8507
  const currentQuestion = getCurrentQuestion();
8300
8508
  const questionComponents = {
8301
8509
  ["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
@@ -8306,26 +8514,35 @@ var QuizContent = forwardRef19(({ paddingBottom }) => {
8306
8514
  ["PREENCHER" /* PREENCHER */]: QuizFill,
8307
8515
  ["IMAGEM" /* IMAGEM */]: QuizImageQuestion
8308
8516
  };
8309
- const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.type] : null;
8310
- return QuestionComponent ? /* @__PURE__ */ jsx39(QuestionComponent, { variant, paddingBottom }) : null;
8517
+ const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.questionType] : null;
8518
+ return QuestionComponent ? /* @__PURE__ */ jsx39(QuestionComponent, { paddingBottom }) : null;
8311
8519
  });
8312
- var QuizAlternative = ({
8313
- variant = "default",
8314
- paddingBottom
8315
- }) => {
8316
- const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
8520
+ var QuizAlternative = ({ paddingBottom }) => {
8521
+ const {
8522
+ getCurrentQuestion,
8523
+ selectAnswer,
8524
+ getQuestionResultByQuestionId,
8525
+ getCurrentAnswer,
8526
+ variant
8527
+ } = useQuizStore();
8317
8528
  const currentQuestion = getCurrentQuestion();
8529
+ const currentQuestionResult = getQuestionResultByQuestionId(
8530
+ currentQuestion?.id || ""
8531
+ );
8318
8532
  const currentAnswer = getCurrentAnswer();
8319
8533
  const alternatives = currentQuestion?.options?.map((option) => {
8320
8534
  let status = "neutral" /* NEUTRAL */;
8321
8535
  if (variant === "result") {
8322
- const isCorrectOption = currentQuestion.options.find(
8323
- (op) => op.isCorrect
8536
+ const isCorrectOption = currentQuestion.correctOptionIds?.includes(
8537
+ option.id
8324
8538
  );
8325
- if (isCorrectOption?.id === option.id) {
8539
+ const isSelected = currentQuestionResult?.optionId === option.id;
8540
+ if (isCorrectOption) {
8326
8541
  status = "correct" /* CORRECT */;
8327
- } else if (currentAnswer?.optionId === option.id && option.id !== isCorrectOption?.id) {
8542
+ } else if (isSelected && !isCorrectOption) {
8328
8543
  status = "incorrect" /* INCORRECT */;
8544
+ } else {
8545
+ status = "neutral" /* NEUTRAL */;
8329
8546
  }
8330
8547
  }
8331
8548
  return {
@@ -8345,8 +8562,8 @@ var QuizAlternative = ({
8345
8562
  name: `question-${currentQuestion?.id || "1"}`,
8346
8563
  layout: "compact",
8347
8564
  alternatives,
8348
- value: currentAnswer?.optionId || "",
8349
- selectedValue: currentAnswer?.optionId || "",
8565
+ value: variant === "result" ? currentQuestionResult?.optionId || "" : currentAnswer?.optionId || "",
8566
+ selectedValue: variant === "result" ? currentQuestionResult?.optionId || "" : currentAnswer?.optionId || "",
8350
8567
  onValueChange: (value) => {
8351
8568
  if (currentQuestion) {
8352
8569
  selectAnswer(currentQuestion.id, value);
@@ -8357,13 +8574,19 @@ var QuizAlternative = ({
8357
8574
  ) }) })
8358
8575
  ] });
8359
8576
  };
8360
- var QuizMultipleChoice = ({
8361
- variant = "default",
8362
- paddingBottom
8363
- }) => {
8364
- const { getCurrentQuestion, selectMultipleAnswer, getAllCurrentAnswer } = useQuizStore();
8577
+ var QuizMultipleChoice = ({ paddingBottom }) => {
8578
+ const {
8579
+ getCurrentQuestion,
8580
+ selectMultipleAnswer,
8581
+ getAllCurrentAnswer,
8582
+ getQuestionResultByQuestionId,
8583
+ variant
8584
+ } = useQuizStore();
8365
8585
  const currentQuestion = getCurrentQuestion();
8366
8586
  const allCurrentAnswers = getAllCurrentAnswer();
8587
+ const currentQuestionResult = getQuestionResultByQuestionId(
8588
+ currentQuestion?.id || ""
8589
+ );
8367
8590
  const prevSelectedValuesRef = useRef10([]);
8368
8591
  const prevQuestionIdRef = useRef10("");
8369
8592
  const allCurrentAnswerIds = useMemo6(() => {
@@ -8385,8 +8608,16 @@ var QuizMultipleChoice = ({
8385
8608
  prevSelectedValuesRef.current = selectedValues;
8386
8609
  return selectedValues;
8387
8610
  }
8611
+ if (variant == "result" && currentQuestionResult?.options.length && currentQuestionResult?.options.length > 0) {
8612
+ return currentQuestionResult?.options.map((op) => op.id) || [];
8613
+ }
8388
8614
  return prevSelectedValuesRef.current;
8389
- }, [selectedValues, currentQuestion?.id]);
8615
+ }, [
8616
+ selectedValues,
8617
+ currentQuestion?.id,
8618
+ variant,
8619
+ currentQuestionResult?.optionId
8620
+ ]);
8390
8621
  const handleSelectedValues = useCallback4(
8391
8622
  (values) => {
8392
8623
  if (currentQuestion) {
@@ -8402,11 +8633,18 @@ var QuizMultipleChoice = ({
8402
8633
  const choices = currentQuestion?.options?.map((option) => {
8403
8634
  let status = "neutral" /* NEUTRAL */;
8404
8635
  if (variant === "result") {
8405
- const isAllCorrectOptionId = currentQuestion.options.filter((op) => op.isCorrect).map((op) => op.id);
8406
- if (isAllCorrectOptionId.includes(option.id)) {
8636
+ const isCorrectOption = currentQuestion.correctOptionIds?.includes(
8637
+ option.id
8638
+ );
8639
+ const isSelected = currentQuestionResult?.options.find(
8640
+ (op) => op.id === option.id
8641
+ );
8642
+ if (isCorrectOption) {
8407
8643
  status = "correct" /* CORRECT */;
8408
- } else if (allCurrentAnswerIds?.includes(option.id) && !isAllCorrectOptionId.includes(option.id)) {
8644
+ } else if (isSelected && !isCorrectOption) {
8409
8645
  status = "incorrect" /* INCORRECT */;
8646
+ } else {
8647
+ status = "neutral" /* NEUTRAL */;
8410
8648
  }
8411
8649
  }
8412
8650
  return {
@@ -8432,12 +8670,18 @@ var QuizMultipleChoice = ({
8432
8670
  ) }) })
8433
8671
  ] });
8434
8672
  };
8435
- var QuizDissertative = ({
8436
- variant = "default",
8437
- paddingBottom
8438
- }) => {
8439
- const { getCurrentQuestion, getCurrentAnswer, selectDissertativeAnswer } = useQuizStore();
8673
+ var QuizDissertative = ({ paddingBottom }) => {
8674
+ const {
8675
+ getCurrentQuestion,
8676
+ getCurrentAnswer,
8677
+ selectDissertativeAnswer,
8678
+ getQuestionResultByQuestionId,
8679
+ variant
8680
+ } = useQuizStore();
8440
8681
  const currentQuestion = getCurrentQuestion();
8682
+ const currentQuestionResult = getQuestionResultByQuestionId(
8683
+ currentQuestion?.id || ""
8684
+ );
8441
8685
  const currentAnswer = getCurrentAnswer();
8442
8686
  const textareaRef = useRef10(null);
8443
8687
  const handleAnswerChange = (value) => {
@@ -8461,6 +8705,7 @@ var QuizDissertative = ({
8461
8705
  if (!currentQuestion) {
8462
8706
  return /* @__PURE__ */ jsx39("div", { className: "space-y-4", children: /* @__PURE__ */ jsx39("p", { className: "text-text-600 text-md", children: "Nenhuma quest\xE3o dispon\xEDvel" }) });
8463
8707
  }
8708
+ const localAnswer = (variant == "result" ? currentQuestionResult?.answer : currentAnswer?.answer) || "";
8464
8709
  return /* @__PURE__ */ jsxs32(Fragment9, { children: [
8465
8710
  /* @__PURE__ */ jsx39(QuizSubTitle, { subTitle: "Resposta" }),
8466
8711
  /* @__PURE__ */ jsx39(QuizContainer, { className: cn(variant != "result" && paddingBottom), children: /* @__PURE__ */ jsx39("div", { className: "space-y-4 max-h-[600px] overflow-y-auto", children: variant === "default" ? /* @__PURE__ */ jsx39("div", { className: "space-y-4", children: /* @__PURE__ */ jsx39(
@@ -8468,22 +8713,20 @@ var QuizDissertative = ({
8468
8713
  {
8469
8714
  ref: textareaRef,
8470
8715
  placeholder: "Escreva sua resposta",
8471
- value: currentAnswer?.answer || "",
8716
+ value: localAnswer,
8472
8717
  onChange: (e) => handleAnswerChange(e.target.value),
8473
8718
  rows: 4,
8474
8719
  className: "min-h-[120px] max-h-[400px] resize-none overflow-y-auto"
8475
8720
  }
8476
- ) }) : /* @__PURE__ */ jsx39("div", { className: "space-y-4", children: /* @__PURE__ */ jsx39("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: currentAnswer?.answer || "Nenhuma resposta fornecida" }) }) }) }),
8477
- variant === "result" && currentAnswer?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ jsxs32(Fragment9, { children: [
8721
+ ) }) : /* @__PURE__ */ jsx39("div", { className: "space-y-4", children: /* @__PURE__ */ jsx39("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: localAnswer || "Nenhuma resposta fornecida" }) }) }) }),
8722
+ variant === "result" && currentQuestionResult?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ jsxs32(Fragment9, { children: [
8478
8723
  /* @__PURE__ */ jsx39(QuizSubTitle, { subTitle: "Observa\xE7\xE3o do professor" }),
8479
8724
  /* @__PURE__ */ jsx39(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ jsx39("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Mauris euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim." }) })
8480
8725
  ] })
8481
8726
  ] });
8482
8727
  };
8483
- var QuizTrueOrFalse = ({
8484
- variant = "default",
8485
- paddingBottom
8486
- }) => {
8728
+ var QuizTrueOrFalse = ({ paddingBottom }) => {
8729
+ const { variant } = useQuizStore();
8487
8730
  const options = [
8488
8731
  {
8489
8732
  label: "25 metros",
@@ -8543,10 +8786,8 @@ var QuizTrueOrFalse = ({
8543
8786
  }) }) })
8544
8787
  ] });
8545
8788
  };
8546
- var QuizConnectDots = ({
8547
- variant = "default",
8548
- paddingBottom
8549
- }) => {
8789
+ var QuizConnectDots = ({ paddingBottom }) => {
8790
+ const { variant } = useQuizStore();
8550
8791
  const dotsOptions = [
8551
8792
  { label: "Ra\xE7\xE3o" },
8552
8793
  { label: "Rato" },
@@ -8672,10 +8913,8 @@ var QuizConnectDots = ({
8672
8913
  }) }) })
8673
8914
  ] });
8674
8915
  };
8675
- var QuizFill = ({
8676
- variant = "default",
8677
- paddingBottom = "pb-[80px]"
8678
- }) => {
8916
+ var QuizFill = ({ paddingBottom = "pb-[80px]" }) => {
8917
+ const { variant } = useQuizStore();
8679
8918
  const options = [
8680
8919
  "ci\xEAncia",
8681
8920
  "disciplina",
@@ -8844,10 +9083,8 @@ var QuizFill = ({
8844
9083
  ] })
8845
9084
  ] });
8846
9085
  };
8847
- var QuizImageQuestion = ({
8848
- variant = "default",
8849
- paddingBottom
8850
- }) => {
9086
+ var QuizImageQuestion = ({ paddingBottom }) => {
9087
+ const { variant } = useQuizStore();
8851
9088
  const correctPositionRelative = { x: 0.48, y: 0.45 };
8852
9089
  const calculateCorrectRadiusRelative = () => {
8853
9090
  const circleWidthRelative = 0.15;
@@ -9065,7 +9302,6 @@ var QuizFooter = forwardRef19(
9065
9302
  }, ref) => {
9066
9303
  const {
9067
9304
  currentQuestionIndex,
9068
- getUserAnswers,
9069
9305
  getTotalQuestions,
9070
9306
  goToNextQuestion,
9071
9307
  goToPreviousQuestion,
@@ -9075,7 +9311,7 @@ var QuizFooter = forwardRef19(
9075
9311
  getCurrentQuestion,
9076
9312
  getQuestionStatusFromUserAnswers,
9077
9313
  variant,
9078
- getActiveQuiz
9314
+ getQuestionResultStatistics
9079
9315
  } = useQuizStore();
9080
9316
  const totalQuestions = getTotalQuestions();
9081
9317
  const isFirstQuestion = currentQuestionIndex === 0;
@@ -9089,7 +9325,6 @@ var QuizFooter = forwardRef19(
9089
9325
  const [modalResolutionOpen, setModalResolutionOpen] = useState16(false);
9090
9326
  const [filterType, setFilterType] = useState16("all");
9091
9327
  const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
9092
- const userAnswers = getUserAnswers();
9093
9328
  const allQuestions = getTotalQuestions();
9094
9329
  const handleFinishQuiz = async () => {
9095
9330
  if (unansweredQuestions.length > 0) {
@@ -9249,21 +9484,9 @@ var QuizFooter = forwardRef19(
9249
9484
  /* @__PURE__ */ jsxs32("p", { className: "text-text-500 font-sm", children: [
9250
9485
  "Voc\xEA acertou",
9251
9486
  " ",
9252
- (() => {
9253
- const activeQuiz = getActiveQuiz();
9254
- if (!activeQuiz) return 0;
9255
- return userAnswers.filter((answer) => {
9256
- const question = activeQuiz.quiz.questions.find(
9257
- (q) => q.id === answer.questionId
9258
- );
9259
- const isCorrectOption = question?.options.find(
9260
- (op) => op.isCorrect
9261
- );
9262
- return question && answer.optionId === isCorrectOption?.id;
9263
- }).length;
9264
- })(),
9487
+ getQuestionResultStatistics()?.correctAnswers ?? "--",
9488
+ " de",
9265
9489
  " ",
9266
- "de ",
9267
9490
  allQuestions,
9268
9491
  " quest\xF5es."
9269
9492
  ] })
@@ -9320,7 +9543,7 @@ var QuizFooter = forwardRef19(
9320
9543
  onClose: () => setModalResolutionOpen(false),
9321
9544
  title: "Resolu\xE7\xE3o",
9322
9545
  size: "lg",
9323
- children: currentQuestion?.answerKey
9546
+ children: currentQuestion?.solutionExplanation
9324
9547
  }
9325
9548
  )
9326
9549
  ] });
@@ -9336,7 +9559,7 @@ var QuizResultHeaderTitle = forwardRef19(({ className, ...props }, ref) => {
9336
9559
  ...props,
9337
9560
  children: [
9338
9561
  /* @__PURE__ */ jsx39("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
9339
- bySimulated && /* @__PURE__ */ jsx39(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
9562
+ bySimulated && /* @__PURE__ */ jsx39(Badge_default, { variant: "solid", action: "info", children: bySimulated.type })
9340
9563
  ]
9341
9564
  }
9342
9565
  );
@@ -9360,13 +9583,11 @@ var QuizResultPerformance = forwardRef19(
9360
9583
  getTotalQuestions,
9361
9584
  timeElapsed,
9362
9585
  formatTime: formatTime2,
9363
- bySimulated,
9364
- byActivity,
9365
- byQuestionary,
9366
- getUserAnswerByQuestionId
9586
+ getQuestionResultStatistics,
9587
+ getQuestionResult
9367
9588
  } = useQuizStore();
9368
9589
  const totalQuestions = getTotalQuestions();
9369
- const quiz = bySimulated || byActivity || byQuestionary;
9590
+ const questionResult = getQuestionResult();
9370
9591
  let correctAnswers = 0;
9371
9592
  let correctEasyAnswers = 0;
9372
9593
  let correctMediumAnswers = 0;
@@ -9374,24 +9595,23 @@ var QuizResultPerformance = forwardRef19(
9374
9595
  let totalEasyQuestions = 0;
9375
9596
  let totalMediumQuestions = 0;
9376
9597
  let totalDifficultQuestions = 0;
9377
- if (quiz) {
9378
- quiz.questions.forEach((question) => {
9379
- const userAnswerItem = getUserAnswerByQuestionId(question.id);
9380
- const isCorrect = userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
9598
+ if (questionResult) {
9599
+ questionResult.answers.forEach((answer) => {
9600
+ const isCorrect = answer.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
9381
9601
  if (isCorrect) {
9382
9602
  correctAnswers++;
9383
9603
  }
9384
- if (question.difficulty === "FACIL" /* FACIL */) {
9604
+ if (answer.difficultyLevel === "FACIL" /* FACIL */) {
9385
9605
  totalEasyQuestions++;
9386
9606
  if (isCorrect) {
9387
9607
  correctEasyAnswers++;
9388
9608
  }
9389
- } else if (question.difficulty === "MEDIO" /* MEDIO */) {
9609
+ } else if (answer.difficultyLevel === "MEDIO" /* MEDIO */) {
9390
9610
  totalMediumQuestions++;
9391
9611
  if (isCorrect) {
9392
9612
  correctMediumAnswers++;
9393
9613
  }
9394
- } else if (question.difficulty === "DIFICIL" /* DIFICIL */) {
9614
+ } else if (answer.difficultyLevel === "DIFICIL" /* DIFICIL */) {
9395
9615
  totalDifficultQuestions++;
9396
9616
  if (isCorrect) {
9397
9617
  correctDifficultAnswers++;
@@ -9424,8 +9644,9 @@ var QuizResultPerformance = forwardRef19(
9424
9644
  /* @__PURE__ */ jsx39("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(timeElapsed) })
9425
9645
  ] }),
9426
9646
  /* @__PURE__ */ jsxs32("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
9427
- correctAnswers,
9428
- " de ",
9647
+ getQuestionResultStatistics()?.correctAnswers ?? "--",
9648
+ " de",
9649
+ " ",
9429
9650
  totalQuestions
9430
9651
  ] }),
9431
9652
  /* @__PURE__ */ jsx39("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })