interview-widget 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var ve = Object.defineProperty;
|
|
2
2
|
var je = (i, r, e) => r in i ? ve(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
3
|
var D = (i, r, e) => je(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import
|
|
4
|
+
import ce, { createContext as Ne, useContext as Te, useRef as S, useState as T, useEffect as P, useCallback as A, useMemo as V } from "react";
|
|
5
5
|
import { createPortal as ke } from "react-dom";
|
|
6
|
-
var
|
|
6
|
+
var de = { exports: {} }, J = {};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
9
9
|
* react-jsx-runtime.production.js
|
|
@@ -14,9 +14,9 @@ var le = { exports: {} }, X = {};
|
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
15
|
*/
|
|
16
16
|
var Ie = Symbol.for("react.transitional.element"), Ee = Symbol.for("react.fragment");
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
if (e !== void 0 && (
|
|
17
|
+
function we(i, r, e) {
|
|
18
|
+
var o = null;
|
|
19
|
+
if (e !== void 0 && (o = "" + e), r.key !== void 0 && (o = "" + r.key), "key" in r) {
|
|
20
20
|
e = {};
|
|
21
21
|
for (var s in r)
|
|
22
22
|
s !== "key" && (e[s] = r[s]);
|
|
@@ -24,17 +24,17 @@ function de(i, r, e) {
|
|
|
24
24
|
return r = e.ref, {
|
|
25
25
|
$$typeof: Ie,
|
|
26
26
|
type: i,
|
|
27
|
-
key:
|
|
27
|
+
key: o,
|
|
28
28
|
ref: r !== void 0 ? r : null,
|
|
29
29
|
props: e
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var t =
|
|
37
|
-
const
|
|
32
|
+
J.Fragment = Ee;
|
|
33
|
+
J.jsx = we;
|
|
34
|
+
J.jsxs = we;
|
|
35
|
+
de.exports = J;
|
|
36
|
+
var t = de.exports;
|
|
37
|
+
const $ = {
|
|
38
38
|
api: {
|
|
39
39
|
baseUrl: "/api",
|
|
40
40
|
retryConfig: {
|
|
@@ -62,48 +62,48 @@ const O = {
|
|
|
62
62
|
provider: "piper"
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
},
|
|
65
|
+
}, ue = Ne(
|
|
66
66
|
null
|
|
67
67
|
);
|
|
68
68
|
function Re({
|
|
69
69
|
config: i = {},
|
|
70
70
|
children: r
|
|
71
71
|
}) {
|
|
72
|
-
var
|
|
72
|
+
var o, s, c, a;
|
|
73
73
|
const e = {
|
|
74
74
|
api: {
|
|
75
|
-
|
|
75
|
+
...$.api,
|
|
76
76
|
...i.api,
|
|
77
77
|
retryConfig: {
|
|
78
|
-
|
|
79
|
-
...(
|
|
78
|
+
...$.api.retryConfig,
|
|
79
|
+
...(o = i.api) == null ? void 0 : o.retryConfig
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
ui: {
|
|
83
|
-
|
|
83
|
+
...$.ui,
|
|
84
84
|
...i.ui
|
|
85
85
|
},
|
|
86
86
|
interview: {
|
|
87
|
-
|
|
87
|
+
...$.interview,
|
|
88
88
|
...i.interview,
|
|
89
89
|
timers: {
|
|
90
|
-
|
|
90
|
+
...$.interview.timers,
|
|
91
91
|
...(s = i.interview) == null ? void 0 : s.timers
|
|
92
92
|
},
|
|
93
93
|
stt: {
|
|
94
|
-
|
|
94
|
+
...$.interview.stt,
|
|
95
95
|
...(c = i.interview) == null ? void 0 : c.stt
|
|
96
96
|
},
|
|
97
97
|
tts: {
|
|
98
|
-
|
|
98
|
+
...$.interview.tts,
|
|
99
99
|
...(a = i.interview) == null ? void 0 : a.tts
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
return /* @__PURE__ */ t.jsx(
|
|
103
|
+
return /* @__PURE__ */ t.jsx(ue.Provider, { value: e, children: r });
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const i = Te(
|
|
105
|
+
function X() {
|
|
106
|
+
const i = Te(ue);
|
|
107
107
|
if (!i)
|
|
108
108
|
throw new Error(
|
|
109
109
|
"useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>"
|
|
@@ -111,15 +111,15 @@ function Z() {
|
|
|
111
111
|
return i;
|
|
112
112
|
}
|
|
113
113
|
function Se() {
|
|
114
|
-
return
|
|
114
|
+
return X().api || $.api;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
116
|
+
function W() {
|
|
117
|
+
return X().ui || $.ui;
|
|
118
118
|
}
|
|
119
119
|
function Ce() {
|
|
120
|
-
return
|
|
120
|
+
return X().interview || $.interview;
|
|
121
121
|
}
|
|
122
|
-
const
|
|
122
|
+
const he = ({
|
|
123
123
|
className: i,
|
|
124
124
|
...r
|
|
125
125
|
}) => /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs(
|
|
@@ -148,17 +148,17 @@ const ue = ({
|
|
|
148
148
|
/* @__PURE__ */ t.jsx("path", { d: "M7.75 7.75l-2.15 -2.15" })
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
|
-
) }),
|
|
151
|
+
) }), se = ({
|
|
152
152
|
children: i,
|
|
153
153
|
variant: r = "primary",
|
|
154
154
|
size: e = "md",
|
|
155
|
-
fullWidth:
|
|
155
|
+
fullWidth: o = !1,
|
|
156
156
|
isLoading: s = !1,
|
|
157
157
|
disabled: c,
|
|
158
158
|
className: a = "",
|
|
159
|
-
...
|
|
159
|
+
...n
|
|
160
160
|
}) => {
|
|
161
|
-
const w = "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",
|
|
161
|
+
const w = "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", m = {
|
|
162
162
|
primary: "iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",
|
|
163
163
|
secondary: "iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",
|
|
164
164
|
outline: "iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",
|
|
@@ -168,15 +168,15 @@ const ue = ({
|
|
|
168
168
|
sm: "iw-px-3 iw-py-1.5 iw-text-sm",
|
|
169
169
|
md: "iw-px-4 iw-py-2.5 iw-text-sm",
|
|
170
170
|
lg: "iw-px-5 iw-py-3 iw-text-base"
|
|
171
|
-
}, h = "iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none", u =
|
|
171
|
+
}, h = "iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none", u = o ? "iw-w-full" : "";
|
|
172
172
|
return /* @__PURE__ */ t.jsxs(
|
|
173
173
|
"button",
|
|
174
174
|
{
|
|
175
|
-
className: `${w} ${
|
|
175
|
+
className: `${w} ${m[r]} ${d[e]} ${u} ${h} ${a}`,
|
|
176
176
|
disabled: c || s,
|
|
177
|
-
...
|
|
177
|
+
...n,
|
|
178
178
|
children: [
|
|
179
|
-
s && /* @__PURE__ */ t.jsx(
|
|
179
|
+
s && /* @__PURE__ */ t.jsx(he, { height: 16, width: 16, style: { marginRight: "3px" } }),
|
|
180
180
|
i
|
|
181
181
|
]
|
|
182
182
|
}
|
|
@@ -191,28 +191,28 @@ function Me(i) {
|
|
|
191
191
|
} : null;
|
|
192
192
|
}
|
|
193
193
|
function Ae(i, r, e) {
|
|
194
|
-
return "#" + [i, r, e].map((
|
|
195
|
-
const s = Math.round(
|
|
194
|
+
return "#" + [i, r, e].map((o) => {
|
|
195
|
+
const s = Math.round(o).toString(16);
|
|
196
196
|
return s.length === 1 ? "0" + s : s;
|
|
197
197
|
}).join("");
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function me(i, r) {
|
|
200
200
|
const e = Me(i);
|
|
201
201
|
if (!e) return i;
|
|
202
|
-
const
|
|
203
|
-
return Ae(
|
|
202
|
+
const o = e.r + (255 - e.r) * r, s = e.g + (255 - e.g) * r, c = e.b + (255 - e.b) * r;
|
|
203
|
+
return Ae(o, s, c);
|
|
204
204
|
}
|
|
205
205
|
function De(i, r = 0.8) {
|
|
206
206
|
return {
|
|
207
|
-
background: `linear-gradient(to bottom, ${
|
|
207
|
+
background: `linear-gradient(to bottom, ${me(i, r)}, #ffffff)`,
|
|
208
208
|
color: "#1f2937"
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
function Pe(i) {
|
|
212
212
|
return new Promise((r) => setTimeout(r, i));
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
return `linear-gradient(to left, ${
|
|
214
|
+
function ge(i) {
|
|
215
|
+
return `linear-gradient(to left, ${me(i, 0.4)}, ${i})`;
|
|
216
216
|
}
|
|
217
217
|
const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
218
218
|
"svg",
|
|
@@ -245,35 +245,35 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
245
245
|
onClose: e
|
|
246
246
|
}) => {
|
|
247
247
|
var j;
|
|
248
|
-
const
|
|
248
|
+
const o = S(null), s = S(null), { baseColor: c, borderRadius: a } = W(), [n, w] = T(!1), [m, d] = T(null), [h, u] = T(!1), g = () => {
|
|
249
249
|
s.current && (s.current.getTracks().forEach((l) => l.stop()), s.current = null);
|
|
250
|
-
},
|
|
250
|
+
}, y = async () => {
|
|
251
251
|
u(!0), d(null);
|
|
252
252
|
try {
|
|
253
253
|
const l = await navigator.mediaDevices.getUserMedia({
|
|
254
254
|
video: { width: { ideal: 1280 }, height: { ideal: 720 } },
|
|
255
255
|
audio: !0
|
|
256
256
|
});
|
|
257
|
-
s.current = l,
|
|
257
|
+
s.current = l, o.current && (o.current.srcObject = l), w(!0);
|
|
258
258
|
} catch (l) {
|
|
259
259
|
console.error("Media permission error:", l);
|
|
260
|
-
let
|
|
261
|
-
(l == null ? void 0 : l.name) === "NotAllowedError" ?
|
|
260
|
+
let p = "Unable to access camera or microphone.";
|
|
261
|
+
(l == null ? void 0 : l.name) === "NotAllowedError" ? p = "Permissions denied. Please allow access to camera and microphone." : (l == null ? void 0 : l.name) === "NotFoundError" ? p = "No camera/microphone found. Please connect a device and retry." : l != null && l.message && (p = l.message), w(!1), d(p);
|
|
262
262
|
} finally {
|
|
263
263
|
u(!1);
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
|
-
if (
|
|
266
|
+
if (P(() => {
|
|
267
267
|
if (!i) {
|
|
268
|
-
|
|
268
|
+
g();
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
|
-
return
|
|
272
|
-
|
|
271
|
+
return y(), () => {
|
|
272
|
+
g();
|
|
273
273
|
};
|
|
274
274
|
}, [i]), !i) return null;
|
|
275
|
-
const
|
|
276
|
-
r(),
|
|
275
|
+
const k = () => {
|
|
276
|
+
r(), g();
|
|
277
277
|
};
|
|
278
278
|
return /* @__PURE__ */ t.jsx("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center iw-bg-black/50 iw-backdrop-blur-sm", children: /* @__PURE__ */ t.jsxs("div", { className: "iw-bg-white iw-rounded-xl iw-shadow-2xl iw-w-full iw-max-w-[800px] iw-mx-4", children: [
|
|
279
279
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-px-5 iw-py-4 iw-border-b iw-border-gray-200 iw-flex iw-items-center iw-justify-between", children: [
|
|
@@ -284,7 +284,7 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
284
284
|
"aria-label": "Close",
|
|
285
285
|
className: "iw-text-gray-500 hover:iw-text-gray-700",
|
|
286
286
|
onClick: () => {
|
|
287
|
-
|
|
287
|
+
g(), e == null || e();
|
|
288
288
|
},
|
|
289
289
|
children: "✕"
|
|
290
290
|
}
|
|
@@ -295,7 +295,7 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
295
295
|
/* @__PURE__ */ t.jsx("div", { className: "iw-border iw-border-gray-200 iw-rounded-lg iw-overflow-hidden iw-bg-gray-900", children: /* @__PURE__ */ t.jsx(
|
|
296
296
|
"video",
|
|
297
297
|
{
|
|
298
|
-
ref:
|
|
298
|
+
ref: o,
|
|
299
299
|
autoPlay: !0,
|
|
300
300
|
playsInline: !0,
|
|
301
301
|
muted: !0,
|
|
@@ -307,9 +307,9 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
307
307
|
) }),
|
|
308
308
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-grid iw-grid-cols-2 iw-gap-2 iw-mt-3", children: [
|
|
309
309
|
/* @__PURE__ */ t.jsx(
|
|
310
|
-
|
|
310
|
+
se,
|
|
311
311
|
{
|
|
312
|
-
onClick:
|
|
312
|
+
onClick: y,
|
|
313
313
|
disabled: h,
|
|
314
314
|
variant: "outline",
|
|
315
315
|
size: "sm",
|
|
@@ -318,17 +318,17 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
318
318
|
borderRadius: a,
|
|
319
319
|
color: c
|
|
320
320
|
},
|
|
321
|
-
children:
|
|
321
|
+
children: n ? "Recheck Permissions" : "Enable Camera & Mic"
|
|
322
322
|
}
|
|
323
323
|
),
|
|
324
324
|
/* @__PURE__ */ t.jsx(
|
|
325
|
-
|
|
325
|
+
se,
|
|
326
326
|
{
|
|
327
|
-
onClick:
|
|
328
|
-
disabled: !
|
|
327
|
+
onClick: k,
|
|
328
|
+
disabled: !n,
|
|
329
329
|
size: "sm",
|
|
330
330
|
style: {
|
|
331
|
-
background:
|
|
331
|
+
background: ge(c),
|
|
332
332
|
borderRadius: a
|
|
333
333
|
},
|
|
334
334
|
children: "Start Interview"
|
|
@@ -342,13 +342,13 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
342
342
|
/* @__PURE__ */ t.jsx("h3", { children: "Interview Guidelines" })
|
|
343
343
|
] }),
|
|
344
344
|
!((j = navigator.mediaDevices) != null && j.getUserMedia) && /* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-red-600", children: "Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox." }),
|
|
345
|
-
|
|
346
|
-
/* @__PURE__ */ t.jsx("ul", { className: "iw-mt-1 iw-text-sm iw-text-gray-500 iw-list-disc iw-pl-4 iw-space-y-1.5", children: _e.map((l,
|
|
345
|
+
m && /* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-red-600", children: m }),
|
|
346
|
+
/* @__PURE__ */ t.jsx("ul", { className: "iw-mt-1 iw-text-sm iw-text-gray-500 iw-list-disc iw-pl-4 iw-space-y-1.5", children: _e.map((l, p) => /* @__PURE__ */ t.jsx("li", { children: l }, p)) })
|
|
347
347
|
] })
|
|
348
348
|
] })
|
|
349
349
|
] }) });
|
|
350
350
|
};
|
|
351
|
-
var
|
|
351
|
+
var R = /* @__PURE__ */ ((i) => (i.IDLE = "idle", i.FETCHING_QUESTION = "fetching_question", i.READING_QUESTION = "reading_question", i.THINKING = "thinking", i.ANSWERING = "answering", i.TRANSCRIBING = "transcribing", i.EDITING = "editing", i.SUBMITTING = "submitting", i.COMPLETED = "completed", i))(R || {});
|
|
352
352
|
const Oe = {
|
|
353
353
|
thinkingDuration: 30,
|
|
354
354
|
answeringDuration: 120,
|
|
@@ -415,8 +415,8 @@ class Ue {
|
|
|
415
415
|
const r = this.state.phase, e = Fe[r];
|
|
416
416
|
if (!e) return;
|
|
417
417
|
this.stopPhaseTimer(), this.state.phase = e.next;
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
const o = this.getDurationForPhase(e.next);
|
|
419
|
+
o > 0 ? (this.state.currentPhaseTimeRemaining = o, this.startPhaseTimer()) : this.state.currentPhaseTimeRemaining = 0, this.notifyChange();
|
|
420
420
|
}
|
|
421
421
|
/**
|
|
422
422
|
* Manually complete the interview
|
|
@@ -484,62 +484,62 @@ class Ue {
|
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
486
|
function Ge(i = {}) {
|
|
487
|
-
const { config: r = {}, callbacks: e = {} } = i,
|
|
488
|
-
|
|
489
|
-
const s =
|
|
487
|
+
const { config: r = {}, callbacks: e = {} } = i, o = S(null);
|
|
488
|
+
o.current || (o.current = new Ue(r, {}));
|
|
489
|
+
const s = o.current, [c, a] = T(s.getState()), n = A(() => {
|
|
490
490
|
a(s.getState());
|
|
491
491
|
}, [s]);
|
|
492
|
-
|
|
492
|
+
P(() => {
|
|
493
493
|
const h = {
|
|
494
|
-
onPhaseChange: (u,
|
|
495
|
-
var
|
|
496
|
-
|
|
494
|
+
onPhaseChange: (u, g) => {
|
|
495
|
+
var y;
|
|
496
|
+
n(), (y = e.onPhaseChange) == null || y.call(e, u, g);
|
|
497
497
|
},
|
|
498
498
|
onTick: (u) => {
|
|
499
|
-
var
|
|
500
|
-
|
|
499
|
+
var g;
|
|
500
|
+
n(), (g = e.onTick) == null || g.call(e, u);
|
|
501
501
|
},
|
|
502
502
|
onInterviewEnd: () => {
|
|
503
503
|
var u;
|
|
504
|
-
|
|
504
|
+
n(), (u = e.onInterviewEnd) == null || u.call(e);
|
|
505
505
|
}
|
|
506
506
|
};
|
|
507
507
|
s.callbacks = h;
|
|
508
|
-
}, [s, e,
|
|
508
|
+
}, [s, e, n]), P(() => () => {
|
|
509
509
|
s.destroy();
|
|
510
510
|
}, [s]);
|
|
511
511
|
const w = A(() => {
|
|
512
|
-
s.startQuestion(),
|
|
513
|
-
}, [s,
|
|
514
|
-
s.nextPhase(),
|
|
515
|
-
}, [s,
|
|
516
|
-
s.completeInterview(),
|
|
517
|
-
}, [s,
|
|
512
|
+
s.startQuestion(), n();
|
|
513
|
+
}, [s, n]), m = A(() => {
|
|
514
|
+
s.nextPhase(), n();
|
|
515
|
+
}, [s, n]), d = A(() => {
|
|
516
|
+
s.completeInterview(), n();
|
|
517
|
+
}, [s, n]);
|
|
518
518
|
return {
|
|
519
519
|
state: c,
|
|
520
520
|
startQuestion: w,
|
|
521
|
-
nextPhase:
|
|
521
|
+
nextPhase: m,
|
|
522
522
|
completeInterview: d,
|
|
523
523
|
timerService: s
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
526
|
function qe(i, r = {}) {
|
|
527
|
-
const [e,
|
|
527
|
+
const [e, o] = T({
|
|
528
528
|
data: null,
|
|
529
529
|
loading: !1,
|
|
530
530
|
error: null
|
|
531
531
|
}), s = A(
|
|
532
532
|
async (...c) => {
|
|
533
|
-
var a,
|
|
534
|
-
|
|
533
|
+
var a, n, w, m;
|
|
534
|
+
o((d) => ({ ...d, loading: !0, error: null }));
|
|
535
535
|
try {
|
|
536
536
|
const d = await i(...c);
|
|
537
|
-
|
|
537
|
+
o((h) => ({
|
|
538
538
|
...h,
|
|
539
539
|
data: d,
|
|
540
540
|
loading: !1,
|
|
541
541
|
error: null
|
|
542
|
-
})), (a = r.onSuccess) == null || a.call(r, d), (
|
|
542
|
+
})), (a = r.onSuccess) == null || a.call(r, d), (n = r.onSettled) == null || n.call(r, d, null);
|
|
543
543
|
} catch (d) {
|
|
544
544
|
const h = d.type ? d : {
|
|
545
545
|
type: "unknown",
|
|
@@ -548,11 +548,11 @@ function qe(i, r = {}) {
|
|
|
548
548
|
userMessage: "Something went wrong. Please try again.",
|
|
549
549
|
originalError: d
|
|
550
550
|
};
|
|
551
|
-
|
|
551
|
+
o((u) => ({
|
|
552
552
|
...u,
|
|
553
553
|
loading: !1,
|
|
554
554
|
error: h
|
|
555
|
-
})), (w = r.onError) == null || w.call(r, h), (
|
|
555
|
+
})), (w = r.onError) == null || w.call(r, h), (m = r.onSettled) == null || m.call(r, null, h);
|
|
556
556
|
}
|
|
557
557
|
},
|
|
558
558
|
[i, r]
|
|
@@ -621,37 +621,37 @@ function Be(i) {
|
|
|
621
621
|
originalError: i
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
async function
|
|
624
|
+
async function ae(i, r = {}, e = {
|
|
625
625
|
attempts: 3,
|
|
626
626
|
backoff: "exponential",
|
|
627
627
|
baseDelay: 1e3,
|
|
628
628
|
maxDelay: 1e4,
|
|
629
629
|
jitter: !0
|
|
630
630
|
}) {
|
|
631
|
-
let
|
|
631
|
+
let o;
|
|
632
632
|
for (let s = 1; s <= e.attempts; s++)
|
|
633
633
|
try {
|
|
634
|
-
const c = new AbortController(), a = setTimeout(() => c.abort(), 6e4),
|
|
634
|
+
const c = new AbortController(), a = setTimeout(() => c.abort(), 6e4), n = await fetch(i, {
|
|
635
635
|
...r,
|
|
636
636
|
signal: c.signal
|
|
637
637
|
});
|
|
638
|
-
if (clearTimeout(a),
|
|
639
|
-
return
|
|
640
|
-
if (!
|
|
641
|
-
throw new Error(`HTTP ${
|
|
642
|
-
return
|
|
638
|
+
if (clearTimeout(a), n.status >= 400 && n.status < 500 && n.status !== 429)
|
|
639
|
+
return n;
|
|
640
|
+
if (!n.ok)
|
|
641
|
+
throw new Error(`HTTP ${n.status}: ${n.statusText}`);
|
|
642
|
+
return n;
|
|
643
643
|
} catch (c) {
|
|
644
|
-
|
|
644
|
+
o = c;
|
|
645
645
|
const a = Be(c);
|
|
646
646
|
if (!a.retryable || s === e.attempts)
|
|
647
647
|
throw a;
|
|
648
|
-
const
|
|
648
|
+
const n = ze(s, e);
|
|
649
649
|
console.warn(
|
|
650
|
-
`API request failed (attempt ${s}/${e.attempts}), retrying in ${
|
|
650
|
+
`API request failed (attempt ${s}/${e.attempts}), retrying in ${n}ms:`,
|
|
651
651
|
a.message
|
|
652
|
-
), await new Promise((w) => setTimeout(w,
|
|
652
|
+
), await new Promise((w) => setTimeout(w, n));
|
|
653
653
|
}
|
|
654
|
-
throw
|
|
654
|
+
throw o;
|
|
655
655
|
}
|
|
656
656
|
function ze(i, r) {
|
|
657
657
|
let e;
|
|
@@ -692,12 +692,12 @@ class Qe {
|
|
|
692
692
|
async generateQuestion({
|
|
693
693
|
interviewId: r,
|
|
694
694
|
isInterviewDone: e = !1,
|
|
695
|
-
qnaId:
|
|
695
|
+
qnaId: o,
|
|
696
696
|
question: s,
|
|
697
697
|
answer: c,
|
|
698
698
|
answerDuration: a
|
|
699
699
|
}) {
|
|
700
|
-
const
|
|
700
|
+
const n = await ae(
|
|
701
701
|
`${this.getBaseUrl()}/questions/next`,
|
|
702
702
|
{
|
|
703
703
|
method: "POST",
|
|
@@ -705,7 +705,7 @@ class Qe {
|
|
|
705
705
|
body: JSON.stringify({
|
|
706
706
|
interview_id: r,
|
|
707
707
|
is_interview_done: e,
|
|
708
|
-
qna_id:
|
|
708
|
+
qna_id: o,
|
|
709
709
|
question: s,
|
|
710
710
|
answer: c,
|
|
711
711
|
// TODO: Hardcoded for now, will be dynamic later
|
|
@@ -713,21 +713,21 @@ class Qe {
|
|
|
713
713
|
})
|
|
714
714
|
}
|
|
715
715
|
);
|
|
716
|
-
if (!
|
|
717
|
-
throw new Error(`Failed to get questions: ${
|
|
718
|
-
return await
|
|
716
|
+
if (!n.ok)
|
|
717
|
+
throw new Error(`Failed to get questions: ${n.status}`);
|
|
718
|
+
return await n.json();
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
function We() {
|
|
722
|
-
const i =
|
|
723
|
-
return
|
|
722
|
+
const i = X();
|
|
723
|
+
return V(() => {
|
|
724
724
|
const e = i.api || {};
|
|
725
725
|
return new Qe(e);
|
|
726
726
|
}, [i.api]);
|
|
727
727
|
}
|
|
728
|
-
class
|
|
729
|
-
constructor(r, e,
|
|
730
|
-
super(r), this.code = e, this.recoverable =
|
|
728
|
+
class v extends Error {
|
|
729
|
+
constructor(r, e, o = !1) {
|
|
730
|
+
super(r), this.code = e, this.recoverable = o, this.name = "STTError";
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
733
|
class He {
|
|
@@ -763,15 +763,15 @@ class He {
|
|
|
763
763
|
* Start recording audio from user's microphone
|
|
764
764
|
*/
|
|
765
765
|
async startRecording(r, e) {
|
|
766
|
-
var
|
|
766
|
+
var o;
|
|
767
767
|
if (!this.isRecordingSupported())
|
|
768
|
-
throw new
|
|
768
|
+
throw new v(
|
|
769
769
|
"Audio recording is not supported in this browser",
|
|
770
770
|
"RECORDING_NOT_SUPPORTED",
|
|
771
771
|
!1
|
|
772
772
|
);
|
|
773
773
|
if (this.isRecording())
|
|
774
|
-
throw new
|
|
774
|
+
throw new v(
|
|
775
775
|
"Recording is already in progress",
|
|
776
776
|
"ALREADY_RECORDING",
|
|
777
777
|
!0
|
|
@@ -794,28 +794,28 @@ class He {
|
|
|
794
794
|
var c;
|
|
795
795
|
(c = e == null ? void 0 : e.onStop) == null || c.call(e);
|
|
796
796
|
}, this.mediaRecorder.onerror = (c) => {
|
|
797
|
-
var
|
|
798
|
-
const a = new
|
|
797
|
+
var n;
|
|
798
|
+
const a = new v(
|
|
799
799
|
`Recording failed: ${c.error}`,
|
|
800
800
|
"RECORDING_ERROR",
|
|
801
801
|
!0
|
|
802
802
|
);
|
|
803
|
-
(
|
|
804
|
-
}, this.mediaRecorder.start(100), (
|
|
803
|
+
(n = e == null ? void 0 : e.onError) == null || n.call(e, a), this.cleanup();
|
|
804
|
+
}, this.mediaRecorder.start(100), (o = e == null ? void 0 : e.onStart) == null || o.call(e), r && r > 0 && (this.autoStopTimeoutId = setTimeout(() => {
|
|
805
805
|
this.isRecording() && this.stopRecording();
|
|
806
806
|
}, r * 1e3));
|
|
807
807
|
} catch (s) {
|
|
808
808
|
if (this.cleanup(), s instanceof Error) {
|
|
809
809
|
if (s.name === "NotAllowedError" || s.name === "PermissionDeniedError")
|
|
810
|
-
throw new
|
|
810
|
+
throw new v(
|
|
811
811
|
"Microphone permission was denied",
|
|
812
812
|
"PERMISSION_DENIED",
|
|
813
813
|
!1
|
|
814
814
|
);
|
|
815
815
|
if (s.name === "NotFoundError")
|
|
816
|
-
throw new
|
|
816
|
+
throw new v("No microphone found", "NO_MICROPHONE", !1);
|
|
817
817
|
}
|
|
818
|
-
throw new
|
|
818
|
+
throw new v(
|
|
819
819
|
`Failed to start recording: ${s instanceof Error ? s.message : String(s)}`,
|
|
820
820
|
"START_RECORDING_FAILED",
|
|
821
821
|
!0
|
|
@@ -827,7 +827,7 @@ class He {
|
|
|
827
827
|
*/
|
|
828
828
|
async stopRecording() {
|
|
829
829
|
if (this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null), !this.mediaRecorder || !this.isRecording())
|
|
830
|
-
throw new
|
|
830
|
+
throw new v(
|
|
831
831
|
"No active recording to stop",
|
|
832
832
|
"NO_ACTIVE_RECORDING",
|
|
833
833
|
!1
|
|
@@ -835,17 +835,17 @@ class He {
|
|
|
835
835
|
return new Promise((r, e) => {
|
|
836
836
|
if (!this.mediaRecorder) {
|
|
837
837
|
e(
|
|
838
|
-
new
|
|
838
|
+
new v("MediaRecorder is null", "MEDIARECORDER_NULL", !1)
|
|
839
839
|
);
|
|
840
840
|
return;
|
|
841
841
|
}
|
|
842
|
-
const
|
|
842
|
+
const o = this.mediaRecorder, s = () => {
|
|
843
843
|
try {
|
|
844
|
-
const c =
|
|
844
|
+
const c = o.mimeType || "audio/webm", a = new Blob(this.audioChunks, { type: c });
|
|
845
845
|
this.cleanup(), r(a);
|
|
846
846
|
} catch (c) {
|
|
847
847
|
e(
|
|
848
|
-
new
|
|
848
|
+
new v(
|
|
849
849
|
`Failed to create audio blob: ${c instanceof Error ? c.message : String(c)}`,
|
|
850
850
|
"BLOB_CREATION_FAILED",
|
|
851
851
|
!1
|
|
@@ -853,7 +853,7 @@ class He {
|
|
|
853
853
|
);
|
|
854
854
|
}
|
|
855
855
|
};
|
|
856
|
-
|
|
856
|
+
o.addEventListener("stop", s, { once: !0 }), o.stop();
|
|
857
857
|
});
|
|
858
858
|
}
|
|
859
859
|
/**
|
|
@@ -862,31 +862,34 @@ class He {
|
|
|
862
862
|
async transcribe(r) {
|
|
863
863
|
const {
|
|
864
864
|
audioBlob: e,
|
|
865
|
-
model:
|
|
865
|
+
model: o = this.config.model,
|
|
866
866
|
language: s = this.config.language,
|
|
867
867
|
includeTimestamps: c = this.config.includeTimestamps,
|
|
868
868
|
temperature: a = this.config.temperature
|
|
869
869
|
} = r;
|
|
870
870
|
if (!e || e.size === 0)
|
|
871
|
-
throw new
|
|
871
|
+
throw new v(
|
|
872
872
|
"Audio blob is empty or invalid",
|
|
873
873
|
"INVALID_AUDIO",
|
|
874
874
|
!1
|
|
875
875
|
);
|
|
876
876
|
try {
|
|
877
|
-
const
|
|
877
|
+
const n = new FormData(), w = new File([e], "recording.wav", {
|
|
878
878
|
type: e.type || "audio/wav"
|
|
879
879
|
});
|
|
880
|
-
|
|
881
|
-
const
|
|
880
|
+
n.append("file", w), n.append("model", o || "whisper-large-v3-turbo"), n.append("language", s || "en"), n.append("include_timestamps", String(c || !1)), n.append("temperature", String(a || 0));
|
|
881
|
+
const m = await ae(
|
|
882
882
|
`${this.config.baseUrl}/speech/transcribe`,
|
|
883
883
|
{
|
|
884
884
|
method: "POST",
|
|
885
885
|
headers: {
|
|
886
886
|
accept: "application/json",
|
|
887
|
-
"X-STT-Provider": this.config.provider || "groq"
|
|
887
|
+
"X-STT-Provider": this.config.provider || "groq",
|
|
888
|
+
...this.config.authToken && {
|
|
889
|
+
Authorization: `Bearer ${this.config.authToken}`
|
|
890
|
+
}
|
|
888
891
|
},
|
|
889
|
-
body:
|
|
892
|
+
body: n
|
|
890
893
|
},
|
|
891
894
|
{
|
|
892
895
|
attempts: 1,
|
|
@@ -896,27 +899,27 @@ class He {
|
|
|
896
899
|
jitter: !0
|
|
897
900
|
}
|
|
898
901
|
);
|
|
899
|
-
if (!
|
|
900
|
-
const h = await
|
|
901
|
-
let u = `STT request failed: ${
|
|
902
|
+
if (!m.ok) {
|
|
903
|
+
const h = await m.text();
|
|
904
|
+
let u = `STT request failed: ${m.status} ${m.statusText}`;
|
|
902
905
|
try {
|
|
903
|
-
const
|
|
904
|
-
u =
|
|
906
|
+
const g = JSON.parse(h);
|
|
907
|
+
u = g.message || g.error || u;
|
|
905
908
|
} catch {
|
|
906
909
|
u = h || u;
|
|
907
910
|
}
|
|
908
|
-
throw new
|
|
911
|
+
throw new v(
|
|
909
912
|
u,
|
|
910
|
-
`HTTP_${
|
|
911
|
-
|
|
913
|
+
`HTTP_${m.status}`,
|
|
914
|
+
m.status >= 500
|
|
912
915
|
);
|
|
913
916
|
}
|
|
914
917
|
return {
|
|
915
|
-
transcript: (await
|
|
918
|
+
transcript: (await m.json()).data.text ?? ""
|
|
916
919
|
};
|
|
917
|
-
} catch (
|
|
918
|
-
throw
|
|
919
|
-
`Transcription failed: ${
|
|
920
|
+
} catch (n) {
|
|
921
|
+
throw n instanceof v ? n : new v(
|
|
922
|
+
`Transcription failed: ${n instanceof Error ? n.message : String(n)}`,
|
|
920
923
|
"TRANSCRIPTION_FAILED",
|
|
921
924
|
!0
|
|
922
925
|
);
|
|
@@ -957,13 +960,13 @@ class He {
|
|
|
957
960
|
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);
|
|
958
961
|
}
|
|
959
962
|
}
|
|
960
|
-
const
|
|
961
|
-
const [r, e] =
|
|
962
|
-
i.config &&
|
|
963
|
-
const h = A(async (
|
|
963
|
+
const Q = new He(), Ye = (i = {}) => {
|
|
964
|
+
const [r, e] = T(!1), [o, s] = T(!1), [c, a] = T(null), [n, w] = T(null), [m, d] = T(null);
|
|
965
|
+
i.config && Q.updateConfig(i.config);
|
|
966
|
+
const h = A(async (k) => {
|
|
964
967
|
var j;
|
|
965
968
|
try {
|
|
966
|
-
w(null), a(null), d(null), await
|
|
969
|
+
w(null), a(null), d(null), await Q.startRecording(k, {
|
|
967
970
|
onStart: () => {
|
|
968
971
|
var l;
|
|
969
972
|
e(!0), (l = i.onStart) == null || l.call(i);
|
|
@@ -973,65 +976,65 @@ const z = new He(), Ye = (i = {}) => {
|
|
|
973
976
|
e(!1), (l = i.onStop) == null || l.call(i);
|
|
974
977
|
},
|
|
975
978
|
onError: (l) => {
|
|
976
|
-
var
|
|
977
|
-
const
|
|
978
|
-
w(
|
|
979
|
+
var I;
|
|
980
|
+
const p = l instanceof v ? l : new v(l.message, "RECORDING_ERROR", !0);
|
|
981
|
+
w(p), e(!1), (I = i.onError) == null || I.call(i, p);
|
|
979
982
|
}
|
|
980
983
|
});
|
|
981
984
|
} catch (l) {
|
|
982
|
-
const
|
|
985
|
+
const p = l instanceof v ? l : new v(
|
|
983
986
|
l instanceof Error ? l.message : String(l),
|
|
984
987
|
"START_FAILED",
|
|
985
988
|
!1
|
|
986
989
|
);
|
|
987
|
-
throw w(
|
|
990
|
+
throw w(p), e(!1), (j = i.onError) == null || j.call(i, p), p;
|
|
988
991
|
}
|
|
989
992
|
}, []), u = A(async () => {
|
|
990
|
-
var
|
|
993
|
+
var k, j;
|
|
991
994
|
try {
|
|
992
|
-
const l = await
|
|
993
|
-
return d(l), e(!1), (
|
|
995
|
+
const l = await Q.stopRecording();
|
|
996
|
+
return d(l), e(!1), (k = i.onStop) == null || k.call(i), l;
|
|
994
997
|
} catch (l) {
|
|
995
|
-
const
|
|
998
|
+
const p = l instanceof v ? l : new v(
|
|
996
999
|
l instanceof Error ? l.message : String(l),
|
|
997
1000
|
"STOP_FAILED",
|
|
998
1001
|
!1
|
|
999
1002
|
);
|
|
1000
|
-
throw w(
|
|
1003
|
+
throw w(p), e(!1), (j = i.onError) == null || j.call(i, p), p;
|
|
1001
1004
|
}
|
|
1002
|
-
}, []),
|
|
1003
|
-
async (
|
|
1004
|
-
var l,
|
|
1005
|
+
}, []), g = A(
|
|
1006
|
+
async (k, j = {}) => {
|
|
1007
|
+
var l, p;
|
|
1005
1008
|
try {
|
|
1006
1009
|
w(null), s(!0);
|
|
1007
|
-
const
|
|
1008
|
-
audioBlob:
|
|
1010
|
+
const I = {
|
|
1011
|
+
audioBlob: k,
|
|
1009
1012
|
...j
|
|
1010
|
-
}, b = await
|
|
1013
|
+
}, b = await Q.transcribe(I);
|
|
1011
1014
|
return a(b.transcript), s(!1), (l = i.onTranscriptionComplete) == null || l.call(i, b), b;
|
|
1012
|
-
} catch (
|
|
1013
|
-
const b =
|
|
1014
|
-
|
|
1015
|
+
} catch (I) {
|
|
1016
|
+
const b = I instanceof v ? I : new v(
|
|
1017
|
+
I instanceof Error ? I.message : String(I),
|
|
1015
1018
|
"TRANSCRIPTION_FAILED",
|
|
1016
1019
|
!0
|
|
1017
1020
|
);
|
|
1018
|
-
throw w(b), s(!1), (
|
|
1021
|
+
throw w(b), s(!1), (p = i.onError) == null || p.call(i, b), b;
|
|
1019
1022
|
}
|
|
1020
1023
|
},
|
|
1021
1024
|
[]
|
|
1022
|
-
),
|
|
1023
|
-
|
|
1025
|
+
), y = A(() => {
|
|
1026
|
+
Q.cancelRecording(), e(!1), d(null);
|
|
1024
1027
|
}, []);
|
|
1025
1028
|
return {
|
|
1026
1029
|
startRecording: h,
|
|
1027
1030
|
stopRecording: u,
|
|
1028
|
-
transcribe:
|
|
1029
|
-
cancelRecording:
|
|
1031
|
+
transcribe: g,
|
|
1032
|
+
cancelRecording: y,
|
|
1030
1033
|
isRecording: r,
|
|
1031
|
-
isTranscribing:
|
|
1034
|
+
isTranscribing: o,
|
|
1032
1035
|
transcript: c,
|
|
1033
|
-
error:
|
|
1034
|
-
audioBlob:
|
|
1036
|
+
error: n,
|
|
1037
|
+
audioBlob: m
|
|
1035
1038
|
};
|
|
1036
1039
|
};
|
|
1037
1040
|
class Ve {
|
|
@@ -1058,18 +1061,21 @@ class Ve {
|
|
|
1058
1061
|
async synthesizeSpeech(r) {
|
|
1059
1062
|
const {
|
|
1060
1063
|
text: e,
|
|
1061
|
-
voice:
|
|
1064
|
+
voice: o = this.config.voice,
|
|
1062
1065
|
speed: s = this.config.speed
|
|
1063
1066
|
} = r, c = new URLSearchParams();
|
|
1064
|
-
c.append("text", e), c.append("voice",
|
|
1065
|
-
const a = await
|
|
1067
|
+
c.append("text", e), c.append("voice", o || "string"), c.append("speed", (s == null ? void 0 : s.toString()) || "1");
|
|
1068
|
+
const a = await ae(
|
|
1066
1069
|
`${this.config.baseUrl}/speech/synthesize`,
|
|
1067
1070
|
{
|
|
1068
1071
|
method: "POST",
|
|
1069
1072
|
headers: {
|
|
1070
1073
|
accept: "application/json",
|
|
1071
1074
|
"X-TTS-Provider": this.config.provider || "piper",
|
|
1072
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
1075
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
1076
|
+
...this.config.authToken && {
|
|
1077
|
+
Authorization: `Bearer ${this.config.authToken}`
|
|
1078
|
+
}
|
|
1073
1079
|
},
|
|
1074
1080
|
body: c
|
|
1075
1081
|
},
|
|
@@ -1085,8 +1091,8 @@ class Ve {
|
|
|
1085
1091
|
throw new Error(
|
|
1086
1092
|
`TTS request failed: ${a.status} ${a.statusText}`
|
|
1087
1093
|
);
|
|
1088
|
-
const
|
|
1089
|
-
if (
|
|
1094
|
+
const n = a.headers.get("content-type");
|
|
1095
|
+
if (n && n.includes("audio/"))
|
|
1090
1096
|
return a.blob();
|
|
1091
1097
|
try {
|
|
1092
1098
|
const w = await a.json();
|
|
@@ -1099,25 +1105,25 @@ class Ve {
|
|
|
1099
1105
|
* Speak text and return a promise that resolves when playback completes
|
|
1100
1106
|
*/
|
|
1101
1107
|
async speak(r, e) {
|
|
1102
|
-
var
|
|
1108
|
+
var o, s;
|
|
1103
1109
|
try {
|
|
1104
|
-
this.stop(), (
|
|
1110
|
+
this.stop(), (o = e == null ? void 0 : e.onStart) == null || o.call(e);
|
|
1105
1111
|
const c = await this.synthesizeSpeech(r), a = URL.createObjectURL(c);
|
|
1106
|
-
return this.currentAudio = new Audio(a), new Promise((
|
|
1112
|
+
return this.currentAudio = new Audio(a), new Promise((n, w) => {
|
|
1107
1113
|
if (!this.currentAudio) {
|
|
1108
1114
|
w(new Error("Audio element not created"));
|
|
1109
1115
|
return;
|
|
1110
1116
|
}
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1117
|
+
const m = this.currentAudio;
|
|
1118
|
+
m.onended = () => {
|
|
1113
1119
|
var d;
|
|
1114
|
-
URL.revokeObjectURL(a), this.currentAudio = null, (d = e == null ? void 0 : e.onEnd) == null || d.call(e),
|
|
1115
|
-
},
|
|
1120
|
+
URL.revokeObjectURL(a), this.currentAudio = null, (d = e == null ? void 0 : e.onEnd) == null || d.call(e), n();
|
|
1121
|
+
}, m.onerror = (d) => {
|
|
1116
1122
|
var u;
|
|
1117
1123
|
URL.revokeObjectURL(a), this.currentAudio = null;
|
|
1118
1124
|
const h = new Error(`Audio playback failed: ${d}`);
|
|
1119
1125
|
(u = e == null ? void 0 : e.onError) == null || u.call(e, h), w(h);
|
|
1120
|
-
},
|
|
1126
|
+
}, m.play().catch((d) => {
|
|
1121
1127
|
var u;
|
|
1122
1128
|
URL.revokeObjectURL(a), this.currentAudio = null;
|
|
1123
1129
|
const h = new Error(`Failed to play audio: ${d.message}`);
|
|
@@ -1142,51 +1148,51 @@ class Ve {
|
|
|
1142
1148
|
return this.currentAudio !== null && !this.currentAudio.paused;
|
|
1143
1149
|
}
|
|
1144
1150
|
}
|
|
1145
|
-
const
|
|
1146
|
-
const [r, e] =
|
|
1147
|
-
i.config &&
|
|
1148
|
-
const
|
|
1149
|
-
async (
|
|
1151
|
+
const ie = new Ve(), Je = (i = {}) => {
|
|
1152
|
+
const [r, e] = T(!1), [o, s] = T(!1), [c, a] = T(null);
|
|
1153
|
+
i.config && ie.updateConfig(i.config);
|
|
1154
|
+
const n = A(
|
|
1155
|
+
async (m, d = {}) => {
|
|
1150
1156
|
var h;
|
|
1151
1157
|
try {
|
|
1152
1158
|
a(null), s(!0);
|
|
1153
1159
|
const u = {
|
|
1154
|
-
text:
|
|
1160
|
+
text: m,
|
|
1155
1161
|
...d
|
|
1156
1162
|
};
|
|
1157
|
-
await
|
|
1163
|
+
await ie.speak(u, {
|
|
1158
1164
|
onStart: () => {
|
|
1159
|
-
var
|
|
1160
|
-
s(!1), e(!0), (
|
|
1165
|
+
var g;
|
|
1166
|
+
s(!1), e(!0), (g = i.onStart) == null || g.call(i);
|
|
1161
1167
|
},
|
|
1162
1168
|
onEnd: () => {
|
|
1163
|
-
var
|
|
1164
|
-
e(!1), (
|
|
1169
|
+
var g;
|
|
1170
|
+
e(!1), (g = i.onEnd) == null || g.call(i);
|
|
1165
1171
|
},
|
|
1166
|
-
onError: (
|
|
1167
|
-
var
|
|
1168
|
-
e(!1), s(!1), a(
|
|
1172
|
+
onError: (g) => {
|
|
1173
|
+
var y;
|
|
1174
|
+
e(!1), s(!1), a(g), (y = i.onError) == null || y.call(i, g);
|
|
1169
1175
|
}
|
|
1170
1176
|
});
|
|
1171
1177
|
} catch (u) {
|
|
1172
|
-
const
|
|
1173
|
-
throw a(
|
|
1178
|
+
const g = u instanceof Error ? u : new Error(String(u));
|
|
1179
|
+
throw a(g), e(!1), s(!1), (h = i.onError) == null || h.call(i, g), g;
|
|
1174
1180
|
}
|
|
1175
1181
|
},
|
|
1176
1182
|
[i]
|
|
1177
1183
|
), w = A(() => {
|
|
1178
|
-
|
|
1184
|
+
ie.stop(), e(!1), s(!1);
|
|
1179
1185
|
}, []);
|
|
1180
1186
|
return {
|
|
1181
|
-
speak:
|
|
1187
|
+
speak: n,
|
|
1182
1188
|
stop: w,
|
|
1183
1189
|
isPlaying: r,
|
|
1184
|
-
isLoading:
|
|
1190
|
+
isLoading: o,
|
|
1185
1191
|
error: c
|
|
1186
1192
|
};
|
|
1187
1193
|
}, Xe = ({ className: i = "" }) => {
|
|
1188
|
-
const r =
|
|
1189
|
-
return
|
|
1194
|
+
const r = S(null);
|
|
1195
|
+
return P(() => {
|
|
1190
1196
|
let e = null;
|
|
1191
1197
|
return (async () => {
|
|
1192
1198
|
try {
|
|
@@ -1205,28 +1211,28 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1205
1211
|
{
|
|
1206
1212
|
ref: r,
|
|
1207
1213
|
autoPlay: !0,
|
|
1214
|
+
playsInline: !0,
|
|
1208
1215
|
muted: !0,
|
|
1209
|
-
hidden: !0,
|
|
1210
1216
|
className: "iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-md iw-min-h-[400px] iw-max-h-[600px] iw-aspect-video",
|
|
1211
1217
|
style: {
|
|
1212
1218
|
transform: "scaleX(-1)"
|
|
1213
1219
|
}
|
|
1214
1220
|
}
|
|
1215
1221
|
) });
|
|
1216
|
-
},
|
|
1217
|
-
const { baseColor: r, borderRadius: e } =
|
|
1222
|
+
}, Z = (i) => {
|
|
1223
|
+
const { baseColor: r, borderRadius: e } = W(), { loading: o, children: s, ...c } = i;
|
|
1218
1224
|
return /* @__PURE__ */ t.jsx(
|
|
1219
|
-
|
|
1225
|
+
se,
|
|
1220
1226
|
{
|
|
1221
1227
|
style: {
|
|
1222
|
-
background:
|
|
1228
|
+
background: ge(r),
|
|
1223
1229
|
borderRadius: e
|
|
1224
1230
|
},
|
|
1225
1231
|
...c,
|
|
1226
|
-
children:
|
|
1232
|
+
children: o ? /* @__PURE__ */ t.jsx(he, {}) : s
|
|
1227
1233
|
}
|
|
1228
1234
|
);
|
|
1229
|
-
},
|
|
1235
|
+
}, ne = (i) => /* @__PURE__ */ t.jsxs(
|
|
1230
1236
|
"svg",
|
|
1231
1237
|
{
|
|
1232
1238
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1248,27 +1254,27 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1248
1254
|
/* @__PURE__ */ t.jsx("path", { d: "M8.644 21.42a10 10 0 0 0 7.631-.38" })
|
|
1249
1255
|
]
|
|
1250
1256
|
}
|
|
1251
|
-
), Ze = (i, r, e) => Math.max(r, Math.min(e, i)),
|
|
1252
|
-
const r = Math.max(0, Math.floor(i)), e = Math.floor(r / 60).toString().padStart(2, "0"),
|
|
1253
|
-
return `${e}:${
|
|
1254
|
-
},
|
|
1257
|
+
), Ze = (i, r, e) => Math.max(r, Math.min(e, i)), le = (i) => {
|
|
1258
|
+
const r = Math.max(0, Math.floor(i)), e = Math.floor(r / 60).toString().padStart(2, "0"), o = (r % 60).toString().padStart(2, "0");
|
|
1259
|
+
return `${e}:${o}`;
|
|
1260
|
+
}, oe = ({
|
|
1255
1261
|
total: i,
|
|
1256
1262
|
remaining: r,
|
|
1257
1263
|
size: e = 64,
|
|
1258
|
-
strokeWidth:
|
|
1264
|
+
strokeWidth: o = 6,
|
|
1259
1265
|
className: s = "",
|
|
1260
1266
|
showLabel: c = !0
|
|
1261
1267
|
}) => {
|
|
1262
|
-
const a = Math.max(1, i || 1),
|
|
1263
|
-
const
|
|
1264
|
-
return { radius:
|
|
1265
|
-
}, [e,
|
|
1268
|
+
const a = Math.max(1, i || 1), n = Ze(r / a, 0, 1), { radius: w, circumference: m, dashOffset: d, center: h } = V(() => {
|
|
1269
|
+
const y = (e - o) / 2, k = 2 * Math.PI * y, j = k * (1 - n), l = Math.round(o) % 2 === 1, p = e / 2 + (l ? 0.5 : 0);
|
|
1270
|
+
return { radius: y, circumference: k, dashOffset: j, center: p };
|
|
1271
|
+
}, [e, o, n]), u = V(() => n <= 0.25 ? "iw-stroke-red-500" : n <= 0.5 ? "iw-stroke-yellow-500" : "iw-stroke-green-500", [n]), g = n <= 0.25 ? "iw-animate-pulse" : "";
|
|
1266
1272
|
return /* @__PURE__ */ t.jsxs(
|
|
1267
1273
|
"div",
|
|
1268
1274
|
{
|
|
1269
1275
|
className: `iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${s}`,
|
|
1270
1276
|
style: { width: e, height: e },
|
|
1271
|
-
"aria-label": `Time remaining ${
|
|
1277
|
+
"aria-label": `Time remaining ${le(r)}`,
|
|
1272
1278
|
role: "timer",
|
|
1273
1279
|
"aria-live": "polite",
|
|
1274
1280
|
children: [
|
|
@@ -1287,7 +1293,7 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1287
1293
|
cy: h,
|
|
1288
1294
|
r: w,
|
|
1289
1295
|
className: "iw-stroke-gray-200",
|
|
1290
|
-
strokeWidth:
|
|
1296
|
+
strokeWidth: o,
|
|
1291
1297
|
fill: "none",
|
|
1292
1298
|
shapeRendering: "geometricPrecision",
|
|
1293
1299
|
vectorEffect: "non-scaling-stroke"
|
|
@@ -1299,11 +1305,11 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1299
1305
|
cx: h,
|
|
1300
1306
|
cy: h,
|
|
1301
1307
|
r: w,
|
|
1302
|
-
className: `${u} ${
|
|
1303
|
-
strokeWidth:
|
|
1308
|
+
className: `${u} ${g}`,
|
|
1309
|
+
strokeWidth: o,
|
|
1304
1310
|
strokeLinecap: "round",
|
|
1305
1311
|
fill: "none",
|
|
1306
|
-
strokeDasharray:
|
|
1312
|
+
strokeDasharray: m,
|
|
1307
1313
|
strokeDashoffset: d,
|
|
1308
1314
|
shapeRendering: "geometricPrecision",
|
|
1309
1315
|
vectorEffect: "non-scaling-stroke",
|
|
@@ -1318,8 +1324,8 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1318
1324
|
c && /* @__PURE__ */ t.jsx("div", { className: "iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0", children: /* @__PURE__ */ t.jsx(
|
|
1319
1325
|
"span",
|
|
1320
1326
|
{
|
|
1321
|
-
className: `iw-text-[11px] iw-font-semibold iw-tabular-nums ${
|
|
1322
|
-
children:
|
|
1327
|
+
className: `iw-text-[11px] iw-font-semibold iw-tabular-nums ${n <= 0.25 ? "iw-text-red-600" : n <= 0.5 ? "iw-text-yellow-600" : "iw-text-green-600"}`,
|
|
1328
|
+
children: le(r)
|
|
1323
1329
|
}
|
|
1324
1330
|
) })
|
|
1325
1331
|
]
|
|
@@ -1329,11 +1335,11 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1329
1335
|
label: i,
|
|
1330
1336
|
error: r,
|
|
1331
1337
|
fullWidth: e = !1,
|
|
1332
|
-
className:
|
|
1338
|
+
className: o = "",
|
|
1333
1339
|
id: s,
|
|
1334
1340
|
...c
|
|
1335
1341
|
}) => {
|
|
1336
|
-
const a = s || `textarea-${Math.random().toString(36).substring(2, 9)}`,
|
|
1342
|
+
const a = s || `textarea-${Math.random().toString(36).substring(2, 9)}`, n = "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", w = r ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", m = e ? "iw-w-full" : "", d = o.includes("iw-h-full") || e ? "iw-h-full" : "";
|
|
1337
1343
|
return /* @__PURE__ */ t.jsxs(
|
|
1338
1344
|
"div",
|
|
1339
1345
|
{
|
|
@@ -1351,7 +1357,7 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1351
1357
|
"textarea",
|
|
1352
1358
|
{
|
|
1353
1359
|
id: a,
|
|
1354
|
-
className: `${
|
|
1360
|
+
className: `${n} ${w} ${m} ${d} ${o}`,
|
|
1355
1361
|
"aria-invalid": r ? "true" : "false",
|
|
1356
1362
|
...c
|
|
1357
1363
|
}
|
|
@@ -1364,23 +1370,23 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1364
1370
|
value: i,
|
|
1365
1371
|
onChange: r,
|
|
1366
1372
|
onSubmit: e,
|
|
1367
|
-
isSubmitDisabled:
|
|
1373
|
+
isSubmitDisabled: o,
|
|
1368
1374
|
state: s,
|
|
1369
1375
|
editingTime: c
|
|
1370
1376
|
}) => {
|
|
1371
|
-
const a = (
|
|
1372
|
-
|
|
1377
|
+
const a = (n) => {
|
|
1378
|
+
n.key === "Enter" && (n.ctrlKey || n.metaKey) && !o && (n.preventDefault(), e());
|
|
1373
1379
|
};
|
|
1374
1380
|
return /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-h-full ", children: [
|
|
1375
1381
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
|
|
1376
1382
|
/* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Your Answer" }),
|
|
1377
1383
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
1378
1384
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
1379
|
-
/* @__PURE__ */ t.jsx(
|
|
1385
|
+
/* @__PURE__ */ t.jsx(ne, { className: "iw-size-4 iw-text-orange-600" }),
|
|
1380
1386
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to edit: " })
|
|
1381
1387
|
] }),
|
|
1382
1388
|
/* @__PURE__ */ t.jsx(
|
|
1383
|
-
|
|
1389
|
+
oe,
|
|
1384
1390
|
{
|
|
1385
1391
|
total: c,
|
|
1386
1392
|
remaining: s.currentPhaseTimeRemaining,
|
|
@@ -1399,38 +1405,38 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1399
1405
|
onKeyDown: a,
|
|
1400
1406
|
placeholder: "Type your answer here...",
|
|
1401
1407
|
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",
|
|
1402
|
-
onPaste: (
|
|
1403
|
-
onCopy: (
|
|
1404
|
-
onCut: (
|
|
1405
|
-
onDrop: (
|
|
1406
|
-
onDragOver: (
|
|
1408
|
+
onPaste: (n) => n.preventDefault(),
|
|
1409
|
+
onCopy: (n) => n.preventDefault(),
|
|
1410
|
+
onCut: (n) => n.preventDefault(),
|
|
1411
|
+
onDrop: (n) => n.preventDefault(),
|
|
1412
|
+
onDragOver: (n) => n.preventDefault()
|
|
1407
1413
|
}
|
|
1408
1414
|
),
|
|
1409
|
-
/* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1 iw-mt-4", children: /* @__PURE__ */ t.jsx(
|
|
1415
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1 iw-mt-4", children: /* @__PURE__ */ t.jsx(Z, { onClick: e, disabled: o, children: "Submit Answer" }) })
|
|
1410
1416
|
] })
|
|
1411
1417
|
] });
|
|
1412
1418
|
}, tt = ({
|
|
1413
1419
|
className: i = "",
|
|
1414
1420
|
width: r,
|
|
1415
1421
|
height: e = 56,
|
|
1416
|
-
barWidth:
|
|
1422
|
+
barWidth: o = 3,
|
|
1417
1423
|
gap: s = 2,
|
|
1418
1424
|
fftSize: c = 1024,
|
|
1419
1425
|
smoothingTimeConstant: a = 0.8,
|
|
1420
|
-
mediaStream:
|
|
1426
|
+
mediaStream: n,
|
|
1421
1427
|
startOnMount: w = !0
|
|
1422
1428
|
}) => {
|
|
1423
|
-
const { baseColor:
|
|
1424
|
-
|
|
1429
|
+
const { baseColor: m } = W(), d = S(null), h = S(null), u = S(null), g = S(null), y = S(null), k = S(null), j = S(!1), [l, p] = T(null);
|
|
1430
|
+
P(() => {
|
|
1425
1431
|
if (r || !h.current) return;
|
|
1426
|
-
const b = h.current,
|
|
1427
|
-
const
|
|
1428
|
-
if (!
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1431
|
-
}, x = new ResizeObserver(
|
|
1432
|
-
return x.observe(b),
|
|
1433
|
-
}, [r, e]),
|
|
1432
|
+
const b = h.current, _ = () => {
|
|
1433
|
+
const N = d.current;
|
|
1434
|
+
if (!N) return;
|
|
1435
|
+
const C = b.clientWidth, M = e;
|
|
1436
|
+
N.width = Math.max(1, Math.floor(C * window.devicePixelRatio || 1)), N.height = Math.max(1, Math.floor(M * window.devicePixelRatio || 1));
|
|
1437
|
+
}, x = new ResizeObserver(_);
|
|
1438
|
+
return x.observe(b), _(), () => x.disconnect();
|
|
1439
|
+
}, [r, e]), P(() => {
|
|
1434
1440
|
if (!r) return;
|
|
1435
1441
|
const b = d.current;
|
|
1436
1442
|
b && (b.width = Math.max(
|
|
@@ -1440,58 +1446,58 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1440
1446
|
1,
|
|
1441
1447
|
Math.floor(e * (window.devicePixelRatio || 1))
|
|
1442
1448
|
));
|
|
1443
|
-
}, [r, e]),
|
|
1449
|
+
}, [r, e]), P(() => {
|
|
1444
1450
|
let b = !1;
|
|
1445
1451
|
return (async () => {
|
|
1446
1452
|
try {
|
|
1447
1453
|
const x = new (window.AudioContext || window.webkitAudioContext)();
|
|
1448
1454
|
u.current = x;
|
|
1449
|
-
let
|
|
1450
|
-
if (!
|
|
1455
|
+
let N = n;
|
|
1456
|
+
if (!N) {
|
|
1451
1457
|
if (!w) return;
|
|
1452
|
-
|
|
1458
|
+
N = await navigator.mediaDevices.getUserMedia({
|
|
1453
1459
|
audio: !0,
|
|
1454
1460
|
video: !1
|
|
1455
1461
|
}), j.current = !0;
|
|
1456
1462
|
}
|
|
1457
1463
|
if (b) return;
|
|
1458
|
-
const
|
|
1459
|
-
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1464
|
+
const C = x.createAnalyser();
|
|
1465
|
+
C.fftSize = c, C.smoothingTimeConstant = a, g.current = C;
|
|
1466
|
+
const M = x.createMediaStreamSource(N);
|
|
1467
|
+
y.current = M, M.connect(C), I();
|
|
1462
1468
|
} catch (x) {
|
|
1463
|
-
|
|
1469
|
+
p((x == null ? void 0 : x.message) || "Failed to initialize microphone");
|
|
1464
1470
|
}
|
|
1465
1471
|
})(), () => {
|
|
1466
|
-
var x,
|
|
1467
|
-
b = !0,
|
|
1472
|
+
var x, N, C, M;
|
|
1473
|
+
b = !0, k.current && cancelAnimationFrame(k.current);
|
|
1468
1474
|
try {
|
|
1469
|
-
(x =
|
|
1475
|
+
(x = y.current) == null || x.disconnect();
|
|
1470
1476
|
} catch {
|
|
1471
1477
|
}
|
|
1472
1478
|
try {
|
|
1473
|
-
(
|
|
1479
|
+
(N = g.current) == null || N.disconnect();
|
|
1474
1480
|
} catch {
|
|
1475
1481
|
}
|
|
1476
|
-
j.current && ((
|
|
1482
|
+
j.current && ((M = ((C = y.current) == null ? void 0 : C.mediaStream) || void 0) == null || M.getTracks().forEach((q) => q.stop())), u.current && u.current.state !== "closed" && u.current.close();
|
|
1477
1483
|
};
|
|
1478
|
-
}, [
|
|
1479
|
-
const
|
|
1480
|
-
const b = d.current,
|
|
1481
|
-
if (!b || !
|
|
1484
|
+
}, [n, c, a, w]);
|
|
1485
|
+
const I = () => {
|
|
1486
|
+
const b = d.current, _ = g.current;
|
|
1487
|
+
if (!b || !_) return;
|
|
1482
1488
|
const x = b.getContext("2d");
|
|
1483
1489
|
if (!x) return;
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
const
|
|
1487
|
-
for (let
|
|
1488
|
-
const ee = Math.min(
|
|
1489
|
-
x.fillStyle = `${
|
|
1490
|
-
const ye = Math.min(
|
|
1491
|
-
rt(x,
|
|
1490
|
+
const N = window.devicePixelRatio || 1, C = b.width, M = b.height, q = _.frequencyBinCount, U = new Uint8Array(q), L = () => {
|
|
1491
|
+
k.current = requestAnimationFrame(L), _.getByteTimeDomainData(U), x.clearRect(0, 0, C, M), x.fillStyle = "rgba(0,0,0,0)", x.fillRect(0, 0, C, M);
|
|
1492
|
+
const O = Math.max(1, Math.floor(o * N)), E = Math.max(1, Math.floor(s * N)), B = O + E, H = Math.max(8, Math.floor((C + E) / B)), K = Math.floor(U.length / H);
|
|
1493
|
+
for (let z = 0; z < H; z++) {
|
|
1494
|
+
const ee = Math.min(U.length - 1, z * K), te = U[ee] / 128 - 1, G = Math.abs(te), re = Math.pow(G, 0.6), f = Math.max(M * 0.06, re * (M * 0.9)), F = z * B, Y = (M - f) / 2, xe = 140 - Math.min(140, 140 * G), pe = 85, be = 48 + Math.floor(12 * (1 - G));
|
|
1495
|
+
x.fillStyle = `${m}`, x.shadowColor = `hsla(${xe}, ${pe}%, ${be}%, ${0.25 * G})`, x.shadowBlur = 8 * G;
|
|
1496
|
+
const ye = Math.min(O / 2, f / 2);
|
|
1497
|
+
rt(x, F, Y, O, f, ye), x.fill();
|
|
1492
1498
|
}
|
|
1493
1499
|
};
|
|
1494
|
-
|
|
1500
|
+
L();
|
|
1495
1501
|
};
|
|
1496
1502
|
return /* @__PURE__ */ t.jsxs(
|
|
1497
1503
|
"div",
|
|
@@ -1506,26 +1512,26 @@ const re = new Ve(), Je = (i = {}) => {
|
|
|
1506
1512
|
}
|
|
1507
1513
|
);
|
|
1508
1514
|
};
|
|
1509
|
-
function rt(i, r, e,
|
|
1510
|
-
const a = Math.min(c,
|
|
1511
|
-
i.beginPath(), i.moveTo(r + a, e), i.lineTo(r +
|
|
1515
|
+
function rt(i, r, e, o, s, c) {
|
|
1516
|
+
const a = Math.min(c, o / 2, s / 2);
|
|
1517
|
+
i.beginPath(), i.moveTo(r + a, e), i.lineTo(r + o - a, e), i.quadraticCurveTo(r + o, e, r + o, e + a), i.lineTo(r + o, e + s - a), i.quadraticCurveTo(r + o, e + s, r + o - a, e + s), i.lineTo(r + a, e + s), i.quadraticCurveTo(r, e + s, r, e + s - a), i.lineTo(r, e + a), i.quadraticCurveTo(r, e, r + a, e), i.closePath();
|
|
1512
1518
|
}
|
|
1513
1519
|
const it = ({
|
|
1514
1520
|
state: i,
|
|
1515
1521
|
answeringTime: r,
|
|
1516
1522
|
nextPhase: e,
|
|
1517
|
-
sttError:
|
|
1523
|
+
sttError: o
|
|
1518
1524
|
}) => /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-justify-between iw-h-full ", children: [
|
|
1519
1525
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1520
1526
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
|
|
1521
1527
|
/* @__PURE__ */ t.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...." }),
|
|
1522
1528
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
1523
1529
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
1524
|
-
/* @__PURE__ */ t.jsx(
|
|
1530
|
+
/* @__PURE__ */ t.jsx(ne, { className: "iw-size-4 iw-text-orange-600" }),
|
|
1525
1531
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to talk: " })
|
|
1526
1532
|
] }),
|
|
1527
1533
|
/* @__PURE__ */ t.jsx(
|
|
1528
|
-
|
|
1534
|
+
oe,
|
|
1529
1535
|
{
|
|
1530
1536
|
total: r,
|
|
1531
1537
|
remaining: i.currentPhaseTimeRemaining,
|
|
@@ -1539,13 +1545,13 @@ const it = ({
|
|
|
1539
1545
|
] }),
|
|
1540
1546
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1541
1547
|
/* @__PURE__ */ t.jsx(tt, {}),
|
|
1542
|
-
|
|
1548
|
+
o && /* @__PURE__ */ t.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
|
|
1543
1549
|
"Recording error: ",
|
|
1544
|
-
|
|
1550
|
+
o.message
|
|
1545
1551
|
] })
|
|
1546
1552
|
] }),
|
|
1547
1553
|
/* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ t.jsx(
|
|
1548
|
-
|
|
1554
|
+
Z,
|
|
1549
1555
|
{
|
|
1550
1556
|
onClick: () => {
|
|
1551
1557
|
e();
|
|
@@ -1555,18 +1561,18 @@ const it = ({
|
|
|
1555
1561
|
) })
|
|
1556
1562
|
] });
|
|
1557
1563
|
function st() {
|
|
1558
|
-
const [i, r] =
|
|
1559
|
-
() => [0, 1, 2].map((
|
|
1564
|
+
const [i, r] = T(!0), e = V(
|
|
1565
|
+
() => [0, 1, 2].map((o) => ({ id: o })),
|
|
1560
1566
|
[]
|
|
1561
1567
|
);
|
|
1562
|
-
return
|
|
1563
|
-
const
|
|
1568
|
+
return P(() => {
|
|
1569
|
+
const o = setInterval(() => {
|
|
1564
1570
|
r((s) => !s);
|
|
1565
1571
|
}, 1500);
|
|
1566
|
-
return () => clearInterval(
|
|
1572
|
+
return () => clearInterval(o);
|
|
1567
1573
|
}, []), /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-h-full", children: [
|
|
1568
|
-
/* @__PURE__ */ t.jsx("div", { className: "iw-relative iw-w-80 iw-h-48 ", "aria-hidden": !0, children: e.map((
|
|
1569
|
-
const c = s * 50, a = i ? c : c + 12,
|
|
1574
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-relative iw-w-80 iw-h-48 ", "aria-hidden": !0, children: e.map((o, s) => {
|
|
1575
|
+
const c = s * 50, a = i ? c : c + 12, n = i ? 1 : 0.08, w = s * 140;
|
|
1570
1576
|
return /* @__PURE__ */ t.jsx(
|
|
1571
1577
|
"div",
|
|
1572
1578
|
{
|
|
@@ -1575,7 +1581,7 @@ function st() {
|
|
|
1575
1581
|
style: {
|
|
1576
1582
|
top: 0,
|
|
1577
1583
|
transform: `translateY(${a}px)`,
|
|
1578
|
-
opacity:
|
|
1584
|
+
opacity: n,
|
|
1579
1585
|
transition: `transform 600ms cubic-bezier(.2,.9,.3,1) ${w}ms, opacity 400ms ease ${w}ms`
|
|
1580
1586
|
},
|
|
1581
1587
|
children: /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-gap-3 iw-items-center", children: [
|
|
@@ -1586,34 +1592,34 @@ function st() {
|
|
|
1586
1592
|
] })
|
|
1587
1593
|
] })
|
|
1588
1594
|
},
|
|
1589
|
-
|
|
1595
|
+
o.id
|
|
1590
1596
|
);
|
|
1591
1597
|
}) }),
|
|
1592
1598
|
/* @__PURE__ */ t.jsx("div", { className: "iw-text-center", children: /* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-500 iw-font-medium", children: "Preparing your question..." }) })
|
|
1593
1599
|
] });
|
|
1594
1600
|
}
|
|
1595
|
-
const
|
|
1601
|
+
const fe = ({
|
|
1596
1602
|
isOpen: i,
|
|
1597
1603
|
onClose: r,
|
|
1598
1604
|
children: e,
|
|
1599
|
-
title:
|
|
1605
|
+
title: o,
|
|
1600
1606
|
showCloseButton: s = !0,
|
|
1601
1607
|
closeOnOverlayClick: c = !0,
|
|
1602
1608
|
closeOnEscape: a = !0,
|
|
1603
|
-
className:
|
|
1609
|
+
className: n = ""
|
|
1604
1610
|
}) => {
|
|
1605
|
-
if (
|
|
1611
|
+
if (P(() => {
|
|
1606
1612
|
if (!i || !a) return;
|
|
1607
1613
|
const d = (h) => {
|
|
1608
1614
|
h.key === "Escape" && r();
|
|
1609
1615
|
};
|
|
1610
1616
|
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
1611
|
-
}, [i, a, r]),
|
|
1617
|
+
}, [i, a, r]), P(() => (i ? (document.body.style.overflow = "hidden", document.body.classList.add("interview-widget-container")) : (document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container")), () => {
|
|
1612
1618
|
document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container");
|
|
1613
1619
|
}), [i]), !i) return null;
|
|
1614
1620
|
const w = (d) => {
|
|
1615
1621
|
c && d.target === d.currentTarget && r();
|
|
1616
|
-
},
|
|
1622
|
+
}, m = /* @__PURE__ */ t.jsxs("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center", children: [
|
|
1617
1623
|
/* @__PURE__ */ t.jsx(
|
|
1618
1624
|
"div",
|
|
1619
1625
|
{
|
|
@@ -1624,18 +1630,18 @@ const ge = ({
|
|
|
1624
1630
|
/* @__PURE__ */ t.jsxs(
|
|
1625
1631
|
"div",
|
|
1626
1632
|
{
|
|
1627
|
-
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 ${
|
|
1633
|
+
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 ${n}`,
|
|
1628
1634
|
role: "dialog",
|
|
1629
1635
|
"aria-modal": "true",
|
|
1630
|
-
"aria-labelledby":
|
|
1636
|
+
"aria-labelledby": o ? "dialog-title" : void 0,
|
|
1631
1637
|
children: [
|
|
1632
|
-
(
|
|
1633
|
-
|
|
1638
|
+
(o || s) && /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-p-4 iw-border-b iw-border-gray-200", children: [
|
|
1639
|
+
o && /* @__PURE__ */ t.jsx(
|
|
1634
1640
|
"h2",
|
|
1635
1641
|
{
|
|
1636
1642
|
id: "dialog-title",
|
|
1637
1643
|
className: "iw-text-lg iw-font-semibold iw-text-gray-900",
|
|
1638
|
-
children:
|
|
1644
|
+
children: o
|
|
1639
1645
|
}
|
|
1640
1646
|
),
|
|
1641
1647
|
s && /* @__PURE__ */ t.jsx(
|
|
@@ -1670,12 +1676,12 @@ const ge = ({
|
|
|
1670
1676
|
}
|
|
1671
1677
|
)
|
|
1672
1678
|
] });
|
|
1673
|
-
return ke(
|
|
1679
|
+
return ke(m, document.body);
|
|
1674
1680
|
}, at = ({
|
|
1675
1681
|
open: i,
|
|
1676
1682
|
onClose: r
|
|
1677
1683
|
}) => /* @__PURE__ */ t.jsx(
|
|
1678
|
-
|
|
1684
|
+
fe,
|
|
1679
1685
|
{
|
|
1680
1686
|
isOpen: i,
|
|
1681
1687
|
onClose: r || (() => {
|
|
@@ -1701,22 +1707,14 @@ const ge = ({
|
|
|
1701
1707
|
)
|
|
1702
1708
|
}
|
|
1703
1709
|
),
|
|
1704
|
-
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-600 iw-mb-6", children: "Thank you for your time. Your answers have been recorded and submitted for review." })
|
|
1705
|
-
/* @__PURE__ */ t.jsx(
|
|
1706
|
-
W,
|
|
1707
|
-
{
|
|
1708
|
-
className: "iw-mt-2 iw-px-6 iw-py-2 iw-bg-primary-500 iw-text-white iw-font-semibold iw-rounded-lg iw-shadow iw-transition hover:iw-bg-primary-600 focus:iw-outline-none",
|
|
1709
|
-
onClick: r,
|
|
1710
|
-
children: "Close"
|
|
1711
|
-
}
|
|
1712
|
-
)
|
|
1710
|
+
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-600 iw-mb-6", children: "Thank you for your time. Your answers have been recorded and submitted for review." })
|
|
1713
1711
|
] })
|
|
1714
1712
|
}
|
|
1715
1713
|
), nt = ({
|
|
1716
1714
|
size: i = "192px",
|
|
1717
1715
|
className: r,
|
|
1718
1716
|
colors: e,
|
|
1719
|
-
animationDuration:
|
|
1717
|
+
animationDuration: o = 20
|
|
1720
1718
|
}) => {
|
|
1721
1719
|
const c = { ...{
|
|
1722
1720
|
bg: "oklch(95% 0.02 264.695)",
|
|
@@ -1726,7 +1724,7 @@ const ge = ({
|
|
|
1726
1724
|
// Pastel blue
|
|
1727
1725
|
c3: "oklch(78% 0.14 280)"
|
|
1728
1726
|
// Pastel purple/lavender
|
|
1729
|
-
}, ...e }, a = parseInt(i.replace("px", ""), 10),
|
|
1727
|
+
}, ...e }, a = parseInt(i.replace("px", ""), 10), n = a < 50 ? Math.max(a * 8e-3, 1) : Math.max(a * 0.015, 4), w = a < 50 ? Math.max(a * 4e-3, 1.2) : Math.max(a * 8e-3, 1.5), m = a < 50 ? Math.max(a * 4e-3, 0.05) : Math.max(a * 8e-3, 0.1), d = a < 50 ? Math.max(a * 4e-3, 0.5) : Math.max(a * 8e-3, 2), h = a < 30 ? "0%" : a < 50 ? "5%" : a < 100 ? "15%" : "25%", u = a < 30 ? 1.1 : a < 50 ? Math.max(w * 1.2, 1.3) : w;
|
|
1730
1728
|
return /* @__PURE__ */ t.jsx(
|
|
1731
1729
|
"div",
|
|
1732
1730
|
{
|
|
@@ -1738,10 +1736,10 @@ const ge = ({
|
|
|
1738
1736
|
"--c1": c.c1,
|
|
1739
1737
|
"--c2": c.c2,
|
|
1740
1738
|
"--c3": c.c3,
|
|
1741
|
-
"--animation-duration": `${
|
|
1742
|
-
"--blur-amount": `${
|
|
1739
|
+
"--animation-duration": `${o}s`,
|
|
1740
|
+
"--blur-amount": `${n}px`,
|
|
1743
1741
|
"--contrast-amount": u,
|
|
1744
|
-
"--dot-size": `${
|
|
1742
|
+
"--dot-size": `${m}px`,
|
|
1745
1743
|
"--shadow-spread": `${d}px`,
|
|
1746
1744
|
"--mask-radius": h
|
|
1747
1745
|
},
|
|
@@ -1871,11 +1869,11 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1871
1869
|
] }),
|
|
1872
1870
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
1873
1871
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
1874
|
-
/* @__PURE__ */ t.jsx(
|
|
1872
|
+
/* @__PURE__ */ t.jsx(ne, { className: "iw-size-4 iw-text-orange-600" }),
|
|
1875
1873
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to think: " })
|
|
1876
1874
|
] }),
|
|
1877
1875
|
/* @__PURE__ */ t.jsx(
|
|
1878
|
-
|
|
1876
|
+
oe,
|
|
1879
1877
|
{
|
|
1880
1878
|
total: r,
|
|
1881
1879
|
remaining: i.currentPhaseTimeRemaining,
|
|
@@ -1885,7 +1883,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1885
1883
|
)
|
|
1886
1884
|
] }),
|
|
1887
1885
|
/* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ t.jsx(
|
|
1888
|
-
|
|
1886
|
+
Z,
|
|
1889
1887
|
{
|
|
1890
1888
|
onClick: () => {
|
|
1891
1889
|
e();
|
|
@@ -1960,7 +1958,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1960
1958
|
question: i,
|
|
1961
1959
|
isLoading: r = !1
|
|
1962
1960
|
}) => {
|
|
1963
|
-
const { baseColor: e } =
|
|
1961
|
+
const { baseColor: e } = W();
|
|
1964
1962
|
return /* @__PURE__ */ t.jsx(
|
|
1965
1963
|
"div",
|
|
1966
1964
|
{
|
|
@@ -1988,7 +1986,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1988
1986
|
confirmExitInterview: i,
|
|
1989
1987
|
isOpen: r,
|
|
1990
1988
|
onClose: e
|
|
1991
|
-
}) => /* @__PURE__ */ t.jsx(
|
|
1989
|
+
}) => /* @__PURE__ */ t.jsx(fe, { isOpen: r, onClose: e, title: "Exit Interview", children: /* @__PURE__ */ t.jsxs("div", { className: "iw-space-y-4", children: [
|
|
1992
1990
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-base iw-text-gray-700", children: "Are you sure you want to exit the interview? All progress will be lost and you will not be able to resume." }),
|
|
1993
1991
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-justify-end iw-space-x-2", children: [
|
|
1994
1992
|
/* @__PURE__ */ t.jsx(
|
|
@@ -2009,7 +2007,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2009
2007
|
)
|
|
2010
2008
|
] })
|
|
2011
2009
|
] }) }), ht = ({ title: i, onExit: r }) => {
|
|
2012
|
-
const { baseColor: e } =
|
|
2010
|
+
const { baseColor: e } = W(), [o, s] = T(!1);
|
|
2013
2011
|
return /* @__PURE__ */ t.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
|
|
2014
2012
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3", children: [
|
|
2015
2013
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
|
|
@@ -2037,7 +2035,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2037
2035
|
/* @__PURE__ */ t.jsx(
|
|
2038
2036
|
ut,
|
|
2039
2037
|
{
|
|
2040
|
-
isOpen:
|
|
2038
|
+
isOpen: o,
|
|
2041
2039
|
confirmExitInterview: () => {
|
|
2042
2040
|
r(), s(!1);
|
|
2043
2041
|
},
|
|
@@ -2050,71 +2048,73 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2050
2048
|
onComplete: r,
|
|
2051
2049
|
className: e = ""
|
|
2052
2050
|
}) => {
|
|
2053
|
-
const
|
|
2054
|
-
thinkingTime: (
|
|
2055
|
-
answeringTime: (
|
|
2056
|
-
editingTime: (
|
|
2057
|
-
}, { thinkingTime:
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
}, [
|
|
2061
|
-
const
|
|
2051
|
+
const o = We(), { baseUrl: s, authToken: c } = Se(), { timers: a, stt: n, tts: w } = Ce(), [m, d] = T(null), [h, u] = T(""), g = S(""), y = S(null), k = {
|
|
2052
|
+
thinkingTime: (a == null ? void 0 : a.thinkingDuration) || 30,
|
|
2053
|
+
answeringTime: (a == null ? void 0 : a.answeringDuration) || 120,
|
|
2054
|
+
editingTime: (a == null ? void 0 : a.editingDuration) || 30
|
|
2055
|
+
}, { thinkingTime: j, answeringTime: l, editingTime: p } = k;
|
|
2056
|
+
P(() => {
|
|
2057
|
+
g.current = h;
|
|
2058
|
+
}, [h]);
|
|
2059
|
+
const I = S(!1), { speak: b, error: _ } = Je({
|
|
2062
2060
|
config: {
|
|
2063
2061
|
baseUrl: s,
|
|
2064
|
-
provider:
|
|
2062
|
+
provider: w == null ? void 0 : w.provider,
|
|
2063
|
+
authToken: c
|
|
2065
2064
|
},
|
|
2066
2065
|
onEnd: () => {
|
|
2067
|
-
|
|
2066
|
+
I.current = !1, E();
|
|
2068
2067
|
},
|
|
2069
2068
|
onError: () => {
|
|
2070
|
-
|
|
2069
|
+
I.current || (I.current = !0, E());
|
|
2071
2070
|
}
|
|
2072
|
-
}),
|
|
2073
|
-
startRecording:
|
|
2074
|
-
stopRecording:
|
|
2075
|
-
transcribe:
|
|
2076
|
-
error:
|
|
2071
|
+
}), x = S(!1), N = S(!1), {
|
|
2072
|
+
startRecording: C,
|
|
2073
|
+
stopRecording: M,
|
|
2074
|
+
transcribe: q,
|
|
2075
|
+
error: U
|
|
2077
2076
|
} = Ye({
|
|
2078
2077
|
config: {
|
|
2079
2078
|
baseUrl: s,
|
|
2080
|
-
provider:
|
|
2081
|
-
model:
|
|
2082
|
-
language:
|
|
2079
|
+
provider: n == null ? void 0 : n.provider,
|
|
2080
|
+
model: n == null ? void 0 : n.model,
|
|
2081
|
+
language: n == null ? void 0 : n.language,
|
|
2082
|
+
authToken: c
|
|
2083
2083
|
},
|
|
2084
2084
|
onStart: () => {
|
|
2085
|
-
|
|
2085
|
+
x.current = !1, N.current = !1;
|
|
2086
2086
|
},
|
|
2087
2087
|
onStop: () => {
|
|
2088
2088
|
},
|
|
2089
|
-
onTranscriptionComplete: (
|
|
2090
|
-
|
|
2089
|
+
onTranscriptionComplete: (f) => {
|
|
2090
|
+
u(f.transcript), N.current || (N.current = !0, E());
|
|
2091
2091
|
},
|
|
2092
|
-
onError: (
|
|
2093
|
-
console.error("STT Error:",
|
|
2092
|
+
onError: (f) => {
|
|
2093
|
+
console.error("STT Error:", f), x.current || (x.current = !0, E());
|
|
2094
2094
|
}
|
|
2095
|
-
}), { state:
|
|
2095
|
+
}), { state: L, startQuestion: O, nextPhase: E, completeInterview: B } = Ge({
|
|
2096
2096
|
config: {
|
|
2097
|
-
thinkingDuration:
|
|
2098
|
-
answeringDuration:
|
|
2099
|
-
editingDuration:
|
|
2097
|
+
thinkingDuration: j,
|
|
2098
|
+
answeringDuration: l,
|
|
2099
|
+
editingDuration: p
|
|
2100
2100
|
},
|
|
2101
2101
|
callbacks: {
|
|
2102
|
-
onPhaseChange: (
|
|
2103
|
-
switch (
|
|
2104
|
-
case
|
|
2102
|
+
onPhaseChange: (f) => {
|
|
2103
|
+
switch (f) {
|
|
2104
|
+
case R.FETCHING_QUESTION:
|
|
2105
2105
|
H();
|
|
2106
2106
|
break;
|
|
2107
|
-
case
|
|
2108
|
-
B();
|
|
2109
|
-
break;
|
|
2110
|
-
case I.ANSWERING:
|
|
2107
|
+
case R.READING_QUESTION:
|
|
2111
2108
|
ee();
|
|
2112
2109
|
break;
|
|
2113
|
-
case
|
|
2110
|
+
case R.ANSWERING:
|
|
2114
2111
|
te();
|
|
2115
2112
|
break;
|
|
2116
|
-
case
|
|
2117
|
-
|
|
2113
|
+
case R.TRANSCRIBING:
|
|
2114
|
+
G();
|
|
2115
|
+
break;
|
|
2116
|
+
case R.SUBMITTING:
|
|
2117
|
+
z();
|
|
2118
2118
|
break;
|
|
2119
2119
|
}
|
|
2120
2120
|
},
|
|
@@ -2123,101 +2123,101 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
2125
|
});
|
|
2126
|
-
|
|
2127
|
-
|
|
2126
|
+
P(() => {
|
|
2127
|
+
O();
|
|
2128
2128
|
}, []);
|
|
2129
|
-
const { execute: H, loading:
|
|
2129
|
+
const { execute: H, loading: K } = qe(
|
|
2130
2130
|
async () => {
|
|
2131
|
-
var
|
|
2132
|
-
const
|
|
2131
|
+
var F, Y;
|
|
2132
|
+
const f = await o.generateQuestion({
|
|
2133
2133
|
interviewId: i,
|
|
2134
|
-
question: ((
|
|
2135
|
-
qnaId: ((
|
|
2136
|
-
answer:
|
|
2134
|
+
question: ((F = y.current) == null ? void 0 : F.question) || "",
|
|
2135
|
+
qnaId: ((Y = y.current) == null ? void 0 : Y.qna_id) || "",
|
|
2136
|
+
answer: g.current
|
|
2137
2137
|
});
|
|
2138
|
-
return
|
|
2138
|
+
return y.current = f.data, f;
|
|
2139
2139
|
},
|
|
2140
2140
|
{
|
|
2141
|
-
onSuccess: async (
|
|
2142
|
-
|
|
2141
|
+
onSuccess: async (f) => {
|
|
2142
|
+
f && f.data && (u(""), d(f.data), E());
|
|
2143
2143
|
},
|
|
2144
|
-
onError: (
|
|
2145
|
-
console.error("Failed to fetch questions:",
|
|
2144
|
+
onError: (f) => {
|
|
2145
|
+
console.error("Failed to fetch questions:", f);
|
|
2146
2146
|
}
|
|
2147
2147
|
}
|
|
2148
|
-
),
|
|
2149
|
-
|
|
2150
|
-
}, [
|
|
2151
|
-
var
|
|
2152
|
-
if ((
|
|
2148
|
+
), z = A(async () => {
|
|
2149
|
+
O();
|
|
2150
|
+
}, [O]), ee = A(async () => {
|
|
2151
|
+
var f;
|
|
2152
|
+
if ((f = y.current) != null && f.question)
|
|
2153
2153
|
try {
|
|
2154
|
-
|
|
2155
|
-
} catch (
|
|
2156
|
-
console.error("Failed to speak question:",
|
|
2154
|
+
I.current = !1, await b(y.current.question), y.current.is_interview_done && (await Pe(2e3), B());
|
|
2155
|
+
} catch (F) {
|
|
2156
|
+
console.error("Failed to speak question:", F);
|
|
2157
2157
|
}
|
|
2158
2158
|
else
|
|
2159
|
-
|
|
2160
|
-
}, [
|
|
2159
|
+
E();
|
|
2160
|
+
}, [b, E, B]), te = A(async () => {
|
|
2161
2161
|
try {
|
|
2162
|
-
await
|
|
2163
|
-
} catch (
|
|
2164
|
-
console.error("Failed to start recording:",
|
|
2162
|
+
await C(l);
|
|
2163
|
+
} catch (f) {
|
|
2164
|
+
console.error("Failed to start recording:", f), E();
|
|
2165
2165
|
}
|
|
2166
|
-
}, [
|
|
2166
|
+
}, [C, E]), G = A(async () => {
|
|
2167
2167
|
try {
|
|
2168
|
-
const
|
|
2169
|
-
await
|
|
2170
|
-
} catch (
|
|
2171
|
-
console.error("STT processing failed:",
|
|
2168
|
+
const f = await M();
|
|
2169
|
+
await q(f);
|
|
2170
|
+
} catch (f) {
|
|
2171
|
+
console.error("STT processing failed:", f), !x.current && !N.current && (x.current = !0, E());
|
|
2172
2172
|
}
|
|
2173
|
-
}, [
|
|
2174
|
-
const { phase:
|
|
2175
|
-
switch (
|
|
2176
|
-
case
|
|
2173
|
+
}, [M, q, E]), re = () => {
|
|
2174
|
+
const { phase: f } = L;
|
|
2175
|
+
switch (f) {
|
|
2176
|
+
case R.IDLE:
|
|
2177
2177
|
return /* @__PURE__ */ t.jsxs("div", { className: "iw-text-center iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-2 iw-h-full", children: [
|
|
2178
2178
|
/* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Ready to start the Interview?" }),
|
|
2179
2179
|
/* @__PURE__ */ t.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.` }),
|
|
2180
|
-
/* @__PURE__ */ t.jsx(
|
|
2180
|
+
/* @__PURE__ */ t.jsx(Z, { onClick: O, className: "iw-mt-2 iw-w-40", children: "Start Interview" })
|
|
2181
2181
|
] });
|
|
2182
|
-
case
|
|
2182
|
+
case R.FETCHING_QUESTION:
|
|
2183
2183
|
return /* @__PURE__ */ t.jsx(st, {});
|
|
2184
|
-
case
|
|
2185
|
-
return /* @__PURE__ */ t.jsx(ot, { ttsError:
|
|
2186
|
-
case
|
|
2184
|
+
case R.READING_QUESTION:
|
|
2185
|
+
return /* @__PURE__ */ t.jsx(ot, { ttsError: _ });
|
|
2186
|
+
case R.THINKING:
|
|
2187
2187
|
return /* @__PURE__ */ t.jsx(
|
|
2188
2188
|
ct,
|
|
2189
2189
|
{
|
|
2190
|
-
state:
|
|
2191
|
-
thinkingTime:
|
|
2192
|
-
nextPhase:
|
|
2190
|
+
state: L,
|
|
2191
|
+
thinkingTime: j,
|
|
2192
|
+
nextPhase: E
|
|
2193
2193
|
}
|
|
2194
2194
|
);
|
|
2195
|
-
case
|
|
2195
|
+
case R.ANSWERING:
|
|
2196
2196
|
return /* @__PURE__ */ t.jsx(
|
|
2197
2197
|
it,
|
|
2198
2198
|
{
|
|
2199
|
-
state:
|
|
2200
|
-
answeringTime:
|
|
2201
|
-
nextPhase:
|
|
2202
|
-
sttError:
|
|
2199
|
+
state: L,
|
|
2200
|
+
answeringTime: l,
|
|
2201
|
+
nextPhase: E,
|
|
2202
|
+
sttError: U
|
|
2203
2203
|
}
|
|
2204
2204
|
);
|
|
2205
|
-
case
|
|
2206
|
-
return /* @__PURE__ */ t.jsx(lt, { sttError:
|
|
2207
|
-
case
|
|
2208
|
-
case
|
|
2205
|
+
case R.TRANSCRIBING:
|
|
2206
|
+
return /* @__PURE__ */ t.jsx(lt, { sttError: U });
|
|
2207
|
+
case R.EDITING:
|
|
2208
|
+
case R.SUBMITTING:
|
|
2209
2209
|
return /* @__PURE__ */ t.jsx("div", { className: "iw-space-y-4 iw-h-full", children: /* @__PURE__ */ t.jsx(
|
|
2210
2210
|
et,
|
|
2211
2211
|
{
|
|
2212
|
-
value:
|
|
2213
|
-
onChange: (
|
|
2214
|
-
onSubmit: () =>
|
|
2215
|
-
isSubmitDisabled: !
|
|
2216
|
-
state:
|
|
2217
|
-
editingTime:
|
|
2212
|
+
value: h,
|
|
2213
|
+
onChange: (F) => u(F.target.value),
|
|
2214
|
+
onSubmit: () => E(),
|
|
2215
|
+
isSubmitDisabled: !h.trim() || K,
|
|
2216
|
+
state: L,
|
|
2217
|
+
editingTime: p
|
|
2218
2218
|
}
|
|
2219
2219
|
) });
|
|
2220
|
-
case
|
|
2220
|
+
case R.COMPLETED:
|
|
2221
2221
|
return /* @__PURE__ */ t.jsx("div", { className: "iw-fixed iw-inset-0 iw-bg-white", children: /* @__PURE__ */ t.jsx(
|
|
2222
2222
|
at,
|
|
2223
2223
|
{
|
|
@@ -2235,7 +2235,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2235
2235
|
ht,
|
|
2236
2236
|
{
|
|
2237
2237
|
title: "Interview for Python Developer",
|
|
2238
|
-
onExit:
|
|
2238
|
+
onExit: B
|
|
2239
2239
|
}
|
|
2240
2240
|
),
|
|
2241
2241
|
/* @__PURE__ */ t.jsxs(
|
|
@@ -2246,13 +2246,13 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2246
2246
|
/* @__PURE__ */ t.jsx("div", { className: "iw-flex iw-items-start iw-justify-between iw-gap-3", children: /* @__PURE__ */ t.jsx("div", { className: "iw-flex-1", children: /* @__PURE__ */ t.jsx(
|
|
2247
2247
|
wt,
|
|
2248
2248
|
{
|
|
2249
|
-
question:
|
|
2250
|
-
isLoading:
|
|
2249
|
+
question: m,
|
|
2250
|
+
isLoading: L.phase === R.FETCHING_QUESTION || L.phase === R.IDLE
|
|
2251
2251
|
}
|
|
2252
2252
|
) }) }),
|
|
2253
2253
|
/* @__PURE__ */ t.jsxs("div", { className: "iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-xl iw-p-4", children: [
|
|
2254
2254
|
/* @__PURE__ */ t.jsx("div", { className: "iw-min-h-[400px] iw-max-h-[600px]", children: /* @__PURE__ */ t.jsx(Xe, {}) }),
|
|
2255
|
-
/* @__PURE__ */ t.jsx("div", { className: "iw-bg-white iw-rounded-lg iw-shadow iw-p-6", children:
|
|
2255
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-bg-white iw-rounded-lg iw-shadow iw-p-6", children: re() })
|
|
2256
2256
|
] })
|
|
2257
2257
|
]
|
|
2258
2258
|
}
|
|
@@ -2263,11 +2263,11 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2263
2263
|
onInterviewEnd: r,
|
|
2264
2264
|
className: e = ""
|
|
2265
2265
|
}) => {
|
|
2266
|
-
const [
|
|
2267
|
-
return
|
|
2266
|
+
const [o, s] = ce.useState(!1), [c, a] = ce.useState(!0), n = S(null);
|
|
2267
|
+
return o ? /* @__PURE__ */ t.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ t.jsx(
|
|
2268
2268
|
"div",
|
|
2269
2269
|
{
|
|
2270
|
-
ref:
|
|
2270
|
+
ref: n,
|
|
2271
2271
|
className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${e}`,
|
|
2272
2272
|
children: /* @__PURE__ */ t.jsx("div", { className: " iw-h-full iw-flex iw-flex-col", children: /* @__PURE__ */ t.jsx(
|
|
2273
2273
|
mt,
|