interview-widget 0.1.5 → 0.1.7
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
|
-
var je = (
|
|
3
|
-
var D = (
|
|
4
|
-
import
|
|
2
|
+
var je = (r, i, e) => i in r ? ve(r, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[i] = e;
|
|
3
|
+
var D = (r, i, e) => je(r, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
+
import de, { createContext as Ne, useContext as Te, useRef as S, useState as k, useEffect as P, useCallback as A, useMemo as X } from "react";
|
|
5
5
|
import { createPortal as ke } from "react-dom";
|
|
6
|
-
var
|
|
6
|
+
var ue = { exports: {} }, Z = {};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
9
9
|
* react-jsx-runtime.production.js
|
|
@@ -14,27 +14,27 @@ var de = { exports: {} }, J = {};
|
|
|
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 he(r, i, e) {
|
|
18
|
+
var a = null;
|
|
19
|
+
if (e !== void 0 && (a = "" + e), i.key !== void 0 && (a = "" + i.key), "key" in i) {
|
|
20
20
|
e = {};
|
|
21
|
-
for (var s in
|
|
22
|
-
s !== "key" && (e[s] =
|
|
23
|
-
} else e =
|
|
24
|
-
return
|
|
21
|
+
for (var s in i)
|
|
22
|
+
s !== "key" && (e[s] = i[s]);
|
|
23
|
+
} else e = i;
|
|
24
|
+
return i = e.ref, {
|
|
25
25
|
$$typeof: Ie,
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
26
|
+
type: r,
|
|
27
|
+
key: a,
|
|
28
|
+
ref: i !== void 0 ? i : null,
|
|
29
29
|
props: e
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var t =
|
|
37
|
-
const
|
|
32
|
+
Z.Fragment = Ee;
|
|
33
|
+
Z.jsx = he;
|
|
34
|
+
Z.jsxs = he;
|
|
35
|
+
ue.exports = Z;
|
|
36
|
+
var t = ue.exports;
|
|
37
|
+
const _ = {
|
|
38
38
|
api: {
|
|
39
39
|
baseUrl: "/api",
|
|
40
40
|
retryConfig: {
|
|
@@ -62,66 +62,66 @@ const $ = {
|
|
|
62
62
|
provider: "piper"
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
},
|
|
65
|
+
}, me = Ne(
|
|
66
66
|
null
|
|
67
67
|
);
|
|
68
68
|
function Re({
|
|
69
|
-
config:
|
|
70
|
-
children:
|
|
69
|
+
config: r = {},
|
|
70
|
+
children: i
|
|
71
71
|
}) {
|
|
72
|
-
var
|
|
72
|
+
var a, s, c, o;
|
|
73
73
|
const e = {
|
|
74
74
|
api: {
|
|
75
|
-
|
|
76
|
-
...
|
|
75
|
+
..._.api,
|
|
76
|
+
...r.api,
|
|
77
77
|
retryConfig: {
|
|
78
|
-
|
|
79
|
-
...(
|
|
78
|
+
..._.api.retryConfig,
|
|
79
|
+
...(a = r.api) == null ? void 0 : a.retryConfig
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
ui: {
|
|
83
|
-
|
|
84
|
-
...
|
|
83
|
+
..._.ui,
|
|
84
|
+
...r.ui
|
|
85
85
|
},
|
|
86
86
|
interview: {
|
|
87
|
-
|
|
88
|
-
...
|
|
87
|
+
..._.interview,
|
|
88
|
+
...r.interview,
|
|
89
89
|
timers: {
|
|
90
|
-
|
|
91
|
-
...(s =
|
|
90
|
+
..._.interview.timers,
|
|
91
|
+
...(s = r.interview) == null ? void 0 : s.timers
|
|
92
92
|
},
|
|
93
93
|
stt: {
|
|
94
|
-
|
|
95
|
-
...(c =
|
|
94
|
+
..._.interview.stt,
|
|
95
|
+
...(c = r.interview) == null ? void 0 : c.stt
|
|
96
96
|
},
|
|
97
97
|
tts: {
|
|
98
|
-
|
|
99
|
-
...(
|
|
98
|
+
..._.interview.tts,
|
|
99
|
+
...(o = r.interview) == null ? void 0 : o.tts
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
return /* @__PURE__ */ t.jsx(
|
|
103
|
+
return /* @__PURE__ */ t.jsx(me.Provider, { value: e, children: i });
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
105
|
+
function K() {
|
|
106
|
+
const r = Te(me);
|
|
107
|
+
if (!r)
|
|
108
108
|
throw new Error(
|
|
109
109
|
"useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>"
|
|
110
110
|
);
|
|
111
|
-
return
|
|
111
|
+
return r;
|
|
112
112
|
}
|
|
113
113
|
function Se() {
|
|
114
|
-
return
|
|
114
|
+
return K().api || _.api;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
116
|
+
function V() {
|
|
117
|
+
return K().ui || _.ui;
|
|
118
118
|
}
|
|
119
119
|
function Ce() {
|
|
120
|
-
return
|
|
120
|
+
return K().interview || _.interview;
|
|
121
121
|
}
|
|
122
|
-
const
|
|
123
|
-
className:
|
|
124
|
-
...
|
|
122
|
+
const ge = ({
|
|
123
|
+
className: r,
|
|
124
|
+
...i
|
|
125
125
|
}) => /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs(
|
|
126
126
|
"svg",
|
|
127
127
|
{
|
|
@@ -134,8 +134,8 @@ const he = ({
|
|
|
134
134
|
strokeWidth: "2",
|
|
135
135
|
strokeLinecap: "round",
|
|
136
136
|
strokeLinejoin: "round",
|
|
137
|
-
className: `iw-animate-spin ${
|
|
138
|
-
...
|
|
137
|
+
className: `iw-animate-spin ${r}`,
|
|
138
|
+
...i,
|
|
139
139
|
children: [
|
|
140
140
|
/* @__PURE__ */ t.jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
141
141
|
/* @__PURE__ */ t.jsx("path", { d: "M12 6l0 -3" }),
|
|
@@ -148,73 +148,73 @@ const he = ({
|
|
|
148
148
|
/* @__PURE__ */ t.jsx("path", { d: "M7.75 7.75l-2.15 -2.15" })
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
|
-
) }),
|
|
152
|
-
children:
|
|
153
|
-
variant:
|
|
151
|
+
) }), ne = ({
|
|
152
|
+
children: r,
|
|
153
|
+
variant: i = "primary",
|
|
154
154
|
size: e = "md",
|
|
155
|
-
fullWidth:
|
|
155
|
+
fullWidth: a = !1,
|
|
156
156
|
isLoading: s = !1,
|
|
157
157
|
disabled: c,
|
|
158
|
-
className:
|
|
158
|
+
className: o = "",
|
|
159
159
|
...n
|
|
160
160
|
}) => {
|
|
161
|
-
const
|
|
161
|
+
const l = "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",
|
|
165
165
|
text: "iw-bg-transparent iw-text-primary-600 iw-hover:bg-primary-50 iw-border iw-border-transparent",
|
|
166
166
|
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"
|
|
167
|
-
},
|
|
167
|
+
}, w = {
|
|
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 = a ? "iw-w-full" : "";
|
|
172
172
|
return /* @__PURE__ */ t.jsxs(
|
|
173
173
|
"button",
|
|
174
174
|
{
|
|
175
|
-
className: `${
|
|
175
|
+
className: `${l} ${m[i]} ${w[e]} ${u} ${h} ${o}`,
|
|
176
176
|
disabled: c || s,
|
|
177
177
|
...n,
|
|
178
178
|
children: [
|
|
179
|
-
s && /* @__PURE__ */ t.jsx(
|
|
180
|
-
|
|
179
|
+
s && /* @__PURE__ */ t.jsx(ge, { height: 16, width: 16, style: { marginRight: "3px" } }),
|
|
180
|
+
r
|
|
181
181
|
]
|
|
182
182
|
}
|
|
183
183
|
);
|
|
184
184
|
};
|
|
185
|
-
function Me(
|
|
186
|
-
const
|
|
187
|
-
return
|
|
188
|
-
r: parseInt(
|
|
189
|
-
g: parseInt(
|
|
190
|
-
b: parseInt(
|
|
185
|
+
function Me(r) {
|
|
186
|
+
const i = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);
|
|
187
|
+
return i ? {
|
|
188
|
+
r: parseInt(i[1], 16),
|
|
189
|
+
g: parseInt(i[2], 16),
|
|
190
|
+
b: parseInt(i[3], 16)
|
|
191
191
|
} : null;
|
|
192
192
|
}
|
|
193
|
-
function Ae(
|
|
194
|
-
return "#" + [
|
|
195
|
-
const s = Math.round(
|
|
193
|
+
function Ae(r, i, e) {
|
|
194
|
+
return "#" + [r, i, e].map((a) => {
|
|
195
|
+
const s = Math.round(a).toString(16);
|
|
196
196
|
return s.length === 1 ? "0" + s : s;
|
|
197
197
|
}).join("");
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
const e = Me(
|
|
201
|
-
if (!e) return
|
|
202
|
-
const
|
|
203
|
-
return Ae(
|
|
199
|
+
function fe(r, i) {
|
|
200
|
+
const e = Me(r);
|
|
201
|
+
if (!e) return r;
|
|
202
|
+
const a = e.r + (255 - e.r) * i, s = e.g + (255 - e.g) * i, c = e.b + (255 - e.b) * i;
|
|
203
|
+
return Ae(a, s, c);
|
|
204
204
|
}
|
|
205
|
-
function De(
|
|
205
|
+
function De(r, i = 0.8) {
|
|
206
206
|
return {
|
|
207
|
-
background: `linear-gradient(to bottom, ${
|
|
207
|
+
background: `linear-gradient(to bottom, ${fe(r, i)}, #ffffff)`,
|
|
208
208
|
color: "#1f2937"
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
|
-
function Pe(
|
|
212
|
-
return new Promise((
|
|
211
|
+
function Pe(r) {
|
|
212
|
+
return new Promise((i) => setTimeout(i, r));
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
return `linear-gradient(to left, ${
|
|
214
|
+
function xe(r) {
|
|
215
|
+
return `linear-gradient(to left, ${fe(r, 0.4)}, ${r})`;
|
|
216
216
|
}
|
|
217
|
-
const $e = (
|
|
217
|
+
const $e = (r) => /* @__PURE__ */ t.jsxs(
|
|
218
218
|
"svg",
|
|
219
219
|
{
|
|
220
220
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -226,7 +226,7 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
226
226
|
strokeWidth: "2",
|
|
227
227
|
strokeLinecap: "round",
|
|
228
228
|
strokeLinejoin: "round",
|
|
229
|
-
...
|
|
229
|
+
...r,
|
|
230
230
|
children: [
|
|
231
231
|
/* @__PURE__ */ t.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" }),
|
|
232
232
|
/* @__PURE__ */ t.jsx("path", { d: "m9 12 2 2 4-4" })
|
|
@@ -240,40 +240,40 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
240
240
|
"Do not disable or interfere with audio/video monitoring",
|
|
241
241
|
"All activities are being recorded, and any violations may result in penalties, including disqualification"
|
|
242
242
|
], Le = ({
|
|
243
|
-
isOpen:
|
|
244
|
-
onStart:
|
|
243
|
+
isOpen: r,
|
|
244
|
+
onStart: i,
|
|
245
245
|
onClose: e
|
|
246
246
|
}) => {
|
|
247
|
-
var
|
|
248
|
-
const
|
|
249
|
-
s.current && (s.current.getTracks().forEach((
|
|
250
|
-
},
|
|
251
|
-
u(!0),
|
|
247
|
+
var I;
|
|
248
|
+
const a = S(null), s = S(null), { baseColor: c, borderRadius: o } = V(), [n, l] = k(!1), [m, w] = k(null), [h, u] = k(!1), g = () => {
|
|
249
|
+
s.current && (s.current.getTracks().forEach((d) => d.stop()), s.current = null);
|
|
250
|
+
}, j = async () => {
|
|
251
|
+
u(!0), w(null);
|
|
252
252
|
try {
|
|
253
|
-
const
|
|
253
|
+
const d = await navigator.mediaDevices.getUserMedia({
|
|
254
254
|
video: { width: { ideal: 1280 }, height: { ideal: 720 } },
|
|
255
255
|
audio: !0
|
|
256
256
|
});
|
|
257
|
-
s.current =
|
|
258
|
-
} catch (
|
|
259
|
-
console.error("Media permission error:",
|
|
260
|
-
let
|
|
261
|
-
(
|
|
257
|
+
s.current = d, a.current && (a.current.srcObject = d), l(!0);
|
|
258
|
+
} catch (d) {
|
|
259
|
+
console.error("Media permission error:", d);
|
|
260
|
+
let x = "Unable to access camera or microphone.";
|
|
261
|
+
(d == null ? void 0 : d.name) === "NotAllowedError" ? x = "Permissions denied. Please allow access to camera and microphone." : (d == null ? void 0 : d.name) === "NotFoundError" ? x = "No camera/microphone found. Please connect a device and retry." : d != null && d.message && (x = d.message), l(!1), w(x);
|
|
262
262
|
} finally {
|
|
263
263
|
u(!1);
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
266
|
if (P(() => {
|
|
267
|
-
if (!
|
|
267
|
+
if (!r) {
|
|
268
268
|
g();
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
|
-
return
|
|
271
|
+
return j(), () => {
|
|
272
272
|
g();
|
|
273
273
|
};
|
|
274
|
-
}, [
|
|
275
|
-
const
|
|
276
|
-
|
|
274
|
+
}, [r]), !r) return null;
|
|
275
|
+
const y = () => {
|
|
276
|
+
i(), 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: [
|
|
@@ -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: a,
|
|
299
299
|
autoPlay: !0,
|
|
300
300
|
playsInline: !0,
|
|
301
301
|
muted: !0,
|
|
@@ -307,29 +307,29 @@ 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
|
+
ne,
|
|
311
311
|
{
|
|
312
|
-
onClick:
|
|
312
|
+
onClick: j,
|
|
313
313
|
disabled: h,
|
|
314
314
|
variant: "outline",
|
|
315
315
|
size: "sm",
|
|
316
316
|
style: {
|
|
317
317
|
borderColor: c,
|
|
318
|
-
borderRadius:
|
|
318
|
+
borderRadius: o,
|
|
319
319
|
color: c
|
|
320
320
|
},
|
|
321
321
|
children: n ? "Recheck Permissions" : "Enable Camera & Mic"
|
|
322
322
|
}
|
|
323
323
|
),
|
|
324
324
|
/* @__PURE__ */ t.jsx(
|
|
325
|
-
|
|
325
|
+
ne,
|
|
326
326
|
{
|
|
327
|
-
onClick:
|
|
327
|
+
onClick: y,
|
|
328
328
|
disabled: !n,
|
|
329
329
|
size: "sm",
|
|
330
330
|
style: {
|
|
331
|
-
background:
|
|
332
|
-
borderRadius:
|
|
331
|
+
background: xe(c),
|
|
332
|
+
borderRadius: o
|
|
333
333
|
},
|
|
334
334
|
children: "Start Interview"
|
|
335
335
|
}
|
|
@@ -341,14 +341,14 @@ const $e = (i) => /* @__PURE__ */ t.jsxs(
|
|
|
341
341
|
/* @__PURE__ */ t.jsx($e, {}),
|
|
342
342
|
/* @__PURE__ */ t.jsx("h3", { children: "Interview Guidelines" })
|
|
343
343
|
] }),
|
|
344
|
-
!((
|
|
344
|
+
!((I = navigator.mediaDevices) != null && I.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
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((
|
|
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((d, x) => /* @__PURE__ */ t.jsx("li", { children: d }, x)) })
|
|
347
347
|
] })
|
|
348
348
|
] })
|
|
349
349
|
] }) });
|
|
350
350
|
};
|
|
351
|
-
var R = /* @__PURE__ */ ((
|
|
351
|
+
var R = /* @__PURE__ */ ((r) => (r.IDLE = "idle", r.FETCHING_QUESTION = "fetching_question", r.READING_QUESTION = "reading_question", r.THINKING = "thinking", r.ANSWERING = "answering", r.TRANSCRIBING = "transcribing", r.EDITING = "editing", r.SUBMITTING = "submitting", r.COMPLETED = "completed", r))(R || {});
|
|
352
352
|
const Oe = {
|
|
353
353
|
thinkingDuration: 30,
|
|
354
354
|
answeringDuration: 120,
|
|
@@ -383,13 +383,13 @@ const Oe = {
|
|
|
383
383
|
}
|
|
384
384
|
};
|
|
385
385
|
class Ue {
|
|
386
|
-
constructor(
|
|
386
|
+
constructor(i = {}, e = {}) {
|
|
387
387
|
D(this, "config");
|
|
388
388
|
D(this, "state");
|
|
389
389
|
D(this, "phaseIntervalId", null);
|
|
390
390
|
D(this, "globalIntervalId", null);
|
|
391
391
|
D(this, "callbacks");
|
|
392
|
-
this.config = { ...Oe, ...
|
|
392
|
+
this.config = { ...Oe, ...i }, this.callbacks = e, this.state = {
|
|
393
393
|
phase: "idle",
|
|
394
394
|
currentPhaseTimeRemaining: 0,
|
|
395
395
|
totalTimeElapsed: 0,
|
|
@@ -412,18 +412,18 @@ class Ue {
|
|
|
412
412
|
* Move to next phase
|
|
413
413
|
*/
|
|
414
414
|
nextPhase() {
|
|
415
|
-
const
|
|
415
|
+
const i = this.state.phase, e = Fe[i];
|
|
416
416
|
if (!e) return;
|
|
417
417
|
this.stopPhaseTimer(), this.state.phase = e.next;
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
const a = this.getDurationForPhase(e.next);
|
|
419
|
+
a > 0 ? (this.state.currentPhaseTimeRemaining = a, this.startPhaseTimer()) : this.state.currentPhaseTimeRemaining = 0, this.notifyChange();
|
|
420
420
|
}
|
|
421
421
|
/**
|
|
422
422
|
* Manually complete the interview
|
|
423
423
|
*/
|
|
424
424
|
completeInterview() {
|
|
425
|
-
var
|
|
426
|
-
this.stopGlobalTimer(), this.stopPhaseTimer(), this.state.phase = "completed", (
|
|
425
|
+
var i, e, a, s;
|
|
426
|
+
(e = (i = this.callbacks).onComplete) == null || e.call(i), this.stopGlobalTimer(), this.stopPhaseTimer(), this.state.phase = "completed", (s = (a = this.callbacks).onInterviewEnd) == null || s.call(a), this.notifyChange();
|
|
427
427
|
}
|
|
428
428
|
/**
|
|
429
429
|
* Cleanup
|
|
@@ -434,8 +434,8 @@ class Ue {
|
|
|
434
434
|
/**
|
|
435
435
|
* Get duration for a phase
|
|
436
436
|
*/
|
|
437
|
-
getDurationForPhase(
|
|
438
|
-
switch (
|
|
437
|
+
getDurationForPhase(i) {
|
|
438
|
+
switch (i) {
|
|
439
439
|
case "thinking":
|
|
440
440
|
return this.config.thinkingDuration;
|
|
441
441
|
case "answering":
|
|
@@ -451,8 +451,8 @@ class Ue {
|
|
|
451
451
|
*/
|
|
452
452
|
startGlobalTimer() {
|
|
453
453
|
this.globalIntervalId = setInterval(() => {
|
|
454
|
-
var
|
|
455
|
-
this.state.totalTimeElapsed++, (e = (
|
|
454
|
+
var i, e;
|
|
455
|
+
this.state.totalTimeElapsed++, (e = (i = this.callbacks).onTick) == null || e.call(i, this.getState());
|
|
456
456
|
}, 1e3);
|
|
457
457
|
}
|
|
458
458
|
/**
|
|
@@ -479,21 +479,21 @@ class Ue {
|
|
|
479
479
|
* Notify phase change
|
|
480
480
|
*/
|
|
481
481
|
notifyChange() {
|
|
482
|
-
var
|
|
483
|
-
(e = (
|
|
482
|
+
var i, e;
|
|
483
|
+
(e = (i = this.callbacks).onPhaseChange) == null || e.call(i, this.state.phase, this.getState());
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
function Ge(
|
|
487
|
-
const { config:
|
|
488
|
-
|
|
489
|
-
const s =
|
|
490
|
-
|
|
486
|
+
function Ge(r = {}) {
|
|
487
|
+
const { config: i = {}, callbacks: e = {} } = r, a = S(null);
|
|
488
|
+
a.current || (a.current = new Ue(i, {}));
|
|
489
|
+
const s = a.current, [c, o] = k(s.getState()), n = A(() => {
|
|
490
|
+
o(s.getState());
|
|
491
491
|
}, [s]);
|
|
492
492
|
P(() => {
|
|
493
493
|
const h = {
|
|
494
494
|
onPhaseChange: (u, g) => {
|
|
495
|
-
var
|
|
496
|
-
n(), (
|
|
495
|
+
var j;
|
|
496
|
+
n(), (j = e.onPhaseChange) == null || j.call(e, u, g);
|
|
497
497
|
},
|
|
498
498
|
onTick: (u) => {
|
|
499
499
|
var g;
|
|
@@ -508,62 +508,62 @@ function Ge(i = {}) {
|
|
|
508
508
|
}, [s, e, n]), P(() => () => {
|
|
509
509
|
s.destroy();
|
|
510
510
|
}, [s]);
|
|
511
|
-
const
|
|
511
|
+
const l = A(() => {
|
|
512
512
|
s.startQuestion(), n();
|
|
513
513
|
}, [s, n]), m = A(() => {
|
|
514
514
|
s.nextPhase(), n();
|
|
515
|
-
}, [s, n]),
|
|
515
|
+
}, [s, n]), w = A(() => {
|
|
516
516
|
s.completeInterview(), n();
|
|
517
517
|
}, [s, n]);
|
|
518
518
|
return {
|
|
519
519
|
state: c,
|
|
520
|
-
startQuestion:
|
|
520
|
+
startQuestion: l,
|
|
521
521
|
nextPhase: m,
|
|
522
|
-
completeInterview:
|
|
522
|
+
completeInterview: w,
|
|
523
523
|
timerService: s
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
|
-
function qe(
|
|
527
|
-
const [e,
|
|
526
|
+
function qe(r, i = {}) {
|
|
527
|
+
const [e, a] = k({
|
|
528
528
|
data: null,
|
|
529
529
|
loading: !1,
|
|
530
530
|
error: null
|
|
531
531
|
}), s = A(
|
|
532
532
|
async (...c) => {
|
|
533
|
-
var
|
|
534
|
-
|
|
533
|
+
var o, n, l, m;
|
|
534
|
+
a((w) => ({ ...w, loading: !0, error: null }));
|
|
535
535
|
try {
|
|
536
|
-
const
|
|
537
|
-
|
|
536
|
+
const w = await r(...c);
|
|
537
|
+
a((h) => ({
|
|
538
538
|
...h,
|
|
539
|
-
data:
|
|
539
|
+
data: w,
|
|
540
540
|
loading: !1,
|
|
541
541
|
error: null
|
|
542
|
-
})), (
|
|
543
|
-
} catch (
|
|
544
|
-
const h =
|
|
542
|
+
})), (o = i.onSuccess) == null || o.call(i, w), (n = i.onSettled) == null || n.call(i, w, null);
|
|
543
|
+
} catch (w) {
|
|
544
|
+
const h = w.type ? w : {
|
|
545
545
|
type: "unknown",
|
|
546
|
-
message:
|
|
546
|
+
message: w.message || "Unknown error",
|
|
547
547
|
retryable: !0,
|
|
548
548
|
userMessage: "Something went wrong. Please try again.",
|
|
549
|
-
originalError:
|
|
549
|
+
originalError: w
|
|
550
550
|
};
|
|
551
|
-
|
|
551
|
+
a((u) => ({
|
|
552
552
|
...u,
|
|
553
553
|
loading: !1,
|
|
554
554
|
error: h
|
|
555
|
-
})), (
|
|
555
|
+
})), (l = i.onError) == null || l.call(i, h), (m = i.onSettled) == null || m.call(i, null, h);
|
|
556
556
|
}
|
|
557
557
|
},
|
|
558
|
-
[
|
|
558
|
+
[r, i]
|
|
559
559
|
);
|
|
560
560
|
return {
|
|
561
561
|
...e,
|
|
562
562
|
execute: s
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
|
-
function Be(
|
|
566
|
-
var
|
|
565
|
+
function Be(r) {
|
|
566
|
+
var i;
|
|
567
567
|
if (!navigator.onLine)
|
|
568
568
|
return {
|
|
569
569
|
type: "network",
|
|
@@ -571,15 +571,15 @@ function Be(i) {
|
|
|
571
571
|
retryable: !0,
|
|
572
572
|
userMessage: "Please check your internet connection and try again."
|
|
573
573
|
};
|
|
574
|
-
if (
|
|
574
|
+
if (r.name === "AbortError" || (i = r.message) != null && i.includes("timeout"))
|
|
575
575
|
return {
|
|
576
576
|
type: "timeout",
|
|
577
577
|
message: "Request timed out",
|
|
578
578
|
retryable: !0,
|
|
579
579
|
userMessage: "The request is taking longer than expected. Please try again."
|
|
580
580
|
};
|
|
581
|
-
if (
|
|
582
|
-
const { status: e } =
|
|
581
|
+
if (r.status) {
|
|
582
|
+
const { status: e } = r;
|
|
583
583
|
if (e === 401 || e === 403)
|
|
584
584
|
return {
|
|
585
585
|
type: "auth",
|
|
@@ -615,101 +615,101 @@ function Be(i) {
|
|
|
615
615
|
}
|
|
616
616
|
return {
|
|
617
617
|
type: "unknown",
|
|
618
|
-
message:
|
|
618
|
+
message: r.message || "Unknown error occurred",
|
|
619
619
|
retryable: !0,
|
|
620
620
|
userMessage: "Something unexpected happened. Please try again.",
|
|
621
|
-
originalError:
|
|
621
|
+
originalError: r
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
async function
|
|
624
|
+
async function oe(r, i = {}, 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 a;
|
|
632
632
|
for (let s = 1; s <= e.attempts; s++)
|
|
633
633
|
try {
|
|
634
|
-
const c = new AbortController(),
|
|
635
|
-
...
|
|
634
|
+
const c = new AbortController(), o = setTimeout(() => c.abort(), 6e4), n = await fetch(r, {
|
|
635
|
+
...i,
|
|
636
636
|
signal: c.signal
|
|
637
637
|
});
|
|
638
|
-
if (clearTimeout(
|
|
638
|
+
if (clearTimeout(o), n.status >= 400 && n.status < 500 && n.status !== 429)
|
|
639
639
|
return n;
|
|
640
640
|
if (!n.ok)
|
|
641
641
|
throw new Error(`HTTP ${n.status}: ${n.statusText}`);
|
|
642
642
|
return n;
|
|
643
643
|
} catch (c) {
|
|
644
|
-
|
|
645
|
-
const
|
|
646
|
-
if (!
|
|
647
|
-
throw
|
|
644
|
+
a = c;
|
|
645
|
+
const o = Be(c);
|
|
646
|
+
if (!o.retryable || s === e.attempts)
|
|
647
|
+
throw o;
|
|
648
648
|
const n = ze(s, e);
|
|
649
649
|
console.warn(
|
|
650
650
|
`API request failed (attempt ${s}/${e.attempts}), retrying in ${n}ms:`,
|
|
651
|
-
|
|
652
|
-
), await new Promise((
|
|
651
|
+
o.message
|
|
652
|
+
), await new Promise((l) => setTimeout(l, n));
|
|
653
653
|
}
|
|
654
|
-
throw
|
|
654
|
+
throw a;
|
|
655
655
|
}
|
|
656
|
-
function ze(
|
|
656
|
+
function ze(r, i) {
|
|
657
657
|
let e;
|
|
658
|
-
return
|
|
658
|
+
return i.backoff === "exponential" ? e = i.baseDelay * Math.pow(2, r - 1) : e = i.baseDelay, e = Math.min(e, i.maxDelay), i.jitter && (e = e * (0.5 + Math.random() * 0.5)), Math.round(e);
|
|
659
659
|
}
|
|
660
660
|
class Qe {
|
|
661
|
-
constructor(
|
|
661
|
+
constructor(i = {}) {
|
|
662
662
|
D(this, "config");
|
|
663
|
-
this.config =
|
|
663
|
+
this.config = i;
|
|
664
664
|
}
|
|
665
665
|
/**
|
|
666
666
|
* Update configuration
|
|
667
667
|
*/
|
|
668
|
-
updateConfig(
|
|
669
|
-
this.config = { ...this.config, ...
|
|
668
|
+
updateConfig(i) {
|
|
669
|
+
this.config = { ...this.config, ...i };
|
|
670
670
|
}
|
|
671
671
|
/**
|
|
672
672
|
* Get default headers for API requests
|
|
673
673
|
*/
|
|
674
674
|
getHeaders() {
|
|
675
675
|
var e;
|
|
676
|
-
const
|
|
676
|
+
const i = {
|
|
677
677
|
"Content-Type": "application/json",
|
|
678
678
|
"X-Auth-Token": "appkey"
|
|
679
679
|
};
|
|
680
|
-
return (e = this.config) != null && e.authToken && (
|
|
680
|
+
return (e = this.config) != null && e.authToken && (i.Authorization = `Bearer ${this.config.authToken}`), i;
|
|
681
681
|
}
|
|
682
682
|
/**
|
|
683
683
|
* Get base URL from config with fallback
|
|
684
684
|
*/
|
|
685
685
|
getBaseUrl() {
|
|
686
|
-
var
|
|
687
|
-
return ((
|
|
686
|
+
var i;
|
|
687
|
+
return ((i = this.config) == null ? void 0 : i.baseUrl) || "/api";
|
|
688
688
|
}
|
|
689
689
|
/**
|
|
690
690
|
* Get questions for an interview
|
|
691
691
|
*/
|
|
692
692
|
async generateQuestion({
|
|
693
|
-
interviewId:
|
|
693
|
+
interviewId: i,
|
|
694
694
|
isInterviewDone: e = !1,
|
|
695
|
-
qnaId:
|
|
695
|
+
qnaId: a,
|
|
696
696
|
question: s,
|
|
697
697
|
answer: c,
|
|
698
|
-
answerDuration:
|
|
698
|
+
answerDuration: o
|
|
699
699
|
}) {
|
|
700
|
-
const n = await
|
|
700
|
+
const n = await oe(
|
|
701
701
|
`${this.getBaseUrl()}/questions/next`,
|
|
702
702
|
{
|
|
703
703
|
method: "POST",
|
|
704
704
|
headers: this.getHeaders(),
|
|
705
705
|
body: JSON.stringify({
|
|
706
|
-
interview_id:
|
|
706
|
+
interview_id: i,
|
|
707
707
|
is_interview_done: e,
|
|
708
|
-
qna_id:
|
|
708
|
+
qna_id: a,
|
|
709
709
|
question: s,
|
|
710
710
|
answer: c,
|
|
711
711
|
// TODO: Hardcoded for now, will be dynamic later
|
|
712
|
-
answer_duration:
|
|
712
|
+
answer_duration: o ?? "00:00:30"
|
|
713
713
|
})
|
|
714
714
|
}
|
|
715
715
|
);
|
|
@@ -719,19 +719,19 @@ class Qe {
|
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
function We() {
|
|
722
|
-
const
|
|
723
|
-
return
|
|
724
|
-
const e =
|
|
722
|
+
const r = K();
|
|
723
|
+
return X(() => {
|
|
724
|
+
const e = r.api || {};
|
|
725
725
|
return new Qe(e);
|
|
726
|
-
}, [
|
|
726
|
+
}, [r.api]);
|
|
727
727
|
}
|
|
728
728
|
class v extends Error {
|
|
729
|
-
constructor(
|
|
730
|
-
super(
|
|
729
|
+
constructor(i, e, a = !1) {
|
|
730
|
+
super(i), this.code = e, this.recoverable = a, this.name = "STTError";
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
733
|
class He {
|
|
734
|
-
constructor(
|
|
734
|
+
constructor(i = {}) {
|
|
735
735
|
D(this, "config");
|
|
736
736
|
D(this, "mediaRecorder", null);
|
|
737
737
|
D(this, "audioChunks", []);
|
|
@@ -744,14 +744,14 @@ class He {
|
|
|
744
744
|
language: "en",
|
|
745
745
|
includeTimestamps: !1,
|
|
746
746
|
temperature: 0,
|
|
747
|
-
...
|
|
747
|
+
...i
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
750
|
/**
|
|
751
751
|
* Update STT configuration
|
|
752
752
|
*/
|
|
753
|
-
updateConfig(
|
|
754
|
-
this.config = { ...this.config, ...
|
|
753
|
+
updateConfig(i) {
|
|
754
|
+
this.config = { ...this.config, ...i };
|
|
755
755
|
}
|
|
756
756
|
/**
|
|
757
757
|
* Check if browser supports audio recording
|
|
@@ -762,8 +762,8 @@ class He {
|
|
|
762
762
|
/**
|
|
763
763
|
* Start recording audio from user's microphone
|
|
764
764
|
*/
|
|
765
|
-
async startRecording(
|
|
766
|
-
var
|
|
765
|
+
async startRecording(i, e) {
|
|
766
|
+
var a;
|
|
767
767
|
if (!this.isRecordingSupported())
|
|
768
768
|
throw new v(
|
|
769
769
|
"Audio recording is not supported in this browser",
|
|
@@ -788,22 +788,22 @@ class He {
|
|
|
788
788
|
this.mediaRecorder = new MediaRecorder(this.recordingStream, {
|
|
789
789
|
mimeType: s
|
|
790
790
|
}), this.mediaRecorder.ondataavailable = (c) => {
|
|
791
|
-
var
|
|
792
|
-
c.data.size > 0 && (this.audioChunks.push(c.data), (
|
|
791
|
+
var o;
|
|
792
|
+
c.data.size > 0 && (this.audioChunks.push(c.data), (o = e == null ? void 0 : e.onDataAvailable) == null || o.call(e, c.data));
|
|
793
793
|
}, this.mediaRecorder.onstop = () => {
|
|
794
794
|
var c;
|
|
795
795
|
(c = e == null ? void 0 : e.onStop) == null || c.call(e);
|
|
796
796
|
}, this.mediaRecorder.onerror = (c) => {
|
|
797
797
|
var n;
|
|
798
|
-
const
|
|
798
|
+
const o = new v(
|
|
799
799
|
`Recording failed: ${c.error}`,
|
|
800
800
|
"RECORDING_ERROR",
|
|
801
801
|
!0
|
|
802
802
|
);
|
|
803
|
-
(n = e == null ? void 0 : e.onError) == null || n.call(e,
|
|
804
|
-
}, this.mediaRecorder.start(100), (
|
|
803
|
+
(n = e == null ? void 0 : e.onError) == null || n.call(e, o), this.cleanup();
|
|
804
|
+
}, this.mediaRecorder.start(100), (a = e == null ? void 0 : e.onStart) == null || a.call(e), i && i > 0 && (this.autoStopTimeoutId = setTimeout(() => {
|
|
805
805
|
this.isRecording() && this.stopRecording();
|
|
806
|
-
},
|
|
806
|
+
}, i * 1e3));
|
|
807
807
|
} catch (s) {
|
|
808
808
|
if (this.cleanup(), s instanceof Error) {
|
|
809
809
|
if (s.name === "NotAllowedError" || s.name === "PermissionDeniedError")
|
|
@@ -832,17 +832,17 @@ class He {
|
|
|
832
832
|
"NO_ACTIVE_RECORDING",
|
|
833
833
|
!1
|
|
834
834
|
);
|
|
835
|
-
return new Promise((
|
|
835
|
+
return new Promise((i, e) => {
|
|
836
836
|
if (!this.mediaRecorder) {
|
|
837
837
|
e(
|
|
838
838
|
new v("MediaRecorder is null", "MEDIARECORDER_NULL", !1)
|
|
839
839
|
);
|
|
840
840
|
return;
|
|
841
841
|
}
|
|
842
|
-
const
|
|
842
|
+
const a = this.mediaRecorder, s = () => {
|
|
843
843
|
try {
|
|
844
|
-
const c =
|
|
845
|
-
this.cleanup(),
|
|
844
|
+
const c = a.mimeType || "audio/webm", o = new Blob(this.audioChunks, { type: c });
|
|
845
|
+
this.cleanup(), i(o);
|
|
846
846
|
} catch (c) {
|
|
847
847
|
e(
|
|
848
848
|
new v(
|
|
@@ -853,20 +853,20 @@ class He {
|
|
|
853
853
|
);
|
|
854
854
|
}
|
|
855
855
|
};
|
|
856
|
-
|
|
856
|
+
a.addEventListener("stop", s, { once: !0 }), a.stop();
|
|
857
857
|
});
|
|
858
858
|
}
|
|
859
859
|
/**
|
|
860
860
|
* Transcribe audio blob using the STT API
|
|
861
861
|
*/
|
|
862
|
-
async transcribe(
|
|
862
|
+
async transcribe(i) {
|
|
863
863
|
const {
|
|
864
864
|
audioBlob: e,
|
|
865
|
-
model:
|
|
865
|
+
model: a = this.config.model,
|
|
866
866
|
language: s = this.config.language,
|
|
867
867
|
includeTimestamps: c = this.config.includeTimestamps,
|
|
868
|
-
temperature:
|
|
869
|
-
} =
|
|
868
|
+
temperature: o = this.config.temperature
|
|
869
|
+
} = i;
|
|
870
870
|
if (!e || e.size === 0)
|
|
871
871
|
throw new v(
|
|
872
872
|
"Audio blob is empty or invalid",
|
|
@@ -874,11 +874,11 @@ class He {
|
|
|
874
874
|
!1
|
|
875
875
|
);
|
|
876
876
|
try {
|
|
877
|
-
const n = new FormData(),
|
|
877
|
+
const n = new FormData(), l = new File([e], "recording.wav", {
|
|
878
878
|
type: e.type || "audio/wav"
|
|
879
879
|
});
|
|
880
|
-
n.append("file",
|
|
881
|
-
const m = await
|
|
880
|
+
n.append("file", l), n.append("model", a || "whisper-large-v3-turbo"), n.append("language", s || "en"), n.append("include_timestamps", String(c || !1)), n.append("temperature", String(o || 0));
|
|
881
|
+
const m = await oe(
|
|
882
882
|
`${this.config.baseUrl}/speech/transcribe`,
|
|
883
883
|
{
|
|
884
884
|
method: "POST",
|
|
@@ -941,14 +941,14 @@ class He {
|
|
|
941
941
|
* Get supported MIME type for recording
|
|
942
942
|
*/
|
|
943
943
|
getSupportedMimeType() {
|
|
944
|
-
const
|
|
944
|
+
const i = [
|
|
945
945
|
"audio/webm",
|
|
946
946
|
"audio/webm;codecs=opus",
|
|
947
947
|
"audio/ogg;codecs=opus",
|
|
948
948
|
"audio/mp4",
|
|
949
949
|
"audio/wav"
|
|
950
950
|
];
|
|
951
|
-
for (const e of
|
|
951
|
+
for (const e of i)
|
|
952
952
|
if (MediaRecorder.isTypeSupported(e))
|
|
953
953
|
return e;
|
|
954
954
|
return "audio/webm";
|
|
@@ -957,88 +957,88 @@ class He {
|
|
|
957
957
|
* Clean up recording resources
|
|
958
958
|
*/
|
|
959
959
|
cleanup() {
|
|
960
|
-
this.recordingStream && (this.recordingStream.getTracks().forEach((
|
|
960
|
+
this.recordingStream && (this.recordingStream.getTracks().forEach((i) => i.stop()), this.recordingStream = null), this.mediaRecorder = null, this.audioChunks = [], this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null);
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
|
-
const
|
|
964
|
-
const [
|
|
965
|
-
|
|
966
|
-
const h = A(async (
|
|
967
|
-
var
|
|
963
|
+
const Y = new He(), Ye = (r = {}) => {
|
|
964
|
+
const [i, e] = k(!1), [a, s] = k(!1), [c, o] = k(null), [n, l] = k(null), [m, w] = k(null);
|
|
965
|
+
r.config && Y.updateConfig(r.config);
|
|
966
|
+
const h = A(async (y) => {
|
|
967
|
+
var I;
|
|
968
968
|
try {
|
|
969
|
-
|
|
969
|
+
l(null), o(null), w(null), await Y.startRecording(y, {
|
|
970
970
|
onStart: () => {
|
|
971
|
-
var
|
|
972
|
-
e(!0), (
|
|
971
|
+
var d;
|
|
972
|
+
e(!0), (d = r.onStart) == null || d.call(r);
|
|
973
973
|
},
|
|
974
974
|
onStop: () => {
|
|
975
|
-
var
|
|
976
|
-
e(!1), (
|
|
975
|
+
var d;
|
|
976
|
+
e(!1), (d = r.onStop) == null || d.call(r);
|
|
977
977
|
},
|
|
978
|
-
onError: (
|
|
979
|
-
var
|
|
980
|
-
const
|
|
981
|
-
|
|
978
|
+
onError: (d) => {
|
|
979
|
+
var C;
|
|
980
|
+
const x = d instanceof v ? d : new v(d.message, "RECORDING_ERROR", !0);
|
|
981
|
+
l(x), e(!1), (C = r.onError) == null || C.call(r, x);
|
|
982
982
|
}
|
|
983
983
|
});
|
|
984
|
-
} catch (
|
|
985
|
-
const
|
|
986
|
-
|
|
984
|
+
} catch (d) {
|
|
985
|
+
const x = d instanceof v ? d : new v(
|
|
986
|
+
d instanceof Error ? d.message : String(d),
|
|
987
987
|
"START_FAILED",
|
|
988
988
|
!1
|
|
989
989
|
);
|
|
990
|
-
throw
|
|
990
|
+
throw l(x), e(!1), (I = r.onError) == null || I.call(r, x), x;
|
|
991
991
|
}
|
|
992
992
|
}, []), u = A(async () => {
|
|
993
|
-
var
|
|
993
|
+
var y, I;
|
|
994
994
|
try {
|
|
995
|
-
const
|
|
996
|
-
return d
|
|
997
|
-
} catch (
|
|
998
|
-
const
|
|
999
|
-
|
|
995
|
+
const d = await Y.stopRecording();
|
|
996
|
+
return w(d), e(!1), (y = r.onStop) == null || y.call(r), d;
|
|
997
|
+
} catch (d) {
|
|
998
|
+
const x = d instanceof v ? d : new v(
|
|
999
|
+
d instanceof Error ? d.message : String(d),
|
|
1000
1000
|
"STOP_FAILED",
|
|
1001
1001
|
!1
|
|
1002
1002
|
);
|
|
1003
|
-
throw
|
|
1003
|
+
throw l(x), e(!1), (I = r.onError) == null || I.call(r, x), x;
|
|
1004
1004
|
}
|
|
1005
1005
|
}, []), g = A(
|
|
1006
|
-
async (
|
|
1007
|
-
var
|
|
1006
|
+
async (y, I = {}) => {
|
|
1007
|
+
var d, x;
|
|
1008
1008
|
try {
|
|
1009
|
-
|
|
1010
|
-
const
|
|
1011
|
-
audioBlob:
|
|
1012
|
-
...
|
|
1013
|
-
},
|
|
1014
|
-
return
|
|
1015
|
-
} catch (
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1009
|
+
l(null), s(!0);
|
|
1010
|
+
const C = {
|
|
1011
|
+
audioBlob: y,
|
|
1012
|
+
...I
|
|
1013
|
+
}, p = await Y.transcribe(C);
|
|
1014
|
+
return o(p.transcript), s(!1), (d = r.onTranscriptionComplete) == null || d.call(r, p), p;
|
|
1015
|
+
} catch (C) {
|
|
1016
|
+
const p = C instanceof v ? C : new v(
|
|
1017
|
+
C instanceof Error ? C.message : String(C),
|
|
1018
1018
|
"TRANSCRIPTION_FAILED",
|
|
1019
1019
|
!0
|
|
1020
1020
|
);
|
|
1021
|
-
throw
|
|
1021
|
+
throw l(p), s(!1), (x = r.onError) == null || x.call(r, p), p;
|
|
1022
1022
|
}
|
|
1023
1023
|
},
|
|
1024
1024
|
[]
|
|
1025
|
-
),
|
|
1026
|
-
|
|
1025
|
+
), j = A(() => {
|
|
1026
|
+
Y.cancelRecording(), e(!1), w(null);
|
|
1027
1027
|
}, []);
|
|
1028
1028
|
return {
|
|
1029
1029
|
startRecording: h,
|
|
1030
1030
|
stopRecording: u,
|
|
1031
1031
|
transcribe: g,
|
|
1032
|
-
cancelRecording:
|
|
1033
|
-
isRecording:
|
|
1034
|
-
isTranscribing:
|
|
1032
|
+
cancelRecording: j,
|
|
1033
|
+
isRecording: i,
|
|
1034
|
+
isTranscribing: a,
|
|
1035
1035
|
transcript: c,
|
|
1036
1036
|
error: n,
|
|
1037
1037
|
audioBlob: m
|
|
1038
1038
|
};
|
|
1039
1039
|
};
|
|
1040
1040
|
class Ve {
|
|
1041
|
-
constructor(
|
|
1041
|
+
constructor(i = {}) {
|
|
1042
1042
|
D(this, "config");
|
|
1043
1043
|
D(this, "currentAudio", null);
|
|
1044
1044
|
this.config = {
|
|
@@ -1046,26 +1046,26 @@ class Ve {
|
|
|
1046
1046
|
provider: "piper",
|
|
1047
1047
|
voice: "string",
|
|
1048
1048
|
speed: 1,
|
|
1049
|
-
...
|
|
1049
|
+
...i
|
|
1050
1050
|
};
|
|
1051
1051
|
}
|
|
1052
1052
|
/**
|
|
1053
1053
|
* Update TTS configuration
|
|
1054
1054
|
*/
|
|
1055
|
-
updateConfig(
|
|
1056
|
-
this.config = { ...this.config, ...
|
|
1055
|
+
updateConfig(i) {
|
|
1056
|
+
this.config = { ...this.config, ...i };
|
|
1057
1057
|
}
|
|
1058
1058
|
/**
|
|
1059
1059
|
* Get TTS audio from the API and return as blob
|
|
1060
1060
|
*/
|
|
1061
|
-
async synthesizeSpeech(
|
|
1061
|
+
async synthesizeSpeech(i) {
|
|
1062
1062
|
const {
|
|
1063
1063
|
text: e,
|
|
1064
|
-
voice:
|
|
1064
|
+
voice: a = this.config.voice,
|
|
1065
1065
|
speed: s = this.config.speed
|
|
1066
|
-
} =
|
|
1067
|
-
c.append("text", e), c.append("voice",
|
|
1068
|
-
const
|
|
1066
|
+
} = i, c = new URLSearchParams();
|
|
1067
|
+
c.append("text", e), c.append("voice", a || "string"), c.append("speed", (s == null ? void 0 : s.toString()) || "1");
|
|
1068
|
+
const o = await oe(
|
|
1069
1069
|
`${this.config.baseUrl}/speech/synthesize`,
|
|
1070
1070
|
{
|
|
1071
1071
|
method: "POST",
|
|
@@ -1087,16 +1087,16 @@ class Ve {
|
|
|
1087
1087
|
jitter: !1
|
|
1088
1088
|
}
|
|
1089
1089
|
);
|
|
1090
|
-
if (!
|
|
1090
|
+
if (!o.ok)
|
|
1091
1091
|
throw new Error(
|
|
1092
|
-
`TTS request failed: ${
|
|
1092
|
+
`TTS request failed: ${o.status} ${o.statusText}`
|
|
1093
1093
|
);
|
|
1094
|
-
const n =
|
|
1094
|
+
const n = o.headers.get("content-type");
|
|
1095
1095
|
if (n && n.includes("audio/"))
|
|
1096
|
-
return
|
|
1096
|
+
return o.blob();
|
|
1097
1097
|
try {
|
|
1098
|
-
const
|
|
1099
|
-
throw new Error(`TTS Error: ${JSON.stringify(
|
|
1098
|
+
const l = await o.json();
|
|
1099
|
+
throw new Error(`TTS Error: ${JSON.stringify(l)}`);
|
|
1100
1100
|
} catch {
|
|
1101
1101
|
throw new Error("TTS request failed with unknown error");
|
|
1102
1102
|
}
|
|
@@ -1104,35 +1104,35 @@ class Ve {
|
|
|
1104
1104
|
/**
|
|
1105
1105
|
* Speak text and return a promise that resolves when playback completes
|
|
1106
1106
|
*/
|
|
1107
|
-
async speak(
|
|
1108
|
-
var
|
|
1107
|
+
async speak(i, e) {
|
|
1108
|
+
var a, s;
|
|
1109
1109
|
try {
|
|
1110
|
-
this.stop(), (
|
|
1111
|
-
const c = await this.synthesizeSpeech(
|
|
1112
|
-
return this.currentAudio = new Audio(
|
|
1110
|
+
this.stop(), (a = e == null ? void 0 : e.onStart) == null || a.call(e);
|
|
1111
|
+
const c = await this.synthesizeSpeech(i), o = URL.createObjectURL(c);
|
|
1112
|
+
return this.currentAudio = new Audio(o), new Promise((n, l) => {
|
|
1113
1113
|
if (!this.currentAudio) {
|
|
1114
|
-
|
|
1114
|
+
l(new Error("Audio element not created"));
|
|
1115
1115
|
return;
|
|
1116
1116
|
}
|
|
1117
1117
|
const m = this.currentAudio;
|
|
1118
1118
|
m.onended = () => {
|
|
1119
|
-
var
|
|
1120
|
-
URL.revokeObjectURL(
|
|
1121
|
-
}, m.onerror = (
|
|
1119
|
+
var w;
|
|
1120
|
+
URL.revokeObjectURL(o), this.currentAudio = null, (w = e == null ? void 0 : e.onEnd) == null || w.call(e), n();
|
|
1121
|
+
}, m.onerror = (w) => {
|
|
1122
1122
|
var u;
|
|
1123
|
-
URL.revokeObjectURL(
|
|
1124
|
-
const h = new Error(`Audio playback failed: ${
|
|
1125
|
-
(u = e == null ? void 0 : e.onError) == null || u.call(e, h),
|
|
1126
|
-
}, m.play().catch((
|
|
1123
|
+
URL.revokeObjectURL(o), this.currentAudio = null;
|
|
1124
|
+
const h = new Error(`Audio playback failed: ${w}`);
|
|
1125
|
+
(u = e == null ? void 0 : e.onError) == null || u.call(e, h), l(h);
|
|
1126
|
+
}, m.play().catch((w) => {
|
|
1127
1127
|
var u;
|
|
1128
|
-
URL.revokeObjectURL(
|
|
1129
|
-
const h = new Error(`Failed to play audio: ${
|
|
1130
|
-
(u = e == null ? void 0 : e.onError) == null || u.call(e, h),
|
|
1128
|
+
URL.revokeObjectURL(o), this.currentAudio = null;
|
|
1129
|
+
const h = new Error(`Failed to play audio: ${w.message}`);
|
|
1130
|
+
(u = e == null ? void 0 : e.onError) == null || u.call(e, h), l(h);
|
|
1131
1131
|
});
|
|
1132
1132
|
});
|
|
1133
1133
|
} catch (c) {
|
|
1134
|
-
const
|
|
1135
|
-
throw (s = e == null ? void 0 : e.onError) == null || s.call(e,
|
|
1134
|
+
const o = c instanceof Error ? c : new Error(`TTS Error: ${String(c)}`);
|
|
1135
|
+
throw (s = e == null ? void 0 : e.onError) == null || s.call(e, o), o;
|
|
1136
1136
|
}
|
|
1137
1137
|
}
|
|
1138
1138
|
/**
|
|
@@ -1148,50 +1148,50 @@ class Ve {
|
|
|
1148
1148
|
return this.currentAudio !== null && !this.currentAudio.paused;
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
|
-
const
|
|
1152
|
-
const [
|
|
1153
|
-
|
|
1151
|
+
const ae = new Ve(), Je = (r = {}) => {
|
|
1152
|
+
const [i, e] = k(!1), [a, s] = k(!1), [c, o] = k(null);
|
|
1153
|
+
r.config && ae.updateConfig(r.config);
|
|
1154
1154
|
const n = A(
|
|
1155
|
-
async (m,
|
|
1155
|
+
async (m, w = {}) => {
|
|
1156
1156
|
var h;
|
|
1157
1157
|
try {
|
|
1158
|
-
|
|
1158
|
+
o(null), s(!0);
|
|
1159
1159
|
const u = {
|
|
1160
1160
|
text: m,
|
|
1161
|
-
...
|
|
1161
|
+
...w
|
|
1162
1162
|
};
|
|
1163
|
-
await
|
|
1163
|
+
await ae.speak(u, {
|
|
1164
1164
|
onStart: () => {
|
|
1165
1165
|
var g;
|
|
1166
|
-
s(!1), e(!0), (g =
|
|
1166
|
+
s(!1), e(!0), (g = r.onStart) == null || g.call(r);
|
|
1167
1167
|
},
|
|
1168
1168
|
onEnd: () => {
|
|
1169
1169
|
var g;
|
|
1170
|
-
e(!1), (g =
|
|
1170
|
+
e(!1), (g = r.onEnd) == null || g.call(r);
|
|
1171
1171
|
},
|
|
1172
1172
|
onError: (g) => {
|
|
1173
|
-
var
|
|
1174
|
-
e(!1), s(!1),
|
|
1173
|
+
var j;
|
|
1174
|
+
e(!1), s(!1), o(g), (j = r.onError) == null || j.call(r, g);
|
|
1175
1175
|
}
|
|
1176
1176
|
});
|
|
1177
1177
|
} catch (u) {
|
|
1178
1178
|
const g = u instanceof Error ? u : new Error(String(u));
|
|
1179
|
-
throw
|
|
1179
|
+
throw o(g), e(!1), s(!1), (h = r.onError) == null || h.call(r, g), g;
|
|
1180
1180
|
}
|
|
1181
1181
|
},
|
|
1182
|
-
[
|
|
1183
|
-
),
|
|
1184
|
-
|
|
1182
|
+
[r]
|
|
1183
|
+
), l = A(() => {
|
|
1184
|
+
ae.stop(), e(!1), s(!1);
|
|
1185
1185
|
}, []);
|
|
1186
1186
|
return {
|
|
1187
1187
|
speak: n,
|
|
1188
|
-
stop:
|
|
1189
|
-
isPlaying:
|
|
1190
|
-
isLoading:
|
|
1188
|
+
stop: l,
|
|
1189
|
+
isPlaying: i,
|
|
1190
|
+
isLoading: a,
|
|
1191
1191
|
error: c
|
|
1192
1192
|
};
|
|
1193
|
-
}, Xe = ({ className:
|
|
1194
|
-
const
|
|
1193
|
+
}, Xe = ({ className: r = "" }) => {
|
|
1194
|
+
const i = S(null);
|
|
1195
1195
|
return P(() => {
|
|
1196
1196
|
let e = null;
|
|
1197
1197
|
return (async () => {
|
|
@@ -1199,17 +1199,17 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1199
1199
|
e = await navigator.mediaDevices.getUserMedia({
|
|
1200
1200
|
video: !0,
|
|
1201
1201
|
audio: !1
|
|
1202
|
-
}),
|
|
1202
|
+
}), i.current && (i.current.srcObject = e);
|
|
1203
1203
|
} catch (s) {
|
|
1204
1204
|
console.error("Error accessing camera:", s);
|
|
1205
1205
|
}
|
|
1206
1206
|
})(), () => {
|
|
1207
1207
|
e && e.getTracks().forEach((s) => s.stop());
|
|
1208
1208
|
};
|
|
1209
|
-
}, []), /* @__PURE__ */ t.jsx("div", { className: `iw-relative ${
|
|
1209
|
+
}, []), /* @__PURE__ */ t.jsx("div", { className: `iw-relative ${r}`, children: /* @__PURE__ */ t.jsx(
|
|
1210
1210
|
"video",
|
|
1211
1211
|
{
|
|
1212
|
-
ref:
|
|
1212
|
+
ref: i,
|
|
1213
1213
|
autoPlay: !0,
|
|
1214
1214
|
playsInline: !0,
|
|
1215
1215
|
muted: !0,
|
|
@@ -1219,20 +1219,20 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
}
|
|
1221
1221
|
) });
|
|
1222
|
-
},
|
|
1223
|
-
const { baseColor:
|
|
1222
|
+
}, ee = (r) => {
|
|
1223
|
+
const { baseColor: i, borderRadius: e } = V(), { loading: a, children: s, ...c } = r;
|
|
1224
1224
|
return /* @__PURE__ */ t.jsx(
|
|
1225
|
-
|
|
1225
|
+
ne,
|
|
1226
1226
|
{
|
|
1227
1227
|
style: {
|
|
1228
|
-
background:
|
|
1228
|
+
background: xe(i),
|
|
1229
1229
|
borderRadius: e
|
|
1230
1230
|
},
|
|
1231
1231
|
...c,
|
|
1232
|
-
children:
|
|
1232
|
+
children: a ? /* @__PURE__ */ t.jsx(ge, {}) : s
|
|
1233
1233
|
}
|
|
1234
1234
|
);
|
|
1235
|
-
},
|
|
1235
|
+
}, ce = (r) => /* @__PURE__ */ t.jsxs(
|
|
1236
1236
|
"svg",
|
|
1237
1237
|
{
|
|
1238
1238
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1244,7 +1244,7 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1244
1244
|
strokeWidth: "2",
|
|
1245
1245
|
strokeLinecap: "round",
|
|
1246
1246
|
strokeLinejoin: "round",
|
|
1247
|
-
...
|
|
1247
|
+
...r,
|
|
1248
1248
|
children: [
|
|
1249
1249
|
/* @__PURE__ */ t.jsx("path", { d: "M12 2a10 10 0 0 1 7.38 16.75" }),
|
|
1250
1250
|
/* @__PURE__ */ t.jsx("path", { d: "M12 6v6l4 2" }),
|
|
@@ -1254,27 +1254,27 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1254
1254
|
/* @__PURE__ */ t.jsx("path", { d: "M8.644 21.42a10 10 0 0 0 7.631-.38" })
|
|
1255
1255
|
]
|
|
1256
1256
|
}
|
|
1257
|
-
), Ze = (
|
|
1258
|
-
const
|
|
1259
|
-
return `${e}:${
|
|
1260
|
-
},
|
|
1261
|
-
total:
|
|
1262
|
-
remaining:
|
|
1257
|
+
), Ze = (r, i, e) => Math.max(i, Math.min(e, r)), we = (r) => {
|
|
1258
|
+
const i = Math.max(0, Math.floor(r)), e = Math.floor(i / 60).toString().padStart(2, "0"), a = (i % 60).toString().padStart(2, "0");
|
|
1259
|
+
return `${e}:${a}`;
|
|
1260
|
+
}, le = ({
|
|
1261
|
+
total: r,
|
|
1262
|
+
remaining: i,
|
|
1263
1263
|
size: e = 64,
|
|
1264
|
-
strokeWidth:
|
|
1264
|
+
strokeWidth: a = 6,
|
|
1265
1265
|
className: s = "",
|
|
1266
1266
|
showLabel: c = !0
|
|
1267
1267
|
}) => {
|
|
1268
|
-
const
|
|
1269
|
-
const
|
|
1270
|
-
return { radius:
|
|
1271
|
-
}, [e,
|
|
1268
|
+
const o = Math.max(1, r || 1), n = Ze(i / o, 0, 1), { radius: l, circumference: m, dashOffset: w, center: h } = X(() => {
|
|
1269
|
+
const j = (e - a) / 2, y = 2 * Math.PI * j, I = y * (1 - n), d = Math.round(a) % 2 === 1, x = e / 2 + (d ? 0.5 : 0);
|
|
1270
|
+
return { radius: j, circumference: y, dashOffset: I, center: x };
|
|
1271
|
+
}, [e, a, n]), u = X(() => 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" : "";
|
|
1272
1272
|
return /* @__PURE__ */ t.jsxs(
|
|
1273
1273
|
"div",
|
|
1274
1274
|
{
|
|
1275
1275
|
className: `iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${s}`,
|
|
1276
1276
|
style: { width: e, height: e },
|
|
1277
|
-
"aria-label": `Time remaining ${
|
|
1277
|
+
"aria-label": `Time remaining ${we(i)}`,
|
|
1278
1278
|
role: "timer",
|
|
1279
1279
|
"aria-live": "polite",
|
|
1280
1280
|
children: [
|
|
@@ -1291,9 +1291,9 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1291
1291
|
{
|
|
1292
1292
|
cx: h,
|
|
1293
1293
|
cy: h,
|
|
1294
|
-
r:
|
|
1294
|
+
r: l,
|
|
1295
1295
|
className: "iw-stroke-gray-200",
|
|
1296
|
-
strokeWidth:
|
|
1296
|
+
strokeWidth: a,
|
|
1297
1297
|
fill: "none",
|
|
1298
1298
|
shapeRendering: "geometricPrecision",
|
|
1299
1299
|
vectorEffect: "non-scaling-stroke"
|
|
@@ -1304,13 +1304,13 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1304
1304
|
{
|
|
1305
1305
|
cx: h,
|
|
1306
1306
|
cy: h,
|
|
1307
|
-
r:
|
|
1307
|
+
r: l,
|
|
1308
1308
|
className: `${u} ${g}`,
|
|
1309
|
-
strokeWidth:
|
|
1309
|
+
strokeWidth: a,
|
|
1310
1310
|
strokeLinecap: "round",
|
|
1311
1311
|
fill: "none",
|
|
1312
1312
|
strokeDasharray: m,
|
|
1313
|
-
strokeDashoffset:
|
|
1313
|
+
strokeDashoffset: w,
|
|
1314
1314
|
shapeRendering: "geometricPrecision",
|
|
1315
1315
|
vectorEffect: "non-scaling-stroke",
|
|
1316
1316
|
style: {
|
|
@@ -1325,68 +1325,68 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1325
1325
|
"span",
|
|
1326
1326
|
{
|
|
1327
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:
|
|
1328
|
+
children: we(i)
|
|
1329
1329
|
}
|
|
1330
1330
|
) })
|
|
1331
1331
|
]
|
|
1332
1332
|
}
|
|
1333
1333
|
);
|
|
1334
1334
|
}, Ke = ({
|
|
1335
|
-
label:
|
|
1336
|
-
error:
|
|
1335
|
+
label: r,
|
|
1336
|
+
error: i,
|
|
1337
1337
|
fullWidth: e = !1,
|
|
1338
|
-
className:
|
|
1338
|
+
className: a = "",
|
|
1339
1339
|
id: s,
|
|
1340
1340
|
...c
|
|
1341
1341
|
}) => {
|
|
1342
|
-
const
|
|
1342
|
+
const o = 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", l = i ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", m = e ? "iw-w-full" : "", w = a.includes("iw-h-full") || e ? "iw-h-full" : "";
|
|
1343
1343
|
return /* @__PURE__ */ t.jsxs(
|
|
1344
1344
|
"div",
|
|
1345
1345
|
{
|
|
1346
1346
|
className: `iw-h-full iw-flex iw-flex-col ${e ? "iw-w-full" : ""}`,
|
|
1347
1347
|
children: [
|
|
1348
|
-
|
|
1348
|
+
r && /* @__PURE__ */ t.jsx(
|
|
1349
1349
|
"label",
|
|
1350
1350
|
{
|
|
1351
|
-
htmlFor:
|
|
1351
|
+
htmlFor: o,
|
|
1352
1352
|
className: "iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",
|
|
1353
|
-
children:
|
|
1353
|
+
children: r
|
|
1354
1354
|
}
|
|
1355
1355
|
),
|
|
1356
1356
|
/* @__PURE__ */ t.jsx(
|
|
1357
1357
|
"textarea",
|
|
1358
1358
|
{
|
|
1359
|
-
id:
|
|
1360
|
-
className: `${n} ${
|
|
1361
|
-
"aria-invalid":
|
|
1359
|
+
id: o,
|
|
1360
|
+
className: `${n} ${l} ${m} ${w} ${a}`,
|
|
1361
|
+
"aria-invalid": i ? "true" : "false",
|
|
1362
1362
|
...c
|
|
1363
1363
|
}
|
|
1364
1364
|
),
|
|
1365
|
-
|
|
1365
|
+
i && /* @__PURE__ */ t.jsx("p", { className: "iw-mt-1 iw-text-sm iw-text-red-600", children: i })
|
|
1366
1366
|
]
|
|
1367
1367
|
}
|
|
1368
1368
|
);
|
|
1369
1369
|
}, et = ({
|
|
1370
|
-
value:
|
|
1371
|
-
onChange:
|
|
1370
|
+
value: r,
|
|
1371
|
+
onChange: i,
|
|
1372
1372
|
onSubmit: e,
|
|
1373
|
-
isSubmitDisabled:
|
|
1373
|
+
isSubmitDisabled: a,
|
|
1374
1374
|
state: s,
|
|
1375
1375
|
editingTime: c
|
|
1376
1376
|
}) => {
|
|
1377
|
-
const
|
|
1378
|
-
n.key === "Enter" && (n.ctrlKey || n.metaKey) && !
|
|
1377
|
+
const o = (n) => {
|
|
1378
|
+
n.key === "Enter" && (n.ctrlKey || n.metaKey) && !a && (n.preventDefault(), e());
|
|
1379
1379
|
};
|
|
1380
1380
|
return /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-h-full ", children: [
|
|
1381
1381
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
|
|
1382
1382
|
/* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Your Answer" }),
|
|
1383
1383
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
1384
1384
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
1385
|
-
/* @__PURE__ */ t.jsx(
|
|
1385
|
+
/* @__PURE__ */ t.jsx(ce, { className: "iw-size-4 iw-text-orange-600" }),
|
|
1386
1386
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to edit: " })
|
|
1387
1387
|
] }),
|
|
1388
1388
|
/* @__PURE__ */ t.jsx(
|
|
1389
|
-
|
|
1389
|
+
le,
|
|
1390
1390
|
{
|
|
1391
1391
|
total: c,
|
|
1392
1392
|
remaining: s.currentPhaseTimeRemaining,
|
|
@@ -1400,9 +1400,9 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1400
1400
|
/* @__PURE__ */ t.jsx(
|
|
1401
1401
|
Ke,
|
|
1402
1402
|
{
|
|
1403
|
-
value:
|
|
1404
|
-
onChange:
|
|
1405
|
-
onKeyDown:
|
|
1403
|
+
value: r,
|
|
1404
|
+
onChange: i,
|
|
1405
|
+
onKeyDown: o,
|
|
1406
1406
|
placeholder: "Type your answer here...",
|
|
1407
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",
|
|
1408
1408
|
onPaste: (n) => n.preventDefault(),
|
|
@@ -1412,129 +1412,129 @@ const ie = new Ve(), Je = (i = {}) => {
|
|
|
1412
1412
|
onDragOver: (n) => n.preventDefault()
|
|
1413
1413
|
}
|
|
1414
1414
|
),
|
|
1415
|
-
/* @__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(ee, { onClick: e, disabled: a, children: "Submit Answer" }) })
|
|
1416
1416
|
] })
|
|
1417
1417
|
] });
|
|
1418
1418
|
}, tt = ({
|
|
1419
|
-
className:
|
|
1420
|
-
width:
|
|
1419
|
+
className: r = "",
|
|
1420
|
+
width: i,
|
|
1421
1421
|
height: e = 56,
|
|
1422
|
-
barWidth:
|
|
1422
|
+
barWidth: a = 3,
|
|
1423
1423
|
gap: s = 2,
|
|
1424
1424
|
fftSize: c = 1024,
|
|
1425
|
-
smoothingTimeConstant:
|
|
1425
|
+
smoothingTimeConstant: o = 0.8,
|
|
1426
1426
|
mediaStream: n,
|
|
1427
|
-
startOnMount:
|
|
1427
|
+
startOnMount: l = !0
|
|
1428
1428
|
}) => {
|
|
1429
|
-
const { baseColor: m } =
|
|
1429
|
+
const { baseColor: m } = V(), w = S(null), h = S(null), u = S(null), g = S(null), j = S(null), y = S(null), I = S(!1), [d, x] = k(null);
|
|
1430
1430
|
P(() => {
|
|
1431
|
-
if (
|
|
1432
|
-
const
|
|
1433
|
-
const
|
|
1434
|
-
if (!
|
|
1435
|
-
const
|
|
1436
|
-
|
|
1437
|
-
},
|
|
1438
|
-
return
|
|
1439
|
-
}, [
|
|
1440
|
-
if (!
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1431
|
+
if (i || !h.current) return;
|
|
1432
|
+
const p = h.current, $ = () => {
|
|
1433
|
+
const M = w.current;
|
|
1434
|
+
if (!M) return;
|
|
1435
|
+
const N = p.clientWidth, T = e;
|
|
1436
|
+
M.width = Math.max(1, Math.floor(N * window.devicePixelRatio || 1)), M.height = Math.max(1, Math.floor(T * window.devicePixelRatio || 1));
|
|
1437
|
+
}, b = new ResizeObserver($);
|
|
1438
|
+
return b.observe(p), $(), () => b.disconnect();
|
|
1439
|
+
}, [i, e]), P(() => {
|
|
1440
|
+
if (!i) return;
|
|
1441
|
+
const p = w.current;
|
|
1442
|
+
p && (p.width = Math.max(
|
|
1443
1443
|
1,
|
|
1444
|
-
Math.floor(
|
|
1445
|
-
),
|
|
1444
|
+
Math.floor(i * (window.devicePixelRatio || 1))
|
|
1445
|
+
), p.height = Math.max(
|
|
1446
1446
|
1,
|
|
1447
1447
|
Math.floor(e * (window.devicePixelRatio || 1))
|
|
1448
1448
|
));
|
|
1449
|
-
}, [
|
|
1450
|
-
let
|
|
1449
|
+
}, [i, e]), P(() => {
|
|
1450
|
+
let p = !1;
|
|
1451
1451
|
return (async () => {
|
|
1452
1452
|
try {
|
|
1453
|
-
const
|
|
1454
|
-
u.current =
|
|
1455
|
-
let
|
|
1456
|
-
if (!
|
|
1457
|
-
if (!
|
|
1458
|
-
|
|
1453
|
+
const b = new (window.AudioContext || window.webkitAudioContext)();
|
|
1454
|
+
u.current = b;
|
|
1455
|
+
let M = n;
|
|
1456
|
+
if (!M) {
|
|
1457
|
+
if (!l) return;
|
|
1458
|
+
M = await navigator.mediaDevices.getUserMedia({
|
|
1459
1459
|
audio: !0,
|
|
1460
1460
|
video: !1
|
|
1461
|
-
}),
|
|
1461
|
+
}), I.current = !0;
|
|
1462
1462
|
}
|
|
1463
|
-
if (
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
} catch (
|
|
1469
|
-
|
|
1463
|
+
if (p) return;
|
|
1464
|
+
const N = b.createAnalyser();
|
|
1465
|
+
N.fftSize = c, N.smoothingTimeConstant = o, g.current = N;
|
|
1466
|
+
const T = b.createMediaStreamSource(M);
|
|
1467
|
+
j.current = T, T.connect(N), C();
|
|
1468
|
+
} catch (b) {
|
|
1469
|
+
x((b == null ? void 0 : b.message) || "Failed to initialize microphone");
|
|
1470
1470
|
}
|
|
1471
1471
|
})(), () => {
|
|
1472
|
-
var
|
|
1473
|
-
|
|
1472
|
+
var b, M, N, T;
|
|
1473
|
+
p = !0, y.current && cancelAnimationFrame(y.current);
|
|
1474
1474
|
try {
|
|
1475
|
-
(
|
|
1475
|
+
(b = j.current) == null || b.disconnect();
|
|
1476
1476
|
} catch {
|
|
1477
1477
|
}
|
|
1478
1478
|
try {
|
|
1479
|
-
(
|
|
1479
|
+
(M = g.current) == null || M.disconnect();
|
|
1480
1480
|
} catch {
|
|
1481
1481
|
}
|
|
1482
|
-
|
|
1482
|
+
I.current && ((T = ((N = j.current) == null ? void 0 : N.mediaStream) || void 0) == null || T.getTracks().forEach((q) => q.stop())), u.current && u.current.state !== "closed" && u.current.close();
|
|
1483
1483
|
};
|
|
1484
|
-
}, [n, c,
|
|
1485
|
-
const
|
|
1486
|
-
const
|
|
1487
|
-
if (!
|
|
1488
|
-
const
|
|
1489
|
-
if (!
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
const
|
|
1493
|
-
for (let z = 0; z <
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
const ye = Math.min(
|
|
1497
|
-
rt(
|
|
1484
|
+
}, [n, c, o, l]);
|
|
1485
|
+
const C = () => {
|
|
1486
|
+
const p = w.current, $ = g.current;
|
|
1487
|
+
if (!p || !$) return;
|
|
1488
|
+
const b = p.getContext("2d");
|
|
1489
|
+
if (!b) return;
|
|
1490
|
+
const M = window.devicePixelRatio || 1, N = p.width, T = p.height, q = $.frequencyBinCount, F = new Uint8Array(q), Q = () => {
|
|
1491
|
+
y.current = requestAnimationFrame(Q), $.getByteTimeDomainData(F), b.clearRect(0, 0, N, T), b.fillStyle = "rgba(0,0,0,0)", b.fillRect(0, 0, N, T);
|
|
1492
|
+
const B = Math.max(1, Math.floor(a * M)), L = Math.max(1, Math.floor(s * M)), U = B + L, E = Math.max(8, Math.floor((N + L) / U)), W = Math.floor(F.length / E);
|
|
1493
|
+
for (let z = 0; z < E; z++) {
|
|
1494
|
+
const te = Math.min(F.length - 1, z * W), re = F[te] / 128 - 1, G = Math.abs(re), ie = Math.pow(G, 0.6), H = Math.max(T * 0.06, ie * (T * 0.9)), se = z * U, f = (T - H) / 2, O = 140 - Math.min(140, 140 * G), J = 85, be = 48 + Math.floor(12 * (1 - G));
|
|
1495
|
+
b.fillStyle = `${m}`, b.shadowColor = `hsla(${O}, ${J}%, ${be}%, ${0.25 * G})`, b.shadowBlur = 8 * G;
|
|
1496
|
+
const ye = Math.min(B / 2, H / 2);
|
|
1497
|
+
rt(b, se, f, B, H, ye), b.fill();
|
|
1498
1498
|
}
|
|
1499
1499
|
};
|
|
1500
|
-
|
|
1500
|
+
Q();
|
|
1501
1501
|
};
|
|
1502
1502
|
return /* @__PURE__ */ t.jsxs(
|
|
1503
1503
|
"div",
|
|
1504
1504
|
{
|
|
1505
1505
|
ref: h,
|
|
1506
|
-
className: `iw-relative iw-w-full iw-overflow-hidden iw-rounded-md iw-bg-gray-50 ${
|
|
1506
|
+
className: `iw-relative iw-w-full iw-overflow-hidden iw-rounded-md iw-bg-gray-50 ${r}`,
|
|
1507
1507
|
style: { height: e },
|
|
1508
1508
|
children: [
|
|
1509
|
-
/* @__PURE__ */ t.jsx("canvas", { ref:
|
|
1510
|
-
|
|
1509
|
+
/* @__PURE__ */ t.jsx("canvas", { ref: w, className: "iw-w-full iw-h-full" }),
|
|
1510
|
+
d && /* @__PURE__ */ t.jsx("div", { className: "iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center", children: /* @__PURE__ */ t.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: d }) })
|
|
1511
1511
|
]
|
|
1512
1512
|
}
|
|
1513
1513
|
);
|
|
1514
1514
|
};
|
|
1515
|
-
function rt(
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1515
|
+
function rt(r, i, e, a, s, c) {
|
|
1516
|
+
const o = Math.min(c, a / 2, s / 2);
|
|
1517
|
+
r.beginPath(), r.moveTo(i + o, e), r.lineTo(i + a - o, e), r.quadraticCurveTo(i + a, e, i + a, e + o), r.lineTo(i + a, e + s - o), r.quadraticCurveTo(i + a, e + s, i + a - o, e + s), r.lineTo(i + o, e + s), r.quadraticCurveTo(i, e + s, i, e + s - o), r.lineTo(i, e + o), r.quadraticCurveTo(i, e, i + o, e), r.closePath();
|
|
1518
1518
|
}
|
|
1519
1519
|
const it = ({
|
|
1520
|
-
state:
|
|
1521
|
-
answeringTime:
|
|
1520
|
+
state: r,
|
|
1521
|
+
answeringTime: i,
|
|
1522
1522
|
nextPhase: e,
|
|
1523
|
-
sttError:
|
|
1523
|
+
sttError: a
|
|
1524
1524
|
}) => /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-justify-between iw-h-full ", children: [
|
|
1525
1525
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1526
1526
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
|
|
1527
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...." }),
|
|
1528
1528
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
1529
1529
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
1530
|
-
/* @__PURE__ */ t.jsx(
|
|
1530
|
+
/* @__PURE__ */ t.jsx(ce, { className: "iw-size-4 iw-text-orange-600" }),
|
|
1531
1531
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to talk: " })
|
|
1532
1532
|
] }),
|
|
1533
1533
|
/* @__PURE__ */ t.jsx(
|
|
1534
|
-
|
|
1534
|
+
le,
|
|
1535
1535
|
{
|
|
1536
|
-
total:
|
|
1537
|
-
remaining:
|
|
1536
|
+
total: i,
|
|
1537
|
+
remaining: r.currentPhaseTimeRemaining,
|
|
1538
1538
|
size: 50,
|
|
1539
1539
|
strokeWidth: 4
|
|
1540
1540
|
}
|
|
@@ -1545,13 +1545,13 @@ const it = ({
|
|
|
1545
1545
|
] }),
|
|
1546
1546
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1547
1547
|
/* @__PURE__ */ t.jsx(tt, {}),
|
|
1548
|
-
|
|
1548
|
+
a && /* @__PURE__ */ t.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
|
|
1549
1549
|
"Recording error: ",
|
|
1550
|
-
|
|
1550
|
+
a.message
|
|
1551
1551
|
] })
|
|
1552
1552
|
] }),
|
|
1553
1553
|
/* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ t.jsx(
|
|
1554
|
-
|
|
1554
|
+
ee,
|
|
1555
1555
|
{
|
|
1556
1556
|
onClick: () => {
|
|
1557
1557
|
e();
|
|
@@ -1561,18 +1561,18 @@ const it = ({
|
|
|
1561
1561
|
) })
|
|
1562
1562
|
] });
|
|
1563
1563
|
function st() {
|
|
1564
|
-
const [
|
|
1565
|
-
() => [0, 1, 2].map((
|
|
1564
|
+
const [r, i] = k(!0), e = X(
|
|
1565
|
+
() => [0, 1, 2].map((a) => ({ id: a })),
|
|
1566
1566
|
[]
|
|
1567
1567
|
);
|
|
1568
1568
|
return P(() => {
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1569
|
+
const a = setInterval(() => {
|
|
1570
|
+
i((s) => !s);
|
|
1571
1571
|
}, 1500);
|
|
1572
|
-
return () => clearInterval(
|
|
1572
|
+
return () => clearInterval(a);
|
|
1573
1573
|
}, []), /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-h-full", children: [
|
|
1574
|
-
/* @__PURE__ */ t.jsx("div", { className: "iw-relative iw-w-80 iw-h-48 ", "aria-hidden": !0, children: e.map((
|
|
1575
|
-
const c = s * 50,
|
|
1574
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-relative iw-w-80 iw-h-48 ", "aria-hidden": !0, children: e.map((a, s) => {
|
|
1575
|
+
const c = s * 50, o = r ? c : c + 12, n = r ? 1 : 0.08, l = s * 140;
|
|
1576
1576
|
return /* @__PURE__ */ t.jsx(
|
|
1577
1577
|
"div",
|
|
1578
1578
|
{
|
|
@@ -1580,9 +1580,9 @@ function st() {
|
|
|
1580
1580
|
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",
|
|
1581
1581
|
style: {
|
|
1582
1582
|
top: 0,
|
|
1583
|
-
transform: `translateY(${
|
|
1583
|
+
transform: `translateY(${o}px)`,
|
|
1584
1584
|
opacity: n,
|
|
1585
|
-
transition: `transform 600ms cubic-bezier(.2,.9,.3,1) ${
|
|
1585
|
+
transition: `transform 600ms cubic-bezier(.2,.9,.3,1) ${l}ms, opacity 400ms ease ${l}ms`
|
|
1586
1586
|
},
|
|
1587
1587
|
children: /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-gap-3 iw-items-center", children: [
|
|
1588
1588
|
/* @__PURE__ */ t.jsx("div", { className: "iw-w-10 iw-h-10 iw-bg-gray-300 iw-rounded iw-flex-shrink-0" }),
|
|
@@ -1592,39 +1592,39 @@ function st() {
|
|
|
1592
1592
|
] })
|
|
1593
1593
|
] })
|
|
1594
1594
|
},
|
|
1595
|
-
|
|
1595
|
+
a.id
|
|
1596
1596
|
);
|
|
1597
1597
|
}) }),
|
|
1598
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..." }) })
|
|
1599
1599
|
] });
|
|
1600
1600
|
}
|
|
1601
|
-
const
|
|
1602
|
-
isOpen:
|
|
1603
|
-
onClose:
|
|
1601
|
+
const pe = ({
|
|
1602
|
+
isOpen: r,
|
|
1603
|
+
onClose: i,
|
|
1604
1604
|
children: e,
|
|
1605
|
-
title:
|
|
1605
|
+
title: a,
|
|
1606
1606
|
showCloseButton: s = !0,
|
|
1607
1607
|
closeOnOverlayClick: c = !0,
|
|
1608
|
-
closeOnEscape:
|
|
1608
|
+
closeOnEscape: o = !0,
|
|
1609
1609
|
className: n = ""
|
|
1610
1610
|
}) => {
|
|
1611
1611
|
if (P(() => {
|
|
1612
|
-
if (!
|
|
1613
|
-
const
|
|
1614
|
-
h.key === "Escape" &&
|
|
1612
|
+
if (!r || !o) return;
|
|
1613
|
+
const w = (h) => {
|
|
1614
|
+
h.key === "Escape" && i();
|
|
1615
1615
|
};
|
|
1616
|
-
return document.addEventListener("keydown",
|
|
1617
|
-
}, [
|
|
1616
|
+
return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
|
|
1617
|
+
}, [r, o, i]), P(() => (r ? (document.body.style.overflow = "hidden", document.body.classList.add("interview-widget-container")) : (document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container")), () => {
|
|
1618
1618
|
document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container");
|
|
1619
|
-
}), [
|
|
1620
|
-
const
|
|
1621
|
-
c &&
|
|
1619
|
+
}), [r]), !r) return null;
|
|
1620
|
+
const l = (w) => {
|
|
1621
|
+
c && w.target === w.currentTarget && i();
|
|
1622
1622
|
}, m = /* @__PURE__ */ t.jsxs("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center", children: [
|
|
1623
1623
|
/* @__PURE__ */ t.jsx(
|
|
1624
1624
|
"div",
|
|
1625
1625
|
{
|
|
1626
1626
|
className: "iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",
|
|
1627
|
-
onClick:
|
|
1627
|
+
onClick: l
|
|
1628
1628
|
}
|
|
1629
1629
|
),
|
|
1630
1630
|
/* @__PURE__ */ t.jsxs(
|
|
@@ -1633,21 +1633,21 @@ const fe = ({
|
|
|
1633
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}`,
|
|
1634
1634
|
role: "dialog",
|
|
1635
1635
|
"aria-modal": "true",
|
|
1636
|
-
"aria-labelledby":
|
|
1636
|
+
"aria-labelledby": a ? "dialog-title" : void 0,
|
|
1637
1637
|
children: [
|
|
1638
|
-
(
|
|
1639
|
-
|
|
1638
|
+
(a || 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
|
+
a && /* @__PURE__ */ t.jsx(
|
|
1640
1640
|
"h2",
|
|
1641
1641
|
{
|
|
1642
1642
|
id: "dialog-title",
|
|
1643
1643
|
className: "iw-text-lg iw-font-semibold iw-text-gray-900",
|
|
1644
|
-
children:
|
|
1644
|
+
children: a
|
|
1645
1645
|
}
|
|
1646
1646
|
),
|
|
1647
1647
|
s && /* @__PURE__ */ t.jsx(
|
|
1648
1648
|
"button",
|
|
1649
1649
|
{
|
|
1650
|
-
onClick:
|
|
1650
|
+
onClick: i,
|
|
1651
1651
|
className: "iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100",
|
|
1652
1652
|
"aria-label": "Close dialog",
|
|
1653
1653
|
children: /* @__PURE__ */ t.jsx(
|
|
@@ -1678,13 +1678,13 @@ const fe = ({
|
|
|
1678
1678
|
] });
|
|
1679
1679
|
return ke(m, document.body);
|
|
1680
1680
|
}, at = ({
|
|
1681
|
-
open:
|
|
1682
|
-
onClose:
|
|
1681
|
+
open: r,
|
|
1682
|
+
onClose: i
|
|
1683
1683
|
}) => /* @__PURE__ */ t.jsx(
|
|
1684
|
-
|
|
1684
|
+
pe,
|
|
1685
1685
|
{
|
|
1686
|
-
isOpen:
|
|
1687
|
-
onClose:
|
|
1686
|
+
isOpen: r,
|
|
1687
|
+
onClose: i || (() => {
|
|
1688
1688
|
}),
|
|
1689
1689
|
title: "Interview Complete!",
|
|
1690
1690
|
className: "",
|
|
@@ -1711,10 +1711,10 @@ const fe = ({
|
|
|
1711
1711
|
] })
|
|
1712
1712
|
}
|
|
1713
1713
|
), nt = ({
|
|
1714
|
-
size:
|
|
1715
|
-
className:
|
|
1714
|
+
size: r = "192px",
|
|
1715
|
+
className: i,
|
|
1716
1716
|
colors: e,
|
|
1717
|
-
animationDuration:
|
|
1717
|
+
animationDuration: a = 20
|
|
1718
1718
|
}) => {
|
|
1719
1719
|
const c = { ...{
|
|
1720
1720
|
bg: "oklch(95% 0.02 264.695)",
|
|
@@ -1724,23 +1724,23 @@ const fe = ({
|
|
|
1724
1724
|
// Pastel blue
|
|
1725
1725
|
c3: "oklch(78% 0.14 280)"
|
|
1726
1726
|
// Pastel purple/lavender
|
|
1727
|
-
}, ...e },
|
|
1727
|
+
}, ...e }, o = parseInt(r.replace("px", ""), 10), n = o < 50 ? Math.max(o * 8e-3, 1) : Math.max(o * 0.015, 4), l = o < 50 ? Math.max(o * 4e-3, 1.2) : Math.max(o * 8e-3, 1.5), m = o < 50 ? Math.max(o * 4e-3, 0.05) : Math.max(o * 8e-3, 0.1), w = o < 50 ? Math.max(o * 4e-3, 0.5) : Math.max(o * 8e-3, 2), h = o < 30 ? "0%" : o < 50 ? "5%" : o < 100 ? "15%" : "25%", u = o < 30 ? 1.1 : o < 50 ? Math.max(l * 1.2, 1.3) : l;
|
|
1728
1728
|
return /* @__PURE__ */ t.jsx(
|
|
1729
1729
|
"div",
|
|
1730
1730
|
{
|
|
1731
|
-
className: `siri-orb ${
|
|
1731
|
+
className: `siri-orb ${i}`,
|
|
1732
1732
|
style: {
|
|
1733
|
-
width:
|
|
1734
|
-
height:
|
|
1733
|
+
width: r,
|
|
1734
|
+
height: r,
|
|
1735
1735
|
"--bg": c.bg,
|
|
1736
1736
|
"--c1": c.c1,
|
|
1737
1737
|
"--c2": c.c2,
|
|
1738
1738
|
"--c3": c.c3,
|
|
1739
|
-
"--animation-duration": `${
|
|
1739
|
+
"--animation-duration": `${a}s`,
|
|
1740
1740
|
"--blur-amount": `${n}px`,
|
|
1741
1741
|
"--contrast-amount": u,
|
|
1742
1742
|
"--dot-size": `${m}px`,
|
|
1743
|
-
"--shadow-spread": `${
|
|
1743
|
+
"--shadow-spread": `${w}px`,
|
|
1744
1744
|
"--mask-radius": h
|
|
1745
1745
|
},
|
|
1746
1746
|
children: /* @__PURE__ */ t.jsx("style", { children: `
|
|
@@ -1852,38 +1852,38 @@ const fe = ({
|
|
|
1852
1852
|
}
|
|
1853
1853
|
);
|
|
1854
1854
|
};
|
|
1855
|
-
function ot({ ttsError:
|
|
1855
|
+
function ot({ ttsError: r }) {
|
|
1856
1856
|
return /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-w-full iw-h-full", children: [
|
|
1857
1857
|
/* @__PURE__ */ t.jsx(nt, { size: "80px" }),
|
|
1858
|
-
|
|
1858
|
+
r && /* @__PURE__ */ t.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
|
|
1859
1859
|
"Audio playback failed: ",
|
|
1860
|
-
|
|
1860
|
+
r.message
|
|
1861
1861
|
] }),
|
|
1862
1862
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text- iw-text-gray-700", children: "Your AI interviewer is speaking..." })
|
|
1863
1863
|
] });
|
|
1864
1864
|
}
|
|
1865
|
-
const ct = ({ state:
|
|
1865
|
+
const ct = ({ state: r, thinkingTime: i, nextPhase: e }) => /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-gap-6 iw-items-center iw-justify-center iw-text-center iw-h-full ", children: [
|
|
1866
1866
|
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1867
1867
|
/* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Get Ready to Answer" }),
|
|
1868
1868
|
/* @__PURE__ */ t.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." })
|
|
1869
1869
|
] }),
|
|
1870
1870
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
|
|
1871
1871
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
|
|
1872
|
-
/* @__PURE__ */ t.jsx(
|
|
1872
|
+
/* @__PURE__ */ t.jsx(ce, { className: "iw-size-4 iw-text-orange-600" }),
|
|
1873
1873
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to think: " })
|
|
1874
1874
|
] }),
|
|
1875
1875
|
/* @__PURE__ */ t.jsx(
|
|
1876
|
-
|
|
1876
|
+
le,
|
|
1877
1877
|
{
|
|
1878
|
-
total:
|
|
1879
|
-
remaining:
|
|
1878
|
+
total: i,
|
|
1879
|
+
remaining: r.currentPhaseTimeRemaining,
|
|
1880
1880
|
size: 50,
|
|
1881
1881
|
strokeWidth: 4
|
|
1882
1882
|
}
|
|
1883
1883
|
)
|
|
1884
1884
|
] }),
|
|
1885
1885
|
/* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ t.jsx(
|
|
1886
|
-
|
|
1886
|
+
ee,
|
|
1887
1887
|
{
|
|
1888
1888
|
onClick: () => {
|
|
1889
1889
|
e();
|
|
@@ -1891,7 +1891,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1891
1891
|
children: "Start Answering"
|
|
1892
1892
|
}
|
|
1893
1893
|
) })
|
|
1894
|
-
] }), lt = ({ sttError:
|
|
1894
|
+
] }), lt = ({ sttError: r }) => /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full", children: [
|
|
1895
1895
|
/* @__PURE__ */ t.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 60 60", fill: "none", children: [
|
|
1896
1896
|
/* @__PURE__ */ t.jsx(
|
|
1897
1897
|
"rect",
|
|
@@ -1927,12 +1927,12 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1927
1927
|
] }),
|
|
1928
1928
|
/* @__PURE__ */ t.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" }),
|
|
1929
1929
|
/* @__PURE__ */ t.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." }),
|
|
1930
|
-
|
|
1930
|
+
r && /* @__PURE__ */ t.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
|
|
1931
1931
|
"Transcription error: ",
|
|
1932
|
-
|
|
1933
|
-
|
|
1932
|
+
r.message,
|
|
1933
|
+
r.recoverable && " (attempting to continue)"
|
|
1934
1934
|
] })
|
|
1935
|
-
] }), dt = (
|
|
1935
|
+
] }), dt = (r) => /* @__PURE__ */ t.jsxs(
|
|
1936
1936
|
"svg",
|
|
1937
1937
|
{
|
|
1938
1938
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1944,7 +1944,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1944
1944
|
strokeWidth: "2",
|
|
1945
1945
|
strokeLinecap: "round",
|
|
1946
1946
|
strokeLinejoin: "round",
|
|
1947
|
-
...
|
|
1947
|
+
...r,
|
|
1948
1948
|
children: [
|
|
1949
1949
|
/* @__PURE__ */ t.jsx("path", { d: "M12 8V4H8" }),
|
|
1950
1950
|
/* @__PURE__ */ t.jsx("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
|
|
@@ -1955,10 +1955,10 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1955
1955
|
]
|
|
1956
1956
|
}
|
|
1957
1957
|
), wt = ({
|
|
1958
|
-
question:
|
|
1959
|
-
isLoading:
|
|
1958
|
+
question: r,
|
|
1959
|
+
isLoading: i = !1
|
|
1960
1960
|
}) => {
|
|
1961
|
-
const { baseColor: e } =
|
|
1961
|
+
const { baseColor: e } = V();
|
|
1962
1962
|
return /* @__PURE__ */ t.jsx(
|
|
1963
1963
|
"div",
|
|
1964
1964
|
{
|
|
@@ -1975,18 +1975,18 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
1975
1975
|
) }),
|
|
1976
1976
|
/* @__PURE__ */ t.jsx("div", { className: "iw-absolute iw-bottom-2 iw-translate-x-1/2 iw-flex iw-mt-2", children: /* @__PURE__ */ t.jsx("div", { className: "iw-text-sm", children: "Novara" }) })
|
|
1977
1977
|
] }),
|
|
1978
|
-
|
|
1978
|
+
i ? /* @__PURE__ */ t.jsxs("div", { className: "iw-animate-pulse iw-w-full iw-space-y-3 iw-mr-10", children: [
|
|
1979
1979
|
/* @__PURE__ */ t.jsx("div", { className: "iw-h-5 iw-bg-gray-200 iw-rounded iw-w-full" }),
|
|
1980
1980
|
/* @__PURE__ */ t.jsx("div", { className: "iw-h-5 iw-bg-gray-200 iw-rounded iw-w-3/4" })
|
|
1981
|
-
] }) : /* @__PURE__ */ t.jsx("p", { className: "iw-text-lg iw-leading-8", children:
|
|
1981
|
+
] }) : /* @__PURE__ */ t.jsx("p", { className: "iw-text-lg iw-leading-8", children: r == null ? void 0 : r.question })
|
|
1982
1982
|
] })
|
|
1983
1983
|
}
|
|
1984
1984
|
);
|
|
1985
1985
|
}, ut = ({
|
|
1986
|
-
confirmExitInterview:
|
|
1987
|
-
isOpen:
|
|
1986
|
+
confirmExitInterview: r,
|
|
1987
|
+
isOpen: i,
|
|
1988
1988
|
onClose: e
|
|
1989
|
-
}) => /* @__PURE__ */ t.jsx(
|
|
1989
|
+
}) => /* @__PURE__ */ t.jsx(pe, { isOpen: i, onClose: e, title: "Exit Interview", children: /* @__PURE__ */ t.jsxs("div", { className: "iw-space-y-4", children: [
|
|
1990
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." }),
|
|
1991
1991
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-justify-end iw-space-x-2", children: [
|
|
1992
1992
|
/* @__PURE__ */ t.jsx(
|
|
@@ -2001,13 +2001,13 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2001
2001
|
"button",
|
|
2002
2002
|
{
|
|
2003
2003
|
className: "iw-px-4 iw-py-2 iw-bg-red-600 iw-text-white iw-rounded iw-font-medium",
|
|
2004
|
-
onClick:
|
|
2004
|
+
onClick: r,
|
|
2005
2005
|
children: "Confirm Exit"
|
|
2006
2006
|
}
|
|
2007
2007
|
)
|
|
2008
2008
|
] })
|
|
2009
|
-
] }) }), ht = ({ title:
|
|
2010
|
-
const { baseColor: e } =
|
|
2009
|
+
] }) }), ht = ({ title: r, onExit: i }) => {
|
|
2010
|
+
const { baseColor: e } = V(), [a, s] = k(!1);
|
|
2011
2011
|
return /* @__PURE__ */ t.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
|
|
2012
2012
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3", children: [
|
|
2013
2013
|
/* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
|
|
@@ -2021,7 +2021,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2021
2021
|
),
|
|
2022
2022
|
/* @__PURE__ */ t.jsx("p", { className: "iw-text-sm iw-font-medium", children: "Novara" })
|
|
2023
2023
|
] }),
|
|
2024
|
-
/* @__PURE__ */ t.jsx("h1", { className: "iw-text-base iw-font-bold", children:
|
|
2024
|
+
/* @__PURE__ */ t.jsx("h1", { className: "iw-text-base iw-font-bold", children: r }),
|
|
2025
2025
|
/* @__PURE__ */ t.jsx(
|
|
2026
2026
|
"button",
|
|
2027
2027
|
{
|
|
@@ -2035,160 +2035,165 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2035
2035
|
/* @__PURE__ */ t.jsx(
|
|
2036
2036
|
ut,
|
|
2037
2037
|
{
|
|
2038
|
-
isOpen:
|
|
2038
|
+
isOpen: a,
|
|
2039
2039
|
confirmExitInterview: () => {
|
|
2040
|
-
|
|
2040
|
+
i(), s(!1);
|
|
2041
2041
|
},
|
|
2042
2042
|
onClose: () => s(!1)
|
|
2043
2043
|
}
|
|
2044
2044
|
)
|
|
2045
2045
|
] });
|
|
2046
2046
|
}, mt = ({
|
|
2047
|
+
interviewTitle: r,
|
|
2047
2048
|
interviewId: i,
|
|
2048
|
-
onComplete:
|
|
2049
|
-
className:
|
|
2049
|
+
onComplete: e,
|
|
2050
|
+
className: a = ""
|
|
2050
2051
|
}) => {
|
|
2051
|
-
const
|
|
2052
|
-
thinkingTime: (
|
|
2053
|
-
answeringTime: (
|
|
2054
|
-
editingTime: (
|
|
2055
|
-
}, { thinkingTime:
|
|
2052
|
+
const s = We(), { baseUrl: c, authToken: o } = Se(), { timers: n, stt: l, tts: m } = Ce(), [w, h] = k(null), [u, g] = k(""), j = S(""), y = S(null), I = {
|
|
2053
|
+
thinkingTime: (n == null ? void 0 : n.thinkingDuration) || 30,
|
|
2054
|
+
answeringTime: (n == null ? void 0 : n.answeringDuration) || 120,
|
|
2055
|
+
editingTime: (n == null ? void 0 : n.editingDuration) || 30
|
|
2056
|
+
}, { thinkingTime: d, answeringTime: x, editingTime: C } = I;
|
|
2056
2057
|
P(() => {
|
|
2057
|
-
|
|
2058
|
-
}, [
|
|
2059
|
-
const
|
|
2058
|
+
j.current = u;
|
|
2059
|
+
}, [u]);
|
|
2060
|
+
const p = S(!1), {
|
|
2061
|
+
speak: $,
|
|
2062
|
+
stop: b,
|
|
2063
|
+
error: M
|
|
2064
|
+
} = Je({
|
|
2060
2065
|
config: {
|
|
2061
|
-
baseUrl:
|
|
2062
|
-
provider:
|
|
2063
|
-
authToken:
|
|
2066
|
+
baseUrl: c,
|
|
2067
|
+
provider: m == null ? void 0 : m.provider,
|
|
2068
|
+
authToken: o
|
|
2064
2069
|
},
|
|
2065
2070
|
onEnd: () => {
|
|
2066
|
-
|
|
2071
|
+
p.current = !1, E();
|
|
2067
2072
|
},
|
|
2068
2073
|
onError: () => {
|
|
2069
|
-
|
|
2074
|
+
p.current || (p.current = !0, E());
|
|
2070
2075
|
}
|
|
2071
|
-
}),
|
|
2072
|
-
startRecording:
|
|
2073
|
-
stopRecording:
|
|
2074
|
-
transcribe:
|
|
2075
|
-
error:
|
|
2076
|
+
}), N = S(!1), T = S(!1), {
|
|
2077
|
+
startRecording: q,
|
|
2078
|
+
stopRecording: F,
|
|
2079
|
+
transcribe: Q,
|
|
2080
|
+
error: B
|
|
2076
2081
|
} = Ye({
|
|
2077
2082
|
config: {
|
|
2078
|
-
baseUrl:
|
|
2079
|
-
provider:
|
|
2080
|
-
model:
|
|
2081
|
-
language:
|
|
2082
|
-
authToken:
|
|
2083
|
+
baseUrl: c,
|
|
2084
|
+
provider: l == null ? void 0 : l.provider,
|
|
2085
|
+
model: l == null ? void 0 : l.model,
|
|
2086
|
+
language: l == null ? void 0 : l.language,
|
|
2087
|
+
authToken: o
|
|
2083
2088
|
},
|
|
2084
2089
|
onStart: () => {
|
|
2085
|
-
|
|
2090
|
+
N.current = !1, T.current = !1;
|
|
2086
2091
|
},
|
|
2087
2092
|
onStop: () => {
|
|
2088
2093
|
},
|
|
2089
2094
|
onTranscriptionComplete: (f) => {
|
|
2090
|
-
|
|
2095
|
+
g(f.transcript), T.current || (T.current = !0, E());
|
|
2091
2096
|
},
|
|
2092
2097
|
onError: (f) => {
|
|
2093
|
-
console.error("STT Error:", f),
|
|
2098
|
+
console.error("STT Error:", f), N.current || (N.current = !0, E());
|
|
2094
2099
|
}
|
|
2095
|
-
}), { state: L, startQuestion:
|
|
2100
|
+
}), { state: L, startQuestion: U, nextPhase: E, completeInterview: W } = Ge({
|
|
2096
2101
|
config: {
|
|
2097
|
-
thinkingDuration:
|
|
2098
|
-
answeringDuration:
|
|
2099
|
-
editingDuration:
|
|
2102
|
+
thinkingDuration: d,
|
|
2103
|
+
answeringDuration: x,
|
|
2104
|
+
editingDuration: C
|
|
2100
2105
|
},
|
|
2101
2106
|
callbacks: {
|
|
2102
2107
|
onPhaseChange: (f) => {
|
|
2103
2108
|
switch (f) {
|
|
2104
2109
|
case R.FETCHING_QUESTION:
|
|
2105
|
-
|
|
2110
|
+
z();
|
|
2106
2111
|
break;
|
|
2107
2112
|
case R.READING_QUESTION:
|
|
2108
|
-
|
|
2113
|
+
G();
|
|
2109
2114
|
break;
|
|
2110
2115
|
case R.ANSWERING:
|
|
2111
|
-
|
|
2116
|
+
ie();
|
|
2112
2117
|
break;
|
|
2113
2118
|
case R.TRANSCRIBING:
|
|
2114
|
-
|
|
2119
|
+
H();
|
|
2115
2120
|
break;
|
|
2116
2121
|
case R.SUBMITTING:
|
|
2117
|
-
|
|
2122
|
+
re();
|
|
2118
2123
|
break;
|
|
2119
2124
|
}
|
|
2120
2125
|
},
|
|
2121
2126
|
onInterviewEnd: () => {
|
|
2122
|
-
|
|
2127
|
+
e == null || e();
|
|
2123
2128
|
}
|
|
2124
2129
|
}
|
|
2125
2130
|
});
|
|
2126
2131
|
P(() => {
|
|
2127
|
-
|
|
2132
|
+
U();
|
|
2128
2133
|
}, []);
|
|
2129
|
-
const { execute:
|
|
2134
|
+
const { execute: z, loading: te } = qe(
|
|
2130
2135
|
async () => {
|
|
2131
|
-
var
|
|
2132
|
-
const f = await
|
|
2136
|
+
var O, J;
|
|
2137
|
+
const f = await s.generateQuestion({
|
|
2133
2138
|
interviewId: i,
|
|
2134
|
-
question: ((
|
|
2135
|
-
qnaId: ((
|
|
2136
|
-
answer:
|
|
2139
|
+
question: ((O = y.current) == null ? void 0 : O.question) || "",
|
|
2140
|
+
qnaId: ((J = y.current) == null ? void 0 : J.qna_id) || "",
|
|
2141
|
+
answer: j.current
|
|
2137
2142
|
});
|
|
2138
2143
|
return y.current = f.data, f;
|
|
2139
2144
|
},
|
|
2140
2145
|
{
|
|
2141
2146
|
onSuccess: async (f) => {
|
|
2142
|
-
f && f.data && (
|
|
2147
|
+
f && f.data && (g(""), h(f.data), E());
|
|
2143
2148
|
},
|
|
2144
2149
|
onError: (f) => {
|
|
2145
2150
|
console.error("Failed to fetch questions:", f);
|
|
2146
2151
|
}
|
|
2147
2152
|
}
|
|
2148
|
-
),
|
|
2149
|
-
|
|
2150
|
-
}, [
|
|
2153
|
+
), re = A(async () => {
|
|
2154
|
+
U();
|
|
2155
|
+
}, [U]), G = A(async () => {
|
|
2151
2156
|
var f;
|
|
2152
2157
|
if ((f = y.current) != null && f.question)
|
|
2153
2158
|
try {
|
|
2154
|
-
|
|
2155
|
-
} catch (
|
|
2156
|
-
console.error("Failed to speak question:",
|
|
2159
|
+
p.current = !1, await $(y.current.question), y.current.is_interview_done && (await Pe(2e3), W());
|
|
2160
|
+
} catch (O) {
|
|
2161
|
+
console.error("Failed to speak question:", O);
|
|
2157
2162
|
}
|
|
2158
2163
|
else
|
|
2159
2164
|
E();
|
|
2160
|
-
}, [
|
|
2165
|
+
}, [$, E, W]), ie = A(async () => {
|
|
2161
2166
|
try {
|
|
2162
|
-
await
|
|
2167
|
+
await q(x);
|
|
2163
2168
|
} catch (f) {
|
|
2164
2169
|
console.error("Failed to start recording:", f), E();
|
|
2165
2170
|
}
|
|
2166
|
-
}, [
|
|
2171
|
+
}, [q, E]), H = A(async () => {
|
|
2167
2172
|
try {
|
|
2168
|
-
const f = await
|
|
2169
|
-
await
|
|
2173
|
+
const f = await F();
|
|
2174
|
+
await Q(f);
|
|
2170
2175
|
} catch (f) {
|
|
2171
|
-
console.error("STT processing failed:", f), !
|
|
2176
|
+
console.error("STT processing failed:", f), !N.current && !T.current && (N.current = !0, E());
|
|
2172
2177
|
}
|
|
2173
|
-
}, [
|
|
2178
|
+
}, [F, Q, E]), se = () => {
|
|
2174
2179
|
const { phase: f } = L;
|
|
2175
2180
|
switch (f) {
|
|
2176
2181
|
case R.IDLE:
|
|
2177
2182
|
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
2183
|
/* @__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
2184
|
/* @__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(
|
|
2185
|
+
/* @__PURE__ */ t.jsx(ee, { onClick: U, className: "iw-mt-2 iw-w-40", children: "Start Interview" })
|
|
2181
2186
|
] });
|
|
2182
2187
|
case R.FETCHING_QUESTION:
|
|
2183
2188
|
return /* @__PURE__ */ t.jsx(st, {});
|
|
2184
2189
|
case R.READING_QUESTION:
|
|
2185
|
-
return /* @__PURE__ */ t.jsx(ot, { ttsError:
|
|
2190
|
+
return /* @__PURE__ */ t.jsx(ot, { ttsError: M });
|
|
2186
2191
|
case R.THINKING:
|
|
2187
2192
|
return /* @__PURE__ */ t.jsx(
|
|
2188
2193
|
ct,
|
|
2189
2194
|
{
|
|
2190
2195
|
state: L,
|
|
2191
|
-
thinkingTime:
|
|
2196
|
+
thinkingTime: d,
|
|
2192
2197
|
nextPhase: E
|
|
2193
2198
|
}
|
|
2194
2199
|
);
|
|
@@ -2197,24 +2202,24 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2197
2202
|
it,
|
|
2198
2203
|
{
|
|
2199
2204
|
state: L,
|
|
2200
|
-
answeringTime:
|
|
2205
|
+
answeringTime: x,
|
|
2201
2206
|
nextPhase: E,
|
|
2202
|
-
sttError:
|
|
2207
|
+
sttError: B
|
|
2203
2208
|
}
|
|
2204
2209
|
);
|
|
2205
2210
|
case R.TRANSCRIBING:
|
|
2206
|
-
return /* @__PURE__ */ t.jsx(lt, { sttError:
|
|
2211
|
+
return /* @__PURE__ */ t.jsx(lt, { sttError: B });
|
|
2207
2212
|
case R.EDITING:
|
|
2208
2213
|
case R.SUBMITTING:
|
|
2209
2214
|
return /* @__PURE__ */ t.jsx("div", { className: "iw-space-y-4 iw-h-full", children: /* @__PURE__ */ t.jsx(
|
|
2210
2215
|
et,
|
|
2211
2216
|
{
|
|
2212
|
-
value:
|
|
2213
|
-
onChange: (
|
|
2217
|
+
value: u,
|
|
2218
|
+
onChange: (O) => g(O.target.value),
|
|
2214
2219
|
onSubmit: () => E(),
|
|
2215
|
-
isSubmitDisabled: !
|
|
2220
|
+
isSubmitDisabled: !u.trim() || te,
|
|
2216
2221
|
state: L,
|
|
2217
|
-
editingTime:
|
|
2222
|
+
editingTime: C
|
|
2218
2223
|
}
|
|
2219
2224
|
) });
|
|
2220
2225
|
case R.COMPLETED:
|
|
@@ -2222,7 +2227,7 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2222
2227
|
at,
|
|
2223
2228
|
{
|
|
2224
2229
|
open: !0,
|
|
2225
|
-
onClose:
|
|
2230
|
+
onClose: e || (() => {
|
|
2226
2231
|
})
|
|
2227
2232
|
}
|
|
2228
2233
|
) });
|
|
@@ -2234,47 +2239,54 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2234
2239
|
/* @__PURE__ */ t.jsx(
|
|
2235
2240
|
ht,
|
|
2236
2241
|
{
|
|
2237
|
-
title:
|
|
2238
|
-
onExit:
|
|
2242
|
+
title: r,
|
|
2243
|
+
onExit: async () => {
|
|
2244
|
+
b(), (await s.generateQuestion({
|
|
2245
|
+
interviewId: i,
|
|
2246
|
+
isInterviewDone: !0
|
|
2247
|
+
})).success && W();
|
|
2248
|
+
}
|
|
2239
2249
|
}
|
|
2240
2250
|
),
|
|
2241
2251
|
/* @__PURE__ */ t.jsxs(
|
|
2242
2252
|
"div",
|
|
2243
2253
|
{
|
|
2244
|
-
className: `iw-p-4 iw-space-y-4 iw-pb-6 ${
|
|
2254
|
+
className: `iw-p-4 iw-space-y-4 iw-pb-6 ${a} iw-min-h-[calc(100vh_-_3.8rem)] iw-flex iw-flex-col iw-justify-between`,
|
|
2245
2255
|
children: [
|
|
2246
2256
|
/* @__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
2257
|
wt,
|
|
2248
2258
|
{
|
|
2249
|
-
question:
|
|
2259
|
+
question: w,
|
|
2250
2260
|
isLoading: L.phase === R.FETCHING_QUESTION || L.phase === R.IDLE
|
|
2251
2261
|
}
|
|
2252
2262
|
) }) }),
|
|
2253
2263
|
/* @__PURE__ */ t.jsxs("div", { className: "iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-xl iw-p-4", children: [
|
|
2254
2264
|
/* @__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:
|
|
2265
|
+
/* @__PURE__ */ t.jsx("div", { className: "iw-bg-white iw-rounded-lg iw-shadow iw-p-6", children: se() })
|
|
2256
2266
|
] })
|
|
2257
2267
|
]
|
|
2258
2268
|
}
|
|
2259
2269
|
)
|
|
2260
2270
|
] });
|
|
2261
2271
|
}, gt = ({
|
|
2272
|
+
title: r,
|
|
2262
2273
|
interviewId: i,
|
|
2263
|
-
onInterviewEnd:
|
|
2264
|
-
className:
|
|
2274
|
+
onInterviewEnd: e,
|
|
2275
|
+
className: a = ""
|
|
2265
2276
|
}) => {
|
|
2266
|
-
const [
|
|
2267
|
-
return
|
|
2277
|
+
const [s, c] = de.useState(!1), [o, n] = de.useState(!0), l = S(null);
|
|
2278
|
+
return s ? /* @__PURE__ */ t.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ t.jsx(
|
|
2268
2279
|
"div",
|
|
2269
2280
|
{
|
|
2270
|
-
ref:
|
|
2271
|
-
className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${
|
|
2281
|
+
ref: l,
|
|
2282
|
+
className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${a}`,
|
|
2272
2283
|
children: /* @__PURE__ */ t.jsx("div", { className: " iw-h-full iw-flex iw-flex-col", children: /* @__PURE__ */ t.jsx(
|
|
2273
2284
|
mt,
|
|
2274
2285
|
{
|
|
2286
|
+
interviewTitle: r ?? "Interview",
|
|
2275
2287
|
interviewId: i,
|
|
2276
|
-
className:
|
|
2277
|
-
onComplete:
|
|
2288
|
+
className: a,
|
|
2289
|
+
onComplete: e || (() => {
|
|
2278
2290
|
})
|
|
2279
2291
|
}
|
|
2280
2292
|
) })
|
|
@@ -2282,9 +2294,9 @@ const ct = ({ state: i, thinkingTime: r, nextPhase: e }) => /* @__PURE__ */ t.js
|
|
|
2282
2294
|
) }) : /* @__PURE__ */ t.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ t.jsx(
|
|
2283
2295
|
Le,
|
|
2284
2296
|
{
|
|
2285
|
-
isOpen:
|
|
2297
|
+
isOpen: o,
|
|
2286
2298
|
onStart: () => {
|
|
2287
|
-
console.log("Permissions granted, starting interview"),
|
|
2299
|
+
console.log("Permissions granted, starting interview"), c(!0), n(!1);
|
|
2288
2300
|
}
|
|
2289
2301
|
}
|
|
2290
2302
|
) });
|