@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.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(A,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react"),require("react-i18next"),require("clsx"),require("i18next"),require("lucide-react"),require("@ant-design/x-markdown"),require("zustand"),require("ahooks"),require("@infinilabs/attachments")):typeof define=="function"&&define.amd?define(["exports","react","react-i18next","clsx","i18next","lucide-react","@ant-design/x-markdown","zustand","ahooks","@infinilabs/attachments"],a):(A=typeof globalThis<"u"?globalThis:A||self,a(A.ChatMessage={},A.React,A.ReactI18next,A.clsx,A.i18n,A.LucideReact,A.xMarkdown,A.zustand,A.ahooks,A.attachments))})(this,(function(A,a,Y,ne,$e,E,Oe,_e,et,tt){"use strict";var me={exports:{}},ae={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
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 ae;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 ae.Fragment=u,ae.jsx=y,ae.jsxs=y,ae}var oe={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,19 +14,19 @@
|
|
|
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"),W=Symbol.iterator,J="@@iterator";function w(e){if(e===null||typeof e!="object")return null;var s=W&&e[W]||e[J];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];ie("error",e,o)}}function ie(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 le=!1,G=!1,ce=!1,q=!1,Q=!1,L;L=Symbol.for("react.module.reference");function de(e){return!!(typeof e=="string"||typeof e=="function"||e===f||e===_||Q||e===l||e===g||e===i||q||e===b||le||G||ce||typeof e=="object"&&e!==null&&(e.$$typeof===m||e.$$typeof===j||e.$$typeof===y||e.$$typeof===p||e.$$typeof===c||e.$$typeof===L||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 ge(e){return e.displayName||"Context"}function B(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 ge(s)+".Consumer";case y:var o=e;return ge(o._context)+".Provider";case c:return we(e,e.render,"ForwardRef");case j:var d=e.displayName||null;return d!==null?d:B(e.type)||"Memo";case m:{var N=e,C=N._payload,v=N._init;try{return B(v(C))}catch{return null}}}return null}var V=Object.assign,X=0,ke,$,F,ye,K,ue,H;function M(){}M.__reactDisabledLog=!0;function fe(){{if(X===0){ke=console.log,$=console.info,F=console.warn,ye=console.error,K=console.group,ue=console.groupCollapsed,H=console.groupEnd;var e={configurable:!0,enumerable:!0,value:M,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}X++}}function he(){{if(X--,X===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:V({},e,{value:ke}),info:V({},e,{value:$}),warn:V({},e,{value:F}),error:V({},e,{value:ye}),group:V({},e,{value:K}),groupCollapsed:V({},e,{value:ue}),groupEnd:V({},e,{value:H})})}X<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var z=x.ReactCurrentDispatcher,xe;function U(e,s,o){{if(xe===void 0)try{throw Error()}catch(N){var d=N.stack.trim().match(/\n( *(at )?)/);xe=d&&d[1]||""}return`
|
|
18
|
+
`+xe+e}}var ee=!1,te;{var Ee=typeof WeakMap=="function"?WeakMap:Map;te=new Ee}function ve(e,s){if(!e||ee)return"";{var o=te.get(e);if(o!==void 0)return o}var d;ee=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var C;C=z.current,z.current=null,fe();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(P){d=P}Reflect.construct(e,[],v)}else{try{v.call()}catch(P){d=P}e.call(v.prototype)}}else{try{throw Error()}catch(P){d=P}e()}}catch(P){if(P&&d&&typeof P.stack=="string"){for(var k=P.stack.split(`
|
|
19
|
+
`),O=d.stack.split(`
|
|
20
|
+
`),T=k.length-1,R=O.length-1;T>=1&&R>=0&&k[T]!==O[R];)R--;for(;T>=1&&R>=0;T--,R--)if(k[T]!==O[R]){if(T!==1||R!==1)do if(T--,R--,R<0||k[T]!==O[R]){var I=`
|
|
21
|
+
`+k[T].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),typeof e=="function"&&te.set(e,I),I}while(T>=1&&R>=0);break}}}finally{ee=!1,z.current=C,he(),Error.prepareStackTrace=N}var re=e?e.displayName||e.name:"",Z=re?U(re):"";return typeof e=="function"&&te.set(e,Z),Z}function Ne(e,s,o){return ve(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 ve(e,Ce(e));if(typeof e=="string")return U(e);switch(e){case g:return U("Suspense");case i:return U("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 D=Object.prototype.hasOwnProperty,Ue={},De=x.ReactDebugCurrentFrame;function je(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(D);for(var v in e)if(C(e,v)){var k=void 0;try{if(typeof e[v]!="function"){var O=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 O.name="Invariant Violation",O}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)&&(je(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),je(null)),k instanceof Error&&!(k.message in Ue)&&(Ue[k.message]=!0,je(N),S("Failed %s type: %s",o,k.message),je(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(D.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(D.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,O=null;o!==void 0&&(Ye(o),k=""+o),Wt(s)&&(Ye(s.key),k=""+s.key),It(s)&&(O=s.ref,Mt(s,N));for(C in s)D.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||O){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;k&&Ut(v,R),O&&Dt(v,R)}return Bt(e,k,O,N,d,Je.current,v)}}var Te=x.ReactCurrentOwner,ze=x.ReactDebugCurrentFrame;function se(e){if(e){var s=e._owner,o=h(e.type,e._source,s?s.type:null);ze.setExtraStackFrame(o)}else ze.setExtraStackFrame(null)}var Re;Re=!1;function Fe(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Ge(){{if(Te.current){var e=B(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 Qe={};function Vt(e){{var s=Ge();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 Xe(e,s){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var o=Vt(s);if(Qe[o])return;Qe[o]=!0;var d="";e&&e._owner&&e._owner!==Te.current&&(d=" It was passed a child from "+B(e._owner.type)+"."),se(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),se(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)&&Xe(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)&&Xe(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=B(s);Ft(o,e.props,"prop",d,e)}else if(s.PropTypes!==void 0&&!Re){Re=!0;var N=B(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 zt(e){{for(var s=Object.keys(e.props),o=0;o<s.length;o++){var d=s[o];if(d!=="children"&&d!=="key"){se(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),se(null);break}}e.ref!==null&&(se(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),se(null))}}var Ze={};function qe(e,s,o,d,N,C){{var v=de(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 O=Jt();O?k+=O:k+=Ge();var T;e===null?T="null":Se(e)?T="array":e!==void 0&&e.$$typeof===n?(T="<"+(B(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 I=s.children;if(I!==void 0)if(d)if(Se(I)){for(var re=0;re<I.length;re++)He(I[re],e);Object.freeze&&Object.freeze(I)}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(I,e)}if(D.call(s,"key")){var Z=B(e),P=Object.keys(s).filter(function(qt){return qt!=="key"}),Ae=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";if(!Ze[Z+Ae]){var Zt=P.length>0?"{"+P.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,ye,Es,ye),Rt[ye+Xe]=!0}}return r===o?ws(W):vs(W),W}}function js(r,l,h){return zt(r,l,h,!0)}function _s(r,l,h){return zt(r,l,h,!1)}var Cs=_s,Ns=js;Ee.Fragment=o,Ee.jsx=Cs,Ee.jsxs=Ns})()),Ee}var et;function Bt(){return et||(et=1,process.env.NODE_ENV==="production"?Oe.exports=qt():Oe.exports=Dt()),Oe.exports}var t=Bt();const Ut={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(ae.initReactI18next).init({resources:Ut,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1},react:{useSuspense:!1}});const Vt="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 Fe({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:le("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 Gt(e){return t.jsx(Fe,{...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}=ae.useTranslation(),[d,c]=m.useState(!1),[f,i]=m.useState(null);return m.useEffect(()=>{e?.payload&&(i(e?.payload),e?.payload?.suggestion&&n&&n(e?.payload?.suggestion))},[e?.payload,n]),m.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(p){console.error("Failed to process message chunk in QueryIntent:",p)}},[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(p=>!p),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(Gt,{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((p,u)=>t.jsxs("span",{className:"text-[#333333] dark:text-[#D8D8D8]",children:[p,u<2&&"、"]},p+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((p,u)=>t.jsxs("span",{children:["- ",p]},p+u))})]}):null]})})})]})},Jt=({Detail:e,ChunkData:s,loading:n})=>{const{t:o}=ae.useTranslation(),[a,d]=m.useState(!1),[c,f]=m.useState("");return m.useEffect(()=>{e?.description&&f(e?.description)},[e?.description]),m.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(Fe,{...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}=ae.useTranslation(),[d,c]=m.useState(!1),[f,i]=m.useState(0),[p,u]=m.useState([]);m.useEffect(()=>{e?.payload&&(u(e?.payload),i(e?.payload.length))},[e?.payload]),m.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:p?.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(Fe,{...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}=ae.useTranslation(),[a,d]=m.useState(!1),[c,f]=m.useState([]);return m.useEffect(()=>{e?.payload&&f(e?.payload)},[e?.payload]),m.useEffect(()=>{if(s?.message_chunk&&!n)try{const p=s.message_chunk.replace(/^"|"$/g,"").match(/<JSON>([\s\S]*?)<\/JSON>/g);if(p)for(let u=p.length-1;u>=0;u--)try{const v=p[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(Fe,{...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}=ae.useTranslation(),[a,d]=m.useState(!1),[c,f]=m.useState([]),[i,p]=m.useState("");return m.useEffect(()=>{e?.description&&p(e?.description)},[e?.description]),m.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,p)=>i.trim()&&t.jsx("p",{className:"text-sm",children:i},p))})})]})},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]=m.useState(!1),[p,u]=m.useState(!1),[v,b]=m.useState(!1),[E,L]=m.useState(!1),[D,C]=m.useState(!1),y=or.includes(e),{synthesizeItem:P,setSynthesizeItem:H}=nr(),te=async()=>{try{await rt(s),i(!0);const z=setTimeout(()=>{i(!1),clearTimeout(z)},2e3)}catch(z){console.error("copy error:",z)}},re=()=>{u(!p),b(!1)},Z=()=>{b(!v),u(!1)},oe=async()=>H({id:e,content:s}),w=()=>{if(c){C(!0),c();const z=setTimeout(()=>{C(!1),clearTimeout(z)},1e3)}};return t.jsxs("div",{className:le("flex items-center gap-1 mt-2",o),children:[!y&&t.jsx("button",{id:d,onClick:te,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:re,className:`p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg transition-colors ${p?"animate-shake":""}`,children:t.jsx(A.ThumbsUp,{className:`w-4 h-4 ${p?"text-[#1990FF] dark:text-[#1990FF]":"text-[#666666] dark:text-[#A3A3A3]"}`,style:{width:a,height:a}})}),!y&&t.jsx("button",{onClick:Z,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:oe,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 ${D?"animate-spin":""}`,children:t.jsx(A.RotateCcw,{className:`w-4 h-4 ${D?"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]=m.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:le("relative inline-block",e),...s}));nt.displayName="Popover";const ot=$e.forwardRef(({className:e,...s},n)=>t.jsx("div",{ref:n,className:le("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:le("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:le("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}),Pe="-",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(Pe),i=f[0]===""&&f.length>1?1:0;return dt(f,i,s)},getConflictingClassGroupIds:(c,f)=>{if(f){const i=o[c],p=n[c];return i?p?dr(p,i):i:p||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 p=dt(e,s+1,d);if(p)return p}const c=n.validators;if(c===null)return;const f=s===0?e.join(Pe):e.slice(s).join(Pe),i=c.length;for(let p=0;p<i;p++){const u=c[p];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 xr(n,s)},xr=(e,s)=>{const n=lt();for(const o in e){const a=e[o];qe(a,n,o,s)}return n},qe=(e,s,n,o)=>{const a=e.length;for(let d=0;d<a;d++){const c=e[d];gr(c,s,n,o)}},gr=(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)){qe(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];qe(i,ut(s,f),n,o)}},ut=(e,s)=>{let n=e;const o=s.split(Pe),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)}}},De="!",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,p;const u=a.length;for(let D=0;D<u;D++){const C=a[D];if(c===0&&f===0){if(C===ft){d.push(a.slice(i,D)),i=D+1;continue}if(C==="/"){p=D;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(De)?(b=v.slice(0,-1),E=!0):v.startsWith(De)&&(b=v.slice(1),E=!0);const L=p&&p>i?p-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 p=f.length-1;p>=0;p-=1){const u=f[p],{isExternal:v,modifiers:b,hasImportantModifier:E,baseClassName:L,maybePostfixModifierPosition:D}=n(u);if(v){i=u+(i.length>0?" "+i:i);continue}let C=!!D,y=o(C?L.substring(0,D):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(":"),H=E?P+De:P,te=H+y;if(c.indexOf(te)>-1)continue;c.push(te);const re=a(y,C);for(let Z=0;Z<re.length;++Z){const oe=re[Z];c.push(H+oe)}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 p=s.reduce((u,v)=>v(u),e());return n=Nr(p),o=n.cache.get,a=n.cache.set,d=f,f(i)},f=i=>{const p=o(i);if(p)return p;const u=Sr(i,n);return a(i,u),u};return d=c,(...i)=>d(Tr(...i))},Or=[],q=e=>{const s=n=>n[e]||Or;return s.isThemeGetter=!0,s},ht=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xt=/^\((?:(\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)\(.+\)$/,ve=e=>Fr.test(e),N=e=>!!e&&!Number.isNaN(Number(e)),me=e=>!!e&&Number.isInteger(Number(e)),Be=e=>e.endsWith("%")&&N(e.slice(0,-1)),ce=e=>Pr.test(e),zr=()=>!0,$r=e=>Ir.test(e)&&!Lr.test(e),gt=()=>!1,Wr=e=>Mr.test(e),qr=e=>Rr.test(e),Dr=e=>!x(e)&&!g(e),Br=e=>we(e,wt,gt),x=e=>ht.test(e),ge=e=>we(e,jt,$r),Ue=e=>we(e,Jr,N),bt=e=>we(e,yt,gt),Ur=e=>we(e,vt,qr),Ie=e=>we(e,_t,Wr),g=e=>xt.test(e),Se=e=>je(e,jt),Vr=e=>je(e,Xr),kt=e=>je(e,yt),Gr=e=>je(e,wt),Yr=e=>je(e,vt),Le=e=>je(e,_t,!0),we=(e,s,n)=>{const o=ht.exec(e);return o?o[1]?s(o[1]):n(o[2]):!1},je=(e,s,n=!1)=>{const o=xt.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=q("color"),s=q("font"),n=q("text"),o=q("font-weight"),a=q("tracking"),d=q("leading"),c=q("breakpoint"),f=q("container"),i=q("spacing"),p=q("radius"),u=q("shadow"),v=q("inset-shadow"),b=q("text-shadow"),E=q("drop-shadow"),L=q("blur"),D=q("perspective"),C=q("aspect"),y=q("ease"),P=q("animate"),H=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],re=()=>[...te(),g,x],Z=()=>["auto","hidden","clip","visible","scroll"],oe=()=>["auto","contain","none"],w=()=>[g,x,i],z=()=>[ve,"full","auto",...w()],pe=()=>[me,"none","subgrid",g,x],ee=()=>["auto",{span:["full",me,g,x]},me,g,x],de=()=>[me,"auto",g,x],B=()=>["auto","min","max","fr",g,x],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...w()],X=()=>[ve,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],k=()=>[e,g,x],ie=()=>[...te(),kt,bt,{position:[g,x]}],be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",Gr,Br,{size:[g,x]}],ue=()=>[Be,Se,ge],$=()=>["","none","full",p,g,x],V=()=>["",N,Se,ge],he=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>[N,Be,kt,bt],j=()=>["","none",L,g,x],K=()=>["none",N,g,x],fe=()=>["none",N,g,x],Te=()=>[N,g,x],ke=()=>[ve,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ce],breakpoint:[ce],color:[zr],container:[ce],"drop-shadow":[ce],ease:["in","out","in-out"],font:[Dr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ce],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ce],shadow:[ce],spacing:["px",N],text:[ce],"text-shadow":[ce],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ve,x,g,C]}],container:["container"],columns:[{columns:[N,x,g,f]}],"break-after":[{"break-after":H()}],"break-before":[{"break-before":H()}],"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:re()}],overflow:[{overflow:Z()}],"overflow-x":[{"overflow-x":Z()}],"overflow-y":[{"overflow-y":Z()}],overscroll:[{overscroll:oe()}],"overscroll-x":[{"overscroll-x":oe()}],"overscroll-y":[{"overscroll-y":oe()}],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:[me,"auto",g,x]}],basis:[{basis:[ve,"full","auto",f,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[N,ve,"auto","initial","none",x]}],grow:[{grow:["",N,g,x]}],shrink:[{shrink:["",N,g,x]}],order:[{order:[me,"first","last","none",g,x]}],"grid-cols":[{"grid-cols":pe()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":de()}],"col-end":[{"col-end":de()}],"grid-rows":[{"grid-rows":pe()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":de()}],"row-end":[{"row-end":de()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m: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:X()}],w:[{w:[f,"screen",...X()]}],"min-w":[{"min-w":[f,"screen","none",...X()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Se,ge]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,g,Ue]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Be,x]}],"font-family":[{font:[Vr,x,s]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,g,x]}],"line-clamp":[{"line-clamp":[N,"none",g,Ue]}],leading:[{leading:[d,...w()]}],"list-image":[{"list-image":["none",g,x]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",g,x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[N,"from-font","auto",g,ge]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[N,"auto",g,x]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",g,x]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",g,x]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:be()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},me,g,x],radial:["",g,x],conic:[me,g,x]},Yr,Ur]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"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:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[N,g,x]}],"outline-w":[{outline:["",N,Se,ge]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",u,Le,Ie]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",v,Le,Ie]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:V()}],"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":V()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",b,Le,Ie]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[N,g,x]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"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":[g,x]}],"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":te()}],"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:ie()}],"mask-repeat":[{mask:be()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",g,x]}],filter:[{filter:["","none",g,x]}],blur:[{blur:j()}],brightness:[{brightness:[N,g,x]}],contrast:[{contrast:[N,g,x]}],"drop-shadow":[{"drop-shadow":["","none",E,Le,Ie]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",N,g,x]}],"hue-rotate":[{"hue-rotate":[N,g,x]}],invert:[{invert:["",N,g,x]}],saturate:[{saturate:[N,g,x]}],sepia:[{sepia:["",N,g,x]}],"backdrop-filter":[{"backdrop-filter":["","none",g,x]}],"backdrop-blur":[{"backdrop-blur":j()}],"backdrop-brightness":[{"backdrop-brightness":[N,g,x]}],"backdrop-contrast":[{"backdrop-contrast":[N,g,x]}],"backdrop-grayscale":[{"backdrop-grayscale":["",N,g,x]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[N,g,x]}],"backdrop-invert":[{"backdrop-invert":["",N,g,x]}],"backdrop-opacity":[{"backdrop-opacity":[N,g,x]}],"backdrop-saturate":[{"backdrop-saturate":[N,g,x]}],"backdrop-sepia":[{"backdrop-sepia":["",N,g,x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",g,x]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[N,"initial",g,x]}],ease:[{ease:["linear","initial",y,g,x]}],delay:[{delay:[N,g,x]}],animate:[{animate:["none",P,g,x]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[D,g,x]}],"perspective-origin":[{"perspective-origin":re()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:Te()}],"skew-x":[{"skew-x":Te()}],"skew-y":[{"skew-y":Te()}],transform:[{transform:[g,x,"","none","gpu","cpu"]}],"transform-origin":[{origin:re()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ke()}],"translate-x":[{"translate-x":ke()}],"translate-y":[{"translate-y":ke()}],"translate-z":[{"translate-z":ke()}],"translate-none":["translate-none"],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",g,x]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",g,x]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[N,Se,ge,Ue]}],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]=m.useState("");return m.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:p,deletable:u,onDelete:v}=e,{t:b}=ae.useTranslation();return t.jsx("div",{className:"w-1/3 px-1",children:t.jsxs("div",{className:"relative group flex items-center gap-1 p-1 rounded-[4px] bg-[#dedede] dark:bg-[#202126]",children:[(i||f)&&u&&t.jsx("div",{className:"absolute flex justify-center items-center size-[14px] bg-red-600 top-0 right-0 rounded-full cursor-pointer translate-x-[5px] -translate-y-[5px] transition opacity-0 group-hover:opacity-100 ",onClick:()=>{v?.(s)},children:t.jsx(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&&p?t.jsx(cr,{content:p,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]=m.useState(!1),{currentService:d}=We(),[c,f]=m.useState([]),{addError:i}=Zr(),p=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:le("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:p,children:s})]}),c&&t.jsx("div",{className:le("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 m.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]=m.useState(),[n,o]=m.useState(),[a,d]=m.useState(),[c,f]=m.useState(),[i,p]=m.useState(),[u,v]=m.useState(),[b,E]=m.useState(),L={deal_query_intent:m.useCallback(C=>{s(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_tools:m.useCallback(C=>{o(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_fetch_source:m.useCallback(C=>{d(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_pick_source:m.useCallback(C=>{f(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_deep_read:m.useCallback(C=>{p(y=>y?{...y,message_chunk:(y.message_chunk||"")+"&"+(C.message_chunk||"")}:C)},[]),deal_think:m.useCallback(C=>{v(y=>y?{...y,message_chunk:(y.message_chunk||"")+(C.message_chunk||"")}:C)},[]),deal_response:m.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),p(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=m.memo(m.forwardRef(function({message:s,isTyping:n,onResend:o,hide_assistant:a=!1,rootClassName:d,actionClassName:c,actionIconSize:f,copyButtonId:i,formatUrl:p,theme:u,locale:v},b){const{t:E,i18n:L}=ae.useTranslation(),D=rs(u),C=We(j=>j.currentAssistant),y=We(j=>j.assistantList),[P,H]=m.useState({}),{data:{query_intent:te,tools:re,fetch_source:Z,pick_source:oe,deep_read:w,think:z,response:pe},handlers:ee,clearAllChunkData:de}=ts(),[B,J]=m.useState({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),U=m.useRef(!1);m.useImperativeHandle(b,()=>({addChunk:j=>{if(J(()=>({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")ee.deal_query_intent(j);else if(j.chunk_type==="tools")ee.deal_tools(j);else if(j.chunk_type==="fetch_source")ee.deal_fetch_source(j);else if(j.chunk_type==="pick_source")ee.deal_pick_source(j);else if(j.chunk_type==="deep_read")ee.deal_deep_read(j);else if(j.chunk_type==="think")ee.deal_think(j);else if(j.chunk_type==="response"){const K=j.message_chunk;if(typeof K=="string"){if(K.includes("<think>")||K.includes("<think>")){U.current=!0;return}else if(K.includes("</think>")||K.includes("</think>")){U.current=!1;return}U.current?ee.deal_think({...j,chunk_type:"think"}):ee.deal_response(j)}}},reset:()=>{de(),J({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),U.current=!1}}));const M=s?._source?.type==="assistant",X=s?._source?.assistant_id,k=s?._source?.assistant_item;m.useEffect(()=>{v&&L.language!==v&&L.changeLanguage(v)},[v,L]),m.useEffect(()=>{if(k){H(k);return}if(M&&X&&Array.isArray(y)){H(y.find(j=>j._id===X)??{});return}H(C)},[M,k,X,y,C]);const ie=s?._source?.message||"",be=s?._source?.attachments??[],se=s?._source?.details||[],ue=s?._source?.question||"",$=n===!1&&(ie||pe?.message_chunk),[V,he]=m.useState([]),xe=j=>{he(j)},I=()=>M?t.jsxs(t.Fragment,{children:[t.jsx(Yt,{Detail:se.find(j=>j.type==="query_intent"),ChunkData:te,getSuggestion:xe,loading:B?.query_intent}),t.jsx(Jt,{Detail:se.find(j=>j.type==="tools"),ChunkData:re,loading:B?.tools}),t.jsx(Ht,{Detail:se.find(j=>j.type==="fetch_source"),ChunkData:Z,loading:B?.fetch_source,formatUrl:p}),t.jsx(er,{Detail:se.find(j=>j.type==="pick_source"),ChunkData:oe,loading:B?.pick_source}),t.jsx(rr,{Detail:se.find(j=>j.type==="deep_read"),ChunkData:w,loading:B?.deep_read}),t.jsx(sr,{Detail:se.find(j=>j.type==="think"),ChunkData:z,loading:B?.think}),t.jsx(Ke.XMarkdown,{content:ie||pe?.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:ie||pe?.message_chunk||"",question:ue,actionClassName:c,actionIconSize:f,copyButtonId:i,onResend:()=>{o&&o(ue)}}),!n&&t.jsx(ir,{suggestions:V,onSelect:j=>o&&o(j)})]}):t.jsx(es,{message:ie,attachments:be});return t.jsx("div",{className:le("w-full py-8 flex",[M?"justify-start":"justify-end"],D==="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:Vt,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=m.memo(m.forwardRef((e,s)=>t.jsx(ae.I18nextProvider,{i18n:tt,children:t.jsx(ss,{...e,ref:s})})));Y.ChatMessage=ns,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})}));
|
|
30
|
+
<%s key={someKey} {...props} />`,Ae,Z,Zt,Z),Ze[Z+Ae]=!0}}return e===f?zt(R):Kt(R),R}}function Gt(e,s,o){return qe(e,s,o,!0)}function Qt(e,s,o){return qe(e,s,o,!1)}var Xt=Qt,Ht=Gt;oe.Fragment=f,oe.jsx=Xt,oe.jsxs=Ht})()),oe}var Ie;function nt(){return Ie||(Ie=1,process.env.NODE_ENV==="production"?me.exports=st():me.exports=rt()),me.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(Y.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 pe({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:ne("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(pe,{...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}=Y.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}=Y.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(pe,{...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}=Y.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 W=JSON.parse(b[0]);i(W)}}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(pe,{...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}=Y.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(pe,{...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}=Y.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}=Y.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,W]=a.useState(!1),[J,w]=a.useState(!1),x=yt.includes(r),{synthesizeItem:S,setSynthesizeItem:ie}=kt(),le=async()=>{try{await Me(n),c(!0);const L=setTimeout(()=>{c(!1),clearTimeout(L)},2e3)}catch(L){console.error("copy error:",L)}},G=()=>{i(!g),m(!1)},ce=()=>{m(!j),i(!1)},q=async()=>ie({id:r,content:n}),Q=()=>{if(y){w(!0),y();const L=setTimeout(()=>{w(!1),clearTimeout(L)},1e3)}};return t.jsxs("div",{className:ne("flex items-center gap-1 mt-2",f),children:[!x&&t.jsx("button",{id:_,onClick:le,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:ce,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:q,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 ${J?"animate-spin":""}`,children:t.jsx(E.RotateCcw,{className:`w-4 h-4 ${J?"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:ne("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:ne("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(),W={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:W,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:W,pick_source:J,deep_read:w,think:x,response:S},ie){const{t:le,i18n:G}=Y.useTranslation(),ce=St(i),q=be(h=>h.currentAssistant),Q=be(h=>h.assistantList),[L,de]=a.useState({}),{data:{query_intent:we,tools:ge,fetch_source:B,pick_source:V,deep_read:X,think:ke,response:$},handlers:F,clearAllChunkData:ye}=Ct();a.useEffect(()=>{m&&F.deal_query_intent(m)},[m]),a.useEffect(()=>{b&&F.deal_tools(b)},[b]),a.useEffect(()=>{W&&F.deal_fetch_source(W)},[W]),a.useEffect(()=>{J&&F.deal_pick_source(J)},[J]),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[K,ue]=a.useState({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),H=a.useRef(!1);a.useImperativeHandle(ie,()=>({addChunk:h=>{if(ue(()=>({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 D=h.message_chunk;if(typeof D=="string"){if(D.includes("<think>")||D.includes("<think>")){H.current=!0;return}else if(D.includes("</think>")||D.includes("</think>")){H.current=!1;return}H.current?F.deal_think({...h,chunk_type:"think"}):F.deal_response(h)}}},reset:()=>{ye(),ue({query_intent:!1,tools:!1,fetch_source:!1,pick_source:!1,deep_read:!1,think:!1,response:!1}),H.current=!1}}));const M=n?._source?.type==="assistant",fe=n?._source?.assistant_id,he=n?._source?.assistant_item;a.useEffect(()=>{j&&G.language!==j&&G.changeLanguage(j)},[j,G]),a.useEffect(()=>{if(he){de(he);return}if(M&&fe&&Array.isArray(Q)){de(Q.find(h=>h._id===fe)??{});return}de(q)},[M,he,fe,Q,q]);const z=n?._source?.message||"",xe=n?._source?.attachments??[],U=n?._source?.details||[],ee=n?._source?.question||"",te=u===!1&&(z||$?.message_chunk),[Ee,ve]=a.useState([]),Ne=h=>{ve(h)},Ce=()=>M?t.jsxs(t.Fragment,{children:[t.jsx(lt,{Detail:U.find(h=>h.type==="query_intent"),ChunkData:we,getSuggestion:Ne,loading:K?.query_intent}),t.jsx(ct,{Detail:U.find(h=>h.type==="tools"),ChunkData:ge,loading:K?.tools}),t.jsx(ft,{Detail:U.find(h=>h.type==="fetch_source"),ChunkData:B,loading:K?.fetch_source,formatUrl:g}),t.jsx(xt,{Detail:U.find(h=>h.type==="pick_source"),ChunkData:V,loading:K?.pick_source}),t.jsx(pt,{Detail:U.find(h=>h.type==="deep_read"),ChunkData:X,loading:K?.deep_read}),t.jsx(gt,{Detail:U.find(h=>h.type==="think"),ChunkData:ke,loading:K?.think}),t.jsx(Oe.XMarkdown,{content:z||$?.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"}),te&&t.jsx(vt,{id:n._id??"",content:z||$?.message_chunk||"",question:ee,actionClassName:y,actionIconSize:p,copyButtonId:c,onResend:()=>{f&&f(ee)}}),!u&&t.jsx(jt,{suggestions:Ee,onSelect:h=>f&&f(h)})]}):t.jsx(Et,{message:z,attachments:xe});return t.jsx("div",{className:ne("w-full py-8 flex",[M?"justify-start":"justify-end"],ce==="dark"&&"dark",_),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:[!l&&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:L?._source?.icon?.startsWith("font_")?t.jsx(Nt,{name:L._source.icon,className:"w-4 h-4"}):t.jsx("img",{src:ot,className:"w-4 h-4",alt:le("assistant.message.logo")})}):null,M?L?._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(Y.I18nextProvider,{i18n:We,children:t.jsx(Tt,{...r,ref:n})})));A.ChatMessage=Rt,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -12,6 +12,13 @@ export interface ChatMessageProps {
|
|
|
12
12
|
formatUrl?: (data: IChunkData) => string;
|
|
13
13
|
theme?: "light" | "dark" | "system";
|
|
14
14
|
locale?: string;
|
|
15
|
+
query_intent?: IChunkData;
|
|
16
|
+
tools?: IChunkData;
|
|
17
|
+
fetch_source?: IChunkData;
|
|
18
|
+
pick_source?: IChunkData;
|
|
19
|
+
deep_read?: IChunkData;
|
|
20
|
+
think?: IChunkData;
|
|
21
|
+
response?: IChunkData;
|
|
15
22
|
}
|
|
16
23
|
export interface ChatMessageRef {
|
|
17
24
|
addChunk: (chunk: IChunkData) => void;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
declare const platformAdapter: {
|
|
2
2
|
commands: (command: string, args: any) => Promise<{
|
|
3
3
|
hits: {
|
|
4
|
-
hits:
|
|
4
|
+
hits: {
|
|
5
|
+
_source: {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
size: string;
|
|
10
|
+
};
|
|
11
|
+
}[];
|
|
5
12
|
};
|
|
6
13
|
}>;
|
|
7
14
|
invokeBackend: <T>(command: string, args: any) => Promise<T | undefined>;
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dist",
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
|
-
"version": "0.0.
|
|
11
|
+
"version": "0.0.5",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "dist/ChatMessage.cjs",
|
|
@@ -34,12 +34,15 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@ant-design/x-markdown": "^2.1.3",
|
|
37
|
+
"@infinilabs/attachments": "^0.0.1",
|
|
37
38
|
"@tailwindcss/vite": "^4.1.18",
|
|
38
39
|
"ahooks": "^3.9.6",
|
|
40
|
+
"antd": "^6.1.4",
|
|
39
41
|
"clsx": "^2.1.1",
|
|
40
42
|
"i18next": "^25.7.3",
|
|
41
43
|
"lucide-react": "^0.461.0",
|
|
42
44
|
"mermaid": "^11.6.0",
|
|
45
|
+
"motion": "^12.25.0",
|
|
43
46
|
"react-markdown": "^9.1.0",
|
|
44
47
|
"rehype-highlight": "^7.0.2",
|
|
45
48
|
"rehype-katex": "^7.0.1",
|
|
@@ -68,5 +71,9 @@
|
|
|
68
71
|
"vite": "^7.1.2",
|
|
69
72
|
"vite-plugin-css-injected-by-js": "^3.5.1",
|
|
70
73
|
"vite-plugin-dts": "^4.5.4"
|
|
74
|
+
},
|
|
75
|
+
"repository": {
|
|
76
|
+
"type": "git",
|
|
77
|
+
"url": "https://github.com/infinilabs/ci"
|
|
71
78
|
}
|
|
72
79
|
}
|