1import{a4 as k,d as R,K as C,r as l,j as e}from"./index-CEBZ7Z96.js";import{d as $,S as x,a as y}from"./shareCard-qdiGIA64.js";function L(s,h,n){const a=n&&n>0?`${n.toLocaleString()} ${h} trajectories`:"analyzed trajectories";return s<40?`A ${s}-point signal measured against ${a} â the gaps are concrete and closable from here.`:s<60?`A ${s}-point signal across ${a}. Your top gap is the fastest lever to move this forward.`:`A strong ${s}-point signal, cross-referenced against ${a}.`}function P(){const s=k(),h=R(),{toast:n}=C(),a=l.useRef(null),[d,g]=l.useState(!1),[o,j]=l.useState(null),[m,f]=l.useState(!1),[b,v]=l.useState(!1),p=s.data,i=h.data,r=p&&i?{composite:p.composite,currentRung:p.currentRung,targetRole:i.targetRole,archetypeName:i.archetypeName,sampleSize:i.sampleSize,percentileSentence:L(p.composite,i.targetRole,i.sampleSize)}:null;l.useEffect(()=>{!a.current||!r||($(a.current,r),g(!0))},[r]),l.useEffect(()=>{!r||o||m||b||(f(!0),fetch("/api/share/cards",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(async t=>{if(!t.ok)throw new Error(`status ${t.status}`);return await t.json()}).then(t=>{const u=`${window.location.origin}${t.path}`;j(u)}).catch(t=>{console.error("[share] snapshot failed",t),v(!0)}).finally(()=>f(!1)))},[r,o,m,b]);const w=async()=>{if(o)try{await navigator.clipboard.writeText(o),n({title:"Link copied"})}catch{n({title:"Couldn't copy automatically",description:o,variant:"destructive"})}},N=()=>{a.current&&a.current.toBlob(t=>{if(!t){n({title:"Couldn't render the card",description:"Try refreshing the page.",variant:"destructive"});return}const u=URL.createObjectURL(t),c=document.createElement("a");c.href=u;const S=(r?.targetRole??"path").toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,40);c.download=`1000paths-${S}.png`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(u)},"image/png")};return e.jsxs("div",{className:"space-y-12",children:[e.jsxs("header",{children:[e.jsxs("div",{className:"flex items-baseline gap-4 mb-2",children:[e.jsx("span",{"aria-hidden":!0,className:"block",style:{width:28,height:1,background:"var(--color-cyan-500)"}}),e.jsx("span",{className:"label-mono",children:"Share · your path"})]}),e.jsxs("h1",{className:"h-display text-5xl sm:text-6xl leading-none mb-3",children:["A card for your feed",e.jsx("span",{className:"italic text-ink-500",children:"."})]}),e.jsx("p",{className:"text-ink-500 max-w-2xl",style:{fontFamily:"var(--font-display)",fontStyle:"italic",fontSize:19,lineHeight:1.55},children:"A 1200Ã627 PNG sized for LinkedIn â your composite, your destination, the percentile against real profiles. Download and post; we won't post for you."})]}),!r&&e.jsx("div",{className:"bg-bone border border-rule p-8",children:e.jsx("span",{className:"label-mono",children:"Loading your scoreâ¦"})}),r&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"bg-bone border border-rule p-4 sm:p-6",children:[e.jsx("div",{className:"label-mono mb-3",children:"Preview"}),e.jsx("div",{className:"overflow-hidden border border-rule-soft bg-paper",style:{aspectRatio:`${x} / ${y}`},children:e.jsx("canvas",{ref:a,width:x,height:y,className:"w-full h-full block","data-testid":"share-canvas"})})]}),o&&e.jsxs("section",{className:"bg-bone border border-rule p-4 sm:p-6",children:[e.jsx("div",{className:"label-mono mb-3",children:"Public link"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-stretch sm:items-center",children:[e.jsx("input",{readOnly:!0,value:o,onFocus:t=>t.currentTarget.select(),className:"flex-1 bg-paper border border-rule px-3 py-2 text-sm font-mono","data-testid":"input-public-share-url"}),e.jsx("button",{type:"button",onClick:w,className:"font-mono uppercase px-5 py-2.5 transition-colors",style:{color:"var(--color-ink-900)",background:"var(--color-cyan-500)",border:"1px solid var(--color-cyan-500)",borderRadius:2,fontSize:12,letterSpacing:"0.14em",cursor:"pointer"},"data-testid":"btn-copy-share-url",children:"Copy link"})]}),e.jsx("p",{className:"text-ink-500 mt-3 text-sm",children:"Paste this anywhere â LinkedIn, Slack, X â and it'll unfurl with your composite and destination as the preview."})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsx("span",{className:"label-mono text-ink-500",children:d?"Ready · 1200 à 627 PNG":"Renderingâ¦"}),e.jsx("button",{type:"button",onClick:N,disabled:!d,className:"font-mono uppercase px-5 py-2.5 transition-colors",style:{color:"var(--color-ink-900)",background:d?"var(--color-cyan-500)":"var(--color-rule)",border:"1px solid var(--color-cyan-500)",borderRadius:2,fontSize:12,letterSpacing:"0.14em",cursor:d?"pointer":"not-allowed"},"data-testid":"btn-download-card",children:"Download PNG"})]})]})]})}export{P 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.