PageSourceSearch

https://bitstage.ai/assets/Practice-BleCX1de.js

js bitstage.ai collected 2026-10-05 13:29:56 UTC 51,843 bytes, 3 lines download raw bytes

1import{j as e,r as l,aH as is,aG as ns,a_ as ls,aL as os}from"./vendor-CkXPoFMb.js";import{C as xt,A as cs,h as ds,j as ms,f as us}from"./CandidateLayout-Dw-nINaX.js";import{C as ft}from"./CandidateBreadcrumb-D9xZh8gN.js";import{B as K}from"./badge-PyECTiJT.js";import{aY as T,aZ as B,ba as hs,bU as xs,c as le,B as S,bV as fs,bO as ps,bP as gs,bQ as bs,a as oe,u as vs,x as js,ak as ys,al as Ns,bW as pt,o as ws,q as ks,r as _s,s as Ss,t as gt,aN as bt,bc as Cs,be as Ls,bf as As,bg as Es,bh as Ps,ax as Rs,bX as vt,bY as Is,i as ye,W as Ms,ar as Ts,as as Bs,at as Ds,au as Js,av as Fs,bp as Vs,aA as Ws,aB as Hs,bq as qs,a$ as Us}from"./index-CR9aNikF.js";import{T as Os,a as Gs,b as jt,c as yt}from"./tabs-Ce1cCIbb.js";import{r as zs,G as $s,a as Nt}from"./GlobalJobCard-Bn3TfYGz.js";import{T as Ys,u as Ks,R as Qs}from"./useCandidateAttemptDetail-C92qnEog.js";import{J as Xs}from"./JobEntryCompanyMark-Bk6RklSq.js";import{J as Zs}from"./JobCompanyNameLink-CvAev2v6.js";import{I as H,e as Je,L as Lt,d as ea,b as ta,Q as wt,b2 as sa,aq as At,g as q,h as Et,b0 as aa,M as ra,b3 as ia,a7 as na,a as la,b4 as oa,k as ca,aW as da,az as ma,b5 as kt,A as ua}from"./vendor-icons-DPnl4cY3.js";import{g as ha,p as _t,f as xa,b as fa,s as pa,S as ga,a as ba}from"./rehearsalBroadcast-DBGnHAMW.js";import{a as Me}from"./candidateApplicationsService-DWV7nKja.js";import{E as va}from"./EmailVerificationRequiredModal-pMRI6WB7.js";import{S as ja}from"./SafeMarkdown-BnhaxEwI.js";import{a as St,c as Ct,p as Te}from"./PracticeScoreCard-CnKtZlmH.js";import{a5 as ya,a6 as Be}from"./vendor-datefns-N8mCDnaz.js";import{P as Na,s as wa,p as ka}from"./practiceQuotaLimits-7MbxVgQ3.js";import{r as _a}from"./rehearsalAudioController-BpLYoF2a.js";import"./checkbox-Cpm-hLEQ.js";import"./GoogleSignupButton-Bksx481N.js";import"./oauthPostLogin-Bp_x4sgc.js";import"./passwordValidation-Dn1l2Lqa.js";import"./signupEmailValidation-CD3kGD9O.js";import"./emailValidationService-D4JrT6ch.js";import"./MfaSetupPage-BYbF_bzC.js";import"./MfaEnrollPanel-ChuKGc1p.js";import"./input-otp-B7lYn7RV.js";import"./recruiterOnboardingService-DY0IebLw.js";import"./bitstage-logo-full-BrydXt0F.js";import"./vendor-jspdf-D2r6YsBm.js";import"./vendor-fingerprint-f-b5Qes_.js";import"./vendor-sanitize-8YZbVxp6.js";import"./vendor-sentry-DuxUMs8C.js";import"./vendor-motion-DvZ9ooo_.js";import"./applicationWithdrawal-C6Uwj61w.js";import"./ResumePreviewModal-BkKhzYQn.js";import"./collapsible-BF0L_gNK.js";import"./evidenceMediaSync-qFKfiRYw.js";function Sa({keyword:s,jobs:n,loading:c}){const h=s.trim();return e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-[hsl(var(--brand-navy))]"}),e.jsx("h2",{className:"text-base md:text-lg font-bold text-foreground",children:"Matching roles"}),h?e.jsx(K,{variant:"secondary",className:"rounded-full",children:h}):null]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Search is keyword-only (title or description). Alerts are sent when new matching roles are posted."})]}),e.jsx(Ys,{keyword:h})]}),c?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Array.from({length:4}).map((i,x)=>e.jsx(T,{className:"border-border",children:e.jsxs(B,{className:"p-4",children:[e.jsx("div",{className:"h-3 w-20 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-4 w-32 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse mt-3"})]})},x))}):n.length===0?e.jsx(T,{className:"border-dashed border-border",children:e.jsx(B,{className:"py-8",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-[hsl(var(--brand-cream))] flex items-center justify-center shrink-0 border border-[hsl(var(--brand-navy))]/15",children:e.jsx(Je,{className:"w-4 h-4 text-[hsl(var(--brand-navy))]"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-foreground",children:"No matching roles yet"}),e.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:"Turn on alerts and we’ll email you when a matching role is posted."})]})]})})}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map((i,x)=>{const y=zs(i),g=hs({isConfidential:i.is_confidential,orgName:i.org_name,companyLogoUrl:i.company_logo_url}
1),v=xs({isConfidential:i.is_confidential,isPubliclyListed:i.is_publicly_listed,orgName:i.org_name,orgShortId:i.org_short_id});return e.jsxs("div",{className:"relative animate-fade-in focus-within:ring-2 focus-within:ring-[hsl(var(--brand-navy))]/40 rounded-lg",style:{animationDelay:`${x*40}ms`,animationFillMode:"backwards"},children:[e.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"absolute inset-0 z-0 rounded-lg","aria-label":i.title}),e.jsx(T,{className:"border-border hover:border-[hsl(var(--brand-navy))]/30 hover:shadow-md transition-all group cursor-pointer h-full pointer-events-none",children:e.jsxs(B,{className:"p-4 flex flex-col h-full",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsxs(Zs,{href:v,className:"pointer-events-auto",children:[e.jsx(Xs,{isConfidential:g.isConfidential,companyLogoUrl:g.logoUrl,companyName:g.displayName,size:"sm"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:g.displayName})]})}),e.jsx("p",{className:"text-sm font-semibold text-foreground line-clamp-2 mb-1 group-hover:text-[hsl(var(--brand-navy))] transition-colors",children:i.title}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-3 leading-snug min-h-[2rem]",children:(()=>{const p=(i.role_title||"").trim(),C=(i.employment_type||"").trim().replace(/_/g,"-"),Q=(i.department||"").trim(),P=(i.location||"").trim(),L=[C,p].filter(Boolean).join(" ")||"Open role",f=[Q,P].filter(Boolean).join(" · "),A=f?`${L} - ${f}`:`${L} now hiring at ${g.displayName}`,R=(i.description||i.summary||i.brief||"").trim().replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();let U="";return R&&(U=R.split(new RegExp("(?<=[.!?])\\s+")).slice(0,2).join(" ").slice(0,220)),U||A})()}),e.jsx("div",{className:"mt-auto pt-2 border-t border-border/60 flex items-center justify-end",children:e.jsx($s,{job:i})})]})})]},i.id)})})]})}const Pt="bitstage:practice:in_progress_v1";function Rt(){if(typeof window>"u")return{};try{const s=localStorage.getItem(Pt);return s?JSON.parse(s):{}}catch{return{}}}function It(s){if(!(typeof window>"u"))try{localStorage.setItem(Pt,JSON.stringify(s))}catch{}}function Ca(s,n){if(!s)return;const c=Rt();c[s]=n,It(c)}function La(s,n){if(!s)return!1;const c=Rt();if(!(s in c))return!1;const h=c[s];return n>h?(delete c[s],It(c),!1):!0}function Y(s){return(s||"").trim().toLowerCase()}function Aa(s){var c;const n=Y(s.attempt_kind);return n==="practice"||(c=s.job)!=null&&c.is_practice?!0:s.job?!1:n==="practice"||n===""}function Ea(s,n){var y,g;if(!Array.isArray(s)||s.length===0)return[];const c=Y((y=n.rehearsal)==null?void 0:y.title),h=Y((g=n.role)==null?void 0:g.title),i=Y(n.slug);return[...s.filter(v=>{if(!Aa(v))return!1;const p=Y(v.scenario),C=Y(v.role);return!!(c&&p===c||c&&p.includes(c)||h&&C===h&&c&&p.includes(c.split(" ")[0]||"")||!c&&h&&C===h||i&&(p.includes(i)||C.includes(i)))})].sort((v,p)=>new Date(p.created_at).getTime()-new Date(v.created_at).getTime())}function Fe(s){var n;return(((n=s.role)==null?void 0:n.title)||"").trim()||"General"}function Pa(s){try{const n=new Date(s);return Number.isNaN(n.getTime())?"-":ya(n,"MMM d, yyyy • h:mm a")}catch{return"-"}}function Ra(s,n=90){const c=s.replace(/[#*_`>~\[\]]/g," ").replace(/\s+/g," ").trim();if(!c)return"";if(c.length<=n)return c;const h=c.slice(0,n),i=h.lastIndexOf(" ");return`${(i>40?h.slice(0,i):h).trim()}…`}function De({available:s}){return s?e.jsxs("span",{className:"inline-flex items-center gap-1 text-[hsl(var(--brand-navy))] text-xs font-semibold",children:[e.jsx(At,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Available"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(aa,{className:"h-3.5 w-3.5","aria-hidden":!0}),"-"]})}function Ia({pc:s,onClick:n,isGuest:c=!1,isVerifiedEmail:h=!1,globallyLocked:i=!1,lockedReason:x="signup",lockedCtaLabel:y,expanded:g=!1,onToggleExpand:v,attempts:p=[],historyLoading:C=!1,onViewDetail:Q}){const P=(s.rehearsal.scenario_card_short||"").trim(),L=(s.rehearsal.candidate_role_description||"").trim(),f=L||(s.rehearsal.brief||"").trim()||s.rehearsal.title,A=Ra(P||f),E=P?[P,L].filter(
1Boolean).join(`
2
3`):f,R=Fe(s),U=typeof s.best_score=="number"&&Number.isFinite(s.best_score)&&s.best_score>0?Math.round(s.best_score):null,X=l.useMemo(()=>{let o=null;for(const w of p){const O=typeof w.bit_score=="number"&&w.bit_score>0?w.bit_score:typeof w.final_score=="number"&&w.final_score>0?w.final_score:null;if(O==null)continue;const F=Math.round(O);o=o==null?F:Math.max(o,F)}return o},[p]),I=U??X,Z=I!=null?Te(I):null,ce=s.attempts_used>=s.max_attempts&&s.max_attempts>0,ee=La(s.slug,s.attempts_used);let N;i||s.requires_signup||s.requires_verification?N="locked":ce?N="completed":s.can_start?ee?N="continue":s.attempts_used>0?N="again":N="start":N="locked";const de=y||(x==="verify-email"?"Verify email to practice":x==="signup"?c?"Sign up to practice":"Create profile to practice":s.verification_message||"Practice limit reached"),D=o=>{o.stopPropagation(),!(N==="completed"||N==="locked")&&n()},te=o=>{o.stopPropagation(),v==null||v()},J=l.useMemo(()=>p.map((o,w)=>{const O=p.length-w,F=typeof o.bit_score=="number"&&o.bit_score>0?o.bit_score:typeof o.final_score=="number"&&o.final_score>0?o.final_score:null,me=Array.isArray(o.transcript)&&o.transcript.length>0,G=o.content_available===!0,j=Array.isArray(o.evidence)&&o.evidence.length>0;return{id:o.id,attemptNumber:O,isLatest:w===0,when:Pa(o.created_at),score:F,transcript:me,video:G,evidence:j}}),[p]);return e.jsxs("div",{className:"rounded-xl border border-border/70 bg-card shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:p-5 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3 sm:gap-4 min-w-0 flex-1",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-[hsl(var(--brand-cream))] text-[hsl(var(--brand-navy))] border border-[hsl(var(--brand-navy))]/15",children:e.jsx(H,{className:"h-5 w-5","aria-hidden":!0})}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx(K,{variant:"outline",className:"border-[hsl(var(--brand-navy))]/20 bg-[hsl(var(--brand-cream))] text-[11px] font-semibold text-[hsl(var(--brand-navy))]",children:R}),e.jsx("h3",{className:"text-base font-bold text-foreground leading-snug",children:s.rehearsal.title}),!g&&A?e.jsx("p",{className:"text-sm text-muted-foreground leading-snug line-clamp-1",children:A}):null,N==="locked"?e.jsxs("p",{className:"text-sm text-amber-700 font-medium flex items-center gap-1.5 pt-0.5",children:[e.jsx(Lt,{className:"h-3.5 w-3.5","aria-hidden":!0}),de]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-6 sm:gap-8 shrink-0 lg:mx-4",children:[e.jsxs("div",{className:"min-w-[4.5rem]",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Attempts"}),e.jsxs("p",{className:"mt-0.5 text-base font-bold tabular-nums text-foreground leading-none",children:[s.attempts_used,s.max_attempts>0?e.jsxs("span",{className:"text-sm font-semibold text-muted-foreground",children:["/",s.max_attempts]}):null]})]}),e.jsxs("div",{className:"min-w-[5.5rem]",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Best readiness"}),Z!=null?e.jsx(K,{variant:"outline",className:le("mt-1 text-[11px] font-bold",Ct(Z)),children:St(Z)}):e.jsx("p",{className:"mt-0.5 text-base font-bold leading-none text-muted-foreground",children:"-"})]})]}),e.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 sm:w-auto sm:shrink-0 sm:justify-end",children:[v?e.jsxs(S,{type:"button",size:"sm",variant:"outline",className:"min-h-11 flex-1 sm:flex-none gap-1.5 font-semibold",onClick:te,"aria-expanded":g,children:[g?s.attempts_used>0?"Hide rehearsals":"Hide scenario":s.attempts_used>0?"View rehearsals":"View scenario",g?e.jsx(ea,{className:"h-4 w-4","aria-hidden":!0}):e.jsx(ta,{className:"h-4 w-4","aria-hidden":!0})]}):null,N==="continue"?e.jsxs(S,{type:"button",size:"sm",variant:"outline",className:"min-h-11 flex-1 sm:flex-none gap-1.5 font-semibold",onClick:D,children:[e.jsx(wt,{className:"h-3.5 w-3.5 fill-current","aria-hidden":!0}),"Resume rehearsal"]}):N==="again"?e.jsxs(S,{type:"button",size:"sm",variant:"outline",className:"min-h-11 flex-1 sm:flex-none gap-1.5 font-semibold",onClick:D,children:[e.jsx(sa,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Run another rehearsal"]}):N==="start"?e.jsxs(S,{type:"button",size:"sm",className:"min-h-11 flex-1 sm:flex-none gap-2 font-semibold",onClick:D,children:[e.jsx(wt,{className:"h-3.5 w-3.5 fill-current","aria-hidden":!0}),"Start rehearsal"]}):N==="completed"?e.jsxs("span",{className:"inline-flex min-h-11 items-center gap-2 rounded-md border border-border bg-muted/40 px-3 text-sm font-semibold text-muted-foreground",children:[e.jsx(At,{className:"h-3.5 w-3.5","aria-hidden":!0}),"All rehearsals used"]}):null]})]}),g?e.jsxs("div",{className:"border-t border-border/60 px-4 py-5 sm:px-5 space-y-5",children:[E?e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-bold text-[hsl(var(--brand-navy))]",children:"Scenario overview"}),e.jsx("div",{className:"rounded-xl border border-border/60 bg-muted/40 px-4 py-3 text-sm text-foreground leading-relaxed",children:e.jsx("div",{className:"prose prose-sm max-w-none prose-p:my-0 dar
3k:prose-invert",children:e.jsx(ja,{children:E})})})]}):null,s.attempts_used>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-extrabold tracking-tight text-foreground",children:"Attempt history"}),C?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-6 justify-center",children:[e.jsx(q,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),"Loading attempts…"]}):J.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No practice attempts for this scenario yet."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[720px] text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-xs font-semibold uppercase tracking-wide text-muted-foreground border-b border-border/50",children:[e.jsx("th",{className:"pb-2 pr-3 font-semibold",children:"Attempt"}),e.jsx("th",{className:"pb-2 pr-3 font-semibold",children:"Date"}),e.jsx("th",{className:"pb-2 pr-3 font-semibold",children:"Readiness"}),e.jsx("th",{className:"pb-2 pr-3 font-semibold",children:"Transcript"}),e.jsx("th",{className:"pb-2 pr-3 font-semibold",children:"Video"}),e.jsx("th",{className:"pb-2 pr-3 font-semibold",children:"Evidence"}),e.jsx("th",{className:"pb-2 font-semibold text-right",children:"Actions"})]})}),e.jsx("tbody",{children:J.map(o=>e.jsxs("tr",{className:"border-b border-border/40 last:border-0",children:[e.jsxs("td",{className:le("py-3 pr-3 font-semibold whitespace-nowrap",o.isLatest?"text-[hsl(var(--brand-navy))]":"text-foreground"),children:["Attempt ",o.attemptNumber,o.isLatest?e.jsx("span",{className:"font-medium",children:" (Latest)"}):null]}),e.jsx("td",{className:"py-3 pr-3 text-muted-foreground whitespace-nowrap",children:o.when}),e.jsx("td",{className:"py-3 pr-3 whitespace-nowrap",children:o.score!=null?e.jsx(K,{variant:"outline",className:le("text-[11px] font-bold",Ct(Te(o.score))),children:St(Te(o.score))}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx("td",{className:"py-3 pr-3",children:e.jsx(De,{available:o.transcript})}),e.jsx("td",{className:"py-3 pr-3",children:e.jsx(De,{available:o.video})}),e.jsx("td",{className:"py-3 pr-3",children:e.jsx(De,{available:o.evidence})}),e.jsx("td",{className:"py-3 text-right",children:Q?e.jsxs(S,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 px-3 font-semibold",onClick:w=>{w.stopPropagation(),Q(o.id)},children:["Watch this rehearsal",e.jsx(Et,{className:"h-3.5 w-3.5","aria-hidden":!0})]}):null})]},o.id))})]})})]}):null]}):null]})}function Ma(){return e.jsxs("div",{className:"relative flex h-28 w-28 shrink-0 items-center justify-center","aria-hidden":!0,children:[e.jsx("div",{className:"absolute inset-2 rounded-2xl bg-emerald-100/50"}),e.jsxs("svg",{viewBox:"0 0 120 120",className:"relative h-24 w-24",children:[e.jsx("rect",{x:"18",y:"22",width:"44",height:"56",rx:"4",fill:"#fff",stroke:"#1E293B",strokeWidth:"2"}),e.jsx("rect",{x:"30",y:"16",width:"20",height:"10",rx:"3",fill:"#93D47A",stroke:"#1E293B",strokeWidth:"2"}),e.jsx("path",{d:"M28 38 h24 M28 48 h20 M28 58 h16",stroke:"#64BD28",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:"M24 42 l4 4 8-8",fill:"none",stroke:"#64BD28",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M24 52 l4 4 8-8",fill:"none",stroke:"#64BD28",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("rect",{x:"72",y:"58",width:"10",height:"22",rx:"2",fill:"#93D47A",stroke:"#1E293B",strokeWidth:"1.5"}),e.jsx("rect",{x:"86",y:"48",width:"10",height:"32",rx:"2",fill:"#64BD28",stroke:"#1E293B",strokeWidth:"1.5"}),e.jsx("rect",{x:"100",y:"38",width:"10",height:"42",rx:"2",fill:"#4A9E22",stroke:"#1E293B",strokeWidth:"1.5"}),e.jsx("path",{d:"M70 82 h46",stroke:"#1E293B",strokeWidth:"2",strokeLinecap:"round"}),e.jsx("path",{d:"M88 34 l8-6 8 4",fill:"none",className:"stroke-brand-green",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M52 78 h16 v6 c0 4-3.5 7-8 7s-8-3-8-7v-6",fill:"#FBBF24",stroke:"#1E293B",strokeWidth:"1.5"}),e.jsx("path",{d:"M44 78 h32 v4 H44z",fill:"#D97706",stroke:"#1E293B",strokeWidth:"1.5"}),e.jsx("path",{d:"M48 58 c0-8 6-14 12-14s12 6 12 14v12 H48V58z",fill:"#FCD34D",stroke:"#1E293B",strokeWidth:"1.5"}),e.jsx("path",{d:"M48 62 H36 c-2 0-4 2-4 5s2 5 4 5h6 M72 62 h12 c2 0 4 2 4 5s-2 5-4 5h-6",fill:"none",stroke:"#1E293B",strokeWidth:"1.5",strokeLinecap:"round"})]})]})}function Ta(){return e.jsx("div",{className:"relative hidden sm:flex h-28 w-28 shrink-0 items-center justify-center","aria-hidden":!0,
3children:e.jsxs("svg",{viewBox:"0 0 120 120",className:"h-24 w-24",children:[e.jsx("rect",{x:"22",y:"24",width:"40",height:"52",rx:"4",fill:"#fff",stroke:"#1E293B",strokeWidth:"2"}),e.jsx("rect",{x:"32",y:"18",width:"20",height:"10",rx:"3",fill:"#FED7AA",stroke:"#1E293B",strokeWidth:"2"}),e.jsx("path",{d:"M30 40 h24 M30 50 h18 M30 60 h14",stroke:"#D97706",strokeWidth:"2",strokeLinecap:"round"}),e.jsx("path",{d:"M26 44 l4 4 7-7",fill:"none",stroke:"#64BD28",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M26 54 l4 4 7-7",fill:"none",stroke:"#64BD28",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M26 64 l4 4 7-7",fill:"none",stroke:"#64BD28",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:"78",cy:"62",r:"22",fill:"#E8F5E9",stroke:"#64BD28",strokeWidth:"2"}),e.jsx("rect",{x:"72",y:"58",width:"12",height:"14",rx:"2",fill:"#64BD28",stroke:"#1E293B",strokeWidth:"1.5"}),e.jsx("path",{d:"M74 58 V54 a6 6 0 0 1 12 0 v4",fill:"none",stroke:"#1E293B",strokeWidth:"2"})]})})}function Ba({used:s,max:n,limitReached:c=!1,limitReason:h="guest",isGuest:i=!1,onPrimary:x,onSignIn:y}){const g=Math.max(n,1),v=Math.max(0,Math.min(s,g));if(c){const p=h==="verify-email",C=h==="platform";return e.jsx("div",{className:"mb-5 rounded-xl border border-orange-200 bg-[#FFF7ED] p-5 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4 sm:gap-6",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-orange-100 flex items-center justify-center shrink-0",children:e.jsx(Lt,{className:"h-5 w-5 text-orange-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-bold text-foreground",children:"Practice limit reached"}),e.jsx("p",{className:"text-sm text-foreground/90 mt-1",children:i?"You've used all your free guest practice attempts.":p?"You've used all your practice attempts before email verification.":"You've used all your available practice attempts."}),!C&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:i?"Create an account to save your progress and unlock more practice rehearsals.":"Verify your email to unlock more practice rehearsals."}),!C&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-4",children:[e.jsxs(S,{onClick:x,className:"gap-2 rounded-lg",children:[p?e.jsx(ra,{className:"h-4 w-4"}):e.jsx(ia,{className:"h-4 w-4"}),i?"Create Your Profile":p?"Verify Email":"Create Your Profile"]}),i&&y&&e.jsx(S,{variant:"outline",className:"rounded-lg bg-white",onClick:y,children:"Sign In"})]})]}),e.jsx(Ta,{})]})})}return e.jsx("div",{className:"mb-5 rounded-xl border border-emerald-200/80 bg-[#E8F5E9]/50 p-5 sm:p-6",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-start lg:items-center gap-5 lg:gap-6",children:[e.jsx("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-base font-bold text-foreground",children:i?"Guest practice":"Practice"}),e.jsxs("p",{className:"text-sm text-foreground/80 mt-1 tabular-nums",children:["Practice rehearsals used: ",v," of ",g]}),e.jsx("div",{className:"mt-2.5",children:e.jsx(Da,{total:g,filled:v})}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2.5 flex items-center gap-1.5",children:["Every take is a rehearsal. Nobody sees these.",e.jsx(fs,{children:e.jsxs(ps,{children:[e.jsx(gs,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"More info",className:"text-muted-foreground/70 hover:text-foreground",children:e.jsx(na,{className:"h-3.5 w-3.5"})})}),e.jsx(bs,{children:i?"Guests get a limited number of free practice attempts. Create a profile to unlock more.":"Practice attempts available in your current account stage (before or after email verification)."})]})})]})]})}),e.jsx("div",{className:"hidden lg:block w-px self-stretch min-h-[5.5rem] bg-emerald-200/80"}),e.jsxs("div",{className:"hidden md:flex flex-col items-center gap-2 shrink-0 px-2",children:[e.jsx(Ma,{}),e.jsx("p",{className:"text-xs font-medium text-emerald-800/80 text-center max-w-[9rem] leading-snug",children:"Every take is a rehearsal. Nobody sees these."})]})]})})}function Da({total:s,filled:n}){const c=Array.from({length:s});return e.jsx("div",{className:"flex items-center gap-1 w-full max-w-[280px]",children:c.map((h,i)=>e.jsx("div",{className:le("h-2 flex-1 min-w-[4px] rounded-sm",i<n?"bg-primary":"bg-emerald-100")},i))})}function Ja({attemptId:s,onClose:n,fallbackJobTitle:c,fallbackScenarioTitle:h,backLabel:i="Back to application rehearsal"}){const{rehearsal:x,isLoading:y}=Ks({attemptId:s,fallbackJobTitle:c,fallbackScenarioTitle:h});return y?e.jsx(T,{className:"border-border/70 shadow-sm",children:e.jsxs(B,{className:"flex flex-col items-center justify-center gap-3 py-16 text-sm text-muted-foreground",children:[e.jsx(q,{className:"h-5 w-5 animate-spin"}),"Loading attempt details…"]})}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs(S,{type:"button",variant:"ghost",size:"sm",className:"gap-1.5 px-0",onClick:n,children:[e.jsx(la,{className:"h-4 w-4"}),i]}),e.jsx(Qs,{rehearsal:x,onClose:n,onTryAgain:n})]})}async function Fa(s){const n={};return n.limit=String(s.limit),oe({path:"/api/candidates/me/job-suggestions/",method:"GET",params:n,signal:s==null?void 0:s.signal,skipLogout:!0})}async function Va(s){const n={};return n.limit=String(s.limit),oe({path:"/api/candidates/me/job-search-history/",method:"GET",params:n,signal:s==null?void 0:s.signal,skipLogout:!0})}async function Wa(s){return oe({path:"/api/candidates/me/job-search-history/",method:"POST",body:{query:s},skipLogout:!0})}async function Ha(s){await oe({path:`/api/candidates/me/job-search-history/${s}/`,method:"DELETE",skipLogout:!0})}async function qa(){await oe({path:"/api/candidates/me/job-search-history/clear/",method:"DELETE",skipLogout:!0})}function Ua(s){const n=qs(s),c=(n.serverMessage||"").trim(),h=c.toLowerCase();return h.includes("expired")||h.includes("has ended")||h.includes("not available")||h.includes("invalid or expired")?{title:"Link expired",description:c||"This invite link has expired."}:{title:"Could not add role",description:Us(n,"Please try again.")}}function Oa(s){return{invited:"Invited",resume_uploaded:"Resume Uploaded",rehearsal_selected:"Rehearsal Selected",in_progress:"In Progress",submitted:"Submitted",expired:"Expired",quota_full:"Role closed",not_eligible:"Not Eligible"}[s==null?void 0:s.toLowerCase()]??s??"Invited"}const Ga=s=>{const n=s==null?void 0:s.toLowerCase();return n==="invited"?"text-[hsl(var(--brand-navy))]":n==="resume_uploaded"||n==="rehearsal_selected"?"text-blue-600":n==="submitted"?"text-emerald-600":n==="expired"||n==="not_eligible"?"text-muted-foreground":n==="in_progress"||n==="quota_full"?"text-amber-600":"text-muted-foreground"},Rr=()=>{var mt,ut,ht;const s=is(),n=ns(),[c,h]=ls(),{toast:i}=vs(),{user:x,loading:y}=js(),{setActiveInvite:g,updateInvite:v}=ys(),p=Ns.get("user_data"),C=((p==null?void 0:p.user_role)||"").toUpperCase(),P=String(((mt=x==null?void 0:x.app_metadata)==null?void 0:mt.role)||((ut=x==null?void 0:x.user_metadata)==null?void 0:ut.role)||"").toUpperCase()||C,L=!!x&&(P?P==="CANDIDATE":!0),f=!x,A=!!((ht=x==null?void 0:x.user_metadata)!=null&&ht.email_verified),[E,R]=l.useState(()=>c.get("tab")==="invited"?"invited":"practice");l.useEffect(()=>{c.get("tab")==="invited"&&R("invited")},[c]),l.useEffect(()=>{if(E!=="invited"||n.hash!=="#open-jobs")return;const t=window.setTimeout(()=>{var a;(a=document.getElementById("open-jobs"))==null||a.scrollIntoView({behavior:"smooth",block:"start"})},150);return()=>window.clearTimeout(t)},[E,n.hash,n.key]),l.useEffect(()=>{const t=(c.get("unsub")||"").trim();if(!t)return;const a=`bitstage:job-alerts:unsub-toast:${t}`;try{if(sessionStorage.getItem(a))return;sessionStorage.setItem(a,"1")}catch{}i(t==="1"?{title:"Unsubscribed",description:"You will no longer receive role alert emails for this keyword."}:t==="0"?{title:"Already unsubscribed",description:"This alert was already unsubscribed."}:t==="expired"?{title:"Link expired",description:"This unsubscribe link has expired. Please open your account to manage alerts.",variant:"destructive"}:t==="invalid"?{title:"Invalid link",description:"This unsubscribe link is invali
3d. Please open your account to manage alerts.",variant:"destructive"}:{title:"Update",description:"Your alert preferences were updated."});const r=new URLSearchParams(c);r.delete("unsub"),h(r,{replace:!0})},[c,h,i]);const U=t=>{R(t),t==="invited"?s("/practice?tab=invited",{replace:!0}):s("/practice",{replace:!0})},[X,I]=l.useState([]),[Z,ce]=l.useState(!0),[ee,N]=l.useState(!1),[de,D]=l.useState(null),[te,J]=l.useState(null),[o,w]=l.useState([]),[O,F]=l.useState(!0),[me,G]=l.useState(null),[j,Ne]=l.useState(null),[Mt,Ve]=l.useState(null),[Tt,We]=l.useState(""),[Bt,z]=l.useState(!1),[Dt,He]=l.useState("Sign in to get 3 more attempts per rehearsal."),[Jt,se]=l.useState(!1),[Ft,we]=l.useState(""),[Vt,qe]=l.useState(!1),[_,Wt]=l.useState(""),[ue,Ht]=l.useState("all"),[qt,he]=l.useState(null),[ke,xe]=l.useState(null),[Ue,Oe]=l.useState(!1),[Ge,_e]=l.useState(null),[ze,Se]=l.useState(null),[fe,Ut]=l.useState(null),[Ot,pe]=l.useState(!1),[$e,Ye]=l.useState(""),[Ke,ge]=l.useState(""),[Qe,Ce]=l.useState(!1),[Xe,ae]=l.useState([]),[Ze,et]=l.useState(!1),be=l.useRef(0),tt=l.useRef(null),[st,at]=l.useState([]),[Gt,rt]=l.useState(!0),[re,Le]=l.useState(""),[ie,Ae]=l.useState(""),[zt,ne]=l.useState([]),[$t,Ee]=l.useState(!1),ve=l.useRef(null),[it,$]=l.useState([]),[Yt,nt]=l.useState(!1),V=l.useMemo(()=>!!x&&L&&!f,[x,L,f]),lt=l.useMemo(()=>it.slice(0,8),[it]),Kt=async t=>{if(V){nt(!0);try{const a=await Va({q:t==null?void 0:t.q,limit:20});$(a||[])}catch{$([])}finally{nt(!1)}}},Qt=V,Pe=async()=>{var r;if(!Qt)return;const t=++be.current;(r=tt.current)==null||r.abort();const a=new AbortController;tt.current=a,et(!0),ae([]);try{const m=(await Fa({limit:8,signal:a.signal})||[]).filter(d=>d==null?void 0:d.job);if(t!==be.current)return;ae(m)}catch{if(t!==be.current)return;ae([])}finally{t===be.current&&et(!1)}};l.useEffect(()=>{if(!V){ae([]),$([]);return}Kt(),Pe()},[V]),l.useEffect(()=>{let t=!1;const a=new AbortController;return rt(!0),pt({is_active:!0,ordering:"-created_at",page_size:8},a.signal).then(r=>{t||at(Array.isArray(r==null?void 0:r.results)?r.results:[])}).catch(()=>{t||at([])}).finally(()=>{t||rt(!1)}),()=>{t=!0,a.abort()}},[]);const Re=async t=>{var u;const a=(t??re).trim();if(t!==void 0&&Le(t),Ae(a),a.length<2){ne([]);return}V&&Wa(a).then(m=>{$(d=>[m,...d.filter(k=>k.id!==m.id)].slice(0,20)),Pe()}).catch(()=>{}),(u=ve.current)==null||u.abort();const r=new AbortController;ve.current=r,Ee(!0);try{const m=await pt({status:"active",search:a,page_size:20},r.signal);ne(m.results||[])}catch{ne([])}finally{Ee(!1)}};l.useEffect(()=>{var t;re.trim()===""&&(Ae(""),ne([]),Ee(!1),(t=ve.current)==null||t.abort(),ve.current=null)},[re]);const je=l.useMemo(()=>{if(!f)return!1;if(o.length>0){if(o.some(r=>r.can_start&&!r.requires_signup))return!1;if(o.every(r=>r.requires_signup))return!0}return!!(j!=null&&j.requiresSignup||j&&j.maxViews>0&&j.viewsUsed>=j.maxViews)},[f,j,o]),ot=l.useMemo(()=>{if(f){const m=(j==null?void 0:j.viewsUsed)??0,d=(j==null?void 0:j.maxViews)??Na.guest;return{used:m,max:d,limitReached:je,limitReason:"guest"}}const t=wa(o),a=ka(A),r=a>0&&t>=a;return{used:t,max:a,limitReached:r,limitReason:A?"platform":"verify-email"}},[f,j,o,je,A]),ct=!f&&ot.limitReached,Xt=l.useMemo(()=>{const t=new Set;for(const a of o){const r=Fe(a);t.add(r)}return Array.from(t).sort((a,r)=>a.localeCompare(r))},[o]),Ie=o.filter(t=>!_||t.role.title.toLowerCase().includes(_.toLowerCase())||(t.role.description||"").toLowerCase().includes(_.toLowerCase())||t.rehearsal.title.toLowerCase().includes(_.toLowerCase())?ue==="all"?!0:Fe(t)===ue:!1),Zt=async()=>{if(f){xe([]);return}if(!(ke!=null||Ue)){Oe(!0);try{const t=await us(1,50);xe(t.results??[])}catch{xe([])}finally{Oe(!1)}}},es=t=>{he(a=>{const r=a===t?null:t;return r&&Zt(),r})},dt=X.filter(t=>{var a,r,u;return!_||t.job_title.toLowerCase().includes(_.toLowerCase())||t.company_name.toLowerCase().includes(_.toLowerCase())||(((a=t.role)==null?void 0:a.title)||"").toLowerCase().includes(_.toLowerCase())||(((r=t.rehearsal)==null?void 0:r.title)||"").toLowerCase().includes(_.toLowerCase())||(((u=t.invited_by)==null?void 0:u.name)||"").toLowerCase().includes(_.toLowerCase())});l.useEffect(()=>{if(y)return;if(!L){I([]),D(null),ce(!1);return}let t=!1;return Me().then(a=>{t||(I(a.results??[]),J(a.next??null),D(null))}).catch(a=>{t||(D((a==null?void 0:a.message)??"Failed to load applications"),I([]),J(null))}).finally(()=>{t||ce(!1)}),()=>{t=!0}},[L,y]);const ts=async()=>
3{if(!(!te||ee)){N(!0);try{const t=await Me({nextPageUrl:te});I(a=>{const r=new Set(a.map(m=>m.invite_id||m.job_id)),u=[...a];for(const m of t.results||[]){const d=m.invite_id||m.job_id;r.has(d)||(u.push(m),r.add(d))}return u}),J(t.next??null)}catch{i({title:"Failed to load more invites",variant:"destructive"})}finally{N(!1)}}};l.useEffect(()=>{if(y)return;let t=!1;return(async()=>{if(F(!0),G(null),xe(null),he(null),L){const d=await ds({}),b=Array.isArray(d)?d:[];t||(w(b),Ne(null),G(null));return}let r=null,u=null;try{r=await vt(!0)}catch(d){console.warn("[Practice] guest session failed (e.g. converted or blocked), clearing stale token and continuing to load rehearsals",d),Is()}if(!t&&r){const d=Number(r==null?void 0:r.practice_attempts_used),b=Number(r==null?void 0:r.practice_attempts_max);Number.isFinite(d)&&Number.isFinite(b)&&b>0&&(u={viewsUsed:d,maxViews:b})}const m=await ms({});if(!t){w(Array.isArray(m.rehearsals)?m.rehearsals:[]);const d=m.guest?{viewsUsed:m.guest.attempts_used??m.guest.views_used,maxViews:m.guest.attempts_max??m.guest.max_views,requiresSignup:m.guest.requires_signup}:null;Ne(d??u),G(null)}})().catch(r=>{console.error("[Practice] Failed to load rehearsals:",r),t||(w([]),Ne(null),G("We couldn't load the practice scenarios."))}).finally(()=>{t||F(!1)}),()=>{t=!0}},[L,y,n.key]);const ss=async t=>{const a=t.rehearsal;if(!t.can_start){if(t.requires_signup){He(t.verification_message||"You have used all guest rehearsals. Please sign up to continue."),z(!0);return}if(t.requires_verification){we(t.verification_message||"Please verify your email to unlock more practice rehearsals."),se(!0);return}if(t.attempts_used>=t.max_attempts){i({title:"No attempts remaining",description:t.verification_message||`You have used all ${t.max_attempts} practice attempts for this rehearsal.`,variant:"destructive"});return}}try{_a.primeFromGesture()}catch(d){console.warn("[Practice] audio prime failed",d)}const r=ha();let u=!1,m=!1;try{Ve(a.id),We(a.title),ye("start","Practice.handleStartPractice begin",{tabId:r,rehearsalId:a.id,slug:t.slug});const d=await _t(r),b=xa(r);if(ye("start","pre-create guard result",{probeActive:d.active,probeFrom:d.from,probeAttemptId:d.attemptId,localStorageActive:b}),d.active||b){ye("block","Practice.start BLOCKED at pre-create guard",{reason:d.active?"broadcastChannel-probe":"localStorage-live-lock",probeActive:d.active,localStorageActive:b}),i({title:"Rehearsal already open",description:"A rehearsal is already running in another browser tab. Finish or close it before starting a new one.",variant:"destructive"});return}if(u=fa(r),!u){ye("block","Practice.start BLOCKED at tryClaimRehearsalActiveLock",{tabId:r}),i({title:"Rehearsal already open",description:"A rehearsal is already running in another browser tab. Finish or close it before starting a new one.",variant:"destructive"});return}pa();try{await Ms()}catch(W){console.warn("[Practice] end HeyGen session before start (non-fatal):",W)}f?await vt():g({invite_code:"",slug:t.slug,company:"",jobTitle:t.role.title,location:"",resume_uploaded:!0,resume_score:null,resume_passed:null,rehearsal_required_count:1,rehearsal_optional_visible:!1,rehearsal_completed:!1,submission_status:null,selected_rehearsal_id:a.id,enabled_rehearsals:[{id:a.id,title:a.title,brief:a.brief}]});const k=await Ts({hiring_link_slug:t.slug,rehearsal_id:a.id,is_practice:!0},async()=>!(await _t(r)).active),M=k.attempt_id??k.id;if(!M)throw new Error("Attempt was created but no attempt ID was returned.");f||v({attempt_id:String(M),selected_rehearsal_id:a.id}),Ca(t.slug,t.attempts_used),s(ga,{state:{fromInvite:!0,fromRealApi:!0,fromPractice:!0,attemptId:M,inviteSlug:t.slug,rehearsalId:a.id,rehearsalTitle:a.title,rehearsalStageKey:"rehearsal_1",practiceAttemptsUsed:t.attempts_used,practiceAttemptsMax:t.max_attempts}}),m=!0}catch(d){const b=Bs(d);if(b.required){we(b.message),se(!0);return}const k=Ds(d);if(k.reached){He(k.message),z(!0);return}const{title:M,description:W}=Js(d);i({title:M,description:W,variant:"destructive"})}finally{!m&&u&&ba(r),Ve(null),We("")}},as=async()=>{qe(!0);try{const t=await Fs(),a=(t==null?void 0:t.message)||"If this account exists, a verification email has been sent.",r=a.toLowerCase().includes("already verified");i({title:r?"Email already verified":"Verification email sent",description:r?"Your email is already verified. Please try starting rehearsal again.":a}),r&&se(!1)}catch(t){i({title:"Could not send verification email",description:t instanceof Error?t.message:"Please try again.",variant:"destructive"})}finally{qe(!1)}},rs=async()=>{const t=$e.trim();if(!t){ge("Please enter an invite link or code.");return}const a=Vs(t);if(ge(""),!a){ge("Could not find a valid role or invite code in that link.");return}const{hiringLinkSlug:r,companySlug:u}=a;Ce(!0);try{await Ws.postJobEntry(r,{companySlug:u}),i({title:"Role added",description:"The role has been added to your applications."})}catch(k){const M=Hs(k);if(!M){const W=Ua(k);
3i({title:W.title,description:W.description,variant:"destructive"}),Ce(!1);return}i({title:M,description:"Opening your application.",variant:"default"})}const m=await Me(),d=m.results??[],b=d.find(k=>k.primary_link_slug===r||k.job_id===r);pe(!1),Ye(""),s(b?`/applications/${b.primary_link_slug||b.job_id}`:"/applications"),I(d),J(m.next??null),Ce(!1)};return Ge?e.jsxs(xt,{pageTitle:"Practice attempt",maxWidth:"max-w-5xl",children:[e.jsx(ft,{items:[{label:"Dashboard",to:"/candidate/dashboard"},{label:"Practice",onClick:()=>{_e(null),Se(null),fe&&he(fe)}},{label:ze||"Attempt detail"}]}),e.jsx(Ja,{attemptId:Ge,fallbackScenarioTitle:ze,fallbackJobTitle:"Practice",backLabel:"Back to practice",onClose:()=>{_e(null),Se(null),fe&&he(fe)}})]}):e.jsxs(xt,{pageTitle:"Practice",maxWidth:"max-w-5xl",children:[e.jsx(ft,{items:[{label:"Dashboard",to:"/candidate/dashboard"},{label:"Practice"}]}),e.jsxs("div",{className:"mb-6 space-y-2",children:[e.jsx("h1",{className:"font-display text-3xl font-bold tracking-tight text-foreground",children:E==="invited"?"Invitations":"Practice"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-2xl",children:E==="invited"?"Rehearsals you have been invited to by an employer.":"Rehearse any scenario within your available practice sessions. Nothing here is scored or shared."})]}),e.jsxs(Os,{value:E,onValueChange:U,className:"w-full",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-center",children:[e.jsxs(Gs,{className:"grid h-11 w-full max-w-md flex-1 grid-cols-2 sm:h-10 sm:w-auto sm:flex-none",children:[e.jsxs(jt,{value:"practice",className:"h-full gap-2",children:[e.jsx(H,{className:"h-4 w-4"}),"Practice"]}),e.jsxs(jt,{value:"invited",className:"h-full gap-2",children:[e.jsx(oa,{className:"h-4 w-4"}),"Invited roles"]})]}),e.jsx("div",{className:"relative w-full sm:max-w-xs sm:flex-none",children:e.jsx("input",{type:"text",placeholder:"Search roles, brands...",value:_,onChange:t=>Wt(t.target.value),className:"h-11 w-full rounded-xl border border-border bg-background px-4 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring sm:h-10"})})]}),e.jsx(yt,{value:"practice",className:"mt-0 space-y-5",children:e.jsxs(e.Fragment,{children:[(()=>{const{used:t,max:a,limitReached:r,limitReason:u}=ot;return a<=0&&!f?null:e.jsx(Ba,{used:t,max:a,isGuest:f,limitReached:r,limitReason:u,onPrimary:()=>{if(u==="verify-email"){we("Please verify your email to unlock more practice rehearsals."),se(!0);return}z(!0)},onSignIn:()=>z(!0)})})(),Mt&&e.jsxs("div",{className:"mb-4 rounded-lg border border-[hsl(var(--brand-navy))]/20 bg-[hsl(var(--brand-cream))] px-4 py-3 flex items-center gap-2 text-sm text-foreground",children:[e.jsx(q,{className:"h-4 w-4 animate-spin text-[hsl(var(--brand-navy))]"}),"Starting rehearsal for ",Tt||"selected scenario","..."]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-extrabold tracking-tight text-foreground",children:"All practice scenarios"}),e.jsx(K,{variant:"secondary",className:"rounded-full tabular-nums",children:Ie.length})]}),e.jsxs(ws,{value:ue,onValueChange:Ht,children:[e.jsx(ks,{className:"w-full sm:w-[200px] h-10 rounded-xl",children:e.jsx(_s,{placeholder:"All categories"})}),e.jsxs(Ss,{children:[e.jsx(gt,{value:"all",children:"All categories"}),Xt.map(t=>e.jsx(gt,{value:t,children:t},t))]})]})]}),O?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-12 text-muted-foreground",children:[e.jsx(q,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading practice scenarios…"})]}):me?e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:me}):Ie.length===0?e.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-6 text-center text-sm text-muted-foreground",children:_||ue!=="all"?"No practice rehearsals match your filters.":"No practice scenarios available yet. Check back soon."}):e.jsx("div",{className:"space-y-3",children:Ie.map(t=>
3{const a=String(t.id||t.slug),r=qt===a,u=ke==null?[]:Ea(ke,t);return e.jsx(Ia,{pc:t,onClick:()=>ss(t),isGuest:f,isVerifiedEmail:A,globallyLocked:f?je:ct,lockedReason:f||je?"signup":t.requires_verification||!A&&ct?"verify-email":"platform",lockedCtaLabel:f?"Sign up to practice":void 0,expanded:r,onToggleExpand:()=>es(a),attempts:u,historyLoading:r&&Ue,onViewDetail:m=>{_e(m),Se(t.rehearsal.title),Ut(a)}},a)})})]})}),e.jsx(yt,{value:"invited",className:"mt-0",children:e.jsxs(e.Fragment,{children:[Z?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-muted-foreground mb-6",children:[e.jsx(q,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading invited roles…"})]}):de?e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive mb-6",children:de}):dt.length===0?e.jsx("div",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-6 text-center text-sm text-muted-foreground",children:f?e.jsxs(e.Fragment,{children:["Exploring as a guest?"," ",e.jsx("button",{type:"button",className:"font-semibold text-[hsl(var(--brand-navy))] hover:underline",onClick:()=>z(!0),children:"Create your profile"})," ","to view invited roles."]}):_?"No invited roles match your search.":"No invited roles yet. When an employer sends you an invite link, roles will appear here."}):e.jsx("div",{className:"space-y-3 mb-6",children:dt.map(t=>{var a,r,u,m,d,b;return e.jsx(T,{role:"button",tabIndex:0,onClick:()=>s(`/applications/${t.primary_link_slug||t.job_id}`),onKeyDown:k=>k.key==="Enter"&&s(`/applications/${t.primary_link_slug||t.job_id}`),className:"cursor-pointer text-left border-border/80 bg-card hover:shadow-md transition-all",children:e.jsxs(B,{className:"p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-base font-bold text-foreground truncate",children:t.job_title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mt-1 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Je,{className:"h-3.5 w-3.5 text-[hsl(var(--brand-navy))]"}),t.is_confidential?"Hiring via BitStage":t.company_name]}),((a=t.role)==null?void 0:a.title)&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(H,{className:"h-3.5 w-3.5 text-[hsl(var(--brand-navy))]/80"}),t.role.title]})]})]}),e.jsxs(K,{variant:"outline",className:"text-xs shrink-0",children:[e.jsx("span",{className:le("mr-1",Ga(t.status)),children:"•"}),Oa(t.status)]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-1 sm:grid-cols-2 gap-2.5",children:[e.jsxs("div",{className:"rounded-md border border-border/70 bg-muted/20 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground font-semibold",children:"Rehearsal"}),e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:((r=t.rehearsal)==null?void 0:r.title)||t.rehearsal_name||"Assigned rehearsal"}),(((u=t.rehearsal)==null?void 0:u.target_duration_text)||t.rehearsal_time_text)&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:((m=t.rehearsal)==null?void 0:m.target_duration_text)||t.rehearsal_time_text})]}),e.jsxs("div",{className:"rounded-md border border-border/70 bg-muted/20 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground font-semibold",children:"Invited By"}),e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:((d=t.invited_by)==null?void 0:d.name)||"Employer"}),((b=t.invited_by)==null?void 0:b.email)&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t.invited_by.email})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 text-xs",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[t.invited_at&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ca,{className:"h-3.5 w-3.5"}),"Invited ",Be(new Date(t.invited_at),{addSuffix:!0})]}),t.deadline&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(da,{className:"h-3.5 w-3.5"}),"Deadline ",Be(new Date(t.deadline),{addSuffix:!0})]}),!t.invited_at&&t.updated_at&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ma,{className:"h-3.5 w-3.5"}),"Updated ",Be(new Date(t.updated_at),{addSuffix:!0})]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-[hsl(var(--brand-navy))] font-semibold",children:["Open Invitation ",e.jsx(Et,{className:"h-3.5 w-3.5"})]})]})]})},t.invite_id||t.job_id)})}),te&&e.jsxs(S,{type:"button",variant:"outline",size:"lg",className:"w-full mt-3",onClick:()=>void ts(),disabled:ee,children:[ee?e.jsx(q,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Show more"]}),e.jsxs("div",{className:"mt-4 flex w-full flex-col gap-2 sm:flex-row sm:items-stretch",children:[e.jsxs(S,{variant:"default",className:"min-w-0 gap-2 sm:flex-1",onClick:()=>pe(!0),children:[e.jsx(kt,{className:"h-4 w-4"})," Enter invitation link"]}),X.length===0&&e.jsxs(S,{variant:"outline",className:"min-w-0 gap-2 border-[hsl(var(--brand-navy))]/30 text-[hsl(var(--brand-navy))] hover:bg-[hsl(var(--brand-cream))] hover:text-[hsl(var(--brand-navy))] sm:flex-1",onClick:()=>R("practice"),children:[e.jsx(H,{className:"h-4 w-4"}),"Browse Practice Catalog"]})]}),e.jsxs("section",{id:"open-jobs",className:"mb-8 mt-6 scroll-mt-24",children:[V&&!ie&&(Ze||Xe.length>0)?e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"mb-4",children:e.jsxs("h2",{className:"text-base md:text-lg font-bold text-foreground flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-[hsl(var(--brand-navy))]"}),"Suggested for you",e.jsx("span",{className:"text-[11px] font-semibold px-2 py-0.5 rounded-full bg-[hsl(var(--brand-cream))] text-[hsl(var(--brand-navy))] border border-[hsl(var(--brand-navy))]/20",children:"Based on your searches"})]})}),e.jsx("div",{className:"flex gap-4 overflow-x-auto pb-2 -mx-1 px-1",children:Ze?Array.from({length:4}).map((t,a)=>e.jsx(T,{className:"border-border shrink-0 w-full sm:w-[calc((100%-1rem)/2)] rounded-xl",children:e.jsxs(B,{className:"p-5 animate-pulse space-y-3",children:[e.jsx("div",{className:"h-3 w-24 bg-muted rounded"}),e.jsx("div",{className:"h-4 w-40 bg-muted rounded"}),e.jsx("div",{className:"h-3 w-full bg-muted rounded"})]})},`sk-${a}`)):Xe.map((t,a)=>{var m;const r=t.job,u=(m=t.matched_query)==null?void 0:m.trim();return e.jsxs("div",{className:"shrink-0 w-full sm:w-[calc((100%-1rem)/2)] space-y-2",children:[u?e.jsxs("span",{className:"inline-flex text-[11px] font-semibold px-2 py-0.5 rounded-full bg-[hsl(var(--brand-cream))] text-[hsl(var(--brand-navy))]",children:["Based on “",u,"”"]}):null,e.jsx(Nt,{job:r,index:a})]},r.id)})})]}):null,e.jsxs("div",{className:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[e.jsx("div",{className:"w-full sm:w-64 md:w-72",children:e.jsx(bt,{value:re,onChange:t=>Le(t.target.value),placeholder:"Search role",className:"h-10 sm:h-9",onKeyDown:t=>{t.key==="Enter"&&Re()}})}),e.jsxs(S,{onClick:()=>void Re(),variant:"outline",className:"h-10 w-full gap-2 sm:h-9 sm:w-auto",disabled:re.trim().length<2,children:[e.jsx(Je,{className:"w-4 h-4"}),"Search"]})]}),V&&lt.length>0?e.jsxs("div",{className:"mt-2 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-muted-foreground",children:[e.jsx("span",{children:"Recent Searches"}),Yt?e.jsx(q,{className:"h-3.5 w-3.5 animate-spin"}):null]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[lt.map(t=>e.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border border-border bg-background px-3 py-1 text-xs font-semibold",children:[e.jsx("button",{type:"button",className:"hover:underline",onClick:()=>{Re(t.query)},children:t.query}),e.jsx("button",{type:"button","aria-label":`Remove ${t.query}`,className:"ml-1 text-muted-foreground hover:text-foreground",onClick:()=>{Ha(t.id).then(()=>{$(a=>a.filter(r=>r.id!==t.id)),Pe()}).catch(()=>{})},children:"×"})]},t.id)),e.jsx("button",{type:"button",className:"text-xs font-semibold text-[hsl(var(--brand-navy))] hover:underline ml-1",onClick:()=>{qa().then(()=>{$([]),ae([]),Ae(""),ne([]),Le("")}).catch(()=>{})},children:"Clear all"})]})]}):null,ie?e.jsx(Sa,{keyword:ie,jobs:zt,loading:$t}):null,ie?null:e.jsxs("div",{className:"flex items-end justify-between mb-3",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-base md:text-lg font-bold text-foreground flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-[hsl(var(--brand-navy))]"}),"Latest open roles"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Fresh active roles across all partner companies."})]}),e.jsxs(os,{to:"/companies",className:"hidden sm:inline-flex items-center gap-1 text-xs font-semibold text-[hsl(var(--brand-navy))] hover:underline",children:["Browse all ",e.jsx(ua,{className:"h-3 w-3"})]})]}),ie?null:Gt?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Array.from({length:4}).map((t,a)=>e.jsx(T,{className:"border-border",children:e.jsxs(B,{className:"p-4",children:[e.jsx("div",{className:"h-3 w-20 bg-muted rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-4 w-32 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-3 w-24 bg-muted rounded animate-pulse mt-3"})]})},a))}):st.length===0?e.jsx(T,{className:"border-dashed border-border",children:e.jsx(B,{className:"py-8 text-center text-sm text-muted-foreground",children:"No active roles right now. Check back soon."})}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:st.slice(0,8).map((t,a)=>e.jsx(Nt,{job:t,index:a},t.id))})]})]})})]}),e.jsx(cs,{open:Bt,onOpenChange:z,customMessage:Dt,initialMode:"signup"}),e.jsx(va,{open:Jt,onOpenChange:se,message:Ft,onSendVerification:as,sending:Vt}),e.jsx(Cs,{open:Ot,onOpenChange:pe,children:e.jsxs(Ls,{className:"sm:max-w-md",children:[e.jsxs(As,{className:"items-center text-center",children:[e.jsx("div",{className:"mx-auto w-10 h-10 rounded-full bg-[hsl(var(--brand-cream))] flex items-center justify-center mb-1 border border-[hsl(var(--brand-navy))]/15",children:e.jsx(kt,{className:"h-5 w-5 text-[hsl(var(--brand-navy))]"})}),e.jsx(Es,{children:"Use Invite Link"}),e.jsx(Ps,{children:"Paste the invite link or code you received from an employer."})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Rs,{htmlFor:"practice-invite-code-modal",children:"Invite link or code"}),e.jsx(bt,{id:"practice-invite-code-modal",placeholder:"e.g. slug or http://.../job/company/xxx",value:$e,onChange:t=>{Ye(t.target.value),ge("")},className:"h-12"}),Ke&&e.jsx("p",{className:"text-sm text-destructive",children:Ke})]}),e.jsx(S,{className:"w-full h-12",onClick:rs,disabled:Qe,children:Qe?"Adding…":"Continue"}),e.jsx("button",{type:"button",className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors",onClick:()=>pe(!1),children:"Back to practice"})]})]})})]})};export{Rr as default};

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.