PageSourceSearch

https://aishudash-zzzaadkh.manus.space/assets/TalkieApp-YroMROnv.js

js aishudash-zzzaadkh.manus.space collected 2026-10-03 05:01:33 UTC 277,994 bytes, 29 lines download raw bytes

1import{r as l,j as e,d2 as Ci,ae as ie,u as Qe,a9 as we}from"./vendor-react-CSjVeD5C.js";import{T as oe,t as re,u as Xe,b as Ri}from"./index-DCu_4ttF.js";import{T as r,A as Te,b as Mi,S as Je,L as Fe,H as ve,K as $e,c as Fi,C as Ai,Q as Ei}from"./QRScannerScreen-BEGIiGmI.js";import{T as Pi,a as Li,c as We,b as Nt,D as Di,M as ut,e as Ze,d as zi,r as Vi,F as $i,p as Wi,G as Ni,o as Oi,n as _i,I as Bi,E as Ui,A as Hi,q as Ki,N as qi,x as Yi,w as Gi,v as Qi,t as Xi,y as Ji,z as Zi,B as ea}from"./SafetySettingsScreen-xwReiSVm.js";import{u as me}from"./useReducedMotion-Bx2Vawh9.js";import{T as H,t as ta,a as ia,b as Be,c as Ot,u as _t,d as Ue,p as aa,r as ra,e as be,g as na,f as sa,h as la,i as ft,j as oa,k as pt,l as ca,m as Ee}from"./talkieMemoryScope-DYfSTG6r.js";import{u as da}from"./useVoiceRecorder-w_Z2IWBc.js";import"./vendor-misc-DNIZ_o8-.js";import"./vendor-ui-BQCqNqg0.js";import"./vendor-charts-CTZ3m9kf.js";import"./vendor-ai-CwA6B3_0.js";import"./ReactorRingCode-5G-n2MbI.js";import"./vendor-three-ByiC_fHE.js";import"./tokens-NEGxNI-7.js";import"./useUndoDelete-9lVFzTic.js";import"./LocationPreviewModal-ByUjK-Ct.js";import"./LumoraStickerPanel-SXPvviZb.js";import"./shareLocation-DxnBFohl.js";const xt={sent:0,delivered:1,read:2};function ua(){const t=new Map,i=new Set,a=()=>i.forEach(s=>s());function n(s,o,d){const c=t.get(s);c&&xt[c.status]>xt[o]||(t.set(s,{status:o,ts:d}),a())}return{noteSent(s,o,d=Date.now()){n(s,o,d)},noteReceipt(s,o,d=Date.now()){n(s,o,d)},statusFor(s){return t.get(s)},clear(s){t.delete(s)&&a()},subscribe(s){return i.add(s),()=>i.delete(s)}}}const fa=`${oe.name} · AISHU.MY`;function pa(t){return{...t,footer:fa}}function xa(t,i=ua()){const a=(s,o,d)=>i.noteSent(s,o??"delivered",d);return{engine:new Proxy(t,{get(s,o,d){if(o==="sendMessage")return async(...u)=>{const f=await s.sendMessage(...u);return a(u[0],f.status,f.ts),f};if(o==="sendVoiceNote")return async(...u)=>{const f=await s.sendVoiceNote(...u);return a(u[0],f.status,f.ts),f};if(o==="sendImage")return async(...u)=>{const f=await s.sendImage(...u);return a(u[0],f.status,f.ts),f};if(o==="sendLocation")return async(...u)=>{const f=await s.sendLocation(...u);return a(u[0],f.status,f.ts),f};if(o==="receipts$")return u=>{const f=s.receipts$(u);return{subscribe(x){return f.subscribe(h=>{i.noteReceipt(u,h.status,h.ts),x(h)})},getValue:()=>f.getValue()}};if(o==="getProfile")return async()=>pa(await s.getProfile());const c=Reflect.get(s,o);return typeof c=="function"?c.bind(s):c}}),outbox:i}}const ka="aishu.talkie.prefs.v1:";function Bt(t){return`${ka}${t??"anon"}`}function ha(t,i,a){const n={...t[i],...a},s={...t};return!n.pinned&&!n.muted&&!n.archived&&!n.markedUnread?delete s[i]:s[i]=n,s}function Ut(t,i){return t[i]??{}}function ga(t){try{const i=localStorage.getItem(Bt(t));if(!i)return{};const a=JSON.parse(i);return a&&typeof a=="object"?a:{}}catch{return{}}}function ya(t,i){try{localStorage.setItem(Bt(t),JSON.stringify(i))}catch{}}function ma(t){let i=ga(t);const a=new Set,n=()=>a.forEach(s=>s());return{getPrefs(){return i},update(s,o){i=ha(i,s,o),ya(t,i),n()},subscribe(s){return a.add(s),()=>a.delete(s)}}}const Re=[1,1.25,1.5,2],Ht=1;function Sa(t){const i=Re.indexOf(t);return i<0?Ht:Re[(i+1)%Re.length]}function Ne(t){const i=typeof t=="number"?t:Number(t);return Re.includes(i)?i:Ht}function et(t){return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function ba(t,i,a){return a<=0?0:et((t-i)/a)}function Pe(t,i){return!Number.isFinite(i)||i<=0?0:et(t)*i}function va(t,i){return!Number.isFinite(i)||i<=0?0:et(t/i)}function ke(t){const i=Math.max(0,Math.floor(Number.isFinite(t)?t:0));return`${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`}function Ta(t,i,a){return a?!0:!Number.isFinite(i)||i<=0?!1:t>=i-.05}const He={autoplayVoiceReplies:!1,playbackSpeed:1},ja="aishu.talkie.voiceprefs.v1:";function Kt(t){return`${ja}${t??"anon"}`}function qt(t){if(!t||typeof t!="object")return{...He};const i=t;return{autoplayVoiceReplies:i.autoplayVoiceReplies===!0,playbackSpeed:Ne(i.playbackSpeed)}}function wa(t){try{const i=localStorage.getItem(Kt(t));return i?qt(JSON.parse(i)):{...He}}catch{return{...He}}}function Ia(t,i){try{localStorage.setItem(Kt(t),JSON.stringify(i))}catch{}}function Ca(t){let i=wa(t);const a=new Set,n=()=>
1a.forEach(s=>s());return{getPrefs(){return i},update(s){i=qt({...i,...s}),Ia(t,i),n()},subscribe(s){return a.add(s),()=>a.delete(s)}}}const Ke={autoplayGlimpses:!1,dataSaving:!1},Ra="aishu.talkie.visionprefs.v1:";function Yt(t){return`${Ra}${t??"anon"}`}function Gt(t){if(!t||typeof t!="object")return{...Ke};const i=t;return{autoplayGlimpses:i.autoplayGlimpses===!0,dataSaving:i.dataSaving===!0}}function Ma(t){try{const i=localStorage.getItem(Yt(t));return i?Gt(JSON.parse(i)):{...Ke}}catch{return{...Ke}}}function Fa(t,i){try{localStorage.setItem(Yt(t),JSON.stringify(i))}catch{}}function Aa(t){let i=Ma(t);const a=new Set,n=()=>a.forEach(s=>s());return{getPrefs(){return i},update(s){i=Gt({...i,...s}),Fa(t,i),n()},subscribe(s){return a.add(s),()=>a.delete(s)}}}const Ea=350,Qt=1600;function Xt(t){return t.failed&&!t.acked?"returned":t.acked?t.memoryPersisted?"remembered":t.receipt==="read"?"received":"reached":t.nowMs-t.releasedAtMs>=Ea?"crossing":"released"}function tt(t){return t==="reached"||t==="received"||t==="remembered"||t==="returned"}const kt={released:H.traversalReleased,crossing:H.traversalCrossing,reached:H.traversalReached,received:H.traversalReceived,remembered:H.traversalRemembered,returned:H.uploadFailed};function Jt(){const t=new Set;return{shouldShow(i){return!t.has(i)},markShown(i){t.add(i)},has(i){return t.has(i)}}}function Pa(t){let i=2166136261;for(let a=0;a<t.length;a++)i^=t.charCodeAt(a),i=Math.imul(i,16777619);return(i>>>0).toString(16).padStart(8,"0")}function Zt(t){const i=t.voice??{},a=(t.text??"").slice(0,200);return Pa([t.clientMessageId,String(i.characterId??0),i.voiceId??"default-voice",i.modelId??"default-model",a].join("|"))}function ei({speak:t}){const i=new Map;return{request(a,n){const s=i.get(a);if(s){if(s.settled&&s.settled.phase!=="failed")return Promise.resolve(s.settled);if(!s.settled)return s.promise}const o={promise:null,settled:null},d=(async()=>{try{const c=await t(n),u=typeof c?.audioUrl=="string"&&c.audioUrl.length>0?c.audioUrl:null;return u?{phase:"ready",audioUrl:u}:{phase:"textFallback",audioUrl:null}}catch{return{phase:"failed",audioUrl:null}}})();return o.promise=d,d.then(c=>{o.settled=c}),i.set(a,o),d},stateFor(a){return i.get(a)?.settled??null},forget(a){i.delete(a)}}}const La=28;function Da(t){return Array.from({length:La},(i,a)=>.2+(a*7+Math.floor(t*3))%17/17*.8)}function qe({src:t,durationSec:i=0,waveform:a,transcript:n,title:s,autoPlay:o=!1,defaultSpeed:d=1,onSpeedChange:c,compact:u=!1}){const[f,x]=l.useState(!1),[h,p]=l.useState(!1),[I,P]=l.useState(!1),[g,R]=l.useState(0),[b,z]=l.useState(0),[w,j]=l.useState(!1),[S,A]=l.useState(d),[m,k]=l.useState(!1),[y,T]=l.useState(!1),_=l.useRef(null),K=l.useRef(null),V=l.useRef(null),M=l.useRef(!1),v=l.useMemo(()=>a&&a.length>0?a:Da(i),[a,i]),E=!!n&&n.trim().length>0,L=l.useCallback(()=>{_.current&&(_.current.pause(),_.current=null),K.current&&(URL.revokeObjectURL(K.current),K.current=null),x(!1),R(0),z(0),j(!1)},[]);l.useEffect(()=>{L(),P(!1)},[t]),l.useEffect(()=>L,[L]);const U=l.useCallback(async()=>{if(_.current)return _.current;p(!0);try{let B=t;if(!t.startsWith("blob:")){const se=await fetch(t);if(!se.ok)throw new Error(`Audio fetch failed: ${se.status}`);const de=await se.blob();K.current=URL.createObjectURL(de),B=K.current}const J=new Audio(B);return J.playbackRate=S,J.ontimeupdate=()=>{const se=J.duration||i||1;z(J.currentTime),R(va(J.currentTime,se))},J.onended=()=>{x(!1),j(!0),R(1)},J.onerror=()=>{x(!1),P(!0)},_.current=J,J}catch{return P(!0),null}finally{p(!1)}},[t,S,i]),Q=l.useCallback(async()=>{if(h||I)return;const B=await U();if(B){if(f){B.pause(),x(!1);return}w&&(B.currentTime=0),j(!1);try{await B.play(),x(!0)}catch{P(!0)}}},[h,I,U,f,w]),D=l.useCallback(async()=>{const B=await U();if(B){B.currentTime=0,j(!1);try{await B.play(),x(!0)}catch{P(!0)}}},[U]);l.useEffect(()=>{!o||M.current||(M.current=!0,(async()=>{const B=await U();if(B)try{await B.play(),x(!0)}catch{}})())},[o,t]);const N=l.useCallback(async B=>{const J=V.current;if(!J)return;const se=J.getBoundingClientRect(),de=ba(B,se.left,se.width),he=await U();if(!he)return;const je=he.duration||i;je<=0||(he.currentTime=Pe(de,Number.isFinite(he.duration)?he.duration:je),R(de),z(Pe(de,je)),j(!1))},[U,i]),Z=l.useCallback(()=>{const B=Sa(S);A(B),_.current&&(_.current.playbackRate=B),c?.(B)},[S,c]),ce=Math.floor(g*v.length),X=s??H.spokenReply;if(I)return e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:226",role:"alert",style:{display:"flex",alignItems:"center",gap:8,padding:u?"6px 10px":"8px 12px",borderRadius:14,background:"rgba(224,106,133,0.10)",border:"1px solid rgba(224,106,133,0.28)",color:r.roseSoft,fontSize:12},children:H.audioUnavailable});return e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:246",style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:247",style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:249",type:"button",onClick:Q,disabled:h,"aria-label":h?H.audioLoading:f?`${H.pause} ${X}`:`${H.play} ${X}`,style:{width:u?30:36,height:u?30:36,borderRadius:"50%",flexShrink:0,background:`linear-gradient(130deg, ${r.violet}, ${r.violetDeep})`,border:"none",cursor:h?"wait":"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 0 12px rgba(142,99,255,0.35)",opacity:h?.6:1},children:h?e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:276",style:{width:12,height:12,borderRadius:"50%",border:"2px s
1olid rgba(255,255,255,0.35)",borderTopColor:"#fff",animation:"lmSoulRingSpin 0.9s linear infinite"}}):f?e.jsxs("svg",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:287",width:"11",height:"12",viewBox:"0 0 11 12",fill:"none",children:[e.jsx("rect",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:288",x:"1.5",y:"1",width:"3",height:"10",rx:"1",fill:"#fff"}),e.jsx("rect",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:289",x:"6.5",y:"1",width:"3",height:"10",rx:"1",fill:"#fff"})]}):e.jsx("svg",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:292",width:"11",height:"12",viewBox:"0 0 11 12",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:293",d:"M2.5 1.2l7 4.8-7 4.8V1.2z",fill:"#fff"})})}),e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:299",ref:V,role:"slider",tabIndex:0,"aria-label":`${X} — ${ke(b)} of ${ke(i)}`,"aria-valuemin":0,"aria-valuemax":Math.round(i),"aria-valuenow":Math.round(b),"aria-valuetext":`${ke(b)} of ${ke(i)}`,onKeyDown:B=>{B.key==="ArrowRight"?(B.preventDefault(),(_.current?.duration||i)>0&&ae(Math.min(1,g+.05))):B.key==="ArrowLeft"?(B.preventDefault(),ae(Math.max(0,g-.05))):(B.key===" "||B.key==="Enter")&&(B.preventDefault(),Q())},onPointerDown:B=>{B.currentTarget.setPointerCapture(B.pointerId),T(!0),N(B.clientX)},onPointerMove:B=>{y&&N(B.clientX)},onPointerUp:()=>T(!1),style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:2,height:u?22:28,cursor:"pointer",touchAction:"none"},children:v.map((B,J)=>{const se=J<=ce&&g>0;return e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:344",style:{flex:1,minWidth:2,borderRadius:2,height:`${Math.max(12,Math.min(100,B*100))}%`,background:se?r.violetSoft:"rgba(142,99,255,0.30)",transition:y?"none":"background 120ms"}},J)})}),e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:359",style:{fontSize:11,fontFamily:"monospace",color:r.violetSoft,flexShrink:0},children:ke(b>0?b:i)}),e.jsxs("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:364",type:"button",onClick:Z,"aria-label":`Playback speed ${S}×. Activate to change.`,style:{padding:"3px 7px",borderRadius:8,flexShrink:0,background:S===1?"rgba(245,242,252,0.05)":"rgba(142,99,255,0.16)",border:`1px solid ${S===1?r.lineSoft:"rgba(142,99,255,0.4)"}`,color:S===1?r.text66:r.violetSoft,fontSize:10.5,fontWeight:700,cursor:"pointer",fontVariantNumeric:"tabular-nums"},children:[S,"×"]}),Ta(b,i,w)&&e.jsx("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:386",type:"button",onClick:()=>void D(),"aria-label":`${H.replay} ${X}`,style:{width:26,height:26,borderRadius:"50%",flexShrink:0,background:"rgba(245,242,252,0.06)",border:`1px solid ${r.lineSoft}`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:403",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:404",d:"M2 6a4 4 0 1 1 1.2 2.9M2 6V3.5M2 6h2.5",stroke:r.text66,strokeWidth:"1.3",strokeLinecap:"round"})})})]}),E&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:412",children:[e.jsxs("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:413",type:"button",onClick:()=>k(B=>!B),"aria-expanded":m,style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:10.5,color:r.violetSoft,letterSpacing:.4,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx("svg",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:430",width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",style:{transform:m?"rotate(90deg)":"none",transition:"transform 150ms"},children:e.jsx("path",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:437",d:"M2 1l4 3-4 3V1z",fill:r.violetSoft})}),H.transcript]}),m&&e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoicePlayer.tsx:442",style:{marginTop:5,padding:"8px 10px",borderRadius:10,background:"rgba(245,242,252,0.04)",border:`1px solid ${r.lineSoft}`,fontSize:12.5,lineHeight:1.5,color:r.text66},children:n})]})]});function ae(B){return(async()=>{const J=await U();if(!J)return;const se=J.duration||i;se<=0||(J.currentTime=Pe(B,se),R(B),z(Pe(B,se)),j(!1))})()}}const za={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ge({label:t,onPress:i,tone:a="neutral",disabled:n=!1}){const s={neutral:{background:"rgba(245,242,252,0.07)",border:`1px solid ${r.line}`,color:r.text},danger:{background:"rgba(224,106,133,0.14)",border:"1px solid rgba(224,106,133,0.35)",color:r.roseSoft},primary:{background:`linear-gradient(130deg, ${r.violet}, ${r.pink})`,border:"none",color:"#fff",boxShadow:"0 0 14px rgba(142,99,255,0.4)"}};return e.jsx("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:68",type:"button",onClick:i,disabled:n,style:{padding:"8px 14px",borderRadius:12,fontSize:12,fontWeight:600,cursor:n?"wait":"pointer",opacity:n?.6:1,...s[a]},children:t})}function Va({waveform:t,live:i}){const a=t.length>0?t:[.12];return e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:90",style:{display:"flex",alignItems:"center",gap:2,height:26,flex:1,minWidth:0,overflow:"hidden"}
1,"aria-hidden":!0,children:a.map((n,s)=>e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:92",style:{flex:1,minWidth:2,maxWidth:5,borderRadius:2,height:`${Math.max(10,Math.min(100,n*100))}%`,background:s===a.length-1&&i?r.violetSoft:`rgba(142,99,255,${.3+n*.55})`,transition:"height 90ms linear"}},s))})}function ti({ritual:t,defaultSpeed:i=1,onSpeedChange:a}){const{state:n,duration:s,waveform:o,take:d,gestureIntent:c,capturing:u}=t,f=n.phase,x=l.useRef(null),h=l.useRef(null),p=l.useMemo(()=>d?URL.createObjectURL(d.blob):null,[d]);l.useEffect(()=>()=>{p&&URL.revokeObjectURL(p)},[p]);const I=ta(n),P=u&&s>=Be-10,g=e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:139",ref:h,role:"button",tabIndex:0,"aria-label":f==="idle"?`${H.holdToRecord}. Keyboard: Space to start, Space again to send, Escape to cancel, L to lock.`:I,"aria-keyshortcuts":"Space Enter Escape KeyL",title:H.holdToRecord,onKeyDown:w=>{w.repeat||(w.key===" "||w.key==="Enter"?(w.preventDefault(),f==="idle"?t.pressStart():f==="recording"?t.send():f==="locked"&&!n.context.takeReady&&t.stopLockedTake()):w.key==="Escape"?(w.preventDefault(),t.cancel()):w.key.toLowerCase()==="l"&&(w.preventDefault(),t.lock()))},onPointerDown:w=>{f==="idle"&&(w.preventDefault(),h.current?.setPointerCapture(w.pointerId),x.current={x:w.clientX,y:w.clientY},t.pressStart())},onPointerMove:w=>{x.current&&t.pressMove(w.clientX-x.current.x,w.clientY-x.current.y)},onPointerUp:()=>{x.current&&(x.current=null,t.pressRelease())},onPointerCancel:()=>{x.current=null,t.cancel()},style:{position:"absolute",right:14,bottom:78,zIndex:30,width:46,height:46,borderRadius:"50%",background:f==="recording"?`linear-gradient(130deg, ${r.pink}, ${r.violet})`:`linear-gradient(130deg, ${r.violet}, ${r.violetDeep})`,border:`1.5px solid ${f==="idle"?"rgba(201,180,255,0.35)":"rgba(255,255,255,0.45)"}`,boxShadow:f==="recording"?"0 0 22px rgba(244,95,181,0.55)":"0 0 16px rgba(142,99,255,0.45)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",touchAction:"none",userSelect:"none",transform:f==="recording"?"scale(1.08)":"scale(1)",transition:"transform 140ms ease-out, box-shadow 140ms ease-out"},children:e.jsxs("svg",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:212",width:"16",height:"20",viewBox:"0 0 16 20",fill:"none","aria-hidden":!0,children:[e.jsx("rect",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:213",x:"5",y:"1.5",width:"6",height:"10",rx:"3",stroke:"#fff",strokeWidth:"1.5"}),e.jsx("path",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:214",d:"M2.5 9.5a5.5 5.5 0 0 0 11 0M8 15v3.5M5.5 18.5h5",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})]})}),R=(f==="recording"||f==="locked")&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:221",style:{position:"absolute",left:0,right:0,bottom:0,zIndex:40,padding:"10px 16px calc(env(safe-area-inset-bottom, 4px) + 10px)",background:"rgba(11,7,20,0.96)",backdropFilter:"blur(16px)",borderTop:`1px solid ${r.lineSoft}`,display:"flex",flexDirection:"column",gap:8},children:[f==="recording"&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:239",style:{display:"flex",justifyContent:"space-between",fontSize:10,letterSpacing:.6},"aria-hidden":!0,children:[e.jsxs("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:240",style:{color:c==="cancel"?r.roseSoft:r.text40},children:["◂ ",H.slideToCancel]}),e.jsxs("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:243",style:{color:c==="lock"?r.violetSoft:r.text40},children:[H.slideToLock," ▸▴"]})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:249",style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:251","aria-hidden":!0,style:{width:9,height:9,borderRadius:"50%",flexShrink:0,background:u?"#FF5A5A":r.violet,animation:u?"lmPulse 1.1s ease-in-out infinite":"none"}}),e.jsx(Va,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:262",waveform:o,live:u}),e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:263",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",flexShrink:0},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:264",style:{fontSize:14,fontFamily:"monospace",color:r.violetSoft,fontVariantNumeric:"tabular-nums"},children:ke(s)}),P&&e.jsxs("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:268",style:{fontSize:9,color:r.warn},children:["ends at ",ke(Be)]})]})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:276",style:{display:"flex",alignItems:"center",gap:8,justifyContent:"flex-end"},children:[e.jsx(ge,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:277",label:H.discard,tone:"danger",onPress:t.cancel}),f==="recording"&&e.jsx(ge,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:278",label:"Lock",onPress:t.lock}),f==="locked"&&!n.context.takeReady&&e.jsx(ge,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:280",label:H.stopTake,onPress:t.stopLockedTake}),e.jsx(ge,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:282",label:H.send,tone:"primary",onPress:t.send})]}),f==="locked"&&n.context.takeReady&&d&&p&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:287",style:{padding:"10px 12px",borderRadius:14,background:"rgba(142,99,255,0.07)",border:`1px solid ${r.lineSoft}`,display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:298",style:{fontSize:10,
1color:r.violetSoft,letterSpacing:1,textTransform:"uppercase"},children:[H.preview," · ",ke(d.durationSec)]}),e.jsx(qe,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:301",src:p,durationSec:d.durationSec,waveform:d.waveform,title:"Your take",defaultSpeed:i,onSpeedChange:a,compact:!0})]})]}),b=(f==="processing"||f==="uploading")&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:317",style:{position:"absolute",left:16,right:16,bottom:82,zIndex:40,display:"flex",alignItems:"center",gap:10,padding:"10px 14px",borderRadius:14,background:"rgba(18,12,32,0.94)",border:`1px solid ${r.lineSoft}`},role:"status",children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:334","aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:r.violet,animation:"lmPulse 1s ease-in-out infinite"}}),e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:344",style:{fontSize:12.5,color:r.text},children:f==="processing"?H.preparing:H.crossing}),d&&e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:348",style:{marginLeft:"auto",fontSize:11,fontFamily:"monospace",color:r.text40},children:ke(d.durationSec)})]}),z=(f==="failed"||f==="cancelled")&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:357",style:{position:"absolute",left:16,right:16,bottom:82,zIndex:40,padding:"12px 14px",borderRadius:16,background:"rgba(24,14,28,0.96)",border:`1px solid ${f==="failed"?"rgba(224,106,133,0.3)":"rgba(232,180,90,0.28)"}`,display:"flex",flexDirection:"column",gap:10,animation:"lmSoftPop 220ms ease-out"},role:"alert",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:375",style:{fontSize:12.5,color:f==="failed"?r.roseSoft:r.warn,lineHeight:1.45},children:f==="failed"&&n.context.failureReason?ia(n.context.failureReason):n.context.interrupted?n.context.draftPreserved?`${H.recordingInterrupted} ${H.draftKept}`:H.recordingInterrupted:"Recording cancelled."}),d&&p&&e.jsx(qe,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:387",src:p,durationSec:d.durationSec,waveform:d.waveform,title:"Your take",defaultSpeed:i,onSpeedChange:a,compact:!0}),e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:398",style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx(ge,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:399",label:f==="failed"?H.discard:H.close,onPress:t.dismiss}),f==="failed"&&n.context.failureReason==="upload"&&d&&e.jsx(ge,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:404",label:H.tryAgain,tone:"primary",onPress:t.retry}),f==="cancelled"&&n.context.draftPreserved&&d&&e.jsx(ge,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:407",label:H.sendAnyway,tone:"primary",onPress:t.send})]})]});return e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceRecorder.tsx:416","aria-live":"polite",role:"status",style:za,children:I}),g,R,b,z]})}const $a=`
2@keyframes talkieTraverse {
3  0% { left: 0%; opacity: 0.5; }
4  15% { opacity: 1; }
5  85% { opacity: 1; }
6  100% { left: calc(100% - 10px); opacity: 0.6; }
7}
8@keyframes talkieTraverseBack {
9  0% { left: calc(55% - 5px); opacity: 1; }
10  100% { left: 0%; opacity: 0.9; }
11}
12@keyframes talkieShoreGlow {
13  0%,100% { box-shadow: 0 0 6px rgba(142,99,255,0.4); }
14  50% { box-shadow: 0 0 14px rgba(142,99,255,0.9); }
15}
16`;function ii({stage:t,reducedMotion:i,onKeepInMemory:a,keepBusy:n=!1}){const s=t==="returned",o=t==="reached"||t==="received"||t==="remembered";return i?e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:64",role:"status","aria-live":"polite",style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",borderRadius:999,background:s?"rgba(224,106,133,0.14)":"rgba(18,12,32,0.94)",border:`1px solid ${s?"rgba(224,106,133,0.35)":"rgba(142,99,255,0.25)"}`,color:s?r.roseSoft:r.text,fontSize:12,fontWeight:500},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:80",style:{width:6,height:6,borderRadius:"50%",background:s?r.rose:r.violet,flexShrink:0}}),kt[t],o&&!s&&a&&t!=="remembered"&&e.jsx(ht,{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:91",onClick:a,busy:n})]}):e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:98",role:"status","aria-live":"polite",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:7,padding:"12px 18px 10px",borderRadius:18,background:"rgba(18,12,32,0.94)",backdropFilter:"blur(16px)",border:`1px solid ${s?"rgba(224,106,133,0.32)":"rgba(142,99,255,0.24)"}`,boxShadow:"0 8px 28px rgba(0,0,0,0.45)",animation:"lmSoftPop 220ms ease-out"},children:[e.jsx("style",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:115",children:$a}),e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:117",style:{position:"relative",width:148,height:18,dis
16play:"flex",alignItems:"center"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:119","aria-hidden":!0,style:{position:"absolute",left:-2,width:8,height:8,borderRadius:"50%",background:s?r.rose:r.violetDeep,boxShadow:`0 0 8px ${s?"rgba(224,106,133,0.7)":"rgba(107,75,196,0.7)"}`}}),e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:131","aria-hidden":!0,style:{position:"absolute",right:-2,width:8,height:8,borderRadius:"50%",background:o?r.violet:"rgba(142,99,255,0.3)",animation:o?"talkieShoreGlow 1.6s ease-in-out infinite":"none"}}),e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:144","aria-hidden":!0,style:{position:"absolute",left:6,right:6,height:2,borderRadius:1,background:`linear-gradient(90deg, ${s?"rgba(224,106,133,0.5)":"rgba(142,99,255,0.45)"}, rgba(142,99,255,0.15))`}}),e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:156","aria-hidden":!0,style:{position:"absolute",width:10,height:10,borderRadius:"50%",background:s?r.roseSoft:`linear-gradient(130deg, ${r.violetSoft}, ${r.violet})`,boxShadow:s?"0 0 10px rgba(224,106,133,0.8)":"0 0 10px rgba(142,99,255,0.8)",left:t==="released"?"0%":o?"calc(100% - 10px)":void 0,animation:t==="crossing"?"talkieTraverse 1.1s ease-in-out infinite":s?"talkieTraverseBack 0.9s ease-out forwards":void 0,transition:"left 320ms ease-out"}})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:181",style:{display:"flex",alignItems:"center",gap:8,fontSize:12,fontWeight:600,letterSpacing:.5,color:s?r.roseSoft:o?r.text:r.violetSoft},children:[kt[t],o&&a&&t!=="remembered"&&e.jsx(ht,{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:194",onClick:a,busy:n})]}),tt(t)&&!s&&e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:198",style:{fontSize:9.5,color:r.text40,letterSpacing:1.2,textTransform:"uppercase"},children:t==="remembered"?"Kept in your shared memory":"Confirmed by the far shore"})]})}function ht({onClick:t,busy:i}){return e.jsx("button",{"data-loc":"client/src/features/talkie/voice/TalkieTraversalOverlay.tsx:208",type:"button",onClick:t,disabled:i,"aria-label":H.keepInMemory,style:{marginLeft:2,padding:"3px 9px",borderRadius:999,background:"rgba(142,99,255,0.12)",border:"1px solid rgba(142,99,255,0.32)",color:r.violetSoft,fontSize:10.5,fontWeight:600,cursor:i?"wait":"pointer",opacity:i?.6:1,whiteSpace:"nowrap"},children:i?"Keeping…":H.keepInMemory})}function Wa(t){return new Promise((i,a)=>{const n=new FileReader;n.onloadend=()=>i(n.result),n.onerror=()=>a(new Error("read failed")),n.readAsDataURL(t)})}function Na({engine:t,threadId:i,threadKind:a,participantId:n,voicePrefsStore:s}){const o=re.useUtils(),d=me(),[c,u]=l.useState(()=>s.getPrefs());l.useEffect(()=>s.subscribe(()=>u(s.getPrefs())),[s]);const f=l.useMemo(()=>Ot({sendVoiceNote:(v,E,L,U)=>t.sendVoiceNote(v,E,L,U)}),[t]),x=l.useMemo(()=>ei({speak:v=>o.client.chat.speak.mutate(v)}),[o.client]),h=l.useMemo(()=>Jt(),[]),[p,I]=l.useState(null),[P,g]=l.useState(()=>Date.now()),R=l.useRef(p);R.current=p;const[b,z]=l.useState({kind:"none"}),w=l.useRef(null),j=l.useCallback(async v=>{const E=await Wa(v.blob),L=await f.send(i,{base64Audio:E,mimeType:v.mimeType,durationSec:v.durationSec,clientMessageId:v.clientMessageId});if(I(U=>{const Q=U&&U.clientMessageId===v.clientMessageId?U:{clientMessageId:v.clientMessageId,releasedAtMs:Date.now(),acked:!1,failed:!1,receipt:void 0,memoryPersisted:!1,messageId:null,settledAtMs:null};if(L.ok){const D=/^\d+$/.test(L.message.id)?L.message.id:null;return{...Q,acked:!0,messageId:D}}return{...Q,failed:!0}}),!L.ok)throw new Error(L.error)},[f,i]),S=_t({onUpload:j}),A=S.state.phase,m=S.state.context.clientMessageId;l.useEffect(()=>{(A==="processing"||A==="uploading")&&m&&I(v=>v&&v.clientMessageId===m||!h.shouldShow(m)?v:{clientMessageId:m,releasedAtMs:Date.now(),acked:!1,failed:!1,receipt:void 0,memoryPersisted:!1,messageId:null,settledAtMs:null})},[A,m,h]),l.useEffect(()=>!p||p.settledAtMs!==null?void 0:t.receipts$(i).subscribe(E=>{I(L=>!L||L.clientMessageId!==p.clientMessageId||L.messageId&&E.messageId!==L.messageId||E.status!=="read"&&E.status!=="delivered"?L:{...L,receipt:E.status})}),[t,i,p?.clientMessageId,p?.settledAtMs]);const k=p?Xt({acked:p.acked,failed:p.failed,receipt:p.receipt,memoryPer
16sisted:p.memoryPersisted,releasedAtMs:p.releasedAtMs,nowMs:P}):null;l.useEffect(()=>{if(!p||!k)return;if(!tt(k)){const E=setInterval(()=>g(Date.now()),200);return()=>clearInterval(E)}k!=="returned"&&h.markShown(p.clientMessageId),I(E=>E&&E.settledAtMs===null?{...E,settledAtMs:Date.now()}:E);const v=setTimeout(()=>I(null),Qt);return()=>clearTimeout(v)},[p?.clientMessageId,k]);const[y,T]=l.useState(!1),_=l.useCallback(async()=>{const v=R.current;if(!(!v?.messageId||y)){T(!0);try{await t.saveToMemory(i,v.messageId),I(E=>E&&{...E,memoryPersisted:!0})}catch{}finally{T(!1)}}},[t,i,y]),K=l.useMemo(()=>{const v=parseInt(n??"",10);return Number.isFinite(v)&&v>0?v:void 0},[n]);l.useEffect(()=>{if(A!=="sent"||a!=="luman"||!K)return;let v=!0,E,L=0;const U=8,Q=2500,D=Z=>{const ce=[...Z].reverse().find(ae=>ae.author==="me"),X=[...Z].reverse().find(ae=>ae.author==="them");if(!ce||!X||X.ts<=ce.ts)return!1;if(X.kind==="voice"&&X.audioUrl){const ae=c.autoplayVoiceReplies&&w.current!==X.audioUrl;ae&&(w.current=X.audioUrl??null),z({kind:"ready",src:X.audioUrl,durationSec:X.durationSec??0,transcript:X.transcription??(X.content||null),autoplay:ae})}else X.kind==="text"&&X.content.trim().length>0&&z({kind:"offer",text:X.content});return!0},N=async()=>{try{const Z=await t.getThread(i);if(!v||D(Z.messages))return}catch{}v&&(L+=1,L<U&&(E=setTimeout(()=>void N(),Q)))};return N(),()=>{v=!1,E&&clearTimeout(E)}},[A,a,K,i,t]);const V=l.useCallback(async()=>{if(b.kind!=="offer"||!K||b.text.trim().length===0)return;const v=b.text,E=Zt({clientMessageId:m??`talkie-tts-${i}`,text:v,voice:{characterId:K}});z({kind:"forming",text:v});const L=await x.request(E,{text:v,characterId:K});if(L.phase==="ready"&&L.audioUrl){const U=c.autoplayVoiceReplies&&w.current!==L.audioUrl;U&&(w.current=L.audioUrl),z({kind:"ready",src:L.audioUrl,durationSec:0,transcript:v,autoplay:U})}else L.phase==="textFallback"?z({kind:"textFallback",text:v}):z({kind:"ttsFailed",text:v})},[b,K,m,i,x,c.autoplayVoiceReplies]);l.useEffect(()=>{I(null),z({kind:"none"})},[i]);const M=a==="luman";return e.jsxs(e.Fragment,{children:[e.jsx(ti,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:337",ritual:S,defaultSpeed:c.playbackSpeed,onSpeedChange:v=>s.update({playbackSpeed:Ne(v)})}),p&&k&&e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:345",style:{position:"absolute",left:0,right:0,bottom:132,zIndex:50,display:"flex",justifyContent:"center",pointerEvents:"none"},children:e.jsx("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:357",style:{pointerEvents:"auto"},children:e.jsx(ii,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:358",stage:k,reducedMotion:d,onKeepInMemory:p.messageId?_:void 0,keepBusy:y})})}),M&&b.kind!=="none"&&A!=="recording"&&A!=="locked"&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:370",style:{position:"absolute",right:14,bottom:136,zIndex:45,width:"min(320px, calc(100% - 28px))",padding:"12px 14px",borderRadius:16,background:"rgba(18,12,32,0.95)",backdropFilter:"blur(16px)",border:`1px solid ${r.line}`,boxShadow:"0 8px 28px rgba(0,0,0,0.45)",display:"flex",flexDirection:"column",gap:8,animation:d?"none":"lmSoftPop 240ms ease-out"},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:389",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:390","aria-hidden":!0,style:{width:7,height:7,borderRadius:"50%",background:r.violetMist,boxShadow:"0 0 8px rgba(168,142,255,0.8)",flexShrink:0}}),e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:401",style:{fontSize:11,fontWeight:600,letterSpacing:1.4,textTransform:"uppercase",color:r.violetSoft,flex:1},children:H.spokenReply}),e.jsx("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:404",type:"button",onClick:()=>z({kind:"none"}),"aria-label":H.close,style:{background:"none",border:"none",cursor:"pointer",padding:2,color:r.text40,fontSize:13,lineHeight:1},children:"✕"})]}),b.kind==="ready"&&e.jsx(qe,{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:415",src:b.src,durationSec:b.durationSec,transcript:b.transcript,title:H.spokenReply,autoPlay:b.autoplay,defaultSpeed:c.playbackSpeed,onSpeedChange:v=>s.update({playbackSpeed:Ne(v)})}),b.kind==="offer"&&e.jsx("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:427",type:"button",onClick:()=>void V(),style:{alignSelf:"flex-start",padding:"7px 13px",borderRadius:999,background:"rgba(142,99,255,0.12)",border:"1px solid rgba(142,99,255,0.35)",color:r.violetSoft,fontSize:12,fontWeight:600,cursor:"pointer"},children:H.hearHerVoice}),b.kind==="forming"&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:447",role:"status",style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:r.text66},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:448","aria-hidden":!0,style:{width:7,height:7,borderRadius:"50%",background:r.violet,animation:"lmPulse 1s ease-in-out infinite"}}),H.ttsForming]}),(b.kind==="textFallback"||b.kind==="ttsFailed")&&e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:457",role:"status",style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:r.text66,lineHeight:1.45},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:458",style:{flex:1},children:H.ttsFailed}),b.kind==="ttsFailed"&&e.jsx("button",{"data-loc":"client/src/features/talkie/voice/TalkieVoiceDock.tsx:460",type:"button",onClick:()=>{z(v=>v.kind==="ttsFailed"?{kind:"offer",text:v.text}:v)},style:{padding:"5px 10px",borderRadius:999,background:"rgba(142,99,255,0.12)",border:"1px solid rgba(142,99,255,0.3)",color:r.violetSoft,fontSize:11,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},children:H.tryAgain})]})]})]})}function gt(t,i){return`${t}::${i}`}function Oa(t){return t.status==="read"}function _a({sendImage:t}){const i=new Map,a=new Map;return{send(n,s){const o=gt(n,s.clientMessageId),d=a.get(o);if(d)return Promise.resolve(d);const c=i.get(o);if(c)return c;const u=(async()=>{try{const f=await t(n,[s.file],s.caption),x={ok:!0,message:f,replyArrived:Oa(f)};return a.set(o,x),x}catch(f){return{ok:!1,error:f instanceof Error?f.message:"send failed"}}finally{i.delete(o)}})();return i.set(o,u),u},hasSucceeded(n,s){return a.has(gt(n,s))}}}
16const yt=1,Ba=12,Ua=["live","isLive","stream","streamUrl","realtime","webcam","feed","feedUrl"];function mt(t){return typeof t!="string"||t.length===0||t.length>2048?!1:!!(/^https:\/\//i.test(t)||t.startsWith("/")&&!t.startsWith("//"))}function Ha(t){if(!t||typeof t!="object")return null;const i=t;for(const n of Ua)if(n in i)return null;if(i.loop===!0||i.v!==yt||i.kind!=="still"&&i.kind!=="clip"||!mt(i.url)||typeof i.alt!="string"||i.alt.trim().length===0||i.alt.length>500||i.origin!=="generated"&&i.origin!=="prepared"||i.visual!=="atmosphere"&&i.visual!=="portrait"||i.posterUrl!==void 0&&!mt(i.posterUrl))return null;let a;if(i.kind==="clip"){if(typeof i.durationSec!="number"||!Number.isFinite(i.durationSec)||i.durationSec<=0||i.durationSec>Ba)return null;a=i.durationSec}else if(i.durationSec!==void 0)return null;return{v:yt,kind:i.kind,url:i.url,...i.posterUrl!==void 0?{posterUrl:i.posterUrl}:{},alt:i.alt.trim(),origin:i.origin,visual:i.visual,...a!==void 0?{durationSec:a}:{}}}function St(t){return(t??"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"")}function Ka(t){return St(t.name)==="aishu"||St(t.soulKey)==="aishu"}function qa(t,i){return!(Ka(i)&&t.visual==="portrait")}function Ya(t){return t.origin==="generated"?"A generated glimpse":"A prepared glimpse"}function it(t){const{meta:i,identity:a,reducedMotion:n,dataSaving:s,autoplayGlimpses:o}=t,d={mode:"none",label:null,reason:null,stillSrc:null};if(!i)return d;if(!qa(i,a))return{...d,reason:"aishu-guard"};const c=Ya(i);if(i.kind==="still")return{mode:"still",label:c,reason:null,stillSrc:i.url};const u=i.posterUrl??null;return n?u?{mode:"still",label:c,reason:"reduced-motion",stillSrc:u}:{mode:"clip-tap",label:c,reason:"reduced-motion",stillSrc:null}:s?{mode:"clip-tap",label:c,reason:"data-saving",stillSrc:u}:o?{mode:"clip-autoplay",label:c,reason:null,stillSrc:u}:{mode:"clip-tap",label:c,reason:"autoplay-off",stillSrc:u}}function Ga(t){if(t.role!=="soul"||t.deletedAt!=null)return null;const i=t.metadata;return!i||typeof i!="object"?null:Ha(i.glimpse)}function at(t){const i=t.filter(s=>s.role==="soul"&&s.deletedAt==null);if(i.length===0)return null;const a=[...i].sort((s,o)=>{const d=s.createdAt!=null?new Date(s.createdAt).getTime():NaN,c=o.createdAt!=null?new Date(o.createdAt).getTime():NaN;return Number.isFinite(d)&&Number.isFinite(c)?c-d:0})[0],n=Ga(a);return n?{row:a,meta:n}:null}const $={uploadFailed:"The image did not reach her.",permissionDenied:"Camera access is off. Enable it to share a glimpse with her.",captureFailed:"No image was captured. Nothing was sent.",processingFailed:"It reached her, but her reply could not be called up.",interrupted:"The session ended before anything was shared.",crossing:"Crossing…",processing:"Your image reached her.",replyCame:"She answered from what you shared.",delivered:"Delivered.",processingHuman:"Delivering…",uploadFailedHuman:"The image was not delivered.",permissionDeniedHuman:"Camera access is off. Enable it to share an image.",openCamera:"Share a glimpse",openCameraAria:"Share a glimpse. Opens the camera only after you confirm — nothing is captured or sent automatically.",pickImage:"Choose an image",viewfinderLive:"The camera is open for this capture only.",captureHint:"Take one image, then review it before anything is sent.",capture:"Capture",retake:"Retake",chooseAgain:"Choose again",review:"Review",confirmShare:"Share this image",cancel:"Cancel",close:"Close",tryAgain:"Try again",consentNote:"One image, only when you choose. The camera closes after capture.",previewNote:"Nothing has been sent yet.",confirmNote:"She will answer only from what is in this frame.",glimpseTapToPlay:"Tap to play",glimpseStillReason:"Shown as a still"};function bt(t){switch(t){case"permission":return $.permissionDenied;case"capture":return $.captureFailed;case"upload":return $.uploadFailed;case"processing":return $.processingFailed}}const Ie={source:null,clientMessageId:null,evidenceReady:!1,confirmed:!1,failureReason:null,interrupted:!1,replyArrived:!1};function Qa(){return{phase:"idle",context:{...Ie}}}const vt=["permissionRequested","picking","capturing","preview","confirming"],Tt=["ready","failed","cancelled"];function Xa(t,i){const{phase:a,context:n}=t;switch(i.type){case"OPEN_CAMERA":return a!=="idle"?t:{phase:"permissionRequested",context:{...Ie,source:"camera",clientMessageId:i.clientMessageId}};case"OPEN_PICK":return a!=="idle"?t:{phase:"picking",context:{...Ie,source:"file",clientMessageId:i.clientMessageId}};case"PERMISSION_GRANTED":return a!=="permissionRequested"?t:{phase:"capturing",context:n};case"PERMISSION_DENIED":return a!=="permissionRequested"?t:{phase:"failed",context:{...n,failureReason:"permission"}};case"FILE_CHOSEN":return a!=="picking"?t:{phase:"preview",context:{...n,evidenceReady:!0}};case"PICK_CANCELLED":return a!=="picking"?t:{phase:"cancelled",context:n};case"CAPTURED":return a!=="capturing"?t:{phase:"preview",context:{...n,evidenceReady:!0}};case"CAPTURE_FAILED":return a!=="capturing"?t:{phase:"failed",context:{...n,failureReason:"capture",evidenceReady:!1}};case"RETAKE":return a!=="preview"&&a!=="confirming"?t:n.source==="file"?{phase:"picking",context:{...n,evidenceReady:!1,confirmed:!1}}:{phase:"capturing",context:{...n,evidenceReady:!1,confirmed:!1}};case"CONFIRM":return a!=="preview"||!n.evidenceReady?t:{phase:"confirming",context:{...n,confirmed:!0}};case"SHARE":return a!=="confirming"||!n.confirmed||!n.evidenceReady?t:{phase:"uploading",context:n};case"UPLOAD_OK":return a!=="uploading"?t:{phase:"processing",context:n};case"UPLOAD_FAIL":return a!=="uploading"?t:{phase:"failed",context:{...n,failureReason:"upload"}};case"PROCESSING_DONE":return a!=="processing"?t:{phase:"ready",context:{...n,replyArrived:i.replyArrived}};case"PROCESSING_FAIL":return a!=="processing"?t:{phase:"failed",context:{...n,failureReason:"processing"}};case"RETRY":return a!=="failed"||n.failureReason!=="upload"||!n.confirmed||!n.evidenceReady?t:{phase:"uploading",context:n};case"CANCEL":return vt.includes(a)?{phase:"cancelled",context:{...n,interrupted:!1}}:Tt.includes(a)?{phase:"idle",context:{...Ie}}:t;
16case"INTERRUPT":return vt.includes(a)?{phase:"cancelled",context:{...n,interrupted:!0}}:t;case"DISMISS":return Tt.includes(a)?{phase:"idle",context:{...Ie}}:t}}function Ja(t){return t.phase==="confirming"&&t.context.confirmed&&t.context.evidenceReady}function Za(t,i){return t==="capturing"&&i!=="capturing"}function jt(t){const{phase:i,context:a}=t;switch(i){case"idle":return"";case"permissionRequested":return"Asking for the camera…";case"picking":return"Choose an image to share.";case"capturing":return`${$.viewfinderLive} ${$.captureHint}`;case"preview":return"Your image is ready to review. Share it, choose again, or cancel.";case"confirming":return"Confirm to share this image. Nothing has been sent yet.";case"uploading":return $.crossing;case"processing":return $.processing;case"ready":return a.replyArrived?$.replyCame:$.delivered;case"failed":switch(a.failureReason){case"permission":return $.permissionDenied;case"capture":return $.captureFailed;case"upload":return $.uploadFailed;case"processing":return $.processingFailed;default:return"The image could not be shared."}case"cancelled":return a.interrupted?$.interrupted:"Cancelled. Nothing was shared."}}const er=450;function ai({onShare:t}){const[i,a]=l.useReducer(Xa,void 0,Qa),[n,s]=l.useState(null),o=l.useRef(i);o.current=i;const d=l.useRef(t);d.current=t;const c=l.useRef(null),u=l.useRef(null),f=l.useRef(void 0),x=l.useRef(null),h=l.useRef(null),p=l.useRef(null),I=l.useRef(null),P=l.useCallback(()=>{const M=c.current;if(c.current=null,M)for(const v of M.getTracks())try{v.stop()}catch{}if(x.current)try{x.current.srcObject=null}catch{}},[]),g=l.useRef(i.phase);l.useEffect(()=>{const M=g.current;M!==i.phase&&(Za(M,i.phase)&&P(),g.current=i.phase)},[i.phase,P]);const R=l.useCallback(M=>{u.current=M,s(v=>(v&&URL.revokeObjectURL(v),M?URL.createObjectURL(M):null))},[]);l.useEffect(()=>{if(i.phase==="cancelled"||i.phase==="idle"){R(null);return}!i.context.evidenceReady&&(i.phase==="capturing"||i.phase==="picking")&&R(null)},[i.phase,i.context.evidenceReady,R]);const b=l.useCallback(()=>{const M=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!M||typeof M.getUserMedia!="function"){a({type:"PERMISSION_DENIED"});return}M.getUserMedia({video:{facingMode:"user"},audio:!1}).then(v=>{const E=o.current;if(E.phase!=="permissionRequested"&&E.phase!=="capturing"){for(const L of v.getTracks())L.stop();return}if(c.current=v,E.phase==="capturing"&&x.current)try{x.current.srcObject=v,x.current.play().catch(()=>{})}catch{}a({type:"PERMISSION_GRANTED"})}).catch(()=>{o.current.phase==="capturing"?a({type:"CAPTURE_FAILED"}):a({type:"PERMISSION_DENIED"})})},[]);l.useEffect(()=>{if(i.phase!=="capturing")return;const M=x.current,v=c.current;!M||!v||(M.srcObject=v,M.play().catch(()=>{}))},[i.phase]);const z=l.useCallback(()=>{o.current.phase==="idle"&&(a({type:"OPEN_CAMERA",clientMessageId:Ue()}),b())},[b]),w=l.useCallback(()=>{if(o.current.phase!=="idle")return;a({type:"OPEN_PICK",clientMessageId:Ue()});const M=h.current;M&&(M.value="",M.click())},[]),j=l.useCallback(M=>{o.current.phase==="picking"&&(M&&M.type.startsWith("image/")?(R(M),a({type:"FILE_CHOSEN"})):M&&a({type:"PICK_CANCELLED"}))},[R]),S=l.useCallback(M=>{if(p.current?.(),p.current=null,h.current=M,M){const v=()=>{o.current.phase==="picking"&&a({type:"PICK_CANCELLED"})};M.addEventListener("cancel",v),p.current=()=>M.removeEventListener("cancel",v)}},[]),A=l.useCallback(()=>{if(o.current.phase!=="capturing")return;const M=x.current;if(!M||M.videoWidth===0||M.videoHeight===0){a({type:"CAPTURE_FAILED"});return}try{const v=document.createElement("canvas");v.width=M.videoWidth,v.height=M.videoHeight;const E=v.getContext("2d");if(!E){a({type:"CAPTURE_FAILED"});return}E.translate(v.width,0),E.scale(-1,1),E.drawImage(M,0,0,v.width,v.height),v.toBlob(L=>{if(!L){a({type:"CAPTURE_FAILED"});return}R(L),a({type:"CAPTURED"})},"image/jpeg",.92)}catch{a({type:"CAPTURE_FAILED"})}},[R]),m=l.useCallback(()=>{const M=o.current;if(a({type:"RETAKE"}),M.context.source==="camera")b();else if(M.context.source==="file"){const v=h.current;v&&(v.value="",v.click())}},[b]),k=l.useCallback(()=>{a({type:"CONFIRM"})},[]),y=l.useCallback(M=>{const v=o.current,E=u.current,L=v.context.clientMessageId;if(!E||!L)return;f.current=M;const U=new File([E],`talkie-capture-${L}.jpg`,{type:E.type||"image/jpeg"});(async()=>{try{const Q=await d.current({file:U,caption:M?.trim()||void 0,clientMessageId:L});a({type:"UPLOAD_OK"}),I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{a({type:"PROCESSING_DONE",replyArrived:Q.replyArrived})},er)}catch{a({type:"UPLOAD_FAIL"})}})()},[]),T=l.useCallback(M=>{Ja(o.current)&&(a({type:"SHARE"}),y(M))},[y]),_=l.useCallback(()=>{const M=o.current;M.phase!=="failed"||M.context.failureReason!=="upload"||(a({type:"RETRY"}),y(f.current))},[y]),K=l.useCallback(()=>{a({type:"CANCEL"})},[]),V=l.useCallback(()=>{a({type:"DISMISS"})},[]);return l.useEffect(()=>{const M=()=>{document.hidden&&a({type:"INTERRUPT"})},v=()=>a({type:"INTERRUPT"});return document.addEventListener("visibilitychange",M),window.addEventListener("pagehide",v),()=>{document.removeEventListener("visibilitychange",M),window.removeEventListener("pagehide",v)}},[]),l.useEffect(()=>()=>{P(),I.current&&clearTimeout(I.current),p.current?.(),R(null)},[P,R]),{state:i,previewUrl:n,videoRef:x,fileInputRef:h,bindFileInput:S,openCamera:z,openPicker:w,onFileChosen:j,capture:A,retake:m,confirm:k,share:T,retry:_,cancel:K,dismiss:V}}const tr={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ir(t,i){switch(t){case"processing":return $.processingHuman;case"failed":return i===$.uploadFailed?$.uploadFailedHuman:i===$.permissionDenied?$.permissionDeniedHuman:i;default:return i}}function ne({label:t,onPress:i,tone:a="neutral",disabled:n=!1}){const s={neutral:{background:"rgba(245,242,252,0.07)",border:`1px solid ${r.line}`,color:r.text},danger:{background:"rgba(224,106,133,0.14)",border:"1px solid rgba(224,106,133,0.35)",color:r.roseSoft},primary:{background:`linear-gradient(130deg, ${r.violet}, ${r.pink})`,border:"none",color:"#fff",boxShadow:"0 0 14px rgba(142,99,255,0.4)"}};return e.jsx("button",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:76",type:"button",onClick:i,disabled:n,style:{padding:"9px 16px",borderRadius:12,fontSize:12.5,fontWeight:600,cursor:n?"wait":"pointer",opacity:n?.6:1,...s[a]},children:t})}function ri({onOpen:t,disabled:i}){return e.jsx("button",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:104",type:"button",onClick:t,disabled:i,"aria-label":$.openCameraAria,title:$.openCamera,style:{position:"absolute",right:72,bottom:78,zIndex:30,width:46,height:46,borderRadius:"50%",background:`linear-gradient(130deg, ${r.violet}, ${r.violetDeep})`,border:"1.5px solid rgba(201,180,255,0.35)",boxShadow:"0 0 16px rgba(142,99,255,0.45)",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"default":"pointer",opacity:i?.4:1},children:e.jsxs("svg",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:128",width:"18",height:"16",viewBox:"0 0 20 16",fill:"none","aria-hidden":!0,
16children:[e.jsx("rect",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:129",x:"1.5",y:"3.5",width:"17",height:"11",rx:"2.5",stroke:"#fff",strokeWidth:"1.5"}),e.jsx("circle",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:130",cx:"10",cy:"9",r:"3",stroke:"#fff",strokeWidth:"1.5"}),e.jsx("path",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:131",d:"M6.5 3.5l1.2-2h4.6l1.2 2",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function ni({ritual:t,isPresence:i,chooserOpen:a,onChooserClose:n}){const{state:s,previewUrl:o,videoRef:d}=t,{phase:c,context:u}=s,f=me(),[x,h]=l.useState(""),p=jt(s),I=i?p:ir(c,p);l.useEffect(()=>{(c==="permissionRequested"||c==="picking")&&h("")},[c,u.clientMessageId]);const P=a||c!=="idle",g=()=>{t.dismiss(),n()};l.useEffect(()=>{if(!P)return;const S=A=>{A.key==="Escape"&&(A.preventDefault(),c==="ready"||c==="failed"||c==="cancelled"?g():c==="idle"?n():t.cancel())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[P,c]);const R=l.useMemo(()=>u.failureReason?i?bt(u.failureReason):u.failureReason==="upload"?$.uploadFailedHuman:u.failureReason==="permission"?$.permissionDeniedHuman:bt(u.failureReason):null,[u.failureReason,i]);if(!P)return e.jsx("input",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:200",ref:t.bindFileInput,type:"file",accept:"image/*",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:S=>t.onFileChosen(S.target.files?.[0])});const b={position:"absolute",inset:0,zIndex:60,display:"flex",alignItems:"center",justifyContent:"center",padding:18,background:"rgba(5,7,13,0.78)",backdropFilter:"blur(10px)",animation:f?"none":"lmFadeIn 180ms ease-out"},z={width:"min(420px, 100%)",maxHeight:"100%",overflowY:"auto",borderRadius:20,background:"linear-gradient(135deg, rgba(18,14,32,0.98), rgba(12,8,22,0.99))",border:`1px solid ${r.line}`,boxShadow:"0 18px 60px rgba(0,0,0,0.55)",padding:"18px 18px 16px",display:"flex",flexDirection:"column",gap:12,animation:f?"none":"lmSoftPop 220ms ease-out"},w={fontSize:11,color:r.text40,lineHeight:1.5},j={width:"100%",borderRadius:14,background:"#05070D",border:`1px solid ${r.lineSoft}`,objectFit:"cover",maxHeight:"46vh",display:"block"};return e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:253",style:b,role:"dialog","aria-modal":"true","aria-label":$.openCamera,children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:254",style:z,children:[e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:256","aria-live":"polite",role:"status",style:tr,children:I}),c==="idle"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:263",style:{fontSize:15,fontWeight:700,color:r.text},children:$.openCamera}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:264",style:w,children:$.consentNote}),e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:265",style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:266",label:$.capture,tone:"primary",onPress:t.openCamera}),e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:267",label:$.pickImage,onPress:t.openPicker}),e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:271",label:$.close,onPress:n})]})]}),c==="permissionRequested"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:279",role:"status",style:{display:"flex",alignItems:"center",gap:10,fontSize:13,color:r.text66},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:280","aria-hidden":!0,style:{width:9,height:9,borderRadius:"50%",background:r.violet,animation:f?"none":"lmPulse 1s ease-in-out infinite"}}),"Asking for the camera…"]}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:286",style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:287",label:$.cancel,tone:"danger",onPress:t.cancel})})]}),c==="picking"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:295",style:{fontSize:13,color:r.text66},children:jt(s)}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:296",style:{display:"flex",gap:8,justifyContent:"flex-end"},children:e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:297",label:$.cancel,tone:"danger",onPress:t.cancel})})]}),c==="capturing"&&e.jsxs(e.Fragment,{children:[e.jsx("video",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:305",ref:d,muted:!0,playsInl
16ine:!0,"aria-label":$.viewfinderLive,style:{...j,transform:"scaleX(-1)",aspectRatio:"4 / 3"}}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:312",style:w,children:$.consentNote}),e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:313",style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:314",label:$.cancel,tone:"danger",onPress:t.cancel}),e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:315",label:$.capture,tone:"primary",onPress:t.capture})]})]}),c==="preview"&&o&&e.jsxs(e.Fragment,{children:[e.jsx("img",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:323",src:o,alt:"Your captured image, not yet sent",style:j}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:324",style:w,children:$.previewNote}),e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:325",style:{display:"flex",gap:8,justifyContent:"flex-end",flexWrap:"wrap"},children:[e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:326",label:$.cancel,tone:"danger",onPress:t.cancel}),e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:327",label:u.source==="file"?$.chooseAgain:$.retake,onPress:t.retake}),e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:331",label:$.review,tone:"primary",onPress:t.confirm})]})]}),(c==="preview"||c==="confirming")&&!o&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:339",style:{fontSize:13,color:r.text66},children:"The image is no longer here. Nothing was sent."}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:340",style:{display:"flex",gap:8,justifyContent:"flex-end"},children:e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:341",label:$.close,onPress:t.cancel})})]}),c==="confirming"&&o&&e.jsxs(e.Fragment,{children:[e.jsx("img",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:349",src:o,alt:"Your captured image, awaiting your confirmation",style:j}),e.jsxs("label",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:350",style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:351",style:{fontSize:11,color:r.text40},children:"Caption (optional)"}),e.jsx("input",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:352",type:"text",value:x,maxLength:500,onChange:S=>h(S.target.value),placeholder:i?"Say something with this glimpse…":"Say something with this image…",style:{padding:"9px 12px",borderRadius:11,background:"rgba(245,242,252,0.05)",border:`1px solid ${r.lineSoft}`,color:r.text,fontSize:13,outline:"none"}})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:369",style:w,children:i?$.confirmNote:"Only this image is shared — nothing else leaves your device."}),e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:374",style:{display:"flex",gap:8,justifyContent:"flex-end",flexWrap:"wrap"},children:[e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:375",label:$.cancel,tone:"danger",onPress:t.cancel}),e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:376",label:u.source==="file"?$.chooseAgain:$.retake,onPress:t.retake}),e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:380",label:$.confirmShare,tone:"primary",onPress:()=>t.share(x)})]})]}),(c==="uploading"||c==="processing")&&e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:391",role:"status",style:{display:"flex",alignItems:"center",gap:10,fontSize:13,color:r.text66},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:392","aria-hidden":!0,style:{width:9,height:9,borderRadius:"50%",background:r.violet,animation:f?"none":"lmPulse 1s ease-in-out infinite"}}),c==="uploading"?$.crossing:i?$.processing:$.processingHuman]}),c==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:407",role:"status",style:{fontSize:13,color:r.okSoft},children:u.replyArrived&&i?$.replyCame:$.delivered}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:410",style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:411",label:$.close,tone
16:"primary",onPress:g})})]}),c==="failed"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:419",role:"alert",style:{fontSize:13,color:r.roseSoft,lineHeight:1.5},children:R}),e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:422",style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:423",label:$.close,onPress:g}),u.failureReason==="upload"&&e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:425",label:$.tryAgain,tone:"primary",onPress:t.retry})]})]}),c==="cancelled"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:434",role:"status",style:{fontSize:13,color:r.text66},children:u.interrupted?$.interrupted:"Cancelled. Nothing was shared."}),e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:437",style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(ne,{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:438",label:$.close,tone:"primary",onPress:g})})]})]}),e.jsx("input",{"data-loc":"client/src/features/talkie/vision/TalkieVisionCaptureSheet.tsx:445",ref:t.bindFileInput,type:"file",accept:"image/*",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:S=>t.onFileChosen(S.target.files?.[0])})]})}function ar({label:t}){return e.jsxs("span",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:26",style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 9px",borderRadius:999,background:"rgba(18,12,32,0.72)",border:`1px solid ${r.lineSoft}`,fontSize:9.5,fontWeight:600,letterSpacing:1.1,textTransform:"uppercase",color:r.violetSoft},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:42","aria-hidden":!0,style:{width:5,height:5,borderRadius:"50%",background:r.violetMist}}),t]})}function rt({meta:t,decision:i,onDismiss:a}){const n=me(),[s,o]=l.useState(!1),d=l.useRef(null);if(l.useEffect(()=>{o(!1)},[t.url,i.mode]),i.mode==="none"||!i.label)return null;const c={position:"relative",width:"min(260px, 72vw)",borderRadius:16,overflow:"hidden",border:`1px solid ${r.lineSoft}`,background:"#05070D",boxShadow:"0 8px 28px rgba(0,0,0,0.45)",animation:n?"none":"lmSoftPop 240ms ease-out"},u=e.jsxs("div",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:80",style:{position:"absolute",top:8,left:8,right:8,display:"flex",alignItems:"center",gap:6},children:[e.jsx(ar,{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:81",label:i.label}),e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:82",style:{flex:1}}),a&&e.jsx("button",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:84",type:"button",onClick:a,"aria-label":$.close,style:{background:"rgba(18,12,32,0.72)",border:`1px solid ${r.lineSoft}`,borderRadius:999,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",color:r.text40,fontSize:11,lineHeight:1,cursor:"pointer"},children:"✕"})]});return i.mode==="still"&&i.stillSrc?e.jsxs("figure",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:112",style:{...c,margin:0},children:[e.jsx("img",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:113",src:i.stillSrc,alt:t.alt,style:{width:"100%",display:"block"},loading:"lazy"}),u,i.reason&&e.jsx("figcaption",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:116",style:{position:"absolute",bottom:8,left:8,padding:"2px 8px",borderRadius:999,background:"rgba(18,12,32,0.72)",fontSize:9,color:r.text40},children:$.glimpseStillReason})]}):i.mode==="clip-tap"?e.jsxs("figure",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:138",style:{...c,margin:0},children:[s?e.jsx("video",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:140",ref:d,src:t.url,poster:i.stillSrc??void 0,autoPlay:!0,controls:!0,muted:!0,playsInl
16ine:!0,loop:!1,"aria-label":t.alt,style:{width:"100%",display:"block"}}):e.jsxs("button",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:153",type:"button",onClick:()=>o(!0),"aria-label":`${$.glimpseTapToPlay}: ${t.alt}`,style:{display:"block",width:"100%",padding:0,border:"none",cursor:"pointer",background:i.stillSrc?`center/cover no-repeat url(${JSON.stringify(i.stillSrc)})`:"linear-gradient(135deg, rgba(142,99,255,0.16), rgba(244,95,181,0.10))",aspectRatio:"16 / 10",position:"relative"},children:[!i.stillSrc&&e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:171",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,color:r.text66,padding:12},children:t.alt}),e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:175","aria-hidden":!0,style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:185",style:{width:44,height:44,borderRadius:"50%",background:"rgba(18,12,32,0.78)",border:`1px solid ${r.line}`,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:197",width:"14",height:"16",viewBox:"0 0 14 16",fill:"none","aria-hidden":!0,children:e.jsx("path",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:198",d:"M2 1.8v12.4c0 .9 1 1.5 1.8 1L13 8.9c.8-.5.8-1.6 0-2.1L3.8.9c-.8-.5-1.8 0-1.8.9z",fill:r.violetSoft})})})})]}),u]}):i.mode==="clip-autoplay"?e.jsxs("figure",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:212",style:{...c,margin:0},children:[e.jsx("video",{"data-loc":"client/src/features/talkie/vision/TalkieGlimpseCard.tsx:213",ref:d,src:t.url,poster:i.stillSrc??void 0,autoPlay:!0,muted:!0,playsInline:!0,loop:!1,"aria-label":t.alt,style:{width:"100%",display:"block"}}),u]}):null}const rr=12e3;function nr({engine:t,threadId:i,threadKind:a,threadName:n,visionPrefsStore:s}){const o=a==="luman",[d,c]=l.useState(()=>s.getPrefs());l.useEffect(()=>s.subscribe(()=>c(s.getPrefs())),[s]);const u=l.useMemo(()=>_a({sendImage:(S,A,m)=>t.sendImage(S,A,m)}),[t]),f=re.connect.getThread.useQuery({threadId:i,limit:30},{enabled:o,refetchInterval:o?rr:!1,refetchOnWindowFocus:!1}),x=l.useCallback(async S=>{const A=await u.send(i,S);if(!A.ok)throw new Error(A.error);return f.refetch().catch(()=>{}),{replyArrived:A.replyArrived}},[u,i,f]),h=ai({onShare:x}),[p,I]=l.useState(!1),[P,g]=l.useState(new Set);l.useEffect(()=>{I(!1),g(new Set)},[i]);const R=me(),b=l.useMemo(()=>{const S=f.data?.messages??[];return at(S)},[f.data]),z=l.useMemo(()=>it({meta:b?.meta??null,identity:{name:n},reducedMotion:R,dataSaving:d.dataSaving,autoplayGlimpses:d.autoplayGlimpses}),[b,n,R,d.dataSaving,d.autoplayGlimpses]),w=b?String(b.row.id):null,j=o&&b&&z.mode!=="none"&&w!==null&&!P.has(w);return e.jsxs(e.Fragment,{children:[e.jsx(ri,{"data-loc":"client/src/features/talkie/vision/TalkieVisionDock.tsx:123",onOpen:()=>I(!0)}),e.jsx(ni,{"data-loc":"client/src/features/talkie/vision/TalkieVisionDock.tsx:125",ritual:h,isPresence:o,chooserOpen:p,onChooserClose:()=>I(!1)}),j&&b&&e.jsx("div",{"data-loc":"client/src/features/talkie/vision/TalkieVisionDock.tsx:134",style:{position:"absolute",left:14,bottom:136,zIndex:44,display:"flex",flexDirection:"column",gap:6},children:e.jsx(rt,{"data-loc":"client/src/features/talkie/vision/TalkieVisionDock.tsx:145",meta:b.meta,decision:z,onDismiss:()=>g(S=>{const A=new Set(S);return w&&A.add(w),A})})})]})}const F={entryTitle:"Flow Talkie",entrySub:"TURN-BASED VOICE",entryBody:"Speak in turns. Each turn crosses to her, and her answer forms in her own voice before you hear it — every reply takes a moment to form.",entryHint:"The microphone opens only while a session is running, and closes when it ends.",entryBegin:"Begin",entryPickTitle:"Choose a Presence to flow with",entryPickSub:"Flow Talkie moves in turns with one Presence.",entryEmptyTitle:"No Presence Talkies yet",entryEmptyBody:"Flow Talkie opens with a Presence. Start a Talkie with a Presence first.",entryOpenPresences:"Open Presences",presenceOnlyTitle:"Flow Talkie is for Presences",presenceOnlyBody:"A Flow session moves in spoken turns with a Presence. This Talkie opens the usual way.",backToThread:"Back to the Talkie",statusStarting:"Opening…",statusListening:"Listening",statusTranscribing:"Transcribing",statusThinking:"Thinking",statusFormingVoice:"Forming voice",statusSpeaking:"Speaking",statusPaused:"Paused",statusInterrupted:"Connection interrupted",statusEnding:"Ending…",statusEnded:"Session ended",bargeIn:"Interrupt",bargeInAria:"Interrupt this turn and speak",pause:"Pause",resume:"Resume",resumeSession:"Resume",end:"End",endAria:"End the session",doneSpeaking:"Done speaking",cancelTake:"Let this take go",replayTurn:"Replay",yourTurnLabel:"You",transcriptLabel:"Session transcript",closeSummary:"Close",startHint:"Speak. She answers in turn.",voiceFallbackNotice:H.ttsFailed,playbackFailedNotice:H.audioUnavailable,noReplyNotice:"No reply formed this turn. If her words arrive, they will be waiting in the Talkie.",takeLostNotice:H.recordingInterrupted,pauseDiscardNote:"Pausing lets go of the take in progress.",interruptedBody:"The connection dropped. Nothing further was sent. Resume when it returns.",sendInterruptedBody:"The message could not cross. Resume to send the same take again.",failedPermission:H.permissionDenied,failedRecorder:H.recorderStartFailed,failedNetwork:"The bridge is unavailable. Try again when the connection returns.",failedSession:"The session could not continue. Your Talkie is untouched.",summaryHeading:"Session summary",summaryTurns:t=>t===1?"1 turn":`${t} turns`,summaryDurationLabel:"Session length",summaryEmpty:"No turns crossed this session."};function sr({engine:t,threadId:i,onBack:a,onInfo:n,onOpenFlow:s,voicePrefsStore:o,visionPrefsStore:d}){const[c,u]=l.useState(null);return l.useEffect(()=>{let f=!0;return t.getThread(i).then(x=>{f&&u({kind:x.kind,participantId:x.participantId,name:x.name})}).catch(()=>{}),()=>{f=!1}},[t,i]),e.jsxs("div",{"data-loc":"client/src/features/talkie/voice/TalkieThreadVoiceLayer.tsx:59",style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[e.jsx(Pi,{"data-loc":"client/src/features/talkie/voice/TalkieThreadVoiceLayer.tsx:60",engine:t,threadId:i,onBack:a,onInfo:n}),e.jsx(Na,{"data-loc":"client/src/features/talkie/voice/TalkieThreadVoiceLayer.tsx:61",engine:t,threadId:i,threadKind:c?.kind,participantId:c?.participantId,voicePrefsStore:o}),e.jsx(nr,{"data-loc":"client/src/features/talkie/voice/TalkieThreadVoiceLayer.tsx:70",engine:t,threadId:i,threadKind:c?.kind,threadName:c?.name,visionPrefsStore:d}),c?.kind==="luman"&&e.jsxs("button",{"data-loc":"client/src/features/talkie/voice/TalkieThreadVoiceLayer.tsx:79",type:"button",onClick:()=>s(i),"aria-label":F.entryTitle,style:{position:"absolute",top:64,right:14,zIndex:40,display:"inline-flex",alignItems:"center",gap:7,padding:"7px 13px",borderRadius:999,background:"rgba(18,12,32,0.92)",backdropFilter:"blur(12px)",border:"1px solid rgba(142,99,255,0.32)",color:r.violetSoft,fontSize:11,fontWeight:700,letterSpacing:1,textTransform:"uppercase",cursor:"pointer"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/voice/TalkieThreadVoiceLayer.tsx:104","aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:r.violetMist,boxShadow:"0 0 8px rgba(168,142,255,0.8)"}}),F.entryTitle]})]})}const lr=["listening","transcribing","thinking","formingVoice","speaking"],si={threadId:null,turnClientMessageId:null,turnsCompleted:0,startedAtMs:null,endedAtMs:null,resumeTarget:null,interruptReason:null,failureReason:null,lastTurnOutcome:null};function or(){return{phase:"idle",context:{...si}
16}}function wt(t){return lr.includes(t)}function ye(t){return{...t,turnClientMessageId:null,lastTurnOutcome:null,resumeTarget:null}}function cr(t,i){const{phase:a,context:n}=t;switch(i.type){case"BEGIN":return a!=="idle"?t:{phase:"starting",context:{...si,threadId:i.threadId}};case"SESSION_READY":return a!=="starting"?t:{phase:"listening",context:{...n,startedAtMs:i.nowMs}};case"START_FAILED":return a!=="starting"?t:{phase:"failed",context:{...n,failureReason:i.reason,endedAtMs:i.nowMs}};case"TAKE_ARMED":return a!=="listening"||n.turnClientMessageId!==null?t:{phase:a,context:{...n,turnClientMessageId:i.clientMessageId}};case"TAKE_RELEASED":return a!=="listening"||n.turnClientMessageId===null?t:{phase:"transcribing",context:n};case"TAKE_CANCELLED":return a!=="listening"?t:{phase:"listening",context:ye(n)};case"SEND_CONFIRMED":return a!=="transcribing"?t:{phase:"thinking",context:{...n,turnsCompleted:n.turnsCompleted+1}};case"SEND_FAILED":return a!=="transcribing"?t:{phase:"interrupted",context:{...n,interruptReason:"sendFailed",resumeTarget:"transcribing"}};case"REPLY_VOICE_READY":return a!=="thinking"?t:{phase:"speaking",context:n};case"REPLY_TEXT_ONLY":return a!=="thinking"?t:{phase:"formingVoice",context:n};case"REPLY_TIMEOUT":return a!=="thinking"?t:{phase:"listening",context:{...ye(n),lastTurnOutcome:"noReply"}};case"VOICE_READY":return a!=="formingVoice"?t:{phase:"speaking",context:n};case"VOICE_UNAVAILABLE":return a!=="formingVoice"?t:{phase:"listening",context:{...ye(n),lastTurnOutcome:"textFallback"}};case"SPEECH_ENDED":return a!=="speaking"?t:{phase:"listening",context:{...ye(n),lastTurnOutcome:"voiceReply"}};case"SPEECH_FAILED":return a!=="speaking"?t:{phase:"listening",context:{...ye(n),lastTurnOutcome:"playbackFailed"}};case"BARGE_IN":return a==="thinking"||a==="formingVoice"||a==="speaking"?{phase:"listening",context:ye(n)}:a==="listening"?{phase:"listening",context:ye(n)}:t;case"PAUSE":return wt(a)?{phase:"paused",context:{...n,resumeTarget:a,turnClientMessageId:a==="listening"?null:n.turnClientMessageId}}:t;case"RESUME":return a!=="paused"||n.resumeTarget===null?t:{phase:n.resumeTarget,context:{...n,resumeTarget:null}};case"CONNECTION_LOST":return wt(a)?{phase:"interrupted",context:{...n,interruptReason:"connection",resumeTarget:a,turnClientMessageId:a==="listening"?null:n.turnClientMessageId}}:t;case"RESUME_SESSION":return a!=="interrupted"||n.resumeTarget===null?t:{phase:n.resumeTarget,context:{...n,resumeTarget:null,interruptReason:null}};case"END":return a==="ended"||a==="failed"?t:a==="idle"?{phase:"ended",context:n}:{phase:"ending",context:n};case"END_COMPLETE":return a!=="ending"?t:{phase:"ended",context:{...n,endedAtMs:i.nowMs}};case"FAIL":return a==="ended"||a==="failed"?t:{phase:"failed",context:{...n,failureReason:i.reason,endedAtMs:i.nowMs}}}}function nt(t){switch(t.phase){case"idle":return null;case"starting":return F.statusStarting;case"listening":return F.statusListening;case"transcribing":return F.statusTranscribing;case"thinking":return F.statusThinking;case"formingVoice":return F.statusFormingVoice;case"speaking":return F.statusSpeaking;case"paused":return F.statusPaused;case"interrupted":return F.statusInterrupted;case"ending":return F.statusEnding;case"ended":return F.statusEnded;case"failed":switch(t.context.failureReason){case"permission":return F.failedPermission;case"recorder":return F.failedRecorder;case"network":return F.failedNetwork;default:return F.failedSession}}}function dr(t){switch(t){case"textFallback":return F.voiceFallbackNotice;case"playbackFailed":return F.playbackFailedNotice;case"noReply":return F.noReplyNotice;case"voiceReply":case null:return null}}function ur(t){return t.phase!=="interrupted"?null:t.context.interruptReason==="sendFailed"?F.sendInterruptedBody:F.interruptedBody}function fr(t){const{phase:i,context:a}=t;switch(i){case"idle":return"";case"starting":return"Opening the session. Asking for the microphone…";case"listening":return a.turnClientMessageId?"Listening. Speak your turn, then pause or tap Done speaking.":"Opening the microphone…";case"transcribing":return"Transcribing. Your turn is crossing…";case"thinking":return"Thinking. Waiting for her reply to form…";case"formingVoice":return"Her reply is here. Forming voice…";case"speaking":return"Speaking. Her reply is playing.";case"paused":return"Session paused.";case"interrupted":return a.interruptReason==="sendFailed"?F.sendInterruptedBody:F.interruptedBody;case"ending":return"Ending the session…";case"ended":return`Session ended. ${F.summaryTurns(a.turnsCompleted)}.`;case"failed":return nt(t)??F.failedSession}}function pr(t){const{startedAtMs:i,endedAtMs:a,turnsCompleted:n}=t;if(i===null||a===null)return null;const s=Math.max(0,a-i);return{turnsCompleted:Math.max(0,n),durationMs:s,durationSec:Math.round(s/1e3)}}function xr(t){const i=Math.max(0,Math.round(t/1e3));if(i<60)return i===1?"1 second":`${i} seconds`;const a=Math.floor(i/60),n=i%60;if(a<60){const u=a===1?"1 minute":`${a} minutes`;if(n===0)return u;const f=n===1?"1 second":`${n} seconds`;return`${u} ${f}`}const s=Math.floor(a/60),o=a%60,d=s===1?"1 hour":`${s} hours`;if(o===0)return d;const c=o===1?"1 minute":`${o} minutes`;return`${d} ${c}`}function kr(t){const a=((t.kind==="voice"?t.transcription??t.content:t.content)??"").trim();return a.length>0?a:null}function hr(t,i){let a=null;for(const s of t)s.author==="them"&&s.ts>i&&(!a||s.ts>a.ts)&&(a=s);if(!a)return{kind:"none"};const n={messageId:a.id,ts:a.ts,text:kr(a),audioUrl:a.kind==="voice"&&typeof a.audioUrl=="string"&&a.audioUrl.length>0?a.audioUrl:null,durationSec:a.kind==="voice"&&typeof a.durationSec=="number"&&a.durationSec>0?a.durationSec:null};return n.audioUrl?{kind:"voice",reply:n}:n.text?{kind:"text",reply:n}:{kind:"none"}}const Ye=[900,1400,2e3,2700,3500,4400,5400,6500,7700,9e3],gr=Ye.length;function It(t){const i=Math.max(0,Math.min(Math.floor(t),Ye.length-1));return Ye[i]}function yr(t,i){return{id:t,index:i,userText:null,userAudioUrl:null,userDurationSec:null,replyText:null,replyAudioUrl:null,replyDurationSec:null,outcome:"inProgress"}}
16function mr(t,i){const a=(i.transcription??i.content??"").trim();return{...t,userText:a.length>0?a:null,userAudioUrl:typeof i.audioUrl=="string"&&i.audioUrl.length>0?i.audioUrl:null,userDurationSec:typeof i.durationSec=="number"&&i.durationSec>0?i.durationSec:null}}function Sr(t,i){return{...t,replyText:i.text,replyAudioUrl:i.audioUrl,replyDurationSec:i.durationSec}}function br(t,i){return{...t,outcome:i}}function vr(t){return new Promise((i,a)=>{const n=new FileReader;n.onloadend=()=>i(n.result),n.onerror=()=>a(new Error("read failed")),n.readAsDataURL(t)})}function Le(t){try{typeof navigator<"u"&&typeof navigator.vibrate=="function"&&navigator.vibrate(t)}catch{}}function Tr({engine:t,threadId:i,characterId:a,speak:n,maxDurationSec:s=Be}){const o=da(),[d,c]=l.useReducer(cr,void 0,or),[u,f]=l.useState([]),[x,h]=l.useState([]),[p,I]=l.useState(null),[P,g]=l.useState(null),[R,b]=l.useState(null),[z,w]=l.useState(!1),j=l.useRef(d);j.current=d;const S=l.useRef(u);S.current=u;const A=l.useRef(0),m=l.useRef([]),k=l.useRef(null),y=l.useRef(null),T=l.useRef(null),_=l.useRef(null),K=l.useRef(null),V=l.useRef(0),M=l.useMemo(()=>Ot({sendVoiceNote:(C,O,Y,q)=>t.sendVoiceNote(C,O,Y,q)}),[t]),v=l.useMemo(()=>ei({speak:n}),[n]),E=d.phase,L=d.context.turnClientMessageId,U=l.useCallback(()=>{try{o.cancel()}catch{}},[o]),Q=l.useCallback(()=>{const C=y.current;if(C){try{C.pause(),C.src=""}catch{}y.current=null}I(null)},[]),D=l.useCallback(()=>{const C=T.current;if(C){try{C.pause()}catch{}T.current=null}g(null)},[]),N=l.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null)},[]),Z=l.useCallback(C=>{f(O=>O.some(Y=>Y.id===C)?O:[...O,yr(C,O.length+1)])},[]),ce=l.useCallback((C,O)=>{f(Y=>Y.map(q=>q.id===C?mr(q,O):q))},[]),X=l.useCallback((C,O)=>{f(Y=>Y.map(q=>q.id===C?Sr(q,O):q))},[]),ae=l.useCallback((C,O)=>{f(Y=>Y.map(q=>q.id===C&&q.outcome==="inProgress"?br(q,O):q))},[]),B=l.useCallback(C=>{f(O=>O.filter(Y=>!(Y.id===C&&Y.outcome==="inProgress"&&Y.userText===null)))},[]),J=l.useCallback(()=>{const C=j.current;if(C.phase!=="listening"||C.context.turnClientMessageId!==null)return;const O=Ue();m.current=[],h([]),w(!1),c({type:"TAKE_ARMED",clientMessageId:O}),Z(O),o.start()},[o,Z]);l.useEffect(()=>{E==="listening"&&L===null&&J()},[E,L,J]),l.useEffect(()=>{!(E==="starting"||E==="listening")&&o.state==="recording"&&U()},[E,o.state,U]);const se=E==="listening";l.useEffect(()=>{if(!se||L===null)return;const C=setInterval(()=>{const O=aa(m.current,o.audioLevel);m.current=O,h(O)},120);return()=>clearInterval(C)},[se,L]),l.useEffect(()=>{if(E!=="transcribing"||!R||K.current===R.clientMessageId)return;const C=R,O=A.current;K.current=C.clientMessageId,(async()=>{try{const Y=await vr(C.blob),q=await M.send(i,{base64Audio:Y,mimeType:C.blob.type||"audio/webm",durationSec:C.durationSec,clientMessageId:C.clientMessageId});if(A.current!==O||j.current.phase!=="transcribing")return;if(!q.ok){c({type:"SEND_FAILED"});return}_.current=q.message.ts,b(ee=>ee&&ee.clientMessageId===C.clientMessageId?null:ee),ce(C.clientMessageId,q.message),c({type:"SEND_CONFIRMED"})}finally{K.current===C.clientMessageId&&(K.current=null)}})()},[E,R,M,i,ce]);const de=l.useCallback(async()=>{const C=j.current;if(C.phase!=="listening"||C.context.turnClientMessageId===null)return;const O=C.context.turnClientMessageId,Y=o.duration;c({type:"TAKE_RELEASED"}),Le(10);const q=await o.stop();if(j.current.phase==="transcribing"){if(!q){B(O),w(!0),c({type:"TAKE_CANCELLED"});return}b({clientMessageId:O,blob:q,durationSec:Y})}},[o,B]);l.useEffect(()=>{o.silenceDetected&&E==="listening"&&L!==null&&de()},[o.silenceDetected,E,L,de]),l.useEffect(()=>{E!=="listening"||L===null||ra(o.duration,s)&&de()},[o.duration,E,L,s,de]),l.useEffect(()=>{o.state==="recording"&&(V.current=0)},[o.state]),l.useEffect(()=>{E!=="listening"||L===null||o.state==="idle"&&o.error&&(U(),B(L),w(!0),V.current+=1,V.current>=2?c({type:"FAIL",reason:"recorder",nowMs:Date.now()}):c({type:"TAKE_CANCELLED"}))},[E,L,o.state,o.error,U,B]),l.useEffect(()=>{if(E!=="thinking")return;const C=A.current,O=j.current.context.turnClientMessageId,Y=_.current;if(!O||Y===null)return;let q=!0,ee=0;const ue=async()=>{try{const le=await t.getThread(i);if(!q||A.current!==C||j.current.phase!=="thinking")return;const pe=hr(le.messages,Y);if(pe.kind==="none")throw new Error("not-ready");X(O,pe.reply),c(pe.kind==="voice"?{type:"REPLY_VOICE_READY"}:{type:"REPLY_TEXT_ONLY"});return}catch{if(!q||A.current!==C||j.current.phase!=="thinking")return;if(typeof navigator<"u"&&navigator.onLine===!1){c({type:"CONNECTION_LOST"});return}}if(ee+=1,ee>
16=gr){ae(O,"noReply"),c({type:"REPLY_TIMEOUT"});return}k.current=setTimeout(()=>void ue(),It(ee))};return k.current=setTimeout(()=>void ue(),It(0)),()=>{q=!1,N()}},[E,t,i,X,ae,N]),l.useEffect(()=>{if(E!=="formingVoice")return;const C=A.current,O=j.current.context.turnClientMessageId;if(!O)return;const Y=S.current.find(le=>le.id===O),q=Y?.replyText?.trim();if(!q){c({type:"VOICE_UNAVAILABLE"});return}let ee=!0;const ue=Zt({clientMessageId:O,text:q,voice:{characterId:a}});return v.request(ue,{text:q,characterId:a}).then(le=>{!ee||A.current!==C||j.current.phase==="formingVoice"&&(le.phase==="ready"&&le.audioUrl?(X(O,{messageId:Y?.id??O,ts:Date.now(),text:q,audioUrl:le.audioUrl,durationSec:null}),c({type:"VOICE_READY"})):(ae(O,"textFallback"),c({type:"VOICE_UNAVAILABLE"})))}),()=>{ee=!1}},[E,a,v,X,ae]),l.useEffect(()=>{if(E!=="speaking")return;const C=A.current,O=j.current.context.turnClientMessageId;if(!O)return;const q=S.current.find(pe=>pe.id===O)?.replyAudioUrl??null;if(!q){ae(O,"playbackFailed"),c({type:"SPEECH_FAILED"});return}I(q);const ee=new Audio(q);y.current=ee;const ue=()=>{A.current===C&&j.current.phase==="speaking"&&(ae(O,"voiceReply"),I(null),c({type:"SPEECH_ENDED"}))},le=()=>{A.current===C&&j.current.phase==="speaking"&&(ae(O,"playbackFailed"),I(null),c({type:"SPEECH_FAILED"}))};return ee.addEventListener("ended",ue),ee.addEventListener("error",le),ee.play().catch(()=>le()),Le(8),()=>{ee.removeEventListener("ended",ue),ee.removeEventListener("error",le);try{ee.pause()}catch{}y.current===ee&&(y.current=null)}},[E,ae]);const he=l.useCallback(()=>{j.current.phase==="idle"&&(A.current+=1,f([]),h([]),m.current=[],_.current=null,b(null),w(!1),V.current=0,c({type:"BEGIN",threadId:i}),o.start())},[o,i]);l.useEffect(()=>{E==="starting"&&(o.state==="recording"?(c({type:"SESSION_READY",nowMs:Date.now()}),Le(12)):o.state==="idle"&&o.error&&c({type:"START_FAILED",reason:/denied|permission|not allowed|notallowed/i.test(o.error)?"permission":"recorder",nowMs:Date.now()}))},[E,o.state,o.error]);const je=l.useCallback(()=>{const C=j.current;C.phase!=="listening"&&C.phase!=="thinking"&&C.phase!=="formingVoice"&&C.phase!=="speaking"||(A.current+=1,N(),Q(),C.phase==="listening"?(U(),C.context.turnClientMessageId&&B(C.context.turnClientMessageId)):C.context.turnClientMessageId&&ae(C.context.turnClientMessageId,"noReply"),b(null),Le([6,24,6]),c({type:"BARGE_IN"}))},[N,Q,U,B,ae]),vi=l.useCallback(()=>{const C=j.current;C.phase!=="listening"&&C.phase!=="transcribing"&&C.phase!=="thinking"&&C.phase!=="formingVoice"&&C.phase!=="speaking"||(C.phase==="listening"&&(U(),C.context.turnClientMessageId&&B(C.context.turnClientMessageId)),C.phase==="speaking"&&y.current?.pause(),C.phase==="thinking"&&N(),c({type:"PAUSE"}))},[U,B,N]),Ti=l.useCallback(()=>{j.current.phase==="paused"&&c({type:"RESUME"})},[]),ji=l.useCallback(()=>{j.current.phase==="interrupted"&&c({type:"RESUME_SESSION"})},[]),wi=l.useCallback(()=>{const C=j.current;C.phase==="ended"||C.phase==="failed"||C.phase==="ending"||(A.current+=1,c({type:"END"}),C.phase!=="idle"&&(N(),Q(),D(),U(),b(null),c({type:"END_COMPLETE",nowMs:Date.now()})))},[N,Q,D,U]);l.useEffect(()=>{const C=()=>{const O=j.current;(O.phase==="listening"||O.phase==="transcribing"||O.phase==="thinking"||O.phase==="formingVoice"||O.phase==="speaking")&&(O.phase==="listening"&&U(),O.phase==="speaking"&&y.current?.pause(),N(),c({type:"CONNECTION_LOST"}))};return window.addEventListener("offline",C),()=>window.removeEventListener("offline",C)},[U,N]),l.useEffect(()=>()=>{A.current+=1,N();const C=y.current;if(C){try{C.pause()}catch{}y.current=null}const O=T.current;if(O){try{O.pause()}catch{}T.current=null}U()},[N,U]);const Ii=l.useCallback((C,O)=>{const Y=j.current;if(Y.phase!=="listening"&&Y.phase!=="paused"&&Y.phase!=="ended")return;const q=S.current.find(Ae=>Ae.id===C),ee=O==="user"?q?.userAudioUrl:q?.replyAudioUrl;if(!ee)return;const ue=`${C}:${O}`;D();const le=new Audio(ee);T.current=le,g(ue);const pe=()=>{T.current===le&&(T.current=null),g(Ae=>Ae===ue?null:Ae)};le.addEventListener("ended",pe),le.addEventListener("error",pe),le.play().catch(pe)},[D]);return{state:d,takeDurationSec:o.duration,waveform:x,turns:u,speakingSrc:p,takeLost:z,replayTurnAudio:Ii,replayingKey:P,begin:he,finishTake:()=>void de(),bargeIn:je,pause:vi,resume:Ti,resumeSession:ji,end:wi}}const jr=12e3,wr=`
17@keyframes flowBreathe {
18  0%, 100% { transform: scale(1); opacity: 0.85; }
19  50% { transform: scale(1.08); opacity: 1; }
20}
21@keyframes flowEq {
22  0%, 100% { transform: scaleY(0.35); }
23  50% { transform: scaleY(1); }
24}
25@keyframes flowSoftPop {
26  from { opacity: 0; transform: translateY(8px); }
27  to { opacity: 1; transform: translateY(0); }
28}
29`;function Ir({state:t}){const i=nt(t);if(!i)return null;const a=t.phase==="interrupted"||t.phase==="failed";return e.jsxs("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:68",role:"status",style:{display:"inline-flex",alignItems:"center",gap:7,padding:"5px 12px",borderRadius:999,fontSize:11,fontWeight:600,letterSpacing:1.2,textTransform:"uppercase",color:a?"#FFB4C8":r.violetSoft,background:a?"rgba(255,120,150,0.10)":"rgba(142,99,255,0.10)",border:`1px solid ${a?"rgba(255,120,150,0.30)":"rgba(142,99,255,0.28)"}`,whiteSpace:"nowrap"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:86","aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:a?"#FF8FA8":r.violetMist,boxShadow:a?"0 0 8px rgba(255,143,168,0.8)":"
290 0 8px rgba(168,142,255,0.8)"}}),i]})}function Cr({samples:t,active:i}){const a=t.length>0?t:[.05];return e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:104","aria-hidden":!0,style:{display:"flex",alignItems:"center",gap:3,height:44,justifyContent:"center"},children:a.map((n,s)=>e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:115",style:{width:3,borderRadius:2,height:`${Math.max(8,Math.round(n*100))}%`,background:i?r.violetMist:r.text40,opacity:i?1:.5,transition:"height 90ms linear"}},s))})}function Rr({reducedMotion:t}){return e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:133","aria-hidden":!0,style:{display:"flex",alignItems:"center",gap:4,height:44,justifyContent:"center"},children:[0,1,2,3,4,5,6].map(i=>e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:135",style:{width:4,height:"70%",borderRadius:2,background:r.violetMist,transformOrigin:"center",animation:t?"none":`flowEq 1.1s ease-in-out ${i*.12}s infinite`,transform:t?"scaleY(0.6)":void 0}},i))})}function Ct({state:t,reducedMotion:i}){const a=t.phase,n=a==="listening"||a==="thinking"||a==="formingVoice"||a==="speaking",s=a==="interrupted"||a==="failed"?"rgba(255,143,168,0.55)":a==="paused"?"rgba(160,160,190,0.4)":"rgba(142,99,255,0.55)";return e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:169","aria-hidden":!0,style:{width:148,height:148,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"radial-gradient(circle at 35% 30%, rgba(201,180,255,0.20), rgba(11,7,20,0.1) 65%)",border:`1px solid ${s}`,boxShadow:n?`0 0 42px ${s}`:`0 0 18px ${s}`,animation:i||!n?"none":"flowBreathe 3.2s ease-in-out infinite"},children:e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:184",style:{width:96,height:96,borderRadius:"50%",background:"radial-gradient(circle at 40% 35%, rgba(168,142,255,0.55), rgba(107,75,196,0.25) 70%)",boxShadow:"inset 0 0 24px rgba(11,7,20,0.5)"}})})}function Mr({entry:t,herName:i,replayingKey:a,onReplay:n,canReplay:s}){const o=(d,c)=>c?e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:212",type:"button",onClick:()=>n(t.id,d),disabled:!s,"aria-label":`${F.replayTurn} — ${d==="user"?F.yourTurnLabel:i}`,style:{padding:"3px 10px",borderRadius:999,background:a===`${t.id}:${d}`?"rgba(142,99,255,0.28)":"rgba(142,99,255,0.10)",border:"1px solid rgba(142,99,255,0.30)",color:r.violetSoft,fontSize:10,fontWeight:600,letterSpacing:.8,cursor:s?"pointer":"default",opacity:s?1:.45,whiteSpace:"nowrap"},children:a===`${t.id}:${d}`?H.pause:F.replayTurn}):null;return e.jsxs("li",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:236",style:{listStyle:"none",display:"flex",flexDirection:"column",gap:6,padding:"10px 12px",borderRadius:14,background:"rgba(18,12,32,0.55)",border:`1px solid ${r.line}`},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:248",style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:249",style:{fontSize:10,fontWeight:700,letterSpacing:1.2,textTransform:"uppercase",color:r.text40,minWidth:44},children:F.yourTurnLabel}),e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:252",style:{flex:1,fontSize:13,color:r.text66,lineHeight:1.45},children:t.userText??"…"}),o("user",t.userAudioUrl)]}),(t.replyText||t.replyAudioUrl)&&e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:258",style:{display:"flex",alignItems:"baseline",gap:8},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:259",style:{fontSize:10,fontWeight:700,letterSpacing:1.2,textTransform:"uppercase",color:r.violetSoft,minWidth:44},children:i}),e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:262",style:{flex:1,fontSize:13,color:"rgba(245,242,252,0.85)",lineHeight:1.45},children:t.replyText??""}),o("reply",t.replyAudioUrl)]}),t.outcome==="noReply"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:269",style:{fontSize:11,color:r.text40,lineHeight:1.4},children:F.noReplyNotice}),t.outcome==="textFallback"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:272",style:{fontSize:11,color:r.text40,lineHeight:1.4},children:F.voiceFallbackNotice}),t.outcome==="playbackFailed"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:275",style:{fontSize:11,color:r.text40,lineHeight:1.4},children:F.playbackFailedNotice})]})}function Fr({engine:t,onPick:i,onOpenPresences:a,onBack:n}){const[s,o]=l.useState(null);return l.useEffect(()=>{let d=!0;return t.listConversations().then(c=>{d&&o(c.filter(u=>u.kind==="luman").map(u=>({threadId:u.threadId,name:u.name,preview:u.preview,avatarUrl:u.avatarUrl})))}).catch(()=>{d&&o([])}),()=>{d=!1}},[t]),e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:316",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[e.jsxs("header",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:317",style:{display:"flex",alignItems:"center",gap:12,padding:"14px 18px",borderBottom:`1px solid ${r.line}`},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:318",type:"button",onClick:n,"aria-label":H.close,style:st,children:"←"}),e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:321",style:{flex:1},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:322",style:{fontSize:15,fontWeight:700},children:F.entryTitle}),e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:323",style:{fontSize:10,letterSpacing:1.6,color:r.violetSoft,textTransform:"uppercase"},children:F.entrySub})]})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:328",style:{flex:1,overflowY:"auto",padding:"22px 18px",display:"flex",flexDirection:"column",gap:14},children:[e.jsx("p",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:329",style:{margin:0,fontSize:13,color:r.text66,lineHeight:1.55,maxWidth:520},children:F.entryBody}),e.jsx("p",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:330",style:{margin:0,fontSize:12,color:r.text40,lineHeight:1.5,maxWidth:520},children:F.entryHint}),e.jsx("h2",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:331",style:{margin:"10px 0 0",fontSize:12,fontWeight:700,letterSpacing:1.4,textTransform:"uppercase",color:r.violetSoft},children:F.entryPickTitle}),s===null&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:334",style:{fontSize:12,color:r.text40},children:"…"}),s!==null&&s.length===0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:336",style:{display:"flex",flexDirection:"column",gap:10,marginTop:8},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:337",style:{fontSize:14,fontWeight:600},children:F.entryEmptyTitle}),e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:338",style:{fontSize:12,color:r.text66,lineHeight:1.5,maxWidth:420},children:F.entryEmptyBody}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:339",type:"button",onClick:a,style:{...xe,alignSelf:"flex-start"},children:F.entryOpenPresences})]}),e.jsx("ul",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:344",style:{margin:0,padding:0,display:"flex",flexDirection:"column",gap:8},children:s?.map(d=>e.jsx("li",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:346",style:{listStyle:"none"},children:e.jsxs("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:347",type:"button",onClick:()=>i(d.threadId),style:{width:"100%",display:"flex",alignItems:"center",gap:12,padding:"12px 14px",borderRadius:16,background:"rgba(18,12,32,0.6)",border:`1px solid ${r.line}`,cursor:"pointer",textAlign:"left",color:"inherit"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:364","aria-hidden":!0,style:{width:38,height:38,borderRadius:"50%",flexShrink:0,background:d.avatarUrl?`center/cover url(${d.avatarUrl})`:"radial-gradient(circle at 40% 35%, rgba(168,142,255,0.6), rgba(107,75,196,0.3))",border:`1px solid ${r.line}`}}),e.jsxs("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:377",style:{flex:1,minWidth:0},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:378",style:{display:"block",fontSize:14,fontWeight:600},children:d.name}),e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:379",style:{display:"block",fontSize:11,color:r.text40,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.preview})]}),e.jsx("span",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:383","aria-hidden":!0,style:{color:r.violetSoft,fontSize:16},children:"→"})]})},d.threadId))})]})]})}const st={background:"none",border:`1px solid ${r.line}
29`,borderRadius:999,width:34,height:34,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:r.text66,fontSize:15,flexShrink:0},xe={padding:"11px 26px",borderRadius:999,background:"linear-gradient(135deg, #8E63FF, #6B4BC4)",border:"none",color:"#fff",fontSize:14,fontWeight:700,letterSpacing:.4,cursor:"pointer",boxShadow:"0 6px 22px rgba(142,99,255,0.35)"},Se={padding:"10px 18px",borderRadius:999,background:"rgba(142,99,255,0.10)",border:"1px solid rgba(142,99,255,0.30)",color:r.violetSoft,fontSize:12,fontWeight:700,letterSpacing:.6,cursor:"pointer"};function Ar({engine:t,threadId:i,herName:a,participantId:n,visionPrefsStore:s,onExitToThread:o}){const d=re.useUtils(),c=me(),u=l.useMemo(()=>{const L=parseInt(n,10);return Number.isFinite(L)&&L>0?L:void 0},[n]),f=l.useMemo(()=>(L=>d.client.chat.speak.mutate(L)),[d.client]),x=Tr({engine:t,threadId:i,characterId:u,speak:f}),{state:h}=x,{phase:p,context:I}=h,[P,g]=l.useState(()=>s.getPrefs());l.useEffect(()=>s.subscribe(()=>g(s.getPrefs())),[s]);const R=p==="listening"||p==="transcribing"||p==="thinking"||p==="formingVoice"||p==="speaking",b=re.connect.getThread.useQuery({threadId:i,limit:30},{enabled:R,refetchInterval:R?jr:!1,refetchOnWindowFocus:!1});l.useEffect(()=>{(p==="speaking"||p==="formingVoice")&&b.refetch().catch(()=>{})},[p]);const[z,w]=l.useState(new Set),j=l.useMemo(()=>{const L=b.data?.messages??[];return at(L)},[b.data]),S=l.useMemo(()=>it({meta:j?.meta??null,identity:{name:a},reducedMotion:c,dataSaving:P.dataSaving,autoplayGlimpses:P.autoplayGlimpses}),[j,a,c,P.dataSaving,P.autoplayGlimpses]),A=j?String(j.row.id):null,m=R&&j&&S.mode!=="none"&&A!==null&&!z.has(A),k=fr(h),[y,T]=l.useState("");l.useEffect(()=>{k&&T(k)},[k]);const _=l.useRef(p);_.current=p,l.useEffect(()=>{const L=U=>{if(U.key!=="Escape")return;const Q=_.current;Q==="listening"||Q==="thinking"||Q==="formingVoice"||Q==="speaking"?(U.preventDefault(),x.bargeIn()):(Q==="ended"||Q==="failed"||Q==="idle")&&(U.preventDefault(),o())};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[x.bargeIn,o]);const K=l.useCallback(()=>{x.end(),o()},[x.end,o]),V=pr(I),M=dr(I.lastTurnOutcome),v=ur(h),E=p==="listening"?e.jsx(Cr,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:544",samples:x.waveform,active:!0}):p==="speaking"?e.jsx(Rr,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:545",reducedMotion:c}):e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:546",style:{height:44},"aria-hidden":!0});return e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:550",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,position:"relative"},children:[e.jsx("style",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:551",children:wr}),e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:553","aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:y}),e.jsxs("header",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:557",style:{display:"flex",alignItems:"center",gap:12,padding:"14px 18px",borderBottom:`1px solid ${r.line}`},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:558",type:"button",onClick:K,"aria-label":F.backToThread,style:st,children:"←"}),e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:561",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:562",style:{fontSize:15,fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:565",style:{fontSize:10,letterSpacing:1.6,color:r.violetSoft,textTransform:"uppercase"},children:F.entryTitle})]}),e.jsx(Ir,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:569",state:h}),p!=="ended"&&p!=="failed"&&p!=="idle"&&e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:571",type:"button",onClick:x.end,"aria-label":F.endAria,style:{...Se,padding:"8px 14px"},children:F.end})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:578",style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",alignItems:"center",padding:"26px 18px 18px",gap:18},children:[e.jsx(Ct,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:579",state:h,reducedMotion:c}),E,x.takeLost&&p==="listening"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:584",role:"status",style:{fontSize:12,color:"#FFB4C8",animation:c?"none":"flowSoftPop 240ms ease-out"},children:F.takeLostNotice}),!x.takeLost&&M&&p==="listening"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:589",role:"status",style:{fontSize:12,color:r.text66,animation:c?"none":"flowSoftPop 240ms ease-out"},children:M}),p==="listening"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:594",style:{fontSize:11,color:r.text40},children:F.startHint}),m&&j&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:599",style:{width:"min(340px, 100%)",animation:c?"none":"flowSoftPop 240ms ease-out"},children:e.jsx(rt,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:600",meta:j.meta,decision:S,onDismiss:()=>w(L=>{const U=new Set(L);return A&&U.add(A),U})})}),x.turns.length>0&&p!=="idle"&&e.jsx("section",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:616","aria-label":F.transcriptLabel,style:{width:"min(560px, 100%)",marginTop:4},children:e.jsx("ul",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:617",style:{margin:0,padding:0,display:"flex",flexDirection:"column",gap:8},children:x.turns.map(L=>e.jsx(Mr,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:619",entry:L,herName:a,replayingKey:x.replayingKey,onReplay:x.replayTurnAudio,canReplay:p==="listening"||p==="paused"||p==="ended"},L.id))})})]}),p!=="idle"&&p!=="ended"&&p!=="failed"&&e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:635",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:10,padding:"14px 18px 20px",flexWrap:"wrap"},children:[p==="listening"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:638",type:"button",onClick:x.finishTake,style:xe,children:F.doneSpeaking}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:641",type:"button",onClick:x.bargeIn,"aria-label":F.bargeInAria,style:Se,children:F.cancelTake}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:644",type:"button",onClick:x.pause,style:Se,title:F.pauseDiscardNote,children:F.pause})]}),(p==="thinking"||p==="formingVoice"||p==="speaking")&&e.jsxs(e.Fragment,{children:[e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:651",type:"button",onClick:x.bargeIn,"aria-label":F.bargeInAria,style:xe,children:F.bargeIn}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:654",type:"button",onClick:x.pause,style:Se,children:F.pause})]}),p==="transcribing"&&e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:660",type:"button",onClick:x.pause,style:Se,children:F.pause}),p==="paused"&&e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:665",type:"button",onClick:x.resume,style:xe,children:F.resume}),p==="interrupted"&&e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:670",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:10,maxWidth:420},children:[e.jsx("p",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:671",style:{margin:0,fontSize:12,color:r.text66,textAlign:"center",lineHeight:1.5},children:v}),e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:672",style:{display:"flex",gap:10},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:673",type:"button",onClick:x.resumeSession,style:xe,children:F.resumeSession}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:676",type:"button",onClick:x.end,style:Se,children:F.end})]})]}),p==="starting"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:682",style:{fontSize:12,color:r.text40},children:F.statusStarting}),p==="ending"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:683",style:{fontSize:12,color:r.text40},children:F.statusEnding})]}),p==="idle"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:689",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(5,7,13,0.88)",backdropFilter:"blur(8px)",padding:18},children:e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:690",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,maxWidth:440,textAlign:"center",animation:c?"none":"flowSoftPop 240ms ease-out"},children:[e.jsx(Ct,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:691",state:h,reducedMotion:c}),e.jsx("h1",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:692",style:{margin:0,fontSize:22,fontWeight:800},children:F.entryTitle}),e.jsx("p",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:693",style:{margin:0,fontSize:13,color:r.text66,lineHeight:1.6},children:F.entryBody}),e.jsx("p",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:694",style:{margin:0,fontSize:11,color:r.text40,lineHeight:1.5},children:F.entryHint}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:695",type:"button",onClick:x.begin,style:xe,autoFocus:!0,children:F.entryBegin})]})}),p==="ended"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:704",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(5,7,13,0.88)",backdropFilter:"blur(8px)",padding:18},children:e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:705",role:"dialog","aria-label":F.summaryHeading,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:14,maxWidth:420,textAlign:"center",padding:"28px 30px",borderRadius:22,background:"rgba(18,12,32,0.95)",border:`1px solid ${r.line}`,animation:c?"none":"flowSoftPop 240ms ease-out"},children:[e.jsx("h2",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:706",style:{margin:0,fontSize:17,fontWeight:800},children:F.summaryHeading}),V?e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:709",style:{fontSize:26,fontWeight:800,color:r.violetSoft},children:F.summaryTurns(V.turnsCompleted)}),e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:712",style:{fontSize:12,color:r.text66},children:[F.summaryDurationLabel,": ",xr(V.durationMs)]}),V.turnsCompleted===0&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:715",style:{fontSize:12,color:r.text40},children:F.summaryEmpty})]}):e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:718",style:{fontSize:12,color:r.text40},children:F.summaryEmpty}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:720",type:"button",onClick:K,style:xe,autoFocus:!0,children:F.backToThread})]})}),p==="failed"&&e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:729",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(5,7,13,0.88)",backdropFilter:"blur(8px)",padding:18},children:e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:730",role:"alert",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:14,maxWidth:420,textAlign:"center",padding:"28px 30px",borderRadius:22,background:"rgba(18,12,32,0.95)",border:"1px solid rgba(255,120,150,0.30)"},children:[e.jsx("p",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:731",style:{margin:0,fontSize:14,color:"#FFB4C8",lineHeight:1.55},children:nt(h)}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:732",type:"button",onClick:K,style:xe,autoFocus:!0,children:F.backToThread})]})})]})}function Er({engine:t,threadId:i,visionPrefsStore:a,onBack:n,onExitToThread:s,onPickThread:o,onOpenPresences:d}){const[c,u]=l.useState(null);return l.useEffect(()=>{if(u(null),!i)return;let f=!0;return t.getThread(i).then(x=>{f&&u({kind:x.kind,name:x.name,participantId:x.participantId})}).catch(()=>{f&&u("failed")}),()=>{f=!1}},[t,i]),i?c===null?e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:786",style:{flex:1}}):c==="failed"||c.kind!=="luman"?e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:792",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[e.jsxs("header",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:793",style:{display:"flex",alignItems:"center",gap:12,padding:"14px 18px",borderBottom:`1px solid ${r.line}`},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:794",type:"button",onClick:()=>s(i),"aria-label":F.backToThread,style:st,children:"←"}),e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:797",style:{flex:1,fontSize:15,fontWeight:700},children:F.entryTitle})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:799",style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:18},children:e.jsxs("div",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:800",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:14,maxWidth:420,textAlign:"center"},children:[e.jsx("h1",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:801",style:{margin:0,fontSize:18,fontWeight:800},children:F.presenceOnlyTitle}),e.jsx("p",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:802",style:{margin:0,fontSize:13,color:r.text66,lineHeight:1.6},children:F.presenceOnlyBody}),e.jsx("button",{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:803",type:"button",onClick:()=>s(i),style:xe,children:F.backToThread})]})})]}):e.jsx(Ar,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:813",engine:t,threadId:i,herName:c.name,participantId:c.participantId,visionPrefsStore:a,onExitToThread:()=>s(i)}):e.jsx(Fr,{"data-loc":"client/src/features/talkie/flow/TalkieFlowScreen.tsx:782",engine:t,onPick:o,onOpenPresences:d,onBack:n})}const W={brand:oe.name,frameSub:"PRIVATE SOCIETY",tabs:{chat:"Chat",members:"Members",memory:"Memory",bonds:"Bonds",culture:"Culture",story:"Story",invite:"Invite"},composerPlaceholder:t=>
29`Message ${t}…`,rosterStripLabel:"Participants",seatLawLine:"A Society holds 4–9 participants. Each human may bring up to two Presences.",privacyLine:"This Society is private. Messages, voice and memories stay inside it — never shared with other Societies or Talkies.",eventJoin:t=>`${t} joined`,mentionHint:t=>`Mentioning ${t.join(", ")}`,replyLabel:t=>`Replying to ${t}`,badgeHuman:"Human",badgePresence:"Presence",badgeMember:"Member",badgeAriaLabel:t=>`${t} author`,voiceSendFailed:"That voice note could not cross. Try again.",imageSendFailed:"That image could not be shared. Try again.",keepInMemory:"Keep in memory",keepBusy:"Keeping…",memoryKeepFailed:"That could not be kept. Try again.",memoryKept:"Kept in this Society's memory.",rosterTitle:"Members",rosterSub:"Humans and Presences in this Society",roleOwner:"Owner",roleElder:"Elder",roleMember:"Member",broughtBy:t=>`brought by ${t}`,brought:t=>`brought ${t.join(" and ")}`,addPresence:"Bring a Presence",addPresenceFull:"This human already has two Presences",removeMember:"Remove from Society",removeConfirmTitle:t=>`Remove ${t}?`,removeConfirmBody:"They and their Presences will leave this Society. This cannot be undone.",removeFailed:"That could not be done. Try again.",removed:t=>`${t} was removed from the Society.`,report:"Report",reportSent:"Report received. Thank you.",reportFailed:"That report could not be sent. Try again.",leaveSociety:"Leave Society",leaveFailed:"You could not leave right now. Try again.",inviteEntry:"Invite",inviteHubTitle:"Grow this Society",inviteHubSub:"Invitations are private — every arrival comes through someone inside.",activeInvitesTitle:"Your invitations",noActiveInvites:"No live invitations yet.",revoke:"Withdraw",revokeFailed:"That invitation could not be withdrawn. Try again.",revoked:"Invitation withdrawn.",seatsOpen:t=>`${t} seat${t===1?"":"s"} open`,societyFull:"Society is full — a seat must open before new invitations.",invariantNotice:"This Society's roster does not match the Society model right now. Showing every member as they are.",memoryTitle:"Society Memory",memoryWhyTitle:"Why this is remembered",memoryEmptyTitle:"No shared memories yet",memoryEmptyBody:"Keep something from the conversation and it will live here — only inside this Society."},Pr=[{key:"chat",label:W.tabs.chat},{key:"members",label:W.tabs.members},{key:"memory",label:W.tabs.memory},{key:"bonds",label:W.tabs.bonds},{key:"culture",label:W.tabs.culture},{key:"story",label:W.tabs.story},{key:"invite",label:W.tabs.invite}];function Lr({societyName:t,activeTab:i,onTab:a,children:n}){return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:36",style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:r.bg},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:39",style:{display:"flex",alignItems:"center",gap:10,padding:"12px 16px 8px",flexShrink:0,borderBottom:`1px solid ${r.lineSoft}`},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:40",style:{width:8,height:8,borderRadius:"50%",background:r.violet,boxShadow:`0 0 10px ${r.violet}`,flexShrink:0}}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:41",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:42",style:{fontSize:12.5,fontWeight:700,letterSpacing:4,textTransform:"uppercase",color:r.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W.brand}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:45",style:{fontSize:8.5,letterSpacing:1.8,textTransform:"uppercase",color:r.text40,marginTop:1},children:[t?`${t} · `:"",W.frameSub]})]})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:52",style:{display:"flex",gap:4,padding:"8px 16px",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${r.lineSoft}`},className:"hide-scrollbar",children:Pr.map(s=>{const o=s.key===i;return e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:56",role:"button",tabIndex:0,onClick:()=>a(s.key),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&a(s.key)}
29,style:{height:26,padding:"0 12px",borderRadius:13,display:"flex",alignItems:"center",fontSize:10.5,fontWeight:o?700:500,cursor:"pointer",flexShrink:0,color:o?"#FFFFFF":"rgba(245,242,252,0.55)",background:o?"rgba(142,99,255,0.9)":"rgba(245,242,252,0.04)",border:o?"1px solid rgba(142,99,255,0.6)":`1px solid ${r.lineSoft}`,boxShadow:o?"0 0 12px rgba(142,99,255,0.35)":"none"},children:s.label},s.key)})}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyFrame.tsx:85",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:n})]})}const Me=9,Dr=3,li=6,oi=2;function lt(t){let i=0,a=0;for(const n of t)n.kind==="human"?i+=1:a+=1;return{humans:i,presences:a,total:i+a}}function ci(t,i){return t.filter(a=>a.kind==="presence"&&a.broughtById===i).length}function zr(t,i){const a=lt(t),n=i?.maxParticipants??Me,s=new Set;(a.total>n||a.total>Me)&&s.add("over_capacity"),a.humans>Dr&&s.add("too_many_humans"),a.presences>li&&s.add("too_many_presences");const o=new Set(t.filter(d=>d.kind==="human").map(d=>d.id));for(const d of t)d.kind==="presence"&&(d.broughtById!=null&&!o.has(d.broughtById)&&s.add("presence_without_human"),d.broughtById!=null&&ci(t,d.broughtById)>oi&&s.add("presence_cap_per_human"));return{ok:s.size===0,violations:[...s],counts:a}}function Vr(t,i,a){const n=lt(t),s=a?.maxParticipants??Me;return n.total>=s?{allowed:!1,reason:"society_full"}:n.presences>=li?{allowed:!1,reason:"presence_seats_full"}:ci(t,i)>=oi?{allowed:!1,reason:"presence_cap_per_human"}:{allowed:!0}}function di(t,i){const a=i?.maxParticipants??Me;return Math.max(0,a-lt(t).total)}function $r(t){return t==="human"?{label:"Human",isAI:!1}:t==="presence"?{label:"Presence",isAI:!0}:{label:"Member",isAI:!1}}function Wr(t){return t!=null?"presence":"human"}function ot(t){const i=t instanceof Date?t.getTime():Date.parse(t);return Number.isFinite(i)?i:0}const Nr=new Set(["text","voice","image","story_beat"]);function Or(t,i){if(!Nr.has(t.contentType))return null;const a=t.senderCharacterId==null&&i!=null&&t.senderId===i,n=t.contentType==="voice"?"voice":t.contentType==="image"?"image":"text";return{id:String(t.id),numericId:t.id,mine:a,kind:n,content:t.content??"",ts:ot(t.createdAt),...n==="voice"&&t.attachmentUrl?{audioUrl:t.attachmentUrl}:{},...n==="voice"&&typeof t.attachmentMeta?.duration=="number"?{durationSec:t.attachmentMeta.duration}:{},...n==="image"&&t.attachmentUrl?{imageUrl:t.attachmentUrl}:{},...t.replyToId!=null?{replyToId:t.replyToId}:{},...a?{status:(t.readBy??[]).some(o=>o!==t.senderId)?"read":"delivered"}:{authorName:t.senderCharacterId!=null?t.characterName??"Presence":t.senderName??"Member",badge:$r(Wr(t.senderCharacterId))}}}function _r(t,i){const a=[],n=[];for(const s of t){const o=Or(s,i);if(o){a.push(o);continue}s.contentType==="system"&&n.push({id:String(s.id),ts:ot(s.createdAt),text:s.content??"",eventKind:"system"})}return a.sort((s,o)=>s.ts-o.ts),n.sort((s,o)=>s.ts-o.ts),{bubbles:a,events:n}}function Br(t,i){const a=[];for(const n of t){if(n.characterId!=null)continue;const s=n.joinedAt?ot(n.joinedAt):0;if(!s)continue;const o=n.userName??"A member",d=n.invitedBy!=null?i?.get(n.invitedBy):void 0;a.push({id:`join-u${n.userId}`,ts:s,text:d?`${o} joined · invited by ${d}`:`${o} joined`,eventKind:"join"})}return a.sort((n,s)=>n.ts-s.ts)}function Ur(t){return[...t.bubbles.map(a=>({type:"bubble",bubble:a})),...t.events.map(a=>({type:"event",event:a}))].sort((a,n)=>{const s=a.type==="bubble"?a.bubble.ts:a.event.ts,o=n.type==="bubble"?n.bubble.ts:n.event.ts;return s-o})}function Hr(t,i){if(t.replyToId==null||t.replyToId===t.numericId
29)return null;const a=i.find(s=>s.numericId===t.replyToId);if(!a)return null;const n=a.kind==="voice"?"Voice note":a.kind==="image"?"Photo":a.content.length>140?`${a.content.slice(0,140)}…`:a.content;return{authorName:a.mine?"You":a.authorName??"Member",snippet:n,kind:a.kind}}function Kr(t,i){if(!t.includes("@"))return[];const a=[];for(const n of i)!n||n==="You"||t.includes(`@${n}`)&&a.push(n);return a}const Rt=new Set(["chat","members","memory","bonds","culture","story","invite"]),ct="society-";function Ce(t){return t.startsWith(ct)}function De(t){return Ce(t)&&t.slice(ct.length)||null}function ui(t){return`${ct}${t}`}function Oe(t){return`/talkie/thread/${encodeURIComponent(t)}`}function qr(t){return`/talkie/thread/${encodeURIComponent(t)}/memory`}function Mt(t){return t?`/talkie/flow/${encodeURIComponent(t)}`:"/talkie/flow"}function G(t,i){const a=`/talkie/society/${encodeURIComponent(t)}`;return i?`${a}/${i}`:a}function Yr(t){const i=t==="/talkie"?"":t.startsWith("/talkie/")?t.slice(8):null;if(i===null||i==="")return{name:"inbox"};const a=i.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}}),[n,s,o]=a;switch(n){case"thread":return s?o==="memory"?{name:"threadMemory",threadId:s}:{name:"thread",threadId:s}:{name:"inbox"};case"info":return s?{name:"info",threadId:s}:{name:"inbox"};case"presences":case"lumans":return{name:"presences"};case"people":return{name:"people"};case"societies":{if(!s)return{name:"societies"};if(s==="new")return{name:"societyCreate"};if(s==="created"&&o)return{name:"societyCreated",societyId:o};const d=o&&Rt.has(o)?o:void 0;return{name:"society",societyId:s,tab:d}}case"society":{if(!s)return{name:"societies"};const d=o&&Rt.has(o)?o:void 0;return{name:"society",societyId:s,tab:d}}case"requests":return{name:"requests"};case"vault":case"saved":return{name:"vault"};case"archived":return{name:"archived"};case"settings":return{name:"settings"};case"profile":case"me":return{name:"me"};case"new":return{name:"new"};case"search":return{name:"search"};case"notifications":return{name:"notifications"};case"moments":return s==="add"?{name:"addMoment"}:{name:"moments"};case"moment":return s?{name:"moment",id:s}:{name:"moments"};case"calls":return{name:"calls"};case"flow":return s?{name:"flow",threadId:s}:{name:"flow"};case"safety":return{name:"safety"};case"invite":case"reactor":return{name:"invite"};case"resolve":return{name:"resolve"};case"scan":return{name:"scan"};default:return{name:"inbox"}}}const Gr=[{key:"talkies",label:"Recent Talkies",path:"/talkie"},{key:"presences",label:"Presences",path:"/talkie/presences"},{key:"people",label:"People",path:"/talkie/people"},{key:"societies",label:"Societies",path:"/talkie/societies"},{key:"requests",label:"Requests",path:"/talkie/requests"},{key:"vault",label:"Vault",path:"/talkie/vault"},{key:"archived",label:"Archived",path:"/talkie/archived"},{key:"settings",label:"Settings",path:"/talkie/settings"}],Qr=[{key:"talkies",label:"Talkies",path:"/talkie"},{key:"presences",label:"Presences",path:"/talkie/presences"},{key:"societies",label:"Societies",path:"/talkie/societies"},{key:"me",label:"Me",path:"/talkie/profile"}];function Xr(t){switch(t.name){case"inbox":case"presences":case"people":case"societies":case"requests":case"vault":case"archived":case"settings":case"me":case"calls":case"moments":case"notifications":return!0;default:return!1}}const ze=/^human-\d+-\d+$/i;function Jr(t){switch(t.name){case"people":case"requests":case"societies":case"societyCreate":case"societyCreated":case"society":case"new":case"scan":case"resolve":case"invite":case"search":return!0;case"thread":return ze.test(t.threadId)||Ce(t.threadId);case"flow":return t.threadId?ze.test(t.threadId)||Ce(t.threadId):!1;case"threadMemory":return ze.test(t.threadId)||Ce(t.threadId);case"info":return ze.test(t.threadId)||Ce(t.threadId);default:return!1}}function Zr(t){switch(t.name){case"inbox":return"talkies";case"presences":return"presences";case"people":return"people";case"societies":return"societies";case"requests":return"requests";case"vault":return"vault";case"archived":return"archived";case"settings":case"safety":return"settings";case"me":return"me";default:return null}}function Ft(t,i){return`society-${t}::${i}`}function fi({societyId:t,upload:i,sendMessage:a}){const n=new Map,s=new Map;return{send(o){const d=Ft(t,o),c=s.get(d);if(c)return Promise.resolve(c);const u=n.get(d);if(u)return u;const f=(async()=>{try{let x;try{({url:x}=await i())}catch(h){return{ok:!1,stage:"upload",error:h instanceof Error?h.message:"upload failed"}}try{const p={ok:!0,result:await a(x)};return s.set(d,p),p}catch(h){return{ok:!1,stage:"send",error:h instanceof Error?h.message:"send failed"}}}
29finally{n.delete(d)}})();return n.set(d,f),f},hasSucceeded(o){return s.has(Ft(t,o))}}}function pi(t){const i="base64Audio"in t;return{societyId:t.societyId,kind:i?"voice":"image",base64:i?t.base64Audio:t.base64,mimeType:t.mimeType,...i?{durationSec:t.durationSec}:{}}}function xi(t,i){const a="base64Audio"in t;return{societyId:t.societyId,content:a?"":t.caption?.trim()??"",contentType:a?"voice":"image",attachmentUrl:i,attachmentMeta:{mimeType:t.mimeType,...a?{duration:t.durationSec}:{}},...t.replyToId!=null?{replyToId:t.replyToId}:{}}}function ki(t){return new Promise((i,a)=>{const n=new FileReader;n.onloadend=()=>i(n.result),n.onerror=()=>a(new Error("read failed")),n.readAsDataURL(t)})}function en({engine:t,societyId:i,voicePrefsStore:a,replyToIdRef:n,onSent:s}){const o=re.useUtils(),d=me(),c=ui(String(i)),[u,f]=l.useState(()=>a.getPrefs());l.useEffect(()=>a.subscribe(()=>f(a.getPrefs())),[a]);const x=l.useMemo(()=>Jt(),[]),[h,p]=l.useState(null),[I,P]=l.useState(()=>Date.now()),g=l.useRef(h);g.current=h;const R=l.useCallback(async k=>{const y={societyId:i,base64Audio:await ki(k.blob),mimeType:k.mimeType,durationSec:k.durationSec,...n?.current!=null?{replyToId:n.current}:{},clientMessageId:k.clientMessageId},_=await fi({societyId:i,upload:async()=>o.client.society.uploadAttachment.mutate(pi(y)),sendMessage:async K=>{const V=await o.client.society.sendMessage.mutate(xi(y,K));return{messageId:V.id,attachmentUrl:V.attachmentUrl??K}}}).send(k.clientMessageId);if(p(K=>{const V=K&&K.clientMessageId===k.clientMessageId?K:{clientMessageId:k.clientMessageId,releasedAtMs:Date.now(),acked:!1,failed:!1,receipt:void 0,memoryPersisted:!1,messageId:null,settledAtMs:null};return _.ok?{...V,acked:!0,messageId:_.result.messageId}:{...V,failed:!0}}),!_.ok)throw new Error(_.error);s?.()},[o.client,i,n,s]),b=_t({onUpload:R}),z=b.state.phase,w=b.state.context.clientMessageId;l.useEffect(()=>{(z==="processing"||z==="uploading")&&w&&p(k=>k&&k.clientMessageId===w||!x.shouldShow(w)?k:{clientMessageId:w,releasedAtMs:Date.now(),acked:!1,failed:!1,receipt:void 0,memoryPersisted:!1,messageId:null,settledAtMs:null})},[z,w,x]);const j=h?Xt({acked:h.acked,failed:h.failed,receipt:h.receipt,memoryPersisted:h.memoryPersisted,releasedAtMs:h.releasedAtMs,nowMs:I}):null;l.useEffect(()=>{if(!h||!j)return;if(!tt(j)){const y=setInterval(()=>P(Date.now()),200);return()=>clearInterval(y)}j!=="returned"&&x.markShown(h.clientMessageId),p(y=>y&&y.settledAtMs===null?{...y,settledAtMs:Date.now()}:y);const k=setTimeout(()=>p(null),Qt);return()=>clearTimeout(k)},[h?.clientMessageId,j]);const[S,A]=l.useState(!1),m=l.useCallback(async()=>{const k=g.current;if(!(!k?.messageId||S)){A(!0);try{await t.saveToMemory(c,String(k.messageId)),p(y=>y&&{...y,memoryPersisted:!0})}catch{}finally{A(!1)}}},[t,c,S]);return l.useEffect(()=>{p(null)},[i]),e.jsxs(e.Fragment,{children:[e.jsx(ti,{"data-loc":"client/src/features/talkie/society/TalkieSocietyVoiceDock.tsx:197",ritual:b,defaultSpeed:u.playbackSpeed,onSpeedChange:k=>a.update({playbackSpeed:Ne(k)})}),h&&j&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyVoiceDock.tsx:203",style:{position:"absolute",left:0,right:0,bottom:132,zIndex:50,display:"flex",justifyContent:"center",pointerEvents:"none"},children:e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyVoiceDock.tsx:215",style:{pointerEvents:"auto"},children:e.jsx(ii,{"data-loc":"client/src/features/talkie/society/TalkieSocietyVoiceDock.tsx:216",stage:j,reducedMotion:d,onKeepInMemory:h.messageId?m:void 0,keepBusy:S})})})]})}const tn=12e3;function an({societyId:t,visionPrefsStore:i,replyToIdRef:a,onSent:n}){const s=re.useUtils(),[o,d]=l.useState(()=>i.getPrefs());l.useEffect(()=>i.subscribe(()=>d(i.getPrefs())),[i]);const c=re.society.getMessages.useQuery({societyId:t,limit:30},{refetchInterval:tn,refetchOnWindowFocus:!1}),u=l.useCallback(async w=>{const j={societyId:t,base64:await ki(w.file),mimeType:w.file.type||"image/jpeg",...w.caption?.trim()?{caption:w.caption.trim()}:{},...a?.current!=null?{replyToId:a.current}:{},clientMessageId:w.clientMessageId},A=await fi({societyId:t,upload:async()=>s.client.society.uploadAttachment.mutate(pi(j)),sendMessage:async m=>{const k=await s.client.society.sendMessage.mutate(xi(j,m));return{messageId:k.id,attachmentUrl:k.attachmentUrl??m}}}).send(w.clientMessageId);if(!A.ok)throw new Error(A.error);return c.refetch().catch(()=>{}),n?.(),{replyArrived:!1}},[s.client,t,a,c,n]),f=ai({onShare:u}),[x,h]=l.useState(!1),[p,I]=l.useState(new Set);l.useEffect(()=>{h(!1),I(new Set)},[t]);const P=me(),g=l.useMemo(()=>{const w=(c.data??[]).map(A=>
29({id:A.id,role:A.senderCharacterId!=null?"soul":"user",metadata:A.metadata,deletedAt:A.deletedAt,createdAt:A.createdAt,authorName:A.characterName??void 0})),j=at(w);if(!j)return null;const S=w.find(A=>A.id===j.row.id)?.authorName;return{...j,authorName:S}},[c.data]),R=l.useMemo(()=>it({meta:g?.meta??null,identity:{name:g?.authorName},reducedMotion:P,dataSaving:o.dataSaving,autoplayGlimpses:o.autoplayGlimpses}),[g,P,o.dataSaving,o.autoplayGlimpses]),b=g?String(g.row.id):null,z=g&&R.mode!=="none"&&b!==null&&!p.has(b);return e.jsxs(e.Fragment,{children:[e.jsx(ri,{"data-loc":"client/src/features/talkie/society/TalkieSocietyVisionDock.tsx:135",onOpen:()=>h(!0)}),e.jsx(ni,{"data-loc":"client/src/features/talkie/society/TalkieSocietyVisionDock.tsx:136",ritual:f,isPresence:!1,chooserOpen:x,onChooserClose:()=>h(!1)}),z&&g&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyVisionDock.tsx:143",style:{position:"absolute",left:14,bottom:136,zIndex:44,display:"flex",flexDirection:"column",gap:6},children:e.jsx(rt,{"data-loc":"client/src/features/talkie/society/TalkieSocietyVisionDock.tsx:154",meta:g.meta,decision:R,onDismiss:()=>I(w=>{const j=new Set(w);return b&&j.add(b),j})})})]})}function rn({msg:t,onReply:i,onCopy:a,onKeepInMemory:n,onReport:s,onClose:o}){const d=[{label:"Reply",icon:"↩",act:i},...t.kind==="text"?[{label:"Copy",icon:"⎘",act:a}]:[],{label:"Save to Memory",icon:"❖",soul:!0,act:n},...s?[{label:"Report",icon:"⚑",danger:!0,act:s}]:[]];return Ci.createPortal(e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyActionSheet.tsx:34",onClick:o,style:{position:"fixed",inset:0,zIndex:99999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(5,4,10,0.55)",backdropFilter:"blur(3px)"},children:e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyActionSheet.tsx:38",onClick:c=>c.stopPropagation(),style:{width:240,borderRadius:18,padding:8,background:"rgba(18,12,32,0.97)",border:`1px solid ${r.line}`,boxShadow:"0 12px 40px rgba(0,0,0,0.5)",animation:"lmSoftPop 180ms ease-out"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyActionSheet.tsx:42",style:{padding:"6px 12px 8px",fontSize:10,color:r.text40,borderBottom:`1px solid ${r.lineSoft}`,marginBottom:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.kind==="voice"?"Voice note":t.kind==="image"?"Photo":t.content.slice(0,60)}),d.map(c=>e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyActionSheet.tsx:46",role:"button",tabIndex:0,onClick:c.act,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&c.act()},style:{display:"flex",alignItems:"center",gap:12,padding:"9px 12px",borderRadius:12,cursor:"pointer",fontSize:13,fontWeight:500,color:c.danger?r.roseSoft:c.soul?r.soul:r.text},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyActionSheet.tsx:64",style:{width:16,textAlign:"center",opacity:.85},children:c.icon}),c.label]},c.label))]})}),document.body)}function nn({placeholder:t,rosterNames:i,replyTo:a,onCancelReply:n,onSend:s}){const[o,d]=l.useState(""),[c,u]=l.useState(!1),f=l.useRef(null),x=o.trim().length>0,h=l.useMemo(()=>{const b=/(?:^|\s)@([^\s@]*)$/.exec(o);return b?b[1]:null},[o]),p=l.useMemo(()=>{if(h===null)return[];const b=h.toLowerCase();return i.filter(z=>z&&z!=="You"&&z.toLowerCase().startsWith(b)).slice(0,5)},[h,i]),I=b=>{d(z=>{const w=/(?:^|\s)@([^\s@]*)$/.exec(z);if(!w)return z;const j=w.index+(w[0].startsWith("@")?0:1);return`${z.slice(0,j)}@${b} `}),f.current?.focus()},P=()=>{const b=o.trim();b&&(s(b),d(""),n(),f.current&&(f.current.style.height="20px"))},g=b=>{d(b.target.value);const z=b.target;z.style.height="20px",z.style.height=Math.min(z.scrollHeight,120)+"px"};l.useEffect(()=>{a&&f.current?.focus()},[a]);const R=c?{border:"1px solid rgba(142,99,255,0.6)",boxShadow:"0 0 12px rgba(142,99,255,0.25), inset 0 0 8px rgba(142,99,255,0.06)"}:{border:`1px solid ${r.line}`,boxShadow:"none"};return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:86",style:{padding:"8px 16px 6px",flexShrink:0},children:[p.length>0&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:89",style:{display:"flex",gap:6,marginBottom:6,flexWrap:"wrap"},children:p.map(b=>e.jsxs("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:91",type:"button",onClick:()=>I(b),style:{height:24,padding:"0 11px",borderRadius:12,border:"1px solid rgba(142,99,255,0.35)",background:"rgba(142,99,255,0.1)",color:r.violetSoft,fontFamily:r.font,fontSize:10.5,fontWeight:600,cursor:"pointer"},children:["@",b]},b))}),a&&e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:116",style:{display:"flex",alignItems:"center",gap:8,padding:"7px 12px",marginBottom:6,borderRadius:12,background:"rgba(142,99,255,0.08)",borderLeft:`2px solid ${r.violetMist}`},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:117",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:118",style:{fontSize:11,fontWeight:600,color:r.violet,marginBottom:2},children:a.author}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:119",style:{fontSize:12,color:"rgba(245,242,252,0.6)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.snippet})]}),e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:121",type:"button","aria-label":"Cancel reply",onClick:n,style:{background:"none",border:"none",cursor:"pointer",padding:4},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:122",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:122",d:"M2 2l8 8M10 2l-8 8",stroke:"rgba(245,242,252,0.5)",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:127",style:{display:"flex",alignItems:"flex-end",gap:8,padding:"7px 9px",borderRadius:25,background:"rgba(245,242,252,0.035)",transition:"border 0.3s ease, box-shadow 0.3s ease",minHeight:48,...R},children:[e.jsx("textarea",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:128",ref:f,value:o,onChange:g,onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),P())},placeholder:a?`Reply to ${a.author}…`:t,rows:1,style:{flex:1,fontSize:14,color:r.text,background:"transparent",border:"none",outline:"none",fontFamily:r.font,resize:"none",height:20,maxHeight:120,lineHeight:"20px",overflowY:"auto",padding:0,margin:0,marginLeft:8}}),e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:139",onClick:P,"aria-label":"Send",style:{width:34,he
29ight:34,borderRadius:"50%",border:"none",cursor:x?"pointer":"default",background:x?`linear-gradient(130deg, ${r.violet}, ${r.pink})`:"transparent",boxShadow:x?"0 0 12px rgba(142,99,255,0.5)":"none",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 0.2s ease"},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:140",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/society/TalkieSocietyComposer.tsx:140",d:"M1.5 7h11M8 2.5L12.5 7L8 11.5",stroke:x?"#FFFFFF":"rgba(245,242,252,0.35)",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})}const sn=8e3;function At(t){const i={height:14,padding:"0 6px",borderRadius:7,display:"inline-flex",alignItems:"center",fontSize:7.5,fontWeight:700,letterSpacing:"0.14em",textTransform:"uppercase",flexShrink:0};return t==="Presence"?{...i,color:r.violetSoft,background:"rgba(142,99,255,0.14)",border:"1px solid rgba(142,99,255,0.4)"}:t==="Human"?{...i,color:r.soul,background:"rgba(184,233,255,0.08)",border:"1px solid rgba(184,233,255,0.3)"}:{...i,color:r.text40,background:"rgba(245,242,252,0.05)",border:"1px solid rgba(245,242,252,0.14)"}}function Et({engine:t,societyId:i,onBack:a,onOpenTab:n,voicePrefsStore:s,visionPrefsStore:o}){const d=Number(i),c=ui(i),u=re.useUtils(),{user:f}=Xe(),[x,h]=l.useState(null),[p,I]=l.useState(null),[P,g]=l.useState(null),[R,b]=l.useState(null),z=l.useRef(void 0);z.current=R?.numericId;const w=l.useRef(null);l.useEffect(()=>{t.getSociety(i).then(h).catch(()=>{}),t.getStoryMode(i).then(I).catch(()=>{})},[t,i]);const j=re.society.getMessages.useQuery({societyId:d,limit:100},{enabled:Number.isFinite(d),refetchInterval:sn,refetchOnWindowFocus:!1}),S=re.society.get.useQuery({societyId:d},{enabled:Number.isFinite(d),staleTime:3e4}),A=l.useCallback(()=>{j.refetch().catch(()=>{})},[j]),m=l.useMemo(()=>(j.data??[]).reduce((D,N)=>Math.max(D,N.id),0),[j.data]);l.useEffect(()=>{Number.isFinite(d)&&m>0&&u.client.society.markRead.mutate({societyId:d,upToMessageId:m}).catch(()=>{})},[u.client,d,m]);const k=S.data?.participants??[],y=l.useMemo(()=>{const D=new Map;for(const N of k)N.characterId==null&&N.userName&&D.set(N.userId,N.userName);return D},[k]),T=l.useMemo(()=>{const D=j.data??[],N=_r(D,f?.id),Z=Br(k,y);return Ur({bubbles:N.bubbles,events:[...N.events,...Z]})},[j.data,f?.id,k,y]),_=l.useMemo(()=>T.flatMap(D=>D.type==="bubble"?[D.bubble]:[]),[T]),K=l.useMemo(()=>k.map(D=>D.characterId!=null?{id:`c${D.characterId}`,kind:"presence",broughtById:`u${D.userId}`,role:D.role}:{id:`u${D.userId}`,kind:"human",role:D.role}),[k]),V=l.useMemo(()=>zr(K,{maxParticipants:x?.maxParticipants}),[K,x?.maxParticipants]),M=l.useMemo(()=>k.map(D=>D.characterId!=null?D.characterName??"Presence":D.userName??"Member"),[k]),v=l.useMemo(()=>k.find(N=>N.characterId==null&&N.userId===f?.id)?.userName??null,[k,f?.id]);l.useEffect(()=>{w.current?.scrollTo({top:w.current.scrollHeight})},[T.length]);const E=D=>{const N=R;if(b(null),N){u.client.society.sendMessage.mutate({societyId:d,content:D,contentType:"text",replyToId:N.numericId}).then(A).catch(()=>ie.error("That message could not be sent. Try again."));return}t.sendMessage(c,{kind:"text",content:D}).then(A).catch(()=>ie.error("That message could not be sent. Try again."))},L=l.useCallback(async D=>{try{await t.saveToMemory(c,D.id),ie.success(W.memoryKept)}catch{ie.error(W.memoryKeepFailed)}},[t,c]),U=l.useCallback(async D=>{try{await u.client.safety.report.mutate({targetType:"message",targetId:`society-${d}-${D.id}`,category:"other",details:D.content.slice(0,500)}),ie.success(W.reportSent)}catch{ie.error(W.reportFailed)}},[u.client,d]);if(!x)return e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:241",style:{flex:1,background:r.bg}});const Q=D=>({id:D.id,threadId:c,author:D.mine?"me":"them",kind:D.kind,content:D.content,ts:D.ts,...D.mine&&D.status?{status:D.status}:{},...D.audioUrl?{audioUrl:D.audioUrl}:{},...D.durationSec!=null?{durationSec:D.durationSec}:{},...D.imageUrl?{imageUrl:D.imageUrl}:{}});return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:259",style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",background:`radial-gradient(600px 400px at 50% -10%, rgba(51,185,255,0.13), transparent 60%), ${r.bg}`},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:261",style:{display:"flex",alignItems:"center",gap:10,padding:"12px 16px 0",flexShrink:0},children:[e.jsx("svg",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:262",onClick:a,role:"button","aria-label":"Back",style:{cursor:"pointer",flexShrink:0},width:"9",height:"15",viewBox:"0 0 10 17",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:262",d:"M8.5 1.5L2 8.5L8.5 15.5",stroke:"rgba(245,242,252,0.75)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:263",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:264",style:{fontSize:15,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:265",style:{fontSize:9.5,color:"rgba(245,242,252,0.55)",marginTop:1},children:[p?.active?"Story Mode · ":"",x.members.replace(/ · \d+ Total$/,"")]})]}),p?.active&&e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:270",onClick:()=>n("story"),role:"button",style:{height:22,padding:"0 12px",borderRadius:11,display:"flex",alignItems:"center",gap:5,background:"rgba(51,185,255,0.12)",border:"1px solid rgba(51,185,255,0.35)",cursor:"pointer",flexShrink:0},children:[e.jsx(Li,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:271"}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:271",style:{fontSize:10,fontWeight:600,color:r.violetSoft},children:"Story Mode"})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:274",onClick:()=>n("invite"),role:"button","aria-label":"Invite",style:{width:30,height:30,borderRadius:"50%",background:"rgba(245,242,252,0.05)",border:`1px solid ${r.line}
29`,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:275",width:"11",height:"11",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:275",d:"M8 2v12M2 8h12",stroke:"rgba(245,242,252,0.7)",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:280",onClick:()=>n("members"),role:"button","aria-label":W.rosterStripLabel,style:{display:"flex",alignItems:"center",gap:8,margin:"8px 16px 0",padding:"6px 10px",borderRadius:14,background:"rgba(245,242,252,0.03)",border:`1px solid ${r.lineSoft}`,cursor:"pointer",flexShrink:0,overflowX:"auto"},children:[K.slice(0,9).map(D=>{const N=k.find(ce=>D.kind==="presence"?ce.characterId===Number(D.id.slice(1)):ce.characterId==null&&ce.userId===Number(D.id.slice(1))),Z=D.kind==="presence"?N?.characterName??"Presence":N?.userId===f?.id?"You":N?.userName??"Member";return e.jsxs("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:292",style:{display:"inline-flex",alignItems:"center",gap:5,flexShrink:0},title:Z,children:[e.jsx(We,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:293",name:Z,fontSize:9}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:294",style:{fontSize:9,color:"rgba(245,242,252,0.6)",maxWidth:72,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Z}),D.kind==="presence"&&e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:295",style:{...At("Presence"),height:12,fontSize:6.5},children:W.badgePresence})]},D.id)}),e.jsxs("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:299",style:{marginLeft:"auto",fontSize:9,color:r.text40,flexShrink:0},children:[V.counts.total," / ",x.maxParticipants??9]})]}),!V.ok&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:306",style:{margin:"6px 16px 0",padding:"7px 12px",borderRadius:12,background:"rgba(232,180,90,0.08)",border:"1px solid rgba(232,180,90,0.3)",fontSize:9.5,color:r.warn,flexShrink:0},children:W.invariantNotice}),x.pinnedMemoryShort&&e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:313",onClick:()=>n("memory"),role:"button",style:{margin:"6px 16px 0",display:"flex",alignItems:"center",gap:7,height:24,padding:"0 12px",borderRadius:12,background:"rgba(184,233,255,0.05)",border:"1px solid rgba(184,233,255,0.18)",flexShrink:0,cursor:"pointer"},children:[e.jsx(Nt,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:314"}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:315",style:{fontSize:9,color:"rgba(184,233,255,0.8)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:x.pinnedMemoryShort})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:320",ref:w,style:{flex:1,overflowY:"auto",padding:"8px 16px 0",display:"flex",flexDirection:"column",gap:7},children:[e.jsx(Di,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:321",label:"Today"}),T.map(D=>{if(D.type==="event")return e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:325",style:{alignSelf:"center",fontSize:9.5,color:"rgba(245,242,252,0.45)",padding:"3px 12px",borderRadius:10,background:"rgba(245,242,252,0.03)"},children:D.event.text},`e-${D.event.id}`);const N=D.bubble,Z=Hr(N,_),ce=!N.mine&&Kr(N.content,v?[v]:[]).length>0;return N.mine?e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:335",style:{alignSelf:"flex-end",display:"flex",flexDirection:"column",alignItems:"flex-end",maxWidth:"84%"},children:[Z&&e.jsx(Pt,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:336",author:Z.authorName,snippet:Z.snippet,mine:!0}),e.jsx(ut,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:337",msg:Q(N),luman:!1,variant:"society",onLongPress:()=>g(N)})]},N.id):e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:342",style:{display:"flex",gap:8,alignItems:"flex-end",maxWidth:"84%"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:343",style:{position:"relative",width:22,height:22,flexShrink:0,marginBottom:2},children:e.jsx(We,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:344",name:N.authorName??x.name,fontSize:9})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:346",style:{display:"flex",flexDirection:"column",minWidth:0},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:348",style:{display:"flex",alignItems:"center",gap:6,margin:"0 0 2px 4px"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:349",style:{fontSize:10,fontWeight:600,color:"rgba(245,242,252,0.75)"},children:N.authorName}),N.badge&&e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:351",
29style:At(N.badge.label),"aria-label":W.badgeAriaLabel(N.badge.label),children:N.badge.label==="Presence"?W.badgePresence:N.badge.label==="Human"?W.badgeHuman:W.badgeMember}),ce&&e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:356",style:{fontSize:8,color:r.pinkSoft,fontWeight:600},children:"@ you"})]}),Z&&e.jsx(Pt,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:359",author:Z.authorName,snippet:Z.snippet}),e.jsx(ut,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:360",msg:Q(N),luman:!0,variant:"society",onLongPress:()=>g(N)})]})]},N.id)})]}),e.jsx(nn,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:368",placeholder:W.composerPlaceholder(x.name),rosterNames:M,replyTo:R?{author:R.mine?"You":R.authorName??"Member",snippet:R.kind==="voice"?"Voice note":R.kind==="image"?"Photo":R.content}:null,onCancelReply:()=>b(null),onSend:E}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:377",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"0 20px 8px",flexShrink:0},children:[e.jsxs("svg",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:378",width:"7",height:"9",viewBox:"0 0 10 12",fill:"none",children:[e.jsx("rect",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:378",x:"1",y:"5",width:"8",height:"6",rx:"1.5",fill:r.sapphireMid}),e.jsx("path",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:378",d:"M3 5V3.5C3 2.4 3.9 1.5 5 1.5C6.1 1.5 7 2.4 7 3.5V5",stroke:r.sapphireMid,strokeWidth:"1.4",fill:"none"})]}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:379",style:{fontSize:8,color:r.sapphireSoft},children:W.privacyLine})]}),e.jsx(en,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:383",engine:t,societyId:d,voicePrefsStore:s,replyToIdRef:z,onSent:A}),e.jsx(an,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:390",societyId:d,visionPrefsStore:o,replyToIdRef:z,onSent:A}),P&&e.jsx(rn,{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:399",msg:P,onReply:()=>{b(P),g(null)},onCopy:()=>{navigator.clipboard?.writeText(P.content).catch(()=>{}),g(null)},onKeepInMemory:()=>{L(P),g(null)},onReport:P.mine?void 0:()=>{U(P),g(null)},onClose:()=>g(null)})]})}function Pt({author:t,snippet:i,mine:a}){return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:417",style:{margin:a?"0 4px 2px 0":"0 0 2px 4px",padding:"4px 9px",borderRadius:9,background:"rgba(142,99,255,0.08)",borderLeft:`2px solid ${r.violetMist}`,maxWidth:260,alignSelf:a?"flex-end":"flex-start"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:426",style:{fontSize:8.5,fontWeight:700,color:r.violetSoft},children:t}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyChatScreen.tsx:427",style:{fontSize:9.5,color:"rgba(245,242,252,0.6)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i})]})}function ln({engine:t,societyId:i,onBack:a,onInvite:n,onChanged:s}){const o=Number(i),d=re.useUtils(),{user:c}=Xe(),[u,f]=l.useState(null),[x,h]=l.useState(null),[p,I]=l.useState(!1),P=re.society.get.useQuery({societyId:o},{enabled:Number.isFinite(o),staleTime:15e3});l.useEffect(()=>{t.getSociety(i).then(f).catch(()=>{})},[t,i,P.data]);const g=P.data?.participants??[],R=g.find(V=>V.characterId==null&&V.userId===c?.id),b=R?.role??"member",z=b==="founder"||b==="elder",w=l.useMemo(()=>g.map(V=>V.characterId!=null?{id:`c${V.characterId}`,kind:"presence",broughtById:`u${V.userId}`,role:V.role}:{id:`u${V.userId}`,kind:"human",role:V.role}),[g]),j=g.filter(V=>V.characterId==null),S=g.filter(V=>V.characterId!=null),A=u?.maxParticipants??Me,m=di(w,{maxParticipants:A}),k=R?Vr(w,`u${R.userId}`,{maxParticipants:A}):null;if(!u)return e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:82",style:{flex:1,background:r.bg}});const y=V=>V==="founder"?W.roleOwner:V==="elder"?W.roleElder:W.roleMember,T=async V=>{I(!0);try{await d.client.society.removeParticipant.mutate({societyId:o,userId:V.userId}),ie.success(W.removed(V.name)),h(null),P.refetch().catch(()=>{}),s?.()}catch{ie.error(W.removeFailed)}finally{I(!1)}},_=async()=>{I(!0);try{await d.client.society.leave.mutate({societyId:o}),s?.(),a()}catch{ie.error(W.leaveFailed)}finally{I(!1)}},K=async(V,M)=>{try{await d.client.safety.report.mutate({targetType:"user",targetId:String(V),category:"other",details:`Society ${u.name} (${i}) member ${M}`}),ie.success(W.reportSent)}catch{ie.error(W.reportFailed)}};return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:130",style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",background:`radial-gradient(600px 400px at 50% -10%, rgba(51,185,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(Ze,{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:131",title:W.rosterTitle,sub:W.rosterSub,onBack:a}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:134",style:{margin:"10px 20px 0",flexShrink:0},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:135",style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:5},children:[e.jsxs("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:136",style:{fontSize:11,fontWeight:600},children:[w.length," / ",A," Participants"]}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:137",style:{fontSize:9,color:r.text40},children:W.seatLawLine})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:139",style:{display:"flex",gap:3},children:Array.from({length:A},(V,M)=>e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:141",style:{flex:1,height:5,borderRadius:3,background:M<w.length?`linear-gradient(90deg,${r.violet},${r.violetDeep})`:"rgba(245,242,252,0.06)",boxShadow:M<w.length?"0 0 6px rgba(51,185,255,0.4)":"none"}},M))})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:147",style:{margin:"10px 20px 0",display:"flex",gap:8,flexShrink:0},children:[e.jsxs("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:148",type:"button",onClick:n,style:{flex:1,height:34,borderRadius:17,border:"1px solid rgba(142,99,255,0.4)",background:"rgba(142,99,255,0.12)",color:r.violetSoft,fontFamily:r.font,fontSize:11.5,fontWeight:600,cursor:"pointer"},children:[W.inviteEntry," · ",W.seatsOpen(m)]}),e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:155",type:"button",onClick:()=>void _(),disabled:p,style:{height:34,padding:"0 14px",borderRadius:17,border:"1px solid rgba(224,106,133,0.35)",background:"transparent",color:r.roseSoft,fontFamily:r.font,fontSize:11.5,fontWeight:600,cursor:"pointer"},children:W.leaveSociety})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:165",style:{flex:1,overflowY:"auto",padding:"10px 14px 12px",display:"flex",flexDirection:"column",gap:5},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:166",style:{fontSize:9,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40,padding:"2px 6px"},children:"Humans"}),j.map(V=>{const M=V.userId===c?.id,v=M?"You":V.userName??"Member",E=S.filter(U=>U.userId===V.userId).map(U=>U.characterName??"Presence"),L=V.role==="founder";return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:173",style:{display:"flex",alignItems:"center",gap:11,padding:"10px 12px",borderRadius:14,background:"rgba(245,242,252,0.03)",border:`1px solid ${r.lineSoft}`},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:176",style:{position:"relative",width:32,height:32,flexShrink:0},children:e.jsx(We,{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:177",name:v,fontSize:11})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:179",style:{flex:1,minWidth:0},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:180",style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:181",style:{fontSize:12.5,fontWeight:600},children:v}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:182",style:{height:14,padding:"0 6px",borderRadius:7,display:"inline-flex",alignItems:"center",fontSize:7.5,fontWeight:700,letterSpacing:"0.14em",textTransform:"uppercase",color:r.soul,background:"rgba(184,233,255,0.08)",border:"1px solid rgba(184,233,255,0.3)"},children:"Human"}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:183",style:{fontSize:8.5,color:V.role==="founder"?r.violetSoft:r.text40,fontWeight:600},children:y(V.role)})]}),E.length>0&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:186",style:{fontSize:9,color:r.text40,marginTop:2},children:W.brought(E)}),M&&k&&!k.allowed&&k.reason==="presence_cap_per_human"&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:189",style:{fontSize:9,color:r.text40,marginTop:2},children:W.addPresenceFull})]}),!M&&e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:193",style:{display:"flex",gap:6,flexShrink:0},children:[z&&!L&&e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:195",type:"button",onClick:()=>h({userId:V.userId,name:v}),style:{height:26,padding:"0 10px",borderRadius:13,border:"1px solid rgba(224,106,133,0.35)",background:"transparent",color:r.roseSoft,fontFamily:r.font,fontSize:9.5,fontWeight:600,cursor:"pointer"},children:W.removeMember}),e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:203",type:"button",onClick:()=>void K(V.userId,v),style:{height:26,padding:"0 10px",borderRadius:13,border:`1px solid ${r.line}`,background:"transparent",color:r.text40,fontFamily:r.font,fontSize:9.5,fontWeight:600,cursor:"pointer"},children:W.report})]})]},`u${V.userId}`)}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:216",style:{fontSize:9,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40,padding:"8px 6px 2px"},children:"Presences"}),S.map(V=>{const M=j.find(E=>E.userId===V.userId),v=M?M.userId===c?.id?"You":M.userName??"Member":null;return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:221",style:{display:"flex",alignItems:"center",gap:11,padding:"10px 12px",borderRadius:14,background:"rgba(142,99,255,0.05)",border:"1px solid rgba(142,99,255,0.16)"},children:[e.jsx(We,{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:222",name:V.characterName??"Presence",fontSize:9}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:223",style:{flex:1,minWidth:0},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:224",style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:225",style:{fontSize:12.5,fontWeight:600},children:V.characterName??"Presence"}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:226",style:{height:14,padding:"0 6px",borderRadius:7,display:"inline-flex",alignItems:"center",fontSize:7.5,fontWeight:700,letterSpacing:"0.14em",textTransform:"uppercase",color:r.violetSoft,background:"rgba(142,99,255,0.14)",border:"1px solid rgba(142,99,255,0.4)"},children:"Presence"})]}),v&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:229",style:{fontSize:9,color:r.text40,marginTop:2},children:W.broughtBy(v)})]})]},`c${V.characterId}`)}),S.length===0&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:236",style:{fontSize:10,
29color:r.text40,padding:"6px 6px"},children:"No Presences here yet."})]}),x&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:242",style:{position:"absolute",inset:0,zIndex:60,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(5,4,10,0.6)",backdropFilter:"blur(4px)"},children:e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:243",style:{width:"min(300px, 86%)",borderRadius:18,padding:"16px",background:"rgba(18,12,32,0.98)",border:`1px solid ${r.line}`,display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:244",style:{fontSize:14,fontWeight:600},children:W.removeConfirmTitle(x.name)}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:245",style:{fontSize:11,color:r.text66,lineHeight:1.5},children:W.removeConfirmBody}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:246",style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:247",type:"button",onClick:()=>h(null),disabled:p,style:{height:32,padding:"0 14px",borderRadius:16,border:`1px solid ${r.line}`,background:"transparent",color:r.text,fontFamily:r.font,fontSize:11,fontWeight:600,cursor:"pointer"},children:"Cancel"}),e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyRosterScreen.tsx:248",type:"button",onClick:()=>void T(x),disabled:p,style:{height:32,padding:"0 14px",borderRadius:16,border:"1px solid rgba(224,106,133,0.5)",background:"rgba(224,106,133,0.14)",color:r.roseSoft,fontFamily:r.font,fontSize:11,fontWeight:700,cursor:"pointer"},children:W.removeMember})]})]})})]})}const on=1440*60;function cn(t){if(t==null)return null;const i=t instanceof Date?t.getTime():Date.parse(t);return Number.isFinite(i)?i:null}function hi(t,i){const a=cn(t.expiresAt),n=t.maxUses!=null&&t.maxUses>1,s=n?"limited-seat-qr":t.singleUse?"single-use-qr":a==null?"permanent-qr":"temporary-qr",o=t.remaining!=null?Math.max(0,t.remaining):t.maxUses!=null?Math.max(0,t.maxUses-(t.useCount??0)):null;let d="active";return t.revokedAt!=null?d="revoked":a!=null&&a<=i?d="expired":(t.faded||t.consumedAt!=null||n&&o!==null&&o<=0||t.singleUse&&(t.useCount??0)>0)&&(d="spent"),{kind:s,status:d,remainingSeats:o,expiresAtMs:a}}function dn(t,i){return t.type==="G"&&t.targetId===i}const un={"temporary-qr":"Temporary QR","permanent-qr":"Permanent QR","single-use-qr":"Single-use QR","limited-seat-qr":"Limited-seat QR"},fn={active:"Active",expired:"Expired",spent:"Spent",revoked:"Revoked"};function Lt(t,i){const a=t-i;if(a<=0)return"Expired";const n=Math.round(a/6e4);if(n<1)return"Expires in under a minute";if(n<60)return`Expires in ${n} min`;const s=Math.round(n/60);return s<48?`Expires in ${s} h`:`Expires in ${Math.round(s/24)} d`}function pn(t,i){const a=hi(t,i),n=un[a.kind];let s="";return a.status==="active"?a.kind==="limited-seat-qr"&&a.remainingSeats!=null?(s=`${a.remainingSeats} seat${a.remainingSeats===1?"":"s"} left`,a.expiresAtMs!=null&&(s+=` · ${Lt(a.expiresAtMs,i).toLowerCase()}`)):a.expiresAtMs!=null?s=Lt(a.expiresAtMs,i):s="Never expires":a.status==="spent"?s=a.kind==="limited-seat-qr"?"All seats joined":"Used":a.status==="expired"?s="This code has faded":s="Withdrawn by you",{title:n,detail:s,statusLabel:fn[a.status],actionable:a.status==="active"}}function xn(t){const i=t>0,a=i?`${t} seat${t===1?"":"s"} open`:"Society is full — a seat must open first";return[{method:"user-id",title:"Invite by User ID",detail:`A private invitation you hand to one person you know — a single-use code only they receive. ${a}.`,available:i},{method:"temporary-qr",title:"Temporary QR",detail:"A live code that fades after 24 hours.",available:i},{method:"permanent-qr",title:"Permanent QR",detail:"The Society's standing sigil — it never fades while the Society lives.",available:i}
29,{method:"single-use-qr",title:"Single-use QR",detail:"One scan, one arrival — then the code burns.",available:i},{method:"limited-seat-qr",title:"Limited-seat QR",detail:`A live ring that stays glowing until its seats join. ${a}.`,available:i}]}const Dt={borderRadius:16,padding:"11px 14px",background:r.card,border:`1px solid ${r.line}`,display:"flex",flexDirection:"column",gap:7};function kn({engine:t,societyId:i,onBack:a}){const n=Number(i),s=re.society.get.useQuery({societyId:n},{enabled:Number.isFinite(n),staleTime:15e3}),[o,d]=l.useState(null);l.useEffect(()=>{t.listSocieties().then(y=>{d(y.find(T=>T.id===i)??null)}).catch(()=>{})},[t,i]);const c=l.useMemo(()=>(s.data?.participants??[]).map(y=>y.characterId!=null?{id:`c${y.characterId}`,kind:"presence",broughtById:`u${y.userId}`,role:y.role}:{id:`u${y.userId}`,kind:"human",role:y.role}),[s.data]),u=s.data?.society?.maxParticipants??void 0,f=o?.permanentId,x=di(c,{maxParticipants:u}),h=l.useMemo(()=>xn(x),[x]),[p,I]=l.useState(null),[P,g]=l.useState(null),[R,b]=l.useState(0),[z,w]=l.useState(null),[j]=l.useState(()=>Date.now());l.useEffect(()=>{t.listMyInvites().then(w).catch(()=>w([]))},[t,R]);const S=l.useMemo(()=>(z??[]).filter(y=>dn(y,n)),[z,n]),A=async y=>{if(!p){I(y);try{const T={type:"G",targetId:n},_=y==="temporary-qr"?{...T,ttlSeconds:on,singleUse:!1}:y==="single-use-qr"?{...T,singleUse:!0}:y==="limited-seat-qr"?{...T,ttlSeconds:10080*60,singleUse:!1,maxUses:Math.max(1,x)}:{...T,singleUse:!0},K=await t.createInvite(_);g({method:y,code:K.code}),b(V=>V+1)}catch(T){ie.error(T instanceof Error?T.message:"That invitation could not be created. Try again.")}finally{I(null)}}},m=async y=>{try{await t.revokeInvite(y),ie.success(W.revoked),b(T=>T+1)}catch{ie.error(W.revokeFailed)}},k=async y=>{try{await navigator.clipboard.writeText(y),ie.success("Copied.")}catch{ie.error("Could not copy.")}};return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:145",style:{display:"flex",flexDirection:"column",height:"100%",background:`radial-gradient(600px 400px at 50% -10%, rgba(76,125,255,0.08), transparent 60%), ${r.bg}`},children:[e.jsx(Ze,{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:146",title:W.inviteHubTitle,sub:W.inviteHubSub,onBack:a}),e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:148",style:{flex:1,overflowY:"auto",padding:"10px 16px 12px",display:"flex",flexDirection:"column",gap:9},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:150",style:{fontSize:9.5,color:x>0?r.text40:r.warn,textAlign:"center"},children:x>0?W.seatsOpen(x):W.societyFull}),h.map(y=>e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:156",style:{...Dt,opacity:y.available?1:.55},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:157",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:158",style:{fontSize:12,fontWeight:600},children:y.title}),y.method==="permanent-qr"?e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:160",type:"button",onClick:()=>f&&void k(f),disabled:!f,style:{height:26,padding:"0 12px",borderRadius:13,border:"1px solid rgba(142,99,255,0.4)",background:"rgba(142,99,255,0.12)",color:r.violetSoft,fontFamily:r.font,fontSize:10,fontWeight:600,cursor:"pointer"},children:"Copy sigil"}):e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:169",type:"button",onClick:()=>void A(y.method),disabled:!y.available||p!==null,style:{height:26,padding:"0 12px",borderRadius:13,border:"1px solid rgba(142,99,255,0.4)",background:"rgba(142,99,255,0.12)",color:r.violetSoft,fontFamily:r.font,fontSize:10,fontWeight:600,cursor:y.available?"pointer":"default"},children:p===y.method?"Creating…":"Create code"})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:179",style:{fontSize:9.5,color:"rgba(245,242,252,0.55)",lineHeight:1.45},children:y.detail}),y.method==="permanent-qr"&&f&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:182",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:11,color:r.text66,wordBreak:"break-all"},children:f}),P?.method===y.method&&e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:186",style:{display:"flex",alignItems:"center",gap:8,padding:"7px 10px",borderRadius:11,background:"rgba(87,217,163,0.07)",border:"1px solid rgba(87,217,163,0.3)"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:187",style:{flex:1,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:11,color:r.okSoft,wordBreak:"break-all"},children:P.code}),e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:188",type:"button",onClick:()=>void k(P.code),style:{height:24,padding:"0 10px",borderRadius:12,border:"1px solid rgba(87,217,163,0.4)",background:"transparent",color:r.okSoft,fontFamily:r.font,fontSize:9.5,fontWeight:700,cursor:"pointer"},children:"Copy"})]})]},y.method)),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:195",style:{fontSize:9,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40,padding:"6px 4px 0"},children:W.activeInvitesTitle}),S.length===0&&e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:199",style:{fontSize:10,
29color:r.text40,padding:"2px 4px"},children:W.noActiveInvites}),S.map(y=>{const T=pn(y,j),_=hi(y,j);return e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:205",style:{...Dt,flexDirection:"row",alignItems:"center",gap:10,opacity:T.actionable?1:.55},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:206",style:{flex:1,minWidth:0},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:207",style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:208",style:{fontSize:11.5,fontWeight:600},children:T.title}),e.jsx("span",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:209",style:{fontSize:8.5,fontWeight:700,letterSpacing:"0.12em",textTransform:"uppercase",color:_.status==="active"?r.okSoft:r.text40},children:T.statusLabel})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:211",style:{fontSize:9.5,color:"rgba(245,242,252,0.55)",marginTop:2},children:T.detail}),e.jsx("div",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:212",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:9.5,color:r.text40,marginTop:3,wordBreak:"break-all"},children:y.code})]}),T.actionable&&e.jsx("button",{"data-loc":"client/src/features/talkie/society/TalkieSocietyInviteHub.tsx:215",type:"button",onClick:()=>void m(y.id),style:{height:26,padding:"0 11px",borderRadius:13,border:"1px solid rgba(224,106,133,0.35)",background:"transparent",color:r.roseSoft,fontFamily:r.font,fontSize:9.5,fontWeight:600,cursor:"pointer",flexShrink:0},children:W.revoke})]},y.id)})]})]})}const gi={event:"Important event",fact:"Fact",culture_trait:"Culture",milestone:"Milestone",conflict:"Conflict",resolution:"Resolution",inside_joke:"Inside joke",shared_story:"Shared story"};function hn(t){const i=[];t.extractedBy==="participant_pin"&&t.extractedFrom!=null?i.push("A member kept this from the conversation."):t.extractedBy&&i.push("It was gathered from this Society's life."),i.push(`Its kind: ${gi[t.type]??t.type.replace(/_/g," ")}.`),typeof t.importanceScore=="number"&&t.importanceScore>=.7&&i.push("It is held as important inside this Society."),t.emotionalTags?.length&&i.push(`Tone: ${t.emotionalTags.slice(0,3).join(", ")}.`);const a=t.createdAt instanceof Date?t.createdAt.getTime():Date.parse(t.createdAt);return Number.isFinite(a)&&i.push(`Remembered on ${new Date(a).toLocaleDateString(void 0,{month:"long",day:"numeric"})}.`),i.length?i:null}function gn({societyId:t,societyName:i,onBack:a}){const n=Number(t),[s,o]=l.useState(null),d=re.society.getSharedMemories.useQuery({societyId:n},{enabled:Number.isFinite(n),staleTime:15e3}),c=l.useMemo(()=>d.data??[],[d.data]);return e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:92",style:{display:"flex",flexDirection:"column",height:"100%",background:`radial-gradient(600px 400px at 50% -10%, rgba(51,185,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(Ze,{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:93",title:W.memoryTitle,sub:i,onBack:a}),e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:96",style:{margin:"10px 16px 0",display:"flex",alignItems:"center",gap:7,padding:"8px 12px",borderRadius:12,background:"rgba(184,233,255,0.05)",border:"1px solid rgba(184,233,255,0.18)",flexShrink:0},children:[e.jsx(Nt,{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:97"}),e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:98",style:{fontSize:9,color:"rgba(184,233,255,0.8)",lineHeight:1.45},children:be.scopeLineSociety})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:101",style:{flex:1,overflowY:"auto",padding:"10px 16px 12px",display:"flex",flexDirection:"column",gap:8},children:[d.isLoading&&e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:103",style:{fontSize:10.5,color:r.text40,padding:8},children:"Gathering this Society's memories…"}),!d.isLoading&&c.length===0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:106",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"36px 24px",textAlign:"center"},children:[e.jsx(zi,{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:107"}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:108",style:{fontSize:13,fontWeight:600},children:W.memoryEmptyTitle}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:109",style:{fontSize:10.5,color:r.text40,lineHeight:1.55,maxWidth:260},children:W.memoryEmptyBody})]}),c.map(u=>{const f=hn(u),x=s===u.id;return e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:116",style:{borderRadius:16,padding:"11px 14px",background:"linear-gradient(100deg,rgba(184,233,255,0.045),rgba(51,185,255,0.035))",border:"1px solid rgba(184,233,255,0.16)",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:117",style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:118",style:{height:18,padding:"0 8px",borderRadius:9,display:"inline-flex",alignItems:"center",fontSize:8,fontWeight:600,color:r.soul,background:"rgba(184,233,255,0.08)",border:"1px solid rgba(184,233,255,0.25)"},children:gi[u.type]??u.type.replace(/_/g," ")}),e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:121",style:{flex:1}}),f&&e.jsx("button",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:123",type:"button",onClick:()=>o(x?null:u.id),"aria-expanded":x,style:{height:22,padding:"0 10px",borderRadius:11,border:"1px solid rgba(184,233,255,0.3)",background:x?"rgba(184,233,255,0.12)":"transparent",color:"rgba(184,233,255,0.85)",fontFamily:r.font,fontSize:8.5,fontWeight:600,cursor:"pointer"},children:W.memoryWhyTitle})]}),u.title&&e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:133",style:{fontSize:12.5,fontWeight:600},children:u.title}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:134",style:{fontSize:11,lineHeight:1.55,color:"rgba(245,242,252,0.85)"},children:u.summary??u.content??""}),x&&f&&e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:136",style:{display:"flex",flexDirection:"column",gap:4,padding:"8px 10px",borderRadius:11,background:"rgba(184,233,255,0.05)",border:"1px solid rgba(184,233,255,0.16)"},children:f.map(h=>e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieSocietyMemoryScreen.tsx:138",style:{fontSize:9.5,color:"rgba(184,233,255,0.85)",lineHeight:1.5},children:h},h))})]},u.id)})]})]})}const te={bg:"#05070D",panel:"rgba(13,11,20,0.92)",line:"rgba(139,92,255,0.14)",violet:"#8B5CFF",text:"#F7F9FF",muted:"rgba(152,167,199,0.72)",faint:"rgba(152,167,199,0.45)"},zt={talkies:'<path d="M4 7a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v4a3 3 0 0 1-3 3H9l-3.5 3v-3.2A3 3 0 0 1 4 11V7z" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linejoin="round"/>',presences:'<circle cx="11" cy="11" r="6" stroke="currentColor" stroke-width="1.5" fill="none" stroke-dasharray="3 2.5"/><circle cx="11" cy="11" r="2" fill="currentColor"/>',people:'<circle cx="11" cy="8" r="3.5" stroke="currentColor" stroke-width="1.5" fill="none"/><path d="M4.5 18.5c0-3.5 3-5.5 6.5-5.5s6.5 2 6.5 5.5" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round"/>',societies:'<circle cx="11" cy="7" r="3" stroke="currentColor" stroke-width="1.4" fill="none"/><circle cx="6" cy="15" r="2.5" stroke="currentColor" stroke-width="1.4" fill="none"/><circle cx="16" cy="15" r="2.5" stroke="currentColor" stroke-width="1.4" fill="none"/>',requests:'<path d="M11 4a5 5 0 0 1 5 5v3l1.5 2.5h-13L6 12V9a5 5 0 0 1 5-5z" stroke="currentColor" stroke-width="1.4" fill="none" stroke-linejoin="round"/>
29<path d="M9.5 17a1.6 1.6 0 0 0 3 0" stroke="currentColor" stroke-width="1.4" fill="none"/>',vault:'<rect x="5" y="5" width="12" height="12" rx="2.5" stroke="currentColor" stroke-width="1.4" fill="none"/><path d="M8.5 9.5h5M8.5 12.5h3" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>',archived:'<rect x="4" y="6" width="14" height="4" rx="1" stroke="currentColor" stroke-width="1.4" fill="none"/><path d="M5.5 10v6a1.5 1.5 0 0 0 1.5 1.5h8a1.5 1.5 0 0 0 1.5-1.5v-6" stroke="currentColor" stroke-width="1.4" fill="none"/><path d="M9.5 13h3" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>',settings:'<circle cx="11" cy="11" r="2.6" stroke="currentColor" stroke-width="1.4" fill="none"/><path d="M11 4v2M11 16v2M4 11h2M16 11h2M6 6l1.4 1.4M14.6 14.6L16 16M16 6l-1.4 1.4M7.4 14.6L6 16" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>',me:'<circle cx="11" cy="8" r="3.5" stroke="currentColor" stroke-width="1.5" fill="none"/><path d="M4.5 18.5c0-3.5 3-5.5 6.5-5.5s6.5 2 6.5 5.5" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round"/>'};function yi({itemKey:t,size:i=18}){return e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:48",width:i,height:i,viewBox:"0 0 22 22",fill:"none",dangerouslySetInnerHTML:{__html:zt[t]??zt.talkies}})}function mi({compact:t=!1}){return e.jsxs("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:55",style:{display:"inline-flex",alignItems:"center",gap:10},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:56",style:{width:10,height:10,borderRadius:"50%",background:te.violet,boxShadow:`0 0 12px ${te.violet}`,flexShrink:0}}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:66",style:{fontSize:t?15:17,fontWeight:600,letterSpacing:t?5:7,textTransform:"uppercase",color:te.text,whiteSpace:"nowrap"},children:oe.nameCaps})]})}function yn({activeKey:t}){const[,i]=Qe();return e.jsxs("aside",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:85","aria-label":`${oe.name} sections`,style:{width:232,flexShrink:0,height:"100%",display:"flex",flexDirection:"column",background:te.panel,borderRight:`1px solid ${te.line}`},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:97",style:{padding:"18px 20px 14px",borderBottom:`1px solid ${te.line}`},children:[e.jsx(mi,{"data-loc":"client/src/features/talkie/TalkieShell.tsx:98"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:99",style:{marginTop:6,fontSize:11,color:te.muted,letterSpacing:.6},children:oe.tagline})]}),e.jsx("nav",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:101",style:{flex:1,overflowY:"auto",padding:"10px 10px"},children:Gr.map(a=>{const n=a.key===t;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:105",role:"button",tabIndex:0,onClick:()=>i(a.path),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&i(a.path)},style:{display:"flex",alignItems:"center",gap:11,padding:"9px 12px",marginBottom:2,borderRadius:12,cursor:"pointer",color:n?te.text:te.muted,background:n?"rgba(139,92,255,0.14)":"transparent",border:n?"1px solid rgba(139,92,255,0.32)":"1px solid transparent",boxShadow:n?"0 0 14px rgba(139,92,255,0.18)":"none"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:127",style:{color:n?te.violet:te.faint,display:"inline-flex"},children:e.jsx(yi,{"data-loc":"client/src/features/talkie/TalkieShell.tsx:128",itemKey:a.key})}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:130",style:{fontSize:13,fontWeight:n?600:500},children:a.label})]},a.key)})}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:135",style:{padding:"12px 20px",borderTop:`1px solid ${te.line}`,fontSize:10,color:te.faint,letterSpacing:.5},children:oe.footer})]})}function mn({activeKey:t}){const[,i]=Qe();return e.jsxs("nav",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:145","aria-label":`${oe.name} primary`,style:{flexShrink:0,background:"rgba(11,7,18,0.96)",backdropFilter:"blur(14px)",borderTop:`1px solid ${te.line}`},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:154",style:{display:"flex",alignItems:"center",justifyContent:"space-around",height:60},children:Qr.map(a=>{const n=a.key===t;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:158",role:"button",tabIndex:0,onClick:()=>i(a.path),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&i(a.path)},style:{position:"relative",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:3,flex:"1 1 0",height:"100%",cursor:"pointer",color:n?te.text:te.faint},children:[n&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:180",style:{position:"absolute",inset:"6px 10px",borderRadius:14,background:"rgba(139,92,255,0.2)",border:"1px solid rgba(139,92,255,0.35)",boxShadow:"0 0 14px rgba(139,92,255,0.3)",pointerEvents:"none"}}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:192",style:{position:"relative",zIndex:1,display:"inline-flex"},children:e.jsx(yi,{"data-loc":"client/src/features/talkie/TalkieShell.tsx:193",itemKey:a.key,size:19})}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:195",style:{position:"relative",zIndex:1,fontSize:9.5,fontWeight:n?700:500,letterSpacing:.5},children:a.label})]},a.key)})}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:202",style:{height:"env(safe-area-inset-bottom, 0px)"}})]})}function fe({title:t,sub:i,onBack:a,right:n}){return e.jsxs("header",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:215",style:{display:"flex",alignItems:"center",gap:12,padding:"0 24px",height:60,flexShrink:0,borderBottom:`1px solid ${te.line}`,background:"linear-gradient(135deg, rgba(18,14,32,0.95), rgba(12,8,22,0.98))"},children:[a&&e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:228",onClick:a,role:"button","aria-label":"Back",style:{cursor:"pointer",flexShrink:0},width:"10",height:"17",viewBox:"0 0 10 17",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:229",d:"M8.5 1.5L2 8.5L8.5 15.5",stroke:"rgba(245,242,252,0.75)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:232",style:{fontSize:15,fontWeight:600,letterSpacing:5,textTransform:"uppercase",color:te.text},children:t}),i&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:233",style:{fontSize:10,fontWeight:500,letterSpacing:2.5,textTransform:"uppercase",color:te.faint},children:i}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:234",style:{flex:1}}),n]})}function Sn({activeKey:t,children:i}){return Ri()?e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:244",style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:te.bg},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:245",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:i}),e.jsx(mn,{"data-loc":"client/src/features/talkie/TalkieShell.tsx:246",activeKey:t})]}):e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:251",style:{display:"flex",height:"100%",minHeight:0,background:te.bg},children:[e.jsx(yn,{"data-loc":"client/src/features/talkie/TalkieShell.tsx:252",activeKey:t}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieShell.tsx:253",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:i})]})}function bn({engine:t,threadId:i,onBack:a}){const n=re.useUtils(),[s,o]=l.useState(""),[d,c]=l.useState("loading"),[u,f]=l.useState(null),[x,h]=l.useState(null),[p,I]=l.useState(null),[P,g]=l.useState(null);l.useEffect(()=>{let k=!0;return t.getThread(i).then(y=>{k&&(o(y.name),c(na({threadId:i,threadKind:y.kind,participantId:y.participantId})))}).catch(()=>{k&&c(null)}),()=>{k=!1}},[t,i]);const R=d!=="loading"&&d?.kind==="thread"?d:null,b=re.memoryPrivacy.listMemories.useQuery({page:1,pageSize:50},{enabled:R!=null,staleTime:15e3}),z=l.useMemo(()=>R?sa(b.data?.items??[],R):[],[b.data,R]),w=l.useMemo(()=>la(z),[z]),j=l.useMemo(()=>z.filter(k=>u?ft(k)===u:!0).sort((k,y)=>Number(y.isPinned??!1)-Number(k.isPinned??!1)),[z,u]),S=R?oa(R):{canUnpin:!1,canDelete:!1},A=async k=>{g(k.id);try{const y=await n.client.memoryPrivacy.togglePin.mutate({memoryId:k.id,pinned:!1}
29);ie.success(Ee({ok:y.success},"unpin").title),b.refetch().catch(()=>{})}catch{const y=Ee({ok:!1},"unpin");ie.error(`${y.title} ${y.body??""}`.trim())}finally{g(null)}},m=async k=>{g(k.id);try{const y=await n.client.memoryPrivacy.deleteMemory.mutate({memoryId:k.id});ie.success(Ee({ok:y.success},"delete").title),I(null),b.refetch().catch(()=>{})}catch{const y=Ee({ok:!1},"delete");ie.error(`${y.title} ${y.body??""}`.trim())}finally{g(null)}};return d==="loading"?e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:129",style:{flex:1,background:r.bg}}):R?e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:146",style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",background:r.bg},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:147",title:"Memory",sub:s||void 0,onBack:a}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:150",style:{margin:"10px 16px 0",padding:"8px 12px",borderRadius:12,background:"rgba(184,233,255,0.05)",border:"1px solid rgba(184,233,255,0.18)",flexShrink:0},children:e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:151",style:{fontSize:9,color:"rgba(184,233,255,0.8)",lineHeight:1.45},children:be.scopeLineThread})}),w.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:156",style:{display:"flex",gap:6,padding:"10px 16px 0",flexShrink:0,flexWrap:"wrap"},children:[e.jsx(Vt,{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:157",label:"All",on:u===null,onPress:()=>f(null)}),w.map(k=>e.jsx(Vt,{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:159",label:pt[k],on:u===k,onPress:()=>f(k)},k))]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:164",style:{flex:1,overflowY:"auto",padding:"10px 16px 12px",display:"flex",flexDirection:"column",gap:8},children:[b.isLoading&&e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:165",style:{fontSize:10.5,color:r.text40,padding:8},children:"Looking into her memory…"}),!b.isLoading&&j.length===0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:167",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"36px 24px",textAlign:"center"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:168",style:{fontSize:13,fontWeight:600},children:be.emptyTitle}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:169",style:{fontSize:10.5,color:r.text40,lineHeight:1.55,maxWidth:260},children:be.emptyBody})]}),j.map(k=>{const y=ca(k),T=x===k.id;return e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:176",style:{borderRadius:16,padding:"11px 14px",background:"rgba(16,26,48,0.55)",border:`1px solid ${r.lineSoft}`,display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:177",style:{display:"flex",alignItems:"center",gap:7,flexWrap:"wrap"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:178",style:{height:18,padding:"0 8px",borderRadius:9,display:"inline-flex",alignItems:"center",fontSize:8,fontWeight:600,color:r.violetSoft,background:"rgba(142,99,255,0.1)",border:"1px solid rgba(142,99,255,0.28)"},children:pt[ft(k)]}),k.isPinned&&e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:182",style:{height:18,padding:"0 8px",borderRadius:9,display:"inline-flex",alignItems:"center",fontSize:8,fontWeight:600,color:r.soul,background:"rgba(184,233,255,0.08)",border:"1px solid rgba(184,233,255,0.25)"},children:"Kept"}),e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:186",style:{flex:1}}),y&&e.jsx("button",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:188",type:"button",onClick:()=>h(T?null:k.id),"aria-expanded":T,style:{height:22,padding:"0 10px",borderRadius:11,border:"1px solid rgba(184,233,255,0.3)",background:T?"rgba(184,233,255,0.12)":"transparent",color:"rgba(184,233,255,0.85)",fontFamily:r.font,fontSize:8.5,fontWeight:600,cursor:"pointer"},children:"Why she remembers this"})]}),(k.title||k.preview)&&e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:194",style:{fontSize:12.5,fontWeight:600},children:k.title??k.preview}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:196",style:{fontSize:11,lineHeight:1.55,color:"rgba(245,242,252,0.85)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(k.summary??k.content??"").slice(0,600)}),T&&y&&e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:200",style:{display:"flex",flexDirection:"column",gap:4,padding:"8px 10px",borderRadius:11,background:"rgba(184,233,255,0.05)",border:"1px solid rgba(184,233,255,0.16)"},children:y.reasons.map(_=>e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:202",style:{fontSize:9.5,color:"rgba(184,233,255,0.85)",lineHeight:1.5},children:_},_))}),(S.canUnpin||S.canDelete)&&e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:207",style:{display:"flex",gap:8,marginTop:2}
29,children:[S.canUnpin&&k.isPinned&&e.jsx("button",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:209",type:"button",disabled:P===k.id,onClick:()=>void A(k),style:{height:26,padding:"0 12px",borderRadius:13,border:`1px solid ${r.line}`,background:"transparent",color:r.text66,fontFamily:r.font,fontSize:9.5,fontWeight:600,cursor:"pointer"},children:"Remove from memory"}),S.canDelete&&e.jsx("button",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:214",type:"button",disabled:P===k.id,onClick:()=>I(k),style:{height:26,padding:"0 12px",borderRadius:13,border:"1px solid rgba(224,106,133,0.35)",background:"transparent",color:r.roseSoft,fontFamily:r.font,fontSize:9.5,fontWeight:600,cursor:"pointer"},children:"Delete"})]})]},k.id)})]}),p&&e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:227",style:{position:"absolute",inset:0,zIndex:60,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(5,4,10,0.6)",backdropFilter:"blur(4px)"},children:e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:228",style:{width:"min(300px, 86%)",borderRadius:18,padding:16,background:"rgba(18,12,32,0.98)",border:`1px solid ${r.line}`,display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:229",style:{fontSize:14,fontWeight:600},children:"Delete this memory?"}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:230",style:{fontSize:11,color:r.text66,lineHeight:1.5},children:"She will no longer remember this. This cannot be undone."}),e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:231",style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:232",type:"button",onClick:()=>I(null),disabled:P!==null,style:{height:32,padding:"0 14px",borderRadius:16,border:`1px solid ${r.line}`,background:"transparent",color:r.text,fontFamily:r.font,fontSize:11,fontWeight:600,cursor:"pointer"},children:"Cancel"}),e.jsx("button",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:233",type:"button",onClick:()=>void m(p),disabled:P!==null,style:{height:32,padding:"0 14px",borderRadius:16,border:"1px solid rgba(224,106,133,0.5)",background:"rgba(224,106,133,0.14)",color:r.roseSoft,fontFamily:r.font,fontSize:11,fontWeight:700,cursor:"pointer"},children:"Delete"})]})]})})]}):e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:135",style:{display:"flex",flexDirection:"column",height:"100%",background:r.bg},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:136",title:"Memory",sub:s||void 0,onBack:a}),e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:137",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:24,textAlign:"center"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:138",style:{fontSize:14,fontWeight:600},children:be.noScopeTitle}),e.jsx("div",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:139",style:{fontSize:11,color:r.text40,lineHeight:1.6,maxWidth:280},children:be.noScopeBody})]})]})}function Vt({label:t,on:i,onPress:a}){return e.jsx("button",{"data-loc":"client/src/features/talkie/memory/TalkieMemoryScreen.tsx:244",type:"button",onClick:a,style:{height:24,padding:"0 12px",borderRadius:12,border:i?"1px solid rgba(142,99,255,0.6)":`1px solid ${r.lineSoft}`,background:i?"rgba(142,99,255,0.16)":"rgba(245,242,252,0.03)",color:i?"#FFFFFF":"rgba(245,242,252,0.6)",fontFamily:r.font,fontSize:10,fontWeight:i?700:500,cursor:"pointer"},children:t})}function vn({engine:t,threadId:i,onBack:a,onOpenMemory:n}){return e.jsxs("div",{"data-loc":"client/src/features/talkie/memory/TalkieChatInfoLayer.tsx:24",style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[e.jsx(Vi,{"data-loc":"client/src/features/talkie/memory/TalkieChatInfoLayer.tsx:25",engine:t,threadId:i,onBack:a}),e.jsxs("button",{"data-loc":"client/src/features/talkie/memory/TalkieChatInfoLayer.tsx:26",type:"button",onClick:()=>n(i),"aria-label":"Open memory for this Talkie",style:{position:"absolute",right:16,bottom:20,zIndex:30,display:"inline-flex",alignItems:"center",gap:7,height:38,padding:"0 16px",borderRadius:19,background:"rgba(18,12,32,0.95)",border:`1px solid ${r.line}`,boxShadow:"0 6px 22px rgba(0,0,0,0.45), 0 0 14px rgba(142,99,255,0.25)",color:r.soul,fontFamily:r.font,fontSize:11.5,fontWeight:600,cursor:"pointer"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/memory/TalkieChatInfoLayer.tsx:51","aria-hidden":!0,style:{width:7,height:7,borderRadius:"50%",background:r.soul,boxShadow:"0 0 8px rgba(184,233,255,0.9)"}}),"Memory"]})]})}function Tn(t){return t==="society"?"societies":t==="luman"?"presences":"people"}const jn=/🎙|voice note/i;function Si(t){return t.previewKind==="voice"||jn.test(t.preview)}function bi(t,i,a){const n=Ut(i,t.threadId),s=a?.statusFor(t.threadId);return{threadId:t.threadId,kind:t.kind,section:Tn(t.kind),name:t.name,avatarUrl:t.avatarUrl,soulKey:t.soulKey,soulColor:t.soulColor,participantId:t.participantId,preview:t.preview,hasVoice:Si(t),unread:t.unread,markedUnread:n.markedUnread===!0,lastActivityTs:t.lastActivityTs,pinned:n.pinned===!0,muted:n.muted===!0,archived:n.archived===!0,delivery:s&&s.ts>=t.lastActivityTs?s.status:void 0}}function Ge(t,i){return i.lastActivityTs-t.lastActivityTs}function wn(t,i,a){const n=t.map(d=>bi(d,i,a)).filter(d=>!d.archived),s=n.filter(d=>d.pinned).sort(Ge),o=n.filter(d=>!d.pinned).sort(Ge);return[...s,...o]}function In(t,i){return t.map(a=>bi(a,i)).filter(a=>a.archived).sort(Ge)}function Cn(t,i,a=""){let n=t;i==="unread"?n=n.filter(o=>o.unread>0||o.markedUnread):i!=="all"&&(n=n.filter(o=>o.section===i));const s=a.trim().toLowerCase();return s&&(n=n.filter(o=>o.name.toLowerCase().includes(s)||o.preview.toLowerCase().includes(s))),n}
29function dt(t,i=Date.now()){if(!t||t<=0)return"";const a=new Date(t),n=new Date(i);if(a.toDateString()===n.toDateString())return a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});const o=new Date(n);return o.setDate(n.getDate()-1),a.toDateString()===o.toDateString()?"Yesterday":a.toLocaleDateString([],{month:"short",day:"numeric"})}const Rn={online:{label:"Present",color:r.ok},away:{label:"Drifting",color:r.warn},busy:{label:"Deep focus",color:r.rose},asleep:{label:"Resting",color:r.text40}},Mn=[{key:"all",label:"All"},{key:"people",label:"People"},{key:"presences",label:"Presences"},{key:"societies",label:"Societies"},{key:"unread",label:"Unread"}],Fn={presences:e.jsx($e,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:45",label:"Presence",kind:"lumorian"}),people:e.jsx($e,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:46",label:"Human",kind:"human"}),societies:e.jsx($e,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:47",label:"Society",kind:"society"})};function An({status:t}){const i=t==="read"?r.violetSoft:r.text40;return e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:53",width:"16",height:"11",viewBox:"0 0 16 11",fill:"none","aria-label":t,children:[t!=="sent"&&e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:55",d:"M1 6L3.4 8.4L8 3.5",stroke:i,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:57",d:t==="sent"?"M4 6L6.4 8.4L11 3.5":"M6 6L8.4 8.4L13 3.5",stroke:i,strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function En(){return e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:70",width:"11",height:"13",viewBox:"0 0 12 14",fill:"none",style:{flexShrink:0},children:[e.jsx("rect",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:71",x:"3.5",y:"1",width:"5",height:"8",rx:"2.5",stroke:r.pinkSoft,strokeWidth:"1.2"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:72",d:"M1.5 7a4.5 4.5 0 0 0 9 0M6 11.5V13",stroke:r.pinkSoft,strokeWidth:"1.2",strokeLinecap:"round"})]})}function Pn({m:t,presence:i}){return t.kind==="society"?e.jsx(Je,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:78",spark:!1}):t.kind==="luman"?e.jsx(Fe,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:81",letter:t.name.charAt(0),avatarUrl:t.avatarUrl,soulKey:t.soulKey,soulColor:t.soulColor,name:i?t.name:void 0,presence:i}):e.jsx(ve,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:91",letter:t.name.charAt(0),ringColor:r.warn})}function Ln({m:t,presence:i,menuOpen:a,onToggleMenu:n,onOpen:s,onAction:o}){const[d,c]=l.useState(!1),u=i?Rn[i]:void 0;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:105",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{position:"relative",display:"flex",alignItems:"center",gap:12,padding:"8.5px 10px",borderRadius:16,background:d||a?"rgba(142,99,255,0.06)":"transparent"},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:110",onClick:s,style:{position:"relative",width:56,height:56,flexShrink:0,cursor:"pointer"},children:[e.jsx(Pn,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:111",m:t,presence:i}),t.pinned&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:113",title:"Pinned",style:{position:"absolute",right:-1,bottom:-1,width:16,height:16,borderRadius:"50%",background:"rgba(20,14,34,0.95)",border:`1px solid ${r.line}`,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:114",width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:114",d:"M6.5 1L9 3.5L5.8 4.6L3 7.5L2.5 7L5.4 4.2L6.5 1z",fill:r.violetSoft})})})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:118",onClick:s,style:{flex:1,minWidth:0,cursor:"pointer"},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:119",style:{display:"flex",alignItems:"center",gap:7},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:120",style:{fontSize:14,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:r.text},children:t.name}),Fn[t.section],t.muted&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:123",title:"Muted",style:{display:"inline-flex",flexShrink:0},children:e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:124",width:"11",height:"11",viewBox:"0 0 12 12",fill:"none",children:[e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:124",d:"M2 4.5v3h2L7 10V2L4 4.5H2z",fill:r.text40}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:124",d:"M9 4l2.5 2.5M11.5 4L9 6.5",stroke:r.text40,strokeWidth:"1.1",strokeLinecap:"round"})]})})]}),u&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:129",style:{fontSize:10,
29color:u.color,marginTop:1,display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:130",style:{width:5,height:5,borderRadius:"50%",background:u.color,boxShadow:`0 0 4px ${u.color}`}}),u.label]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:134",style:{display:"flex",alignItems:"center",gap:5,marginTop:1},children:[t.hasVoice&&e.jsx(En,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:135"}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:136",style:{fontSize:12,color:r.text66,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.preview||(t.hasVoice?"Voice note":"")})]})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:141",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,flexShrink:0},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:142",style:{fontSize:10.5,color:r.text40},children:dt(t.lastActivityTs)}),e.jsxs("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:143",style:{display:"flex",alignItems:"center",gap:5},children:[t.delivery&&e.jsx(An,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:144",status:t.delivery}),t.unread>0&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:146",style:{minWidth:18,height:18,padding:"0 5px",borderRadius:9,background:t.muted?"rgba(124,130,153,0.35)":r.pink,boxShadow:t.muted?"none":"0 0 9px rgba(244,95,181,0.5)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:9.5,fontWeight:600,color:"#FFFFFF"},children:t.unread}),t.markedUnread&&t.unread===0&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:157",title:"Marked unread",style:{width:9,height:9,borderRadius:"50%",background:r.violet,boxShadow:"0 0 8px rgba(142,99,255,0.7)"}}),e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:160","aria-label":`Actions for ${t.name}`,onClick:f=>{f.stopPropagation(),n()},style:{width:22,height:22,borderRadius:"50%",border:`1px solid ${r.line}`,background:d||a?"rgba(20,14,34,0.95)":"transparent",color:r.text40,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:170",width:"12",height:"4",viewBox:"0 0 14 4",fill:"none",children:[e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:170",cx:"2",cy:"2",r:"1.5",fill:"currentColor"}),e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:170",cx:"7",cy:"2",r:"1.5",fill:"currentColor"}),e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:170",cx:"12",cy:"2",r:"1.5",fill:"currentColor"})]})})]})]}),a&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:175",style:{position:"absolute",right:8,top:"calc(50% + 18px)",zIndex:40,minWidth:168,background:"rgba(24,17,40,0.98)",border:`1px solid ${r.line}`,borderRadius:12,boxShadow:"0 10px 32px rgba(0,0,0,0.55)",backdropFilter:"blur(16px)",padding:"5px 0"},children:[[t.pinned?"Unpin":"Pin","pin"],[t.muted?"Unmute":"Mute","mute"],[t.unread>0||t.markedUnread?"Mark read":"Mark unread",t.unread>0||t.markedUnread?"markRead":"markUnread"],["Archive","archive"]].map(([f,x])=>e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:186",onClick:h=>{h.stopPropagation(),o(x)},style:{display:"block",width:"100%",textAlign:"left",padding:"9px 16px",background:"none",border:"none",cursor:"pointer",color:r.text,fontSize:12.5,fontFamily:r.font},children:f},x))})]})}function Dn({engine:t,outbox:i,prefsStore:a,onOpenThread:n,onNewChat:s,onOpenNotifications:o,onOpenSearch:d}){const[c,u]=l.useState(null),[f,x]=l.useState([]),[h,p]=l.useState("all"),[I,P]=l.useState(""),[g,R]=l.useState(null),[,b]=l.useReducer(T=>T+1,0),z=re.connect.markRead.useMutation({onSuccess:()=>void t.listConversations().then(u)});l.useEffect(()=>{t.listConversations().then(u),t.listLumans().then(x).catch(()=>{});const T=t.conversationUpdates$().subscribe(()=>void t.listConversations().then(u)),_=i.subscribe(b),K=a.subscribe(b);return()=>{T(),_(),K()}},[t,i,a]);const w=a.getPrefs(),j=l.useMemo(()=>wn(c??[],w,i),[c,w,i]),S=l.useMemo(()=>Cn(j,h,I),[j,h,I]),A=j.some(T=>T.unread>0),m=l.useMemo(()=>{const T=new Map;for(const _ of f)T.set(_.id,_.presence);return T},[f]),k=(T,_)=>{R(null),_==="pin"?a.update(T.threadId,{pinned:!T.pinned}):_==="mute"?a.update(T.threadId,{muted:!T.muted}):_==="archive"?a.update(T.threadId,{archived:!0}):_==="markUnread"?a.update(T.threadId,{markedUnread:!0}):_==="markRead"&&(a.update(T.threadId,{markedUnread:!1}),T.unread>0&&z.mutate({threadId:T.threadId}))},y=c!==null&&c.length===0;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:260",onClick:()=>g&&R(null),style:{position:"relative",display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.12), transparent 60%), ${r.bg}`},children:[e.jsxs("header",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:262",style:{display:"flex",alignItems:"center",gap:12,padding:"0 24px",height:60,flexShrink:0,borderBottom:`1px solid ${r.lineSoft}`,background:"linear-gradient(135deg, rgba(18,14,32,0.95), rgba(12,8,22,0.98))"},children:[e.jsx(mi,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:263",compact:!0}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:264",style:{fontSize:10,fontWeight:500,letterSpacing:3,textTransform:"uppercase",color:"rgba(152,167,199,0.6)"},children:oe.inboxHeading}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:265",style:{flex:1}}),e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:266",onClick:d,title:"Search Lumo Talkie",style:{width:38,height:38,borderRadius:"50%",border:"1px solid rgba(214,221,244,.2)",background:"rgba(20,12,30,.7)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:267",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:267",cx:"7",cy:"7",r:"5.2",stroke:"#F7F9FF",strokeWidth:"1.5"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:267",d:"M11 11L14.5 14.5",stroke:"#F7F9FF",strokeWidth:"1.5",strokeLinecap:"round"})]})}),e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:269",onClick:s,title:"Start a Talkie",style:{width:38,height:38,borderRadius:"50%",border:"1px solid rgba(214,221,244,.2)",background:"rgba(20,12,30,.7)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:270",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:270",d:"M8 1.5v13M1.5 8h13",stroke:"#F7F9FF",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsxs("button",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:272",onClick:o,title:"Notifications",style:{position:"relative",width:38,height:38,borderRadius:"50%",border:"1px solid rgba(214,221,244,.2)",background:"rgba(20,12,30,.7)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:[e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:273",width:"15",height:"16",viewBox:"0 0 16 17",fill:"none",children:[e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:273",d:"M8 1.5a5 5 0 0 1 5 5v3l1.5 2.5H1.5L3 9.5v-3a5 5 0 0 1 5-5z",stroke:"#F7F9FF",strokeWidth:"1.4",fill:"none"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:273",d:"M6.5 14.5a1.6 1.6 0 0 0 3 0",stroke:"#F7F9FF",strokeWidth:"1.4",fill:"none"})]}),A&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:274",style:{position:"absolute",top:7,right:8,width:6,height:6,borderRadius:"50%",background:r.pink,boxShadow:"0 0 6px rgba(244,95,181,0.8)"}})]})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:279",style:{margin:"10px 20px 0",display:"flex",alignItems:"center",gap:10,height:40,padding:"0 16px",borderRadius:20,background:"rgba(245,242,252,0.035)",border:`1px solid ${r.line}`,flexShrink:0},children:[e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:280",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:280",cx:"7",cy:"7",r:"5.2",stroke:"rgba(245,242,252,0.45)",strokeWidth:"1.4"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:280",d:"M11 11L14.5 14.5",stroke:"rgba(245,242,252,0.45)",strokeWidth:"1.4",strokeLinecap:"round"})]}),e.jsx("input",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:281",value:I,onChange:T=>P(T.target.value),placeholder:"Search Talkies…","aria-label":"Search Talkies",style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:13,color:r.text,fontFamily:r.font}}),I&&e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:289",onClick:()=>P(""),"aria-label":"Clear search",style:{background:"none",border:"none",color:r.text40,cursor:"pointer",fontSize:13},children:"✕"})]}),y?e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:294",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:18,padding:"0 48px",textAlign:"center",animation:"lmFadeIn 350ms ease-out"},children:[e.jsx(Te,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:295"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:296",style:{fontSize:20,fontWeight:600,color:r.text},children:oe.emptyTitle}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:297",style:{fontSize:13.5,color:r.text66,lineHeight:1.55},children:oe.emptyBody}),e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:298",onClick:s,style:{height:48,padding:"0 28px",borderRadius:24,border:"none",cursor:"pointer",fontFamily:r.font,fontSize:14,fontWeight:600,color:"#FFFFFF",background:`linear-gradient(120deg,${r.violet},${r.violetDeep})`,boxShadow:"0 0 22px rgba(142,99,255,0.45)"},children:"Start a Talkie"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:303",style:{marginTop:12,flexShrink:0},children:e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:304",style:{display:"flex",gap:7,padding:"0 20px",overflowX:"auto",scrollbarWidth:"none"},className:"hide-scrollbar",children:Mn.map(T=>e.jsx(Mi,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:306",label:T.label,on:h===T.key,onClick:()=>p(T.key)},T.key))})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:311",style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch",padding:"8px 12px 12px",display:"flex",flexDirection:"column"},children:[c===null&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:313",style:{padding:"28px 0",textAlign:"center",fontSize:12,color:r.text40},children:"Opening your Talkies…"}),c!==null&&S.length===0&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:316",style:{padding:"28px 24px",textAlign:"center",fontSize:12.5,color:r.text40,lineHeight:1.6},children:I?`No Talkies match “${I}
29”.`:j.length===0&&c.length>0?"All your Talkies are archived — find them under Archived.":"No Talkies in this view yet."}),S.map(T=>e.jsx(Ln,{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:325",m:T,presence:T.kind==="luman"?m.get(T.participantId):void 0,menuOpen:g===T.threadId,onToggleMenu:()=>R(_=>_===T.threadId?null:T.threadId),onOpen:()=>n(T.threadId),onAction:_=>k(T,_)},T.threadId))]}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:337",style:{position:"absolute",right:20,bottom:20,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:7},children:e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:338",onClick:s,role:"button","aria-label":"Start a Talkie",style:{width:54,height:54,borderRadius:"50%",background:`linear-gradient(130deg,${r.violet},${r.violetDeep})`,boxShadow:"0 0 26px rgba(142,99,255,0.55), 0 8px 20px rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:339",width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieInboxScreen.tsx:339",d:"M8 2v12M2 8h12",stroke:"#FFFFFF",strokeWidth:"1.8",strokeLinecap:"round"})})})})]})]})}const $t={online:{label:"Present",color:r.ok},away:{label:"Drifting",color:r.warn},busy:{label:"Deep focus",color:r.rose},asleep:{label:"Resting",color:r.text40}};function zn({engine:t,onOpenThread:i}){const[a,n]=l.useState(null),[s,o]=l.useState("");l.useEffect(()=>{t.listLumans().then(n).catch(()=>n([]))},[t]);const d=l.useMemo(()=>{const u=s.trim().toLowerCase(),f=a??[];return u?f.filter(x=>x.name.toLowerCase().includes(u)||x.role.toLowerCase().includes(u)||x.mood.toLowerCase().includes(u)):f},[a,s]),c=a!==null&&a.length===0;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:48",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.12), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:49",title:"Presences",sub:"Living companions"}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:50",style:{margin:"10px 20px 0",display:"flex",alignItems:"center",gap:10,height:40,padding:"0 16px",borderRadius:20,background:"rgba(245,242,252,0.035)",border:`1px solid ${r.line}`,flexShrink:0},children:[e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:51",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:51",cx:"7",cy:"7",r:"5.2",stroke:"rgba(245,242,252,0.45)",strokeWidth:"1.4"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:51",d:"M11 11L14.5 14.5",stroke:"rgba(245,242,252,0.45)",strokeWidth:"1.4",strokeLinecap:"round"})]}),e.jsx("input",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:52",value:s,onChange:u=>o(u.target.value),placeholder:"Search Presences by name, mood, role…","aria-label":"Search Presences",style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:13,color:r.text,fontFamily:r.font}})]}),c?e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:62",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"0 48px",textAlign:"center",animation:"lmFadeIn 350ms ease-out"},children:[e.jsx(Te,{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:63"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:64",style:{fontSize:20,fontWeight:600,color:r.text},children:"No Presences yet"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:65",style:{fontSize:13,color:r.text66,lineHeight:1.55},children:"When a Presence joins your world, she appears here — ready to open a Talkie."})]}):e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:70",style:{flex:1,overflowY:"auto",padding:"12px 12px",display:"flex",flexDirection:"column"},children:[a===null&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:71",style:{padding:"28px 0",textAlign:"center",fontSize:12,color:r.text40},children:"Gathering Presences…"}),a!==null&&d.length===0&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:73",style:{padding:"28px 24px",textAlign:"center",fontSize:12.5,color:r.text40},children:s?`No Presences match “${s}”.`:"Nothing here yet."}),d.map(u=>{const f=$t[u.presence]??$t.asleep,x=!!u.threadId;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:81",onClick:()=>u.threadId&&i(u.threadId),role:x?"button":void 0,style:{display:"flex",alignItems:"center",gap:12,padding:"8.5px 10px",borderRadius:16,cursor:x?"pointer":"default"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:87",style:{position:"relative",width:52,height:52,flexShrink:0},children:e.jsx(Fe,{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:88",letter:u.name.charAt(0),avatarUrl:u.avatarUrl,soulKey:u.soulKey,soulColor:u.soulColor??void 0,name:u.name,presence:u.presence})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:90",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:91",style:{display:"flex",alignItems:"center",gap:7},children:e.jsx("span",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:92",style:{fontSize:14,fontWeight:600,color:r.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:u.name})}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:94",style:{fontSize:10.5,color:r.text40,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}
29,children:[u.role,u.mood].filter(Boolean).join(" · ")}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:97",style:{fontSize:10,color:f.color,marginTop:2,display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:98",style:{width:5,height:5,borderRadius:"50%",background:f.color,boxShadow:`0 0 4px ${f.color}`}}),f.label]})]}),x?e.jsx("span",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:103",style:{fontSize:10.5,color:r.violetSoft,flexShrink:0},children:"Open Talkie"}):e.jsx("span",{"data-loc":"client/src/features/talkie/TalkiePresencesScreen.tsx:105",style:{fontSize:10.5,color:r.text40,flexShrink:0},children:u.awaken?"Dormant":"No Talkie yet"})]},u.id)})]})]})}function Vn({engine:t,prefsStore:i,onOpenThread:a}){const[n,s]=l.useState(null),[o,d]=l.useState(""),[,c]=l.useReducer(h=>h+1,0);l.useEffect(()=>{t.listConversations().then(s);const h=t.conversationUpdates$().subscribe(()=>void t.listConversations().then(s)),p=i.subscribe(c);return()=>{h(),p()}},[t,i]);const u=i.getPrefs(),f=l.useMemo(()=>{const h=o.trim().toLowerCase();return(n??[]).filter(p=>p.kind==="human").filter(p=>Ut(u,p.threadId).archived!==!0).filter(p=>!h||p.name.toLowerCase().includes(h)||p.preview.toLowerCase().includes(h)).sort((p,I)=>I.lastActivityTs-p.lastActivityTs)},[n,o,u]),x=n!==null&&(n??[]).every(h=>h.kind!=="human");return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:45",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:46",title:"People",sub:"Human Talkies"}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:47",style:{margin:"10px 20px 0",display:"flex",alignItems:"center",gap:10,height:40,padding:"0 16px",borderRadius:20,background:"rgba(245,242,252,0.035)",border:`1px solid ${r.line}`,flexShrink:0},children:[e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:48",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:48",cx:"7",cy:"7",r:"5.2",stroke:"rgba(245,242,252,0.45)",strokeWidth:"1.4"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:48",d:"M11 11L14.5 14.5",stroke:"rgba(245,242,252,0.45)",strokeWidth:"1.4",strokeLinecap:"round"})]}),e.jsx("input",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:49",value:o,onChange:h=>d(h.target.value),placeholder:"Search people…","aria-label":"Search people",style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:13,color:r.text,fontFamily:r.font}})]}),x?e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:59",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"0 48px",textAlign:"center",animation:"lmFadeIn 350ms ease-out"},children:[e.jsx(Te,{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:60"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:61",style:{fontSize:20,fontWeight:600,color:r.text},children:"No people yet"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:62",style:{fontSize:13,color:r.text66,lineHeight:1.55},children:"Human Talkies begin with an invite — share your ring code from a new Talkie and people you welcome appear here."})]}):e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:67",style:{flex:1,overflowY:"auto",padding:"12px 12px",display:"flex",flexDirection:"column"},children:[n===null&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:68",style:{padding:"28px 0",textAlign:"center",fontSize:12,color:r.text40},children:"Finding your people…"}),n!==null&&f.length===0&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:70",style:{padding:"28px 24px",textAlign:"center",fontSize:12.5,color:r.text40},children:o?`No people match “${o}”.`:"Nothing here yet."}),f.map(h=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:75",onClick:()=>a(h.threadId),role:"button",style:{display:"flex",alignItems:"center",gap:12,padding:"8.5px 10px",borderRadius:16,cursor:"pointer"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:76",style:{position:"relative",width:52,height:52,flexShrink:0},children:e.jsx(ve,{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:77",letter:h.name.charAt(0),ringColor:r.warn})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:79",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:80",style:{fontSize:14,fontWeight:600,color:r.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:h.name}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:81",style:{fontSize:12,color:r.text66,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Si(h)?"🎙 Voice note":h.preview})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:85",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,flexShrink:0},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:86",style:{fontSize:10.5,color:r.text40},children:dt(h.lastActivityTs)}),h.unread>0&&e.jsx("span",{"data-loc":"client/src/features/talkie/TalkiePeopleScreen.tsx:88",style:{minWidth:18,height:18,padding:"0 5px",borderRadius:9,background:r.pink,boxShadow:"0 0 9px rgba(244,95,181,0.5)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:9.5,fontWeight:600,color:"#FFFFFF"},children:h.unread})]})]},h.threadId))]})]})}function $n({engine:t,onOpenSocieties:i}){const[a,n]=l.useState(null),[s,o]=l.useState([]),[d,c]=l.useState(null),u=l.useCallback(()=>{t.getProfile().then(n).catch(()=>n(null)),t.listNotifications().then(o).catch(()=>{})},[t]);l.useEffect(()=>{u()},[u]);const f=async(g,R)=>{c(g);
29try{await t.resolveCollaborate(g,R),u()}finally{c(null)}},x=(a?.collaborateInbox??[]).filter(g=>g.status==="pending"),h=a?.collaborators??[],p=s.filter(g=>g.kind==="society_invite"||g.kind==="invite_accepted"),I=a===null,P=x.length===0&&h.length===0&&p.length===0;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:48",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:49",title:"Requests",sub:"Pending invitations"}),!I&&P?e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:51",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"0 48px",textAlign:"center",animation:"lmFadeIn 350ms ease-out"},children:[e.jsx(Te,{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:52"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:53",style:{fontSize:20,fontWeight:600,color:r.text},children:"No requests waiting"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:54",style:{fontSize:13,color:r.text66,lineHeight:1.55},children:"When someone asks to connect with one of your Presences, or a Society invite arrives, it waits here for your decision."})]}):e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:59",style:{flex:1,overflowY:"auto",padding:"14px 16px",display:"flex",flexDirection:"column",gap:14},children:[I&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:60",style:{padding:"28px 0",textAlign:"center",fontSize:12,color:r.text40},children:"Checking for requests…"}),x.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:63",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:64",style:{padding:"4px 6px 8px",fontSize:10,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40},children:"Presence requests"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:67",style:{display:"flex",flexDirection:"column",gap:8},children:x.map(g=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:69",style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",borderRadius:16,background:"rgba(245,242,252,0.03)",border:`1px solid ${r.line}`},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:70",style:{position:"relative",width:44,height:44,flexShrink:0},children:e.jsx(ve,{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:71",letter:(g.fromName||"?").charAt(0),ringColor:r.warn})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:73",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:74",style:{fontSize:13.5,fontWeight:600,color:r.text},children:g.fromName}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:75",style:{fontSize:11,color:r.text66,marginTop:2},children:["asks to open a Talkie with ",e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:76",style:{color:r.violetSoft},children:g.characterName})]})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:79",style:{display:"flex",gap:7,flexShrink:0},children:[e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:80",disabled:d===g.id,onClick:()=>void f(g.id,!0),style:{height:32,padding:"0 16px",borderRadius:16,border:"none",cursor:"pointer",fontFamily:r.font,fontSize:11.5,fontWeight:600,color:"#FFFFFF",background:`linear-gradient(120deg,${r.violet},${r.violetDeep})`,opacity:d===g.id?.6:1},children:"Accept"}),e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:87",disabled:d===g.id,onClick:()=>void f(g.id,!1),style:{height:32,padding:"0 16px",borderRadius:16,border:`1px solid ${r.line}`,background:"rgba(245,242,252,0.04)",cursor:"pointer",fontFamily:r.font,fontSize:11.5,fontWeight:600,color:r.text66,opacity:d===g.id?.6:1},children:"Decline"})]})]},g.id))})]}),p.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:102",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:103",style:{padding:"4px 6px 8px",fontSize:10,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40},children:"Society invites"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:106",style:{display:"flex",flexDirection:"column",gap:8},children:p.map(g=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:108",onClick:g.kind==="society_invite"?i:void 0,role:g.kind==="society_invite"?"button":void 0,style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",borderRadius:16,background:"rgba(245,242,252,0.03)",border:`1px solid ${r.line}`,cursor:g.kind==="society_invite"?"pointer":"default"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:114",style:{position:"relative",width:44,height:44,flexShrink:0},children:e.jsx(Fe,{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:115",letter:(g.title||"S").charAt(0),fontSize:13})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:117",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:118",style:{fontSize:13.5,fontWeight:600,color:r.text},children:g.title}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:119",style:{fontSize:11.5,color:r.text66,marginTop:2},children:g.body})]}),e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:121",style:{fontSize:10,
29color:r.text40,flexShrink:0},children:g.time})]},g.id))})]}),h.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:129",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:130",style:{padding:"4px 6px 8px",fontSize:10,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40},children:"Accepted bonds"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:133",style:{display:"flex",flexDirection:"column",gap:8},children:h.map(g=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:135",style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px",borderRadius:16,background:"rgba(245,242,252,0.02)",border:`1px solid ${r.lineSoft}`},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:136",style:{position:"relative",width:40,height:40,flexShrink:0},children:e.jsx(ve,{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:137",letter:(g.fromName||"?").charAt(0),ringColor:r.ok})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:139",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:140",style:{fontSize:13,fontWeight:600,color:r.text},children:g.fromName}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieRequestsScreen.tsx:141",style:{fontSize:11,color:r.text40,marginTop:1},children:["connected with ",g.characterName]})]})]},g.id))})]})]})]})}function Wn({onOpenThread:t}){const i=re.messageActions.getStarred.useQuery({limit:50}),a=(i.data??[]).filter(s=>s.surface==="connect"),n=i.isLoading;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:30",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:31",title:"Vault",sub:"Saved from your Talkies"}),n?e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:33",style:{padding:"28px 0",textAlign:"center",fontSize:12,color:r.text40},children:"Opening the Vault…"}):a.length===0?e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:35",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"0 48px",textAlign:"center",animation:"lmFadeIn 350ms ease-out"},children:[e.jsx(Te,{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:36"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:37",style:{fontSize:20,fontWeight:600,color:r.text},children:"The Vault is empty"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:38",style:{fontSize:13,color:r.text66,lineHeight:1.55},children:"Star a message inside any Talkie and it is kept here — only for you, across every session."})]}):e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:43",style:{flex:1,overflowY:"auto",padding:"14px 16px",display:"flex",flexDirection:"column",gap:8},children:a.map(s=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:45",onClick:()=>s.threadId&&t(s.threadId),role:s.threadId?"button":void 0,style:{display:"flex",alignItems:"flex-start",gap:12,padding:"12px 14px",borderRadius:16,background:"rgba(245,242,252,0.03)",border:`1px solid ${r.line}`,cursor:s.threadId?"pointer":"default"},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:51",style:{flexShrink:0,marginTop:2,display:"inline-flex"},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:52",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:52",d:"M7 1.5l1.7 3.6 3.9.5-2.9 2.7.8 3.9L7 10.3 3.5 12.2l.8-3.9-2.9-2.7 3.9-.5L7 1.5z",stroke:r.warn,strokeWidth:"1.2",strokeLinejoin:"round",fill:"rgba(232,180,90,0.12)"})})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:54",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:55",style:{fontSize:13,color:r.text,lineHeight:1.5,wordBreak:"break-word"},children:s.contentSnapshot||"Saved message"}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieVaultScreen.tsx:58",style:{fontSize:10,
29color:r.text40,marginTop:5},children:[s.createdAt?new Date(s.createdAt).toLocaleDateString([],{month:"short",day:"numeric"}):"",s.threadId?" · tap to open the Talkie":""]})]})]},s.id))})]})}function Nn({m:t}){return t.kind==="society"?e.jsx(Je,{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:17",spark:!1}):t.kind==="luman"?e.jsx(Fe,{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:18",letter:t.name.charAt(0),avatarUrl:t.avatarUrl,soulKey:t.soulKey,soulColor:t.soulColor}):e.jsx(ve,{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:19",letter:t.name.charAt(0),ringColor:r.warn})}function On({engine:t,prefsStore:i,onOpenThread:a}){const[n,s]=l.useState(null),[o,d]=l.useState(0);l.useEffect(()=>(t.listConversations().then(s),i.subscribe(()=>d(f=>f+1))),[t,i]);const c=i.getPrefs(),u=l.useMemo(()=>In(n??[],c),[n,c,o]);return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:43",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:44",title:"Archived",sub:"Out of sight, never deleted"}),n===null?e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:46",style:{padding:"28px 0",textAlign:"center",fontSize:12,color:r.text40},children:"Opening the archive…"}):u.length===0?e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:48",style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"0 48px",textAlign:"center",animation:"lmFadeIn 350ms ease-out"},children:[e.jsx(Te,{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:49"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:50",style:{fontSize:20,fontWeight:600,color:r.text},children:"Nothing archived"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:51",style:{fontSize:13,color:r.text66,lineHeight:1.55},children:"Archive a Talkie from Recent Talkies to tuck it away here. Messages stay exactly as they were."})]}):e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:56",style:{flex:1,overflowY:"auto",padding:"12px 12px",display:"flex",flexDirection:"column"},children:u.map(f=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:58",style:{display:"flex",alignItems:"center",gap:12,padding:"8.5px 10px",borderRadius:16},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:59",onClick:()=>a(f.threadId),role:"button",style:{position:"relative",width:52,height:52,flexShrink:0,cursor:"pointer"},children:e.jsx(Nn,{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:60",m:f})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:62",onClick:()=>a(f.threadId),role:"button",style:{flex:1,minWidth:0,cursor:"pointer"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:63",style:{fontSize:14,fontWeight:600,color:r.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.name}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:64",style:{fontSize:12,color:r.text66,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.hasVoice?"🎙 Voice note":f.preview})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:68",style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:5,flexShrink:0},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:69",style:{fontSize:10.5,color:r.text40},children:dt(f.lastActivityTs)}),e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieArchivedScreen.tsx:70",onClick:()=>i.update(f.threadId,{archived:!1}),style:{height:26,padding:"0 13px",borderRadius:13,border:`1px solid ${r.line}`,background:"rgba(245,242,252,0.04)",color:r.violetSoft,fontFamily:r.font,fontSize:10.5,fontWeight:600,cursor:"pointer"},children:"Unarchive"})]})]},f.threadId))})]})}function Wt({checked:t,onChange:i,label:a}){return e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:27",type:"button",role:"switch","aria-checked":t,"aria-label":a,onClick:()=>
29i(!t),style:{width:42,height:24,borderRadius:999,flexShrink:0,border:`1px solid ${t?"rgba(142,99,255,0.55)":r.line}`,background:t?"rgba(142,99,255,0.35)":"rgba(245,242,252,0.06)",cursor:"pointer",position:"relative",transition:"background 160ms"},children:e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:45",style:{position:"absolute",top:2,left:t?20:2,width:18,height:18,borderRadius:"50%",background:t?r.violetSoft:r.text40,transition:"left 160ms"}})})}function Ve({title:t,sub:i,onOpen:a}){const[n,s]=l.useState(!1);return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:64",onClick:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),role:a?"button":void 0,style:{display:"flex",alignItems:"center",gap:12,padding:"13px 16px",borderRadius:14,cursor:a?"pointer":"default",background:n&&a?"rgba(142,99,255,0.07)":"rgba(245,242,252,0.025)",border:`1px solid ${r.lineSoft}`},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:76",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:77",style:{fontSize:13.5,fontWeight:600,color:r.text},children:t}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:78",style:{fontSize:11,color:r.text40,marginTop:2},children:i})]}),a&&e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:81",width:"6",height:"11",viewBox:"0 0 6 11",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:81",d:"M1 1l4 4.5L1 10",stroke:r.text40,strokeWidth:"1.4",strokeLinecap:"round"})})]})}function _n({voicePrefsStore:t}){const[i,a]=l.useState(()=>t.getPrefs());return l.useEffect(()=>t.subscribe(()=>a(t.getPrefs())),[t]),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:93",style:{padding:"14px 16px",borderRadius:18,background:"linear-gradient(135deg, rgba(18,14,32,0.9), rgba(12,8,22,0.95))",border:`1px solid ${r.lineSoft}`,display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:104",style:{fontSize:11,fontWeight:600,letterSpacing:2,textTransform:"uppercase",color:r.violetSoft},children:"Voice"}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:109",style:{display:"flex",alignItems:"center",gap:12},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:110",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:111",style:{fontSize:13,fontWeight:600,color:r.text},children:"Play spoken replies automatically"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:112",style:{fontSize:11,color:r.text40,marginTop:2},children:"Off by default — a Presence's spoken reply only sounds when you press play."})]}),e.jsx("button",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:116",type:"button",role:"switch","aria-checked":i.autoplayVoiceReplies,"aria-label":"Play spoken replies automatically",onClick:()=>t.update({autoplayVoiceReplies:!i.autoplayVoiceReplies}
29),style:{width:42,height:24,borderRadius:999,flexShrink:0,border:`1px solid ${i.autoplayVoiceReplies?"rgba(142,99,255,0.55)":r.line}`,background:i.autoplayVoiceReplies?"rgba(142,99,255,0.35)":"rgba(245,242,252,0.06)",cursor:"pointer",position:"relative",transition:"background 160ms"},children:e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:134",style:{position:"absolute",top:2,left:i.autoplayVoiceReplies?20:2,width:18,height:18,borderRadius:"50%",background:i.autoplayVoiceReplies?r.violetSoft:r.text40,transition:"left 160ms"}})})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:150",style:{display:"flex",alignItems:"center",gap:12},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:151",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:152",style:{fontSize:13,fontWeight:600,color:r.text},children:"Playback speed"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:153",style:{fontSize:11,color:r.text40,marginTop:2},children:"For every Talkie voice player."})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:155",style:{display:"flex",gap:4},role:"group","aria-label":"Playback speed",children:Re.map(n=>{const s=i.playbackSpeed===n;return e.jsxs("button",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:159",type:"button","aria-pressed":s,onClick:()=>t.update({playbackSpeed:n}),style:{padding:"5px 9px",borderRadius:9,fontSize:11,fontWeight:s?700:500,cursor:"pointer",fontVariantNumeric:"tabular-nums",background:s?"rgba(142,99,255,0.2)":"rgba(245,242,252,0.04)",border:`1px solid ${s?"rgba(142,99,255,0.5)":r.lineSoft}`,color:s?r.violetSoft:r.text66},children:[n,"×"]},n)})})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:183",style:{fontSize:10,color:r.text40,lineHeight:1.5},children:"Talkie honors your device's reduced-motion setting: voice rituals become simple status updates."})]})}function Bn({visionPrefsStore:t}){const[i,a]=l.useState(()=>t.getPrefs());return l.useEffect(()=>t.subscribe(()=>a(t.getPrefs())),[t]),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:196",style:{padding:"14px 16px",borderRadius:18,background:"linear-gradient(135deg, rgba(18,14,32,0.9), rgba(12,8,22,0.95))",border:`1px solid ${r.lineSoft}`,display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:207",style:{fontSize:11,fontWeight:600,letterSpacing:2,textTransform:"uppercase",color:r.violetSoft},children:"Vision"}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:212",style:{display:"flex",alignItems:"center",gap:12},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:213",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:214",style:{fontSize:13,fontWeight:600,color:r.text},children:"Play glimpses automatically"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:215",style:{fontSize:11,color:r.text40,marginTop:2},children:"Off by default — a glimpse from a Presence only moves when you tap it. Glimpses are always labelled, never live."})]}),e.jsx(Wt,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:219",checked:i.autoplayGlimpses,onChange:n=>t.update({autoplayGlimpses:n}),label:"Play glimpses automatically"})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:227",style:{display:"flex",alignItems:"center",gap:12},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:228",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:229",style:{fontSize:13,fontWeight:600,color:r.text},children:"Data saving"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:230",style:{fontSize:11,color:r.text40,marginTop:2},children:"Glimpse clips load only when you tap them. Still images always show."})]}),e.jsx(Wt,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:234",checked:i.dataSaving,onChange:n=>t.update({dataSaving:n}),label:"Data saving"})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:241",style:{fontSize:10,
29color:r.text40,lineHeight:1.5},children:"The camera opens only when you choose to share a glimpse, and closes right after capture. Reduced-motion devices always see glimpses as stills."})]})}function Un({engine:t,voicePrefsStore:i,visionPrefsStore:a,onOpenSafety:n,onOpenArchived:s,onOpenVault:o,onOpenAppSettings:d}){const[c,u]=l.useState(null);return l.useEffect(()=>{t.getProfile().then(u).catch(()=>{})},[t]),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:265",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:266",title:"Settings",sub:oe.name}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:267",style:{flex:1,overflowY:"auto",padding:"18px 20px",display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:269",style:{display:"flex",alignItems:"center",gap:14,padding:"16px 18px",borderRadius:18,background:"linear-gradient(135deg, rgba(18,14,32,0.9), rgba(12,8,22,0.95))",border:`1px solid ${r.line}`},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:270",style:{width:52,height:52,borderRadius:"50%",flexShrink:0,background:`linear-gradient(135deg, ${r.violet}, ${r.violetDeep})`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,fontWeight:700,color:"#FFF",boxShadow:"0 0 18px rgba(142,99,255,0.4)"},children:(c?.name??"?").charAt(0).toUpperCase()}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:273",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:274",style:{fontSize:16,fontWeight:600,color:r.text},children:c?.name??"…"}),c?.tagline&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:275",style:{fontSize:11.5,color:r.text66,fontStyle:"italic",marginTop:2},children:c.tagline}),c?.permanentId&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:276",style:{fontSize:10,color:r.text40,marginTop:3,letterSpacing:.6},children:c.permanentId})]})]}),e.jsx(_n,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:280",voicePrefsStore:i}),e.jsx(Bn,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:282",visionPrefsStore:a}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:284",style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ve,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:285",title:"Safety & privacy",sub:"Age gate, blocked contacts, report history",onOpen:n}),e.jsx(Ve,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:286",title:"Vault",sub:"Messages you saved from your Talkies",onOpen:o}),e.jsx(Ve,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:287",title:"Archived",sub:"Talkies tucked away",onOpen:s}),e.jsx(Ve,{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:288",title:"AISHU app settings",sub:"Account, notifications and app-wide preferences",onOpen:d})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSettingsScreen.tsx:291",style:{textAlign:"center",fontSize:10,color:r.text40,letterSpacing:.5,paddingTop:8},children:oe.footer})]})]})}const Hn={online:{label:"Present",color:r.ok},away:{label:"Drifting",color:r.warn},busy:{label:"Deep focus",color:r.rose},asleep:{label:"Resting",color:r.text40}};function Kn({engine:t,onBack:i,onOpenThread:a,onOpenSociety:n}){const[s,o]=l.useState(""),[d,c]=l.useState(null),[u,f]=l.useState([]);l.useEffect(()=>{t.listLumans().then(f).catch(()=>{})},[t]),l.useEffect(()=>{let p=!0;if(!s.trim()){c(null);return}return t.search(s).then(I=>{p&&c(I)}),()=>{p=!1}},[t,s]);const x=l.useMemo(()=>{const p=new Map;for(const I of u)p.set(I.id,I);return p},[u]),h=d&&d.contacts.length+d.societies.length+d.memories.length+d.messages.length>0;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:52",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.12), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:53",title:"Search",sub:"Within Lumo Talkie",onBack:i}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:54",style:{margin:"10px 20px 0",display:"flex",alignItems:"center",gap:10,height:42,padding:"0 16px",borderRadius:21,background:"rgba(245,242,252,0.05)",border:`1px solid ${r.line}`,flexShrink:0},children:[e.jsxs("svg",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:55",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:55",cx:"7",cy:"7",r:"5.2",stroke:"rgba(245,242,252,0.6)",strokeWidth:"1.4"}),e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:55",d:"M11 11L14.5 14.5",stroke:"rgba(245,242,252,0.6)",strokeWidth:"1.4",strokeLinecap:"round"})]}),e.jsx("input",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:56",autoFocus:!0,value:s,onChange:p=>o(p.target.value),placeholder:"Search Talkies, people, Presences, societies…","aria-label":"Search within Lumo Talkie",style:{flex:1,fontSize:14,color:r.text,background:"transparent",border:"none",outline:"none",fontFamily:r.font}})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:66",style:{flex:1,overflowY:"auto",padding:"10px 12px 8px",display:"flex",flexDirection:"column"},children:[!s.trim()&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:68",style:{padding:"40px 16px",textAlign:"center",fontSize:12.5,color:r.text40,lineHeight:1.6}
29,children:"Search across your Talkies — names, messages and societies."}),s.trim()&&d&&!h&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:73",style:{padding:"40px 8px",textAlign:"center",fontSize:13,color:r.text66},children:["Nothing found for “",s,"” yet."]}),d&&d.contacts.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:77",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:78",style:{padding:"8px 8px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40},children:"Presences & people"}),d.contacts.map(p=>{const I=p.kind==="luman"?x.get(p.id):void 0,P=I?Hn[I.presence]:void 0;return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:83",onClick:()=>I?.threadId&&a(I.threadId),role:I?.threadId?"button":void 0,style:{display:"flex",alignItems:"center",gap:11,padding:"6px 10px",borderRadius:14,cursor:I?.threadId?"pointer":"default"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:89",style:{position:"relative",width:38,height:38,flexShrink:0},children:p.kind==="luman"?e.jsx(Fe,{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:90",letter:p.name.charAt(0),fontSize:12}):e.jsx(ve,{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:90",letter:p.name.charAt(0),ringColor:r.warn})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:92",style:{flex:1,minWidth:0},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:93",style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:94",style:{fontSize:13.5,fontWeight:600,color:r.text},children:p.name}),e.jsx($e,{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:95",label:p.kind==="luman"?"Presence":"Human",kind:p.kind==="luman"?"lumorian":"human"})]}),P&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:97",style:{fontSize:10.5,color:P.color,marginTop:1},children:P.label})]})]},p.id)})]}),d&&d.societies.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:106",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:107",style:{padding:"8px 8px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40},children:"Societies"}),d.societies.map(p=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:109",onClick:()=>n(p.id),role:"button",style:{display:"flex",alignItems:"center",gap:11,padding:"6px 10px",borderRadius:14,cursor:"pointer"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:110",style:{position:"relative",width:38,height:38,flexShrink:0},children:e.jsx(Je,{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:110",spark:p.spark})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:111",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:112",style:{fontSize:13.5,fontWeight:600,color:r.text},children:p.name}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:113",style:{fontSize:10.5,color:r.text40,marginTop:1},children:p.sub})]})]},p.id))]}),d&&d.messages.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:121",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:122",style:{padding:"8px 8px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40},children:"Messages"}),d.messages.map(p=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:124",onClick:()=>a(p.threadId),role:"button",style:{display:"flex",alignItems:"center",gap:11,padding:"6px 10px",borderRadius:14,cursor:"pointer"},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:125",style:{width:38,height:38,borderRadius:12,background:"rgba(142,99,255,0.10)",border:`1px solid ${r.line}
29`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:126",width:"15",height:"15",viewBox:"0 0 20 20",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:126",d:"M3 7a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v4a4 4 0 0 1-4 4H8l-3.5 3v-3.4A4 4 0 0 1 3 11V7z",stroke:r.violetSoft,strokeWidth:"1.5",fill:"none"})})}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:128",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:129",style:{fontSize:13,fontWeight:500,color:"rgba(245,242,252,0.85)",fontStyle:"italic",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.excerpt}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieSearchScreen.tsx:130",style:{fontSize:10.5,color:r.text40,marginTop:1},children:p.sub})]})]},p.id))]})]})]})}function _e({title:t,sub:i,onOpen:a}){return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:16",onClick:a,role:a?"button":void 0,style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderRadius:14,cursor:a?"pointer":"default",background:"rgba(245,242,252,0.025)",border:`1px solid ${r.lineSoft}`},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:21",style:{flex:1,minWidth:0},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:22",style:{fontSize:13.5,fontWeight:600,color:r.text},children:t}),i&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:23",style:{fontSize:11,color:r.text40,marginTop:2},children:i})]}),a&&e.jsx("svg",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:26",width:"6",height:"11",viewBox:"0 0 6 11",fill:"none",children:e.jsx("path",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:26",d:"M1 1l4 4.5L1 10",stroke:r.text40,strokeWidth:"1.4",strokeLinecap:"round"})})]})}function qn({engine:t,onShareInvite:i,onOpenSettings:a,onOpenPresence:n}){const[s,o]=l.useState(null);l.useEffect(()=>{t.getProfile().then(o).catch(()=>{})},[t]);const d=s?.entities??[];return e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:47",style:{display:"flex",flexDirection:"column",flex:1,minHeight:0,background:`radial-gradient(600px 400px at 50% -10%, rgba(142,99,255,0.10), transparent 60%), ${r.bg}`},children:[e.jsx(fe,{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:48",title:"Me",sub:oe.name}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:49",style:{flex:1,overflowY:"auto",padding:"18px 20px",display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:51",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"22px 18px",borderRadius:20,background:"linear-gradient(135deg, rgba(18,14,32,0.9), rgba(12,8,22,0.95))",border:`1px solid ${r.line}`},children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:52",style:{width:68,height:68,borderRadius:"50%",background:`linear-gradient(135deg, ${r.violet}, ${r.violetDeep})`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:24,fontWeight:700,color:"#FFF",boxShadow:"0 0 24px rgba(142,99,255,0.45)"},children:(s?.name??"?").charAt(0).toUpperCase()}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:55",style:{fontSize:18,fontWeight:600,color:r.text},children:s?.name??"…"}),s?.handle&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:56",style:{fontSize:11.5,color:r.text40},children:s.handle}),s?.tagline&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:57",style:{fontSize:12,color:r.text66,fontStyle:"italic",textAlign:"center"},children:s.tagline}),s?.permanentId&&e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:59",style:{fontSize:10,color:r.violetSoft,letterSpacing:1,marginTop:2,padding:"3px 10px",borderRadius:10,border:`1px solid ${r.line}`,background:"rgba(142,99,255,0.07)"},children:s.permanentId})]}),d.length>0&&e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:67",children:[e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:68",style:{padding:"2px 6px 8px",fontSize:10,fontWeight:600,letterSpacing:"0.28em",textTransform:"uppercase",color:r.text40},children:"Your Presences"}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:71",style:{display:"flex",flexDirection:"column",gap:8},children:d.map(c=>e.jsx(_e,{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:73",title:c.name,sub:c.permanentId,onOpen:()=>n(c.characterId)},c.permanentId))})]}),e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:85",style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx(_e,{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:86",title:"Share my invite",sub:"Let someone open a Talkie with you",onOpen:i}),e.jsx(_e,{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:87",title:"Settings",sub:"Safety, Vault, Archived and app settings",onOpen:a})]}),e.jsx("div",{"data-loc":"client/src/features/talkie/TalkieMeScreen.tsx:90",style:{textAlign:"center",fontSize:10,
29color:r.text40,letterSpacing:.5,paddingTop:4},children:s?.footer??oe.footer})]})]})}function fs(){const t=re.useUtils(),{user:i}=Xe(),[a,n]=Qe(),s=l.useMemo(()=>xa(Fi(t.client,i?.id!=null?{currentUserId:i.id}:void 0)),[t.client,i?.id]),{engine:o,outbox:d}=s,c=l.useMemo(()=>ma(i?.id),[i?.id]),u=l.useMemo(()=>Ca(i?.id),[i?.id]),f=l.useMemo(()=>Aa(i?.id),[i?.id]),[x,h]=l.useState([]),[p,I]=l.useState(null),P=re.safety.ageGateStatus.useQuery(void 0,{enabled:!!i?.id,staleTime:3e4}),g=l.useMemo(()=>Yr(a),[a]);l.useEffect(()=>{I(null)},[a]),l.useEffect(()=>{if(typeof document>"u")return;const m=document.title;document.title=oe.pageTitle;let k=document.querySelector('meta[name="description"]');const y=k?.getAttribute("content")??null;return k||(k=document.createElement("meta"),k.setAttribute("name","description"),document.head.appendChild(k)),k.setAttribute("content",oe.metaDescription),()=>{document.title=m,y!==null?k?.setAttribute("content",y):k?.remove()}},[]),l.useEffect(()=>{o.listSocieties().then(h).catch(()=>{})},[o]),l.useEffect(()=>()=>o.dispose(),[o]),l.useEffect(()=>{g.name==="thread"&&c.update(g.threadId,{markedUnread:!1})},[g,c]);const R=m=>{const k=De(m)??x.find(y=>`society-${y.id}`===m)?.id;n(k?G(k,"chat"):Oe(m))},b=m=>{m.kind==="thread"?R(m.threadId):m.kind==="society"?(o.listSocieties().then(h).catch(()=>{}),n(G(m.societyId))):m.kind==="collaborate"&&I({characterId:m.characterId,permanentId:m.permanentId,characterName:m.characterName,ringPayload:m.ringPayload})},z=Jr(g),w=z&&P.data?.attested&&!P.data?.isAdult;l.useEffect(()=>{w&&ie.error("Human Talkies are locked for this account. Presences remain open.")},[w]);const j=m=>e.jsxs("div",{"data-loc":"client/src/features/talkie/TalkieApp.tsx:184",style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",minHeight:0,background:"#05070D",color:"#F5F2FC",fontFamily:"'Sora',sans-serif"},children:[e.jsx(Ai,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:185"}),m]});if(P.isLoading&&(z||g.name==="inbox"))return j(null);if(P.data){if((z||g.name==="inbox")&&!P.data.attested)return j(e.jsx(Ni,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:202",onAdult:()=>{t.safety.ageGateStatus.invalidate()},onMinor:()=>{t.safety.ageGateStatus.invalidate(),n("/talkie/presences")}}));if(w)return j(e.jsx(we,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:214",to:"/talkie/presences"}))}let S=null;switch(g.name){case"inbox":S=e.jsx(Dn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:223",engine:o,outbox:d,prefsStore:c,onOpenThread:R,onNewChat:()=>n("/talkie/new"),onOpenNotifications:()=>n("/talkie/notifications"),onOpenSearch:()=>n("/talkie/search")});break;case"thread":{const m=De(g.threadId);m?S=e.jsx(Et,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:238",engine:o,societyId:m,onBack:()=>n(G(m)),onOpenTab:k=>n(G(m,k)),voicePrefsStore:u,visionPrefsStore:f}):S=e.jsx(sr,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:252",engine:o,threadId:g.threadId,onBack:()=>n("/talkie"),onInfo:k=>n(`/talkie/info/${encodeURIComponent(k)}`),onOpenFlow:k=>n(Mt(k)),voicePrefsStore:u,visionPrefsStore:f},g.threadId);break}case"threadMemory":{const m=De(g.threadId);S=m?e.jsx(we,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:269",to:G(m,"memory")}):e.jsx(bn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:271",engine:o,threadId:g.threadId,onBack:()=>n(`/talkie/info/${encodeURIComponent(g.threadId)}`)});break}case"info":{const m=De(g.threadId);S=m?e.jsx(we,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:282",to:G(m)}):e.jsx(vn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:284",engine:o,threadId:g.threadId,onBack:()=>n(Oe(g.threadId)),onOpenMemory:k=>n(qr(k))});break}case"presences":S=e.jsx(zn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:294",engine:o,onOpenThread:R});break;case"people":S=e.jsx(Vn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:297",engine:o,prefsStore:c,onOpenThread:R});break;case"societies":S=e.jsx(Xi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:301",engine:o,onCreate:()=>n("/talkie/societies/new"),onEnter:m=>n(G(m.id)),onEnterCode:()=>n("/talkie/resolve")});break;case"societyCreate":S=e.jsx(Qi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:311",engine:o,onBack:()=>n("/talkie/societies"),onCreated:m=>{o.listSocieties().then(h).catch(()=>{}),n(`/talkie/societies/created/${encodeURIComponent(m.id)}`)}});break;case"societyCreated":S=e.jsx(Gi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:322",onEnter:()=>n(G(g.societyId))});break;case"society":{const m=g.societyId,k=x.find(T=>T.id===m)?.name,y=(T,_)=>e.jsx(Lr,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:328",s
29ocietyName:k,activeTab:T,onTab:K=>n(G(m,K)),children:_});switch(g.tab){case"chat":S=y("chat",e.jsx(Et,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:340",engine:o,societyId:m,onBack:()=>n(G(m)),onOpenTab:T=>n(G(m,T)),voicePrefsStore:u,visionPrefsStore:f}));break;case"members":S=y("members",e.jsx(ln,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:353",engine:o,societyId:m,onBack:()=>n(G(m)),onInvite:()=>n(G(m,"invite")),onChanged:()=>void o.listSocieties().then(h).catch(()=>{})}));break;case"memory":S=y("memory",e.jsx(gn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:365",societyId:m,societyName:k,onBack:()=>n(G(m))}));break;case"bonds":S=y("bonds",e.jsx(ea,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:369",engine:o,societyId:m,onBack:()=>n(G(m))}));break;case"culture":S=y("culture",e.jsx(Zi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:372",engine:o,societyId:m,onBack:()=>n(G(m))}));break;case"story":S=y("story",e.jsx(Ji,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:377",engine:o,societyId:m,onBack:()=>n(G(m,"chat")),onStart:()=>n(G(m,"chat"))}));break;case"invite":S=y("invite",e.jsx(kn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:386",engine:o,societyId:m,onBack:()=>n(G(m))}));break;default:S=e.jsx(Yi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:390",engine:o,societyId:m,onBack:()=>n("/talkie/societies"),onEnterChat:()=>n(G(m,"chat")),onInvite:()=>n(G(m,"invite")),onTab:T=>{T==="Members"&&n(G(m,"members")),T==="Memory"&&n(G(m,"memory")),T==="Bonds"&&n(G(m,"bonds")),T==="Culture"&&n(G(m,"culture"))}})}break}case"requests":S=e.jsx($n,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:408",engine:o,onOpenSocieties:()=>n("/talkie/societies")});break;case"vault":S=e.jsx(Wn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:411",onOpenThread:R});break;case"archived":S=e.jsx(On,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:414",engine:o,prefsStore:c,onOpenThread:R});break;case"settings":S=e.jsx(Un,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:418",engine:o,voicePrefsStore:u,visionPrefsStore:f,onOpenSafety:()=>n("/talkie/safety"),onOpenArchived:()=>n("/talkie/archived"),onOpenVault:()=>n("/talkie/vault"),onOpenAppSettings:()=>n("/settings")});break;case"me":S=e.jsx(qn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:431",engine:o,onShareInvite:()=>n("/talkie/invite"),onOpenSettings:()=>n("/talkie/settings"),onOpenPresence:m=>n(`/presence/${m}`)});break;case"new":S=e.jsx(qi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:441",engine:o,onBack:()=>n("/talkie"),onStart:m=>m.threadId?R(m.threadId):n("/talkie"),onNewSociety:()=>n("/talkie/societies/new"),onScan:()=>n("/talkie/scan"),onShareMyInvite:()=>n("/talkie/invite")});break;case"search":S=e.jsx(Kn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:453",engine:o,onBack:()=>n("/talkie"),onOpenThread:R,onOpenSociety:m=>n(G(m))});break;case"notifications":S=e.jsx(Ki,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:463",engine:o,onBack:()=>n("/talkie"),onOpenThread:R});break;case"moments":S=e.jsx(Hi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:472",engine:o,onOpen:m=>n(`/talkie/moment/${encodeURIComponent(m.id)}`),onBack:()=>n("/talkie"),onAddMoment:()=>n("/talkie/moments/add")});break;case"addMoment":S=e.jsx(Ui,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:481",onBack:()=>n("/talkie/moments"),onCreated:()=>n("/talkie/moments")});break;case"moment":S=e.jsx($i,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:484",engine:o,momentId:g.id,onClose:()=>n("/talkie/moments")});break;case"calls":S=e.jsx(we,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:489",to:"/talkie/flow"});break;case"flow":S=e.jsx(Er,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:494",engine:o,threadId:g.threadId??null,visionPrefsStore:f,onBack:()=>n("/talkie"),onExitToThread:m=>n(Oe(m)),onPickThread:m=>n(Mt(m)),onOpenPresences:()=>n("/talkie/presences")},g.threadId??"picker");break;case"safety":S=e.jsx(Bi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:507",onBack:()=>n("/talkie/settings")});break;case"invite":S=e.jsx(_i,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:510",engine:o,onBack:()=>n("/talkie")});break;case"resolve":S=e.jsx(Oi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:513",engine:o,onBack:()=>n("/talkie/new"),onResolved:b});break;case"scan":S=e.jsx(Ei,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:516",engine:o,onBack:()=>n("/talkie/new"),onResolved:b});break;default:S=e.jsx(we,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:519",to:"/talkie"})}p&&(S=e.jsx(Wi,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:524",engine:o,characterId:p.characterId,permanentId:p.permanentId,characterName:p.characterName,ringPayload:p.ringPayload,onBack:()=>{I(null),n("/talkie/new")},onSent:()=>{I(null),n("/talkie/requests")}}));const A=Xr(g)&&!p;return j(A?e.jsx(Sn,{"data-loc":"client/src/features/talkie/TalkieApp.tsx:539",activeKey:Zr(g),children:S}):S)}export{fs 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.