@thanh01.pmt/interactive-quiz-kit 1.0.52 → 1.0.53

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.
@@ -11703,6 +11703,125 @@ init_react_shim();
11703
11703
  // node_modules/react-i18next/dist/es/useSSR.js
11704
11704
  init_react_shim();
11705
11705
 
11706
+ // src/react-ui/hooks/use-toast.ts
11707
+ init_react_shim();
11708
+ var TOAST_LIMIT = 1;
11709
+ var TOAST_REMOVE_DELAY = 1e6;
11710
+ var count = 0;
11711
+ function genId() {
11712
+ count = (count + 1) % Number.MAX_SAFE_INTEGER;
11713
+ return count.toString();
11714
+ }
11715
+ var toastTimeouts = /* @__PURE__ */ new Map();
11716
+ var addToRemoveQueue = (toastId) => {
11717
+ if (toastTimeouts.has(toastId)) {
11718
+ return;
11719
+ }
11720
+ const timeout = setTimeout(() => {
11721
+ toastTimeouts.delete(toastId);
11722
+ dispatch({
11723
+ type: "REMOVE_TOAST",
11724
+ toastId
11725
+ });
11726
+ }, TOAST_REMOVE_DELAY);
11727
+ toastTimeouts.set(toastId, timeout);
11728
+ };
11729
+ var reducer = (state, action) => {
11730
+ switch (action.type) {
11731
+ case "ADD_TOAST":
11732
+ return {
11733
+ ...state,
11734
+ toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
11735
+ };
11736
+ case "UPDATE_TOAST":
11737
+ return {
11738
+ ...state,
11739
+ toasts: state.toasts.map(
11740
+ (t2) => t2.id === action.toast.id ? { ...t2, ...action.toast } : t2
11741
+ )
11742
+ };
11743
+ case "DISMISS_TOAST": {
11744
+ const { toastId } = action;
11745
+ if (toastId) {
11746
+ addToRemoveQueue(toastId);
11747
+ } else {
11748
+ state.toasts.forEach((toast2) => {
11749
+ addToRemoveQueue(toast2.id);
11750
+ });
11751
+ }
11752
+ return {
11753
+ ...state,
11754
+ toasts: state.toasts.map(
11755
+ (t2) => t2.id === toastId || toastId === void 0 ? {
11756
+ ...t2,
11757
+ open: false
11758
+ } : t2
11759
+ )
11760
+ };
11761
+ }
11762
+ case "REMOVE_TOAST":
11763
+ if (action.toastId === void 0) {
11764
+ return {
11765
+ ...state,
11766
+ toasts: []
11767
+ };
11768
+ }
11769
+ return {
11770
+ ...state,
11771
+ toasts: state.toasts.filter((t2) => t2.id !== action.toastId)
11772
+ };
11773
+ }
11774
+ };
11775
+ var listeners = [];
11776
+ var memoryState = { toasts: [] };
11777
+ function dispatch(action) {
11778
+ memoryState = reducer(memoryState, action);
11779
+ listeners.forEach((listener) => {
11780
+ listener(memoryState);
11781
+ });
11782
+ }
11783
+ function toast({ ...props }) {
11784
+ const id2 = genId();
11785
+ const update = (props2) => dispatch({
11786
+ type: "UPDATE_TOAST",
11787
+ toast: { ...props2, id: id2 }
11788
+ });
11789
+ const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id2 });
11790
+ dispatch({
11791
+ type: "ADD_TOAST",
11792
+ toast: {
11793
+ ...props,
11794
+ id: id2,
11795
+ open: true,
11796
+ onOpenChange: (open2) => {
11797
+ if (!open2) dismiss();
11798
+ }
11799
+ }
11800
+ });
11801
+ return {
11802
+ id: id2,
11803
+ dismiss,
11804
+ update
11805
+ };
11806
+ }
11807
+ function useToast() {
11808
+ const [state, setState] = React97.useState(memoryState);
11809
+ React97.useEffect(() => {
11810
+ listeners.push(setState);
11811
+ return () => {
11812
+ const index3 = listeners.indexOf(setState);
11813
+ if (index3 > -1) {
11814
+ listeners.splice(index3, 1);
11815
+ }
11816
+ };
11817
+ }, [state]);
11818
+ return {
11819
+ ...state,
11820
+ toast,
11821
+ dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId })
11822
+ };
11823
+ }
11824
+
11706
11825
  // src/react-ui/components/ui/QuestionRenderer.tsx
11707
11826
  init_react_shim();
11708
11827
 
