analytica-frontend-lib 1.1.18 → 1.1.19
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/hooks/useMobile/index.d.mts +24 -0
- package/dist/hooks/useMobile/index.d.ts +24 -0
- package/dist/hooks/useMobile/index.js +87 -0
- package/dist/hooks/useMobile/index.js.map +1 -0
- package/dist/hooks/useMobile/index.mjs +61 -0
- package/dist/hooks/useMobile/index.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +197 -136
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -129,11 +129,13 @@ __export(src_exports, {
|
|
|
129
129
|
VideoPlayer: () => VideoPlayer_default,
|
|
130
130
|
Whiteboard: () => Whiteboard_default,
|
|
131
131
|
createZustandAuthAdapter: () => createZustandAuthAdapter,
|
|
132
|
+
getDeviceType: () => getDeviceType,
|
|
132
133
|
getRootDomain: () => getRootDomain,
|
|
133
134
|
getStatusBadge: () => getStatusBadge,
|
|
134
135
|
useApiConfig: () => useApiConfig,
|
|
135
136
|
useAuth: () => useAuth,
|
|
136
137
|
useAuthGuard: () => useAuthGuard,
|
|
138
|
+
useMobile: () => useMobile,
|
|
137
139
|
useQuizStore: () => useQuizStore,
|
|
138
140
|
useRouteAuth: () => useRouteAuth,
|
|
139
141
|
useToastStore: () => ToastStore_default,
|
|
@@ -5974,9 +5976,66 @@ var IconRender = ({
|
|
|
5974
5976
|
};
|
|
5975
5977
|
var IconRender_default = IconRender;
|
|
5976
5978
|
|
|
5979
|
+
// src/hooks/useMobile.ts
|
|
5980
|
+
var import_react19 = require("react");
|
|
5981
|
+
var MOBILE_WIDTH = 500;
|
|
5982
|
+
var TABLET_WIDTH = 931;
|
|
5983
|
+
var DEFAULT_WIDTH = 1200;
|
|
5984
|
+
var getWindowWidth = () => {
|
|
5985
|
+
if (typeof window === "undefined") {
|
|
5986
|
+
return DEFAULT_WIDTH;
|
|
5987
|
+
}
|
|
5988
|
+
return window.innerWidth;
|
|
5989
|
+
};
|
|
5990
|
+
var getDeviceType = () => {
|
|
5991
|
+
const width = getWindowWidth();
|
|
5992
|
+
return width < TABLET_WIDTH ? "responsive" : "desktop";
|
|
5993
|
+
};
|
|
5994
|
+
var useMobile = () => {
|
|
5995
|
+
const [isMobile, setIsMobile] = (0, import_react19.useState)(false);
|
|
5996
|
+
const [isTablet, setIsTablet] = (0, import_react19.useState)(false);
|
|
5997
|
+
(0, import_react19.useEffect)(() => {
|
|
5998
|
+
const checkScreenSize = () => {
|
|
5999
|
+
const width = getWindowWidth();
|
|
6000
|
+
setIsMobile(width < MOBILE_WIDTH);
|
|
6001
|
+
setIsTablet(width < TABLET_WIDTH);
|
|
6002
|
+
};
|
|
6003
|
+
checkScreenSize();
|
|
6004
|
+
window.addEventListener("resize", checkScreenSize);
|
|
6005
|
+
return () => window.removeEventListener("resize", checkScreenSize);
|
|
6006
|
+
}, []);
|
|
6007
|
+
const getFormContainerClasses = () => {
|
|
6008
|
+
if (isMobile) {
|
|
6009
|
+
return "w-full px-4";
|
|
6010
|
+
}
|
|
6011
|
+
if (isTablet) {
|
|
6012
|
+
return "w-full px-6";
|
|
6013
|
+
}
|
|
6014
|
+
return "w-full max-w-[992px] mx-auto px-0";
|
|
6015
|
+
};
|
|
6016
|
+
const getMobileHeaderClasses = () => {
|
|
6017
|
+
return "flex flex-col items-start gap-4 mb-6";
|
|
6018
|
+
};
|
|
6019
|
+
const getDesktopHeaderClasses = () => {
|
|
6020
|
+
return "flex flex-row justify-between items-center gap-6 mb-8";
|
|
6021
|
+
};
|
|
6022
|
+
const getHeaderClasses = () => {
|
|
6023
|
+
return isMobile ? getMobileHeaderClasses() : getDesktopHeaderClasses();
|
|
6024
|
+
};
|
|
6025
|
+
return {
|
|
6026
|
+
isMobile,
|
|
6027
|
+
isTablet,
|
|
6028
|
+
getFormContainerClasses,
|
|
6029
|
+
getHeaderClasses,
|
|
6030
|
+
getMobileHeaderClasses,
|
|
6031
|
+
getDesktopHeaderClasses,
|
|
6032
|
+
getDeviceType
|
|
6033
|
+
};
|
|
6034
|
+
};
|
|
6035
|
+
|
|
5977
6036
|
// src/components/Select/Select.tsx
|
|
5978
6037
|
var import_zustand5 = require("zustand");
|
|
5979
|
-
var
|
|
6038
|
+
var import_react20 = require("react");
|
|
5980
6039
|
var import_phosphor_react16 = require("phosphor-react");
|
|
5981
6040
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5982
6041
|
var VARIANT_CLASSES4 = {
|
|
@@ -6036,13 +6095,13 @@ function getLabelAsNode(children) {
|
|
|
6036
6095
|
if (typeof children === "string" || typeof children === "number") {
|
|
6037
6096
|
return children;
|
|
6038
6097
|
}
|
|
6039
|
-
const flattened =
|
|
6098
|
+
const flattened = import_react20.Children.toArray(children);
|
|
6040
6099
|
if (flattened.length === 1) return flattened[0];
|
|
6041
6100
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: flattened });
|
|
6042
6101
|
}
|
|
6043
6102
|
var injectStore4 = (children, store, size, selectId) => {
|
|
6044
|
-
return
|
|
6045
|
-
if ((0,
|
|
6103
|
+
return import_react20.Children.map(children, (child) => {
|
|
6104
|
+
if ((0, import_react20.isValidElement)(child)) {
|
|
6046
6105
|
const typedChild = child;
|
|
6047
6106
|
const newProps = {
|
|
6048
6107
|
store
|
|
@@ -6059,7 +6118,7 @@ var injectStore4 = (children, store, size, selectId) => {
|
|
|
6059
6118
|
selectId
|
|
6060
6119
|
);
|
|
6061
6120
|
}
|
|
6062
|
-
return (0,
|
|
6121
|
+
return (0, import_react20.cloneElement)(typedChild, newProps);
|
|
6063
6122
|
}
|
|
6064
6123
|
return child;
|
|
6065
6124
|
});
|
|
@@ -6076,18 +6135,18 @@ var Select = ({
|
|
|
6076
6135
|
errorMessage,
|
|
6077
6136
|
id
|
|
6078
6137
|
}) => {
|
|
6079
|
-
const storeRef = (0,
|
|
6138
|
+
const storeRef = (0, import_react20.useRef)(null);
|
|
6080
6139
|
storeRef.current ??= createSelectStore(onValueChange);
|
|
6081
6140
|
const store = storeRef.current;
|
|
6082
|
-
const selectRef = (0,
|
|
6141
|
+
const selectRef = (0, import_react20.useRef)(null);
|
|
6083
6142
|
const { open, setOpen, setValue, selectedLabel } = (0, import_zustand5.useStore)(store, (s) => s);
|
|
6084
|
-
const generatedId = (0,
|
|
6143
|
+
const generatedId = (0, import_react20.useId)();
|
|
6085
6144
|
const selectId = id ?? `select-${generatedId}`;
|
|
6086
6145
|
const findLabelForValue = (children2, targetValue) => {
|
|
6087
6146
|
let found = null;
|
|
6088
6147
|
const search = (nodes) => {
|
|
6089
|
-
|
|
6090
|
-
if (!(0,
|
|
6148
|
+
import_react20.Children.forEach(nodes, (child) => {
|
|
6149
|
+
if (!(0, import_react20.isValidElement)(child)) return;
|
|
6091
6150
|
const typedChild = child;
|
|
6092
6151
|
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
6093
6152
|
if (typeof typedChild.props.children === "string")
|
|
@@ -6100,13 +6159,13 @@ var Select = ({
|
|
|
6100
6159
|
search(children2);
|
|
6101
6160
|
return found;
|
|
6102
6161
|
};
|
|
6103
|
-
(0,
|
|
6162
|
+
(0, import_react20.useEffect)(() => {
|
|
6104
6163
|
if (!selectedLabel && defaultValue) {
|
|
6105
6164
|
const label2 = findLabelForValue(children, defaultValue);
|
|
6106
6165
|
if (label2) store.setState({ selectedLabel: label2 });
|
|
6107
6166
|
}
|
|
6108
6167
|
}, [children, defaultValue, selectedLabel]);
|
|
6109
|
-
(0,
|
|
6168
|
+
(0, import_react20.useEffect)(() => {
|
|
6110
6169
|
const handleClickOutside = (event) => {
|
|
6111
6170
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
6112
6171
|
setOpen(false);
|
|
@@ -6141,7 +6200,7 @@ var Select = ({
|
|
|
6141
6200
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
6142
6201
|
};
|
|
6143
6202
|
}, [open]);
|
|
6144
|
-
(0,
|
|
6203
|
+
(0, import_react20.useEffect)(() => {
|
|
6145
6204
|
if (propValue) {
|
|
6146
6205
|
setValue(propValue);
|
|
6147
6206
|
const label2 = findLabelForValue(children, propValue);
|
|
@@ -6178,7 +6237,7 @@ var SelectValue = ({
|
|
|
6178
6237
|
const value = (0, import_zustand5.useStore)(store, (s) => s.value);
|
|
6179
6238
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
|
|
6180
6239
|
};
|
|
6181
|
-
var SelectTrigger = (0,
|
|
6240
|
+
var SelectTrigger = (0, import_react20.forwardRef)(
|
|
6182
6241
|
({
|
|
6183
6242
|
className,
|
|
6184
6243
|
invalid = false,
|
|
@@ -6232,7 +6291,7 @@ var SelectTrigger = (0, import_react19.forwardRef)(
|
|
|
6232
6291
|
}
|
|
6233
6292
|
);
|
|
6234
6293
|
SelectTrigger.displayName = "SelectTrigger";
|
|
6235
|
-
var SelectContent = (0,
|
|
6294
|
+
var SelectContent = (0, import_react20.forwardRef)(
|
|
6236
6295
|
({
|
|
6237
6296
|
children,
|
|
6238
6297
|
className,
|
|
@@ -6262,7 +6321,7 @@ var SelectContent = (0, import_react19.forwardRef)(
|
|
|
6262
6321
|
}
|
|
6263
6322
|
);
|
|
6264
6323
|
SelectContent.displayName = "SelectContent";
|
|
6265
|
-
var SelectItem = (0,
|
|
6324
|
+
var SelectItem = (0, import_react20.forwardRef)(
|
|
6266
6325
|
({
|
|
6267
6326
|
className,
|
|
6268
6327
|
children,
|
|
@@ -6323,7 +6382,7 @@ var Select_default = Select;
|
|
|
6323
6382
|
|
|
6324
6383
|
// src/components/Menu/Menu.tsx
|
|
6325
6384
|
var import_zustand6 = require("zustand");
|
|
6326
|
-
var
|
|
6385
|
+
var import_react21 = require("react");
|
|
6327
6386
|
var import_phosphor_react17 = require("phosphor-react");
|
|
6328
6387
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6329
6388
|
var createMenuStore = (onValueChange) => (0, import_zustand6.create)((set) => ({
|
|
@@ -6343,7 +6402,7 @@ var VARIANT_CLASSES5 = {
|
|
|
6343
6402
|
menu2: "",
|
|
6344
6403
|
breadcrumb: "bg-transparent shadow-none !px-0 !-ml-2"
|
|
6345
6404
|
};
|
|
6346
|
-
var Menu = (0,
|
|
6405
|
+
var Menu = (0, import_react21.forwardRef)(
|
|
6347
6406
|
({
|
|
6348
6407
|
className,
|
|
6349
6408
|
children,
|
|
@@ -6353,11 +6412,11 @@ var Menu = (0, import_react20.forwardRef)(
|
|
|
6353
6412
|
onValueChange,
|
|
6354
6413
|
...props
|
|
6355
6414
|
}, ref) => {
|
|
6356
|
-
const storeRef = (0,
|
|
6415
|
+
const storeRef = (0, import_react21.useRef)(null);
|
|
6357
6416
|
storeRef.current ??= createMenuStore(onValueChange);
|
|
6358
6417
|
const store = storeRef.current;
|
|
6359
6418
|
const { setValue } = (0, import_zustand6.useStore)(store, (s) => s);
|
|
6360
|
-
(0,
|
|
6419
|
+
(0, import_react21.useEffect)(() => {
|
|
6361
6420
|
setValue(propValue ?? defaultValue);
|
|
6362
6421
|
}, [defaultValue, propValue, setValue]);
|
|
6363
6422
|
const baseClasses = "w-full py-2 flex flex-row items-center justify-center";
|
|
@@ -6378,7 +6437,7 @@ var Menu = (0, import_react20.forwardRef)(
|
|
|
6378
6437
|
}
|
|
6379
6438
|
);
|
|
6380
6439
|
Menu.displayName = "Menu";
|
|
6381
|
-
var MenuContent = (0,
|
|
6440
|
+
var MenuContent = (0, import_react21.forwardRef)(
|
|
6382
6441
|
({ className, children, variant = "menu", ...props }, ref) => {
|
|
6383
6442
|
const baseClasses = "w-full flex flex-row items-center gap-2";
|
|
6384
6443
|
const variantClasses = variant === "menu2" ? "overflow-x-auto scroll-smooth" : "";
|
|
@@ -6400,7 +6459,7 @@ var MenuContent = (0, import_react20.forwardRef)(
|
|
|
6400
6459
|
}
|
|
6401
6460
|
);
|
|
6402
6461
|
MenuContent.displayName = "MenuContent";
|
|
6403
|
-
var MenuItem = (0,
|
|
6462
|
+
var MenuItem = (0, import_react21.forwardRef)(
|
|
6404
6463
|
({
|
|
6405
6464
|
className,
|
|
6406
6465
|
children,
|
|
@@ -6533,10 +6592,10 @@ var MenuOverflow = ({
|
|
|
6533
6592
|
onValueChange,
|
|
6534
6593
|
...props
|
|
6535
6594
|
}) => {
|
|
6536
|
-
const containerRef = (0,
|
|
6537
|
-
const [showLeftArrow, setShowLeftArrow] = (0,
|
|
6538
|
-
const [showRightArrow, setShowRightArrow] = (0,
|
|
6539
|
-
(0,
|
|
6595
|
+
const containerRef = (0, import_react21.useRef)(null);
|
|
6596
|
+
const [showLeftArrow, setShowLeftArrow] = (0, import_react21.useState)(false);
|
|
6597
|
+
const [showRightArrow, setShowRightArrow] = (0, import_react21.useState)(false);
|
|
6598
|
+
(0, import_react21.useEffect)(() => {
|
|
6540
6599
|
const checkScroll = () => internalCheckScroll(
|
|
6541
6600
|
containerRef.current,
|
|
6542
6601
|
setShowLeftArrow,
|
|
@@ -6596,11 +6655,11 @@ var MenuOverflow = ({
|
|
|
6596
6655
|
}
|
|
6597
6656
|
);
|
|
6598
6657
|
};
|
|
6599
|
-
var injectStore5 = (children, store) =>
|
|
6600
|
-
if (!(0,
|
|
6658
|
+
var injectStore5 = (children, store) => import_react21.Children.map(children, (child) => {
|
|
6659
|
+
if (!(0, import_react21.isValidElement)(child)) return child;
|
|
6601
6660
|
const typedChild = child;
|
|
6602
6661
|
const shouldInject = typedChild.type === MenuItem;
|
|
6603
|
-
return (0,
|
|
6662
|
+
return (0, import_react21.cloneElement)(typedChild, {
|
|
6604
6663
|
...shouldInject ? { store } : {},
|
|
6605
6664
|
...typedChild.props.children ? { children: injectStore5(typedChild.props.children, store) } : {}
|
|
6606
6665
|
});
|
|
@@ -6608,7 +6667,7 @@ var injectStore5 = (children, store) => import_react20.Children.map(children, (c
|
|
|
6608
6667
|
var Menu_default = Menu;
|
|
6609
6668
|
|
|
6610
6669
|
// src/components/Skeleton/Skeleton.tsx
|
|
6611
|
-
var
|
|
6670
|
+
var import_react22 = require("react");
|
|
6612
6671
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6613
6672
|
var SKELETON_ANIMATION_CLASSES = {
|
|
6614
6673
|
pulse: "animate-pulse",
|
|
@@ -6626,7 +6685,7 @@ var SPACING_CLASSES = {
|
|
|
6626
6685
|
medium: "space-y-2",
|
|
6627
6686
|
large: "space-y-3"
|
|
6628
6687
|
};
|
|
6629
|
-
var Skeleton = (0,
|
|
6688
|
+
var Skeleton = (0, import_react22.forwardRef)(
|
|
6630
6689
|
({
|
|
6631
6690
|
variant = "text",
|
|
6632
6691
|
width,
|
|
@@ -6675,13 +6734,13 @@ var Skeleton = (0, import_react21.forwardRef)(
|
|
|
6675
6734
|
);
|
|
6676
6735
|
}
|
|
6677
6736
|
);
|
|
6678
|
-
var SkeletonText = (0,
|
|
6737
|
+
var SkeletonText = (0, import_react22.forwardRef)(
|
|
6679
6738
|
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
6680
6739
|
);
|
|
6681
|
-
var SkeletonCircle = (0,
|
|
6682
|
-
var SkeletonRectangle = (0,
|
|
6683
|
-
var SkeletonRounded = (0,
|
|
6684
|
-
var SkeletonCard = (0,
|
|
6740
|
+
var SkeletonCircle = (0, import_react22.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
6741
|
+
var SkeletonRectangle = (0, import_react22.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
6742
|
+
var SkeletonRounded = (0, import_react22.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
6743
|
+
var SkeletonCard = (0, import_react22.forwardRef)(
|
|
6685
6744
|
({
|
|
6686
6745
|
showAvatar = true,
|
|
6687
6746
|
showTitle = true,
|
|
@@ -6717,7 +6776,7 @@ var SkeletonCard = (0, import_react21.forwardRef)(
|
|
|
6717
6776
|
);
|
|
6718
6777
|
}
|
|
6719
6778
|
);
|
|
6720
|
-
var SkeletonList = (0,
|
|
6779
|
+
var SkeletonList = (0, import_react22.forwardRef)(
|
|
6721
6780
|
({
|
|
6722
6781
|
items = 3,
|
|
6723
6782
|
showAvatar = true,
|
|
@@ -6736,7 +6795,7 @@ var SkeletonList = (0, import_react21.forwardRef)(
|
|
|
6736
6795
|
] }, index)) });
|
|
6737
6796
|
}
|
|
6738
6797
|
);
|
|
6739
|
-
var SkeletonTable = (0,
|
|
6798
|
+
var SkeletonTable = (0, import_react22.forwardRef)(
|
|
6740
6799
|
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
6741
6800
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
6742
6801
|
showHeader && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6861,7 +6920,7 @@ var NotFound = ({
|
|
|
6861
6920
|
var NotFound_default = NotFound;
|
|
6862
6921
|
|
|
6863
6922
|
// src/components/VideoPlayer/VideoPlayer.tsx
|
|
6864
|
-
var
|
|
6923
|
+
var import_react23 = require("react");
|
|
6865
6924
|
var import_phosphor_react18 = require("phosphor-react");
|
|
6866
6925
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6867
6926
|
var CONTROLS_HIDE_TIMEOUT = 3e3;
|
|
@@ -6966,26 +7025,26 @@ var VideoPlayer = ({
|
|
|
6966
7025
|
autoSave = true,
|
|
6967
7026
|
storageKey = "video-progress"
|
|
6968
7027
|
}) => {
|
|
6969
|
-
const videoRef = (0,
|
|
6970
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
6971
|
-
const [currentTime, setCurrentTime] = (0,
|
|
6972
|
-
const [duration, setDuration] = (0,
|
|
6973
|
-
const [isMuted, setIsMuted] = (0,
|
|
6974
|
-
const [volume, setVolume] = (0,
|
|
6975
|
-
const [isFullscreen, setIsFullscreen] = (0,
|
|
6976
|
-
const [showControls, setShowControls] = (0,
|
|
6977
|
-
const [hasCompleted, setHasCompleted] = (0,
|
|
6978
|
-
const [showCaptions, setShowCaptions] = (0,
|
|
6979
|
-
(0,
|
|
7028
|
+
const videoRef = (0, import_react23.useRef)(null);
|
|
7029
|
+
const [isPlaying, setIsPlaying] = (0, import_react23.useState)(false);
|
|
7030
|
+
const [currentTime, setCurrentTime] = (0, import_react23.useState)(0);
|
|
7031
|
+
const [duration, setDuration] = (0, import_react23.useState)(0);
|
|
7032
|
+
const [isMuted, setIsMuted] = (0, import_react23.useState)(false);
|
|
7033
|
+
const [volume, setVolume] = (0, import_react23.useState)(1);
|
|
7034
|
+
const [isFullscreen, setIsFullscreen] = (0, import_react23.useState)(false);
|
|
7035
|
+
const [showControls, setShowControls] = (0, import_react23.useState)(true);
|
|
7036
|
+
const [hasCompleted, setHasCompleted] = (0, import_react23.useState)(false);
|
|
7037
|
+
const [showCaptions, setShowCaptions] = (0, import_react23.useState)(false);
|
|
7038
|
+
(0, import_react23.useEffect)(() => {
|
|
6980
7039
|
setHasCompleted(false);
|
|
6981
7040
|
}, [src]);
|
|
6982
|
-
const [playbackRate, setPlaybackRate] = (0,
|
|
6983
|
-
const [showSpeedMenu, setShowSpeedMenu] = (0,
|
|
6984
|
-
const lastSaveTimeRef = (0,
|
|
6985
|
-
const trackRef = (0,
|
|
6986
|
-
const controlsTimeoutRef = (0,
|
|
6987
|
-
const lastMousePositionRef = (0,
|
|
6988
|
-
const isUserInteracting = (0,
|
|
7041
|
+
const [playbackRate, setPlaybackRate] = (0, import_react23.useState)(1);
|
|
7042
|
+
const [showSpeedMenu, setShowSpeedMenu] = (0, import_react23.useState)(false);
|
|
7043
|
+
const lastSaveTimeRef = (0, import_react23.useRef)(0);
|
|
7044
|
+
const trackRef = (0, import_react23.useRef)(null);
|
|
7045
|
+
const controlsTimeoutRef = (0, import_react23.useRef)(null);
|
|
7046
|
+
const lastMousePositionRef = (0, import_react23.useRef)({ x: 0, y: 0 });
|
|
7047
|
+
const isUserInteracting = (0, import_react23.useCallback)(() => {
|
|
6989
7048
|
if (showSpeedMenu) {
|
|
6990
7049
|
return true;
|
|
6991
7050
|
}
|
|
@@ -7002,13 +7061,13 @@ var VideoPlayer = ({
|
|
|
7002
7061
|
}
|
|
7003
7062
|
return false;
|
|
7004
7063
|
}, [showSpeedMenu]);
|
|
7005
|
-
const clearControlsTimeout = (0,
|
|
7064
|
+
const clearControlsTimeout = (0, import_react23.useCallback)(() => {
|
|
7006
7065
|
if (controlsTimeoutRef.current) {
|
|
7007
7066
|
clearTimeout(controlsTimeoutRef.current);
|
|
7008
7067
|
controlsTimeoutRef.current = null;
|
|
7009
7068
|
}
|
|
7010
7069
|
}, []);
|
|
7011
|
-
const showControlsWithTimer = (0,
|
|
7070
|
+
const showControlsWithTimer = (0, import_react23.useCallback)(() => {
|
|
7012
7071
|
setShowControls(true);
|
|
7013
7072
|
clearControlsTimeout();
|
|
7014
7073
|
if (isFullscreen) {
|
|
@@ -7023,7 +7082,7 @@ var VideoPlayer = ({
|
|
|
7023
7082
|
}, CONTROLS_HIDE_TIMEOUT);
|
|
7024
7083
|
}
|
|
7025
7084
|
}, [isFullscreen, isPlaying, clearControlsTimeout]);
|
|
7026
|
-
const handleMouseMove = (0,
|
|
7085
|
+
const handleMouseMove = (0, import_react23.useCallback)(
|
|
7027
7086
|
(event) => {
|
|
7028
7087
|
const currentX = event.clientX;
|
|
7029
7088
|
const currentY = event.clientY;
|
|
@@ -7036,10 +7095,10 @@ var VideoPlayer = ({
|
|
|
7036
7095
|
},
|
|
7037
7096
|
[showControlsWithTimer]
|
|
7038
7097
|
);
|
|
7039
|
-
const handleMouseEnter = (0,
|
|
7098
|
+
const handleMouseEnter = (0, import_react23.useCallback)(() => {
|
|
7040
7099
|
showControlsWithTimer();
|
|
7041
7100
|
}, [showControlsWithTimer]);
|
|
7042
|
-
const handleMouseLeave = (0,
|
|
7101
|
+
const handleMouseLeave = (0, import_react23.useCallback)(() => {
|
|
7043
7102
|
const userInteracting = isUserInteracting();
|
|
7044
7103
|
clearControlsTimeout();
|
|
7045
7104
|
if (!isFullscreen && !userInteracting) {
|
|
@@ -7048,13 +7107,13 @@ var VideoPlayer = ({
|
|
|
7048
7107
|
}, LEAVE_HIDE_TIMEOUT);
|
|
7049
7108
|
}
|
|
7050
7109
|
}, [isFullscreen, clearControlsTimeout, isUserInteracting]);
|
|
7051
|
-
(0,
|
|
7110
|
+
(0, import_react23.useEffect)(() => {
|
|
7052
7111
|
if (videoRef.current) {
|
|
7053
7112
|
videoRef.current.volume = volume;
|
|
7054
7113
|
videoRef.current.muted = isMuted;
|
|
7055
7114
|
}
|
|
7056
7115
|
}, [volume, isMuted]);
|
|
7057
|
-
(0,
|
|
7116
|
+
(0, import_react23.useEffect)(() => {
|
|
7058
7117
|
const video = videoRef.current;
|
|
7059
7118
|
if (!video) return;
|
|
7060
7119
|
const onPlay = () => setIsPlaying(true);
|
|
@@ -7069,7 +7128,7 @@ var VideoPlayer = ({
|
|
|
7069
7128
|
video.removeEventListener("ended", onEnded);
|
|
7070
7129
|
};
|
|
7071
7130
|
}, []);
|
|
7072
|
-
(0,
|
|
7131
|
+
(0, import_react23.useEffect)(() => {
|
|
7073
7132
|
if (isPlaying) {
|
|
7074
7133
|
showControlsWithTimer();
|
|
7075
7134
|
} else {
|
|
@@ -7081,7 +7140,7 @@ var VideoPlayer = ({
|
|
|
7081
7140
|
}
|
|
7082
7141
|
}
|
|
7083
7142
|
}, [isPlaying, isFullscreen, showControlsWithTimer, clearControlsTimeout]);
|
|
7084
|
-
(0,
|
|
7143
|
+
(0, import_react23.useEffect)(() => {
|
|
7085
7144
|
const handleFullscreenChange = () => {
|
|
7086
7145
|
const isCurrentlyFullscreen = !!document.fullscreenElement;
|
|
7087
7146
|
setIsFullscreen(isCurrentlyFullscreen);
|
|
@@ -7094,7 +7153,7 @@ var VideoPlayer = ({
|
|
|
7094
7153
|
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
7095
7154
|
};
|
|
7096
7155
|
}, [showControlsWithTimer]);
|
|
7097
|
-
(0,
|
|
7156
|
+
(0, import_react23.useEffect)(() => {
|
|
7098
7157
|
const init = () => {
|
|
7099
7158
|
if (!isFullscreen) {
|
|
7100
7159
|
showControlsWithTimer();
|
|
@@ -7116,7 +7175,7 @@ var VideoPlayer = ({
|
|
|
7116
7175
|
};
|
|
7117
7176
|
}
|
|
7118
7177
|
}, []);
|
|
7119
|
-
const getInitialTime = (0,
|
|
7178
|
+
const getInitialTime = (0, import_react23.useCallback)(() => {
|
|
7120
7179
|
if (!autoSave || !storageKey) {
|
|
7121
7180
|
return Number.isFinite(initialTime) && initialTime >= 0 ? initialTime : void 0;
|
|
7122
7181
|
}
|
|
@@ -7127,14 +7186,14 @@ var VideoPlayer = ({
|
|
|
7127
7186
|
if (hasValidSaved) return saved;
|
|
7128
7187
|
return void 0;
|
|
7129
7188
|
}, [autoSave, storageKey, src, initialTime]);
|
|
7130
|
-
(0,
|
|
7189
|
+
(0, import_react23.useEffect)(() => {
|
|
7131
7190
|
const start = getInitialTime();
|
|
7132
7191
|
if (start !== void 0 && videoRef.current) {
|
|
7133
7192
|
videoRef.current.currentTime = start;
|
|
7134
7193
|
setCurrentTime(start);
|
|
7135
7194
|
}
|
|
7136
7195
|
}, [getInitialTime]);
|
|
7137
|
-
const saveProgress = (0,
|
|
7196
|
+
const saveProgress = (0, import_react23.useCallback)(
|
|
7138
7197
|
(time) => {
|
|
7139
7198
|
if (!autoSave || !storageKey) return;
|
|
7140
7199
|
const now = Date.now();
|
|
@@ -7145,7 +7204,7 @@ var VideoPlayer = ({
|
|
|
7145
7204
|
},
|
|
7146
7205
|
[autoSave, storageKey, src]
|
|
7147
7206
|
);
|
|
7148
|
-
const togglePlayPause = (0,
|
|
7207
|
+
const togglePlayPause = (0, import_react23.useCallback)(async () => {
|
|
7149
7208
|
const video = videoRef.current;
|
|
7150
7209
|
if (!video) return;
|
|
7151
7210
|
if (!video.paused) {
|
|
@@ -7157,7 +7216,7 @@ var VideoPlayer = ({
|
|
|
7157
7216
|
} catch {
|
|
7158
7217
|
}
|
|
7159
7218
|
}, []);
|
|
7160
|
-
const handleVolumeChange = (0,
|
|
7219
|
+
const handleVolumeChange = (0, import_react23.useCallback)(
|
|
7161
7220
|
(newVolume) => {
|
|
7162
7221
|
const video = videoRef.current;
|
|
7163
7222
|
if (!video) return;
|
|
@@ -7176,7 +7235,7 @@ var VideoPlayer = ({
|
|
|
7176
7235
|
},
|
|
7177
7236
|
[isMuted]
|
|
7178
7237
|
);
|
|
7179
|
-
const toggleMute = (0,
|
|
7238
|
+
const toggleMute = (0, import_react23.useCallback)(() => {
|
|
7180
7239
|
const video = videoRef.current;
|
|
7181
7240
|
if (!video) return;
|
|
7182
7241
|
if (isMuted) {
|
|
@@ -7190,13 +7249,13 @@ var VideoPlayer = ({
|
|
|
7190
7249
|
setIsMuted(true);
|
|
7191
7250
|
}
|
|
7192
7251
|
}, [isMuted, volume]);
|
|
7193
|
-
const handleSeek = (0,
|
|
7252
|
+
const handleSeek = (0, import_react23.useCallback)((newTime) => {
|
|
7194
7253
|
const video = videoRef.current;
|
|
7195
7254
|
if (video) {
|
|
7196
7255
|
video.currentTime = newTime;
|
|
7197
7256
|
}
|
|
7198
7257
|
}, []);
|
|
7199
|
-
const toggleFullscreen = (0,
|
|
7258
|
+
const toggleFullscreen = (0, import_react23.useCallback)(() => {
|
|
7200
7259
|
const container = videoRef.current?.parentElement;
|
|
7201
7260
|
if (!container) return;
|
|
7202
7261
|
if (!isFullscreen && container.requestFullscreen) {
|
|
@@ -7205,23 +7264,23 @@ var VideoPlayer = ({
|
|
|
7205
7264
|
document.exitFullscreen();
|
|
7206
7265
|
}
|
|
7207
7266
|
}, [isFullscreen]);
|
|
7208
|
-
const handleSpeedChange = (0,
|
|
7267
|
+
const handleSpeedChange = (0, import_react23.useCallback)((speed) => {
|
|
7209
7268
|
if (videoRef.current) {
|
|
7210
7269
|
videoRef.current.playbackRate = speed;
|
|
7211
7270
|
setPlaybackRate(speed);
|
|
7212
7271
|
setShowSpeedMenu(false);
|
|
7213
7272
|
}
|
|
7214
7273
|
}, []);
|
|
7215
|
-
const toggleSpeedMenu = (0,
|
|
7274
|
+
const toggleSpeedMenu = (0, import_react23.useCallback)(() => {
|
|
7216
7275
|
setShowSpeedMenu(!showSpeedMenu);
|
|
7217
7276
|
}, [showSpeedMenu]);
|
|
7218
|
-
const toggleCaptions = (0,
|
|
7277
|
+
const toggleCaptions = (0, import_react23.useCallback)(() => {
|
|
7219
7278
|
if (!trackRef.current?.track || !subtitles) return;
|
|
7220
7279
|
const newShowCaptions = !showCaptions;
|
|
7221
7280
|
setShowCaptions(newShowCaptions);
|
|
7222
7281
|
trackRef.current.track.mode = newShowCaptions && subtitles ? "showing" : "hidden";
|
|
7223
7282
|
}, [showCaptions, subtitles]);
|
|
7224
|
-
const checkVideoCompletion = (0,
|
|
7283
|
+
const checkVideoCompletion = (0, import_react23.useCallback)(
|
|
7225
7284
|
(progressPercent) => {
|
|
7226
7285
|
if (progressPercent >= 95 && !hasCompleted) {
|
|
7227
7286
|
setHasCompleted(true);
|
|
@@ -7230,7 +7289,7 @@ var VideoPlayer = ({
|
|
|
7230
7289
|
},
|
|
7231
7290
|
[hasCompleted, onVideoComplete]
|
|
7232
7291
|
);
|
|
7233
|
-
const handleTimeUpdate = (0,
|
|
7292
|
+
const handleTimeUpdate = (0, import_react23.useCallback)(() => {
|
|
7234
7293
|
const video = videoRef.current;
|
|
7235
7294
|
if (!video) return;
|
|
7236
7295
|
const current = video.currentTime;
|
|
@@ -7243,17 +7302,17 @@ var VideoPlayer = ({
|
|
|
7243
7302
|
checkVideoCompletion(progressPercent);
|
|
7244
7303
|
}
|
|
7245
7304
|
}, [duration, saveProgress, onTimeUpdate, onProgress, checkVideoCompletion]);
|
|
7246
|
-
const handleLoadedMetadata = (0,
|
|
7305
|
+
const handleLoadedMetadata = (0, import_react23.useCallback)(() => {
|
|
7247
7306
|
if (videoRef.current) {
|
|
7248
7307
|
setDuration(videoRef.current.duration);
|
|
7249
7308
|
}
|
|
7250
7309
|
}, []);
|
|
7251
|
-
(0,
|
|
7310
|
+
(0, import_react23.useEffect)(() => {
|
|
7252
7311
|
if (trackRef.current?.track) {
|
|
7253
7312
|
trackRef.current.track.mode = showCaptions && subtitles ? "showing" : "hidden";
|
|
7254
7313
|
}
|
|
7255
7314
|
}, [subtitles, showCaptions]);
|
|
7256
|
-
(0,
|
|
7315
|
+
(0, import_react23.useEffect)(() => {
|
|
7257
7316
|
const handleVisibilityChange = () => {
|
|
7258
7317
|
if (document.hidden && isPlaying && videoRef.current) {
|
|
7259
7318
|
videoRef.current.pause();
|
|
@@ -7275,13 +7334,13 @@ var VideoPlayer = ({
|
|
|
7275
7334
|
};
|
|
7276
7335
|
}, [isPlaying, clearControlsTimeout]);
|
|
7277
7336
|
const progressPercentage = duration > 0 ? currentTime / duration * 100 : 0;
|
|
7278
|
-
const getTopControlsOpacity = (0,
|
|
7337
|
+
const getTopControlsOpacity = (0, import_react23.useCallback)(() => {
|
|
7279
7338
|
return showControls ? "opacity-100" : "opacity-0";
|
|
7280
7339
|
}, [showControls]);
|
|
7281
|
-
const getBottomControlsOpacity = (0,
|
|
7340
|
+
const getBottomControlsOpacity = (0, import_react23.useCallback)(() => {
|
|
7282
7341
|
return showControls ? "opacity-100" : "opacity-0";
|
|
7283
7342
|
}, [showControls]);
|
|
7284
|
-
const handleVideoKeyDown = (0,
|
|
7343
|
+
const handleVideoKeyDown = (0, import_react23.useCallback)(
|
|
7285
7344
|
(e) => {
|
|
7286
7345
|
if (e.key) {
|
|
7287
7346
|
e.stopPropagation();
|
|
@@ -7506,7 +7565,7 @@ var VideoPlayer = ({
|
|
|
7506
7565
|
var VideoPlayer_default = VideoPlayer;
|
|
7507
7566
|
|
|
7508
7567
|
// src/components/Whiteboard/Whiteboard.tsx
|
|
7509
|
-
var
|
|
7568
|
+
var import_react24 = require("react");
|
|
7510
7569
|
var import_phosphor_react19 = require("phosphor-react");
|
|
7511
7570
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
7512
7571
|
var IMAGE_WIDTH = 225;
|
|
@@ -7519,8 +7578,8 @@ var Whiteboard = ({
|
|
|
7519
7578
|
imagesPerRow = 2,
|
|
7520
7579
|
...rest
|
|
7521
7580
|
}) => {
|
|
7522
|
-
const [imageErrors, setImageErrors] = (0,
|
|
7523
|
-
const handleDownload = (0,
|
|
7581
|
+
const [imageErrors, setImageErrors] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
|
|
7582
|
+
const handleDownload = (0, import_react24.useCallback)(
|
|
7524
7583
|
(image) => {
|
|
7525
7584
|
if (onDownload) {
|
|
7526
7585
|
onDownload(image);
|
|
@@ -7537,7 +7596,7 @@ var Whiteboard = ({
|
|
|
7537
7596
|
},
|
|
7538
7597
|
[onDownload]
|
|
7539
7598
|
);
|
|
7540
|
-
const handleImageError = (0,
|
|
7599
|
+
const handleImageError = (0, import_react24.useCallback)((imageId) => {
|
|
7541
7600
|
setImageErrors((prev) => new Set(prev).add(imageId));
|
|
7542
7601
|
}, []);
|
|
7543
7602
|
const gridColsClass = images?.length === 1 ? "grid-cols-1" : {
|
|
@@ -7624,10 +7683,10 @@ var Whiteboard = ({
|
|
|
7624
7683
|
var Whiteboard_default = Whiteboard;
|
|
7625
7684
|
|
|
7626
7685
|
// src/components/Auth/Auth.tsx
|
|
7627
|
-
var
|
|
7686
|
+
var import_react25 = require("react");
|
|
7628
7687
|
var import_react_router_dom = require("react-router-dom");
|
|
7629
7688
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
7630
|
-
var AuthContext = (0,
|
|
7689
|
+
var AuthContext = (0, import_react25.createContext)(void 0);
|
|
7631
7690
|
var AuthProvider = ({
|
|
7632
7691
|
children,
|
|
7633
7692
|
checkAuthFn,
|
|
@@ -7637,12 +7696,12 @@ var AuthProvider = ({
|
|
|
7637
7696
|
getSessionFn,
|
|
7638
7697
|
getTokensFn
|
|
7639
7698
|
}) => {
|
|
7640
|
-
const [authState, setAuthState] = (0,
|
|
7699
|
+
const [authState, setAuthState] = (0, import_react25.useState)({
|
|
7641
7700
|
isAuthenticated: false,
|
|
7642
7701
|
isLoading: true,
|
|
7643
7702
|
...initialAuthState
|
|
7644
7703
|
});
|
|
7645
|
-
const checkAuth = (0,
|
|
7704
|
+
const checkAuth = (0, import_react25.useCallback)(async () => {
|
|
7646
7705
|
try {
|
|
7647
7706
|
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
7648
7707
|
if (!checkAuthFn) {
|
|
@@ -7673,7 +7732,7 @@ var AuthProvider = ({
|
|
|
7673
7732
|
return false;
|
|
7674
7733
|
}
|
|
7675
7734
|
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
7676
|
-
const signOut = (0,
|
|
7735
|
+
const signOut = (0, import_react25.useCallback)(() => {
|
|
7677
7736
|
if (signOutFn) {
|
|
7678
7737
|
signOutFn();
|
|
7679
7738
|
}
|
|
@@ -7685,10 +7744,10 @@ var AuthProvider = ({
|
|
|
7685
7744
|
tokens: void 0
|
|
7686
7745
|
}));
|
|
7687
7746
|
}, [signOutFn]);
|
|
7688
|
-
(0,
|
|
7747
|
+
(0, import_react25.useEffect)(() => {
|
|
7689
7748
|
checkAuth();
|
|
7690
7749
|
}, [checkAuth]);
|
|
7691
|
-
const contextValue = (0,
|
|
7750
|
+
const contextValue = (0, import_react25.useMemo)(
|
|
7692
7751
|
() => ({
|
|
7693
7752
|
...authState,
|
|
7694
7753
|
checkAuth,
|
|
@@ -7699,7 +7758,7 @@ var AuthProvider = ({
|
|
|
7699
7758
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AuthContext.Provider, { value: contextValue, children });
|
|
7700
7759
|
};
|
|
7701
7760
|
var useAuth = () => {
|
|
7702
|
-
const context = (0,
|
|
7761
|
+
const context = (0, import_react25.useContext)(AuthContext);
|
|
7703
7762
|
if (context === void 0) {
|
|
7704
7763
|
throw new Error("useAuth deve ser usado dentro de um AuthProvider");
|
|
7705
7764
|
}
|
|
@@ -7839,7 +7898,7 @@ function createZustandAuthAdapter(useAuthStore) {
|
|
|
7839
7898
|
}
|
|
7840
7899
|
|
|
7841
7900
|
// src/components/Auth/useUrlAuthentication.ts
|
|
7842
|
-
var
|
|
7901
|
+
var import_react26 = require("react");
|
|
7843
7902
|
var import_react_router_dom2 = require("react-router-dom");
|
|
7844
7903
|
var getAuthParams = (location, extractParams) => {
|
|
7845
7904
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -7887,7 +7946,7 @@ var handleUserData = (responseData, setUser) => {
|
|
|
7887
7946
|
};
|
|
7888
7947
|
function useUrlAuthentication(options) {
|
|
7889
7948
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
7890
|
-
(0,
|
|
7949
|
+
(0, import_react26.useEffect)(() => {
|
|
7891
7950
|
const handleAuthentication = async () => {
|
|
7892
7951
|
const authParams = getAuthParams(location, options.extractParams);
|
|
7893
7952
|
if (!hasValidAuthParams(authParams)) {
|
|
@@ -7926,9 +7985,9 @@ function useUrlAuthentication(options) {
|
|
|
7926
7985
|
}
|
|
7927
7986
|
|
|
7928
7987
|
// src/components/Auth/useApiConfig.ts
|
|
7929
|
-
var
|
|
7988
|
+
var import_react27 = require("react");
|
|
7930
7989
|
function useApiConfig(api) {
|
|
7931
|
-
return (0,
|
|
7990
|
+
return (0, import_react27.useMemo)(
|
|
7932
7991
|
() => ({
|
|
7933
7992
|
get: (endpoint, config) => api.get(endpoint, config)
|
|
7934
7993
|
}),
|
|
@@ -7938,7 +7997,7 @@ function useApiConfig(api) {
|
|
|
7938
7997
|
|
|
7939
7998
|
// src/components/Quiz/Quiz.tsx
|
|
7940
7999
|
var import_phosphor_react20 = require("phosphor-react");
|
|
7941
|
-
var
|
|
8000
|
+
var import_react28 = require("react");
|
|
7942
8001
|
|
|
7943
8002
|
// src/components/Quiz/useQuizStore.ts
|
|
7944
8003
|
var import_zustand7 = require("zustand");
|
|
@@ -8534,9 +8593,9 @@ var getStatusStyles = (variantCorrect) => {
|
|
|
8534
8593
|
return "bg-error-background border-error-300";
|
|
8535
8594
|
}
|
|
8536
8595
|
};
|
|
8537
|
-
var Quiz = (0,
|
|
8596
|
+
var Quiz = (0, import_react28.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
|
|
8538
8597
|
const { setVariant } = useQuizStore();
|
|
8539
|
-
(0,
|
|
8598
|
+
(0, import_react28.useEffect)(() => {
|
|
8540
8599
|
setVariant(variant);
|
|
8541
8600
|
}, [variant, setVariant]);
|
|
8542
8601
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -8552,11 +8611,11 @@ var Quiz = (0, import_react27.forwardRef)(({ children, className, variant = "def
|
|
|
8552
8611
|
}
|
|
8553
8612
|
);
|
|
8554
8613
|
});
|
|
8555
|
-
var QuizHeaderResult = (0,
|
|
8614
|
+
var QuizHeaderResult = (0, import_react28.forwardRef)(
|
|
8556
8615
|
({ className, ...props }, ref) => {
|
|
8557
8616
|
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
8558
|
-
const [isCorrect, setIsCorrect] = (0,
|
|
8559
|
-
(0,
|
|
8617
|
+
const [isCorrect, setIsCorrect] = (0, import_react28.useState)(false);
|
|
8618
|
+
(0, import_react28.useEffect)(() => {
|
|
8560
8619
|
const cq = getCurrentQuestion();
|
|
8561
8620
|
if (!cq) {
|
|
8562
8621
|
setIsCorrect(false);
|
|
@@ -8587,7 +8646,7 @@ var QuizHeaderResult = (0, import_react27.forwardRef)(
|
|
|
8587
8646
|
);
|
|
8588
8647
|
}
|
|
8589
8648
|
);
|
|
8590
|
-
var QuizTitle = (0,
|
|
8649
|
+
var QuizTitle = (0, import_react28.forwardRef)(
|
|
8591
8650
|
({ className, ...props }, ref) => {
|
|
8592
8651
|
const {
|
|
8593
8652
|
currentQuestionIndex,
|
|
@@ -8619,7 +8678,7 @@ var QuizTitle = (0, import_react27.forwardRef)(
|
|
|
8619
8678
|
);
|
|
8620
8679
|
}
|
|
8621
8680
|
);
|
|
8622
|
-
var QuizSubTitle = (0,
|
|
8681
|
+
var QuizSubTitle = (0, import_react28.forwardRef)(
|
|
8623
8682
|
({ subTitle, ...props }, ref) => {
|
|
8624
8683
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "px-4 pb-2 pt-6", ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "font-bold text-lg text-text-950", children: subTitle }) });
|
|
8625
8684
|
}
|
|
@@ -8636,7 +8695,7 @@ var QuizHeader = () => {
|
|
|
8636
8695
|
}
|
|
8637
8696
|
);
|
|
8638
8697
|
};
|
|
8639
|
-
var QuizContainer = (0,
|
|
8698
|
+
var QuizContainer = (0, import_react28.forwardRef)(({ children, className, ...props }, ref) => {
|
|
8640
8699
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8641
8700
|
"div",
|
|
8642
8701
|
{
|
|
@@ -8650,7 +8709,7 @@ var QuizContainer = (0, import_react27.forwardRef)(({ children, className, ...pr
|
|
|
8650
8709
|
}
|
|
8651
8710
|
);
|
|
8652
8711
|
});
|
|
8653
|
-
var QuizContent = (0,
|
|
8712
|
+
var QuizContent = (0, import_react28.forwardRef)(({ paddingBottom }) => {
|
|
8654
8713
|
const { getCurrentQuestion } = useQuizStore();
|
|
8655
8714
|
const currentQuestion = getCurrentQuestion();
|
|
8656
8715
|
const questionComponents = {
|
|
@@ -8735,15 +8794,15 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
8735
8794
|
const currentQuestionResult = getQuestionResultByQuestionId(
|
|
8736
8795
|
currentQuestion?.id || ""
|
|
8737
8796
|
);
|
|
8738
|
-
const prevSelectedValuesRef = (0,
|
|
8739
|
-
const prevQuestionIdRef = (0,
|
|
8740
|
-
const allCurrentAnswerIds = (0,
|
|
8797
|
+
const prevSelectedValuesRef = (0, import_react28.useRef)([]);
|
|
8798
|
+
const prevQuestionIdRef = (0, import_react28.useRef)("");
|
|
8799
|
+
const allCurrentAnswerIds = (0, import_react28.useMemo)(() => {
|
|
8741
8800
|
return allCurrentAnswers?.map((answer) => answer.optionId) || [];
|
|
8742
8801
|
}, [allCurrentAnswers]);
|
|
8743
|
-
const selectedValues = (0,
|
|
8802
|
+
const selectedValues = (0, import_react28.useMemo)(() => {
|
|
8744
8803
|
return allCurrentAnswerIds?.filter((id) => id !== null) || [];
|
|
8745
8804
|
}, [allCurrentAnswerIds]);
|
|
8746
|
-
const stableSelectedValues = (0,
|
|
8805
|
+
const stableSelectedValues = (0, import_react28.useMemo)(() => {
|
|
8747
8806
|
const currentQuestionId = currentQuestion?.id || "";
|
|
8748
8807
|
const hasQuestionChanged = prevQuestionIdRef.current !== currentQuestionId;
|
|
8749
8808
|
if (hasQuestionChanged) {
|
|
@@ -8767,7 +8826,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
8767
8826
|
variant,
|
|
8768
8827
|
currentQuestionResult?.selectedOptions
|
|
8769
8828
|
]);
|
|
8770
|
-
const handleSelectedValues = (0,
|
|
8829
|
+
const handleSelectedValues = (0, import_react28.useCallback)(
|
|
8771
8830
|
(values) => {
|
|
8772
8831
|
if (currentQuestion) {
|
|
8773
8832
|
selectMultipleAnswer(currentQuestion.id, values);
|
|
@@ -8775,7 +8834,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
8775
8834
|
},
|
|
8776
8835
|
[currentQuestion, selectMultipleAnswer]
|
|
8777
8836
|
);
|
|
8778
|
-
const questionKey = (0,
|
|
8837
|
+
const questionKey = (0, import_react28.useMemo)(
|
|
8779
8838
|
() => `question-${currentQuestion?.id || "1"}`,
|
|
8780
8839
|
[currentQuestion?.id]
|
|
8781
8840
|
);
|
|
@@ -8830,13 +8889,13 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
8830
8889
|
currentQuestion?.id || ""
|
|
8831
8890
|
);
|
|
8832
8891
|
const currentAnswer = getCurrentAnswer();
|
|
8833
|
-
const textareaRef = (0,
|
|
8892
|
+
const textareaRef = (0, import_react28.useRef)(null);
|
|
8834
8893
|
const handleAnswerChange = (value) => {
|
|
8835
8894
|
if (currentQuestion) {
|
|
8836
8895
|
selectDissertativeAnswer(currentQuestion.id, value);
|
|
8837
8896
|
}
|
|
8838
8897
|
};
|
|
8839
|
-
const adjustTextareaHeight = (0,
|
|
8898
|
+
const adjustTextareaHeight = (0, import_react28.useCallback)(() => {
|
|
8840
8899
|
if (textareaRef.current) {
|
|
8841
8900
|
textareaRef.current.style.height = "auto";
|
|
8842
8901
|
const scrollHeight = textareaRef.current.scrollHeight;
|
|
@@ -8846,7 +8905,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
8846
8905
|
textareaRef.current.style.height = `${newHeight}px`;
|
|
8847
8906
|
}
|
|
8848
8907
|
}, []);
|
|
8849
|
-
(0,
|
|
8908
|
+
(0, import_react28.useEffect)(() => {
|
|
8850
8909
|
adjustTextareaHeight();
|
|
8851
8910
|
}, [currentAnswer, adjustTextareaHeight]);
|
|
8852
8911
|
if (!currentQuestion) {
|
|
@@ -8985,7 +9044,7 @@ var QuizConnectDots = ({ paddingBottom }) => {
|
|
|
8985
9044
|
isCorrect: false
|
|
8986
9045
|
}
|
|
8987
9046
|
];
|
|
8988
|
-
const [userAnswers, setUserAnswers] = (0,
|
|
9047
|
+
const [userAnswers, setUserAnswers] = (0, import_react28.useState)(() => {
|
|
8989
9048
|
if (variant === "result") {
|
|
8990
9049
|
return mockUserAnswers;
|
|
8991
9050
|
}
|
|
@@ -9104,8 +9163,8 @@ var QuizFill = ({ paddingBottom }) => {
|
|
|
9104
9163
|
isCorrect: true
|
|
9105
9164
|
}
|
|
9106
9165
|
];
|
|
9107
|
-
const [answers, setAnswers] = (0,
|
|
9108
|
-
const baseId = (0,
|
|
9166
|
+
const [answers, setAnswers] = (0, import_react28.useState)({});
|
|
9167
|
+
const baseId = (0, import_react28.useId)();
|
|
9109
9168
|
const getAvailableOptionsForSelect = (selectId) => {
|
|
9110
9169
|
const usedOptions = Object.entries(answers).filter(([key]) => key !== selectId).map(([, value]) => value);
|
|
9111
9170
|
return options.filter((option) => !usedOptions.includes(option));
|
|
@@ -9242,7 +9301,7 @@ var QuizImageQuestion = ({ paddingBottom }) => {
|
|
|
9242
9301
|
};
|
|
9243
9302
|
const correctRadiusRelative = calculateCorrectRadiusRelative();
|
|
9244
9303
|
const mockUserAnswerRelative = { x: 0.72, y: 0.348 };
|
|
9245
|
-
const [clickPositionRelative, setClickPositionRelative] = (0,
|
|
9304
|
+
const [clickPositionRelative, setClickPositionRelative] = (0, import_react28.useState)(variant == "result" ? mockUserAnswerRelative : null);
|
|
9246
9305
|
const convertToRelativeCoordinates = (x, y, rect) => {
|
|
9247
9306
|
const safeWidth = Math.max(rect.width, 1e-3);
|
|
9248
9307
|
const safeHeight = Math.max(rect.height, 1e-3);
|
|
@@ -9439,7 +9498,7 @@ var QuizQuestionList = ({
|
|
|
9439
9498
|
] }, subjectId)
|
|
9440
9499
|
) });
|
|
9441
9500
|
};
|
|
9442
|
-
var QuizFooter = (0,
|
|
9501
|
+
var QuizFooter = (0, import_react28.forwardRef)(
|
|
9443
9502
|
({
|
|
9444
9503
|
className,
|
|
9445
9504
|
onGoToSimulated,
|
|
@@ -9466,11 +9525,11 @@ var QuizFooter = (0, import_react27.forwardRef)(
|
|
|
9466
9525
|
const currentAnswer = getCurrentAnswer();
|
|
9467
9526
|
const currentQuestion = getCurrentQuestion();
|
|
9468
9527
|
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
9469
|
-
const [alertDialogOpen, setAlertDialogOpen] = (0,
|
|
9470
|
-
const [modalResultOpen, setModalResultOpen] = (0,
|
|
9471
|
-
const [modalNavigateOpen, setModalNavigateOpen] = (0,
|
|
9472
|
-
const [modalResolutionOpen, setModalResolutionOpen] = (0,
|
|
9473
|
-
const [filterType, setFilterType] = (0,
|
|
9528
|
+
const [alertDialogOpen, setAlertDialogOpen] = (0, import_react28.useState)(false);
|
|
9529
|
+
const [modalResultOpen, setModalResultOpen] = (0, import_react28.useState)(false);
|
|
9530
|
+
const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react28.useState)(false);
|
|
9531
|
+
const [modalResolutionOpen, setModalResolutionOpen] = (0, import_react28.useState)(false);
|
|
9532
|
+
const [filterType, setFilterType] = (0, import_react28.useState)(void 0);
|
|
9474
9533
|
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
9475
9534
|
const allQuestions = getTotalQuestions();
|
|
9476
9535
|
const handleFinishQuiz = async () => {
|
|
@@ -9696,7 +9755,7 @@ var QuizFooter = (0, import_react27.forwardRef)(
|
|
|
9696
9755
|
] });
|
|
9697
9756
|
}
|
|
9698
9757
|
);
|
|
9699
|
-
var QuizResultHeaderTitle = (0,
|
|
9758
|
+
var QuizResultHeaderTitle = (0, import_react28.forwardRef)(({ className, ...props }, ref) => {
|
|
9700
9759
|
const { bySimulated } = useQuizStore();
|
|
9701
9760
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
9702
9761
|
"div",
|
|
@@ -9711,7 +9770,7 @@ var QuizResultHeaderTitle = (0, import_react27.forwardRef)(({ className, ...prop
|
|
|
9711
9770
|
}
|
|
9712
9771
|
);
|
|
9713
9772
|
});
|
|
9714
|
-
var QuizResultTitle = (0,
|
|
9773
|
+
var QuizResultTitle = (0, import_react28.forwardRef)(({ className, ...props }, ref) => {
|
|
9715
9774
|
const { getQuizTitle } = useQuizStore();
|
|
9716
9775
|
const quizTitle = getQuizTitle();
|
|
9717
9776
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -9724,7 +9783,7 @@ var QuizResultTitle = (0, import_react27.forwardRef)(({ className, ...props }, r
|
|
|
9724
9783
|
}
|
|
9725
9784
|
);
|
|
9726
9785
|
});
|
|
9727
|
-
var QuizResultPerformance = (0,
|
|
9786
|
+
var QuizResultPerformance = (0, import_react28.forwardRef)(
|
|
9728
9787
|
({ ...props }, ref) => {
|
|
9729
9788
|
const {
|
|
9730
9789
|
getTotalQuestions,
|
|
@@ -9848,7 +9907,7 @@ var QuizResultPerformance = (0, import_react27.forwardRef)(
|
|
|
9848
9907
|
);
|
|
9849
9908
|
}
|
|
9850
9909
|
);
|
|
9851
|
-
var QuizListResult = (0,
|
|
9910
|
+
var QuizListResult = (0, import_react28.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
|
|
9852
9911
|
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
9853
9912
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
9854
9913
|
const subjectsStats = Object.entries(groupedQuestions).map(
|
|
@@ -10025,11 +10084,13 @@ var QuizListResultByMateria = ({
|
|
|
10025
10084
|
VideoPlayer,
|
|
10026
10085
|
Whiteboard,
|
|
10027
10086
|
createZustandAuthAdapter,
|
|
10087
|
+
getDeviceType,
|
|
10028
10088
|
getRootDomain,
|
|
10029
10089
|
getStatusBadge,
|
|
10030
10090
|
useApiConfig,
|
|
10031
10091
|
useAuth,
|
|
10032
10092
|
useAuthGuard,
|
|
10093
|
+
useMobile,
|
|
10033
10094
|
useQuizStore,
|
|
10034
10095
|
useRouteAuth,
|
|
10035
10096
|
useToastStore,
|