@infinilabs/chat-message 0.0.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 (42) hide show
  1. package/README.md +123 -0
  2. package/dist/App.d.ts +2 -0
  3. package/dist/ChatMessage.cjs +32 -0
  4. package/dist/ChatMessage.iife.js +32 -0
  5. package/dist/ChatMessage.js +4950 -0
  6. package/dist/ChatMessage.umd.cjs +32 -0
  7. package/dist/components/Assistant/AttachmentList.d.ts +9 -0
  8. package/dist/components/CallTools.d.ts +8 -0
  9. package/dist/components/Common/CopyButton.d.ts +5 -0
  10. package/dist/components/Common/Icons/FileIcon.d.ts +7 -0
  11. package/dist/components/Common/Icons/FontIcon.d.ts +8 -0
  12. package/dist/components/Common/Tooltip2.d.ts +8 -0
  13. package/dist/components/DeepRead.d.ts +8 -0
  14. package/dist/components/FetchSource.d.ts +25 -0
  15. package/dist/components/MessageActions.d.ts +11 -0
  16. package/dist/components/PickSource.d.ts +8 -0
  17. package/dist/components/PrevSuggestion.d.ts +6 -0
  18. package/dist/components/QueryIntent.d.ts +9 -0
  19. package/dist/components/SuggestionList.d.ts +6 -0
  20. package/dist/components/Think.d.ts +8 -0
  21. package/dist/components/UserMessage.d.ts +7 -0
  22. package/dist/components/index.d.ts +20 -0
  23. package/dist/components/ui/popover.d.ts +8 -0
  24. package/dist/demo.d.ts +98 -0
  25. package/dist/hooks/useMessageChunkData.d.ts +22 -0
  26. package/dist/i18n/config.d.ts +2 -0
  27. package/dist/icons/Reading.d.ts +2 -0
  28. package/dist/icons/Retrieve.d.ts +2 -0
  29. package/dist/icons/SVGWrap.d.ts +2 -0
  30. package/dist/icons/Selection.d.ts +2 -0
  31. package/dist/icons/Understand.d.ts +2 -0
  32. package/dist/icons/types.d.ts +14 -0
  33. package/dist/index.d.ts +2 -0
  34. package/dist/main.d.ts +0 -0
  35. package/dist/stores/appStore.d.ts +5 -0
  36. package/dist/stores/chatStore.d.ts +20 -0
  37. package/dist/stores/connectStore.d.ts +8 -0
  38. package/dist/types/chat.d.ts +31 -0
  39. package/dist/utils/index.d.ts +4 -0
  40. package/dist/utils/platformAdapter.d.ts +9 -0
  41. package/dist/vite.svg +1 -0
  42. package/package.json +72 -0
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # @infinilabs/chat-message
2
+
3
+ A React component for rendering AI chat messages with support for streaming responses, thinking process, tool calls, and citations.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm install @infinilabs/chat-message
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Basic Rendering (Static Data)
14
+
15
+ ```tsx
16
+ import { ChatMessage } from '@infinilabs/chat-message';
17
+
18
+ const message = {
19
+ _id: '1',
20
+ _source: {
21
+ type: 'assistant',
22
+ message: 'Hello! I am Coco AI.',
23
+ // Pre-populated details for history
24
+ details: [
25
+ { type: 'think', description: 'Thinking process...' },
26
+ { type: 'query_intent', payload: { ... } }
27
+ ]
28
+ }
29
+ };
30
+
31
+ function App() {
32
+ return (
33
+ <ChatMessage
34
+ message={message}
35
+ locale="en"
36
+ theme="light"
37
+ />
38
+ );
39
+ }
40
+ ```
41
+
42
+ ### Streaming Responses (Real-time)
43
+
44
+ To stream AI responses (including thinking, tools, etc.), use the `ref` to push chunks directly to the component. This allows the component to manage internal loading states and data accumulation efficiently.
45
+
46
+ ```tsx
47
+ import { useRef } from 'react';
48
+ import { ChatMessage, ChatMessageRef, IChatMessage } from '@infinilabs/chat-message';
49
+
50
+ function App() {
51
+ const chatRef = useRef<ChatMessageRef>(null);
52
+
53
+ // Initial empty message structure
54
+ const message: IChatMessage = {
55
+ _id: 'streaming-msg',
56
+ _source: {
57
+ type: 'assistant',
58
+ message: '',
59
+ details: []
60
+ }
61
+ };
62
+
63
+ const handleStream = async () => {
64
+ // 1. Reset component state for new stream
65
+ chatRef.current?.reset();
66
+
67
+ // 2. Add chunks as they arrive
68
+ // Example: Thinking chunk
69
+ chatRef.current?.addChunk({
70
+ chunk_type: 'think',
71
+ message_chunk: 'Thinking process...'
72
+ });
73
+
74
+ // Example: Response chunk
75
+ chatRef.current?.addChunk({
76
+ chunk_type: 'response',
77
+ message_chunk: 'Hello world!'
78
+ });
79
+ };
80
+
81
+ return (
82
+ <ChatMessage
83
+ ref={chatRef}
84
+ message={message}
85
+ isTyping={true}
86
+ />
87
+ );
88
+ }
89
+ ```
90
+
91
+ ## Props
92
+
93
+ | Prop | Type | Default | Description |
94
+ |------|------|---------|-------------|
95
+ | `message` | `IChatMessage` | Required | The message object containing content and metadata. |
96
+ | `isTyping` | `boolean` | `false` | Shows typing cursor/animation. |
97
+ | `onResend` | `(value: string) => void` | - | Callback for resending a message (user messages). |
98
+ | `hide_assistant` | `boolean` | `false` | Whether to hide the assistant avatar/name. |
99
+ | `theme` | `'light' \| 'dark' \| 'system'` | - | Color theme. |
100
+ | `locale` | `string` | - | Language code (e.g., 'en', 'zh'). |
101
+ | `formatUrl` | `(data: IChunkData) => string` | - | Custom formatter for source URLs. |
102
+ | `rootClassName` | `string` | - | Custom class for the root element. |
103
+ | `actionClassName` | `string` | - | Custom class for the action buttons area. |
104
+ | `actionIconSize` | `number` | - | Size of the action icons. |
105
+ | `copyButtonId` | `string` | - | ID for the copy button (for tracking/testing). |
106
+
107
+ ## Instance Methods (Ref)
108
+
109
+ | Method | Type | Description |
110
+ |--------|------|-------------|
111
+ | `addChunk` | `(chunk: IChunkData) => void` | Feeds a new data chunk (think, tools, response, etc.) to the component. Automatically handles loading states and data merging. |
112
+ | `reset` | `() => void` | Clears internal streaming state and resets loading indicators. |
113
+
114
+ ## Features
115
+
116
+ - **Internal State Management**: Automatically handles complex AI steps like `query_intent`, `tools`, `fetch_source`, `pick_source`, `deep_read`, and `think` via streaming chunks.
117
+ - **Streaming Support**: Real-time rendering of content as it arrives using `addChunk`.
118
+ - **Markdown Support**: Integrated with `@ant-design/x-markdown` for rich text rendering including code blocks and tables.
119
+ - **Thinking Process**: Collapsible section for AI thought process.
120
+ - **Tool Calls**: Visualizes tool execution steps.
121
+ - **Citations**: Supports source citations.
122
+ - **Theming**: Built-in light, dark, and system modes.
123
+ - **I18n**: Built-in English and Chinese support.
package/dist/App.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare function App(): import("react/jsx-runtime").JSX.Element;
2
+ export default App;
@@ -0,0 +1,32 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),ae=require("react-i18next"),ue=require("clsx"),lr=require("i18next"),T=require("lucide-react"),gt=require("@ant-design/x-markdown"),Ge=require("zustand"),bt=require("ahooks");function cr(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(s,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return s.default=e,Object.freeze(s)}const Ye=cr(h);var Oe={exports:{}},Ee={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ct;function dr(){if(ct)return Ee;ct=1;var e=h,s=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function c(f,i,m){var u,v={},b=null,N=null;m!==void 0&&(b=""+m),i.key!==void 0&&(b=""+i.key),i.ref!==void 0&&(N=i.ref);for(u in i)o.call(i,u)&&!d.hasOwnProperty(u)&&(v[u]=i[u]);if(f&&f.defaultProps)for(u in i=f.defaultProps,i)v[u]===void 0&&(v[u]=i[u]);return{$$typeof:s,type:f,key:b,ref:N,props:v,_owner:a.current}}return Ee.Fragment=n,Ee.jsx=c,Ee.jsxs=c,Ee}var Se={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var dt;function ur(){return dt||(dt=1,process.env.NODE_ENV!=="production"&&(function(){var e=h,s=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),N=Symbol.for("react.offscreen"),I=Symbol.iterator,q="@@iterator";function C(r){if(r===null||typeof r!="object")return null;var l=I&&r[I]||r[q];return typeof l=="function"?l:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function F(r){{for(var l=arguments.length,p=new Array(l>1?l-1:0),_=1;_<l;_++)p[_-1]=arguments[_];Q("error",r,p)}}function Q(r,l,p){{var _=y.ReactDebugCurrentFrame,A=_.getStackAddendum();A!==""&&(l+="%s",p=p.concat([A]));var O=p.map(function(R){return String(R)});O.unshift("Warning: "+l),Function.prototype.apply.call(console[r],console,O)}}var ee=!1,te=!1,H=!1,ne=!1,w=!1,z;z=Symbol.for("react.module.reference");function fe(r){return!!(typeof r=="string"||typeof r=="function"||r===o||r===d||w||r===a||r===m||r===u||ne||r===N||ee||te||H||typeof r=="object"&&r!==null&&(r.$$typeof===b||r.$$typeof===v||r.$$typeof===c||r.$$typeof===f||r.$$typeof===i||r.$$typeof===z||r.getModuleId!==void 0))}function Z(r,l,p){var _=r.displayName;if(_)return _;var A=l.displayName||l.name||"";return A!==""?p+"("+A+")":p}function ie(r){return r.displayName||"Context"}function B(r){if(r==null)return null;if(typeof r.tag=="number"&&F("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case o:return"Fragment";case n:return"Portal";case d:return"Profiler";case a:return"StrictMode";case m:return"Suspense";case u:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case f:var l=r;return ie(l)+".Consumer";case c:var p=r;return ie(p._context)+".Provider";case i:return Z(r,r.render,"ForwardRef");case v:var _=r.displayName||null;return _!==null?_:B(r.type)||"Memo";case b:{var A=r,O=A._payload,R=A._init;try{return B(R(O))}catch{return null}}}return null}var Y=Object.assign,U=0,L,J,k,oe,xe,re,le;function $(){}$.__reactDisabledLog=!0;function V(){{if(U===0){L=console.log,J=console.info,k=console.warn,oe=console.error,xe=console.group,re=console.groupCollapsed,le=console.groupEnd;var r={configurable:!0,enumerable:!0,value:$,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}U++}}function me(){{if(U--,U===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},r,{value:L}),info:Y({},r,{value:J}),warn:Y({},r,{value:k}),error:Y({},r,{value:oe}),group:Y({},r,{value:xe}),groupCollapsed:Y({},r,{value:re}),groupEnd:Y({},r,{value:le})})}U<0&&F("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=y.ReactCurrentDispatcher,P;function j(r,l,p){{if(P===void 0)try{throw Error()}catch(A){var _=A.stack.trim().match(/\n( *(at )?)/);P=_&&_[1]||""}return`
18
+ `+P+r}}var X=!1,ce;{var Ce=typeof WeakMap=="function"?WeakMap:Map;ce=new Ce}function ge(r,l){if(!r||X)return"";{var p=ce.get(r);if(p!==void 0)return p}var _;X=!0;var A=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var O;O=pe.current,pe.current=null,V();try{if(l){var R=function(){throw Error()};if(Object.defineProperty(R.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(R,[])}catch(K){_=K}Reflect.construct(r,[],R)}else{try{R.call()}catch(K){_=K}r.call(R.prototype)}}else{try{throw Error()}catch(K){_=K}r()}}catch(K){if(K&&_&&typeof K.stack=="string"){for(var S=K.stack.split(`
19
+ `),G=_.stack.split(`
20
+ `),M=S.length-1,W=G.length-1;M>=1&&W>=0&&S[M]!==G[W];)W--;for(;M>=1&&W>=0;M--,W--)if(S[M]!==G[W]){if(M!==1||W!==1)do if(M--,W--,W<0||S[M]!==G[W]){var se=`
21
+ `+S[M].replace(" at new "," at ");return r.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",r.displayName)),typeof r=="function"&&ce.set(r,se),se}while(M>=1&&W>=0);break}}}finally{X=!1,pe.current=O,me(),Error.prepareStackTrace=A}var ve=r?r.displayName||r.name:"",be=ve?j(ve):"";return typeof r=="function"&&ce.set(r,be),be}function zt(r,l,p){return ge(r,!1)}function $t(r){var l=r.prototype;return!!(l&&l.isReactComponent)}function Te(r,l,p){if(r==null)return"";if(typeof r=="function")return ge(r,$t(r));if(typeof r=="string")return j(r);switch(r){case m:return j("Suspense");case u:return j("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case i:return zt(r.render);case v:return Te(r.type,l,p);case b:{var _=r,A=_._payload,O=_._init;try{return Te(O(A),l,p)}catch{}}}return""}var Ne=Object.prototype.hasOwnProperty,Xe={},Ke=y.ReactDebugCurrentFrame;function Ae(r){if(r){var l=r._owner,p=Te(r.type,r._source,l?l.type:null);Ke.setExtraStackFrame(p)}else Ke.setExtraStackFrame(null)}function Wt(r,l,p,_,A){{var O=Function.call.bind(Ne);for(var R in r)if(O(r,R)){var S=void 0;try{if(typeof r[R]!="function"){var G=Error((_||"React class")+": "+p+" type `"+R+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[R]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw G.name="Invariant Violation",G}S=r[R](l,R,_,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(M){S=M}S&&!(S instanceof Error)&&(Ae(A),F("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",_||"React class",p,R,typeof S),Ae(null)),S instanceof Error&&!(S.message in Xe)&&(Xe[S.message]=!0,Ae(A),F("Failed %s type: %s",p,S.message),Ae(null))}}}var qt=Array.isArray;function Me(r){return qt(r)}function Dt(r){{var l=typeof Symbol=="function"&&Symbol.toStringTag,p=l&&r[Symbol.toStringTag]||r.constructor.name||"Object";return p}}function Bt(r){try{return Qe(r),!1}catch{return!0}}function Qe(r){return""+r}function He(r){if(Bt(r))return F("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Dt(r)),Qe(r)}var Ze=y.ReactCurrentOwner,Ut={key:!0,ref:!0,__self:!0,__source:!0},et,tt;function Vt(r){if(Ne.call(r,"ref")){var l=Object.getOwnPropertyDescriptor(r,"ref").get;if(l&&l.isReactWarning)return!1}return r.ref!==void 0}function Gt(r){if(Ne.call(r,"key")){var l=Object.getOwnPropertyDescriptor(r,"key").get;if(l&&l.isReactWarning)return!1}return r.key!==void 0}function Yt(r,l){typeof r.ref=="string"&&Ze.current}function Jt(r,l){{var p=function(){et||(et=!0,F("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};p.isReactWarning=!0,Object.defineProperty(r,"key",{get:p,configurable:!0})}}function Xt(r,l){{var p=function(){tt||(tt=!0,F("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};p.isReactWarning=!0,Object.defineProperty(r,"ref",{get:p,configurable:!0})}}var Kt=function(r,l,p,_,A,O,R){var S={$$typeof:s,type:r,key:l,ref:p,props:R,_owner:O};return S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(S,"_self",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.defineProperty(S,"_source",{configurable:!1,enumerable:!1,writable:!1,value:A}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S};function Qt(r,l,p,_,A){{var O,R={},S=null,G=null;p!==void 0&&(He(p),S=""+p),Gt(l)&&(He(l.key),S=""+l.key),Vt(l)&&(G=l.ref,Yt(l,A));for(O in l)Ne.call(l,O)&&!Ut.hasOwnProperty(O)&&(R[O]=l[O]);if(r&&r.defaultProps){var M=r.defaultProps;for(O in M)R[O]===void 0&&(R[O]=M[O])}if(S||G){var W=typeof r=="function"?r.displayName||r.name||"Unknown":r;S&&Jt(R,W),G&&Xt(R,W)}return Kt(r,S,G,A,_,Ze.current,R)}}var ze=y.ReactCurrentOwner,rt=y.ReactDebugCurrentFrame;function ye(r){if(r){var l=r._owner,p=Te(r.type,r._source,l?l.type:null);rt.setExtraStackFrame(p)}else rt.setExtraStackFrame(null)}var $e;$e=!1;function We(r){return typeof r=="object"&&r!==null&&r.$$typeof===s}function st(){{if(ze.current){var r=B(ze.current.type);if(r)return`
22
+
23
+ Check the render method of \``+r+"`."}return""}}function Ht(r){return""}var nt={};function Zt(r){{var l=st();if(!l){var p=typeof r=="string"?r:r.displayName||r.name;p&&(l=`
24
+
25
+ Check the top-level render call using <`+p+">.")}return l}}function ot(r,l){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var p=Zt(l);if(nt[p])return;nt[p]=!0;var _="";r&&r._owner&&r._owner!==ze.current&&(_=" It was passed a child from "+B(r._owner.type)+"."),ye(r),F('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,_),ye(null)}}function at(r,l){{if(typeof r!="object")return;if(Me(r))for(var p=0;p<r.length;p++){var _=r[p];We(_)&&ot(_,l)}else if(We(r))r._store&&(r._store.validated=!0);else if(r){var A=C(r);if(typeof A=="function"&&A!==r.entries)for(var O=A.call(r),R;!(R=O.next()).done;)We(R.value)&&ot(R.value,l)}}}function er(r){{var l=r.type;if(l==null||typeof l=="string")return;var p;if(typeof l=="function")p=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===i||l.$$typeof===v))p=l.propTypes;else return;if(p){var _=B(l);Wt(p,r.props,"prop",_,r)}else if(l.PropTypes!==void 0&&!$e){$e=!0;var A=B(l);F("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",A||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&F("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function tr(r){{for(var l=Object.keys(r.props),p=0;p<l.length;p++){var _=l[p];if(_!=="children"&&_!=="key"){ye(r),F("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),ye(null);break}}r.ref!==null&&(ye(r),F("Invalid attribute `ref` supplied to `React.Fragment`."),ye(null))}}var it={};function lt(r,l,p,_,A,O){{var R=fe(r);if(!R){var S="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var G=Ht();G?S+=G:S+=st();var M;r===null?M="null":Me(r)?M="array":r!==void 0&&r.$$typeof===s?(M="<"+(B(r.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):M=typeof r,F("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",M,S)}var W=Qt(r,l,p,A,O);if(W==null)return W;if(R){var se=l.children;if(se!==void 0)if(_)if(Me(se)){for(var ve=0;ve<se.length;ve++)at(se[ve],r);Object.freeze&&Object.freeze(se)}else F("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else at(se,r)}if(Ne.call(l,"key")){var be=B(r),K=Object.keys(l).filter(function(ir){return ir!=="key"}),qe=K.length>0?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}";if(!it[be+qe]){var ar=K.length>0?"{"+K.join(": ..., ")+": ...}":"{}";F(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,qe,be,ar,be),it[be+qe]=!0}}return r===o?tr(W):er(W),W}}function rr(r,l,p){return lt(r,l,p,!0)}function sr(r,l,p){return lt(r,l,p,!1)}var nr=sr,or=rr;Se.Fragment=o,Se.jsx=nr,Se.jsxs=or})()),Se}var ut;function fr(){return ut||(ut=1,process.env.NODE_ENV==="production"?Oe.exports=dr():Oe.exports=ur()),Oe.exports}var t=fr();const mr={en:{translation:{assistant:{message:{logo:"Coco AI Logo",aiName:"Coco AI",thinkingButton:"View thinking process",steps:{query_intent:"Understand the query",tools:"Call LLM Tools",source_zero:"Searching for relevant documents",fetch_source:"Retrieve {{count}} documents",pick_source:"Intelligent pick {{count}} results",pick_source_start:"Intelligently pre-selecting",deep_read:"Deep reading",think:"AI is thinking...",thoughtTime:"Thought for a few seconds",keywords:"Keywords",questionType:"Query Type",userIntent:"User Intent",relatedQuestions:"Query",suggestion:"Suggestion",informationSeeking:"Information Seeking"}}}}},zh:{translation:{assistant:{message:{logo:"Coco AI 图标",aiName:"Coco AI",thinkingButton:"查看思考过程",steps:{query_intent:"理解查询",tools:"调用大模型工具",source_zero:"正在搜索相关文档",fetch_source:"检索 {{count}} 份文档",pick_source:"智能预选 {{count}} 个结果",pick_source_start:"正在智能预选",deep_read:"深度阅读",think:"AI 正在思考...",thoughtTime:"思考了数秒",keywords:"关键词",questionType:"查询类型",userIntent:"用户意图",relatedQuestions:"查询",suggestion:"建议",informationSeeking:"信息查询"}}}}}},kt=lr.createInstance();kt.use(ae.initReactI18next).init({resources:mr,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1},react:{useSuspense:!1}});const pr="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3ccircle%20cx='50'%20cy='50'%20r='40'%20stroke='black'%20stroke-width='3'%20fill='red'%20/%3e%3c/svg%3e";function Le({size:e=18,children:s,className:n,title:o,onClick:a,action:d=!1,...c}){const f=i=>{a?.(i)};return t.jsx("i",{style:{width:e,height:e},title:o,onClick:f,className:ue("inline-flex items-center justify-center rounded-sm p-[2px] transition-all",{"cursor-pointer":d},n),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{width:"100%",height:"100%"},...c,children:s})})}function hr(e){return t.jsx(Le,{...e,viewBox:"0 0 16 16",children:t.jsx("g",{id:"Understand",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsxs("g",{id:"编组",transform:"translate(0.5, 0.5)",stroke:"currentColor",strokeWidth:"1.25",children:[t.jsx("path",{d:"M7.44444444,3 C9.89904333,3 11.8888889,4.95366655 11.8888889,7.36363636 C11.8888889,9.06711551 10.8946979,10.5426108 9.44492275,11.2613085 L9.44444444,12.2727273 C9.44444444,13.3772968 8.54901394,14.2727273 7.44444444,14.2727273 C6.33987494,14.2727273 5.44444444,13.3772968 5.44444444,12.2727273 L5.44396614,11.2613085 C3.99419095,10.5426108 3,9.06711551 3,7.36363636 C3,4.95366655 4.98984556,3 7.44444444,3 Z",id:"形状结合"}),t.jsx("line",{x1:"5.5",y1:"11.2156017",x2:"9.5",y2:"11.2156017",id:"路径-11"}),t.jsx("line",{x1:"7.44444444",y1:"10.6363636",x2:"7.44444444",y2:"8.45454545",id:"路径-12"}),t.jsx("line",{x1:"7.44444444",y1:"0.818181818",x2:"7.44444444",y2:"0.272727273",id:"路径-12备份"}),t.jsx("line",{x1:"12.352383",y1:"2.81770629",x2:"12.3574335",y2:"2.26720124",id:"路径-12备份",transform:"translate(12.3549, 2.5425) rotate(45) translate(-12.3549, -2.5425)"}),t.jsx("line",{x1:"14.3888889",y1:"7.64141414",x2:"14.3888889",y2:"7.08585859",id:"路径-12备份",transform:"translate(14.3889, 7.3636) rotate(90) translate(-14.3889, -7.3636)"}),t.jsx("line",{x1:"12.3574335",y1:"12.4600715",x2:"12.352383",y2:"11.9095664",id:"路径-12备份",transform:"translate(12.3549, 12.1848) rotate(135) translate(-12.3549, -12.1848)"}),t.jsx("line",{x1:"2.53145543",y1:"12.4600715",x2:"2.53650594",y2:"11.9095664",id:"路径-12备份",transform:"translate(2.534, 12.1848) rotate(225) translate(-2.534, -12.1848)"}),t.jsx("line",{x1:"0.5",y1:"7.64141414",x2:"0.5",y2:"7.08585859",id:"路径-12备份",transform:"translate(0.5, 7.3636) rotate(270) translate(-0.5, -7.3636)"}),t.jsx("line",{x1:"2.53650594",y1:"2.81770629",x2:"2.53145543",y2:"2.26720124",id:"路径-12备份",transform:"translate(2.534, 2.5425) rotate(315) translate(-2.534, -2.5425)"}),t.jsx("polyline",{id:"路径-15",transform:"translate(7.4398, 6.7308) rotate(-45) translate(-7.4398, -6.7308)",points:"6.33632897 5.60310185 6.3568375 7.83853192 8.5432888 7.85859111"})]})})})}const xr=({Detail:e,ChunkData:s,getSuggestion:n,loading:o})=>{const{t:a}=ae.useTranslation(),[d,c]=h.useState(!1),[f,i]=h.useState(null);return h.useEffect(()=>{e?.payload&&(i(e?.payload),e?.payload?.suggestion&&n&&n(e?.payload?.suggestion))},[e?.payload,n]),h.useEffect(()=>{if(s?.message_chunk&&!o)try{const u=s.message_chunk.replace(/^"|"$/g,"").match(/<JSON>([\s\S]*?)<\/JSON>/g);if(u){const b=u[u.length-1].replace(/<JSON>|<\/JSON>/g,""),N=JSON.parse(b);N?.suggestion&&n&&n(N?.suggestion),i(N)}}catch(m){console.error("Failed to process message chunk in QueryIntent:",m)}},[s?.message_chunk,o,n]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>c(m=>!m),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[o?t.jsxs(t.Fragment,{children:[t.jsx(T.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:a(`assistant.message.steps.${s?.chunk_type||e.type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(hr,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:a(`assistant.message.steps.${s?.chunk_type||e.type}`)})]}),d?t.jsx(T.ChevronUp,{className:"w-4 h-4"}):t.jsx(T.ChevronDown,{className:"w-4 h-4"})]}),d&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsxs("div",{className:"mb-4 space-y-2 text-xs",children:[f?.keyword?t.jsxs("div",{className:"flex gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.keywords"),":"]}),t.jsx("div",{className:"flex flex-wrap gap-1",children:f?.keyword?.map((m,u)=>t.jsxs("span",{className:"text-[#333333] dark:text-[#D8D8D8]",children:[m,u<2&&"、"]},m+u))})]}):null,f?.category?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.questionType"),":"]}),t.jsx("span",{className:"text-[#333333] dark:text-[#D8D8D8]",children:f?.category})]}):null,f?.intent?t.jsxs("div",{className:"flex items-start gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.userIntent"),":"]}),t.jsx("div",{className:"flex-1 text-[#333333] dark:text-[#D8D8D8]",children:f?.intent})]}):null,f?.query?t.jsxs("div",{className:"flex items-start gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.relatedQuestions"),":"]}),t.jsx("div",{className:"flex-1 flex flex-col text-[#333333] dark:text-[#D8D8D8]",children:f?.query?.map((m,u)=>t.jsxs("span",{children:["- ",m]},m+u))})]}):null]})})})]})},gr=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=ae.useTranslation(),[a,d]=h.useState(!1),[c,f]=h.useState("");return h.useEffect(()=>{e?.description&&f(e?.description)},[e?.description]),h.useEffect(()=>{s?.message_chunk&&f(s?.message_chunk)},[s?.message_chunk,c]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(i=>!i),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(T.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o(`assistant.message.steps.${s?.chunk_type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(T.Hammer,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o(`assistant.message.steps.${s?.chunk_type}`)})]}),a?t.jsx(T.ChevronUp,{className:"w-4 h-4"}):t.jsx(T.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsx(gt.XMarkdown,{content:c||""})})})]})},yt=async e=>{navigator.clipboard?await navigator.clipboard.writeText(e):console.log("Clipboard not available",e)},br=e=>{window.open(e,"_blank")},kr=e=>e+" B";function yr(e){return t.jsx(Le,{...e,viewBox:"0 0 16 16",children:t.jsxs("g",{id:"Retrieve",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"10.8977456",y1:"14.5",x2:"14",y2:"10.9204757",id:"路径",stroke:"currentColor",strokeWidth:"1.25",transform:"translate(12.4489, 12.7102) scale(-1, 1) translate(-12.4489, -12.7102)"}),t.jsx("circle",{id:"椭圆形",stroke:"currentColor",strokeWidth:"1.25",transform:"translate(7.5, 7) scale(-1, 1) translate(-7.5, -7)",cx:"7.5",cy:"7",r:"5"})]})})}const vr=({Detail:e,ChunkData:s,loading:n,formatUrl:o})=>{const{t:a}=ae.useTranslation(),[d,c]=h.useState(!1),[f,i]=h.useState(0),[m,u]=h.useState([]);h.useEffect(()=>{e?.payload&&(u(e?.payload),i(e?.payload.length))},[e?.payload]),h.useEffect(()=>{if(s?.message_chunk&&!n)try{const b=s.message_chunk.match(/<Payload total=(\d+)>/);b&&i(Number(b[1]));const N=s.message_chunk.match(/\[([\s\S]*)\]/);if(N){const I=JSON.parse(N[0]);u(I)}}catch(b){console.error("Failed to parse fetch source data:",b)}},[s?.message_chunk,n]);const v=b=>()=>{const N=o&&o(b)||b.url;N&&br(N)};return!s&&!e?null:t.jsxs("div",{className:`mt-2 mb-2 max-w-full w-full md:w-[610px] ${d?"rounded-lg overflow-hidden border border-[#E6E6E6] dark:border-[#272626]":""}`,children:[t.jsxs("button",{onClick:()=>c(b=>!b),className:`inline-flex justify-between items-center gap-2 px-2 py-1 rounded-xl transition-colors whitespace-nowrap ${d?"w-full":"border border-[#E6E6E6] dark:border-[#272626]"}`,children:[t.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[t.jsx(yr,{className:"w-4 h-4 text-[#38C200] shrink-0"}),t.jsx("span",{className:"text-xs text-[#999999]",children:a(`assistant.message.steps.${s?.chunk_type||e.type}`,{count:Number(f)})})]}),d?t.jsx(T.ChevronUp,{className:"w-4 h-4 text-[#999999]"}):t.jsx(T.ChevronDown,{className:"w-4 h-4 text-[#999999]"})]}),d&&t.jsx(t.Fragment,{children:m?.map((b,N)=>t.jsx("div",{onClick:v(b),className:"group flex items-center p-2 hover:bg-[#F7F7F7] dark:hover:bg-[#2C2C2C] border-b border-[#E6E6E6] dark:border-[#272626] last:border-b-0 cursor-pointer transition-colors",children:t.jsxs("div",{className:"w-full flex items-center gap-2",children:[t.jsxs("div",{className:"w-[75%] mobile:w-full flex items-center gap-1",children:[t.jsx(T.Globe,{className:"w-3 h-3 shrink-0"}),t.jsx("div",{className:"text-xs text-[#333333] dark:text-[#D8D8D8] truncate font-normal group-hover:text-[#0072FF] dark:group-hover:text-[#0072FF]",children:b.title||b.category})]}),t.jsxs("div",{className:"flex-1 mobile:hidden flex items-center justify-end gap-2",children:[t.jsx("span",{className:"text-xs text-[#999999] dark:text-[#999999] truncate",children:b.source?.name||b?.category}),t.jsx(T.SquareArrowOutUpRight,{className:"w-3 h-3 text-[#999999] dark:text-[#999999] shrink-0"})]})]})},N))})]})};function wr(e){return t.jsx(Le,{...e,viewBox:"0 0 16 16",children:t.jsx("g",{id:"selection",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:t.jsxs("g",{id:"编组",transform:"translate(1.4813, 1)",stroke:"currentColor",strokeWidth:"1.25",children:[t.jsx("line",{x1:"6.7986538",y1:"2.8",x2:"6.7986538",y2:"2.07241631e-17",id:"路径",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("circle",{id:"椭圆形",fill:"#000000",cx:"6.7986538",cy:"6.72",r:"1"}),t.jsx("line",{x1:"2.17440858e-17",y1:"13.5186538",x2:"4.62042688",y2:"8.89822692",id:"路径",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("line",{x1:"10.1008425",y1:"4.16781133",x2:"10.1008425",y2:"2.66781133",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(10.1008, 3.4178) rotate(45) translate(-10.1008, -3.4178)"}),t.jsx("line",{x1:"12.1186538",y1:"8.12",x2:"12.1186538",y2:"5.32",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(12.1187, 6.72) rotate(90) translate(-12.1187, -6.72)"}),t.jsx("line",{x1:"10.1008425",y1:"10.7721887",x2:"10.1008425",y2:"9.27218867",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(10.1008, 10.0222) rotate(135) translate(-10.1008, -10.0222)"}),t.jsx("line",{x1:"6.7986538",y1:"13.44",x2:"6.7986538",y2:"10.64",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(6.7987, 12.04) rotate(180) translate(-6.7987, -12.04)"}),t.jsx("line",{x1:"1.4786538",y1:"8.12",x2:"1.4786538",y2:"5.32",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(1.4787, 6.72) rotate(270) translate(-1.4787, -6.72)"}),t.jsx("line",{x1:"3.49646513",y1:"4.16781133",x2:"3.49646513",y2:"2.66781133",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(3.4965, 3.4178) rotate(315) translate(-3.4965, -3.4178)"})]})})})}const jr=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=ae.useTranslation(),[a,d]=h.useState(!1),[c,f]=h.useState([]);return h.useEffect(()=>{e?.payload&&f(e?.payload)},[e?.payload]),h.useEffect(()=>{if(s?.message_chunk&&!n)try{const m=s.message_chunk.replace(/^"|"$/g,"").match(/<JSON>([\s\S]*?)<\/JSON>/g);if(m)for(let u=m.length-1;u>=0;u--)try{const v=m[u].replace(/<JSON>|<\/JSON>|<think>|<\/think>/g,""),b=JSON.parse(v.trim());if(Array.isArray(b)&&b.every(N=>N.id&&N.title&&N.explain)){f(b);break}}catch{continue}}catch(i){console.error("Failed to parse pick source data:",i)}},[s?.message_chunk,n]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(i=>!i),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(T.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o("assistant.message.steps.pick_source_start")})]}):t.jsxs(t.Fragment,{children:[t.jsx(wr,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o(`assistant.message.steps.${s?.chunk_type||e.type}`,{count:c?.length})})]}),a?t.jsx(T.ChevronUp,{className:"w-4 h-4"}):t.jsx(T.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsx("div",{className:"mb-4 space-y-3 text-xs",children:c?.map(i=>t.jsx("div",{className:"p-3 rounded-lg border border-[#E6E6E6] dark:border-[#272626] bg-white dark:bg-[#1E1E1E] hover:bg-gray-50 dark:hover:bg-[#2C2C2C] transition-colors",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("div",{className:"text-sm font-medium text-[#333333] dark:text-[#D8D8D8]",children:i.title}),t.jsx("div",{className:"text-xs text-[#666666] dark:text-[#A3A3A3] line-clamp-2",children:i.explain})]})},i.id))})})})]})};function _r(e){return t.jsx(Le,{...e,viewBox:"0 0 16 16",children:t.jsxs("g",{id:"deading",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:[t.jsx("circle",{id:"椭圆形",stroke:"currentColor",strokeWidth:"1.25",cx:"8",cy:"3",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-2",stroke:"currentColor",strokeWidth:"1.25",cx:"3",cy:"5",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-4",stroke:"currentColor",strokeWidth:"1.25",cx:"13",cy:"5",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份",stroke:"currentColor",strokeWidth:"1.25",cx:"8",cy:"13",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-3",stroke:"currentColor",strokeWidth:"1.25",cx:"3",cy:"11",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-5",stroke:"currentColor",strokeWidth:"1.25",cx:"13",cy:"11",r:"1.375"}),t.jsx("path",{d:"M8.0070039,4.03345364 L8.0070039,8.50590493 L4.1923477,10.2855921",id:"路径-13",stroke:"currentColor",strokeWidth:"1.25"}),t.jsx("line",{x1:"11.7924093",y1:"8.47550067",x2:"8",y2:"10.2754456",id:"路径-13备份",stroke:"currentColor",strokeWidth:"1.25",transform:"translate(9.8962, 9.3755) scale(-1, 1) translate(-9.8962, -9.3755)"}),t.jsx("path",{d:"M4.17568738,4.53038288 L6.65384701,3.54050563 M9.35480875,3.53987819 L11.7283558,4.49062879",id:"形状",stroke:"currentColor",strokeWidth:"1.25"}),t.jsx("line",{x1:"3",y1:"6.06946104",x2:"3",y2:"9.97988046",id:"路径-14",stroke:"currentColor",strokeWidth:"1.25"}),t.jsx("line",{x1:"13",y1:"6.06946104",x2:"13",y2:"9.97988046",id:"路径-14备份",stroke:"currentColor",strokeWidth:"1.25"})]})})}const Cr=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=ae.useTranslation(),[a,d]=h.useState(!1),[c,f]=h.useState([]),[i,m]=h.useState("");return h.useEffect(()=>{e?.description&&m(e?.description)},[e?.description]),h.useEffect(()=>{if(s?.message_chunk)try{if(s.message_chunk.includes("&")){const u=s.message_chunk.split("&").filter(Boolean);f(u)}else f([s.message_chunk])}catch(u){console.error("Failed to parse query data:",u)}},[s?.message_chunk]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(u=>!u),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(T.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o(`assistant.message.steps.${s?.chunk_type||e?.type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(_r,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o(`assistant.message.steps.${s?.chunk_type||e?.type}`,{count:Number(c.length)})})]}),a?t.jsx(T.ChevronUp,{className:"w-4 h-4"}):t.jsx(T.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsxs("div",{className:"mb-4 space-y-3 text-xs",children:[c?.map(u=>t.jsx("div",{className:"flex flex-col gap-2",children:t.jsxs("div",{className:"text-xs text-[#999999] dark:text-[#808080]",children:["- ",u]})},u)),i?.split(`
31
+ `).map((u,v)=>u.trim()&&t.jsx("p",{className:"text-sm",children:u},v))]})})})]})},Nr=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=ae.useTranslation(),[a,d]=h.useState(!0),[c,f]=h.useState("");return h.useEffect(()=>{e?.description&&f(e?.description)},[e?.description]),h.useEffect(()=>{s?.message_chunk&&f(s?.message_chunk)},[s?.message_chunk,c]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(i=>!i),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(T.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o(`assistant.message.steps.${s?.chunk_type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(T.Brain,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o("assistant.message.steps.thoughtTime")})]}),a?t.jsx(T.ChevronUp,{className:"w-4 h-4"}):t.jsx(T.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:c?.split(`
32
+ `).map((i,m)=>i.trim()&&t.jsx("p",{className:"text-sm",children:i},m))})})]})},Er=Ge.create(e=>({synthesizeItem:null,setSynthesizeItem:s=>e({synthesizeItem:s}),uploadAttachments:[],setUploadAttachments:s=>e({uploadAttachments:s})})),Sr=["timedout","error"],Rr=({id:e,content:s,question:n,actionClassName:o,actionIconSize:a,copyButtonId:d,onResend:c})=>{const[f,i]=h.useState(!1),[m,u]=h.useState(!1),[v,b]=h.useState(!1),[N,I]=h.useState(!1),[q,C]=h.useState(!1),y=Sr.includes(e),{synthesizeItem:F,setSynthesizeItem:Q}=Er(),ee=async()=>{try{await yt(s),i(!0);const z=setTimeout(()=>{i(!1),clearTimeout(z)},2e3)}catch(z){console.error("copy error:",z)}},te=()=>{u(!m),b(!1)},H=()=>{b(!v),u(!1)},ne=async()=>Q({id:e,content:s}),w=()=>{if(c){C(!0),c();const z=setTimeout(()=>{C(!1),clearTimeout(z)},1e3)}};return t.jsxs("div",{className:ue("flex items-center gap-1 mt-2",o),children:[!y&&t.jsx("button",{id:d,onClick:ee,className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors",children:f?t.jsx(T.Check,{className:"w-4 h-4 text-[#38C200] dark:text-[#38C200]",style:{width:a,height:a}}):t.jsx(T.Copy,{className:"w-4 h-4 text-[#666666] dark:text-[#A3A3A3]",style:{width:a,height:a}})}),!y&&t.jsx("button",{onClick:te,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${m?"animate-shake":""}`,children:t.jsx(T.ThumbsUp,{className:`w-4 h-4 ${m?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})}),!y&&t.jsx("button",{onClick:H,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${v?"animate-shake":""}`,children:t.jsx(T.ThumbsDown,{className:`w-4 h-4 ${v?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})}),!y&&t.jsx(t.Fragment,{children:t.jsx("button",{onClick:ne,className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors",children:t.jsx(T.Volume2,{className:`w-4 h-4 ${N||F?.id===e?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})})}),n&&t.jsx("button",{onClick:w,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${q?"animate-spin":""}`,children:t.jsx(T.RotateCcw,{className:`w-4 h-4 ${q?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})})]})};function Tr({suggestions:e,onSelect:s}){return!e||e.length===0?null:t.jsx("div",{className:"mt-4 flex flex-col gap-2",children:e.map((n,o)=>t.jsxs("button",{onClick:()=>s(n),className:"text-left inline-flex items-center px-3 py-1.5 rounded-full bg-white dark:bg-[#202126] border border-[#E4E5EF] dark:border-[#272626] text-sm text-[#666666] dark:text-[#A3A3A3] hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors w-fit max-w-full break-words whitespace-pre-wrap",children:[t.jsx("span",{className:"break-all",children:n}),t.jsx(T.MoveRight,{className:"w-3 h-3 ml-1.5 shrink-0"})]},o))})}const Ar=({textToCopy:e})=>{const[s,n]=h.useState(!1),o=async()=>{try{await yt(e),n(!0);const a=setTimeout(()=>{n(!1),clearTimeout(a)},2e3)}catch(a){console.error("copy error:",a)}};return t.jsx("button",{className:"p-1 bg-gray-200 dark:bg-gray-700 rounded",onClick:o,children:s?t.jsx(T.Check,{className:"w-4 h-4 text-[#38C200] dark:text-[#38C200]"}):t.jsx(T.Copy,{className:"w-4 h-4 text-gray-600 dark:text-gray-300"})})},vt={commands:async(e,s)=>(console.log(`Mock command: ${e}`,s),{hits:{hits:[]}}),invokeBackend:async(e,s)=>{console.log(`Mock invokeBackend: ${e}`,s)}},Ue=Ge.create(e=>({currentAssistant:{},assistantList:[],currentService:{id:"mock-service-id"},setAssistant:s=>e({currentAssistant:s})})),wt=Ye.forwardRef(({className:e,...s},n)=>t.jsx("div",{ref:n,className:ue("relative inline-block",e),...s}));wt.displayName="Popover";const jt=Ye.forwardRef(({className:e,...s},n)=>t.jsx("div",{ref:n,className:ue("inline-block cursor-pointer",e),...s}));jt.displayName="PopoverTrigger";const _t=Ye.forwardRef(({className:e,side:s="bottom",...n},o)=>t.jsx("div",{ref:o,className:ue("absolute z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",{"bottom-full mb-2":s==="top","top-full mt-2":s==="bottom","right-full mr-2":s==="left","left-full ml-2":s==="right"},e),...n}));_t.displayName="PopoverContent";const Or=e=>{const{content:s,children:n,className:o}=e,[a,{setTrue:d,setFalse:c}]=bt.useBoolean(!1);return t.jsxs(wt,{children:[t.jsx(jt,{onMouseOver:d,onMouseOut:c,children:n}),t.jsx(_t,{side:"top",className:ue("z-1000 p-2 rounded-md text-xs text-white bg-black/75 hidden",{block:a},o),children:s})]})},Ct=({name:e,className:s,style:n,...o})=>t.jsx("svg",{className:`icon dark:drop-shadow-[0_0_6px_rgb(255,255,255)] ${s||""}`,style:n,...o,children:t.jsx("use",{xlinkHref:`#${e}`})}),Fr=(e,s)=>{const n=new Array(e.length+s.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<s.length;o++)n[e.length+o]=s[o];return n},Pr=(e,s)=>({classGroupId:e,validator:s}),Nt=(e=new Map,s=null,n)=>({nextPart:e,validators:s,classGroupId:n}),Ie="-",ft=[],Ir="arbitrary..",Lr=e=>{const s=zr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Mr(c);const f=c.split(Ie),i=f[0]===""&&f.length>1?1:0;return Et(f,i,s)},getConflictingClassGroupIds:(c,f)=>{if(f){const i=o[c],m=n[c];return i?m?Fr(m,i):i:m||ft}return n[c]||ft}}},Et=(e,s,n)=>{if(e.length-s===0)return n.classGroupId;const a=e[s],d=n.nextPart.get(a);if(d){const m=Et(e,s+1,d);if(m)return m}const c=n.validators;if(c===null)return;const f=s===0?e.join(Ie):e.slice(s).join(Ie),i=c.length;for(let m=0;m<i;m++){const u=c[m];if(u.validator(f))return u.classGroupId}},Mr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=e.slice(1,-1),n=s.indexOf(":"),o=s.slice(0,n);return o?Ir+o:void 0})(),zr=e=>{const{theme:s,classGroups:n}=e;return $r(n,s)},$r=(e,s)=>{const n=Nt();for(const o in e){const a=e[o];Je(a,n,o,s)}return n},Je=(e,s,n,o)=>{const a=e.length;for(let d=0;d<a;d++){const c=e[d];Wr(c,s,n,o)}},Wr=(e,s,n,o)=>{if(typeof e=="string"){qr(e,s,n);return}if(typeof e=="function"){Dr(e,s,n,o);return}Br(e,s,n,o)},qr=(e,s,n)=>{const o=e===""?s:St(s,e);o.classGroupId=n},Dr=(e,s,n,o)=>{if(Ur(e)){Je(e(o),s,n,o);return}s.validators===null&&(s.validators=[]),s.validators.push(Pr(n,e))},Br=(e,s,n,o)=>{const a=Object.entries(e),d=a.length;for(let c=0;c<d;c++){const[f,i]=a[c];Je(i,St(s,f),n,o)}},St=(e,s)=>{let n=e;const o=s.split(Ie),a=o.length;for(let d=0;d<a;d++){const c=o[d];let f=n.nextPart.get(c);f||(f=Nt(),n.nextPart.set(c,f)),n=f}return n},Ur=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Vr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let s=0,n=Object.create(null),o=Object.create(null);const a=(d,c)=>{n[d]=c,s++,s>e&&(s=0,o=n,n=Object.create(null))};return{get(d){let c=n[d];if(c!==void 0)return c;if((c=o[d])!==void 0)return a(d,c),c},set(d,c){d in n?n[d]=c:a(d,c)}}},Ve="!",mt=":",Gr=[],pt=(e,s,n,o,a)=>({modifiers:e,hasImportantModifier:s,baseClassName:n,maybePostfixModifierPosition:o,isExternal:a}),Yr=e=>{const{prefix:s,experimentalParseClassName:n}=e;let o=a=>{const d=[];let c=0,f=0,i=0,m;const u=a.length;for(let q=0;q<u;q++){const C=a[q];if(c===0&&f===0){if(C===mt){d.push(a.slice(i,q)),i=q+1;continue}if(C==="/"){m=q;continue}}C==="["?c++:C==="]"?c--:C==="("?f++:C===")"&&f--}const v=d.length===0?a:a.slice(i);let b=v,N=!1;v.endsWith(Ve)?(b=v.slice(0,-1),N=!0):v.startsWith(Ve)&&(b=v.slice(1),N=!0);const I=m&&m>i?m-i:void 0;return pt(d,N,b,I)};if(s){const a=s+mt,d=o;o=c=>c.startsWith(a)?d(c.slice(a.length)):pt(Gr,!1,c,void 0,!0)}if(n){const a=o;o=d=>n({className:d,parseClassName:a})}return o},Jr=e=>{const s=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{s.set(n,1e6+o)}),n=>{const o=[];let a=[];for(let d=0;d<n.length;d++){const c=n[d],f=c[0]==="[",i=s.has(c);f||i?(a.length>0&&(a.sort(),o.push(...a),a=[]),o.push(c)):a.push(c)}return a.length>0&&(a.sort(),o.push(...a)),o}},Xr=e=>({cache:Vr(e.cacheSize),parseClassName:Yr(e),sortModifiers:Jr(e),...Lr(e)}),Kr=/\s+/,Qr=(e,s)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:a,sortModifiers:d}=s,c=[],f=e.trim().split(Kr);let i="";for(let m=f.length-1;m>=0;m-=1){const u=f[m],{isExternal:v,modifiers:b,hasImportantModifier:N,baseClassName:I,maybePostfixModifierPosition:q}=n(u);if(v){i=u+(i.length>0?" "+i:i);continue}let C=!!q,y=o(C?I.substring(0,q):I);if(!y){if(!C){i=u+(i.length>0?" "+i:i);continue}if(y=o(I),!y){i=u+(i.length>0?" "+i:i);continue}C=!1}const F=b.length===0?"":b.length===1?b[0]:d(b).join(":"),Q=N?F+Ve:F,ee=Q+y;if(c.indexOf(ee)>-1)continue;c.push(ee);const te=a(y,C);for(let H=0;H<te.length;++H){const ne=te[H];c.push(Q+ne)}i=u+(i.length>0?" "+i:i)}return i},Hr=(...e)=>{let s=0,n,o,a="";for(;s<e.length;)(n=e[s++])&&(o=Rt(n))&&(a&&(a+=" "),a+=o);return a},Rt=e=>{if(typeof e=="string")return e;let s,n="";for(let o=0;o<e.length;o++)e[o]&&(s=Rt(e[o]))&&(n&&(n+=" "),n+=s);return n},Zr=(e,...s)=>{let n,o,a,d;const c=i=>{const m=s.reduce((u,v)=>v(u),e());return n=Xr(m),o=n.cache.get,a=n.cache.set,d=f,f(i)},f=i=>{const m=o(i);if(m)return m;const u=Qr(i,n);return a(i,u),u};return d=c,(...i)=>d(Hr(...i))},es=[],D=e=>{const s=n=>n[e]||es;return s.isThemeGetter=!0,s},Tt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,At=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ts=/^\d+\/\d+$/,rs=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ss=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ns=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,os=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,as=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,we=e=>ts.test(e),E=e=>!!e&&!Number.isNaN(Number(e)),he=e=>!!e&&Number.isInteger(Number(e)),De=e=>e.endsWith("%")&&E(e.slice(0,-1)),de=e=>rs.test(e),is=()=>!0,ls=e=>ss.test(e)&&!ns.test(e),Ot=()=>!1,cs=e=>os.test(e),ds=e=>as.test(e),us=e=>!x(e)&&!g(e),fs=e=>je(e,It,Ot),x=e=>Tt.test(e),ke=e=>je(e,Lt,ls),Be=e=>je(e,gs,E),ht=e=>je(e,Ft,Ot),ms=e=>je(e,Pt,ds),Fe=e=>je(e,Mt,cs),g=e=>At.test(e),Re=e=>_e(e,Lt),ps=e=>_e(e,bs),xt=e=>_e(e,Ft),hs=e=>_e(e,It),xs=e=>_e(e,Pt),Pe=e=>_e(e,Mt,!0),je=(e,s,n)=>{const o=Tt.exec(e);return o?o[1]?s(o[1]):n(o[2]):!1},_e=(e,s,n=!1)=>{const o=At.exec(e);return o?o[1]?s(o[1]):n:!1},Ft=e=>e==="position"||e==="percentage",Pt=e=>e==="image"||e==="url",It=e=>e==="length"||e==="size"||e==="bg-size",Lt=e=>e==="length",gs=e=>e==="number",bs=e=>e==="family-name",Mt=e=>e==="shadow",ks=()=>{const e=D("color"),s=D("font"),n=D("text"),o=D("font-weight"),a=D("tracking"),d=D("leading"),c=D("breakpoint"),f=D("container"),i=D("spacing"),m=D("radius"),u=D("shadow"),v=D("inset-shadow"),b=D("text-shadow"),N=D("drop-shadow"),I=D("blur"),q=D("perspective"),C=D("aspect"),y=D("ease"),F=D("animate"),Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],te=()=>[...ee(),g,x],H=()=>["auto","hidden","clip","visible","scroll"],ne=()=>["auto","contain","none"],w=()=>[g,x,i],z=()=>[we,"full","auto",...w()],fe=()=>[he,"none","subgrid",g,x],Z=()=>["auto",{span:["full",he,g,x]},he,g,x],ie=()=>[he,"auto",g,x],B=()=>["auto","min","max","fr",g,x],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...w()],J=()=>[we,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],k=()=>[e,g,x],oe=()=>[...ee(),xt,ht,{position:[g,x]}],xe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",hs,fs,{size:[g,x]}],le=()=>[De,Re,ke],$=()=>["","none","full",m,g,x],V=()=>["",E,Re,ke],me=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>[E,De,xt,ht],j=()=>["","none",I,g,x],X=()=>["none",E,g,x],ce=()=>["none",E,g,x],Ce=()=>[E,g,x],ge=()=>[we,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[de],breakpoint:[de],color:[is],container:[de],"drop-shadow":[de],ease:["in","out","in-out"],font:[us],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[de],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[de],shadow:[de],spacing:["px",E],text:[de],"text-shadow":[de],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",we,x,g,C]}],container:["container"],columns:[{columns:[E,x,g,f]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:te()}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:ne()}],"overscroll-x":[{"overscroll-x":ne()}],"overscroll-y":[{"overscroll-y":ne()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[he,"auto",g,x]}],basis:[{basis:[we,"full","auto",f,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[E,we,"auto","initial","none",x]}],grow:[{grow:["",E,g,x]}],shrink:[{shrink:["",E,g,x]}],order:[{order:[he,"first","last","none",g,x]}],"grid-cols":[{"grid-cols":fe()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":fe()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],w:[{w:[f,"screen",...J()]}],"min-w":[{"min-w":[f,"screen","none",...J()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",n,Re,ke]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,g,Be]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",De,x]}],"font-family":[{font:[ps,x,s]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,g,x]}],"line-clamp":[{"line-clamp":[E,"none",g,Be]}],leading:[{leading:[d,...w()]}],"list-image":[{"list-image":["none",g,x]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",g,x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[E,"from-font","auto",g,ke]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[E,"auto",g,x]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",g,x]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",g,x]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:xe()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},he,g,x],radial:["",g,x],conic:[he,g,x]},xs,ms]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[E,g,x]}],"outline-w":[{outline:["",E,Re,ke]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",u,Pe,Fe]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",v,Pe,Fe]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[E,ke]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",b,Pe,Fe]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[E,g,x]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[E]}],"mask-image-linear-from-pos":[{"mask-linear-from":P()}],"mask-image-linear-to-pos":[{"mask-linear-to":P()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":P()}],"mask-image-t-to-pos":[{"mask-t-to":P()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":P()}],"mask-image-r-to-pos":[{"mask-r-to":P()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":P()}],"mask-image-b-to-pos":[{"mask-b-to":P()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":P()}],"mask-image-l-to-pos":[{"mask-l-to":P()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":P()}],"mask-image-x-to-pos":[{"mask-x-to":P()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":P()}],"mask-image-y-to-pos":[{"mask-y-to":P()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[g,x]}],"mask-image-radial-from-pos":[{"mask-radial-from":P()}],"mask-image-radial-to-pos":[{"mask-radial-to":P()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":ee()}],"mask-image-conic-pos":[{"mask-conic":[E]}],"mask-image-conic-from-pos":[{"mask-conic-from":P()}],"mask-image-conic-to-pos":[{"mask-conic-to":P()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:xe()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",g,x]}],filter:[{filter:["","none",g,x]}],blur:[{blur:j()}],brightness:[{brightness:[E,g,x]}],contrast:[{contrast:[E,g,x]}],"drop-shadow":[{"drop-shadow":["","none",N,Pe,Fe]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",E,g,x]}],"hue-rotate":[{"hue-rotate":[E,g,x]}],invert:[{invert:["",E,g,x]}],saturate:[{saturate:[E,g,x]}],sepia:[{sepia:["",E,g,x]}],"backdrop-filter":[{"backdrop-filter":["","none",g,x]}],"backdrop-blur":[{"backdrop-blur":j()}],"backdrop-brightness":[{"backdrop-brightness":[E,g,x]}],"backdrop-contrast":[{"backdrop-contrast":[E,g,x]}],"backdrop-grayscale":[{"backdrop-grayscale":["",E,g,x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[E,g,x]}],"backdrop-invert":[{"backdrop-invert":["",E,g,x]}],"backdrop-opacity":[{"backdrop-opacity":[E,g,x]}],"backdrop-saturate":[{"backdrop-saturate":[E,g,x]}],"backdrop-sepia":[{"backdrop-sepia":["",E,g,x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",g,x]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[E,"initial",g,x]}],ease:[{ease:["linear","initial",y,g,x]}],delay:[{delay:[E,g,x]}],animate:[{animate:["none",F,g,x]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[q,g,x]}],"perspective-origin":[{"perspective-origin":te()}],rotate:[{rotate:X()}],"rotate-x":[{"rotate-x":X()}],"rotate-y":[{"rotate-y":X()}],"rotate-z":[{"rotate-z":X()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[g,x,"","none","gpu","cpu"]}],"transform-origin":[{origin:te()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",g,x]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",g,x]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[E,Re,ke,Be]}],stroke:[{stroke:["none",...k()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ys=Zr(ks),vs=e=>{const{path:s,className:n}=e,[o,a]=h.useState("");return h.useEffect(()=>{vt.invokeBackend("get_file_icon",{path:s}).then(d=>{d&&a(d)})},[s]),t.jsx(Ct,{name:o,className:ys("min-w-8 h-8",n)})},ws=e=>{const{id:s,name:n,path:o,extname:a,size:d,uploaded:c,attachmentId:f,uploadFailed:i,failedMessage:m,deletable:u,onDelete:v}=e,{t:b}=ae.useTranslation();return t.jsx("div",{className:"w-1/3 px-1",children:t.jsxs("div",{className:"relative group flex items-center gap-1 p-1 rounded-[4px] bg-[#dedede] dark:bg-[#202126]",children:[(i||f)&&u&&t.jsx("div",{className:"absolute flex justify-center items-center size-[14px] bg-red-600 top-0 right-0 rounded-full cursor-pointer translate-x-[5px] -translate-y-[5px] transition opacity-0 group-hover:opacity-100 ",onClick:()=>{v?.(s)},children:t.jsx(T.X,{className:"size-[10px] text-white"})}),t.jsx(vs,{path:o}),t.jsxs("div",{className:"flex flex-col justify-between overflow-hidden",children:[t.jsx("div",{className:"truncate text-sm text-[#333333] dark:text-[#D8D8D8]",children:n}),t.jsx("div",{className:"text-xs",children:i&&m?t.jsx(Or,{content:m,children:t.jsx("span",{className:"text-red-500",children:"Upload Failed"})}):t.jsx("div",{className:"text-[#999]",children:c?t.jsxs("div",{className:"flex gap-2",children:[a&&t.jsx("span",{children:a}),t.jsx("span",{children:kr(d)})]}):t.jsx("span",{children:b("assistant.fileList.uploading")})})})]})]})},s)},js=Ge.create(()=>({addError:e=>console.error(e)})),_s=e=>{const{message:s,attachments:n}=e,[o,a]=h.useState(!1),{currentService:d}=Ue(),[c,f]=h.useState([]),{addError:i}=js(),m=u=>{if(typeof window<"u"&&typeof document<"u"){const v=window.getSelection(),b=document.createRange();if(u.currentTarget&&v&&b)try{b.selectNodeContents(u.currentTarget),v.removeAllRanges(),v.addRange(b)}catch(N){console.error("Selection failed:",N)}}};return bt.useAsyncEffect(async()=>{try{if(n.length===0)return;const u=await vt.commands("get_attachment_by_ids",{serverId:d.id,attachments:n});f(u?.hits?.hits)}catch(u){i(String(u))}},[n]),t.jsxs(t.Fragment,{children:[s&&t.jsxs("div",{className:"flex gap-1 items-center justify-end",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[t.jsx("div",{className:ue("size-6 transition",{"opacity-0":!o}),children:t.jsx(Ar,{textToCopy:s})}),t.jsx("div",{className:"max-w-[85%] overflow-auto text-left px-3 py-2 bg-white dark:bg-[#202126] rounded-xl border border-black/12 dark:border-black/15 font-normal text-sm text-[#333333] dark:text-[#D8D8D8] cursor-pointer user-select-text whitespace-pre-wrap",onDoubleClick:m,children:s})]}),c&&t.jsx("div",{className:ue("flex justify-end flex-wrap gap-y-2 w-full",{"mt-3":s}),children:c.map(u=>{const{id:v,name:b,size:N,icon:I}=u._source;return h.createElement(ws,{...u._source,key:v,uploading:!1,uploaded:!0,id:v,extname:I,attachmentId:v,name:b,path:b,size:N,deletable:!1})})})]})};function Cs(){const[e,s]=h.useState(),[n,o]=h.useState(),[a,d]=h.useState(),[c,f]=h.useState(),[i,m]=h.useState(),[u,v]=h.useState(),[b,N]=h.useState(),I={deal_query_intent:h.useCallback(C=>{s(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_tools:h.useCallback(C=>{o(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_fetch_source:h.useCallback(C=>{d(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_pick_source:h.useCallback(C=>{f(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_deep_read:h.useCallback(C=>{m(y=>y?{...y,message_chunk:(y.message_chunk||"")+"&"+(C.message_chunk||"")}:C)},[]),deal_think:h.useCallback(C=>{v(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_response:h.useCallback(C=>{N(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[])};return{data:{query_intent:e,tools:n,fetch_source:a,pick_source:c,deep_read:i,think:u,response:b},handlers:I,clearAllChunkData:()=>new Promise(C=>{s(void 0),o(void 0),d(void 0),f(void 0),m(void 0),v(void 0),N(void 0),setTimeout(C,0)})}}function Ns(e){if(e)return e==="light"?"light":e==="dark"||typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const Es=h.memo(h.forwardRef(function({message:s,isTyping:n,onResend:o,hide_assistant:a=!1,rootClassName:d,actionClassName:c,actionIconSize:f,copyButtonId:i,formatUrl:m,theme:u,locale:v},b){const{t:N,i18n:I}=ae.useTranslation(),q=Ns(u),C=Ue(j=>j.currentAssistant),y=Ue(j=>j.assistantList),[F,Q]=h.useState({}),{data:{query_intent:ee,tools:te,fetch_source:H,pick_source:ne,deep_read:w,think:z,response:fe},handlers:Z,clearAllChunkData:ie}=Cs(),[B,Y]=h.useState({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),U=h.useRef(!1);h.useImperativeHandle(b,()=>({addChunk:j=>{if(Y(()=>({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1,[j.chunk_type||""]:!0})),j.chunk_type==="query_intent")Z.deal_query_intent(j);else if(j.chunk_type==="tools")Z.deal_tools(j);else if(j.chunk_type==="fetch_source")Z.deal_fetch_source(j);else if(j.chunk_type==="pick_source")Z.deal_pick_source(j);else if(j.chunk_type==="deep_read")Z.deal_deep_read(j);else if(j.chunk_type==="think")Z.deal_think(j);else if(j.chunk_type==="response"){const X=j.message_chunk;if(typeof X=="string"){if(X.includes("<think>")||X.includes("<think>")){U.current=!0;return}else if(X.includes("</think>")||X.includes("</think>")){U.current=!1;return}U.current?Z.deal_think({...j,chunk_type:"think"}):Z.deal_response(j)}}},reset:()=>{ie(),Y({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),U.current=!1}}));const L=s?._source?.type==="assistant",J=s?._source?.assistant_id,k=s?._source?.assistant_item;h.useEffect(()=>{v&&I.language!==v&&I.changeLanguage(v)},[v,I]),h.useEffect(()=>{if(k){Q(k);return}if(L&&J&&Array.isArray(y)){Q(y.find(j=>j._id===J)??{});return}Q(C)},[L,k,J,y,C]);const oe=s?._source?.message||"",xe=s?._source?.attachments??[],re=s?._source?.details||[],le=s?._source?.question||"",$=n===!1&&(oe||fe?.message_chunk),[V,me]=h.useState([]),pe=j=>{me(j)},P=()=>L?t.jsxs(t.Fragment,{children:[t.jsx(xr,{Detail:re.find(j=>j.type==="query_intent"),ChunkData:ee,getSuggestion:pe,loading:B?.query_intent}),t.jsx(gr,{Detail:re.find(j=>j.type==="tools"),ChunkData:te,loading:B?.tools}),t.jsx(vr,{Detail:re.find(j=>j.type==="fetch_source"),ChunkData:H,loading:B?.fetch_source,formatUrl:m}),t.jsx(jr,{Detail:re.find(j=>j.type==="pick_source"),ChunkData:ne,loading:B?.pick_source}),t.jsx(Cr,{Detail:re.find(j=>j.type==="deep_read"),ChunkData:w,loading:B?.deep_read}),t.jsx(Nr,{Detail:re.find(j=>j.type==="think"),ChunkData:z,loading:B?.think}),t.jsx(gt.XMarkdown,{content:oe||fe?.message_chunk||""}),n&&t.jsx("div",{className:"inline-block w-1.5 h-5 ml-0.5 -mb-0.5 bg-[#666666] dark:bg-[#A3A3A3] rounded-sm animate-typing"}),$&&t.jsx(Rr,{id:s._id??"",content:oe||fe?.message_chunk||"",question:le,actionClassName:c,actionIconSize:f,copyButtonId:i,onResend:()=>{o&&o(le)}}),!n&&t.jsx(Tr,{suggestions:V,onSelect:j=>o&&o(j)})]}):t.jsx(_s,{message:oe,attachments:xe});return t.jsx("div",{className:ue("w-full py-8 flex",[L?"justify-start":"justify-end"],q==="dark"&&"dark",d),children:t.jsx("div",{className:`w-full px-4 flex gap-4 ${L?"w-full":"flex-row-reverse"}`,children:t.jsxs("div",{className:`w-full space-y-2 ${L?"text-left":"text-right"}`,children:[!a&&t.jsxs("div",{className:"w-full flex items-center gap-1 font-semibold text-sm text-[#333] dark:text-[#d8d8d8]",children:[L?t.jsx("div",{className:"w-6 h-6 flex justify-center items-center rounded-full bg-white border border-[#E6E6E6]",children:F?._source?.icon?.startsWith("font_")?t.jsx(Ct,{name:F._source.icon,className:"w-4 h-4"}):t.jsx("img",{src:pr,className:"w-4 h-4",alt:N("assistant.message.logo")})}):null,L?F?._source?.name||"Coco AI":""]}),t.jsx("div",{className:"w-full prose dark:prose-invert prose-sm max-w-none",children:t.jsx("div",{className:"w-full pl-7 text-[#333] dark:text-[#d8d8d8] leading-relaxed",children:P()})})]})})})})),Ss=h.memo(h.forwardRef((e,s)=>t.jsx(ae.I18nextProvider,{i18n:kt,children:t.jsx(Es,{...e,ref:s})})));exports.ChatMessage=Ss;
@@ -0,0 +1,32 @@
1
+ var ChatMessage=(function(Re,h,oe,ie,$t,A,Ke,ze,Qe){"use strict";function Wt(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(s,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return s.default=e,Object.freeze(s)}const $e=Wt(h);var Ae={exports:{}},Ce={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var He;function Dt(){if(He)return Ce;He=1;var e=h,s=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function c(f,i,m){var u,v={},b=null,E=null;m!==void 0&&(b=""+m),i.key!==void 0&&(b=""+i.key),i.ref!==void 0&&(E=i.ref);for(u in i)o.call(i,u)&&!d.hasOwnProperty(u)&&(v[u]=i[u]);if(f&&f.defaultProps)for(u in i=f.defaultProps,i)v[u]===void 0&&(v[u]=i[u]);return{$$typeof:s,type:f,key:b,ref:E,props:v,_owner:a.current}}return Ce.Fragment=n,Ce.jsx=c,Ce.jsxs=c,Ce}var Ne={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Ze;function Bt(){return Ze||(Ze=1,process.env.NODE_ENV!=="production"&&(function(){var e=h,s=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),E=Symbol.for("react.offscreen"),L=Symbol.iterator,B="@@iterator";function C(r){if(r===null||typeof r!="object")return null;var l=L&&r[L]||r[B];return typeof l=="function"?l:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function P(r){{for(var l=arguments.length,p=new Array(l>1?l-1:0),_=1;_<l;_++)p[_-1]=arguments[_];Q("error",r,p)}}function Q(r,l,p){{var _=y.ReactDebugCurrentFrame,O=_.getStackAddendum();O!==""&&(l+="%s",p=p.concat([O]));var F=p.map(function(T){return String(T)});F.unshift("Warning: "+l),Function.prototype.apply.call(console[r],console,F)}}var ee=!1,te=!1,H=!1,ne=!1,w=!1,z;z=Symbol.for("react.module.reference");function me(r){return!!(typeof r=="string"||typeof r=="function"||r===o||r===d||w||r===a||r===m||r===u||ne||r===E||ee||te||H||typeof r=="object"&&r!==null&&(r.$$typeof===b||r.$$typeof===v||r.$$typeof===c||r.$$typeof===f||r.$$typeof===i||r.$$typeof===z||r.getModuleId!==void 0))}function Z(r,l,p){var _=r.displayName;if(_)return _;var O=l.displayName||l.name||"";return O!==""?p+"("+O+")":p}function ce(r){return r.displayName||"Context"}function U(r){if(r==null)return null;if(typeof r.tag=="number"&&P("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case o:return"Fragment";case n:return"Portal";case d:return"Profiler";case a:return"StrictMode";case m:return"Suspense";case u:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case f:var l=r;return ce(l)+".Consumer";case c:var p=r;return ce(p._context)+".Provider";case i:return Z(r,r.render,"ForwardRef");case v:var _=r.displayName||null;return _!==null?_:U(r.type)||"Memo";case b:{var O=r,F=O._payload,T=O._init;try{return U(T(F))}catch{return null}}}return null}var Y=Object.assign,V=0,M,J,k,ae,xe,re,de;function $(){}$.__reactDisabledLog=!0;function G(){{if(V===0){M=console.log,J=console.info,k=console.warn,ae=console.error,xe=console.group,re=console.groupCollapsed,de=console.groupEnd;var r={configurable:!0,enumerable:!0,value:$,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}V++}}function pe(){{if(V--,V===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},r,{value:M}),info:Y({},r,{value:J}),warn:Y({},r,{value:k}),error:Y({},r,{value:ae}),group:Y({},r,{value:xe}),groupCollapsed:Y({},r,{value:re}),groupEnd:Y({},r,{value:de})})}V<0&&P("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var he=y.ReactCurrentDispatcher,I;function j(r,l,p){{if(I===void 0)try{throw Error()}catch(O){var _=O.stack.trim().match(/\n( *(at )?)/);I=_&&_[1]||""}return`
18
+ `+I+r}}var X=!1,ue;{var Se=typeof WeakMap=="function"?WeakMap:Map;ue=new Se}function be(r,l){if(!r||X)return"";{var p=ue.get(r);if(p!==void 0)return p}var _;X=!0;var O=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var F;F=he.current,he.current=null,G();try{if(l){var T=function(){throw Error()};if(Object.defineProperty(T.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(T,[])}catch(K){_=K}Reflect.construct(r,[],T)}else{try{T.call()}catch(K){_=K}r.call(T.prototype)}}else{try{throw Error()}catch(K){_=K}r()}}catch(K){if(K&&_&&typeof K.stack=="string"){for(var S=K.stack.split(`
19
+ `),q=_.stack.split(`
20
+ `),R=S.length-1,W=q.length-1;R>=1&&W>=0&&S[R]!==q[W];)W--;for(;R>=1&&W>=0;R--,W--)if(S[R]!==q[W]){if(R!==1||W!==1)do if(R--,W--,W<0||S[R]!==q[W]){var se=`
21
+ `+S[R].replace(" at new "," at ");return r.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",r.displayName)),typeof r=="function"&&ue.set(r,se),se}while(R>=1&&W>=0);break}}}finally{X=!1,he.current=F,pe(),Error.prepareStackTrace=O}var _e=r?r.displayName||r.name:"",ke=_e?j(_e):"";return typeof r=="function"&&ue.set(r,ke),ke}function os(r,l,p){return be(r,!1)}function as(r){var l=r.prototype;return!!(l&&l.isReactComponent)}function Le(r,l,p){if(r==null)return"";if(typeof r=="function")return be(r,as(r));if(typeof r=="string")return j(r);switch(r){case m:return j("Suspense");case u:return j("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case i:return os(r.render);case v:return Le(r.type,l,p);case b:{var _=r,O=_._payload,F=_._init;try{return Le(F(O),l,p)}catch{}}}return""}var Te=Object.prototype.hasOwnProperty,Ct={},Nt=y.ReactDebugCurrentFrame;function Me(r){if(r){var l=r._owner,p=Le(r.type,r._source,l?l.type:null);Nt.setExtraStackFrame(p)}else Nt.setExtraStackFrame(null)}function is(r,l,p,_,O){{var F=Function.call.bind(Te);for(var T in r)if(F(r,T)){var S=void 0;try{if(typeof r[T]!="function"){var q=Error((_||"React class")+": "+p+" type `"+T+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[T]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw q.name="Invariant Violation",q}S=r[T](l,T,_,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){S=R}S&&!(S instanceof Error)&&(Me(O),P("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",_||"React class",p,T,typeof S),Me(null)),S instanceof Error&&!(S.message in Ct)&&(Ct[S.message]=!0,Me(O),P("Failed %s type: %s",p,S.message),Me(null))}}}var ls=Array.isArray;function Ge(r){return ls(r)}function cs(r){{var l=typeof Symbol=="function"&&Symbol.toStringTag,p=l&&r[Symbol.toStringTag]||r.constructor.name||"Object";return p}}function ds(r){try{return Et(r),!1}catch{return!0}}function Et(r){return""+r}function St(r){if(ds(r))return P("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",cs(r)),Et(r)}var Tt=y.ReactCurrentOwner,us={key:!0,ref:!0,__self:!0,__source:!0},At,Ot;function fs(r){if(Te.call(r,"ref")){var l=Object.getOwnPropertyDescriptor(r,"ref").get;if(l&&l.isReactWarning)return!1}return r.ref!==void 0}function ms(r){if(Te.call(r,"key")){var l=Object.getOwnPropertyDescriptor(r,"key").get;if(l&&l.isReactWarning)return!1}return r.key!==void 0}function ps(r,l){typeof r.ref=="string"&&Tt.current}function hs(r,l){{var p=function(){At||(At=!0,P("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};p.isReactWarning=!0,Object.defineProperty(r,"key",{get:p,configurable:!0})}}function gs(r,l){{var p=function(){Ot||(Ot=!0,P("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};p.isReactWarning=!0,Object.defineProperty(r,"ref",{get:p,configurable:!0})}}var xs=function(r,l,p,_,O,F,T){var S={$$typeof:s,type:r,key:l,ref:p,props:T,_owner:F};return S._store={},Object.defineProperty(S._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(S,"_self",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.defineProperty(S,"_source",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.freeze&&(Object.freeze(S.props),Object.freeze(S)),S};function bs(r,l,p,_,O){{var F,T={},S=null,q=null;p!==void 0&&(St(p),S=""+p),ms(l)&&(St(l.key),S=""+l.key),fs(l)&&(q=l.ref,ps(l,O));for(F in l)Te.call(l,F)&&!us.hasOwnProperty(F)&&(T[F]=l[F]);if(r&&r.defaultProps){var R=r.defaultProps;for(F in R)T[F]===void 0&&(T[F]=R[F])}if(S||q){var W=typeof r=="function"?r.displayName||r.name||"Unknown":r;S&&hs(T,W),q&&gs(T,W)}return xs(r,S,q,O,_,Tt.current,T)}}var qe=y.ReactCurrentOwner,Ft=y.ReactDebugCurrentFrame;function je(r){if(r){var l=r._owner,p=Le(r.type,r._source,l?l.type:null);Ft.setExtraStackFrame(p)}else Ft.setExtraStackFrame(null)}var Ye;Ye=!1;function Je(r){return typeof r=="object"&&r!==null&&r.$$typeof===s}function Pt(){{if(qe.current){var r=U(qe.current.type);if(r)return`
22
+
23
+ Check the render method of \``+r+"`."}return""}}function ks(r){return""}var It={};function ys(r){{var l=Pt();if(!l){var p=typeof r=="string"?r:r.displayName||r.name;p&&(l=`
24
+
25
+ Check the top-level render call using <`+p+">.")}return l}}function Lt(r,l){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var p=ys(l);if(It[p])return;It[p]=!0;var _="";r&&r._owner&&r._owner!==qe.current&&(_=" It was passed a child from "+U(r._owner.type)+"."),je(r),P('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,_),je(null)}}function Mt(r,l){{if(typeof r!="object")return;if(Ge(r))for(var p=0;p<r.length;p++){var _=r[p];Je(_)&&Lt(_,l)}else if(Je(r))r._store&&(r._store.validated=!0);else if(r){var O=C(r);if(typeof O=="function"&&O!==r.entries)for(var F=O.call(r),T;!(T=F.next()).done;)Je(T.value)&&Lt(T.value,l)}}}function vs(r){{var l=r.type;if(l==null||typeof l=="string")return;var p;if(typeof l=="function")p=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===i||l.$$typeof===v))p=l.propTypes;else return;if(p){var _=U(l);is(p,r.props,"prop",_,r)}else if(l.PropTypes!==void 0&&!Ye){Ye=!0;var O=U(l);P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",O||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&P("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ws(r){{for(var l=Object.keys(r.props),p=0;p<l.length;p++){var _=l[p];if(_!=="children"&&_!=="key"){je(r),P("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),je(null);break}}r.ref!==null&&(je(r),P("Invalid attribute `ref` supplied to `React.Fragment`."),je(null))}}var Rt={};function zt(r,l,p,_,O,F){{var T=me(r);if(!T){var S="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var q=ks();q?S+=q:S+=Pt();var R;r===null?R="null":Ge(r)?R="array":r!==void 0&&r.$$typeof===s?(R="<"+(U(r.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):R=typeof r,P("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,S)}var W=bs(r,l,p,O,F);if(W==null)return W;if(T){var se=l.children;if(se!==void 0)if(_)if(Ge(se)){for(var _e=0;_e<se.length;_e++)Mt(se[_e],r);Object.freeze&&Object.freeze(se)}else P("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Mt(se,r)}if(Te.call(l,"key")){var ke=U(r),K=Object.keys(l).filter(function(Ss){return Ss!=="key"}),Xe=K.length>0?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}";if(!Rt[ke+Xe]){var Es=K.length>0?"{"+K.join(": ..., ")+": ...}":"{}";P(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,Xe,ke,Es,ke),Rt[ke+Xe]=!0}}return r===o?ws(W):vs(W),W}}function js(r,l,p){return zt(r,l,p,!0)}function _s(r,l,p){return zt(r,l,p,!1)}var Cs=_s,Ns=js;Ne.Fragment=o,Ne.jsx=Cs,Ne.jsxs=Ns})()),Ne}var et;function Ut(){return et||(et=1,process.env.NODE_ENV==="production"?Ae.exports=Dt():Ae.exports=Bt()),Ae.exports}var t=Ut();const Vt={en:{translation:{assistant:{message:{logo:"Coco AI Logo",aiName:"Coco AI",thinkingButton:"View thinking process",steps:{query_intent:"Understand the query",tools:"Call LLM Tools",source_zero:"Searching for relevant documents",fetch_source:"Retrieve {{count}} documents",pick_source:"Intelligent pick {{count}} results",pick_source_start:"Intelligently pre-selecting",deep_read:"Deep reading",think:"AI is thinking...",thoughtTime:"Thought for a few seconds",keywords:"Keywords",questionType:"Query Type",userIntent:"User Intent",relatedQuestions:"Query",suggestion:"Suggestion",informationSeeking:"Information Seeking"}}}}},zh:{translation:{assistant:{message:{logo:"Coco AI 图标",aiName:"Coco AI",thinkingButton:"查看思考过程",steps:{query_intent:"理解查询",tools:"调用大模型工具",source_zero:"正在搜索相关文档",fetch_source:"检索 {{count}} 份文档",pick_source:"智能预选 {{count}} 个结果",pick_source_start:"正在智能预选",deep_read:"深度阅读",think:"AI 正在思考...",thoughtTime:"思考了数秒",keywords:"关键词",questionType:"查询类型",userIntent:"用户意图",relatedQuestions:"查询",suggestion:"建议",informationSeeking:"信息查询"}}}}}},tt=$t.createInstance();tt.use(oe.initReactI18next).init({resources:Vt,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1},react:{useSuspense:!1}});const Gt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3ccircle%20cx='50'%20cy='50'%20r='40'%20stroke='black'%20stroke-width='3'%20fill='red'%20/%3e%3c/svg%3e";function Oe({size:e=18,children:s,className:n,title:o,onClick:a,action:d=!1,...c}){const f=i=>{a?.(i)};return t.jsx("i",{style:{width:e,height:e},title:o,onClick:f,className:ie("inline-flex items-center justify-center rounded-sm p-[2px] transition-all",{"cursor-pointer":d},n),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{width:"100%",height:"100%"},...c,children:s})})}function qt(e){return t.jsx(Oe,{...e,viewBox:"0 0 16 16",children:t.jsx("g",{id:"Understand",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsxs("g",{id:"编组",transform:"translate(0.5, 0.5)",stroke:"currentColor",strokeWidth:"1.25",children:[t.jsx("path",{d:"M7.44444444,3 C9.89904333,3 11.8888889,4.95366655 11.8888889,7.36363636 C11.8888889,9.06711551 10.8946979,10.5426108 9.44492275,11.2613085 L9.44444444,12.2727273 C9.44444444,13.3772968 8.54901394,14.2727273 7.44444444,14.2727273 C6.33987494,14.2727273 5.44444444,13.3772968 5.44444444,12.2727273 L5.44396614,11.2613085 C3.99419095,10.5426108 3,9.06711551 3,7.36363636 C3,4.95366655 4.98984556,3 7.44444444,3 Z",id:"形状结合"}),t.jsx("line",{x1:"5.5",y1:"11.2156017",x2:"9.5",y2:"11.2156017",id:"路径-11"}),t.jsx("line",{x1:"7.44444444",y1:"10.6363636",x2:"7.44444444",y2:"8.45454545",id:"路径-12"}),t.jsx("line",{x1:"7.44444444",y1:"0.818181818",x2:"7.44444444",y2:"0.272727273",id:"路径-12备份"}),t.jsx("line",{x1:"12.352383",y1:"2.81770629",x2:"12.3574335",y2:"2.26720124",id:"路径-12备份",transform:"translate(12.3549, 2.5425) rotate(45) translate(-12.3549, -2.5425)"}),t.jsx("line",{x1:"14.3888889",y1:"7.64141414",x2:"14.3888889",y2:"7.08585859",id:"路径-12备份",transform:"translate(14.3889, 7.3636) rotate(90) translate(-14.3889, -7.3636)"}),t.jsx("line",{x1:"12.3574335",y1:"12.4600715",x2:"12.352383",y2:"11.9095664",id:"路径-12备份",transform:"translate(12.3549, 12.1848) rotate(135) translate(-12.3549, -12.1848)"}),t.jsx("line",{x1:"2.53145543",y1:"12.4600715",x2:"2.53650594",y2:"11.9095664",id:"路径-12备份",transform:"translate(2.534, 12.1848) rotate(225) translate(-2.534, -12.1848)"}),t.jsx("line",{x1:"0.5",y1:"7.64141414",x2:"0.5",y2:"7.08585859",id:"路径-12备份",transform:"translate(0.5, 7.3636) rotate(270) translate(-0.5, -7.3636)"}),t.jsx("line",{x1:"2.53650594",y1:"2.81770629",x2:"2.53145543",y2:"2.26720124",id:"路径-12备份",transform:"translate(2.534, 2.5425) rotate(315) translate(-2.534, -2.5425)"}),t.jsx("polyline",{id:"路径-15",transform:"translate(7.4398, 6.7308) rotate(-45) translate(-7.4398, -6.7308)",points:"6.33632897 5.60310185 6.3568375 7.83853192 8.5432888 7.85859111"})]})})})}const Yt=({Detail:e,ChunkData:s,getSuggestion:n,loading:o})=>{const{t:a}=oe.useTranslation(),[d,c]=h.useState(!1),[f,i]=h.useState(null);return h.useEffect(()=>{e?.payload&&(i(e?.payload),e?.payload?.suggestion&&n&&n(e?.payload?.suggestion))},[e?.payload,n]),h.useEffect(()=>{if(s?.message_chunk&&!o)try{const u=s.message_chunk.replace(/^"|"$/g,"").match(/<JSON>([\s\S]*?)<\/JSON>/g);if(u){const b=u[u.length-1].replace(/<JSON>|<\/JSON>/g,""),E=JSON.parse(b);E?.suggestion&&n&&n(E?.suggestion),i(E)}}catch(m){console.error("Failed to process message chunk in QueryIntent:",m)}},[s?.message_chunk,o,n]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>c(m=>!m),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[o?t.jsxs(t.Fragment,{children:[t.jsx(A.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:a(`assistant.message.steps.${s?.chunk_type||e.type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(qt,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:a(`assistant.message.steps.${s?.chunk_type||e.type}`)})]}),d?t.jsx(A.ChevronUp,{className:"w-4 h-4"}):t.jsx(A.ChevronDown,{className:"w-4 h-4"})]}),d&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsxs("div",{className:"mb-4 space-y-2 text-xs",children:[f?.keyword?t.jsxs("div",{className:"flex gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.keywords"),":"]}),t.jsx("div",{className:"flex flex-wrap gap-1",children:f?.keyword?.map((m,u)=>t.jsxs("span",{className:"text-[#333333] dark:text-[#D8D8D8]",children:[m,u<2&&"、"]},m+u))})]}):null,f?.category?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.questionType"),":"]}),t.jsx("span",{className:"text-[#333333] dark:text-[#D8D8D8]",children:f?.category})]}):null,f?.intent?t.jsxs("div",{className:"flex items-start gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.userIntent"),":"]}),t.jsx("div",{className:"flex-1 text-[#333333] dark:text-[#D8D8D8]",children:f?.intent})]}):null,f?.query?t.jsxs("div",{className:"flex items-start gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",a("assistant.message.steps.relatedQuestions"),":"]}),t.jsx("div",{className:"flex-1 flex flex-col text-[#333333] dark:text-[#D8D8D8]",children:f?.query?.map((m,u)=>t.jsxs("span",{children:["- ",m]},m+u))})]}):null]})})})]})},Jt=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=oe.useTranslation(),[a,d]=h.useState(!1),[c,f]=h.useState("");return h.useEffect(()=>{e?.description&&f(e?.description)},[e?.description]),h.useEffect(()=>{s?.message_chunk&&f(s?.message_chunk)},[s?.message_chunk,c]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(i=>!i),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(A.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o(`assistant.message.steps.${s?.chunk_type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(A.Hammer,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o(`assistant.message.steps.${s?.chunk_type}`)})]}),a?t.jsx(A.ChevronUp,{className:"w-4 h-4"}):t.jsx(A.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsx(Ke.XMarkdown,{content:c||""})})})]})},rt=async e=>{navigator.clipboard?await navigator.clipboard.writeText(e):console.log("Clipboard not available",e)},Xt=e=>{window.open(e,"_blank")},Kt=e=>e+" B";function Qt(e){return t.jsx(Oe,{...e,viewBox:"0 0 16 16",children:t.jsxs("g",{id:"Retrieve",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"10.8977456",y1:"14.5",x2:"14",y2:"10.9204757",id:"路径",stroke:"currentColor",strokeWidth:"1.25",transform:"translate(12.4489, 12.7102) scale(-1, 1) translate(-12.4489, -12.7102)"}),t.jsx("circle",{id:"椭圆形",stroke:"currentColor",strokeWidth:"1.25",transform:"translate(7.5, 7) scale(-1, 1) translate(-7.5, -7)",cx:"7.5",cy:"7",r:"5"})]})})}const Ht=({Detail:e,ChunkData:s,loading:n,formatUrl:o})=>{const{t:a}=oe.useTranslation(),[d,c]=h.useState(!1),[f,i]=h.useState(0),[m,u]=h.useState([]);h.useEffect(()=>{e?.payload&&(u(e?.payload),i(e?.payload.length))},[e?.payload]),h.useEffect(()=>{if(s?.message_chunk&&!n)try{const b=s.message_chunk.match(/<Payload total=(\d+)>/);b&&i(Number(b[1]));const E=s.message_chunk.match(/\[([\s\S]*)\]/);if(E){const L=JSON.parse(E[0]);u(L)}}catch(b){console.error("Failed to parse fetch source data:",b)}},[s?.message_chunk,n]);const v=b=>()=>{const E=o&&o(b)||b.url;E&&Xt(E)};return!s&&!e?null:t.jsxs("div",{className:`mt-2 mb-2 max-w-full w-full md:w-[610px] ${d?"rounded-lg overflow-hidden border border-[#E6E6E6] dark:border-[#272626]":""}`,children:[t.jsxs("button",{onClick:()=>c(b=>!b),className:`inline-flex justify-between items-center gap-2 px-2 py-1 rounded-xl transition-colors whitespace-nowrap ${d?"w-full":"border border-[#E6E6E6] dark:border-[#272626]"}`,children:[t.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[t.jsx(Qt,{className:"w-4 h-4 text-[#38C200] shrink-0"}),t.jsx("span",{className:"text-xs text-[#999999]",children:a(`assistant.message.steps.${s?.chunk_type||e.type}`,{count:Number(f)})})]}),d?t.jsx(A.ChevronUp,{className:"w-4 h-4 text-[#999999]"}):t.jsx(A.ChevronDown,{className:"w-4 h-4 text-[#999999]"})]}),d&&t.jsx(t.Fragment,{children:m?.map((b,E)=>t.jsx("div",{onClick:v(b),className:"group flex items-center p-2 hover:bg-[#F7F7F7] dark:hover:bg-[#2C2C2C] border-b border-[#E6E6E6] dark:border-[#272626] last:border-b-0 cursor-pointer transition-colors",children:t.jsxs("div",{className:"w-full flex items-center gap-2",children:[t.jsxs("div",{className:"w-[75%] mobile:w-full flex items-center gap-1",children:[t.jsx(A.Globe,{className:"w-3 h-3 shrink-0"}),t.jsx("div",{className:"text-xs text-[#333333] dark:text-[#D8D8D8] truncate font-normal group-hover:text-[#0072FF] dark:group-hover:text-[#0072FF]",children:b.title||b.category})]}),t.jsxs("div",{className:"flex-1 mobile:hidden flex items-center justify-end gap-2",children:[t.jsx("span",{className:"text-xs text-[#999999] dark:text-[#999999] truncate",children:b.source?.name||b?.category}),t.jsx(A.SquareArrowOutUpRight,{className:"w-3 h-3 text-[#999999] dark:text-[#999999] shrink-0"})]})]})},E))})]})};function Zt(e){return t.jsx(Oe,{...e,viewBox:"0 0 16 16",children:t.jsx("g",{id:"selection",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:t.jsxs("g",{id:"编组",transform:"translate(1.4813, 1)",stroke:"currentColor",strokeWidth:"1.25",children:[t.jsx("line",{x1:"6.7986538",y1:"2.8",x2:"6.7986538",y2:"2.07241631e-17",id:"路径",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("circle",{id:"椭圆形",fill:"#000000",cx:"6.7986538",cy:"6.72",r:"1"}),t.jsx("line",{x1:"2.17440858e-17",y1:"13.5186538",x2:"4.62042688",y2:"8.89822692",id:"路径",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("line",{x1:"10.1008425",y1:"4.16781133",x2:"10.1008425",y2:"2.66781133",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(10.1008, 3.4178) rotate(45) translate(-10.1008, -3.4178)"}),t.jsx("line",{x1:"12.1186538",y1:"8.12",x2:"12.1186538",y2:"5.32",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(12.1187, 6.72) rotate(90) translate(-12.1187, -6.72)"}),t.jsx("line",{x1:"10.1008425",y1:"10.7721887",x2:"10.1008425",y2:"9.27218867",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(10.1008, 10.0222) rotate(135) translate(-10.1008, -10.0222)"}),t.jsx("line",{x1:"6.7986538",y1:"13.44",x2:"6.7986538",y2:"10.64",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(6.7987, 12.04) rotate(180) translate(-6.7987, -12.04)"}),t.jsx("line",{x1:"1.4786538",y1:"8.12",x2:"1.4786538",y2:"5.32",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(1.4787, 6.72) rotate(270) translate(-1.4787, -6.72)"}),t.jsx("line",{x1:"3.49646513",y1:"4.16781133",x2:"3.49646513",y2:"2.66781133",id:"路径",strokeLinecap:"round",strokeLinejoin:"round",transform:"translate(3.4965, 3.4178) rotate(315) translate(-3.4965, -3.4178)"})]})})})}const er=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=oe.useTranslation(),[a,d]=h.useState(!1),[c,f]=h.useState([]);return h.useEffect(()=>{e?.payload&&f(e?.payload)},[e?.payload]),h.useEffect(()=>{if(s?.message_chunk&&!n)try{const m=s.message_chunk.replace(/^"|"$/g,"").match(/<JSON>([\s\S]*?)<\/JSON>/g);if(m)for(let u=m.length-1;u>=0;u--)try{const v=m[u].replace(/<JSON>|<\/JSON>|<think>|<\/think>/g,""),b=JSON.parse(v.trim());if(Array.isArray(b)&&b.every(E=>E.id&&E.title&&E.explain)){f(b);break}}catch{continue}}catch(i){console.error("Failed to parse pick source data:",i)}},[s?.message_chunk,n]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(i=>!i),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(A.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o("assistant.message.steps.pick_source_start")})]}):t.jsxs(t.Fragment,{children:[t.jsx(Zt,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o(`assistant.message.steps.${s?.chunk_type||e.type}`,{count:c?.length})})]}),a?t.jsx(A.ChevronUp,{className:"w-4 h-4"}):t.jsx(A.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsx("div",{className:"mb-4 space-y-3 text-xs",children:c?.map(i=>t.jsx("div",{className:"p-3 rounded-lg border border-[#E6E6E6] dark:border-[#272626] bg-white dark:bg-[#1E1E1E] hover:bg-gray-50 dark:hover:bg-[#2C2C2C] transition-colors",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("div",{className:"text-sm font-medium text-[#333333] dark:text-[#D8D8D8]",children:i.title}),t.jsx("div",{className:"text-xs text-[#666666] dark:text-[#A3A3A3] line-clamp-2",children:i.explain})]})},i.id))})})})]})};function tr(e){return t.jsx(Oe,{...e,viewBox:"0 0 16 16",children:t.jsxs("g",{id:"deading",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:[t.jsx("circle",{id:"椭圆形",stroke:"currentColor",strokeWidth:"1.25",cx:"8",cy:"3",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-2",stroke:"currentColor",strokeWidth:"1.25",cx:"3",cy:"5",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-4",stroke:"currentColor",strokeWidth:"1.25",cx:"13",cy:"5",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份",stroke:"currentColor",strokeWidth:"1.25",cx:"8",cy:"13",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-3",stroke:"currentColor",strokeWidth:"1.25",cx:"3",cy:"11",r:"1.375"}),t.jsx("circle",{id:"椭圆形备份-5",stroke:"currentColor",strokeWidth:"1.25",cx:"13",cy:"11",r:"1.375"}),t.jsx("path",{d:"M8.0070039,4.03345364 L8.0070039,8.50590493 L4.1923477,10.2855921",id:"路径-13",stroke:"currentColor",strokeWidth:"1.25"}),t.jsx("line",{x1:"11.7924093",y1:"8.47550067",x2:"8",y2:"10.2754456",id:"路径-13备份",stroke:"currentColor",strokeWidth:"1.25",transform:"translate(9.8962, 9.3755) scale(-1, 1) translate(-9.8962, -9.3755)"}),t.jsx("path",{d:"M4.17568738,4.53038288 L6.65384701,3.54050563 M9.35480875,3.53987819 L11.7283558,4.49062879",id:"形状",stroke:"currentColor",strokeWidth:"1.25"}),t.jsx("line",{x1:"3",y1:"6.06946104",x2:"3",y2:"9.97988046",id:"路径-14",stroke:"currentColor",strokeWidth:"1.25"}),t.jsx("line",{x1:"13",y1:"6.06946104",x2:"13",y2:"9.97988046",id:"路径-14备份",stroke:"currentColor",strokeWidth:"1.25"})]})})}const rr=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=oe.useTranslation(),[a,d]=h.useState(!1),[c,f]=h.useState([]),[i,m]=h.useState("");return h.useEffect(()=>{e?.description&&m(e?.description)},[e?.description]),h.useEffect(()=>{if(s?.message_chunk)try{if(s.message_chunk.includes("&")){const u=s.message_chunk.split("&").filter(Boolean);f(u)}else f([s.message_chunk])}catch(u){console.error("Failed to parse query data:",u)}},[s?.message_chunk]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(u=>!u),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(A.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o(`assistant.message.steps.${s?.chunk_type||e?.type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(tr,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o(`assistant.message.steps.${s?.chunk_type||e?.type}`,{count:Number(c.length)})})]}),a?t.jsx(A.ChevronUp,{className:"w-4 h-4"}):t.jsx(A.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:t.jsxs("div",{className:"mb-4 space-y-3 text-xs",children:[c?.map(u=>t.jsx("div",{className:"flex flex-col gap-2",children:t.jsxs("div",{className:"text-xs text-[#999999] dark:text-[#808080]",children:["- ",u]})},u)),i?.split(`
31
+ `).map((u,v)=>u.trim()&&t.jsx("p",{className:"text-sm",children:u},v))]})})})]})},sr=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=oe.useTranslation(),[a,d]=h.useState(!0),[c,f]=h.useState("");return h.useEffect(()=>{e?.description&&f(e?.description)},[e?.description]),h.useEffect(()=>{s?.message_chunk&&f(s?.message_chunk)},[s?.message_chunk,c]),!s&&!e?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>d(i=>!i),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[n?t.jsxs(t.Fragment,{children:[t.jsx(A.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:o(`assistant.message.steps.${s?.chunk_type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(A.Brain,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:o("assistant.message.steps.thoughtTime")})]}),a?t.jsx(A.ChevronUp,{className:"w-4 h-4"}):t.jsx(A.ChevronDown,{className:"w-4 h-4"})]}),a&&t.jsx("div",{className:"pl-2 border-l-2 border-[#e5e5e5] dark:border-[#4e4e56]",children:t.jsx("div",{className:"text-[#8b8b8b] dark:text-[#a6a6a6] space-y-2",children:c?.split(`
32
+ `).map((i,m)=>i.trim()&&t.jsx("p",{className:"text-sm",children:i},m))})})]})},nr=ze.create(e=>({synthesizeItem:null,setSynthesizeItem:s=>e({synthesizeItem:s}),uploadAttachments:[],setUploadAttachments:s=>e({uploadAttachments:s})})),or=["timedout","error"],ar=({id:e,content:s,question:n,actionClassName:o,actionIconSize:a,copyButtonId:d,onResend:c})=>{const[f,i]=h.useState(!1),[m,u]=h.useState(!1),[v,b]=h.useState(!1),[E,L]=h.useState(!1),[B,C]=h.useState(!1),y=or.includes(e),{synthesizeItem:P,setSynthesizeItem:Q}=nr(),ee=async()=>{try{await rt(s),i(!0);const z=setTimeout(()=>{i(!1),clearTimeout(z)},2e3)}catch(z){console.error("copy error:",z)}},te=()=>{u(!m),b(!1)},H=()=>{b(!v),u(!1)},ne=async()=>Q({id:e,content:s}),w=()=>{if(c){C(!0),c();const z=setTimeout(()=>{C(!1),clearTimeout(z)},1e3)}};return t.jsxs("div",{className:ie("flex items-center gap-1 mt-2",o),children:[!y&&t.jsx("button",{id:d,onClick:ee,className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors",children:f?t.jsx(A.Check,{className:"w-4 h-4 text-[#38C200] dark:text-[#38C200]",style:{width:a,height:a}}):t.jsx(A.Copy,{className:"w-4 h-4 text-[#666666] dark:text-[#A3A3A3]",style:{width:a,height:a}})}),!y&&t.jsx("button",{onClick:te,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${m?"animate-shake":""}`,children:t.jsx(A.ThumbsUp,{className:`w-4 h-4 ${m?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})}),!y&&t.jsx("button",{onClick:H,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${v?"animate-shake":""}`,children:t.jsx(A.ThumbsDown,{className:`w-4 h-4 ${v?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})}),!y&&t.jsx(t.Fragment,{children:t.jsx("button",{onClick:ne,className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors",children:t.jsx(A.Volume2,{className:`w-4 h-4 ${E||P?.id===e?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})})}),n&&t.jsx("button",{onClick:w,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${B?"animate-spin":""}`,children:t.jsx(A.RotateCcw,{className:`w-4 h-4 ${B?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})})]})};function ir({suggestions:e,onSelect:s}){return!e||e.length===0?null:t.jsx("div",{className:"mt-4 flex flex-col gap-2",children:e.map((n,o)=>t.jsxs("button",{onClick:()=>s(n),className:"text-left inline-flex items-center px-3 py-1.5 rounded-full bg-white dark:bg-[#202126] border border-[#E4E5EF] dark:border-[#272626] text-sm text-[#666666] dark:text-[#A3A3A3] hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors w-fit max-w-full break-words whitespace-pre-wrap",children:[t.jsx("span",{className:"break-all",children:n}),t.jsx(A.MoveRight,{className:"w-3 h-3 ml-1.5 shrink-0"})]},o))})}const lr=({textToCopy:e})=>{const[s,n]=h.useState(!1),o=async()=>{try{await rt(e),n(!0);const a=setTimeout(()=>{n(!1),clearTimeout(a)},2e3)}catch(a){console.error("copy error:",a)}};return t.jsx("button",{className:"p-1 bg-gray-200 dark:bg-gray-700 rounded",onClick:o,children:s?t.jsx(A.Check,{className:"w-4 h-4 text-[#38C200] dark:text-[#38C200]"}):t.jsx(A.Copy,{className:"w-4 h-4 text-gray-600 dark:text-gray-300"})})},st={commands:async(e,s)=>(console.log(`Mock command: ${e}`,s),{hits:{hits:[]}}),invokeBackend:async(e,s)=>{console.log(`Mock invokeBackend: ${e}`,s)}},We=ze.create(e=>({currentAssistant:{},assistantList:[],currentService:{id:"mock-service-id"},setAssistant:s=>e({currentAssistant:s})})),nt=$e.forwardRef(({className:e,...s},n)=>t.jsx("div",{ref:n,className:ie("relative inline-block",e),...s}));nt.displayName="Popover";const ot=$e.forwardRef(({className:e,...s},n)=>t.jsx("div",{ref:n,className:ie("inline-block cursor-pointer",e),...s}));ot.displayName="PopoverTrigger";const at=$e.forwardRef(({className:e,side:s="bottom",...n},o)=>t.jsx("div",{ref:o,className:ie("absolute z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",{"bottom-full mb-2":s==="top","top-full mt-2":s==="bottom","right-full mr-2":s==="left","left-full ml-2":s==="right"},e),...n}));at.displayName="PopoverContent";const cr=e=>{const{content:s,children:n,className:o}=e,[a,{setTrue:d,setFalse:c}]=Qe.useBoolean(!1);return t.jsxs(nt,{children:[t.jsx(ot,{onMouseOver:d,onMouseOut:c,children:n}),t.jsx(at,{side:"top",className:ie("z-1000 p-2 rounded-md text-xs text-white bg-black/75 hidden",{block:a},o),children:s})]})},it=({name:e,className:s,style:n,...o})=>t.jsx("svg",{className:`icon dark:drop-shadow-[0_0_6px_rgb(255,255,255)] ${s||""}`,style:n,...o,children:t.jsx("use",{xlinkHref:`#${e}`})}),dr=(e,s)=>{const n=new Array(e.length+s.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<s.length;o++)n[e.length+o]=s[o];return n},ur=(e,s)=>({classGroupId:e,validator:s}),lt=(e=new Map,s=null,n)=>({nextPart:e,validators:s,classGroupId:n}),Fe="-",ct=[],fr="arbitrary..",mr=e=>{const s=hr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return pr(c);const f=c.split(Fe),i=f[0]===""&&f.length>1?1:0;return dt(f,i,s)},getConflictingClassGroupIds:(c,f)=>{if(f){const i=o[c],m=n[c];return i?m?dr(m,i):i:m||ct}return n[c]||ct}}},dt=(e,s,n)=>{if(e.length-s===0)return n.classGroupId;const a=e[s],d=n.nextPart.get(a);if(d){const m=dt(e,s+1,d);if(m)return m}const c=n.validators;if(c===null)return;const f=s===0?e.join(Fe):e.slice(s).join(Fe),i=c.length;for(let m=0;m<i;m++){const u=c[m];if(u.validator(f))return u.classGroupId}},pr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=e.slice(1,-1),n=s.indexOf(":"),o=s.slice(0,n);return o?fr+o:void 0})(),hr=e=>{const{theme:s,classGroups:n}=e;return gr(n,s)},gr=(e,s)=>{const n=lt();for(const o in e){const a=e[o];De(a,n,o,s)}return n},De=(e,s,n,o)=>{const a=e.length;for(let d=0;d<a;d++){const c=e[d];xr(c,s,n,o)}},xr=(e,s,n,o)=>{if(typeof e=="string"){br(e,s,n);return}if(typeof e=="function"){kr(e,s,n,o);return}yr(e,s,n,o)},br=(e,s,n)=>{const o=e===""?s:ut(s,e);o.classGroupId=n},kr=(e,s,n,o)=>{if(vr(e)){De(e(o),s,n,o);return}s.validators===null&&(s.validators=[]),s.validators.push(ur(n,e))},yr=(e,s,n,o)=>{const a=Object.entries(e),d=a.length;for(let c=0;c<d;c++){const[f,i]=a[c];De(i,ut(s,f),n,o)}},ut=(e,s)=>{let n=e;const o=s.split(Fe),a=o.length;for(let d=0;d<a;d++){const c=o[d];let f=n.nextPart.get(c);f||(f=lt(),n.nextPart.set(c,f)),n=f}return n},vr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,wr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let s=0,n=Object.create(null),o=Object.create(null);const a=(d,c)=>{n[d]=c,s++,s>e&&(s=0,o=n,n=Object.create(null))};return{get(d){let c=n[d];if(c!==void 0)return c;if((c=o[d])!==void 0)return a(d,c),c},set(d,c){d in n?n[d]=c:a(d,c)}}},Be="!",ft=":",jr=[],mt=(e,s,n,o,a)=>({modifiers:e,hasImportantModifier:s,baseClassName:n,maybePostfixModifierPosition:o,isExternal:a}),_r=e=>{const{prefix:s,experimentalParseClassName:n}=e;let o=a=>{const d=[];let c=0,f=0,i=0,m;const u=a.length;for(let B=0;B<u;B++){const C=a[B];if(c===0&&f===0){if(C===ft){d.push(a.slice(i,B)),i=B+1;continue}if(C==="/"){m=B;continue}}C==="["?c++:C==="]"?c--:C==="("?f++:C===")"&&f--}const v=d.length===0?a:a.slice(i);let b=v,E=!1;v.endsWith(Be)?(b=v.slice(0,-1),E=!0):v.startsWith(Be)&&(b=v.slice(1),E=!0);const L=m&&m>i?m-i:void 0;return mt(d,E,b,L)};if(s){const a=s+ft,d=o;o=c=>c.startsWith(a)?d(c.slice(a.length)):mt(jr,!1,c,void 0,!0)}if(n){const a=o;o=d=>n({className:d,parseClassName:a})}return o},Cr=e=>{const s=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{s.set(n,1e6+o)}),n=>{const o=[];let a=[];for(let d=0;d<n.length;d++){const c=n[d],f=c[0]==="[",i=s.has(c);f||i?(a.length>0&&(a.sort(),o.push(...a),a=[]),o.push(c)):a.push(c)}return a.length>0&&(a.sort(),o.push(...a)),o}},Nr=e=>({cache:wr(e.cacheSize),parseClassName:_r(e),sortModifiers:Cr(e),...mr(e)}),Er=/\s+/,Sr=(e,s)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:a,sortModifiers:d}=s,c=[],f=e.trim().split(Er);let i="";for(let m=f.length-1;m>=0;m-=1){const u=f[m],{isExternal:v,modifiers:b,hasImportantModifier:E,baseClassName:L,maybePostfixModifierPosition:B}=n(u);if(v){i=u+(i.length>0?" "+i:i);continue}let C=!!B,y=o(C?L.substring(0,B):L);if(!y){if(!C){i=u+(i.length>0?" "+i:i);continue}if(y=o(L),!y){i=u+(i.length>0?" "+i:i);continue}C=!1}const P=b.length===0?"":b.length===1?b[0]:d(b).join(":"),Q=E?P+Be:P,ee=Q+y;if(c.indexOf(ee)>-1)continue;c.push(ee);const te=a(y,C);for(let H=0;H<te.length;++H){const ne=te[H];c.push(Q+ne)}i=u+(i.length>0?" "+i:i)}return i},Tr=(...e)=>{let s=0,n,o,a="";for(;s<e.length;)(n=e[s++])&&(o=pt(n))&&(a&&(a+=" "),a+=o);return a},pt=e=>{if(typeof e=="string")return e;let s,n="";for(let o=0;o<e.length;o++)e[o]&&(s=pt(e[o]))&&(n&&(n+=" "),n+=s);return n},Ar=(e,...s)=>{let n,o,a,d;const c=i=>{const m=s.reduce((u,v)=>v(u),e());return n=Nr(m),o=n.cache.get,a=n.cache.set,d=f,f(i)},f=i=>{const m=o(i);if(m)return m;const u=Sr(i,n);return a(i,u),u};return d=c,(...i)=>d(Tr(...i))},Or=[],D=e=>{const s=n=>n[e]||Or;return s.isThemeGetter=!0,s},ht=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fr=/^\d+\/\d+$/,Pr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ir=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Lr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Rr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ye=e=>Fr.test(e),N=e=>!!e&&!Number.isNaN(Number(e)),fe=e=>!!e&&Number.isInteger(Number(e)),Ue=e=>e.endsWith("%")&&N(e.slice(0,-1)),le=e=>Pr.test(e),zr=()=>!0,$r=e=>Ir.test(e)&&!Lr.test(e),xt=()=>!1,Wr=e=>Mr.test(e),Dr=e=>Rr.test(e),Br=e=>!g(e)&&!x(e),Ur=e=>ve(e,wt,xt),g=e=>ht.test(e),ge=e=>ve(e,jt,$r),Ve=e=>ve(e,Jr,N),bt=e=>ve(e,yt,xt),Vr=e=>ve(e,vt,Dr),Pe=e=>ve(e,_t,Wr),x=e=>gt.test(e),Ee=e=>we(e,jt),Gr=e=>we(e,Xr),kt=e=>we(e,yt),qr=e=>we(e,wt),Yr=e=>we(e,vt),Ie=e=>we(e,_t,!0),ve=(e,s,n)=>{const o=ht.exec(e);return o?o[1]?s(o[1]):n(o[2]):!1},we=(e,s,n=!1)=>{const o=gt.exec(e);return o?o[1]?s(o[1]):n:!1},yt=e=>e==="position"||e==="percentage",vt=e=>e==="image"||e==="url",wt=e=>e==="length"||e==="size"||e==="bg-size",jt=e=>e==="length",Jr=e=>e==="number",Xr=e=>e==="family-name",_t=e=>e==="shadow",Kr=Ar(()=>{const e=D("color"),s=D("font"),n=D("text"),o=D("font-weight"),a=D("tracking"),d=D("leading"),c=D("breakpoint"),f=D("container"),i=D("spacing"),m=D("radius"),u=D("shadow"),v=D("inset-shadow"),b=D("text-shadow"),E=D("drop-shadow"),L=D("blur"),B=D("perspective"),C=D("aspect"),y=D("ease"),P=D("animate"),Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],te=()=>[...ee(),x,g],H=()=>["auto","hidden","clip","visible","scroll"],ne=()=>["auto","contain","none"],w=()=>[x,g,i],z=()=>[ye,"full","auto",...w()],me=()=>[fe,"none","subgrid",x,g],Z=()=>["auto",{span:["full",fe,x,g]},fe,x,g],ce=()=>[fe,"auto",x,g],U=()=>["auto","min","max","fr",x,g],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...w()],J=()=>[ye,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],k=()=>[e,x,g],ae=()=>[...ee(),kt,bt,{position:[x,g]}],xe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",qr,Ur,{size:[x,g]}],de=()=>[Ue,Ee,ge],$=()=>["","none","full",m,x,g],G=()=>["",N,Ee,ge],pe=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>[N,Ue,kt,bt],j=()=>["","none",L,x,g],X=()=>["none",N,x,g],ue=()=>["none",N,x,g],Se=()=>[N,x,g],be=()=>[ye,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[le],breakpoint:[le],color:[zr],container:[le],"drop-shadow":[le],ease:["in","out","in-out"],font:[Br],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[le],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[le],shadow:[le],spacing:["px",N],text:[le],"text-shadow":[le],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ye,g,x,C]}],container:["container"],columns:[{columns:[N,g,x,f]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:te()}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:ne()}],"overscroll-x":[{"overscroll-x":ne()}],"overscroll-y":[{"overscroll-y":ne()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[fe,"auto",x,g]}],basis:[{basis:[ye,"full","auto",f,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[N,ye,"auto","initial","none",g]}],grow:[{grow:["",N,x,g]}],shrink:[{shrink:["",N,x,g]}],order:[{order:[fe,"first","last","none",x,g]}],"grid-cols":[{"grid-cols":me()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":ce()}],"col-end":[{"col-end":ce()}],"grid-rows":[{"grid-rows":me()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":ce()}],"row-end":[{"row-end":ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],w:[{w:[f,"screen",...J()]}],"min-w":[{"min-w":[f,"screen","none",...J()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",n,Ee,ge]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,x,Ve]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ue,g]}],"font-family":[{font:[Gr,g,s]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,x,g]}],"line-clamp":[{"line-clamp":[N,"none",x,Ve]}],leading:[{leading:[d,...w()]}],"list-image":[{"list-image":["none",x,g]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",x,g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[N,"from-font","auto",x,ge]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[N,"auto",x,g]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",x,g]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",x,g]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:xe()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},fe,x,g],radial:["",x,g],conic:[fe,x,g]},Yr,Vr]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:de()}],"gradient-via-pos":[{via:de()}],"gradient-to-pos":[{to:de()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...pe(),"hidden","none"]}],"divide-style":[{divide:[...pe(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[N,x,g]}],"outline-w":[{outline:["",N,Ee,ge]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",u,Ie,Pe]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",v,Ie,Pe]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[N,ge]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",b,Ie,Pe]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[N,x,g]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[N]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[x,g]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":ee()}],"mask-image-conic-pos":[{"mask-conic":[N]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:xe()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",x,g]}],filter:[{filter:["","none",x,g]}],blur:[{blur:j()}],brightness:[{brightness:[N,x,g]}],contrast:[{contrast:[N,x,g]}],"drop-shadow":[{"drop-shadow":["","none",E,Ie,Pe]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",N,x,g]}],"hue-rotate":[{"hue-rotate":[N,x,g]}],invert:[{invert:["",N,x,g]}],saturate:[{saturate:[N,x,g]}],sepia:[{sepia:["",N,x,g]}],"backdrop-filter":[{"backdrop-filter":["","none",x,g]}],"backdrop-blur":[{"backdrop-blur":j()}],"backdrop-brightness":[{"backdrop-brightness":[N,x,g]}],"backdrop-contrast":[{"backdrop-contrast":[N,x,g]}],"backdrop-grayscale":[{"backdrop-grayscale":["",N,x,g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[N,x,g]}],"backdrop-invert":[{"backdrop-invert":["",N,x,g]}],"backdrop-opacity":[{"backdrop-opacity":[N,x,g]}],"backdrop-saturate":[{"backdrop-saturate":[N,x,g]}],"backdrop-sepia":[{"backdrop-sepia":["",N,x,g]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",x,g]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[N,"initial",x,g]}],ease:[{ease:["linear","initial",y,x,g]}],delay:[{delay:[N,x,g]}],animate:[{animate:["none",P,x,g]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[B,x,g]}],"perspective-origin":[{"perspective-origin":te()}],rotate:[{rotate:X()}],"rotate-x":[{"rotate-x":X()}],"rotate-y":[{"rotate-y":X()}],"rotate-z":[{"rotate-z":X()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[x,g,"","none","gpu","cpu"]}],"transform-origin":[{origin:te()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",x,g]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",x,g]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[N,Ee,ge,Ve]}],stroke:[{stroke:["none",...k()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}),Qr=e=>{const{path:s,className:n}=e,[o,a]=h.useState("");return h.useEffect(()=>{st.invokeBackend("get_file_icon",{path:s}).then(d=>{d&&a(d)})},[s]),t.jsx(it,{name:o,className:Kr("min-w-8 h-8",n)})},Hr=e=>{const{id:s,name:n,path:o,extname:a,size:d,uploaded:c,attachmentId:f,uploadFailed:i,failedMessage:m,deletable:u,onDelete:v}=e,{t:b}=oe.useTranslation();return t.jsx("div",{className:"w-1/3 px-1",children:t.jsxs("div",{className:"relative group flex items-center gap-1 p-1 rounded-[4px] bg-[#dedede] dark:bg-[#202126]",children:[(i||f)&&u&&t.jsx("div",{className:"absolute flex justify-center items-center size-[14px] bg-red-600 top-0 right-0 rounded-full cursor-pointer translate-x-[5px] -translate-y-[5px] transition opacity-0 group-hover:opacity-100 ",onClick:()=>{v?.(s)},children:t.jsx(A.X,{className:"size-[10px] text-white"})}),t.jsx(Qr,{path:o}),t.jsxs("div",{className:"flex flex-col justify-between overflow-hidden",children:[t.jsx("div",{className:"truncate text-sm text-[#333333] dark:text-[#D8D8D8]",children:n}),t.jsx("div",{className:"text-xs",children:i&&m?t.jsx(cr,{content:m,children:t.jsx("span",{className:"text-red-500",children:"Upload Failed"})}):t.jsx("div",{className:"text-[#999]",children:c?t.jsxs("div",{className:"flex gap-2",children:[a&&t.jsx("span",{children:a}),t.jsx("span",{children:Kt(d)})]}):t.jsx("span",{children:b("assistant.fileList.uploading")})})})]})]})},s)},Zr=ze.create(()=>({addError:e=>console.error(e)})),es=e=>{const{message:s,attachments:n}=e,[o,a]=h.useState(!1),{currentService:d}=We(),[c,f]=h.useState([]),{addError:i}=Zr(),m=u=>{if(typeof window<"u"&&typeof document<"u"){const v=window.getSelection(),b=document.createRange();if(u.currentTarget&&v&&b)try{b.selectNodeContents(u.currentTarget),v.removeAllRanges(),v.addRange(b)}catch(E){console.error("Selection failed:",E)}}};return Qe.useAsyncEffect(async()=>{try{if(n.length===0)return;const u=await st.commands("get_attachment_by_ids",{serverId:d.id,attachments:n});f(u?.hits?.hits)}catch(u){i(String(u))}},[n]),t.jsxs(t.Fragment,{children:[s&&t.jsxs("div",{className:"flex gap-1 items-center justify-end",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[t.jsx("div",{className:ie("size-6 transition",{"opacity-0":!o}),children:t.jsx(lr,{textToCopy:s})}),t.jsx("div",{className:"max-w-[85%] overflow-auto text-left px-3 py-2 bg-white dark:bg-[#202126] rounded-xl border border-black/12 dark:border-black/15 font-normal text-sm text-[#333333] dark:text-[#D8D8D8] cursor-pointer user-select-text whitespace-pre-wrap",onDoubleClick:m,children:s})]}),c&&t.jsx("div",{className:ie("flex justify-end flex-wrap gap-y-2 w-full",{"mt-3":s}),children:c.map(u=>{const{id:v,name:b,size:E,icon:L}=u._source;return h.createElement(Hr,{...u._source,key:v,uploading:!1,uploaded:!0,id:v,extname:L,attachmentId:v,name:b,path:b,size:E,deletable:!1})})})]})};function ts(){const[e,s]=h.useState(),[n,o]=h.useState(),[a,d]=h.useState(),[c,f]=h.useState(),[i,m]=h.useState(),[u,v]=h.useState(),[b,E]=h.useState(),L={deal_query_intent:h.useCallback(C=>{s(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_tools:h.useCallback(C=>{o(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_fetch_source:h.useCallback(C=>{d(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_pick_source:h.useCallback(C=>{f(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_deep_read:h.useCallback(C=>{m(y=>y?{...y,message_chunk:(y.message_chunk||"")+"&"+(C.message_chunk||"")}:C)},[]),deal_think:h.useCallback(C=>{v(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_response:h.useCallback(C=>{E(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[])};return{data:{query_intent:e,tools:n,fetch_source:a,pick_source:c,deep_read:i,think:u,response:b},handlers:L,clearAllChunkData:()=>new Promise(C=>{s(void 0),o(void 0),d(void 0),f(void 0),m(void 0),v(void 0),E(void 0),setTimeout(C,0)})}}function rs(e){if(e)return e==="light"?"light":e==="dark"||typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const ss=h.memo(h.forwardRef(function({message:s,isTyping:n,onResend:o,hide_assistant:a=!1,rootClassName:d,actionClassName:c,actionIconSize:f,copyButtonId:i,formatUrl:m,theme:u,locale:v},b){const{t:E,i18n:L}=oe.useTranslation(),B=rs(u),C=We(j=>j.currentAssistant),y=We(j=>j.assistantList),[P,Q]=h.useState({}),{data:{query_intent:ee,tools:te,fetch_source:H,pick_source:ne,deep_read:w,think:z,response:me},handlers:Z,clearAllChunkData:ce}=ts(),[U,Y]=h.useState({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),V=h.useRef(!1);h.useImperativeHandle(b,()=>({addChunk:j=>{if(Y(()=>({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1,[j.chunk_type||""]:!0})),j.chunk_type==="query_intent")Z.deal_query_intent(j);else if(j.chunk_type==="tools")Z.deal_tools(j);else if(j.chunk_type==="fetch_source")Z.deal_fetch_source(j);else if(j.chunk_type==="pick_source")Z.deal_pick_source(j);else if(j.chunk_type==="deep_read")Z.deal_deep_read(j);else if(j.chunk_type==="think")Z.deal_think(j);else if(j.chunk_type==="response"){const X=j.message_chunk;if(typeof X=="string"){if(X.includes("<think>")||X.includes("<think>")){V.current=!0;return}else if(X.includes("</think>")||X.includes("</think>")){V.current=!1;return}V.current?Z.deal_think({...j,chunk_type:"think"}):Z.deal_response(j)}}},reset:()=>{ce(),Y({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),V.current=!1}}));const M=s?._source?.type==="assistant",J=s?._source?.assistant_id,k=s?._source?.assistant_item;h.useEffect(()=>{v&&L.language!==v&&L.changeLanguage(v)},[v,L]),h.useEffect(()=>{if(k){Q(k);return}if(M&&J&&Array.isArray(y)){Q(y.find(j=>j._id===J)??{});return}Q(C)},[M,k,J,y,C]);const ae=s?._source?.message||"",xe=s?._source?.attachments??[],re=s?._source?.details||[],de=s?._source?.question||"",$=n===!1&&(ae||me?.message_chunk),[G,pe]=h.useState([]),he=j=>{pe(j)},I=()=>M?t.jsxs(t.Fragment,{children:[t.jsx(Yt,{Detail:re.find(j=>j.type==="query_intent"),ChunkData:ee,getSuggestion:he,loading:U?.query_intent}),t.jsx(Jt,{Detail:re.find(j=>j.type==="tools"),ChunkData:te,loading:U?.tools}),t.jsx(Ht,{Detail:re.find(j=>j.type==="fetch_source"),ChunkData:H,loading:U?.fetch_source,formatUrl:m}),t.jsx(er,{Detail:re.find(j=>j.type==="pick_source"),ChunkData:ne,loading:U?.pick_source}),t.jsx(rr,{Detail:re.find(j=>j.type==="deep_read"),ChunkData:w,loading:U?.deep_read}),t.jsx(sr,{Detail:re.find(j=>j.type==="think"),ChunkData:z,loading:U?.think}),t.jsx(Ke.XMarkdown,{content:ae||me?.message_chunk||""}),n&&t.jsx("div",{className:"inline-block w-1.5 h-5 ml-0.5 -mb-0.5 bg-[#666666] dark:bg-[#A3A3A3] rounded-sm animate-typing"}),$&&t.jsx(ar,{id:s._id??"",content:ae||me?.message_chunk||"",question:de,actionClassName:c,actionIconSize:f,copyButtonId:i,onResend:()=>{o&&o(de)}}),!n&&t.jsx(ir,{suggestions:G,onSelect:j=>o&&o(j)})]}):t.jsx(es,{message:ae,attachments:xe});return t.jsx("div",{className:ie("w-full py-8 flex",[M?"justify-start":"justify-end"],B==="dark"&&"dark",d),children:t.jsx("div",{className:`w-full px-4 flex gap-4 ${M?"w-full":"flex-row-reverse"}`,children:t.jsxs("div",{className:`w-full space-y-2 ${M?"text-left":"text-right"}`,children:[!a&&t.jsxs("div",{className:"w-full flex items-center gap-1 font-semibold text-sm text-[#333] dark:text-[#d8d8d8]",children:[M?t.jsx("div",{className:"w-6 h-6 flex justify-center items-center rounded-full bg-white border border-[#E6E6E6]",children:P?._source?.icon?.startsWith("font_")?t.jsx(it,{name:P._source.icon,className:"w-4 h-4"}):t.jsx("img",{src:Gt,className:"w-4 h-4",alt:E("assistant.message.logo")})}):null,M?P?._source?.name||"Coco AI":""]}),t.jsx("div",{className:"w-full prose dark:prose-invert prose-sm max-w-none",children:t.jsx("div",{className:"w-full pl-7 text-[#333] dark:text-[#d8d8d8] leading-relaxed",children:I()})})]})})})})),ns=h.memo(h.forwardRef((e,s)=>t.jsx(oe.I18nextProvider,{i18n:tt,children:t.jsx(ss,{...e,ref:s})})));return Re.ChatMessage=ns,Object.defineProperty(Re,Symbol.toStringTag,{value:"Module"}),Re})({},React,ReactI18next,clsx,i18n,LucideReact,xMarkdown,zustand,ahooks);