@infinilabs/chat-message 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -23
- package/dist/ChatMessage.cjs +12 -12
- package/dist/ChatMessage.iife.js +12 -12
- package/dist/ChatMessage.js +951 -3759
- package/dist/ChatMessage.umd.cjs +12 -12
- package/dist/components/SessionFiles/components/Icon.d.ts +3 -0
- package/dist/components/SessionFiles/index.d.ts +2 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/utils/platformAdapter.d.ts +8 -1
- package/package.json +8 -1
package/dist/ChatMessage.iife.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ChatMessage=(function(
|
|
1
|
+
var ChatMessage=(function(je,a,B,re,$e,E,Oe,_e,et,tt){"use strict";var xe={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var ChatMessage=(function(Re,h,oe,ie,$t,A,Ke,ze,Qe){"use strict";function Wt(e){
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Pe;function st(){if(Pe)return ne;Pe=1;var r=a,n=Symbol.for("react.element"),u=Symbol.for("react.fragment"),f=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function y(p,c,g){var i,j={},m=null,b=null;g!==void 0&&(m=""+g),c.key!==void 0&&(m=""+c.key),c.ref!==void 0&&(b=c.ref);for(i in c)f.call(c,i)&&!_.hasOwnProperty(i)&&(j[i]=c[i]);if(p&&p.defaultProps)for(i in c=p.defaultProps,c)j[i]===void 0&&(j[i]=c[i]);return{$$typeof:n,type:p,key:m,ref:b,props:j,_owner:l.current}}return ne.Fragment=u,ne.jsx=y,ne.jsxs=y,ne}var ae={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,19 +14,19 @@ var ChatMessage=(function(Re,h,oe,ie,$t,A,Ke,ze,Qe){"use strict";function Wt(e){
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var Le;function rt(){return Le||(Le=1,process.env.NODE_ENV!=="production"&&(function(){var r=a,n=Symbol.for("react.element"),u=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),p=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),i=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),I=Symbol.iterator,Y="@@iterator";function w(e){if(e===null||typeof e!="object")return null;var s=I&&e[I]||e[Y];return typeof s=="function"?s:null}var x=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var s=arguments.length,o=new Array(s>1?s-1:0),d=1;d<s;d++)o[d-1]=arguments[d];oe("error",e,o)}}function oe(e,s,o){{var d=x.ReactDebugCurrentFrame,N=d.getStackAddendum();N!==""&&(s+="%s",o=o.concat([N]));var C=o.map(function(v){return String(v)});C.unshift("Warning: "+s),Function.prototype.apply.call(console[e],console,C)}}var ie=!1,G=!1,le=!1,Z=!1,Q=!1,P;P=Symbol.for("react.module.reference");function ce(e){return!!(typeof e=="string"||typeof e=="function"||e===f||e===_||Q||e===l||e===g||e===i||Z||e===b||ie||G||le||typeof e=="object"&&e!==null&&(e.$$typeof===m||e.$$typeof===j||e.$$typeof===y||e.$$typeof===p||e.$$typeof===c||e.$$typeof===P||e.getModuleId!==void 0))}function we(e,s,o){var d=e.displayName;if(d)return d;var N=s.displayName||s.name||"";return N!==""?o+"("+N+")":o}function pe(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case f:return"Fragment";case u:return"Portal";case _:return"Profiler";case l:return"StrictMode";case g:return"Suspense";case i:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var s=e;return pe(s)+".Consumer";case y:var o=e;return pe(o._context)+".Provider";case c:return we(e,e.render,"ForwardRef");case j:var d=e.displayName||null;return d!==null?d:D(e.type)||"Memo";case m:{var N=e,C=N._payload,v=N._init;try{return D(v(C))}catch{return null}}}return null}var J=Object.assign,X=0,ge,q,F,ke,V,de,z;function W(){}W.__reactDisabledLog=!0;function ue(){{if(X===0){ge=console.log,q=console.info,F=console.warn,ke=console.error,V=console.group,de=console.groupCollapsed,z=console.groupEnd;var e={configurable:!0,enumerable:!0,value:W,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}X++}}function fe(){{if(X--,X===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},e,{value:ge}),info:J({},e,{value:q}),warn:J({},e,{value:F}),error:J({},e,{value:ke}),group:J({},e,{value:V}),groupCollapsed:J({},e,{value:de}),groupEnd:J({},e,{value:z})})}X<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=x.ReactCurrentDispatcher,he;function M(e,s,o){{if(he===void 0)try{throw Error()}catch(N){var d=N.stack.trim().match(/\n( *(at )?)/);he=d&&d[1]||""}return`
|
|
18
|
+
`+he+e}}var $=!1,ee;{var Ee=typeof WeakMap=="function"?WeakMap:Map;ee=new Ee}function ye(e,s){if(!e||$)return"";{var o=ee.get(e);if(o!==void 0)return o}var d;$=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var C;C=K.current,K.current=null,ue();try{if(s){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(O){d=O}Reflect.construct(e,[],v)}else{try{v.call()}catch(O){d=O}e.call(v.prototype)}}else{try{throw Error()}catch(O){d=O}e()}}catch(O){if(O&&d&&typeof O.stack=="string"){for(var k=O.stack.split(`
|
|
19
|
+
`),A=d.stack.split(`
|
|
20
|
+
`),T=k.length-1,R=A.length-1;T>=1&&R>=0&&k[T]!==A[R];)R--;for(;T>=1&&R>=0;T--,R--)if(k[T]!==A[R]){if(T!==1||R!==1)do if(T--,R--,R<0||k[T]!==A[R]){var L=`
|
|
21
|
+
`+k[T].replace(" at new "," at ");return e.displayName&&L.includes("<anonymous>")&&(L=L.replace("<anonymous>",e.displayName)),typeof e=="function"&&ee.set(e,L),L}while(T>=1&&R>=0);break}}}finally{$=!1,K.current=C,fe(),Error.prepareStackTrace=N}var se=e?e.displayName||e.name:"",H=se?M(se):"";return typeof e=="function"&&ee.set(e,H),H}function Ne(e,s,o){return ye(e,!1)}function Ce(e){var s=e.prototype;return!!(s&&s.isReactComponent)}function h(e,s,o){if(e==null)return"";if(typeof e=="function")return ye(e,Ce(e));if(typeof e=="string")return M(e);switch(e){case g:return M("Suspense");case i:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Ne(e.render);case j:return h(e.type,s,o);case m:{var d=e,N=d._payload,C=d._init;try{return h(C(N),s,o)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,Ue={},De=x.ReactDebugCurrentFrame;function ve(e){if(e){var s=e._owner,o=h(e.type,e._source,s?s.type:null);De.setExtraStackFrame(o)}else De.setExtraStackFrame(null)}function Ft(e,s,o,d,N){{var C=Function.call.bind(U);for(var v in e)if(C(e,v)){var k=void 0;try{if(typeof e[v]!="function"){var A=Error((d||"React class")+": "+o+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}k=e[v](s,v,d,o,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){k=T}k&&!(k instanceof Error)&&(ve(N),S("%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).",d||"React class",o,v,typeof k),ve(null)),k instanceof Error&&!(k.message in Ue)&&(Ue[k.message]=!0,ve(N),S("Failed %s type: %s",o,k.message),ve(null))}}}var At=Array.isArray;function Se(e){return At(e)}function Ot(e){{var s=typeof Symbol=="function"&&Symbol.toStringTag,o=s&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o}}function Pt(e){try{return Be(e),!1}catch{return!0}}function Be(e){return""+e}function Ye(e){if(Pt(e))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ot(e)),Be(e)}var Je=x.ReactCurrentOwner,Lt={key:!0,ref:!0,__self:!0,__source:!0},Ve,Ke;function It(e){if(U.call(e,"ref")){var s=Object.getOwnPropertyDescriptor(e,"ref").get;if(s&&s.isReactWarning)return!1}return e.ref!==void 0}function Wt(e){if(U.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function Mt(e,s){typeof e.ref=="string"&&Je.current}function Ut(e,s){{var o=function(){Ve||(Ve=!0,S("%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)",s))};o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}}function Dt(e,s){{var o=function(){Ke||(Ke=!0,S("%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)",s))};o.isReactWarning=!0,Object.defineProperty(e,"ref",{get:o,configurable:!0})}}var Bt=function(e,s,o,d,N,C,v){var k={$$typeof:n,type:e,key:s,ref:o,props:v,_owner:C};return k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(k,"_self",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.defineProperty(k,"_source",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k};function Yt(e,s,o,d,N){{var C,v={},k=null,A=null;o!==void 0&&(Ye(o),k=""+o),Wt(s)&&(Ye(s.key),k=""+s.key),It(s)&&(A=s.ref,Mt(s,N));for(C in s)U.call(s,C)&&!Lt.hasOwnProperty(C)&&(v[C]=s[C]);if(e&&e.defaultProps){var T=e.defaultProps;for(C in T)v[C]===void 0&&(v[C]=T[C])}if(k||A){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;k&&Ut(v,R),A&&Dt(v,R)}return Bt(e,k,A,N,d,Je.current,v)}}var Te=x.ReactCurrentOwner,Ge=x.ReactDebugCurrentFrame;function te(e){if(e){var s=e._owner,o=h(e.type,e._source,s?s.type:null);Ge.setExtraStackFrame(o)}else Ge.setExtraStackFrame(null)}var Re;Re=!1;function Fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Qe(){{if(Te.current){var e=D(Te.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function Jt(e){return""}var Xe={};function Vt(e){{var s=Qe();if(!s){var o=typeof e=="string"?e:e.displayName||e.name;o&&(s=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+o+">.")}return s}}function ze(e,s){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Vt(s);if(Xe[o])return;Xe[o]=!0;var d="";e&&e._owner&&e._owner!==Te.current&&(d=" It was passed a child from "+D(e._owner.type)+"."),te(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',o,d),te(null)}}function He(e,s){{if(typeof e!="object")return;if(Se(e))for(var o=0;o<e.length;o++){var d=e[o];Fe(d)&&ze(d,s)}else if(Fe(e))e._store&&(e._store.validated=!0);else if(e){var N=w(e);if(typeof N=="function"&&N!==e.entries)for(var C=N.call(e),v;!(v=C.next()).done;)Fe(v.value)&&ze(v.value,s)}}}function Kt(e){{var s=e.type;if(s==null||typeof s=="string")return;var o;if(typeof s=="function")o=s.propTypes;else if(typeof s=="object"&&(s.$$typeof===c||s.$$typeof===j))o=s.propTypes;else return;if(o){var d=D(s);Ft(o,e.props,"prop",d,e)}else if(s.PropTypes!==void 0&&!Re){Re=!0;var N=D(s);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",N||"Unknown")}typeof s.getDefaultProps=="function"&&!s.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Gt(e){{for(var s=Object.keys(e.props),o=0;o<s.length;o++){var d=s[o];if(d!=="children"&&d!=="key"){te(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),te(null);break}}e.ref!==null&&(te(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}}var Ze={};function qe(e,s,o,d,N,C){{var v=ce(e);if(!v){var k="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(k+=" 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 A=Jt();A?k+=A:k+=Qe();var T;e===null?T="null":Se(e)?T="array":e!==void 0&&e.$$typeof===n?(T="<"+(D(e.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,k)}var R=Yt(e,s,o,N,C);if(R==null)return R;if(v){var L=s.children;if(L!==void 0)if(d)if(Se(L)){for(var se=0;se<L.length;se++)He(L[se],e);Object.freeze&&Object.freeze(L)}else S("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 He(L,e)}if(U.call(s,"key")){var H=D(e),O=Object.keys(s).filter(function(qt){return qt!=="key"}),Ae=O.length>0?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}";if(!Ze[H+Ae]){var Zt=O.length>0?"{"+O.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
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((
|
|
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);
|
|
30
|
+
<%s key={someKey} {...props} />`,Ae,H,Zt,H),Ze[H+Ae]=!0}}return e===f?Gt(R):Kt(R),R}}function Qt(e,s,o){return qe(e,s,o,!0)}function Xt(e,s,o){return qe(e,s,o,!1)}var zt=Xt,Ht=Qt;ae.Fragment=f,ae.jsx=zt,ae.jsxs=Ht})()),ae}var Ie;function nt(){return Ie||(Ie=1,process.env.NODE_ENV==="production"?xe.exports=st():xe.exports=rt()),xe.exports}var t=nt();const at={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"}}},sessionFiles:{labels:{all:"All"},modal:{title:"Files in the conversation",description:"Only the selected files will participate in the current conversation."}}}},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:"信息查询"}}},sessionFiles:{labels:{all:"全部"},modal:{title:"会话中的文件",description:"只有选定的文件才会参与当前会话。"}}}}},We=$e.createInstance();We.use(B.initReactI18next).init({resources:at,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1},react:{useSuspense:!1}});const ot="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 me({size:r=18,children:n,className:u,title:f,onClick:l,action:_=!1,...y}){const p=c=>{l?.(c)};return t.jsx("i",{style:{width:r,height:r},title:f,onClick:p,className:re("inline-flex items-center justify-center rounded-sm p-[2px] transition-all",{"cursor-pointer":_},u),children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{width:"100%",height:"100%"},...y,children:n})})}function it(r){return t.jsx(me,{...r,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 lt=({Detail:r,ChunkData:n,getSuggestion:u,loading:f})=>{const{t:l}=B.useTranslation(),[_,y]=a.useState(!1),[p,c]=a.useState(null);return a.useEffect(()=>{r?.payload&&(c(r?.payload),r?.payload?.suggestion&&u&&u(r?.payload?.suggestion))},[r?.payload,u]),a.useEffect(()=>{if(n?.message_chunk&&!f)try{const i=n.message_chunk.replace(/^"|"$/g,"").match(/<JSON>([\s\S]*?)<\/JSON>/g);if(i){const m=i[i.length-1].replace(/<JSON>|<\/JSON>/g,""),b=JSON.parse(m);b?.suggestion&&u&&u(b?.suggestion),c(b)}}catch(g){console.error("Failed to process message chunk in QueryIntent:",g)}},[n?.message_chunk,f,u]),!n&&!r?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>y(g=>!g),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[f?t.jsxs(t.Fragment,{children:[t.jsx(E.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:l(`assistant.message.steps.${n?.chunk_type||r.type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(it,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:l(`assistant.message.steps.${n?.chunk_type||r.type}`)})]}),_?t.jsx(E.ChevronUp,{className:"w-4 h-4"}):t.jsx(E.ChevronDown,{className:"w-4 h-4"})]}),_&&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:[p?.keyword?t.jsxs("div",{className:"flex gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",l("assistant.message.steps.keywords"),":"]}),t.jsx("div",{className:"flex flex-wrap gap-1",children:p?.keyword?.map((g,i)=>t.jsxs("span",{className:"text-[#333333] dark:text-[#D8D8D8]",children:[g,i<2&&"、"]},g+i))})]}):null,p?.category?t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",l("assistant.message.steps.questionType"),":"]}),t.jsx("span",{className:"text-[#333333] dark:text-[#D8D8D8]",children:p?.category})]}):null,p?.intent?t.jsxs("div",{className:"flex items-start gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",l("assistant.message.steps.userIntent"),":"]}),t.jsx("div",{className:"flex-1 text-[#333333] dark:text-[#D8D8D8]",children:p?.intent})]}):null,p?.query?t.jsxs("div",{className:"flex items-start gap-1",children:[t.jsxs("span",{className:"text-[#999999]",children:["- ",l("assistant.message.steps.relatedQuestions"),":"]}),t.jsx("div",{className:"flex-1 flex flex-col text-[#333333] dark:text-[#D8D8D8]",children:p?.query?.map((g,i)=>t.jsxs("span",{children:["- ",g]},g+i))})]}):null]})})})]})},ct=({Detail:r,ChunkData:n,loading:u})=>{const{t:f}=B.useTranslation(),[l,_]=a.useState(!1),[y,p]=a.useState("");return a.useEffect(()=>{r?.description&&p(r?.description)},[r?.description]),a.useEffect(()=>{n?.message_chunk&&p(n?.message_chunk)},[n?.message_chunk,y]),!n&&!r?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>_(c=>!c),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[u?t.jsxs(t.Fragment,{children:[t.jsx(E.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:f(`assistant.message.steps.${n?.chunk_type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(E.Hammer,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:f(`assistant.message.steps.${n?.chunk_type}`)})]}),l?t.jsx(E.ChevronUp,{className:"w-4 h-4"}):t.jsx(E.ChevronDown,{className:"w-4 h-4"})]}),l&&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(Oe.XMarkdown,{content:y||""})})})]})},Me=async r=>{navigator.clipboard?await navigator.clipboard.writeText(r):console.log("Clipboard not available",r)},dt=r=>{window.open(r,"_blank")};function ut(r){return t.jsx(me,{...r,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 ft=({Detail:r,ChunkData:n,loading:u,formatUrl:f})=>{const{t:l}=B.useTranslation(),[_,y]=a.useState(!1),[p,c]=a.useState(0),[g,i]=a.useState([]);a.useEffect(()=>{r?.payload&&(i(r?.payload),c(r?.payload.length))},[r?.payload]),a.useEffect(()=>{if(n?.message_chunk&&!u)try{const m=n.message_chunk.match(/<Payload total=(\d+)>/);m&&c(Number(m[1]));const b=n.message_chunk.match(/\[([\s\S]*)\]/);if(b){const I=JSON.parse(b[0]);i(I)}}catch(m){console.error("Failed to parse fetch source data:",m)}},[n?.message_chunk,u]);const j=m=>()=>{const b=f&&f(m)||m.url;b&&dt(b)};return!n&&!r?null:t.jsxs("div",{className:`mt-2 mb-2 max-w-full w-full md:w-[610px] ${_?"rounded-lg overflow-hidden border border-[#E6E6E6] dark:border-[#272626]":""}`,children:[t.jsxs("button",{onClick:()=>y(m=>!m),className:`inline-flex justify-between items-center gap-2 px-2 py-1 rounded-xl transition-colors whitespace-nowrap ${_?"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(ut,{className:"w-4 h-4 text-[#38C200] shrink-0"}),t.jsx("span",{className:"text-xs text-[#999999]",children:l(`assistant.message.steps.${n?.chunk_type||r.type}`,{count:Number(p)})})]}),_?t.jsx(E.ChevronUp,{className:"w-4 h-4 text-[#999999]"}):t.jsx(E.ChevronDown,{className:"w-4 h-4 text-[#999999]"})]}),_&&t.jsx(t.Fragment,{children:g?.map((m,b)=>t.jsx("div",{onClick:j(m),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(E.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:m.title||m.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:m.source?.name||m?.category}),t.jsx(E.SquareArrowOutUpRight,{className:"w-3 h-3 text-[#999999] dark:text-[#999999] shrink-0"})]})]})},b))})]})};function ht(r){return t.jsx(me,{...r,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 xt=({Detail:r,ChunkData:n,loading:u})=>{const{t:f}=B.useTranslation(),[l,_]=a.useState(!1),[y,p]=a.useState([]);return a.useEffect(()=>{r?.payload&&p(r?.payload)},[r?.payload]),a.useEffect(()=>{if(n?.message_chunk&&!u)try{const g=n.message_chunk.replace(/^"|"$/g,"").match(/<JSON>([\s\S]*?)<\/JSON>/g);if(g)for(let i=g.length-1;i>=0;i--)try{const j=g[i].replace(/<JSON>|<\/JSON>|<think>|<\/think>/g,""),m=JSON.parse(j.trim());if(Array.isArray(m)&&m.every(b=>b.id&&b.title&&b.explain)){p(m);break}}catch{continue}}catch(c){console.error("Failed to parse pick source data:",c)}},[n?.message_chunk,u]),!n&&!r?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>_(c=>!c),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[u?t.jsxs(t.Fragment,{children:[t.jsx(E.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:f("assistant.message.steps.pick_source_start")})]}):t.jsxs(t.Fragment,{children:[t.jsx(ht,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:f(`assistant.message.steps.${n?.chunk_type||r.type}`,{count:y?.length})})]}),l?t.jsx(E.ChevronUp,{className:"w-4 h-4"}):t.jsx(E.ChevronDown,{className:"w-4 h-4"})]}),l&&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:y?.map(c=>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:c.title}),t.jsx("div",{className:"text-xs text-[#666666] dark:text-[#A3A3A3] line-clamp-2",children:c.explain})]})},c.id))})})})]})};function mt(r){return t.jsx(me,{...r,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 pt=({Detail:r,ChunkData:n,loading:u})=>{const{t:f}=B.useTranslation(),[l,_]=a.useState(!1),[y,p]=a.useState([]),[c,g]=a.useState("");return a.useEffect(()=>{r?.description&&g(r?.description)},[r?.description]),a.useEffect(()=>{if(n?.message_chunk)try{if(n.message_chunk.includes("&")){const i=n.message_chunk.split("&").filter(Boolean);p(i)}else p([n.message_chunk])}catch(i){console.error("Failed to parse query data:",i)}},[n?.message_chunk]),!n&&!r?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>_(i=>!i),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[u?t.jsxs(t.Fragment,{children:[t.jsx(E.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:f(`assistant.message.steps.${n?.chunk_type||r?.type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(mt,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:f(`assistant.message.steps.${n?.chunk_type||r?.type}`,{count:Number(y.length)})})]}),l?t.jsx(E.ChevronUp,{className:"w-4 h-4"}):t.jsx(E.ChevronDown,{className:"w-4 h-4"})]}),l&&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:[y?.map(i=>t.jsx("div",{className:"flex flex-col gap-2",children:t.jsxs("div",{className:"text-xs text-[#999999] dark:text-[#808080]",children:["- ",i]})},i)),c?.split(`
|
|
31
|
+
`).map((i,j)=>i.trim()&&t.jsx("p",{className:"text-sm",children:i},j))]})})})]})},gt=({Detail:r,ChunkData:n,loading:u})=>{const{t:f}=B.useTranslation(),[l,_]=a.useState(!0),[y,p]=a.useState("");return a.useEffect(()=>{r?.description&&p(r?.description)},[r?.description]),a.useEffect(()=>{n?.message_chunk&&p(n?.message_chunk)},[n?.message_chunk,y]),!n&&!r?null:t.jsxs("div",{className:"space-y-2 mb-3 w-full",children:[t.jsxs("button",{onClick:()=>_(c=>!c),className:"inline-flex items-center gap-2 px-2 py-1 rounded-xl transition-colors border border-[#E6E6E6] dark:border-[#272626]",children:[u?t.jsxs(t.Fragment,{children:[t.jsx(E.Loader,{className:"w-4 h-4 animate-spin text-[#1990FF]"}),t.jsx("span",{className:"text-xs text-[#999999] italic",children:f(`assistant.message.steps.${n?.chunk_type}`)})]}):t.jsxs(t.Fragment,{children:[t.jsx(E.Brain,{className:"w-4 h-4 text-[#38C200]"}),t.jsx("span",{className:"text-xs text-[#999999]",children:f("assistant.message.steps.thoughtTime")})]}),l?t.jsx(E.ChevronUp,{className:"w-4 h-4"}):t.jsx(E.ChevronDown,{className:"w-4 h-4"})]}),l&&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:y?.split(`
|
|
32
|
+
`).map((c,g)=>c.trim()&&t.jsx("p",{className:"text-sm",children:c},g))})})]})},kt=_e.create(r=>({synthesizeItem:null,setSynthesizeItem:n=>r({synthesizeItem:n}),uploadAttachments:[],setUploadAttachments:n=>r({uploadAttachments:n})})),yt=["timedout","error"],vt=({id:r,content:n,question:u,actionClassName:f,actionIconSize:l,copyButtonId:_,onResend:y})=>{const[p,c]=a.useState(!1),[g,i]=a.useState(!1),[j,m]=a.useState(!1),[b,I]=a.useState(!1),[Y,w]=a.useState(!1),x=yt.includes(r),{synthesizeItem:S,setSynthesizeItem:oe}=kt(),ie=async()=>{try{await Me(n),c(!0);const P=setTimeout(()=>{c(!1),clearTimeout(P)},2e3)}catch(P){console.error("copy error:",P)}},G=()=>{i(!g),m(!1)},le=()=>{m(!j),i(!1)},Z=async()=>oe({id:r,content:n}),Q=()=>{if(y){w(!0),y();const P=setTimeout(()=>{w(!1),clearTimeout(P)},1e3)}};return t.jsxs("div",{className:re("flex items-center gap-1 mt-2",f),children:[!x&&t.jsx("button",{id:_,onClick:ie,className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors",children:p?t.jsx(E.Check,{className:"w-4 h-4 text-[#38C200] dark:text-[#38C200]",style:{width:l,height:l}}):t.jsx(E.Copy,{className:"w-4 h-4 text-[#666666] dark:text-[#A3A3A3]",style:{width:l,height:l}})}),!x&&t.jsx("button",{onClick:G,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${g?"animate-shake":""}`,children:t.jsx(E.ThumbsUp,{className:`w-4 h-4 ${g?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:l,height:l}})}),!x&&t.jsx("button",{onClick:le,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${j?"animate-shake":""}`,children:t.jsx(E.ThumbsDown,{className:`w-4 h-4 ${j?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:l,height:l}})}),!x&&t.jsx(t.Fragment,{children:t.jsx("button",{onClick:Z,className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors",children:t.jsx(E.Volume2,{className:`w-4 h-4 ${b||S?.id===r?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:l,height:l}})})}),u&&t.jsx("button",{onClick:Q,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${Y?"animate-spin":""}`,children:t.jsx(E.RotateCcw,{className:`w-4 h-4 ${Y?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:l,height:l}})})]})};function jt({suggestions:r,onSelect:n}){return!r||r.length===0?null:t.jsx("div",{className:"mt-4 flex flex-col gap-2",children:r.map((u,f)=>t.jsxs("button",{onClick:()=>n(u),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:u}),t.jsx(E.MoveRight,{className:"w-3 h-3 ml-1.5 shrink-0"})]},f))})}const _t=({textToCopy:r})=>{const[n,u]=a.useState(!1),f=async()=>{try{await Me(r),u(!0);const l=setTimeout(()=>{u(!1),clearTimeout(l)},2e3)}catch(l){console.error("copy error:",l)}};return t.jsx("button",{className:"p-1 bg-gray-200 dark:bg-gray-700 rounded",onClick:f,children:n?t.jsx(E.Check,{className:"w-4 h-4 text-[#38C200] dark:text-[#38C200]"}):t.jsx(E.Copy,{className:"w-4 h-4 text-gray-600 dark:text-gray-300"})})},bt={commands:async(r,n)=>(console.log(`Mock command: ${r}`,n),r==="get_attachment_by_ids"?{hits:{hits:[{_source:{id:"1",name:"测试文件1.txt",icon:"txt",size:"4kb"}},{_source:{id:"2",name:"测试文件2.pdf",icon:"pdf",size:"982kb"}},{_source:{id:"3",name:"测试文件3.md",icon:"md",size:"12kb"}}]}}:{hits:{hits:[]}}),invokeBackend:async(r,n)=>{console.log(`Mock invokeBackend: ${r}`,n)}},be=_e.create(r=>({currentAssistant:{},assistantList:[],currentService:{id:"mock-service-id"},setAssistant:n=>r({currentAssistant:n})})),wt=_e.create(()=>({addError:r=>console.error(r)})),Et=r=>{const{message:n,attachments:u}=r,[f,l]=a.useState(!1),{currentService:_}=be(),[y,p]=a.useState([]),{addError:c}=wt(),g=i=>{if(typeof window<"u"&&typeof document<"u"){const j=window.getSelection(),m=document.createRange();if(i.currentTarget&&j&&m)try{m.selectNodeContents(i.currentTarget),j.removeAllRanges(),j.addRange(m)}catch(b){console.error("Selection failed:",b)}}};return et.useAsyncEffect(async()=>{try{if(u.length===0)return;const i=await bt.commands("get_attachment_by_ids",{serverId:_.id,attachments:u});p(i?.hits?.hits)}catch(i){c(String(i))}},[u]),t.jsxs(t.Fragment,{children:[n&&t.jsxs("div",{className:"flex gap-1 items-center justify-end",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[t.jsx("div",{className:re("size-6 transition",{"opacity-0":!f}),children:t.jsx(_t,{textToCopy:n})}),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:g,children:n})]}),y&&y.length>0&&t.jsx("div",{className:re("w-full",{"mt-3":n}),children:t.jsx(tt.Attachments,{data:y.map(i=>({id:i._source.id,filename:i._source.name,extname:i._source.icon,size:i._source.size,status:"uploaded"})),className:"text-left"})})]})},Nt=({name:r,className:n,style:u,...f})=>t.jsx("svg",{className:`icon dark:drop-shadow-[0_0_6px_rgb(255,255,255)] ${n||""}`,style:u,...f,children:t.jsx("use",{xlinkHref:`#${r}`})});function Ct(){const[r,n]=a.useState(),[u,f]=a.useState(),[l,_]=a.useState(),[y,p]=a.useState(),[c,g]=a.useState(),[i,j]=a.useState(),[m,b]=a.useState(),I={deal_query_intent:a.useCallback(w=>{n(x=>x?{...x,message_chunk:(x.message_chunk||"")+(w.message_chunk||"")}:w)},[]),deal_tools:a.useCallback(w=>{f(x=>x?{...x,message_chunk:(x.message_chunk||"")+(w.message_chunk||"")}:w)},[]),deal_fetch_source:a.useCallback(w=>{_(x=>x?{...x,message_chunk:(x.message_chunk||"")+(w.message_chunk||"")}:w)},[]),deal_pick_source:a.useCallback(w=>{p(x=>x?{...x,message_chunk:(x.message_chunk||"")+(w.message_chunk||"")}:w)},[]),deal_deep_read:a.useCallback(w=>{g(x=>x?{...x,message_chunk:(x.message_chunk||"")+"&"+(w.message_chunk||"")}:w)},[]),deal_think:a.useCallback(w=>{j(x=>x?{...x,message_chunk:(x.message_chunk||"")+(w.message_chunk||"")}:w)},[]),deal_response:a.useCallback(w=>{b(x=>x?{...x,message_chunk:(x.message_chunk||"")+(w.message_chunk||"")}:w)},[])};return{data:{query_intent:r,tools:u,fetch_source:l,pick_source:y,deep_read:c,think:i,response:m},handlers:I,clearAllChunkData:()=>new Promise(w=>{n(void 0),f(void 0),_(void 0),p(void 0),g(void 0),j(void 0),b(void 0),setTimeout(w,0)})}}function St(r){if(r)return r==="light"?"light":r==="dark"||typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const Tt=a.memo(a.forwardRef(function({message:n,isTyping:u,onResend:f,hide_assistant:l=!1,rootClassName:_,actionClassName:y,actionIconSize:p,copyButtonId:c,formatUrl:g,theme:i,locale:j,query_intent:m,tools:b,fetch_source:I,pick_source:Y,deep_read:w,think:x,response:S},oe){const{t:ie,i18n:G}=B.useTranslation(),le=St(i),Z=be(h=>h.currentAssistant),Q=be(h=>h.assistantList),[P,ce]=a.useState({}),{data:{query_intent:we,tools:pe,fetch_source:D,pick_source:J,deep_read:X,think:ge,response:q},handlers:F,clearAllChunkData:ke}=Ct();a.useEffect(()=>{m&&F.deal_query_intent(m)},[m]),a.useEffect(()=>{b&&F.deal_tools(b)},[b]),a.useEffect(()=>{I&&F.deal_fetch_source(I)},[I]),a.useEffect(()=>{Y&&F.deal_pick_source(Y)},[Y]),a.useEffect(()=>{w&&F.deal_deep_read(w)},[w]),a.useEffect(()=>{x&&F.deal_think(x)},[x]),a.useEffect(()=>{S&&F.deal_response(S)},[S]);const[V,de]=a.useState({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),z=a.useRef(!1);a.useImperativeHandle(oe,()=>({addChunk:h=>{if(de(()=>({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1,[h.chunk_type||""]:!0})),h.chunk_type==="query_intent")F.deal_query_intent(h);else if(h.chunk_type==="tools")F.deal_tools(h);else if(h.chunk_type==="fetch_source")F.deal_fetch_source(h);else if(h.chunk_type==="pick_source")F.deal_pick_source(h);else if(h.chunk_type==="deep_read")F.deal_deep_read(h);else if(h.chunk_type==="think")F.deal_think(h);else if(h.chunk_type==="response"){const U=h.message_chunk;if(typeof U=="string"){if(U.includes("<think>")||U.includes("<think>")){z.current=!0;return}else if(U.includes("</think>")||U.includes("</think>")){z.current=!1;return}z.current?F.deal_think({...h,chunk_type:"think"}):F.deal_response(h)}}},reset:()=>{ke(),de({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),z.current=!1}}));const W=n?._source?.type==="assistant",ue=n?._source?.assistant_id,fe=n?._source?.assistant_item;a.useEffect(()=>{j&&G.language!==j&&G.changeLanguage(j)},[j,G]),a.useEffect(()=>{if(fe){ce(fe);return}if(W&&ue&&Array.isArray(Q)){ce(Q.find(h=>h._id===ue)??{});return}ce(Z)},[W,fe,ue,Q,Z]);const K=n?._source?.message||"",he=n?._source?.attachments??[],M=n?._source?.details||[],$=n?._source?.question||"",ee=u===!1&&(K||q?.message_chunk),[Ee,ye]=a.useState([]),Ne=h=>{ye(h)},Ce=()=>W?t.jsxs(t.Fragment,{children:[t.jsx(lt,{Detail:M.find(h=>h.type==="query_intent"),ChunkData:we,getSuggestion:Ne,loading:V?.query_intent}),t.jsx(ct,{Detail:M.find(h=>h.type==="tools"),ChunkData:pe,loading:V?.tools}),t.jsx(ft,{Detail:M.find(h=>h.type==="fetch_source"),ChunkData:D,loading:V?.fetch_source,formatUrl:g}),t.jsx(xt,{Detail:M.find(h=>h.type==="pick_source"),ChunkData:J,loading:V?.pick_source}),t.jsx(pt,{Detail:M.find(h=>h.type==="deep_read"),ChunkData:X,loading:V?.deep_read}),t.jsx(gt,{Detail:M.find(h=>h.type==="think"),ChunkData:ge,loading:V?.think}),t.jsx(Oe.XMarkdown,{content:K||q?.message_chunk||""}),u&&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"}),ee&&t.jsx(vt,{id:n._id??"",content:K||q?.message_chunk||"",question:$,actionClassName:y,actionIconSize:p,copyButtonId:c,onResend:()=>{f&&f($)}}),!u&&t.jsx(jt,{suggestions:Ee,onSelect:h=>f&&f(h)})]}):t.jsx(Et,{message:K,attachments:he});return t.jsx("div",{className:re("w-full py-8 flex",[W?"justify-start":"justify-end"],le==="dark"&&"dark",_),children:t.jsx("div",{className:`w-full px-4 flex gap-4 ${W?"w-full":"flex-row-reverse"}`,children:t.jsxs("div",{className:`w-full space-y-2 ${W?"text-left":"text-right"}`,children:[!l&&t.jsxs("div",{className:"w-full flex items-center gap-1 font-semibold text-sm text-[#333] dark:text-[#d8d8d8]",children:[W?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(Nt,{name:P._source.icon,className:"w-4 h-4"}):t.jsx("img",{src:ot,className:"w-4 h-4",alt:ie("assistant.message.logo")})}):null,W?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:Ce()})})]})})})})),Rt=a.memo(a.forwardRef((r,n)=>t.jsx(B.I18nextProvider,{i18n:We,children:t.jsx(Tt,{...r,ref:n})})));return je.ChatMessage=Rt,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"}),je})({},React,ReactI18next,clsx,i18n,LucideReact,xMarkdown,zustand,ahooks,attachments);
|