(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,40737,e=>{"use strict";var t=e.i(43476),n=e.i(8144),o=e.i(19882),i=e.i(63087),l=e.i(4592);e.s(["DeadEnd",0,function({section:e,title:r,body:a}){return(0,t.jsx)("main",{style:{minHeight:"100vh",background:n.surface.bg,color:n.text.primary},children:(0,t.jsxs)("div",{style:{maxWidth:620,margin:"0 auto",padding:"2rem 1.5rem 6rem"},children:[(0,t.jsx)("div",{style:{paddingBottom:"1rem"},children:(0,t.jsx)(o.Wordmark,{section:e})}),(0,t.jsx)(i.Rule,{style:{marginBottom:"2.5rem"}}),(0,t.jsx)("div",{style:{fontFamily:n.font.mono,fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:n.signal.gold,marginBottom:"0.75rem"},children:"Terrain unknown"}),(0,t.jsx)("h1",{style:{fontFamily:n.font.sans,fontSize:"1.6rem",fontWeight:600,color:n.text.primary,margin:"0 0 0.75rem",lineHeight:1.2,letterSpacing:"-0.01em"},children:r}),(0,t.jsx)("p",{style:{fontFamily:n.font.sans,fontSize:"0.95rem",color:n.text.secondary,margin:"0 0 2rem",lineHeight:1.6},children:a}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[(0,t.jsx)(l.ButtonLink,{variant:"primary",size:"md",glyph:"⊕",href:"/dashboard",children:"Open the compass"}),(0,t.jsx)(l.ButtonLink,{variant:"ghost",size:"md",href:"/history",children:"Your ledger"}),(0,t.jsx)(l.ButtonLink,{variant:"ghost",size:"md",href:"/",children:"Home"})]})]})})}])},4889,e=>{"use strict";var t=e.i(43476),n=e.i(71645),o=e.i(18566),i=e.i(8144);function l(){let[e,o]=(0,n.useState)(!1),[l,r]=(0,n.useState)(null);if((0,n.useEffect)(()=>{if(!window.location.search.includes("ptdebug"))return;o(!0);let e=e=>{let t=window.getSelection()?.toString().trim().length??0,n="touch"!==e.pointerType&&t>=3;r({type:e.pointerType||"—",len:t,fires:n})};return document.addEventListener("pointerup",e),()=>document.removeEventListener("pointerup",e)},[]),!e)return null;let a=l?.type==="pen"?"#00FF9D":l?.type==="mouse"?"#00F0FF":l?.type==="touch"?"#FF4D6D":"#475569";return(0,t.jsxs)("div",{style:{position:"fixed",left:10,bottom:10,zIndex:99999,fontFamily:i.font.mono,fontSize:11,lineHeight:1.5,background:"rgba(2,4,8,.92)",color:"#e2e8f0",border:`.5px solid ${a}`,borderRadius:6,padding:"7px 10px",letterSpacing:".04em",pointerEvents:"none",boxShadow:`0 0 10px ${a}33`},children:[(0,t.jsx)("div",{style:{color:"#64748b",fontSize:11,letterSpacing:".12em",textTransform:"uppercase",marginBottom:3},children:"pointer probe"}),(0,t.jsxs)("div",{children:["type: ",(0,t.jsx)("strong",{style:{color:a},children:l?.type??"—"})]}),(0,t.jsxs)("div",{children:["selection: ",l?.len??0," chars"]}),(0,t.jsxs)("div",{children:["reflect picker: ",(0,t.jsx)("strong",{style:{color:l?.fires?"#00FF9D":"#FF4D6D"},children:l?l.fires?"✓ fires":"✕ native":"—"})]})]})}let r=i.signal.cyan,a=i.signal.gold,s=i.signal.red,d=i.signal.green,p={THOUGHT:r,COMMENT:a,REACTION:s},c={THOUGHT:"✏",COMMENT:"✦",REACTION:"◈"};function f(e){let t=e??"rgba(71,85,105,.7)",n=e?{background:`${e}0f`,borderColor:`${e}48`,color:t,boxShadow:`0 0 8px ${e}12`}:{background:"rgba(15,21,32,.5)",borderColor:"rgba(71,85,105,.25)",color:t};return{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:"0.06em",padding:"4px 12px",borderRadius:20,cursor:"pointer",border:".5px solid",display:"inline-flex",alignItems:"center",gap:4,textTransform:"uppercase",lineHeight:1,...n}}let m=["◆ Key","✕ Disagree","⚑ Flag","↻ Follow up"];function g(e){let t=[];return e.THOUGHT&&t.push("thoughts"),e.COMMENT&&t.push("comments"),e.REACTION&&t.push("reactions"),t.join("-")||"thoughts-comments-reactions"}e.s(["ReflectLayer",0,function({receiptId:e,surface:x,children:h,defaultHudOpen:y=!1,defaultLayers:u,reflectUrl:b,layerUrlBase:j}){let S,T,v,k=(0,o.useRouter)(),[C,w]=(0,n.useState)(y),[z,E]=(0,n.useState)(!0),[H,F]=(0,n.useState)(u??{THOUGHT:!0,COMMENT:!0,REACTION:!0}),[O,$]=(0,n.useState)(null),[L,R]=(0,n.useState)([]),[M,A]=(0,n.useState)(null),[I,N]=(0,n.useState)(""),[B,D]=(0,n.useState)(null),[W,U]=(0,n.useState)(new Set),[G,P]=(0,n.useState)(new Set),[K,Y]=(0,n.useState)(!1),[J,q]=(0,n.useState)(0),[Q,V]=(0,n.useState)("ALL"),[X,Z]=(0,n.useState)(!1),[_,ee]=(0,n.useState)(null),[et,en]=(0,n.useState)(!0),[eo,ei]=(0,n.useState)(1280),[el,er]=(0,n.useState)(null),ea=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>ei(window.innerWidth))};return t(),window.addEventListener("resize",t),()=>{cancelAnimationFrame(e),window.removeEventListener("resize",t)}},[]);let es=eo<=760;(0,n.useEffect)(()=>{fetch(`/api/annotations/by-receipt/${e}`).then(e=>e.json()).then(e=>{e.ok&&R(e.annotations)}).catch(()=>{})},[e]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(er(null),ea.current=null,A(null),N(""),D(null),Y(!1))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,n.useEffect)(()=>{let e={"`":"THOUGHT","!":"REACTION","@":"COMMENT"},t=t=>{let n=t.key;if(!(n in e))return;let o=t.target;if(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o.isContentEditable)return;let i=e[n];if(t.preventDefault(),ea.current)return void ec(i);let l=window.getSelection(),r=l?.toString().trim()??"";if(r.length>=3){w(!0),$(i);let e=l.getRangeAt(0),t=e.getBoundingClientRect(),n=e.commonAncestorContainer.textContent??"",o=n.indexOf(r),a=n.slice(Math.max(0,o-40),o),s=n.slice(o+r.length,o+r.length+40);A({anchorText:r,preContext:a,postContext:s,x:t.left+t.width/2,y:t.bottom+window.scrollY+8}),N(""),er(null)}else w(!0),$(e=>e===i?null:i)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[]);let ed=(0,n.useCallback)(e=>{if("touch"===e.pointerType){er(null),ea.current=null;return}let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t.isContentEditable)return;let n=window.getSelection();if(!n||n.isCollapsed)return void er(null);let o=n.toString().trim();if(!o||o.length<3)return void er(null);if(!C)return;let i=n.getRangeAt(0),l=i.getBoundingClientRect(),r=i.commonAncestorContainer.textContent??"",a=r.indexOf(o),s=r.slice(Math.max(0,a-40),a),d=r.slice(a+o.length,a+o.length+40),p=Math.max(8,Math.min(l.left+l.width/2-132,window.innerWidth-264-8)),c=l.top-72,f={anchorText:o,preContext:s,postContext:d,x:p,y:c<8?l.bottom+8:c};ea.current=f,er(f),"pen"===e.pointerType&&n.removeAllRanges()},[C]);(0,n.useEffect)(()=>(document.addEventListener("pointerup",ed),()=>document.removeEventListener("pointerup",ed)),[ed]);let ep=(0,n.useRef)(null);function ec(e){let t=ea.current;t&&($(e),w(!0),A({anchorText:t.anchorText,preContext:t.preContext,postContext:t.postContext,x:t.x+132,y:t.y+window.scrollY+72+8}),N(""),ea.current=null,er(null))}async function ef(t){if(!M||!O)return;let n=t??I.trim();if(n)try{let t=await fetch("/api/annotations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({receiptId:e,surface:x,anchorText:M.anchorText,preContext:M.preContext,postContext:M.postContext,type:O,body:n})}),o=await t.json();o.ok&&(R(e=>[...e,o.annotation]),A(null),N(""),window.getSelection()?.removeAllRanges())}catch{}}async function em(e){await fetch(`/api/annotations/${e}`,{method:"DELETE"}),R(t=>{let n=t.filter(t=>t.id!==e);return 0===n.length?w(!1):F(e=>({THOUGHT:!!n.some(e=>"THOUGHT"===e.type)&&e.THOUGHT,COMMENT:!!n.some(e=>"COMMENT"===e.type)&&e.COMMENT,REACTION:!!n.some(e=>"REACTION"===e.type)&&e.REACTION})),n}),D(null)}async function eg(e){P(t=>new Set(t).add(e.id)),D(e=>e?{...e,distilling:!0}:null);let t=await fetch(`/api/annotations/${e.id}/shavasana`,{method:"POST"}),n=await t.json();n.ok&&(R(t=>t.map(t=>t.id===e.id?{...t,kernel:n.kernel}:t)),D(e=>e?{...e,annotation:{...e.annotation,kernel:n.kernel},distilling:!1}:null)),P(t=>{let n=new Set(t);return n.delete(e.id),n})}async function ex(e){(await fetch(`/api/annotations/${e}/harden`,{method:"POST"})).ok&&(R(t=>t.map(t=>t.id===e?{...t,hardened:!0,kernel:t.kernel}:t)),D(t=>t?.annotation.id===e?{...t,annotation:{...t.annotation,hardened:!0}}:t),U(t=>new Set(t).add(e)))}async function eh(){Z(!0),en(!0),ee(null);try{let t=L.filter(e=>!e.kernel);t.length>0&&await Promise.all(t.map(async e=>{let t=await fetch(`/api/annotations/${e.id}/shavasana`,{method:"POST"}),n=await t.json();n.ok&&R(t=>t.map(t=>t.id===e.id?{...t,kernel:n.kernel}:t))}));let n=await fetch("/api/annotations/meditate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({receiptId:e})}),o=await n.json();o.ok&&ee({held:o.held??[],falsified:o.falsified??[],elevated:o.elevated??[]})}finally{Z(!1)}}(0,n.useEffect)(()=>{let e=e=>{ep.current?.contains(e.target)||(er(null),ea.current=null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let[ey,eu]=(0,n.useState)("ALL"),eb=L.filter(e=>"THOUGHT"===e.type).length,ej=L.filter(e=>"COMMENT"===e.type).length,eS=L.filter(e=>"REACTION"===e.type).length,eT=L.filter(e=>"ALL"===ey||e.type===ey).sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),ev=C&&!es;return es?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l,{}),h]}):(0,t.jsxs)("div",{style:{position:"relative",minHeight:"100vh"},children:[(0,t.jsx)(l,{}),(0,t.jsx)("style",{children:"::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:rgba(30,41,59,.55);border-radius:2px}::-webkit-scrollbar-thumb:hover{background:rgba(71,85,105,.65)}"}),(0,t.jsxs)("div",{style:{display:ev?"grid":"block",gridTemplateColumns:ev?eo>760&&eo<=1024?"320px 1fr":"400px 1fr":void 0,alignItems:"start"},children:[ev&&(0,t.jsxs)("div",{style:{position:"sticky",top:0,height:"100vh",display:"flex",flexDirection:"column",borderRight:".5px solid rgba(30,41,59,.4)",background:"rgba(6,9,16,.6)",backdropFilter:"blur(8px)",overflow:"hidden"},children:[(0,t.jsxs)("div",{style:{padding:"12px 12px 10px",borderBottom:".5px solid rgba(30,41,59,.35)",flexShrink:0},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".12em",color:"rgba(0,240,255,.6)",textTransform:"uppercase"},children:"◎ Reflect"}),(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.4)"},children:"·"}),(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.5)",letterSpacing:".06em"},children:x})]}),(0,t.jsx)("button",{onClick:()=>{w(!1),$(null)},style:{...f(),fontSize:i.font.ramp.label,padding:"4px 11px"},children:"↓ close"})]}),(0,t.jsx)("div",{style:{display:"flex",gap:0,borderRadius:6,overflow:"hidden",border:".5px solid rgba(30,41,59,.4)"},children:[{key:"THOUGHT",emoji:"💭",label:"Thought",count:eb,color:r},{key:"COMMENT",emoji:"💬",label:"Comment",count:ej,color:a},{key:"REACTION",emoji:"🗯️",label:"React",count:eS,color:s}].map(({key:e,emoji:n,label:o,count:l,color:r},a)=>{let s=ey===e;return(0,t.jsxs)("button",{onClick:()=>(function(e){if(eu(e),"ALL"===e){let e={THOUGHT:!0,COMMENT:!0,REACTION:!0};F(e),j&&k.replace(`${j}/${g(e)}`,{scroll:!1})}else{let t={THOUGHT:"THOUGHT"===e,COMMENT:"COMMENT"===e,REACTION:"REACTION"===e};F(t),j&&k.replace(`${j}/${g(t)}`,{scroll:!1})}})(e),style:{flex:1,fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".06em",padding:"7px 4px",cursor:"pointer",border:"none",borderRight:a<2?".5px solid rgba(30,41,59,.4)":"none",borderBottom:s?`2px solid ${r}`:"2px solid transparent",background:s?`${r}10`:"rgba(10,15,26,.4)",color:s?r:"rgba(71,85,105,.5)",textTransform:"uppercase",display:"flex",flexDirection:"column",alignItems:"center",gap:3,transition:"all .12s"},children:[(0,t.jsx)("span",{style:{fontSize:i.font.ramp.body},children:n}),(0,t.jsx)("span",{children:o}),l>0&&(0,t.jsx)("span",{style:{opacity:.6},children:l})]},e)})})]}),(0,t.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"10px 14px",display:"flex",flexDirection:"column",gap:0},children:[(X||_)&&(0,t.jsxs)("div",{style:{marginBottom:2},children:[(0,t.jsxs)("button",{onClick:()=>en(e=>!e),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",padding:"5px 0"},children:[(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".1em",color:`${d}bb`,textTransform:"uppercase"},children:"📿 Meditate"}),(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.4)"},children:et?"▲":"▼"})]}),et&&X&&(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:`${d}44`,textAlign:"center",padding:"14px 0",letterSpacing:".08em"},children:"distilling…"}),et&&!X&&_&&(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4,paddingBottom:6},children:[{label:"Held",items:_.held,color:r},{label:"Challenged",items:_.falsified,color:s},{label:"Elevated",items:_.elevated,color:d}].filter(({items:e})=>e.length>0).map(({label:e,items:n,color:o})=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".1em",color:`${o}55`,textTransform:"uppercase",marginBottom:3},children:e}),n.map((e,n)=>(0,t.jsx)("div",{style:{borderLeft:`2px solid ${o}44`,paddingLeft:8,marginBottom:4},children:(0,t.jsx)("p",{style:{fontFamily:i.font.sans,fontSize:i.font.ramp.body,color:i.text.secondary,lineHeight:1.6,margin:0},children:e})},n))]},e))}),(0,t.jsx)("div",{style:{height:".5px",background:"rgba(30,41,59,.3)"}})]}),K&&(T=(S=L.filter(e=>"ALL"===Q||e.type===Q))[Math.min(J,S.length-1)],v=Math.min(J,S.length-1),(0,t.jsxs)("div",{style:{marginBottom:2},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"5px 0"},children:[(0,t.jsxs)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".1em",color:`${d}88`,textTransform:"uppercase",flex:1},children:["☽ Shavasana · ",S.length]}),["ALL","THOUGHT","COMMENT","REACTION"].map(e=>(0,t.jsx)("button",{onClick:()=>{V(e),q(0)},style:{...f(Q===e?r:void 0),fontSize:i.font.ramp.label,padding:"2px 6px",borderRadius:10},children:"ALL"===e?"All":c[e]},e)),(0,t.jsx)("button",{onClick:()=>Y(!1),style:{...f(),fontSize:i.font.ramp.label,padding:"2px 6px",marginLeft:2},children:"✕"})]}),0===S.length?(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.3)",padding:"10px 0"},children:"No annotations in this layer"}):T&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{background:"rgba(8,13,22,.6)",border:`.5px solid ${p[T.type]}18`,borderRadius:6,padding:"10px 12px",marginBottom:6},children:[(0,t.jsxs)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:`${p[T.type]}66`,textTransform:"uppercase",letterSpacing:".1em",marginBottom:6},children:[c[T.type]," ",T.type," · ",new Date(T.createdAt).toLocaleDateString()]}),(0,t.jsxs)("div",{style:{borderLeft:".5px solid rgba(30,41,59,.5)",paddingLeft:7,marginBottom:8,fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.5)",lineHeight:1.55},children:['"',T.anchorText,'"']}),(0,t.jsx)("div",{style:{fontFamily:i.font.sans,fontSize:i.font.ramp.body,color:i.text.secondary,lineHeight:1.65,marginBottom:10},children:T.body}),T.kernel?(0,t.jsxs)("div",{style:{paddingTop:8,borderTop:".5px solid rgba(30,41,59,.3)"},children:[(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".1em",color:T.hardened?`${r}44`:`${d}44`,textTransform:"uppercase",marginBottom:4},children:T.hardened?"💎 Hardened":"☽ Kernel"}),(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.body,color:T.hardened?`${r}dd`:`${d}dd`,lineHeight:1.55},children:T.kernel.replace(/\*\*|#{1,3} /g,"")}),!T.hardened&&(0,t.jsx)("button",{onClick:()=>ex(T.id),style:{...f(r),fontSize:i.font.ramp.label,padding:"3px 9px",marginTop:6},children:"💎 Harden"})]}):(0,t.jsx)("button",{onClick:async()=>{let e=await fetch(`/api/annotations/${T.id}/shavasana`,{method:"POST"}),t=await e.json();t.ok&&R(e=>e.map(e=>e.id===T.id?{...e,kernel:t.kernel}:e))},style:{...f(d),fontSize:i.font.ramp.label,padding:"4px 12px"},children:"☽ Distill →"})]}),S.length>1&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,paddingBottom:6},children:[(0,t.jsx)("button",{onClick:()=>q(e=>Math.max(0,e-1)),disabled:0===v,style:{...f(),fontSize:i.font.ramp.label,padding:"3px 10px",opacity:0===v?.3:1},children:"← prev"}),(0,t.jsx)("div",{style:{flex:1,display:"flex",justifyContent:"center",gap:4},children:S.map((e,n)=>(0,t.jsx)("div",{onClick:()=>q(n),style:{width:n===v?16:5,height:5,borderRadius:n===v?2:"50%",background:n===v?`${r}bb`:"rgba(30,41,59,.45)",cursor:"pointer",transition:"all .15s"}},n))}),(0,t.jsx)("button",{onClick:()=>q(e=>Math.min(S.length-1,e+1)),disabled:v===S.length-1,style:{...f(r),fontSize:i.font.ramp.label,padding:"3px 10px",opacity:v===S.length-1?.3:1},children:"next →"})]})]}),(0,t.jsx)("div",{style:{height:".5px",background:"rgba(30,41,59,.3)"}})]})),0===eT.length&&(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.3)",textAlign:"center",marginTop:24,lineHeight:1.7},children:O?`${c[O]} Select text to annotate`:"Select an instrument\nto begin annotating"}),eT.map(e=>{let n=p[e.type],o=W.has(e.id),l=G.has(e.id),a=e.kernel?e.kernel.replace(/\*\*|#{1,3} /g,""):null;return(0,t.jsxs)("div",{style:{borderLeft:`3px solid ${n}`,paddingLeft:14,paddingTop:10,paddingBottom:10,marginBottom:10},children:[(0,t.jsxs)("div",{onClick:()=>{var t;return t=e.id,void U(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},style:{cursor:"pointer",display:"flex",alignItems:"flex-start",gap:6},children:[(0,t.jsxs)("div",{style:{flex:1},children:[(0,t.jsx)("div",{style:{fontFamily:i.font.sans,fontSize:i.font.ramp.body,fontWeight:500,color:i.text.primary,lineHeight:1.6},children:e.body}),(0,t.jsxs)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.45)",lineHeight:1.45,marginTop:4},children:['"',e.anchorText.slice(0,60),e.anchorText.length>60?"…":"",'" · ',new Date(e.createdAt).toLocaleDateString("en-US",{month:"short",day:"numeric"})]}),!o&&a&&(0,t.jsxs)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:e.hardened?`${r}77`:`${d}66`,lineHeight:1.45,marginTop:5},children:[e.hardened?"💎 ":"☽ ",a.slice(0,80),a.length>80?"…":""]})]}),(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.3)",paddingTop:2,flexShrink:0},children:o?"▲":"▼"})]}),o&&(0,t.jsxs)("div",{style:{marginTop:8,paddingTop:8,borderTop:".5px solid rgba(30,41,59,.3)"},children:[a?(0,t.jsxs)("div",{style:{marginBottom:8},children:[(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".1em",color:e.hardened?`${r}55`:`${d}55`,textTransform:"uppercase",marginBottom:4},children:e.hardened?"💎 Hardened":"☽ Kernel"}),(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.body,color:e.hardened?`${r}cc`:`${d}bb`,lineHeight:1.6},children:a})]}):(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),eg(e)},disabled:l,style:{...f(d),fontSize:i.font.ramp.label,padding:"4px 10px",marginBottom:8,opacity:l?.5:1},children:l?"distilling…":"☽ Distill kernel"}),(0,t.jsxs)("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[a&&!e.hardened&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),ex(e.id)},style:{...f(r),fontSize:i.font.ramp.label,padding:"3px 8px"},children:"💎 Harden"}),(0,t.jsx)("div",{style:{flex:1}}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),em(e.id)},style:{...f(s),fontSize:i.font.ramp.label,padding:"2px 7px"},children:"✕"})]})]})]},e.id)})]}),(0,t.jsxs)("div",{style:{padding:"11px 14px",borderTop:".5px solid rgba(30,41,59,.35)",flexShrink:0,display:"flex",flexDirection:"column",gap:6},children:[(0,t.jsx)("div",{style:{display:"flex",gap:4},children:["THOUGHT","COMMENT","REACTION"].map(e=>{let n=O===e,o=p[e];return(0,t.jsx)("button",{onClick:()=>{$(t=>t===e?null:e),A(null)},style:{flex:1,fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,padding:"7px 4px",borderRadius:i.radius.xs,cursor:"pointer",border:`.5px solid ${n?`${o}50`:"rgba(30,41,59,.25)"}`,background:n?`${o}12`:"rgba(10,15,26,.4)",color:n?`${o}cc`:"rgba(71,85,105,.5)",letterSpacing:".04em",textTransform:"uppercase"},children:c[e]},e)})}),O&&(0,t.jsxs)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:`${p[O]}66`,textAlign:"center",letterSpacing:".06em"},children:[c[O]," Select text to annotate · Esc to cancel"]}),(0,t.jsxs)("div",{style:{display:"flex",gap:4,alignItems:"stretch"},children:[(0,t.jsxs)("button",{onClick:eh,disabled:0===L.length||X,style:{...f(d),fontSize:i.font.ramp.label,padding:"6px 12px",flex:2,justifyContent:"center",opacity:0===L.length?.3:1},children:["📿 ",X?"Synthesizing…":"Meditate"]}),(0,t.jsxs)("button",{onClick:()=>Y(e=>!e),disabled:0===L.length,"aria-expanded":K,style:{...f(K?r:void 0),fontSize:i.font.ramp.label,padding:"6px 12px",flex:1,justifyContent:"center",opacity:0===L.length?.3:1},children:["☽ Shavasana ",(0,t.jsx)("span",{style:{opacity:.6},children:K?"▴":"▾"})]})]})]})]}),(0,t.jsx)("div",{style:{cursor:C?"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ctext y='23' font-size='22'%3E%F0%9F%94%A6%3C/text%3E%3C/svg%3E\") 3 3, text":void 0,WebkitTouchCallout:C?"none":void 0},children:h})]}),!C&&z&&(0,t.jsx)("div",{style:{position:"sticky",bottom:0,background:"rgba(6,10,18,.88)",borderTop:".5px solid rgba(30,41,59,.25)",zIndex:40},children:(0,t.jsxs)("div",{style:{padding:"7px 14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsxs)("button",{onClick:()=>b?k.push(b):(w(!0),E(!0)),style:{...f(r),fontSize:i.font.ramp.label,padding:"4px 13px",gap:6},children:[(0,t.jsx)("span",{style:{fontSize:i.font.ramp.label},children:"◎"}),(0,t.jsx)("span",{children:"Reflect"}),(0,t.jsx)("span",{style:{opacity:.45,marginLeft:2,fontSize:i.font.ramp.label},children:b?"→":"↑"})]}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[(0,t.jsxs)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.4)",letterSpacing:".06em"},children:[L.length," annotation",1!==L.length?"s":""]}),(0,t.jsx)("button",{onClick:()=>{E(!1),b&&k.back()},style:{background:"none",border:"none",padding:"2px 4px",cursor:"pointer",fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.5)",lineHeight:1},title:"Dismiss reflect bar",children:"✕"})]})]})}),el&&(0,t.jsxs)("div",{ref:ep,style:{position:"fixed",top:el.y,left:el.x,width:264,zIndex:60,background:"rgba(8,12,20,.95)",border:".5px solid rgba(30,41,59,.5)",borderRadius:i.radius.sm,overflow:"hidden",boxShadow:"0 4px 24px rgba(0,0,0,.5), 0 0 0 .5px rgba(0,240,255,.06)"},children:[(0,t.jsx)("div",{style:{height:".5px",background:"linear-gradient(90deg,transparent,rgba(0,240,255,.2) 30%,rgba(0,240,255,.2) 70%,transparent)"}}),(0,t.jsxs)("div",{style:{padding:"7px 12px 6px",borderBottom:".5px solid rgba(30,41,59,.3)",fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.5)",lineHeight:1.4},children:['"',el.anchorText.slice(0,48),el.anchorText.length>48?"…":"",'"']}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr"},children:[{type:"THOUGHT",emoji:"💭",label:"Thought",key:"~",color:r},{type:"COMMENT",emoji:"💬",label:"Comment",key:"!",color:a},{type:"REACTION",emoji:"🗯️",label:"React",key:"@",color:s}].map(({type:e,emoji:n,label:o,key:l,color:r},a)=>(0,t.jsxs)("button",{onClick:()=>ec(e),style:{background:"transparent",border:"none",borderRight:a<2?".5px solid rgba(30,41,59,.3)":"none",cursor:"pointer",padding:"10px 6px 9px",display:"flex",flexDirection:"column",alignItems:"center",gap:5,transition:"background .12s"},onMouseEnter:e=>{e.currentTarget.style.background=`${r}0c`},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:[(0,t.jsx)("span",{style:{fontSize:20,lineHeight:1},children:n}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".05em",color:`${r}bb`,textTransform:"uppercase"},children:o}),(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.4)",letterSpacing:".02em"},children:l})]})]},e))})]}),M&&O&&(0,t.jsxs)("div",{style:{position:"absolute",top:M.y,left:Math.min(M.x,window.innerWidth-280),width:268,background:"rgba(6,10,18,.97)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",border:`.5px solid ${p[O]}40`,borderRadius:i.radius.sm,padding:12,zIndex:50,boxShadow:"0 8px 32px rgba(0,0,0,.7), 0 0 0 .5px rgba(0,0,0,.4)"},children:[(0,t.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,height:".5px",background:`linear-gradient(90deg,transparent,${p[O]}33 40%,${p[O]}33 60%,transparent)`}}),(0,t.jsxs)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".1em",color:`${p[O]}cc`,textTransform:"uppercase",marginBottom:7},children:[c[O]," ",O]}),(0,t.jsxs)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(148,163,184,.6)",borderLeft:`.5px solid ${p[O]}30`,paddingLeft:8,marginBottom:10,lineHeight:1.5},children:['"',M.anchorText.slice(0,70),M.anchorText.length>70?"…":"",'"']}),"REACTION"===O?(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},children:m.map(e=>(0,t.jsx)("button",{onClick:()=>ef(e),style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,padding:"5px 8px",border:`.5px solid ${i.border.subtle}`,borderRadius:3,background:"transparent",color:i.text.secondary,cursor:"pointer",textAlign:"center"},children:e},e))}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("textarea",{value:I,onChange:e=>N(e.target.value),maxLength:400,autoFocus:!0,placeholder:`Your ${O.toLowerCase()}…`,onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&ef()},style:{width:"100%",background:"rgba(10,15,26,.8)",border:`.5px solid ${i.border.subtle}`,borderRadius:i.radius.xs,color:"#e2e8f0",fontFamily:i.font.mono,fontSize:i.font.ramp.label,padding:"6px 8px",resize:"none",height:64,outline:"none",lineHeight:1.4}}),(0,t.jsxs)("div",{style:{marginTop:6,display:"flex",alignItems:"center",gap:4},children:[(0,t.jsx)("div",{style:{flex:1}}),(0,t.jsx)("button",{onClick:()=>{A(null),N("")},style:{...f(),fontSize:i.font.ramp.label,padding:"3px 8px"},children:"Cancel"}),(0,t.jsx)("button",{onClick:()=>ef(),disabled:!I.trim(),style:{...f(r),fontSize:i.font.ramp.label,padding:"3px 10px",opacity:I.trim()?1:.4},children:"Save →"})]})]})]}),B&&(0,t.jsx)("div",{onClick:e=>{e.target===e.currentTarget&&D(null)},style:{position:"fixed",inset:0,background:"rgba(2,4,8,.7)",zIndex:70,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:(0,t.jsxs)("div",{style:{background:"rgba(8,13,22,.96)",border:`.5px solid ${p[B.annotation.type]}20`,borderRadius:i.radius.sm,padding:16,width:"100%",maxWidth:420,position:"relative",overflow:"hidden"},children:[(0,t.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,height:".5px",background:`linear-gradient(90deg,transparent,${p[B.annotation.type]}28 30%,${p[B.annotation.type]}28 70%,transparent)`}}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[(0,t.jsxs)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".1em",color:`${p[B.annotation.type]}88`,textTransform:"uppercase"},children:[c[B.annotation.type]," ",B.annotation.type]}),(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.4)"},children:"·"}),(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.4)"},children:new Date(B.annotation.createdAt).toLocaleDateString()}),B.annotation.linkedRef&&(()=>{let e=null;try{e=JSON.parse(B.annotation.linkedRef)}catch{return null}return e?(0,t.jsxs)("div",{style:{marginLeft:"auto",background:`${a}0a`,border:`.5px solid ${a}33`,borderRadius:10,padding:"1px 7px",display:"flex",gap:4},children:[(0,t.jsx)("span",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,color:`${a}99`},children:e.type.slice(0,3)}),(0,t.jsx)("span",{style:{fontSize:i.font.ramp.label,color:`${a}77`},children:e.label.slice(0,24)})]}):null})()]}),(0,t.jsxs)("div",{style:{borderLeft:".5px solid rgba(30,41,59,.5)",paddingLeft:9,marginBottom:10,fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:"rgba(71,85,105,.5)",lineHeight:1.5},children:['"',B.annotation.anchorText,'"']}),(0,t.jsx)("div",{style:{fontSize:i.font.ramp.label,color:i.text.primary,lineHeight:1.65,marginBottom:14},children:B.annotation.body}),B.annotation.kernel&&(0,t.jsxs)("div",{style:{marginBottom:12,paddingTop:10,borderTop:".5px solid rgba(30,41,59,.35)"},children:[(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,fontWeight:700,letterSpacing:".12em",color:B.annotation.hardened?`${r}55`:`${d}55`,textTransform:"uppercase",marginBottom:5},children:B.annotation.hardened?"💎 Hardened":"☽ Kernel"}),(0,t.jsx)("div",{style:{fontFamily:i.font.mono,fontSize:i.font.ramp.label,color:B.annotation.hardened?`${r}dd`:`${d}dd`,lineHeight:1.55},children:B.annotation.kernel})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[!B.annotation.kernel&&(0,t.jsx)("button",{onClick:()=>eg(B.annotation),disabled:B.distilling,style:{...f(d),fontSize:i.font.ramp.label,padding:"5px 14px",opacity:B.distilling?.6:1},children:B.distilling?"Distilling…":"☽ Distill"}),B.annotation.kernel&&!B.annotation.hardened&&(0,t.jsx)("button",{onClick:()=>ex(B.annotation.id),style:{...f(r),fontSize:i.font.ramp.label,padding:"5px 14px"},children:"💎 Harden"}),(0,t.jsx)("div",{style:{flex:1}}),(0,t.jsx)("button",{onClick:()=>em(B.annotation.id),style:{...f(s),fontSize:i.font.ramp.label,padding:"3px 9px"},children:"Delete"}),(0,t.jsx)("button",{onClick:()=>D(null),style:{...f(),fontSize:i.font.ramp.label,padding:"3px 9px"},children:"Close"})]})]})})]})},"parseLayerSegment",0,function(e){if(!e)return{THOUGHT:!0,COMMENT:!0,REACTION:!0};let t=e.toLowerCase().split("-");return{THOUGHT:t.some(e=>"thoughts"===e||"thought"===e),COMMENT:t.some(e=>"comments"===e||"comment"===e),REACTION:t.some(e=>"reactions"===e||"reaction"===e)}}],4889)}]);