interview-widget 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +214 -223
- package/dist/assets/alert-triangle-icon.d.ts +1 -0
- package/dist/assets/bot-icon.d.ts +1 -0
- package/dist/assets/circle-play-icon.d.ts +1 -0
- package/dist/assets/clock-fading-icon.d.ts +1 -0
- package/dist/assets/clock-icon.d.ts +1 -0
- package/dist/assets/eye-icon.d.ts +1 -0
- package/dist/assets/focus-icon.d.ts +1 -0
- package/dist/assets/index.d.ts +12 -0
- package/dist/assets/keyboard-icon.d.ts +1 -0
- package/dist/assets/loader-icon.d.ts +1 -0
- package/dist/assets/monitor-icon.d.ts +1 -0
- package/dist/assets/mouse-pointer-click-icon.d.ts +1 -0
- package/dist/assets/shield-icon.d.ts +2 -0
- package/dist/assets/speak-icon.d.ts +1 -0
- package/dist/components/interview/answer-area.d.ts +12 -0
- package/dist/components/interview/interview-content.d.ts +11 -0
- package/dist/components/interview/interview-controller.d.ts +10 -0
- package/dist/components/interview/interview-header.d.ts +7 -0
- package/dist/components/interview/phases/animated-blob.d.ts +13 -0
- package/dist/components/interview/phases/answering-phase.d.ts +10 -0
- package/dist/components/interview/phases/file-generation-animation.d.ts +1 -0
- package/dist/components/interview/phases/interview-completion-modal.d.ts +7 -0
- package/dist/components/interview/phases/question-reading-animation.d.ts +5 -0
- package/dist/components/interview/phases/thinking-phase.d.ts +8 -0
- package/dist/components/interview/phases/transcription-animation.d.ts +6 -0
- package/dist/components/interview/proctoring/cheating-warning-modal.d.ts +10 -0
- package/dist/components/interview/proctoring/interview-proctoring.d.ts +6 -0
- package/dist/components/interview/question-display.d.ts +9 -0
- package/dist/components/media/audio-wave-visualizer.d.ts +14 -0
- package/dist/components/media/video-feed.d.ts +6 -0
- package/dist/components/modals/exit-confirmation-modal.d.ts +7 -0
- package/dist/components/modals/hard-reload-warning.d.ts +16 -0
- package/dist/components/modals/onboarding-modal.d.ts +8 -0
- package/dist/components/timer/circular-timer.d.ts +11 -0
- package/dist/components/timer/timer-display.d.ts +13 -0
- package/dist/components/ui/button.d.ts +9 -0
- package/dist/components/ui/dialog.d.ts +13 -0
- package/dist/components/ui/extended/styled-button.d.ts +7 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/textarea.d.ts +8 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/interview-widget-context.d.ts +34 -0
- package/dist/context/proctoring-context.d.ts +17 -0
- package/dist/dev.d.ts +0 -1
- package/dist/hooks/index.d.ts +11 -0
- package/dist/hooks/use-api.d.ts +26 -0
- package/dist/hooks/use-dialog.d.ts +6 -0
- package/dist/hooks/use-full-screen.d.ts +17 -0
- package/dist/hooks/use-interview-api.d.ts +5 -0
- package/dist/hooks/use-keyboard-prevention.d.ts +2 -0
- package/dist/hooks/use-stt.d.ts +20 -0
- package/dist/hooks/use-tab-switch.d.ts +2 -0
- package/dist/hooks/use-text-selection-prevention.d.ts +1 -0
- package/dist/hooks/use-timer.d.ts +13 -0
- package/dist/hooks/use-tts.d.ts +15 -0
- package/dist/hooks/use-violation-logger.d.ts +13 -0
- package/dist/index.d.ts +6 -8
- package/dist/interview-widget.d.ts +4 -0
- package/dist/services/api/index.d.ts +2 -0
- package/dist/services/api/interview-api.d.ts +23 -0
- package/dist/services/stt/index.d.ts +1 -0
- package/dist/services/stt/stt-service.d.ts +79 -0
- package/dist/services/timer/index.d.ts +6 -0
- package/dist/services/timer/timer-service.d.ts +82 -0
- package/dist/services/tts/index.d.ts +1 -0
- package/dist/services/tts/tts-service.d.ts +44 -0
- package/dist/styles.d.ts +0 -0
- package/dist/types.d.ts +89 -23
- package/dist/utils/api-error-classifier.d.ts +2 -0
- package/dist/utils/constants.d.ts +3 -0
- package/dist/utils/helper.d.ts +8 -0
- package/dist/utils/resilient-fetch.d.ts +9 -0
- package/dist/widget.css +1 -0
- package/dist/widget.es.js +3204 -0
- package/dist/widget.umd.js +127 -0
- package/package.json +37 -23
- package/dist/ChatWidget.d.ts +0 -5
- package/dist/Message.d.ts +0 -10
- package/dist/chat-widget.css +0 -1
- package/dist/chat-widget.es.js +0 -189
- package/dist/chat-widget.umd.js +0 -9
|
@@ -0,0 +1,3204 @@
|
|
|
1
|
+
var Fe = Object.defineProperty;
|
|
2
|
+
var Le = (t, r, i) => r in t ? Fe(t, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[r] = i;
|
|
3
|
+
var F = (t, r, i) => Le(t, typeof r != "symbol" ? r + "" : r, i);
|
|
4
|
+
import fe, { createContext as je, useRef as E, useCallback as N, useMemo as X, useContext as re, useSyncExternalStore as Ne, useState as k, useEffect as C } from "react";
|
|
5
|
+
import { createPortal as $e } from "react-dom";
|
|
6
|
+
var ke = { exports: {} }, se = {};
|
|
7
|
+
/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react-jsx-runtime.production.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
var qe = Symbol.for("react.transitional.element"), Oe = Symbol.for("react.fragment");
|
|
17
|
+
function Te(t, r, i) {
|
|
18
|
+
var s = null;
|
|
19
|
+
if (i !== void 0 && (s = "" + i), r.key !== void 0 && (s = "" + r.key), "key" in r) {
|
|
20
|
+
i = {};
|
|
21
|
+
for (var n in r)
|
|
22
|
+
n !== "key" && (i[n] = r[n]);
|
|
23
|
+
} else i = r;
|
|
24
|
+
return r = i.ref, {
|
|
25
|
+
$$typeof: qe,
|
|
26
|
+
type: t,
|
|
27
|
+
key: s,
|
|
28
|
+
ref: r !== void 0 ? r : null,
|
|
29
|
+
props: i
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
se.Fragment = Oe;
|
|
33
|
+
se.jsx = Te;
|
|
34
|
+
se.jsxs = Te;
|
|
35
|
+
ke.exports = se;
|
|
36
|
+
var e = ke.exports;
|
|
37
|
+
const $ = {
|
|
38
|
+
api: {
|
|
39
|
+
baseUrl: "/api",
|
|
40
|
+
retryConfig: {
|
|
41
|
+
attempts: 3,
|
|
42
|
+
backoff: "exponential",
|
|
43
|
+
baseDelay: 1e3
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
ui: {
|
|
47
|
+
baseColor: "#3B82F6",
|
|
48
|
+
borderRadius: "8px"
|
|
49
|
+
},
|
|
50
|
+
interview: {
|
|
51
|
+
timers: {
|
|
52
|
+
thinkingDuration: 30,
|
|
53
|
+
answeringDuration: 120,
|
|
54
|
+
editingDuration: 30
|
|
55
|
+
},
|
|
56
|
+
stt: {
|
|
57
|
+
provider: "groq",
|
|
58
|
+
model: "whisper-large-v3-turbo",
|
|
59
|
+
language: "en"
|
|
60
|
+
},
|
|
61
|
+
tts: {
|
|
62
|
+
provider: "piper"
|
|
63
|
+
},
|
|
64
|
+
proctoring: {
|
|
65
|
+
enabled: !0
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, ne = je(null), Ee = "proctoring-storage", Be = () => {
|
|
69
|
+
var t, r;
|
|
70
|
+
try {
|
|
71
|
+
const i = sessionStorage.getItem(Ee);
|
|
72
|
+
if (i) {
|
|
73
|
+
const s = JSON.parse(i);
|
|
74
|
+
return {
|
|
75
|
+
logViolations: ((t = s.state) == null ? void 0 : t.logViolations) || [],
|
|
76
|
+
totalViolations: ((r = s.state) == null ? void 0 : r.totalViolations) || 0
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
} catch (i) {
|
|
80
|
+
console.error(
|
|
81
|
+
"Failed to load proctoring data from session storage:",
|
|
82
|
+
i
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return { logViolations: [], totalViolations: 0 };
|
|
86
|
+
}, pe = (t) => {
|
|
87
|
+
try {
|
|
88
|
+
sessionStorage.setItem(
|
|
89
|
+
Ee,
|
|
90
|
+
JSON.stringify({
|
|
91
|
+
state: t,
|
|
92
|
+
version: 0
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
} catch (r) {
|
|
96
|
+
console.error("Failed to save proctoring data to session storage:", r);
|
|
97
|
+
}
|
|
98
|
+
}, Ge = ({
|
|
99
|
+
children: t
|
|
100
|
+
}) => {
|
|
101
|
+
const r = E(Be()), i = E(/* @__PURE__ */ new Set()), s = N(() => {
|
|
102
|
+
i.current.forEach((w) => w());
|
|
103
|
+
}, []), n = N((w) => (i.current.add(w), () => {
|
|
104
|
+
i.current.delete(w);
|
|
105
|
+
}), []), o = N(() => r.current, []), l = N(
|
|
106
|
+
(w) => {
|
|
107
|
+
r.current = {
|
|
108
|
+
logViolations: [...r.current.logViolations, w],
|
|
109
|
+
totalViolations: r.current.totalViolations + 1
|
|
110
|
+
}, pe(r.current), s();
|
|
111
|
+
},
|
|
112
|
+
[s]
|
|
113
|
+
), a = N(() => {
|
|
114
|
+
r.current = {
|
|
115
|
+
logViolations: [],
|
|
116
|
+
totalViolations: 0
|
|
117
|
+
}, pe(r.current), s();
|
|
118
|
+
}, [s]), d = X(
|
|
119
|
+
() => ({
|
|
120
|
+
getState: o,
|
|
121
|
+
addViolation: l,
|
|
122
|
+
clearViolations: a,
|
|
123
|
+
subscribe: n
|
|
124
|
+
}),
|
|
125
|
+
[o, l, a, n]
|
|
126
|
+
);
|
|
127
|
+
return /* @__PURE__ */ e.jsx(ne.Provider, { value: d, children: t });
|
|
128
|
+
}, Ue = () => {
|
|
129
|
+
const t = re(ne);
|
|
130
|
+
if (!t)
|
|
131
|
+
throw new Error("useViolations must be used within a ProctoringProvider");
|
|
132
|
+
return Ne(
|
|
133
|
+
t.subscribe,
|
|
134
|
+
() => t.getState().logViolations,
|
|
135
|
+
() => t.getState().logViolations
|
|
136
|
+
);
|
|
137
|
+
}, ze = () => {
|
|
138
|
+
const t = re(ne);
|
|
139
|
+
if (!t)
|
|
140
|
+
throw new Error(
|
|
141
|
+
"useTotalViolations must be used within a ProctoringProvider"
|
|
142
|
+
);
|
|
143
|
+
return Ne(
|
|
144
|
+
t.subscribe,
|
|
145
|
+
() => t.getState().totalViolations,
|
|
146
|
+
() => t.getState().totalViolations
|
|
147
|
+
);
|
|
148
|
+
}, We = () => {
|
|
149
|
+
const t = re(ne);
|
|
150
|
+
if (!t)
|
|
151
|
+
throw new Error(
|
|
152
|
+
"useProctoringActions must be used within a ProctoringProvider"
|
|
153
|
+
);
|
|
154
|
+
return {
|
|
155
|
+
addViolation: t.addViolation,
|
|
156
|
+
clearViolations: t.clearViolations
|
|
157
|
+
};
|
|
158
|
+
}, Se = je(
|
|
159
|
+
null
|
|
160
|
+
);
|
|
161
|
+
function Ve({
|
|
162
|
+
config: t = {},
|
|
163
|
+
children: r
|
|
164
|
+
}) {
|
|
165
|
+
var s, n, o, l;
|
|
166
|
+
const i = {
|
|
167
|
+
api: {
|
|
168
|
+
...$.api,
|
|
169
|
+
...t.api,
|
|
170
|
+
retryConfig: {
|
|
171
|
+
...$.api.retryConfig,
|
|
172
|
+
...(s = t.api) == null ? void 0 : s.retryConfig
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
ui: {
|
|
176
|
+
...$.ui,
|
|
177
|
+
...t.ui
|
|
178
|
+
},
|
|
179
|
+
interview: {
|
|
180
|
+
...$.interview,
|
|
181
|
+
...t.interview,
|
|
182
|
+
timers: {
|
|
183
|
+
...$.interview.timers,
|
|
184
|
+
...(n = t.interview) == null ? void 0 : n.timers
|
|
185
|
+
},
|
|
186
|
+
stt: {
|
|
187
|
+
...$.interview.stt,
|
|
188
|
+
...(o = t.interview) == null ? void 0 : o.stt
|
|
189
|
+
},
|
|
190
|
+
tts: {
|
|
191
|
+
...$.interview.tts,
|
|
192
|
+
...(l = t.interview) == null ? void 0 : l.tts
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
return /* @__PURE__ */ e.jsx(Se.Provider, { value: i, children: /* @__PURE__ */ e.jsx(Ge, { children: r }) });
|
|
197
|
+
}
|
|
198
|
+
function ae() {
|
|
199
|
+
const t = re(Se);
|
|
200
|
+
if (!t)
|
|
201
|
+
throw new Error(
|
|
202
|
+
"useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>"
|
|
203
|
+
);
|
|
204
|
+
return t;
|
|
205
|
+
}
|
|
206
|
+
function Ce() {
|
|
207
|
+
return ae().api || $.api;
|
|
208
|
+
}
|
|
209
|
+
function Z() {
|
|
210
|
+
return ae().ui || $.ui;
|
|
211
|
+
}
|
|
212
|
+
function He() {
|
|
213
|
+
return ae().interview || $.interview;
|
|
214
|
+
}
|
|
215
|
+
const Ie = ({
|
|
216
|
+
className: t,
|
|
217
|
+
...r
|
|
218
|
+
}) => /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(
|
|
219
|
+
"svg",
|
|
220
|
+
{
|
|
221
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
222
|
+
width: "20",
|
|
223
|
+
height: "20",
|
|
224
|
+
viewBox: "0 0 24 24",
|
|
225
|
+
fill: "none",
|
|
226
|
+
stroke: "currentColor",
|
|
227
|
+
strokeWidth: "2",
|
|
228
|
+
strokeLinecap: "round",
|
|
229
|
+
strokeLinejoin: "round",
|
|
230
|
+
className: `iw-animate-spin ${t}`,
|
|
231
|
+
...r,
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ e.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
234
|
+
/* @__PURE__ */ e.jsx("path", { d: "M12 6l0 -3" }),
|
|
235
|
+
/* @__PURE__ */ e.jsx("path", { d: "M16.25 7.75l2.15 -2.15" }),
|
|
236
|
+
/* @__PURE__ */ e.jsx("path", { d: "M18 12l3 0" }),
|
|
237
|
+
/* @__PURE__ */ e.jsx("path", { d: "M16.25 16.25l2.15 2.15" }),
|
|
238
|
+
/* @__PURE__ */ e.jsx("path", { d: "M12 18l0 3" }),
|
|
239
|
+
/* @__PURE__ */ e.jsx("path", { d: "M7.75 16.25l-2.15 2.15" }),
|
|
240
|
+
/* @__PURE__ */ e.jsx("path", { d: "M6 12l-3 0" }),
|
|
241
|
+
/* @__PURE__ */ e.jsx("path", { d: "M7.75 7.75l-2.15 -2.15" })
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
) }), Re = ({
|
|
245
|
+
children: t,
|
|
246
|
+
variant: r = "primary",
|
|
247
|
+
size: i = "md",
|
|
248
|
+
fullWidth: s = !1,
|
|
249
|
+
isLoading: n = !1,
|
|
250
|
+
disabled: o,
|
|
251
|
+
className: l = "",
|
|
252
|
+
...a
|
|
253
|
+
}) => {
|
|
254
|
+
const d = "iw-inline-flex iw-items-center iw-justify-center iw-rounded-md iw-font-medium iw-transition-colors iw-focus:outline-none iw-focus:ring-2 iw-focus:ring-primary-500 iw-focus:ring-offset-2", w = {
|
|
255
|
+
primary: "iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",
|
|
256
|
+
secondary: "iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",
|
|
257
|
+
outline: "iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",
|
|
258
|
+
text: "iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",
|
|
259
|
+
gradient: "iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"
|
|
260
|
+
}, u = {
|
|
261
|
+
sm: "iw-px-3 iw-py-1.5 iw-text-sm",
|
|
262
|
+
md: "iw-px-4 iw-py-2.5 iw-text-sm",
|
|
263
|
+
lg: "iw-px-5 iw-py-3 iw-text-base"
|
|
264
|
+
}, h = "iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none", m = s ? "iw-w-full" : "";
|
|
265
|
+
return /* @__PURE__ */ e.jsxs(
|
|
266
|
+
"button",
|
|
267
|
+
{
|
|
268
|
+
className: `${d} ${w[r]} ${u[i]} ${m} ${h} ${l}`,
|
|
269
|
+
disabled: o || n,
|
|
270
|
+
...a,
|
|
271
|
+
children: [
|
|
272
|
+
n && /* @__PURE__ */ e.jsx(Ie, { height: 16, width: 16, style: { marginRight: "3px" } }),
|
|
273
|
+
t
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
};
|
|
278
|
+
function Qe(t) {
|
|
279
|
+
const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
|
|
280
|
+
return r ? {
|
|
281
|
+
r: parseInt(r[1], 16),
|
|
282
|
+
g: parseInt(r[2], 16),
|
|
283
|
+
b: parseInt(r[3], 16)
|
|
284
|
+
} : null;
|
|
285
|
+
}
|
|
286
|
+
function Ye(t, r, i) {
|
|
287
|
+
return "#" + [t, r, i].map((s) => {
|
|
288
|
+
const n = Math.round(s).toString(16);
|
|
289
|
+
return n.length === 1 ? "0" + n : n;
|
|
290
|
+
}).join("");
|
|
291
|
+
}
|
|
292
|
+
function Me(t, r) {
|
|
293
|
+
const i = Qe(t);
|
|
294
|
+
if (!i) return t;
|
|
295
|
+
const s = i.r + (255 - i.r) * r, n = i.g + (255 - i.g) * r, o = i.b + (255 - i.b) * r;
|
|
296
|
+
return Ye(s, n, o);
|
|
297
|
+
}
|
|
298
|
+
function Je(t, r = 0.8) {
|
|
299
|
+
return {
|
|
300
|
+
background: `linear-gradient(to bottom, ${Me(t, r)}, #ffffff)`,
|
|
301
|
+
color: "#1f2937"
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function Ke(t) {
|
|
305
|
+
return new Promise((r) => setTimeout(r, t));
|
|
306
|
+
}
|
|
307
|
+
function Ae(t) {
|
|
308
|
+
return `linear-gradient(to left, ${Me(t, 0.4)}, ${t})`;
|
|
309
|
+
}
|
|
310
|
+
const Xe = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
311
|
+
function Ze(t) {
|
|
312
|
+
try {
|
|
313
|
+
const r = t.split(".");
|
|
314
|
+
if (r.length !== 3 || !r[1])
|
|
315
|
+
throw new Error("Invalid JWT token");
|
|
316
|
+
const s = r[1].replace(/-/g, "+").replace(/_/g, "/"), n = s.padEnd(
|
|
317
|
+
s.length + (4 - s.length % 4) % 4,
|
|
318
|
+
"="
|
|
319
|
+
), o = atob(n);
|
|
320
|
+
return JSON.parse(o);
|
|
321
|
+
} catch (r) {
|
|
322
|
+
return console.error("Error decoding JWT:", r), null;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const Pe = (t) => /* @__PURE__ */ e.jsxs(
|
|
326
|
+
"svg",
|
|
327
|
+
{
|
|
328
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
329
|
+
width: "24",
|
|
330
|
+
height: "24",
|
|
331
|
+
viewBox: "0 0 24 24",
|
|
332
|
+
fill: "none",
|
|
333
|
+
stroke: "currentColor",
|
|
334
|
+
strokeWidth: "2",
|
|
335
|
+
strokeLinecap: "round",
|
|
336
|
+
strokeLinejoin: "round",
|
|
337
|
+
...t,
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ e.jsx("path", { d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" }),
|
|
340
|
+
/* @__PURE__ */ e.jsx("path", { d: "m9 12 2 2 4-4" })
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
), De = (t) => /* @__PURE__ */ e.jsxs(
|
|
344
|
+
"svg",
|
|
345
|
+
{
|
|
346
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
347
|
+
width: "24",
|
|
348
|
+
height: "24",
|
|
349
|
+
viewBox: "0 0 24 24",
|
|
350
|
+
fill: "none",
|
|
351
|
+
stroke: "currentColor",
|
|
352
|
+
strokeWidth: "2",
|
|
353
|
+
strokeLinecap: "round",
|
|
354
|
+
strokeLinejoin: "round",
|
|
355
|
+
...t,
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ e.jsx("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
|
|
358
|
+
/* @__PURE__ */ e.jsx("line", { x1: "8", x2: "16", y1: "21", y2: "21" }),
|
|
359
|
+
/* @__PURE__ */ e.jsx("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
), et = (t) => /* @__PURE__ */ e.jsxs(
|
|
363
|
+
"svg",
|
|
364
|
+
{
|
|
365
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
366
|
+
width: "24",
|
|
367
|
+
height: "24",
|
|
368
|
+
viewBox: "0 0 24 24",
|
|
369
|
+
fill: "none",
|
|
370
|
+
stroke: "currentColor",
|
|
371
|
+
strokeWidth: "2",
|
|
372
|
+
strokeLinecap: "round",
|
|
373
|
+
strokeLinejoin: "round",
|
|
374
|
+
...t,
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ e.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
377
|
+
/* @__PURE__ */ e.jsx("path", { d: "M15 8a5 5 0 0 1 0 8" }),
|
|
378
|
+
/* @__PURE__ */ e.jsx("path", { d: "M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5" })
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
), W = (t) => {
|
|
382
|
+
const { baseColor: r, borderRadius: i } = Z(), { loading: s, children: n, ...o } = t;
|
|
383
|
+
return /* @__PURE__ */ e.jsx(
|
|
384
|
+
Re,
|
|
385
|
+
{
|
|
386
|
+
style: {
|
|
387
|
+
background: Ae(r),
|
|
388
|
+
borderRadius: i
|
|
389
|
+
},
|
|
390
|
+
...o,
|
|
391
|
+
children: s ? /* @__PURE__ */ e.jsx(Ie, {}) : n
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
}, tt = [
|
|
395
|
+
"Do not refresh or reload the page during your assessment",
|
|
396
|
+
"Refrain from switching tabs or opening other applications while the session is in progress",
|
|
397
|
+
"Ensure your face remains clearly visible on camera at all times",
|
|
398
|
+
"Avoid frequent distractions or leaving your seat during the session",
|
|
399
|
+
"Do not disable or interfere with audio/video monitoring"
|
|
400
|
+
], it = ({
|
|
401
|
+
isOpen: t,
|
|
402
|
+
onStart: r,
|
|
403
|
+
onClose: i
|
|
404
|
+
}) => {
|
|
405
|
+
var M;
|
|
406
|
+
const s = E(null), n = E(null), { baseColor: o, borderRadius: l } = Z(), [a, d] = k(!1), [w, u] = k(null), [h, m] = k(!1), c = o ?? "#2563eb", g = Ae(c), y = l ?? 18, j = (x, I) => x.startsWith("#") && x.length === 7 ? `${x}${I}` : x, f = [
|
|
407
|
+
`radial-gradient(120% 85% at 50% 125%, ${j(
|
|
408
|
+
c,
|
|
409
|
+
"34"
|
|
410
|
+
)} 0%, transparent 70%)`,
|
|
411
|
+
`radial-gradient(90% 70% at 10% 130%, ${j(
|
|
412
|
+
c,
|
|
413
|
+
"24"
|
|
414
|
+
)} 0%, transparent 72%)`,
|
|
415
|
+
`radial-gradient(90% 70% at 90% 130%, ${j(
|
|
416
|
+
c,
|
|
417
|
+
"24"
|
|
418
|
+
)} 0%, transparent 72%)`,
|
|
419
|
+
`repeating-linear-gradient(135deg, ${j(
|
|
420
|
+
c,
|
|
421
|
+
"14"
|
|
422
|
+
)} 0, ${j(
|
|
423
|
+
c,
|
|
424
|
+
"14"
|
|
425
|
+
)} 16px, transparent 16px, transparent 32px)`
|
|
426
|
+
].join(", "), T = a ? {
|
|
427
|
+
label: "Camera & microphone ready",
|
|
428
|
+
toneClass: "iw-bg-white/15 iw-text-white",
|
|
429
|
+
dotClass: "iw-bg-emerald-400"
|
|
430
|
+
} : h ? {
|
|
431
|
+
label: "Checking device access…",
|
|
432
|
+
toneClass: "iw-bg-white/15 iw-text-white",
|
|
433
|
+
dotClass: "iw-bg-amber-300"
|
|
434
|
+
} : {
|
|
435
|
+
label: "Allow access to continue",
|
|
436
|
+
toneClass: "iw-bg-white/15 iw-text-white",
|
|
437
|
+
dotClass: "iw-bg-rose-300"
|
|
438
|
+
}, S = a ? {
|
|
439
|
+
badge: "Ready",
|
|
440
|
+
toneClass: "iw-bg-emerald-50 iw-text-emerald-600",
|
|
441
|
+
cameraCopy: "Framing looks good for identity verification.",
|
|
442
|
+
micCopy: "We can hear you clearly for your responses."
|
|
443
|
+
} : h ? {
|
|
444
|
+
badge: "Checking",
|
|
445
|
+
toneClass: "iw-bg-amber-50 iw-text-amber-600",
|
|
446
|
+
cameraCopy: "Hang tight while we confirm camera access.",
|
|
447
|
+
micCopy: "Listening for microphone permission from your browser."
|
|
448
|
+
} : {
|
|
449
|
+
badge: "Action needed",
|
|
450
|
+
toneClass: "iw-bg-rose-50 iw-text-rose-600",
|
|
451
|
+
cameraCopy: "Grant camera access to continue with the interview.",
|
|
452
|
+
micCopy: "Enable microphone access so we can capture your answers."
|
|
453
|
+
}, v = [
|
|
454
|
+
{
|
|
455
|
+
label: "Camera feed",
|
|
456
|
+
description: S.cameraCopy,
|
|
457
|
+
status: S.badge,
|
|
458
|
+
toneClass: S.toneClass,
|
|
459
|
+
Icon: De
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
label: "Microphone input",
|
|
463
|
+
description: S.micCopy,
|
|
464
|
+
status: S.badge,
|
|
465
|
+
toneClass: S.toneClass,
|
|
466
|
+
Icon: et
|
|
467
|
+
}
|
|
468
|
+
], _ = () => {
|
|
469
|
+
n.current && (n.current.getTracks().forEach((x) => x.stop()), n.current = null);
|
|
470
|
+
}, b = async () => {
|
|
471
|
+
m(!0), u(null);
|
|
472
|
+
try {
|
|
473
|
+
const x = await navigator.mediaDevices.getUserMedia({
|
|
474
|
+
video: { width: { ideal: 1280 }, height: { ideal: 720 } },
|
|
475
|
+
audio: !0
|
|
476
|
+
});
|
|
477
|
+
n.current = x, s.current && (s.current.srcObject = x), d(!0);
|
|
478
|
+
} catch (x) {
|
|
479
|
+
console.error("Media permission error:", x);
|
|
480
|
+
let I = "Unable to access camera or microphone.";
|
|
481
|
+
(x == null ? void 0 : x.name) === "NotAllowedError" ? I = "Permissions denied. Please allow access to camera and microphone." : (x == null ? void 0 : x.name) === "NotFoundError" ? I = "No camera/microphone found. Please connect a device and retry." : x != null && x.message && (I = x.message), d(!1), u(I);
|
|
482
|
+
} finally {
|
|
483
|
+
m(!1);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
if (C(() => {
|
|
487
|
+
if (!t) {
|
|
488
|
+
_();
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
return b(), () => {
|
|
492
|
+
_();
|
|
493
|
+
};
|
|
494
|
+
}, [t]), !t) return null;
|
|
495
|
+
const P = () => {
|
|
496
|
+
r(), _();
|
|
497
|
+
};
|
|
498
|
+
return /* @__PURE__ */ e.jsx("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-gray-900/25 iw-backdrop-blur-md iw-p-4", children: /* @__PURE__ */ e.jsxs("div", { className: " iw-w-full iw-max-w-[920px] iw-max-h-[96vh] iw-overflow-auto iw-rounded-3xl iw-bg-white iw-shadow-[0_40px_80px_-28px_rgba(15,23,42,0.25)]", children: [
|
|
499
|
+
/* @__PURE__ */ e.jsxs(
|
|
500
|
+
"div",
|
|
501
|
+
{
|
|
502
|
+
className: "iw-relative iw-overflow-hidden",
|
|
503
|
+
style: { background: g },
|
|
504
|
+
children: [
|
|
505
|
+
/* @__PURE__ */ e.jsx(
|
|
506
|
+
"div",
|
|
507
|
+
{
|
|
508
|
+
"aria-hidden": !0,
|
|
509
|
+
className: "iw-absolute iw-pointer-events-none",
|
|
510
|
+
style: {
|
|
511
|
+
top: -90,
|
|
512
|
+
right: -100,
|
|
513
|
+
width: 240,
|
|
514
|
+
height: 240,
|
|
515
|
+
background: "radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%)",
|
|
516
|
+
filter: "blur(12px)"
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
/* @__PURE__ */ e.jsx(
|
|
521
|
+
"div",
|
|
522
|
+
{
|
|
523
|
+
"aria-hidden": !0,
|
|
524
|
+
className: "iw-absolute iw-pointer-events-none",
|
|
525
|
+
style: {
|
|
526
|
+
bottom: -110,
|
|
527
|
+
left: -60,
|
|
528
|
+
width: 220,
|
|
529
|
+
height: 220,
|
|
530
|
+
background: "radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%)",
|
|
531
|
+
filter: "blur(14px)"
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
),
|
|
535
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-relative iw-grid md:iw-grid-cols-[minmax(0,1fr)_auto] iw-items-start iw-gap-6 iw-px-6 iw-py-7", children: [
|
|
536
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-flex-col iw-gap-4 iw-text-white", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-start iw-gap-4", children: [
|
|
537
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-12 iw-w-12 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-white/15 iw-shadow-inner", children: /* @__PURE__ */ e.jsx(Pe, { className: "iw-h-6 iw-w-6" }) }),
|
|
538
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
539
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-white/70", children: "Pre-interview checklist" }),
|
|
540
|
+
/* @__PURE__ */ e.jsx("h2", { className: "iw-mt-1 iw-text-xl iw-font-semibold iw-leading-tight", children: "Final checks before you go live" }),
|
|
541
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-mt-2 iw-text-sm iw-text-white/80", children: "Align your space, confirm device access, and step confidently into your secure session." })
|
|
542
|
+
] })
|
|
543
|
+
] }) }),
|
|
544
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-items-start iw-justify-end", children: /* @__PURE__ */ e.jsxs(
|
|
545
|
+
"div",
|
|
546
|
+
{
|
|
547
|
+
className: `iw-inline-flex iw-items-center iw-gap-2 iw-rounded-full iw-bg-white/10 iw-px-4 iw-py-1.5 iw-text-xs iw-font-medium iw-text-white/85 iw-backdrop-blur-sm ${T.toneClass}`,
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ e.jsx(
|
|
550
|
+
"span",
|
|
551
|
+
{
|
|
552
|
+
className: `iw-inline-flex iw-h-2 iw-w-2 iw-rounded-full ${T.dotClass}`
|
|
553
|
+
}
|
|
554
|
+
),
|
|
555
|
+
T.label
|
|
556
|
+
]
|
|
557
|
+
}
|
|
558
|
+
) }),
|
|
559
|
+
i && /* @__PURE__ */ e.jsx(
|
|
560
|
+
"button",
|
|
561
|
+
{
|
|
562
|
+
"aria-label": "Close",
|
|
563
|
+
className: "iw-absolute iw-top-5 iw-right-5 iw-text-white/70 transition-colors hover:iw-text-white",
|
|
564
|
+
onClick: () => {
|
|
565
|
+
_(), i == null || i();
|
|
566
|
+
},
|
|
567
|
+
children: "✕"
|
|
568
|
+
}
|
|
569
|
+
)
|
|
570
|
+
] })
|
|
571
|
+
]
|
|
572
|
+
}
|
|
573
|
+
),
|
|
574
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-relative iw-flex iw-flex-col iw-gap-6 iw-px-6 iw-pb-8 iw-pt-6", children: [
|
|
575
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-grid xl:iw-grid-cols-[0.95fr_1.05fr] iw-gap-6", children: [
|
|
576
|
+
/* @__PURE__ */ e.jsx("section", { className: "iw-flex iw-flex-col iw-gap-5", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-rounded-2xl iw-border iw-border-slate-100 iw-bg-white iw-p-5 iw-shadow-sm", children: [
|
|
577
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
|
|
578
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-text-sm iw-font-semibold iw-text-slate-900", children: "Proctoring guidelines" }),
|
|
579
|
+
/* @__PURE__ */ e.jsx("span", { className: "iw-text-[11px] iw-font-medium iw-uppercase iw-tracking-wide iw-text-slate-400", children: "Required" })
|
|
580
|
+
] }),
|
|
581
|
+
/* @__PURE__ */ e.jsx("ul", { className: "iw-mt-5 iw-flex iw-flex-col iw-gap-4", children: tt.map((x, I) => /* @__PURE__ */ e.jsx(
|
|
582
|
+
"li",
|
|
583
|
+
{
|
|
584
|
+
className: "iw-group iw-overflow-hidden iw-rounded-xl iw-border iw-border-slate-100 iw-bg-slate-50/60 iw-p-4 iw-transition-all hover:iw-border-slate-200 hover:iw-bg-white",
|
|
585
|
+
children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-start iw-gap-3", children: [
|
|
586
|
+
/* @__PURE__ */ e.jsx(
|
|
587
|
+
"span",
|
|
588
|
+
{
|
|
589
|
+
className: "iw-flex iw-h-8 iw-w-8 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-text-sm iw-font-semibold iw-text-white",
|
|
590
|
+
style: { background: g },
|
|
591
|
+
children: I + 1
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
/* @__PURE__ */ e.jsx("span", { className: "iw-text-sm iw-text-slate-600", children: x })
|
|
595
|
+
] })
|
|
596
|
+
},
|
|
597
|
+
x
|
|
598
|
+
)) })
|
|
599
|
+
] }) }),
|
|
600
|
+
/* @__PURE__ */ e.jsxs("section", { className: "iw-flex iw-flex-col iw-gap-5", children: [
|
|
601
|
+
/* @__PURE__ */ e.jsxs(
|
|
602
|
+
"div",
|
|
603
|
+
{
|
|
604
|
+
className: "iw-relative iw-flex iw-flex-col iw-gap-6 iw-overflow-hidden iw-rounded-3xl iw-bg-white ",
|
|
605
|
+
style: { borderRadius: y },
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-relative iw-z-10 iw-rounded-2xl iw-border iw-border-slate-200 iw-bg-slate-50/80 iw-p-3", children: /* @__PURE__ */ e.jsx(
|
|
608
|
+
"video",
|
|
609
|
+
{
|
|
610
|
+
ref: s,
|
|
611
|
+
autoPlay: !0,
|
|
612
|
+
playsInline: !0,
|
|
613
|
+
muted: !0,
|
|
614
|
+
className: "iw-h-64 iw-w-full iw-rounded-2xl iw-object-cover",
|
|
615
|
+
style: {
|
|
616
|
+
transform: "scaleX(-1)",
|
|
617
|
+
borderRadius: y
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
) }),
|
|
621
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-relative iw-grid iw-grid-cols-2 iw-gap-4 iw-px-1", children: [
|
|
622
|
+
/* @__PURE__ */ e.jsx(
|
|
623
|
+
Re,
|
|
624
|
+
{
|
|
625
|
+
onClick: b,
|
|
626
|
+
disabled: h,
|
|
627
|
+
variant: "outline",
|
|
628
|
+
size: "sm",
|
|
629
|
+
className: "iw-font-medium",
|
|
630
|
+
style: {
|
|
631
|
+
borderColor: c,
|
|
632
|
+
borderRadius: y,
|
|
633
|
+
color: c
|
|
634
|
+
},
|
|
635
|
+
children: a ? "Recheck permissions" : "Enable camera & mic"
|
|
636
|
+
}
|
|
637
|
+
),
|
|
638
|
+
/* @__PURE__ */ e.jsx(
|
|
639
|
+
W,
|
|
640
|
+
{
|
|
641
|
+
onClick: P,
|
|
642
|
+
disabled: !a,
|
|
643
|
+
className: "iw-h-10 iw-px-6 iw-text-sm",
|
|
644
|
+
style: {
|
|
645
|
+
backgroundColor: c
|
|
646
|
+
},
|
|
647
|
+
children: "Proceed"
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
] })
|
|
651
|
+
]
|
|
652
|
+
}
|
|
653
|
+
),
|
|
654
|
+
/* @__PURE__ */ e.jsx("ul", { className: "iw-grid sm:iw-grid-cols-1 iw-gap-3", children: v.map(
|
|
655
|
+
({ Icon: x, label: I, description: L, status: G, toneClass: B }) => /* @__PURE__ */ e.jsx(
|
|
656
|
+
"li",
|
|
657
|
+
{
|
|
658
|
+
className: "iw-rounded-2xl iw-border iw-border-slate-200/65 iw-bg-white iw-p-4 iw-shadow-sm iw-transition-all hover:iw-border-slate-200",
|
|
659
|
+
children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-start iw-gap-3", children: [
|
|
660
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-xl iw-bg-slate-100", children: /* @__PURE__ */ e.jsx(x, { className: "iw-h-5 iw-w-5 iw-text-slate-600" }) }),
|
|
661
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex-1", children: [
|
|
662
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-gap-3", children: [
|
|
663
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-font-medium iw-text-slate-800", children: I }),
|
|
664
|
+
/* @__PURE__ */ e.jsx(
|
|
665
|
+
"span",
|
|
666
|
+
{
|
|
667
|
+
className: `iw-rounded-full iw-px-3 iw-py-1 iw-text-[11px] iw-font-semibold ${B}`,
|
|
668
|
+
children: G
|
|
669
|
+
}
|
|
670
|
+
)
|
|
671
|
+
] }),
|
|
672
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-mt-1.5 iw-text-xs iw-text-slate-500", children: L })
|
|
673
|
+
] })
|
|
674
|
+
] })
|
|
675
|
+
},
|
|
676
|
+
I
|
|
677
|
+
)
|
|
678
|
+
) }),
|
|
679
|
+
w && /* @__PURE__ */ e.jsx("div", { className: "iw-rounded-lg iw-border iw-border-rose-200 iw-bg-rose-50 iw-px-3 iw-py-2 iw-text-xs iw-text-rose-600", children: w }),
|
|
680
|
+
!((M = navigator.mediaDevices) != null && M.getUserMedia) && /* @__PURE__ */ e.jsx("div", { className: "iw-rounded-lg iw-border iw-border-amber-200 iw-bg-amber-50 iw-px-3 iw-py-2 iw-text-xs iw-text-amber-700", children: "Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox." })
|
|
681
|
+
] })
|
|
682
|
+
] }),
|
|
683
|
+
/* @__PURE__ */ e.jsx("div", { className: " iw-rounded-2xl iw-border iw-border-dashed iw-border-slate-200 iw-bg-slate-50/85 iw-px-5 iw-py-4 iw-text-center", children: /* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-slate-500", children: "Your session is monitored to protect exam integrity. Continuing confirms you have reviewed and accept these safeguards." }) }),
|
|
684
|
+
/* @__PURE__ */ e.jsx(
|
|
685
|
+
"div",
|
|
686
|
+
{
|
|
687
|
+
"aria-hidden": !0,
|
|
688
|
+
className: "iw-pointer-events-none iw-absolute iw-inset-x-0 iw-bottom-1 iw-h-20",
|
|
689
|
+
style: {
|
|
690
|
+
backgroundImage: f,
|
|
691
|
+
backgroundSize: "100% 120%, 100% 120%, 100% 120%, 32px 32px",
|
|
692
|
+
backgroundPosition: "center bottom, left 95% bottom, right 95% bottom, center bottom",
|
|
693
|
+
backgroundRepeat: "no-repeat, no-repeat, no-repeat, repeat",
|
|
694
|
+
opacity: 0.9,
|
|
695
|
+
transform: "translateY(4px)",
|
|
696
|
+
maskImage: "linear-gradient(to top, rgba(0,0,0,0.92), transparent)",
|
|
697
|
+
WebkitMaskImage: "linear-gradient(to top, rgba(0,0,0,0.92), transparent)"
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
)
|
|
701
|
+
] })
|
|
702
|
+
] }) });
|
|
703
|
+
};
|
|
704
|
+
var D = /* @__PURE__ */ ((t) => (t.IDLE = "idle", t.FETCHING_QUESTION = "fetching_question", t.READING_QUESTION = "reading_question", t.THINKING = "thinking", t.ANSWERING = "answering", t.TRANSCRIBING = "transcribing", t.EDITING = "editing", t.SUBMITTING = "submitting", t.COMPLETED = "completed", t))(D || {});
|
|
705
|
+
const rt = {
|
|
706
|
+
thinkingDuration: 30,
|
|
707
|
+
answeringDuration: 120,
|
|
708
|
+
editingDuration: 30
|
|
709
|
+
}, st = {
|
|
710
|
+
idle: {
|
|
711
|
+
next: "fetching_question"
|
|
712
|
+
/* FETCHING_QUESTION */
|
|
713
|
+
},
|
|
714
|
+
fetching_question: {
|
|
715
|
+
next: "reading_question"
|
|
716
|
+
/* READING_QUESTION */
|
|
717
|
+
},
|
|
718
|
+
reading_question: {
|
|
719
|
+
next: "thinking"
|
|
720
|
+
/* THINKING */
|
|
721
|
+
},
|
|
722
|
+
thinking: { next: "answering", duration: 30 },
|
|
723
|
+
answering: { next: "transcribing", duration: 120 },
|
|
724
|
+
transcribing: {
|
|
725
|
+
next: "editing"
|
|
726
|
+
/* EDITING */
|
|
727
|
+
},
|
|
728
|
+
editing: { next: "submitting", duration: 30 },
|
|
729
|
+
submitting: {
|
|
730
|
+
next: "completed"
|
|
731
|
+
/* COMPLETED */
|
|
732
|
+
},
|
|
733
|
+
completed: {
|
|
734
|
+
next: "completed"
|
|
735
|
+
/* COMPLETED */
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
class nt {
|
|
739
|
+
constructor(r = {}, i = {}) {
|
|
740
|
+
F(this, "config");
|
|
741
|
+
F(this, "state");
|
|
742
|
+
F(this, "phaseIntervalId", null);
|
|
743
|
+
F(this, "globalIntervalId", null);
|
|
744
|
+
F(this, "callbacks");
|
|
745
|
+
this.config = { ...rt, ...r }, this.callbacks = i, this.state = {
|
|
746
|
+
phase: "idle",
|
|
747
|
+
currentPhaseTimeRemaining: 0,
|
|
748
|
+
totalTimeElapsed: 0,
|
|
749
|
+
currentQuestionNumber: 0
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Get current state
|
|
754
|
+
*/
|
|
755
|
+
getState() {
|
|
756
|
+
return { ...this.state };
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Start a new question cycle
|
|
760
|
+
*/
|
|
761
|
+
startQuestion() {
|
|
762
|
+
this.state.currentQuestionNumber === 0 && this.startGlobalTimer(), this.state.currentQuestionNumber = this.state.currentQuestionNumber + 1, this.state.phase = "fetching_question", this.notifyChange();
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Move to next phase
|
|
766
|
+
*/
|
|
767
|
+
nextPhase() {
|
|
768
|
+
const r = this.state.phase, i = st[r];
|
|
769
|
+
if (!i) return;
|
|
770
|
+
this.stopPhaseTimer(), this.state.phase = i.next;
|
|
771
|
+
const s = this.getDurationForPhase(i.next);
|
|
772
|
+
s > 0 ? (this.state.currentPhaseTimeRemaining = s, this.startPhaseTimer()) : this.state.currentPhaseTimeRemaining = 0, this.notifyChange();
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Manually complete the interview
|
|
776
|
+
*/
|
|
777
|
+
completeInterview() {
|
|
778
|
+
var r, i;
|
|
779
|
+
this.stopGlobalTimer(), this.stopPhaseTimer(), this.state.phase = "completed", (i = (r = this.callbacks).onInterviewEnd) == null || i.call(r), this.notifyChange();
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Cleanup
|
|
783
|
+
*/
|
|
784
|
+
destroy() {
|
|
785
|
+
this.stopPhaseTimer(), this.stopGlobalTimer();
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Get duration for a phase
|
|
789
|
+
*/
|
|
790
|
+
getDurationForPhase(r) {
|
|
791
|
+
switch (r) {
|
|
792
|
+
case "thinking":
|
|
793
|
+
return this.config.thinkingDuration;
|
|
794
|
+
case "answering":
|
|
795
|
+
return this.config.answeringDuration;
|
|
796
|
+
case "editing":
|
|
797
|
+
return this.config.editingDuration;
|
|
798
|
+
default:
|
|
799
|
+
return 0;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Start global timer (runs continuously during entire interview for tracking)
|
|
804
|
+
*/
|
|
805
|
+
startGlobalTimer() {
|
|
806
|
+
this.globalIntervalId = setInterval(() => {
|
|
807
|
+
var r, i;
|
|
808
|
+
this.state.totalTimeElapsed++, (i = (r = this.callbacks).onTick) == null || i.call(r, this.getState());
|
|
809
|
+
}, 1e3);
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Stop global timer
|
|
813
|
+
*/
|
|
814
|
+
stopGlobalTimer() {
|
|
815
|
+
this.globalIntervalId && (clearInterval(this.globalIntervalId), this.globalIntervalId = null);
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Start phase timer (only for timed phases)
|
|
819
|
+
*/
|
|
820
|
+
startPhaseTimer() {
|
|
821
|
+
this.phaseIntervalId = setInterval(() => {
|
|
822
|
+
this.state.currentPhaseTimeRemaining--, this.state.currentPhaseTimeRemaining <= 0 && this.nextPhase();
|
|
823
|
+
}, 1e3);
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Stop phase timer
|
|
827
|
+
*/
|
|
828
|
+
stopPhaseTimer() {
|
|
829
|
+
this.phaseIntervalId && (clearInterval(this.phaseIntervalId), this.phaseIntervalId = null);
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Notify phase change
|
|
833
|
+
*/
|
|
834
|
+
notifyChange() {
|
|
835
|
+
var r, i;
|
|
836
|
+
(i = (r = this.callbacks).onPhaseChange) == null || i.call(r, this.state.phase, this.getState());
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
function at(t = {}) {
|
|
840
|
+
const { config: r = {}, callbacks: i = {} } = t, s = E(null);
|
|
841
|
+
s.current || (s.current = new nt(r, {}));
|
|
842
|
+
const n = s.current, [o, l] = k(n.getState()), a = N(() => {
|
|
843
|
+
l(n.getState());
|
|
844
|
+
}, [n]);
|
|
845
|
+
C(() => {
|
|
846
|
+
const h = {
|
|
847
|
+
onPhaseChange: (m, c) => {
|
|
848
|
+
var g;
|
|
849
|
+
a(), (g = i.onPhaseChange) == null || g.call(i, m, c);
|
|
850
|
+
},
|
|
851
|
+
onTick: (m) => {
|
|
852
|
+
var c;
|
|
853
|
+
a(), (c = i.onTick) == null || c.call(i, m);
|
|
854
|
+
},
|
|
855
|
+
onInterviewEnd: () => {
|
|
856
|
+
var m;
|
|
857
|
+
a(), (m = i.onInterviewEnd) == null || m.call(i);
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
n.callbacks = h;
|
|
861
|
+
}, [n, i, a]), C(() => () => {
|
|
862
|
+
n.destroy();
|
|
863
|
+
}, [n]);
|
|
864
|
+
const d = N(() => {
|
|
865
|
+
n.startQuestion(), a();
|
|
866
|
+
}, [n, a]), w = N(() => {
|
|
867
|
+
n.nextPhase(), a();
|
|
868
|
+
}, [n, a]), u = N(() => {
|
|
869
|
+
n.completeInterview(), a();
|
|
870
|
+
}, [n, a]);
|
|
871
|
+
return {
|
|
872
|
+
state: o,
|
|
873
|
+
startQuestion: d,
|
|
874
|
+
nextPhase: w,
|
|
875
|
+
completeInterview: u,
|
|
876
|
+
timerService: n
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
function ot(t, r = {}) {
|
|
880
|
+
const [i, s] = k({
|
|
881
|
+
data: null,
|
|
882
|
+
loading: !1,
|
|
883
|
+
error: null
|
|
884
|
+
}), n = N(
|
|
885
|
+
async (...o) => {
|
|
886
|
+
var l, a, d, w;
|
|
887
|
+
s((u) => ({ ...u, loading: !0, error: null }));
|
|
888
|
+
try {
|
|
889
|
+
const u = await t(...o);
|
|
890
|
+
s((h) => ({
|
|
891
|
+
...h,
|
|
892
|
+
data: u,
|
|
893
|
+
loading: !1,
|
|
894
|
+
error: null
|
|
895
|
+
})), (l = r.onSuccess) == null || l.call(r, u), (a = r.onSettled) == null || a.call(r, u, null);
|
|
896
|
+
} catch (u) {
|
|
897
|
+
const h = u.type ? u : {
|
|
898
|
+
type: "unknown",
|
|
899
|
+
message: u.message || "Unknown error",
|
|
900
|
+
retryable: !0,
|
|
901
|
+
userMessage: "Something went wrong. Please try again.",
|
|
902
|
+
originalError: u
|
|
903
|
+
};
|
|
904
|
+
s((m) => ({
|
|
905
|
+
...m,
|
|
906
|
+
loading: !1,
|
|
907
|
+
error: h
|
|
908
|
+
})), (d = r.onError) == null || d.call(r, h), (w = r.onSettled) == null || w.call(r, null, h);
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
[t, r]
|
|
912
|
+
);
|
|
913
|
+
return {
|
|
914
|
+
...i,
|
|
915
|
+
execute: n
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
const lt = (t) => {
|
|
919
|
+
const [r, i] = k(null), [s, n] = k(!1), o = document, l = () => !!(o.fullscreenEnabled || o.webkitFullscreenEnabled || o.mozFullScreenEnabled || o.msFullscreenEnabled), a = () => o.fullscreenElement || o.webkitFullscreenElement || o.mozFullScreenElement || o.msFullscreenElement, d = async (c) => {
|
|
920
|
+
var g;
|
|
921
|
+
try {
|
|
922
|
+
if (!l())
|
|
923
|
+
throw new Error("Fullscreen is not supported in this environment");
|
|
924
|
+
c.requestFullscreen ? await c.requestFullscreen() : c.webkitRequestFullscreen ? await c.webkitRequestFullscreen() : c.mozRequestFullScreen ? await c.mozRequestFullScreen() : c.msRequestFullscreen && await c.msRequestFullscreen();
|
|
925
|
+
} catch (y) {
|
|
926
|
+
const j = {
|
|
927
|
+
name: "FullscreenError",
|
|
928
|
+
message: y instanceof Error ? y.message : "Failed to enter fullscreen"
|
|
929
|
+
};
|
|
930
|
+
i(j), (g = t == null ? void 0 : t.onError) == null || g.call(t, j);
|
|
931
|
+
}
|
|
932
|
+
}, w = async () => {
|
|
933
|
+
var c;
|
|
934
|
+
try {
|
|
935
|
+
o.exitFullscreen ? await o.exitFullscreen() : o.webkitExitFullscreen ? await o.webkitExitFullscreen() : o.mozCancelFullScreen ? await o.mozCancelFullScreen() : o.msExitFullscreen && await o.msExitFullscreen();
|
|
936
|
+
} catch (g) {
|
|
937
|
+
const y = {
|
|
938
|
+
name: "FullscreenError",
|
|
939
|
+
message: g instanceof Error ? g.message : "Failed to exit fullscreen"
|
|
940
|
+
};
|
|
941
|
+
i(y), (c = t == null ? void 0 : t.onError) == null || c.call(t, y);
|
|
942
|
+
}
|
|
943
|
+
}, u = N(() => {
|
|
944
|
+
var g;
|
|
945
|
+
const c = !!a();
|
|
946
|
+
n(c), (g = t == null ? void 0 : t.onFullScreenChange) == null || g.call(t, c);
|
|
947
|
+
}, [t]);
|
|
948
|
+
C(() => {
|
|
949
|
+
const c = [
|
|
950
|
+
"fullscreenchange",
|
|
951
|
+
"webkitfullscreenchange",
|
|
952
|
+
"mozfullscreenchange",
|
|
953
|
+
"MSFullscreenChange"
|
|
954
|
+
];
|
|
955
|
+
return c.forEach((g) => {
|
|
956
|
+
document.addEventListener(g, u);
|
|
957
|
+
}), () => {
|
|
958
|
+
c.forEach((g) => {
|
|
959
|
+
document.removeEventListener(g, u);
|
|
960
|
+
});
|
|
961
|
+
};
|
|
962
|
+
}, [u]);
|
|
963
|
+
const h = async (c) => {
|
|
964
|
+
i(null);
|
|
965
|
+
const g = c ?? document.documentElement;
|
|
966
|
+
await d(g);
|
|
967
|
+
};
|
|
968
|
+
return {
|
|
969
|
+
isFullScreen: s,
|
|
970
|
+
toggleFullScreen: async (c) => {
|
|
971
|
+
s ? await w() : await h(c);
|
|
972
|
+
},
|
|
973
|
+
enterFullScreen: h,
|
|
974
|
+
exitFullScreen: w,
|
|
975
|
+
error: r
|
|
976
|
+
};
|
|
977
|
+
};
|
|
978
|
+
function ct(t) {
|
|
979
|
+
var r;
|
|
980
|
+
if (!navigator.onLine)
|
|
981
|
+
return {
|
|
982
|
+
type: "network",
|
|
983
|
+
message: "No internet connection",
|
|
984
|
+
retryable: !0,
|
|
985
|
+
userMessage: "Please check your internet connection and try again."
|
|
986
|
+
};
|
|
987
|
+
if (t.name === "AbortError" || (r = t.message) != null && r.includes("timeout"))
|
|
988
|
+
return {
|
|
989
|
+
type: "timeout",
|
|
990
|
+
message: "Request timed out",
|
|
991
|
+
retryable: !0,
|
|
992
|
+
userMessage: "The request is taking longer than expected. Please try again."
|
|
993
|
+
};
|
|
994
|
+
if (t.status) {
|
|
995
|
+
const { status: i } = t;
|
|
996
|
+
if (i === 401 || i === 403)
|
|
997
|
+
return {
|
|
998
|
+
type: "auth",
|
|
999
|
+
status: i,
|
|
1000
|
+
message: "Authentication failed",
|
|
1001
|
+
retryable: !1,
|
|
1002
|
+
userMessage: "Your session has expired. Please refresh the page."
|
|
1003
|
+
};
|
|
1004
|
+
if (i === 429)
|
|
1005
|
+
return {
|
|
1006
|
+
type: "rate-limit",
|
|
1007
|
+
status: i,
|
|
1008
|
+
message: "Too many requests",
|
|
1009
|
+
retryable: !0,
|
|
1010
|
+
userMessage: "Please wait a moment before trying again."
|
|
1011
|
+
};
|
|
1012
|
+
if (i >= 500)
|
|
1013
|
+
return {
|
|
1014
|
+
type: "server",
|
|
1015
|
+
status: i,
|
|
1016
|
+
message: `Server error: ${i}`,
|
|
1017
|
+
retryable: !0,
|
|
1018
|
+
userMessage: "Our servers are experiencing issues. Please try again in a few moments."
|
|
1019
|
+
};
|
|
1020
|
+
if (i >= 400)
|
|
1021
|
+
return {
|
|
1022
|
+
type: "client",
|
|
1023
|
+
status: i,
|
|
1024
|
+
message: `Client error: ${i}`,
|
|
1025
|
+
retryable: !1,
|
|
1026
|
+
userMessage: "There was an issue with your request. Please check your input."
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
return {
|
|
1030
|
+
type: "unknown",
|
|
1031
|
+
message: t.message || "Unknown error occurred",
|
|
1032
|
+
retryable: !0,
|
|
1033
|
+
userMessage: "Something unexpected happened. Please try again.",
|
|
1034
|
+
originalError: t
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
async function he(t, r = {}, i = {
|
|
1038
|
+
attempts: 3,
|
|
1039
|
+
backoff: "exponential",
|
|
1040
|
+
baseDelay: 1e3,
|
|
1041
|
+
maxDelay: 1e4,
|
|
1042
|
+
jitter: !0
|
|
1043
|
+
}) {
|
|
1044
|
+
let s;
|
|
1045
|
+
for (let n = 1; n <= i.attempts; n++)
|
|
1046
|
+
try {
|
|
1047
|
+
const o = new AbortController(), l = setTimeout(() => o.abort(), 6e4), a = await fetch(t, {
|
|
1048
|
+
...r,
|
|
1049
|
+
signal: o.signal
|
|
1050
|
+
});
|
|
1051
|
+
if (clearTimeout(l), a.status >= 400 && a.status < 500 && a.status !== 429)
|
|
1052
|
+
return a;
|
|
1053
|
+
if (!a.ok)
|
|
1054
|
+
throw new Error(`HTTP ${a.status}: ${a.statusText}`);
|
|
1055
|
+
return a;
|
|
1056
|
+
} catch (o) {
|
|
1057
|
+
s = o;
|
|
1058
|
+
const l = ct(o);
|
|
1059
|
+
if (!l.retryable || n === i.attempts)
|
|
1060
|
+
throw l;
|
|
1061
|
+
const a = dt(n, i);
|
|
1062
|
+
console.warn(
|
|
1063
|
+
`API request failed (attempt ${n}/${i.attempts}), retrying in ${a}ms:`,
|
|
1064
|
+
l.message
|
|
1065
|
+
), await new Promise((d) => setTimeout(d, a));
|
|
1066
|
+
}
|
|
1067
|
+
throw s;
|
|
1068
|
+
}
|
|
1069
|
+
function dt(t, r) {
|
|
1070
|
+
let i;
|
|
1071
|
+
return r.backoff === "exponential" ? i = r.baseDelay * Math.pow(2, t - 1) : i = r.baseDelay, i = Math.min(i, r.maxDelay), r.jitter && (i = i * (0.5 + Math.random() * 0.5)), Math.round(i);
|
|
1072
|
+
}
|
|
1073
|
+
class wt {
|
|
1074
|
+
constructor(r = {}) {
|
|
1075
|
+
F(this, "config");
|
|
1076
|
+
this.config = r;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Update configuration
|
|
1080
|
+
*/
|
|
1081
|
+
updateConfig(r) {
|
|
1082
|
+
this.config = { ...this.config, ...r };
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Get default headers for API requests
|
|
1086
|
+
*/
|
|
1087
|
+
getHeaders() {
|
|
1088
|
+
var i;
|
|
1089
|
+
const r = {
|
|
1090
|
+
"Content-Type": "application/json",
|
|
1091
|
+
"X-Auth-Token": "appkey"
|
|
1092
|
+
};
|
|
1093
|
+
return (i = this.config) != null && i.authToken && (r.Authorization = `Bearer ${this.config.authToken}`), r;
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Get base URL from config with fallback
|
|
1097
|
+
*/
|
|
1098
|
+
getBaseUrl() {
|
|
1099
|
+
var r;
|
|
1100
|
+
return ((r = this.config) == null ? void 0 : r.baseUrl) || "/api";
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Get questions for an interview
|
|
1104
|
+
*/
|
|
1105
|
+
async generateQuestion({
|
|
1106
|
+
interviewId: r,
|
|
1107
|
+
isInterviewDone: i = !1,
|
|
1108
|
+
qnaId: s,
|
|
1109
|
+
question: n,
|
|
1110
|
+
answer: o,
|
|
1111
|
+
answerDuration: l
|
|
1112
|
+
}) {
|
|
1113
|
+
const a = await he(
|
|
1114
|
+
`${this.getBaseUrl()}/questions/next`,
|
|
1115
|
+
{
|
|
1116
|
+
method: "POST",
|
|
1117
|
+
headers: this.getHeaders(),
|
|
1118
|
+
body: JSON.stringify({
|
|
1119
|
+
interview_id: r,
|
|
1120
|
+
is_interview_done: i,
|
|
1121
|
+
qna_id: s,
|
|
1122
|
+
question: n,
|
|
1123
|
+
answer: o,
|
|
1124
|
+
// TODO: Hardcoded for now, will be dynamic later
|
|
1125
|
+
answer_duration: l ?? "00:00:30"
|
|
1126
|
+
})
|
|
1127
|
+
}
|
|
1128
|
+
);
|
|
1129
|
+
if (!a.ok)
|
|
1130
|
+
throw new Error(`Failed to get questions: ${a.status}`);
|
|
1131
|
+
return await a.json();
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
function ut() {
|
|
1135
|
+
const t = ae();
|
|
1136
|
+
return X(() => {
|
|
1137
|
+
const i = t.api || {};
|
|
1138
|
+
return new wt(i);
|
|
1139
|
+
}, [t.api]);
|
|
1140
|
+
}
|
|
1141
|
+
const ht = (t) => {
|
|
1142
|
+
C(() => {
|
|
1143
|
+
const r = (s) => {
|
|
1144
|
+
(s.ctrlKey || s.metaKey) && ["c", "v", "a", "t", "n", "w", "r", "s", "p"].includes(s.key.toLowerCase()) && (s.preventDefault(), t({
|
|
1145
|
+
type: "blocked_shortcut",
|
|
1146
|
+
severity: "low",
|
|
1147
|
+
details: {
|
|
1148
|
+
action: "shortcut_pressed",
|
|
1149
|
+
reason: `Attempted to use a blocked keyboard shortcut: Ctrl + ${s.key}`
|
|
1150
|
+
}
|
|
1151
|
+
})), s.key.startsWith("F") && s.key.length <= 3 && (s.preventDefault(), t({
|
|
1152
|
+
type: "blocked_function_key",
|
|
1153
|
+
severity: "low",
|
|
1154
|
+
details: {
|
|
1155
|
+
action: "function_key_pressed",
|
|
1156
|
+
reason: `Attempted to use a blocked function key: ${s.key}`
|
|
1157
|
+
}
|
|
1158
|
+
})), s.altKey && s.key === "Tab" && (s.preventDefault(), t({
|
|
1159
|
+
type: "alt_tab_attempt",
|
|
1160
|
+
severity: "medium",
|
|
1161
|
+
details: {
|
|
1162
|
+
action: "alt_tab",
|
|
1163
|
+
reason: "Attempted to use the Alt + Tab shortcut"
|
|
1164
|
+
}
|
|
1165
|
+
}));
|
|
1166
|
+
}, i = (s) => {
|
|
1167
|
+
s.preventDefault(), t({
|
|
1168
|
+
type: "right_click_attempt",
|
|
1169
|
+
severity: "low",
|
|
1170
|
+
details: {
|
|
1171
|
+
action: "right_click",
|
|
1172
|
+
reason: "Attempted to use the right click"
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
};
|
|
1176
|
+
return document.addEventListener("keydown", r), document.addEventListener("contextmenu", i), () => {
|
|
1177
|
+
document.removeEventListener("keydown", r), document.removeEventListener("contextmenu", i);
|
|
1178
|
+
};
|
|
1179
|
+
}, [t]);
|
|
1180
|
+
};
|
|
1181
|
+
class R extends Error {
|
|
1182
|
+
constructor(r, i, s = !1) {
|
|
1183
|
+
super(r), this.code = i, this.recoverable = s, this.name = "STTError";
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
class mt {
|
|
1187
|
+
constructor(r = {}) {
|
|
1188
|
+
F(this, "config");
|
|
1189
|
+
F(this, "mediaRecorder", null);
|
|
1190
|
+
F(this, "audioChunks", []);
|
|
1191
|
+
F(this, "recordingStream", null);
|
|
1192
|
+
F(this, "autoStopTimeoutId", null);
|
|
1193
|
+
this.config = {
|
|
1194
|
+
baseUrl: "http://localhost:8000",
|
|
1195
|
+
provider: "groq",
|
|
1196
|
+
model: "whisper-large-v3-turbo",
|
|
1197
|
+
language: "en",
|
|
1198
|
+
includeTimestamps: !1,
|
|
1199
|
+
temperature: 0,
|
|
1200
|
+
...r
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Update STT configuration
|
|
1205
|
+
*/
|
|
1206
|
+
updateConfig(r) {
|
|
1207
|
+
this.config = { ...this.config, ...r };
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Check if browser supports audio recording
|
|
1211
|
+
*/
|
|
1212
|
+
isRecordingSupported() {
|
|
1213
|
+
return !!(navigator.mediaDevices && typeof navigator.mediaDevices.getUserMedia == "function" && window.MediaRecorder);
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Start recording audio from user's microphone
|
|
1217
|
+
*/
|
|
1218
|
+
async startRecording(r, i) {
|
|
1219
|
+
var s;
|
|
1220
|
+
if (!this.isRecordingSupported())
|
|
1221
|
+
throw new R(
|
|
1222
|
+
"Audio recording is not supported in this browser",
|
|
1223
|
+
"RECORDING_NOT_SUPPORTED",
|
|
1224
|
+
!1
|
|
1225
|
+
);
|
|
1226
|
+
if (this.isRecording())
|
|
1227
|
+
throw new R(
|
|
1228
|
+
"Recording is already in progress",
|
|
1229
|
+
"ALREADY_RECORDING",
|
|
1230
|
+
!0
|
|
1231
|
+
);
|
|
1232
|
+
try {
|
|
1233
|
+
this.recordingStream = await navigator.mediaDevices.getUserMedia({
|
|
1234
|
+
audio: {
|
|
1235
|
+
echoCancellation: !0,
|
|
1236
|
+
noiseSuppression: !0,
|
|
1237
|
+
sampleRate: 44100
|
|
1238
|
+
}
|
|
1239
|
+
}), this.audioChunks = [];
|
|
1240
|
+
const n = this.getSupportedMimeType();
|
|
1241
|
+
this.mediaRecorder = new MediaRecorder(this.recordingStream, {
|
|
1242
|
+
mimeType: n
|
|
1243
|
+
}), this.mediaRecorder.ondataavailable = (o) => {
|
|
1244
|
+
var l;
|
|
1245
|
+
o.data.size > 0 && (this.audioChunks.push(o.data), (l = i == null ? void 0 : i.onDataAvailable) == null || l.call(i, o.data));
|
|
1246
|
+
}, this.mediaRecorder.onstop = () => {
|
|
1247
|
+
var o;
|
|
1248
|
+
(o = i == null ? void 0 : i.onStop) == null || o.call(i);
|
|
1249
|
+
}, this.mediaRecorder.onerror = (o) => {
|
|
1250
|
+
var a;
|
|
1251
|
+
const l = new R(
|
|
1252
|
+
`Recording failed: ${o.error}`,
|
|
1253
|
+
"RECORDING_ERROR",
|
|
1254
|
+
!0
|
|
1255
|
+
);
|
|
1256
|
+
(a = i == null ? void 0 : i.onError) == null || a.call(i, l), this.cleanup();
|
|
1257
|
+
}, this.mediaRecorder.start(100), (s = i == null ? void 0 : i.onStart) == null || s.call(i), r && r > 0 && (this.autoStopTimeoutId = setTimeout(() => {
|
|
1258
|
+
this.isRecording() && this.stopRecording();
|
|
1259
|
+
}, r * 1e3));
|
|
1260
|
+
} catch (n) {
|
|
1261
|
+
if (this.cleanup(), n instanceof Error) {
|
|
1262
|
+
if (n.name === "NotAllowedError" || n.name === "PermissionDeniedError")
|
|
1263
|
+
throw new R(
|
|
1264
|
+
"Microphone permission was denied",
|
|
1265
|
+
"PERMISSION_DENIED",
|
|
1266
|
+
!1
|
|
1267
|
+
);
|
|
1268
|
+
if (n.name === "NotFoundError")
|
|
1269
|
+
throw new R("No microphone found", "NO_MICROPHONE", !1);
|
|
1270
|
+
}
|
|
1271
|
+
throw new R(
|
|
1272
|
+
`Failed to start recording: ${n instanceof Error ? n.message : String(n)}`,
|
|
1273
|
+
"START_RECORDING_FAILED",
|
|
1274
|
+
!0
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Stop recording and return the audio blob
|
|
1280
|
+
*/
|
|
1281
|
+
async stopRecording() {
|
|
1282
|
+
if (this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null), !this.mediaRecorder || !this.isRecording())
|
|
1283
|
+
throw new R(
|
|
1284
|
+
"No active recording to stop",
|
|
1285
|
+
"NO_ACTIVE_RECORDING",
|
|
1286
|
+
!1
|
|
1287
|
+
);
|
|
1288
|
+
return new Promise((r, i) => {
|
|
1289
|
+
if (!this.mediaRecorder) {
|
|
1290
|
+
i(
|
|
1291
|
+
new R("MediaRecorder is null", "MEDIARECORDER_NULL", !1)
|
|
1292
|
+
);
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
const s = this.mediaRecorder, n = () => {
|
|
1296
|
+
try {
|
|
1297
|
+
const o = s.mimeType || "audio/webm", l = new Blob(this.audioChunks, { type: o });
|
|
1298
|
+
this.cleanup(), r(l);
|
|
1299
|
+
} catch (o) {
|
|
1300
|
+
i(
|
|
1301
|
+
new R(
|
|
1302
|
+
`Failed to create audio blob: ${o instanceof Error ? o.message : String(o)}`,
|
|
1303
|
+
"BLOB_CREATION_FAILED",
|
|
1304
|
+
!1
|
|
1305
|
+
)
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
s.addEventListener("stop", n, { once: !0 }), s.stop();
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Transcribe audio blob using the STT API
|
|
1314
|
+
*/
|
|
1315
|
+
async transcribe(r) {
|
|
1316
|
+
const {
|
|
1317
|
+
audioBlob: i,
|
|
1318
|
+
model: s = this.config.model,
|
|
1319
|
+
language: n = this.config.language,
|
|
1320
|
+
includeTimestamps: o = this.config.includeTimestamps,
|
|
1321
|
+
temperature: l = this.config.temperature
|
|
1322
|
+
} = r;
|
|
1323
|
+
if (!i || i.size === 0)
|
|
1324
|
+
throw new R(
|
|
1325
|
+
"Audio blob is empty or invalid",
|
|
1326
|
+
"INVALID_AUDIO",
|
|
1327
|
+
!1
|
|
1328
|
+
);
|
|
1329
|
+
try {
|
|
1330
|
+
const a = new FormData(), d = new File([i], "recording.wav", {
|
|
1331
|
+
type: i.type || "audio/wav"
|
|
1332
|
+
});
|
|
1333
|
+
a.append("file", d), a.append("model", s || "whisper-large-v3-turbo"), a.append("language", n || "en"), a.append("include_timestamps", String(o || !1)), a.append("temperature", String(l || 0));
|
|
1334
|
+
const w = await he(
|
|
1335
|
+
`${this.config.baseUrl}/speech/transcribe`,
|
|
1336
|
+
{
|
|
1337
|
+
method: "POST",
|
|
1338
|
+
headers: {
|
|
1339
|
+
accept: "application/json",
|
|
1340
|
+
"X-STT-Provider": this.config.provider || "groq",
|
|
1341
|
+
...this.config.authToken && {
|
|
1342
|
+
Authorization: `Bearer ${this.config.authToken}`
|
|
1343
|
+
}
|
|
1344
|
+
},
|
|
1345
|
+
body: a
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
attempts: 1,
|
|
1349
|
+
backoff: "exponential",
|
|
1350
|
+
baseDelay: 1e3,
|
|
1351
|
+
maxDelay: 3e3,
|
|
1352
|
+
jitter: !0
|
|
1353
|
+
}
|
|
1354
|
+
);
|
|
1355
|
+
if (!w.ok) {
|
|
1356
|
+
const h = await w.text();
|
|
1357
|
+
let m = `STT request failed: ${w.status} ${w.statusText}`;
|
|
1358
|
+
try {
|
|
1359
|
+
const c = JSON.parse(h);
|
|
1360
|
+
m = c.message || c.error || m;
|
|
1361
|
+
} catch {
|
|
1362
|
+
m = h || m;
|
|
1363
|
+
}
|
|
1364
|
+
throw new R(
|
|
1365
|
+
m,
|
|
1366
|
+
`HTTP_${w.status}`,
|
|
1367
|
+
w.status >= 500
|
|
1368
|
+
);
|
|
1369
|
+
}
|
|
1370
|
+
return {
|
|
1371
|
+
transcript: (await w.json()).data.text ?? ""
|
|
1372
|
+
};
|
|
1373
|
+
} catch (a) {
|
|
1374
|
+
throw a instanceof R ? a : new R(
|
|
1375
|
+
`Transcription failed: ${a instanceof Error ? a.message : String(a)}`,
|
|
1376
|
+
"TRANSCRIPTION_FAILED",
|
|
1377
|
+
!0
|
|
1378
|
+
);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Cancel current recording without processing
|
|
1383
|
+
*/
|
|
1384
|
+
cancelRecording() {
|
|
1385
|
+
this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null), this.mediaRecorder && this.isRecording() && this.mediaRecorder.stop(), this.cleanup();
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Check if currently recording
|
|
1389
|
+
*/
|
|
1390
|
+
isRecording() {
|
|
1391
|
+
return this.mediaRecorder !== null && this.mediaRecorder.state === "recording";
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Get supported MIME type for recording
|
|
1395
|
+
*/
|
|
1396
|
+
getSupportedMimeType() {
|
|
1397
|
+
const r = [
|
|
1398
|
+
"audio/webm",
|
|
1399
|
+
"audio/webm;codecs=opus",
|
|
1400
|
+
"audio/ogg;codecs=opus",
|
|
1401
|
+
"audio/mp4",
|
|
1402
|
+
"audio/wav"
|
|
1403
|
+
];
|
|
1404
|
+
for (const i of r)
|
|
1405
|
+
if (MediaRecorder.isTypeSupported(i))
|
|
1406
|
+
return i;
|
|
1407
|
+
return "audio/webm";
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Clean up recording resources
|
|
1411
|
+
*/
|
|
1412
|
+
cleanup() {
|
|
1413
|
+
this.recordingStream && (this.recordingStream.getTracks().forEach((r) => r.stop()), this.recordingStream = null), this.mediaRecorder = null, this.audioChunks = [], this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
const K = new mt(), xt = (t = {}) => {
|
|
1417
|
+
const [r, i] = k(!1), [s, n] = k(!1), [o, l] = k(null), [a, d] = k(null), [w, u] = k(null);
|
|
1418
|
+
t.config && K.updateConfig(t.config);
|
|
1419
|
+
const h = N(async (y) => {
|
|
1420
|
+
var j;
|
|
1421
|
+
try {
|
|
1422
|
+
d(null), l(null), u(null), await K.startRecording(y, {
|
|
1423
|
+
onStart: () => {
|
|
1424
|
+
var f;
|
|
1425
|
+
i(!0), (f = t.onStart) == null || f.call(t);
|
|
1426
|
+
},
|
|
1427
|
+
onStop: () => {
|
|
1428
|
+
var f;
|
|
1429
|
+
i(!1), (f = t.onStop) == null || f.call(t);
|
|
1430
|
+
},
|
|
1431
|
+
onError: (f) => {
|
|
1432
|
+
var S;
|
|
1433
|
+
const T = f instanceof R ? f : new R(f.message, "RECORDING_ERROR", !0);
|
|
1434
|
+
d(T), i(!1), (S = t.onError) == null || S.call(t, T);
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
} catch (f) {
|
|
1438
|
+
const T = f instanceof R ? f : new R(
|
|
1439
|
+
f instanceof Error ? f.message : String(f),
|
|
1440
|
+
"START_FAILED",
|
|
1441
|
+
!1
|
|
1442
|
+
);
|
|
1443
|
+
throw d(T), i(!1), (j = t.onError) == null || j.call(t, T), T;
|
|
1444
|
+
}
|
|
1445
|
+
}, []), m = N(async () => {
|
|
1446
|
+
var y, j;
|
|
1447
|
+
try {
|
|
1448
|
+
const f = await K.stopRecording();
|
|
1449
|
+
return u(f), i(!1), (y = t.onStop) == null || y.call(t), f;
|
|
1450
|
+
} catch (f) {
|
|
1451
|
+
const T = f instanceof R ? f : new R(
|
|
1452
|
+
f instanceof Error ? f.message : String(f),
|
|
1453
|
+
"STOP_FAILED",
|
|
1454
|
+
!1
|
|
1455
|
+
);
|
|
1456
|
+
throw d(T), i(!1), (j = t.onError) == null || j.call(t, T), T;
|
|
1457
|
+
}
|
|
1458
|
+
}, []), c = N(
|
|
1459
|
+
async (y, j = {}) => {
|
|
1460
|
+
var f, T;
|
|
1461
|
+
try {
|
|
1462
|
+
d(null), n(!0);
|
|
1463
|
+
const S = {
|
|
1464
|
+
audioBlob: y,
|
|
1465
|
+
...j
|
|
1466
|
+
}, v = await K.transcribe(S);
|
|
1467
|
+
return l(v.transcript), n(!1), (f = t.onTranscriptionComplete) == null || f.call(t, v), v;
|
|
1468
|
+
} catch (S) {
|
|
1469
|
+
const v = S instanceof R ? S : new R(
|
|
1470
|
+
S instanceof Error ? S.message : String(S),
|
|
1471
|
+
"TRANSCRIPTION_FAILED",
|
|
1472
|
+
!0
|
|
1473
|
+
);
|
|
1474
|
+
throw d(v), n(!1), (T = t.onError) == null || T.call(t, v), v;
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
[]
|
|
1478
|
+
), g = N(() => {
|
|
1479
|
+
K.cancelRecording(), i(!1), u(null);
|
|
1480
|
+
}, []);
|
|
1481
|
+
return {
|
|
1482
|
+
startRecording: h,
|
|
1483
|
+
stopRecording: m,
|
|
1484
|
+
transcribe: c,
|
|
1485
|
+
cancelRecording: g,
|
|
1486
|
+
isRecording: r,
|
|
1487
|
+
isTranscribing: s,
|
|
1488
|
+
transcript: o,
|
|
1489
|
+
error: a,
|
|
1490
|
+
audioBlob: w
|
|
1491
|
+
};
|
|
1492
|
+
}, gt = (t) => {
|
|
1493
|
+
const r = E(null), i = E(!1);
|
|
1494
|
+
C(() => {
|
|
1495
|
+
const s = () => {
|
|
1496
|
+
document.hidden && (i.current = !0, r.current && (clearTimeout(r.current), r.current = null), t({
|
|
1497
|
+
type: "tab_switch",
|
|
1498
|
+
severity: "high",
|
|
1499
|
+
details: {
|
|
1500
|
+
action: "tab_hidden",
|
|
1501
|
+
reason: "Attempted to switch tabs or applications"
|
|
1502
|
+
}
|
|
1503
|
+
}), setTimeout(() => {
|
|
1504
|
+
i.current = !1;
|
|
1505
|
+
}, 100));
|
|
1506
|
+
}, n = () => {
|
|
1507
|
+
i.current || (r.current = setTimeout(() => {
|
|
1508
|
+
i.current || t({
|
|
1509
|
+
type: "focus_loss",
|
|
1510
|
+
severity: "medium",
|
|
1511
|
+
details: {
|
|
1512
|
+
action: "window_blur",
|
|
1513
|
+
reason: "Focus lost from the interview window"
|
|
1514
|
+
}
|
|
1515
|
+
}), r.current = null;
|
|
1516
|
+
}, 50));
|
|
1517
|
+
};
|
|
1518
|
+
return document.addEventListener("visibilitychange", s), window.addEventListener("blur", n), () => {
|
|
1519
|
+
document.removeEventListener("visibilitychange", s), window.removeEventListener("blur", n), r.current && clearTimeout(r.current);
|
|
1520
|
+
};
|
|
1521
|
+
}, [t]);
|
|
1522
|
+
}, ft = () => {
|
|
1523
|
+
C(() => {
|
|
1524
|
+
const t = document.createElement("style");
|
|
1525
|
+
return t.textContent = `
|
|
1526
|
+
* {
|
|
1527
|
+
-webkit-user-select: none !important;
|
|
1528
|
+
-moz-user-select: none !important;
|
|
1529
|
+
-ms-user-select: none !important;
|
|
1530
|
+
user-select: none !important;
|
|
1531
|
+
}
|
|
1532
|
+
input, textarea {
|
|
1533
|
+
-webkit-user-select: text !important;
|
|
1534
|
+
-moz-user-select: text !important;
|
|
1535
|
+
-ms-user-select: text !important;
|
|
1536
|
+
user-select: text !important;
|
|
1537
|
+
}
|
|
1538
|
+
`, document.head.appendChild(t), () => {
|
|
1539
|
+
document.head.removeChild(t);
|
|
1540
|
+
};
|
|
1541
|
+
}, []);
|
|
1542
|
+
};
|
|
1543
|
+
class pt {
|
|
1544
|
+
constructor(r = {}) {
|
|
1545
|
+
F(this, "config");
|
|
1546
|
+
F(this, "currentAudio", null);
|
|
1547
|
+
this.config = {
|
|
1548
|
+
baseUrl: "http://localhost:8000",
|
|
1549
|
+
provider: "piper",
|
|
1550
|
+
voice: "string",
|
|
1551
|
+
speed: 1,
|
|
1552
|
+
...r
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Update TTS configuration
|
|
1557
|
+
*/
|
|
1558
|
+
updateConfig(r) {
|
|
1559
|
+
this.config = { ...this.config, ...r };
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* Get TTS audio from the API and return as blob
|
|
1563
|
+
*/
|
|
1564
|
+
async synthesizeSpeech(r) {
|
|
1565
|
+
const {
|
|
1566
|
+
text: i,
|
|
1567
|
+
voice: s = this.config.voice,
|
|
1568
|
+
speed: n = this.config.speed
|
|
1569
|
+
} = r, o = new URLSearchParams();
|
|
1570
|
+
o.append("text", i), o.append("voice", s || "string"), o.append("speed", (n == null ? void 0 : n.toString()) || "1");
|
|
1571
|
+
const l = await he(
|
|
1572
|
+
`${this.config.baseUrl}/speech/synthesize`,
|
|
1573
|
+
{
|
|
1574
|
+
method: "POST",
|
|
1575
|
+
headers: {
|
|
1576
|
+
accept: "application/json",
|
|
1577
|
+
"X-TTS-Provider": this.config.provider || "piper",
|
|
1578
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
1579
|
+
...this.config.authToken && {
|
|
1580
|
+
Authorization: `Bearer ${this.config.authToken}`
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
body: o
|
|
1584
|
+
},
|
|
1585
|
+
{
|
|
1586
|
+
attempts: 1,
|
|
1587
|
+
backoff: "fixed",
|
|
1588
|
+
baseDelay: 1e3,
|
|
1589
|
+
maxDelay: 1e3,
|
|
1590
|
+
jitter: !1
|
|
1591
|
+
}
|
|
1592
|
+
);
|
|
1593
|
+
if (!l.ok)
|
|
1594
|
+
throw new Error(
|
|
1595
|
+
`TTS request failed: ${l.status} ${l.statusText}`
|
|
1596
|
+
);
|
|
1597
|
+
const a = l.headers.get("content-type");
|
|
1598
|
+
if (a && a.includes("audio/"))
|
|
1599
|
+
return l.blob();
|
|
1600
|
+
try {
|
|
1601
|
+
const d = await l.json();
|
|
1602
|
+
throw new Error(`TTS Error: ${JSON.stringify(d)}`);
|
|
1603
|
+
} catch {
|
|
1604
|
+
throw new Error("TTS request failed with unknown error");
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Speak text and return a promise that resolves when playback completes
|
|
1609
|
+
*/
|
|
1610
|
+
async speak(r, i) {
|
|
1611
|
+
var s, n;
|
|
1612
|
+
try {
|
|
1613
|
+
this.stop(), (s = i == null ? void 0 : i.onStart) == null || s.call(i);
|
|
1614
|
+
const o = await this.synthesizeSpeech(r), l = URL.createObjectURL(o);
|
|
1615
|
+
return this.currentAudio = new Audio(l), new Promise((a, d) => {
|
|
1616
|
+
if (!this.currentAudio) {
|
|
1617
|
+
d(new Error("Audio element not created"));
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
const w = this.currentAudio;
|
|
1621
|
+
w.onended = () => {
|
|
1622
|
+
var u;
|
|
1623
|
+
URL.revokeObjectURL(l), this.currentAudio = null, (u = i == null ? void 0 : i.onEnd) == null || u.call(i), a();
|
|
1624
|
+
}, w.onerror = (u) => {
|
|
1625
|
+
var m;
|
|
1626
|
+
URL.revokeObjectURL(l), this.currentAudio = null;
|
|
1627
|
+
const h = new Error(`Audio playback failed: ${u}`);
|
|
1628
|
+
(m = i == null ? void 0 : i.onError) == null || m.call(i, h), d(h);
|
|
1629
|
+
}, w.play().catch((u) => {
|
|
1630
|
+
var m;
|
|
1631
|
+
URL.revokeObjectURL(l), this.currentAudio = null;
|
|
1632
|
+
const h = new Error(`Failed to play audio: ${u.message}`);
|
|
1633
|
+
(m = i == null ? void 0 : i.onError) == null || m.call(i, h), d(h);
|
|
1634
|
+
});
|
|
1635
|
+
});
|
|
1636
|
+
} catch (o) {
|
|
1637
|
+
const l = o instanceof Error ? o : new Error(`TTS Error: ${String(o)}`);
|
|
1638
|
+
throw (n = i == null ? void 0 : i.onError) == null || n.call(i, l), l;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Stop current audio playback
|
|
1643
|
+
*/
|
|
1644
|
+
stop() {
|
|
1645
|
+
this.currentAudio && (this.currentAudio.pause(), this.currentAudio.currentTime = 0, this.currentAudio = null);
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Check if audio is currently playing
|
|
1649
|
+
*/
|
|
1650
|
+
isPlaying() {
|
|
1651
|
+
return this.currentAudio !== null && !this.currentAudio.paused;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
const we = new pt(), bt = (t = {}) => {
|
|
1655
|
+
const [r, i] = k(!1), [s, n] = k(!1), [o, l] = k(null);
|
|
1656
|
+
t.config && we.updateConfig(t.config);
|
|
1657
|
+
const a = N(
|
|
1658
|
+
async (w, u = {}) => {
|
|
1659
|
+
var h;
|
|
1660
|
+
try {
|
|
1661
|
+
l(null), n(!0);
|
|
1662
|
+
const m = {
|
|
1663
|
+
text: w,
|
|
1664
|
+
...u
|
|
1665
|
+
};
|
|
1666
|
+
await we.speak(m, {
|
|
1667
|
+
onStart: () => {
|
|
1668
|
+
var c;
|
|
1669
|
+
n(!1), i(!0), (c = t.onStart) == null || c.call(t);
|
|
1670
|
+
},
|
|
1671
|
+
onEnd: () => {
|
|
1672
|
+
var c;
|
|
1673
|
+
i(!1), (c = t.onEnd) == null || c.call(t);
|
|
1674
|
+
},
|
|
1675
|
+
onError: (c) => {
|
|
1676
|
+
var g;
|
|
1677
|
+
i(!1), n(!1), l(c), (g = t.onError) == null || g.call(t, c);
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
} catch (m) {
|
|
1681
|
+
const c = m instanceof Error ? m : new Error(String(m));
|
|
1682
|
+
throw l(c), i(!1), n(!1), (h = t.onError) == null || h.call(t, c), c;
|
|
1683
|
+
}
|
|
1684
|
+
},
|
|
1685
|
+
[t]
|
|
1686
|
+
), d = N(() => {
|
|
1687
|
+
we.stop(), i(!1), n(!1);
|
|
1688
|
+
}, []);
|
|
1689
|
+
return {
|
|
1690
|
+
speak: a,
|
|
1691
|
+
stop: d,
|
|
1692
|
+
isPlaying: r,
|
|
1693
|
+
isLoading: s,
|
|
1694
|
+
error: o
|
|
1695
|
+
};
|
|
1696
|
+
}, vt = ({
|
|
1697
|
+
onViolation: t,
|
|
1698
|
+
onEnd: r,
|
|
1699
|
+
maxViolations: i = 5
|
|
1700
|
+
}) => {
|
|
1701
|
+
const { addViolation: s } = We(), n = Ue(), o = ze(), l = E(o);
|
|
1702
|
+
C(() => {
|
|
1703
|
+
l.current = o;
|
|
1704
|
+
}, [o]);
|
|
1705
|
+
const a = N(
|
|
1706
|
+
(w) => {
|
|
1707
|
+
r && r(w, l.current);
|
|
1708
|
+
},
|
|
1709
|
+
[r]
|
|
1710
|
+
);
|
|
1711
|
+
return {
|
|
1712
|
+
logViolation: N(
|
|
1713
|
+
({ type: w, severity: u, details: h }) => {
|
|
1714
|
+
const m = {
|
|
1715
|
+
id: Xe(),
|
|
1716
|
+
type: w,
|
|
1717
|
+
severity: u,
|
|
1718
|
+
details: h,
|
|
1719
|
+
timestamp: Date.now()
|
|
1720
|
+
};
|
|
1721
|
+
s(m);
|
|
1722
|
+
const c = l.current + 1;
|
|
1723
|
+
t && t(m, c), c >= i && a("excessive_violations");
|
|
1724
|
+
},
|
|
1725
|
+
[s, t, i, a]
|
|
1726
|
+
),
|
|
1727
|
+
onInterviewEnd: a,
|
|
1728
|
+
violationCount: o,
|
|
1729
|
+
logList: n
|
|
1730
|
+
};
|
|
1731
|
+
}, me = (t) => /* @__PURE__ */ e.jsxs(
|
|
1732
|
+
"svg",
|
|
1733
|
+
{
|
|
1734
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1735
|
+
width: "24",
|
|
1736
|
+
height: "24",
|
|
1737
|
+
viewBox: "0 0 24 24",
|
|
1738
|
+
fill: "none",
|
|
1739
|
+
stroke: "currentColor",
|
|
1740
|
+
strokeWidth: "2",
|
|
1741
|
+
strokeLinecap: "round",
|
|
1742
|
+
strokeLinejoin: "round",
|
|
1743
|
+
...t,
|
|
1744
|
+
children: [
|
|
1745
|
+
/* @__PURE__ */ e.jsx("path", { d: "M12 2a10 10 0 0 1 7.38 16.75" }),
|
|
1746
|
+
/* @__PURE__ */ e.jsx("path", { d: "M12 6v6l4 2" }),
|
|
1747
|
+
/* @__PURE__ */ e.jsx("path", { d: "M2.5 8.875a10 10 0 0 0-.5 3" }),
|
|
1748
|
+
/* @__PURE__ */ e.jsx("path", { d: "M2.83 16a10 10 0 0 0 2.43 3.4" }),
|
|
1749
|
+
/* @__PURE__ */ e.jsx("path", { d: "M4.636 5.235a10 10 0 0 1 .891-.857" }),
|
|
1750
|
+
/* @__PURE__ */ e.jsx("path", { d: "M8.644 21.42a10 10 0 0 0 7.631-.38" })
|
|
1751
|
+
]
|
|
1752
|
+
}
|
|
1753
|
+
), yt = (t, r, i) => Math.max(r, Math.min(i, t)), be = (t) => {
|
|
1754
|
+
const r = Math.max(0, Math.floor(t)), i = Math.floor(r / 60).toString().padStart(2, "0"), s = (r % 60).toString().padStart(2, "0");
|
|
1755
|
+
return `${i}:${s}`;
|
|
1756
|
+
}, xe = ({
|
|
1757
|
+
total: t,
|
|
1758
|
+
remaining: r,
|
|
1759
|
+
size: i = 64,
|
|
1760
|
+
strokeWidth: s = 6,
|
|
1761
|
+
className: n = "",
|
|
1762
|
+
showLabel: o = !0
|
|
1763
|
+
}) => {
|
|
1764
|
+
const l = Math.max(1, t || 1), a = yt(r / l, 0, 1), { radius: d, circumference: w, dashOffset: u, center: h } = X(() => {
|
|
1765
|
+
const g = (i - s) / 2, y = 2 * Math.PI * g, j = y * (1 - a), f = Math.round(s) % 2 === 1, T = i / 2 + (f ? 0.5 : 0);
|
|
1766
|
+
return { radius: g, circumference: y, dashOffset: j, center: T };
|
|
1767
|
+
}, [i, s, a]), m = X(() => a <= 0.25 ? "iw-stroke-red-500" : a <= 0.5 ? "iw-stroke-yellow-500" : "iw-stroke-green-500", [a]), c = a <= 0.25 ? "iw-animate-pulse" : "";
|
|
1768
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1769
|
+
"div",
|
|
1770
|
+
{
|
|
1771
|
+
className: `iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${n}`,
|
|
1772
|
+
style: { width: i, height: i },
|
|
1773
|
+
"aria-label": `Time remaining ${be(r)}`,
|
|
1774
|
+
role: "timer",
|
|
1775
|
+
"aria-live": "polite",
|
|
1776
|
+
children: [
|
|
1777
|
+
/* @__PURE__ */ e.jsx(
|
|
1778
|
+
"svg",
|
|
1779
|
+
{
|
|
1780
|
+
width: i,
|
|
1781
|
+
height: i,
|
|
1782
|
+
viewBox: `0 0 ${i} ${i}`,
|
|
1783
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
1784
|
+
children: /* @__PURE__ */ e.jsxs("g", { transform: `rotate(-90 ${h} ${h})`, children: [
|
|
1785
|
+
/* @__PURE__ */ e.jsx(
|
|
1786
|
+
"circle",
|
|
1787
|
+
{
|
|
1788
|
+
cx: h,
|
|
1789
|
+
cy: h,
|
|
1790
|
+
r: d,
|
|
1791
|
+
className: "iw-stroke-gray-200",
|
|
1792
|
+
strokeWidth: s,
|
|
1793
|
+
fill: "none",
|
|
1794
|
+
shapeRendering: "geometricPrecision",
|
|
1795
|
+
vectorEffect: "non-scaling-stroke"
|
|
1796
|
+
}
|
|
1797
|
+
),
|
|
1798
|
+
/* @__PURE__ */ e.jsx(
|
|
1799
|
+
"circle",
|
|
1800
|
+
{
|
|
1801
|
+
cx: h,
|
|
1802
|
+
cy: h,
|
|
1803
|
+
r: d,
|
|
1804
|
+
className: `${m} ${c}`,
|
|
1805
|
+
strokeWidth: s,
|
|
1806
|
+
strokeLinecap: "round",
|
|
1807
|
+
fill: "none",
|
|
1808
|
+
strokeDasharray: w,
|
|
1809
|
+
strokeDashoffset: u,
|
|
1810
|
+
shapeRendering: "geometricPrecision",
|
|
1811
|
+
vectorEffect: "non-scaling-stroke",
|
|
1812
|
+
style: {
|
|
1813
|
+
transition: "stroke-dashoffset 0.3s ease, stroke 0.2s ease"
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
)
|
|
1817
|
+
] })
|
|
1818
|
+
}
|
|
1819
|
+
),
|
|
1820
|
+
o && /* @__PURE__ */ e.jsx("div", { className: "iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0", children: /* @__PURE__ */ e.jsx(
|
|
1821
|
+
"span",
|
|
1822
|
+
{
|
|
1823
|
+
className: `iw-text-[11px] iw-font-semibold iw-tabular-nums ${a <= 0.25 ? "iw-text-red-600" : a <= 0.5 ? "iw-text-yellow-600" : "iw-text-green-600"}`,
|
|
1824
|
+
children: be(r)
|
|
1825
|
+
}
|
|
1826
|
+
) })
|
|
1827
|
+
]
|
|
1828
|
+
}
|
|
1829
|
+
);
|
|
1830
|
+
}, jt = ({
|
|
1831
|
+
label: t,
|
|
1832
|
+
error: r,
|
|
1833
|
+
fullWidth: i = !1,
|
|
1834
|
+
className: s = "",
|
|
1835
|
+
id: n,
|
|
1836
|
+
...o
|
|
1837
|
+
}) => {
|
|
1838
|
+
const l = n || `textarea-${Math.random().toString(36).substring(2, 9)}`, a = "iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-transition-all", d = r ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", w = i ? "iw-w-full" : "", u = s.includes("iw-h-full") || i ? "iw-h-full" : "";
|
|
1839
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1840
|
+
"div",
|
|
1841
|
+
{
|
|
1842
|
+
className: `iw-h-full iw-flex iw-flex-col ${i ? "iw-w-full" : ""}`,
|
|
1843
|
+
children: [
|
|
1844
|
+
t && /* @__PURE__ */ e.jsx(
|
|
1845
|
+
"label",
|
|
1846
|
+
{
|
|
1847
|
+
htmlFor: l,
|
|
1848
|
+
className: "iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",
|
|
1849
|
+
children: t
|
|
1850
|
+
}
|
|
1851
|
+
),
|
|
1852
|
+
/* @__PURE__ */ e.jsx(
|
|
1853
|
+
"textarea",
|
|
1854
|
+
{
|
|
1855
|
+
id: l,
|
|
1856
|
+
className: `${a} ${d} ${w} ${u} ${s}`,
|
|
1857
|
+
"aria-invalid": r ? "true" : "false",
|
|
1858
|
+
...o
|
|
1859
|
+
}
|
|
1860
|
+
),
|
|
1861
|
+
r && /* @__PURE__ */ e.jsx("p", { className: "iw-mt-1 iw-text-sm iw-text-red-600", children: r })
|
|
1862
|
+
]
|
|
1863
|
+
}
|
|
1864
|
+
);
|
|
1865
|
+
}, Nt = ({
|
|
1866
|
+
value: t,
|
|
1867
|
+
onChange: r,
|
|
1868
|
+
onSubmit: i,
|
|
1869
|
+
isSubmitDisabled: s,
|
|
1870
|
+
state: n,
|
|
1871
|
+
editingTime: o
|
|
1872
|
+
}) => {
|
|
1873
|
+
const l = (a) => {
|
|
1874
|
+
a.key === "Enter" && (a.ctrlKey || a.metaKey) && !s && (a.preventDefault(), i());
|
|
1875
|
+
};
|
|
1876
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-h-full ", children: [
|
|
1877
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
|
|
1878
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Your Answer" }),
|
|
1879
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
1880
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
1881
|
+
/* @__PURE__ */ e.jsx(me, { className: "iw-size-4 iw-text-orange-600" }),
|
|
1882
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to edit: " })
|
|
1883
|
+
] }),
|
|
1884
|
+
/* @__PURE__ */ e.jsx(
|
|
1885
|
+
xe,
|
|
1886
|
+
{
|
|
1887
|
+
total: o,
|
|
1888
|
+
remaining: n.currentPhaseTimeRemaining,
|
|
1889
|
+
size: 50,
|
|
1890
|
+
strokeWidth: 4
|
|
1891
|
+
}
|
|
1892
|
+
)
|
|
1893
|
+
] })
|
|
1894
|
+
] }),
|
|
1895
|
+
/* @__PURE__ */ e.jsxs("div", { className: " iw-overflow-hidden iw-flex iw-flex-col iw-h-full iw-mt-2", children: [
|
|
1896
|
+
/* @__PURE__ */ e.jsx(
|
|
1897
|
+
jt,
|
|
1898
|
+
{
|
|
1899
|
+
value: t,
|
|
1900
|
+
onChange: r,
|
|
1901
|
+
onKeyDown: l,
|
|
1902
|
+
placeholder: "Type your answer here...",
|
|
1903
|
+
className: " iw-w-full iw-h-full iw-flex-1 iw-resize-none !iw-p-4 iw-bg-transparent iw-min-h-full focus-visible:iw-outline-0",
|
|
1904
|
+
onPaste: (a) => a.preventDefault(),
|
|
1905
|
+
onCopy: (a) => a.preventDefault(),
|
|
1906
|
+
onCut: (a) => a.preventDefault(),
|
|
1907
|
+
onDrop: (a) => a.preventDefault(),
|
|
1908
|
+
onDragOver: (a) => a.preventDefault()
|
|
1909
|
+
}
|
|
1910
|
+
),
|
|
1911
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1 iw-mt-4", children: /* @__PURE__ */ e.jsx(W, { onClick: i, disabled: s, children: "Submit Answer" }) })
|
|
1912
|
+
] })
|
|
1913
|
+
] });
|
|
1914
|
+
}, kt = ({ className: t = "" }) => {
|
|
1915
|
+
var n;
|
|
1916
|
+
const { authToken: r } = Ce(), i = r ? Ze(r) : null, s = E(null);
|
|
1917
|
+
return C(() => {
|
|
1918
|
+
let o = null;
|
|
1919
|
+
return (async () => {
|
|
1920
|
+
try {
|
|
1921
|
+
o = await navigator.mediaDevices.getUserMedia({
|
|
1922
|
+
video: !0,
|
|
1923
|
+
audio: !1
|
|
1924
|
+
}), s.current && (s.current.srcObject = o);
|
|
1925
|
+
} catch (a) {
|
|
1926
|
+
console.error("Error accessing camera:", a);
|
|
1927
|
+
}
|
|
1928
|
+
})(), () => {
|
|
1929
|
+
o && o.getTracks().forEach((a) => a.stop());
|
|
1930
|
+
};
|
|
1931
|
+
}, []), /* @__PURE__ */ e.jsxs("div", { className: `iw-relative ${t}`, children: [
|
|
1932
|
+
/* @__PURE__ */ e.jsx(
|
|
1933
|
+
"video",
|
|
1934
|
+
{
|
|
1935
|
+
ref: s,
|
|
1936
|
+
autoPlay: !0,
|
|
1937
|
+
playsInline: !0,
|
|
1938
|
+
muted: !0,
|
|
1939
|
+
className: "iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-r-xl iw-min-h-[400px] iw-max-h-[600px] iw-aspect-video",
|
|
1940
|
+
style: {
|
|
1941
|
+
transform: "scaleX(-1)"
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
),
|
|
1945
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-absolute iw-top-4 iw-left-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md", children: [
|
|
1946
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-size-2 iw-animate-pulse iw-rounded-full iw-bg-red-500" }),
|
|
1947
|
+
/* @__PURE__ */ e.jsx("span", { className: "iw-font-medium iw-text-white", children: "Recording" })
|
|
1948
|
+
] }),
|
|
1949
|
+
((n = i == null ? void 0 : i.data) == null ? void 0 : n.user_name) && /* @__PURE__ */ e.jsx("div", { className: "iw-absolute iw-bottom-4 iw-right-4 iw-inline-flex iw-items-center iw-gap-2 iw-rounded-lg iw-border iw-border-white/10 iw-bg-black/40 iw-px-4 iw-py-2 iw-backdrop-blur-md", children: /* @__PURE__ */ e.jsx("span", { className: "iw-font-medium iw-text-white", children: i.data.user_name }) })
|
|
1950
|
+
] });
|
|
1951
|
+
}, Tt = ({
|
|
1952
|
+
question: t,
|
|
1953
|
+
isLoading: r = !1
|
|
1954
|
+
}) => {
|
|
1955
|
+
const { baseColor: i } = Z();
|
|
1956
|
+
return /* @__PURE__ */ e.jsx(
|
|
1957
|
+
"div",
|
|
1958
|
+
{
|
|
1959
|
+
className: "iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-p-6 ",
|
|
1960
|
+
style: Je(i, 0.85),
|
|
1961
|
+
children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-8", children: [
|
|
1962
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-flex-col iw-items-center iw-relative iw-h-32 iw-w-32 iw-shrink-0 iw-shadow iw-rounded-lg iw-bg-white", children: /* @__PURE__ */ e.jsx("div", { className: "iw-mt-2", children: /* @__PURE__ */ e.jsx(
|
|
1963
|
+
"img",
|
|
1964
|
+
{
|
|
1965
|
+
src: "https://duf9q5sx7u.ufs.sh/f/va7H6eSeKAux755zByRN5Nq9LZurgIoJGYX6c0CEdRSDm8y2",
|
|
1966
|
+
alt: "brand_logo",
|
|
1967
|
+
className: "iw-h-28 iw-w-28"
|
|
1968
|
+
}
|
|
1969
|
+
) }) }),
|
|
1970
|
+
r ? /* @__PURE__ */ e.jsxs("div", { className: "iw-animate-pulse iw-w-full iw-space-y-3 iw-mr-10", children: [
|
|
1971
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-h-5 iw-bg-gray-200 iw-rounded iw-w-full" }),
|
|
1972
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-h-5 iw-bg-gray-200 iw-rounded iw-w-3/4" })
|
|
1973
|
+
] }) : /* @__PURE__ */ e.jsx("p", { className: "iw-text-lg iw-leading-8", children: t == null ? void 0 : t.question })
|
|
1974
|
+
] })
|
|
1975
|
+
}
|
|
1976
|
+
);
|
|
1977
|
+
}, ve = ({
|
|
1978
|
+
currentQuestion: t,
|
|
1979
|
+
phase: r,
|
|
1980
|
+
className: i = "",
|
|
1981
|
+
children: s
|
|
1982
|
+
}) => /* @__PURE__ */ e.jsxs(
|
|
1983
|
+
"div",
|
|
1984
|
+
{
|
|
1985
|
+
className: `iw-p-4 iw-space-y-4 iw-pb-6 ${i} iw-min-h-[calc(100vh_-_3.8rem)] iw-flex iw-flex-col iw-justify-between`,
|
|
1986
|
+
children: [
|
|
1987
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-items-start iw-justify-between iw-gap-3", children: /* @__PURE__ */ e.jsx("div", { className: "iw-flex-1", children: /* @__PURE__ */ e.jsx(
|
|
1988
|
+
Tt,
|
|
1989
|
+
{
|
|
1990
|
+
question: t,
|
|
1991
|
+
isLoading: r === D.FETCHING_QUESTION || r === D.IDLE
|
|
1992
|
+
}
|
|
1993
|
+
) }) }),
|
|
1994
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-[14px] iw-p-6", children: [
|
|
1995
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-min-h-[400px] iw-max-h-[600px]", children: /* @__PURE__ */ e.jsx(kt, {}) }),
|
|
1996
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-bg-white iw-rounded-r-xl iw-shadow iw-p-6", children: s })
|
|
1997
|
+
] })
|
|
1998
|
+
]
|
|
1999
|
+
}
|
|
2000
|
+
), _e = ({
|
|
2001
|
+
isOpen: t,
|
|
2002
|
+
onClose: r,
|
|
2003
|
+
children: i,
|
|
2004
|
+
title: s,
|
|
2005
|
+
showCloseButton: n = !0,
|
|
2006
|
+
closeOnOverlayClick: o = !0,
|
|
2007
|
+
closeOnEscape: l = !0,
|
|
2008
|
+
className: a = ""
|
|
2009
|
+
}) => {
|
|
2010
|
+
if (C(() => {
|
|
2011
|
+
if (!t || !l) return;
|
|
2012
|
+
const u = (h) => {
|
|
2013
|
+
h.key === "Escape" && r();
|
|
2014
|
+
};
|
|
2015
|
+
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
2016
|
+
}, [t, l, r]), C(() => (t ? (document.body.style.overflow = "hidden", document.body.classList.add("interview-widget-container")) : (document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container")), () => {
|
|
2017
|
+
document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container");
|
|
2018
|
+
}), [t]), !t) return null;
|
|
2019
|
+
const d = (u) => {
|
|
2020
|
+
o && u.target === u.currentTarget && r();
|
|
2021
|
+
}, w = /* @__PURE__ */ e.jsxs("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center", children: [
|
|
2022
|
+
/* @__PURE__ */ e.jsx(
|
|
2023
|
+
"div",
|
|
2024
|
+
{
|
|
2025
|
+
className: "iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",
|
|
2026
|
+
onClick: d
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
/* @__PURE__ */ e.jsxs(
|
|
2030
|
+
"div",
|
|
2031
|
+
{
|
|
2032
|
+
className: `iw-relative iw-bg-white iw-rounded-lg iw-shadow-xl iw-max-w-md iw-w-full iw-mx-4 iw-max-h-[90vh] iw-overflow-hidden ${a}`,
|
|
2033
|
+
role: "dialog",
|
|
2034
|
+
"aria-modal": "true",
|
|
2035
|
+
"aria-labelledby": s ? "dialog-title" : void 0,
|
|
2036
|
+
children: [
|
|
2037
|
+
(s || n) && /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-p-4 iw-border-b iw-border-gray-200", children: [
|
|
2038
|
+
s && /* @__PURE__ */ e.jsx(
|
|
2039
|
+
"h2",
|
|
2040
|
+
{
|
|
2041
|
+
id: "dialog-title",
|
|
2042
|
+
className: "iw-text-lg iw-font-semibold iw-text-gray-900",
|
|
2043
|
+
children: s
|
|
2044
|
+
}
|
|
2045
|
+
),
|
|
2046
|
+
n && /* @__PURE__ */ e.jsx(
|
|
2047
|
+
"button",
|
|
2048
|
+
{
|
|
2049
|
+
onClick: r,
|
|
2050
|
+
className: "iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100",
|
|
2051
|
+
"aria-label": "Close dialog",
|
|
2052
|
+
children: /* @__PURE__ */ e.jsx(
|
|
2053
|
+
"svg",
|
|
2054
|
+
{
|
|
2055
|
+
className: "iw-w-5 iw-h-5",
|
|
2056
|
+
fill: "none",
|
|
2057
|
+
stroke: "currentColor",
|
|
2058
|
+
viewBox: "0 0 24 24",
|
|
2059
|
+
children: /* @__PURE__ */ e.jsx(
|
|
2060
|
+
"path",
|
|
2061
|
+
{
|
|
2062
|
+
strokeLinecap: "round",
|
|
2063
|
+
strokeLinejoin: "round",
|
|
2064
|
+
strokeWidth: 2,
|
|
2065
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
2066
|
+
}
|
|
2067
|
+
)
|
|
2068
|
+
}
|
|
2069
|
+
)
|
|
2070
|
+
}
|
|
2071
|
+
)
|
|
2072
|
+
] }),
|
|
2073
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-p-4 iw-overflow-y-auto", children: i })
|
|
2074
|
+
]
|
|
2075
|
+
}
|
|
2076
|
+
)
|
|
2077
|
+
] });
|
|
2078
|
+
return $e(w, document.body);
|
|
2079
|
+
}, Et = ({
|
|
2080
|
+
confirmExitInterview: t,
|
|
2081
|
+
isOpen: r,
|
|
2082
|
+
onClose: i
|
|
2083
|
+
}) => /* @__PURE__ */ e.jsx(
|
|
2084
|
+
_e,
|
|
2085
|
+
{
|
|
2086
|
+
isOpen: r,
|
|
2087
|
+
onClose: i,
|
|
2088
|
+
title: "Exit Interview",
|
|
2089
|
+
closeOnOverlayClick: !1,
|
|
2090
|
+
children: /* @__PURE__ */ e.jsxs("div", { className: "iw-space-y-5", children: [
|
|
2091
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-start iw-gap-3 iw-rounded-xl iw-p-2", children: [
|
|
2092
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-10 iw-w-10 iw-flex-none iw-items-center iw-justify-center iw-rounded-full iw-bg-rose-100 iw-text-rose-600", children: "!" }),
|
|
2093
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-space-y-2", children: [
|
|
2094
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-font-semibold iw-text-rose-600", children: "Leaving now will end your interview !" }),
|
|
2095
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-text-slate-500", children: "Are you sure you want to exit? All progress will be lost and you will not be able to resume." })
|
|
2096
|
+
] })
|
|
2097
|
+
] }),
|
|
2098
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col-reverse iw-gap-2 sm:iw-flex-row sm:iw-items-center sm:iw-justify-end iw-pb-1", children: [
|
|
2099
|
+
/* @__PURE__ */ e.jsx(
|
|
2100
|
+
"button",
|
|
2101
|
+
{
|
|
2102
|
+
className: "iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-border iw-border-slate-200 iw-bg-white iw-px-4 iw-py-2 iw-text-sm iw-font-medium iw-text-slate-600 iw-shadow-sm iw-transition hover:iw-bg-slate-50",
|
|
2103
|
+
onClick: i,
|
|
2104
|
+
children: "Stay in interview"
|
|
2105
|
+
}
|
|
2106
|
+
),
|
|
2107
|
+
/* @__PURE__ */ e.jsx(
|
|
2108
|
+
"button",
|
|
2109
|
+
{
|
|
2110
|
+
className: "iw-inline-flex iw-items-center iw-justify-center iw-rounded-lg iw-bg-gradient-to-r iw-from-red-500/80 iw-to-red-600/80 iw-px-4 iw-py-2 iw-text-sm iw-font-semibold iw-text-white iw-shadow-[0_12px_30px_-16px_rgba(244,63,94,0.65)] iw-transition hover:iw-brightness-110",
|
|
2111
|
+
onClick: t,
|
|
2112
|
+
children: "Confirm exit"
|
|
2113
|
+
}
|
|
2114
|
+
)
|
|
2115
|
+
] })
|
|
2116
|
+
] })
|
|
2117
|
+
}
|
|
2118
|
+
), ye = ({ title: t, onExit: r }) => {
|
|
2119
|
+
const { baseColor: i } = Z(), [s, n] = k(!1);
|
|
2120
|
+
return /* @__PURE__ */ e.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
|
|
2121
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-pb-4 iw-pt-2", children: [
|
|
2122
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
|
|
2123
|
+
/* @__PURE__ */ e.jsx(
|
|
2124
|
+
"div",
|
|
2125
|
+
{
|
|
2126
|
+
className: "iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",
|
|
2127
|
+
style: { backgroundColor: i },
|
|
2128
|
+
children: "N"
|
|
2129
|
+
}
|
|
2130
|
+
),
|
|
2131
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-font-medium", children: "Novara" })
|
|
2132
|
+
] }),
|
|
2133
|
+
/* @__PURE__ */ e.jsx("h1", { className: "iw-text-base iw-font-bold", children: t }),
|
|
2134
|
+
/* @__PURE__ */ e.jsx(
|
|
2135
|
+
"button",
|
|
2136
|
+
{
|
|
2137
|
+
className: "iw-text-sm iw-text-white iw-bg-gradient-to-r iw-from-red-500/80 iw-to-red-600/80 iw-px-4 iw-py-2 iw-rounded-md",
|
|
2138
|
+
onClick: () => n(!0),
|
|
2139
|
+
children: "Exit Interview"
|
|
2140
|
+
}
|
|
2141
|
+
)
|
|
2142
|
+
] }),
|
|
2143
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-h-px iw-bg-gray-200" }),
|
|
2144
|
+
/* @__PURE__ */ e.jsx(
|
|
2145
|
+
Et,
|
|
2146
|
+
{
|
|
2147
|
+
isOpen: s,
|
|
2148
|
+
confirmExitInterview: () => {
|
|
2149
|
+
r(), n(!1);
|
|
2150
|
+
},
|
|
2151
|
+
onClose: () => n(!1)
|
|
2152
|
+
}
|
|
2153
|
+
)
|
|
2154
|
+
] });
|
|
2155
|
+
}, St = ({
|
|
2156
|
+
className: t = "",
|
|
2157
|
+
width: r,
|
|
2158
|
+
height: i = 56,
|
|
2159
|
+
barWidth: s = 3,
|
|
2160
|
+
gap: n = 2,
|
|
2161
|
+
fftSize: o = 1024,
|
|
2162
|
+
smoothingTimeConstant: l = 0.8,
|
|
2163
|
+
mediaStream: a,
|
|
2164
|
+
startOnMount: d = !0
|
|
2165
|
+
}) => {
|
|
2166
|
+
const { baseColor: w } = Z(), u = E(null), h = E(null), m = E(null), c = E(null), g = E(null), y = E(null), j = E(!1), [f, T] = k(null);
|
|
2167
|
+
C(() => {
|
|
2168
|
+
if (r || !h.current) return;
|
|
2169
|
+
const v = h.current, _ = () => {
|
|
2170
|
+
const P = u.current;
|
|
2171
|
+
if (!P) return;
|
|
2172
|
+
const M = v.clientWidth, x = i;
|
|
2173
|
+
P.width = Math.max(1, Math.floor(M * window.devicePixelRatio || 1)), P.height = Math.max(1, Math.floor(x * window.devicePixelRatio || 1));
|
|
2174
|
+
}, b = new ResizeObserver(_);
|
|
2175
|
+
return b.observe(v), _(), () => b.disconnect();
|
|
2176
|
+
}, [r, i]), C(() => {
|
|
2177
|
+
if (!r) return;
|
|
2178
|
+
const v = u.current;
|
|
2179
|
+
v && (v.width = Math.max(
|
|
2180
|
+
1,
|
|
2181
|
+
Math.floor(r * (window.devicePixelRatio || 1))
|
|
2182
|
+
), v.height = Math.max(
|
|
2183
|
+
1,
|
|
2184
|
+
Math.floor(i * (window.devicePixelRatio || 1))
|
|
2185
|
+
));
|
|
2186
|
+
}, [r, i]), C(() => {
|
|
2187
|
+
let v = !1;
|
|
2188
|
+
return (async () => {
|
|
2189
|
+
try {
|
|
2190
|
+
const b = new (window.AudioContext || window.webkitAudioContext)();
|
|
2191
|
+
m.current = b;
|
|
2192
|
+
let P = a;
|
|
2193
|
+
if (!P) {
|
|
2194
|
+
if (!d) return;
|
|
2195
|
+
P = await navigator.mediaDevices.getUserMedia({
|
|
2196
|
+
audio: !0,
|
|
2197
|
+
video: !1
|
|
2198
|
+
}), j.current = !0;
|
|
2199
|
+
}
|
|
2200
|
+
if (v) return;
|
|
2201
|
+
const M = b.createAnalyser();
|
|
2202
|
+
M.fftSize = o, M.smoothingTimeConstant = l, c.current = M;
|
|
2203
|
+
const x = b.createMediaStreamSource(P);
|
|
2204
|
+
g.current = x, x.connect(M), S();
|
|
2205
|
+
} catch (b) {
|
|
2206
|
+
T((b == null ? void 0 : b.message) || "Failed to initialize microphone");
|
|
2207
|
+
}
|
|
2208
|
+
})(), () => {
|
|
2209
|
+
var b, P, M, x;
|
|
2210
|
+
v = !0, y.current && cancelAnimationFrame(y.current);
|
|
2211
|
+
try {
|
|
2212
|
+
(b = g.current) == null || b.disconnect();
|
|
2213
|
+
} catch {
|
|
2214
|
+
}
|
|
2215
|
+
try {
|
|
2216
|
+
(P = c.current) == null || P.disconnect();
|
|
2217
|
+
} catch {
|
|
2218
|
+
}
|
|
2219
|
+
j.current && ((x = ((M = g.current) == null ? void 0 : M.mediaStream) || void 0) == null || x.getTracks().forEach((I) => I.stop())), m.current && m.current.state !== "closed" && m.current.close();
|
|
2220
|
+
};
|
|
2221
|
+
}, [a, o, l, d]);
|
|
2222
|
+
const S = () => {
|
|
2223
|
+
const v = u.current, _ = c.current;
|
|
2224
|
+
if (!v || !_) return;
|
|
2225
|
+
const b = v.getContext("2d");
|
|
2226
|
+
if (!b) return;
|
|
2227
|
+
const P = window.devicePixelRatio || 1, M = v.width, x = v.height, I = _.frequencyBinCount, L = new Uint8Array(I), G = () => {
|
|
2228
|
+
y.current = requestAnimationFrame(G), _.getByteTimeDomainData(L), b.clearRect(0, 0, M, x), b.fillStyle = "rgba(0,0,0,0)", b.fillRect(0, 0, M, x);
|
|
2229
|
+
const B = Math.max(1, Math.floor(s * P)), V = Math.max(1, Math.floor(n * P)), H = B + V, q = Math.max(8, Math.floor((M + V) / H)), z = Math.floor(L.length / q);
|
|
2230
|
+
for (let A = 0; A < q; A++) {
|
|
2231
|
+
const Q = Math.min(L.length - 1, A * z), oe = L[Q] / 128 - 1, U = Math.abs(oe), le = Math.pow(U, 0.6), Y = Math.max(x * 0.06, le * (x * 0.9)), ce = A * H, de = (x - Y) / 2, J = 140 - Math.min(140, 140 * U), ee = 85, p = 48 + Math.floor(12 * (1 - U));
|
|
2232
|
+
b.fillStyle = `${w}`, b.shadowColor = `hsla(${J}, ${ee}%, ${p}%, ${0.25 * U})`, b.shadowBlur = 8 * U;
|
|
2233
|
+
const O = Math.min(B / 2, Y / 2);
|
|
2234
|
+
Ct(b, ce, de, B, Y, O), b.fill();
|
|
2235
|
+
}
|
|
2236
|
+
};
|
|
2237
|
+
G();
|
|
2238
|
+
};
|
|
2239
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2240
|
+
"div",
|
|
2241
|
+
{
|
|
2242
|
+
ref: h,
|
|
2243
|
+
className: `iw-relative iw-w-full iw-overflow-hidden iw-rounded-md iw-bg-gray-50 ${t}`,
|
|
2244
|
+
style: { height: i },
|
|
2245
|
+
children: [
|
|
2246
|
+
/* @__PURE__ */ e.jsx("canvas", { ref: u, className: "iw-w-full iw-h-full" }),
|
|
2247
|
+
f && /* @__PURE__ */ e.jsx("div", { className: "iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center", children: /* @__PURE__ */ e.jsx("span", { className: "iw-text-xs iw-text-red-600 iw-bg-red-50 iw-border iw-border-red-200 iw-px-2 iw-py-1 iw-rounded", children: f }) })
|
|
2248
|
+
]
|
|
2249
|
+
}
|
|
2250
|
+
);
|
|
2251
|
+
};
|
|
2252
|
+
function Ct(t, r, i, s, n, o) {
|
|
2253
|
+
const l = Math.min(o, s / 2, n / 2);
|
|
2254
|
+
t.beginPath(), t.moveTo(r + l, i), t.lineTo(r + s - l, i), t.quadraticCurveTo(r + s, i, r + s, i + l), t.lineTo(r + s, i + n - l), t.quadraticCurveTo(r + s, i + n, r + s - l, i + n), t.lineTo(r + l, i + n), t.quadraticCurveTo(r, i + n, r, i + n - l), t.lineTo(r, i + l), t.quadraticCurveTo(r, i, r + l, i), t.closePath();
|
|
2255
|
+
}
|
|
2256
|
+
const It = ({
|
|
2257
|
+
state: t,
|
|
2258
|
+
answeringTime: r,
|
|
2259
|
+
nextPhase: i,
|
|
2260
|
+
sttError: s
|
|
2261
|
+
}) => /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-justify-between iw-h-full ", children: [
|
|
2262
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
2263
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
|
|
2264
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "You may start speaking now. We're listening...." }),
|
|
2265
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
2266
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
2267
|
+
/* @__PURE__ */ e.jsx(me, { className: "iw-size-4 iw-text-orange-600" }),
|
|
2268
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to talk: " })
|
|
2269
|
+
] }),
|
|
2270
|
+
/* @__PURE__ */ e.jsx(
|
|
2271
|
+
xe,
|
|
2272
|
+
{
|
|
2273
|
+
total: r,
|
|
2274
|
+
remaining: t.currentPhaseTimeRemaining,
|
|
2275
|
+
size: 50,
|
|
2276
|
+
strokeWidth: 4
|
|
2277
|
+
}
|
|
2278
|
+
)
|
|
2279
|
+
] })
|
|
2280
|
+
] }),
|
|
2281
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: "Done talking? Click the button to review your answer." })
|
|
2282
|
+
] }),
|
|
2283
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
2284
|
+
/* @__PURE__ */ e.jsx(St, {}),
|
|
2285
|
+
s && /* @__PURE__ */ e.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
|
|
2286
|
+
"Recording error: ",
|
|
2287
|
+
s.message
|
|
2288
|
+
] })
|
|
2289
|
+
] }),
|
|
2290
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ e.jsx(
|
|
2291
|
+
W,
|
|
2292
|
+
{
|
|
2293
|
+
onClick: () => {
|
|
2294
|
+
i();
|
|
2295
|
+
},
|
|
2296
|
+
children: "Transcribe My Answer"
|
|
2297
|
+
}
|
|
2298
|
+
) })
|
|
2299
|
+
] });
|
|
2300
|
+
function Rt() {
|
|
2301
|
+
const [t, r] = k(!0), i = X(
|
|
2302
|
+
() => [0, 1, 2].map((s) => ({ id: s })),
|
|
2303
|
+
[]
|
|
2304
|
+
);
|
|
2305
|
+
return C(() => {
|
|
2306
|
+
const s = setInterval(() => {
|
|
2307
|
+
r((n) => !n);
|
|
2308
|
+
}, 1500);
|
|
2309
|
+
return () => clearInterval(s);
|
|
2310
|
+
}, []), /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-h-full", children: [
|
|
2311
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-relative iw-w-80 iw-h-48 ", "aria-hidden": !0, children: i.map((s, n) => {
|
|
2312
|
+
const o = n * 50, l = t ? o : o + 12, a = t ? 1 : 0.08, d = n * 140;
|
|
2313
|
+
return /* @__PURE__ */ e.jsx(
|
|
2314
|
+
"div",
|
|
2315
|
+
{
|
|
2316
|
+
role: "presentation",
|
|
2317
|
+
className: "iw-absolute iw-w-full iw-rounded-lg iw-p-4 iw-shadow-md iw-bg-gradient-to-b iw-from-gray-50 iw-to-gray-100 iw-overflow-hidden",
|
|
2318
|
+
style: {
|
|
2319
|
+
top: 0,
|
|
2320
|
+
transform: `translateY(${l}px)`,
|
|
2321
|
+
opacity: a,
|
|
2322
|
+
transition: `transform 600ms cubic-bezier(.2,.9,.3,1) ${d}ms, opacity 400ms ease ${d}ms`
|
|
2323
|
+
},
|
|
2324
|
+
children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-gap-3 iw-items-center", children: [
|
|
2325
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-w-10 iw-h-10 iw-bg-gray-300 iw-rounded iw-flex-shrink-0" }),
|
|
2326
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex-1 iw-space-y-2", children: [
|
|
2327
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-h-2 iw-bg-gray-300 iw-rounded iw-w-24" }),
|
|
2328
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-h-2 iw-bg-gray-300 iw-rounded iw-w-32" })
|
|
2329
|
+
] })
|
|
2330
|
+
] })
|
|
2331
|
+
},
|
|
2332
|
+
s.id
|
|
2333
|
+
);
|
|
2334
|
+
}) }),
|
|
2335
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-center", children: /* @__PURE__ */ e.jsx("p", { className: "iw-text-gray-500 iw-font-medium", children: "Preparing your question..." }) })
|
|
2336
|
+
] });
|
|
2337
|
+
}
|
|
2338
|
+
const Mt = ({
|
|
2339
|
+
size: t = "192px",
|
|
2340
|
+
className: r,
|
|
2341
|
+
colors: i,
|
|
2342
|
+
animationDuration: s = 20
|
|
2343
|
+
}) => {
|
|
2344
|
+
const o = { ...{
|
|
2345
|
+
bg: "oklch(95% 0.02 264.695)",
|
|
2346
|
+
c1: "oklch(75% 0.15 350)",
|
|
2347
|
+
// Pastel pink
|
|
2348
|
+
c2: "oklch(80% 0.12 200)",
|
|
2349
|
+
// Pastel blue
|
|
2350
|
+
c3: "oklch(78% 0.14 280)"
|
|
2351
|
+
// Pastel purple/lavender
|
|
2352
|
+
}, ...i }, l = parseInt(t.replace("px", ""), 10), a = l < 50 ? Math.max(l * 8e-3, 1) : Math.max(l * 0.015, 4), d = l < 50 ? Math.max(l * 4e-3, 1.2) : Math.max(l * 8e-3, 1.5), w = l < 50 ? Math.max(l * 4e-3, 0.05) : Math.max(l * 8e-3, 0.1), u = l < 50 ? Math.max(l * 4e-3, 0.5) : Math.max(l * 8e-3, 2), h = l < 30 ? "0%" : l < 50 ? "5%" : l < 100 ? "15%" : "25%", m = l < 30 ? 1.1 : l < 50 ? Math.max(d * 1.2, 1.3) : d;
|
|
2353
|
+
return /* @__PURE__ */ e.jsx(
|
|
2354
|
+
"div",
|
|
2355
|
+
{
|
|
2356
|
+
className: `siri-orb ${r}`,
|
|
2357
|
+
style: {
|
|
2358
|
+
width: t,
|
|
2359
|
+
height: t,
|
|
2360
|
+
"--bg": o.bg,
|
|
2361
|
+
"--c1": o.c1,
|
|
2362
|
+
"--c2": o.c2,
|
|
2363
|
+
"--c3": o.c3,
|
|
2364
|
+
"--animation-duration": `${s}s`,
|
|
2365
|
+
"--blur-amount": `${a}px`,
|
|
2366
|
+
"--contrast-amount": m,
|
|
2367
|
+
"--dot-size": `${w}px`,
|
|
2368
|
+
"--shadow-spread": `${u}px`,
|
|
2369
|
+
"--mask-radius": h
|
|
2370
|
+
},
|
|
2371
|
+
children: /* @__PURE__ */ e.jsx("style", { children: `
|
|
2372
|
+
@property --angle {
|
|
2373
|
+
syntax: "<angle>";
|
|
2374
|
+
inherits: false;
|
|
2375
|
+
initial-value: 0deg;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
.siri-orb {
|
|
2379
|
+
display: grid;
|
|
2380
|
+
grid-template-areas: "stack";
|
|
2381
|
+
overflow: hidden;
|
|
2382
|
+
border-radius: 50%;
|
|
2383
|
+
position: relative;
|
|
2384
|
+
transform: scale(1.1);
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
.siri-orb::before,
|
|
2388
|
+
.siri-orb::after {
|
|
2389
|
+
content: "";
|
|
2390
|
+
display: block;
|
|
2391
|
+
grid-area: stack;
|
|
2392
|
+
width: 100%;
|
|
2393
|
+
height: 100%;
|
|
2394
|
+
border-radius: 50%;
|
|
2395
|
+
transform: translateZ(0);
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
.siri-orb::before {
|
|
2399
|
+
background: conic-gradient(
|
|
2400
|
+
from calc(var(--angle) * 2) at 25% 70%,
|
|
2401
|
+
var(--c3),
|
|
2402
|
+
transparent 20% 80%,
|
|
2403
|
+
var(--c3)
|
|
2404
|
+
),
|
|
2405
|
+
conic-gradient(
|
|
2406
|
+
from calc(var(--angle) * 2) at 45% 75%,
|
|
2407
|
+
var(--c2),
|
|
2408
|
+
transparent 30% 60%,
|
|
2409
|
+
var(--c2)
|
|
2410
|
+
),
|
|
2411
|
+
conic-gradient(
|
|
2412
|
+
from calc(var(--angle) * -3) at 80% 20%,
|
|
2413
|
+
var(--c1),
|
|
2414
|
+
transparent 40% 60%,
|
|
2415
|
+
var(--c1)
|
|
2416
|
+
),
|
|
2417
|
+
conic-gradient(
|
|
2418
|
+
from calc(var(--angle) * 2) at 15% 5%,
|
|
2419
|
+
var(--c2),
|
|
2420
|
+
transparent 10% 90%,
|
|
2421
|
+
var(--c2)
|
|
2422
|
+
),
|
|
2423
|
+
conic-gradient(
|
|
2424
|
+
from calc(var(--angle) * 1) at 20% 80%,
|
|
2425
|
+
var(--c1),
|
|
2426
|
+
transparent 10% 90%,
|
|
2427
|
+
var(--c1)
|
|
2428
|
+
),
|
|
2429
|
+
conic-gradient(
|
|
2430
|
+
from calc(var(--angle) * -2) at 85% 10%,
|
|
2431
|
+
var(--c3),
|
|
2432
|
+
transparent 20% 80%,
|
|
2433
|
+
var(--c3)
|
|
2434
|
+
);
|
|
2435
|
+
box-shadow: inset var(--bg) 0 0 var(--shadow-spread)
|
|
2436
|
+
calc(var(--shadow-spread) * 0.2);
|
|
2437
|
+
filter: blur(var(--blur-amount)) contrast(var(--contrast-amount));
|
|
2438
|
+
animation: rotate var(--animation-duration) linear infinite;
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
.siri-orb::after {
|
|
2442
|
+
background-image: radial-gradient(
|
|
2443
|
+
circle at center,
|
|
2444
|
+
var(--bg) var(--dot-size),
|
|
2445
|
+
transparent var(--dot-size)
|
|
2446
|
+
);
|
|
2447
|
+
background-size: calc(var(--dot-size) * 2) calc(var(--dot-size) * 2);
|
|
2448
|
+
backdrop-filter: blur(calc(var(--blur-amount) * 2))
|
|
2449
|
+
contrast(calc(var(--contrast-amount) * 2));
|
|
2450
|
+
mix-blend-mode: overlay;
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
/* Apply mask only when radius is greater than 0 */
|
|
2454
|
+
.siri-orb[style*="--mask-radius: 0%"]::after {
|
|
2455
|
+
mask-image: none;
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
.siri-orb:not([style*="--mask-radius: 0%"])::after {
|
|
2459
|
+
mask-image: radial-gradient(
|
|
2460
|
+
black var(--mask-radius),
|
|
2461
|
+
transparent 75%
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
@keyframes rotate {
|
|
2466
|
+
to {
|
|
2467
|
+
--angle: 360deg;
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2472
|
+
.siri-orb::before {
|
|
2473
|
+
animation: none;
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
` })
|
|
2477
|
+
}
|
|
2478
|
+
);
|
|
2479
|
+
};
|
|
2480
|
+
function At({ ttsError: t }) {
|
|
2481
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-w-full iw-h-full", children: [
|
|
2482
|
+
/* @__PURE__ */ e.jsx(Mt, { size: "80px" }),
|
|
2483
|
+
t && /* @__PURE__ */ e.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
|
|
2484
|
+
"Audio playback failed: ",
|
|
2485
|
+
t.message
|
|
2486
|
+
] }),
|
|
2487
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text- iw-text-gray-700", children: "Your AI interviewer is speaking..." })
|
|
2488
|
+
] });
|
|
2489
|
+
}
|
|
2490
|
+
const Pt = ({ state: t, thinkingTime: r, nextPhase: i }) => /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-gap-6 iw-items-center iw-justify-center iw-text-center iw-h-full ", children: [
|
|
2491
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
2492
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Get Ready to Answer" }),
|
|
2493
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: "After 30-seconds thinking time, recording will start automatically, or you can begin recording early by clicking the button below." })
|
|
2494
|
+
] }),
|
|
2495
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
2496
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
2497
|
+
/* @__PURE__ */ e.jsx(me, { className: "iw-size-4 iw-text-orange-600" }),
|
|
2498
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to think: " })
|
|
2499
|
+
] }),
|
|
2500
|
+
/* @__PURE__ */ e.jsx(
|
|
2501
|
+
xe,
|
|
2502
|
+
{
|
|
2503
|
+
total: r,
|
|
2504
|
+
remaining: t.currentPhaseTimeRemaining,
|
|
2505
|
+
size: 50,
|
|
2506
|
+
strokeWidth: 4
|
|
2507
|
+
}
|
|
2508
|
+
)
|
|
2509
|
+
] }),
|
|
2510
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ e.jsx(
|
|
2511
|
+
W,
|
|
2512
|
+
{
|
|
2513
|
+
onClick: () => {
|
|
2514
|
+
i();
|
|
2515
|
+
},
|
|
2516
|
+
children: "Start Answering"
|
|
2517
|
+
}
|
|
2518
|
+
) })
|
|
2519
|
+
] }), Dt = ({ sttError: t }) => /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full", children: [
|
|
2520
|
+
/* @__PURE__ */ e.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 60 60", fill: "none", children: [
|
|
2521
|
+
/* @__PURE__ */ e.jsx(
|
|
2522
|
+
"rect",
|
|
2523
|
+
{
|
|
2524
|
+
width: 60,
|
|
2525
|
+
height: 60,
|
|
2526
|
+
rx: 30,
|
|
2527
|
+
fill: "url(#prefix__paint0_linear_1460_12482)"
|
|
2528
|
+
}
|
|
2529
|
+
),
|
|
2530
|
+
/* @__PURE__ */ e.jsx(
|
|
2531
|
+
"path",
|
|
2532
|
+
{
|
|
2533
|
+
d: "M28.127 14c.276 7.685 6.442 13.851 14.127 14.127-7.684.276-13.85 6.442-14.127 14.127-.275-7.685-6.442-13.851-14.126-14.127 7.684-.276 13.85-6.442 14.126-14.127zM38.937 31.873A7.331 7.331 0 0046 38.937 7.331 7.331 0 0038.937 46a7.331 7.331 0 00-7.064-7.063 7.331 7.331 0 007.064-7.064z",
|
|
2534
|
+
fill: "#fff"
|
|
2535
|
+
}
|
|
2536
|
+
),
|
|
2537
|
+
/* @__PURE__ */ e.jsx("defs", { children: /* @__PURE__ */ e.jsxs(
|
|
2538
|
+
"linearGradient",
|
|
2539
|
+
{
|
|
2540
|
+
id: "prefix__paint0_linear_1460_12482",
|
|
2541
|
+
x1: 30,
|
|
2542
|
+
y1: -6.563,
|
|
2543
|
+
x2: 77.813,
|
|
2544
|
+
y2: 54.375,
|
|
2545
|
+
gradientUnits: "userSpaceOnUse",
|
|
2546
|
+
children: [
|
|
2547
|
+
/* @__PURE__ */ e.jsx("stop", { offset: 0.211, stopColor: "#5C92FA" }),
|
|
2548
|
+
/* @__PURE__ */ e.jsx("stop", { offset: 1, stopColor: "#A75FFD" })
|
|
2549
|
+
]
|
|
2550
|
+
}
|
|
2551
|
+
) })
|
|
2552
|
+
] }),
|
|
2553
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1 iw-mt-3", children: "Just a moment... We're analyzing your response" }),
|
|
2554
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-max-w-lg iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: "After transcription, you'll have 45 sec to review your answer." }),
|
|
2555
|
+
t && /* @__PURE__ */ e.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
|
|
2556
|
+
"Transcription error: ",
|
|
2557
|
+
t.message,
|
|
2558
|
+
t.recoverable && " (attempting to continue)"
|
|
2559
|
+
] })
|
|
2560
|
+
] }), ie = (t) => /* @__PURE__ */ e.jsxs(
|
|
2561
|
+
"svg",
|
|
2562
|
+
{
|
|
2563
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2564
|
+
width: "24",
|
|
2565
|
+
height: "24",
|
|
2566
|
+
viewBox: "0 0 24 24",
|
|
2567
|
+
fill: "none",
|
|
2568
|
+
stroke: "currentColor",
|
|
2569
|
+
strokeWidth: "2",
|
|
2570
|
+
strokeLinecap: "round",
|
|
2571
|
+
strokeLinejoin: "round",
|
|
2572
|
+
...t,
|
|
2573
|
+
children: [
|
|
2574
|
+
/* @__PURE__ */ e.jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
2575
|
+
/* @__PURE__ */ e.jsx("path", { d: "M12 9v4" }),
|
|
2576
|
+
/* @__PURE__ */ e.jsx("path", { d: "M12 17h.01" })
|
|
2577
|
+
]
|
|
2578
|
+
}
|
|
2579
|
+
), _t = (t) => /* @__PURE__ */ e.jsxs(
|
|
2580
|
+
"svg",
|
|
2581
|
+
{
|
|
2582
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2583
|
+
width: "24",
|
|
2584
|
+
height: "24",
|
|
2585
|
+
viewBox: "0 0 24 24",
|
|
2586
|
+
fill: "none",
|
|
2587
|
+
stroke: "currentColor",
|
|
2588
|
+
strokeWidth: "2",
|
|
2589
|
+
strokeLinecap: "round",
|
|
2590
|
+
strokeLinejoin: "round",
|
|
2591
|
+
...t,
|
|
2592
|
+
children: [
|
|
2593
|
+
/* @__PURE__ */ e.jsx("path", { d: "M12 6v6l4 2" }),
|
|
2594
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "10" })
|
|
2595
|
+
]
|
|
2596
|
+
}
|
|
2597
|
+
), Ft = (t) => /* @__PURE__ */ e.jsxs(
|
|
2598
|
+
"svg",
|
|
2599
|
+
{
|
|
2600
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2601
|
+
width: "24",
|
|
2602
|
+
height: "24",
|
|
2603
|
+
viewBox: "0 0 24 24",
|
|
2604
|
+
fill: "none",
|
|
2605
|
+
stroke: "currentColor",
|
|
2606
|
+
strokeWidth: "2",
|
|
2607
|
+
strokeLinecap: "round",
|
|
2608
|
+
strokeLinejoin: "round",
|
|
2609
|
+
...t,
|
|
2610
|
+
children: [
|
|
2611
|
+
/* @__PURE__ */ e.jsx("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }),
|
|
2612
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
), Lt = (t) => /* @__PURE__ */ e.jsxs(
|
|
2616
|
+
"svg",
|
|
2617
|
+
{
|
|
2618
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2619
|
+
width: "24",
|
|
2620
|
+
height: "24",
|
|
2621
|
+
viewBox: "0 0 24 24",
|
|
2622
|
+
fill: "none",
|
|
2623
|
+
stroke: "currentColor",
|
|
2624
|
+
strokeWidth: "2",
|
|
2625
|
+
strokeLinecap: "round",
|
|
2626
|
+
strokeLinejoin: "round",
|
|
2627
|
+
...t,
|
|
2628
|
+
children: [
|
|
2629
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
2630
|
+
/* @__PURE__ */ e.jsx("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
|
|
2631
|
+
/* @__PURE__ */ e.jsx("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
|
|
2632
|
+
/* @__PURE__ */ e.jsx("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
|
|
2633
|
+
/* @__PURE__ */ e.jsx("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" })
|
|
2634
|
+
]
|
|
2635
|
+
}
|
|
2636
|
+
), ue = (t) => /* @__PURE__ */ e.jsxs(
|
|
2637
|
+
"svg",
|
|
2638
|
+
{
|
|
2639
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2640
|
+
width: "24",
|
|
2641
|
+
height: "24",
|
|
2642
|
+
viewBox: "0 0 24 24",
|
|
2643
|
+
fill: "none",
|
|
2644
|
+
stroke: "currentColor",
|
|
2645
|
+
strokeWidth: "2",
|
|
2646
|
+
strokeLinecap: "round",
|
|
2647
|
+
strokeLinejoin: "round",
|
|
2648
|
+
...t,
|
|
2649
|
+
children: [
|
|
2650
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
2651
|
+
/* @__PURE__ */ e.jsx("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
|
|
2652
|
+
/* @__PURE__ */ e.jsx("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
|
|
2653
|
+
/* @__PURE__ */ e.jsx("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
|
|
2654
|
+
/* @__PURE__ */ e.jsx("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" })
|
|
2655
|
+
]
|
|
2656
|
+
}
|
|
2657
|
+
), $t = (t) => /* @__PURE__ */ e.jsxs(
|
|
2658
|
+
"svg",
|
|
2659
|
+
{
|
|
2660
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2661
|
+
width: "24",
|
|
2662
|
+
height: "24",
|
|
2663
|
+
viewBox: "0 0 24 24",
|
|
2664
|
+
fill: "none",
|
|
2665
|
+
stroke: "currentColor",
|
|
2666
|
+
strokeWidth: "2",
|
|
2667
|
+
strokeLinecap: "round",
|
|
2668
|
+
strokeLinejoin: "round",
|
|
2669
|
+
...t,
|
|
2670
|
+
children: [
|
|
2671
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
2672
|
+
/* @__PURE__ */ e.jsx("path", { d: "M3 7V5a2 2 0 0 1 2-2h2" }),
|
|
2673
|
+
/* @__PURE__ */ e.jsx("path", { d: "M17 3h2a2 2 0 0 1 2 2v2" }),
|
|
2674
|
+
/* @__PURE__ */ e.jsx("path", { d: "M21 17v2a2 2 0 0 1-2 2h-2" }),
|
|
2675
|
+
/* @__PURE__ */ e.jsx("path", { d: "M7 21H5a2 2 0 0 1-2-2v-2" })
|
|
2676
|
+
]
|
|
2677
|
+
}
|
|
2678
|
+
), te = 5;
|
|
2679
|
+
function qt({
|
|
2680
|
+
isOpen: t,
|
|
2681
|
+
onClose: r,
|
|
2682
|
+
warningCount: i,
|
|
2683
|
+
violationType: s,
|
|
2684
|
+
onDisqualify: n
|
|
2685
|
+
}) {
|
|
2686
|
+
const [o, l] = k(10), a = E(r);
|
|
2687
|
+
if (C(() => {
|
|
2688
|
+
a.current = r;
|
|
2689
|
+
}, [r]), C(() => {
|
|
2690
|
+
if (!t) return;
|
|
2691
|
+
const m = setInterval(() => {
|
|
2692
|
+
l((c) => c <= 1 ? (a.current(), 10) : c - 1);
|
|
2693
|
+
}, 1e3);
|
|
2694
|
+
return () => clearInterval(m);
|
|
2695
|
+
}, [t]), C(() => {
|
|
2696
|
+
t && l(10);
|
|
2697
|
+
}, [t]), C(() => (t ? (document.body.style.overflow = "hidden", document.body.classList.add("interview-widget-container")) : (document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container")), () => {
|
|
2698
|
+
document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container");
|
|
2699
|
+
}), [t]), !t) return null;
|
|
2700
|
+
const w = (() => {
|
|
2701
|
+
switch (s) {
|
|
2702
|
+
case "tab_switch":
|
|
2703
|
+
return {
|
|
2704
|
+
title: "Tab Switch Detected",
|
|
2705
|
+
description: "You attempted to switch to another tab or reload application.",
|
|
2706
|
+
icon: /* @__PURE__ */ e.jsx(Ft, { className: "iw-h-5 iw-w-5" })
|
|
2707
|
+
};
|
|
2708
|
+
case "fullscreen_exit":
|
|
2709
|
+
return {
|
|
2710
|
+
title: "Full Screen Exit Detected",
|
|
2711
|
+
description: "You attempted to exit full screen mode.",
|
|
2712
|
+
icon: /* @__PURE__ */ e.jsx(De, { className: "iw-h-5 iw-w-5" })
|
|
2713
|
+
};
|
|
2714
|
+
case "focus_loss":
|
|
2715
|
+
return {
|
|
2716
|
+
title: "Focus Loss Detected",
|
|
2717
|
+
description: "You lost focus from the interview window.",
|
|
2718
|
+
icon: /* @__PURE__ */ e.jsx(Lt, { className: "iw-h-5 iw-w-5" })
|
|
2719
|
+
};
|
|
2720
|
+
case "blocked_shortcut":
|
|
2721
|
+
return {
|
|
2722
|
+
title: "Keyboard Shortcut Blocked",
|
|
2723
|
+
description: "You attempted to use a blocked keyboard shortcut.",
|
|
2724
|
+
icon: /* @__PURE__ */ e.jsx(ue, { className: "iw-h-5 iw-w-5" })
|
|
2725
|
+
};
|
|
2726
|
+
case "right_click_attempt":
|
|
2727
|
+
return {
|
|
2728
|
+
title: "Right Click Attempted",
|
|
2729
|
+
description: "You attempted to use the right click.",
|
|
2730
|
+
icon: /* @__PURE__ */ e.jsx($t, { className: "iw-h-5 iw-w-5" })
|
|
2731
|
+
};
|
|
2732
|
+
case "alt_tab_attempt":
|
|
2733
|
+
return {
|
|
2734
|
+
title: "Alt + Tab Attempted",
|
|
2735
|
+
description: "You attempted to use the Alt + Tab shortcut.",
|
|
2736
|
+
icon: /* @__PURE__ */ e.jsx(ue, { className: "iw-h-5 iw-w-5" })
|
|
2737
|
+
};
|
|
2738
|
+
case "blocked_function_key":
|
|
2739
|
+
return {
|
|
2740
|
+
title: "Function Key Blocked",
|
|
2741
|
+
description: "You attempted to use a blocked function key.",
|
|
2742
|
+
icon: /* @__PURE__ */ e.jsx(ue, { className: "iw-h-5 iw-w-5" })
|
|
2743
|
+
};
|
|
2744
|
+
default:
|
|
2745
|
+
return {
|
|
2746
|
+
title: "Violation Detected",
|
|
2747
|
+
description: "You attempted to perform an action that is not allowed.",
|
|
2748
|
+
icon: /* @__PURE__ */ e.jsx(ie, { className: "iw-h-5 iw-w-5" })
|
|
2749
|
+
};
|
|
2750
|
+
}
|
|
2751
|
+
})(), u = te - i, h = () => {
|
|
2752
|
+
i + 1 > te ? n() : r();
|
|
2753
|
+
};
|
|
2754
|
+
return /* @__PURE__ */ e.jsx("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/60 iw-p-4 iw-backdrop-blur-sm", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-w-full iw-max-w-md iw-rounded-2xl iw-border iw-border-gray-100 iw-bg-white iw-shadow-xl", children: [
|
|
2755
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-p-6 iw-pb-0", children: [
|
|
2756
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-mb-6 iw-flex iw-items-start iw-gap-4", children: [
|
|
2757
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-12 iw-w-12 iw-flex-shrink-0 iw-items-center iw-justify-center iw-rounded-2xl iw-bg-red-50", children: /* @__PURE__ */ e.jsx(ie, { className: "iw-h-6 iw-w-6 iw-text-red-500" }) }),
|
|
2758
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex-1", children: [
|
|
2759
|
+
/* @__PURE__ */ e.jsx("h2", { className: "iw-mb-1 iw-text-xl iw-font-semibold iw-text-gray-900", children: "Security Violation" }),
|
|
2760
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-2", children: [
|
|
2761
|
+
/* @__PURE__ */ e.jsx("span", { className: "iw-text-sm iw-text-gray-500", children: "Warning" }),
|
|
2762
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-gap-1", children: Array.from({ length: te }).map((m, c) => /* @__PURE__ */ e.jsx(
|
|
2763
|
+
"div",
|
|
2764
|
+
{
|
|
2765
|
+
className: `iw-h-2 iw-w-2 iw-rounded-full ${c <= i - 1 ? "iw-bg-red-500" : "iw-bg-gray-200"}`
|
|
2766
|
+
},
|
|
2767
|
+
c
|
|
2768
|
+
)) }),
|
|
2769
|
+
/* @__PURE__ */ e.jsxs("span", { className: "iw-text-sm iw-text-gray-500", children: [
|
|
2770
|
+
"(",
|
|
2771
|
+
i,
|
|
2772
|
+
"/",
|
|
2773
|
+
te,
|
|
2774
|
+
")"
|
|
2775
|
+
] })
|
|
2776
|
+
] })
|
|
2777
|
+
] })
|
|
2778
|
+
] }),
|
|
2779
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-mb-5 iw-rounded-2xl iw-border iw-border-red-100 iw-bg-gradient-to-r iw-from-red-50 iw-to-orange-50 iw-p-5", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-start iw-gap-4", children: [
|
|
2780
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-10 iw-w-10 iw-items-center iw-justify-center iw-rounded-xl iw-bg-white iw-shadow-sm", children: w.icon }),
|
|
2781
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-flex-1", children: [
|
|
2782
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-mb-2 iw-font-semibold iw-text-gray-900", children: w.title }),
|
|
2783
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-sm iw-leading-relaxed iw-text-gray-700", children: w.description }),
|
|
2784
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-mt-3 iw-flex iw-items-center iw-gap-2 iw-text-xs iw-text-red-600", children: [
|
|
2785
|
+
/* @__PURE__ */ e.jsx(Pe, { className: "iw-h-3 iw-w-3" }),
|
|
2786
|
+
/* @__PURE__ */ e.jsx("span", { children: "This action is monitored for interview integrity" })
|
|
2787
|
+
] })
|
|
2788
|
+
] })
|
|
2789
|
+
] }) }),
|
|
2790
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-mb-5 iw-grid iw-grid-cols-2 iw-gap-3", children: [
|
|
2791
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-rounded-xl iw-border iw-border-amber-200 iw-bg-amber-50 iw-p-4", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-text-center", children: [
|
|
2792
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-mb-1 iw-text-2xl iw-font-bold iw-text-amber-600", children: u }),
|
|
2793
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-font-medium iw-text-amber-700", children: "Warnings Left" })
|
|
2794
|
+
] }) }),
|
|
2795
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-border-primary-100 iw-bg-primary-50 iw-rounded-xl iw-border iw-p-4", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-text-center", children: [
|
|
2796
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-mb-1 iw-flex iw-items-center iw-justify-center iw-gap-1.5", children: [
|
|
2797
|
+
/* @__PURE__ */ e.jsx(_t, { className: "iw-text-primary-600 iw-h-4 iw-w-4" }),
|
|
2798
|
+
/* @__PURE__ */ e.jsx("span", { className: "iw-text-primary-600 iw-text-2xl iw-font-bold", children: o })
|
|
2799
|
+
] }),
|
|
2800
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-primary-700 iw-text-xs iw-font-medium", children: "Auto Close" })
|
|
2801
|
+
] }) })
|
|
2802
|
+
] }),
|
|
2803
|
+
u === 1 && /* @__PURE__ */ e.jsx("div", { className: "iw-mb-5 iw-rounded-2xl iw-bg-gradient-to-r iw-from-red-600/90 iw-to-red-500/90 iw-p-4 iw-text-white", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-3", children: [
|
|
2804
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-flex iw-h-8 iw-w-8 iw-items-center iw-justify-center iw-rounded-full iw-bg-white/20", children: /* @__PURE__ */ e.jsx(ie, { className: "iw-h-4 iw-w-4" }) }),
|
|
2805
|
+
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
2806
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-sm iw-font-semibold", children: "Final Warning" }),
|
|
2807
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-text-xs iw-text-red-100", children: "Next violation will disqualify you from this interview" })
|
|
2808
|
+
] })
|
|
2809
|
+
] }) })
|
|
2810
|
+
] }),
|
|
2811
|
+
/* @__PURE__ */ e.jsxs("div", { className: "iw-p-6 iw-pt-0", children: [
|
|
2812
|
+
/* @__PURE__ */ e.jsx(
|
|
2813
|
+
W,
|
|
2814
|
+
{
|
|
2815
|
+
onClick: h,
|
|
2816
|
+
className: "iw-h-12 iw-w-full iw-rounded-xl iw-bg-gray-800 iw-text-sm iw-font-medium iw-text-white iw-hover:bg-gray-800",
|
|
2817
|
+
children: "I Understand - Continue Interview"
|
|
2818
|
+
}
|
|
2819
|
+
),
|
|
2820
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-text-gray-500 iw-mt-3 iw-text-center iw-text-xs", children: "Please maintain focus and avoid switching tabs, exiting fullscreen, using shortcuts or right-clicking." })
|
|
2821
|
+
] })
|
|
2822
|
+
] }) });
|
|
2823
|
+
}
|
|
2824
|
+
const Ot = (t) => /* @__PURE__ */ e.jsxs(
|
|
2825
|
+
"svg",
|
|
2826
|
+
{
|
|
2827
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2828
|
+
width: "24",
|
|
2829
|
+
height: "24",
|
|
2830
|
+
viewBox: "0 0 24 24",
|
|
2831
|
+
fill: "none",
|
|
2832
|
+
stroke: "currentColor",
|
|
2833
|
+
strokeWidth: "2",
|
|
2834
|
+
strokeLinecap: "round",
|
|
2835
|
+
strokeLinejoin: "round",
|
|
2836
|
+
...t,
|
|
2837
|
+
children: [
|
|
2838
|
+
/* @__PURE__ */ e.jsx("path", { d: "M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z" }),
|
|
2839
|
+
/* @__PURE__ */ e.jsx("circle", { cx: "12", cy: "12", r: "10" })
|
|
2840
|
+
]
|
|
2841
|
+
}
|
|
2842
|
+
), Bt = ({
|
|
2843
|
+
showHardReloadWarning: t,
|
|
2844
|
+
onContinue: r
|
|
2845
|
+
}) => {
|
|
2846
|
+
const i = () => {
|
|
2847
|
+
r();
|
|
2848
|
+
};
|
|
2849
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2850
|
+
_e,
|
|
2851
|
+
{
|
|
2852
|
+
isOpen: t,
|
|
2853
|
+
onClose: i,
|
|
2854
|
+
closeOnOverlayClick: !1,
|
|
2855
|
+
closeOnEscape: !1,
|
|
2856
|
+
showCloseButton: !1,
|
|
2857
|
+
className: "iw-max-w-lg iw-px-2 iw-rounded-xl",
|
|
2858
|
+
children: [
|
|
2859
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-absolute iw-inset-x-0 iw-top-0 iw-h-1 iw-bg-gradient-to-r iw-from-red-500 iw-to-red-600" }),
|
|
2860
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-space-y-1 iw-pb-2 iw-pt-3", children: /* @__PURE__ */ e.jsxs("div", { className: "iw-flex iw-items-center iw-gap-2", children: [
|
|
2861
|
+
/* @__PURE__ */ e.jsx(ie, { className: "iw-w-5 iw-h-5 iw-text-red-500" }),
|
|
2862
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-text-xl iw-font-semibold iw-text-red-500", children: "Full Screen Exit Detected" })
|
|
2863
|
+
] }) }),
|
|
2864
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-pt-4 iw-pb-6", children: /* @__PURE__ */ e.jsx("p", { className: "iw-text-center iw-text-sm iw-leading-relaxed iw-text-gray-500/90", children: "Exiting full screen mode or reloading this page during the session is strictly prohibited. Any attempt to do so will be recorded and may lead to penalties." }) }),
|
|
2865
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-pt-2 iw-pb-4", children: /* @__PURE__ */ e.jsxs(
|
|
2866
|
+
"button",
|
|
2867
|
+
{
|
|
2868
|
+
onClick: i,
|
|
2869
|
+
className: "iw-w-full iw-flex iw-items-center iw-justify-center iw-gap-2 iw-px-4 iw-py-3 iw-bg-gray-100 iw-text-gray-600 iw-rounded-md iw-font-medium iw-transition-colors hover:iw-bg-gray-200 focus:iw-outline-none focus:iw-ring-2 focus:iw-ring-gray-400 focus:iw-ring-offset-2",
|
|
2870
|
+
children: [
|
|
2871
|
+
/* @__PURE__ */ e.jsx(Ot, { className: "iw-size-4" }),
|
|
2872
|
+
"Continue Session"
|
|
2873
|
+
]
|
|
2874
|
+
}
|
|
2875
|
+
) })
|
|
2876
|
+
]
|
|
2877
|
+
}
|
|
2878
|
+
);
|
|
2879
|
+
}, Gt = ({ children: t, onDisqualify: r }) => {
|
|
2880
|
+
const [i, s] = k(!1), [n, o] = k(!1), [l, a] = k("fullscreen_exit"), { logViolation: d, violationCount: w } = vt({
|
|
2881
|
+
maxViolations: 5,
|
|
2882
|
+
onViolation: (g) => {
|
|
2883
|
+
n || (s(!0), a(g.type));
|
|
2884
|
+
}
|
|
2885
|
+
}), { enterFullScreen: u, isFullScreen: h, exitFullScreen: m } = lt({
|
|
2886
|
+
onFullScreenChange(g) {
|
|
2887
|
+
!g && !n && (s(!0), d({
|
|
2888
|
+
type: "fullscreen_exit",
|
|
2889
|
+
severity: "high",
|
|
2890
|
+
details: {
|
|
2891
|
+
action: "fullscreen_exit",
|
|
2892
|
+
reason: "Attempted to exit full screen mode"
|
|
2893
|
+
}
|
|
2894
|
+
}));
|
|
2895
|
+
}
|
|
2896
|
+
});
|
|
2897
|
+
C(() => {
|
|
2898
|
+
u();
|
|
2899
|
+
}, []), gt(d), ht(d), ft();
|
|
2900
|
+
const c = () => {
|
|
2901
|
+
o(!0), m(), s(!1), r == null || r();
|
|
2902
|
+
};
|
|
2903
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2904
|
+
/* @__PURE__ */ e.jsx("div", { className: "iw-relative iw-h-full iw-w-full", children: t }),
|
|
2905
|
+
/* @__PURE__ */ e.jsx(
|
|
2906
|
+
qt,
|
|
2907
|
+
{
|
|
2908
|
+
warningCount: w,
|
|
2909
|
+
isOpen: i,
|
|
2910
|
+
violationType: l,
|
|
2911
|
+
onClose: () => {
|
|
2912
|
+
s(!1), u();
|
|
2913
|
+
},
|
|
2914
|
+
onDisqualify: c
|
|
2915
|
+
}
|
|
2916
|
+
),
|
|
2917
|
+
!i && w > 0 && !n && /* @__PURE__ */ e.jsx(
|
|
2918
|
+
Bt,
|
|
2919
|
+
{
|
|
2920
|
+
showHardReloadWarning: !h,
|
|
2921
|
+
logViolation: d,
|
|
2922
|
+
onContinue: u
|
|
2923
|
+
}
|
|
2924
|
+
)
|
|
2925
|
+
] });
|
|
2926
|
+
}, Ut = ({
|
|
2927
|
+
interviewTitle: t,
|
|
2928
|
+
interviewId: r,
|
|
2929
|
+
onComplete: i,
|
|
2930
|
+
onDisqualify: s,
|
|
2931
|
+
className: n = ""
|
|
2932
|
+
}) => {
|
|
2933
|
+
const o = ut(), { baseUrl: l, authToken: a } = Ce(), { timers: d, stt: w, tts: u, proctoring: h } = He(), [m, c] = k(null), [g, y] = k(""), j = E(""), f = E(null), T = {
|
|
2934
|
+
thinkingTime: (d == null ? void 0 : d.thinkingDuration) || 30,
|
|
2935
|
+
answeringTime: (d == null ? void 0 : d.answeringDuration) || 120,
|
|
2936
|
+
editingTime: (d == null ? void 0 : d.editingDuration) || 30
|
|
2937
|
+
}, { thinkingTime: S, answeringTime: v, editingTime: _ } = T;
|
|
2938
|
+
C(() => {
|
|
2939
|
+
j.current = g;
|
|
2940
|
+
}, [g]);
|
|
2941
|
+
const b = E(!1), {
|
|
2942
|
+
speak: P,
|
|
2943
|
+
stop: M,
|
|
2944
|
+
error: x
|
|
2945
|
+
} = bt({
|
|
2946
|
+
config: {
|
|
2947
|
+
baseUrl: l,
|
|
2948
|
+
provider: u == null ? void 0 : u.provider,
|
|
2949
|
+
authToken: a
|
|
2950
|
+
},
|
|
2951
|
+
onEnd: () => {
|
|
2952
|
+
b.current = !1, A();
|
|
2953
|
+
},
|
|
2954
|
+
onError: () => {
|
|
2955
|
+
b.current || (b.current = !0, A());
|
|
2956
|
+
}
|
|
2957
|
+
}), I = E(!1), L = E(!1), {
|
|
2958
|
+
startRecording: G,
|
|
2959
|
+
stopRecording: B,
|
|
2960
|
+
transcribe: V,
|
|
2961
|
+
error: H
|
|
2962
|
+
} = xt({
|
|
2963
|
+
config: {
|
|
2964
|
+
baseUrl: l,
|
|
2965
|
+
provider: w == null ? void 0 : w.provider,
|
|
2966
|
+
model: w == null ? void 0 : w.model,
|
|
2967
|
+
language: w == null ? void 0 : w.language,
|
|
2968
|
+
authToken: a
|
|
2969
|
+
},
|
|
2970
|
+
onStart: () => {
|
|
2971
|
+
I.current = !1, L.current = !1;
|
|
2972
|
+
},
|
|
2973
|
+
onStop: () => {
|
|
2974
|
+
},
|
|
2975
|
+
onTranscriptionComplete: (p) => {
|
|
2976
|
+
y(p.transcript), L.current || (L.current = !0, A());
|
|
2977
|
+
},
|
|
2978
|
+
onError: (p) => {
|
|
2979
|
+
console.error("STT Error:", p), I.current || (I.current = !0, A());
|
|
2980
|
+
}
|
|
2981
|
+
}), { state: q, startQuestion: z, nextPhase: A, completeInterview: Q } = at({
|
|
2982
|
+
config: {
|
|
2983
|
+
thinkingDuration: S,
|
|
2984
|
+
answeringDuration: v,
|
|
2985
|
+
editingDuration: _
|
|
2986
|
+
},
|
|
2987
|
+
callbacks: {
|
|
2988
|
+
onPhaseChange: (p) => {
|
|
2989
|
+
switch (p) {
|
|
2990
|
+
case D.FETCHING_QUESTION:
|
|
2991
|
+
oe();
|
|
2992
|
+
break;
|
|
2993
|
+
case D.READING_QUESTION:
|
|
2994
|
+
Y();
|
|
2995
|
+
break;
|
|
2996
|
+
case D.ANSWERING:
|
|
2997
|
+
ce();
|
|
2998
|
+
break;
|
|
2999
|
+
case D.TRANSCRIBING:
|
|
3000
|
+
de();
|
|
3001
|
+
break;
|
|
3002
|
+
case D.SUBMITTING:
|
|
3003
|
+
le();
|
|
3004
|
+
break;
|
|
3005
|
+
}
|
|
3006
|
+
},
|
|
3007
|
+
onInterviewEnd: () => {
|
|
3008
|
+
i == null || i();
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
});
|
|
3012
|
+
C(() => {
|
|
3013
|
+
z();
|
|
3014
|
+
}, []);
|
|
3015
|
+
const { execute: oe, loading: U } = ot(
|
|
3016
|
+
async () => {
|
|
3017
|
+
var O, ge;
|
|
3018
|
+
const p = await o.generateQuestion({
|
|
3019
|
+
interviewId: r,
|
|
3020
|
+
question: ((O = f.current) == null ? void 0 : O.question) || "",
|
|
3021
|
+
qnaId: ((ge = f.current) == null ? void 0 : ge.qna_id) || "",
|
|
3022
|
+
answer: j.current
|
|
3023
|
+
});
|
|
3024
|
+
return f.current = p.data, p;
|
|
3025
|
+
},
|
|
3026
|
+
{
|
|
3027
|
+
onSuccess: async (p) => {
|
|
3028
|
+
p && p.data && (y(""), c(p.data), A());
|
|
3029
|
+
},
|
|
3030
|
+
onError: (p) => {
|
|
3031
|
+
console.error("Failed to fetch questions:", p);
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
), le = N(async () => {
|
|
3035
|
+
z();
|
|
3036
|
+
}, [z]), Y = N(async () => {
|
|
3037
|
+
var p;
|
|
3038
|
+
if ((p = f.current) != null && p.question)
|
|
3039
|
+
try {
|
|
3040
|
+
b.current = !1, await P(f.current.question), f.current.is_interview_done && (await Ke(2e3), Q());
|
|
3041
|
+
} catch (O) {
|
|
3042
|
+
console.error("Failed to speak question:", O);
|
|
3043
|
+
}
|
|
3044
|
+
else
|
|
3045
|
+
A();
|
|
3046
|
+
}, [P, A, Q]), ce = N(async () => {
|
|
3047
|
+
try {
|
|
3048
|
+
await G(v);
|
|
3049
|
+
} catch (p) {
|
|
3050
|
+
console.error("Failed to start recording:", p), A();
|
|
3051
|
+
}
|
|
3052
|
+
}, [G, A]), de = N(async () => {
|
|
3053
|
+
try {
|
|
3054
|
+
const p = await B();
|
|
3055
|
+
await V(p);
|
|
3056
|
+
} catch (p) {
|
|
3057
|
+
console.error("STT processing failed:", p), !I.current && !L.current && (I.current = !0, A());
|
|
3058
|
+
}
|
|
3059
|
+
}, [B, V, A]), J = N(
|
|
3060
|
+
async (p) => {
|
|
3061
|
+
M(), (await o.generateQuestion({
|
|
3062
|
+
interviewId: r,
|
|
3063
|
+
isInterviewDone: !0
|
|
3064
|
+
})).success && (p == null || p(), Q());
|
|
3065
|
+
},
|
|
3066
|
+
[r, M, o]
|
|
3067
|
+
), ee = () => {
|
|
3068
|
+
const { phase: p } = q;
|
|
3069
|
+
switch (p) {
|
|
3070
|
+
case D.IDLE:
|
|
3071
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "iw-text-center iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-2 iw-h-full", children: [
|
|
3072
|
+
/* @__PURE__ */ e.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Ready to start the Interview?" }),
|
|
3073
|
+
/* @__PURE__ */ e.jsx("p", { className: "iw-max-w-xl iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: `You will be asked a series of behavioral and technical questions. For each one you'll get a short thinking period, then a timed recording window. We'll transcribe your response so you can review and edit it before submitting. Click "Start Interview" when you're ready.` }),
|
|
3074
|
+
/* @__PURE__ */ e.jsx(W, { onClick: z, className: "iw-mt-2 iw-w-40", children: "Start Interview" })
|
|
3075
|
+
] });
|
|
3076
|
+
case D.FETCHING_QUESTION:
|
|
3077
|
+
return /* @__PURE__ */ e.jsx(Rt, {});
|
|
3078
|
+
case D.READING_QUESTION:
|
|
3079
|
+
return /* @__PURE__ */ e.jsx(At, { ttsError: x });
|
|
3080
|
+
case D.THINKING:
|
|
3081
|
+
return /* @__PURE__ */ e.jsx(
|
|
3082
|
+
Pt,
|
|
3083
|
+
{
|
|
3084
|
+
state: q,
|
|
3085
|
+
thinkingTime: S,
|
|
3086
|
+
nextPhase: A
|
|
3087
|
+
}
|
|
3088
|
+
);
|
|
3089
|
+
case D.ANSWERING:
|
|
3090
|
+
return /* @__PURE__ */ e.jsx(
|
|
3091
|
+
It,
|
|
3092
|
+
{
|
|
3093
|
+
state: q,
|
|
3094
|
+
answeringTime: v,
|
|
3095
|
+
nextPhase: A,
|
|
3096
|
+
sttError: H
|
|
3097
|
+
}
|
|
3098
|
+
);
|
|
3099
|
+
case D.TRANSCRIBING:
|
|
3100
|
+
return /* @__PURE__ */ e.jsx(Dt, { sttError: H });
|
|
3101
|
+
case D.EDITING:
|
|
3102
|
+
case D.SUBMITTING:
|
|
3103
|
+
return /* @__PURE__ */ e.jsx("div", { className: "iw-space-y-4 iw-h-full", children: /* @__PURE__ */ e.jsx(
|
|
3104
|
+
Nt,
|
|
3105
|
+
{
|
|
3106
|
+
value: g,
|
|
3107
|
+
onChange: (O) => y(O.target.value),
|
|
3108
|
+
onSubmit: () => A(),
|
|
3109
|
+
isSubmitDisabled: !g.trim() || U,
|
|
3110
|
+
state: q,
|
|
3111
|
+
editingTime: _
|
|
3112
|
+
}
|
|
3113
|
+
) });
|
|
3114
|
+
case D.COMPLETED:
|
|
3115
|
+
return null;
|
|
3116
|
+
default:
|
|
3117
|
+
return null;
|
|
3118
|
+
}
|
|
3119
|
+
};
|
|
3120
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: h != null && h.enabled ? /* @__PURE__ */ e.jsxs(
|
|
3121
|
+
Gt,
|
|
3122
|
+
{
|
|
3123
|
+
onDisqualify: () => J(s),
|
|
3124
|
+
children: [
|
|
3125
|
+
/* @__PURE__ */ e.jsx(
|
|
3126
|
+
ye,
|
|
3127
|
+
{
|
|
3128
|
+
title: t,
|
|
3129
|
+
onExit: () => J()
|
|
3130
|
+
}
|
|
3131
|
+
),
|
|
3132
|
+
/* @__PURE__ */ e.jsx(
|
|
3133
|
+
ve,
|
|
3134
|
+
{
|
|
3135
|
+
currentQuestion: m,
|
|
3136
|
+
phase: q.phase,
|
|
3137
|
+
className: n,
|
|
3138
|
+
children: ee()
|
|
3139
|
+
}
|
|
3140
|
+
)
|
|
3141
|
+
]
|
|
3142
|
+
}
|
|
3143
|
+
) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3144
|
+
/* @__PURE__ */ e.jsx(
|
|
3145
|
+
ye,
|
|
3146
|
+
{
|
|
3147
|
+
title: t,
|
|
3148
|
+
onExit: () => J()
|
|
3149
|
+
}
|
|
3150
|
+
),
|
|
3151
|
+
/* @__PURE__ */ e.jsx(
|
|
3152
|
+
ve,
|
|
3153
|
+
{
|
|
3154
|
+
currentQuestion: m,
|
|
3155
|
+
phase: q.phase,
|
|
3156
|
+
className: n,
|
|
3157
|
+
children: ee()
|
|
3158
|
+
}
|
|
3159
|
+
)
|
|
3160
|
+
] }) });
|
|
3161
|
+
}, zt = ({
|
|
3162
|
+
title: t,
|
|
3163
|
+
interviewId: r,
|
|
3164
|
+
onInterviewEnd: i,
|
|
3165
|
+
onInterviewDisqualify: s,
|
|
3166
|
+
className: n = ""
|
|
3167
|
+
}) => {
|
|
3168
|
+
const [o, l] = fe.useState(!1), [a, d] = fe.useState(!0), w = E(null);
|
|
3169
|
+
return o ? /* @__PURE__ */ e.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ e.jsx(
|
|
3170
|
+
"div",
|
|
3171
|
+
{
|
|
3172
|
+
ref: w,
|
|
3173
|
+
className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${n}`,
|
|
3174
|
+
children: /* @__PURE__ */ e.jsx("div", { className: " iw-h-full iw-flex iw-flex-col", children: /* @__PURE__ */ e.jsx(
|
|
3175
|
+
Ut,
|
|
3176
|
+
{
|
|
3177
|
+
interviewTitle: t ?? "Interview",
|
|
3178
|
+
interviewId: r,
|
|
3179
|
+
className: n,
|
|
3180
|
+
onComplete: i || (() => {
|
|
3181
|
+
}),
|
|
3182
|
+
onDisqualify: s
|
|
3183
|
+
}
|
|
3184
|
+
) })
|
|
3185
|
+
}
|
|
3186
|
+
) }) : /* @__PURE__ */ e.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ e.jsx(
|
|
3187
|
+
it,
|
|
3188
|
+
{
|
|
3189
|
+
isOpen: a,
|
|
3190
|
+
onStart: () => {
|
|
3191
|
+
l(!0), d(!1);
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
) });
|
|
3195
|
+
};
|
|
3196
|
+
typeof window < "u" && (window.InterviewWidget = {
|
|
3197
|
+
InterviewWidget: zt,
|
|
3198
|
+
InterviewWidgetProvider: Ve
|
|
3199
|
+
});
|
|
3200
|
+
export {
|
|
3201
|
+
zt as InterviewWidget,
|
|
3202
|
+
Ve as InterviewWidgetProvider,
|
|
3203
|
+
zt as default
|
|
3204
|
+
};
|