1import{aj as H,ax as K,ac as V,h as J,c5 as X,k as C,t as f,r as P,j as e,B as S,L as F,A as Q,m as Y,n as U,c_ as Z,ay as g,af as I,cv as T,br as D,C as y,f as v,S as k,a1 as L,as as E,K as ee,cw as se,cx as te,cy as O,c$ as re,c8 as ae,cN as ie,cz as ne}from"./main-DngGJsB2.js";import{B as N}from"./badge-Cpjof17R.js";import{D as le,a as oe,b as ce,d as de}from"./dropdown-menu-D858TeLy.js";import{C as me}from"./check-Dz_St1ky.js";import{L as xe}from"./link-2-CNz_SpyC.js";import{S as _}from"./sparkles-BoyPxG-t.js";import{T as ue}from"./trash-2-D-FEd2ct.js";import{L as he}from"./layout-grid-Cb_Ya6Le.js";import{U as pe}from"./user-DPzSWi9H.js";import{B as fe}from"./briefcase-XywNlNO5.js";import{M as ge}from"./mail-CbWNGYWX.js";import{C as je}from"./calendar-BZwgJMD1.js";import{C as M}from"./clipboard-check-F2WtEB8s.js";import{M as $}from"./message-square-HMj28heY.js";import{S as R}from"./star-DQG_h9va.js";import{T as be}from"./triangle-alert-BgSWI0FL.js";import{C as G}from"./chevron-down-i2vpzGr3.js";import"./index-2g65uNBu.js";import"./index-DAUy0Qgq.js";import"./circle-DyPmNM1A.js";const Ne=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],ye=H("ellipsis-vertical",Ne);function ve({profileId:s,className:t}){const r=K(),c=V(),m=J(),{orgSlug:i}=X({strict:!1}),l=C(r.calibration.deleteProfile.mutationOptions({onSuccess:()=>{f.success("Profile deleted successfully"),m({to:"/o/$orgSlug/calibration",params:{orgSlug:i||""}})},onError:d=>{f.error(d.message||"Failed to delete profile")}})),o=C(r.calibration.regenerateProfile.mutationOptions({onSuccess:()=>{f.success("Profile regeneration started"),c.invalidateQueries({queryKey:r.calibration.getProfile.queryOptions({id:s}).queryKey}),c.invalidateQueries({queryKey:r.calibration.getGeneratedProfile.queryOptions({profileId:s}).queryKey}),c.invalidateQueries({queryKey:r.calibration.getNotesByProfile.queryOptions({profileId:s}).queryKey}),c.invalidateQueries({queryKey:r.calibration.getEvaluationsByProfile.queryOptions({profileId:s}).queryKey})},onError:d=>{f.error(d.message||"Failed to regenerate profile")}})),[p,u]=P.useState(!1),x=C(r.calibration.createCalibrationInterview.mutationOptions({onSuccess:async d=>{await navigator.clipboard.writeText(d.url),u(!0),f.success("Interview link copied to clipboard"),setTimeout(()=>u(!1),2e3)},onError:d=>{f.error(d.message||"Failed to create interview link")}})),a=()=>{x.mutate({profileId:s,organizationSlug:i||""})},w=()=>{confirm("Are you sure you want to delete this profile? This action cannot be undone.")&&l.mutate({id:s})},b=()=>{o.mutate({profileId:s,organizationSlug:i||""})};return e.jsxs("div",{className:`flex items-center gap-2 ${t||""}`,children:[e.jsxs(S,{variant:"outline",size:"sm",disabled:x.isPending,onClick:a,className:"gap-2",children:[p?e.jsx(me,{className:"h-3.5 w-3.5"}):e.jsx(xe,{className:"h-3.5 w-3.5"}),x.isPending?"Creating...":p?"Link Copied!":"Get Interview Link"]}),e.jsxs(S,{variant:"default",size:"sm",disabled:o.isPending,onClick:b,className:"gap-2",children:[e.jsx(_,{className:"h-3.5 w-3.5"}),o.isPending?"Generating...":"Generate Profile"]}),e.jsxs(le,{children:[e.jsx(oe,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"sm",disabled:l.isPending,className:"gap-2",children:e.jsx(ye,{className:"h-3.5 w-3.5"})})}),e.jsx(ce,{align:"end",children:e.jsxs(de,{onClick:w,disabled:l.isPending,className:"cursor-pointer text-destructive focus:text-destructive",children:[e.jsx(ue,{className:"mr-2 h-4 w-4"}),"Delete Profile"]})})]})]})}function we(s){const t=s.trim().split(/\s+/);return t.length>=2?`${t[0].charAt(0)}${t[1].charAt(0)}`.toUpperCase():s.charAt(0).toUpperCase()||"?"}function Ce({orgSlug:s,traitId:t,title:r,description:c,fullDescription:m,examples:i}){const l=i[0]?.profile;return e.jsxs(F,{to:"/o/$orgSlug/calibration/traits/$traitId",params:{orgSlug:s,traitId:t},className:"group block rounded-md border border-border bg-card p-5 transition-colors hover:border-foreground
1/20 hover:bg-secondary/20",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"font-semibold text-foreground text-sm",children:r}),e.jsx("p",{className:"mt-0.5 text-muted-foreground text-sm",children:c})]}),e.jsx(_,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground/60"})]}),m&&e.jsx("p",{className:"mt-3 line-clamp-2 text-foreground/80 text-sm leading-relaxed",children:m}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[l&&e.jsxs(Q,{className:"size-6 border border-border",children:[l.avatar&&e.jsx(Y,{src:l.avatar,alt:l.name}),e.jsx(U,{className:"bg-primary/10 font-medium text-[10px] text-primary",children:we(l.name)})]}),e.jsxs("span",{className:"text-muted-foreground text-xs",children:[i.length," ",i.length===1?"example":"examples"]})]})]})}function Se(s){if(!s)return"?";const t=s.trim().split(/\s+/);return t.length>=2?`${t[0].charAt(0)}${t[1].charAt(0)}`.toUpperCase():s.charAt(0).toUpperCase()||"?"}function ke(s){return!s||s.length===0?{label:"Not started",tone:"outline"}:s.some(t=>t.status==="completed")?{label:"Completed",tone:"default"}:s.some(t=>t.status==="active")?{label:"In progress",tone:"secondary"}:{label:"Invited",tone:"secondary"}}function j({icon:s,label:t,children:r}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 py-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground text-sm",children:[s,e.jsx("span",{children:t})]}),e.jsx("div",{className:"min-w-0 text-right font-medium text-foreground text-sm",children:r})]})}function He(){const{profileId:s,orgSlug:t}=Z.useParams(),r=K(),[c,m]=P.useState(!1),[i,l]=P.useState(!1),{data:o,isLoading:p}=g(r.calibration.getProfile.queryOptions({id:s})),{data:u}=g(r.calibration.getNotesByProfile.queryOptions({profileId:s})),{data:x}=g(r.calibration.getEvaluationsByProfile.queryOptions({profileId:s})),{data:a}=g(r.calibration.getGeneratedProfile.queryOptions({profileId:s})),{data:w}=g(r.calibration.getCalibrationInterviews.queryOptions({profileId:s})),{data:b}=g(r.calibration.getTraitsByProfile.queryOptions({profileId:s})),d=o?.name||"Profile",z=ke(w),h=a?.sourceData,W=!!a&&(h?.reverseInterviewCount??0)===0,q=e.jsxs(ee,{children:[e.jsx(se,{children:e.jsxs(te,{className:"gap-0 text-foreground",children:[e.jsx(O,{children:e.jsx(re,{asChild:!0,children:e.jsx(F,{to:"/o/$orgSlug/calibration",params:{orgSlug:t},children:e.jsx(ae,{icon:e.jsx(L,{}),textAs:"span",children:"Calibration"})})})}),e.jsx(ie,{}),e.jsx(O,{children:e.jsx(ne,{children:d})})]})}),o&&e.jsx(ve,{profileId:s,className:"ml-auto"})]});return!p&&!o?e.jsxs(I,{className:"h-full",children:[q,e.jsx(T,{children:e.jsx(D,{className:"h-full",children:e.jsx("div",{className:"p-8",children:e.jsx(y,{children:e.jsx(v,{className:"py-12 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"Profile not found"})})})})})})]}):e.jsxs(I,{className:"h-full",children:[q,e.jsx(T,{children:e.jsxs(D,{className:"h-full",children:[e.jsx("div",{className:"flex items-center gap-4 border-border border-b p-6",children:p?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"size-14 shrink-0 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(k,{className:"h-6 w-48"}),e.jsx(k,{className:"h-4 w-64"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"size-14 shrink-0 border border-border",children:e.jsx(U,{className:"bg-primary/10 font-semibold text-lg text-primary",children:Se(o?.name)})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"font-semibold text-foreground text-xl",children:d}),e.jsx("p",{className:"text-muted-foreground text-sm",children:o?.role?`${o.role} · calibration profile`:"Calibration profile"})]})]})}),e.jsxs("div",{className:"flex flex-col lg:flex-row",children:[e.jsxs("aside",{className:"w-full shrink-0 border-border border-b p-6 lg:w-80 lg:border-r lg:border-b-0",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx(he,{className:"size-4 text-muted-foreground"}),e.jsx("h2",{className:"font-semibold text-foreground text-sm",children:"Details"})]}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:e.jsx(pe,{className:"size-4"}),label:"Name",children:d}),e.jsx(j,{icon:e.jsx(fe,{className:"size-4"}),label:"Role",children:o?.role||e.jsx("span",{className:"text-muted-foreground
1/60",children:"Not set"})}),e.jsx(j,{icon:e.jsx(ge,{className:"size-4"}),label:"Email",children:o?.email||e.jsx("span",{className:"text-muted-foreground/60",children:"Not set"})}),e.jsx(j,{icon:e.jsx(je,{className:"size-4"}),label:"Created",children:o?.createdAt?new Date(o.createdAt).toLocaleDateString():"â"})]}),e.jsxs("div",{className:"mt-5 mb-3 flex items-center gap-2",children:[e.jsx(M,{className:"size-4 text-muted-foreground"}),e.jsx("h2",{className:"font-semibold text-foreground text-sm",children:"Calibration"})]}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:e.jsx($,{className:"size-4"}),label:"Interview",children:e.jsx(N,{variant:z.tone,className:"rounded-full",children:z.label})}),a&&e.jsx(j,{icon:e.jsx(R,{className:"size-4"}),label:"Generated from",children:e.jsxs("span",{className:"text-muted-foreground text-xs",children:[h?.reverseInterviewCount??0," interview",(h?.reverseInterviewCount??0)===1?"":"s"," ·"," ",h?.noteCount??0," note",(h?.noteCount??0)===1?"":"s"," ·"," ",h?.evaluationCount??0," eval",(h?.evaluationCount??0)===1?"":"s"]})})]}),W&&e.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-amber-700 text-xs dark:text-amber-300",children:[e.jsx(be,{className:"mt-0.5 size-3.5 shrink-0"}
1),e.jsx("span",{children:"This profile was generated without a completed calibration interview. Run one for a higher-fidelity profile."})]})]}),e.jsx("div",{className:"min-w-0 flex-1 p-6",children:!p&&!a?e.jsx(y,{children:e.jsxs(v,{className:"flex flex-col items-center gap-3 py-12 text-center",children:[e.jsx(L,{className:"size-8 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-base",children:"No calibration profile yet"}),e.jsxs("p",{className:"mx-auto mt-1 max-w-sm text-muted-foreground text-sm",children:["Share an interview link with ",d," to capture how they work, then generate a profile. We won't fabricate one without real input."]})]})]})}):e.jsxs("div",{className:"space-y-6",children:[a?.summary&&e.jsxs("div",{children:[e.jsx("p",{className:"text-base text-foreground leading-relaxed",children:a.summary}),a.roleSpecificSummary&&e.jsx("p",{className:"mt-3 text-muted-foreground text-sm leading-relaxed",children:a.roleSpecificSummary})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(M,{className:"size-4 text-muted-foreground"}),e.jsx("h2",{className:"font-semibold text-foreground text-sm",children:"Profile Traits"})]}),b&&b.length>0?e.jsx("div",{className:"grid grid-cols-1 gap-3 xl:grid-cols-2",children:b.map(n=>e.jsx(Ce,{orgSlug:t,traitId:n.id,title:n.title,description:n.description,fullDescription:n.fullDescription,examples:n.examples},n.id))}):e.jsx(Pe,{technicalStrengths:a?.technicalStrengths??[],roleCompetencies:a?.roleCompetencies??[],culturalStrengths:a?.culturalStrengths??[],workStyleTraits:a?.workStyleTraits??[]})]}),a?.personalitySummary&&e.jsxs("div",{children:[e.jsx("h2",{className:"mb-2 font-semibold text-foreground text-sm",children:"Personality"}),e.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:a.personalitySummary})]}),a?.fullContent&&e.jsxs("div",{children:[e.jsx("h2",{className:"mb-2 font-semibold text-foreground text-sm",children:"Full profile"}),e.jsx("p",{className:"whitespace-pre-wrap text-muted-foreground text-sm leading-relaxed",children:a.fullContent})]}),u&&u.length>0&&e.jsx(y,{children:e.jsxs(v,{className:"px-4 py-0",children:[e.jsxs("button",{type:"button",onClick:()=>m(!c),className:"flex w-full items-center justify-between py-3 text-left transition-colors hover:opacity-80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{className:"size-4 text-muted-foreground"}),e.jsxs("h3",{className:"font-semibold text-sm",children:["Notes",e.jsx(N,{variant:"secondary",className:"ml-2",children:u.length})]})]}),c?e.jsx(G,{className:"size-4 text-muted-foreground"}):e.jsx(E,{className:"size-4 text-muted-foreground"})]}),c&&e.jsx("div",{className:"space-y-3 pb-3",children:u.map(n=>e.jsxs("div",{className:"border-border border-b pb-3 last:border-0",children:[e.jsx("div",{className:"mb-1 text-muted-foreground text-xs",children:new Date(n.createdAt).toLocaleDateString()}),e.jsx("p",{className:"text-sm",children:n.content})]},n.id))})]})}),x&&x.length>0&&e.jsx(y,{children:e.jsxs(v,{className:"px-4 py-0",children:[e.jsxs("button",{type:"button",onClick:()=>l(!i),className:"flex w-full items-center justify-between py-3 text-left transition-colors hover:opacity-80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{className:"size-4 text-muted-foreground"}),e.jsxs("h3",{className:"font-semibold text-sm",children:["Evaluations",e.jsx(N,{variant:"secondary",className:"ml-2",children:x.length})]})]}),i?e.jsx(G,{className:"size-4 text-muted-foreground"}):e.jsx(E,{className:"size-4 text-muted-foreground"})]}),i&&e.jsx("div",{className:"space-y-3 pb-3",children:x.map(n=>e.jsxs("div",{className:"border-border border-b pb-3 last:border-0",children:[n.structuredScores&&Object.keys(n.structuredScores).length>0&&e.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:Object.entries(n.structuredScores).map(([B,A])=>A!==void 0&&e.jsxs(N,{variant:"secondary",children:[B,": ",A]},B))}),n.freeformNotes&&e.jsx("p",{className:"text-muted-foreground text-sm",children:n.freeformNotes})]},n.id))})]})})]})})]})]})})]})}function Pe({technicalStrengths:s,roleCompetencies:t,culturalStrengths:r,workStyleTraits:c}){const m=[{label:"Technical strengths",items:s},{label:"Role competencies",items:t},{label:"Cultural strengths",items:r},{label:"Work style",items:c}].filter(i=>i.items.length>0);return m.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No traits extracted yet. They'll appear here once calibration analysis runs."}):e.jsx("div",{className:"space-y-4",children:m.map(i=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-2 font-medium text-muted-foreground text-xs uppercase tracking-wide",children:i.label}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.items.map(l
1=>e.jsx(N,{variant:"secondary",className:"rounded-full",children:l},l))})]},i.label))})}export{He as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.