PageSourceSearch

https://personaresearch.ai/assets/PersonaViewer-qzxxIW3n.js

js personaresearch.ai collected 2026-10-05 16:14:18 UTC 26,885 bytes, 1 lines download raw bytes

1import{j as e,M as y,N as M,r as c,u as W,L as $,a as le,b as te}from"./index-DRqqyXod.js";import{u as ae,D as G,a as ne}from"./usePersonaFilterOptions-DkbPfA17.js";import{a as re}from"./avatarTint-BGsE-VEQ.js";function ie({totalCount:s,isLoading:l}){return e.jsxs("section",{className:"mb-8",children:[e.jsx(y,{as:"div",children:"Volume · the archive"}),e.jsxs("h1",{className:"mt-2 font-shell-serif text-5xl leading-[1] tracking-tight",children:["Persona Library"," ",e.jsxs("span",{style:{color:"var(--shell-accent)"},children:["—"," ",l?e.jsx("span",{className:"opacity-50",children:"…"}):e.jsx(M,{children:s.toLocaleString()})]})]}),e.jsx("p",{className:"mt-6 max-w-3xl text-[15px] leading-relaxed text-shell-dim",children:"A searchable record of every persona in the system. Filter by demography, psychology, or behavior — browse the full library or narrow to your own created personas."})]})}function oe({onSearch:s,isLoading:l,initialName:a="",initialProfile:o=""}){const[x,i]=c.useState(a),[r,p]=c.useState(o);c.useEffect(()=>{i(a)},[a]),c.useEffect(()=>{p(o)},[o]);const m=c.useCallback(()=>{s(x,r)},[s,x,r]),n=c.useCallback(g=>{g.key==="Enter"&&m()},[m]);return e.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 border px-3 py-2",style:{borderColor:"var(--shell-rule)",borderRadius:4},children:[e.jsx("span",{className:"font-shell-mono text-shell-dim",children:"⌕"}),e.jsx("input",{type:"text",placeholder:"Search by name…",value:x,onChange:g=>i(g.target.value),onKeyDown:n,className:"flex-1 bg-transparent text-[13px] placeholder:text-shell-dim focus:outline-none"})]}),e.jsxs("div",{className:"flex items-center gap-2 border px-3 py-2",style:{borderColor:"var(--shell-rule)",borderRadius:4},children:[e.jsx("span",{className:"font-shell-mono text-shell-dim",children:"⌕"}),e.jsx("input",{type:"text",placeholder:"Profile contains: occupation, location, trait…",value:r,onChange:g=>p(g.target.value),onKeyDown:n,className:"flex-1 bg-transparent text-[13px] placeholder:text-shell-dim focus:outline-none"})]}),e.jsx("button",{onClick:m,disabled:l,className:"px-4 font-shell-mono text-[11px] uppercase tracking-mono disabled:opacity-50",style:{borderRadius:4,background:"var(--shell-fg)",color:"var(--shell-bg)"},children:l?"Searching…":"Search"})]})}function ce({rows:s,currentUserId:l,pinnedIds:a,onTogglePin:o}){const x=W(),i=(r,p)=>{r.target.closest("a,button")||x(`/persona-detail/${p}`)};return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsx("span",{className:"font-shell-serif text-2xl",children:s.length.toLocaleString()}),e.jsx(y,{children:"results"})]}),e.jsxs("table",{className:"w-full border-collapse text-[13px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",style:{borderColor:"var(--shell-rule-strong)"},children:[e.jsx("th",{className:"py-2 text-left",children:e.jsx(y,{children:"Subject"})}),e.jsx("th",{className:"py-2 pl-3 text-left",children:e.jsx(y,{children:"Age"})}),e.jsx("th",{className:"py-2 pl-3 text-left",children:e.jsx(y,{children:"Gen"})}),e.jsx("th",{className:"py-2 pl-3 text-left",children:e.jsx(y,{children:"Ethnicity"})}),e.jsx("th",{className:"py-2 pl-3 text-left",children:e.jsx(y,{children:"Occupation"})}),e.jsx("th",{className:"py-2 pl-3 text-left",children:e.jsx(y,{children:"Income"})}),e.jsx("th",{className:"py-2 pl-3 text-left",children:e.jsx(y,{children:"Location"})}),e.jsx("th",{className:"py-2 pr-2 text-right",children:e.jsx(y,{children:"Actions"})})]})}),e.jsx("tbody",{children:s.map(r=>e.jsxs("tr",{onClick:p=>i(p,r.persona_id),className:"cursor-pointer border-b transition-colors hover:bg-shell-paper",style:{borderColor:"var(--shell-rule)"},children:[e.jsx("td",{className:"py-3",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(de,{name:r.name,imageUrl:r.profile_thumbnail_url||r.profile_image_url}),e.jsxs("div",{className:"min-w-0",children:[e.jsx($,{to:`/persona-detail/${r.persona_id}`,className:"block truncate text-[13px] hover:text-shell-accent",children:_(r.name,20)}),e.jsxs(y,{className:"mt-0.5 block text-[10px]",children:["ID · ",r.persona_id.slice(-8)]})]})]})}),e.jsx("td",{className:"py-3 pl-3 align-middle font-shell-mono tabular-nums",children:r.age}),e.jsx("td",{className:"py-3 pl-3 capitalize",children:ue(r.gender)}),e.jsx("td",{className:"py-3 pl-3",children:_(r.ethnicity,16)}),e.jsx("td",{className:"py-3 pl-3",children:_(r.occupation,18)}),e.jsx("td",{className:"py-3 pl-3",children:e.jsx(y,{className:"text-[11px]",children:_(xe(r.income_bracket),12)})}),e.jsx("td",{className:"py-3 pl-3",children:pe(r.city,r.state_region)}),e.jsx("td",{className:"py-3 pr-2",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("button",{onClick:p=>{p.stopPropagation(),o(r.persona_id)},title:"Pin for comparison / add to panel",className:`border px-1.5 py-0.5 font-shell-mono text-[10px] ${a.includes(r.persona_id)?"border-shell-accent text-shell-accent":"border-shell-rule text-shell-dim hover:text-shell-fg"}`,style:{borderRadius:3},children:"⊟"}),e.jsx($,{to:`/persona-detail/${r.persona_id}`,className:"border px-2 py-0.5 font-shell-mono text-[10px] uppercase tracking-mono hover:border-shell-fg",style:{borderColor:"var(--shell-rule-strong)",borderRadius:3},children:"Open →"})]})})]},r.persona_id))})]}),s.length===0&&e.jsx("div",{className:"py-12 text-center text-shell-dim",children:"No personas match your search criteria."})]})}function de({name:s,imageUrl:l}){const a=he(s);return l?e.jsx("img",{src:l,alt:s,className:"h-8 w-8 flex-shrink-0 object-cover",style:{borderRadius:3,border:"1px solid var(--shell-rule-strong)"}}):e.jsx("span",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center font-shell-mono text-[10px] uppercase tracking-mono",style:{borderRadius:3,background:re(a),color:"var(--shell-fg)",border:"1px solid var(--shell-rule-strong)"},children:a})}
1function he(s){return s.split(/\s+/).filter(Boolean).slice(0,2).map(l=>{var a;return((a=l[0])==null?void 0:a.toUpperCase())??""}).join("")}function _(s,l){return s?s.length<=l?s:s.slice(0,l-1)+"…":"—"}function ue(s){if(!s)return"—";const l=s.toLowerCase();return l==="male"||l==="m"?"M":l==="female"||l==="f"?"F":l.includes("non-binary")||l==="nb"?"NB":l.slice(0,2).toUpperCase()}function xe(s){return s?s.replace("Under ","<").replace("Over ",">").replace(",000","k").replace("–","-"):"—"}function pe(s,l){const a=[s,l].filter(Boolean);if(a.length===0)return"—";const o=a.join(", ");return _(o,18)}const P=[{display:"Male",dbValues:["male","Male","MALE","m","M"]},{display:"Female",dbValues:["female","Female","FEMALE","f","F"]},{display:"Nonbinary",dbValues:["nonbinary","Nonbinary","non-binary","Non-Binary","Non Binary","non binary","nb","NB"]}],me=["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming","District of Columbia","Puerto Rico","Canada","Mexico"],ge=[{display:"White",value:"White"},{display:"Black or African American",value:"Black"},{display:"Hispanic or Latino",value:"Hispanic/Latino"},{display:"Indian",value:"Indian"},{display:"Pakistani",value:"Pakistani"},{display:"Bangladeshi",value:"Bangladeshi"},{display:"South Asian (Other)",value:"South Asian"},{display:"Chinese",value:"Chinese"},{display:"Korean",value:"Korean"},{display:"Vietnamese",value:"Vietnamese"},{display:"Japanese",value:"Japanese"},{display:"Taiwanese",value:"Taiwanese"},{display:"Filipino",value:"Filipino"},{display:"Asian (Other)",value:"Asian (Other)"},{display:"Middle Eastern",value:"Middle Eastern"},{display:"Native American",value:"Native American"},{display:"Pacific Islander",value:"Pacific Islander"},{display:"Mixed / Multiracial",value:"Mixed"}],fe=[{display:"Less than High School",value:"Less than High School"},{display:"High School",value:"High School"},{display:"Some College / Trade",value:"Some College / Trade"},{display:"Associate's Degree",value:"Associate's Degree"},{display:"Bachelor's Degree",value:"Bachelor's Degree"},{display:"Master's Degree",value:"Master's Degree"},{display:"Doctorate",value:"Doctorate"}];function E(s){return s?s.replace(/_/g," ").split(/[\s-]+/).map(o=>o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()).join(" "):""}function be({filters:s,onFilterChange:l,filterOptions:a,isLoading:o,resultCount:x,onClear:i,hasActiveFilters:r}){const[p,m]=c.useState(!1),n=c.useCallback((t,d)=>{l({...s,[t]:d})},[s,l]),g=c.useCallback(t=>{const d=P.find(f=>f.display===t);if(!d)return;if(d.dbValues.some(f=>s.genders.includes(f))){const f=s.genders.filter(C=>!d.dbValues.includes(C));n("genders",f)}else{const f=[...s.genders,d.dbValues[0]];n("genders",f)}},[s,n]),h=c.useCallback(t=>{const d=P.find(b=>b.display===t);return d?d.dbValues.some(b=>s.genders.includes(b)):!1},[s.genders]),S=c.useCallback(t=>{if(s.ethnicities.includes(t)){const b=s.ethnicities.filter(f=>f!==t);n("ethnicities",b)}else{const b=[...s.ethnicities,t];n("ethnicities",b)}},[s,n]),w=c.useCallback(t=>{if(s.educationLevels.includes(t)){const b=s.educationLevels.filter(f=>f!==t);n("educationLevels",b)}else{const b=[...s.educationLevels,t];n("educationLevels",b)}},[s,n]),N=c.useCallback((t,d)=>{const b=s[t],f=b.includes(d)?b.filter(C=>C!==d):[...b,d];n(t,f)},[s,n]);return p?e.jsx("aside",{className:"w-10 flex-shrink-0",children:e.jsx("button",{onClick:()=>m(!1),className:"sticky top-4 flex h-10 w-10 items-center justify-center border text-shell-dim hover:text-shell-fg",style:{borderColor:"var(--shell-rule)",borderRadius:4},title:"Show filters",children:e.jsx("span",{className:"text-lg",children:"▶"})})}):e.jsxs("aside",{className:"w-[240px] flex-shrink-0 space-y-5 overflow-y-auto pr-4",style:{maxHeight:"calc(100vh - 200px)"},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(y,{as:"div",children:"Filters"}),e.jsx("button",{onClick:()=>m(!0),className:"text-shell-dim hover:text-shell-fg",title:"Collapse filters",children:e.jsx("span",{className:"text-xs",children:"◀"})})]}),e.jsxs("div",{className:"border p-3",style:{borderColor:"var(--shell-rule)",borderRadius:4},children:[e.jsx("div",{className:"font-shell-serif text-2xl leading-none",children:o?e.jsx("span",{className:"text-shell-dim",children:"…"}
1):e.jsx(M,{children:x.toLocaleString()})}),e.jsx(y,{className:"mt-1",children:"matches"})]}),r&&e.jsx("button",{onClick:i,className:"w-full border py-2 font-shell-mono text-[11px] uppercase tracking-mono text-shell-dim hover:border-shell-fg hover:text-shell-fg",style:{borderColor:"var(--shell-rule)",borderRadius:4},children:"Clear all filters"}),e.jsx(k,{title:"Age",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",placeholder:"Min",value:s.ageMin??"",onChange:t=>{const d=t.target.value;n("ageMin",d===""?null:Number(d))},onBlur:t=>{const d=t.target.value;n("ageMin",d===""?null:Number(d))},className:"w-full border bg-transparent px-2 py-1.5 font-shell-mono text-[12px] tabular-nums placeholder:text-shell-dim focus:border-shell-fg focus:outline-none",style:{borderColor:"var(--shell-rule)",borderRadius:3},min:18,max:100}),e.jsx("span",{className:"text-shell-dim",children:"–"}),e.jsx("input",{type:"number",placeholder:"Max",value:s.ageMax??"",onChange:t=>{const d=t.target.value;n("ageMax",d===""?null:Number(d))},onBlur:t=>{const d=t.target.value;n("ageMax",d===""?null:Number(d))},className:"w-full border bg-transparent px-2 py-1.5 font-shell-mono text-[12px] tabular-nums placeholder:text-shell-dim focus:border-shell-fg focus:outline-none",style:{borderColor:"var(--shell-rule)",borderRadius:3},min:18,max:100})]})}),e.jsx(k,{title:"Gender",children:e.jsx("div",{className:"space-y-1",children:P.map(t=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px] hover:text-shell-fg",children:[e.jsx("input",{type:"checkbox",checked:h(t.display),onChange:()=>g(t.display),className:"h-3.5 w-3.5 cursor-pointer accent-shell-accent"}),e.jsx("span",{className:h(t.display)?"text-shell-fg":"text-shell-dim",children:t.display})]},t.display))})}),e.jsx(k,{title:"Has Children",children:e.jsx(je,{value:s.hasChildren,onChange:t=>n("hasChildren",t)})}),e.jsx(k,{title:"Marital Status",children:e.jsx(D,{options:a.marital_statuses,selected:s.maritalStatuses,onToggle:t=>N("maritalStatuses",t),formatLabel:E})}),e.jsx(k,{title:"State / Region",children:e.jsx(ye,{options:me,selected:s.states,onToggle:t=>N("states",t),placeholder:"Search states…"})}),e.jsx(k,{title:"Ethnicity",children:e.jsx("div",{className:"space-y-1",children:ge.map(t=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px] hover:text-shell-fg",children:[e.jsx("input",{type:"checkbox",checked:s.ethnicities.includes(t.value),onChange:()=>S(t.value),className:"h-3.5 w-3.5 cursor-pointer accent-shell-accent"}),e.jsx("span",{className:s.ethnicities.includes(t.value)?"text-shell-fg":"text-shell-dim",children:t.display})]},t.value))})}),e.jsx(k,{title:"Income",children:e.jsx(D,{options:a.income_brackets,selected:s.incomeBrackets,onToggle:t=>N("incomeBrackets",t),formatLabel:E})}),e.jsx(k,{title:"Education",children:e.jsx("div",{className:"space-y-1",children:fe.map(t=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px] hover:text-shell-fg",children:[e.jsx("input",{type:"checkbox",checked:s.educationLevels.includes(t.value),onChange:()=>w(t.value),className:"h-3.5 w-3.5 cursor-pointer accent-shell-accent"}),e.jsx("span",{className:s.educationLevels.includes(t.value)?"text-shell-fg":"text-shell-dim",children:t.display})]},t.value))})}),e.jsx(k,{title:"Political Lean",children:e.jsx(D,{options:a.political_leans,selected:s.politicalLeans,onToggle:t=>N("politicalLeans",t),formatLabel:E})})]})}function k({title:s,children:l}){return e.jsxs("div",{children:[e.jsx(y,{as:"div",className:"mb-2",children:s}),l]})}function D({options:s,selected:l,onToggle:a,maxVisible:o=10,formatLabel:x}){const[i,r]=c.useState(!1),p=i?s:s.slice(0,o),m=s.length>o,n=x||E;return s.length===0?e.jsx("div",{className:"text-[11px] text-shell-dim",children:"No options available"}):e.jsxs("div",{className:"space-y-1",children:[p.map(g=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px] hover:text-shell-fg",children:[e.jsx("input",{type:"checkbox",checked:l.includes(g),onChange:()=>a(g),className:"h-3.5 w-3.5 cursor-pointer accent-shell-accent"}),e.jsx("span",{className:l.includes(g)?"text-shell-fg":"text-shell-dim",children:n(g)})]},g)),m&&e.jsx("button",{onClick:()=>r(!i),className:"mt-1 font-shell-mono text-[10px] uppercase tracking-mono text-shell-dim hover:text-shell-fg",children:i?"− Show less":`+ ${s.length-o} more`})]})}function je({value:s,onChange:l}){return e.jsx("div",{className:"flex gap-1",children:[{label:"Any",val:null},{label:"Yes",val:!0},{label:"No",val:!1}].map(({label:a,val:o})=>e.jsx("button",{onClick:()=>l(o),className:`flex-1 border py-1 font-shell-mono text-[10px] uppercase tracking-mono ${s===o?"border-shell-fg text-shell-fg":"border-shell-rule text-shell-dim hover:text-shell-fg"}`,style:{borderRadius:3},children:a},a))})}function ye({options:s,selected:l,onToggle:a,placeholder:o}){const[x,i]=c.useState(""),[r,p]=c.useState(!1),m=c.useMemo(()=>
1{if(!x)return s;const n=x.toLowerCase();return s.filter(g=>g.toLowerCase().includes(n))},[s,x]);return e.jsxs("div",{className:"relative",children:[l.length>0&&e.jsx("div",{className:"mb-2 flex flex-wrap gap-1",children:l.map(n=>e.jsxs("span",{className:"flex items-center gap-1 border px-1.5 py-0.5 font-shell-mono text-[10px] uppercase",style:{borderColor:"var(--shell-accent)",borderRadius:2},children:[n,e.jsx("button",{onClick:()=>a(n),className:"text-shell-dim hover:text-shell-fg",children:"×"})]},n))}),e.jsx("input",{type:"text",placeholder:o,value:x,onChange:n=>i(n.target.value),onFocus:()=>p(!0),className:"w-full border bg-transparent px-2 py-1.5 text-[12px] placeholder:text-shell-dim focus:border-shell-fg focus:outline-none",style:{borderColor:"var(--shell-rule)",borderRadius:3}}),r&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>p(!1)}),e.jsx("div",{className:"absolute left-0 right-0 z-20 mt-1 max-h-48 overflow-y-auto border bg-shell-bg",style:{borderColor:"var(--shell-rule)",borderRadius:4},children:m.length===0?e.jsx("div",{className:"px-2 py-2 text-[11px] text-shell-dim",children:"No matches"}):m.slice(0,20).map(n=>e.jsxs("button",{onClick:()=>{a(n),i("")},className:`flex w-full items-center gap-2 px-2 py-1.5 text-left text-[12px] hover:bg-shell-paper ${l.includes(n)?"text-shell-accent":""}`,children:[e.jsx("span",{className:`h-3 w-3 flex-shrink-0 border ${l.includes(n)?"border-shell-accent bg-shell-accent":"border-shell-rule"}`,style:{borderRadius:2},children:l.includes(n)&&e.jsx("span",{className:"flex h-full w-full items-center justify-center text-[8px] text-shell-bg",children:"✓"})}),n]},n))})]})]})}function ve({pinnedPersonas:s,onRemove:l,onClearAll:a}){const o=W();if(s.length===0)return null;const x=()=>{const i=s.map(r=>r.persona_id).join(",");o(`/studies/new?personas=${encodeURIComponent(i)}`)};return e.jsx("aside",{className:"w-[280px] flex-shrink-0 space-y-4 self-start sticky",style:{minWidth:280,top:72},children:e.jsxs("div",{className:"border p-5",style:{borderColor:"var(--shell-rule)",borderRadius:6,background:"var(--shell-paper)"},children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(y,{as:"div",children:"Pinned for comparison"}),e.jsxs("div",{className:"mt-2 font-shell-serif text-3xl leading-none tracking-tight",children:[e.jsx(M,{children:s.length}),e.jsx("span",{className:"ml-2 text-[15px] text-shell-dim",children:s.length===1?"subject":"subjects"})]})]}),e.jsx("button",{onClick:a,className:"font-shell-mono text-[10px] uppercase tracking-mono text-shell-dim hover:text-shell-fg",children:"Clear all"})]}),e.jsx("p",{className:"mt-4 text-[13px] leading-relaxed text-shell-dim",children:"Pin rows (⊟) to compare personas side by side, build a panel, or launch a study."}),e.jsx("ul",{className:"mt-4 space-y-3 border-t pt-4",style:{borderColor:"var(--shell-rule)"},children:s.map(i=>e.jsx("li",{className:"group",children:e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(Ne,{name:i.name,imageUrl:i.profile_thumbnail_url||i.profile_image_url}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("span",{className:"truncate text-[13px]",children:i.name}),e.jsx("button",{onClick:()=>l(i.persona_id),className:"flex-shrink-0 font-shell-mono text-[10px] text-shell-dim opacity-0 transition-opacity hover:text-shell-fg group-hover:opacity-100",title:"Remove from comparison",children:"✕"})]}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 font-shell-mono text-[10px] tracking-mono text-shell-dim",children:[e.jsx("span",{className:"tabular-nums",children:i.age}),e.jsx("span",{children:"·"}),e.jsx("span",{className:"truncate",children:z(i.occupation,16)})]}),i.interest_tags&&i.interest_tags.length>0&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:i.interest_tags.slice(0,2).map(r=>e.jsx("span",{className:"border px-1.5 py-0.5 font-shell-mono text-[9px] uppercase tracking-mono text-shell-dim",style:{borderColor:"var(--shell-rule)",borderRadius:2},children:z(r,12)},r))})]})]})},i.persona_id))}),e.jsx("div",{className:"mt-5",children:e.jsx("button",{onClick:x,className:"w-full bg-shell-live py-2 font-shell-mono text-[11px] uppercase tracking-mono text-shell-bg hover:opacity-90",style:{borderRadius:4},children:"▶ Launch study with panel"})})]})})}function Ne({name:s,imageUrl:l}){const a=Ce(s);return l?e.jsx("img",{src:l,alt:s,className:"h-8 w-8 flex-shrink-0 object-cover",style:{borderRadius:3,border:"1px solid var(--shell-rule-strong)"}}):e.jsx("span",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center font-shell-mono text-[10px] uppercase tracking-mono",style:{borderRadius:3,background:ke(a),color:"var(--shell-fg)",border:"1px solid var(--shell-rule-strong)"},children:a})}
1function Ce(s){return s.split(/\s+/).filter(Boolean).slice(0,2).map(l=>{var a;return((a=l[0])==null?void 0:a.toUpperCase())??""}).join("")}function z(s,l){return s?s.length<=l?s:s.slice(0,l-1)+"…":"—"}function ke(s){const l=["oklch(0.42 0.07 50)","oklch(0.42 0.08 150)","oklch(0.42 0.1 300)","oklch(0.4 0.04 260)","oklch(0.42 0.08 85)","oklch(0.4 0.08 20)","oklch(0.42 0.09 200)","oklch(0.4 0.08 340)"];let a=0;for(let o=0;o<s.length;o++)a=(a<<5)-a+s.charCodeAt(o),a|=0;return l[Math.abs(a)%l.length]}const Se=50,Le=300;function Me(s){const l={},a=s.get("ageMin"),o=s.get("ageMax");a&&(l.ageMin=Number(a)),o&&(l.ageMax=Number(o));const x=s.get("gender");x&&(l.genders=x.split(",").filter(Boolean));const i=s.get("ethnicity");i&&(l.ethnicities=i.split(",").filter(Boolean));const r=s.get("state");r&&(l.states=r.split(",").filter(Boolean));const p=s.get("income");p&&(l.incomeBrackets=p.split(",").filter(Boolean));const m=s.get("education");m&&(l.educationLevels=m.split(",").filter(Boolean));const n=s.get("political");n&&(l.politicalLeans=n.split(",").filter(Boolean));const g=s.get("hasChildren");g==="true"?l.hasChildren=!0:g==="false"&&(l.hasChildren=!1);const h=s.get("marital");h&&(l.maritalStatuses=h.split(",").filter(Boolean));const S=s.get("name");S&&(l.nameContains=S);const w=s.get("text");return w&&(l.textContains=w),l}function we(s){const l=new URLSearchParams;return s.ageMin!==null&&l.set("ageMin",String(s.ageMin)),s.ageMax!==null&&l.set("ageMax",String(s.ageMax)),s.genders.length>0&&l.set("gender",s.genders.join(",")),s.ethnicities.length>0&&l.set("ethnicity",s.ethnicities.join(",")),s.states.length>0&&l.set("state",s.states.join(",")),s.incomeBrackets.length>0&&l.set("income",s.incomeBrackets.join(",")),s.educationLevels.length>0&&l.set("education",s.educationLevels.join(",")),s.politicalLeans.length>0&&l.set("political",s.politicalLeans.join(",")),s.hasChildren!==null&&l.set("hasChildren",String(s.hasChildren)),s.maritalStatuses.length>0&&l.set("marital",s.maritalStatuses.join(",")),s.nameContains&&l.set("name",s.nameContains),s.textContains&&l.set("text",s.textContains),l}function Re(){const{user:s}=le(),[l,a]=te(),[o,x]=c.useState("public"),[i,r]=c.useState(!1),p=c.useRef(null),m=c.useRef(!1),{options:n,isLoading:g}=ae(),[h,S]=c.useState(()=>({...G,...Me(l)})),w={publicOnly:o==="public",userId:o==="mine"?s==null?void 0:s.id:void 0,limit:Se},{results:N,totalCount:t,isLoading:d,filters:b,setFilters:f,search:C,resetFilters:U,hasActiveFilters:Ae,currentPage:A,setCurrentPage:R,totalPages:I}=ne(h,w);c.useEffect(()=>{m.current&&i&&(m.current=!1,C())},[b,i,C]);const B=c.useCallback(u=>{S(u);const v=we(u);a(v,{replace:!0}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{f(u),R(1),m.current=!0},Le)},[f,R,a]),Q=c.useCallback(()=>{S(G),a(new URLSearchParams,{replace:!0}),U(),m.current=!0},[U,a]);c.useEffect(()=>{!i&&!g&&(r(!0),f(h),C())},[i,g,h,f,C]),c.useEffect(()=>{i&&(R(1),m.current=!0,f(h))},[o]);const F=l.get("name")??"";c.useEffect(()=>{if(!i||F===h.nameContains)return;const u={...h,nameContains:F};S(u),f(u),R(1),m.current=!0},[F,i]);const J=c.useCallback((u,v)=>{const j={...h,nameContains:u,textContains:v};B(j)},[h,B]),H=c.useCallback(u=>{R(u),setTimeout(()=>C(),0)},[R,C]),Y=h.ageMin!==null||h.ageMax!==null||h.genders.length>0||h.ethnicities.length>0||h.states.length>0||h.hasChildren!==null||h.maritalStatuses.length>0||h.incomeBrackets.length>0||h.educationLevels.length>0||h.politicalLeans.length>0,[L,O]=c.useState([]),[V,T]=c.useState(new Map);c.useEffect(()=>{N.length>0&&T(u=>{const v=new Map(u);for(const j of N)L.includes(j.persona_id)&&v.set(j.persona_id,j);return v})},[N,L]);const q=c.useCallback(u=>{O(j=>j.includes(u)?j.filter(se=>se!==u):[...j,u]);const v=N.find(j=>j.persona_id===u);v&&!L.includes(u)&&T(j=>new Map(j).set(u,v))},[N,L]),X=c.useCallback(()=>{O([]),T(new Map)},[]),Z=c.useCallback(u=>{O(v=>v.filter(j=>j!==u)),T(v=>{const j=new Map(v);return j.delete(u),j})},[]),ee=c.useMemo(()=>L.map(u=>V.get(u)).filter(u=>u!==void 0),[L,V]);return e.jsxs("div",{className:"mx-auto max-w-[1600px] px-6 py-10",children:[e.jsx(ie,{totalCount:t,isLoading:d&&!i}),e.jsx(oe,{onSearch:J,isLoading:d,initialName:h.nameContains,initialProfile:h.textContains}),e.jsx("div",{className:"mt-6 flex items-center justify-between border-b pb-3",style:{borderColor:"var(--shell-rule)"},children:e.jsxs("div",{className:"flex gap-6",children:[e.jsxs(K,{active:o==="public",onClick:()=>x("public"),children:["Public"," ",o==="public"&&!d&&e.jsx(M,{className:"ml-1",children:t.toLocaleStr
1ing()})]}),e.jsxs(K,{active:o==="mine",onClick:()=>x("mine"),children:["Mine"," ",o==="mine"&&!d&&e.jsx(M,{className:"ml-1",children:t.toLocaleString()})]})]})}),e.jsxs("div",{className:"mt-6 flex gap-6",children:[e.jsx(be,{filters:h,onFilterChange:B,filterOptions:n,isLoading:d,resultCount:t,onClear:Q,hasActiveFilters:Y}),e.jsxs("div",{className:"min-w-0 flex-1",children:[d&&e.jsx("div",{className:"py-8 text-center text-shell-dim",children:"Loading personas…"}),!d&&e.jsx(ce,{rows:N,currentUserId:s==null?void 0:s.id,pinnedIds:L,onTogglePin:q}),!d&&N.length>0&&I>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-center gap-4",children:[e.jsx("button",{onClick:()=>H(Math.max(1,A-1)),disabled:A===1,className:"border px-3 py-1.5 font-shell-mono text-[11px] uppercase tracking-mono disabled:opacity-30",style:{borderColor:"var(--shell-rule-strong)",borderRadius:4},children:"← Previous"}),e.jsxs(y,{children:["Page ",e.jsx(M,{children:A})," of ",e.jsx(M,{children:I})]}),e.jsx("button",{onClick:()=>H(Math.min(I,A+1)),disabled:A===I,className:"border px-3 py-1.5 font-shell-mono text-[11px] uppercase tracking-mono disabled:opacity-30",style:{borderColor:"var(--shell-rule-strong)",borderRadius:4},children:"Next →"})]})]}),e.jsx(ve,{pinnedPersonas:ee,onRemove:Z,onClearAll:X})]})]})}function K({active:s,children:l,onClick:a}){return e.jsx("button",{onClick:a,className:`font-shell-mono text-[11px] uppercase tracking-mono ${s?"border-b-2 border-shell-fg pb-2 text-shell-fg":"pb-2 text-shell-dim hover:text-shell-fg"}`,style:{marginBottom:-13},children:l})}function Ee(){return e.jsx(Re,{})}export{Ee 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.