interview-widget 0.1.7 → 1.0.1

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