interview-widget 0.1.2 → 0.1.4

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 me = Object.defineProperty;
2
- var ge = (i, t, e) => t in i ? me(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var I = (i, t, e) => ge(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { createContext as he, useContext as fe, useEffect as A, useState as y, useRef as D, useCallback as v, useMemo as xe } from "react";
5
- import { createPortal as pe } from "react-dom";
6
- var X = { exports: {} }, U = {};
1
+ var ve = Object.defineProperty;
2
+ var je = (i, r, e) => r in i ? ve(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
3
+ var D = (i, r, e) => je(i, typeof r != "symbol" ? r + "" : r, e);
4
+ import oe, { createContext as Ne, useContext as Te, useRef as E, useState as k, useEffect as $, useCallback as A, useMemo as J } from "react";
5
+ import { createPortal as ke } from "react-dom";
6
+ var le = { exports: {} }, X = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-jsx-runtime.production.js
@@ -13,28 +13,28 @@ var X = { exports: {} }, U = {};
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 be = Symbol.for("react.transitional.element"), ye = Symbol.for("react.fragment");
17
- function Z(i, t, e) {
18
- var a = null;
19
- if (e !== void 0 && (a = "" + e), t.key !== void 0 && (a = "" + t.key), "key" in t) {
16
+ var Ie = Symbol.for("react.transitional.element"), Ee = Symbol.for("react.fragment");
17
+ function de(i, r, e) {
18
+ var n = null;
19
+ if (e !== void 0 && (n = "" + e), r.key !== void 0 && (n = "" + r.key), "key" in r) {
20
20
  e = {};
21
- for (var s in t)
22
- s !== "key" && (e[s] = t[s]);
23
- } else e = t;
24
- return t = e.ref, {
25
- $$typeof: be,
21
+ for (var s in r)
22
+ s !== "key" && (e[s] = r[s]);
23
+ } else e = r;
24
+ return r = e.ref, {
25
+ $$typeof: Ie,
26
26
  type: i,
27
- key: a,
28
- ref: t !== void 0 ? t : null,
27
+ key: n,
28
+ ref: r !== void 0 ? r : null,
29
29
  props: e
30
30
  };
31
31
  }
32
- U.Fragment = ye;
33
- U.jsx = Z;
34
- U.jsxs = Z;
35
- X.exports = U;
36
- var r = X.exports;
37
- const C = {
32
+ X.Fragment = Ee;
33
+ X.jsx = de;
34
+ X.jsxs = de;
35
+ le.exports = X;
36
+ var t = le.exports;
37
+ const O = {
38
38
  api: {
39
39
  baseUrl: "/api",
40
40
  retryConfig: {
@@ -62,214 +62,103 @@ const C = {
62
62
  provider: "piper"
63
63
  }
64
64
  }
65
- }, ee = he(
65
+ }, we = Ne(
66
66
  null
67
67
  );
68
- function Ne({
68
+ function Re({
69
69
  config: i = {},
70
- children: t
70
+ children: r
71
71
  }) {
72
- var a, s, c, n;
72
+ var n, s, c, a;
73
73
  const e = {
74
74
  api: {
75
- ...C.api,
75
+ ...O.api,
76
76
  ...i.api,
77
77
  retryConfig: {
78
- ...C.api.retryConfig,
79
- ...(a = i.api) == null ? void 0 : a.retryConfig
78
+ ...O.api.retryConfig,
79
+ ...(n = i.api) == null ? void 0 : n.retryConfig
80
80
  }
81
81
  },
82
82
  ui: {
83
- ...C.ui,
83
+ ...O.ui,
84
84
  ...i.ui
85
85
  },
86
86
  interview: {
87
- ...C.interview,
87
+ ...O.interview,
88
88
  ...i.interview,
89
89
  timers: {
90
- ...C.interview.timers,
90
+ ...O.interview.timers,
91
91
  ...(s = i.interview) == null ? void 0 : s.timers
92
92
  },
93
93
  stt: {
94
- ...C.interview.stt,
94
+ ...O.interview.stt,
95
95
  ...(c = i.interview) == null ? void 0 : c.stt
96
96
  },
97
97
  tts: {
98
- ...C.interview.tts,
99
- ...(n = i.interview) == null ? void 0 : n.tts
98
+ ...O.interview.tts,
99
+ ...(a = i.interview) == null ? void 0 : a.tts
100
100
  }
101
101
  }
102
102
  };
103
- return /* @__PURE__ */ r.jsx(ee.Provider, { value: e, children: t });
103
+ return /* @__PURE__ */ t.jsx(we.Provider, { value: e, children: r });
104
104
  }
105
- function q() {
106
- const i = fe(ee);
105
+ function Z() {
106
+ const i = Te(we);
107
107
  if (!i)
108
108
  throw new Error(
109
109
  "useInterviewConfig must be used within an InterviewWidgetProvider. Wrap your component tree with <InterviewWidgetProvider config={...}>"
110
110
  );
111
111
  return i;
112
112
  }
113
- function Te() {
114
- return q().api || C.api;
113
+ function Se() {
114
+ return Z().api || O.api;
115
115
  }
116
- function F() {
117
- return q().ui || C.ui;
116
+ function Q() {
117
+ return Z().ui || O.ui;
118
118
  }
119
- function Ie() {
120
- return q().interview || C.interview;
119
+ function Ce() {
120
+ return Z().interview || O.interview;
121
121
  }
122
- const ve = ({
123
- isOpen: i,
124
- onClose: t,
125
- children: e,
126
- title: a,
127
- showCloseButton: s = !0,
128
- closeOnOverlayClick: c = !0,
129
- closeOnEscape: n = !0,
130
- className: o = ""
131
- }) => {
132
- if (A(() => {
133
- if (!i || !n) return;
134
- const d = (u) => {
135
- u.key === "Escape" && t();
136
- };
137
- return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
138
- }, [i, n, t]), A(() => (i ? (document.body.style.overflow = "hidden", document.body.classList.add("interview-widget-container")) : (document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container")), () => {
139
- document.body.style.overflow = "unset";
140
- }), [i]), !i) return null;
141
- const m = (d) => {
142
- c && d.target === d.currentTarget && t();
143
- }, g = /* @__PURE__ */ r.jsxs("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center", children: [
144
- /* @__PURE__ */ r.jsx(
145
- "div",
146
- {
147
- className: "iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",
148
- onClick: m
149
- }
150
- ),
151
- /* @__PURE__ */ r.jsxs(
152
- "div",
153
- {
154
- 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 ${o}`,
155
- role: "dialog",
156
- "aria-modal": "true",
157
- "aria-labelledby": a ? "dialog-title" : void 0,
158
- children: [
159
- (a || s) && /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-p-4 iw-border-b iw-border-gray-200", children: [
160
- a && /* @__PURE__ */ r.jsx(
161
- "h2",
162
- {
163
- id: "dialog-title",
164
- className: "iw-text-lg iw-font-semibold iw-text-gray-900",
165
- children: a
166
- }
167
- ),
168
- s && /* @__PURE__ */ r.jsx(
169
- "button",
170
- {
171
- onClick: t,
172
- className: "iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100",
173
- "aria-label": "Close dialog",
174
- children: /* @__PURE__ */ r.jsx(
175
- "svg",
176
- {
177
- className: "iw-w-5 iw-h-5",
178
- fill: "none",
179
- stroke: "currentColor",
180
- viewBox: "0 0 24 24",
181
- children: /* @__PURE__ */ r.jsx(
182
- "path",
183
- {
184
- strokeLinecap: "round",
185
- strokeLinejoin: "round",
186
- strokeWidth: 2,
187
- d: "M6 18L18 6M6 6l12 12"
188
- }
189
- )
190
- }
191
- )
192
- }
193
- )
194
- ] }),
195
- /* @__PURE__ */ r.jsx("div", { className: "iw-p-4 iw-overflow-y-auto", children: e })
196
- ]
197
- }
198
- )
199
- ] });
200
- return pe(g, document.body);
201
- }, Ee = ({
202
- confirmExitInterview: i,
203
- isOpen: t,
204
- onClose: e
205
- }) => /* @__PURE__ */ r.jsx(ve, { isOpen: t, onClose: e, title: "Exit Interview", children: /* @__PURE__ */ r.jsxs("div", { className: "iw-space-y-4", children: [
206
- /* @__PURE__ */ r.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." }),
207
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-justify-end iw-space-x-2", children: [
208
- /* @__PURE__ */ r.jsx(
209
- "button",
210
- {
211
- className: "iw-px-4 iw-py-2 iw-bg-gray-200 iw-rounded iw-text-gray-700 iw-font-medium",
212
- onClick: e,
213
- children: "Cancel"
214
- }
215
- ),
216
- /* @__PURE__ */ r.jsx(
217
- "button",
218
- {
219
- className: "iw-px-4 iw-py-2 iw-bg-red-600 iw-text-white iw-rounded iw-font-medium",
220
- onClick: i,
221
- children: "Confirm Exit"
222
- }
223
- )
224
- ] })
225
- ] }) }), je = ({ title: i, onExit: t }) => {
226
- const { baseColor: e } = F(), [a, s] = y(!1);
227
- return /* @__PURE__ */ r.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
228
- /* @__PURE__ */ r.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3", children: [
229
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
230
- /* @__PURE__ */ r.jsx(
231
- "div",
232
- {
233
- className: "iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",
234
- style: { backgroundColor: e },
235
- children: "N"
236
- }
237
- ),
238
- /* @__PURE__ */ r.jsx("p", { className: "iw-text-sm iw-font-medium", children: "Novara" })
239
- ] }),
240
- /* @__PURE__ */ r.jsx("h1", { className: "iw-text-base iw-font-medium", children: i }),
241
- /* @__PURE__ */ r.jsx(
242
- "button",
243
- {
244
- className: "iw-text-sm iw-text-gray-500 hover:iw-text-gray-700",
245
- onClick: () => s(!0),
246
- children: "Exit Interview"
247
- }
248
- )
249
- ] }),
250
- /* @__PURE__ */ r.jsx("div", { className: "iw-h-px iw-bg-gray-200" }),
251
- /* @__PURE__ */ r.jsx(
252
- Ee,
253
- {
254
- isOpen: a,
255
- confirmExitInterview: () => {
256
- t(), s(!1);
257
- },
258
- onClose: () => s(!1)
259
- }
260
- )
261
- ] });
262
- }, $ = ({
122
+ const ue = ({
123
+ className: i,
124
+ ...r
125
+ }) => /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs(
126
+ "svg",
127
+ {
128
+ xmlns: "http://www.w3.org/2000/svg",
129
+ width: "20",
130
+ height: "20",
131
+ viewBox: "0 0 24 24",
132
+ fill: "none",
133
+ stroke: "currentColor",
134
+ strokeWidth: "2",
135
+ strokeLinecap: "round",
136
+ strokeLinejoin: "round",
137
+ className: `iw-animate-spin ${i}`,
138
+ ...r,
139
+ 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" })
149
+ ]
150
+ }
151
+ ) }), ie = ({
263
152
  children: i,
264
- variant: t = "primary",
153
+ variant: r = "primary",
265
154
  size: e = "md",
266
- fullWidth: a = !1,
155
+ fullWidth: n = !1,
267
156
  isLoading: s = !1,
268
157
  disabled: c,
269
- className: n = "",
158
+ className: a = "",
270
159
  ...o
271
160
  }) => {
272
- const m = "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", g = {
161
+ const w = "iw-inline-flex iw-items-center iw-justify-center iw-rounded-md iw-font-medium iw-transition-colors iw-focus:outline-none iw-focus:ring-2 iw-focus:ring-primary-500 iw-focus:ring-offset-2", g = {
273
162
  primary: "iw-bg-primary-600 iw-text-white iw-hover:bg-primary-700 iw-border iw-border-transparent",
274
163
  secondary: "iw-bg-primary-100 iw-text-primary-700 iw-hover:bg-primary-200 iw-border iw-border-transparent",
275
164
  outline: "iw-bg-transparent iw-text-primary-700 iw-border iw-border-primary-500 iw-hover:bg-primary-50",
@@ -277,159 +166,194 @@ const ve = ({
277
166
  gradient: "iw-text-white iw-border iw-border-transparent iw-bg-gradient-to-r iw-from-purple-500 iw-to-indigo-500 hover:iw-from-purple-600 hover:iw-to-indigo-600"
278
167
  }, d = {
279
168
  sm: "iw-px-3 iw-py-1.5 iw-text-sm",
280
- md: "iw-px-4 iw-py-2 iw-text-sm",
281
- lg: "iw-px-5 iw-py-2.5 iw-text-base"
282
- }, u = "iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none", h = a ? "iw-w-full" : "";
283
- return /* @__PURE__ */ r.jsxs(
169
+ md: "iw-px-4 iw-py-2.5 iw-text-sm",
170
+ lg: "iw-px-5 iw-py-3 iw-text-base"
171
+ }, h = "iw-disabled:opacity-50 iw-disabled:cursor-not-allowed iw-disabled:pointer-events-none", u = n ? "iw-w-full" : "";
172
+ return /* @__PURE__ */ t.jsxs(
284
173
  "button",
285
174
  {
286
- className: `${m} ${g[t]} ${d[e]} ${h} ${u} ${n}`,
175
+ className: `${w} ${g[r]} ${d[e]} ${u} ${h} ${a}`,
287
176
  disabled: c || s,
288
177
  ...o,
289
178
  children: [
290
- s && /* @__PURE__ */ r.jsxs(
291
- "svg",
292
- {
293
- className: "iw-animate-spin iw-mr-2 iw-h-4 iw-w-4 iw-text-white",
294
- xmlns: "http://www.w3.org/2000/svg",
295
- fill: "none",
296
- viewBox: "0 0 24 24",
297
- children: [
298
- /* @__PURE__ */ r.jsx(
299
- "circle",
300
- {
301
- className: "iw-opacity-25",
302
- cx: "12",
303
- cy: "12",
304
- r: "10",
305
- stroke: "currentColor",
306
- strokeWidth: "4"
307
- }
308
- ),
309
- /* @__PURE__ */ r.jsx(
310
- "path",
311
- {
312
- className: "iw-opacity-75",
313
- fill: "currentColor",
314
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
315
- }
316
- )
317
- ]
318
- }
319
- ),
179
+ s && /* @__PURE__ */ t.jsx(ue, { height: 16, width: 16, style: { marginRight: "3px" } }),
320
180
  i
321
181
  ]
322
182
  }
323
183
  );
324
- }, Se = ({
184
+ };
185
+ function Me(i) {
186
+ const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);
187
+ return r ? {
188
+ r: parseInt(r[1], 16),
189
+ g: parseInt(r[2], 16),
190
+ b: parseInt(r[3], 16)
191
+ } : null;
192
+ }
193
+ function Ae(i, r, e) {
194
+ return "#" + [i, r, e].map((n) => {
195
+ const s = Math.round(n).toString(16);
196
+ return s.length === 1 ? "0" + s : s;
197
+ }).join("");
198
+ }
199
+ function he(i, r) {
200
+ const e = Me(i);
201
+ if (!e) return i;
202
+ const n = e.r + (255 - e.r) * r, s = e.g + (255 - e.g) * r, c = e.b + (255 - e.b) * r;
203
+ return Ae(n, s, c);
204
+ }
205
+ function De(i, r = 0.8) {
206
+ return {
207
+ background: `linear-gradient(to bottom, ${he(i, r)}, #ffffff)`,
208
+ color: "#1f2937"
209
+ };
210
+ }
211
+ function Pe(i) {
212
+ return new Promise((r) => setTimeout(r, i));
213
+ }
214
+ function me(i) {
215
+ return `linear-gradient(to left, ${he(i, 0.4)}, ${i})`;
216
+ }
217
+ const $e = (i) => /* @__PURE__ */ t.jsxs(
218
+ "svg",
219
+ {
220
+ xmlns: "http://www.w3.org/2000/svg",
221
+ width: "24",
222
+ height: "24",
223
+ viewBox: "0 0 24 24",
224
+ fill: "none",
225
+ stroke: "currentColor",
226
+ strokeWidth: "2",
227
+ strokeLinecap: "round",
228
+ strokeLinejoin: "round",
229
+ ...i,
230
+ 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" })
233
+ ]
234
+ }
235
+ ), _e = [
236
+ "Do not refresh or reload the page during your assessment",
237
+ "Refrain from switching tabs or opening other applications while the session is in progress",
238
+ "Ensure your face remains clearly visible on camera at all times",
239
+ "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 = ({
325
243
  isOpen: i,
326
- onStart: t,
244
+ onStart: r,
327
245
  onClose: e
328
246
  }) => {
329
- var N;
330
- const a = D(null), s = D(null), { baseColor: c, borderRadius: n } = F(), [o, m] = y(!1), [g, d] = y(null), [u, h] = y(!1), x = () => {
331
- s.current && (s.current.getTracks().forEach((w) => w.stop()), s.current = null);
332
- }, k = async () => {
333
- h(!0), d(null);
247
+ var j;
248
+ const n = E(null), s = E(null), { baseColor: c, borderRadius: a } = Q(), [o, w] = k(!1), [g, d] = k(null), [h, u] = k(!1), m = () => {
249
+ s.current && (s.current.getTracks().forEach((l) => l.stop()), s.current = null);
250
+ }, v = async () => {
251
+ u(!0), d(null);
334
252
  try {
335
- const w = await navigator.mediaDevices.getUserMedia({
253
+ const l = await navigator.mediaDevices.getUserMedia({
336
254
  video: { width: { ideal: 1280 }, height: { ideal: 720 } },
337
255
  audio: !0
338
256
  });
339
- s.current = w, a.current && (a.current.srcObject = w), m(!0);
340
- } catch (w) {
341
- console.error("Media permission error:", w);
342
- let p = "Unable to access camera or microphone.";
343
- (w == null ? void 0 : w.name) === "NotAllowedError" ? p = "Permissions denied. Please allow access to camera and microphone." : (w == null ? void 0 : w.name) === "NotFoundError" ? p = "No camera/microphone found. Please connect a device and retry." : w != null && w.message && (p = w.message), m(!1), d(p);
257
+ s.current = l, n.current && (n.current.srcObject = l), w(!0);
258
+ } catch (l) {
259
+ console.error("Media permission error:", l);
260
+ let f = "Unable to access camera or microphone.";
261
+ (l == null ? void 0 : l.name) === "NotAllowedError" ? f = "Permissions denied. Please allow access to camera and microphone." : (l == null ? void 0 : l.name) === "NotFoundError" ? f = "No camera/microphone found. Please connect a device and retry." : l != null && l.message && (f = l.message), w(!1), d(f);
344
262
  } finally {
345
- h(!1);
263
+ u(!1);
346
264
  }
347
265
  };
348
- if (A(() => {
266
+ if ($(() => {
349
267
  if (!i) {
350
- x();
268
+ m();
351
269
  return;
352
270
  }
353
- return k(), () => {
354
- x();
271
+ return v(), () => {
272
+ m();
355
273
  };
356
274
  }, [i]), !i) return null;
357
- const j = () => {
358
- t(), x();
275
+ const N = () => {
276
+ r(), m();
359
277
  };
360
- return /* @__PURE__ */ r.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__ */ r.jsxs("div", { className: "iw-bg-white iw-rounded-xl iw-shadow-2xl iw-w-full iw-max-w-3xl iw-mx-4", children: [
361
- /* @__PURE__ */ r.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: [
362
- /* @__PURE__ */ r.jsx("h2", { className: "iw-text-base iw-font-semibold", children: "Camera & Microphone Check" }),
363
- e && /* @__PURE__ */ r.jsx(
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(
364
282
  "button",
365
283
  {
366
284
  "aria-label": "Close",
367
285
  className: "iw-text-gray-500 hover:iw-text-gray-700",
368
286
  onClick: () => {
369
- x(), e == null || e();
287
+ m(), e == null || e();
370
288
  },
371
289
  children: "✕"
372
290
  }
373
291
  )
374
292
  ] }),
375
- /* @__PURE__ */ r.jsxs("div", { className: "iw-p-4 iw-grid iw-grid-cols-2 iw-gap-4", children: [
376
- /* @__PURE__ */ r.jsx("div", { className: "iw-border iw-border-gray-200 iw-rounded-lg iw-overflow-hidden iw-bg-gray-900", children: /* @__PURE__ */ r.jsx(
377
- "video",
378
- {
379
- ref: a,
380
- autoPlay: !0,
381
- playsInline: !0,
382
- muted: !0,
383
- className: "iw-w-full iw-h-64 iw-object-cover"
384
- }
385
- ) }),
386
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-flex-col iw-gap-3", children: [
387
- /* @__PURE__ */ r.jsx("p", { className: "iw-text-sm iw-text-gray-700", children: "We will need access to your camera and microphone. Grant permission to preview your setup and to enable the Start Interview button." }),
388
- !((N = navigator.mediaDevices) != null && N.getUserMedia) && /* @__PURE__ */ r.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." }),
389
- g && /* @__PURE__ */ r.jsx("div", { className: "iw-text-xs iw-text-red-600", children: g }),
390
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-gap-2", children: [
391
- /* @__PURE__ */ r.jsx(
392
- $,
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: n,
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
+ ie,
393
311
  {
394
- onClick: k,
395
- isLoading: u,
312
+ onClick: v,
313
+ disabled: h,
396
314
  variant: "outline",
397
315
  size: "sm",
398
316
  style: {
399
317
  borderColor: c,
400
- borderRadius: n,
318
+ borderRadius: a,
401
319
  color: c
402
320
  },
403
321
  children: o ? "Recheck Permissions" : "Enable Camera & Mic"
404
322
  }
405
323
  ),
406
- /* @__PURE__ */ r.jsx(
407
- $,
324
+ /* @__PURE__ */ t.jsx(
325
+ ie,
408
326
  {
409
- onClick: j,
327
+ onClick: N,
410
328
  disabled: !o,
411
329
  size: "sm",
412
- style: { backgroundColor: c, borderRadius: n },
413
- children: "Proceed"
330
+ style: {
331
+ background: me(c),
332
+ borderRadius: a
333
+ },
334
+ children: "Start Interview"
414
335
  }
415
336
  )
416
- ] }),
417
- /* @__PURE__ */ r.jsxs("ul", { className: "iw-text-xs iw-text-gray-500 iw-pt-2 iw-list-disc iw-pl-4", children: [
418
- /* @__PURE__ */ r.jsx("li", { children: "Your preview is muted to avoid echo." }),
419
- /* @__PURE__ */ r.jsx("li", { children: "You can change devices from your browser’s site settings." })
420
337
  ] })
338
+ ] }),
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
+ !((j = navigator.mediaDevices) != null && j.getUserMedia) && /* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-red-600", children: "Your browser does not support media devices. Please use a modern browser like Chrome, Edge, or Firefox." }),
345
+ g && /* @__PURE__ */ t.jsx("div", { className: "iw-text-xs iw-text-red-600", children: g }),
346
+ /* @__PURE__ */ t.jsx("ul", { className: "iw-mt-1 iw-text-sm iw-text-gray-500 iw-list-disc iw-pl-4 iw-space-y-1.5", children: _e.map((l, f) => /* @__PURE__ */ t.jsx("li", { children: l }, f)) })
421
347
  ] })
422
348
  ] })
423
349
  ] }) });
424
350
  };
425
- var l = /* @__PURE__ */ ((i) => (i.IDLE = "idle", i.FETCHING_QUESTION = "fetching_question", i.READING_QUESTION = "reading_question", i.THINKING = "thinking", i.ANSWERING = "answering", i.TRANSCRIBING = "transcribing", i.EDITING = "editing", i.SUBMITTING = "submitting", i.COMPLETED = "completed", i))(l || {});
426
- const Re = {
351
+ var I = /* @__PURE__ */ ((i) => (i.IDLE = "idle", i.FETCHING_QUESTION = "fetching_question", i.READING_QUESTION = "reading_question", i.THINKING = "thinking", i.ANSWERING = "answering", i.TRANSCRIBING = "transcribing", i.EDITING = "editing", i.SUBMITTING = "submitting", i.COMPLETED = "completed", i))(I || {});
352
+ const Oe = {
427
353
  thinkingDuration: 30,
428
354
  answeringDuration: 120,
429
- editingDuration: 30,
430
- totalInterviewDuration: 600,
431
- minimumTimeForNextQuestion: 120
432
- }, Ce = {
355
+ editingDuration: 30
356
+ }, Fe = {
433
357
  idle: {
434
358
  next: "fetching_question"
435
359
  /* FETCHING_QUESTION */
@@ -458,17 +382,16 @@ const Re = {
458
382
  /* COMPLETED */
459
383
  }
460
384
  };
461
- class ke {
462
- constructor(t = {}, e = {}) {
463
- I(this, "config");
464
- I(this, "state");
465
- I(this, "phaseIntervalId", null);
466
- I(this, "globalIntervalId", null);
467
- I(this, "callbacks");
468
- this.config = { ...Re, ...t }, this.callbacks = e, this.state = {
385
+ class Ue {
386
+ constructor(r = {}, 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, ...r }, this.callbacks = e, this.state = {
469
393
  phase: "idle",
470
394
  currentPhaseTimeRemaining: 0,
471
- totalTimeRemaining: this.config.totalInterviewDuration,
472
395
  totalTimeElapsed: 0,
473
396
  currentQuestionNumber: 0
474
397
  };
@@ -483,22 +406,24 @@ class ke {
483
406
  * Start a new question cycle
484
407
  */
485
408
  startQuestion() {
486
- var t, e;
487
- if (this.state.totalTimeRemaining < this.config.minimumTimeForNextQuestion) {
488
- this.state.phase = "completed", this.stopGlobalTimer(), this.stopPhaseTimer(), (e = (t = this.callbacks).onInterviewEnd) == null || e.call(t), this.notifyChange();
489
- return;
490
- }
491
409
  this.state.currentQuestionNumber === 0 && this.startGlobalTimer(), this.state.currentQuestionNumber = this.state.currentQuestionNumber + 1, this.state.phase = "fetching_question", this.notifyChange();
492
410
  }
493
411
  /**
494
412
  * Move to next phase
495
413
  */
496
414
  nextPhase() {
497
- const t = this.state.phase, e = Ce[t];
415
+ const r = this.state.phase, e = Fe[r];
498
416
  if (!e) return;
499
417
  this.stopPhaseTimer(), this.state.phase = e.next;
500
- const a = this.getDurationForPhase(e.next);
501
- a > 0 ? (this.state.currentPhaseTimeRemaining = a, this.startPhaseTimer()) : this.state.currentPhaseTimeRemaining = 0, this.notifyChange();
418
+ const n = this.getDurationForPhase(e.next);
419
+ n > 0 ? (this.state.currentPhaseTimeRemaining = n, this.startPhaseTimer()) : this.state.currentPhaseTimeRemaining = 0, this.notifyChange();
420
+ }
421
+ /**
422
+ * Manually complete the interview
423
+ */
424
+ completeInterview() {
425
+ var r, e;
426
+ this.stopGlobalTimer(), this.stopPhaseTimer(), this.state.phase = "completed", (e = (r = this.callbacks).onInterviewEnd) == null || e.call(r), this.notifyChange();
502
427
  }
503
428
  /**
504
429
  * Cleanup
@@ -509,8 +434,8 @@ class ke {
509
434
  /**
510
435
  * Get duration for a phase
511
436
  */
512
- getDurationForPhase(t) {
513
- switch (t) {
437
+ getDurationForPhase(r) {
438
+ switch (r) {
514
439
  case "thinking":
515
440
  return this.config.thinkingDuration;
516
441
  case "answering":
@@ -522,12 +447,12 @@ class ke {
522
447
  }
523
448
  }
524
449
  /**
525
- * Start global timer (runs continuously during entire interview)
450
+ * Start global timer (runs continuously during entire interview for tracking)
526
451
  */
527
452
  startGlobalTimer() {
528
453
  this.globalIntervalId = setInterval(() => {
529
- var t, e, a, s;
530
- this.state.totalTimeRemaining--, this.state.totalTimeElapsed++, (e = (t = this.callbacks).onTick) == null || e.call(t, this.getState()), this.state.totalTimeRemaining <= 0 && (this.stopGlobalTimer(), this.stopPhaseTimer(), this.state.phase = "completed", (s = (a = this.callbacks).onInterviewEnd) == null || s.call(a), this.notifyChange());
454
+ var r, e;
455
+ this.state.totalTimeElapsed++, (e = (r = this.callbacks).onTick) == null || e.call(r, this.getState());
531
456
  }, 1e3);
532
457
  }
533
458
  /**
@@ -554,88 +479,91 @@ class ke {
554
479
  * Notify phase change
555
480
  */
556
481
  notifyChange() {
557
- var t, e;
558
- (e = (t = this.callbacks).onPhaseChange) == null || e.call(t, this.state.phase, this.getState());
482
+ var r, e;
483
+ (e = (r = this.callbacks).onPhaseChange) == null || e.call(r, this.state.phase, this.getState());
559
484
  }
560
485
  }
561
- function De(i = {}) {
562
- const { config: t = {}, callbacks: e = {} } = i, a = D(null);
563
- a.current || (a.current = new ke(t, {}));
564
- const s = a.current, [c, n] = y(s.getState()), o = v(() => {
565
- n(s.getState());
486
+ function Ge(i = {}) {
487
+ const { config: r = {}, callbacks: e = {} } = i, n = E(null);
488
+ n.current || (n.current = new Ue(r, {}));
489
+ const s = n.current, [c, a] = k(s.getState()), o = A(() => {
490
+ a(s.getState());
566
491
  }, [s]);
567
- A(() => {
568
- const d = {
569
- onPhaseChange: (u, h) => {
570
- var x;
571
- o(), (x = e.onPhaseChange) == null || x.call(e, u, h);
492
+ $(() => {
493
+ const h = {
494
+ onPhaseChange: (u, m) => {
495
+ var v;
496
+ o(), (v = e.onPhaseChange) == null || v.call(e, u, m);
572
497
  },
573
498
  onTick: (u) => {
574
- var h;
575
- o(), (h = e.onTick) == null || h.call(e, u);
499
+ var m;
500
+ o(), (m = e.onTick) == null || m.call(e, u);
576
501
  },
577
502
  onInterviewEnd: () => {
578
503
  var u;
579
504
  o(), (u = e.onInterviewEnd) == null || u.call(e);
580
505
  }
581
506
  };
582
- s.callbacks = d;
583
- }, [s, e, o]), A(() => () => {
507
+ s.callbacks = h;
508
+ }, [s, e, o]), $(() => () => {
584
509
  s.destroy();
585
510
  }, [s]);
586
- const m = v(() => {
511
+ const w = A(() => {
587
512
  s.startQuestion(), o();
588
- }, [s, o]), g = v(() => {
513
+ }, [s, o]), g = A(() => {
589
514
  s.nextPhase(), o();
515
+ }, [s, o]), d = A(() => {
516
+ s.completeInterview(), o();
590
517
  }, [s, o]);
591
518
  return {
592
519
  state: c,
593
- startQuestion: m,
520
+ startQuestion: w,
594
521
  nextPhase: g,
522
+ completeInterview: d,
595
523
  timerService: s
596
524
  };
597
525
  }
598
- function Pe(i, t = {}) {
599
- const [e, a] = y({
526
+ function qe(i, r = {}) {
527
+ const [e, n] = k({
600
528
  data: null,
601
529
  loading: !1,
602
530
  error: null
603
- }), s = v(
531
+ }), s = A(
604
532
  async (...c) => {
605
- var n, o, m, g;
606
- a((d) => ({ ...d, loading: !0, error: null }));
533
+ var a, o, w, g;
534
+ n((d) => ({ ...d, loading: !0, error: null }));
607
535
  try {
608
536
  const d = await i(...c);
609
- a((u) => ({
610
- ...u,
537
+ n((h) => ({
538
+ ...h,
611
539
  data: d,
612
540
  loading: !1,
613
541
  error: null
614
- })), (n = t.onSuccess) == null || n.call(t, d), (o = t.onSettled) == null || o.call(t, d, null);
542
+ })), (a = r.onSuccess) == null || a.call(r, d), (o = r.onSettled) == null || o.call(r, d, null);
615
543
  } catch (d) {
616
- const u = d.type ? d : {
544
+ const h = d.type ? d : {
617
545
  type: "unknown",
618
546
  message: d.message || "Unknown error",
619
547
  retryable: !0,
620
548
  userMessage: "Something went wrong. Please try again.",
621
549
  originalError: d
622
550
  };
623
- a((h) => ({
624
- ...h,
551
+ n((u) => ({
552
+ ...u,
625
553
  loading: !1,
626
- error: u
627
- })), (m = t.onError) == null || m.call(t, u), (g = t.onSettled) == null || g.call(t, null, u);
554
+ error: h
555
+ })), (w = r.onError) == null || w.call(r, h), (g = r.onSettled) == null || g.call(r, null, h);
628
556
  }
629
557
  },
630
- [i, t]
558
+ [i, r]
631
559
  );
632
560
  return {
633
561
  ...e,
634
562
  execute: s
635
563
  };
636
564
  }
637
- function Ae(i) {
638
- var t;
565
+ function Be(i) {
566
+ var r;
639
567
  if (!navigator.onLine)
640
568
  return {
641
569
  type: "network",
@@ -643,7 +571,7 @@ function Ae(i) {
643
571
  retryable: !0,
644
572
  userMessage: "Please check your internet connection and try again."
645
573
  };
646
- if (i.name === "AbortError" || (t = i.message) != null && t.includes("timeout"))
574
+ if (i.name === "AbortError" || (r = i.message) != null && r.includes("timeout"))
647
575
  return {
648
576
  type: "timeout",
649
577
  message: "Request timed out",
@@ -693,95 +621,95 @@ function Ae(i) {
693
621
  originalError: i
694
622
  };
695
623
  }
696
- async function H(i, t = {}, e = {
624
+ async function se(i, r = {}, e = {
697
625
  attempts: 3,
698
626
  backoff: "exponential",
699
627
  baseDelay: 1e3,
700
628
  maxDelay: 1e4,
701
629
  jitter: !0
702
630
  }) {
703
- let a;
631
+ let n;
704
632
  for (let s = 1; s <= e.attempts; s++)
705
633
  try {
706
- const c = new AbortController(), n = setTimeout(() => c.abort(), 6e4), o = await fetch(i, {
707
- ...t,
634
+ const c = new AbortController(), a = setTimeout(() => c.abort(), 6e4), o = await fetch(i, {
635
+ ...r,
708
636
  signal: c.signal
709
637
  });
710
- if (clearTimeout(n), o.status >= 400 && o.status < 500 && o.status !== 429)
638
+ if (clearTimeout(a), o.status >= 400 && o.status < 500 && o.status !== 429)
711
639
  return o;
712
640
  if (!o.ok)
713
641
  throw new Error(`HTTP ${o.status}: ${o.statusText}`);
714
642
  return o;
715
643
  } catch (c) {
716
- a = c;
717
- const n = Ae(c);
718
- if (!n.retryable || s === e.attempts)
719
- throw n;
720
- const o = Ge(s, e);
644
+ n = c;
645
+ const a = Be(c);
646
+ if (!a.retryable || s === e.attempts)
647
+ throw a;
648
+ const o = ze(s, e);
721
649
  console.warn(
722
650
  `API request failed (attempt ${s}/${e.attempts}), retrying in ${o}ms:`,
723
- n.message
724
- ), await new Promise((m) => setTimeout(m, o));
651
+ a.message
652
+ ), await new Promise((w) => setTimeout(w, o));
725
653
  }
726
- throw a;
654
+ throw n;
727
655
  }
728
- function Ge(i, t) {
656
+ function ze(i, r) {
729
657
  let e;
730
- return t.backoff === "exponential" ? e = t.baseDelay * Math.pow(2, i - 1) : e = t.baseDelay, e = Math.min(e, t.maxDelay), t.jitter && (e = e * (0.5 + Math.random() * 0.5)), Math.round(e);
658
+ return r.backoff === "exponential" ? e = r.baseDelay * Math.pow(2, i - 1) : e = r.baseDelay, e = Math.min(e, r.maxDelay), r.jitter && (e = e * (0.5 + Math.random() * 0.5)), Math.round(e);
731
659
  }
732
- class Me {
733
- constructor(t = {}) {
734
- I(this, "config");
735
- this.config = t;
660
+ class Qe {
661
+ constructor(r = {}) {
662
+ D(this, "config");
663
+ this.config = r;
736
664
  }
737
665
  /**
738
666
  * Update configuration
739
667
  */
740
- updateConfig(t) {
741
- this.config = { ...this.config, ...t };
668
+ updateConfig(r) {
669
+ this.config = { ...this.config, ...r };
742
670
  }
743
671
  /**
744
672
  * Get default headers for API requests
745
673
  */
746
674
  getHeaders() {
747
675
  var e;
748
- const t = {
676
+ const r = {
749
677
  "Content-Type": "application/json",
750
678
  "X-Auth-Token": "appkey"
751
679
  };
752
- return (e = this.config) != null && e.authToken && (t.Authorization = `Bearer ${this.config.authToken}`), t;
680
+ return (e = this.config) != null && e.authToken && (r.Authorization = `Bearer ${this.config.authToken}`), r;
753
681
  }
754
682
  /**
755
683
  * Get base URL from config with fallback
756
684
  */
757
685
  getBaseUrl() {
758
- var t;
759
- return ((t = this.config) == null ? void 0 : t.baseUrl) || "/api";
686
+ var r;
687
+ return ((r = this.config) == null ? void 0 : r.baseUrl) || "/api";
760
688
  }
761
689
  /**
762
690
  * Get questions for an interview
763
691
  */
764
692
  async generateQuestion({
765
- interviewId: t,
693
+ interviewId: r,
766
694
  isInterviewDone: e = !1,
767
- qnaId: a,
695
+ qnaId: n,
768
696
  question: s,
769
697
  answer: c,
770
- answerDuration: n
698
+ answerDuration: a
771
699
  }) {
772
- const o = await H(
773
- `${this.getBaseUrl()}/interview/generate-question`,
700
+ const o = await se(
701
+ `${this.getBaseUrl()}/questions/next`,
774
702
  {
775
703
  method: "POST",
776
704
  headers: this.getHeaders(),
777
705
  body: JSON.stringify({
778
- interview_id: t,
706
+ interview_id: r,
779
707
  is_interview_done: e,
780
- qna_id: a,
708
+ qna_id: n,
781
709
  question: s,
782
710
  answer: c,
783
711
  // TODO: Hardcoded for now, will be dynamic later
784
- answer_duration: n ?? "00:00:30"
712
+ answer_duration: a ?? "00:00:30"
785
713
  })
786
714
  }
787
715
  );
@@ -790,25 +718,25 @@ class Me {
790
718
  return await o.json();
791
719
  }
792
720
  }
793
- function Oe() {
794
- const i = q();
795
- return xe(() => {
721
+ function We() {
722
+ const i = Z();
723
+ return J(() => {
796
724
  const e = i.api || {};
797
- return new Me(e);
725
+ return new Qe(e);
798
726
  }, [i.api]);
799
727
  }
800
- class b extends Error {
801
- constructor(t, e, a = !1) {
802
- super(t), this.code = e, this.recoverable = a, this.name = "STTError";
728
+ class y extends Error {
729
+ constructor(r, e, n = !1) {
730
+ super(r), this.code = e, this.recoverable = n, this.name = "STTError";
803
731
  }
804
732
  }
805
- class $e {
806
- constructor(t = {}) {
807
- I(this, "config");
808
- I(this, "mediaRecorder", null);
809
- I(this, "audioChunks", []);
810
- I(this, "recordingStream", null);
811
- I(this, "autoStopTimeoutId", null);
733
+ class He {
734
+ constructor(r = {}) {
735
+ D(this, "config");
736
+ D(this, "mediaRecorder", null);
737
+ D(this, "audioChunks", []);
738
+ D(this, "recordingStream", null);
739
+ D(this, "autoStopTimeoutId", null);
812
740
  this.config = {
813
741
  baseUrl: "http://localhost:8000",
814
742
  provider: "groq",
@@ -816,14 +744,14 @@ class $e {
816
744
  language: "en",
817
745
  includeTimestamps: !1,
818
746
  temperature: 0,
819
- ...t
747
+ ...r
820
748
  };
821
749
  }
822
750
  /**
823
751
  * Update STT configuration
824
752
  */
825
- updateConfig(t) {
826
- this.config = { ...this.config, ...t };
753
+ updateConfig(r) {
754
+ this.config = { ...this.config, ...r };
827
755
  }
828
756
  /**
829
757
  * Check if browser supports audio recording
@@ -834,16 +762,16 @@ class $e {
834
762
  /**
835
763
  * Start recording audio from user's microphone
836
764
  */
837
- async startRecording(t, e) {
838
- var a;
765
+ async startRecording(r, e) {
766
+ var n;
839
767
  if (!this.isRecordingSupported())
840
- throw new b(
768
+ throw new y(
841
769
  "Audio recording is not supported in this browser",
842
770
  "RECORDING_NOT_SUPPORTED",
843
771
  !1
844
772
  );
845
773
  if (this.isRecording())
846
- throw new b(
774
+ throw new y(
847
775
  "Recording is already in progress",
848
776
  "ALREADY_RECORDING",
849
777
  !0
@@ -860,34 +788,34 @@ class $e {
860
788
  this.mediaRecorder = new MediaRecorder(this.recordingStream, {
861
789
  mimeType: s
862
790
  }), this.mediaRecorder.ondataavailable = (c) => {
863
- var n;
864
- c.data.size > 0 && (this.audioChunks.push(c.data), (n = e == null ? void 0 : e.onDataAvailable) == null || n.call(e, c.data));
791
+ var a;
792
+ c.data.size > 0 && (this.audioChunks.push(c.data), (a = e == null ? void 0 : e.onDataAvailable) == null || a.call(e, c.data));
865
793
  }, this.mediaRecorder.onstop = () => {
866
794
  var c;
867
795
  (c = e == null ? void 0 : e.onStop) == null || c.call(e);
868
796
  }, this.mediaRecorder.onerror = (c) => {
869
797
  var o;
870
- const n = new b(
798
+ const a = new y(
871
799
  `Recording failed: ${c.error}`,
872
800
  "RECORDING_ERROR",
873
801
  !0
874
802
  );
875
- (o = e == null ? void 0 : e.onError) == null || o.call(e, n), this.cleanup();
876
- }, this.mediaRecorder.start(100), (a = e == null ? void 0 : e.onStart) == null || a.call(e), t && t > 0 && (this.autoStopTimeoutId = setTimeout(() => {
803
+ (o = e == null ? void 0 : e.onError) == null || o.call(e, a), this.cleanup();
804
+ }, this.mediaRecorder.start(100), (n = e == null ? void 0 : e.onStart) == null || n.call(e), r && r > 0 && (this.autoStopTimeoutId = setTimeout(() => {
877
805
  this.isRecording() && this.stopRecording();
878
- }, t * 1e3));
806
+ }, r * 1e3));
879
807
  } catch (s) {
880
808
  if (this.cleanup(), s instanceof Error) {
881
809
  if (s.name === "NotAllowedError" || s.name === "PermissionDeniedError")
882
- throw new b(
810
+ throw new y(
883
811
  "Microphone permission was denied",
884
812
  "PERMISSION_DENIED",
885
813
  !1
886
814
  );
887
815
  if (s.name === "NotFoundError")
888
- throw new b("No microphone found", "NO_MICROPHONE", !1);
816
+ throw new y("No microphone found", "NO_MICROPHONE", !1);
889
817
  }
890
- throw new b(
818
+ throw new y(
891
819
  `Failed to start recording: ${s instanceof Error ? s.message : String(s)}`,
892
820
  "START_RECORDING_FAILED",
893
821
  !0
@@ -899,25 +827,25 @@ class $e {
899
827
  */
900
828
  async stopRecording() {
901
829
  if (this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null), !this.mediaRecorder || !this.isRecording())
902
- throw new b(
830
+ throw new y(
903
831
  "No active recording to stop",
904
832
  "NO_ACTIVE_RECORDING",
905
833
  !1
906
834
  );
907
- return new Promise((t, e) => {
835
+ return new Promise((r, e) => {
908
836
  if (!this.mediaRecorder) {
909
837
  e(
910
- new b("MediaRecorder is null", "MEDIARECORDER_NULL", !1)
838
+ new y("MediaRecorder is null", "MEDIARECORDER_NULL", !1)
911
839
  );
912
840
  return;
913
841
  }
914
- const a = this.mediaRecorder, s = () => {
842
+ const n = this.mediaRecorder, s = () => {
915
843
  try {
916
- const c = a.mimeType || "audio/webm", n = new Blob(this.audioChunks, { type: c });
917
- this.cleanup(), t(n);
844
+ const c = n.mimeType || "audio/webm", a = new Blob(this.audioChunks, { type: c });
845
+ this.cleanup(), r(a);
918
846
  } catch (c) {
919
847
  e(
920
- new b(
848
+ new y(
921
849
  `Failed to create audio blob: ${c instanceof Error ? c.message : String(c)}`,
922
850
  "BLOB_CREATION_FAILED",
923
851
  !1
@@ -925,32 +853,32 @@ class $e {
925
853
  );
926
854
  }
927
855
  };
928
- a.addEventListener("stop", s, { once: !0 }), a.stop();
856
+ n.addEventListener("stop", s, { once: !0 }), n.stop();
929
857
  });
930
858
  }
931
859
  /**
932
860
  * Transcribe audio blob using the STT API
933
861
  */
934
- async transcribe(t) {
862
+ async transcribe(r) {
935
863
  const {
936
864
  audioBlob: e,
937
- model: a = this.config.model,
865
+ model: n = this.config.model,
938
866
  language: s = this.config.language,
939
867
  includeTimestamps: c = this.config.includeTimestamps,
940
- temperature: n = this.config.temperature
941
- } = t;
868
+ temperature: a = this.config.temperature
869
+ } = r;
942
870
  if (!e || e.size === 0)
943
- throw new b(
871
+ throw new y(
944
872
  "Audio blob is empty or invalid",
945
873
  "INVALID_AUDIO",
946
874
  !1
947
875
  );
948
876
  try {
949
- const o = new FormData(), m = new File([e], "recording.wav", {
877
+ const o = new FormData(), w = new File([e], "recording.wav", {
950
878
  type: e.type || "audio/wav"
951
879
  });
952
- o.append("file", m), o.append("model", a || "whisper-large-v3-turbo"), o.append("language", s || "en"), o.append("include_timestamps", String(c || !1)), o.append("temperature", String(n || 0));
953
- const g = await H(
880
+ o.append("file", w), o.append("model", n || "whisper-large-v3-turbo"), o.append("language", s || "en"), o.append("include_timestamps", String(c || !1)), o.append("temperature", String(a || 0));
881
+ const g = await se(
954
882
  `${this.config.baseUrl}/speech/transcribe`,
955
883
  {
956
884
  method: "POST",
@@ -969,16 +897,16 @@ class $e {
969
897
  }
970
898
  );
971
899
  if (!g.ok) {
972
- const u = await g.text();
973
- let h = `STT request failed: ${g.status} ${g.statusText}`;
900
+ const h = await g.text();
901
+ let u = `STT request failed: ${g.status} ${g.statusText}`;
974
902
  try {
975
- const x = JSON.parse(u);
976
- h = x.message || x.error || h;
903
+ const m = JSON.parse(h);
904
+ u = m.message || m.error || u;
977
905
  } catch {
978
- h = u || h;
906
+ u = h || u;
979
907
  }
980
- throw new b(
981
- h,
908
+ throw new y(
909
+ u,
982
910
  `HTTP_${g.status}`,
983
911
  g.status >= 500
984
912
  );
@@ -987,7 +915,7 @@ class $e {
987
915
  transcript: (await g.json()).data.text ?? ""
988
916
  };
989
917
  } catch (o) {
990
- throw o instanceof b ? o : new b(
918
+ throw o instanceof y ? o : new y(
991
919
  `Transcription failed: ${o instanceof Error ? o.message : String(o)}`,
992
920
  "TRANSCRIPTION_FAILED",
993
921
  !0
@@ -1010,14 +938,14 @@ class $e {
1010
938
  * Get supported MIME type for recording
1011
939
  */
1012
940
  getSupportedMimeType() {
1013
- const t = [
941
+ const r = [
1014
942
  "audio/webm",
1015
943
  "audio/webm;codecs=opus",
1016
944
  "audio/ogg;codecs=opus",
1017
945
  "audio/mp4",
1018
946
  "audio/wav"
1019
947
  ];
1020
- for (const e of t)
948
+ for (const e of r)
1021
949
  if (MediaRecorder.isTypeSupported(e))
1022
950
  return e;
1023
951
  return "audio/webm";
@@ -1026,115 +954,115 @@ class $e {
1026
954
  * Clean up recording resources
1027
955
  */
1028
956
  cleanup() {
1029
- this.recordingStream && (this.recordingStream.getTracks().forEach((t) => t.stop()), this.recordingStream = null), this.mediaRecorder = null, this.audioChunks = [], this.autoStopTimeoutId && (clearTimeout(this.autoStopTimeoutId), this.autoStopTimeoutId = null);
957
+ 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);
1030
958
  }
1031
959
  }
1032
- const O = new $e(), _e = (i = {}) => {
1033
- const [t, e] = y(!1), [a, s] = y(!1), [c, n] = y(null), [o, m] = y(null), [g, d] = y(null);
1034
- i.config && O.updateConfig(i.config);
1035
- const u = v(async (j) => {
1036
- var N;
960
+ const z = new He(), Ye = (i = {}) => {
961
+ const [r, e] = k(!1), [n, s] = k(!1), [c, a] = k(null), [o, w] = k(null), [g, d] = k(null);
962
+ i.config && z.updateConfig(i.config);
963
+ const h = A(async (N) => {
964
+ var j;
1037
965
  try {
1038
- m(null), n(null), d(null), await O.startRecording(j, {
966
+ w(null), a(null), d(null), await z.startRecording(N, {
1039
967
  onStart: () => {
1040
- var w;
1041
- e(!0), (w = i.onStart) == null || w.call(i);
968
+ var l;
969
+ e(!0), (l = i.onStart) == null || l.call(i);
1042
970
  },
1043
971
  onStop: () => {
1044
- var w;
1045
- e(!1), (w = i.onStop) == null || w.call(i);
972
+ var l;
973
+ e(!1), (l = i.onStop) == null || l.call(i);
1046
974
  },
1047
- onError: (w) => {
1048
- var T;
1049
- const p = w instanceof b ? w : new b(w.message, "RECORDING_ERROR", !0);
1050
- m(p), e(!1), (T = i.onError) == null || T.call(i, p);
975
+ onError: (l) => {
976
+ var M;
977
+ const f = l instanceof y ? l : new y(l.message, "RECORDING_ERROR", !0);
978
+ w(f), e(!1), (M = i.onError) == null || M.call(i, f);
1051
979
  }
1052
980
  });
1053
- } catch (w) {
1054
- const p = w instanceof b ? w : new b(
1055
- w instanceof Error ? w.message : String(w),
981
+ } catch (l) {
982
+ const f = l instanceof y ? l : new y(
983
+ l instanceof Error ? l.message : String(l),
1056
984
  "START_FAILED",
1057
985
  !1
1058
986
  );
1059
- throw m(p), e(!1), (N = i.onError) == null || N.call(i, p), p;
987
+ throw w(f), e(!1), (j = i.onError) == null || j.call(i, f), f;
1060
988
  }
1061
- }, []), h = v(async () => {
1062
- var j, N;
989
+ }, []), u = A(async () => {
990
+ var N, j;
1063
991
  try {
1064
- const w = await O.stopRecording();
1065
- return d(w), e(!1), (j = i.onStop) == null || j.call(i), w;
1066
- } catch (w) {
1067
- const p = w instanceof b ? w : new b(
1068
- w instanceof Error ? w.message : String(w),
992
+ const l = await z.stopRecording();
993
+ return d(l), e(!1), (N = i.onStop) == null || N.call(i), l;
994
+ } catch (l) {
995
+ const f = l instanceof y ? l : new y(
996
+ l instanceof Error ? l.message : String(l),
1069
997
  "STOP_FAILED",
1070
998
  !1
1071
999
  );
1072
- throw m(p), e(!1), (N = i.onError) == null || N.call(i, p), p;
1000
+ throw w(f), e(!1), (j = i.onError) == null || j.call(i, f), f;
1073
1001
  }
1074
- }, []), x = v(
1075
- async (j, N = {}) => {
1076
- var w, p;
1002
+ }, []), m = A(
1003
+ async (N, j = {}) => {
1004
+ var l, f;
1077
1005
  try {
1078
- m(null), s(!0);
1079
- const T = {
1080
- audioBlob: j,
1081
- ...N
1082
- }, S = await O.transcribe(T);
1083
- return n(S.transcript), s(!1), (w = i.onTranscriptionComplete) == null || w.call(i, S), S;
1084
- } catch (T) {
1085
- const S = T instanceof b ? T : new b(
1086
- T instanceof Error ? T.message : String(T),
1006
+ w(null), s(!0);
1007
+ const M = {
1008
+ audioBlob: N,
1009
+ ...j
1010
+ }, b = await z.transcribe(M);
1011
+ return a(b.transcript), s(!1), (l = i.onTranscriptionComplete) == null || l.call(i, b), b;
1012
+ } catch (M) {
1013
+ const b = M instanceof y ? M : new y(
1014
+ M instanceof Error ? M.message : String(M),
1087
1015
  "TRANSCRIPTION_FAILED",
1088
1016
  !0
1089
1017
  );
1090
- throw m(S), s(!1), (p = i.onError) == null || p.call(i, S), S;
1018
+ throw w(b), s(!1), (f = i.onError) == null || f.call(i, b), b;
1091
1019
  }
1092
1020
  },
1093
1021
  []
1094
- ), k = v(() => {
1095
- O.cancelRecording(), e(!1), d(null);
1022
+ ), v = A(() => {
1023
+ z.cancelRecording(), e(!1), d(null);
1096
1024
  }, []);
1097
1025
  return {
1098
- startRecording: u,
1099
- stopRecording: h,
1100
- transcribe: x,
1101
- cancelRecording: k,
1102
- isRecording: t,
1103
- isTranscribing: a,
1026
+ startRecording: h,
1027
+ stopRecording: u,
1028
+ transcribe: m,
1029
+ cancelRecording: v,
1030
+ isRecording: r,
1031
+ isTranscribing: n,
1104
1032
  transcript: c,
1105
1033
  error: o,
1106
1034
  audioBlob: g
1107
1035
  };
1108
1036
  };
1109
- class Le {
1110
- constructor(t = {}) {
1111
- I(this, "config");
1112
- I(this, "currentAudio", null);
1037
+ class Ve {
1038
+ constructor(r = {}) {
1039
+ D(this, "config");
1040
+ D(this, "currentAudio", null);
1113
1041
  this.config = {
1114
1042
  baseUrl: "http://localhost:8000",
1115
1043
  provider: "piper",
1116
1044
  voice: "string",
1117
1045
  speed: 1,
1118
- ...t
1046
+ ...r
1119
1047
  };
1120
1048
  }
1121
1049
  /**
1122
1050
  * Update TTS configuration
1123
1051
  */
1124
- updateConfig(t) {
1125
- this.config = { ...this.config, ...t };
1052
+ updateConfig(r) {
1053
+ this.config = { ...this.config, ...r };
1126
1054
  }
1127
1055
  /**
1128
1056
  * Get TTS audio from the API and return as blob
1129
1057
  */
1130
- async synthesizeSpeech(t) {
1058
+ async synthesizeSpeech(r) {
1131
1059
  const {
1132
1060
  text: e,
1133
- voice: a = this.config.voice,
1061
+ voice: n = this.config.voice,
1134
1062
  speed: s = this.config.speed
1135
- } = t, c = new URLSearchParams();
1136
- c.append("text", e), c.append("voice", a || "string"), c.append("speed", (s == null ? void 0 : s.toString()) || "1");
1137
- const n = await H(
1063
+ } = r, c = new URLSearchParams();
1064
+ c.append("text", e), c.append("voice", n || "string"), c.append("speed", (s == null ? void 0 : s.toString()) || "1");
1065
+ const a = await se(
1138
1066
  `${this.config.baseUrl}/speech/synthesize`,
1139
1067
  {
1140
1068
  method: "POST",
@@ -1153,16 +1081,16 @@ class Le {
1153
1081
  jitter: !1
1154
1082
  }
1155
1083
  );
1156
- if (!n.ok)
1084
+ if (!a.ok)
1157
1085
  throw new Error(
1158
- `TTS request failed: ${n.status} ${n.statusText}`
1086
+ `TTS request failed: ${a.status} ${a.statusText}`
1159
1087
  );
1160
- const o = n.headers.get("content-type");
1088
+ const o = a.headers.get("content-type");
1161
1089
  if (o && o.includes("audio/"))
1162
- return n.blob();
1090
+ return a.blob();
1163
1091
  try {
1164
- const m = await n.json();
1165
- throw new Error(`TTS Error: ${JSON.stringify(m)}`);
1092
+ const w = await a.json();
1093
+ throw new Error(`TTS Error: ${JSON.stringify(w)}`);
1166
1094
  } catch {
1167
1095
  throw new Error("TTS request failed with unknown error");
1168
1096
  }
@@ -1170,35 +1098,35 @@ class Le {
1170
1098
  /**
1171
1099
  * Speak text and return a promise that resolves when playback completes
1172
1100
  */
1173
- async speak(t, e) {
1174
- var a, s;
1101
+ async speak(r, e) {
1102
+ var n, s;
1175
1103
  try {
1176
- this.stop(), (a = e == null ? void 0 : e.onStart) == null || a.call(e);
1177
- const c = await this.synthesizeSpeech(t), n = URL.createObjectURL(c);
1178
- return this.currentAudio = new Audio(n), new Promise((o, m) => {
1104
+ this.stop(), (n = e == null ? void 0 : e.onStart) == null || n.call(e);
1105
+ const c = await this.synthesizeSpeech(r), a = URL.createObjectURL(c);
1106
+ return this.currentAudio = new Audio(a), new Promise((o, w) => {
1179
1107
  if (!this.currentAudio) {
1180
- m(new Error("Audio element not created"));
1108
+ w(new Error("Audio element not created"));
1181
1109
  return;
1182
1110
  }
1183
1111
  const g = this.currentAudio;
1184
1112
  g.onended = () => {
1185
1113
  var d;
1186
- URL.revokeObjectURL(n), this.currentAudio = null, (d = e == null ? void 0 : e.onEnd) == null || d.call(e), o();
1114
+ URL.revokeObjectURL(a), this.currentAudio = null, (d = e == null ? void 0 : e.onEnd) == null || d.call(e), o();
1187
1115
  }, g.onerror = (d) => {
1188
- var h;
1189
- URL.revokeObjectURL(n), this.currentAudio = null;
1190
- const u = new Error(`Audio playback failed: ${d}`);
1191
- (h = e == null ? void 0 : e.onError) == null || h.call(e, u), m(u);
1116
+ var u;
1117
+ URL.revokeObjectURL(a), this.currentAudio = null;
1118
+ const h = new Error(`Audio playback failed: ${d}`);
1119
+ (u = e == null ? void 0 : e.onError) == null || u.call(e, h), w(h);
1192
1120
  }, g.play().catch((d) => {
1193
- var h;
1194
- URL.revokeObjectURL(n), this.currentAudio = null;
1195
- const u = new Error(`Failed to play audio: ${d.message}`);
1196
- (h = e == null ? void 0 : e.onError) == null || h.call(e, u), m(u);
1121
+ var u;
1122
+ URL.revokeObjectURL(a), this.currentAudio = null;
1123
+ const h = new Error(`Failed to play audio: ${d.message}`);
1124
+ (u = e == null ? void 0 : e.onError) == null || u.call(e, h), w(h);
1197
1125
  });
1198
1126
  });
1199
1127
  } catch (c) {
1200
- const n = c instanceof Error ? c : new Error(`TTS Error: ${String(c)}`);
1201
- throw (s = e == null ? void 0 : e.onError) == null || s.call(e, n), n;
1128
+ const a = c instanceof Error ? c : new Error(`TTS Error: ${String(c)}`);
1129
+ throw (s = e == null ? void 0 : e.onError) == null || s.call(e, a), a;
1202
1130
  }
1203
1131
  }
1204
1132
  /**
@@ -1214,661 +1142,1159 @@ class Le {
1214
1142
  return this.currentAudio !== null && !this.currentAudio.paused;
1215
1143
  }
1216
1144
  }
1217
- const B = new Le(), Ue = (i = {}) => {
1218
- const [t, e] = y(!1), [a, s] = y(!1), [c, n] = y(null);
1219
- i.config && B.updateConfig(i.config);
1220
- const o = v(
1145
+ const re = new Ve(), Je = (i = {}) => {
1146
+ const [r, e] = k(!1), [n, s] = k(!1), [c, a] = k(null);
1147
+ i.config && re.updateConfig(i.config);
1148
+ const o = A(
1221
1149
  async (g, d = {}) => {
1222
- var u;
1150
+ var h;
1223
1151
  try {
1224
- n(null), s(!0);
1225
- const h = {
1152
+ a(null), s(!0);
1153
+ const u = {
1226
1154
  text: g,
1227
1155
  ...d
1228
1156
  };
1229
- await B.speak(h, {
1157
+ await re.speak(u, {
1230
1158
  onStart: () => {
1231
- var x;
1232
- s(!1), e(!0), (x = i.onStart) == null || x.call(i);
1159
+ var m;
1160
+ s(!1), e(!0), (m = i.onStart) == null || m.call(i);
1233
1161
  },
1234
1162
  onEnd: () => {
1235
- var x;
1236
- e(!1), (x = i.onEnd) == null || x.call(i);
1163
+ var m;
1164
+ e(!1), (m = i.onEnd) == null || m.call(i);
1237
1165
  },
1238
- onError: (x) => {
1239
- var k;
1240
- e(!1), s(!1), n(x), (k = i.onError) == null || k.call(i, x);
1166
+ onError: (m) => {
1167
+ var v;
1168
+ e(!1), s(!1), a(m), (v = i.onError) == null || v.call(i, m);
1241
1169
  }
1242
1170
  });
1243
- } catch (h) {
1244
- const x = h instanceof Error ? h : new Error(String(h));
1245
- throw n(x), e(!1), s(!1), (u = i.onError) == null || u.call(i, x), x;
1171
+ } catch (u) {
1172
+ const m = u instanceof Error ? u : new Error(String(u));
1173
+ throw a(m), e(!1), s(!1), (h = i.onError) == null || h.call(i, m), m;
1246
1174
  }
1247
1175
  },
1248
1176
  [i]
1249
- ), m = v(() => {
1250
- B.stop(), e(!1), s(!1);
1177
+ ), w = A(() => {
1178
+ re.stop(), e(!1), s(!1);
1251
1179
  }, []);
1252
1180
  return {
1253
1181
  speak: o,
1254
- stop: m,
1255
- isPlaying: t,
1256
- isLoading: a,
1182
+ stop: w,
1183
+ isPlaying: r,
1184
+ isLoading: n,
1257
1185
  error: c
1258
1186
  };
1259
- };
1260
- function qe(i) {
1261
- const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);
1262
- return t ? {
1263
- r: parseInt(t[1], 16),
1264
- g: parseInt(t[2], 16),
1265
- b: parseInt(t[3], 16)
1266
- } : null;
1267
- }
1268
- function Fe(i, t, e) {
1269
- return "#" + [i, t, e].map((a) => {
1270
- const s = Math.round(a).toString(16);
1271
- return s.length === 1 ? "0" + s : s;
1272
- }).join("");
1273
- }
1274
- function V(i, t) {
1275
- const e = qe(i);
1276
- if (!e) return i;
1277
- const a = e.r + (255 - e.r) * t, s = e.g + (255 - e.g) * t, c = e.b + (255 - e.b) * t;
1278
- return Fe(a, s, c);
1279
- }
1280
- function Qe(i, t = 0.8) {
1281
- const e = V(i, t), a = V(i, 0.7);
1282
- return {
1283
- background: `linear-gradient(to bottom, ${e}, #ffffff)`,
1284
- border: `1px solid ${a}`,
1285
- color: "#1f2937"
1286
- };
1287
- }
1288
- function Be(i) {
1289
- return new Promise((t) => setTimeout(t, i));
1290
- }
1291
- const He = ({
1292
- state: i,
1293
- className: t = "",
1294
- defaultTimers: e = { thinking: 30, answering: 120, editing: 30 }
1295
- }) => {
1296
- const a = (d) => {
1297
- const u = Math.floor(d / 60), h = d % 60;
1298
- return `${u.toString().padStart(2, "0")}:${h.toString().padStart(2, "0")}`;
1299
- }, s = (d) => ({
1300
- [l.IDLE]: "Ready",
1301
- [l.FETCHING_QUESTION]: "Loading Question...",
1302
- [l.READING_QUESTION]: "Reading Question...",
1303
- [l.THINKING]: "Preparation Time",
1304
- [l.ANSWERING]: "Recording Answer",
1305
- [l.TRANSCRIBING]: "Processing Speech...",
1306
- [l.EDITING]: "Edit Your Answer",
1307
- [l.SUBMITTING]: "Submitting...",
1308
- [l.COMPLETED]: "Interview Complete"
1309
- })[d] || d, c = (d) => ({
1310
- [l.IDLE]: "iw-bg-gray-500",
1311
- [l.FETCHING_QUESTION]: "iw-bg-blue-500",
1312
- [l.READING_QUESTION]: "iw-bg-indigo-500",
1313
- [l.THINKING]: "iw-bg-yellow-500",
1314
- [l.ANSWERING]: "iw-bg-red-500",
1315
- [l.TRANSCRIBING]: "iw-bg-purple-500",
1316
- [l.EDITING]: "iw-bg-orange-500",
1317
- [l.SUBMITTING]: "iw-bg-green-500",
1318
- [l.COMPLETED]: "iw-bg-green-600"
1319
- })[d] || "iw-bg-gray-500", n = (d) => ({
1320
- [l.IDLE]: "iw-bg-gray-100 iw-text-gray-800",
1321
- [l.FETCHING_QUESTION]: "iw-bg-blue-100 iw-text-blue-800",
1322
- [l.READING_QUESTION]: "iw-bg-indigo-100 iw-text-indigo-800",
1323
- [l.THINKING]: "iw-bg-yellow-100 iw-text-yellow-800",
1324
- [l.ANSWERING]: "iw-bg-red-100 iw-text-red-800",
1325
- [l.TRANSCRIBING]: "iw-bg-purple-100 iw-text-purple-800",
1326
- [l.EDITING]: "iw-bg-orange-100 iw-text-orange-800",
1327
- [l.SUBMITTING]: "iw-bg-green-100 iw-text-green-800",
1328
- [l.COMPLETED]: "iw-bg-green-200 iw-text-green-900"
1329
- })[d] || "iw-bg-gray-100 iw-text-gray-800", o = (d) => ({
1330
- [l.IDLE]: "Ready to start next question.",
1331
- [l.FETCHING_QUESTION]: "Please wait while we load the next question...",
1332
- [l.READING_QUESTION]: "Listening to the question...",
1333
- [l.THINKING]: "Take time to think about your answer.",
1334
- [l.ANSWERING]: "Speak clearly into your microphone.",
1335
- [l.TRANSCRIBING]: "Converting your speech to text...",
1336
- [l.EDITING]: "Review and edit your answer.",
1337
- [l.SUBMITTING]: "Submitting your answer...",
1338
- [l.COMPLETED]: "Thank you for completing the interview!"
1339
- })[d] || "";
1340
- function m(d) {
1341
- return {
1342
- [l.THINKING]: e.thinking || 30,
1343
- [l.ANSWERING]: e.answering || 120,
1344
- [l.EDITING]: e.editing || 30
1345
- }[d] || 1;
1187
+ }, Xe = ({ className: i = "" }) => {
1188
+ const r = E(null);
1189
+ return $(() => {
1190
+ let e = null;
1191
+ return (async () => {
1192
+ try {
1193
+ e = await navigator.mediaDevices.getUserMedia({
1194
+ video: !0,
1195
+ audio: !1
1196
+ }), r.current && (r.current.srcObject = e);
1197
+ } catch (s) {
1198
+ console.error("Error accessing camera:", s);
1199
+ }
1200
+ })(), () => {
1201
+ e && e.getTracks().forEach((s) => s.stop());
1202
+ };
1203
+ }, []), /* @__PURE__ */ t.jsx("div", { className: `iw-relative ${i}`, children: /* @__PURE__ */ t.jsx(
1204
+ "video",
1205
+ {
1206
+ ref: r,
1207
+ autoPlay: !0,
1208
+ muted: !0,
1209
+ hidden: !0,
1210
+ className: "iw-w-full iw-h-full iw-object-cover iw-scale-75 iw-rounded-md iw-min-h-[400px] iw-max-h-[600px] iw-aspect-video",
1211
+ style: {
1212
+ transform: "scaleX(-1)"
1213
+ }
1214
+ }
1215
+ ) });
1216
+ }, W = (i) => {
1217
+ const { baseColor: r, borderRadius: e } = Q(), { loading: n, children: s, ...c } = i;
1218
+ return /* @__PURE__ */ t.jsx(
1219
+ ie,
1220
+ {
1221
+ style: {
1222
+ background: me(r),
1223
+ borderRadius: e
1224
+ },
1225
+ ...c,
1226
+ children: n ? /* @__PURE__ */ t.jsx(ue, {}) : s
1227
+ }
1228
+ );
1229
+ }, ae = (i) => /* @__PURE__ */ t.jsxs(
1230
+ "svg",
1231
+ {
1232
+ xmlns: "http://www.w3.org/2000/svg",
1233
+ width: "24",
1234
+ height: "24",
1235
+ viewBox: "0 0 24 24",
1236
+ fill: "none",
1237
+ stroke: "currentColor",
1238
+ strokeWidth: "2",
1239
+ strokeLinecap: "round",
1240
+ strokeLinejoin: "round",
1241
+ ...i,
1242
+ children: [
1243
+ /* @__PURE__ */ t.jsx("path", { d: "M12 2a10 10 0 0 1 7.38 16.75" }),
1244
+ /* @__PURE__ */ t.jsx("path", { d: "M12 6v6l4 2" }),
1245
+ /* @__PURE__ */ t.jsx("path", { d: "M2.5 8.875a10 10 0 0 0-.5 3" }),
1246
+ /* @__PURE__ */ t.jsx("path", { d: "M2.83 16a10 10 0 0 0 2.43 3.4" }),
1247
+ /* @__PURE__ */ t.jsx("path", { d: "M4.636 5.235a10 10 0 0 1 .891-.857" }),
1248
+ /* @__PURE__ */ t.jsx("path", { d: "M8.644 21.42a10 10 0 0 0 7.631-.38" })
1249
+ ]
1346
1250
  }
1347
- const g = i.currentPhaseTimeRemaining > 0;
1348
- return /* @__PURE__ */ r.jsxs(
1251
+ ), Ze = (i, r, e) => Math.max(r, Math.min(e, i)), ce = (i) => {
1252
+ const r = Math.max(0, Math.floor(i)), e = Math.floor(r / 60).toString().padStart(2, "0"), n = (r % 60).toString().padStart(2, "0");
1253
+ return `${e}:${n}`;
1254
+ }, ne = ({
1255
+ total: i,
1256
+ remaining: r,
1257
+ size: e = 64,
1258
+ strokeWidth: n = 6,
1259
+ className: s = "",
1260
+ showLabel: c = !0
1261
+ }) => {
1262
+ const a = Math.max(1, i || 1), o = Ze(r / a, 0, 1), { radius: w, circumference: g, dashOffset: d, center: h } = J(() => {
1263
+ const v = (e - n) / 2, N = 2 * Math.PI * v, j = N * (1 - o), l = Math.round(n) % 2 === 1, f = e / 2 + (l ? 0.5 : 0);
1264
+ return { radius: v, circumference: N, dashOffset: j, center: f };
1265
+ }, [e, n, o]), u = J(() => o <= 0.25 ? "iw-stroke-red-500" : o <= 0.5 ? "iw-stroke-yellow-500" : "iw-stroke-green-500", [o]), m = o <= 0.25 ? "iw-animate-pulse" : "";
1266
+ return /* @__PURE__ */ t.jsxs(
1349
1267
  "div",
1350
1268
  {
1351
- className: `iw-iw-bg-white iw-rounded-lg iw-shadow-md iw-p-4 iw-border iw-border-gray-200 ${t}`,
1269
+ className: `iw-relative iw-inline-flex iw-items-center iw-justify-center iw-rounded-full iw-bg-white ${s}`,
1270
+ style: { width: e, height: e },
1271
+ "aria-label": `Time remaining ${ce(r)}`,
1272
+ role: "timer",
1273
+ "aria-live": "polite",
1352
1274
  children: [
1353
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-justify-between iw-items-center iw-mb-4", children: [
1354
- /* @__PURE__ */ r.jsxs("div", { children: [
1355
- /* @__PURE__ */ r.jsx("h3", { className: "iw-text-sm iw-font-semibold iw-text-gray-700", children: "Interview Timer" }),
1356
- /* @__PURE__ */ r.jsxs("p", { className: "iw-text-xs iw-text-gray-700 iw-my-3 iw-font-mono", children: [
1357
- "Phase",
1358
- " ",
1359
- /* @__PURE__ */ r.jsx(
1360
- "span",
1275
+ /* @__PURE__ */ t.jsx(
1276
+ "svg",
1277
+ {
1278
+ width: e,
1279
+ height: e,
1280
+ viewBox: `0 0 ${e} ${e}`,
1281
+ preserveAspectRatio: "xMidYMid meet",
1282
+ children: /* @__PURE__ */ t.jsxs("g", { transform: `rotate(-90 ${h} ${h})`, children: [
1283
+ /* @__PURE__ */ t.jsx(
1284
+ "circle",
1361
1285
  {
1362
- className: `iw-px-3 iw-py-1.5 iw-rounded-md iw-font-medium ${n(
1363
- i.phase
1364
- )}`,
1365
- children: i.phase
1286
+ cx: h,
1287
+ cy: h,
1288
+ r: w,
1289
+ className: "iw-stroke-gray-200",
1290
+ strokeWidth: n,
1291
+ fill: "none",
1292
+ shapeRendering: "geometricPrecision",
1293
+ vectorEffect: "non-scaling-stroke"
1294
+ }
1295
+ ),
1296
+ /* @__PURE__ */ t.jsx(
1297
+ "circle",
1298
+ {
1299
+ cx: h,
1300
+ cy: h,
1301
+ r: w,
1302
+ className: `${u} ${m}`,
1303
+ strokeWidth: n,
1304
+ strokeLinecap: "round",
1305
+ fill: "none",
1306
+ strokeDasharray: g,
1307
+ strokeDashoffset: d,
1308
+ shapeRendering: "geometricPrecision",
1309
+ vectorEffect: "non-scaling-stroke",
1310
+ style: {
1311
+ transition: "stroke-dashoffset 0.3s ease, stroke 0.2s ease"
1312
+ }
1366
1313
  }
1367
1314
  )
1368
- ] }),
1369
- /* @__PURE__ */ r.jsxs("p", { className: "iw-text-xs iw-text-gray-700 iw-font-mono", children: [
1370
- "Question ",
1371
- i.currentQuestionNumber
1372
1315
  ] })
1373
- ] }),
1374
- /* @__PURE__ */ r.jsxs("div", { className: "iw-text-right", children: [
1375
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-2xl iw-font-bold iw-text-gray-900", children: a(i.totalTimeRemaining) }),
1376
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: "Total Time Left" })
1377
- ] })
1378
- ] }),
1379
- /* @__PURE__ */ r.jsx("div", { className: "iw-mb-4", children: /* @__PURE__ */ r.jsx("div", { className: "iw-w-full iw-h-2 iw-iw-bg-gray-200 iw-rounded-full iw-overflow-hidden", children: /* @__PURE__ */ r.jsx(
1380
- "div",
1316
+ }
1317
+ ),
1318
+ c && /* @__PURE__ */ t.jsx("div", { className: "iw-absolute iw-inset-0 iw-flex iw-items-center iw-justify-center iw-rotate-0", children: /* @__PURE__ */ t.jsx(
1319
+ "span",
1381
1320
  {
1382
- className: "iw-h-full iw-iw-bg-gradient-to-r iw-from-blue-500 iw-to-purple-500 iw-transition-all iw-duration-300",
1383
- style: {
1384
- width: `${i.totalTimeElapsed / (i.totalTimeElapsed + i.totalTimeRemaining) * 100}%`
1385
- }
1321
+ className: `iw-text-[11px] iw-font-semibold iw-tabular-nums ${o <= 0.25 ? "iw-text-red-600" : o <= 0.5 ? "iw-text-yellow-600" : "iw-text-green-600"}`,
1322
+ children: ce(r)
1386
1323
  }
1387
- ) }) }),
1388
- /* @__PURE__ */ r.jsxs("div", { className: "iw-mb-4", children: [
1389
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-mb-2", children: [
1390
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
1391
- /* @__PURE__ */ r.jsx(
1392
- "div",
1393
- {
1394
- className: `iw-w-3 iw-h-3 iw-rounded-full ${c(
1395
- i.phase
1396
- )} ${g ? "iw-animate-pulse" : ""}`
1397
- }
1398
- ),
1399
- /* @__PURE__ */ r.jsx("span", { className: "iw-text-sm iw-font-medium iw-text-gray-700", children: s(i.phase) })
1400
- ] }),
1401
- g && /* @__PURE__ */ r.jsx("span", { className: "iw-text-lg iw-font-bold iw-text-gray-900", children: a(i.currentPhaseTimeRemaining) })
1402
- ] }),
1403
- g && /* @__PURE__ */ r.jsx("div", { className: "iw-w-full iw-h-1.5 iw-iw-bg-gray-200 iw-rounded-full iw-overflow-hidden", children: /* @__PURE__ */ r.jsx(
1404
- "div",
1405
- {
1406
- className: `iw-h-full ${c(
1407
- i.phase
1408
- )} iw-transition-all iw-duration-300`,
1409
- style: {
1410
- width: `${i.currentPhaseTimeRemaining / m(i.phase) * 100}%`
1411
- }
1412
- }
1413
- ) })
1414
- ] }),
1415
- /* @__PURE__ */ r.jsx("div", { className: "iw-mt-3 iw-pt-3 iw-border-t iw-border-gray-200", children: /* @__PURE__ */ r.jsx("p", { className: "iw-text-xs iw-text-gray-600", children: o(i.phase) }) })
1324
+ ) })
1416
1325
  ]
1417
1326
  }
1418
1327
  );
1419
- }, We = ({
1328
+ }, Ke = ({
1420
1329
  label: i,
1421
- error: t,
1330
+ error: r,
1422
1331
  fullWidth: e = !1,
1423
- className: a = "",
1332
+ className: n = "",
1424
1333
  id: s,
1425
1334
  ...c
1426
1335
  }) => {
1427
- const n = s || `textarea-${Math.random().toString(36).substring(2, 9)}`, o = "iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-focus:border-primary-500 iw-focus:ring-primary-500 iw-focus:outline-none iw-transition-all", m = t ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", g = e ? "iw-w-full" : "", d = a.includes("iw-h-full") ? "iw-h-full" : "";
1428
- return /* @__PURE__ */ r.jsxs(
1336
+ const a = s || `textarea-${Math.random().toString(36).substring(2, 9)}`, o = "iw-block iw-rounded-md iw-border iw-border-gray-300 iw-shadow-sm iw-px-4 iw-py-2 iw-text-sm iw-transition-all", w = r ? "iw-border-red-500 iw-focus:border-red-500 iw-focus:ring-red-500" : "", g = e ? "iw-w-full" : "", d = n.includes("iw-h-full") || e ? "iw-h-full" : "";
1337
+ return /* @__PURE__ */ t.jsxs(
1429
1338
  "div",
1430
1339
  {
1431
- className: `${e ? "iw-w-full iw-h-full" : ""} ${d ? "iw-flex iw-flex-col" : ""}`,
1340
+ className: `iw-h-full iw-flex iw-flex-col ${e ? "iw-w-full" : ""}`,
1432
1341
  children: [
1433
- i && /* @__PURE__ */ r.jsx(
1342
+ i && /* @__PURE__ */ t.jsx(
1434
1343
  "label",
1435
1344
  {
1436
- htmlFor: n,
1345
+ htmlFor: a,
1437
1346
  className: "iw-block iw-text-sm iw-font-medium iw-text-gray-700 iw-mb-1",
1438
1347
  children: i
1439
1348
  }
1440
1349
  ),
1441
- /* @__PURE__ */ r.jsx(
1350
+ /* @__PURE__ */ t.jsx(
1442
1351
  "textarea",
1443
1352
  {
1444
- id: n,
1445
- className: `${o} ${m} ${g} ${d} ${a}`,
1446
- "aria-invalid": t ? "true" : "false",
1353
+ id: a,
1354
+ className: `${o} ${w} ${g} ${d} ${n}`,
1355
+ "aria-invalid": r ? "true" : "false",
1447
1356
  ...c
1448
1357
  }
1449
1358
  ),
1450
- t && /* @__PURE__ */ r.jsx("p", { className: "iw-mt-1 iw-text-sm iw-text-red-600", children: t })
1359
+ r && /* @__PURE__ */ t.jsx("p", { className: "iw-mt-1 iw-text-sm iw-text-red-600", children: r })
1451
1360
  ]
1452
1361
  }
1453
1362
  );
1454
- }, ze = ({
1363
+ }, et = ({
1455
1364
  value: i,
1456
- onChange: t,
1365
+ onChange: r,
1457
1366
  onSubmit: e,
1458
- isSubmitDisabled: a,
1459
- remainingTimeText: s
1367
+ isSubmitDisabled: n,
1368
+ state: s,
1369
+ editingTime: c
1370
+ }) => {
1371
+ const a = (o) => {
1372
+ o.key === "Enter" && (o.ctrlKey || o.metaKey) && !n && (o.preventDefault(), e());
1373
+ };
1374
+ return /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-h-full ", children: [
1375
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
1376
+ /* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Your Answer" }),
1377
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
1378
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
1379
+ /* @__PURE__ */ t.jsx(ae, { className: "iw-size-4 iw-text-orange-600" }),
1380
+ /* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to edit: " })
1381
+ ] }),
1382
+ /* @__PURE__ */ t.jsx(
1383
+ ne,
1384
+ {
1385
+ total: c,
1386
+ remaining: s.currentPhaseTimeRemaining,
1387
+ size: 50,
1388
+ strokeWidth: 4
1389
+ }
1390
+ )
1391
+ ] })
1392
+ ] }),
1393
+ /* @__PURE__ */ t.jsxs("div", { className: " iw-overflow-hidden iw-flex iw-flex-col iw-h-full iw-mt-2", children: [
1394
+ /* @__PURE__ */ t.jsx(
1395
+ Ke,
1396
+ {
1397
+ value: i,
1398
+ onChange: r,
1399
+ onKeyDown: a,
1400
+ placeholder: "Type your answer here...",
1401
+ className: " iw-w-full iw-h-full iw-flex-1 iw-resize-none !iw-p-4 iw-bg-transparent iw-min-h-full focus-visible:iw-outline-0",
1402
+ onPaste: (o) => o.preventDefault(),
1403
+ onCopy: (o) => o.preventDefault(),
1404
+ onCut: (o) => o.preventDefault(),
1405
+ onDrop: (o) => o.preventDefault(),
1406
+ onDragOver: (o) => o.preventDefault()
1407
+ }
1408
+ ),
1409
+ /* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1 iw-mt-4", children: /* @__PURE__ */ t.jsx(W, { onClick: e, disabled: n, children: "Submit Answer" }) })
1410
+ ] })
1411
+ ] });
1412
+ }, tt = ({
1413
+ className: i = "",
1414
+ width: r,
1415
+ height: e = 56,
1416
+ barWidth: n = 3,
1417
+ gap: s = 2,
1418
+ fftSize: c = 1024,
1419
+ smoothingTimeConstant: a = 0.8,
1420
+ mediaStream: o,
1421
+ startOnMount: w = !0
1460
1422
  }) => {
1461
- const c = (n) => {
1462
- n.key === "Enter" && (n.ctrlKey || n.metaKey) && !a && (n.preventDefault(), e());
1423
+ const { baseColor: g } = Q(), d = E(null), h = E(null), u = E(null), m = E(null), v = E(null), N = E(null), j = E(!1), [l, f] = k(null);
1424
+ $(() => {
1425
+ if (r || !h.current) return;
1426
+ const b = h.current, P = () => {
1427
+ const R = d.current;
1428
+ if (!R) return;
1429
+ const S = b.clientWidth, C = e;
1430
+ R.width = Math.max(1, Math.floor(S * window.devicePixelRatio || 1)), R.height = Math.max(1, Math.floor(C * window.devicePixelRatio || 1));
1431
+ }, x = new ResizeObserver(P);
1432
+ return x.observe(b), P(), () => x.disconnect();
1433
+ }, [r, e]), $(() => {
1434
+ if (!r) return;
1435
+ const b = d.current;
1436
+ b && (b.width = Math.max(
1437
+ 1,
1438
+ Math.floor(r * (window.devicePixelRatio || 1))
1439
+ ), b.height = Math.max(
1440
+ 1,
1441
+ Math.floor(e * (window.devicePixelRatio || 1))
1442
+ ));
1443
+ }, [r, e]), $(() => {
1444
+ let b = !1;
1445
+ return (async () => {
1446
+ try {
1447
+ const x = new (window.AudioContext || window.webkitAudioContext)();
1448
+ u.current = x;
1449
+ let R = o;
1450
+ if (!R) {
1451
+ if (!w) return;
1452
+ R = await navigator.mediaDevices.getUserMedia({
1453
+ audio: !0,
1454
+ video: !1
1455
+ }), j.current = !0;
1456
+ }
1457
+ if (b) return;
1458
+ const S = x.createAnalyser();
1459
+ S.fftSize = c, S.smoothingTimeConstant = a, m.current = S;
1460
+ const C = x.createMediaStreamSource(R);
1461
+ v.current = C, C.connect(S), M();
1462
+ } catch (x) {
1463
+ f((x == null ? void 0 : x.message) || "Failed to initialize microphone");
1464
+ }
1465
+ })(), () => {
1466
+ var x, R, S, C;
1467
+ b = !0, N.current && cancelAnimationFrame(N.current);
1468
+ try {
1469
+ (x = v.current) == null || x.disconnect();
1470
+ } catch {
1471
+ }
1472
+ try {
1473
+ (R = m.current) == null || R.disconnect();
1474
+ } catch {
1475
+ }
1476
+ j.current && ((C = ((S = v.current) == null ? void 0 : S.mediaStream) || void 0) == null || C.getTracks().forEach((G) => G.stop())), u.current && u.current.state !== "closed" && u.current.close();
1477
+ };
1478
+ }, [o, c, a, w]);
1479
+ const M = () => {
1480
+ const b = d.current, P = m.current;
1481
+ if (!b || !P) return;
1482
+ const x = b.getContext("2d");
1483
+ if (!x) return;
1484
+ const R = window.devicePixelRatio || 1, S = b.width, C = b.height, G = P.frequencyBinCount, _ = new Uint8Array(G), F = () => {
1485
+ N.current = requestAnimationFrame(F), P.getByteTimeDomainData(_), x.clearRect(0, 0, S, C), x.fillStyle = "rgba(0,0,0,0)", x.fillRect(0, 0, S, C);
1486
+ const T = Math.max(1, Math.floor(n * R)), q = Math.max(1, Math.floor(s * R)), H = T + q, Y = Math.max(8, Math.floor((S + q) / H)), K = Math.floor(_.length / Y);
1487
+ for (let B = 0; B < Y; B++) {
1488
+ const ee = Math.min(_.length - 1, B * K), te = _[ee] / 128 - 1, U = Math.abs(te), p = Math.pow(U, 0.6), L = Math.max(C * 0.06, p * (C * 0.9)), V = B * H, fe = (C - L) / 2, xe = 140 - Math.min(140, 140 * U), pe = 85, be = 48 + Math.floor(12 * (1 - U));
1489
+ x.fillStyle = `${g}`, x.shadowColor = `hsla(${xe}, ${pe}%, ${be}%, ${0.25 * U})`, x.shadowBlur = 8 * U;
1490
+ const ye = Math.min(T / 2, L / 2);
1491
+ rt(x, V, fe, T, L, ye), x.fill();
1492
+ }
1493
+ };
1494
+ F();
1463
1495
  };
1464
- return /* @__PURE__ */ r.jsx("div", { className: "iw-mt-auto", children: /* @__PURE__ */ r.jsxs("div", { className: "iw-rounded-xl iw-overflow-hidden iw-border iw-border-gray-200", children: [
1465
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between iw-px-3 iw-py-2 iw-bg-gray-50 iw-border-b iw-border-gray-200", children: [
1466
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-sm iw-font-medium", children: "Your answer" }),
1467
- s && /* @__PURE__ */ r.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: s })
1496
+ return /* @__PURE__ */ t.jsxs(
1497
+ "div",
1498
+ {
1499
+ ref: h,
1500
+ className: `iw-relative iw-w-full iw-overflow-hidden iw-rounded-md iw-bg-gray-50 ${i}`,
1501
+ style: { height: e },
1502
+ children: [
1503
+ /* @__PURE__ */ t.jsx("canvas", { ref: d, className: "iw-w-full iw-h-full" }),
1504
+ l && /* @__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: l }) })
1505
+ ]
1506
+ }
1507
+ );
1508
+ };
1509
+ function rt(i, r, e, n, s, c) {
1510
+ const a = Math.min(c, n / 2, s / 2);
1511
+ i.beginPath(), i.moveTo(r + a, e), i.lineTo(r + n - a, e), i.quadraticCurveTo(r + n, e, r + n, e + a), i.lineTo(r + n, e + s - a), i.quadraticCurveTo(r + n, e + s, r + n - a, e + s), i.lineTo(r + a, e + s), i.quadraticCurveTo(r, e + s, r, e + s - a), i.lineTo(r, e + a), i.quadraticCurveTo(r, e, r + a, e), i.closePath();
1512
+ }
1513
+ const it = ({
1514
+ state: i,
1515
+ answeringTime: r,
1516
+ nextPhase: e,
1517
+ sttError: n
1518
+ }) => /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-justify-between iw-h-full ", children: [
1519
+ /* @__PURE__ */ t.jsxs("div", { children: [
1520
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-between", children: [
1521
+ /* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "You may start speaking now. We're listening...." }),
1522
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
1523
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
1524
+ /* @__PURE__ */ t.jsx(ae, { className: "iw-size-4 iw-text-orange-600" }),
1525
+ /* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to talk: " })
1526
+ ] }),
1527
+ /* @__PURE__ */ t.jsx(
1528
+ ne,
1529
+ {
1530
+ total: r,
1531
+ remaining: i.currentPhaseTimeRemaining,
1532
+ size: 50,
1533
+ strokeWidth: 4
1534
+ }
1535
+ )
1536
+ ] })
1468
1537
  ] }),
1469
- /* @__PURE__ */ r.jsx(
1470
- We,
1538
+ /* @__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." })
1539
+ ] }),
1540
+ /* @__PURE__ */ t.jsxs("div", { children: [
1541
+ /* @__PURE__ */ t.jsx(tt, {}),
1542
+ n && /* @__PURE__ */ t.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
1543
+ "Recording error: ",
1544
+ n.message
1545
+ ] })
1546
+ ] }),
1547
+ /* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ t.jsx(
1548
+ W,
1549
+ {
1550
+ onClick: () => {
1551
+ e();
1552
+ },
1553
+ children: "Transcribe My Answer"
1554
+ }
1555
+ ) })
1556
+ ] });
1557
+ function st() {
1558
+ const [i, r] = k(!0), e = J(
1559
+ () => [0, 1, 2].map((n) => ({ id: n })),
1560
+ []
1561
+ );
1562
+ return $(() => {
1563
+ const n = setInterval(() => {
1564
+ r((s) => !s);
1565
+ }, 1500);
1566
+ return () => clearInterval(n);
1567
+ }, []), /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-8 iw-h-full", children: [
1568
+ /* @__PURE__ */ t.jsx("div", { className: "iw-relative iw-w-80 iw-h-48 ", "aria-hidden": !0, children: e.map((n, s) => {
1569
+ const c = s * 50, a = i ? c : c + 12, o = i ? 1 : 0.08, w = s * 140;
1570
+ return /* @__PURE__ */ t.jsx(
1571
+ "div",
1572
+ {
1573
+ role: "presentation",
1574
+ 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",
1575
+ style: {
1576
+ top: 0,
1577
+ transform: `translateY(${a}px)`,
1578
+ opacity: o,
1579
+ transition: `transform 600ms cubic-bezier(.2,.9,.3,1) ${w}ms, opacity 400ms ease ${w}ms`
1580
+ },
1581
+ children: /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-gap-3 iw-items-center", children: [
1582
+ /* @__PURE__ */ t.jsx("div", { className: "iw-w-10 iw-h-10 iw-bg-gray-300 iw-rounded iw-flex-shrink-0" }),
1583
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex-1 iw-space-y-2", children: [
1584
+ /* @__PURE__ */ t.jsx("div", { className: "iw-h-2 iw-bg-gray-300 iw-rounded iw-w-24" }),
1585
+ /* @__PURE__ */ t.jsx("div", { className: "iw-h-2 iw-bg-gray-300 iw-rounded iw-w-32" })
1586
+ ] })
1587
+ ] })
1588
+ },
1589
+ n.id
1590
+ );
1591
+ }) }),
1592
+ /* @__PURE__ */ t.jsx("div", { className: "iw-text-center", children: /* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-500 iw-font-medium", children: "Preparing your question..." }) })
1593
+ ] });
1594
+ }
1595
+ const ge = ({
1596
+ isOpen: i,
1597
+ onClose: r,
1598
+ children: e,
1599
+ title: n,
1600
+ showCloseButton: s = !0,
1601
+ closeOnOverlayClick: c = !0,
1602
+ closeOnEscape: a = !0,
1603
+ className: o = ""
1604
+ }) => {
1605
+ if ($(() => {
1606
+ if (!i || !a) return;
1607
+ const d = (h) => {
1608
+ h.key === "Escape" && r();
1609
+ };
1610
+ return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
1611
+ }, [i, a, r]), $(() => (i ? (document.body.style.overflow = "hidden", document.body.classList.add("interview-widget-container")) : (document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container")), () => {
1612
+ document.body.style.overflow = "unset", document.body.classList.remove("interview-widget-container");
1613
+ }), [i]), !i) return null;
1614
+ const w = (d) => {
1615
+ c && d.target === d.currentTarget && r();
1616
+ }, g = /* @__PURE__ */ t.jsxs("div", { className: "iw-fixed iw-inset-0 iw-z-50 iw-flex iw-items-center iw-justify-center", children: [
1617
+ /* @__PURE__ */ t.jsx(
1618
+ "div",
1471
1619
  {
1472
- value: i,
1473
- onChange: t,
1474
- onKeyDown: c,
1475
- placeholder: "Type your answer here...",
1476
- className: "iw-bg-gray-50 iw-w-full iw-resize-none iw-focus:outline-none iw-bg-transparent iw-min-h-[112px]",
1477
- rows: 5,
1478
- fullWidth: !0
1620
+ className: "iw-fixed iw-inset-0 iw-bg-black iw-bg-opacity-50 iw-transition-opacity",
1621
+ onClick: w
1479
1622
  }
1480
1623
  ),
1481
- /* @__PURE__ */ r.jsxs("div", { className: "iw-p-2 iw-flex iw-justify-between iw-items-center iw-bg-gray-50", children: [
1482
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: /* @__PURE__ */ r.jsx("kbd", { children: " Press Ctrl+Enter to submit" }) }),
1483
- /* @__PURE__ */ r.jsx(
1484
- $,
1624
+ /* @__PURE__ */ t.jsxs(
1625
+ "div",
1626
+ {
1627
+ className: `iw-relative iw-bg-white iw-rounded-lg iw-shadow-xl iw-max-w-md iw-w-full iw-mx-4 iw-max-h-[90vh] iw-overflow-hidden ${o}`,
1628
+ role: "dialog",
1629
+ "aria-modal": "true",
1630
+ "aria-labelledby": n ? "dialog-title" : void 0,
1631
+ children: [
1632
+ (n || 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: [
1633
+ n && /* @__PURE__ */ t.jsx(
1634
+ "h2",
1635
+ {
1636
+ id: "dialog-title",
1637
+ className: "iw-text-lg iw-font-semibold iw-text-gray-900",
1638
+ children: n
1639
+ }
1640
+ ),
1641
+ s && /* @__PURE__ */ t.jsx(
1642
+ "button",
1643
+ {
1644
+ onClick: r,
1645
+ className: "iw-p-1 iw-text-gray-400 iw-hover:text-gray-600 iw-transition-colors iw-rounded iw-hover:bg-gray-100",
1646
+ "aria-label": "Close dialog",
1647
+ children: /* @__PURE__ */ t.jsx(
1648
+ "svg",
1649
+ {
1650
+ className: "iw-w-5 iw-h-5",
1651
+ fill: "none",
1652
+ stroke: "currentColor",
1653
+ viewBox: "0 0 24 24",
1654
+ children: /* @__PURE__ */ t.jsx(
1655
+ "path",
1656
+ {
1657
+ strokeLinecap: "round",
1658
+ strokeLinejoin: "round",
1659
+ strokeWidth: 2,
1660
+ d: "M6 18L18 6M6 6l12 12"
1661
+ }
1662
+ )
1663
+ }
1664
+ )
1665
+ }
1666
+ )
1667
+ ] }),
1668
+ /* @__PURE__ */ t.jsx("div", { className: "iw-p-4 iw-overflow-y-auto", children: e })
1669
+ ]
1670
+ }
1671
+ )
1672
+ ] });
1673
+ return ke(g, document.body);
1674
+ }, at = ({
1675
+ open: i,
1676
+ onClose: r
1677
+ }) => /* @__PURE__ */ t.jsx(
1678
+ ge,
1679
+ {
1680
+ isOpen: i,
1681
+ onClose: r || (() => {
1682
+ }),
1683
+ title: "Interview Complete!",
1684
+ className: "",
1685
+ children: /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-text-center iw-py-2", children: [
1686
+ /* @__PURE__ */ t.jsx(
1687
+ "svg",
1688
+ {
1689
+ className: "iw-w-16 iw-h-16 iw-mx-auto iw-mb-4 iw-text-green-500",
1690
+ fill: "none",
1691
+ stroke: "currentColor",
1692
+ viewBox: "0 0 24 24",
1693
+ children: /* @__PURE__ */ t.jsx(
1694
+ "path",
1695
+ {
1696
+ strokeLinecap: "round",
1697
+ strokeLinejoin: "round",
1698
+ strokeWidth: 2,
1699
+ d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
1700
+ }
1701
+ )
1702
+ }
1703
+ ),
1704
+ /* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-600 iw-mb-6", children: "Thank you for your time. Your answers have been recorded and submitted for review." }),
1705
+ /* @__PURE__ */ t.jsx(
1706
+ W,
1485
1707
  {
1486
- onClick: e,
1487
- disabled: a,
1488
- size: "sm",
1489
- variant: "gradient",
1490
- children: "Submit Answer"
1708
+ className: "iw-mt-2 iw-px-6 iw-py-2 iw-bg-primary-500 iw-text-white iw-font-semibold iw-rounded-lg iw-shadow iw-transition hover:iw-bg-primary-600 focus:iw-outline-none",
1709
+ onClick: r,
1710
+ children: "Close"
1491
1711
  }
1492
1712
  )
1493
1713
  ] })
1494
- ] }) });
1495
- }, Ye = ({
1496
- question: i,
1497
- isLoading: t = !1
1714
+ }
1715
+ ), nt = ({
1716
+ size: i = "192px",
1717
+ className: r,
1718
+ colors: e,
1719
+ animationDuration: n = 20
1498
1720
  }) => {
1499
- const { baseColor: e } = F();
1500
- return t ? /* @__PURE__ */ r.jsxs(
1721
+ const c = { ...{
1722
+ bg: "oklch(95% 0.02 264.695)",
1723
+ c1: "oklch(75% 0.15 350)",
1724
+ // Pastel pink
1725
+ c2: "oklch(80% 0.12 200)",
1726
+ // Pastel blue
1727
+ c3: "oklch(78% 0.14 280)"
1728
+ // Pastel purple/lavender
1729
+ }, ...e }, a = parseInt(i.replace("px", ""), 10), o = a < 50 ? Math.max(a * 8e-3, 1) : Math.max(a * 0.015, 4), w = a < 50 ? Math.max(a * 4e-3, 1.2) : Math.max(a * 8e-3, 1.5), g = a < 50 ? Math.max(a * 4e-3, 0.05) : Math.max(a * 8e-3, 0.1), d = a < 50 ? Math.max(a * 4e-3, 0.5) : Math.max(a * 8e-3, 2), h = a < 30 ? "0%" : a < 50 ? "5%" : a < 100 ? "15%" : "25%", u = a < 30 ? 1.1 : a < 50 ? Math.max(w * 1.2, 1.3) : w;
1730
+ return /* @__PURE__ */ t.jsx(
1501
1731
  "div",
1502
1732
  {
1503
- className: "iw-rounded-xl iw-mb-4 iw-p-5",
1733
+ className: `siri-orb ${r}`,
1504
1734
  style: {
1505
- background: "linear-gradient(to bottom, #eef2ff, #ffffff)",
1506
- border: "1px solid #e0e7ff",
1507
- color: "#1f2937"
1735
+ width: i,
1736
+ height: i,
1737
+ "--bg": c.bg,
1738
+ "--c1": c.c1,
1739
+ "--c2": c.c2,
1740
+ "--c3": c.c3,
1741
+ "--animation-duration": `${n}s`,
1742
+ "--blur-amount": `${o}px`,
1743
+ "--contrast-amount": u,
1744
+ "--dot-size": `${g}px`,
1745
+ "--shadow-spread": `${d}px`,
1746
+ "--mask-radius": h
1508
1747
  },
1509
- children: [
1510
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-3 iw-mb-3", children: [
1511
- /* @__PURE__ */ r.jsx(
1512
- "div",
1513
- {
1514
- className: "iw-h-12 iw-w-12 iw-rounded-lg iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold iw-animate-pulse",
1515
- style: { backgroundColor: e },
1516
- children: "N"
1517
- }
1518
- ),
1519
- /* @__PURE__ */ r.jsxs("div", { children: [
1520
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-sm iw-font-semibold", children: "Novara" }),
1521
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: "Assistant" })
1522
- ] })
1523
- ] }),
1524
- /* @__PURE__ */ r.jsxs("div", { className: "iw-animate-pulse", children: [
1525
- /* @__PURE__ */ r.jsx("div", { className: "iw-h-4 iw-bg-gray-200 iw-rounded iw-w-3/4 iw-mb-2" }),
1526
- /* @__PURE__ */ r.jsx("div", { className: "iw-h-4 iw-bg-gray-200 iw-rounded iw-w-full" })
1527
- ] })
1528
- ]
1748
+ children: /* @__PURE__ */ t.jsx("style", { children: `
1749
+ @property --angle {
1750
+ syntax: "<angle>";
1751
+ inherits: false;
1752
+ initial-value: 0deg;
1753
+ }
1754
+
1755
+ .siri-orb {
1756
+ display: grid;
1757
+ grid-template-areas: "stack";
1758
+ overflow: hidden;
1759
+ border-radius: 50%;
1760
+ position: relative;
1761
+ transform: scale(1.1);
1762
+ }
1763
+
1764
+ .siri-orb::before,
1765
+ .siri-orb::after {
1766
+ content: "";
1767
+ display: block;
1768
+ grid-area: stack;
1769
+ width: 100%;
1770
+ height: 100%;
1771
+ border-radius: 50%;
1772
+ transform: translateZ(0);
1773
+ }
1774
+
1775
+ .siri-orb::before {
1776
+ background: conic-gradient(
1777
+ from calc(var(--angle) * 2) at 25% 70%,
1778
+ var(--c3),
1779
+ transparent 20% 80%,
1780
+ var(--c3)
1781
+ ),
1782
+ conic-gradient(
1783
+ from calc(var(--angle) * 2) at 45% 75%,
1784
+ var(--c2),
1785
+ transparent 30% 60%,
1786
+ var(--c2)
1787
+ ),
1788
+ conic-gradient(
1789
+ from calc(var(--angle) * -3) at 80% 20%,
1790
+ var(--c1),
1791
+ transparent 40% 60%,
1792
+ var(--c1)
1793
+ ),
1794
+ conic-gradient(
1795
+ from calc(var(--angle) * 2) at 15% 5%,
1796
+ var(--c2),
1797
+ transparent 10% 90%,
1798
+ var(--c2)
1799
+ ),
1800
+ conic-gradient(
1801
+ from calc(var(--angle) * 1) at 20% 80%,
1802
+ var(--c1),
1803
+ transparent 10% 90%,
1804
+ var(--c1)
1805
+ ),
1806
+ conic-gradient(
1807
+ from calc(var(--angle) * -2) at 85% 10%,
1808
+ var(--c3),
1809
+ transparent 20% 80%,
1810
+ var(--c3)
1811
+ );
1812
+ box-shadow: inset var(--bg) 0 0 var(--shadow-spread)
1813
+ calc(var(--shadow-spread) * 0.2);
1814
+ filter: blur(var(--blur-amount)) contrast(var(--contrast-amount));
1815
+ animation: rotate var(--animation-duration) linear infinite;
1816
+ }
1817
+
1818
+ .siri-orb::after {
1819
+ background-image: radial-gradient(
1820
+ circle at center,
1821
+ var(--bg) var(--dot-size),
1822
+ transparent var(--dot-size)
1823
+ );
1824
+ background-size: calc(var(--dot-size) * 2) calc(var(--dot-size) * 2);
1825
+ backdrop-filter: blur(calc(var(--blur-amount) * 2))
1826
+ contrast(calc(var(--contrast-amount) * 2));
1827
+ mix-blend-mode: overlay;
1828
+ }
1829
+
1830
+ /* Apply mask only when radius is greater than 0 */
1831
+ .siri-orb[style*="--mask-radius: 0%"]::after {
1832
+ mask-image: none;
1833
+ }
1834
+
1835
+ .siri-orb:not([style*="--mask-radius: 0%"])::after {
1836
+ mask-image: radial-gradient(
1837
+ black var(--mask-radius),
1838
+ transparent 75%
1839
+ );
1840
+ }
1841
+
1842
+ @keyframes rotate {
1843
+ to {
1844
+ --angle: 360deg;
1845
+ }
1846
+ }
1847
+
1848
+ @media (prefers-reduced-motion: reduce) {
1849
+ .siri-orb::before {
1850
+ animation: none;
1851
+ }
1852
+ }
1853
+ ` })
1854
+ }
1855
+ );
1856
+ };
1857
+ function ot({ ttsError: i }) {
1858
+ 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: [
1859
+ /* @__PURE__ */ t.jsx(nt, { size: "80px" }),
1860
+ i && /* @__PURE__ */ t.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
1861
+ "Audio playback failed: ",
1862
+ i.message
1863
+ ] }),
1864
+ /* @__PURE__ */ t.jsx("p", { className: "iw-text- iw-text-gray-700", children: "Your AI interviewer is speaking..." })
1865
+ ] });
1866
+ }
1867
+ const ct = ({ state: i, thinkingTime: r, 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: [
1868
+ /* @__PURE__ */ t.jsxs("div", { children: [
1869
+ /* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Get Ready to Answer" }),
1870
+ /* @__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." })
1871
+ ] }),
1872
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-justify-center iw-gap-2", children: [
1873
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-1", children: [
1874
+ /* @__PURE__ */ t.jsx(ae, { className: "iw-size-4 iw-text-orange-600" }),
1875
+ /* @__PURE__ */ t.jsx("p", { className: "iw-text-gray-700 iw-text-sm", children: "Time to think: " })
1876
+ ] }),
1877
+ /* @__PURE__ */ t.jsx(
1878
+ ne,
1879
+ {
1880
+ total: r,
1881
+ remaining: i.currentPhaseTimeRemaining,
1882
+ size: 50,
1883
+ strokeWidth: 4
1884
+ }
1885
+ )
1886
+ ] }),
1887
+ /* @__PURE__ */ t.jsx("div", { className: "iw-w-full iw-grid iw-grid-cols-1", children: /* @__PURE__ */ t.jsx(
1888
+ W,
1889
+ {
1890
+ onClick: () => {
1891
+ e();
1892
+ },
1893
+ children: "Start Answering"
1529
1894
  }
1530
- ) : i ? /* @__PURE__ */ r.jsxs(
1895
+ ) })
1896
+ ] }), lt = ({ sttError: i }) => /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-flex-col iw-items-center iw-justify-center iw-h-full", children: [
1897
+ /* @__PURE__ */ t.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 60 60", fill: "none", children: [
1898
+ /* @__PURE__ */ t.jsx(
1899
+ "rect",
1900
+ {
1901
+ width: 60,
1902
+ height: 60,
1903
+ rx: 30,
1904
+ fill: "url(#prefix__paint0_linear_1460_12482)"
1905
+ }
1906
+ ),
1907
+ /* @__PURE__ */ t.jsx(
1908
+ "path",
1909
+ {
1910
+ 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",
1911
+ fill: "#fff"
1912
+ }
1913
+ ),
1914
+ /* @__PURE__ */ t.jsx("defs", { children: /* @__PURE__ */ t.jsxs(
1915
+ "linearGradient",
1916
+ {
1917
+ id: "prefix__paint0_linear_1460_12482",
1918
+ x1: 30,
1919
+ y1: -6.563,
1920
+ x2: 77.813,
1921
+ y2: 54.375,
1922
+ gradientUnits: "userSpaceOnUse",
1923
+ children: [
1924
+ /* @__PURE__ */ t.jsx("stop", { offset: 0.211, stopColor: "#5C92FA" }),
1925
+ /* @__PURE__ */ t.jsx("stop", { offset: 1, stopColor: "#A75FFD" })
1926
+ ]
1927
+ }
1928
+ ) })
1929
+ ] }),
1930
+ /* @__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" }),
1931
+ /* @__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." }),
1932
+ i && /* @__PURE__ */ t.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
1933
+ "Transcription error: ",
1934
+ i.message,
1935
+ i.recoverable && " (attempting to continue)"
1936
+ ] })
1937
+ ] }), dt = (i) => /* @__PURE__ */ t.jsxs(
1938
+ "svg",
1939
+ {
1940
+ xmlns: "http://www.w3.org/2000/svg",
1941
+ width: "24",
1942
+ height: "24",
1943
+ viewBox: "0 0 24 24",
1944
+ fill: "none",
1945
+ stroke: "currentColor",
1946
+ strokeWidth: "2",
1947
+ strokeLinecap: "round",
1948
+ strokeLinejoin: "round",
1949
+ ...i,
1950
+ children: [
1951
+ /* @__PURE__ */ t.jsx("path", { d: "M12 8V4H8" }),
1952
+ /* @__PURE__ */ t.jsx("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
1953
+ /* @__PURE__ */ t.jsx("path", { d: "M2 14h2" }),
1954
+ /* @__PURE__ */ t.jsx("path", { d: "M20 14h2" }),
1955
+ /* @__PURE__ */ t.jsx("path", { d: "M15 13v2" }),
1956
+ /* @__PURE__ */ t.jsx("path", { d: "M9 13v2" })
1957
+ ]
1958
+ }
1959
+ ), wt = ({
1960
+ question: i,
1961
+ isLoading: r = !1
1962
+ }) => {
1963
+ const { baseColor: e } = Q();
1964
+ return /* @__PURE__ */ t.jsx(
1531
1965
  "div",
1532
1966
  {
1533
- className: "iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-border iw-border-indigo-100 iw-p-5",
1534
- style: Qe(e ?? "#8C75FB", 0.85),
1535
- children: [
1536
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-3 iw-mb-3", children: [
1537
- /* @__PURE__ */ r.jsx(
1538
- "div",
1967
+ className: "iw-rounded-xl iw-mb-4 message-animation iw-text-gray-800 iw-p-6 ",
1968
+ style: De(e, 0.85),
1969
+ children: /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-gap-8", children: [
1970
+ /* @__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: [
1971
+ /* @__PURE__ */ t.jsx("div", { className: "iw-mt-8", children: /* @__PURE__ */ t.jsx(
1972
+ dt,
1539
1973
  {
1540
- className: "iw-h-12 iw-w-12 iw-rounded-lg iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",
1541
- style: { backgroundColor: e },
1542
- children: "N"
1974
+ className: "iw-h-12 iw-w-12",
1975
+ style: { stroke: e }
1543
1976
  }
1544
- ),
1545
- /* @__PURE__ */ r.jsxs("div", { children: [
1546
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-sm iw-font-semibold", children: "Novara" }),
1547
- /* @__PURE__ */ r.jsx("div", { className: "iw-text-xs iw-text-gray-500", children: "Assistant" })
1548
- ] })
1977
+ ) }),
1978
+ /* @__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" }) })
1549
1979
  ] }),
1550
- /* @__PURE__ */ r.jsx("p", { className: "iw-text-[15px] iw-leading-6", children: i.question })
1551
- ]
1552
- }
1553
- ) : /* @__PURE__ */ r.jsx(
1554
- "div",
1555
- {
1556
- className: "iw-rounded-xl iw-mb-4 iw-bg-gray-50 iw-text-gray-500 iw-border iw-border-gray-200 iw-p-5 iw-text-center",
1557
- children: /* @__PURE__ */ r.jsx("p", { className: "iw-text-sm", children: "No question available" })
1980
+ r ? /* @__PURE__ */ t.jsxs("div", { className: "iw-animate-pulse iw-w-full iw-space-y-3 iw-mr-10", children: [
1981
+ /* @__PURE__ */ t.jsx("div", { className: "iw-h-5 iw-bg-gray-200 iw-rounded iw-w-full" }),
1982
+ /* @__PURE__ */ t.jsx("div", { className: "iw-h-5 iw-bg-gray-200 iw-rounded iw-w-3/4" })
1983
+ ] }) : /* @__PURE__ */ t.jsx("p", { className: "iw-text-lg iw-leading-8", children: i == null ? void 0 : i.question })
1984
+ ] })
1558
1985
  }
1559
1986
  );
1560
- }, Ke = ({
1987
+ }, ut = ({
1988
+ confirmExitInterview: i,
1989
+ isOpen: r,
1990
+ onClose: e
1991
+ }) => /* @__PURE__ */ t.jsx(ge, { isOpen: r, onClose: e, title: "Exit Interview", children: /* @__PURE__ */ t.jsxs("div", { className: "iw-space-y-4", children: [
1992
+ /* @__PURE__ */ t.jsx("p", { className: "iw-text-base iw-text-gray-700", children: "Are you sure you want to exit the interview? All progress will be lost and you will not be able to resume." }),
1993
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-justify-end iw-space-x-2", children: [
1994
+ /* @__PURE__ */ t.jsx(
1995
+ "button",
1996
+ {
1997
+ className: "iw-px-4 iw-py-2 iw-bg-gray-200 iw-rounded iw-text-gray-700 iw-font-medium",
1998
+ onClick: e,
1999
+ children: "Cancel"
2000
+ }
2001
+ ),
2002
+ /* @__PURE__ */ t.jsx(
2003
+ "button",
2004
+ {
2005
+ className: "iw-px-4 iw-py-2 iw-bg-red-600 iw-text-white iw-rounded iw-font-medium",
2006
+ onClick: i,
2007
+ children: "Confirm Exit"
2008
+ }
2009
+ )
2010
+ ] })
2011
+ ] }) }), ht = ({ title: i, onExit: r }) => {
2012
+ const { baseColor: e } = Q(), [n, s] = k(!1);
2013
+ return /* @__PURE__ */ t.jsxs("header", { className: "iw-w-full iw-text-gray-900", children: [
2014
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-mx-auto iw-flex iw-items-center iw-justify-between iw-px-4 iw-py-3", children: [
2015
+ /* @__PURE__ */ t.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
2016
+ /* @__PURE__ */ t.jsx(
2017
+ "div",
2018
+ {
2019
+ className: "iw-h-7 iw-w-7 iw-rounded-md iw-flex iw-items-center iw-justify-center iw-text-white iw-font-semibold",
2020
+ style: { backgroundColor: e },
2021
+ children: "N"
2022
+ }
2023
+ ),
2024
+ /* @__PURE__ */ t.jsx("p", { className: "iw-text-sm iw-font-medium", children: "Novara" })
2025
+ ] }),
2026
+ /* @__PURE__ */ t.jsx("h1", { className: "iw-text-base iw-font-bold", children: i }),
2027
+ /* @__PURE__ */ t.jsx(
2028
+ "button",
2029
+ {
2030
+ className: "iw-text-sm iw-text-gray-500 hover:iw-text-gray-700",
2031
+ onClick: () => s(!0),
2032
+ children: "Exit Interview"
2033
+ }
2034
+ )
2035
+ ] }),
2036
+ /* @__PURE__ */ t.jsx("div", { className: "iw-h-px iw-bg-gray-200" }),
2037
+ /* @__PURE__ */ t.jsx(
2038
+ ut,
2039
+ {
2040
+ isOpen: n,
2041
+ confirmExitInterview: () => {
2042
+ r(), s(!1);
2043
+ },
2044
+ onClose: () => s(!1)
2045
+ }
2046
+ )
2047
+ ] });
2048
+ }, mt = ({
1561
2049
  interviewId: i,
1562
- onComplete: t,
2050
+ onComplete: r,
1563
2051
  className: e = ""
1564
2052
  }) => {
1565
- const a = Oe(), { baseColor: s } = F(), { baseUrl: c } = Te(), { timers: n, stt: o, tts: m } = Ie(), [g, d] = y(null), [u, h] = y(""), [x, k] = y(!1), j = D(""), N = D(null), w = {
1566
- thinkingTime: (n == null ? void 0 : n.thinkingDuration) || 30,
1567
- answeringTime: (n == null ? void 0 : n.answeringDuration) || 120,
1568
- editingTime: (n == null ? void 0 : n.editingDuration) || 30,
1569
- totalTime: (n == null ? void 0 : n.totalInterviewDuration) || 600,
1570
- minimumBufferTime: (n == null ? void 0 : n.minimumTimeForNextQuestion) || 120
1571
- }, {
1572
- thinkingTime: p,
1573
- answeringTime: T,
1574
- editingTime: S,
1575
- totalTime: ie,
1576
- minimumBufferTime: re
1577
- } = w;
1578
- A(() => {
1579
- j.current = u;
1580
- }, [u]);
1581
- const _ = D(!1), {
1582
- speak: te,
1583
- isPlaying: se,
1584
- error: W
1585
- } = Ue({
2053
+ const n = We(), { baseUrl: s } = Se(), { timers: c, stt: a, tts: o } = Ce(), [w, g] = k(null), [d, h] = k(""), u = E(""), m = E(null), v = {
2054
+ thinkingTime: (c == null ? void 0 : c.thinkingDuration) || 30,
2055
+ answeringTime: (c == null ? void 0 : c.answeringDuration) || 120,
2056
+ editingTime: (c == null ? void 0 : c.editingDuration) || 30
2057
+ }, { thinkingTime: N, answeringTime: j, editingTime: l } = v;
2058
+ $(() => {
2059
+ u.current = d;
2060
+ }, [d]);
2061
+ const f = E(!1), { speak: M, error: b } = Je({
1586
2062
  config: {
1587
- baseUrl: c,
1588
- provider: m == null ? void 0 : m.provider
2063
+ baseUrl: s,
2064
+ provider: o == null ? void 0 : o.provider
1589
2065
  },
1590
2066
  onEnd: () => {
1591
- console.log("TTS playback completed"), _.current = !1, E();
2067
+ f.current = !1, T();
1592
2068
  },
1593
- onError: (f) => {
1594
- console.error("TTS Error:", f), _.current || (_.current = !0, E());
2069
+ onError: () => {
2070
+ f.current || (f.current = !0, T());
1595
2071
  }
1596
- }), G = D(!1), L = D(!1), {
1597
- startRecording: z,
1598
- stopRecording: Y,
1599
- transcribe: K,
1600
- isRecording: ne,
1601
- isTranscribing: ae,
1602
- error: M
1603
- } = _e({
2072
+ }), P = E(!1), x = E(!1), {
2073
+ startRecording: R,
2074
+ stopRecording: S,
2075
+ transcribe: C,
2076
+ error: G
2077
+ } = Ye({
1604
2078
  config: {
1605
- baseUrl: c,
1606
- provider: o == null ? void 0 : o.provider,
1607
- model: o == null ? void 0 : o.model,
1608
- language: o == null ? void 0 : o.language
2079
+ baseUrl: s,
2080
+ provider: a == null ? void 0 : a.provider,
2081
+ model: a == null ? void 0 : a.model,
2082
+ language: a == null ? void 0 : a.language
1609
2083
  },
1610
2084
  onStart: () => {
1611
- console.log("STT recording started"), G.current = !1, L.current = !1;
2085
+ P.current = !1, x.current = !1;
1612
2086
  },
1613
2087
  onStop: () => {
1614
- console.log("STT recording stopped");
1615
2088
  },
1616
- onTranscriptionComplete: (f) => {
1617
- console.log("Transcription completed:", f), h(f.transcript), L.current || (L.current = !0, E());
2089
+ onTranscriptionComplete: (p) => {
2090
+ h(p.transcript), x.current || (x.current = !0, T());
1618
2091
  },
1619
- onError: (f) => {
1620
- console.error("STT Error:", f), G.current || (G.current = !0, E());
2092
+ onError: (p) => {
2093
+ console.error("STT Error:", p), P.current || (P.current = !0, T());
1621
2094
  }
1622
- }), { state: R, startQuestion: Q, nextPhase: E } = De({
2095
+ }), { state: _, startQuestion: F, nextPhase: T, completeInterview: q } = Ge({
1623
2096
  config: {
1624
- thinkingDuration: p,
1625
- answeringDuration: T,
1626
- editingDuration: S,
1627
- totalInterviewDuration: ie,
1628
- minimumTimeForNextQuestion: re
2097
+ thinkingDuration: N,
2098
+ answeringDuration: j,
2099
+ editingDuration: l
1629
2100
  },
1630
2101
  callbacks: {
1631
- onPhaseChange: (f) => {
1632
- switch (console.log("Phase changed:", f), f) {
1633
- case l.FETCHING_QUESTION:
1634
- oe();
2102
+ onPhaseChange: (p) => {
2103
+ switch (p) {
2104
+ case I.FETCHING_QUESTION:
2105
+ H();
1635
2106
  break;
1636
- case l.READING_QUESTION:
1637
- le();
2107
+ case I.READING_QUESTION:
2108
+ B();
1638
2109
  break;
1639
- case l.ANSWERING:
1640
- de();
2110
+ case I.ANSWERING:
2111
+ ee();
1641
2112
  break;
1642
- case l.TRANSCRIBING:
1643
- we();
2113
+ case I.TRANSCRIBING:
2114
+ te();
1644
2115
  break;
1645
- case l.SUBMITTING:
1646
- ce();
2116
+ case I.SUBMITTING:
2117
+ K();
1647
2118
  break;
1648
2119
  }
1649
2120
  },
1650
2121
  onInterviewEnd: () => {
1651
- t == null || t();
2122
+ r == null || r();
1652
2123
  }
1653
2124
  }
1654
- }), { execute: oe } = Pe(
2125
+ });
2126
+ $(() => {
2127
+ F();
2128
+ }, []);
2129
+ const { execute: H, loading: Y } = qe(
1655
2130
  async () => {
1656
- var P, J;
1657
- const f = await a.generateQuestion({
2131
+ var L, V;
2132
+ const p = await n.generateQuestion({
1658
2133
  interviewId: i,
1659
- isInterviewDone: R.totalTimeRemaining < 120,
1660
- question: ((P = N.current) == null ? void 0 : P.question) || "",
1661
- qnaId: ((J = N.current) == null ? void 0 : J.qna_id) || "",
1662
- answer: j.current
2134
+ question: ((L = m.current) == null ? void 0 : L.question) || "",
2135
+ qnaId: ((V = m.current) == null ? void 0 : V.qna_id) || "",
2136
+ answer: u.current
1663
2137
  });
1664
- return N.current = f.data, f;
2138
+ return m.current = p.data, p;
1665
2139
  },
1666
2140
  {
1667
- onSuccess: async (f) => {
1668
- console.log("Questions fetched successfully", f), f && f.data && (h(""), d(f.data), E());
2141
+ onSuccess: async (p) => {
2142
+ p && p.data && (h(""), g(p.data), T());
1669
2143
  },
1670
- onError: (f) => {
1671
- console.error("Failed to fetch questions:", f);
2144
+ onError: (p) => {
2145
+ console.error("Failed to fetch questions:", p);
1672
2146
  }
1673
2147
  }
1674
- ), ce = v(async () => {
1675
- console.log("Answer submitted successfully"), await Be(1500), Q();
1676
- }, [Q]), le = v(async () => {
1677
- var f;
1678
- if ((f = N.current) != null && f.question)
2148
+ ), K = A(async () => {
2149
+ F();
2150
+ }, [F]), B = A(async () => {
2151
+ var p;
2152
+ if ((p = m.current) != null && p.question)
1679
2153
  try {
1680
- _.current = !1, console.log("Starting TTS for question"), await te(N.current.question);
1681
- } catch (P) {
1682
- console.error("Failed to speak question:", P);
2154
+ f.current = !1, await M(m.current.question), m.current.is_interview_done && (await Pe(2e3), q());
2155
+ } catch (L) {
2156
+ console.error("Failed to speak question:", L);
1683
2157
  }
1684
2158
  else
1685
- E();
1686
- }, []), de = v(async () => {
1687
- console.log("Starting recording...");
2159
+ T();
2160
+ }, [M, T, q]), ee = A(async () => {
1688
2161
  try {
1689
- const f = T;
1690
- console.log("🚀 ~ maxDuration:", f), await z(f);
1691
- } catch (f) {
1692
- console.error("Failed to start recording:", f), E();
2162
+ await R(j);
2163
+ } catch (p) {
2164
+ console.error("Failed to start recording:", p), T();
1693
2165
  }
1694
- }, [z, E]), we = v(async () => {
1695
- console.log("Stopping recording and processing STT...");
2166
+ }, [R, T]), te = A(async () => {
1696
2167
  try {
1697
- const f = await Y();
1698
- console.log("Recording stopped, audio blob size:", f.size), await K(f);
1699
- } catch (f) {
1700
- console.error("STT processing failed:", f), !G.current && !L.current && (G.current = !0, E());
2168
+ const p = await S();
2169
+ await C(p);
2170
+ } catch (p) {
2171
+ console.error("STT processing failed:", p), !P.current && !x.current && (P.current = !0, T());
1701
2172
  }
1702
- }, [Y, K, E]), ue = () => {
1703
- const { phase: f } = R;
1704
- switch (f) {
1705
- case l.IDLE:
1706
- return /* @__PURE__ */ r.jsx("div", { className: "iw-text-center iw-py-8", children: /* @__PURE__ */ r.jsx("p", { className: "iw-text-gray-600", children: "Ready to start..." }) });
1707
- case l.FETCHING_QUESTION:
1708
- return /* @__PURE__ */ r.jsx("div", { className: "iw-space-y-4" });
1709
- case l.READING_QUESTION:
1710
- return /* @__PURE__ */ r.jsx("div", { className: "iw-space-y-4", children: /* @__PURE__ */ r.jsxs("div", { className: "iw-p-4 iw-bg-indigo-50 iw-border iw-border-indigo-200 iw-rounded-lg", children: [
1711
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
1712
- /* @__PURE__ */ r.jsx("div", { className: "iw-w-3 iw-h-3 iw-bg-indigo-500 iw-rounded-full iw-animate-pulse" }),
1713
- /* @__PURE__ */ r.jsx("span", { className: "iw-text-sm iw-font-medium iw-text-indigo-700", children: se ? "Playing question audio..." : "Reading the question..." })
1714
- ] }),
1715
- W && /* @__PURE__ */ r.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
1716
- "Audio playback failed: ",
1717
- W.message
1718
- ] })
1719
- ] }) });
1720
- case l.THINKING:
1721
- case l.ANSWERING:
1722
- return /* @__PURE__ */ r.jsx("div", { className: "iw-space-y-4", children: f === l.ANSWERING && /* @__PURE__ */ r.jsxs("div", { className: "iw-p-4 iw-bg-red-50 iw-border iw-border-red-200 iw-rounded-lg", children: [
1723
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
1724
- /* @__PURE__ */ r.jsx("div", { className: "iw-w-3 iw-h-3 iw-bg-red-500 iw-rounded-full iw-animate-pulse" }),
1725
- /* @__PURE__ */ r.jsx("span", { className: "iw-text-sm iw-font-medium iw-text-red-700", children: ne ? "Recording in progress..." : "Preparing to record..." })
1726
- ] }),
1727
- M && /* @__PURE__ */ r.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
1728
- "Recording error: ",
1729
- M.message
1730
- ] })
1731
- ] }) });
1732
- case l.TRANSCRIBING:
1733
- return /* @__PURE__ */ r.jsx("div", { className: "iw-space-y-4", children: /* @__PURE__ */ r.jsxs("div", { className: "iw-p-4 iw-bg-purple-50 iw-border iw-border-purple-200 iw-rounded-lg", children: [
1734
- /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
1735
- /* @__PURE__ */ r.jsx("div", { className: "iw-animate-spin iw-h-4 iw-w-4 iw-border-2 iw-border-purple-500 iw-border-t-transparent iw-rounded-full" }),
1736
- /* @__PURE__ */ r.jsx("span", { className: "iw-text-sm iw-font-medium iw-text-purple-700", children: ae ? "Transcribing your speech..." : "Processing audio..." })
1737
- ] }),
1738
- M && /* @__PURE__ */ r.jsxs("div", { className: "iw-mt-2 iw-text-xs iw-text-red-600", children: [
1739
- "Transcription error: ",
1740
- M.message,
1741
- M.recoverable && " (attempting to continue)"
1742
- ] })
1743
- ] }) });
1744
- case l.EDITING:
1745
- return /* @__PURE__ */ r.jsx("div", { className: "iw-space-y-4", children: /* @__PURE__ */ r.jsx(
1746
- ze,
2173
+ }, [S, C, T]), U = () => {
2174
+ const { phase: p } = _;
2175
+ switch (p) {
2176
+ case I.IDLE:
2177
+ return /* @__PURE__ */ t.jsxs("div", { className: "iw-text-center iw-flex iw-flex-col iw-items-center iw-justify-center iw-gap-2 iw-h-full", children: [
2178
+ /* @__PURE__ */ t.jsx("h3", { className: "iw-text-lg iw-font-semibold iw-text-gray-900 iw-mb-1", children: "Ready to start the Interview?" }),
2179
+ /* @__PURE__ */ t.jsx("p", { className: "iw-max-w-xl iw-text-gray-500 iw-text-xs iw-leading-[21px]", children: `You will be asked a series of behavioral and technical questions. For each one you'll get a short thinking period, then a timed recording window. We'll transcribe your response so you can review and edit it before submitting. Click "Start Interview" when you're ready.` }),
2180
+ /* @__PURE__ */ t.jsx(W, { onClick: F, className: "iw-mt-2 iw-w-40", children: "Start Interview" })
2181
+ ] });
2182
+ case I.FETCHING_QUESTION:
2183
+ return /* @__PURE__ */ t.jsx(st, {});
2184
+ case I.READING_QUESTION:
2185
+ return /* @__PURE__ */ t.jsx(ot, { ttsError: b });
2186
+ case I.THINKING:
2187
+ return /* @__PURE__ */ t.jsx(
2188
+ ct,
1747
2189
  {
1748
- value: u,
1749
- onChange: (P) => h(P.target.value),
1750
- onSubmit: () => E(),
1751
- isSubmitDisabled: !u.trim(),
1752
- remainingTimeText: `${R.currentPhaseTimeRemaining}s remaining`
2190
+ state: _,
2191
+ thinkingTime: N,
2192
+ nextPhase: T
1753
2193
  }
1754
- ) });
1755
- case l.SUBMITTING:
1756
- return /* @__PURE__ */ r.jsx("div", { className: "iw-space-y-4", children: /* @__PURE__ */ r.jsx("div", { className: "iw-p-4 iw-bg-green-50 iw-border iw-border-green-200 iw-rounded-lg", children: /* @__PURE__ */ r.jsxs("div", { className: "iw-flex iw-items-center iw-space-x-2", children: [
1757
- /* @__PURE__ */ r.jsx("div", { className: "iw-animate-spin iw-h-4 iw-w-4 iw-border-2 iw-border-green-500 iw-border-t-transparent iw-rounded-full" }),
1758
- /* @__PURE__ */ r.jsx("span", { className: "iw-text-sm iw-font-medium iw-text-green-700", children: "Submitting your answer..." })
1759
- ] }) }) });
1760
- case l.COMPLETED:
1761
- return /* @__PURE__ */ r.jsxs("div", { className: "iw-text-center iw-py-8", children: [
1762
- /* @__PURE__ */ r.jsx("div", { className: "iw-mb-4", children: /* @__PURE__ */ r.jsx(
1763
- "svg",
1764
- {
1765
- className: "iw-w-16 iw-h-16 iw-mx-auto iw-text-green-500",
1766
- fill: "none",
1767
- stroke: "currentColor",
1768
- viewBox: "0 0 24 24",
1769
- children: /* @__PURE__ */ r.jsx(
1770
- "path",
1771
- {
1772
- strokeLinecap: "round",
1773
- strokeLinejoin: "round",
1774
- strokeWidth: 2,
1775
- d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
1776
- }
1777
- )
1778
- }
1779
- ) }),
1780
- /* @__PURE__ */ r.jsx("h3", { className: "iw-text-xl iw-font-bold iw-text-gray-900 iw-mb-2", children: "Interview Complete!" }),
1781
- /* @__PURE__ */ r.jsx("p", { className: "iw-text-gray-600", children: "Thank you for your time. Your answers have been recorded." })
1782
- ] });
1783
- default:
1784
- return null;
1785
- }
1786
- };
1787
- return /* @__PURE__ */ r.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ r.jsxs(
1788
- "div",
1789
- {
1790
- className: ` iw-max-w-3xl iw-mx-auto iw-space-y-4 iw-py-8 ${e}`,
1791
- children: [
1792
- R.phase !== l.IDLE && R.phase !== l.COMPLETED && /* @__PURE__ */ r.jsx(
1793
- Ye,
2194
+ );
2195
+ case I.ANSWERING:
2196
+ return /* @__PURE__ */ t.jsx(
2197
+ it,
1794
2198
  {
1795
- question: g,
1796
- isLoading: R.phase === l.FETCHING_QUESTION
2199
+ state: _,
2200
+ answeringTime: j,
2201
+ nextPhase: T,
2202
+ sttError: G
1797
2203
  }
1798
- ),
1799
- /* @__PURE__ */ r.jsx("div", { className: "iw-bg-white iw-rounded-lg iw-shadow-md iw-p-6", children: ue() }),
1800
- /* @__PURE__ */ r.jsx(
1801
- He,
2204
+ );
2205
+ case I.TRANSCRIBING:
2206
+ return /* @__PURE__ */ t.jsx(lt, { sttError: G });
2207
+ case I.EDITING:
2208
+ case I.SUBMITTING:
2209
+ return /* @__PURE__ */ t.jsx("div", { className: "iw-space-y-4 iw-h-full", children: /* @__PURE__ */ t.jsx(
2210
+ et,
1802
2211
  {
1803
- state: R,
1804
- defaultTimers: {
1805
- thinking: p,
1806
- answering: T,
1807
- editing: S
1808
- }
2212
+ value: d,
2213
+ onChange: (L) => h(L.target.value),
2214
+ onSubmit: () => T(),
2215
+ isSubmitDisabled: !d.trim() || Y,
2216
+ state: _,
2217
+ editingTime: l
1809
2218
  }
1810
- ),
1811
- x && (R.phase === l.THINKING || R.phase === l.ANSWERING || R.phase === l.EDITING) && /* @__PURE__ */ r.jsx($, { onClick: E, children: "Next Phase" }),
1812
- !x && /* @__PURE__ */ r.jsx("div", { className: "iw-text-center iw-py-12 w-full", children: /* @__PURE__ */ r.jsx(
1813
- $,
2219
+ ) });
2220
+ case I.COMPLETED:
2221
+ return /* @__PURE__ */ t.jsx("div", { className: "iw-fixed iw-inset-0 iw-bg-white", children: /* @__PURE__ */ t.jsx(
2222
+ at,
1814
2223
  {
1815
- className: "w-full",
1816
- style: { backgroundColor: s },
1817
- onClick: () => {
1818
- Q(), k(!0);
1819
- },
1820
- children: "Start Interview"
2224
+ open: !0,
2225
+ onClose: r || (() => {
2226
+ })
1821
2227
  }
1822
- ) })
1823
- ]
2228
+ ) });
2229
+ default:
2230
+ return null;
1824
2231
  }
1825
- ) });
1826
- }, Je = ({
1827
- interviewId: i,
1828
- title: t = "Interview",
1829
- onInterviewEnd: e,
1830
- className: a = ""
1831
- }) => {
1832
- const [s, c] = y(!1), [n, o] = y(!0), m = D(null);
1833
- if (!s)
1834
- return /* @__PURE__ */ r.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ r.jsx(
1835
- Se,
2232
+ };
2233
+ return /* @__PURE__ */ t.jsxs("div", { className: "interview-widget-container", children: [
2234
+ /* @__PURE__ */ t.jsx(
2235
+ ht,
1836
2236
  {
1837
- isOpen: n,
1838
- onStart: () => {
1839
- console.log("Permissions granted, starting interview"), c(!0), o(!1);
1840
- }
2237
+ title: "Interview for Python Developer",
2238
+ onExit: q
1841
2239
  }
1842
- ) });
1843
- const g = () => {
1844
- e == null || e();
1845
- };
1846
- return /* @__PURE__ */ r.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ r.jsx(
2240
+ ),
2241
+ /* @__PURE__ */ t.jsxs(
2242
+ "div",
2243
+ {
2244
+ className: `iw-p-4 iw-space-y-4 iw-pb-6 ${e} iw-min-h-[calc(100vh_-_3.8rem)] iw-flex iw-flex-col iw-justify-between`,
2245
+ children: [
2246
+ /* @__PURE__ */ t.jsx("div", { className: "iw-flex iw-items-start iw-justify-between iw-gap-3", children: /* @__PURE__ */ t.jsx("div", { className: "iw-flex-1", children: /* @__PURE__ */ t.jsx(
2247
+ wt,
2248
+ {
2249
+ question: w,
2250
+ isLoading: _.phase === I.FETCHING_QUESTION || _.phase === I.IDLE
2251
+ }
2252
+ ) }) }),
2253
+ /* @__PURE__ */ t.jsxs("div", { className: "iw iw-bg-[#F6F6F6] iw-grid iw-grid-cols-2 iw-rounded-xl iw-p-4", children: [
2254
+ /* @__PURE__ */ t.jsx("div", { className: "iw-min-h-[400px] iw-max-h-[600px]", children: /* @__PURE__ */ t.jsx(Xe, {}) }),
2255
+ /* @__PURE__ */ t.jsx("div", { className: "iw-bg-white iw-rounded-lg iw-shadow iw-p-6", children: U() })
2256
+ ] })
2257
+ ]
2258
+ }
2259
+ )
2260
+ ] });
2261
+ }, gt = ({
2262
+ interviewId: i,
2263
+ onInterviewEnd: r,
2264
+ className: e = ""
2265
+ }) => {
2266
+ const [n, s] = oe.useState(!1), [c, a] = oe.useState(!0), o = E(null);
2267
+ return n ? /* @__PURE__ */ t.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ t.jsx(
1847
2268
  "div",
1848
2269
  {
1849
- ref: m,
1850
- className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${a}`,
1851
- children: /* @__PURE__ */ r.jsxs("div", { className: " iw-h-full iw-flex iw-flex-col", children: [
1852
- /* @__PURE__ */ r.jsx(je, { title: t, onExit: g }),
1853
- /* @__PURE__ */ r.jsx(
1854
- Ke,
1855
- {
1856
- interviewId: i,
1857
- className: a,
1858
- onComplete: e || (() => {
1859
- })
1860
- }
1861
- )
1862
- ] })
2270
+ ref: o,
2271
+ className: `iw-flex iw-flex-col iw-rounded-xl iw-shadow-lg iw-overflow-hidden iw-h-[calc(100vh-1rem)] ${e}`,
2272
+ children: /* @__PURE__ */ t.jsx("div", { className: " iw-h-full iw-flex iw-flex-col", children: /* @__PURE__ */ t.jsx(
2273
+ mt,
2274
+ {
2275
+ interviewId: i,
2276
+ className: e,
2277
+ onComplete: r || (() => {
2278
+ })
2279
+ }
2280
+ ) })
2281
+ }
2282
+ ) }) : /* @__PURE__ */ t.jsx("div", { className: "interview-widget-container", children: /* @__PURE__ */ t.jsx(
2283
+ Le,
2284
+ {
2285
+ isOpen: c,
2286
+ onStart: () => {
2287
+ console.log("Permissions granted, starting interview"), s(!0), a(!1);
2288
+ }
1863
2289
  }
1864
2290
  ) });
1865
2291
  };
1866
2292
  typeof window < "u" && (window.InterviewWidget = {
1867
- InterviewWidget: Je,
1868
- InterviewWidgetProvider: Ne
2293
+ InterviewWidget: gt,
2294
+ InterviewWidgetProvider: Re
1869
2295
  });
1870
2296
  export {
1871
- Je as InterviewWidget,
1872
- Ne as InterviewWidgetProvider,
1873
- Je as default
2297
+ gt as InterviewWidget,
2298
+ Re as InterviewWidgetProvider,
2299
+ gt as default
1874
2300
  };