1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13016],{13016:(e,t,s)=>{s.r(t),s.d(t,{AIChatWidget:()=>h,default:()=>x});var r=s(73365),n=s(1521),a=s(28302),l=s(41330);function i({onSend:e,disabled:t=!1,placeholder:s="Ask about EMR systems, AI tools..."}){let[a,l]=(0,n.useState)(""),o=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=o.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,120)}px`)},[a]);let d=()=>{let s=a.trim();s&&!t&&(e(s),l(""),o.current&&(o.current.style.height="auto"))};return(0,r.jsxs)("div",{className:"flex items-end gap-2 p-3 border-t border-border bg-background",children:[(0,r.jsx)("div",{className:"flex-1 relative",children:(0,r.jsx)("textarea",{ref:o,value:a,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),d())},disabled:t,placeholder:s,"aria-label":"Chat message",rows:1,className:"w-full px-3 py-2 border border-border rounded-lg resize-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:border-transparent disabled:bg-surface-1 disabled:cursor-not-allowed text-body-xs",style:{maxHeight:"120px"}})}),(0,r.jsx)("button",{onClick:d,disabled:t||!a.trim(),className:"flex-shrink-0 w-10 h-10 flex items-center justify-center bg-accent text-white rounded-lg hover:bg-accent-800 disabled:bg-surface-2 disabled:cursor-not-allowed transition-colors","aria-label":"Send message",children:t?(0,r.jsxs)("svg",{className:"w-5 h-5 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})}function o({role:e,content:t,isStreaming:s,timestamp:n}){let a="user"===e,l=e=>{let t=[],s=e,n=0;for(;s;){let e=s.match(/\*\*(.+?)\*\*/),a=s.match(/`([^`]+)`/),l=s.match(/\[([^\]]+)\]\(([^)]+)\)/),i=[e?{type:"bold",match:e,index:e.index}:null,a?{type:"code",match:a,index:a.index}:null,l?{type:"link",match:l,index:l.index}:null].filter(Boolean).sort((e,t)=>e.index-t.index);if(0===i.length){t.push(s);break}let{type:o,match:d,index:c}=i[0];if(c>0&&t.push(s.slice(0,c)),"bold"===o)t.push((0,r.jsx)("strong",{className:"font-semibold",children:d[1]},n++));else if("code"===o)t.push((0,r.jsx)("code",{className:"bg-surface-1 px-1 py-0.5 rounded text-body-xs font-mono",children:d[1]},n++));else if("link"===o){let e=d[2]||"",s=d[1]||e;t.push((0,r.jsx)("a",{href:e,className:"text-accent hover:text-accent-800 underline",target:e.startsWith("http")?"_blank":void 0,rel:e.startsWith("http")?"noopener noreferrer":void 0,children:s},n++))}s=s.slice(c+d[0].length)}return 1===t.length&&"string"==typeof t[0]?t[0]:(0,r.jsx)(r.Fragment,{children:t})};return(0,r.jsx)("div",{className:`flex ${a?"justify-end":"justify-start"} mb-3`,children:(0,r.jsxs)("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${a?"bg-accent text-white rounded-br-md":"bg-surface-1 text-foreground rounded-bl-md"}`,children:[(0,r.jsxs)("div",{className:"text-body-xs leading-relaxed",children:[t?t.split(/(```[\s\S]*?```)/g).map((e,t)=>{if(e.startsWith("```")&&e.endsWith("```")){let s=e.slice(3,-3),n=s.indexOf("\n"),a=n>0?s.slice(0,n):"",l=n>0?s.slice(n+1):s;return(0,r.jsx)("pre",{className:"bg-surface-1 rounded-md p-3 my-2 overflow-x-auto text-body-xs",children:(0,r.jsx)("code",{className:`language-${a}`,children:l})},t)}return(0,r.jsx)("span",{children:e.split("\n").map((e,t)=>{if(e.startsWith("### "))return(0,r.jsx)("h3",{className:"font-semibold text-body mt-3 mb-1",children:e.slice(4)},t);if(e.startsWith("## "))return(0,r.jsx)("h2",{className:"font-bold text-body-lg mt-3 mb-1",children:e.slice(3)},t);if(e.startsWith("# "))return(0,r.jsx)("h1",{className:"font-bold text-heading-xs mt-3 mb-1",children:e.slice(2)},t);if(e.startsWith("- ")||e.startsWith("* "))return(0,r.jsxs)("div",{className:"flex items-start gap-2 my-0.5",children:[(0,r.jsx)("span",{className:"text-accent mt-1.5",children:"â¢"}),(0,r.jsx)("span",{children:l(e.slice(2))})]},t);let s=e.match(/^(\d+)\.\s/);return s?(0,r.jsxs)("div",{className:"flex items-start gap-2 my-0.5",children:[(0,r.jsxs)("span",{className:"text-accent min-w-6",children:[s[1],"."]}),(0,r.jsx)("span",{children:l(e.slice(s[0].length))})]},t):""===e.trim()?(0,r.jsx)("br",{},t):(0,r.jsx)("p",{className:"my-1",children:l(e)},t)})},t)}
1):null,s&&(0,r.jsx)("span",{className:"inline-block w-2 h-4 bg-current animate-pulse ml-0.5 align-middle"})]}),n&&!s&&(0,r.jsx)("div",{className:`text-caption-sm mt-1 ${a?"text-accent-200":"text-foreground-subtle"}`,children:n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})})}function d(){let{isOpen:e,messages:t,isLoading:s,isStreaming:l,sendMessage:d,closeChat:h,clearChat:x}=(0,a.vd)(),u=(0,n.useRef)(null),m=(0,n.useRef)(null);return((0,n.useEffect)(()=>{u.current&&u.current.scrollIntoView({behavior:"smooth"})},[t]),(0,n.useEffect)(()=>{let t=t=>{"Escape"===t.key&&e&&h()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,h]),e)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black/20 z-40 md:hidden",onClick:h,"aria-hidden":"true"}),(0,r.jsxs)("div",{className:`fixed bottom-0 right-0 md:bottom-4 md:right-4 z-50 w-full md:w-96 h-[85vh] md:h-[600px] md:max-h-[80vh] bg-background rounded-t-2xl md:rounded-2xl shadow-2xl flex flex-col overflow-hidden transform transition-transform duration-300 ${e?"translate-y-0":"translate-y-full"}`,role:"dialog","aria-modal":"true","aria-label":"AI Chat Assistant",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-gradient-to-r from-accent to-accent-800",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-white/20 rounded-full flex items-center justify-center",children:(0,r.jsx)("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-white font-semibold text-body-xs",children:"Records Assistant"}),(0,r.jsx)("p",{className:"text-accent-100 text-caption-sm",children:l?"Typing...":"Powered by Claude"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[t.length>0&&(0,r.jsx)("button",{onClick:x,className:"p-2 text-white/90 hover:text-white hover:bg-white/10 rounded-lg transition-colors","aria-label":"Start new chat",title:"New chat",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),(0,r.jsx)("button",{onClick:h,className:"p-2 text-white/90 hover:text-white hover:bg-white/10 rounded-lg transition-colors","aria-label":"Close chat",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,r.jsx)("div",{ref:m,className:"flex-1 overflow-y-auto p-4 bg-surface-1",children:0===t.length?(0,r.jsx)(c,{}):(0,r.jsxs)(r.Fragment,{children:[t.map(e=>(0,r.jsx)(o,{role:e.role,content:e.content,isStreaming:e.isStreaming,timestamp:e.createdAt},e.id)),(0,r.jsx)("div",{ref:u})]})}),(0,r.jsx)(i,{onSend:d,disabled:s||l})]})]}):null}function c(){let{sendMessage:e}=(0,a.vd)(),{audience:t}=(0,l.g)();return(0,r.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[(0,r.jsx)("div",{className:"w-16 h-16 bg-accent-100 rounded-full flex items-center justify-center mb-4",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-accent",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),(0,r.jsx)("h3",{className:"text-body-lg font-semibold text-foreground mb-2",children:"Hi! I'm your Records Assistant"}),(0,r.jsx)("p",{className:"text-foreground-muted text-body-xs mb-6 max-w-xs",children:"providers"===t?"I can help you find the right EMR systems and AI tools for your healthcare practice.":"I can help you get your medical records, understand your HIPAA rights, and deal with insurance denials."}),(0,r.jsx)("p",{className:"mb-6 max-w-xs text-caption-sm leading-relaxed text-foreground-subtle",children:"Do not submit names, dates of birth (DOB), medical record numbers (MRNs), or other health information. Responses are general information, not medical or legal advice."}),(0,r.jsxs)("div",{className:"w-full space-y-2",children:[(0,r.jsx)("p",{className:"text-caption-sm text-foreground-subtle uppercase tracking-wide",children:"Try asking:"}),("providers"===t?["What EMR is best for a small cardiology practice?","How do AI medical scribes work?","Compare Epic vs Cerner","What AI tools integrate with Epic?"]:["How do I get my medical records?","How long c
1an my provider take to send records?","What can I do about a denied insurance claim?","Was my provider part of a data breach?"]).map((t,s)=>(0,r.jsx)("button",{onClick:()=>e(t),className:"w-full text-left px-3 py-2 text-body-xs text-foreground bg-background border border-border rounded-lg hover:border-accent-300 hover:bg-accent-50 transition-colors",children:t},s))]})]})}function h(){let{isOpen:e,toggleChat:t,messages:s}=(0,a.vd)(),[l,i]=(0,n.useState)(!1),[o,c]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=setTimeout(()=>c(!0),100);return()=>clearTimeout(e)},[]),(0,n.useEffect)(()=>{s.length>0&&!e?i(!0):e&&i(!1)},[s.length,e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:t,style:{bottom:"calc(1rem + var(--cookie-banner-height, 0px))"},className:`fixed right-4 z-40 w-14 h-14 bg-accent text-white rounded-full shadow-lg hover:bg-accent-800 hover:shadow-xl hover:scale-105 active:scale-95 transition-all duration-200 flex items-center justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 ${o?"opacity-100 translate-y-0":"opacity-0 translate-y-4"} ${e?"md:hidden":""}`,"aria-label":e?"Close chat":"Open AI assistant","aria-expanded":e,children:[e?(0,r.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}):(0,r.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),l&&!e&&(0,r.jsx)("span",{className:"absolute right-0 top-0 h-3 w-3 animate-pulse rounded-full border-2 border-white bg-status-danger"}),!e&&!l&&(0,r.jsx)("span",{className:"absolute inset-0 rounded-full bg-accent-400 animate-ping opacity-25"})]}),!e&&(0,r.jsx)("div",{style:{bottom:"calc(5rem + var(--cookie-banner-height, 0px))"},className:"fixed right-4 z-40 hidden md:block pointer-events-none",children:(0,r.jsxs)("div",{className:"bg-foreground text-white text-body-xs px-3 py-1.5 rounded-lg shadow-lg opacity-0 group-hover:opacity-100 transition-opacity",children:["Ask Records Assistant",(0,r.jsx)("div",{className:"absolute top-full right-4 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-foreground"})]})}),(0,r.jsx)(d,{})]})}let x=h}}]);
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.