1import{p as L,a7 as E,q as F,j as e,L as De,a as y,r,bo as Ve,u as Ie,E as Oe,a3 as Qe,B as M,b as N,be as te,aZ as Ge,t as h}from"./index-DNidg_Qc.js";import{t as Ye,P as Re,C as Je}from"./tts.functions-qe4uOKtD.js";import{T as We}from"./tool-shell-Ca_pGYsK.js";import{S as Ke}from"./shield-check-DVO32LZ7.js";import{P as $e}from"./PlanGate-Dn5rCudQ.js";import{V as He}from"./PremiumToolPreviews-Cg7USIaG.js";import{I as Ce}from"./input-70YvsUaZ.js";import{L as V}from"./label-Bhudjdxi.js";import{M as Ze,a as Xe}from"./MicroTip-BclhUOIG.js";import{S as es}from"./SavedJobPicker-Cxs_iqO-.js";import{L as ss}from"./LinkedApplicationBanner-XULYa-Rs.js";import{V as ts}from"./video-DWkt9FxH.js";import"./calendar-range-DtWa0rnV.js";import"./dollar-sign-DLC6ZiSK.js";import"./camera-CYuBMNZh.js";import"./mic-UwRtLMQn.js";import"./message-square-tEJuq6-U.js";import"./linkedin-DeuNArME.js";import"./mail-DIM7-Uur.js";import"./file-text-BlHcyHb-.js";import"./target-BIU4lc4B.js";import"./ToolAllowanceChip-DpV-q-mI.js";import"./usage.functions-EBSqWXJF.js";import"./DemoVideo-CwAl5Odk.js";import"./dialog-B1BXKzKU.js";import"./index-D324aKeF.js";import"./index-Bk7P141l.js";import"./tool-demos-DgraiMJb.js";import"./check-DWkmcDeA.js";import"./useSubscription-C5ij1Ie9.js";import"./stripe-BL9TlFig.js";import"./useIsAdmin-_vVIyJqR.js";import"./lock-DY_q9bUw.js";import"./circle-check-big-DjEcvWDG.js";import"./circle-alert-Bw878CKd.js";import"./lightbulb-5U240Hvw.js";import"./sparkles-BLWsg7Fk.js";import"./tracked-applications.functions-D9ru-dy2.js";import"./folder-open-CvvqG1yO.js";import"./briefcase-Bth-ssxz.js";import"./search-DY8HD4NR.js";const rs=L({method:"POST"}).middleware([E]).handler(F("1d217e99bac7354da4b649351e80c62155ec5dd786f6887755a8bf51d05752bf")),as=L({method:"POST"}).middleware([E]).handler(F("3a1e2d1cd8fd1497e4602ae37d55805d3db7a6df0272c42fe6f13b12820f8bf7")),ns=L({method:"POST"}).middleware([E]).handler(F("a36e240fdcf08ff69a47cb847c53731f15ba2ac6eabb4b33f3cc441091877560")),is="#e9eef4",os=L({method:"POST"}).middleware([E]).handler(F("cc46aa214e47c1f3318211422e9ea252a489a2e05d3441b0a0da1f650c052d8c")),cs=L({method:"POST"}).middleware([E]).handler(F("708f4bd3a55c5d0c5c9434060bc59df9aea7b41d0f341499e09dc05d259248b6"));function ds(){return e.jsxs("div",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 px-3 py-2 flex items-center gap-2 text-xs",children:[e.jsx(Ke,{className:"size-3.5 shrink-0"}),e.jsxs("span",{className:"leading-snug",children:[e.jsx("span",{className:"font-semibold",children:"Practice tool."})," We will never assist during a live interview."," ",e.jsx(De,{to:"/ethical-ai",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-emerald-900 dark:hover:text-emerald-100",children:"Read our ethics pledge"})]})]})}const ls=c=>new Promise((n,S)=>{const f=new FileReader;f.onloadend=()=>n(String(f.result).split(",")[1]??""),f.onerror=S,f.readAsDataURL(c)}),ms=()=>{if(!(typeof MediaRecorder>"u"))return["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"].find(c=>MediaRecorder.isTypeSupported(c))},us=()=>{if(!(typeof MediaRecorder>"u"))return["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/mpeg"].find(c=>MediaRecorder.isTypeSupported(c))};function et(){const c=y(rs),n=y(as),S=y(ns),f=y(Ye),re=y(os),Te=y(cs),[x,ae]=r.useState(""),[O,ne]=r.useState(""),[k,_]=r.useState(""),{applicationId:ie}=Ve.useSearch(),oe=Ie(),[ce,de]=r.useState(!1),[p,le]=r.useState([]),[me,Q]=r.useState([]),[d,G]=r.useState(0),[R,Y]=r.useState([]),[B,ue]=r.useState(!1),[U,fe]=r.useState(!1),[J,pe]=r.useState(!1),[W,C]=r.useState(!1),[K,$]=r.useState(""),[Pe,he]=r.useState(!1),v=r.useRef(null),xe=r.useRef(null),H=r.useRef(null),ve=r.useRef(null),Z=r.useRef([]),j=r.useRef(null),X=r.useRef([]),ge=r.useRef(0),A=r.useRef([]),T=r.useRef(new Set),je=r.useCallback(()=>{A.current.forEach(s=>window.clearTimeout(s)),A.current=[]},[]),z=r.useCallback(()=>{try{H.current?.stop()}catch{}j.current?.getTracks().forEach(s=>s.stop()),j.current=null,v.current&&(v.current.srcObject=null),je()},[je]);r.useEffect(()=>()=>z(),[z]);const w=(s,t)=>{Q(a=>a.map((o,i)=>i===s?{...o,...t}:o))},qe=s=>["completed","complete","success","succeeded","ready"].includes(s.toLowerCase()),Me=s=>["failed","error","errored"].includes(s.toLowerCase()),we=(s,t,a=0)=>{const o=window.setTimeout(async()=>{A.current=A.current.filter(i=>i!==o);try{const i=await Te({data:{videoId:t}});if(qe(i.status)&&i.videoUrl){w(s,{status:"ready",videoUrl:i.videoUrl,error:null}),console.info(`[video-mock] avatar ${s+1} ready after ${a+1} checks`);return}if(Me(i.status)||i.error){w(s,{status:"failed",error:String(i.error||"Avatar rendering failed")});return}}catch(i){if(a>=5){w(s,{status:"failed",error:i instanceof Error?i.message:"Avatar status check failed"});return}}if(a>=90){w(s,{status:"failed",error:"Avatar rendering timed out"});return}we(s,t,a+1)},a===0?1e3:5e3);A.current.push(o)},ee=r.useCallback(async(s,t)=>{if(s<0||s>=t.length||T.current.has(s))return;T.current.add(s);const a=t[s];try{const o=Date.now(),i=await re({data:{text:a.text}});w(s,{videoId:i.videoId,status:"pending",error:null,startedAt:o}),we(s,i.videoId)}catch(o){console.error("HeyGen start failed",o),T.current.delete(s),w(s,{status:"failed",error:o instanceof Error?o.message:"Avatar generation failed"})}},[re]),Le=async()=>
1{if(!x.trim()){h.error("Add a role first");return}de(!0);try{const s=await c({data:{role:x,company:O,jobDescription:k}});le(s.questions),Q(s.questions.map(()=>({videoId:"",status:"pending",videoUrl:null,error:null}))),G(0),Y([]),$(""),C(!1),T.current=new Set,ee(0,s.questions),navigator.mediaDevices.getUserMedia({video:{width:{ideal:1280},height:{ideal:720},facingMode:"user"},audio:!0}).then(async t=>{j.current=t,v.current&&(v.current.srcObject=t,v.current.muted=!0,await v.current.play().catch(()=>{}))}).catch(t=>{h.error(t instanceof Error?t.message:"Camera or microphone permission was blocked")})}catch(s){h.error(s instanceof Error?s.message:"Failed to start")}finally{de(!1)}},Ee=async()=>{const s=me[d],t=xe.current;if(!(!s||!t||!s.videoUrl))try{pe(!0),t.currentTime=0,await t.play(),await new Promise(a=>{const o=()=>{t.onended=null,t.onerror=null,a()};t.onended=o,t.onerror=o}),C(!0)}catch(a){h.error(a instanceof Error?a.message:"Avatar playback failed"),C(!0)}finally{pe(!1)}},Fe=()=>{if(!j.current){h.error("Camera not ready");return}const s=ms();X.current=[],Z.current=[];const t=new MediaRecorder(j.current,s?{mimeType:s}:void 0);t.ondataavailable=l=>{l.data.size>0&&X.current.push(l.data)},H.current=t;const a=us(),o=j.current.getAudioTracks(),i=new MediaStream(o),u=new MediaRecorder(i,a?{mimeType:a}:void 0);u.ondataavailable=l=>{l.data.size>0&&Z.current.push(l.data)},ve.current=u;let se=0;const b=async()=>{if(se+=1,se<2)return;const l=new Blob(X.current,{type:s??"video/webm"}),D=new Blob(Z.current,{type:a??"audio/webm"}),ke=(Date.now()-ge.current)/1e3;await Be(l,D,ke)};t.onstop=b,u.onstop=b,ge.current=Date.now(),ee(d+1,p),t.start(),u.start(),ue(!0)},_e=()=>{try{H.current?.stop()}catch{}try{ve.current?.stop()}catch{}ue(!1)},Be=async(s,t,a)=>{fe(!0);const o=p[d],i=URL.createObjectURL(s);try{if(t.size<1024)throw new Error("That recording was empty - please try again and speak into the mic.");const u=await ls(t),b=(await f({data:{audioBase64:u,mimeType:t.type||"audio/webm"}})).text||"";let l={};if(b.trim().length>0)try{l=await n({data:{role:x,question:o.text,transcript:b,durationSec:a}})}catch(q){h.error(q instanceof Error?q.message:"Scoring failed")}const D={question:o.text,transcript:b,durationSec:a,videoUrl:i,...l};Y(q=>[...q,D]),d+1>=p.length?await Ue([...R,D]):(G(d+1),C(!1),ee(d+1,p))}catch(u){h.error(u instanceof Error?u.message:"Processing failed")}finally{fe(!1)}},Ue=async s=>{he(!0);try{const t=await S({data:{role:x,answers:s.map(a=>({question:a.question,transcript:a.transcript,overall:a.overall}))}});$(t.summary),z()}catch(t){h.error(t instanceof Error?t.message:"Could not generate summary")}finally{he(!1)}},ze=()=>{z(),T.current=new Set,le([]),Q([]),G(0),Y([]),$(""),C(!1)},be=p.length>0,ye=K.length>0,m=me[d],g=m?.status==="ready"&&!!m.videoUrl,P=m?.status==="failed",[Ne,Se]=r.useState(null);return r.useEffect(()=>{if(!m||m.status!=="pending"||!m.startedAt){Se(null);return}const s=m.startedAt,t=()=>Se(Math.floor((Date.now()-s)/1e3));t();const a=window.setInterval(t,1e3);return()=>window.clearInterval(a)},[m]),e.jsxs($e,{tool:"mock_interview_video",preview:e.jsx(He,{}),children:[e.jsx(ss,{applicationId:ie,onLoaded:s=>{x||ae(s.job_title),O||ne(s.company),!k&&s.job_description&&_(s.job_description)}}),e.jsxs(We,{title:"Video Mock Interview",description:"Beta - record yourself answering AI-generated questions, get per-answer scores and a final report.",usageTool:"mock_interview_video",demo:"video-mock",children:[e.jsx("div",{className:"mb-4",children:e.jsx(ds,{})}),!be&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-midnight/40 bg-card/40 p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex size-5 items-center justify-center rounded-full bg-blue-600 text-white text-[11px] font-semibold",children:"1"}),e.jsx(V,{className:"text-sm font-semibold",children:"Role and company"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 items-start",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(V,{htmlFor:"role",className:"flex items-center gap-1 h-5",children:["Role",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(Ce,{id:"role",value:x,onChange:s=>ae(s.target.value),placeholder:"e.g. Marketing Manager"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(V,{htmlFor:"company",className:"flex items-center h-5",children:"Company (optional)"}),e.jsx(Ce,{id:"company",value:O,onChange:s=>ne(s.target.value),placeholder:"e.g. Brightline Analytics"})]})]})]}),e.jsxs("div",{children:[e.jsxs(V,{htmlFor:"jd",className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"inline-flex size-5 items-center justify-center rounded-full bg-blue-600 text-white text-[11px] font-semibold",children:"2"}),"Target job description (optional)"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2 min-h-[32px]",children:"Paste the JD for sharper, more relevant questions tailored to the role."}),e.jsx("div",{className:"mb-2",children:e.jsx(es,{applicationId:ie,onPick:s=>{_(""),oe({search:t=>({...t,applicationId:s})})},onClear:()=>{_(""),oe({search:s=>{const{applicationId:t,...a}=s;return a}})},variant:"inline"})}),e.jsx(Oe,{id:"jd",value:k,onChange:s=>_(s.target.value),rows:6,maxLength:Qe.jobDescription,placeholder:"Paste the JD for sharper, more relevant questions"}),k.length>
13e3&&e.jsxs("p",{className:"mt-1 text-[11px] text-amber-600 dark:text-amber-400",children:["This job description is long (",k.length.toLocaleString()," characters) - weâll focus on the requirements and responsibilities sections for faster generation."]})]}),e.jsxs("div",{className:"space-y-3 max-w-2xl mx-auto flex flex-col items-center",children:[e.jsx(M,{onClick:Le,className:"px-6 bg-blue-600 text-white hover:bg-blue-700 font-semibold",size:"lg",disabled:ce||!x.trim(),children:ce?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"h-4 w-4 mr-2 animate-spin"}),"Writing your questionsâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(ts,{className:"h-4 w-4 mr-2"}),"Start interview"]})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center max-w-md",children:"Your questions are ready in a few seconds. The video interviewer takes a minute or two to appear for the first question; the rest are rendered while you answer. You can always answer from the question text without waiting."})]})]}),be&&!ye&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(te,{variant:"secondary",children:["Question ",d+1," of ",p.length]}),e.jsx(te,{variant:"outline",children:p[d]?.category})]}),e.jsxs("div",{className:"rounded-md border bg-card text-card-foreground p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Interviewer asks:"}),e.jsx("div",{className:"text-base font-medium",children:p[d]?.text}),e.jsx("div",{className:"mt-3 flex gap-2",children:e.jsx(M,{size:"sm",variant:"outline",onClick:Ee,disabled:J||B||!g,children:J?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"h-3 w-3 mr-2 animate-spin"}),"Playing"]}):!g&&!P?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"h-3 w-3 mr-2 animate-spin"}),"Avatar renderingâ¦"]}):P?e.jsx(e.Fragment,{children:"Avatar unavailable"}):e.jsxs(e.Fragment,{children:[e.jsx(Re,{className:"h-3 w-3 mr-2"}),W?"Replay":"Play question"]})})})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Interviewer"}),e.jsx("div",{className:"aspect-video w-full rounded-md overflow-hidden border",style:{background:is},children:g?e.jsx("video",{ref:xe,src:m.videoUrl,className:"w-full h-full object-cover",playsInline:!0,preload:"auto"}):e.jsx("div",{className:"w-full h-full flex flex-col items-center justify-center gap-1 px-4 text-center text-xs text-muted-foreground",children:P?"Avatar unavailable - the question is above; answer from the text.":e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(N,{className:"h-4 w-4 mr-2 animate-spin"}),"Your interviewer is being rendered",Ne!==null?` · ${Ne}s`:""]}),e.jsx("span",{children:d===0?"The first question usually takes a minute or two. Later questions are prepared while you answer.":"Prepared while you answered - nearly there."})]})})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"You"}),e.jsx("div",{className:"aspect-video w-full bg-black rounded-md overflow-hidden border",children:e.jsx("video",{ref:v,className:"w-full h-full object-cover",playsInline:!0,muted:!0,autoPlay:!0})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[B?e.jsxs(M,{variant:"destructive",onClick:_e,children:[e.jsx(Je,{className:"h-4 w-4 mr-2"}),"Stop & submit"]}):e.jsxs(M,{onClick:Fe,disabled:U||J||g&&!W,children:[e.jsx(Re,{className:"h-4 w-4 mr-2"}),!g&&!P?"Answer now - don't wait for the video":"Start recording answer"]}),U&&e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center",children:[e.jsx(N,{className:"h-3 w-3 mr-1 animate-spin"}),"Transcribing & scoringâ¦"]}),!W&&!B&&!U&&g&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"Play the question first."}),!g&&!P&&!B&&!U&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"The video appears here when it's ready; you don't have to wait for it."})]}),R.length>0&&e.jsxs("details",{className:"border rounded-md p-3 mt-4",children:[e.jsxs("summary",{className:"cursor-pointer text-sm font-medium",children:["Previous answers (",R.length,")"]}),e.jsx("div",{className:"mt-3 space-y-3",children:R.map((s,t)=>e.jsx(Ae,{idx:t+1,a:s},t))})]})]}),Pe&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-6",children:[e.jsx(N,{className:"h-4 w-4 animate-spin"}),"Generating final reportâ¦"]}),ye&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-md border bg-card text-card-foreground p-5",children:[e.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Final Report"}),e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:e.jsx(Ge,{children:K})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Answer breakdown"}),e.jsx("div",{className:"space-y-3",children:R.map((s,t)=>e.jsx(Ae,{idx:t+1,a:s},t))})]}),e.jsx(M,{variant:"outline",onClick:ze,children:"Start a new session"}),e.jsx(Ze,{toolKey:"mock",tips:[...Xe.mock],resultKey:K.length})]})]})]})}function Ae({idx:c,a:n}){return e.jsxs("div",{className:"border rounded-md p-3 bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:["Q",c,": ",n.question]}),n.overall!=null&&e.jsxs(te,{children:[n.overall,"/10"]})]}),e.jsx("video",{src:n.videoUrl,controls:!0,className:"w-full max-w-md rounded mb-2"}),e.jsxs("div",{className:"text-xs text-muted-foreground mb-1",children:["Transcript (",Math.round(n.durationSec),"s)"]}),e.jsx("div",{className:"text-sm whitespace-pre-wrap mb-2",children:n.transcript||e.jsx("span",{className:"italic text-muted-foreground",children:"No speech detected."})}),n.scores&&e.jsxs("div",{className:"grid grid-cols-4 gap-2 text-xs mb-2",children:[e.jsx(I,{label:"Content",v:n.scores.content}),e.jsx(I,{label:"Structure",v:n.scores.structure}),e.jsx(I,{label:"Clarity",v:n.scores.clarity}),e.jsx(I,{label:"Confidence",v:n.scores.confidence})]}),n.summary&&e.jsxs("div",{className:"text-sm mb-1",children:[e.jsx("span",{className:"font-medium",children:"Verdict:"})," ",n.summary]}),n.filler_count!=null&&n.filler_count>0&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-1",children:["Filler words: ",n.filler_count," (",n.filler_words?.slice(0,6).join(", "),")"]}),n.improvements&&n.improvements.length>0&&e.jsx("ul",{className:"text-sm list-disc ml-5 mt-1",children:n.improvements.map((S,f)=>e.jsx("li",{children:S},f))})]})}function I({label:c,v:n}){return e.jsxs("div",{className:"rounded bg-background border p-2 text-center",children:[e.jsx("div",{className:"text-muted-foreground",children:c}),e.jsxs("div",{className:"font-semibold",children:[n,"/10"]})]})}export{et as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.