interview-widget 0.1.4 → 0.1.6

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