@collective-intelligence/ui-react 0.6.0 → 0.7.0

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.
Files changed (83) hide show
  1. package/README.md +19 -0
  2. package/dist/chat.js +1 -1
  3. package/dist/components/ai-elements/index.js +1 -1
  4. package/dist/components/icons/index.d.ts +184 -1
  5. package/dist/components/icons/index.js +1 -1
  6. package/dist/components/illustrations/index.js +1 -1
  7. package/dist/components/ui/index.js +4 -4
  8. package/dist/components/ui-extensions/atoms/ThemeToggle/index.js +1 -1
  9. package/dist/components/ui-extensions/hooks/use-mobile.js +1 -1
  10. package/dist/components/ui-extensions/index.js +6 -6
  11. package/dist/components/ui-extensions/molecules/LabeledField/index.d.ts +22 -0
  12. package/dist/components/ui-extensions/molecules/LabeledField/index.js +2 -0
  13. package/dist/components/ui-extensions/molecules/VideoPlayer/index.js +2 -2
  14. package/dist/hooks/index.js +1 -1
  15. package/dist/hooks/operations.js +1 -1
  16. package/dist/hooks/use-debounced-callback.js +1 -1
  17. package/dist/hooks/use-mount-action.js +1 -1
  18. package/dist/index-05ch8g3p.js +2 -0
  19. package/dist/{index-qbwndfn2.js → index-1amahhaz.js} +2 -2
  20. package/dist/index-2136bczj.js +2 -0
  21. package/dist/{index-m0v264jr.js → index-4r9c455p.js} +2 -2
  22. package/dist/index-4vk89see.js +2 -0
  23. package/dist/index-4xymfb7h.js +2 -0
  24. package/dist/index-50pv1cer.js +2 -0
  25. package/dist/{index-vx2b9cz3.js → index-5x3deeat.js} +2 -2
  26. package/dist/{index-fnk7gsdd.js → index-6aftpcjv.js} +2 -2
  27. package/dist/index-74qkvrg9.js +2 -0
  28. package/dist/{index-1hxjsnw5.js → index-79sav2qr.js} +2 -2
  29. package/dist/index-ar540v2r.js +2 -0
  30. package/dist/{index-ecvn2gnv.js → index-bpnj24pg.js} +1 -1
  31. package/dist/index-d6srr7et.js +2 -0
  32. package/dist/{index-2yf6mq9g.js → index-dea72se6.js} +2 -2
  33. package/dist/index-drbb68sv.js +2 -0
  34. package/dist/{index-rjemhrz1.js → index-e503pv3f.js} +2 -2
  35. package/dist/index-eccj25rh.js +2 -0
  36. package/dist/{index-7j277075.js → index-em3kg0cy.js} +1 -1
  37. package/dist/index-eyr85r2d.js +2 -0
  38. package/dist/index-f22spsh5.js +2 -0
  39. package/dist/index-h7m6anb3.js +7 -0
  40. package/dist/index-hmd0rx9g.js +2 -0
  41. package/dist/index-hqx38rgx.js +0 -0
  42. package/dist/index-j136rmty.js +1 -0
  43. package/dist/index-k1f6eehk.js +2 -0
  44. package/dist/{index-zmwpsfzp.js → index-m7gvtt3h.js} +2 -2
  45. package/dist/index-ncrdjrq1.js +2 -0
  46. package/dist/index-ndjegtyf.js +2 -0
  47. package/dist/{index-4cds99c5.js → index-q5rfnpnm.js} +2 -2
  48. package/dist/{index-9289ppfk.js → index-r2keb0zb.js} +2 -2
  49. package/dist/index-ra03yvht.js +2 -0
  50. package/dist/index-rqqztw4a.js +42 -0
  51. package/dist/index-s3nshy6x.js +2 -0
  52. package/dist/{index-6r0znbzv.js → index-xmk5as68.js} +2 -2
  53. package/dist/index-xqct5yan.js +2 -0
  54. package/dist/{index-9gtg7nt7.js → index-yp7dwqdt.js} +2 -2
  55. package/dist/index-yqjasa46.js +2 -0
  56. package/dist/index-z6vdzwb1.js +2 -0
  57. package/dist/{index-0gzm7bb9.js → index-z9tsk9ev.js} +2 -2
  58. package/dist/{index-064d20xp.js → index-zwm9cyre.js} +2 -2
  59. package/dist/index.js +1 -1
  60. package/dist/resources.js +1 -1
  61. package/dist/tokens/theme.js +1 -1
  62. package/dist/utils/cn.js +1 -1
  63. package/package.json +8 -2
  64. package/dist/index-2twj52t7.js +0 -2
  65. package/dist/index-64r6cav3.js +0 -1
  66. package/dist/index-ab3fc47y.js +0 -2
  67. package/dist/index-b1wfq5b8.js +0 -2
  68. package/dist/index-dg126t3v.js +0 -2
  69. package/dist/index-dvvkk1vk.js +0 -2
  70. package/dist/index-ggr2edm8.js +0 -2
  71. package/dist/index-ngpxevag.js +0 -2
  72. package/dist/index-nxbvv8m4.js +0 -2
  73. package/dist/index-pearjjhb.js +0 -2
  74. package/dist/index-r2snvwyb.js +0 -42
  75. package/dist/index-r5ds1mtq.js +0 -2
  76. package/dist/index-r7hjj3ek.js +0 -2
  77. package/dist/index-rgbg5bsy.js +0 -2
  78. package/dist/index-sd38wa4w.js +0 -2
  79. package/dist/index-t9yq7kfg.js +0 -2
  80. package/dist/index-tcwzyy71.js +0 -2
  81. package/dist/index-vyhk8kgm.js +0 -6
  82. package/dist/index-ykjbsyeq.js +0 -2
  83. package/dist/index-zrw7ne3f.js +0 -2
package/README.md CHANGED
@@ -390,6 +390,25 @@ description to their control with `aria-describedby`. With `CardOption` and a
390
390
  custom `control`, pass a `descriptionId` and set the same id as the
391
391
  `aria-describedby` of your control.
392
392
 
393
+ ## Labelled field
394
+
395
+ `LabeledField` shows a `<label for={id}>` above the control that its children
396
+ render, and an optional `help` text or `error` below it. Import it from
397
+ `@collective-intelligence/ui-react/ui-extensions`, or from its own subpath
398
+ `@collective-intelligence/ui-react/ui-extensions/labeled-field`. The
399
+ `ui-extensions` entry also loads its Markdown components and thus
400
+ `react-markdown`; the subpath does not. Use the subpath in a package that
401
+ needs only the field.
402
+
403
+ ```tsx
404
+ import { Input } from "@collective-intelligence/ui-react/ui"
405
+ import { LabeledField } from "@collective-intelligence/ui-react/ui-extensions/labeled-field"
406
+
407
+ ;<LabeledField id="email" label="Email" help="We send the code here.">
408
+ <Input id="email" type="email" />
409
+ </LabeledField>
410
+ ```
411
+
393
412
  ## Video player
394
413
 
395
414
  Import `VideoPlayer` from its own subpath,
