teodor-new-chat-ui 4.3.30 → 4.3.31
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.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -12282,7 +12282,7 @@ const ou = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, Ff = W.forwa
|
|
|
12282
12282
|
}
|
|
12283
12283
|
};
|
|
12284
12284
|
}, [a]), te = ct(() => !v || x ? !1 : A ? "auto" : !1, [A, v, x]);
|
|
12285
|
-
return
|
|
12285
|
+
return O.length === 0 ? /* @__PURE__ */ c.jsx("div", { className: f, style: h, children: /* @__PURE__ */ c.jsx("div", { className: "flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto", children: p || "No messages yet. Start a conversation!" }) }) : /* @__PURE__ */ c.jsx("div", { className: f, style: h, children: /* @__PURE__ */ c.jsx(
|
|
12286
12286
|
Uv,
|
|
12287
12287
|
{
|
|
12288
12288
|
ref: (L) => {
|
package/dist/index.umd.js
CHANGED
|
@@ -128,7 +128,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
128
128
|
… [truncated ${i.length-o} chars]`}catch{return""}},n=e.filter(r=>r.type==="tool_end");if(n.length)try{return n.length===1?t(n[0].output):t(n.map(r=>({toolCallId:r.toolCallId,output:r.output})))}catch{}return t(e)}function mw(e){const t=e.find(r=>r.type==="tool_end");if(!t)return null;const n=t.output;return typeof n=="string"?n:null}function gw(e){return e.name&&e.name.trim()?e.name:e.model&&e.model.includes("/")?e.model.split("/").pop()||null:e.model||null}function uf(e){const t=e.updatedAt??e.createdAt??"",n=Array.isArray(e.content)?e.content.map(r=>{switch(r.type){case"text":return`t:${r.text.length}`;case"image_url":return"img";case"file":return"file";case"tool_call":return"call";case"tool_end":return"end";default:return"unknown"}}).join("|"):"";return`${e.id}:${t}:${n}`}function xw({className:e}){const[t,n]=w.useState(0);return w.useEffect(()=>{const r=setInterval(()=>n(o=>(o+1)%4),500);return()=>clearInterval(r)},[]),c.jsxs("span",{"aria-live":"polite",className:ne("inline-block text-xs opacity-70 ml-1",e),children:["Is thinking",".".repeat(t)]})}const df=w.memo(function({message:t,messageIndex:n,isStreamingMessage:r=!1,isEditing:o=!1,showActions:s=!0,showTimestamp:i=!0,showAgentName:a=!0,layoutSize:l="desktop",truncateToolMessages:u=!0,toolMessagePreviewLength:d=200,truncateUserMessages:f=!0,userMessagePreviewLength:h=200,customStyles:p={},onEdit:v,onRegenerate:x,onCancelEdit:g,onCopy:y,activeInterrupt:b,disableInterruptActions:S=!1,onInterruptActionStart:E,onInterruptActionEnd:C}){const[T,I]=w.useState(!1),[_,R]=w.useState("collapsed"),[j,z]=w.useState(!1),{currentThreadId:L}=Go(),{respondToInterrupt:B}=Yo(),{toast:M}=ya(),[q,U]=w.useState({}),[te,$]=w.useState(!1),[F,ie]=w.useState(null),O=l==="phone"||l==="half-screen",G=t.role,ce=G==="tool",be=!(r&&G!=="user"),ge=w.useMemo(()=>{switch(G){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))]"}},[G]),ye=w.useMemo(()=>dw(t.content),[t.content]),V=w.useMemo(()=>fw(t.content),[t.content]),D=w.useMemo(()=>t.content.filter(re=>re.type==="image_url"),[t.content]),X=w.useMemo(()=>t.content.filter(re=>re.type==="file"),[t.content]),Z=w.useMemo(()=>t.content.filter(re=>re.type==="interrupt"),[t.content]),fe=(b==null?void 0:b.id)??null,ae=b==null?void 0:b.value,Q=w.useMemo(()=>pw(t.content),[t.content]);w.useMemo(()=>mw(t.content),[t.content]);const tt=w.useMemo(()=>Q.length<=vr?Q:`${Q.slice(0,vr)}
|
|
129
129
|
… [truncated ${Q.length-vr} chars]`,[Q]),Ze=w.useCallback(async(re="all")=>{const xe=re==="visible"&&ce?tt:ce?Q:ye;async function Me(Le){try{await navigator.clipboard.writeText(Le)}catch{try{const qe=document.createElement("textarea");qe.value=Le,qe.setAttribute("readonly",""),qe.style.position="absolute",qe.style.left="-9999px",document.body.appendChild(qe),qe.select(),document.execCommand("copy"),document.body.removeChild(qe)}catch(qe){throw console.error("Failed to copy:",qe),qe}}}try{await Me(xe),I(!0),setTimeout(()=>I(!1),2e3),y==null||y(xe)}catch(Le){console.error("Failed to copy:",Le)}},[ce,Q,ye,tt,y]),Re=w.useCallback(()=>{if(!v)return;const re=ce?Q:ye;v(t.id,re)},[v,t.id,ce,Q,ye]),ze=w.useCallback(()=>{x==null||x(n)},[x,n]),nt=w.useCallback(async(re,oe,xe)=>{if(!be){re.preventDefault();return}if(q[xe]){re.preventDefault();return}try{const Me=String(oe.url??""),Le=Me.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);if(Le){re.preventDefault();const qe=Le[1],bt=oe.name||`file_${qe}`,ot=oe.mimeType||"application/octet-stream";ie({id:qe,name:bt,mimeType:ot}),$(!0);return}if(Me.startsWith("data:")){re.preventDefault(),U(ot=>({...ot,[xe]:!0}));const qe=`${oe.name}_${oe.size}_${Date.now()}`,bt=M({title:"Fetching file...",description:"",open:!0});try{const ot=await Wv(L??void 0);if(!ot||!Array.isArray(ot))throw new Error("Invalid file list response");const ht=ot.find(Kt=>!Kt||typeof Kt!="object"||!((Kt.filename??"")===(oe.name??""))?!1:typeof oe.size=="number"&&typeof Kt.size=="number"?Kt.size===oe.size:!0);if(!(ht!=null&&ht.id))throw new Error(`File "${oe.name}" is not yet available on the server`);if(!ht.id||!ht.filename)throw new Error("Invalid file data received from server");ie({id:ht.id,name:oe.name||ht.filename||`file_${ht.id}`,mimeType:oe.mimeType||ht.mime_type||"application/octet-stream"}),$(!0),bt.update({id:bt.id,title:"Success",description:`Opened ${oe.name}`,open:!0})}catch(ot){console.error("Failed to fetch server file:",ot);const ht=ot instanceof Error?ot.message:"Unknown error occurred";bt.update({id:bt.id,title:"Failed",description:ht}),M({title:"Failed to fetch file",description:ht,open:!0})}finally{U(ot=>({...ot,[xe]:!1}))}}}catch(Me){console.error("File click error:",Me),U(Le=>({...Le,[xe]:!1}))}},[be,q,M,L]),rt=w.useCallback(()=>{const oe=ne(O?"h-3 w-3":"h-4 w-4","opacity-60 flex-shrink-0",ge);switch(G){case"user":return c.jsx(ue.User,{className:oe});case"assistant":return c.jsx(ue.Bot,{className:oe});case"tool":return c.jsx(ue.Wrench,{className:oe});default:return c.jsx(ue.Bot,{className:oe})}},[O,ge,G]),Pe=w.useCallback(()=>{const re="group relative mb-4 flex w-full";switch(G){case"user":return ne(re,"justify-end");case"assistant":case"tool":case"system":return ne(re,"justify-start");default:return re}},[G]),St=w.useCallback(()=>{const re=ne("rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",O&&"px-3 py-2 text-sm");switch(G){case"user":return ne(re,"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 ne(re,"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 ne(re,"w-full md:max-w-[95%] bg-secondary/50 text-secondary-foreground border border-dashed");case"system":return ne(re,"w-full md:max-w-[85%] bg-accent/40 text-muted-foreground border");default:return ne(re,"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")}},[O,G]),Ct=w.useCallback(async re=>{if(S)return;const oe=(re==null?void 0:re.id)||(re==null?void 0:re.interrupt_id);if(!oe){console.warn("Interrupt part missing id",re);return}try{E==null||E(),await B(oe,!0)}catch(xe){console.error("Failed to approve interrupt:",xe)}finally{C==null||C()}},[S,C,E,B]),kt=w.useCallback(async re=>{if(S)return;const oe=(re==null?void 0:re.id)||(re==null?void 0:re.interrupt_id);if(!oe){console.warn("Interrupt part missing id",re);return}try{E==null||E(),await B(oe,!1)}catch(xe){console.error("Failed to reject interrupt:",xe)}finally{C==null||C()}},[S,C,E,B]),ut=w.useCallback(({part:re,i:oe})=>{if(re.type==="text"){const xe=re.text??"",Me=xe.trim(),Le=af(Me);return Le&&G!=="tool"?c.jsx(yw,{data:Le},oe):G==="user"&&f&&Me.length>h?c.jsxs(Gu,{open:j,onOpenChange:z,children:[c.jsx("div",{className:ne("text-sm text-[hsl(var(--chat-bubble-user-text))]",O&&"text-xs"),children:j?c.jsx(ma,{content:Me,allowHtml:!1}):c.jsxs("pre",{className:ne("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]",O&&"text-xs"),children:[Me.substring(0,h),"..."]})}),c.jsx(Yu,{asChild:!0,children:c.jsx(Ke,{variant:"ghost",size:"sm",className:"h-6 text-xs !text-[hsl(var(--chat-bubble-user-text))]",children:j?c.jsxs(c.Fragment,{children:[c.jsx(ue.ChevronUp,{className:"h-3 w-3 mr-1"})," Show less"]}):c.jsxs(c.Fragment,{children:[c.jsx(ue.ChevronDown,{className:"h-3 w-3 mr-1"})," Show more (",Me.length-h," chars)"]})})})]},oe):c.jsx(ma,{content:xe,allowHtml:!1},oe)}if(re.type==="image_url"){const xe=re;return c.jsx("div",{className:"my-2",children:c.jsx("img",{src:xe.url,alt:xe.alt??"",loading:"lazy",className:"border rounded max-h-[420px] w-auto object-contain"})},oe)}if(re.type==="file"){const xe=re,Me=xe.name||"file";return c.jsxs("a",{href:xe.url,onClick:Le=>nt(Le,xe,oe),className:`inline-flex items-center gap-2 rounded px-2 py-1 text-xs bg-gray-100 border hover:bg-gray-200
|
|
130
130
|
dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20`,children:[q[oe]?c.jsx(ue.Loader,{className:"h-4 w-4 animate-spin"}):null,c.jsxs("span",{className:"truncate max-w-[180px]",children:[Me,q[oe]?" (processing)":""]})]},oe)}if(re.type==="interrupt"){const xe=re,Me=b?fe?(xe==null?void 0:xe.id)===fe:!0:!1,Le=Me?ae??(xe==null?void 0:xe.value):xe==null?void 0:xe.value;return c.jsx(bw,{interruptPart:xe,onApprove:Ct,onReject:kt,disabled:S,isActive:Me,payload:Le},oe)}return null},[nt,q,Ct,kt,G,f,h,j,O,fe,ae,b,S,Z]),et=w.useCallback(()=>c.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/30 rounded",children:[c.jsx(ue.Paperclip,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:"File upload"})]}),[]),Be=w.useCallback(()=>{const re=ye.trim().length>0||D.length>0||X.length>0||Z.length>0;if(!ce&&!re&&!r)return et();if(t.model==="reflection"){const oe=ye.trim(),xe=af(oe);if(xe&&typeof xe=="object")return c.jsx(ww,{data:xe})}if(ce&&V.name==="get_issues"){const oe=t.content.find(Le=>Le.type==="tool_end"),xe=(oe==null?void 0:oe.output)??Q,Me=cf(xe);if(Me)return c.jsx(Sw,{issues:Me})}if(ce){const oe=hw(t.content);if(oe.length>0)return c.jsx("div",{className:"space-y-2",children:oe.map((xe,Me)=>{const Le=typeof xe.output=="string"?xe.output:Os(xe.output),qe=Le.length>vr?`${Le.slice(0,vr)}
|
|
131
|
-
… [truncated ${Le.length-vr} chars]`:Le,bt=_==="expanded";return c.jsxs(Gu,{open:bt,onOpenChange:ot=>R(ot?"expanded":"preview"),children:[c.jsx("div",{className:"flex items-center gap-2 text-xs",children:c.jsx(la,{variant:"outline",children:(xe.name??"tool")+(xe.toolCallId?` • ${xe.toolCallId.slice(0,8)}`:"")})}),c.jsx("div",{className:"font-mono text-sm mt-1",children:c.jsx("pre",{className:"whitespace-pre-wrap break-words",children:bt?qe:qe.slice(0,d)+(qe.length>d?"...":"")})}),c.jsx(Yu,{asChild:!0,children:c.jsx(Ke,{variant:"ghost",size:"sm",className:"h-6 text-xs",children:bt?c.jsxs(c.Fragment,{children:[" ",c.jsx(ue.ChevronUp,{className:"h-3 w-3 mr-1"})," Show less"]}):c.jsxs(c.Fragment,{children:[c.jsx(ue.ChevronDown,{className:"h-3 w-3 mr-1"})," Show more"]})})})]},xe.toolCallId??Me)})})}if(!ce){const oe=c.jsx("div",{className:"space-y-2",children:t.content.map((xe,Me)=>c.jsx(ut,{part:xe,i:Me},Me))});return r?c.jsxs("div",{"aria-busy":"true",role:"status",children:[oe,c.jsx(xw,{className:ge})]}):oe}},[ye,D.length,X.length,Z.length,r,t.model,ce,V.name,Q,_,u,et,ge]),dt=w.useMemo(()=>gw(t),[t]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:ne(Pe(),p.container),children:c.jsxs("div",{className:ne(St(),p.content),children:[(i||a||ce)&&c.jsxs("div",{className:ne("flex items-center justify-between mb-2 pb-2 border-b border-current/10",O&&"mb-1 pb-1",ge,p.header),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[rt(),a&&dt&&c.jsx("span",{className:ne("font-medium",O?"text-xs":"text-sm"),children:dt}),ce&&V.name&&c.jsxs(la,{variant:"outline",className:ne("text-xs flex items-center gap-1 cursor-pointer",ge,"border border-current/40",O&&"text-xs h-4"),role:"button",tabIndex:0,"aria-expanded":_!=="collapsed",onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),R(oe=>oe==="collapsed"?"preview":"collapsed"))},onClick:()=>R(re=>re==="collapsed"?"preview":"collapsed"),children:[c.jsx("span",{children:V.name}),c.jsx("span",{className:"inline-flex items-center",children:_!=="collapsed"?c.jsx(ue.ChevronUp,{className:"h-3 w-3"}):c.jsx(ue.ChevronDown,{className:"h-3 w-3"})})]}),ce&&!V.name&&c.jsx(Ke,{variant:"ghost",size:"sm",className:ne("h-6 px-1",ge,"hover:bg-foreground/10"),onClick:()=>R(re=>re==="collapsed"?"preview":"collapsed"),children:c.jsxs("span",{className:"text-xs flex items-center gap-1",children:["Tool Output ",_!=="collapsed"?c.jsx(ue.ChevronUp,{className:"h-3 w-3"}):c.jsx(ue.ChevronDown,{className:"h-3 w-3"})]})})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[i&&t.createdAt&&c.jsx("time",{className:ne("text-xs opacity-60",ge,O&&"text-xs"),dateTime:new Date(t.createdAt).toISOString(),title:new Date(t.createdAt).toLocaleString(),children:new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(t.createdAt))}),s&&!o&&c.jsxs("div",{className:ne("opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",p.actions),children:[c.jsxs("div",{className:"relative",children:[c.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>Ze(ce?"visible":"all"),className:ne("h-6 w-6 p-0 hover:bg-foreground/10",ge,O&&"h-5 w-5"),"aria-label":ce?"Copy visible":"Copy message",title:ce?"Copy visible portion":"Copy message",children:c.jsx(ue.Copy,{className:ne(T?"text-success":ge,O?"h-3 w-3":"h-4 w-4")})}),ce&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>Ze("all"),className:ne("h-6 px-1 text-xs hover:bg-foreground/10",ge),"aria-label":"Copy all (may be large)",title:"Copy all (may be large)",children:"all"})]}),G==="user"&&v&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:Re,className:ne("h-6 w-6 p-0 hover:bg-foreground/10",ge,O&&"h-5 w-5"),"aria-label":"Edit message",children:c.jsx(ue.Edit,{className:ne(ge,O?"h-3 w-3":"h-4 w-4")})}),G==="assistant"&&x&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:ze,className:ne("h-6 w-6 p-0 hover:bg-foreground/10",ge,O&&"h-5 w-5"),"aria-label":"Regenerate response",children:c.jsx(ue.RotateCcw,{className:ne(ge,O?"h-3 w-3":"h-4 w-4")})})]})]})]}),c.jsx("div",{className:"relative",children:Be()}),ce&&_==="expanded"&&(V.toolCallId||V.name)&&c.jsxs("div",{className:ne("mt-2 pt-2 border-t border-current/10 text-xs opacity-60",O&&"text-xs"),children:[V.name&&c.jsxs("div",{children:["Function: ",V.name]}),V.toolCallId&&c.jsxs("div",{children:["Call ID: ",V.toolCallId]})]}),!(i||a||ce)&&s&&!o&&c.jsxs("div",{className:ne("absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",p.actions),children:[c.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>Ze(),className:ne("h-6 w-6 p-0 hover:bg-background/50 text-current",O&&"h-5 w-5"),children:c.jsx(ue.Copy,{className:ne(T?"text-success":"text-current",O?"h-3 w-3":"h-4 w-4")})}),G==="user"&&v&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:Re,className:ne("h-6 w-6 p-0 hover:bg-background/50 text-current",O&&"h-5 w-5"),children:c.jsx(ue.Edit,{className:ne("text-current",O?"h-3 w-3":"h-4 w-4")})}),G==="assistant"&&x&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:ze,className:ne("h-6 w-6 p-0 hover:bg-background/50 text-current",O&&"h-5 w-5"),children:c.jsx(ue.RotateCcw,{className:ne("text-current",O?"h-3 w-3":"h-4 w-4")})})]})]})}),F&&c.jsx(uw,{isOpen:te,onClose:()=>{$(!1),ie(null)},fileId:F.id,fileName:F.name,mimeType:F.mimeType})]})},(e,t)=>{var i,a,l,u,d,f,h,p;if(t.isStreamingMessage||e.isStreamingMessage||!(e.message.id===t.message.id&&uf(e.message)===uf(t.message)))return!1;const o=["isEditing","showActions","layoutSize","showTimestamp","showAgentName","truncateToolMessages","toolMessagePreviewLength","truncateUserMessages","userMessagePreviewLength"].every(v=>e[v]===t[v]),s=((i=e.customStyles)==null?void 0:i.container)===((a=t.customStyles)==null?void 0:a.container)&&((l=e.customStyles)==null?void 0:l.content)===((u=t.customStyles)==null?void 0:u.content)&&((d=e.customStyles)==null?void 0:d.actions)===((f=t.customStyles)==null?void 0:f.actions)&&((h=e.customStyles)==null?void 0:h.header)===((p=t.customStyles)==null?void 0:p.header);return o&&s});function yw({data:e}){if(Array.isArray(e))return e.every(n=>n===null||["string","number","boolean"].includes(typeof n))?c.jsx("div",{className:Ms,children:c.jsx("ul",{className:"list-disc pl-5",children:e.map((n,r)=>c.jsx("li",{children:String(n)},r))})}):c.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Os(e)});if(e&&typeof e=="object"){const t=Array.isArray(e.distilled_facts)?e.distilled_facts:null,n=Array.isArray(e.follow_up_queries)?e.follow_up_queries:null,r=typeof e.is_sufficient=="boolean"?e.is_sufficient:void 0;if(t||n||typeof r=="boolean")return c.jsxs("div",{className:Ms,children:[typeof r=="boolean"&&c.jsxs("p",{children:[c.jsx("strong",{children:"Is sufficient:"})," ",r?"Yes":"No"]}),n&&n.length>0&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"Follow-up queries:"})}),c.jsx("ul",{className:"list-disc pl-5",children:n.map((s,i)=>c.jsx("li",{children:String(s)},i))})]}),t&&t.length>0&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"Facts:"})}),c.jsx("ul",{className:"list-disc pl-5",children:t.map((s,i)=>c.jsx("li",{children:String(s)},i))})]})]});const o=Object.entries(e);return c.jsx("div",{className:Ms,children:c.jsx("dl",{className:"mt-0",children:o.map(([s,i])=>c.jsxs("div",{className:"mb-1",children:[c.jsxs("dt",{className:"inline font-medium mr-1",children:[s,":"]}),c.jsx("dd",{className:"inline",children:vw(i)})]},s))})})}return c.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Os(e)})}function vw(e){if(e==null)return String(e);const t=typeof e;if(t==="string"||t==="number"||t==="boolean")return String(e);if(Array.isArray(e)&&e.every(r=>r===null||["string","number","boolean"].includes(typeof r)))return e.join(", ");try{return c.jsx("code",{className:"text-xs",children:JSON.stringify(vo(e))})}catch{return String(e)}}function bw({interruptPart:e,onApprove:t,onReject:n,disabled:r,isActive:o,payload:s}){const i=e.title??"Approve the result?";let a=null;if(s!=null)if(typeof s=="string")a=c.jsx("p",{className:"text-sm leading-relaxed text-blue-800/90 dark:text-blue-200/90 whitespace-pre-wrap",children:s});else{const u=Os(s);a=c.jsx("pre",{className:"max-h-48 overflow-auto rounded bg-blue-100/60 p-2 text-xs text-blue-900/90 dark:bg-blue-900/40 dark:text-blue-100/80",children:u})}const l=o?"Please approve or reject this action to resume the workflow.":"Waiting for approval from another participant.";return c.jsxs(po,{className:ne("border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/10 transition-shadow",o?"shadow-md ring-1 ring-blue-300 dark:ring-blue-500/70":"opacity-80"),children:[c.jsxs(mo,{className:"pb-3",children:[c.jsx(go,{className:"text-blue-900 dark:text-blue-100 text-base",children:i}),c.jsx(Xu,{className:"text-blue-700 dark:text-blue-300 text-sm",children:l})]}),a&&c.jsx(xo,{className:"pt-0 pb-3",children:a}),c.jsx(Ju,{className:"pt-0",children:c.jsxs("div",{className:"flex gap-2 ml-auto",children:[c.jsx(Ke,{size:"sm",variant:"outline",onClick:()=>n(e),className:"border-red-300 text-red-700 hover:bg-red-50 dark:border-red-700 dark:text-red-300 dark:hover:bg-red-950/50",disabled:r||!o,children:"Reject"}),c.jsx(Ke,{size:"sm",onClick:()=>t(e),className:"bg-blue-600 hover:bg-blue-700 text-white",disabled:r||!o,children:"Approve"})]})})]})}function ww({data:e}){return c.jsx("dl",{className:"grid grid-cols-1 gap-y-2",children:Object.entries(e).map(([t,n])=>c.jsxs("div",{className:"flex",children:[c.jsxs("dt",{className:"font-semibold mr-2",children:[t,":"]}),c.jsx("dd",{className:"flex-1 break-words",children:Array.isArray(n)?n.map((r,o)=>c.jsxs("div",{className:"ml-4 break-words",children:["- ",String(r)]},o)):String(n)})]},t))})}function Sw({issues:e}){const t=[{key:"desirability",title:"Desirability"},{key:"feasibility",title:"Feasibility"},{key:"viability",title:"Viability"},{key:"other",title:"Other"}];return c.jsx("div",{className:Ms,children:t.map(n=>{const r=e[n.key];return!r||!r.length?null:c.jsxs("div",{className:"mb-4",children:[c.jsxs("h4",{className:"font-semibold mb-2",children:[n.title," (",r.length,")"]}),c.jsx("ol",{className:"list-decimal pl-5 space-y-2",children:r.map((o,s)=>c.jsxs("li",{children:[c.jsx("div",{className:"font-medium",children:o.title}),c.jsx("div",{className:"text-sm text-muted-foreground",children:o.description})]},s))})]},n.key)})})}const ff=(e,t)=>(e==null?void 0:e.id)??`message-${t}`,Pa=w.forwardRef(({messages:e,isStreaming:t,streamingAssistantId:n,streamingDebounceMs:r,layoutSize:o,enableMessageEditing:s,editingMessageId:i,onStartReached:a,onEdit:l,onRegenerate:u,onCancelEdit:d,className:f,style:h,emptyMessage:p,followNewMessages:v=!0,isNavigatingCheckpoint:x=!1,onScrollAway:g,onAtBottom:y,activeInterrupt:b,disableInterruptActions:S=!1,onInterruptActionStart:E,onInterruptActionEnd:C},T)=>{const I=w.useRef(null),_=w.useRef(null),R=w.useRef(!1),[j,z]=w.useState(!0),L=w.useMemo(()=>b?e.some($=>Array.isArray($==null?void 0:$.content)&&$.content.some(F=>F&&F.type==="interrupt"&&(F.id??F.interrupt_id)===b.id)):!1,[b,e]),B=w.useMemo(()=>{if(!b||L)return null;const $=b.id&&String(b.id).trim()?String(b.id).trim():"pending-interrupt";let F;const ie=b.value;if(ie&&typeof ie=="object"&&!Array.isArray(ie)){const O=ie.title;typeof O=="string"&&O.trim()&&(F=O.trim())}return{id:`interrupt-${$}`,role:"system",createdAt:new Date().toISOString(),content:[{type:"interrupt",id:$,value:ie,title:F}]}},[b,L]),M=w.useMemo(()=>B?[...e,B]:e,[e,B]),q=w.useCallback($=>{z($),g&&g(!$),y&&y($)},[g,y]),U=w.useMemo(()=>{if(a)return async()=>{if(!R.current){R.current=!0;try{await a()}finally{R.current=!1}}}},[a]),te=w.useMemo(()=>!v||x?!1:j?"auto":!1,[j,v,x]);return e.length===0?c.jsx("div",{className:f,style:h,children:c.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto",children:p||"No messages yet. Start a conversation!"})}):c.jsx("div",{className:f,style:h,children:c.jsx(Gy,{ref:$=>{I.current=$},scrollerRef:$=>{_.current=$ instanceof HTMLDivElement?$:null},data:M,followOutput:te,overscan:200,increaseViewportBy:{top:100,bottom:200},defaultItemHeight:80,atBottomThreshold:50,alignToBottom:!1,startReached:()=>{U&&U()},atBottomStateChange:q,style:{height:"100%",overscrollBehavior:"contain"},computeItemKey:($,F)=>ff(F,$),itemContent:($,F)=>{const ie=ff(F,$);return c.jsx("div",{className:"mb-4 last:mb-0","data-message-id":ie,style:{minHeight:"60px",containIntrinsicSize:"auto 120px"},children:c.jsx(df,{message:F,messageIndex:$,isStreamingMessage:t&&n===F.id,streamingDebounceMs:r,isEditing:i===F.id,showActions:s,showTimestamp:!1,showAgentName:!0,layoutSize:o,truncateToolMessages:!1,toolMessagePreviewLength:200,onEdit:l,onRegenerate:()=>u($),onCancelEdit:d,activeInterrupt:b,disableInterruptActions:S,onInterruptActionStart:E,onInterruptActionEnd:C})})}})})});Pa.displayName="MessageList";const Ds=1e4;function Cw(e){if(typeof e!="string")return String(e);const t=[/<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=e;for(const o of t)n=n.replace(o,"");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,`
|
|
131
|
+
… [truncated ${Le.length-vr} chars]`:Le,bt=_==="expanded";return c.jsxs(Gu,{open:bt,onOpenChange:ot=>R(ot?"expanded":"preview"),children:[c.jsx("div",{className:"flex items-center gap-2 text-xs",children:c.jsx(la,{variant:"outline",children:(xe.name??"tool")+(xe.toolCallId?` • ${xe.toolCallId.slice(0,8)}`:"")})}),c.jsx("div",{className:"font-mono text-sm mt-1",children:c.jsx("pre",{className:"whitespace-pre-wrap break-words",children:bt?qe:qe.slice(0,d)+(qe.length>d?"...":"")})}),c.jsx(Yu,{asChild:!0,children:c.jsx(Ke,{variant:"ghost",size:"sm",className:"h-6 text-xs",children:bt?c.jsxs(c.Fragment,{children:[" ",c.jsx(ue.ChevronUp,{className:"h-3 w-3 mr-1"})," Show less"]}):c.jsxs(c.Fragment,{children:[c.jsx(ue.ChevronDown,{className:"h-3 w-3 mr-1"})," Show more"]})})})]},xe.toolCallId??Me)})})}if(!ce){const oe=c.jsx("div",{className:"space-y-2",children:t.content.map((xe,Me)=>c.jsx(ut,{part:xe,i:Me},Me))});return r?c.jsxs("div",{"aria-busy":"true",role:"status",children:[oe,c.jsx(xw,{className:ge})]}):oe}},[ye,D.length,X.length,Z.length,r,t.model,ce,V.name,Q,_,u,et,ge]),dt=w.useMemo(()=>gw(t),[t]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:ne(Pe(),p.container),children:c.jsxs("div",{className:ne(St(),p.content),children:[(i||a||ce)&&c.jsxs("div",{className:ne("flex items-center justify-between mb-2 pb-2 border-b border-current/10",O&&"mb-1 pb-1",ge,p.header),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[rt(),a&&dt&&c.jsx("span",{className:ne("font-medium",O?"text-xs":"text-sm"),children:dt}),ce&&V.name&&c.jsxs(la,{variant:"outline",className:ne("text-xs flex items-center gap-1 cursor-pointer",ge,"border border-current/40",O&&"text-xs h-4"),role:"button",tabIndex:0,"aria-expanded":_!=="collapsed",onKeyDown:re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),R(oe=>oe==="collapsed"?"preview":"collapsed"))},onClick:()=>R(re=>re==="collapsed"?"preview":"collapsed"),children:[c.jsx("span",{children:V.name}),c.jsx("span",{className:"inline-flex items-center",children:_!=="collapsed"?c.jsx(ue.ChevronUp,{className:"h-3 w-3"}):c.jsx(ue.ChevronDown,{className:"h-3 w-3"})})]}),ce&&!V.name&&c.jsx(Ke,{variant:"ghost",size:"sm",className:ne("h-6 px-1",ge,"hover:bg-foreground/10"),onClick:()=>R(re=>re==="collapsed"?"preview":"collapsed"),children:c.jsxs("span",{className:"text-xs flex items-center gap-1",children:["Tool Output ",_!=="collapsed"?c.jsx(ue.ChevronUp,{className:"h-3 w-3"}):c.jsx(ue.ChevronDown,{className:"h-3 w-3"})]})})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[i&&t.createdAt&&c.jsx("time",{className:ne("text-xs opacity-60",ge,O&&"text-xs"),dateTime:new Date(t.createdAt).toISOString(),title:new Date(t.createdAt).toLocaleString(),children:new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(t.createdAt))}),s&&!o&&c.jsxs("div",{className:ne("opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",p.actions),children:[c.jsxs("div",{className:"relative",children:[c.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>Ze(ce?"visible":"all"),className:ne("h-6 w-6 p-0 hover:bg-foreground/10",ge,O&&"h-5 w-5"),"aria-label":ce?"Copy visible":"Copy message",title:ce?"Copy visible portion":"Copy message",children:c.jsx(ue.Copy,{className:ne(T?"text-success":ge,O?"h-3 w-3":"h-4 w-4")})}),ce&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>Ze("all"),className:ne("h-6 px-1 text-xs hover:bg-foreground/10",ge),"aria-label":"Copy all (may be large)",title:"Copy all (may be large)",children:"all"})]}),G==="user"&&v&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:Re,className:ne("h-6 w-6 p-0 hover:bg-foreground/10",ge,O&&"h-5 w-5"),"aria-label":"Edit message",children:c.jsx(ue.Edit,{className:ne(ge,O?"h-3 w-3":"h-4 w-4")})}),G==="assistant"&&x&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:ze,className:ne("h-6 w-6 p-0 hover:bg-foreground/10",ge,O&&"h-5 w-5"),"aria-label":"Regenerate response",children:c.jsx(ue.RotateCcw,{className:ne(ge,O?"h-3 w-3":"h-4 w-4")})})]})]})]}),c.jsx("div",{className:"relative",children:Be()}),ce&&_==="expanded"&&(V.toolCallId||V.name)&&c.jsxs("div",{className:ne("mt-2 pt-2 border-t border-current/10 text-xs opacity-60",O&&"text-xs"),children:[V.name&&c.jsxs("div",{children:["Function: ",V.name]}),V.toolCallId&&c.jsxs("div",{children:["Call ID: ",V.toolCallId]})]}),!(i||a||ce)&&s&&!o&&c.jsxs("div",{className:ne("absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity","flex items-center gap-1",p.actions),children:[c.jsx(Ke,{variant:"ghost",size:"sm",onClick:()=>Ze(),className:ne("h-6 w-6 p-0 hover:bg-background/50 text-current",O&&"h-5 w-5"),children:c.jsx(ue.Copy,{className:ne(T?"text-success":"text-current",O?"h-3 w-3":"h-4 w-4")})}),G==="user"&&v&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:Re,className:ne("h-6 w-6 p-0 hover:bg-background/50 text-current",O&&"h-5 w-5"),children:c.jsx(ue.Edit,{className:ne("text-current",O?"h-3 w-3":"h-4 w-4")})}),G==="assistant"&&x&&c.jsx(Ke,{variant:"ghost",size:"sm",onClick:ze,className:ne("h-6 w-6 p-0 hover:bg-background/50 text-current",O&&"h-5 w-5"),children:c.jsx(ue.RotateCcw,{className:ne("text-current",O?"h-3 w-3":"h-4 w-4")})})]})]})}),F&&c.jsx(uw,{isOpen:te,onClose:()=>{$(!1),ie(null)},fileId:F.id,fileName:F.name,mimeType:F.mimeType})]})},(e,t)=>{var i,a,l,u,d,f,h,p;if(t.isStreamingMessage||e.isStreamingMessage||!(e.message.id===t.message.id&&uf(e.message)===uf(t.message)))return!1;const o=["isEditing","showActions","layoutSize","showTimestamp","showAgentName","truncateToolMessages","toolMessagePreviewLength","truncateUserMessages","userMessagePreviewLength"].every(v=>e[v]===t[v]),s=((i=e.customStyles)==null?void 0:i.container)===((a=t.customStyles)==null?void 0:a.container)&&((l=e.customStyles)==null?void 0:l.content)===((u=t.customStyles)==null?void 0:u.content)&&((d=e.customStyles)==null?void 0:d.actions)===((f=t.customStyles)==null?void 0:f.actions)&&((h=e.customStyles)==null?void 0:h.header)===((p=t.customStyles)==null?void 0:p.header);return o&&s});function yw({data:e}){if(Array.isArray(e))return e.every(n=>n===null||["string","number","boolean"].includes(typeof n))?c.jsx("div",{className:Ms,children:c.jsx("ul",{className:"list-disc pl-5",children:e.map((n,r)=>c.jsx("li",{children:String(n)},r))})}):c.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Os(e)});if(e&&typeof e=="object"){const t=Array.isArray(e.distilled_facts)?e.distilled_facts:null,n=Array.isArray(e.follow_up_queries)?e.follow_up_queries:null,r=typeof e.is_sufficient=="boolean"?e.is_sufficient:void 0;if(t||n||typeof r=="boolean")return c.jsxs("div",{className:Ms,children:[typeof r=="boolean"&&c.jsxs("p",{children:[c.jsx("strong",{children:"Is sufficient:"})," ",r?"Yes":"No"]}),n&&n.length>0&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"Follow-up queries:"})}),c.jsx("ul",{className:"list-disc pl-5",children:n.map((s,i)=>c.jsx("li",{children:String(s)},i))})]}),t&&t.length>0&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"Facts:"})}),c.jsx("ul",{className:"list-disc pl-5",children:t.map((s,i)=>c.jsx("li",{children:String(s)},i))})]})]});const o=Object.entries(e);return c.jsx("div",{className:Ms,children:c.jsx("dl",{className:"mt-0",children:o.map(([s,i])=>c.jsxs("div",{className:"mb-1",children:[c.jsxs("dt",{className:"inline font-medium mr-1",children:[s,":"]}),c.jsx("dd",{className:"inline",children:vw(i)})]},s))})})}return c.jsx("pre",{className:"font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words",children:Os(e)})}function vw(e){if(e==null)return String(e);const t=typeof e;if(t==="string"||t==="number"||t==="boolean")return String(e);if(Array.isArray(e)&&e.every(r=>r===null||["string","number","boolean"].includes(typeof r)))return e.join(", ");try{return c.jsx("code",{className:"text-xs",children:JSON.stringify(vo(e))})}catch{return String(e)}}function bw({interruptPart:e,onApprove:t,onReject:n,disabled:r,isActive:o,payload:s}){const i=e.title??"Approve the result?";let a=null;if(s!=null)if(typeof s=="string")a=c.jsx("p",{className:"text-sm leading-relaxed text-blue-800/90 dark:text-blue-200/90 whitespace-pre-wrap",children:s});else{const u=Os(s);a=c.jsx("pre",{className:"max-h-48 overflow-auto rounded bg-blue-100/60 p-2 text-xs text-blue-900/90 dark:bg-blue-900/40 dark:text-blue-100/80",children:u})}const l=o?"Please approve or reject this action to resume the workflow.":"Waiting for approval from another participant.";return c.jsxs(po,{className:ne("border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/10 transition-shadow",o?"shadow-md ring-1 ring-blue-300 dark:ring-blue-500/70":"opacity-80"),children:[c.jsxs(mo,{className:"pb-3",children:[c.jsx(go,{className:"text-blue-900 dark:text-blue-100 text-base",children:i}),c.jsx(Xu,{className:"text-blue-700 dark:text-blue-300 text-sm",children:l})]}),a&&c.jsx(xo,{className:"pt-0 pb-3",children:a}),c.jsx(Ju,{className:"pt-0",children:c.jsxs("div",{className:"flex gap-2 ml-auto",children:[c.jsx(Ke,{size:"sm",variant:"outline",onClick:()=>n(e),className:"border-red-300 text-red-700 hover:bg-red-50 dark:border-red-700 dark:text-red-300 dark:hover:bg-red-950/50",disabled:r||!o,children:"Reject"}),c.jsx(Ke,{size:"sm",onClick:()=>t(e),className:"bg-blue-600 hover:bg-blue-700 text-white",disabled:r||!o,children:"Approve"})]})})]})}function ww({data:e}){return c.jsx("dl",{className:"grid grid-cols-1 gap-y-2",children:Object.entries(e).map(([t,n])=>c.jsxs("div",{className:"flex",children:[c.jsxs("dt",{className:"font-semibold mr-2",children:[t,":"]}),c.jsx("dd",{className:"flex-1 break-words",children:Array.isArray(n)?n.map((r,o)=>c.jsxs("div",{className:"ml-4 break-words",children:["- ",String(r)]},o)):String(n)})]},t))})}function Sw({issues:e}){const t=[{key:"desirability",title:"Desirability"},{key:"feasibility",title:"Feasibility"},{key:"viability",title:"Viability"},{key:"other",title:"Other"}];return c.jsx("div",{className:Ms,children:t.map(n=>{const r=e[n.key];return!r||!r.length?null:c.jsxs("div",{className:"mb-4",children:[c.jsxs("h4",{className:"font-semibold mb-2",children:[n.title," (",r.length,")"]}),c.jsx("ol",{className:"list-decimal pl-5 space-y-2",children:r.map((o,s)=>c.jsxs("li",{children:[c.jsx("div",{className:"font-medium",children:o.title}),c.jsx("div",{className:"text-sm text-muted-foreground",children:o.description})]},s))})]},n.key)})})}const ff=(e,t)=>(e==null?void 0:e.id)??`message-${t}`,Pa=w.forwardRef(({messages:e,isStreaming:t,streamingAssistantId:n,streamingDebounceMs:r,layoutSize:o,enableMessageEditing:s,editingMessageId:i,onStartReached:a,onEdit:l,onRegenerate:u,onCancelEdit:d,className:f,style:h,emptyMessage:p,followNewMessages:v=!0,isNavigatingCheckpoint:x=!1,onScrollAway:g,onAtBottom:y,activeInterrupt:b,disableInterruptActions:S=!1,onInterruptActionStart:E,onInterruptActionEnd:C},T)=>{const I=w.useRef(null),_=w.useRef(null),R=w.useRef(!1),[j,z]=w.useState(!0),L=w.useMemo(()=>b?e.some($=>Array.isArray($==null?void 0:$.content)&&$.content.some(F=>F&&F.type==="interrupt"&&(F.id??F.interrupt_id)===b.id)):!1,[b,e]),B=w.useMemo(()=>{if(!b||L)return null;const $=b.id&&String(b.id).trim()?String(b.id).trim():"pending-interrupt";let F;const ie=b.value;if(ie&&typeof ie=="object"&&!Array.isArray(ie)){const O=ie.title;typeof O=="string"&&O.trim()&&(F=O.trim())}return{id:`interrupt-${$}`,role:"system",createdAt:new Date().toISOString(),content:[{type:"interrupt",id:$,value:ie,title:F}]}},[b,L]),M=w.useMemo(()=>B?[...e,B]:e,[e,B]),q=w.useCallback($=>{z($),g&&g(!$),y&&y($)},[g,y]),U=w.useMemo(()=>{if(a)return async()=>{if(!R.current){R.current=!0;try{await a()}finally{R.current=!1}}}},[a]),te=w.useMemo(()=>!v||x?!1:j?"auto":!1,[j,v,x]);return M.length===0?c.jsx("div",{className:f,style:h,children:c.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-center max-w-md mx-auto",children:p||"No messages yet. Start a conversation!"})}):c.jsx("div",{className:f,style:h,children:c.jsx(Gy,{ref:$=>{I.current=$},scrollerRef:$=>{_.current=$ instanceof HTMLDivElement?$:null},data:M,followOutput:te,overscan:200,increaseViewportBy:{top:100,bottom:200},defaultItemHeight:80,atBottomThreshold:50,alignToBottom:!1,startReached:()=>{U&&U()},atBottomStateChange:q,style:{height:"100%",overscrollBehavior:"contain"},computeItemKey:($,F)=>ff(F,$),itemContent:($,F)=>{const ie=ff(F,$);return c.jsx("div",{className:"mb-4 last:mb-0","data-message-id":ie,style:{minHeight:"60px",containIntrinsicSize:"auto 120px"},children:c.jsx(df,{message:F,messageIndex:$,isStreamingMessage:t&&n===F.id,streamingDebounceMs:r,isEditing:i===F.id,showActions:s,showTimestamp:!1,showAgentName:!0,layoutSize:o,truncateToolMessages:!1,toolMessagePreviewLength:200,onEdit:l,onRegenerate:()=>u($),onCancelEdit:d,activeInterrupt:b,disableInterruptActions:S,onInterruptActionStart:E,onInterruptActionEnd:C})})}})})});Pa.displayName="MessageList";const Ds=1e4;function Cw(e){if(typeof e!="string")return String(e);const t=[/<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=e;for(const o of t)n=n.replace(o,"");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,`
|
|
132
132
|
`).replace(/<p>(.*?)<\/p>/gi,`$1
|
|
133
133
|
|
|
134
134
|
`).replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(o,s,i)=>`${"#".repeat(parseInt(s))} ${i}
|
package/package.json
CHANGED