1import{r as o,j as e}from"./react-CHTGUyAX.js";import{L as U}from"./router-D1a9Ug87.js";import{a as v}from"./index-COIxwMRP.js";import{u as J}from"./ExtensionConnectBanner-CWe8bTRz.js";import"./extensionConnect-CCtv1X-2.js";import"./extensionLinks-DrWV-jsc.js";import"./isDevEnvironment-DbjHDiIg.js";function y(r){if(!r)return"â";const n=new Date(r);return Number.isNaN(n.getTime())?"â":n.toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"})}function A(r){return!r||typeof r.amount!="number"?null:`${r.currency==="EUR"?"â¬":r.currency==="GBP"?"£":"$"}${r.amount}/hr`}function D(r){return r?r.type==="display_value"?r.rawNormalized:r.type==="exact"&&typeof r.amount=="number"?`$${r.amount.toLocaleString()} earned`:null:null}function I({status:r}){const n=r==null?void 0:r.account,{extVersion:g,linkedToCurrentUser:l}=J(),d=(r==null?void 0:r.latestExtensionVersion)||"",c=(n==null?void 0:n.extensionVersion)||"",i=g||"",h=d?`v${d}`:"the latest version",p=n==null?void 0:n.backgroundObservationLastRunAt,j=p&&(n==null?void 0:n.backgroundObservationLastProfileOk)===!1,m=(n==null?void 0:n.backgroundObservationLastProfileError)||"",b=!l,u=!!(i&&c&&i!==c);return e.jsxs("section",{className:"mup-card mup-empty",children:[e.jsx("h2",{children:"No profile snapshot in Freelancer Brain yet"}),e.jsx("p",{className:"mup-muted",children:"This page shows stored Upwork profile data â not live heartbeats. Heartbeats only prove the Sensor is online."}),n?e.jsxs("dl",{className:"mup-status-dl",children:[e.jsx("dt",{children:"Sensor"}),e.jsx("dd",{children:n.sensorEnabled?"ON":"OFF"}),e.jsx("dt",{children:"Chrome extension"}),e.jsx("dd",{children:i||"â (not reachable)"}),e.jsx("dt",{children:"Version at last heartbeat"}),e.jsxs("dd",{children:[c||"â",u?" (stale â waiting for 0.8.49 to report)":""]}),e.jsx("dt",{children:"Paired"}),e.jsx("dd",{children:l?"YES":"NO"}),e.jsx("dt",{children:"Last seen"}),e.jsx("dd",{children:y(n.lastSensorSeenAt)}),e.jsx("dt",{children:"Last page"}),e.jsx("dd",{children:n.lastPageType||"â"}),e.jsx("dt",{children:"Last observation"}),e.jsx("dd",{children:p?`${y(p)} · profile ${n.backgroundObservationLastProfileOk?"ok":"failed"}`:"Never"}),j&&m?e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:"Last error"}),e.jsx("dd",{className:"mup-err",children:m})]}):null]}):null,e.jsxs("ol",{className:"mup-steps",children:[b?e.jsxs("li",{children:["Open ",e.jsx(U,{to:"/app/extension",children:"Extension"})," and click ",e.jsx("strong",{children:"Connect"})," until pairing shows YES",i?` (Chrome has v${i})`:"","."]}):null,i&&d&&i!==d?e.jsxs("li",{children:["Reload the extension to ",e.jsx("strong",{children:h})," (chrome://extensions)."]}):null,e.jsxs("li",{children:["Open ",e.jsx(U,{to:"/app/extension",children:"Extension"})," â ",e.jsx("strong",{children:"Run now"})," (stay logged into Upwork)."]}),e.jsx("li",{children:"Wait ~2 minutes, then refresh this page."})]}),e.jsx("p",{className:"mup-muted",children:r!=null&&r.diagnosticProbeCount?`${r.diagnosticProbeCount} diagnostic probe(s) captured. The page was reached, but selectors or the Upwork route still need repair.`:"If Upwork moves the page, Run now captures a diagnostic probe instead of silently failing."})]})}function Z(){var S,C,E,P,L,F,O,T,z,$,R;const[r,n]=o.useState(null),[g,l]=o.useState(null),[d,c]=o.useState(!0),[i,h]=o.useState(""),[p,j]=o.useState("field_incorrect"),[m,b]=o.useState(""),[u,k]=o.useState(!1),[w,x]=o.useState("");async function V(){c(!0);try{const[a,f]=await Promise.all([v("/api/extension/sensor/profile"),v("/api/extension/sensor/status")]),M=await a.json().catch(()=>({})),B=await f.json().catch(()=>({}));a.ok?n(M):n(null),f.ok?l(B):l(null)}catch{n(null),l(null)}finally{c(!1)}}o.useEffect(()=>{V()},[]);async function N(a){k(!0),x("");try{(await v("/api/extension/sensor/profile/feedback",{method:"POST",body:a?{accurate:!0}:{accurate:!1,issueType:p,field:m,note:""}})).ok?(x(a?"Thanks â marked as accurate.":"Thanks â weâll use this to improve extraction."),h(a?"yes":"no")):x("Could not save feedback.")}catch{x("Could not save feedback.")}finally{k(!1)}}const t=r==null?void 0:r.snapshot,s=(t==null?void 0:t.profile)||(t==null?void 0:t.profileData),H=A(s==null?void 0:s.hourlyRate),_=D((S=s==null?void 0:s.marketplaceHistory)==null?void 0:S.totalEarnings);return e.jsxs("div",{className:"mup-page",children:[e.jsxs("header",{className:"mup-hero",children:[e.jsx("h1",{children:"My Upwork Profile"}),e.jsx("p",{children:"Your Upwork profile as stored in Freelancer Brain â updated by Sensor (Run now or when you open Profile). Facts only; no scores yet."})]}),d?e.jsx("p",{className:"mup-muted",children:"Loadingâ¦"}):t?e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"mup-card mup-summary",children:[e.jsxs("div",{className:"mup-meta",children:["Last synced: ",e.jsx("strong",{children:y(t.capturedAt)}),t.health?e.jsx("span",{className:"mup-pill",children:t.health}):null,t.completeness!=null?e.jsxs("span",{className:"mup-pill",children:[Math.round(Number(t.completeness)*100),"% complete"]}):null]}),e.jsx("h2",{className:"mup-title",children:(s==null?void 0:s.professionalTitle)||"Title not observed"}),s!=null&&s.displayName?e.jsx("p",{className:"mup-name",children:s.displayName}):null,e.jsxs("div",{className:"mup-hero-stats",children:[e.jsxs("div",{children:[e.jsx("span",{className:"mup-stat-label",children:"Rate"}),e.jsx("strong",{children:H||"â"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"mup-stat-label",children:"Job Success"}),e.jsx("strong",{children:((C=s==null?void 0:s.reputation)==null?void 0:C.jobSuccessScore)!=null?`${s.reputation.jobSuccessScore}%`:"â"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"mup-stat-label",children:"Jobs"}),e.jsx("strong",{children:((E=s==null?void 0:s.marketplaceHistory)==null?void 0:E.totalJobs)??"â"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"mup-stat-label",children:"Earnings"}),e.jsx("strong",{children:_||"â"})]})]}),s!=null&&s.location?e.jsx("p",{className:"mup-muted",children:s.location}
1):null,s!=null&&s.availability?e.jsxs("p",{className:"mup-muted",children:["Availability: ",s.availability]}):null]}),e.jsxs("section",{className:"mup-card",children:[e.jsx("h3",{children:"Skills"}),(P=s==null?void 0:s.skills)!=null&&P.length?e.jsx("ul",{className:"mup-skills",children:s.skills.map(a=>e.jsx("li",{children:a},a))}):e.jsx("p",{className:"mup-muted",children:"No skills observed on the last visit."})]}),e.jsxs("div",{className:"mup-two",children:[e.jsxs("section",{className:"mup-card",children:[e.jsx("h3",{children:"Marketplace"}),e.jsxs("dl",{className:"mup-dl",children:[e.jsx("dt",{children:"Badges"}),e.jsx("dd",{children:(F=(L=s==null?void 0:s.reputation)==null?void 0:L.badges)!=null&&F.length?s.reputation.badges.join(", "):"â"}),e.jsx("dt",{children:"Hours"}),e.jsx("dd",{children:((O=s==null?void 0:s.marketplaceHistory)==null?void 0:O.totalHours)??"â"})]})]}),e.jsxs("section",{className:"mup-card",children:[e.jsx("h3",{children:"Profile assets"}),e.jsxs("dl",{className:"mup-dl",children:[e.jsx("dt",{children:"Portfolio"}),e.jsx("dd",{children:((T=s==null?void 0:s.assets)==null?void 0:T.portfolioCount)??"â"}),e.jsx("dt",{children:"Certifications"}),e.jsx("dd",{children:((z=s==null?void 0:s.assets)==null?void 0:z.certificationCount)??"â"}),e.jsx("dt",{children:"Employment"}),e.jsx("dd",{children:(($=s==null?void 0:s.assets)==null?void 0:$.employmentCount)??"â"}),e.jsx("dt",{children:"Education"}),e.jsx("dd",{children:((R=s==null?void 0:s.assets)==null?void 0:R.educationCount)??"â"})]})]})]}),s!=null&&s.overview?e.jsxs("section",{className:"mup-card",children:[e.jsx("h3",{children:"Overview"}),e.jsx("p",{className:"mup-overview",children:s.overview})]}):null,e.jsxs("section",{className:"mup-card",children:[e.jsx("h3",{children:"Does this look accurate?"}),e.jsx("p",{className:"mup-muted",children:"Confirming helps improve extraction. This does not edit your Upwork profile."}),e.jsxs("div",{className:"mup-actions",children:[e.jsx("button",{type:"button",className:"mup-btn",disabled:u,onClick:()=>void N(!0),children:"Yes"}),e.jsx("button",{type:"button",className:"mup-btn mup-btn-ghost",disabled:u,onClick:()=>h("form"),children:"Something is wrong"})]}),i==="form"?e.jsxs("div",{className:"mup-form",children:[e.jsxs("label",{children:["Issue type",e.jsxs("select",{value:p,onChange:a=>j(a.target.value),children:[e.jsx("option",{value:"field_incorrect",children:"Field incorrect"}),e.jsx("option",{value:"missing_field",children:"Missing field"}),e.jsx("option",{value:"stale_field",children:"Stale / outdated"}),e.jsx("option",{value:"ownership_problem",children:"Wrong profile (not mine)"}),e.jsx("option",{value:"parse_issue",children:"Parse issue"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("label",{children:["Field (optional)",e.jsx("input",{value:m,onChange:a=>b(a.target.value),placeholder:"e.g. professionalTitle, hourlyRate, skills"})]}),e.jsx("button",{type:"button",className:"mup-btn",disabled:u,onClick:()=>void N(!1),children:"Submit feedback"})]}):null,w?e.jsx("p",{className:"mup-ok",children:w}):null,e.jsxs("p",{className:"mup-muted",style:{marginTop:14},children:["Ownership: ",t.ownershipStatus||"â"," · Collector ",t.collectorVersion||"â"]}
1)]})]}):e.jsx(I,{status:g}),e.jsx("style",{children:` 2 .mup-page { max-width: 760px; } 3 .mup-hero { margin-bottom: 22px; } 4 .mup-hero h1 { margin: 0 0 8px; font-size: 1.65rem; } 5 .mup-hero p { margin: 0; color: var(--muted); line-height: 1.55; } 6 .mup-card { 7 background: var(--bg-panel); 8 border: 1px solid var(--border); 9 border-radius: 14px; 10 padding: 20px 22px; 11 margin-bottom: 14px; 12 } 13 .mup-card h2, .mup-card h3 { margin: 0 0 12px; font-size: 1.05rem; } 14 .mup-title { font-size: 1.35rem !important; margin-bottom: 6px !important; } 15 .mup-name { margin: 0 0 12px; font-weight: 600; } 16 .mup-hero-stats { 17 display: grid; 18 grid-template-columns: repeat(4, minmax(0, 1fr)); 19 gap: 12px; 20 margin: 14px 0 10px; 21 } 22 .mup-hero-stats > div { 23 border: 1px solid var(--border); 24 border-radius: 10px; 25 padding: 10px 12px; 26 } 27 .mup-stat-label { 28 display: block; 29 font-size: 0.7rem; 30 letter-spacing: 0.04em; 31 text-transform: uppercase; 32 color: var(--muted); 33 margin-bottom: 4px; 34 } 35 .mup-meta { color: var(--muted); font-size: 0.875rem; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } 36 .mup-pill { 37 font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; 38 border: 1px solid var(--border); color: var(--muted); 39 } 40 .mup-muted { color: var(--muted); font-size: 0.875rem; line-height: 1.5; } 41 .mup-skills { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; } 42 .mup-skills li { 43 border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; 44 } 45 .mup-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } 46 @media (max-width: 640px) { 47 .mup-hero-stats, .mup-two { grid-template-columns: 1fr 1fr; } 48 } 49 .mup-dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; font-size: 0.9rem; } 50 .mup-dl dt { color: var(--muted); margin: 0; } 51 .mup-dl dd { margin: 0; font-weight: 600; } 52 .mup-status-dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 14px 0; font-size: 0.875rem; } 53 .mup-status-dl dt { color: var(--muted); margin: 0; } 54 .mup-status-dl dd { margin: 0; font-weight: 600; } 55 .mup-err { color: #b45309; font-weight: 600; word-break: break-word; } 56 .mup-overview { margin: 0; white-space: pre-wrap; line-height: 1.55; font-size: 0.9rem; color: var(--text); } 57 .mup-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; } 58 .mup-btn { 59 border: none; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; 60 background: var(--brand, #6366f1); color: #fff; font-family: inherit; 61 } 62 .mup-btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); } 63 .mup-btn:disabled { opacity: 0.5; cursor: not-allowed; } 64 .mup-form { display: grid; gap: 10px; margin-top: 8px; max-width: 360px; } 65 .mup-form label { display: grid; gap: 4px; font-size: 0.8rem; color: var(--muted); } 66 .mup-form input, .mup-form select { 67 padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); 68 background: var(--bg); color: var(--text); font-family: inherit; 69 } 70 .mup-ok { color: var(--brand, #6366f1); font-size: 0.875rem; } 71 .mup-steps { margin: 0 0 12px; padding-left: 1.2rem; color: var(--muted); line-height: 1.6; } 72 `})]})}export{Z 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.