package/dist/chat.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import"./index-64r6cav3.js";import"./index-dg126t3v.js";import{a}from"./index-r2snvwyb.js";import{N,ao,O,Xo,V,sr,_,q,g,I}from"./index-sd38wa4w.js";import{Q,nr,ar}from"./index-2twj52t7.js";import{T}from"./index-r5ds1mtq.js";import{Vr,Pt}from"./index-fnk7gsdd.js";import{fr,Dt,mo,ho,qe,pr,go,je,vo,mr,xo,bo,yo,Co}from"./index-m0v264jr.js";import{H,ve,Wt,It,Xe}from"./index-2yf6mq9g.js";import{b}from"./index-ecvn2gnv.js";import{L}from"./index-rgbg5bsy.js";import{v}from"./index-tcwzyy71.js";import"./index-0gzm7bb9.js";import{e}from"./index-qbwndfn2.js";import{useState as Ne}from"react";import{jsx as D,jsxs as j,Fragment as He}from"react/jsx-runtime";var Ce=({active:t,disabled:n,label:o,onClick:r,sentiment:s})=>{let i=s==="positive"?bo:xo;return D(a,{"aria-label":o,"aria-pressed":t,disabled:n,className:e("h-7 min-w-7 px-2 text-base",t&&(s==="positive"?"border-(--success) text-(--success)":"border-(--danger) text-(--danger)")),onClick:r,size:"sm",type:"button",variant:"ghost",children:D(i,{"aria-hidden":"true",className:e("size-4",t&&"fill-current")})})},Qe=({labels:t,onCancel:n,onSubmit:o})=>{let[r,s]=Ne(""),i=r.trim();return j(He,{children:[D(Q,{"aria-label":t.note,autoFocus:!0,onChange:(d)=>{s(d.target.value)},placeholder:t.note,required:!0,value:r}),j(sr,{children:[D(a,{onClick:n,type:"button",variant:"outline",children:t.cancel}),D(a,{disabled:i==="",onClick:()=>{o(i)},type:"button",children:t.submit})]})]})},_e=({className:t,error:n,labels:o,onClear:r,onSubmit:s,pending:i=!1,value:d})=>{let[p,u]=Ne(!1);return j("div",{className:e("flex flex-wrap items-center gap-2 text-xs text-muted-foreground",t),"data-part":"answer-feedback",children:[j("fieldset",{"aria-busy":i,"aria-label":o.group,className:"flex items-center gap-1",children:[D(Ce,{active:d==="positive",disabled:i,label:o.positive,onClick:()=>{if(d==="positive"){r();return}s({note:null,sentiment:"positive"})},sentiment:"positive"}),D(Ce,{active:d==="negative",disabled:i,label:o.negative,onClick:()=>{if(d==="negative"){r();return}u(!0)},sentiment:"negative"})]}),i?D("span",{children:o.saving}):null,n===void 0||n===null?null:D("span",{className:"text-destructive",role:"alert",children:n}),D(N,{onOpenChange:u,open:p,children:j(O,{children:[j(V,{children:[D(_,{children:o.noteTitle}),D(q,{children:o.noteDescription})]}),D(Qe,{labels:o,onCancel:()=>{u(!1)},onSubmit:(x)=>{s({note:x,sentiment:"negative"}),u(!1)}})]})})]})};import{useId as ye,useState as se}from"react";import{jsx as c,jsxs as R}from"react/jsx-runtime";var Ue=new Set(["continuation_failed","reconciliation_required"]),Ke=({status:t})=>c("div",{className:"mt-0.5 rounded-md border border-border bg-muted/40 p-1.5",children:(()=>{if(t==="approved")return c(H,{className:"size-4 text-emerald-600"});if(t==="pending")return c(pr,{className:"size-4 text-muted-foreground"});return c(Dt,{className:"size-4 text-destructive"})})()}),Ge=({label:t,outcome:n})=>R("output",{className:"mt-3 flex items-center gap-2 border-t border-border pt-3 text-sm font-medium text-foreground",children:[Ue.has(n)?c(ve,{className:"size-4 shrink-0 text-destructive"}):c(H,{className:"size-4 shrink-0 text-emerald-600"}),t]}),re=[],$e=({onApprove:t,onReject:n,outcome:o,status:r})=>{if(r!=="pending"||o!==void 0)return"closed";return t===void 0&&n===void 0?"read_only":"decide"},Ve={closed:null,decide:"decideHint",read_only:"readOnlyHint"},We=({className:t,decisions:n=re,labels:o,meta:r=re,resolution:s,steps:i=re})=>{if(r.length===0&&i.length===0&&n.length===0&&s===void 0)return null;return R("div",{className:e("mt-3 grid gap-2 text-xs text-muted-foreground",t),children:[r.length===0?null:c("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:r.map((d,p)=>c("span",{children:d},p))}),i.length===0?null:c("ul",{"aria-label":o.steps,className:"grid gap-1",children:i.map((d)=>R("li",{className:"flex items-center justify-between gap-3",children:[c("span",{className:"truncate",children:d.label}),c("span",{className:"shrink-0",children:o.stepProgress(d.approved,d.required)})]},d.id))}),n.length===0?null:c("ul",{"aria-label":o.decisions,className:"grid gap-1 border-t border-border pt-2",children:n.map((d)=>c("li",{children:d.label},d.id))}),s===void 0?null:c("p",{className:"border-t border-border pt-2",children:s})]})},ie=500,Je=({labels:t,onCancel:n,onReject:o,pending:r})=>{let s=ye(),[i,d]=se(""),p=i.trim();return R("div",{className:"mt-3 grid gap-2 border-t border-border pt-3",children:[c(I,{htmlFor:s,children:t.rejectReason}),c(Q,{autoFocus:!0,disabled:r,id:s,maxLength:ie,onChange:(u)=>{d(u.target.value)},placeholder:t.rejectReasonPlaceholder,value:i}),R("div",{className:"flex items-center justify-between gap-2",children:[R("span",{className:"text-xs text-muted-foreground",children:[i.length,"/",ie]}),R("div",{className:"flex gap-2",children:[c(a,{disabled:r,onClick:n,size:"sm",type:"button",variant:"ghost",children:t.cancel}),R(a,{disabled:r||p==="",onClick:()=>{o(p)},size:"sm",type:"button",variant:"destructive",children:[r?c(b,{className:"size-3.5 animate-spin"}):null,t.confirmReject]})]})]})]})},Ye=({labels:t,onApprove:n,onReject:o,pendingAction:r})=>{let s=ye(),[i,d]=se(""),[p,u]=se(!1),x=r!==void 0;if(p&&o!==void 0)return c(Je,{labels:t,onCancel:()=>{u(!1)},onReject:o,pending:r==="reject"});return R("div",{className:"mt-3 grid gap-2 border-t border-border pt-3",children:[n===void 0?null:R("div",{className:"grid gap-1.5",children:[c(I,{className:"text-xs",htmlFor:s,children:t.comment}),c(g,{disabled:x,id:s,maxLength:ie,onChange:(h)=>{d(h.target.value)},placeholder:t.commentPlaceholder,value:i})]}),R("div",{className:"flex gap-2",children:[n===void 0?null:R(a,{disabled:x,onClick:()=>{n(i.trim()===""?null:i.trim())},size:"sm",type:"button",children:[r==="approve"?c(b,{className:"size-3.5 animate-spin"}):c(H,{className:"size-3.5"}),r==="approve"?t.approving:t.approve]}),o===void 0?null:R(a,{disabled:x,onClick:()=>{u(!0)},size:"sm",type:"button",variant:"outline",children:[c(Dt,{className:"size-3.5"}),t.reject]})]})]})},Ze=({children:t,className:n,classNames:o,decisions:r,error:s,labels:i,meta:d,onApprove:p,onReject:u,outcome:x,pendingAction:h,resolution:k,status:C,steps:M,summary:J})=>{let z=$e({onApprove:p,onReject:u,outcome:x,status:C}),Y=Ve[z],Z=Y===null?void 0:i[Y];return R("section",{"aria-label":i.title,className:e("rounded-md border border-border bg-background p-3 text-sm",n),"data-part":"approval-card","data-status":C,children:[R("div",{className:e("flex items-start gap-3",o?.header),children:[c(Ke,{status:C}),R("div",{className:"min-w-0 flex-1",children:[R("div",{className:"flex flex-wrap items-center gap-2",children:[c("p",{className:"font-medium text-foreground",children:i.title}),c(T,{variant:z==="decide"?"default":"outline",children:i.statuses[C]}),z==="read_only"?c(T,{variant:"secondary",children:i.readOnly}):null]}),Z===void 0?null:c("p",{className:"mt-1 text-muted-foreground",children:Z}),J===void 0?null:c("div",{className:"mt-1 break-words text-foreground",children:J}),c(We,{className:o?.details,decisions:r,labels:i,meta:d,resolution:k,steps:M})]})]}),t,z==="decide"?c("div",{className:o?.actions,children:c(Ye,{labels:i,onApprove:p,onReject:u,pendingAction:h})}):null,s===void 0||s===null?null:c("p",{className:"mt-2 text-destructive",role:"alert",children:s}),x===void 0?null:c(Ge,{label:i.outcomes[x],outcome:x})]})};import{jsx as y,jsxs as U,Fragment as nt}from"react/jsx-runtime";var et=({labels:t,name:n,onDownload:o,pending:r})=>U("button",{"aria-label":t.downloadFile(n),className:"inline-flex items-center gap-1 rounded-sm px-1 text-(--accent) hover:text-(--accent-hover) focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:o,type:"button",children:[r?y(b,{className:"size-3.5 animate-spin"}):y(Wt,{className:"size-3.5"}),y("span",{children:r?t.downloading:t.download})]}),tt=({description:t,label:n,name:o,url:r})=>U(N,{children:[y(ao,{asChild:!0,children:y("button",{"aria-label":n,className:"shrink-0 overflow-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",type:"button",children:y("img",{alt:"",className:"size-7 object-cover",src:r})})}),y(ao,{asChild:!0,children:y("button",{className:"max-w-[220px] truncate text-left hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",type:"button",children:o})}),U(O,{size:"xl",children:[U(V,{children:[y(_,{children:o}),y(q,{children:t})]}),y(Xo,{children:y("img",{alt:o,className:"max-h-[70vh] w-full rounded-md object-contain",src:r})})]})]}),at=(t)=>{let{className:n,detail:o,labels:r,name:s,previewUrl:i}=t;return U("span",{className:e("inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/50 px-2 py-1 text-xs text-foreground",n),"data-mode":t.mode,"data-part":"attachment-chip",children:[i===void 0?U(nt,{children:[y(je,{className:"size-3.5 shrink-0 text-muted-foreground"}),y("span",{className:"max-w-[220px] truncate",children:s})]}):y(tt,{description:r.previewDescription,label:r.preview(s),name:s,url:i}),o===void 0?null:y("span",{className:"text-muted-foreground",children:o}),t.mode==="draft"?y("button",{"aria-label":r.remove(s),className:"rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",onClick:t.onRemove,type:"button",children:y(L,{className:"size-3.5"})}):null,t.mode==="stored"&&t.onDownload!==void 0?y(et,{labels:r,name:s,onDownload:t.onDownload,pending:t.pending??!1}):null,t.mode==="stored"&&t.error!==void 0&&t.error!==null?y("span",{className:"text-destructive",role:"alert",children:t.error}):null]})};import{jsx as we,jsxs as ke}from"react/jsx-runtime";var ot=(t,n,o)=>{if(n>0)return` · ${t.messages(n)}`;if(o>0)return` · ${t.runs(o)}`;return""},rt=({className:t,labels:n,messageCount:o=0,runCount:r=0})=>ke("div",{className:e("flex items-center gap-3 text-xs text-muted-foreground",t),"data-part":"compaction-marker",children:[we("hr",{"aria-label":n.compacted,className:"h-px flex-1 border-0 bg-border"}),ke("span",{className:"shrink-0 rounded-md border border-border bg-background px-2 py-1",children:[n.compacted,ot(n,o,r)]}),we("span",{"aria-hidden":"true",className:"h-px flex-1 bg-border"})]});import{useState as st}from"react";import{jsx as P,jsxs as ee}from"react/jsx-runtime";var de=(t)=>[...t.dataTransfer.types].includes("Files"),it=({state:t})=>{if(t==="idle")return P(ho,{className:"size-4"});return P(b,{className:"size-4 animate-spin"})},Re=({className:t,label:n,onStop:o,stopping:r})=>P(a,{"aria-busy":r||void 0,"aria-label":n,className:e("size-8 shrink-0 rounded-md bg-destructive text-destructive-foreground hover:bg-destructive/90",t),disabled:r,onClick:o,size:"icon",type:"button",children:r?P(b,{className:"size-4 animate-spin"}):P("span",{className:"size-3 rounded-[2px] bg-current"})}),dt=({canSubmit:t,labels:n,onStop:o,sendClassName:r,showStop:s,state:i,stopping:d,submit:p,trailing:u})=>{let x=s&&o!==void 0,h=!x&&i==="running"&&o!==void 0;return ee("div",{className:"flex shrink-0 items-center gap-1.5",children:[x?P(Re,{className:void 0,label:n.stop,onStop:o,stopping:d}):null,u,h?P(Re,{className:r,label:n.stop,onStop:o,stopping:d}):P(a,{"aria-label":i==="idle"?n.send:n.submitting,className:e("size-8 shrink-0 rounded-md bg-foreground text-background hover:bg-foreground/90",r),disabled:!t,onClick:p,size:"icon",type:"button",children:P(it,{state:i})})]})},lt=({attachments:t,className:n,classNames:o,disabled:r=!1,footer:s,labels:i,leading:d,notice:p,onFilesAdd:u,onInputKeyDown:x,onStop:h,onSubmit:k,onValueChange:C,placeholder:M,showStop:J=!1,state:z="idle",stopping:Y=!1,suggestions:Z,trailing:Ie,value:ue})=>{let[ge,oe]=st(!1),fe=z==="idle"&&!r&&ue.trim()!=="",be=()=>{if(fe)k()},xe=(f)=>{if(u!==void 0&&f.length>0)u([...f])},Oe=u===void 0?{}:{onDragEnter:(f)=>{if(de(f))f.preventDefault(),oe(!0)},onDragLeave:(f)=>{let{relatedTarget:he}=f;if(!(he instanceof Node)||!f.currentTarget.contains(he))oe(!1)},onDragOver:(f)=>{if(de(f))f.preventDefault()},onDrop:(f)=>{if(de(f))f.preventDefault(),oe(!1),xe(f.dataTransfer.files)}};return ee("div",{className:e("w-full",n),"data-part":"composer",children:[p===void 0?null:P("div",{className:"mb-2",children:p}),ee("div",{className:e("relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-colors dark:border-border/80 dark:bg-black dark:shadow-none",ge&&"border-primary/70 bg-primary/5 ring-2 ring-primary/20",o?.frame),"data-part":"composer-frame",...Oe,children:[ge?P("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center rounded-xl border border-primary/40 bg-background/80 text-sm font-medium text-foreground backdrop-blur-sm",children:i.drop}):null,t===void 0?null:P("div",{className:"flex flex-wrap gap-2 border-b border-border px-3 py-2",children:t}),P(Q,{"aria-label":i.input,className:e("max-h-44 min-h-20 resize-none border-0 bg-transparent px-5 py-4 text-base text-foreground shadow-none placeholder:text-muted-foreground focus-visible:ring-0 dark:bg-transparent",o?.input),disabled:r,onChange:(f)=>{C(f.target.value)},onKeyDown:(f)=>{if(x?.(f),f.defaultPrevented||f.key!=="Enter"||f.shiftKey||f.nativeEvent.isComposing)return;f.preventDefault(),be()},onPaste:(f)=>{if(u!==void 0&&f.clipboardData.files.length>0)f.preventDefault(),xe(f.clipboardData.files)},placeholder:M,value:ue}),Z,ee("div",{className:e("flex min-h-14 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-t border-border/80 bg-muted/30 px-3 py-2 dark:border-zinc-800 dark:bg-zinc-950",o?.toolbar),children:[P("div",{className:"flex min-w-0 flex-1 items-center gap-1 text-muted-foreground",children:d}),P(dt,{canSubmit:fe,labels:i,onStop:h,sendClassName:o?.send,showStop:J,state:z,stopping:Y,submit:be,trailing:Ie})]})]}),s]})};import{jsx as pt}from"react/jsx-runtime";var ct=(t)=>Number.isFinite(t)?Math.round(Math.min(1,Math.max(0,t))*100):0,mt=({className:t,label:n,ratio:o})=>{let r=ct(o);return pt(Vr,{"aria-valuenow":r,className:t,"data-part":"context-usage-ring",label:n,role:"meter",value:r})};import ut from"react-markdown";import gt from"remark-gfm";import{jsx as W}from"react/jsx-runtime";var ft=({children:t,href:n})=>W("a",{href:n,rel:"noreferrer",target:"_blank",children:t}),bt=({children:t,...n})=>W("div",{className:"my-4 max-w-full overflow-x-auto",children:W("table",{...n,className:"w-max min-w-full",children:t})}),Pe={a:ft,table:bt},xt=[gt],ht=({className:t,components:n,content:o})=>W("div",{className:e("prose prose-sm min-w-0 max-w-none break-words text-[15px] leading-7 text-foreground dark:prose-invert prose-headings:font-semibold prose-pre:bg-muted prose-th:text-left",t),"data-part":"markdown",children:W(ut,{components:n===void 0?Pe:{...Pe,...n},remarkPlugins:xt,children:o})});import{jsx as B,jsxs as te}from"react/jsx-runtime";var vt=6,Ct=({className:t,classNames:n,events:o,labels:r,memoryDisabled:s=!1,saved:i,used:d})=>{if(o.length===0)return null;return te("div",{className:e("rounded-lg border border-border bg-muted/30 px-4 py-3 text-sm",t),"data-part":"memory-evidence",children:[te("div",{className:e("flex flex-wrap items-center justify-between gap-2",n?.header),children:[B("div",{className:"font-semibold",children:r.title}),te("div",{className:"flex flex-wrap gap-1.5",children:[d>0?B(T,{className:"rounded-md",variant:"secondary",children:r.used(d)}):null,i>0?B(T,{className:"rounded-md",variant:"secondary",children:r.saved(i)}):null,s?B(T,{className:"rounded-md",variant:"secondary",children:r.disabled}):null]})]}),B("ul",{className:e("mt-2 space-y-1.5",n?.events),children:o.slice(0,vt).map((p)=>te("li",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[B("span",{className:"font-medium text-foreground",children:p.label}),(p.details??[]).map((u,x)=>B("span",{children:u},x))]},p.id))})]})};import{jsx as K,jsxs as le}from"react/jsx-runtime";var Se={assistant:{className:"bg-accent text-accent-foreground",icon:K(qe,{className:"size-5"})},user:{className:"bg-primary text-primary-foreground",icon:K(yo,{className:"size-5"})}},Nt=({author:t,avatar:n,children:o,className:r,classNames:s,sender:i,timestamp:d})=>le("article",{className:e("grid grid-cols-[36px_minmax(0,1fr)] gap-3",r),"data-part":"message","data-sender":i,children:[K("div",{"aria-hidden":"true",className:e("grid size-9 place-items-center overflow-hidden rounded-full",n===void 0&&Se[i].className,s?.avatar),children:n??Se[i].icon}),le("div",{className:"min-w-0 text-sm text-foreground",children:[le("div",{className:e("mb-1.5 flex flex-wrap items-center gap-2",s?.header),children:[K("span",{className:e("font-semibold",s?.author),children:t}),d===void 0?null:K("span",{className:e("text-xs text-muted-foreground",s?.timestamp),children:d})]}),K("div",{className:e("flex flex-col gap-3",s?.body),children:o})]})]});import{jsx as E,jsxs as G}from"react/jsx-runtime";var ce=({className:t,decision:n,label:o,onDecide:r,pendingDecision:s,variant:i="default"})=>G(a,{className:t,disabled:s!==void 0,onClick:()=>{r(n)},type:"button",variant:i,children:[s===n?E(b,{className:"size-4 animate-spin"}):null,o]}),yt=({className:t,classNames:n,description:o,error:r,labels:s,name:i,onDecide:d,pendingDecision:p})=>E("section",{"aria-label":s.region(i),className:e("rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm",t),"data-part":"permission-prompt",children:G("div",{className:"flex items-start gap-3",children:[E("div",{className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-md bg-(--bg-accent-soft) text-(--accent)",children:E(mr,{className:"size-4"})}),G("div",{className:"@container/permission min-w-0 flex-1 space-y-3",children:[G("div",{children:[E("h2",{className:e("break-words text-base font-semibold text-foreground",n?.title),children:s.title(i)}),s.description===void 0?null:E("p",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:s.description})]}),o===void 0||o===null?null:E("p",{className:e("rounded-md border border-border bg-muted/50 px-3 py-2 text-sm leading-6 text-muted-foreground",n?.description),children:o}),r===void 0||r===null?null:E("p",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm leading-6 text-destructive",role:"alert",children:r}),G("div",{className:e("flex flex-col gap-2 @2xl/permission:flex-row @2xl/permission:items-center",n?.actions),children:[E(ce,{className:"w-full @2xl/permission:w-auto",decision:"deny",label:s.deny,onDecide:d,pendingDecision:p,variant:"outline"}),G("div",{className:"flex flex-col gap-2 @md/permission:flex-row @2xl/permission:ml-auto @2xl/permission:justify-end",children:[E(ce,{className:"w-full @md/permission:w-auto",decision:"allow_this_conversation",label:s.allowThisConversation,onDecide:d,pendingDecision:p}),E(ce,{className:"w-full @md/permission:w-auto",decision:"allow_always",label:s.allowAlways,onDecide:d,pendingDecision:p})]})]})]})]})});import{useState as wt}from"react";import{jsx as A,jsxs as X}from"react/jsx-runtime";var kt={approval:pr,command:mo,compaction:H,file:je,model:qe,permission:mr,request:H,run:H,skill:qe,step:H,tool:Co},Rt=({step:t})=>{if(t.status==="active")return A(b,{className:"size-4 animate-spin"});let n=kt[t.kind];return A(n,{className:"size-4"})},St=({className:t,classNames:n,defaultOpen:o=!1,onOpenChange:r,open:s,steps:i,summary:d})=>{let[p,u]=wt(o),x=s??p;if(i.length===0)return null;return X("details",{className:e("group ml-12 text-sm text-muted-foreground",t),"data-part":"processing-steps",onToggle:(h)=>{let k=h.currentTarget.open;if(k!==x)u(k),r?.(k)},open:x,children:[X("summary",{className:e("flex w-fit cursor-pointer list-none items-center gap-1.5 font-medium text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",n?.summary),children:[A("span",{children:d}),A(v,{className:"size-4 transition-transform group-open:rotate-180"})]}),x?A("ol",{className:e("mt-4",n?.list),children:i.map((h,k)=>X("li",{className:e("grid grid-cols-[32px_minmax(0,1fr)] gap-3",n?.step),"data-status":h.status,children:[X("div",{className:"relative flex justify-center",children:[A("span",{className:"mt-0.5 grid size-6 place-items-center rounded-md border border-border bg-background text-muted-foreground",children:A(Rt,{step:h})}),k<i.length-1?A("span",{className:"absolute top-8 bottom-0 w-px bg-border"}):null]}),A("div",{className:"min-w-0 pb-5",children:X("div",{className:"flex min-h-6 flex-wrap items-center gap-2",children:[A("span",{className:e("break-words text-base",h.status==="active"?"text-foreground":"text-muted-foreground"),children:h.label}),h.detail===void 0?null:A("span",{className:"rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground",children:h.detail})]})})]},h.id))}):null]})};import{useId as Te,useState as ae}from"react";import{jsx as m,jsxs as S,Fragment as Ft}from"react/jsx-runtime";var me="other",De=(t)=>`option:${t}`,Ee=({description:t,id:n,label:o,value:r})=>S("div",{className:"flex items-start gap-2",children:[m(ar,{className:"mt-0.5",id:n,value:r}),S("div",{className:"grid gap-0.5",children:[m(I,{htmlFor:n,children:o}),t===void 0?null:m("span",{className:"text-xs text-muted-foreground",children:t})]})]}),Et=({disabled:t,labels:n,onRespond:o,options:r,withText:s})=>{let i=Te(),[d,p]=ae(null),[u,x]=ae(""),h=(C)=>r.find((M)=>De(M.id)===C),k=(()=>{if(d===me)return u.trim()===""?null:{action:"answer",text:u.trim()};let C=d===null?void 0:h(d);return C===void 0?null:{action:"answer",optionId:C.id}})();return S(Ft,{children:[S(nr,{className:"grid gap-2",disabled:t,onValueChange:(C)=>{p(C);let M=h(C);if(!s&&M!==void 0)o({action:"answer",optionId:M.id})},value:d??"",children:[r.map((C,M)=>m(Ee,{description:C.description,id:`${i}-${M}`,label:C.label,value:De(C.id)},C.id)),s?m(Ee,{id:`${i}-other`,label:n.otherOption,value:me}):null]}),s?S("div",{className:"flex gap-2",children:[m(g,{"aria-label":n.otherAnswer,disabled:t||d!==me,onChange:(C)=>{x(C.target.value)},value:u}),m(a,{disabled:t||k===null,onClick:()=>{if(k!==null)o(k)},type:"button",children:n.continue})]}):null]})},At=({disabled:t,labels:n,onRespond:o})=>{let[r,s]=ae("");return S("div",{className:"grid gap-2",children:[m(Q,{"aria-label":n.textAnswer,disabled:t,onChange:(i)=>{s(i.target.value)},placeholder:n.textPlaceholder,value:r}),m(a,{className:"justify-self-start",disabled:t||r.trim()==="",onClick:()=>{o({action:"answer",text:r.trim()})},type:"button",children:n.answer})]})},Lt=({disabled:t,labels:n,onRespond:o})=>{let r=Te(),[s,i]=ae("");return S("div",{className:"grid gap-2",children:[m(a,{className:"justify-self-start",disabled:t,onClick:()=>{o({action:"approve"})},type:"button",children:t?n.responding:n.approve}),m(I,{htmlFor:r,children:n.reviseLabel}),S("div",{className:"flex gap-2",children:[m(g,{disabled:t,id:r,onChange:(d)=>{i(d.target.value)},value:s}),m(a,{disabled:t||s.trim()==="",onClick:()=>{o({action:"revise",text:s.trim()})},type:"button",variant:"outline",children:n.revise})]})]})},Ae=({error:t})=>t===void 0||t===null?null:m("p",{className:"text-destructive",role:"alert",children:t}),Le=({meta:t})=>t.length===0?null:m("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:t.map((n,o)=>m("span",{children:n},o))}),Tt=({className:t,label:n,preview:o})=>o===void 0||o===null?null:S("div",{className:e("grid gap-2 rounded-md border border-border bg-muted/30 p-3",t),children:[m("p",{className:"font-semibold",children:n}),m("div",{className:"break-words",children:o})]}),Mt=(t)=>t!=="pending"&&t!=="responding",zt=({className:t,classNames:n,labels:o,outcome:r,prompt:s,status:i})=>S("section",{className:e("grid gap-2 rounded-lg border border-border bg-muted/30 p-4 text-sm",t),"data-part":"question-card","data-status":i,children:[m("div",{className:e("break-words",n?.prompt),children:s}),S("p",{className:"flex items-center gap-2 font-medium",children:[i==="completed"?m(H,{className:"size-4 shrink-0 text-emerald-600"}):m(Dt,{className:"size-4 shrink-0 text-destructive"}),o[i]]}),r===void 0||r===null?null:m("output",{className:"text-muted-foreground",children:r})]}),Bt=(t)=>{let{className:n,classNames:o,error:r,labels:s,meta:i=[],onRespond:d,outcome:p,preview:u,prompt:x,status:h}=t;if(Mt(h))return m(zt,{className:n,classNames:o,labels:s,outcome:p,prompt:x,status:h});let k=h==="responding",C=m(Tt,{className:o?.preview,label:s.preview,preview:u});if(t.mode==="confirm")return S("section",{className:e("grid gap-3 rounded-lg border border-border bg-muted/30 p-4 text-sm",n),"data-part":"question-card","data-status":h,children:[S("div",{children:[m("p",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:s.confirmTitle}),s.confirmHint===void 0?null:m("p",{className:"text-xs text-muted-foreground",children:s.confirmHint})]}),m("div",{className:e("break-words font-semibold",o?.prompt),children:x}),m(Le,{meta:i}),C,m(Lt,{disabled:k,labels:s,onRespond:d}),m(Ae,{error:r})]});return S("section",{className:e("grid gap-3 rounded-lg border border-border p-4 text-sm",n),"data-part":"question-card","data-status":h,children:[C,m("div",{className:e("break-words",o?.prompt),children:x}),m(Le,{meta:i}),t.mode==="choice"||t.mode==="choice_or_text"?m(Et,{disabled:k,labels:s,onRespond:d,options:t.options,withText:t.mode==="choice_or_text"}):null,t.mode==="text"?m(At,{disabled:k,labels:s,onRespond:d}):null,m(Ae,{error:r})]})};import{jsx as F,jsxs as ne,Fragment as _t}from"react/jsx-runtime";var Ot={danger:"text-destructive",neutral:"text-muted-foreground",primary:"text-primary",success:"text-emerald-600",warning:"text-amber-600"},Qt=({className:t,classNames:n,detail:o,label:r,labels:s,tone:i})=>ne("div",{className:e("rounded-lg border border-border bg-muted/30 px-4 py-3",t),"data-part":"run-status","data-tone":i,children:[ne("div",{className:"flex min-w-0 items-center gap-2",children:[F(qe,{className:"size-4 shrink-0 text-muted-foreground"}),F("span",{className:e("truncate font-semibold",n?.title),children:s.title})]}),ne("div",{className:e("mt-1.5 flex flex-wrap items-center gap-2 text-sm",n?.status),children:[F(Pt,{size:"md",tone:i}),F("span",{className:"text-muted-foreground",children:s.status}),F("span",{className:Ot[i],children:r}),o===void 0||o===null?null:ne(_t,{children:[F("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"·"}),F("span",{className:"font-mono text-xs text-muted-foreground",children:o})]})]})]});import{useState as Me}from"react";import{jsx as l,jsxs as w}from"react/jsx-runtime";var jt=5,Ht=4,Ut={custom:je,evidence:je,json:fr,links:Xe,sources:vo,summary:fr,table:go,text:fr,warnings:ve},qt=(t)=>{try{let{protocol:n}=new URL(t);return n==="http:"||n==="https:"?t:null}catch{return null}},ze=({children:t,url:n})=>{let o=qt(n);if(o===null)return l("span",{className:"break-words font-medium",children:t});return w("a",{className:"inline-flex max-w-full items-center gap-1 break-all font-medium text-primary hover:text-(--accent-hover)",href:o,rel:"noreferrer",target:"_blank",children:[l("span",{className:"min-w-0 break-words",children:t}),l(It,{className:"size-3 shrink-0"})]})},Be=({meta:t})=>t===void 0||t.length===0?null:l("div",{className:"mt-1 flex flex-wrap gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:t.map((n,o)=>l("span",{children:n},o))}),pe=({excerpt:t})=>t===void 0?null:l("p",{className:"mt-1 break-words text-xs leading-5 text-muted-foreground",children:t}),Fe=({hidden:t,label:n,onShow:o})=>t>0?w("button",{className:"inline-flex items-center gap-1 text-xs font-medium text-primary hover:text-(--accent-hover)",onClick:o,type:"button",children:[n(t),l(v,{className:"size-3"})]}):null,Kt=({groups:t,note:n})=>w("div",{className:"flex flex-col gap-3",children:[t.map((o)=>w("section",{className:"flex flex-col gap-2",children:[l("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:o.label}),l("ol",{className:"flex flex-col gap-2",children:o.items.map((r)=>w("li",{className:"rounded-md border border-border bg-background/70 p-2.5",children:[w("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[w("div",{className:"min-w-0",children:[l("div",{className:"font-medium",children:r.title}),l(pe,{excerpt:r.excerpt})]}),r.action]}),l(Be,{meta:r.meta})]},r.id))})]},o.id)),n===void 0?null:l("p",{className:"text-xs text-muted-foreground",children:n})]}),Gt=({columns:t,labels:n,rows:o})=>{let[r,s]=Me(!1),i=r?o:o.slice(0,jt);return w("div",{className:"flex flex-col items-start gap-2",children:[l("div",{className:"w-full max-w-full overflow-x-auto",children:w("table",{className:"w-full min-w-[520px] table-fixed border-collapse text-left text-xs",children:[l("thead",{children:l("tr",{className:"border-b border-border",children:t.map((d)=>l("th",{className:"w-[180px] px-2 py-2 font-semibold text-muted-foreground",title:d.description,children:d.label},d.key))})}),l("tbody",{children:i.map((d)=>l("tr",{className:"border-b border-border/70 last:border-0",children:t.map((p)=>l("td",{className:"px-2 py-2 align-top break-words",children:d.cells[p.key]},p.key))},d.id))})]})}),l(Fe,{hidden:o.length-i.length,label:n.showMore,onShow:()=>{s(!0)}})]})},$t=({labels:t,sources:n})=>{let[o,r]=Me(!1),s=o?n:n.slice(0,Ht);return w("div",{className:"flex flex-col items-start gap-2",children:[l("ol",{className:"flex w-full flex-col gap-2",children:s.map((i)=>w("li",{className:"rounded-md border border-border bg-background/70 p-2",children:[w("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[w("div",{className:"min-w-0",children:[i.url===void 0?l("span",{className:"font-medium",children:i.title}):l(ze,{url:i.url,children:i.title}),l(pe,{excerpt:i.excerpt})]}),i.rank===void 0?null:l("span",{className:"shrink-0 text-xs text-muted-foreground",children:i.rank})]}),l(Be,{meta:i.meta})]},i.id))}),l(Fe,{hidden:n.length-s.length,label:t.showMore,onShow:()=>{r(!0)}})]})},Vt=(t)=>{switch(t.kind){case"custom":return!1;case"evidence":return t.groups.every((n)=>n.items.length===0);case"json":return t.json==="";case"links":return t.links.length===0;case"sources":return t.sources.length===0;case"summary":return t.items.length===0;case"table":return t.columns.length===0||t.rows.length===0;case"text":return t.text==="";case"warnings":return t.warnings.length===0;default:return t}},Xt=({labels:t,part:n})=>{if(Vt(n))return l("p",{className:"text-xs text-muted-foreground",children:t.empty});switch(n.kind){case"custom":return n.content;case"evidence":return l(Kt,{groups:n.groups,note:n.note});case"json":return l("pre",{className:"max-h-[280px] overflow-auto rounded-md bg-background p-2 text-xs leading-5 text-foreground",children:n.json});case"links":return l("ul",{className:"grid gap-2",children:n.links.map((o)=>w("li",{className:"min-w-0 rounded-md border border-border bg-background/70 p-2",children:[l(ze,{url:o.url,children:o.label}),l(pe,{excerpt:o.description})]},o.id))});case"sources":return l($t,{labels:t,sources:n.sources});case"summary":return l("dl",{className:"grid gap-2 @lg/chat:grid-cols-2",children:n.items.map((o)=>w("div",{className:"min-w-0 rounded-md border border-border bg-background/70 p-2",children:[l("dt",{className:"text-xs font-medium text-muted-foreground",children:o.label}),l("dd",{className:"mt-1 break-words text-sm",children:o.value}),o.description===void 0?null:l("dd",{className:"mt-1 text-xs text-muted-foreground",children:o.description})]},o.id))});case"table":return l(Gt,{columns:n.columns,labels:t,rows:n.rows});case"text":return l("p",{className:"whitespace-pre-wrap break-words text-sm leading-6",children:n.text});case"warnings":return l("ul",{className:"flex flex-col gap-2",children:n.warnings.map((o)=>w("li",{className:"flex min-w-0 gap-2 rounded-md border border-amber-200 bg-amber-50 px-2 py-2 text-amber-900 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:[l(ve,{className:"mt-0.5 size-3.5 shrink-0"}),l("span",{className:"break-words text-xs",children:o.message})]},o.id))});default:return n}},Jt=({part:t})=>{if(t.kind==="custom"&&t.icon!==void 0)return t.icon;let n=Ut[t.kind];return l(n,{className:"size-4"})},Yt=({className:t,classNames:n,labels:o,parts:r})=>r.length===0?null:l("div",{className:e("flex flex-col gap-3",t),"data-part":"tool-evidence",children:r.map((s)=>w("section",{className:e("overflow-hidden rounded-md border border-border bg-muted/20",n?.part),"data-kind":s.kind,children:[w("div",{className:e("flex min-w-0 items-start gap-2 border-b border-border px-3 py-2",n?.header),children:[l("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:l(Jt,{part:s})}),w("div",{className:"min-w-0",children:[l("h3",{className:"truncate text-sm font-medium",children:s.title}),s.description===void 0?null:l("p",{className:"mt-0.5 text-xs leading-5 text-muted-foreground",children:s.description})]})]}),l("div",{className:e("min-w-0 p-3",n?.body),children:l(Xt,{labels:o,part:s})})]},s.id))});export{_e as ChatAnswerFeedback,Ze as ChatApprovalCard,at as ChatAttachmentChip,rt as ChatCompactionMarker,lt as ChatComposerShell,mt as ChatContextUsageRing,ht as ChatMarkdown,Ct as ChatMemoryEvidence,Nt as ChatMessage,yt as ChatPermissionPrompt,St as ChatProcessingSteps,Bt as ChatQuestionCard,Qt as ChatRunStatus,Yt as ChatToolEvidence};
2
+ import"./index-j136rmty.js";import"./index-xqct5yan.js";import{n}from"./index-rqqztw4a.js";import"./index-ar540v2r.js";import{N,qr,_,Qo,U,Qt,O,Q,g}from"./index-yqjasa46.js";import{Y,Yt,Xt}from"./index-ncrdjrq1.js";import{L}from"./index-74qkvrg9.js";import{P}from"./index-drbb68sv.js";import{Fr,wt}from"./index-6aftpcjv.js";import{or,At,eo,to,$e,ar,ro,We,oo,nr,ao,no,so,io}from"./index-4r9c455p.js";import{H,he,$t,kt,Ye}from"./index-dea72se6.js";import{b}from"./index-bpnj24pg.js";import{I}from"./index-hmd0rx9g.js";import{v}from"./index-4vk89see.js";import"./index-z9tsk9ev.js";import{e}from"./index-1amahhaz.js";import{useState as Ne}from"react";import{jsx as E,jsxs as j,Fragment as je}from"react/jsx-runtime";var Ce=({active:t,disabled:a,label:o,onClick:r,sentiment:s})=>{let i=s==="positive"?no:ao;return E(n,{"aria-label":o,"aria-pressed":t,disabled:a,className:e("h-7 min-w-7 px-2 text-base",t&&(s==="positive"?"border-(--success) text-(--success)":"border-(--danger) text-(--danger)")),onClick:r,size:"sm",type:"button",variant:"ghost",children:E(i,{"aria-hidden":"true",className:e("size-4",t&&"fill-current")})})},Qe=({labels:t,onCancel:a,onSubmit:o})=>{let[r,s]=Ne(""),i=r.trim();return j(je,{children:[E(Y,{"aria-label":t.note,autoFocus:!0,onChange:(d)=>{s(d.target.value)},placeholder:t.note,required:!0,value:r}),j(Qt,{children:[E(n,{onClick:a,type:"button",variant:"outline",children:t.cancel}),E(n,{disabled:i==="",onClick:()=>{o(i)},type:"button",children:t.submit})]})]})},_e=({className:t,error:a,labels:o,onClear:r,onSubmit:s,pending:i=!1,value:d})=>{let[p,u]=Ne(!1);return j("div",{className:e("flex flex-wrap items-center gap-2 text-xs text-muted-foreground",t),"data-part":"answer-feedback",children:[j("fieldset",{"aria-busy":i,"aria-label":o.group,className:"flex items-center gap-1",children:[E(Ce,{active:d==="positive",disabled:i,label:o.positive,onClick:()=>{if(d==="positive"){r();return}s({note:null,sentiment:"positive"})},sentiment:"positive"}),E(Ce,{active:d==="negative",disabled:i,label:o.negative,onClick:()=>{if(d==="negative"){r();return}u(!0)},sentiment:"negative"})]}),i?E("span",{children:o.saving}):null,a===void 0||a===null?null:E("span",{className:"text-destructive",role:"alert",children:a}),E(N,{onOpenChange:u,open:p,children:j(_,{children:[j(U,{children:[E(O,{children:o.noteTitle}),E(Q,{children:o.noteDescription})]}),E(Qe,{labels:o,onCancel:()=>{u(!1)},onSubmit:(x)=>{s({note:x,sentiment:"negative"}),u(!1)}})]})})]})};import{useId as ye,useState as se}from"react";import{jsx as c,jsxs as R}from"react/jsx-runtime";var He=new Set(["continuation_failed","reconciliation_required"]),Ue=({status:t})=>c("div",{className:"mt-0.5 rounded-md border border-border bg-muted/40 p-1.5",children:(()=>{if(t==="approved")return c(H,{className:"size-4 text-emerald-600"});if(t==="pending")return c(ar,{className:"size-4 text-muted-foreground"});return c(At,{className:"size-4 text-destructive"})})()}),qe=({label:t,outcome:a})=>R("output",{className:"mt-3 flex items-center gap-2 border-t border-border pt-3 text-sm font-medium text-foreground",children:[He.has(a)?c(he,{className:"size-4 shrink-0 text-destructive"}):c(H,{className:"size-4 shrink-0 text-emerald-600"}),t]}),re=[],Ke=({onApprove:t,onReject:a,outcome:o,status:r})=>{if(r!=="pending"||o!==void 0)return"closed";return t===void 0&&a===void 0?"read_only":"decide"},Ge={closed:null,decide:"decideHint",read_only:"readOnlyHint"},Ve=({className:t,decisions:a=re,labels:o,meta:r=re,resolution:s,steps:i=re})=>{if(r.length===0&&i.length===0&&a.length===0&&s===void 0)return null;return R("div",{className:e("mt-3 grid gap-2 text-xs text-muted-foreground",t),children:[r.length===0?null:c("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:r.map((d,p)=>c("span",{children:d},p))}),i.length===0?null:c("ul",{"aria-label":o.steps,className:"grid gap-1",children:i.map((d)=>R("li",{className:"flex items-center justify-between gap-3",children:[c("span",{className:"truncate",children:d.label}),c("span",{className:"shrink-0",children:o.stepProgress(d.approved,d.required)})]},d.id))}),a.length===0?null:c("ul",{"aria-label":o.decisions,className:"grid gap-1 border-t border-border pt-2",children:a.map((d)=>c("li",{children:d.label},d.id))}),s===void 0?null:c("p",{className:"border-t border-border pt-2",children:s})]})},ie=500,Xe=({labels:t,onCancel:a,onReject:o,pending:r})=>{let s=ye(),[i,d]=se(""),p=i.trim();return R("div",{className:"mt-3 grid gap-2 border-t border-border pt-3",children:[c(P,{htmlFor:s,children:t.rejectReason}),c(Y,{autoFocus:!0,disabled:r,id:s,maxLength:ie,onChange:(u)=>{d(u.target.value)},placeholder:t.rejectReasonPlaceholder,value:i}),R("div",{className:"flex items-center justify-between gap-2",children:[R("span",{className:"text-xs text-muted-foreground",children:[i.length,"/",ie]}),R("div",{className:"flex gap-2",children:[c(n,{disabled:r,onClick:a,size:"sm",type:"button",variant:"ghost",children:t.cancel}),R(n,{disabled:r||p==="",onClick:()=>{o(p)},size:"sm",type:"button",variant:"destructive",children:[r?c(b,{className:"size-3.5 animate-spin"}):null,t.confirmReject]})]})]})]})},Je=({labels:t,onApprove:a,onReject:o,pendingAction:r})=>{let s=ye(),[i,d]=se(""),[p,u]=se(!1),x=r!==void 0;if(p&&o!==void 0)return c(Xe,{labels:t,onCancel:()=>{u(!1)},onReject:o,pending:r==="reject"});return R("div",{className:"mt-3 grid gap-2 border-t border-border pt-3",children:[a===void 0?null:R("div",{className:"grid gap-1.5",children:[c(P,{className:"text-xs",htmlFor:s,children:t.comment}),c(g,{disabled:x,id:s,maxLength:ie,onChange:(h)=>{d(h.target.value)},placeholder:t.commentPlaceholder,value:i})]}),R("div",{className:"flex gap-2",children:[a===void 0?null:R(n,{disabled:x,onClick:()=>{a(i.trim()===""?null:i.trim())},size:"sm",type:"button",children:[r==="approve"?c(b,{className:"size-3.5 animate-spin"}):c(H,{className:"size-3.5"}),r==="approve"?t.approving:t.approve]}),o===void 0?null:R(n,{disabled:x,onClick:()=>{u(!0)},size:"sm",type:"button",variant:"outline",children:[c(At,{className:"size-3.5"}),t.reject]})]})]})},Ze=({children:t,className:a,classNames:o,decisions:r,error:s,labels:i,meta:d,onApprove:p,onReject:u,outcome:x,pendingAction:h,resolution:k,status:C,steps:M,summary:X})=>{let z=Ke({onApprove:p,onReject:u,outcome:x,status:C}),J=Ge[z],Z=J===null?void 0:i[J];return R("section",{"aria-label":i.title,className:e("rounded-md border border-border bg-background p-3 text-sm",a),"data-part":"approval-card","data-status":C,children:[R("div",{className:e("flex items-start gap-3",o?.header),children:[c(Ue,{status:C}),R("div",{className:"min-w-0 flex-1",children:[R("div",{className:"flex flex-wrap items-center gap-2",children:[c("p",{className:"font-medium text-foreground",children:i.title}),c(L,{variant:z==="decide"?"default":"outline",children:i.statuses[C]}),z==="read_only"?c(L,{variant:"secondary",children:i.readOnly}):null]}),Z===void 0?null:c("p",{className:"mt-1 text-muted-foreground",children:Z}),X===void 0?null:c("div",{className:"mt-1 break-words text-foreground",children:X}),c(Ve,{className:o?.details,decisions:r,labels:i,meta:d,resolution:k,steps:M})]})]}),t,z==="decide"?c("div",{className:o?.actions,children:c(Je,{labels:i,onApprove:p,onReject:u,pendingAction:h})}):null,s===void 0||s===null?null:c("p",{className:"mt-2 text-destructive",role:"alert",children:s}),x===void 0?null:c(qe,{label:i.outcomes[x],outcome:x})]})};import{jsx as y,jsxs as q,Fragment as nt}from"react/jsx-runtime";var et=({labels:t,name:a,onDownload:o,pending:r})=>q("button",{"aria-label":t.downloadFile(a),className:"inline-flex items-center gap-1 rounded-sm px-1 text-(--accent) hover:text-(--accent-hover) focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60",disabled:r,onClick:o,type:"button",children:[r?y(b,{className:"size-3.5 animate-spin"}):y($t,{className:"size-3.5"}),y("span",{children:r?t.downloading:t.download})]}),tt=({description:t,label:a,name:o,url:r})=>q(N,{children:[y(qr,{asChild:!0,children:y("button",{"aria-label":a,className:"shrink-0 overflow-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",type:"button",children:y("img",{alt:"",className:"size-7 object-cover",src:r})})}),y(qr,{asChild:!0,children:y("button",{className:"max-w-[220px] truncate text-left hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",type:"button",children:o})}),q(_,{size:"xl",children:[q(U,{children:[y(O,{children:o}),y(Q,{children:t})]}),y(Qo,{children:y("img",{alt:o,className:"max-h-[70vh] w-full rounded-md object-contain",src:r})})]})]}),at=(t)=>{let{className:a,detail:o,labels:r,name:s,previewUrl:i}=t;return q("span",{className:e("inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/50 px-2 py-1 text-xs text-foreground",a),"data-mode":t.mode,"data-part":"attachment-chip",children:[i===void 0?q(nt,{children:[y(We,{className:"size-3.5 shrink-0 text-muted-foreground"}),y("span",{className:"max-w-[220px] truncate",children:s})]}):y(tt,{description:r.previewDescription,label:r.preview(s),name:s,url:i}),o===void 0?null:y("span",{className:"text-muted-foreground",children:o}),t.mode==="draft"?y("button",{"aria-label":r.remove(s),className:"rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",onClick:t.onRemove,type:"button",children:y(I,{className:"size-3.5"})}):null,t.mode==="stored"&&t.onDownload!==void 0?y(et,{labels:r,name:s,onDownload:t.onDownload,pending:t.pending??!1}):null,t.mode==="stored"&&t.error!==void 0&&t.error!==null?y("span",{className:"text-destructive",role:"alert",children:t.error}):null]})};import{jsx as we,jsxs as ke}from"react/jsx-runtime";var ot=(t,a,o)=>{if(a>0)return` · ${t.messages(a)}`;if(o>0)return` · ${t.runs(o)}`;return""},rt=({className:t,labels:a,messageCount:o=0,runCount:r=0})=>ke("div",{className:e("flex items-center gap-3 text-xs text-muted-foreground",t),"data-part":"compaction-marker",children:[we("hr",{"aria-label":a.compacted,className:"h-px flex-1 border-0 bg-border"}),ke("span",{className:"shrink-0 rounded-md border border-border bg-background px-2 py-1",children:[a.compacted,ot(a,o,r)]}),we("span",{"aria-hidden":"true",className:"h-px flex-1 bg-border"})]});import{useState as st}from"react";import{jsx as S,jsxs as ee}from"react/jsx-runtime";var de=(t)=>[...t.dataTransfer.types].includes("Files"),it=({state:t})=>{if(t==="idle")return S(to,{className:"size-4"});return S(b,{className:"size-4 animate-spin"})},Re=({className:t,label:a,onStop:o,stopping:r})=>S(n,{"aria-busy":r||void 0,"aria-label":a,className:e("size-8 shrink-0 rounded-md bg-destructive text-destructive-foreground hover:bg-destructive/90",t),disabled:r,onClick:o,size:"icon",type:"button",children:r?S(b,{className:"size-4 animate-spin"}):S("span",{className:"size-3 rounded-[2px] bg-current"})}),dt=({canSubmit:t,labels:a,onStop:o,sendClassName:r,showStop:s,state:i,stopping:d,submit:p,trailing:u})=>{let x=s&&o!==void 0,h=!x&&i==="running"&&o!==void 0;return ee("div",{className:"flex shrink-0 items-center gap-1.5",children:[x?S(Re,{className:void 0,label:a.stop,onStop:o,stopping:d}):null,u,h?S(Re,{className:r,label:a.stop,onStop:o,stopping:d}):S(n,{"aria-label":i==="idle"?a.send:a.submitting,className:e("size-8 shrink-0 rounded-md bg-foreground text-background hover:bg-foreground/90",r),disabled:!t,onClick:p,size:"icon",type:"button",children:S(it,{state:i})})]})},lt=({attachments:t,className:a,classNames:o,disabled:r=!1,footer:s,labels:i,leading:d,notice:p,onFilesAdd:u,onInputKeyDown:x,onStop:h,onSubmit:k,onValueChange:C,placeholder:M,showStop:X=!1,state:z="idle",stopping:J=!1,suggestions:Z,trailing:Ie,value:ue})=>{let[ge,oe]=st(!1),fe=z==="idle"&&!r&&ue.trim()!=="",be=()=>{if(fe)k()},xe=(f)=>{if(u!==void 0&&f.length>0)u([...f])},Oe=u===void 0?{}:{onDragEnter:(f)=>{if(de(f))f.preventDefault(),oe(!0)},onDragLeave:(f)=>{let{relatedTarget:ve}=f;if(!(ve instanceof Node)||!f.currentTarget.contains(ve))oe(!1)},onDragOver:(f)=>{if(de(f))f.preventDefault()},onDrop:(f)=>{if(de(f))f.preventDefault(),oe(!1),xe(f.dataTransfer.files)}};return ee("div",{className:e("w-full",a),"data-part":"composer",children:[p===void 0?null:S("div",{className:"mb-2",children:p}),ee("div",{className:e("relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-colors dark:border-border/80 dark:bg-black dark:shadow-none",ge&&"border-primary/70 bg-primary/5 ring-2 ring-primary/20",o?.frame),"data-part":"composer-frame",...Oe,children:[ge?S("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center rounded-xl border border-primary/40 bg-background/80 text-sm font-medium text-foreground backdrop-blur-sm",children:i.drop}):null,t===void 0?null:S("div",{className:"flex flex-wrap gap-2 border-b border-border px-3 py-2",children:t}),S(Y,{"aria-label":i.input,className:e("max-h-44 min-h-20 resize-none border-0 bg-transparent px-5 py-4 text-base text-foreground shadow-none placeholder:text-muted-foreground focus-visible:ring-0 dark:bg-transparent",o?.input),disabled:r,onChange:(f)=>{C(f.target.value)},onKeyDown:(f)=>{if(x?.(f),f.defaultPrevented||f.key!=="Enter"||f.shiftKey||f.nativeEvent.isComposing)return;f.preventDefault(),be()},onPaste:(f)=>{if(u!==void 0&&f.clipboardData.files.length>0)f.preventDefault(),xe(f.clipboardData.files)},placeholder:M,value:ue}),Z,ee("div",{className:e("flex min-h-14 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-t border-border/80 bg-muted/30 px-3 py-2 dark:border-zinc-800 dark:bg-zinc-950",o?.toolbar),children:[S("div",{className:"flex min-w-0 flex-1 items-center gap-1 text-muted-foreground",children:d}),S(dt,{canSubmit:fe,labels:i,onStop:h,sendClassName:o?.send,showStop:X,state:z,stopping:J,submit:be,trailing:Ie})]})]}),s]})};import{jsx as pt}from"react/jsx-runtime";var ct=(t)=>Number.isFinite(t)?Math.round(Math.min(1,Math.max(0,t))*100):0,mt=({className:t,label:a,ratio:o})=>{let r=ct(o);return pt(Fr,{"aria-valuenow":r,className:t,"data-part":"context-usage-ring",label:a,role:"meter",value:r})};import ut from"react-markdown";import gt from"remark-gfm";import{jsx as V}from"react/jsx-runtime";var ft=({children:t,href:a})=>V("a",{href:a,rel:"noreferrer",target:"_blank",children:t}),bt=({children:t,...a})=>V("div",{className:"my-4 max-w-full overflow-x-auto",children:V("table",{...a,className:"w-max min-w-full",children:t})}),Pe={a:ft,table:bt},xt=[gt],ht=({className:t,components:a,content:o})=>V("div",{className:e("prose prose-sm min-w-0 max-w-none break-words text-[15px] leading-7 text-foreground dark:prose-invert prose-headings:font-semibold prose-pre:bg-muted prose-th:text-left",t),"data-part":"markdown",children:V(ut,{components:a===void 0?Pe:{...Pe,...a},remarkPlugins:xt,children:o})});import{jsx as B,jsxs as te}from"react/jsx-runtime";var vt=6,Ct=({className:t,classNames:a,events:o,labels:r,memoryDisabled:s=!1,saved:i,used:d})=>{if(o.length===0)return null;return te("div",{className:e("rounded-lg border border-border bg-muted/30 px-4 py-3 text-sm",t),"data-part":"memory-evidence",children:[te("div",{className:e("flex flex-wrap items-center justify-between gap-2",a?.header),children:[B("div",{className:"font-semibold",children:r.title}),te("div",{className:"flex flex-wrap gap-1.5",children:[d>0?B(L,{className:"rounded-md",variant:"secondary",children:r.used(d)}):null,i>0?B(L,{className:"rounded-md",variant:"secondary",children:r.saved(i)}):null,s?B(L,{className:"rounded-md",variant:"secondary",children:r.disabled}):null]})]}),B("ul",{className:e("mt-2 space-y-1.5",a?.events),children:o.slice(0,vt).map((p)=>te("li",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[B("span",{className:"font-medium text-foreground",children:p.label}),(p.details??[]).map((u,x)=>B("span",{children:u},x))]},p.id))})]})};import{jsx as K,jsxs as le}from"react/jsx-runtime";var Se={assistant:{className:"bg-accent text-accent-foreground",icon:K($e,{className:"size-5"})},user:{className:"bg-primary text-primary-foreground",icon:K(so,{className:"size-5"})}},Nt=({author:t,avatar:a,children:o,className:r,classNames:s,sender:i,timestamp:d})=>le("article",{className:e("grid grid-cols-[36px_minmax(0,1fr)] gap-3",r),"data-part":"message","data-sender":i,children:[K("div",{"aria-hidden":"true",className:e("grid size-9 place-items-center overflow-hidden rounded-full",a===void 0&&Se[i].className,s?.avatar),children:a??Se[i].icon}),le("div",{className:"min-w-0 text-sm text-foreground",children:[le("div",{className:e("mb-1.5 flex flex-wrap items-center gap-2",s?.header),children:[K("span",{className:e("font-semibold",s?.author),children:t}),d===void 0?null:K("span",{className:e("text-xs text-muted-foreground",s?.timestamp),children:d})]}),K("div",{className:e("flex flex-col gap-3",s?.body),children:o})]})]});import{jsx as A,jsxs as G}from"react/jsx-runtime";var ce=({className:t,decision:a,label:o,onDecide:r,pendingDecision:s,variant:i="default"})=>G(n,{className:t,disabled:s!==void 0,onClick:()=>{r(a)},type:"button",variant:i,children:[s===a?A(b,{className:"size-4 animate-spin"}):null,o]}),yt=({className:t,classNames:a,description:o,error:r,labels:s,name:i,onDecide:d,pendingDecision:p})=>A("section",{"aria-label":s.region(i),className:e("rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm",t),"data-part":"permission-prompt",children:G("div",{className:"flex items-start gap-3",children:[A("div",{className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-md bg-(--bg-accent-soft) text-(--accent)",children:A(nr,{className:"size-4"})}),G("div",{className:"@container/permission min-w-0 flex-1 space-y-3",children:[G("div",{children:[A("h2",{className:e("break-words text-base font-semibold text-foreground",a?.title),children:s.title(i)}),s.description===void 0?null:A("p",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:s.description})]}),o===void 0||o===null?null:A("p",{className:e("rounded-md border border-border bg-muted/50 px-3 py-2 text-sm leading-6 text-muted-foreground",a?.description),children:o}),r===void 0||r===null?null:A("p",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm leading-6 text-destructive",role:"alert",children:r}),G("div",{className:e("flex flex-col gap-2 @2xl/permission:flex-row @2xl/permission:items-center",a?.actions),children:[A(ce,{className:"w-full @2xl/permission:w-auto",decision:"deny",label:s.deny,onDecide:d,pendingDecision:p,variant:"outline"}),G("div",{className:"flex flex-col gap-2 @md/permission:flex-row @2xl/permission:ml-auto @2xl/permission:justify-end",children:[A(ce,{className:"w-full @md/permission:w-auto",decision:"allow_this_conversation",label:s.allowThisConversation,onDecide:d,pendingDecision:p}),A(ce,{className:"w-full @md/permission:w-auto",decision:"allow_always",label:s.allowAlways,onDecide:d,pendingDecision:p})]})]})]})]})});import{useState as Rt}from"react";import{jsx as T,jsxs as W}from"react/jsx-runtime";var Pt={approval:ar,command:eo,compaction:H,file:We,model:$e,permission:nr,request:H,run:H,skill:$e,step:H,tool:io},St=({step:t})=>{if(t.status==="active")return T(b,{className:"size-4 animate-spin"});let a=Pt[t.kind];return T(a,{className:"size-4"})},Dt=({className:t,classNames:a,defaultOpen:o=!1,onOpenChange:r,open:s,steps:i,summary:d})=>{let[p,u]=Rt(o),x=s??p;if(i.length===0)return null;return W("details",{className:e("group ml-12 text-sm text-muted-foreground",t),"data-part":"processing-steps",onToggle:(h)=>{let k=h.currentTarget.open;if(k!==x)u(k),r?.(k)},open:x,children:[W("summary",{className:e("flex w-fit cursor-pointer list-none items-center gap-1.5 font-medium text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",a?.summary),children:[T("span",{children:d}),T(v,{className:"size-4 transition-transform group-open:rotate-180"})]}),x?T("ol",{className:e("mt-4",a?.list),children:i.map((h,k)=>W("li",{className:e("grid grid-cols-[32px_minmax(0,1fr)] gap-3",a?.step),"data-status":h.status,children:[W("div",{className:"relative flex justify-center",children:[T("span",{className:"mt-0.5 grid size-6 place-items-center rounded-md border border-border bg-background text-muted-foreground",children:T(St,{step:h})}),k<i.length-1?T("span",{className:"absolute top-8 bottom-0 w-px bg-border"}):null]}),T("div",{className:"min-w-0 pb-5",children:W("div",{className:"flex min-h-6 flex-wrap items-center gap-2",children:[T("span",{className:e("break-words text-base",h.status==="active"?"text-foreground":"text-muted-foreground"),children:h.label}),h.detail===void 0?null:T("span",{className:"rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground",children:h.detail})]})})]},h.id))}):null]})};import{useId as Te,useState as ae}from"react";import{jsx as m,jsxs as D,Fragment as It}from"react/jsx-runtime";var me="other",De=(t)=>`option:${t}`,Ee=({description:t,id:a,label:o,value:r})=>D("div",{className:"flex items-start gap-2",children:[m(Xt,{className:"mt-0.5",id:a,value:r}),D("div",{className:"grid gap-0.5",children:[m(P,{htmlFor:a,children:o}),t===void 0?null:m("span",{className:"text-xs text-muted-foreground",children:t})]})]}),Et=({disabled:t,labels:a,onRespond:o,options:r,withText:s})=>{let i=Te(),[d,p]=ae(null),[u,x]=ae(""),h=(C)=>r.find((M)=>De(M.id)===C),k=(()=>{if(d===me)return u.trim()===""?null:{action:"answer",text:u.trim()};let C=d===null?void 0:h(d);return C===void 0?null:{action:"answer",optionId:C.id}})();return D(It,{children:[D(Yt,{className:"grid gap-2",disabled:t,onValueChange:(C)=>{p(C);let M=h(C);if(!s&&M!==void 0)o({action:"answer",optionId:M.id})},value:d??"",children:[r.map((C,M)=>m(Ee,{description:C.description,id:`${i}-${M}`,label:C.label,value:De(C.id)},C.id)),s?m(Ee,{id:`${i}-other`,label:a.otherOption,value:me}):null]}),s?D("div",{className:"flex gap-2",children:[m(g,{"aria-label":a.otherAnswer,disabled:t||d!==me,onChange:(C)=>{x(C.target.value)},value:u}),m(n,{disabled:t||k===null,onClick:()=>{if(k!==null)o(k)},type:"button",children:a.continue})]}):null]})},Lt=({disabled:t,labels:a,onRespond:o})=>{let[r,s]=ae("");return D("div",{className:"grid gap-2",children:[m(Y,{"aria-label":a.textAnswer,disabled:t,onChange:(i)=>{s(i.target.value)},placeholder:a.textPlaceholder,value:r}),m(n,{className:"justify-self-start",disabled:t||r.trim()==="",onClick:()=>{o({action:"answer",text:r.trim()})},type:"button",children:a.answer})]})},Tt=({disabled:t,labels:a,onRespond:o})=>{let r=Te(),[s,i]=ae("");return D("div",{className:"grid gap-2",children:[m(n,{className:"justify-self-start",disabled:t,onClick:()=>{o({action:"approve"})},type:"button",children:t?a.responding:a.approve}),m(P,{htmlFor:r,children:a.reviseLabel}),D("div",{className:"flex gap-2",children:[m(g,{disabled:t,id:r,onChange:(d)=>{i(d.target.value)},value:s}),m(n,{disabled:t||s.trim()==="",onClick:()=>{o({action:"revise",text:s.trim()})},type:"button",variant:"outline",children:a.revise})]})]})},Ae=({error:t})=>t===void 0||t===null?null:m("p",{className:"text-destructive",role:"alert",children:t}),Le=({meta:t})=>t.length===0?null:m("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:t.map((a,o)=>m("span",{children:a},o))}),Mt=({className:t,label:a,preview:o})=>o===void 0||o===null?null:D("div",{className:e("grid gap-2 rounded-md border border-border bg-muted/30 p-3",t),children:[m("p",{className:"font-semibold",children:a}),m("div",{className:"break-words",children:o})]}),zt=(t)=>t!=="pending"&&t!=="responding",Bt=({className:t,classNames:a,labels:o,outcome:r,prompt:s,status:i})=>D("section",{className:e("grid gap-2 rounded-lg border border-border bg-muted/30 p-4 text-sm",t),"data-part":"question-card","data-status":i,children:[m("div",{className:e("break-words",a?.prompt),children:s}),D("p",{className:"flex items-center gap-2 font-medium",children:[i==="completed"?m(H,{className:"size-4 shrink-0 text-emerald-600"}):m(At,{className:"size-4 shrink-0 text-destructive"}),o[i]]}),r===void 0||r===null?null:m("output",{className:"text-muted-foreground",children:r})]}),Ft=(t)=>{let{className:a,classNames:o,error:r,labels:s,meta:i=[],onRespond:d,outcome:p,preview:u,prompt:x,status:h}=t;if(zt(h))return m(Bt,{className:a,classNames:o,labels:s,outcome:p,prompt:x,status:h});let k=h==="responding",C=m(Mt,{className:o?.preview,label:s.preview,preview:u});if(t.mode==="confirm")return D("section",{className:e("grid gap-3 rounded-lg border border-border bg-muted/30 p-4 text-sm",a),"data-part":"question-card","data-status":h,children:[D("div",{children:[m("p",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:s.confirmTitle}),s.confirmHint===void 0?null:m("p",{className:"text-xs text-muted-foreground",children:s.confirmHint})]}),m("div",{className:e("break-words font-semibold",o?.prompt),children:x}),m(Le,{meta:i}),C,m(Tt,{disabled:k,labels:s,onRespond:d}),m(Ae,{error:r})]});return D("section",{className:e("grid gap-3 rounded-lg border border-border p-4 text-sm",a),"data-part":"question-card","data-status":h,children:[C,m("div",{className:e("break-words",o?.prompt),children:x}),m(Le,{meta:i}),t.mode==="choice"||t.mode==="choice_or_text"?m(Et,{disabled:k,labels:s,onRespond:d,options:t.options,withText:t.mode==="choice_or_text"}):null,t.mode==="text"?m(Lt,{disabled:k,labels:s,onRespond:d}):null,m(Ae,{error:r})]})};import{jsx as F,jsxs as ne,Fragment as jt}from"react/jsx-runtime";var Ot={danger:"text-destructive",neutral:"text-muted-foreground",primary:"text-primary",success:"text-emerald-600",warning:"text-amber-600"},_t=({className:t,classNames:a,detail:o,label:r,labels:s,tone:i})=>ne("div",{className:e("rounded-lg border border-border bg-muted/30 px-4 py-3",t),"data-part":"run-status","data-tone":i,children:[ne("div",{className:"flex min-w-0 items-center gap-2",children:[F($e,{className:"size-4 shrink-0 text-muted-foreground"}),F("span",{className:e("truncate font-semibold",a?.title),children:s.title})]}),ne("div",{className:e("mt-1.5 flex flex-wrap items-center gap-2 text-sm",a?.status),children:[F(wt,{size:"md",tone:i}),F("span",{className:"text-muted-foreground",children:s.status}),F("span",{className:Ot[i],children:r}),o===void 0||o===null?null:ne(jt,{children:[F("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"·"}),F("span",{className:"font-mono text-xs text-muted-foreground",children:o})]})]})]});import{useState as Me}from"react";import{jsx as l,jsxs as w}from"react/jsx-runtime";var Ht=5,Ut=4,qt={custom:We,evidence:We,json:or,links:Ye,sources:oo,summary:or,table:ro,text:or,warnings:he},Kt=(t)=>{try{let{protocol:a}=new URL(t);return a==="http:"||a==="https:"?t:null}catch{return null}},ze=({children:t,url:a})=>{let o=Kt(a);if(o===null)return l("span",{className:"break-words font-medium",children:t});return w("a",{className:"inline-flex max-w-full items-center gap-1 break-all font-medium text-primary hover:text-(--accent-hover)",href:o,rel:"noreferrer",target:"_blank",children:[l("span",{className:"min-w-0 break-words",children:t}),l(kt,{className:"size-3 shrink-0"})]})},Be=({meta:t})=>t===void 0||t.length===0?null:l("div",{className:"mt-1 flex flex-wrap gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:t.map((a,o)=>l("span",{children:a},o))}),pe=({excerpt:t})=>t===void 0?null:l("p",{className:"mt-1 break-words text-xs leading-5 text-muted-foreground",children:t}),Fe=({hidden:t,label:a,onShow:o})=>t>0?w("button",{className:"inline-flex items-center gap-1 text-xs font-medium text-primary hover:text-(--accent-hover)",onClick:o,type:"button",children:[a(t),l(v,{className:"size-3"})]}):null,Gt=({groups:t,note:a})=>w("div",{className:"flex flex-col gap-3",children:[t.map((o)=>w("section",{className:"flex flex-col gap-2",children:[l("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:o.label}),l("ol",{className:"flex flex-col gap-2",children:o.items.map((r)=>w("li",{className:"rounded-md border border-border bg-background/70 p-2.5",children:[w("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[w("div",{className:"min-w-0",children:[l("div",{className:"font-medium",children:r.title}),l(pe,{excerpt:r.excerpt})]}),r.action]}),l(Be,{meta:r.meta})]},r.id))})]},o.id)),a===void 0?null:l("p",{className:"text-xs text-muted-foreground",children:a})]}),Vt=({columns:t,labels:a,rows:o})=>{let[r,s]=Me(!1),i=r?o:o.slice(0,Ht);return w("div",{className:"flex flex-col items-start gap-2",children:[l("div",{className:"w-full max-w-full overflow-x-auto",children:w("table",{className:"w-full min-w-[520px] table-fixed border-collapse text-left text-xs",children:[l("thead",{children:l("tr",{className:"border-b border-border",children:t.map((d)=>l("th",{className:"w-[180px] px-2 py-2 font-semibold text-muted-foreground",title:d.description,children:d.label},d.key))})}),l("tbody",{children:i.map((d)=>l("tr",{className:"border-b border-border/70 last:border-0",children:t.map((p)=>l("td",{className:"px-2 py-2 align-top break-words",children:d.cells[p.key]},p.key))},d.id))})]})}),l(Fe,{hidden:o.length-i.length,label:a.showMore,onShow:()=>{s(!0)}})]})},Wt=({labels:t,sources:a})=>{let[o,r]=Me(!1),s=o?a:a.slice(0,Ut);return w("div",{className:"flex flex-col items-start gap-2",children:[l("ol",{className:"flex w-full flex-col gap-2",children:s.map((i)=>w("li",{className:"rounded-md border border-border bg-background/70 p-2",children:[w("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[w("div",{className:"min-w-0",children:[i.url===void 0?l("span",{className:"font-medium",children:i.title}):l(ze,{url:i.url,children:i.title}),l(pe,{excerpt:i.excerpt})]}),i.rank===void 0?null:l("span",{className:"shrink-0 text-xs text-muted-foreground",children:i.rank})]}),l(Be,{meta:i.meta})]},i.id))}),l(Fe,{hidden:a.length-s.length,label:t.showMore,onShow:()=>{r(!0)}})]})},Jt=(t)=>{switch(t.kind){case"custom":return!1;case"evidence":return t.groups.every((a)=>a.items.length===0);case"json":return t.json==="";case"links":return t.links.length===0;case"sources":return t.sources.length===0;case"summary":return t.items.length===0;case"table":return t.columns.length===0||t.rows.length===0;case"text":return t.text==="";case"warnings":return t.warnings.length===0;default:return t}},Zt=({labels:t,part:a})=>{if(Jt(a))return l("p",{className:"text-xs text-muted-foreground",children:t.empty});switch(a.kind){case"custom":return a.content;case"evidence":return l(Gt,{groups:a.groups,note:a.note});case"json":return l("pre",{className:"max-h-[280px] overflow-auto rounded-md bg-background p-2 text-xs leading-5 text-foreground",children:a.json});case"links":return l("ul",{className:"grid gap-2",children:a.links.map((o)=>w("li",{className:"min-w-0 rounded-md border border-border bg-background/70 p-2",children:[l(ze,{url:o.url,children:o.label}),l(pe,{excerpt:o.description})]},o.id))});case"sources":return l(Wt,{labels:t,sources:a.sources});case"summary":return l("dl",{className:"grid gap-2 @lg/chat:grid-cols-2",children:a.items.map((o)=>w("div",{className:"min-w-0 rounded-md border border-border bg-background/70 p-2",children:[l("dt",{className:"text-xs font-medium text-muted-foreground",children:o.label}),l("dd",{className:"mt-1 break-words text-sm",children:o.value}),o.description===void 0?null:l("dd",{className:"mt-1 text-xs text-muted-foreground",children:o.description})]},o.id))});case"table":return l(Vt,{columns:a.columns,labels:t,rows:a.rows});case"text":return l("p",{className:"whitespace-pre-wrap break-words text-sm leading-6",children:a.text});case"warnings":return l("ul",{className:"flex flex-col gap-2",children:a.warnings.map((o)=>w("li",{className:"flex min-w-0 gap-2 rounded-md border border-amber-200 bg-amber-50 px-2 py-2 text-amber-900 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:[l(he,{className:"mt-0.5 size-3.5 shrink-0"}),l("span",{className:"break-words text-xs",children:o.message})]},o.id))});default:return a}},ea=({part:t})=>{if(t.kind==="custom"&&t.icon!==void 0)return t.icon;let a=qt[t.kind];return l(a,{className:"size-4"})},ta=({className:t,classNames:a,labels:o,parts:r})=>r.length===0?null:l("div",{className:e("flex flex-col gap-3",t),"data-part":"tool-evidence",children:r.map((s)=>w("section",{className:e("overflow-hidden rounded-md border border-border bg-muted/20",a?.part),"data-kind":s.kind,children:[w("div",{className:e("flex min-w-0 items-start gap-2 border-b border-border px-3 py-2",a?.header),children:[l("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:l(ea,{part:s})}),w("div",{className:"min-w-0",children:[l("h3",{className:"truncate text-sm font-medium",children:s.title}),s.description===void 0?null:l("p",{className:"mt-0.5 text-xs leading-5 text-muted-foreground",children:s.description})]})]}),l("div",{className:e("min-w-0 p-3",a?.body),children:l(Zt,{labels:o,part:s})})]},s.id))});export{_e as ChatAnswerFeedback,Ze as ChatApprovalCard,at as ChatAttachmentChip,rt as ChatCompactionMarker,lt as ChatComposerShell,mt as ChatContextUsageRing,ht as ChatMarkdown,Ct as ChatMemoryEvidence,Nt as ChatMessage,yt as ChatPermissionPrompt,Dt as ChatProcessingSteps,Ft as ChatQuestionCard,_t as ChatRunStatus,ta as ChatToolEvidence};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{t}from"../../index-64r6cav3.js";import"../../index-dg126t3v.js";import{T}from"../../index-r5ds1mtq.js";import{_e,Fe,Be}from"../../index-r7hjj3ek.js";import{_o,Fo}from"../../index-nxbvv8m4.js";import{v}from"../../index-tcwzyy71.js";import{e}from"../../index-qbwndfn2.js";var J=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],x=t("brain",J);import*as g from"react";import*as b from"react";var V=(n,o,a)=>{let[r,c]=b.useState(o),p=n!==void 0,i=p?n:r,u=b.useCallback((h)=>{if(!p)c(h);if(!Object.is(h,i))a?.(h)},[p,a,i]);return[i,u]};import{jsx as l,jsxs as R}from"react/jsx-runtime";var _=g.createContext(null),K=()=>{let n=g.useContext(_);if(n===null)throw Error("ChainOfThought components must be used within ChainOfThought");return n},Q=({className:n,open:o,defaultOpen:a=!1,onOpenChange:r,children:c,...p})=>{let[i,u]=V(o,a,r),h=g.useMemo(()=>({isOpen:i,setIsOpen:u}),[i,u]);return l(_.Provider,{value:h,children:l(_e,{open:i,onOpenChange:u,className:e("not-prose flex w-full flex-col gap-4",n),...p,children:c})})},W=({className:n,children:o,...a})=>{let{isOpen:r}=K();return R(Fe,{className:e("text-muted-foreground hover:text-foreground flex w-full items-center gap-2 text-sm transition-colors",n),...a,children:[l(x,{className:"size-4"}),l("span",{className:"flex-1 text-left",children:o??"Chain of Thought"}),l(v,{className:e("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})},X={active:"text-foreground",complete:"text-muted-foreground",pending:"text-muted-foreground/50"},Z=({className:n,icon:o=Fo,label:a,description:r,status:c="complete",children:p,...i})=>R("div",{"data-status":c,className:e("flex gap-2 text-sm",X[c],"fade-in-0 slide-in-from-top-2 animate-in",n),...i,children:[R("div",{className:"relative mt-0.5",children:[l(o,{className:"size-4"}),l("div",{className:"bg-border absolute top-7 bottom-0 left-1/2 -mx-px w-px"})]}),R("div",{className:"flex flex-1 flex-col gap-2 overflow-hidden",children:[l("div",{children:a}),r!==void 0&&r!==null&&r!==!1&&l("div",{className:"text-muted-foreground text-xs",children:r}),p]})]}),j=({className:n,...o})=>l("div",{className:e("flex flex-wrap items-center gap-2",n),...o}),ee=({className:n,children:o,...a})=>l(T,{className:e("gap-1 px-2 py-0.5 text-xs font-normal",n),variant:"secondary",...a,children:o}),oe=({className:n,children:o,...a})=>l(Be,{className:e("mt-2 flex flex-col gap-3","data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 text-popover-foreground data-closed:animate-out data-open:animate-in outline-none",n),...a,children:o}),te=({className:n,children:o,caption:a,...r})=>R("div",{className:e("mt-2 flex flex-col gap-2",n),...r,children:[l("div",{className:"bg-muted relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg p-3",children:o}),a!==void 0&&a!==""&&l("p",{className:"text-muted-foreground text-xs",children:a})]});import*as s from"react";import{Streamdown as re}from"streamdown";import*as C from"react";import{jsx as E}from"react/jsx-runtime";var ne=1000,ae=({children:n,as:o="p",className:a,duration:r=2,spread:c=2})=>{let p=C.useRef(null);C.useEffect(()=>{let u=p.current;if(u===null||!("animate"in u))return;if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let h=u.animate([{backgroundPosition:"100% center"},{backgroundPosition:"0% center"}],{duration:r*ne,easing:"linear",iterations:Number.POSITIVE_INFINITY});return()=>h.cancel()},[r]);let i={"--spread":`${n.length*c}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))",backgroundPosition:"100% center"};return E(o,{children:E("span",{ref:p,"data-slot":"shimmer",className:e("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[background-repeat:no-repeat,padding-box] [--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))]",a),style:i,children:n})})},N=C.memo(ae);import{jsx as m,jsxs as A,Fragment as he}from"react/jsx-runtime";var D=s.createContext(null),H=()=>{let n=s.useContext(D);if(n===null)throw Error("Reasoning components must be used within Reasoning");return n},se=1000,ie=1000,pe=({className:n,isStreaming:o=!1,open:a,defaultOpen:r,onOpenChange:c,duration:p,children:i,...u})=>{let[h,L]=s.useState(r),[z,q]=s.useState(o),[O,U]=s.useState(o),[P,I]=s.useState(!1);if(o!==z){if(q(o),o)U(!0),I(!1)}let S=a??h??(O&&!P),y=s.useCallback((f)=>{L(f),c?.(f)},[c]),[Y,F]=s.useState(),k=p??Y;s.useEffect(()=>{if(!o)return;let f=Date.now();return()=>{F(Math.ceil((Date.now()-f)/ie))}},[o]);let M=a===void 0&&h===void 0;s.useEffect(()=>{if(!M||!O||o||P)return;let f=setTimeout(()=>I(!0),se);return()=>clearTimeout(f)},[M,O,o,P]);let G=s.useMemo(()=>({duration:k,isOpen:S,isStreaming:o,setIsOpen:y}),[k,S,o,y]);return m(D.Provider,{value:G,children:m(_e,{className:e("not-prose mb-4",n),onOpenChange:y,open:S,...u,children:i})})},le=(n,o)=>{if(n||o===0)return m(N,{duration:1,children:"Thinking..."});if(o===void 0)return m("p",{children:"Thought for a few seconds"});return A("p",{children:["Thought for ",o," seconds"]})},ce=({className:n,children:o,getThinkingMessage:a=le,...r})=>{let{isStreaming:c,isOpen:p,duration:i}=H();return m(Fe,{className:e("text-muted-foreground hover:text-foreground flex w-full items-center gap-2 text-sm transition-colors",n),...r,children:o??A(he,{children:[m(x,{className:"size-4"}),a(c,i),m(v,{className:e("size-4 transition-transform",p?"rotate-180":"rotate-0")})]})})},ue=({className:n,children:o,...a})=>m(Be,{className:e("mt-4 text-sm","data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 text-muted-foreground data-closed:animate-out data-open:animate-in outline-none",n),...a,children:m(re,{children:o})});import{jsx as d,jsxs as w,Fragment as B}from"react/jsx-runtime";var me=({className:n,...o})=>d(_e,{className:e("not-prose text-primary mb-4 text-xs",n),...o}),de=({className:n,count:o,children:a,...r})=>d(Fe,{className:e("flex items-center gap-2",n),...r,children:a??w(B,{children:[w("p",{className:"font-medium",children:["Used ",o," sources"]}),d(v,{className:"h-4 w-4"})]})}),fe=({className:n,...o})=>d(Be,{className:e("mt-3 flex w-fit flex-col gap-2","data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 data-closed:animate-out data-open:animate-in outline-none",n),...o}),ge=({href:n,title:o,children:a,...r})=>d("a",{className:"flex items-center gap-2",href:n,rel:"noreferrer",target:"_blank",...r,children:a??w(B,{children:[d(_o,{className:"h-4 w-4"}),d("span",{className:"block font-medium",children:o})]})});export{Q as ChainOfThought,oe as ChainOfThoughtContent,W as ChainOfThoughtHeader,te as ChainOfThoughtImage,ee as ChainOfThoughtSearchResult,j as ChainOfThoughtSearchResults,Z as ChainOfThoughtStep,pe as Reasoning,ue as ReasoningContent,ce as ReasoningTrigger,N as Shimmer,ge as Source,me as Sources,fe as SourcesContent,de as SourcesTrigger,H as useReasoning};
2
+ import"../../index-j136rmty.js";import"../../index-xqct5yan.js";import{L}from"../../index-74qkvrg9.js";import{Oe,Fe,Be}from"../../index-ra03yvht.js";import{Ro,sr,wo}from"../../index-2136bczj.js";import{v}from"../../index-4vk89see.js";import{e}from"../../index-1amahhaz.js";import*as g from"react";import*as R from"react";var I=(t,o,n)=>{let[a,p]=R.useState(o),i=t!==void 0,s=i?t:a,c=R.useCallback((u)=>{if(!i)p(u);if(!Object.is(u,s))n?.(u)},[i,n,s]);return[s,c]};import{jsx as l,jsxs as C}from"react/jsx-runtime";var k=g.createContext(null),G=()=>{let t=g.useContext(k);if(t===null)throw Error("ChainOfThought components must be used within ChainOfThought");return t},q=({className:t,open:o,defaultOpen:n=!1,onOpenChange:a,children:p,...i})=>{let[s,c]=I(o,n,a),u=g.useMemo(()=>({isOpen:s,setIsOpen:c}),[s,c]);return l(k.Provider,{value:u,children:l(Oe,{open:s,onOpenChange:c,className:e("not-prose flex w-full flex-col gap-4",t),...i,children:p})})},J=({className:t,children:o,...n})=>{let{isOpen:a}=G();return C(Fe,{className:e("text-muted-foreground hover:text-foreground flex w-full items-center gap-2 text-sm transition-colors",t),...n,children:[l(sr,{className:"size-4"}),l("span",{className:"flex-1 text-left",children:o??"Chain of Thought"}),l(v,{className:e("size-4 transition-transform",a?"rotate-180":"rotate-0")})]})},K={active:"text-foreground",complete:"text-muted-foreground",pending:"text-muted-foreground/50"},Q=({className:t,icon:o=wo,label:n,description:a,status:p="complete",children:i,...s})=>C("div",{"data-status":p,className:e("flex gap-2 text-sm",K[p],"fade-in-0 slide-in-from-top-2 animate-in",t),...s,children:[C("div",{className:"relative mt-0.5",children:[l(o,{className:"size-4"}),l("div",{className:"bg-border absolute top-7 bottom-0 left-1/2 -mx-px w-px"})]}),C("div",{className:"flex flex-1 flex-col gap-2 overflow-hidden",children:[l("div",{children:n}),a!==void 0&&a!==null&&a!==!1&&l("div",{className:"text-muted-foreground text-xs",children:a}),i]})]}),W=({className:t,...o})=>l("div",{className:e("flex flex-wrap items-center gap-2",t),...o}),X=({className:t,children:o,...n})=>l(L,{className:e("gap-1 px-2 py-0.5 text-xs font-normal",t),variant:"secondary",...n,children:o}),Z=({className:t,children:o,...n})=>l(Be,{className:e("mt-2 flex flex-col gap-3","data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 text-popover-foreground data-closed:animate-out data-open:animate-in outline-none",t),...n,children:o}),j=({className:t,children:o,caption:n,...a})=>C("div",{className:e("mt-2 flex flex-col gap-2",t),...a,children:[l("div",{className:"bg-muted relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg p-3",children:o}),n!==void 0&&n!==""&&l("p",{className:"text-muted-foreground text-xs",children:n})]});import*as r from"react";import{Streamdown as te}from"streamdown";import*as d from"react";import{jsx as V}from"react/jsx-runtime";var ee=1000,oe=({children:t,as:o="p",className:n,duration:a=2,spread:p=2})=>{let i=d.useRef(null);d.useEffect(()=>{let c=i.current;if(c===null||!("animate"in c))return;if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let u=c.animate([{backgroundPosition:"100% center"},{backgroundPosition:"0% center"}],{duration:a*ee,easing:"linear",iterations:Number.POSITIVE_INFINITY});return()=>u.cancel()},[a]);let s={"--spread":`${t.length*p}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))",backgroundPosition:"100% center"};return V(o,{children:V("span",{ref:i,"data-slot":"shimmer",className:e("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[background-repeat:no-repeat,padding-box] [--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))]",n),style:s,children:t})})},P=d.memo(oe);import{jsx as h,jsxs as E,Fragment as pe}from"react/jsx-runtime";var M=r.createContext(null),_=()=>{let t=r.useContext(M);if(t===null)throw Error("Reasoning components must be used within Reasoning");return t},ne=1000,ae=1000,re=({className:t,isStreaming:o=!1,open:n,defaultOpen:a,onOpenChange:p,duration:i,children:s,...c})=>{let[u,H]=r.useState(a),[B,z]=r.useState(o),[T,A]=r.useState(o),[x,y]=r.useState(!1);if(o!==B){if(z(o),o)A(!0),y(!1)}let b=n??u??(T&&!x),O=r.useCallback((f)=>{H(f),p?.(f)},[p]),[U,Y]=r.useState(),N=i??U;r.useEffect(()=>{if(!o)return;let f=Date.now();return()=>{Y(Math.ceil((Date.now()-f)/ae))}},[o]);let w=n===void 0&&u===void 0;r.useEffect(()=>{if(!w||!T||o||x)return;let f=setTimeout(()=>y(!0),ne);return()=>clearTimeout(f)},[w,T,o,x]);let F=r.useMemo(()=>({duration:N,isOpen:b,isStreaming:o,setIsOpen:O}),[N,b,o,O]);return h(M.Provider,{value:F,children:h(Oe,{className:e("not-prose mb-4",t),onOpenChange:O,open:b,...c,children:s})})},se=(t,o)=>{if(t||o===0)return h(P,{duration:1,children:"Thinking..."});if(o===void 0)return h("p",{children:"Thought for a few seconds"});return E("p",{children:["Thought for ",o," seconds"]})},ie=({className:t,children:o,getThinkingMessage:n=se,...a})=>{let{isStreaming:p,isOpen:i,duration:s}=_();return h(Fe,{className:e("text-muted-foreground hover:text-foreground flex w-full items-center gap-2 text-sm transition-colors",t),...a,children:o??E(pe,{children:[h(sr,{className:"size-4"}),n(p,s),h(v,{className:e("size-4 transition-transform",i?"rotate-180":"rotate-0")})]})})},le=({className:t,children:o,...n})=>h(Be,{className:e("mt-4 text-sm","data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 text-muted-foreground data-closed:animate-out data-open:animate-in outline-none",t),...n,children:h(te,{children:o})});import{jsx as m,jsxs as S,Fragment as D}from"react/jsx-runtime";var ce=({className:t,...o})=>m(Oe,{className:e("not-prose text-primary mb-4 text-xs",t),...o}),ue=({className:t,count:o,children:n,...a})=>m(Fe,{className:e("flex items-center gap-2",t),...a,children:n??S(D,{children:[S("p",{className:"font-medium",children:["Used ",o," sources"]}),m(v,{className:"h-4 w-4"})]})}),he=({className:t,...o})=>m(Be,{className:e("mt-3 flex w-fit flex-col gap-2","data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 data-closed:animate-out data-open:animate-in outline-none",t),...o}),me=({href:t,title:o,children:n,...a})=>m("a",{className:"flex items-center gap-2",href:t,rel:"noreferrer",target:"_blank",...a,children:n??S(D,{children:[m(Ro,{className:"h-4 w-4"}),m("span",{className:"block font-medium",children:o})]})});export{q as ChainOfThought,Z as ChainOfThoughtContent,J as ChainOfThoughtHeader,j as ChainOfThoughtImage,X as ChainOfThoughtSearchResult,W as ChainOfThoughtSearchResults,Q as ChainOfThoughtStep,re as Reasoning,le as ReasoningContent,ie as ReasoningTrigger,P as Shimmer,me as Source,ce as Sources,he as SourcesContent,ue as SourcesTrigger,_ as useReasoning};
@@ -1,6 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { Activity, AlertCircle, AlertTriangle, AppWindow, Apple, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, AtSign, Award, Bell, BellIcon, Book, Bot, Box, Braces, Briefcase, Building, Calculator, Calendar, CalendarDays, Check, CheckCircle, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronLeftIcon, ChevronRight, ChevronRightIcon, ChevronUp, ChevronUpIcon, ChevronsUpDown, CircleIcon, Clock, Cloud, Code, Code2, Copy, Cpu, CreditCard, CreditCardIcon, Database, Dot, Download, Edit, Eraser, ExternalLink, Eye, EyeOff, FileIcon, FileSpreadsheet, FileText, Filter, Folder, FolderInput, FolderOpen, FolderPlus, GitCompareArrows, GitFork, Globe, GripVertical, Hash, History as History$1, Home, IdCard, Inbox, Info, Key, Layers, LayoutDashboard, LayoutGrid, Link2, Link2Off, List, ListFilter, Loader2, LogOutIcon, LucideIcon, Mail, MapPin, Maximize, Megaphone, MemoryStick, MessageSquare, MessageSquarePlus, Mic, Minimize2, MinusIcon, Monitor, MoonIcon, MoreHorizontal, MoreHorizontalIcon, MoreVertical, MoreVerticalIcon, PanelLeftIcon, PanelTop, Paperclip, Pause, Pencil, Play, Plug2, Plus, PlusCircle, Power, Receipt, RefreshCw, Rocket, RotateCcw, Save, Search, SearchIcon, Send, SendHorizontal, ServerCrash, Settings, Settings2, Shield, ShieldAlert, ShieldCheck, ShieldX, Signal, SignalHigh, SignalLow, SignalMedium, Sparkles, Stamp, SunIcon, Table, Tag, Terminal, TestTube, TestTube2, ThumbsDown, ThumbsUp, ToggleLeft, Trash2, TrendingUp, Type, Upload, User, UserCheck, UserCircleIcon, UserCog, UserPlus, UserX, Users, Workflow, Wrench, X, XCircle, XIcon, Zap } from 'lucide-react';
3
+ import { Activity, AlertCircle, AlertTriangle, AppWindow, Apple, Archive, ArchiveRestore, ArchiveX, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, AtSign, AudioLines, Award, Bell, BellDot, BellIcon, BellMinus, BellPlus, BellRing, Binoculars, Book, BookMarked, BookOpen, BookOpenText, BookPlus, BookSearch, BookUser, BookX, Bot, Box, BoxSelect, Braces, Brain, BrainCircuit, BrainCog, Briefcase, BriefcaseBusiness, BriefcaseConveyorBelt, BriefcaseMedical, Building, Building2, Calculator, Calendar, Calendar1, CalendarCheck, CalendarCheck2, CalendarClock, CalendarCog, CalendarDays, CalendarFold, CalendarPlus, CalendarPlus2, CalendarRange, CalendarSearch, CalendarX, CalendarX2, ChartColumn, ChartLine, Check, CheckCircle, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronLeftIcon, ChevronRight, ChevronRightIcon, ChevronUp, ChevronUpIcon, ChevronsUpDown, CircleIcon, CirclePause, CirclePlay, Clipboard as Clipboard$1, ClipboardCheck, ClipboardList, ClipboardMinus, ClipboardPen, ClipboardPlus, ClipboardType, Clock, Cloud, CloudAlert, CloudBackup, CloudCheck, CloudCog, CloudOff, CloudSync, CloudUpload, Code, Code2, Coins, Contact, ContactRound, Copy, Cpu, CreditCard, CreditCardIcon, Crosshair, Database, Dot, Download, Edit, Eraser, ExternalLink, Eye, EyeOff, Factory, FileDown, FileIcon, FileInput, FilePen, FilePenLine, FilePlus, FilePlus2, FileSearch, FileSpreadsheet, FileText, FileType, FileX, FileX2, Filter, Flag, Folder, FolderArchive, FolderCog, FolderDown, FolderInput, FolderMinus, FolderOpen, FolderOutput, FolderPen, FolderPlus, FolderTree, FolderX, Forward, Gauge, GaugeCircle, GitBranch, GitCompareArrows, GitFork, Globe, GripVertical, Handshake, HardDriveDownload, Hash, History as History$1, Home, Hourglass, IdCard, ImagePlus, Inbox, Info, Key, Landmark, Layers, LayersPlus, LayoutDashboard, LayoutGrid, LayoutTemplate, LetterText, Library, LibraryBig, Link, Link2, Link2Off, List, ListChecks, ListEnd, ListFilter, ListFilterPlus, ListOrdered, ListPlus, ListTodo, ListVideo, Loader2, LogOutIcon, LucideIcon, Mail, MailCheck, MailMinus, MailOpen, MailPlus, MailQuestionMark, MailSearch, MailWarning, MailX, Mailbox, Mails, MapPin, Maximize, Megaphone, MemoryStick, MessageCircle, MessageCircleMore, MessageCircleReply, MessageSquare, MessageSquareDot, MessageSquareMore, MessageSquarePlus, MessageSquareQuote, MessageSquareShare, MessageSquareText, Mic, Milestone, Minimize2, MinusIcon, Monitor, MoonIcon, MoreHorizontal, MoreHorizontalIcon, MoreVertical, MoreVerticalIcon, Network, Newspaper, Notebook, NotebookPen, NotebookTabs, NotebookText, NotepadText, PackageCheck, PackageOpen, PackagePlus, PackageSearch, PackageX, PanelLeftIcon, PanelTop, Paperclip, Pause, PenLine, PenTool, Pencil, PencilLine, Phone, PhoneForwarded, PhoneIncoming, PhoneOutgoing, Play, Plug2, PlugZap, Plus, PlusCircle, Power, Receipt, ReceiptText, RefreshCw, Rocket, RotateCcw, Rss, Save, Scale, ScanSearch, ScanText, Search, SearchCheck, SearchIcon, Send, SendHorizontal, SendToBack, ServerCrash, Settings, Settings2, Share2, Shield, ShieldAlert, ShieldCheck, ShieldX, Sigma, Signal, SignalHigh, SignalLow, SignalMedium, Signpost, SkipForward, SlidersHorizontal, SlidersVertical, Smartphone, SmartphoneNfc, Sparkles, SquareCheck, SquareCheckBig, SquarePlus, SquareUser, Stamp, StickyNote, Store, SunIcon, Table, Table2, TableConfig, TableOfContents, TableProperties, Tag, Tags, Target, Telescope, Terminal, TestTube, TestTube2, TextQuote, TextSearch, TextSelect, ThumbsDown, ThumbsUp, ToggleLeft, Trash2, TrendingUp, Type, Unlink, Upload, User, UserCheck, UserCircleIcon, UserCog, UserMinus, UserPen, UserPlus, UserRoundCheck, UserRoundCog, UserRoundPen, UserRoundPlus, UserRoundSearch, UserSearch, UserStar, UserX, Users, UsersRound, Warehouse, Waypoints, Webhook, Workflow, Wrench, X, XCircle, XIcon, Zap } from 'lucide-react';
4
4
  import { SVGProps } from 'react';
5
5
 
6
6
  export declare const GoogleIcon: (props: SVGProps<SVGSVGElement>) => import("react").JSX.Element;
@@ -19,24 +19,61 @@ export {
19
19
  AppWindow,
20
20
  Apple,
21
21
  Archive,
22
+ ArchiveRestore,
23
+ ArchiveX,
22
24
  ArrowDown,
23
25
  ArrowLeft,
24
26
  ArrowRight,
25
27
  ArrowUp,
26
28
  ArrowUpDown,
27
29
  AtSign,
30
+ AudioLines,
28
31
  Award,
29
32
  Bell,
33
+ BellDot,
30
34
  BellIcon,
35
+ BellMinus,
36
+ BellPlus,
37
+ BellRing,
38
+ Binoculars,
31
39
  Book,
40
+ BookMarked,
41
+ BookOpen,
42
+ BookOpenText,
43
+ BookPlus,
44
+ BookSearch,
45
+ BookUser,
46
+ BookX,
32
47
  Bot,
33
48
  Box,
49
+ BoxSelect,
34
50
  Braces,
51
+ Brain,
52
+ BrainCircuit,
53
+ BrainCog,
35
54
  Briefcase,
55
+ BriefcaseBusiness,
56
+ BriefcaseConveyorBelt,
57
+ BriefcaseMedical,
36
58
  Building,
59
+ Building2,
37
60
  Calculator,
38
61
  Calendar,
62
+ Calendar1,
63
+ CalendarCheck,
64
+ CalendarCheck2,
65
+ CalendarClock,
66
+ CalendarCog,
39
67
  CalendarDays,
68
+ CalendarFold,
69
+ CalendarPlus,
70
+ CalendarPlus2,
71
+ CalendarRange,
72
+ CalendarSearch,
73
+ CalendarX,
74
+ CalendarX2,
75
+ ChartColumn,
76
+ ChartLine,
40
77
  Check,
41
78
  CheckCircle,
42
79
  CheckCircle2,
@@ -51,14 +88,34 @@ export {
51
88
  ChevronUpIcon,
52
89
  ChevronsUpDown,
53
90
  CircleIcon,
91
+ CirclePause,
92
+ CirclePlay,
93
+ Clipboard$1 as Clipboard,
94
+ ClipboardCheck,
95
+ ClipboardList,
96
+ ClipboardMinus,
97
+ ClipboardPen,
98
+ ClipboardPlus,
99
+ ClipboardType,
54
100
  Clock,
55
101
  Cloud,
102
+ CloudAlert,
103
+ CloudBackup,
104
+ CloudCheck,
105
+ CloudCog,
106
+ CloudOff,
107
+ CloudSync,
108
+ CloudUpload,
56
109
  Code,
57
110
  Code2,
111
+ Coins,
112
+ Contact,
113
+ ContactRound,
58
114
  Copy,
59
115
  Cpu,
60
116
  CreditCard,
61
117
  CreditCardIcon,
118
+ Crosshair,
62
119
  Database,
63
120
  Dot,
64
121
  Download,
@@ -67,43 +124,104 @@ export {
67
124
  ExternalLink,
68
125
  Eye,
69
126
  EyeOff,
127
+ Factory,
128
+ FileDown,
70
129
  FileIcon,
130
+ FileInput,
131
+ FilePen,
132
+ FilePenLine,
133
+ FilePlus,
134
+ FilePlus2,
135
+ FileSearch,
71
136
  FileSpreadsheet,
72
137
  FileText,
138
+ FileType,
139
+ FileX,
140
+ FileX2,
73
141
  Filter,
142
+ Flag,
74
143
  Folder,
144
+ FolderArchive,
145
+ FolderCog,
146
+ FolderDown,
75
147
  FolderInput,
148
+ FolderMinus,
76
149
  FolderOpen,
150
+ FolderOutput,
151
+ FolderPen,
77
152
  FolderPlus,
153
+ FolderTree,
154
+ FolderX,
155
+ Forward,
156
+ Gauge,
157
+ GaugeCircle,
158
+ GitBranch,
78
159
  GitCompareArrows,
79
160
  GitFork,
80
161
  Globe,
81
162
  GripVertical,
163
+ Handshake,
164
+ HardDriveDownload,
82
165
  Hash,
83
166
  History$1 as History,
84
167
  Home,
168
+ Hourglass,
85
169
  IdCard,
170
+ ImagePlus,
86
171
  Inbox,
87
172
  Info,
88
173
  Key,
174
+ Landmark,
89
175
  Layers,
176
+ LayersPlus,
90
177
  LayoutDashboard,
91
178
  LayoutGrid,
179
+ LayoutTemplate,
180
+ LetterText,
181
+ Library,
182
+ LibraryBig,
183
+ Link,
92
184
  Link2,
93
185
  Link2Off,
94
186
  List,
187
+ ListChecks,
188
+ ListEnd,
95
189
  ListFilter,
190
+ ListFilterPlus,
191
+ ListOrdered,
192
+ ListPlus,
193
+ ListTodo,
194
+ ListVideo,
96
195
  Loader2,
97
196
  LogOutIcon,
98
197
  LucideIcon,
99
198
  Mail,
199
+ MailCheck,
200
+ MailMinus,
201
+ MailOpen,
202
+ MailPlus,
203
+ MailQuestionMark,
204
+ MailSearch,
205
+ MailWarning,
206
+ MailX,
207
+ Mailbox,
208
+ Mails,
100
209
  MapPin,
101
210
  Maximize,
102
211
  Megaphone,
103
212
  MemoryStick,
213
+ MessageCircle,
214
+ MessageCircleMore,
215
+ MessageCircleReply,
104
216
  MessageSquare,
217
+ MessageSquareDot,
218
+ MessageSquareMore,
105
219
  MessageSquarePlus,
220
+ MessageSquareQuote,
221
+ MessageSquareShare,
222
+ MessageSquareText,
106
223
  Mic,
224
+ Milestone,
107
225
  Minimize2,
108
226
  MinusIcon,
109
227
  Monitor,
@@ -112,58 +230,123 @@ export {
112
230
  MoreHorizontalIcon,
113
231
  MoreVertical,
114
232
  MoreVerticalIcon,
233
+ Network,
234
+ Newspaper,
235
+ Notebook,
236
+ NotebookPen,
237
+ NotebookTabs,
238
+ NotebookText,
239
+ NotepadText,
240
+ PackageCheck,
241
+ PackageOpen,
242
+ PackagePlus,
243
+ PackageSearch,
244
+ PackageX,
115
245
  PanelLeftIcon,
116
246
  PanelTop,
117
247
  Paperclip,
118
248
  Pause,
249
+ PenLine,
250
+ PenTool,
119
251
  Pencil,
252
+ PencilLine,
253
+ Phone,
254
+ PhoneForwarded,
255
+ PhoneIncoming,
256
+ PhoneOutgoing,
120
257
  Play,
121
258
  Plug2,
259
+ PlugZap,
122
260
  Plus,
123
261
  PlusCircle,
124
262
  Power,
125
263
  Receipt,
264
+ ReceiptText,
126
265
  RefreshCw,
127
266
  Rocket,
128
267
  RotateCcw,
268
+ Rss,
129
269
  Save,
270
+ Scale,
271
+ ScanSearch,
272
+ ScanText,
130
273
  Search,
274
+ SearchCheck,
131
275
  SearchIcon,
132
276
  Send,
133
277
  SendHorizontal,
278
+ SendToBack,
134
279
  ServerCrash,
135
280
  Settings,
136
281
  Settings2,
282
+ Share2,
137
283
  Shield,
138
284
  ShieldAlert,
139
285
  ShieldCheck,
140
286
  ShieldX,
287
+ Sigma,
141
288
  Signal,
142
289
  SignalHigh,
143
290
  SignalLow,
144
291
  SignalMedium,
292
+ Signpost,
293
+ SkipForward,
294
+ SlidersHorizontal,
295
+ SlidersVertical,
296
+ Smartphone,
297
+ SmartphoneNfc,
145
298
  Sparkles,
299
+ SquareCheck,
300
+ SquareCheckBig,
301
+ SquarePlus,
302
+ SquareUser,
146
303
  Stamp,
304
+ StickyNote,
305
+ Store,
147
306
  SunIcon,
148
307
  Table,
308
+ Table2,
309
+ TableConfig,
310
+ TableOfContents,
311
+ TableProperties,
149
312
  Tag,
313
+ Tags,
314
+ Target,
315
+ Telescope,
150
316
  Terminal,
151
317
  TestTube,
152
318
  TestTube2,
319
+ TextQuote,
320
+ TextSearch,
321
+ TextSelect,
153
322
  ThumbsDown,
154
323
  ThumbsUp,
155
324
  ToggleLeft,
156
325
  Trash2,
157
326
  TrendingUp,
158
327
  Type,
328
+ Unlink,
159
329
  Upload,
160
330
  User,
161
331
  UserCheck,
162
332
  UserCircleIcon,
163
333
  UserCog,
334
+ UserMinus,
335
+ UserPen,
164
336
  UserPlus,
337
+ UserRoundCheck,
338
+ UserRoundCog,
339
+ UserRoundPen,
340
+ UserRoundPlus,
341
+ UserRoundSearch,
342
+ UserSearch,
343
+ UserStar,
165
344
  UserX,
166
345
  Users,
346
+ UsersRound,
347
+ Warehouse,
348
+ Waypoints,
349
+ Webhook,
167
350
  Workflow,
168
351
  Wrench,
169
352
  X,