teodor-new-chat-ui 3.0.136 → 3.0.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -80,7 +80,7 @@ React keys must be passed directly to JSX without using spread:
80
80
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
81
81
 
82
82
  For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return T.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},aI="DialogDescriptionWarning",iI=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jm(aI).contentName}}.`;return T.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},Xm=km,oI=Fm,Zm=Gm,li=Ym,ci=Hm,$n=Vm,di=$m,Jm=Km;const sI=Xm,lI=Zm,eg=T.forwardRef(({className:t,...e},n)=>u.jsx(li,{ref:n,className:j("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));eg.displayName=li.displayName;const tg=T.forwardRef(({className:t,children:e,...n},r)=>{const a=T.useMemo(()=>{let i=!1;function o(s){T.Children.forEach(s,l=>{if(i||!T.isValidElement(l))return;const c=l.type;if(c===$n||(c==null?void 0:c.displayName)===$n.displayName||(c==null?void 0:c.name)==="DialogTitle"){i=!0;return}l.props&&l.props.children&&o(l.props.children)})}return o(e),i},[e]);return u.jsxs(lI,{children:[u.jsx(eg,{}),u.jsxs(ci,{ref:r,className:j("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[!a&&u.jsx($n,{className:"sr-only",children:"Dialog"}),e,u.jsxs(Jm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[u.jsx(pe.X,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});tg.displayName=ci.displayName;const ng=({className:t,...e})=>u.jsx("div",{className:j("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});ng.displayName="DialogHeader";const rg=T.forwardRef(({className:t,...e},n)=>u.jsx($n,{ref:n,className:j("text-lg font-semibold leading-none tracking-tight",t),...e}));rg.displayName=$n.displayName;const cI=T.forwardRef(({className:t,...e},n)=>u.jsx(di,{ref:n,className:j("text-sm text-muted-foreground",t),...e}));cI.displayName=di.displayName;function dI({isOpen:t,onClose:e,fileId:n,fileName:r,mimeType:a}){const[i,o]=O.useState(!1),[s,l]=O.useState(null),[c,d]=O.useState(null),{toast:_}=ns();O.useEffect(()=>{t&&n&&p()},[t,n]);const p=async()=>{if(n){o(!0),d(null),l(null);try{const S=await dm(n);l(S)}catch(S){console.error("Failed to load file:",S),d(S instanceof Error?S.message:"Failed to load file")}finally{o(!1)}}},m=async()=>{if(n)try{await VO(n),_({title:"Download started",description:`Downloading ${r}`})}catch(S){console.error("Failed to download file:",S),_({title:"Download failed",description:String(S),variant:"destructive"})}},E=async()=>{if(n)try{const S=await dm(n),b=new Blob([S],{type:a}),h=URL.createObjectURL(b);window.open(h,"_blank"),URL.revokeObjectURL(h)}catch(S){console.error("Failed to open file externally:",S),_({title:"Failed to open file",description:String(S),variant:"destructive"})}},f=()=>i?u.jsxs("div",{className:"flex items-center justify-center py-12",children:[u.jsx(pe.Loader,{className:"h-8 w-8 animate-spin mr-3"}),u.jsx("span",{children:"Loading file..."})]}):c?u.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[u.jsx("div",{className:"text-red-500 mb-4",children:"⚠️"}),u.jsx("p",{className:"text-red-600 mb-4",children:c}),u.jsx($e,{onClick:p,variant:"outline",children:"Try Again"})]}):s?a.startsWith("image/")?u.jsx("div",{className:"flex justify-center",children:u.jsx("img",{src:`data:${a};base64,${s}`,alt:r,className:"max-w-full max-h-[70vh] object-contain rounded-lg"})}):a==="application/pdf"?u.jsx("div",{className:"w-full h-[70vh] border rounded-lg overflow-hidden",children:u.jsx("iframe",{src:`data:application/pdf;base64,${s}`,className:"w-full h-full",title:r})}):a.startsWith("text/")||a.includes("json")||a.includes("xml")?u.jsx("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4 max-h-[70vh] overflow-auto",children:u.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm",children:s})}):u.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[u.jsx(pe.FileText,{className:"h-16 w-16 text-gray-400 mb-4"}),u.jsx("p",{className:"text-lg font-medium mb-2",children:r}),u.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[a," • ",s.length," bytes"]}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"This file type cannot be previewed. Use download or external view."})]}):u.jsx("div",{className:"flex items-center justify-center py-12",children:u.jsx("p",{className:"text-muted-foreground",children:"No content to display"})}),g=()=>a.startsWith("image/")?u.jsx(pe.Image,{className:"h-5 w-5"}):u.jsx(pe.FileText,{className:"h-5 w-5"});return u.jsx(sI,{open:t,onOpenChange:e,children:u.jsxs(tg,{className:"max-w-4xl max-h-[90vh] overflow-hidden",children:[u.jsx(ng,{children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[g(),u.jsxs("div",{children:[u.jsx(rg,{className:"text-left",children:r}),u.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[a," • Click download or external view for full access"]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs($e,{variant:"outline",size:"sm",onClick:E,className:"flex items-center gap-2",children:[u.jsx(pe.ExternalLink,{className:"h-4 w-4"}),"External"]}),u.jsxs($e,{variant:"outline",size:"sm",onClick:m,className:"flex items-center gap-2",children:[u.jsx(pe.Download,{className:"h-4 w-4"}),"Download"]})]})]})}),u.jsx("div",{className:"flex-1 overflow-hidden",children:f()})]})})}const ui="prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words";function uI({className:t}){const[e,n]=O.useState(0);return O.useEffect(()=>{const r=setInterval(()=>n(a=>(a+1)%4),500);return()=>clearInterval(r)},[]),u.jsxs("span",{"aria-live":"polite",className:j("inline-block text-xs opacity-70 ml-1",t),children:["Is thinking",".".repeat(e)]})}const ag=O.memo(function({message:e,messageIndex:n,isStreamingMessage:r=!1,streamingDebounceMs:a=16,isEditing:i=!1,showActions:o=!0,showTimestamp:s=!0,showAgentName:l=!0,layoutSize:c="desktop",truncateToolMessages:d=!0,toolMessagePreviewLength:_=200,truncateUserMessages:p=!0,userMessagePreviewLength:m=200,customStyles:E={},onEdit:f,onRegenerate:g,onCancelEdit:S,onCopy:b}){const[h,v]=O.useState(!1),[C,R]=O.useState(!1),[N,y]=O.useState(!1),[I,D]=O.useState(!1),{currentThreadId:L}=xa();ns();const[q,K]=O.useState({}),[F,G]=O.useState(!1),[A,B]=O.useState(null),M=c==="phone"||c==="half-screen",k=e.role,$=k==="tool",W=O.useMemo(()=>{switch(k){case"user":return"text-[hsl(var(--chat-bubble-user-text))]";case"assistant":return"text-[hsl(var(--chat-bubble-ai-text))]";case"tool":return"text-secondary-foreground";case"system":return"text-muted-foreground";default:return"text-[hsl(var(--chat-bubble-ai-text))]"}},[k]),ne=O.useMemo(()=>_I(e.content),[e.content]),V=O.useMemo(()=>fI(e.content),[e.content]),X=O.useMemo(()=>e.content.filter(de=>de.type==="image_url"),[e.content]),se=O.useMemo(()=>e.content.filter(de=>de.type==="file"),[e.content]),ce=bI(ne,r);O.useEffect(()=>{r&&ne!==ce&&console.log("[MessageComponent] Streaming update:",{messageId:e.id,isStreamingMessage:r,textLength:ne.length,batchedLength:ce.length,textPreview:ne.slice(-50),batchedPreview:ce.slice(-50)})},[r,ne,ce,e.id]);const H=async()=>{try{const de=$?gr(e.content):ne;await navigator.clipboard.writeText(de),v(!0),setTimeout(()=>v(!1),2e3),b==null||b(de)}catch(de){console.error("Failed to copy:",de)}},P=()=>{if(!f)return;const de=$?gr(e.content):ne;f(e.id,de)},z=()=>g==null?void 0:g(n),Z=()=>{const Me=j(M?"h-3 w-3":"h-4 w-4","opacity-60 flex-shrink-0",W);switch(k){case"user":return u.jsx(pe.User,{className:Me});case"assistant":return u.jsx(pe.Bot,{className:Me});case"tool":return u.jsx(pe.Wrench,{className:Me});default:return u.jsx(pe.Bot,{className:Me})}},ie=()=>{const de="group relative mb-4 flex w-full";switch(k){case"user":return j(de,"justify-end");case"assistant":case"tool":case"system":return j(de,"justify-start");default:return de}},oe=()=>{const de=j("rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",M&&"px-3 py-2 text-sm");switch(k){case"user":return j(de,"w-full md:max-w-[95%]","bg-[hsl(var(--chat-bubble-user))] text-[hsl(var(--chat-bubble-user-text))]","border border-transparent");case"assistant":return j(de,"w-full md:max-w-[95%]","bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]","border border-border/60 dark:border-border/40");case"tool":return j(de,"w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");case"system":return j(de,"w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");default:return j(de,"w-full md:max-w-[95%]","bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]","border border-border/60 dark:border-border/40")}},Ne=de=>{if(!de)return"";try{return new Date(de).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}},Ue=()=>{if(!(ne.trim().length>0||X.length>0||se.length>0))return u.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/30 rounded",children:[u.jsx(pe.Paperclip,{className:"h-4 w-4 text-muted-foreground"}),u.jsx("span",{className:"text-sm text-muted-foreground",children:"File upload"})]});if(e.model==="reflection"){const Se=ne.trim(),Te=fs(Se);if(Te&&typeof Te=="object")return u.jsx(TI,{data:Te})}if($&&V.name==="get_issues"){const Se=e.content.find(et=>et.type==="tool_result"),Te=(Se==null?void 0:Se.output)??gr(e.content),be=sg(Te);if(be)return u.jsx(hI,{issues:be})}if($&&!N){const Se=gr(e.content).slice(0,80).replace(/\s+/g," ");return u.jsx("div",{className:j("text-xs font-mono opacity-70 flex items-center justify-between gap-2 text-current",M&&"text-[10px]"),children:u.jsxs("span",{className:"truncate max-w-full text-current",children:[Se,Se.length>=80?"…":""]})})}if($&&d){const Se=gr(e.content),Te=Se.length>_;return u.jsx(rm,{open:C,onOpenChange:R,children:u.jsxs("div",{className:"font-mono text-sm text-current",children:[u.jsx("pre",{className:j("whitespace-pre-wrap break-words text-current",M&&"text-xs"),children:Te&&!C?Se.substring(0,_)+"...":Se}),Te&&u.jsx(am,{asChild:!0,children:u.jsx($e,{variant:"ghost",size:"sm",className:"h-6 text-xs text-current",children:C?u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronUp,{className:"h-3 w-3 mr-1"}),"Show less"]}):u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronDown,{className:"h-3 w-3 mr-1"}),"Show more (",Se.length-_," chars)"]})})})]})})}if($&&N&&!d){const Se=CI(e.content);if(Se&&pI(Se))return u.jsx(Wa,{content:Se.trim(),hideFallbackDuringStreaming:!0});const Te=gr(e.content);return u.jsx("div",{className:"font-mono text-sm text-current",children:u.jsx("pre",{className:j("whitespace-pre-wrap break-words text-current",M&&"text-xs"),children:Te})})}const Me=X.length>0&&k!=="tool",ae=se.length>0&&k!=="tool"&&!1;return u.jsxs("div",{children:[r?u.jsxs("div",{className:j("relative transition-all duration-200 ease-out",M?"text-xs":"text-sm"),style:{minHeight:80},children:[(()=>{const Se=fs(ce);if(Se!==null)return u.jsx(ig,{data:Se});const Te=gI(mI(ce)),be=ce.trim().length===0;return u.jsx(u.Fragment,{children:be?u.jsx("div",{className:"w-full",children:u.jsxs("div",{className:"animate-pulse space-y-2",children:[u.jsx("div",{className:"h-3 bg-slate-200 dark:bg-slate-700 rounded w-3/4"}),u.jsx("div",{className:"h-3 bg-slate-200 dark:bg-slate-700 rounded w-5/6"}),u.jsx("div",{className:"h-3 bg-slate-200 dark:bg-slate-700 rounded w-2/3"})]})}):u.jsx("pre",{className:j("whitespace-pre-wrap break-words font-sans leading-relaxed transition-opacity duration-200",M&&"text-xs"),children:Te})})})(),u.jsx("div",{className:"mt-2",children:u.jsx(uI,{className:j(W,M?"text-xs":"text-sm")})})]}):(()=>{const Se=fs(ne.trim());if(Se!==null)return u.jsx(ig,{data:Se});if(k==="user"&&p){const Te=ne.trim();if(Te.length>m)return u.jsxs(rm,{open:I,onOpenChange:D,children:[u.jsx("div",{className:j("text-sm text-[hsl(var(--chat-bubble-user-text))]",M&&"text-xs"),children:I?u.jsx(Wa,{content:Te,hideFallbackDuringStreaming:!0}):u.jsxs("pre",{className:j("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]",M&&"text-xs"),children:[Te.substring(0,m),"..."]})}),u.jsx(am,{asChild:!0,children:u.jsx($e,{variant:"ghost",size:"sm",className:"h-6 text-xs !text-[hsl(var(--chat-bubble-user-text))]",children:I?u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronUp,{className:"h-3 w-3 mr-1"})," Show less"]}):u.jsxs(u.Fragment,{children:[u.jsx(pe.ChevronDown,{className:"h-3 w-3 mr-1"})," Show more (",Te.length-m," chars)"]})})})]})}return u.jsx(Wa,{content:ne.trim(),isStreaming:r,hideFallbackDuringStreaming:!0,streamingThrottleMs:a,useWorker:!r})})(),Me&&u.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:X.map((Se,Te)=>{const be=Se,et=typeof be.width=="number"?be.width:void 0,We=typeof be.height=="number"?be.height:void 0,lt=et&&We&&We>0?`${et} / ${We}`:"4 / 3",Je=et&&We&&We>0?Math.max(120,Math.round(We/et*140)):160;return u.jsxs("div",{className:"relative border rounded overflow-hidden bg-gray-100 dark:bg-gray-900/40",style:{aspectRatio:lt,minHeight:Je},"data-placeholder-height":Je,children:[u.jsx("img",{src:be.url,alt:be.alt??"image",loading:"lazy",className:"absolute inset-0 h-full w-full object-contain"}),u.jsxs("div",{className:"absolute top-1 right-1 bg-background/70 rounded px-1 py-0.5 text-[10px] flex items-center gap-1",children:[u.jsx(pe.Image,{className:"h-3 w-3"}),u.jsx("span",{children:"image"})]})]},Te)})}),ae]})},Oe=O.useMemo(()=>SI(e),[e]);return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:j(ie(),E.container),children:u.jsxs("div",{className:j(oe(),E.content),children:[(s||l||$)&&u.jsxs("div",{className:j("flex items-center justify-between mb-2 pb-2 border-b border-current/10",M&&"mb-1 pb-1",W,E.header),children:[u.jsxs("div",{className:"flex items-center gap-2",children:[Z(),l&&Oe&&u.jsx("span",{className:j("font-medium",M?"text-xs":"text-sm"),children:Oe}),$&&V.name&&u.jsxs(Xp,{variant:"outline",className:j("text-xs flex items-center gap-1 cursor-pointer",W,"border border-current/40",M&&"text-xs h-4"),onClick:()=>y(de=>!de),children:[u.jsx("span",{children:V.name}),u.jsx("span",{className:"inline-flex items-center",children:N?u.jsx(pe.ChevronUp,{className:"h-3 w-3"}):u.jsx(pe.ChevronDown,{className:"h-3 w-3"})})]}),$&&!V.name&&u.jsx($e,{variant:"ghost",size:"sm",className:j("h-6 px-1",W,"hover:bg-foreground/10"),onClick:()=>y(de=>!de),children:u.jsxs("span",{className:"text-xs flex items-center gap-1",children:["Tool Output ",N?u.jsx(pe.ChevronUp,{className:"h-3 w-3"}):u.jsx(pe.ChevronDown,{className:"h-3 w-3"})]})})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[s&&u.jsx("span",{className:j("text-xs opacity-60",W,M&&"text-xs"),children:Ne(e.createdAt)}),o&&!i&&u.jsxs("div",{className:j("opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",E.actions),children:[u.jsx($e,{variant:"ghost",size:"sm",onClick:H,className:j("h-6 w-6 p-0 hover:bg-foreground/10",W,M&&"h-5 w-5"),children:u.jsx(pe.Copy,{className:j(h?"text-success":W,M?"h-3 w-3":"h-4 w-4")})}),k==="user"&&f&&u.jsx($e,{variant:"ghost",size:"sm",onClick:P,className:j("h-6 w-6 p-0 hover:bg-foreground/10",W,M&&"h-5 w-5"),children:u.jsx(pe.Edit,{className:j(W,M?"h-3 w-3":"h-4 w-4")})}),k==="assistant"&&g&&u.jsx($e,{variant:"ghost",size:"sm",onClick:z,className:j("h-6 w-6 p-0 hover:bg-foreground/10",W,M&&"h-5 w-5"),children:u.jsx(pe.RotateCcw,{className:j(W,M?"h-3 w-3":"h-4 w-4")})})]})]})]}),u.jsx("div",{className:"relative",children:Ue()}),$&&N&&(V.toolCallId||V.name)&&u.jsxs("div",{className:j("mt-2 pt-2 border-t border-current/10 text-xs opacity-60",M&&"text-xs"),children:[V.name&&u.jsxs("div",{children:["Function: ",V.name]}),V.toolCallId&&u.jsxs("div",{children:["Call ID: ",V.toolCallId]})]}),!(s||l||$)&&o&&!i&&u.jsxs("div",{className:j("absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",E.actions),children:[u.jsx($e,{variant:"ghost",size:"sm",onClick:H,className:j("h-6 w-6 p-0 hover:bg-background/50 text-current",M&&"h-5 w-5"),children:u.jsx(pe.Copy,{className:j(h?"text-success":"text-current",M?"h-3 w-3":"h-4 w-4")})}),k==="user"&&f&&u.jsx($e,{variant:"ghost",size:"sm",onClick:P,className:j("h-6 w-6 p-0 hover:bg-background/50 text-current",M&&"h-5 w-5"),children:u.jsx(pe.Edit,{className:j("text-current",M?"h-3 w-3":"h-4 w-4")})}),k==="assistant"&&g&&u.jsx($e,{variant:"ghost",size:"sm",onClick:z,className:j("h-6 w-6 p-0 hover:bg-background/50 text-current",M&&"h-5 w-5"),children:u.jsx(pe.RotateCcw,{className:j("text-current",M?"h-3 w-3":"h-4 w-4")})})]})]})}),A&&u.jsx(dI,{isOpen:F,onClose:()=>{G(!1),B(null)},fileId:A.id,fileName:A.name,mimeType:A.mimeType})]})},(t,e)=>e.isStreamingMessage?!1:t.message.id===e.message.id&&t.message.content===e.message.content&&t.isStreamingMessage===e.isStreamingMessage&&t.isEditing===e.isEditing);function _I(t){const e=t.filter(n=>n.type==="text").map(n=>n.text).join("");return e||JSON.stringify(t)}function pI(t){return t.includes(`