@@ -12050,11 +12169,11 @@ var useLayoutEffect2 = globalThis?.document ? React97.useLayoutEffect : () => {
12050
12169
 
12051
12170
  // node_modules/@radix-ui/react-id/dist/index.mjs
12052
12171
  var useReactId = React97[" useId ".trim().toString()] || (() => void 0);
12053
- var count = 0;
12172
+ var count2 = 0;
12054
12173
  function useId(deterministicId) {
12055
12174
  const [id2, setId] = React97.useState(useReactId());
12056
12175
  useLayoutEffect2(() => {
12057
- setId((reactId) => reactId ?? String(count++));
12176
+ setId((reactId) => reactId ?? String(count2++));
12058
12177
  }, [deterministicId]);
12059
12178
  return (id2 ? `radix-${id2}` : "");
12060
12179
  }
@@ -67397,18 +67516,18 @@ var Branch = DismissableLayerBranch;
67397
67516
 
67398
67517
  // node_modules/@radix-ui/react-focus-guards/dist/index.mjs
67399
67518
  init_react_shim();
67400
- var count2 = 0;
67519
+ var count3 = 0;
67401
67520
  function useFocusGuards() {
67402
67521
  React97.useEffect(() => {
67403
67522
  const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
67404
67523
  document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
67405
67524
  document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
67406
- count2++;
67525
+ count3++;
67407
67526
  return () => {
67408
- if (count2 === 1) {
67527
+ if (count3 === 1) {
67409
67528
  document.querySelectorAll("[data-radix-focus-guard]").forEach((node2) => node2.remove());
67410
67529
  }
67411
- count2--;
67530
+ count3--;
67412
67531
  };
67413
67532
  }, []);
67414
67533
  }
@@ -99085,125 +99204,6 @@ var TabsContent2 = React97.forwardRef(({ className, ...props }, ref) => /* @__PU
99085
99204
  ));
99086
99205
  TabsContent2.displayName = Content3.displayName;
99087
99206
 
99088
- // src/react-ui/hooks/use-toast.ts
99089
- init_react_shim();
99090
- var TOAST_LIMIT = 1;
99091
- var TOAST_REMOVE_DELAY = 1e6;
99092
- var count3 = 0;
99093
- function genId() {
99094
- count3 = (count3 + 1) % Number.MAX_SAFE_INTEGER;
99095
- return count3.toString();
99096
- }
99097
- var toastTimeouts = /* @__PURE__ */ new Map();
99098
- var addToRemoveQueue = (toastId) => {
99099
- if (toastTimeouts.has(toastId)) {
99100
- return;
99101
- }
99102
- const timeout = setTimeout(() => {
99103
- toastTimeouts.delete(toastId);
99104
- dispatch({
99105
- type: "REMOVE_TOAST",
99106
- toastId
99107
- });
99108
- }, TOAST_REMOVE_DELAY);
99109
- toastTimeouts.set(toastId, timeout);
99110
- };
99111
- var reducer = (state, action) => {
99112
- switch (action.type) {
99113
- case "ADD_TOAST":
99114
- return {
99115
- ...state,
99116
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT)
99117
- };
99118
- case "UPDATE_TOAST":
99119
- return {
99120
- ...state,
99121
- toasts: state.toasts.map(
99122
- (t2) => t2.id === action.toast.id ? { ...t2, ...action.toast } : t2
99123
- )
99124
- };
99125
- case "DISMISS_TOAST": {
99126
- const { toastId } = action;
99127
- if (toastId) {
99128
- addToRemoveQueue(toastId);
99129
- } else {
99130
- state.toasts.forEach((toast2) => {
99131
- addToRemoveQueue(toast2.id);
99132
- });
99133
- }
99134
- return {
99135
- ...state,
99136
- toasts: state.toasts.map(
99137
- (t2) => t2.id === toastId || toastId === void 0 ? {
99138
- ...t2,
99139
- open: false
99140
- } : t2
99141
- )
99142
- };
99143
- }
99144
- case "REMOVE_TOAST":
99145
- if (action.toastId === void 0) {
99146
- return {
99147
- ...state,
99148
- toasts: []
99149
- };
99150
- }
99151
- return {
99152
- ...state,
99153
- toasts: state.toasts.filter((t2) => t2.id !== action.toastId)
99154
- };
99155
- }
99156
- };
99157
- var listeners = [];
99158
- var memoryState = { toasts: [] };
99159
- function dispatch(action) {
99160
- memoryState = reducer(memoryState, action);
99161
- listeners.forEach((listener) => {
99162
- listener(memoryState);
99163
- });
99164
- }
99165
- function toast({ ...props }) {
99166
- const id2 = genId();
99167
- const update = (props2) => dispatch({
99168
- type: "UPDATE_TOAST",
99169
- toast: { ...props2, id: id2 }
99170
- });
99171
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id2 });
99172
- dispatch({
99173
- type: "ADD_TOAST",
99174
- toast: {
99175
- ...props,
99176
- id: id2,
99177
- open: true,
99178
- onOpenChange: (open2) => {
99179
- if (!open2) dismiss();
99180
- }
99181
- }
99182
- });
99183
- return {
99184
- id: id2,
99185
- dismiss,
99186
- update
99187
- };
99188
- }
99189
- function useToast() {
99190
- const [state, setState] = React97.useState(memoryState);
99191
- React97.useEffect(() => {
99192
- listeners.push(setState);
99193
- return () => {
99194
- const index3 = listeners.indexOf(setState);
99195
- if (index3 > -1) {
99196
- listeners.splice(index3, 1);
99197
- }
99198
- };
99199
- }, [state]);
99200
- return {
99201
- ...state,
99202
- toast,
99203
- dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId })
99204
- };
99205
- }
99206
-
99207
99207
  // src/react-ui/components/ui/CodingQuestionUI.tsx
99208
99208
  var languageMap = {
99209
99209
  cpp: cpp2(),