1import{r as d,j as e,aL as B,aV as Qt,aH as Zt}from"./vendor-CkXPoFMb.js";import{i as Kt}from"./vendor-quill-Bo48LKbP.js";import{bU as vt,B as v,c as le,ao as Ee,x as Xt,dK as es,u as ts,al as pt,aA as Ce,g as ht,eg as gt,aB as ft,iz as he,dH as ge,aY as fe,aZ as be,iA as ss,iB as as,b as Ae,cE as rs,bX as ns,ar as is,au as ls,iC as os}from"./index-CR9aNikF.js";import{g as cs}from"./candidateApplicationsService-DWV7nKja.js";import{d as Re,b as bt,k as yt,l as Pe}from"./jobLifecycle-DzFJw_s6.js";import{s as ds}from"./candidateJobAvailability-DQpKy8Uj.js";import{C as ie,A as Le}from"./CandidateLayout-Dw-nINaX.js";import{C as _t}from"./CandidateBreadcrumb-D9xZh8gN.js";import{a as ms}from"./oauthPostLogin-Bp_x4sgc.js";import{L as us}from"./LoadingSpinner-BAckjbJh.js";import{g as xs,p as jt,f as ps,S as hs}from"./rehearsalBroadcast-DBGnHAMW.js";import{B as A}from"./badge-PyECTiJT.js";import{a as kt,b as St,c as Ct,d as At,e as Rt,g as Pt,p as Lt,J as Ie}from"./jobEntryDisplay-DoA8SaGn.js";import{J as Tt}from"./JobEntryCompanyMark-Bk6RklSq.js";import{J as Et}from"./JobCompanyNameLink-CvAev2v6.js";import{J as It}from"./JobDeadlineDisplay-BipFZw4Z.js";import{b as Jt}from"./jobShareMessage-D_tqbGH8.js";import{A as z,aE as Bt,o as Dt,e as X,B as je,az as Je,d as Ot,b as Mt,aI as gs,bf as fs,aJ as bs,M as ys,aR as Te,ay as js,aO as ws,w as Ns}from"./vendor-icons-DPnl4cY3.js";import{S as vs}from"./ShareModal-B7Ej6iZo.js";import{f as _s}from"./behaviouralRehearsalResolve-5B06uLox.js";import"./vendor-datefns-N8mCDnaz.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"./checkbox-Cpm-hLEQ.js";import"./GoogleSignupButton-Bksx481N.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";const ks="Apply for this role on BitStage",wt="Apply for this role on BitStage. Candidates apply free. Complete a short role rehearsal so a recruiter can see how you do the work.";function Nt(t){const n=(t.companyName||"").trim()||"BitStage",u=(t.title||"").trim(),i=u?`${u} at ${n}`:ks;return{title:i,description:wt,ogTitle:i,ogDescription:wt}}function Ss({jobId:t,roleId:n,roleTitle:u,location:i}){const[o,p]=d.useState(!1),[T,D]=d.useState([]),[x,s]=d.useState(!0);return d.useEffect(()=>{},[t,n,u,i]),null}function Ut(t){var u;return((u=t.company_slogan)==null?void 0:u.trim())||null}const qt="/backgrounds/hotel_frontdesk.jpeg";function ye({children:t,onSignIn:n,companyLogoUrl:u,companyName:i,brandHref:o}){const p=!!(u||i);return e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx("header",{className:"border-b border-border bg-white",children:e.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between px-4 sm:px-6 lg:px-8 h-16",children:[p?e.jsxs(B,{to:o||"/",className:"flex items-center gap-2.5",children:[u&&e.jsx("img",{src:u,alt:"","aria-hidden":!0,className:"h-8 w-auto"}),i&&e.jsx("span",{className:"font-bold text-foreground text-sm",children:i})]}):e.jsx(B,{to:"/",className:"flex items-center",children:e.jsx("img",{src:Ee,alt:"BitStage",className:"h-6 w-auto"})}),p?o?e.jsxs(B,{to:o,className:"text-sm font-medium text-primary hover:underline inline-flex items-center gap-1",children:["View all jobs",e.jsx(z,{className:"h-3.5 w-3.5"})]}):null:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"hidden sm:inline text-sm text-muted-foreground",children:"Already have an account?"}),e.jsx(v,{variant:"outline",size:"sm",onClick:n,className:"min-h-11 border-primary/40 text-primary hover:bg-primary hover:text-primary-foreground",children:"Sign in"})]})]})}),e.jsx("div",{className:"flex-1",children:t}),e.jsx("footer",{className:"border-t border-border mt-auto",children:p?e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[u&&e.jsx("img",{src:u,alt:"","aria-hidden":!0,
1className:"h-5 w-auto"}),i&&e.jsx("span",{className:"font-medium text-foreground",children:i})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Powered by"}),e.jsx("img",{src:Ee,alt:"BitStage",className:"h-4 w-auto"})]}),e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(B,{to:"/privacy",className:"inline-flex min-h-11 items-center hover:text-foreground",children:"Privacy Policy"}),e.jsx(B,{to:"/terms",className:"inline-flex min-h-11 items-center hover:text-foreground",children:"Terms of Use"})]})]}):e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-14 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:["© ",new Date().getFullYear()," BitStage. All rights reserved."]}),e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(B,{to:"/privacy",className:"inline-flex min-h-11 items-center hover:text-foreground",children:"Privacy Policy"}),e.jsx(B,{to:"/terms",className:"inline-flex min-h-11 items-center hover:text-foreground",children:"Terms of Use"})]})]})})]})}function Cs({variant:t,children:n}){return t==="required"?e.jsx("span",{className:"shrink-0 rounded-full bg-[#002242] text-white text-xs font-semibold px-2.5 py-0.5 whitespace-nowrap",children:n}):t==="recommended"?e.jsx("span",{className:"shrink-0 rounded-full bg-[#EDF6E1] text-primary text-xs font-semibold px-2.5 py-0.5 whitespace-nowrap",children:n}):t==="optional"?e.jsx("span",{className:"shrink-0 rounded-full bg-muted text-muted-foreground text-xs font-medium px-2.5 py-0.5 whitespace-nowrap",children:n}):e.jsx("span",{className:"shrink-0 rounded-full border border-muted-foreground/40 text-muted-foreground text-xs font-medium px-2.5 py-0.5 whitespace-nowrap",children:n})}function As(t,n){const u=t!=null&&Number.isFinite(t)&&t>0?Math.round(t):60;return[...n?[{title:"Eligibility questions",badges:[{label:"Required",variant:"required"}],desc:"A few yes or no questions for this role.",tone:"required"}]:[],{title:"Your resume",badges:[{label:"Required",variant:"required"}],desc:"We score it against this role and show you the result.",tone:"required"},{title:`AI rehearsal, about ${u} seconds`,badges:[{label:"Required",variant:"required"}],desc:"One scenario, in your own words. This is how you stand out.",tone:"required"},{title:"Screening call",badges:[{label:"If shortlisted",variant:"conditional"}],desc:"A short call with a BitStage recruiter.",tone:"later"}].map((o,p)=>({...o,num:p+1}))}const Rs={required:"bg-[#002242] text-white",later:"bg-gray-400 text-white"};function $t({isOpen:t,submitting:n,onStart:u,shareUrl:i,shareText:o,shareSubject:p,ctaLabel:T="Start your application",rehearsalDurationSeconds:D,hasEligibilityQuestions:x=!1}){const s=As(D??null,!!x),F=[{icon:gs,label:"Share via LinkedIn",href:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(i)}`},{icon:fs,label:"Share via X",href:`https://x.com/intent/tweet?url=${encodeURIComponent(i)}&text=${encodeURIComponent(o||"")}`},{icon:bs,label:"Share via Facebook",href:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(i)}`},{icon:ys,label:"Share via Email",href:`mailto:?subject=${encodeURIComponent(p||"")}&body=${encodeURIComponent(i)}`}];return e.jsxs("div",{className:"rounded-xl border border-border bg-white shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"mb-5",children:[e.jsxs("span",{className:"inline-flex items-center rounded-full bg-[#EDF6E1] text-primary text-xs font-semibold px-2.5 py-1 mb-3",children:[s.length," steps"]}),e.jsx("h3",{className:"text-2xl font-bold text-foreground",children:"How to apply"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:[s.filter(h=>h.tone==="required").length," required",s.some(h=>h.tone==="later")?", one if you are shortlisted":"","."]})]}),e.jsx("ol",{className:"relative",children:s.map((h,O)=>{const Q=O===s.length-1;return e.jsxs("li",{className:"relative flex gap-3 pb-5 last:pb-0",children:[!Q&&e.jsx("span",{"aria-hidden":!0,
1className:"absolute left-[13px] top-7 bottom-0 w-0.5 bg-border"}),e.jsx("span",{className:le("relative z-10 h-7 w-7 shrink-0 rounded-full flex items-center justify-center text-xs font-bold",Rs[h.tone]),"aria-hidden":!0,children:h.num}),e.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsxs("p",{className:"text-sm font-semibold text-foreground",children:[e.jsx("span",{className:"sr-only",children:`Step ${h.num}: `}),h.title]}),h.badges.map(R=>e.jsx(Cs,{variant:R.variant,children:R.label},R.label))]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:h.desc})]})]},h.num)})}),t&&e.jsxs(v,{className:"w-full mt-4 h-12 gap-2",onClick:u,disabled:n,children:[n?"Opening your applicationâ¦":T,!n&&e.jsx(z,{className:"h-4 w-4"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-start gap-1.5 mt-3",children:[e.jsx(Je,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),e.jsx("span",{children:"Steps 1 and 2 take about five minutes. You then have 48 hours to finish the rehearsal."})]})]}),e.jsxs("div",{className:"border-t border-border px-6 py-5",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground mb-3",children:"Share this role"}),e.jsx("div",{className:"flex items-center gap-3",children:F.map(h=>e.jsx("a",{href:h.href,target:"_blank",rel:"noopener noreferrer","aria-label":h.label,className:"h-10 w-10 rounded-lg border border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:border-foreground
1/40 transition",children:e.jsx(h.icon,{className:"h-4 w-4"})},h.label))})]})]})}function Ps({job:t,isOpen:n,submitting:u,closedBannerMessage:i,closedBannerTitle:o,onStart:p,onSignIn:T,showHeroBanner:D=!0}){var k,P,$,G,S,Y;const[x,s]=d.useState(!1),[F,h]=d.useState(!1),[O,Q]=d.useState([]),[R,y]=d.useState(!0),g=!!t.is_confidential,f=g?"Hiring via BitStage":t.org_name,_=vt({isConfidential:g,isPubliclyListed:t.is_publicly_listed,orgName:t.org_name,orgShortId:t.org_short_id}),E=kt(t.employment_type),U=St(t.work_mode),q=Ct(t.experience_range),w=At({currency:t.salary_currency,min:t.salary_min,max:t.salary_max}),Z=Array.isArray(t.skills)?t.skills:[],se=Rt(t),ee=Pt(t),j=Lt(t.description),C=d.useMemo(()=>{const c=t.global_link_url||t.primary_link_url||(typeof window<"u"?window.location.href:"");if(!c)return null;const M=Jt({title:t.title,description:t.description,companyName:g?null:t.org_name,location:t.location,url:c});return{title:"Share this role",description:"Share the hiring link with your network.",url:c,text:M.full,shortText:M.short,subject:M.subject}},[t.global_link_url,t.primary_link_url,t.title,t.description,t.org_name,t.location,g]),K=(C==null?void 0:C.url)||(typeof window<"u"?window.location.href:"");d.useEffect(()=>{{y(!1),Q([]);return}},[t.id,t.role_id,t.role_title,t.location]),F||O.slice(0,3),(k=t.location)!=null&&k.trim();const H=((P=t.company_background_image_url)==null?void 0:P.trim())||qt,I=t.company_background_image_url?`${f} workplace`:"",N=Ut(t);return e.jsxs(ye,{onSignIn:T,companyLogoUrl:g?null:t.company_logo_url,companyName:g?null:f,brandHref:g?null:_,children:[D?e.jsxs("section",{"data-testid":"hero-banner-section",className:"relative overflow-hidden min-h-[320px] lg:min-h-[380px]",children:[e.jsx("img",{src:H,alt:I,"aria-hidden":I?void 0:!0,className:"absolute inset-0 z-0 h-full w-full object-cover"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 z-[1]","aria-hidden":!0,style:{background:"linear-gradient(90deg, rgba(0, 34, 66, 0.88) 0%, rgba(0, 34, 66, 0.78) 42%, rgba(0, 34, 66, 0.35) 62%, rgba(0, 34, 66, 0.08) 78%, rgba(0, 34, 66, 0) 100%)"}}),e.jsx("div",{className:"relative z-[2] mx-auto flex min-h-[320px] max-w-7xl items-center px-6 py-10 sm:px-8 lg:min-h-[380px] lg:px-12 lg:py-14",children:e.jsxs("div",{className:"w-full max-w-xl lg:max-w-lg",children:[e.jsx("div",{className:"mb-5",children:n?E?e.jsx(A,{className:"rounded-full border-0 bg-primary px-3 py-1 text-xs font-bold uppercase tracking-wide text-primary-foreground",children:E}):null:e.jsx(A,{variant:"secondary",className:"rounded-full px-3 py-1 text-xs font-bold uppercase tracking-wide",children:"Closed"})}),e.jsx("h1",{className:"mb-4 font-display text-3xl font-bold leading-tight tracking-tight text-white sm:text-4xl lg:text-5xl",children:t.title}),N?e.jsx("p",{className:"mb-6 max-w-md text-sm leading-relaxed text-white/85",children:N}):null,n?e.jsxs(v,{className:"gap-2 bg-primary px-6 font-semibold text-primary-foreground hover:bg-primary/90",onClick:p,disabled:u,children:[u?"Openingâ¦":"Start your application",!u&&e.jsx(z,{className:"h-4 w-4"})]}):null]})})]}):null,e.jsx("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 lg:py-10",children:e.jsxs("div",{className:"grid grid-cols-1 items-start gap-6 lg:grid-cols-3 lg:gap-10",children:[e.jsxs("div",{className:"min-w-0 space-y-8 lg:col-span-2",children:[!D&&e.jsxs("div",{children:[n?E?e.jsx(A,{className:"rounded-full border-0 bg-primary px-3 py-1 text-xs font-bold uppercase tracking-wide text-primary-foreground mb-3",children:E}):null:e.jsx(A,{variant:"secondary",className:"rounded-full px-3 py-1 text-xs font-bold uppercase tracking-wide mb-3",children:"Closed"}),e.jsx("h1",{className:"font-display text-3xl sm:text-4xl font-bold text-foreground tracking-tight leading-tight mt-3 mb-4",children:t.title}),e.jsxs(Et,{href:g?null:_,children:[e.jsx(Tt,{isConfidential:g,companyLogoUrl:g?void 0:t.company_logo_url,companyName:f}),e.jsx("span",{className:"font-semibold text-foreground",children:f})]}),N?e.jsx("p",{className:"mt-3 max-w-md text-sm leading-relaxed text-muted-foreground",children:N}):null]}),e.jsxs("div",{className:"grid grid-cols-1 gap-5 border-b border-border pb-6 sm:grid-cols-2 sm:gap-6",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(Bt,{className:"mt-0.5 h-5 w-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-0.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Location"}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:se}),U?e.jsx("p",{className:"text-xs text-muted-foreground",children:U}):null]})]}),e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(Dt,{className:"mt-0.5 h-5 w-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-0.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Applications close"}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:e.jsx(It,{deadlineStr:ee,expired:!n})})]})]}),E?e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(X,{className:"mt-0.5 h-5 w-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-0.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Employment type"}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:E})]})]}):null,($=t.department)!=null&&$.trim()?e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(je,{className:"mt-0.5 h-5 w-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-0.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Department"}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:t.department.trim()})]})]}):null,q?e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(Je,{className:"mt-0.5 h-5 w-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-0.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Experience"}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:q})]})]}):null,w?e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(X,{className:"mt-0.5 h-5 w-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-0.5 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Salary"}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:w})]})]}):null]}),Z.length>0?e.jsx("div",{className:"flex flex-wrap gap-2 border-b border-border pb-6",children:Z.map(c=>e.jsx(A,{variant:"secondary",className:"font-normal",children:c.name},c.id))}):null,e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-xl font-bold text-foreground",children:"About the role"}),e.jsxs("div",{className:le("relative min-w-0 max-w-full overflow-x-hidden break-words",!x&&"max-h-48 overflow-hidden"),children:[e.jsx(Ie,{text:j,className:"break-words [&_*]:max-w-full [&_*]:break-words",emptyText:"No description provided."}),!x&&j.trim().length>0?e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-background to-transparent"}):null]}),j.trim().length>0?e.jsxs("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-2 inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline",children:[x?"Collapse":"Read full description",x?e.jsx(Ot,{className:"h-4 w-4"}):e.jsx(Mt,{className:"h-4 w-4"})]}):null]}),i&&e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",role:"status",children:[o&&e.jsx("p",{className:"mb-1.5 font-semibold leading-none",children:o}),e.jsx("p",{children:i})]}),null]}),e.jsx("aside",{className:"lg:sticky lg:top-6 lg:self-start",children:e.jsx($t,{isOpen:n,submitting:u,onStart:p,shareUrl:K,shareText:C==null?void 0:C.shortText,shareSubject:C==null?void 0:C.subject,rehearsalDurationSeconds:((G=t.selected_rehearsal)==null?void 0:G.target_interaction_seconds)??((Y=(S=t.enabled_rehearsals)==null?void 0:S[0])==null?void 0:Y.target_interaction_seconds)??null,hasEligibilityQuestions:t.has_eligibility_questions})})]})})]})}function Ls({job:t,isOpen:n,submitting:u,statusLabel:i,closedBannerMessage:o,closedBannerTitle:p,alreadyApplied:T=!1,startLabel:D="Start your application",showHeroBanner:x=!1,onStart:s,onShare:F}){var P,$,G,S,Y;
1const[h,O]=d.useState(!1),[Q,R]=d.useState(!1),y=!!t.is_confidential,g=y?"Hiring via BitStage":t.org_name,f=vt({isConfidential:y,isPubliclyListed:t.is_publicly_listed,orgName:t.org_name,orgShortId:t.org_short_id}),_=kt(t.employment_type),E=St(t.work_mode),U=Ct(t.experience_range),q=At({currency:t.salary_currency,min:t.salary_min,max:t.salary_max}),w=Array.isArray(t.skills)?t.skills:[],Z=Rt(t),se=Pt(t),ee=Lt(t.description),j=d.useMemo(()=>{const c=t.global_link_url||t.primary_link_url||(typeof window<"u"?window.location.href:"");if(!c)return null;const M=Jt({title:t.title,description:t.description,companyName:y?null:t.org_name,location:t.location,url:c});return{title:"Share this role",description:"Share the hiring link with your network.",url:c,text:M.full,shortText:M.short,subject:M.subject}},[t.global_link_url,t.primary_link_url,t.title,t.description,t.org_name,t.location,y]),C=(j==null?void 0:j.url)||(typeof window<"u"?window.location.href:""),K=()=>{if(F){F();return}R(!0)},H=((P=t.company_background_image_url)==null?void 0:P.trim())||qt,I=t.company_background_image_url?`${g} workplace`:"",N=Ut(t),k=x?e.jsxs("section",{className:"relative overflow-hidden min-h-[280px] lg:min-h-[340px]",children:[e.jsx("img",{src:H,alt:I,"aria-hidden":I?void 0:!0,className:"absolute inset-0 z-0 h-full w-full object-cover"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 z-[1]","aria-hidden":!0,style:{background:"linear-gradient(90deg, rgba(0, 34, 66, 0.88) 0%, rgba(0, 34, 66, 0.78) 42%, rgba(0, 34, 66, 0.35) 62%, rgba(0, 34, 66, 0.08) 78%, rgba(0, 34, 66, 0) 100%)"}}),e.jsx("div",{className:"relative z-[2] mx-auto flex min-h-[280px] max-w-7xl items-center px-6 py-8 sm:px-8 lg:min-h-[340px] lg:px-12 lg:py-12",children:e.jsxs("div",{className:"w-full max-w-xl lg:max-w-lg",children:[e.jsx("div",{className:"mb-4",children:n?_?e.jsx(A,{className:"rounded-full border-0 bg-primary px-3 py-1 text-xs font-bold uppercase tracking-wide text-primary-foreground",children:_}):null:e.jsx(A,{variant:"secondary",className:"rounded-full px-3 py-1 text-xs font-bold uppercase tracking-wide",children:"Closed"})}),e.jsx("h2",{className:"mb-3 font-display text-2xl font-bold leading-tight tracking-tight text-white sm:text-3xl lg:text-4xl",children:t.title}),N&&e.jsx("p",{className:"mb-5 max-w-md text-sm leading-relaxed text-white/85",children:N}),n&&e.jsxs(v,{className:"gap-2 bg-primary px-6 font-semibold text-primary-foreground hover:bg-primary/90",onClick:s,disabled:u,children:[u?"Openingâ¦":D,!u&&e.jsx(z,{className:"h-4 w-4"})]})]})})]}):void 0;return e.jsxs(ie,{layout:"job-entry",topSlot:k,children:[e.jsx(_t,{items:[{label:"My Profile",to:"/candidate/profile"},{label:"Applications",to:"/applications"},{label:t.title}]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 lg:gap-10",children:[e.jsxs("div",{className:"lg:col-span-2 min-w-0 space-y-8",children:[x?f?e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs(B,{to:f,className:"inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline",children:["View all jobs at ",g,e.jsx(z,{className:"h-3.5 w-3.5"})]}),e.jsxs("button",{type:"button",onClick:K,"aria-label":"Share",className:"flex flex-col items-center gap-1 text-muted-foreground hover:text-foreground transition shrink-0",children:[e.jsx("span",{className:"h-11 w-11 rounded-full border border-border flex items-center justify-center",children:e.jsx(Te,{className:"h-5 w-5"})}),e.jsx("span",{className:"text-xs",children:"Share"})]})]}):e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{type:"button",onClick:K,"aria-label":"Share",className:"flex flex-col items-center gap-1 text-muted-foreground hover:text-foreground transition shrink-0",children:[e.jsx("span",{className:"h-11 w-11 rounded-full border border-border flex items-center justify-center",children:e.jsx(Te,{className:"h-5 w-5"})}),e.jsx("span",{className:"text-xs",children:"Share"})]})}):e.jsxs("div",{children:[i?e.jsxs(A,{variant:"secondary",className:"bg-green-50 text-primary border-primary/20 rounded-full mb-3 gap-1.5 font-medium",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary"}),i]}):n?_?e.jsx(A,{className:"bg-primary text-primary-foreground rounded-full text-xs font-bold uppercase tracking-wide px-3 py-1 border-0 mb-3",children:_}):null:e.jsx(A,{variant:"secondary",className:"rounded-full text-xs font-bold uppercase tracking-wide px-3 py-1 mb-3",children:"Closed"}),e.jsx("h1",{className:"font-display text-3xl sm:text-4xl font-bold text-foreground tracking-tight leading-tight mt-3 mb-4",children:t.title}),e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 space-y-1.5",children:[e.jsxs(Et,{href:f,children:[e.jsx(Tt,{isConfidential:y,companyLogoUrl:t.company_logo_url,companyName:g}),e.jsx("span",{className:"font-semibold text-foreground",children:g})]}),f?e.jsxs(B,{to:f,className:"inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline",children:["View all jobs",e.jsx(z,{className:"h-3.5 w-3.5"})]}):null]}),e.jsxs("button",{type:"button",onClick:K,"aria-label":"Share",className:"flex flex-col items-center gap-1 text-muted-foreground hover:text-foreground transition shrink-0",children:[e.jsx("span",{className:"h-11 w-11 rounded-full border border-border flex items-center justify-center",children:e.jsx(Te,{className:"h-5 w-5"})}),e.jsx("span",{className:"text-xs",children:"Share"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 py-4 border-y border-border",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Bt,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide mb-0.5",children:"Location"}),e.jsx("p",{className:"text-sm text-foreground font-semibold",children:Z}),E?e.jsx("p",{className:"text-xs text-muted-foreground",children:E}):null]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Dt,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide mb-0.5",children:"Applications close"}),e.jsx("p",{className:"text-sm text-foreground font-semibold",children:e.jsx(It,{deadlineStr:se,expired:!n})})]})]}),_?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(X,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide mb-0.5",children:"Employment type"}),e.jsx("p",{className:"text-sm text-foreground font-semibold",children:_})]})]}):null,($=t.department)!=null&&$.trim()?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(je,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide mb-0.5",children:"Department"}),e.jsx("p",{className:"text-sm text-foreground font-semibold",children:t.department.trim()})]})]}):null,U?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide mb-0.5",children:"Experience"}),e.jsx("p",{className:"text-sm text-foreground font-semibold",children:U})]})]}):null,q?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(X,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wide mb-0.5",children:"Salary"}),e.jsx("p",{className:"text-sm text-foreground font-semibold",children:q})]})]}):null]}),w.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(c=>e.jsx(A,{variant:"secondary",className:"font-normal",children:c.name},c.id))}):null,e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-xl font-bold text-foreground",children:"About the role"}),e.jsxs("div",{className:le("relative min-w-0 max-w-full overflow-x-hidden break-words",!h&&"max-h-48 overflow-hidden"),children:[e.jsx(Ie,{text:ee,className:"break-words [&_*]:max-w-full [&_*]:break-words",emptyText:"No description provided."}),!h&&ee.trim().length>0?e.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-background to-transparent"}):null]}),ee.trim().length>0?e.jsxs("button",{type:"button",onClick:()=>O(c=>!c),className:"mt-2 inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline",children:[h?"Collapse":"Read full description",h?e.jsx(Ot,{className:"h-4 w-4"}):e.jsx(Mt,{className:"h-4 w-4"})]}):null]}),o&&e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",role:"status",children:[p&&e.jsx("p",{className:"font-semibold leading-none mb-1.5",children:p}),e.jsx("p",{children:o})]}),e.jsx(Ss,{jobId:t.id,roleId:t.role_id,roleTitle:t.role_title,location:t.location})]}),e.jsx("aside",{className:"lg:sticky lg:top-6 lg:self-start",children:e.jsx($t,{isOpen:n,submitting:u,onStart:s,ctaLabel:T?D:"Start your application",shareUrl:C,shareText:j==null?void 0:j.shortText,shareSubject:j==null?void 0:j.subject,rehearsalDurationSeconds:((G=t.selected_rehearsal)==null?void 0:G.target_interaction_seconds)??((Y=(S=t.enabled_rehearsals)==null?void 0:S[0])==null?void 0:Y.target_interaction_seconds)??null,hasEligibilityQuestions:t.has_eligibility_questions})})]}),e.jsx(vs,{open:Q,onOpenChange:R,payload:j,pasteBeforeSocialOpen:!0})]})}function Ts(t){if(!t)return null;const n=new Date(t),u=new Date,i=n.getTime()-u.getTime(),o=Math.ceil(i/(1e3*60*60*24));return o<0?"Closed":o===0?"Due today":o===1?"1 day left":`${o} days left`}function Es(t){return/<\/?[a-z][\s\S]*>/i.test(t)}function fa({legacyRootJobPath:t=!1}){var Ke,Xe,et;const{slug:n,companyName:u}=Qt(),i=Zt(),{user:o,loading:p}=Xt(),{session:T,loading:D}=es(),{toast:x}=ts(),[s,F]=d.useState(null),[h,O]=d.useState(!0),[Q,R]=d.useState(!1),[y,g]=d.useState(null),[f,_]=d.useState(null),[E,U]=d.use
1State(!1),[q,w]=d.useState(!1),[Z,se]=d.useState(0),[ee,j]=d.useState(0),[C,K]=d.useState(null),H=d.useRef(!0),I=d.useRef(0),N=d.useRef(null);d.useRef(!1);const k=d.useRef(!1),P=pt.get("user_data"),$=pt.get("user_profile"),G=String((P==null?void 0:P.user_role)||($==null?void 0:$.role)||(o==null?void 0:o.role)||"").toUpperCase(),S=G==="CANDIDATE",Y=!!G&&!S,c=!!o&&(!S||!!T),M=(o==null?void 0:o.org_id)??(T==null?void 0:T.org_id)??(P==null?void 0:P.org_id)??null;d.useEffect(()=>{if(!o||!S||!(s!=null&&s.id)||c){U(!1);return}let a=!1;return cs().then(m=>{if(a)return;const l=m.some(b=>String(b.job_id)===String(s.id));U(l)}).catch(()=>{a||U(!1)}),()=>{a=!0}},[o,S,s==null?void 0:s.id,c]);const V=E||!!(s!=null&&s.already_applied);d.useEffect(()=>()=>{H.current=!1,N.current&&N.current.abort()},[]);const oe=d.useRef(null);d.useEffect(()=>{if(console.log("[JobPublicPage] useEffect triggered:",{slug:n,authLoading:p,hasFetched:oe.current,navigating:k.current}),!n){O(!1),R(!1),g("Invalid link");return}if(k.current){console.log("[JobPublicPage] Navigating away, skipping fetch");return}if(p){console.log("[JobPublicPage] Waiting for auth to load...");return}if(oe.current===n&&Z===0){console.log("[JobPublicPage] Already fetched for this slug, skipping");return}let a,m=!1;N.current&&N.current.abort();const l=new AbortController;N.current=l,s||(O(!0),R(!1)),g(null),_(null),I.current=Date.now(),j(0),a=setInterval(()=>{if(I.current>0){const r=Math.floor((Date.now()-I.current)/1e3);j(r)}},1e3);const b=!p&&!!o;return console.log("[JobPublicPage] Fetching job, sendAuth:",b),Ce.getJobBySlug(n,{sendAuth:b,skipLogout:!0,signal:l.signal,companySlug:u??null}).then(r=>{if(m){console.log("[JobPublicPage] Request cancelled, ignoring response");return}if(!H.current){console.log("[JobPublicPage] Component unmounted, ignoring response");return}console.log("[JobPublicPage] Received data:",r),r&&typeof r=="object"&&r!==null&&"id"in r&&"title"in r?(console.log("[JobPublicPage] Valid job data, setting job state"),oe.current=n,F(r),g(null)):(console.warn("[JobPublicPage] Invalid job data structure:",r),r!==null&&g("Invalid role data"))}).catch(r=>{var st,at,rt,nt,it,lt,ot,ct,dt,mt,ut;if(m){console.log("[JobPublicPage] Request cancelled, ignoring error");return}if(!H.current){console.log("[JobPublicPage] Component unmounted, ignoring error");return}console.error("[JobPublicPage] Error loading job:",r);const J=ht(r),L=(r==null?void 0:r.message)||"",pe=J.type||((st=r==null?void 0:r.normalized)==null?void 0:st.type)||(r==null?void 0:r.type)||"",ke=J.httpStatus||((at=r==null?void 0:r.normalized)==null?void 0:at.httpStatus)||(r==null?void 0:r.httpStatus)||0,Se=(rt=J.serverMessage)==null?void 0:rt.trim(),Wt=((ot=(it=(nt=J.responseBody)==null?void 0:nt.job_status)==null?void 0:(lt=it.toString()).toLowerCase)==null?void 0:ot.call(lt))||((ut=(dt=(ct=J.responseBody)==null?void 0:ct.status)==null?void 0:(mt=dt.toString()).toLowerCase)==null?void 0:ut.call(mt))||"";if(console.log("[JobPublicPage] Error details:",{errorMessage:L,errorType:pe,httpStatus:ke}),pe==="TIMEOUT"||L.includes("TIMEOUT")){console.log("[JobPublicPage] Request timed out - possible slow connection"),g("The request took too long. Please check your connection and try again.");return}const tt=Re(Se,Wt);if(tt){g(tt.message);return}if(ke===401||pe==="UNAUTHORIZED"||L==="API Error: UNAUTHORIZED"||L.toLowerCase().includes("unauthorized")||L.toLowerCase().includes("login required")||L.toLowerCase().includes("token")||ke===403&&(L.toLowerCase().includes("forbidden")||L.toLowerCase().includes("authentication")||!Se))console.log("[JobPublicPage] Setting error to LOGIN_REQUIRED"),g("LOGIN_REQUIRED");else{const xt=Se||L||"Failed to load role";console.log("[JobPublicPage] Setting error:",xt),g(xt)}}).finally(()=>{a&&clearInterval(a),I.current=0,!m&&H.current&&(console.log("[JobPublicPage] Request completed, setting loading to false"),O(!1),R(!0))}),()=>{console.log("[JobPublicPage] Cleanup: cancelling request"),m=!0,a&&clearInterval(a),I.current=0,N.current&&N.current.abort()}},[n,p,Z]),d.useEffect(()=>{if(!s||!n)return;
1const a=window.location.pathname,m=a.split("/").filter(Boolean);if(!(t||m[0]==="job"&&m.length===2))return;const b=window.location.search;let r=null;if(s.primary_link_url)try{const J=new URL(s.primary_link_url,window.location.origin).pathname;/^\/job\/[^/]/.test(J)&&(r=J)}catch{r=null}r||(r=new URL(gt(s.primary_link_slug||n,s.org_name),window.location.origin).pathname),r&&r!==a&&i(`${r}${b}`,{replace:!0})},[s,n,t,i]);const zt=()=>{console.log("[JobPublicPage] Manual retry triggered"),oe.current=null,R(!1),se(a=>a+1)},[ce,Be]=d.useState(!1),[De,Oe]=d.useState(!1),Me=!c&&(p||!o),Ft=k.current||!Q||h||p||c&&D,Ue=a=>{const m=ht(a),l=m.responseBody;return Re(m.serverMessage??(l==null?void 0:l.detail),(l==null?void 0:l.job_status)??(l==null?void 0:l.status),l==null?void 0:l.code)},qe=a=>{x({title:a.title,description:a.message,variant:"destructive"})},ae=d.useCallback(async()=>{if(!n||k.current)return;k.current=!0;const a=!y||y!=="LOGIN_REQUIRED",m=s!=null&&s.id?`/applications/${s.id}`:`/applications/${n}`;if(V){i(m,{replace:!0});return}try{await Ce.postJobEntry(n,{skipLogout:!0,companySlug:u??null}
1),a?(x({title:"Application started",description:"Opening your application."}),i(m,{replace:!0})):(x({title:"Role added",description:"Opening application."}),i(m,{replace:!0}))}catch(l){const b=ft(l);if(b)x({title:b,description:"Opening your application.",variant:"default"}),i(m,{replace:!0});else{const r=Ue(l);r?(_(r),k.current=!1,x({title:r.title,description:r.message,variant:"destructive"})):(k.current=!1,x({title:"Couldn't open your application",description:"Please refresh and try again. If it keeps failing, this role may have just closed.",variant:"destructive"}))}}},[n,y,s==null?void 0:s.id,u,i,x,V]);d.useEffect(()=>{p||!o||!S||!n||!s||c||k.current||ms()&&ae()},[p,o,S,n,s,c,ae]);const we=async()=>{if(!n||!s)return;if(!o){try{sessionStorage.setItem("bitstage_oauth_resume_job_apply","1")}catch{}w(!0);return}const a=`/applications/${s.id}`;if(V){i(a,{replace:!0});return}const m=f??(bt(s.closes_at)?Pe():null);if(m||!yt(s)){const l=m??Pe();_(l),qe(l);return}Be(!0);try{await Ce.postJobEntry(n,{skipLogout:!0,companySlug:u??null}),x({title:"Application started",description:"Opening your application."}),i(a,{replace:!0})}catch(l){const b=ft(l);if(b)x({title:b,description:"Opening your application.",variant:"default"}),i(a,{replace:!0});else{const r=Ue(l);r?(_(r),qe(r)):x({title:"Couldn't open your application",description:"Please refresh and try again. If it keeps failing, this role may have just closed.",variant:"destructive"})}}finally{Be(!1)}},$e=async()=>{if(!n||!s)return;const a=s.selected_rehearsal||_s(s.enabled_rehearsals);if(!a){x({title:"Practice rehearsal isn't available for this role",description:"You can still start your application.",variant:"destructive"});return}Oe(!0);let m=!1;try{o||await ns(!0);const l=xs(),b=await jt(l),r=ps(l);if(b.active||r){x({title:"Rehearsal in progress",description:"Finish or close your other rehearsal tab, then try again.",variant:"destructive"});return}const J=await is({hiring_link_slug:n,rehearsal_id:a.id,is_practice:!0},async()=>!(await jt(l)).active),L=J.attempt_id??J.id;if(!L)throw new Error("Attempt was created but no attempt ID was returned.");m=!0,i(hs,{state:{fromInvite:!0,fromRealApi:!0,fromPractice:!0,attemptId:L,inviteSlug:n,rehearsalId:a.id,rehearsalTitle:a.title,rehearsalStageKey:"rehearsal_1"}})}catch(l){const{title:b,description:r}=ls(l);x({title:b,description:r,variant:"destructive"})}finally{m||Oe(!1)}};if(Ft){const a=e.jsx(us,{message:k.current?"Setting up your applicationâ¦":"Loading role detailsâ¦"});return c||p&&Y?e.jsx(he,{children:e.jsx(ge,{children:a})}):Me?e.jsx(ye,{onSignIn:()=>w(!0),children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16",children:a})}):o&&S?e.jsx(ie,{layout:"job-entry",children:e.jsx("div",{className:"py-10",children:a})}):e.jsx(ie,{pageTitle:"Role",maxWidth:"max-w-4xl",children:a})}if(y||!s){if(y==="LOGIN_REQUIRED"&&n)return c?e.jsx(he,{children:e.jsx(ge,{children:e.jsx("div",{className:"max-w-2xl mx-auto px-4 py-10",children:e.jsx(fe,{children:e.jsxs(be,{className:"pt-6 text-center space-y-4",children:[e.jsx("h1",{className:"font-display text-xl font-bold text-foreground",children:"Could not load this role preview"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Please open this role from the Roles page, or try again in a moment."}),e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(v,{onClick:()=>i("/client/jobs"),className:"w-full sm:w-auto",children:"Go to Roles"})})]})})})})}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{onSignIn:()=>w(!0),children:e.jsx("div",{className:"max-w-2xl mx-auto px-4 py-10",children:e.jsx(fe,{children:e.jsxs(be,{className:"pt-6 text-center space-y-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-[hsl(var(--brand-cream))] flex items-center justify-center mx-auto mb-2",children:e.jsx(X,{className:"w-8 h-8 text-[hsl(var(--brand-navy))]"})}),e.jsx("h1",{className:"font-display text-xl font-bold text-foreground",children:"Sign in to view this role"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"This role requires you to be signed in to view the details and start your application."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center pt-2",children:[e.jsx(B,{to:"/",className:"w-full sm:w-auto",children:e.jsx(v,{variant:"outline",className:"w-full sm:w-auto",children:"Back to home"})}),e.jsxs(v,{onClick:()=>w(!0),className:"w-full sm:w-auto",children:["Sign in to continue",e.jsx(z,{className:"h-4 w-4 ml-2"})]})]})]})})})}),e.jsx(Le,{open:q,onOpenChange:w,onSuccess:ae})]});const a=Re(y,null),m=(a==null?void 0:a.kind)==="paused",l=(a==null?void 0:a.kind)==="closed",b=(a==null?void 0:a.kind)==="deadline_ended",r=e.jsx("div",{className:"max-w-2xl mx-auto px-4 py-10",children:e.jsx(fe,{children:e.jsxs(be,{className:"pt-7 pb-7 text-center",children:[e.jsx("div",{className:`mx-auto mb-4 w-14 h-14 roun
1ded-full flex items-center justify-center ${m?"bg-amber-50 text-amber-600 border border-amber-200":"bg-muted text-muted-foreground"}`,children:e.jsx(X,{className:"h-7 w-7"})}),e.jsx("h1",{className:"font-display text-xl font-bold text-foreground mb-2",children:m?"Applications are paused right now":b?(a==null?void 0:a.title)??"Role deadline ended":l?(a==null?void 0:a.title)??"This role is closed":c?"Role preview unavailable":"Role not found"}),e.jsx("p",{className:"text-muted-foreground text-sm mb-5 leading-relaxed",children:(a==null?void 0:a.message)||y||"This role link may be invalid or expired."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[c?e.jsx(v,{onClick:()=>i("/client/jobs"),className:"w-full sm:w-auto",children:"Go to Roles"}):e.jsx(B,{to:"/",className:"w-full sm:w-auto",children:e.jsx(v,{variant:"outline",className:"w-full sm:w-auto",children:"Back to home"})}),y&&(y.includes("took too long")||y.includes("timeout")||y.includes("connection"))&&e.jsxs(v,{onClick:zt,className:"gap-2 w-full sm:w-auto",children:[e.jsx(js,{className:"h-4 w-4"}),"Try again"]})]})]})})});return c||p&&Y?e.jsx(he,{children:e.jsx(ge,{children:r})}):Me?e.jsx(ye,{onSignIn:()=>w(!0),children:r}):e.jsx(ie,{pageTitle:"Role",maxWidth:"max-w-4xl",children:r})}const ze=s.application_closes_at??s.closes_at??s.job_availability_closes_at??null;Ts(ze);const Ht=bt(ze),Fe=((Ke=s.enabled_rehearsals)==null?void 0:Ke.length)??0,He=yt(s)&&!f,Ne=He||V,Ge=V?"Continue application":"Start your application",te=(f==null?void 0:f.kind)==="deadline_ended"?f:Ht?Pe():null,Ye=(te==null?void 0:te.message)??(f==null?void 0:f.message)??(!s.is_open||s.status!=="active"?"This job is closed and is not accepting new applications.":null),Gt=(te==null?void 0:te.title)??(f?f.title:null),Ve=ds({jobClosed:!!Ye,hasApplication:V}),de=Ve?Ye:null,re=Ve?Gt:null,me=s.primary_link_url||(typeof window<"u"?ss(null,s.primary_link_slug||n||"",s.org_name):gt(s.primary_link_slug||n||"",s.org_name)),We=!!(s.org_id&&M&&String(s.org_id)===String(M)),Qe=!s.is_confidential&&!!((Xe=s.company_background_image_url)!=null&&Xe.trim()),ne=!c&&s.is_confidential?as:s.org_name,ue=!c&&s.is_confidential?void 0:s.company_logo_url||void 0,xe=Nt({title:s.title,companyName:ne,description:s.description}),ve=os("/job"),_e="A candidate part-way through a BitStage role rehearsal.",Yt=async()=>{try{await navigator.clipboard.writeText(me),x({title:"Candidate link copied",description:"Share this URL with candidates."})}catch{x({title:"Copy failed",description:"Please copy the link manually.",variant:"destructive"})}},Ze=e.jsxs(e.Fragment,{children:[e.jsx(Ae,{title:xe.title,description:xe.description,ogTitle:xe.ogTitle,ogDescription:xe.ogDescription,image:ve,imageAlt:_e,url:me,type:"article",structuredData:{"@context":"https://schema.org","@type":"JobPosting",title:s.title,description:s.description||`Apply for ${s.title} at ${ne}.`,datePosted:s.created_at||new Date().toISOString(),validThrough:s.closes_at?new Date(s.closes_at).toISOString():void 0,hiringOrganization:{"@type":"Organization",name:ne,logo:ue},jobLocation:{"@type":"Place",address:{"@type":"PostalAddress",addressLocality:s.location||"Remote"}},employmentType:"FULL_TIME"}}),c&&e.jsxs("div",{className:"mb-6 rounded-xl border border-[hsl(var(--brand-navy))]/25 bg-[hsl(var(--brand-navy))]/5 px-4 py-4",role:"status",children:[e.jsx("p",{className:"font-semibold text-foreground mb-1",children:"You're viewing as an employer"}),e.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed mb-3",children:["This is the candidate-facing role page. Candidates see an Apply button here - you won't apply from your employer account.",We?" Use the actions below to manage this role or copy the link for applicants.":" Copy the link below to share with candidates."]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[We&&s.id?e.jsxs(v,{className:"gap-2",onClick:()=>i(`/client/jobs/${s.id}`),children:[e.jsx(X,{className:"h-4 w-4"}),"Manage role"]}):e.jsx(v,{variant:"outline",className:"gap-2",onClick:()=>i("/client/jobs"),children:"Go to Roles"}),e.jsxs(v,{variant:"outline",className:"gap-2",onClick:()=>void Yt(),children:[e.jsx(ws,{className:"h-4 w-4"}),"Copy candidate link"]})]})]}),!c&&e.jsx(_t,{items:[{label:"My Profile",to:"/profile"},{label:"Applications",to:"/applications"},{label:"Role Detail"}]}),e.jsx(fe,{className:"bg-white border-border mb-6",children:e.jsxs(be,{className:"py-6",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[e.jsxs("div",{className:"flex-shrink-0",children:[ue?e.jsx("img",{src:ue,alt:ne,className:"w-14 h-14 roun
1ded-lg object-cover border border-border bg-white",onError:a=>{var m;a.currentTarget.style.display="none",(m=a.currentTarget.nextElementSibling)==null||m.classList.remove("hidden")}}):null,e.jsx("div",{className:le("w-14 h-14 rounded-lg flex items-center justify-center bg-[hsl(var(--brand-cream))] text-[hsl(var(--brand-navy))] border border-[hsl(var(--brand-navy))]/10",ue&&"hidden"),children:e.jsx(je,{className:"h-7 w-7"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsx("h1",{className:"font-display text-xl font-bold text-foreground leading-tight",children:s.title}),Ne?e.jsx(A,{variant:"secondary",className:"bg-[hsl(var(--brand-cream))] text-[hsl(var(--brand-navy))] border-[hsl(var(--brand-navy))]/20",children:"Open"}):e.jsx(A,{variant:"secondary",className:"bg-muted text-muted-foreground border-border",children:"Closed"})]}),e.jsxs("p",{className:"text-muted-foreground font-medium flex items-center gap-1.5",children:[e.jsx(je,{className:"h-3.5 w-3.5"}),ne]})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-bold text-foreground mb-3 underline underline-offset-4 decoration-[hsl(var(--brand-navy))]/30",children:"Role Description"}),Es(s.description||"")?e.jsx("div",{className:"jd-preview-quill",children:e.jsx(Kt,{theme:"snow",value:rs(s.description||""),readOnly:!0,modules:{toolbar:!1}})}):e.jsx(Ie,{text:s.description,emptyText:"No description provided."})]})]})}),e.jsxs("div",{className:"bg-[hsl(var(--brand-cream))] border border-[hsl(var(--brand-navy))]/10 rounded-xl p-6 mb-8",children:[e.jsxs("h3",{className:"text-sm font-bold text-[hsl(var(--brand-navy))] flex items-center gap-2 mb-2",children:[e.jsx(Ns,{className:"h-4 w-4"}),"How this role is assessed"]}),e.jsx("p",{className:"text-sm text-foreground/80 mb-4",children:Fe>1?e.jsxs(e.Fragment,{children:[Fe," rehearsals. You play out real situations from this role. A recruiter reviews the recordings before the employer sees anything."]}):e.jsx(e.Fragment,{children:"One rehearsal. You play out a real situation from this role. A recruiter reviews the recording before the employer sees anything."})}),e.jsx("div",{className:"flex flex-wrap gap-2.5",children:(et=s.enabled_rehearsals)==null?void 0:et.map((a,m)=>{const l=C===m,b=Number(a.target_interaction_seconds),r=Number.isFinite(b)&&b>0?Math.round(b):null;return e.jsxs("div",{className:"w-full",children:[e.jsxs("button",{type:"button",onClick:()=>K(l?null:m),"aria-expanded":l,"aria-controls":`rehearsal-desc-${m}`,className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border border-border bg-white text-sm font-medium text-foreground shadow-sm hover:border-[hsl(var(--brand-navy))]/40 transition-colors",children:[a.title,e.jsx("span",{"aria-hidden":!0,className:le("text-xs text-muted-foreground transition-transform",l&&"rotate-180"),children:"â¾"})]}),l&&e.jsxs("p",{id:`rehearsal-desc-${m}`,className:"mt-2 text-xs leading-relaxed text-foreground/75 max-w-xl",children:["A live",r?` ${r}-second`:""," rehearsal for ",a.title,". No gotchas, no trick questions - just the role."]})]},m)})})]}),de&&e.jsxs("div",{className:"mb-6 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900",role:"status",children:[re?e.jsx("p",{className:"font-semibold leading-none mb-1.5",children:re}):null,e.jsx("p",{className:re?"leading-snug text-amber-900/90":void 0,children:de})]}),!c&&(He||V)&&e.jsx("div",{children:o?e.jsxs(v,{className:"w-full gap-2",onClick:we,disabled:ce,children:[ce?"Openingâ¦":Ge,e.jsx(z,{className:"h-4 w-4"})]}):e.jsxs(v,{className:"w-full gap-2",onClick:()=>w(!0),children:["Create your profile to continue",e.jsx(z,{className:"h-4 w-4"})]})}),e.jsx("div",{className:"text-center mt-8",children:e.jsxs("div",{className:"inline-flex items-center justify-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Powered by"}),e.jsx("img",{src:Ee,alt:"BitStage",className:"h-4 w-auto object-contain",draggable:!1})]})}),!c&&e.jsx(Le,{open:q,onOpenChange:w,onSuccess:ae,initialMode:"signup",customMessage:"Create your profile to continue with your application."})]}),Vt=s.is_confidential?"BitStage":s.org_name,W=Nt({title:s.title,companyName:Vt,description:s.description});return!c&&!o?e.jsxs(e.Fragment,{children:[e.jsx(Ae,{title:W.title,de
1scription:W.description,ogTitle:W.ogTitle,ogDescription:W.ogDescription,image:ve,imageAlt:_e,url:me,type:"article"}),e.jsx(Ps,{job:s,isOpen:Ne,submitting:ce,practiceSubmitting:De,closedBannerMessage:de,closedBannerTitle:re,onStart:we,onSignIn:()=>w(!0),onTryPractice:$e,showHeroBanner:Qe}),e.jsx(Le,{open:q,onOpenChange:w,onSuccess:ae,initialMode:"signup",customMessage:"Create your profile to continue with your application."})]}):!c&&o&&S?e.jsxs(e.Fragment,{children:[e.jsx(Ae,{title:W.title,description:W.description,ogTitle:W.ogTitle,ogDescription:W.ogDescription,image:ve,imageAlt:_e,url:me,type:"article"}),e.jsx(Ls,{job:s,isOpen:Ne,submitting:ce,practiceSubmitting:De,closedBannerMessage:de,closedBannerTitle:re,alreadyApplied:V,startLabel:Ge,showHeroBanner:Qe,onStart:we,onTryPractice:$e})]}):c?e.jsx(he,{children:e.jsx(ge,{children:Ze})}):e.jsx(ie,{pageTitle:"Role Detail",maxWidth:"max-w-4xl",children:Ze})}export{fa 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.