83
- `)||t.includes("```")||/[-*] /.test(t)||/#+\s/.test(t)}function mI(t){let e=t;try{(e.match(/```/g)||[]).length%2===1&&(e+="\n```"),(e.replace(/```[\s\S]*?```/g,"").match(new RegExp("(?<!`)`(?!`)","g"))||[]).length%2===1&&(e+="`")}catch{}return e}function gI(t){let e=t;try{const n=[],r=[],a="\0F",i="\0I";let o=e.replace(/```[\s\S]*?```/g,s=>(n.push(s),`${a}${n.length-1}\0`));o=o.replace(/`[^`]*`/g,s=>(r.push(s),`${i}${r.length-1}\0`)),o=o.replace(/\b([A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/\b([A-Za-z0-9_&\/-]+\s+[A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/([\.,;:!\?\-])\1+/g,"$1").replace(/([:;!\?\)])([A-Za-z])/g,"$1 $2").replace(/\s{3,}/g," "),o=o.replace(/\u0000F(\d+)\u0000/g,(s,l)=>n[Number(l)]??""),o=o.replace(/\u0000I(\d+)\u0000/g,(s,l)=>r[Number(l)]??""),e=o}catch{}return e}function fs(t){const e=t==null?void 0:t.trim();if(!e||!(e.startsWith("{")||e.startsWith("[")))return null;try{return JSON.parse(e)}catch{return null}}function ig({data:t}){if(Array.isArray(t))return t.every(n=>n===null||["string","number","boolean"].includes(typeof n))?u.jsx("div",{className:ui,children:u.jsx("ul",{className:"list-disc pl-5",children:t.map((n,r)=>u.jsx("li",{children:String(n)},r))})}):u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Zr(t)});if(t&&typeof t=="object"){const e=Array.isArray(t.distilled_facts)?t.distilled_facts:null,n=Array.isArray(t.follow_up_queries)?t.follow_up_queries:null,r=typeof t.is_sufficient=="boolean"?t.is_sufficient:void 0;if(e||n||typeof r=="boolean")return u.jsxs("div",{className:ui,children:[typeof r=="boolean"&&u.jsxs("p",{children:[u.jsx("strong",{children:"Is sufficient:"})," ",r?"Yes":"No"]}),n&&n.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Follow-up queries:"})}),u.jsx("ul",{className:"list-disc pl-5",children:n.map((i,o)=>u.jsx("li",{children:String(i)},o))})]}),e&&e.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Facts:"})}),u.jsx("ul",{className:"list-disc pl-5",children:e.map((i,o)=>u.jsx("li",{children:String(i)},o))})]})]});const a=Object.entries(t);return u.jsx("div",{className:ui,children:u.jsx("dl",{className:"mt-0",children:a.map(([i,o])=>u.jsxs("div",{className:"mb-1",children:[u.jsxs("dt",{className:"inline font-medium mr-1",children:[i,":"]}),u.jsx("dd",{className:"inline",children:EI(o)})]},i))})})}return u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Zr(t)})}function EI(t){if(t==null)return String(t);const e=typeof t;if(e==="string"||e==="number"||e==="boolean")return String(t);if(Array.isArray(t)&&t.every(r=>r===null||["string","number","boolean"].includes(typeof r)))return t.join(", ");try{return u.jsx("code",{className:"text-xs",children:JSON.stringify(_i(t))})}catch{return String(t)}}function og(t){return!!(t&&typeof t=="object"&&(t.type==="file"||t.mimeType||t.filename||t.sourceType==="base64"))}function _i(t){if(typeof t=="string")return t.length>2e3?t.slice(0,2e3)+"... [truncated]":t;if(t&&typeof t=="object"){if(Array.isArray(t)){const n=t.map(_i).filter(r=>r!==void 0);return n.length?n:void 0}if(og(t))return;const e={};for(const n of Object.keys(t)){const r=t[n];if(n==="data"&&typeof r=="string"&&r.length>100)e[n]=`[base64 ${r.length} chars omitted]`;else{const a=_i(r);a!==void 0&&(e[n]=a)}}return Object.keys(e).length?e:void 0}return t}function Zr(t){if(typeof t=="string")return t;if(og(t))return"";try{const e=_i(t);return e===void 0?"":typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return""}}function fI(t){const e=t.find(r=>r.type==="tool_call"),n=t.find(r=>r.type==="tool_result");return{name:e==null?void 0:e.name,toolCallId:(n==null?void 0:n.toolCallId)??(e==null?void 0:e.id)}}function SI(t){return t.name&&t.name.trim()?t.name:t.model&&t.model.includes("/")?t.model.split("/").pop()||null:t.model||null}function bI(t,e){const[n,r]=O.useState(t),a=O.useRef(t),i=O.useRef(null);return O.useEffect(()=>{if(!e){r(t);return}return a.current=t,i.current===null&&(i.current=requestAnimationFrame(()=>{i.current=null,r(a.current)})),()=>{i.current&&cancelAnimationFrame(i.current)}},[t,e]),n}function TI({data:t}){return u.jsx("dl",{className:"grid grid-cols-1 gap-y-2",children:Object.entries(t).map(([e,n])=>u.jsxs("div",{className:"flex",children:[u.jsxs("dt",{className:"font-semibold mr-2",children:[e,":"]}),u.jsx("dd",{className:"flex-1 break-words",children:Array.isArray(n)?n.map((r,a)=>u.jsxs("div",{className:"ml-4 break-words",children:["- ",String(r)]},a)):String(n)})]},e))})}function sg(t){if(!t)return null;if(typeof t=="object"&&!Array.isArray(t)){if(t.desirability||t.feasibility||t.viability||t.other)return{desirability:Array.isArray(t.desirability)?t.desirability:[],feasibility:Array.isArray(t.feasibility)?t.feasibility:[],viability:Array.isArray(t.viability)?t.viability:[],other:Array.isArray(t.other)?t.other:[]};if(t.output&&typeof t.output!="object")t=t.output;else if(t.output&&typeof t.output=="object")return sg(t.output)}const e=String(t),n={desirability:[],feasibility:[],viability:[],other:[]};let r=e;const a=Math.min(...["desirability=","feasibility=","viability=","other="].map(o=>{const s=r.toLowerCase().indexOf(o);return s===-1?Number.MAX_SAFE_INTEGER:s}));a!==Number.MAX_SAFE_INTEGER&&(r=r.slice(a));for(const o of Object.keys(n)){const l=new RegExp(o+"\\s*=\\s*\\[([\\s\\S]*?)\\]","i").exec(r);if(!l)continue;const c=l[1],d=/Issue\(([\s\S]*?)\)(?:,|$)/g;let _=null;for(;(_=d.exec(c))!==null;){const p=_[1],m=/title\s*=\s*(['"])([\s\S]*?)\1/.exec(p),E=/description\s*=\s*(['"])([\s\S]*?)\1/.exec(p),f=m?m[2].trim():"",g=E?E[2].trim():"";n[o].push({title:f,description:g})}}return Object.values(n).some(o=>o.length>0)?n:null}function hI({issues:t}){const e=[{key:"desirability",title:"Desirability"},{key:"feasibility",title:"Feasibility"},{key:"viability",title:"Viability"},{key:"other",title:"Other"}];return u.jsx("div",{className:ui,children:e.map(n=>{const r=t[n.key];return!r||!r.length?null:u.jsxs("div",{className:"mb-4",children:[u.jsxs("h4",{className:"font-semibold mb-2",children:[n.title," (",r.length,")"]}),u.jsx("ol",{className:"list-decimal pl-5 space-y-2",children:r.map((a,i)=>u.jsxs("li",{children:[u.jsx("div",{className:"font-medium",children:a.title}),u.jsx("div",{className:"text-sm text-muted-foreground",children:a.description})]},i))})]},n.key)})})}function gr(t){const e=t.filter(n=>n.type==="tool_result");if(e.length)try{return e.length===1?Zr(e[0].output):Zr(e.map(n=>({toolCallId:n.toolCallId,output:n.output})))}catch{}return Zr(t)}function CI(t){const e=t.find(r=>r.type==="tool_result");if(!e)return null;const n=e.output;return typeof n=="string"?n:null}const lg=(t,e)=>(t==null?void 0:t.id)??`message-${e}`,Ss=O.forwardRef(({messages:t,isStreaming:e,streamingAssistantId:n,streamingDebounceMs:r,layoutSize:a,enableMessageEditing:i,editingMessageId:o,onStartReached:s,onEdit:l,onRegenerate:c,onCancelEdit:d,className:_,style:p,emptyMessage:m,followNewMessages:E=!0,isNavigatingCheckpoint:f=!1,onScrollAway:g,onAtBottom:S},b)=>{const h=O.useRef(null),v=O.useRef(null),C=O.useRef(!1),R=O.useRef(!0);O.useRef(null);const N=O.useRef(t.length),y=O.useCallback(G=>{R.current=G,g&&g(!G),S&&S(G)},[g,S]),I=O.useCallback(G=>{},[]),D=O.useMemo(()=>{if(s)return async()=>{if(!C.current){C.current=!0;try{await s()}finally{C.current=!1}}}},[s]);O.useEffect(()=>{N.current;const G=t.length;N.current=G},[t.length]),O.useEffect(()=>()=>{},[]);const L=e&&E&&R.current,q=L?"auto":!1;O.useEffect(()=>{console.log("[MessageList] Streaming state:",{isStreaming:e,streamingAssistantId:n,messagesLength:t.length,shouldFollow:L,followOutput:q,isNavigatingCheckpoint:f,isNearBottom:R.current,followNewMessages:E})},[e,n,t.length,L,q,f,E]);const K=O.useMemo(()=>{},[]),F={display:"flex",flexDirection:"column",overflowY:"auto",overflowAnchor:"auto",overscrollBehavior:"contain"};return t.length===0?u.jsx("div",{className:_,style:p,children:u.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto",children:m||"No messages yet. Start a conversation!"})}):u.jsx("div",{className:_,style:p,children:u.jsx(rO,{ref:G=>{h.current=G},scrollerRef:G=>{v.current=G instanceof HTMLDivElement?G:null},data:t,followOutput:q,initialTopMostItemIndex:K,overscan:200,increaseViewportBy:200,defaultItemHeight:120,atBottomThreshold:50,alignToBottom:!0,startReached:()=>{D&&D()},atBottomStateChange:y,rangeChanged:I,style:{height:"100%",overscrollBehavior:"contain"},computeItemKey:(G,A)=>lg(A,G),components:{Scroller:O.forwardRef((G,A)=>u.jsx("div",{...G,ref:A,style:{...F,...(G==null?void 0:G.style)??{}}}))},itemContent:(G,A)=>{const B=A.role==="user"&&G===t.length-1,M=e&&n===A.id||B&&e,k=lg(A,G);return u.jsx("div",{className:"mb-4 last:mb-0","data-message-id":k,style:{minHeight:M?120:void 0,containIntrinsicSize:M?"auto 120px":void 0,willChange:e&&M?"contents":void 0},children:u.jsx(ag,{message:A,messageIndex:G,isStreamingMessage:e&&n===A.id,streamingDebounceMs:r,isEditing:o===A.id,showActions:i,showTimestamp:!1,showAgentName:!0,layoutSize:a,truncateToolMessages:!1,toolMessagePreviewLength:200,onEdit:l,onRegenerate:()=>c(G),onCancelEdit:d},A.id??`msg-${A.role}-${G}-${A.createdAt??""}`)})}})})});Ss.displayName="MessageList";const pi=1e4;function RI(t){if(typeof t!="string")return String(t);const e=[/<script[^>]*>.*?<\/script>/gi,/<iframe[^>]*>.*?<\/iframe>/gi,/javascript:/gi,/vbscript:/gi,/on\w+\s*=/gi,/<object[^>]*>.*?<\/object>/gi,/<embed[^>]*>.*?<\/embed>/gi,/<form[^>]*>.*?<\/form>/gi];let n=t;for(const a of e)n=n.replace(a,"");return/<[^>]+>/.test(n)&&!/<(?!\/?(?:code|strong|em|b|i|br|p|ul|ol|li|h[1-6])\b)[^>]+>/i.test(n)?n.replace(/<code>(.*?)<\/code>/gi,"`$1`").replace(/<strong>(.*?)<\/strong>/gi,"**$1**").replace(/<b>(.*?)<\/b>/gi,"**$1**").replace(/<em>(.*?)<\/em>/gi,"*$1*").replace(/<i>(.*?)<\/i>/gi,"*$1*").replace(/<br\s*\/?>/gi,`
83
+ `)||t.includes("```")||/[-*] /.test(t)||/#+\s/.test(t)}function mI(t){let e=t;try{(e.match(/```/g)||[]).length%2===1&&(e+="\n```"),(e.replace(/```[\s\S]*?```/g,"").match(new RegExp("(?<!`)`(?!`)","g"))||[]).length%2===1&&(e+="`")}catch{}return e}function gI(t){let e=t;try{const n=[],r=[],a="\0F",i="\0I";let o=e.replace(/```[\s\S]*?```/g,s=>(n.push(s),`${a}${n.length-1}\0`));o=o.replace(/`[^`]*`/g,s=>(r.push(s),`${i}${r.length-1}\0`)),o=o.replace(/\b([A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/\b([A-Za-z0-9_&\/-]+\s+[A-Za-z0-9_&\/-]+)\b(\s+\1\b)+/g,"$1").replace(/([\.,;:!\?\-])\1+/g,"$1").replace(/([:;!\?\)])([A-Za-z])/g,"$1 $2").replace(/\s{3,}/g," "),o=o.replace(/\u0000F(\d+)\u0000/g,(s,l)=>n[Number(l)]??""),o=o.replace(/\u0000I(\d+)\u0000/g,(s,l)=>r[Number(l)]??""),e=o}catch{}return e}function fs(t){const e=t==null?void 0:t.trim();if(!e||!(e.startsWith("{")||e.startsWith("[")))return null;try{return JSON.parse(e)}catch{return null}}function ig({data:t}){if(Array.isArray(t))return t.every(n=>n===null||["string","number","boolean"].includes(typeof n))?u.jsx("div",{className:ui,children:u.jsx("ul",{className:"list-disc pl-5",children:t.map((n,r)=>u.jsx("li",{children:String(n)},r))})}):u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Zr(t)});if(t&&typeof t=="object"){const e=Array.isArray(t.distilled_facts)?t.distilled_facts:null,n=Array.isArray(t.follow_up_queries)?t.follow_up_queries:null,r=typeof t.is_sufficient=="boolean"?t.is_sufficient:void 0;if(e||n||typeof r=="boolean")return u.jsxs("div",{className:ui,children:[typeof r=="boolean"&&u.jsxs("p",{children:[u.jsx("strong",{children:"Is sufficient:"})," ",r?"Yes":"No"]}),n&&n.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Follow-up queries:"})}),u.jsx("ul",{className:"list-disc pl-5",children:n.map((i,o)=>u.jsx("li",{children:String(i)},o))})]}),e&&e.length>0&&u.jsxs("div",{children:[u.jsx("p",{children:u.jsx("strong",{children:"Facts:"})}),u.jsx("ul",{className:"list-disc pl-5",children:e.map((i,o)=>u.jsx("li",{children:String(i)},o))})]})]});const a=Object.entries(t);return u.jsx("div",{className:ui,children:u.jsx("dl",{className:"mt-0",children:a.map(([i,o])=>u.jsxs("div",{className:"mb-1",children:[u.jsxs("dt",{className:"inline font-medium mr-1",children:[i,":"]}),u.jsx("dd",{className:"inline",children:EI(o)})]},i))})})}return u.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Zr(t)})}function EI(t){if(t==null)return String(t);const e=typeof t;if(e==="string"||e==="number"||e==="boolean")return String(t);if(Array.isArray(t)&&t.every(r=>r===null||["string","number","boolean"].includes(typeof r)))return t.join(", ");try{return u.jsx("code",{className:"text-xs",children:JSON.stringify(_i(t))})}catch{return String(t)}}function og(t){return!!(t&&typeof t=="object"&&(t.type==="file"||t.mimeType||t.filename||t.sourceType==="base64"))}function _i(t){if(typeof t=="string")return t.length>2e3?t.slice(0,2e3)+"... [truncated]":t;if(t&&typeof t=="object"){if(Array.isArray(t)){const n=t.map(_i).filter(r=>r!==void 0);return n.length?n:void 0}if(og(t))return;const e={};for(const n of Object.keys(t)){const r=t[n];if(n==="data"&&typeof r=="string"&&r.length>100)e[n]=`[base64 ${r.length} chars omitted]`;else{const a=_i(r);a!==void 0&&(e[n]=a)}}return Object.keys(e).length?e:void 0}return t}function Zr(t){if(typeof t=="string")return t;if(og(t))return"";try{const e=_i(t);return e===void 0?"":typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return""}}function fI(t){const e=t.find(r=>r.type==="tool_call"),n=t.find(r=>r.type==="tool_result");return{name:e==null?void 0:e.name,toolCallId:(n==null?void 0:n.toolCallId)??(e==null?void 0:e.id)}}function SI(t){return t.name&&t.name.trim()?t.name:t.model&&t.model.includes("/")?t.model.split("/").pop()||null:t.model||null}function bI(t,e){const[n,r]=O.useState(t),a=O.useRef(t),i=O.useRef(null);return O.useEffect(()=>{if(!e){r(t);return}return a.current=t,i.current===null&&(i.current=requestAnimationFrame(()=>{i.current=null,r(a.current)})),()=>{i.current&&cancelAnimationFrame(i.current)}},[t,e]),n}function TI({data:t}){return u.jsx("dl",{className:"grid grid-cols-1 gap-y-2",children:Object.entries(t).map(([e,n])=>u.jsxs("div",{className:"flex",children:[u.jsxs("dt",{className:"font-semibold mr-2",children:[e,":"]}),u.jsx("dd",{className:"flex-1 break-words",children:Array.isArray(n)?n.map((r,a)=>u.jsxs("div",{className:"ml-4 break-words",children:["- ",String(r)]},a)):String(n)})]},e))})}function sg(t){if(!t)return null;if(typeof t=="object"&&!Array.isArray(t)){if(t.desirability||t.feasibility||t.viability||t.other)return{desirability:Array.isArray(t.desirability)?t.desirability:[],feasibility:Array.isArray(t.feasibility)?t.feasibility:[],viability:Array.isArray(t.viability)?t.viability:[],other:Array.isArray(t.other)?t.other:[]};if(t.output&&typeof t.output!="object")t=t.output;else if(t.output&&typeof t.output=="object")return sg(t.output)}const e=String(t),n={desirability:[],feasibility:[],viability:[],other:[]};let r=e;const a=Math.min(...["desirability=","feasibility=","viability=","other="].map(o=>{const s=r.toLowerCase().indexOf(o);return s===-1?Number.MAX_SAFE_INTEGER:s}));a!==Number.MAX_SAFE_INTEGER&&(r=r.slice(a));for(const o of Object.keys(n)){const l=new RegExp(o+"\\s*=\\s*\\[([\\s\\S]*?)\\]","i").exec(r);if(!l)continue;const c=l[1],d=/Issue\(([\s\S]*?)\)(?:,|$)/g;let _=null;for(;(_=d.exec(c))!==null;){const p=_[1],m=/title\s*=\s*(['"])([\s\S]*?)\1/.exec(p),E=/description\s*=\s*(['"])([\s\S]*?)\1/.exec(p),f=m?m[2].trim():"",g=E?E[2].trim():"";n[o].push({title:f,description:g})}}return Object.values(n).some(o=>o.length>0)?n:null}function hI({issues:t}){const e=[{key:"desirability",title:"Desirability"},{key:"feasibility",title:"Feasibility"},{key:"viability",title:"Viability"},{key:"other",title:"Other"}];return u.jsx("div",{className:ui,children:e.map(n=>{const r=t[n.key];return!r||!r.length?null:u.jsxs("div",{className:"mb-4",children:[u.jsxs("h4",{className:"font-semibold mb-2",children:[n.title," (",r.length,")"]}),u.jsx("ol",{className:"list-decimal pl-5 space-y-2",children:r.map((a,i)=>u.jsxs("li",{children:[u.jsx("div",{className:"font-medium",children:a.title}),u.jsx("div",{className:"text-sm text-muted-foreground",children:a.description})]},i))})]},n.key)})})}function gr(t){const e=t.filter(n=>n.type==="tool_result");if(e.length)try{return e.length===1?Zr(e[0].output):Zr(e.map(n=>({toolCallId:n.toolCallId,output:n.output})))}catch{}return Zr(t)}function CI(t){const e=t.find(r=>r.type==="tool_result");if(!e)return null;const n=e.output;return typeof n=="string"?n:null}const lg=(t,e)=>(t==null?void 0:t.id)??`message-${e}`,Ss=O.forwardRef(({messages:t,isStreaming:e,streamingAssistantId:n,streamingDebounceMs:r,layoutSize:a,enableMessageEditing:i,editingMessageId:o,onStartReached:s,onEdit:l,onRegenerate:c,onCancelEdit:d,className:_,style:p,emptyMessage:m,followNewMessages:E=!0,isNavigatingCheckpoint:f=!1,onScrollAway:g,onAtBottom:S},b)=>{const h=O.useRef(null),v=O.useRef(null),C=O.useRef(!1),R=O.useRef(!0),N=O.useRef(t.length),y=O.useRef(e),I=O.useCallback(G=>{R.current=G,g&&g(!G),S&&S(G)},[g,S]),D=O.useCallback(G=>{},[]),L=O.useMemo(()=>{if(s)return async()=>{if(!C.current){C.current=!0;try{await s()}finally{C.current=!1}}}},[s]);O.useEffect(()=>{N.current;const G=t.length;N.current=G},[t.length]),O.useEffect(()=>()=>{},[]);const q=O.useMemo(()=>!R.current||!E?!1:e&&n&&t.some(A=>A.id===n)?"auto":!1,[e,n,E,t]);O.useEffect(()=>{const G=y.current,A=e;if(y.current=A,!G&&A){const B=setTimeout(()=>{var M;R.current&&t.length>0&&((M=h.current)==null||M.scrollToIndex({index:t.length-1,align:"end",behavior:"auto"}))},0);return()=>clearTimeout(B)}},[e,t.length]),O.useEffect(()=>{console.log("[MessageList] Streaming state:",{isStreaming:e,streamingAssistantId:n,messagesLength:t.length,followOutput:q,isNavigatingCheckpoint:f,isNearBottom:R.current,followNewMessages:E})},[e,n,t.length,q,f,E]);const K=O.useMemo(()=>{},[]),F={display:"flex",flexDirection:"column",overflowY:"auto",overflowAnchor:"auto",overscrollBehavior:"contain"};return t.length===0?u.jsx("div",{className:_,style:p,children:u.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto",children:m||"No messages yet. Start a conversation!"})}):u.jsx("div",{className:_,style:p,children:u.jsx(rO,{ref:G=>{h.current=G},scrollerRef:G=>{v.current=G instanceof HTMLDivElement?G:null},data:t,followOutput:q,initialTopMostItemIndex:K,overscan:200,increaseViewportBy:200,defaultItemHeight:120,atBottomThreshold:50,alignToBottom:!0,startReached:()=>{L&&L()},atBottomStateChange:I,rangeChanged:D,style:{height:"100%",overscrollBehavior:"contain"},computeItemKey:(G,A)=>lg(A,G),components:{Scroller:O.forwardRef((G,A)=>u.jsx("div",{...G,ref:A,style:{...F,...(G==null?void 0:G.style)??{}}}))},itemContent:(G,A)=>{const B=A.role==="user"&&G===t.length-1,M=e&&n===A.id||B&&e,k=lg(A,G);return u.jsx("div",{className:"mb-4 last:mb-0","data-message-id":k,style:{minHeight:M?120:void 0,containIntrinsicSize:M?"auto 120px":void 0,willChange:e&&M?"contents":void 0},children:u.jsx(ag,{message:A,messageIndex:G,isStreamingMessage:e&&n===A.id,streamingDebounceMs:r,isEditing:o===A.id,showActions:i,showTimestamp:!1,showAgentName:!0,layoutSize:a,truncateToolMessages:!1,toolMessagePreviewLength:200,onEdit:l,onRegenerate:()=>c(G),onCancelEdit:d},A.id??`msg-${A.role}-${G}-${A.createdAt??""}`)})}})})});Ss.displayName="MessageList";const pi=1e4;function RI(t){if(typeof t!="string")return String(t);const e=[/<script[^>]*>.*?<\/script>/gi,/<iframe[^>]*>.*?<\/iframe>/gi,/javascript:/gi,/vbscript:/gi,/on\w+\s*=/gi,/<object[^>]*>.*?<\/object>/gi,/<embed[^>]*>.*?<\/embed>/gi,/<form[^>]*>.*?<\/form>/gi];let n=t;for(const a of e)n=n.replace(a,"");return/<[^>]+>/.test(n)&&!/<(?!\/?(?:code|strong|em|b|i|br|p|ul|ol|li|h[1-6])\b)[^>]+>/i.test(n)?n.replace(/<code>(.*?)<\/code>/gi,"`$1`").replace(/<strong>(.*?)<\/strong>/gi,"**$1**").replace(/<b>(.*?)<\/b>/gi,"**$1**").replace(/<em>(.*?)<\/em>/gi,"*$1*").replace(/<i>(.*?)<\/i>/gi,"*$1*").replace(/<br\s*\/?>/gi,`
84
84
  `).replace(/<p>(.*?)<\/p>/gi,`$1
85
85
 
86
86
  `).replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(a,i,o)=>`${"#".repeat(parseInt(i))} ${o}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teodor-new-chat-ui",
3
- "version": "3.0.136",
3
+ "version": "3.0.138",
4
4
  "description": "React chat UI components with streaming support, tool calls, and modern design",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",