PageSourceSearch

https://www.notalawyer.com/assets/chat-CboM4kpw.js

js notalawyer.com collected 2026-10-04 18:42:03 UTC 40,247 bytes, 23 lines download raw bytes

1import{r as a,j as t,ar as os,ay as is}from"./vendor-CQvDjHCe.js";import{h as _t,j as ls,k as u,u as cs,l as ds,m as us,o as ms,q as hs,r as ps,t as fs,v as xs,w as gs,x as ys,y as kt,D as bs,z as ws,X as He,M as ye,C as vs,E as Ns,a as ne,A as js,F as ks,S as Ct,L as St,G as be,T as Cs,P as Ss,H as Ts,I as Tt}from"./index-HQFlV2ng.js";import{b as Mt}from"./vendor-query-CO2d5N1l.js";import{u as Es}from"./index-DT2Aan2H.js";import{c as Pt,$ as Dt,a0 as Rs,a1 as As,a2 as It,a3 as Ls}from"./vendor-radix-B1QfMPj_.js";import{S as _s}from"./switch-DrPxixoS.js";import{AuthModal as Ms}from"./auth-modal-DDC_LtUl.js";import{C as Ps,p as Ds}from"./print-document-DtaXZObB.js";import{S as Is}from"./share-menu-DrWDcMv5.js";import{E as Os}from"./email-not-verified-inline-BgNB-uEL.js";import{S as Fs}from"./saved-record-list-DNhTXp5S.js";import{t as ve}from"./analytics-CWOe1EJH.js";import{p as Us}from"./practice-areas-lnNmaN91.js";import{C as Ws}from"./circle-check-CI3S8FNs.js";import{M as $s}from"./messages-square-CK_dxsKt.js";import{H as Et}from"./vendor-date-CCaikUO-.js";import{C as qs}from"./key-round-BUywcYZQ.js";import{M as Qe,r as ze}from"./vendor-markdown-BuTnfjSR.js";import{P as Hs}from"./pen-line-Booybf1k.js";import{A as Qs}from"./arrow-down-MRwR61e1.js";import{S as zs}from"./send-mUNsWa-K.js";import{G as Ys}from"./gavel-Cqc3Yb9e.js";import{C as Gs}from"./copy-DVeumATe.js";import"./input-x2dvDuHX.js";import"./label-Byv3DySB.js";import"./tabs-BwfBWin7.js";import"./radio-group-Bi8pUo67.js";import"./password-strength-meter-DgspjSZS.js";import"./mail-check-BsrnInZq.js";import"./circle-alert-V1cUkBwA.js";import"./eye-off-ZTeeH6kH.js";import"./eye-BXS_21sb.js";import"./triangle-alert-CM3QbSvq.js";import"./phone-An6POoON.js";import"./globe-yJnmf88j.js";import"./use-mobile-CRXE7QQr.js";import"./social-intents-BdkgwDzg.js";import"./share-2-K5YfYEm-.js";import"./mail-BVXxIWL1.js";import"./arrow-left-VcouEFue.js";import"./email-verification-presence-kZZCOt-b.js";import"./delete-confirm-button-Cy21SUXG.js";import"./trash-2-CUSNBQvb.js";import"./pencil-B-GbFHtb.js";import"./seo-pages-DJw3K49l.js";import"./clock-DGjOXS1J.js";import"./dollar-sign-Cp_SsmN-.js";import"./landmark-D4vzMc0N.js";import"./hand-coins-BGdNoFRW.js";import"./shield-alert-CMwRXxXC.js";const Ks=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Bs=Pt("panel-right-close",Ks);const Js=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Vs=Pt("panel-right-open",Js);function Xs({conversationId:l,onFinish:m,onError:g}){const[r,p]=a.useState(!1),[S,y]=a.useState(""),A=Mt(),L=a.useRef(null),je=a.useCallback(async(ke,J,O,V)=>{const T=J??l;if(T)try{p(!0),y(""),L.current=new AbortController;const F=V&&/^[A-Z]{2}$/.test(V)?`?state=${V}`:"",v=await fetch(`/api/openai/conversations/${T}/messages${F}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ke,askMode:O===!0}),signal:L.current.signal,credentials:"include"});if(!v.ok){const _=await v.json().catch(()=>({})),U=new Error(_?.message||_?.error||"Failed to send message");throw U.status=v.status,U.code=_?.code,U}if(!v.body)throw new Error("No response body");const Q=v.body.getReader(),ie=new TextDecoder;let b="";for(;;){const{done:_,value:U}=await Q.read();if(_)break;const Ce=ie.decode(U,{stream:!0}).split(`
2`);for(const k of Ce)if(k.startsWith("data: ")&&k!=="data: [DONE]")try{const d=JSON.parse(k.slice(6));if(d.content&&(b+=d.content,y(b)),d.done)break}catch(d){console.warn("Failed to parse SSE chunk",k,d)}}await Promise.all([A.invalidateQueries({queryKey:_t(T)}
2),A.invalidateQueries({queryKey:ls(T)}),A.invalidateQueries({queryKey:["/api/openai/conversations"]})]),m?.()}catch(F){const v=F;v.name!=="AbortError"&&(console.error("Chat stream error:",v),g?.(v))}finally{p(!1),y("")}},[l,A,m,g]),I=a.useCallback(()=>{L.current&&L.current.abort()},[]);return{sendMessage:je,isStreaming:r,currentStream:S,stopStream:I}}const Ke=a.forwardRef(({className:l,children:m,scrollbarVisibility:g="hover",...r},p)=>t.jsxs(Dt,{ref:p,...g==="always"?{type:"always"}:{},className:u("relative overflow-hidden",l),...r,children:[t.jsx(Rs,{className:"h-full w-full rounded-[inherit]",children:m}),g==="always"?t.jsx(Be,{forceMount:!0,"data-scrollbar-visibility":"always",className:"border-l-border/40 bg-muted/40"}):t.jsx(Be,{}),t.jsx(As,{})]}));Ke.displayName=Dt.displayName;const Be=a.forwardRef(({className:l,orientation:m="vertical",...g},r)=>t.jsx(It,{ref:r,orientation:m,className:u("flex touch-none select-none transition-colors",m==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",m==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",l),...g,children:t.jsx(Ls,{className:"relative flex-1 rounded-full bg-border"})}));Be.displayName=It.displayName;const Zs=/\b(kill (myself|me)|suicid|end (my|it all) (life|tonight)|going to die|harm myself|hurting myself|want to die|cutting myself|overdos)/i,ea=/\b(beat(en|ing)? (me|us|the kids?)|hit(ting)? me|domestic (violence|abuse)|restrain(ing)? order|protective order|stalking me|sexual(ly)? assault|raped?|child abuse|threatened to (kill|hurt|shoot)|he\s+hits|she\s+hits|trafficking|kidnap)/i,ta=/\b(in danger right now|he('s| is) (here|coming|outside)|she('s| is) (here|coming|outside)|gun (in|on)|with a (gun|knife|weapon)|breaking in|just attacked|hiding (in|from))/i;function sa(l){return!l||l.length<4?null:ta.test(l)?"danger":Zs.test(l)?"mental_health":ea.test(l)?"abuse":null}const Ot="/";function aa(l){return Us.find(m=>m.slug===l)?.lawyerIssueQuery??""}function Ye(l){const[m,g]=a.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(l).matches:!1);return a.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(l),p=()=>g(r.matches);return p(),r.addEventListener("change",p),()=>r.removeEventListener("change",p)},[l]),m}const we=120,re=360,Ne=300,Je=560,Rt="nal-chat-notes-width",At=16;function oe(l){return Math.min(Je,Math.max(Ne,Math.round(l)))}async function na(l){try{const m=await fetch(`${Ot}api/openai/summarize-for-search`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({messages:l})});return m.ok&&(await m.json()).keywords||""}catch{return""}}const Ge="rounded-full h-10 px-4 gap-1.5 text-sm font-semibold border-line bg-paper text-ink-soft shadow-sm transition-colors hover:bg-sage-pale/40 hover:text-ink hover:border-sage/60",ra="rounded-full h-10 px-5 gap-2 text-sm font-semibold bg-sage-deep text-white shadow-sm transition-colors hover:bg-sage-deep/90";function Lt({text:l,source:m,testid:g,idleAria:r,doneAria:p,title:S}){const[y,A]=a.useState(!1);return t.jsxs("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(l),A(!0),ve("share_action",{source:m,action:"copy_text"}),setTimeout(()=>A(!1),2e3)}catch{}},"aria-label":y?p:r,title:S,"data-testid":g,className:"inline-flex items-center gap-1.5 rounded-lg px-2 py-1 text-xs font-medium text-muted-foreground/80 hover:text-foreground hover:bg-cream-2/70 transition-colors",children:[y?t.jsx(Ts,{className:"w-3.5 h-3.5"}):t.jsx(Gs,{className:"w-3.5 h-3.5"}),y?"Copied":"Copy"]})}function rn(){cs({title:"AI Legal Chat",description:"Ask your legal question and get a plain-English answer in seconds. Covers landlord-tenant, employment, family law, and more.",canonical:"/chat"});const[,l]=os(),m=is(),g=Mt(),[r,p]=a.useState(null),[S,y]=a.useState(""),[A,L]=a.useState(!1),[je,I]=a.useState(!1),[ke,J]=a.useState(!1),[O,V]=a.useState(!0),[T,F]=a.useState("split"),{state:v}=ds(),[Q,ie]=a.useState(!1),[b,_]=a.useState("chat"),U=!Ye("(min-width: 640px)"),Ve=Ye("
2(min-width: 1024px)"),Ce=Ye("(max-height: 640px)"),k=U||Ce||!Ve?"tabbed":"columns",d=k==="tabbed",le=k==="columns",[N,ce]=a.useState(null),[Xe,Ze]=a.useState(!1),[et,W]=a.useState(null),[tt,Ft]=a.useState([]),st=a.useRef(null),z=a.useRef(null),[Ut,Se]=a.useState(!1),Te=async e=>{W(null);const s=/^image\/(jpeg|jpg|png|webp|heic|heif)$/i;if(e.type!=="application/pdf"&&!s.test(e.type)){W("Attach a PDF or image (JPG, PNG, WEBP, HEIC).");return}if(e.size>15*1024*1024){W("That file is over 15 MB.");return}z.current?.abort();const n=new AbortController;z.current=n,Ze(!0);try{const i=new FormData;i.append("file",e),i.append("dontSave","true");const c=await fetch(`${Ot}api/documents/analyze-file`,{method:"POST",body:i,credentials:"include",signal:n.signal}),o=await c.json().catch(()=>({}));if(!c.ok||!o.result){W(o.error||"Couldn't analyze that file.");return}ce({fileName:e.name,docType:o.result.detectedType??"generic",extractedText:o.extractedText??"",summary:o.result.plainEnglishSummary??"",keyTerms:o.result.keyTerms??[],concerns:(o.result.concerns??[]).length})}catch(i){if(i instanceof DOMException&&i.name==="AbortError")return;console.error("Chat attachment upload failed:",i),W("Upload failed — try again.")}finally{z.current===n&&(z.current=null,Ze(!1))}},Wt=()=>{z.current?.abort()};a.useEffect(()=>{let e=null;try{e=sessionStorage.getItem("nal-chat-staged-doc")}catch{e=null}if(!e)return;try{sessionStorage.removeItem("nal-chat-staged-doc")}catch{}let s;try{s=JSON.parse(e)}catch{return}s.draft&&y(s.draft);const n=s.url;n&&(async()=>{try{const c=await(await fetch(n)).blob(),o=new File([c],s.name||"document",{type:s.type||c.type});await Te(o)}catch{}finally{try{URL.revokeObjectURL(n)}catch{}}})()},[]),a.useEffect(()=>()=>z.current?.abort(),[]);const[Ee,at]=a.useState(null),[$,Re]=a.useState(null),[E,Ae]=a.useState(null),[$t,nt]=a.useState(!1),[X,Z]=a.useState(()=>{if(typeof window>"u")return re;try{const e=window.localStorage.getItem(Rt),s=e==null?NaN:Number(e);return Number.isFinite(s)?oe(s):re}catch{return re}}),Y=a.useRef(null),de=e=>{try{window.localStorage.setItem(Rt,String(e))}catch{}},ee=a.useRef(null),te=a.useRef(""),ue=a.useRef(null),me=a.useRef(null),M=a.useRef(!0),j=a.useRef(!1),Le=a.useRef(!1),se=a.useRef(0),he=a.useRef(null),_e=a.useRef(!1),rt=a.useRef(void 0),ot=a.useRef("chat"),it=a.useRef("split"),lt=a.useRef(void 0),Me=a.useRef(null),Pe=a.useRef(!1),De=a.useRef(!1),pe=a.useRef(!1),{data:G}=us(),qt=!G?.isAuthenticated,{data:w}=ms(),{data:C}=hs(r,{query:{enabled:!!r,queryKey:_t(r)}});ps({limit:3}),a.useEffect(()=>{G?.isAuthenticated&&Ee&&(l(Ee),at(null))},[G?.isAuthenticated,Ee,l]);const{mutateAsync:ct,isPending:K}=fs(),Ie=xs({mutation:{onSuccess:()=>{g.invalidateQueries({queryKey:Tt()})}}}),Oe=gs({mutation:{onSuccess:()=>{g.invalidateQueries({queryKey:Tt()})}}}),{toast:dt}=ys(),Fe=Es({onUnauthenticated:()=>L(!0),onEmailNotVerified:()=>J(!0),onForbidden:()=>I(!0),onRateLimited:e=>{const s=e.message&&e.message!=="rate_limited";dt({title:s?"Hold on":"You're sending messages too fast",description:s?e.message:"Give it a few seconds and try again.",variant:"destructive"})},onOther:e=>{dt({title:"Couldn't send your message",description:e.message&&e.message!=="Failed to send message"?e.message:"Something went wrong on our end. Please try again in a moment.",variant:"destructive"})}}),{sendMessage:ut,isStreaming:f,currentStream:ae}=Xs({conversationId:r,onFinish:()=>{},onError:e=>Fe(e)}),D=new URLSearchParams(m).get("q")||"";a.useEffect(()=>{const s=new URLSearchParams(m).get("area")||"";s&&(te.current=s)},[]),a.useEffect(()=>{if(!D||De.current||K||w===void 0)return;De.current=!0,M.current=!1,j.current=!0,se.current=0,Re(D);const e=()=>window.history.replaceState(null,"",window.location.pathname);(async()=>{try{const n=(await ct({data:{title:D.slice(0,60)}})).id;he.current=n,p(n),e(),await ut(D,n,O,v)}catch(s){y(D),e(),Re(null),j.current=!1,M.current=!0,Fe(s),De.current=!1}})()},[D,w,qt]),a.useEffect(()=>{pe.current||!D&&!r&&w&&w.length>0&&p(w[0].id)},[w,r,D]),a.useEffect(()=>{F("split")},[r]),a.useEffect(()=>{const e=me.current?.querySelector("[data-radix-scroll-area-viewport]");if(!e)return;const s=()=>{const n=e.scrollHeight-e.scrollTop-e.clientHeight;Le.current?Le.current=!1:j.current&&n<we||(M.current=n<we,j.current=!1),nt(n>we)};return e.addEventListener("scroll",s,{passive:!0}),()=>e.removeEventListener("scroll",s)},[]),a.useEffect(()=>{const e=C?.messages??[],s=!_e.current&&f,n=_e.current&&!f;_e.current=f;const i=rt.current!==r;rt.current=r;const c=ot.current!==b||it.current!==T||lt.current!==k;ot.current=b,it.current=T,lt.current=k;const o=me.current?.querySelector("[data-radix-scroll-area-viewport]");if(!o)return;const R=()=>{o.scrollTop=o.scrollHeight},h=()=>nt(o.scrollHeight-o.scrollTop-o.clientHeight>we);if(s&&(se.current=e.length),i&&!(j.current&&(E?.convoId===r||$!=null))){j.current=!1,M.current=!0,R(),h();return}if(j.current){const ge=o.querySelector("[data-chat-last-user]");if(ge){M.current=!1;const jt=ge.getBoundingClientRect().top-o.getBoundingClientRect().top;if(jt>2){const rs=o.scrollTop;o.scrollTop+=jt,o.scrollTop!==rs&&(Le.current=!0),ge.getBoundingClientRect().top-o.getBoundingClientRect().top<=2&&(j.current=!1)}else j.current=!1}n&&(j.current=!1),h();return}if(f){M.current&&R(),h();return}if(c){R(),h();return}M.current&&R(),h()},[C?.messages,ae,f,O,b,$,E,T,r,k]),a.useEffect(()=>{if(!E||E.convoId!==r)return;const e=C?.messages??[];e.length>se.current&&e.some(s=>s.role==="user")&&Ae(null)},[C?.messages,E,r]);const mt=f||K;a.useEffect(()=>{if(mt||!Pe.current||(Pe.current=!1,!kt()))return;const e=Me.current;if(!e)return;const s=document.activeElement;s&&s!==document.body&&s!==e||e.focus()},[mt]),a.useEffect(()=>{if(!$)return;(ae.length>0||(C?.messages||[]).some(s=>s.role==="user"&&s.content===$))&&Re(null)},[$,ae,C?.messages]);function Ht(e){G?.isAuthenticated?l(e):(at(e),L(!0))}const Qt=async e=>{if(e.preventDefault(),!S.trim()&&!N||f)return;const s=N,n=S.trim()||(s?"Help me understand this document.":""),i=s?`[Attached document "${s.fileName}" (${s.docType}). Extracted text:
3${s.extractedText.slice(0,8e3)}
4]
5
6${n}`:S;try{let c=r;if(c||(c=(await ct({data:{title:n.slice(0,60)||s?.fileName||"New chat"}})).id,p(c),pe.current=!1),s){const o=x.filter(R=>R.role==="user").length+1;Ft(R=>[...R,{id:`${Date.now()}-${s.fileName}`,afterUserMessageCount:o,fileName:s.fileName,docType:s.docType,summary:s.summary,keyTermsCount:s.keyTerms.length,concerns:s.concerns}])}y(""),ce(null),W(null),J(!1),M.current=!1,j.current=!0,se.current=(C?.messages??[]).length,he.current=c,Ae({convoId:c,text:n}),Pe.current=!0,await ut(i,c,O,v)}catch(c){Ae(null),j.current=!1,M.current=!0,y(o=>o||i),Fe(c)}},x=C?.messages||[],zt=async()=>
6{if(ee.current)return ee.current;if(te.current){const n=aa(te.current);if(n)return ee.current=n,n}const e=x.map(n=>({role:n.role,content:n.content}));if(e.length===0)return"";const s=await na(e);return s&&(ee.current=s),s};a.useEffect(()=>{if(ee.current=null,!!te.current){if(ue.current===null){r!=null&&(ue.current=r);return}r!==ue.current&&(te.current="",ue.current=null)}},[r]);const q=e=>e.replace(/\[NEEDS_LAWYER:[^\]]*\]/gi,"").replace(/\[LAWYER_TRIGGER:[^\]]*\]/gi,"").replace(/\[SUMMARY:[^\]]*\]/gi,"").replace(/\[RISK:[^\]]*\]/gi,"").replace(/\[FOLLOWUPS:[^\]]*\]/gi,"").replace(/\[LETTER_TYPE:[^\]]*\]/gi,"").replace(/\[FOLLOWUP_Q:[^\]]*\]/gi,"").replace(/\[(NEEDS_LAWYER|LAWYER_TRIGGER|SUMMARY|RISK|FOLLOWUPS|LETTER_TYPE|FOLLOWUP_Q)[^\]]*$/i,"").replace(/^[ \t]*#{1,6}[ \t]*$/gm,"").replace(/[ \t]+#{1,6}[ \t]*$/gm,"").replace(/^([ \t]*(?:\d+\.|[-*]))[ \t]+#{1,6}[ \t]*$/gm,"").replace(/\n{3,}/g,`
7
8`).trim(),ht=e=>{const s=e.match(/\[FOLLOWUP_Q:\s*([^\]]+)\]/i);return s?s[1].trim():null},pt=x.filter(e=>e.role==="assistant");let ft=-1;for(let e=x.length-1;e>=0;e--)if(x[e].role==="assistant"){ft=e;break}let xt=-1;for(let e=x.length-1;e>=0;e--)if(x[e].role==="user"){xt=e;break}const Ue=f&&he.current===r?x.slice(0,se.current):x,We=pt.flatMap(e=>{const s=e.content.match(/\[NEEDS_LAWYER:([^\]]*)\]/i);return s?[s[1].trim()]:[]})[0]??null;function Yt(e){return/\[(NEEDS_LAWYER|LETTER_TYPE)\b/i.test(e)?!1:q(e).trim().length<700}const fe=x[x.length-1],Gt=!!fe&&fe.role==="assistant"&&Yt(fe.content),xe=pt.flatMap(e=>{const s=e.content.match(/\[LETTER_TYPE:\s*([^\]]+)\]/i);return s?[s[1].trim()]:[]})[0]??null,gt=xe?{"demand letter":"demand","security deposit demand letter":"demand","security deposit":"demand","cease and desist":"cease_and_desist","cease and desist letter":"cease_and_desist","notice to landlord":"landlord_notice","landlord notice":"landlord_notice","contract cancellation":"contract_cancellation","contract cancellation letter":"contract_cancellation","debt dispute":"debt_dispute","debt dispute letter":"debt_dispute"}[xe.toLowerCase()]??"demand":null;function Kt(e,s){Oe.mutate({id:e,data:{title:s}})}function Bt(e){Ie.mutate({id:e},{onSuccess:()=>{r===e&&p(null)}})}function Jt(e){pe.current=!1,p(e),ie(!1)}const Vt=e=>{V(e)};async function Xt(){ve("lawyer_cta_click",{source:"chat_action_row",category:We});const e=await zt(),s=new URLSearchParams;e?s.set("issue",e):We&&s.set("category",We);const n=G?.isAuthenticated?G.user?.zipCode:void 0;n&&s.set("location",n),l(`/lawyers?${s.toString()}`)}function Zt(){const e=[...x].reverse().find(n=>n.role==="user")?.content||"";ve("momentum_bridge_yes",{letterType:xe});const s=new URLSearchParams;gt&&s.set("type",gt),e&&s.set("situation",e.slice(0,600)),Ht(`/letters?${s.toString()}`)}const $e=C?.notes??"",B=$e.trim().length>0,yt=T==="notes"&&(!B||le)?"split":T,H=yt==="transcript",bt=yt==="notes",wt=()=>{F(e=>e==="transcript"?"split":"transcript")};a.useEffect(()=>{f&&bt&&F("split")},[f]);const P=r&&C?.title?C.title:"New chat",es=e=>e.replace(/^\[Attached document[\s\S]*?\n\]\n+/,"").trim(),qe=()=>$e.replace(/\*\*/g,"").trim(),ts=e=>{const s=c=>/^\s*\*\*[^*\n]+\*\*\s*$/.test(c),n=e.split(`
9`),i=[];for(let c=0;c<n.length;c++){const o=n[c];s(o)?(i.length>0&&i[i.length-1].trim()!==""&&i.push(""),i.push(o.trim()),c+1<n.length&&n[c+1].trim()!==""&&i.push("")):i.push(o)}return i.join(`
10`).trim()},vt=()=>{const e=[];for(const s of x)if(s.role==="user"){const n=es(s.content);n&&e.push(`You:
11${n}`)}else if(s.role==="assistant"){const n=q(s.content).trim(),i=ht(s.content),c=i?n?`${n}
12
13${i}`:i:n;c&&e.push(`NotALawyer:
14${c}`)}return e.join(`
15
16`)},Nt=()=>{const e=[];return B&&e.push(`NOTES — summary & next steps
17
18${qe()}`),e.push(`CONVERSATION
19
20${vt()}`),e.join(`
21
22
23`)},ss=()=>`notalawyer-${P.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"chat"}`,as=()=>{const e=[];B&&e.push({heading:"Notes — summary & next steps",body:qe()}),e.push({heading:"Conversation",body:vt()}),Ds({title:P,meta:Et(new Date,"MMMM d, yyyy"),sections:e})},ns=()=>{ve("chat_close",{}),pe.current=!0,p(null),_("chat"),y(""),ce(null),W(null),J(!1),setTimeout(()=>{kt()&&Me.current?.focus()},0)};return t.jsxs(t.Fragment,{children:[t.jsx(Ms,{open:A,onOpenChange:L}),t.jsx(bs,{open:je,onOpenChange:I,children:t.jsxs(ws,{className:"sm:max-w-md p-0 gap-0 overflow-hidden rounded-2xl border-0 [&>button:last-child]:hidden",children:[t.jsxs("div",{className:"bg-sage-deep text-primary-foreground p-6 pb-5 relative",children:[t.jsx("button",{type:"button",onClick:()=>I(!1),className:"absolute top-3 right-3 p-1.5 rounded-lg bg-white/15 hover:bg-white/25 transition-colors",children:t.jsx(He,{className:"w-4 h-4 text-primary-foreground
23/80"})}),t.jsx("div",{className:"w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center mb-4",children:t.jsx(ye,{className:"w-6 h-6 text-primary-foreground"})}),t.jsx(vs,{asChild:!0,children:t.jsx("h2",{className:"text-xl font-bold mb-2",children:"You're on a roll!"})}),t.jsx(Ns,{asChild:!0,children:t.jsx("p",{className:"text-primary-foreground/80 text-sm leading-relaxed",children:"Create an account to keep asking questions, save your conversation history, and pick up where you left off."})})]}),t.jsxs("div",{className:"p-6",children:[t.jsx("div",{className:"space-y-2.5 mb-5",children:["Ask as many questions as you need","Save & revisit your answers","Email summaries of your chats","Access from any device"].map(e=>t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Ws,{className:"w-4 h-4 text-teal shrink-0"}),t.jsx("span",{className:"text-sm text-foreground",children:e})]},e))}),t.jsxs(ne,{onClick:()=>{I(!1),L(!0)},className:"w-full bg-sage-deep text-white hover:bg-sage-deep/90 h-12 rounded-xl text-base font-bold shadow-sm mb-3",children:["Create Account ",t.jsx(js,{className:"w-4 h-4 ml-2"})]}),t.jsx("button",{type:"button",onClick:()=>I(!1),className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors py-2",children:"Maybe later"})]})]})}),t.jsxs("div",{"data-testid":"chat-root","data-chat-mode":k,className:u("flex flex-1 min-h-0 flex-col bg-background mx-auto w-full border-x border-border/50 mb-[calc(-5rem_-_env(safe-area-inset-bottom,0px))] sm:mb-0",le?"max-w-7xl":"max-w-3xl"),children:[t.jsxs("div",{className:u("relative flex flex-col shrink-0 border-b border-line/40 bg-cream-2/40",!d&&Q&&w&&w.length>0&&"min-h-0 overflow-hidden shrink grow-[20] basis-0 max-h-max"),children:[w&&w.length>0?t.jsxs("button",{type:"button",onClick:()=>ie(e=>!e),"aria-expanded":Q,className:"w-full flex items-center justify-between gap-3 px-4 py-1.5 text-left hover:bg-cream-2/70 transition-colors","data-testid":"chat-past-chats-trigger",children:[t.jsxs("span",{className:"min-w-0 flex items-center gap-2 text-[13px] text-muted-foreground",children:[t.jsx($s,{className:"w-3.5 h-3.5 text-ink-faint shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"font-medium text-ink-soft shrink-0",children:"Past chats"}),t.jsxs("span",{className:"text-[12px] tabular-nums shrink-0",children:["· ",w.length]}),t.jsx("span",{className:"text-muted-foreground/50 shrink-0 mx-1","aria-hidden":"true",children:"—"}),t.jsx("span",{className:"truncate",title:P,children:P})]}),t.jsx(ks,{className:u("w-3.5 h-3.5 text-muted-foreground/70 shrink-0 transition-transform",!Q&&"-rotate-90"),"aria-hidden":"true"})]}):t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[t.jsx(Ct,{className:"w-3.5 h-3.5 text-ink-faint shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"text-[13px] font-medium text-ink-soft truncate",title:P,children:P})]}),w&&w.length>0&&Q&&t.jsx("div",{className:u("px-3 pb-3 overflow-y-auto border-t border-border/50",d?"max-h-[40vh]":"flex-1 min-h-0"),children:t.jsx(Fs,{accent:"cedar",size:"md",activeId:r,renameLabel:"Rename this chat",deleteLabel:"Delete this chat",renamingId:Oe.isPending?Oe.variables?.id??null:null,deletingId:Ie.isPending?Ie.variables?.id??null:null,onOpen:Jt,onRename:Kt,onDelete:Bt,items:w.map(e=>({id:e.id,title:e.title,dateLabel:Et(new Date(e.createdAt),"MMM d, yyyy"),icon:t.jsx(ye,{className:"w-4 h-4 text-cedar/70 mt-0.5 shrink-0"})}))})})]}),r!=null&&d&&t.jsxs("div",{className:"shrink-0 flex items-stretch gap-1.5 px-3 py-1.5 border-b border-border/50 bg-card/40","data-testid":"chat-tab-bar",children:[t.jsxs("button",{type:"button",onClick:()=>_("chat"),"aria-pressed":b==="chat","data-testid":"chat-tab-conversation",className:u("flex-1 flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-sm font-semibold transition-colors",b==="chat"?"bg-sage-deep text-white shadow-sm":"text-ink-soft hover:bg-sage-pale/40"),children:[t.jsx(ye,{className:"w-4 h-4","aria-hidden":"true"}),"Conversation"]}),t.jsxs("button",{type:"button",onClick:()=>_("notes"),"aria-pressed":b==="notes","data-testid":"chat-tab-notes",className:u("flex-1 flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-sm font-semibold transition-colors",b==="notes"?"bg-sage-deep text-white shadow-sm":"text-ink-soft hover:bg-sage-pale/40"),children:[t.jsx(qs,{className:"w-4 h-4","aria-hidden":"true"}),"Notes",B&&t.jsx("span",{"aria-hidden":"true",className:u("w-1.5 h-1.5 rounded-full",b==="notes"?"bg-white/80":"bg-cedar")})]})]}),t.jsxs("div",{"data-testid":"chat-content-area",className:u(le?"grid min-h-0 grow-[80] shrink basis-0 grid-cols-[minmax(0,1fr)_auto]":"contents"),children:[r!=null&&t.jsxs("div",{"data-testid":"chat-notes-panel",className:u("bg-paper flex-col",d?b==="notes"?"flex flex-1 min-h-0 border-b border-line/50":"hidden":H?"flex order-2 self-start min-h-0 border-l border-line/50":"relative flex order-2 min-h-0 border-l border-line/50"),style:!d&&!H?{width:X}:void 0,children:[!d&&!H&&t.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize notes panel","aria-valuemin":Ne,"aria-valuemax":Je,"aria-valuenow":X,tabIndex:0,"data-testid":"chat-notes-resizer",onPointerDown:e=>{e.button===0&&(Y.current={startX:e.clientX,startWidth:X},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{const s=Y.current;if(!s)return;const n=s.startWidth+(s.startX-e.clientX);if(n<Ne-60){Y.current=null,e.currentTarget.releasePointerCapture(e.pointerId);const i=oe(s.startWidth);Z(i),de(i),wt();return}Z(oe(n))},onPointerUp:e=>{Y.current&&(Y.current=null,e.currentTarget.releasePointerCapture(e.pointerId),Z(s=>(de(s),s)))},onPointerCancel:()=>{Y.current=null},onKeyDown:e=>{let s=null;
23e.key==="ArrowLeft"?s=oe(X+At):e.key==="ArrowRight"?s=oe(X-At):e.key==="Home"?s=Ne:e.key==="End"&&(s=Je),s!=null&&(e.preventDefault(),Z(s),de(s))},onDoubleClick:()=>{Z(re),de(re)},className:"absolute inset-y-0 -left-1 w-2 z-10 cursor-col-resize touch-none select-none focus-visible:outline-none group/resizer",children:t.jsx("div",{className:"h-full w-px mx-auto bg-transparent transition-colors group-hover/resizer:bg-sage/60 group-focus-visible/resizer:bg-sage/80","aria-hidden":"true"})}),!d&&t.jsx("div",{className:"flex items-stretch border-b border-line/50 bg-manila",children:t.jsxs("button",{type:"button",onClick:wt,"aria-expanded":!H,"data-testid":"chat-notes-toggle",className:"flex-1 min-w-0 flex items-center justify-between gap-2 px-4 py-1.5 text-left hover:bg-cream-2/70 transition-colors",children:[t.jsxs("span",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx("span",{className:"inline-flex items-center rounded-[4px] border border-plate bg-plate-face px-2 py-[1px] text-[11px] font-bold uppercase tracking-[0.14em] text-cedar-deep shadow-[inset_0_1px_0_rgba(255,255,255,0.5)]",children:"Notes"}),!(le&&H)&&t.jsx("span",{className:"text-[13px] text-muted-foreground truncate",children:B?"summary & next steps":"nothing yet"})]}),H?t.jsx(Vs,{className:"w-3.5 h-3.5 text-muted-foreground/70 shrink-0","aria-hidden":"true"}):t.jsx(Bs,{className:"w-3.5 h-3.5 text-muted-foreground/70 shrink-0","aria-hidden":"true"})]})}),(d?b==="notes":!H)&&t.jsx(Ke,{scrollbarVisibility:"always",className:"chat-notes-pad flex-1 min-h-0",children:t.jsx("div",{className:"pl-12 pr-4 py-2",children:B?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"prose prose-sm max-w-none chat-notes-body",children:t.jsx(Qe,{remarkPlugins:[ze],children:ts($e)})}),t.jsx("div",{className:"mt-2 flex justify-end",children:t.jsx(Lt,{text:qe(),source:"chat_notes_copy",testid:"chat-notes-copy",idleAria:"Copy notes",doneAria:"Notes copied",title:"Copy notes"})})]}):t.jsxs("div",{className:"py-3",children:[t.jsx("p",{className:"text-[15px] font-medium text-ink-2 [font-family:var(--font-read)]",children:"No notes yet"}),t.jsx("p",{className:"chat-aside mt-1 text-[14.5px] text-ink-faint max-w-[44ch]",children:"As you describe your situation, I'll keep a short summary and possible next steps here so you have a self-contained recap."})]})})})]}),t.jsxs("div",{className:u("relative flex-col min-h-0",d?b==="chat"||r==null?"flex flex-1 min-h-0":"hidden":"flex order-1 min-h-0"),children:[r!=null&&!d&&t.jsx("div",{className:"flex items-stretch border-b border-line/40 bg-sage/[0.04]",children:t.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2 px-4 py-1.5",children:t.jsxs("span",{className:"flex items-center gap-2 text-[13px] font-medium text-ink-soft min-w-0",children:[t.jsx(ye,{className:"w-3.5 h-3.5 text-sage-deep/80 shrink-0"}),"Conversation"]})})}),t.jsx(Ke,{scrollbarVisibility:"always","data-testid":"chat-transcript-scroll",className:u("flex-1 min-h-0","[&_[data-radix-scroll-area-viewport]]:[overflow-anchor:none]",d?"p-3 sm:px-6":"p-4 sm:px-8 sm:py-5",!d&&(bt?"hidden":"block")),ref:me,children:$?t.jsxs("div",{className:"max-w-3xl mx-auto flex flex-col gap-6 pb-2",children:[t.jsxs("p",{className:"text-xs text-muted-foreground/80 text-center flex items-center justify-center gap-1.5",children:[t.jsx("span",{className:"text-sage/70",children:"✦"}),"Starting a fresh question from the home page"]}),t.jsx("div",{className:"flex justify-end","data-chat-last-user":!0,children:t.jsx("div",{className:"max-w-[75%] rounded-2xl rounded-br-md border border-sage/20 bg-sage-pale/50 px-4 py-2.5 text-[14px] leading-relaxed text-ink-soft",children:$})}),t.jsxs("div",{className:"flex items-center gap-2.5",role:"status","aria-live":"polite",children:[t.jsx(St,{className:"w-4 h-4 animate-spin text-sage-deep","aria-hidden":"true"}),t.jsx("span",{className:"chat-aside",children:"Looking that up…"})]})]}):!r&&!K?t.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center py-16 px-6",children:[t.jsx(Ct,{className:"w-9 h-9 mb-5 text-sage","aria-hidden":"true"}),t.jsxs("h1",{className:"text-display text-[1.9rem] sm:text-[2.2rem] text-ink",children:["How can we ",t.jsx("em",{children:"help"}),"?"]}),t.jsx("p",{className:"chat-aside max-w-md mt-3",children:"Tell us what's going on, in your own words — we'll walk through it together in plain English, and keep notes as we go."})]}):t.jsxs("div",{className:"max-w-3xl mx-auto flex flex-col gap-6 pb-2",children:[(()=>{const e=x.filter(s=>s.role==="user");for(let s=e.length-1;s>=0;s--){const n=sa(e[s].content);if(n)return t.jsx(Ps,{variant:n,defaultOpen:!0})}return null})(),Ue.map((e,s)=>{const n=Ue.slice(0,s+1).filter(h=>h.role==="user").length,i=e.role==="user"?tt.filter(h=>h.afterUserMessageCount===n):[],c=e.role==="assistant"&&!(f&&s===Ue.length-1)&&q(e.content).trim().length>0,o=e.role==="assistant"?ht(e.content):null,R=O&&!f&&s===ft&&!!o;return t.jsxs("div",{className:"flex flex-col gap-2",children:[i.map(h=>t.jsxs("div",{"data-testid":`chat-attachment-card-${h.id}`,className:"self-end max-w-[85%] rounded-xl border border-sage/30 bg-sage/[0.05] p-3 flex items-start gap-3",children:[t.jsx(be,{className:"w-4 h-4 text-sage-deep shrink-0 mt-0.5"}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"text-sm font-semibold truncate",children:h.fileName}),t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-bold px-1.5 py-0.5 rounded bg-sage/15 text-sage-deep",children:h.docType})]}),h.summary&&t.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:h.summary}
23),t.jsxs("p",{className:"text-[11px] text-muted-foreground/80 mt-1",children:[h.keyTermsCount," key terms · ",h.concerns," concerns"]})]})]},h.id)),e.role==="user"?t.jsx("div",{className:"flex justify-end",...s===xt&&!(E&&E.convoId===r)?{"data-chat-last-user":!0}:{},children:t.jsx("div",{className:"max-w-[75%] rounded-2xl rounded-br-md border border-sage/20 bg-sage-pale/50 px-4 py-2.5 text-[14px] leading-relaxed text-ink-soft",children:q(e.content)})}):t.jsxs("div",{className:"min-w-0 flex flex-col gap-1",children:[t.jsx("div",{className:"prose chat-answer",children:t.jsx(Qe,{remarkPlugins:[ze],children:q(e.content)})}),c&&t.jsx("div",{className:"flex -ml-2",children:t.jsx(Lt,{text:q(e.content),source:"chat_answer_copy",testid:"chat-answer-copy",idleAria:"Copy this answer",doneAria:"Answer copied",title:"Copy this answer"})})]}),R&&t.jsxs("div",{className:"mt-1.5 max-w-[68ch] border-l-2 border-cedar/40 pl-4 py-0.5","data-testid":"chat-followup",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.12em] text-cedar mb-1",children:[t.jsx(Hs,{className:"w-3 h-3","aria-hidden":"true"}),"Question for you"]}),t.jsx("p",{className:"chat-aside",children:o})]})]},s)}),E&&E.convoId===r&&t.jsxs(t.Fragment,{children:[tt.filter(e=>e.afterUserMessageCount===x.filter(s=>s.role==="user").length+1).map(e=>t.jsxs("div",{"data-testid":`chat-attachment-card-${e.id}`,className:"self-end max-w-[85%] rounded-xl border border-sage/30 bg-sage/[0.05] p-3 flex items-start gap-3",children:[t.jsx(be,{className:"w-4 h-4 text-sage-deep shrink-0 mt-0.5"}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"text-sm font-semibold truncate",children:e.fileName}),t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-bold px-1.5 py-0.5 rounded bg-sage/15 text-sage-deep",children:e.docType})]}),e.summary&&t.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.summary}),t.jsxs("p",{className:"text-[11px] text-muted-foreground/80 mt-1",children:[e.keyTermsCount," key terms · ",e.concerns," concerns"]})]})]},e.id)),t.jsx("div",{className:"flex justify-end","data-chat-last-user":!0,children:t.jsx("div",{className:"max-w-[75%] rounded-2xl rounded-br-md border border-sage/20 bg-sage-pale/50 px-4 py-2.5 text-[14px] leading-relaxed text-ink-soft",children:E.text})})]}),f&&he.current===r&&t.jsx("div",{className:"min-w-0 flex flex-col",role:"status","aria-live":"polite",children:ae?t.jsx("div",{className:"prose chat-answer chat-caret-host",children:t.jsx(Qe,{remarkPlugins:[ze],children:q(ae)})}):t.jsxs("div",{className:"flex gap-1.5 items-center h-6",children:[t.jsx("div",{className:"w-1.5 h-1.5 bg-sage/60 rounded-full animate-pulse"}),t.jsx("div",{className:"w-1.5 h-1.5 bg-sage/60 rounded-full animate-pulse [animation-delay:0.2s]"}),t.jsx("div",{className:"w-1.5 h-1.5 bg-sage/60 rounded-full animate-pulse [animation-delay:0.4s]"})]})})]})}),$t&&r!=null&&t.jsx("button",{type:"button","data-testid":"chat-jump-latest","aria-label":"Jump to latest",onClick:()=>{const e=me.current?.querySelector("[data-radix-scroll-area-viewport]");e&&(e.scrollTop=e.scrollHeight)},className:"absolute bottom-3 right-5 z-10 flex items-center justify-center w-8 h-8 rounded-full border border-line/60 bg-background/95 text-ink-soft shadow-sm transition-colors hover:text-ink hover:border-sage/50 animate-in fade-in duration-200",children:t.jsx(Qs,{className:"w-4 h-4","aria-hidden":"true"})})]})]}),t.jsxs("div",{className:u("shrink-0 bg-background border-t border-border/50",d?"px-3 py-2":"p-4"),children:[ke&&t.jsx("div",{className:"max-w-3xl mx-auto mb-3",children:t.jsx(Os,{message:"Confirm your email before sending more messages. We need to know the address belongs to you."})}),N&&t.jsxs("div",{className:"max-w-3xl mx-auto mb-2 rounded-xl border border-sage/30 bg-sage/[0.05] p-3 flex items-start gap-3","data-testid":"chat-pending-attachment",children:[t.jsx(be,{className:"w-5 h-5 text-sage-deep shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"text-sm font-semibold truncate",children:N.fileName}),t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-bold px-1.5 py-0.5 rounded bg-sage/15 text-sage-deep",children:N.docType})]}),N.summary&&t.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:N.summary}
23),t.jsxs("p",{className:"text-[11px] text-muted-foreground/80 mt-1",children:[N.keyTerms.length," key terms · ",N.concerns," concerns · ready to discuss"]})]}),t.jsx("button",{type:"button","aria-label":"Remove attachment",onClick:()=>ce(null),className:"text-muted-foreground hover:text-foreground",children:t.jsx(He,{className:"w-4 h-4"})})]}),Xe&&t.jsxs("div",{className:"max-w-3xl mx-auto mb-2 text-xs text-muted-foreground flex items-center gap-2",children:[t.jsx(St,{className:"w-3 h-3 animate-spin"})," Reading your document…",t.jsx("button",{type:"button",onClick:Wt,"data-testid":"chat-attachment-cancel",className:"ml-1 font-semibold text-primary underline underline-offset-2 hover:text-primary/80",children:"Cancel"})]}),et&&t.jsx("div",{className:"max-w-3xl mx-auto mb-2 text-xs text-red-600","data-testid":"chat-attachment-error",children:et}),t.jsx("input",{ref:st,type:"file",accept:"application/pdf,.pdf,image/jpeg,image/png,image/webp,image/heic,image/heif",className:"sr-only",onChange:e=>{const s=e.target.files?.[0];e.target.value="",s&&Te(s)}}),t.jsxs("form",{onSubmit:Qt,className:u("max-w-3xl mx-auto rounded-2xl border border-paper-edge bg-paper px-3 py-2 shadow-sm transition-colors focus-within:border-sage-deep",Ut&&"ring-2 ring-primary/50"),onDragOver:e=>{Array.from(e.dataTransfer.types).includes("Files")&&(e.preventDefault(),Se(!0))},onDragLeave:()=>Se(!1),onDrop:e=>{e.preventDefault(),Se(!1);const s=e.dataTransfer.files?.[0];s&&Te(s)},children:[t.jsx(Cs,{ref:Me,value:S,rows:1,onChange:e=>y(e.target.value),"aria-label":"Ask a legal question or describe your situation",placeholder:"Ask a legal question or describe your situation...",style:{fieldSizing:"content"},className:"w-full border-0 bg-transparent shadow-none resize-none text-base leading-6 px-1 pt-1 min-h-[2.5rem] max-h-40 overflow-y-auto focus-visible:ring-0 focus:outline-none disabled:opacity-50",disabled:f||K,onKeyDown:e=>{if(e.key==="Enter"&&!e.shiftKey){if(e.preventDefault(),f||K||!S.trim()&&!N)return;e.currentTarget.closest("form")?.requestSubmit()}}}),t.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[t.jsx("button",{type:"button","aria-label":"Attach a document to analyze",title:"Analyze a document",onClick:()=>st.current?.click(),disabled:Xe||!!N,className:"shrink-0 h-10 w-10 rounded-xl text-muted-foreground hover:text-primary hover:bg-primary/5 disabled:opacity-50 transition-colors flex items-center justify-center",children:t.jsx(Ss,{className:"w-5 h-5","aria-hidden":"true"})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_s,{id:"chat-ask-mode",checked:O,onCheckedChange:Vt,"aria-label":"Let me follow up — let the assistant ask clarifying questions"}),t.jsx("label",{htmlFor:"chat-ask-mode",className:"text-xs font-medium text-muted-foreground cursor-pointer select-none whitespace-nowrap",title:"When on, I'll ask a clarifying question to better understand your situation.",children:"Let me follow up"})]}),t.jsx(ne,{type:"submit",size:"icon","aria-label":"Send message",disabled:!S.trim()&&!N||f||K,className:"shrink-0 h-10 w-10 rounded-full bg-cedar text-cream hover:bg-cedar-2 transition-colors",children:t.jsx(zs,{className:"w-4 h-4","aria-hidden":"true"})})]})]})]}),r!=null&&x.length>0&&t.jsxs("div",{className:u("max-w-3xl mx-auto flex flex-nowrap items-center justify-center gap-2",d?"mt-2":"mt-2.5"),children:[!f&&fe?.role==="assistant"&&!Gt&&t.jsxs(t.Fragment,{children:[t.jsxs(ne,{type:"button",onClick:Xt,"aria-label":"Find a lawyer",className:u(ra,"max-sm:px-3",d&&"h-9"),children:[t.jsx(Ys,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Find a lawyer"})]}),xe&&t.jsxs(ne,{type:"button",onClick:Zt,"aria-label":"Write a letter about this",className:u(Ge,"max-sm:px-3",d&&"h-9"),children:[t.jsx(be,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Write a letter about this"})]})]}),t.jsx(Is,{source:"chat_thread_share",label:"Share",labelClassName:"hidden sm:inline",align:"end",className:u(Ge,"max-sm:px-3",d&&"h-9"),payload:{title:P,email:{kind:"answer-copy",question:P,answer:Nt()},download:{filenameBase:ss(),docTitle:P,onPdf:as,documentText:Nt()}}}),t.jsxs(ne,{type:"button","aria-label":"Close chat and start fresh",title:"Close",className:u(Ge,"max-sm:px-3",d&&"h-9"),onClick:ns,"data-testid":"chat-close",children:[t.jsx(He,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Close"})]})]}),t.jsx("p",{className:u("max-w-3xl mx-auto text-center text-muted-foreground
23/60",d?"mt-2 text-[10.5px] leading-snug":"mt-2.5 text-[11px] leading-relaxed"),children:"Responses are generated by artificial intelligence and may be inaccurate or incomplete. This is not legal advice. Consult a licensed lawyer for advice regarding your specific situation."})]})]})]})}export{rn 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.