@gientech/modual 2.1.10 → 2.1.12

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/chat.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as ee,jsxs as ut,Fragment as Ac}from"react/jsx-runtime";import*as C from"react";import we,{forwardRef as Oi,createElement as ec,createContext as cs,version as Fz,useMemo as Gt,useContext as hr,useState as nt,useRef as et,Children as SF,useEffect as Et,useCallback as ql,useImperativeHandle as $c,useLayoutEffect as AF,cloneElement as $F,isValidElement as OF,PureComponent as Pz,Component as Iz}from"react";import{a as cl,g as Bz,au as MF,l as NF,an as Rz,aN as _z,B as ki,aA as jz,f as _E,u as Lz,a5 as zz,aC as Hz,bw as Wz,A as Vz,bx as IS,aQ as DF,b as Mr,I as Wu,i as sC,T as Ks,a6 as Gz,F as Ia,aK as bd,by as TF,bz as Uz,h as qz,bA as Ug}from"./assets/index-BRq6VK9v.js";import{N as Kr,d as BS,c as FF,T as Yz,e as Xz}from"./assets/index-DzFAvwdY.js";import*as Kz from"react-dom";import RS,{flushSync as jE,createPortal as PF,unstable_batchedUpdates as Zz}from"react-dom";import{D as Qz,S as Jz,a as eH,F as tH,b as _S}from"./assets/index-CqK3Ppmi.js";import{u as pa}from"./assets/index-CpW6Dhpp.js";import{P as nH}from"./assets/plus-CldFV1Lg.js";import{S as LE}from"./assets/index-CPTyN9Rk.js";import{X as lC}from"./assets/x-D-pV1NCt.js";import{A as rH,s as gr,M as cC,S as Ud}from"./assets/style-CRg0RQug.js";import{g as jS,P as oH,a as uC}from"./assets/index-Cqjn7TCr.js";import{C as iH,G as IF,c as aH,r as sH}from"./assets/GientechStreamReader-CoQaXcHK.js";import{B as qEe}from"./assets/GientechStreamReader-CoQaXcHK.js";import{P as lH,S as cH}from"./assets/index-B3zi0w0x.js";/* empty css */import{D as BF}from"./assets/index-BQi5haCb.js";import"./database.js";import"./databaseTable.js";import"./modelManage.js";import"./sensitive.js";import"./assets/index-DNMf-zgr.js";import"./assets/index-DDz1HJaH.js";import"./assets/index-BfDZSwG3.js";/**
1
+ import{jsx as ee,jsxs as ut,Fragment as Ac}from"react/jsx-runtime";import*as C from"react";import we,{forwardRef as Oi,createElement as ec,createContext as cs,version as Fz,useMemo as Gt,useContext as hr,useState as nt,useRef as et,Children as SF,useEffect as Et,useCallback as ql,useImperativeHandle as $c,useLayoutEffect as AF,cloneElement as $F,isValidElement as OF,PureComponent as Pz,Component as Iz}from"react";import{a as cl,g as Bz,au as MF,l as NF,an as Rz,aN as _z,B as ki,aA as jz,f as _E,u as Lz,a5 as zz,aC as Hz,bw as Wz,A as Vz,bx as IS,aQ as DF,b as Mr,I as Wu,i as sC,T as Ks,a6 as Gz,F as Ia,aK as bd,by as TF,bz as Uz,h as qz,bA as Ug}from"./assets/index-BRq6VK9v.js";import{N as Kr,d as BS,c as FF,T as Yz,e as Xz}from"./assets/index-DzFAvwdY.js";import*as Kz from"react-dom";import RS,{flushSync as jE,createPortal as PF,unstable_batchedUpdates as Zz}from"react-dom";import{D as Qz,S as Jz,a as eH,F as tH,b as _S}from"./assets/index-CqK3Ppmi.js";import{u as pa}from"./assets/index-CpW6Dhpp.js";import{P as nH}from"./assets/plus-CldFV1Lg.js";import{S as LE}from"./assets/index-B2DbErCc.js";import{X as lC}from"./assets/x-D-pV1NCt.js";import{A as rH,s as gr,M as cC,S as Ud}from"./assets/style-CRg0RQug.js";import{g as jS,P as oH,a as uC}from"./assets/index-Cqjn7TCr.js";import{C as iH,G as IF,c as aH,r as sH}from"./assets/GientechStreamReader-CoQaXcHK.js";import{B as qEe}from"./assets/GientechStreamReader-CoQaXcHK.js";import{P as lH,S as cH}from"./assets/index-B3zi0w0x.js";/* empty css */import{D as BF}from"./assets/index-BQi5haCb.js";import"./database.js";import"./databaseTable.js";import"./modelManage.js";import"./sensitive.js";import"./assets/index-DNMf-zgr.js";import"./assets/index-DDz1HJaH.js";import"./assets/index-BfDZSwG3.js";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -589,7 +589,7 @@ ${v.substring(X)}`;y(ie),requestAnimationFrame(()=>{q.selectionStart=q.selection
589
589
  border-color: ${n.primary};
590
590
  box-shadow: 0 0 0 2px ${n.primary}1A;
591
591
  }
592
- `};function Voe({config:e,styles:t}){if(!e)return null;const n=JSON.parse(e.configJson),r=Gt(()=>{var o;return{...sC.colors,...(o=t==null?void 0:t.theme)==null?void 0:o.colors}},[t]);return ut("div",{className:"w-[340px] rounded-xl p-4 animate-fade-in bg-white",children:[ut("div",{className:"flex items-center mb-2",children:[ee("span",{className:"text-md font-bold truncate mr-2",style:{color:r.primary},children:n.config_name||"\u52A9\u624B\u914D\u7F6E"}),ee("span",{className:"text-xs truncate rounded px-2 py-0.5",style:{backgroundColor:`${r.primary}1A`,color:r.disabled},children:n.model_name})]}),ee("div",{className:"border-b my-2",style:{borderColor:r.border}}),ut("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-700 mb-2",style:{color:r.text},children:[ut("div",{children:["\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_round})]}),ut("div",{children:["\u6700\u5927\u4EE4\u724C\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_tokens})]}),ut("div",{children:["\u6E29\u5EA6\uFF1A",ee("span",{className:"font-semibold",children:n.temperature})]}),ut("div",{children:["\u53EC\u56DE\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.top_k})]}),ut("div",{children:["\u591A\u6837\u6027\uFF1A",ee("span",{className:"font-semibold",children:n.top_p})]}),ut("div",{children:["\u76F8\u4F3C\u5EA6\u9608\u503C\uFF1A",ee("span",{className:"font-semibold",children:n.score_threshold})]})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5173\u8054\u77E5\u8BC6\u5E93\uFF1A"}),ee("div",{className:"flex flex-wrap gap-1",children:n.knowledge_base_name?n.knowledge_base_name.split(";").map((o,i)=>ee("span",{className:"px-2 py-0.5 rounded-full text-xs",style:{backgroundColor:`${r.primary}1A`,color:r.primary},children:o},i)):ee("span",{className:"text-gray-300",style:{color:r.disabled},children:"\u65E0"})})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5F00\u542F\u529F\u80FD:"}),ut("div",{className:"flex flex-wrap gap-2 text-xs mt-2",children:[!!n.enabled_faq&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"FAQ"}),!!n.enabled_graph&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u56FE\u8C31"}),!!n.dependOnKb&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u5F3A\u77E5\u8BC6\u4F9D\u8D56"}),!!n.enabled_table_select&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u8868\u683C\u7B5B\u9009"}),!!n.enabled_rerank&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u7CBE\u6392\u6A21\u5F0F"}),!!n.need_trace_source&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u6EAF\u6E90"}),!!n.is_download&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u4E0B\u8F7D\u6EAF\u6E90"})]})]})]})}function Goe(e,t=[],n=60){const[r,o]=nt("");return Et(()=>{o("");let i=0;const a=setInterval(()=>{o(s=>i>=e.length?(clearInterval(a),s):(i++,e.slice(0,i)))},n);return()=>clearInterval(a)},[e,...t]),r}function Uoe(e){const{assistantList:t,eventsEmit:n,styles:r,selectedId:o,onSelectAssistant:i,productLogo:a}=e,[s,l]=nt(1),[c,u]=nt(!1),[d,f]=nt(""),h=c||d.trim()?6:12,m=et(),p=et(!1),g=et(null),v=et(null),y=et("");Et(()=>{o&&m.current!==o&&(n==null||n("conversation:new_assistant_change",{assistantId:o}),m.current=o)},[o,n]);const b=Gt(()=>pa(),[]);Et(()=>{var $;if(($=r==null?void 0:r.theme)!=null&&$.colors){const M=document.createElement("style");return M.innerHTML=Woe(r.theme.colors,b),M.id=`g-welcome-styles-${b}`,document.head.appendChild(M),()=>{const N=document.getElementById(M.id);N&&N.remove()}}},[r,b]);const w=Gt(()=>t.find($=>$.id===o),[t,o]),x=Gt(()=>JSON.parse((w==null?void 0:w.configJson)||"{}"),[w]),E=Gt(()=>{if(!d.trim())return t||[];const $=d.toLowerCase().trim();return(t||[]).filter(M=>{var D,T;const N=((D=M.name)==null?void 0:D.toLowerCase())||"";try{const I=((T=JSON.parse(M.configJson||"{}").config_name)==null?void 0:T.toLowerCase())||"";return N.includes($)||I.includes($)}catch{return N.includes($)}})},[t,d]),k=Math.ceil(((E==null?void 0:E.length)||0)/h),S=(E==null?void 0:E.slice((s-1)*h,s*h))||[];Et(()=>{if(o&&o!==v.current){if(p.current&&g.current!==null){v.current=o;return}const $=d.trim()?E:t;if($&&$.length>0){const M=$.findIndex(N=>N.id===o);if(M!==-1){const N=Math.floor(M/h)+1;l(N),v.current=o}}}},[o,t,E,h,d]),Et(()=>{if(d!==y.current){if(p.current&&g.current!==null){l(g.current),p.current=!1,g.current=null,y.current=d;return}if(v.current===o){y.current=d;return}p.current||(d.trim()&&(v.current=null),l(1)),y.current=d}},[d,o]),Et(()=>{k>0&&s>k&&l(k)},[k,s]);const O=x.prologue||"\u60A8\u597D\uFF0C\u6B22\u8FCE\u4F7F\u7528\u5C0F\u9CB8\u667A\u80FD\u95EE\u7B54",A=Goe(O,[o],30);return ut("div",{className:`flex flex-col relative items-center justify-center h-full w-full g-welcome-${b}`,children:[ee("img",{src:a||zoe,alt:"logo",className:"mb-4",style:{width:68,height:68}}),ee("div",{className:"text-3xl font-bold mb-2 g-welcome-title",children:A}),!o&&ee("div",{className:"flex mb-2 g-welcome-subtitle",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B"}),ut("div",{style:{maxWidth:"1200px"},className:`flex mt-8 flex-wrap gap-3\r
592
+ `};function Voe({config:e,styles:t}){if(!e)return null;const n=JSON.parse(e.configJson),r=Gt(()=>{var o;return{...sC.colors,...(o=t==null?void 0:t.theme)==null?void 0:o.colors}},[t]);return ut("div",{className:"w-[340px] rounded-xl p-4 animate-fade-in bg-white",children:[ut("div",{className:"flex items-center mb-2",children:[ee("span",{className:"text-md font-bold truncate mr-2",style:{color:r.primary},children:n.config_name||"\u52A9\u624B\u914D\u7F6E"}),ee("span",{className:"text-xs truncate rounded px-2 py-0.5",style:{backgroundColor:`${r.primary}1A`,color:r.disabled},children:n.model_name})]}),ee("div",{className:"border-b my-2",style:{borderColor:r.border}}),ut("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-700 mb-2",style:{color:r.text},children:[ut("div",{children:["\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_round})]}),ut("div",{children:["\u6700\u5927\u4EE4\u724C\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.max_tokens})]}),ut("div",{children:["\u6E29\u5EA6\uFF1A",ee("span",{className:"font-semibold",children:n.temperature})]}),ut("div",{children:["\u53EC\u56DE\u6570\uFF1A",ee("span",{className:"font-semibold",children:n.top_k})]}),ut("div",{children:["\u591A\u6837\u6027\uFF1A",ee("span",{className:"font-semibold",children:n.top_p})]}),ut("div",{children:["\u76F8\u4F3C\u5EA6\u9608\u503C\uFF1A",ee("span",{className:"font-semibold",children:n.score_threshold})]})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5173\u8054\u77E5\u8BC6\u5E93\uFF1A"}),ee("div",{className:"flex flex-wrap gap-1",children:n.knowledge_base_name?n.knowledge_base_name.split(";").map((o,i)=>ee("span",{className:"px-2 py-0.5 rounded-full text-xs",style:{backgroundColor:`${r.primary}1A`,color:r.primary},children:o},i)):ee("span",{className:"text-gray-300",style:{color:r.disabled},children:"\u65E0"})})]}),ut("div",{className:"mb-2",children:[ee("div",{className:"text-xs text-gray-400 mb-1",style:{color:r.disabled},children:"\u5F00\u542F\u529F\u80FD:"}),ut("div",{className:"flex flex-wrap gap-2 text-xs mt-2",children:[!!n.enabled_faq&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"FAQ"}),!!n.enabled_graph&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u56FE\u8C31"}),!!n.dependOnKb&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u5F3A\u77E5\u8BC6\u4F9D\u8D56"}),!!n.enabled_table_select&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u8868\u683C\u7B5B\u9009"}),!!n.enabled_rerank&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u7CBE\u6392\u6A21\u5F0F"}),!!n.need_trace_source&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u6EAF\u6E90"}),!!n.is_download&&ee("span",{className:"px-2 py-0.5 rounded",style:{backgroundColor:`${r.success}1A`,color:r.success},children:"\u4E0B\u8F7D\u6EAF\u6E90"})]})]})]})}function Goe(e,t=[],n=60){const[r,o]=nt("");return Et(()=>{o("");let i=0;const a=setInterval(()=>{o(s=>i>=e.length?(clearInterval(a),s):(i++,e.slice(0,i)))},n);return()=>clearInterval(a)},[e,...t]),r}function Uoe(e){const{assistantList:t,eventsEmit:n,styles:r,selectedId:o,onSelectAssistant:i,productLogo:a}=e,[s,l]=nt(1),[c,u]=nt(!1),[d,f]=nt(""),h=c||d.trim()?6:12,m=et(),p=et(!1),g=et(null),v=et(null),y=et("");Et(()=>{o&&m.current!==o&&(n==null||n("conversation:new_assistant_change",{assistantId:o}),m.current=o)},[o,n]);const b=Gt(()=>pa(),[]);Et(()=>{var $;if(($=r==null?void 0:r.theme)!=null&&$.colors){const M=document.createElement("style");return M.innerHTML=Woe(r.theme.colors,b),M.id=`g-welcome-styles-${b}`,document.head.appendChild(M),()=>{const N=document.getElementById(M.id);N&&N.remove()}}},[r,b]);const w=Gt(()=>t.find($=>$.id===o),[t,o]),x=Gt(()=>JSON.parse((w==null?void 0:w.configJson)||"{}"),[w]),E=Gt(()=>{if(!d.trim())return t||[];const $=d.toLowerCase().trim();return(t||[]).filter(M=>{var D,T;const N=((D=M.name)==null?void 0:D.toLowerCase())||"";try{const I=((T=JSON.parse(M.configJson||"{}").config_name)==null?void 0:T.toLowerCase())||"";return N.includes($)||I.includes($)}catch{return N.includes($)}})},[t,d]),k=Math.ceil(((E==null?void 0:E.length)||0)/h),S=(E==null?void 0:E.slice((s-1)*h,s*h))||[];Et(()=>{if(o&&o!==v.current){if(p.current&&g.current!==null){v.current=o;return}const $=d.trim()?E:t;if($&&$.length>0){const M=$.findIndex(N=>N.id===o);if(M!==-1){const N=Math.floor(M/h)+1;l(N),v.current=o}}}},[o,t,E,h,d]),Et(()=>{if(d!==y.current){if(p.current&&g.current!==null){l(g.current),p.current=!1,g.current=null,y.current=d;return}if(v.current===o){y.current=d;return}p.current||(d.trim()&&(v.current=null),l(1)),y.current=d}},[d,o]),Et(()=>{k>0&&s>k&&l(k)},[k,s]);const O=x.prologue||"\u60A8\u597D\uFF0C\u6B22\u8FCE\u4F7F\u7528\u5C0F\u9CB8\u667A\u80FD\u95EE\u7B54",A=Goe(O,[o],30);return ut("div",{className:`flex flex-col relative items-center justify-center h-full w-full g-welcome-${b}`,children:[ee("img",{src:a||zoe,alt:"logo",className:"mb-4",style:{width:68,height:68}}),ee("div",{className:"text-3xl font-bold mb-2 g-welcome-title",children:A}),!o&&ee("div",{className:"flex mb-2 g-welcome-subtitle",children:"\u8BF7\u9009\u62E9\u4E00\u4E2A\u667A\u80FD\u52A9\u624B"}),ut("div",{style:{maxWidth:"1200px"},className:`flex mt-8 flex-wrap gap-3
593
593
  max-w-[1200px] px-8 w-full mx-auto justify-center mb-4`,children:[c?ee("div",{className:"flex items-center gap-2 px-5 w-full",style:{flexBasis:"100%"},children:ee(Wu,{className:"g-welcome-search-input w-full",placeholder:"\u641C\u7D22\u52A9\u624B\u540D\u79F0",prefix:ee(LE,{size:16}),suffix:ee("button",{type:"button",onClick:()=>{u(!1),f("")},style:{background:"transparent",border:"none",cursor:"pointer"},children:ee(lC,{size:14})}),value:d,onChange:$=>f($.target.value),autoFocus:!0})}):ee("button",{type:"button",className:"g-welcome-search-btn",onClick:()=>u(!0),children:ee(LE,{size:16})}),S&&S.length>0?ee(Ac,{children:S.map($=>{const M=o===$.id;let N=$.icon;try{const D=JSON.parse($.configJson||"{}");N=N||D.icon||D.avatar||D.logo}catch{}return N=N||Hoe,ee(uC,{content:()=>ee(Voe,{config:t.find(D=>D.id===$.id),styles:r}),trigger:"hover",placement:"bottom",children:ut("button",{type:"button",className:`g-welcome-btn px-3 cursor-pointer rounded-full border font-medium min-w-[160px] text-sm transition-all flex items-center gap-2 ${M?"active":""}`,onClick:()=>{i==null||i($.id);const D=c||d.trim(),P=(D?t:d.trim()?E:t).findIndex(I=>I.id===$.id);if(P!==-1){const R=Math.floor(P/(D?12:h))+1;l(R),v.current=$.id,D&&(g.current=R,p.current=!0,setTimeout(()=>{f(""),u(!1)},100))}},title:$.name,children:[ee("span",{className:"icon-badge",children:ee("img",{src:N,alt:"icon",style:{width:16,height:16,borderRadius:4}})}),ee("span",{className:"truncate max-w-[180px]",children:$.name})]})},$.id)})}):ee("div",{className:"g-welcome-subtitle",children:"\u6682\u65E0\u53EF\u7528\u52A9\u624B"})]}),k>1&&ut("div",{className:"flex items-center gap-2",children:[ee("button",{type:"button",className:"g-welcome-pagination-btn",onClick:()=>l($=>Math.max(1,$-1)),disabled:s===1,children:ee(iH,{size:16})}),ee("div",{className:"flex items-center gap-1",children:(()=>{const $=[];if(k<=7)for(let N=1;N<=k;N++)$.push(N);else if($.push(1),s<=4){for(let N=2;N<=5;N++)$.push(N);$.push("..."),$.push(k)}else if(s>=k-3){$.push("...");for(let N=k-4;N<=k;N++)$.push(N)}else{$.push("...");for(let N=s-1;N<=s+1;N++)$.push(N);$.push("..."),$.push(k)}return $.map((N,D)=>{if(N==="...")return ee("span",{className:"g-welcome-pagination-text px-1",children:"..."},`ellipsis-${D}`);const T=N;return ee("button",{type:"button",className:`g-welcome-pagination-btn ${s===T?"active":""}`,onClick:()=>l(T),children:T},T)})})()}),ee("button",{type:"button",className:"g-welcome-pagination-btn",onClick:()=>l($=>Math.min(k,$+1)),disabled:s===k,children:ee(FF,{size:16})})]})]})}async function qoe(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)}function Yoe(e){let t,n,r,o=!1;return function(a){t===void 0?(t=a,n=0,r=-1):t=Koe(t,a);const s=t.length;let l=0;for(;n<s;){o&&(t[n]===10&&(l=++n),o=!1);let c=-1;for(;n<s&&c===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-l);break;case 13:o=!0;case 10:c=n;break}if(c===-1)break;e(t.subarray(l,c),r),l=n,r=-1}l===s?t=void 0:l!==0&&(t=t.subarray(l),n-=l)}}function Xoe(e,t,n){let r=VA();const o=new TextDecoder;return function(a,s){if(a.length===0)n==null||n(r),r=VA();else if(s>0){const l=o.decode(a.subarray(0,s)),c=s+(a[s+1]===32?2:1),u=o.decode(a.subarray(c));switch(l){case"data":r.data=r.data?r.data+`
594
594
  `+u:u;break;case"event":r.event=u;break;case"id":e(r.id=u);break;case"retry":const d=parseInt(u,10);isNaN(d)||t(r.retry=d);break}}}}function Koe(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function VA(){return{data:"",event:"",id:"",retry:void 0}}var Zoe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const dw="text/event-stream",Qoe=1e3,GA="last-event-id";function Joe(e,t){var{signal:n,headers:r,onopen:o,onmessage:i,onclose:a,onerror:s,openWhenHidden:l,fetch:c}=t,u=Zoe(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((d,f)=>{const h=Object.assign({},r);h.accept||(h.accept=dw);let m;function p(){m.abort(),document.hidden||x()}l||document.addEventListener("visibilitychange",p);let g=Qoe,v=0;function y(){document.removeEventListener("visibilitychange",p),window.clearTimeout(v),m.abort()}n==null||n.addEventListener("abort",()=>{y(),d()});const b=c??window.fetch,w=o??eie;async function x(){var E;m=new AbortController;try{const k=await b(e,Object.assign(Object.assign({},u),{headers:h,signal:m.signal}));await w(k),await qoe(k.body,Yoe(Xoe(S=>{S?h[GA]=S:delete h[GA]},S=>{g=S},i))),a==null||a(),y(),d()}catch(k){if(!m.signal.aborted)try{const S=(E=s==null?void 0:s(k))!==null&&E!==void 0?E:g;window.clearTimeout(v),v=window.setTimeout(x,S)}catch(S){y(),f(S)}}}x()})}function eie(e){const t=e.headers.get("content-type");if(!(t!=null&&t.startsWith(dw)))throw new Error(`Expected content-type to be ${dw}, Actual: ${t}`)}class Bm extends Error{}let Do=null,ia=null,Ar=[],Il,Bl,Rm=new Map;const tie=({baseUrl:e,token:t,CSRFToken:n,setChatData:r,activeSessionId:o,setAppStatus:i,setConversationList:a})=>{const s=g=>{if(!g)return!1;if(typeof g=="string"){const v=g.trim();return v!==""&&v!=="[]"&&v!=="null"}return!0},l=({content:g,status:v,respTime:y,filePaths:b,reference:w,webReference:x,knowledgeBases:E,graphReference:k,databaseReference:S,llmType:O,resultType:A,queryId:$,tokens:M,chain:N,enableCot:D,chainRespTime:T})=>{r(P=>{var W;if(!P[0])return P;const I=P[0],R=I.messages||[],H=R.length-1;if(H<0)return P;const V=R[H];if(V.istype!=="ai")return P;let L=R.slice();if(b!=null&&b.length){const q=R.length-2;if(q>=0&&((W=R[q])==null?void 0:W.istype)==="user"){const U={...R[q],filePaths:b};L[q]=U}}const _=$&&$!==V.queryId,j=v===1&&V.status===2,F=_||j?s(k)?k:null:k!==void 0&&s(k)?k:V.graphReference;v===2&&k!==void 0&&console.log("[AichatUseController] reset_chat status=2 \u65F6\u7684 graphReference:",{graphReference:k,isValid:s(k),lastMessageGraphReference:V.graphReference,finalGraphReference:F,isNewQuery:_,isRestart:j});let B;_?B=g:j?B="":v===4||v===2&&!g?B=V.content||"":B=(V.content||"")+g;const z={...V,content:B,status:v,respTime:y,filePaths:b,reference:_||j?w||"[]":w,webReference:_||j?x||"[]":x,knowledgeBases:_||j?E||"[]":E,graphReference:F,databaseReference:_||j?S!==void 0?S:null:S!==void 0?S:V.databaseReference,resultType:A,llmType:O,tokens:M,queryId:$||V.queryId||pa(32),chain:_||j?N!==void 0?N:void 0:N!==void 0?N:V.chain,enableCot:D!==void 0?D:V.enableCot,chainRespTime:T!==void 0?T:V.chainRespTime};return z.clientSideId=z.clientSideId||z.queryId+"-ai",L[H]=z,[{...I,isNew:!1,messages:L},...P.slice(1)]})},c=g=>{if(g instanceof Bm)throw i(v=>({...v,display:"error",sender:"ready"})),Do&&(Do.abort(),Do=null),ia=null,g};return{updateUserFilesMessage:({currentFiles:g})=>{r(v=>{if(!v[0])return v;const y=v[0],b=y.messages||[];if(!b.length)return v;const w=b.length-2;if(w<0||b[w].istype!=="user")return v;const E=b.slice();return E[w]={...b[w],currentFiles:g},[{...y,messages:E},...v.slice(1)]})},api_startChat_re:(g,v)=>{Do&&Do.abort(),Do=new AbortController,ia=g.sessionId,Ar=[],Il=void 0,Bl=void 0,Rm=new Map;const y=`${e}/qa/ai/question_re`;console.log("data",g);const b={...g};Joe(y,{method:"post",signal:Do.signal,headers:{"Content-Type":"application/json",Accept:"text/event-stream",Authorization:t||"","X-CSRF-TOKEN-IN":n||""},openWhenHidden:!0,body:JSON.stringify(b),onopen:async w=>{if(w.status===500)throw new Bm("Internal Server Error");if(!w.ok)throw new Bm(`HTTP error: ${w.status}`)},onmessage:w=>{var F,B,z,G;const x=JSON.parse(w.data);if(ia!==x.sessionId){console.log("[AichatUseController] \u6D41\u5F0F\u8BF7\u6C42\u7684 sessionId \u5DF2\u4E0D\u5339\u914D\uFF0C\u5FFD\u7565\u6570\u636E",{currentStreamSessionId:ia,receivedSessionId:x.sessionId,activeSessionId:o});return}if(o!==x.sessionId)return;const{reply:E,resultType:k,respTime:S,reference:O,webReference:A,graphReference:$,knowledgeBases:M,filePaths:N,status:D,docs:T,llmType:P,databaseReference:I,businessType:R,nodeStatus:H,enableCot:V,chainRespTime:L}=x;if(D===4&&R){H===2&&typeof L=="number"&&L>0&&Rm.set(R,L);const W=H===2&&typeof L=="number"&&L>0?L:void 0;Ar=Jz(Ar,{businessType:R,nodeStatus:H,reply:E,respTime:W,chainRespTime:W}),console.log("[AichatUseController] status=4 \u805A\u5408\u601D\u7EF4\u94FE\u6570\u636E:",{businessType:R,nodeStatus:H,content:(F=E==null?void 0:E.content)==null?void 0:F.substring(0,50),currentThoughtNodesCount:Ar.length,chainRespTime:H===2?L:void 0})}else D===1&&R&&console.log("[AichatUseController] status=1 \u8DF3\u8FC7\u601D\u7EF4\u94FE\u805A\u5408:",{businessType:R,content:(B=E==null?void 0:E.content)==null?void 0:B.substring(0,50),note:"status=1 \u7684\u5185\u5BB9\u5E94\u8BE5\u53BB\u6B63\u6587\uFF0C\u4E0D\u662F\u601D\u7EF4\u94FE"});if(typeof V=="number"&&(Il=V),D===1||D===2){const W=Array.from(Rm.values()).reduce((q,U)=>q+U,0);W>0&&(Bl=W)}const _=N?JSON.parse(N):[];D===2&&E&&E.content&&(E.content.includes("\u6A21\u578B\u6682\u65E0\u6CD5\u8FD4\u56DE")||E.content.includes("\u5931\u8D25")||E.content.includes("\u9519\u8BEF")||E.content.includes("\u8BF7\u7A0D\u540E\u518D\u8BD5"))&&i(W=>({...W,display:"ready",sender:"ready"}));const j=s($)?$:void 0;if(D===2&&console.log("[AichatUseController] status=2 \u65F6\u7684 graphReference:",{graphReference:$,type:typeof $,isValid:s($),finalGraphReference:j}),D===4){const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content})):void 0;console.log("[AichatUseController] status=4 \u66F4\u65B0\u601D\u7EF4\u94FE:",{businessType:R,chainLength:(W==null?void 0:W.length)||0,replyContentLength:((z=E==null?void 0:E.content)==null?void 0:z.length)||0,note:"status=4 \u65F6\uFF0Creply.content \u5E94\u8BE5\u805A\u5408\u5230\u601D\u7EF4\u94FE\uFF0C\u4E0D\u66F4\u65B0\u6B63\u6587"}),l({content:"",status:D,respTime:S,filePaths:_,reference:O||T||"",webReference:A||"",knowledgeBases:M||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W,enableCot:Il,chainRespTime:Bl})}else if(D===1){Ar.length>0&&(Ar=Ar.map(q=>({...q,nodeStatus:2}))),console.log("[AichatUseController] status=1 \u66F4\u65B0\u6B63\u6587:",{businessType:R,content:(G=E==null?void 0:E.content)==null?void 0:G.substring(0,50),thoughtNodesCount:Ar.length,note:"status=1 \u65F6\uFF0Creply.content \u5E94\u8BE5\u53BB\u6B63\u6587\uFF0C\u601D\u7EF4\u94FE\u8282\u70B9\u72B6\u6001\u66F4\u65B0\u4E3A\u5B8C\u6210"});const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content})):void 0;l({content:E.content||"",status:D,respTime:S,filePaths:_,reference:O||T||"",webReference:A||"",graphReference:j,knowledgeBases:M||"",databaseReference:I??null,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W??void 0,enableCot:Il,chainRespTime:Bl})}else if(D===2){Ar.length>0&&(Ar=Ar.map(q=>({...q,nodeStatus:2})));const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content})):void 0;if(l({content:E.content||"",status:2,respTime:S,filePaths:_,reference:O||T||"",webReference:A||"",knowledgeBases:M||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W,enableCot:Il,chainRespTime:Bl}),Ar=[],i(q=>({...q,display:"ready",sender:"ready"})),v){const q=S||Date.now();console.log("[AichatUseController] \u6D88\u606F\u53D1\u9001\u6210\u529F\uFF0CgmtModified:",q),v(q)}}else{const W=Ar.length>0?Ar.map(q=>({businessType:q.businessType,nodeStatus:q.nodeStatus,content:q.content,respTime:q.respTime,chainRespTime:q.respTime})):void 0;l({content:E.content||"",status:D,respTime:S,filePaths:_,reference:O||T||"",knowledgeBases:M||"",webReference:A||"",graphReference:j,databaseReference:I,llmType:P,resultType:k,queryId:x.queryId,tokens:x.tokens,chain:W,enableCot:Il,chainRespTime:Bl})}},onerror:c,onclose:()=>{ia===g.sessionId&&(ia=null)}})},addEmptyMessage:({queryId:g,content:v,filePaths:y,currentFiles:b})=>{r(w=>{const x=new Date().toISOString(),E=g||pa(32),k={istype:"user",content:v,time:x,queryId:E,clientSideId:E+"-user",filePaths:y||"",currentFiles:b||[]},S={istype:"ai",content:"",time:new Date(Date.now()+1).toISOString(),streaming:!0,status:0,queryId:E,clientSideId:E+"-ai"},O=w.find(A=>A.id===o);return O?O.messages.push(k,S):console.warn("addEmptyMessage called without an active session."),[...w]})},setLastEmptyMessage:({now:g})=>{r(v=>{if(!v[0])return v;const y=v[0],b=y.messages||[];if(!b.length)return v;const w=b.length-1;if(w<0)return v;const x=b[w];if(x.istype!=="ai")return v;const E=b.slice();return E[w]={...x,istype:"ai",content:"",time:g,streaming:!0,status:0},[{...y,messages:E},...v.slice(1)]})},stopStream:()=>{Do&&(Do.abort(),Do=null),ia=null,i(g=>({...g,display:"ready",sender:"ready"}))},cancelStreamBySessionId:g=>Do&&ia===g?(console.log("[AichatUseController] \u5207\u6362\u4F1A\u8BDD\uFF0C\u53D6\u6D88\u6B63\u5728\u8FDB\u884C\u7684\u6D41\u5F0F\u8BF7\u6C42",g),Do.abort(),Do=null,ia=null,i(v=>({...v,display:"ready",sender:"ready"})),!0):!1}},nie=1e3,rie=3e3;function oie({url:e,token:t,CSRFToken:n,onError:r,activeSessionId:o}){const[i,a]=nt([]),[s,l]=nt(()=>({uploadedFiles:[]})),c=et(!1),u=async p=>{var g,v;if(!p)return null;try{const y=await Mr.get(`${e}/index/knowledgeBase/file/getFilesBysessionId?sessionId=${p}`,{headers:{Authorization:t}});console.log("[DEBUG] \u83B7\u53D6\u4E34\u65F6\u6587\u4EF6\u5217\u8868 res:",(g=y==null?void 0:y.data)==null?void 0:g.data),l({uploadedFiles:((v=y==null?void 0:y.data)==null?void 0:v.data)||[]})}catch(y){throw console.error("\u83B7\u53D6\u4E34\u65F6\u6587\u4EF6\u5217\u8868\u5931\u8D25:",y),y}},d=ql((p,g)=>{const v=p.join(",");let y=0,b=null;b=()=>{c.current=!0};const w=async()=>{if(!c.current){if(y>=nie){c.current||g.onFail("\u6587\u4EF6\u89E3\u6790\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");return}y++;try{const x=await Mr.get(`${e}/index/knowledgeBase/file/getFileStatusByUids?uids=${v}`,{headers:{Authorization:t}});if(c.current)return;if(x.data.success){const E=x.data.data;c.current||g.onStatusUpdate(E),E.every(S=>{const O=S.fileParseStatus??S.status;return O===3||O===4})?c.current||g.onComplete():c.current||setTimeout(w,rie)}else c.current||g.onFail(x.data.errorMsg||"\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u5931\u8D25")}catch(x){if(r==null||r(x),c.current)return;g.onFail("\u67E5\u8BE2\u6587\u4EF6\u72B6\u6001\u65F6\u53D1\u751F\u7F51\u7EDC\u9519\u8BEF")}}};return w(),b},[e,t,r]),f=ql(async(p,g)=>{if(!p){console.warn("[DEBUG] \u7F3A\u5C11uid\uFF0C\u65E0\u6CD5\u5220\u9664\u4E34\u65F6\u6587\u4EF6");return}Loe({url:e,token:t,CSRFToken:n},{uid:p,queryId:g},(v,y)=>{v?(gr.success("\u6587\u4EF6\u5DF2\u4ECE\u4E34\u65F6\u77E5\u8BC6\u5E93\u79FB\u9664"),u(o)):(console.log("[DEBUG] removeFilefromTempUpload \u56DE\u8C03 false\uFF0Cres:",y),gr.error("\u6587\u4EF6\u79FB\u9664\u5931\u8D25"))})},[e,t,n,o]),h=ql(()=>{c.current=!1},[]),m=ql(()=>{c.current=!0},[]);return{fileManagerData:s,fileStatuses:i,setFileManagerData:l,setFileStatuses:a,pollFileStatus:d,handleRemoveFromTemp:f,resetStopFlag:h,setStopFlag:m,stoppedRef:c,getTempFileList:u}}function iie({fileManagerData:e,styles:t,eventsEmit:n}){const[r,o]=nt(!1),[i,a]=nt(!1),s=Gt(()=>{var m;const c=((m=e.uploadedFiles)==null?void 0:m.length)||0;if(c===0)return null;const u=p=>p?p<1024?`${p}B`:p<1024*1024?`${(p/1024).toFixed(0)}KB`:isNaN(p)?p||"":`${(p/1024/1024).toFixed(1)}MB`:"",d=p=>{var v;const g=((v=p.split(".").pop())==null?void 0:v.toUpperCase())||"";return g==="DOCX"||g==="DOC"?"DOC":g==="XLSX"||g==="XLS"?"XLS":g==="PPTX"||g==="PPT"?"PPT":g==="JPG"||g==="JPEG"?"JPG":g},f=p=>{var v;switch(((v=p.split(".").pop())==null?void 0:v.toLowerCase())||""){case"docx":case"doc":return ee(Kr,{type:"rag/word",size:32});case"jpg":case"jpeg":case"png":case"gif":case"bmp":case"webp":case"svg":case"ico":return ee(Kr,{type:"rag/pic",size:32});case"pptx":case"ppt":return ee(Kr,{type:"rag/ppt",size:32});case"xls":case"xlsx":case"xlsm":case"xlsb":case"xltx":case"xltm":case"xlt":case"xlam":return ee(Kr,{type:"rag/excel",size:32});case"csv":return ee(Kr,{type:"rag/csv",size:32});case"pdf":return ee(Kr,{type:"rag/pdf",size:32});case"txt":return ee(Kr,{type:"rag/txt",size:32});case"md":return ee(Kr,{type:"rag/txt",size:32});case"json":return ee(Kr,{type:"rag/json",size:32});case"html":case"htm":return ee(Kr,{type:"rag/url",size:32});default:return ee(Kr,{type:"rag/file",size:32})}},h=ut("div",{className:"bg-white rounded-lg",style:{width:"280px",maxHeight:"400px",overflowY:"auto",padding:"8px"},children:[ee("div",{className:"text-sm font-semibold",style:{color:"#333",fontWeight:700,fontSize:"16px"},children:"\u4E34\u65F6\u77E5\u8BC6\u5E93\u6587\u6863"}),ee("div",{style:{fontSize:"12px",color:"#86909C",marginTop:"4px"},children:"\u4E34\u65F6\u77E5\u8BC6\u5E93\u5185\u5BB9\u4E3A\u672C\u6B21\u4F1A\u8BDD\u4E0A\u4F20\u6587\u4EF6\uFF0C\u5220\u9664\u540E\u5C06\u4E0D\u518D\u751F\u6548\u3002"}),ee("div",{className:"flex flex-col gap-3",children:e.uploadedFiles.map((p,g)=>{var x,E,k;const v=p.name||((x=p.file)==null?void 0:x.name)||p.fileName||((E=p.file)==null?void 0:E.fileName)||"",y=((k=p.file)==null?void 0:k.size)||p.size||0,b=f(v),w=d(v);return ut("div",{className:"fileItem flex items-center cursor-pointer rounded transition-colors",style:{padding:"8px",border:"1px solid transparent",height:"56px"},onClick:()=>{var $;o(!1);const S=(($=(v||"").split(".").pop())==null?void 0:$.toLowerCase())||"",O=p.convertedFilePath||p.parseUrl||p.parsedFilePath,A=p.url||p.filePath||p.convertedFilePath;!O&&p.uid?n("referenceFile_question",{data:{...p,file_name:v,file_type:S,url:A,convertedFilePath:p.convertedFilePath,filePath:p.url||p.filePath,parsedFilePath:p.parsedFilePath||p.convertedFilePath,pdfPages:p.pdfPages||0,size:p.size||u(y),metadata:{...p.metadata||{},source:A,convertedFilePath:p.convertedFilePath,filePath:p.url||p.filePath,name:v,pdfPages:p.pdfPages||0,size:p.size||u(y)}}}):n("reference_file:click",{file:v,file_type:S,url:p.url||p.filePath,parse_url:O,retrieve_tags:p.retrieveTags||[],file_id:p.uid||p.file_id,uid:p.uid,parsed_file_type:S,type:S,isUploadFile:!0,pdfPages:p.pdfPages||0,metadata:p.metadata||{convertedFilePath:p.convertedFilePath,filePath:p.url||p.filePath,name:v,pdfPages:p.pdfPages||0}})},children:[ee("div",{style:{width:"32px",height:"32px",marginRight:"12px"},children:b}),ut("div",{className:"flex-1 min-w-0",children:[ut("div",{className:"flex justify-between items-center",children:[ee("div",{className:"text-sm font-medium truncate",style:{color:"#333",marginBottom:"4px"},title:v,children:v}),ee(LF,{title:"\u786E\u8BA4\u4ECE\u4E34\u65F6\u5BF9\u8BDD\u77E5\u8BC6\u5E93\u79FB\u9664\u8BE5\u6587\u4EF6\uFF1F",onConfirm:S=>{S.stopPropagation(),n&&n("uploaded_file:removeFromTemp",{file:p})},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",children:ee(lC,{size:14,style:{cursor:"pointer",marginLeft:"8px",color:"#999"},onClick:S=>S.stopPropagation()})})]}),ut("div",{className:"text-xs",style:{color:"#999",fontSize:"12px"},children:[w," ",u(y)]})]})]},p.uid||g)})})]});return ut("div",{className:"flex items-center",children:[ee(uC,{content:h,trigger:"click",placement:"bottomRight",overlayClassName:"file-list-popover",open:r,onOpenChange:o,children:ee(Ks,{title:ee("div",{style:{width:"108px",fontSize:"12px"},children:"\u67E5\u770B\u4E34\u65F6\u77E5\u8BC6\u5E93\u6587\u6863"}),placement:"top",color:"#5F5E6B",children:ee("div",{className:"flex items-center cursor-pointer hover:opacity-80 transition-opacity",children:ut("div",{className:"linshiBtn",style:{width:"119px",height:"32px",border:"1px solid #E5E6EB",borderRadius:"8px",display:"flex",justifyContent:"center",alignItems:"center"},children:[ee(dH,{size:16,style:{color:"#1D2129"}}),ee("div",{style:{color:"#1D2129",fontSize:"12px",margin:"0 4px"},children:"\u4E34\u65F6\u77E5\u8BC6\u5E93"}),ee("div",{style:{width:"18px",height:"18px",borderRadius:"100%",backgroundColor:"#DBEAFE",fontSize:"10px",color:"#4E6EF2",fontWeight:500,display:"flex",justifyContent:"center",alignItems:"center"},children:c})]})})})}),ee("div",{style:{borderRight:"1px solid #DDE0E5",height:"16px",margin:"0 8px"}}),ee(Ks,{title:ut("div",{style:{width:"204px",fontSize:"12px"},children:[ee("div",{children:"\u5F00\u542F\uFF1A\u56DE\u7B54\u4EC5\u57FA\u4E8E\u4E34\u65F6\u77E5\u8BC6\u5E93\u68C0\u7D22\u5185\u5BB9 "}),ee("div",{children:"\u5173\u95ED\uFF1A\u56DE\u7B54\u57FA\u4E8E\u4F01\u4E1A\u77E5\u8BC6\u5E93\u68C0\u7D22\u5185\u5BB9 "})]}),placement:"top",color:"#5F5E6B",children:ee(Gz,{checkedChildren:"\u5F00",unCheckedChildren:"\u5173",checked:i,onChange:p=>{a(p),n("TempKnowledgeBase",p)}})})]})},[e.uploadedFiles,t,n,r]),l=et(e.uploadedFiles||[]);return Et(()=>{var d;if(!((d=e==null?void 0:e.uploadedFiles)!=null&&d.length))return;const c=JSON.stringify(l.current||[]),u=JSON.stringify(e.uploadedFiles||[]);c!==u&&(l.current=e.uploadedFiles||[],a(!0),n("TempKnowledgeBase",!0))},[e.uploadedFiles]),{FileDisplayTools:s,setFileListPopoverOpen:o}}const aie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACRSURBVHgB7ZJBCsQgDEWTmQvMncT7dOuqmY3iai6kMN31UmIjdNFFKuk+DwKahP9ABDAMQyTnvHCtT/ZjjIs0e0nN1hr03kkjGTu8+0PEjzR/S81a6+6cQz6S9x5KKdsknLi+IQRSC07JfybRhE8FM4k2fICgIKVE/MYrF427NlwtuEpOgSr8MUNy9x0Nw7jnAFsnZ7Uu5CkqAAAAAElFTkSuQmCC",{TextArea:UA}=Wu,{useForm:sie}=Ia,m9={\u56DE\u7B54\u4E0D\u4F73:"ansPoor",\u683C\u5F0F\u95EE\u9898:"formatError",\u7406\u89E3\u95EE\u9898\u6709\u8BEF:"harmfulInfo",\u5176\u4ED6:"othres"},lie=({open:e,setOpen:t,feedBackList:n,handleConfirm:r})=>{const o={header:{padding:"20px 24px",borderBottom:"1px solid #F0F0F0",margin:0},body:{padding:"16px 24px 20px 24px",borderBottom:"1px solid #F0F0F0"},mask:{},footer:{padding:"16px 24px",margin:0},content:{padding:0,borderRadius:"4px",width:"563px"}},[i]=sie(),[a,s]=nt({}),l=async()=>{try{const u=await i.validateFields();t(!1);const d={...u};Object.entries(a||{}).forEach(f=>{const[h,m]=f;m&&(d[m9[h]]=m)}),r(d)}catch(u){console.log(u);return}};Et(()=>{e||(i.resetFields(),s(null))},[e]);const c=Gt(()=>{var u;return(u=JSON.parse(localStorage.getItem("gitech_ril:rag_ai")||"{}"))==null?void 0:u.userInfo},[e]);return ee(bd,{modal:{styles:o},children:ut(cC,{open:e,onCancel:()=>t(!1),title:ee("div",{className:"text-[16px] text-[#2A2A2A] font-bold leading-[1]",children:"\u611F\u8C22\u60A8\u7684\u53CD\u9988\uFF01\u8FD9\u5C06\u5E2E\u52A9\u6211\u4EEC\u4E0D\u65AD\u4F18\u5316\u4E0E\u63D0\u5347\u3002"}),destroyOnHidden:!0,footer:ut("div",{children:[ee(ki,{className:"mr-[16px] w-[76px]",onClick:()=>{t(!1)},children:"\u53D6\u6D88"}),ee(ki,{type:"primary",className:"w-[76px] border-none",onClick:l,children:"\u786E\u8BA4"})]}),children:[ee(cie,{feedBackList:n,treeSelectResult:a,setTreeSelectResult:s}),ut(Ia,{form:i,layout:"vertical",children:[ee(Ia.Item,{name:"supplementExplain",label:"\u8865\u5145\u63CF\u8FF0",children:ee(UA,{})})," ",ee(Ia.Item,{name:"idealAnswer",label:"\u60A8\u89C9\u5F97\u66F4\u597D\u7684\u56DE\u7B54\u662F\u4EC0\u4E48\uFF1F",children:ee(UA,{})}),c&&ut(Ac,{children:[ee(Ia.Item,{name:"userPhone",label:"\u8054\u7CFB\u7535\u8BDD",initialValue:c==null?void 0:c.phone,children:ee(Wu,{disabled:!0})}),ee(Ia.Item,{name:"deptName",label:"\u90E8\u95E8",initialValue:c==null?void 0:c.deptName,children:ee(Wu,{disabled:!0})})]})]})]})})},cie=({feedBackList:e,treeSelectResult:t,setTreeSelectResult:n})=>{const[r,o]=nt(!1),[i,a]=nt([]),[s,l]=nt([]),[c,u]=nt([]),[d,f]=nt(null),h=Gt(()=>(l([]),d!=null&&d.items?[{title:"\u5168\u9009",key:"\u5168\u9009",children:d.items.map(p=>({title:p,key:p}))}]:[]),[d]),m=p=>{u(g=>Array.isArray(g)&&Array.isArray(s)?Object.entries(t).reduce((y,b)=>{const[w,x]=b,k=(x?x.split(";"):[]).filter(S=>S!==p);return n(S=>({...S||{},[w]:k.join(";")})),[...y,...k]},[]):g)};return Et(()=>{if(a(["\u5168\u9009"]),!t||!(d!=null&&d.que_name))return;const p=t[d.que_name]||"",g=p?p.split(";"):[];l(g)},[h,r]),Et(()=>{t===null&&(u([]),f(null),l([]))},[t]),Et(()=>{console.log("treeSelectResult",t),console.log("selectedValue",c),console.log("feedBackList",e),console.log("pKey",m9),console.log("selectedParent",d)},[t,c]),ut("div",{className:"relative mb-[24px] z-20",children:[ut("div",{className:"absolute w-full z-10",children:[ut("div",{className:"h-[32px] box-border flex items-center justify-between border-[1px] border-solid border-[#D9D9D9] rounded-[4px] cursor-pointer",onClick:()=>o(!r),children:[ee("div",{className:"ml-[16px]",children:"\u95EE\u9898\u7C7B\u578B"}),ee("img",{src:aie,width:24,height:24,className:"mr-[16px]"})]}),ut("div",{style:{display:r?"":"none"},className:"h-[288px] rounded-[4px] shadow-md mt-[4px] bg-white",children:[ut("div",{className:"h-[248px] flex",style:{borderBottom:"1px solid #F0F0F0"},children:[ee("div",{className:"w-[203px] px-[8px] py-[8px]",style:{borderRight:"1px solid #F0F0F0"},children:e.map((p,g)=>{var v;return ut("div",{className:"rounded-[4px] h-[32px] cursor-pointer flex items-center",style:{backgroundColor:(d==null?void 0:d.que_name)===p.que_name?"#E6F4FF":""},children:[ee("div",{className:"h-full w-full leading-[32px]",onClick:()=>{f(p)},children:ut("div",{className:"ml-[8px] text-[14px] text-[#2A2A2A]",children:[p.que_name,"(",t&&t[p.que_name]?t[p.que_name].split(";").length:0,"/",(v=p==null?void 0:p.items)==null?void 0:v.length,")"]})}),ee(FF,{className:"mr-[8px] w-3 h-3 text-[rgba(0,0,0,0.45)]"})]},g)})}),ee("div",{className:"selfTree h-full flex-1 mt-[8px] ml-[16px]",children:ee(eH,{checkable:!0,defaultSelectedKeys:["0-1"],treeData:h,blockNode:!0,checkedKeys:s,expandedKeys:i,onCheck:p=>{Array.isArray(p)&&n(g=>({...g||{},[(d==null?void 0:d.que_name)||""]:(p||[]).filter(v=>v!=="\u5168\u9009").join(";")})),l(p)}})})]}),ut("div",{className:"flex justify-end h-[40px] items-center",children:[ee(ki,{size:"small",className:"mr-[8px]",onClick:()=>o(!1),children:"\u53D6\u6D88"}),ee(ki,{size:"small",type:"primary",className:"border-none mr-[16px]",onClick:()=>{u(p=>Array.isArray(p)&&Array.isArray(s)?Object.values(t).reduce((v,y)=>[...v,...y?y.split(";"):[]],[]):p),o(!1)},children:"\u786E\u8BA4"})]})]})]}),ee("div",{className:"h-[32px]"}),!!(c!=null&&c.length)&&ut("div",{children:[ut("div",{className:"mt-[5px] text-[12px] text-[#555555]",children:["\u5DF2\u9009\u62E9 ",c.length," \u4E2A"]}),(c||[]).map(p=>{let g="";return Object.entries(t||{}).forEach(v=>{const[y,b]=v;b.indexOf(p)>-1&&(g=y)}),ut(Yz,{closable:!0,className:"mt-[5px]",onClose:()=>m(p),children:[g,"\uFF08",p,"\uFF09"]},p)})]})]})};function uie({title:e,subtitle:t}){const[n,r]=nt(0);return Et(()=>{let o;return n<98?o=setTimeout(()=>{r(i=>i+Math.random()*6+1)},80):n<100&&(o=setTimeout(()=>r(100),400)),()=>clearTimeout(o)},[n]),ut("div",{className:"flex flex-col justify-center items-center min-h-screen bg-gradient-to-br from-[#EEF4FF] via-white to-[#F5F8FF]",children:[ut("div",{className:"mb-8 flex flex-col items-center",children:[ee("div",{className:"mt-6 text-2xl font-semibold text-[#222222] tracking-wide",children:e||"\u5C0F\u9CB8\u667A\u80FD\u4F1A\u8BDD\u52A9\u624B"}),ee("div",{className:"mt-2 text-sm text-[#555555]",children:t||"\u8BA9\u667A\u80FD\u5BF9\u8BDD\u66F4\u7B80\u5355"})]}),ut("div",{className:"relative w-80 max-w-sm",children:[ee("div",{className:"w-full h-2 bg-[#EEF4FF] rounded-full overflow-hidden shadow-inner",children:ee("div",{className:"h-full bg-gradient-to-r from-[#2B69FF] to-[#8F91FF] transition-all duration-300 ease-out",style:{width:`${Math.min(n,100)}%`}})}),ut("div",{className:"absolute -right-2 top-5 text-sm text-[#555555]",children:[Math.min(Math.round(n),100),"%"]})]}),ut("div",{className:"mt-8 flex flex-col items-center gap-2",children:[ee("div",{className:"text-sm text-[#555555] animate-pulse",children:"\u6B63\u5728\u521D\u59CB\u5316\u5E94\u7528"}),ee("div",{className:"text-xs text-[#888888]",children:"\u9996\u6B21\u52A0\u8F7D\u53EF\u80FD\u9700\u8981\u4E00\u4E9B\u65F6\u95F4\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85"})]})]})}const v9=document.createElement("style");v9.textContent=`
595
595
  .animate-bounce-slow {
@@ -790,7 +790,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
790
790
  <div onwheel="event.stopPropagation();" onmousewheel="event.stopPropagation();" ontouchmove="event.stopPropagation();" style="max-width:310px; max-height:300px; overflow-y:auto; padding:10px 12px;">
791
791
  ${k}${S}
792
792
  </div>
793
- `}}:!1,...d}),[t,n,o,i,a,s,l,c,d]);if(!p)return dh.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"\u6570\u636E\u8F6C\u6362\u5931\u8D25"});try{return console.log("\u5F00\u59CB\u6E32\u67D3 NodeGraph..."),dh.jsx(jbe,{data:p,behaviors:{dragCanvas:{direction:"both"},zoomCanvas:!0,dragElement:!0,optimizeViewportTransform:!0},plugins:v,layout:Gt(()=>{if(!u)return{animate:!1,animation:!1};const b={...u};return b.animate=!1,b.animation=!1,b!=null&&b.options&&typeof b.options=="object"&&(b.options={...b.options,animate:!1,animation:!1}),b},[u]),onReady:(b=>{m.current=b,console.log("KnowledgeGraphPreview ready:",b);const w=g;if(w){const x=()=>{var A,$,M;try{if(typeof b.fitView=="function"&&((A=b.fitView)==null||A.call(b,{padding:40})),typeof b.focusItem=="function")b.focusItem(w,!0);else if(typeof b.focusElement=="function")b.focusElement(w,!0);else if(typeof b.centerElement=="function")b.centerElement(w);else{const D=typeof b.getNode=="function"?b.getNode(w):typeof b.findById=="function"?b.findById(w):null,T=(($=D==null?void 0:D.getModel)==null?void 0:$.call(D))??((M=D==null?void 0:D.getData)==null?void 0:M.call(D)),P=T==null?void 0:T.x,I=T==null?void 0:T.y;P!=null&&I!=null&&(typeof b.panTo=="function"?b.panTo(P,I):typeof b.focusViewport=="function"&&b.focusViewport(P,I))}const N=b.getZoom?b.getZoom():1;typeof b.zoomTo=="function"&&N<.9&&b.zoomTo(.9)}catch(N){console.warn("\u5C45\u4E2D\u8282\u70B9\u5931\u8D25:",N)}};setTimeout(x,80);const E=A=>{try{const $=b;if(typeof $.once=="function")$.once(A,()=>setTimeout(x,30));else if(typeof $.on=="function"){const M=()=>{var N;setTimeout(x,30);try{(N=$.off)==null||N.call($,A,M)}catch{}};$.on(A,M)}}catch{}};E("afterlayout"),E("layoutEnd");let k=0;const S=1,O=setInterval(()=>{k+=1,x(),k>=S&&clearInterval(O)},150)}f&&f(b)}),onDestroy:h})}catch(b){return console.error("=== \u6E32\u67D3\u9519\u8BEF ==="),console.error("\u9519\u8BEF\u7C7B\u578B:",(y=b==null?void 0:b.constructor)==null?void 0:y.name),dh.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"red"},children:["\u56FE\u8868\u6E32\u67D3\u5931\u8D25: ",b instanceof Error?b.message:"\u672A\u77E5\u9519\u8BEF"]})}}const Ybe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACqSURBVHgBzZFNDoQgDIX5uQ3hOMDam8gcxS2nmDkEbL0JDDViiJay9SVNatv3RZ+MvUbOud0Ys87u4MZau7dn0e02zrmnILCDm1pbm8nWxBi/WmteW6+UYiml38D8CSH4B4CCjMwgjr1qzcOXUtZax/HIPAT0kBOAmkFiBMg5F6y/S2LD/ptrQQ5osCjgHtjs70jK3OYURM7MM8gVohBiodIGwe7MZWGv0R+Uy3dwBYPzyQAAAABJRU5ErkJggg==",Vg=({title:e,setOpen:t})=>ut("div",{style:{width:"100%",height:"60px",borderBottom:"1px solid #EBEBEB",padding:"20px",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"16px",fontWeight:600},children:[ee("div",{children:e}),ee("img",{src:Ybe,style:{width:"16px",height:"16px",cursor:"pointer"},onClick:()=>t(!1)})]});Lbe();const Xbe=({curFileInfo:e,onClose:t,token:n})=>{var s;const r={title:"",subtitle:"",backgroundColor:"#f8f9fa",showGrid:!1,showLegend:!1,showTooltip:!1,showFullscreen:!1,showMinimap:!1},[o,i]=nt({nodeList:[],edgeList:[]});Et(()=>{console.log("curFileInfo",e)},[e]);const a=async l=>{if(!(!(l!=null&&l.id)||!(l!=null&&l.cyphers)||!(l!=null&&l.fetchUrl)))try{const{cyphers:c,fetchUrl:u,id:d}=l||{};console.log("getGraphData params",c,u,d);const f=await Mr.post(u,{cyphers:c,ontologyId:d},{headers:{Authorization:n}});console.log("getGraphData res",f),i((f==null?void 0:f.data)||{})}catch(c){console.log("error",c)}};return Et(()=>{a(e)},[e]),ut("div",{children:[ee(Vg,{title:e==null?void 0:e.graphName,setOpen:t}),ee("div",{style:{width:"100%",height:"calc(100vh - 60px)"},children:ee(qbe,{centerNode:{vid:(s=e==null?void 0:e.traceNode)==null?void 0:s.vid},data:o,layout:{type:"force",linkDistance:190},title:r.title,subtitle:r.subtitle,backgroundColor:r.backgroundColor,showGrid:r.showGrid,showLegend:r.showLegend,showTooltip:r.showTooltip,showFullscreen:r.showFullscreen,showMinimap:r.showMinimap,customPlugins:{},onReady:l=>{console.log("KnowledgeGraphPreview ready:",l)}})})]})},PE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAV9SURBVHgBvVZfb1VFEJ/ZPS2l9cpFQypSEEMhUmKiYjQBoxDjm8ZoQuKjTyZ+AV9MrOAH8MlHE99rRKOvPgCSoAkalbQx1mBLLV4vpX9u2t6es7vjzOyevZdg5Y2b7N09c3Zn5jfzm9kDcJ9/uN2LZy6c/RAMfoCASFlKcoKAREb8H0Us/G89RH2v9OHc9gYvnQusDPnHU1Ajaky9jAbjGsQhijPV+6IjaVYdcTuY7QzyaT4ouyijU5k8q5hEC1JaK2KFo/ti6Kg+GWrnoID/+yUDmM9TDUxDG50Ssf5jL+SEtQGq98E9ECZDd6IGjWVUlgxjTlKMxl1nkvG+FMhWejtQ+HgzVM1Vt0n/dNfwRneZ/u6u4HK1Dl1f8ZZwV75Xqk1YDyX8tDan2iJirJVjzkZKv0jrkE7yQ5ONggsBtkJFnXIDV7bWYbnswLovMUQnE4mSKn7eMzAiijKhqAaCRIk06YAyUA2K+GDexUh88HwwkOO5Cg6dcxAghiYRNBOVCorhTXRSttZ5jZkVZmGkGmWDyWHCwAgDk8o5z4YqKitHlavQM/raWEKpFipTwe3OCiXMiD18cVYKZw71GU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wZ59/AcalYkfFCITdAAAAAElFTkSuQmCC",MS=e=>e||"",Sz=["txt","pdf","jpeg","jpg","png"],Qbe=e=>[""].includes(e),op=`http://${location.hostname}:9000/`,jT={docx:_T,doc:_T,pdf:Zbe,xls:PE,xlsx:PE,csv:PE,ppt:IE,pptx:IE,pub:IE,txt:Kbe,png:BE,jpg:BE,jpge:BE},Jbe=e=>jT[e]||jT.txt,aC=()=>"/proxy",NS=e=>{var r;let t=e==null?void 0:e.file_type;const n=(r=e==null?void 0:e.metadata)==null?void 0:r.source;if(n)t=n.split(".").slice(-1)[0];else return(e==null?void 0:e.file_source)||"";return Sz.includes(t)?n.includes("http")?n:`${op}${n}`:(e==null?void 0:e.file_source)||""},DS=e=>{var r;if(!e)return"";const{file_name:t}=e;if(t)return t;const n=(r=e==null?void 0:e.metadata)==null?void 0:r.source;if(n){const o=n.split("/");return o.length?o[o.length-1]:""}else return""},ip=(e,t)=>{var r;if(!e)return"";const n=(r=e==null?void 0:e.metadata)==null?void 0:r.source;if(n){const o=n.split(".");if(!o.length)return"";const i=o[o.length-1],a=(t||"").split(".");if(!a.length)return"";const s=a[a.length-1];switch(i.toLocaleLowerCase()){case"ppt":case"pub":case"pptx":return"pdf_slides";case"xls":case"xlsx":case"csv":case"md":return s==="pdf"?"pdf":"markdown_table";case"png":case"jpg":case"jpeg":return"image";case"html":case"htm":return"html";case"txt":return"text";default:return s==="ppt"||s==="pub"||s==="pptx"?"pdf_slides":"pdf"}}else return""},exe=async({filePath:e,fileName:t,token:n})=>{if(e&&t)try{const r=await Mr.post("/proxy/index/knowledgeBase/file/stream",{convertedFilePath:e},{headers:{"Content-Type":"application/json",Authorization:n},responseType:"arraybuffer"});console.log("response",r);const o=new Blob([r.data]),i=window.URL.createObjectURL(o),a=document.createElement("a"),s=document.body;a.href=i,a.download=t,a.style.display="none",s.appendChild(a);const l=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});a.dispatchEvent(l),setTimeout(()=>{s.removeChild(a),window.URL.revokeObjectURL(i)},100)}catch(r){console.error("\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25\uFF1A",r)}else console.error("\u7F3A\u5C11\u6587\u4EF6\u540D\u6216\u6587\u4EF6\u5730\u5740\uFF1A")},Az=(e,t)=>{var n,r,o,i,a,s;try{if((r=(n=t==null?void 0:t.metadata)==null?void 0:n.page_size)!=null&&r.length){let l=((i=t==null?void 0:t.metadata)==null?void 0:i.page_size)||[[0,0]];Array.isArray(l)||(l=JSON.parse(l));const c=((a=l[0])==null?void 0:a[0])||0;return(((s=l[0])==null?void 0:s[1])||0)>c||!e||!c||c<=e?1:+(e/c).toFixed(4)}else{const l=MS(NS(t)),c=ip(t,l);let u=c;const d=(t==null?void 0:t.file_name)||((o=t==null?void 0:t.metadata)==null?void 0:o.source);if(d){const f=d.split(".");u=f==null?void 0:f[f.length-1]}return LT(c)||LT(u)?.6:1}}catch(l){return console.log("error",l),1}},LT=e=>["ppt","pptx","pub"].includes(e.toLocaleLowerCase()),txe=e=>{if(!e)return"";const t=e.split("/"),n=t.length,r=t[n-3];if(!r)return"";const o=r.split(".");return o[o.length-1]},nxe=e=>{try{if(!e)return"";const t=e.split("/"),n=t.length;return t[n-3]||""}catch{return""}},rxe=({content:e,onClose:t,token:n})=>{const r=a=>{if(!(a!=null&&a.metadata))return;const s=ip(a,""),{page_number:l,page_size:c,position:u,offset:d,chunk_type:f}=a.metadata;if(s==="markdown_table")return d!=null&&d.length?{annotations:[{id:pa(),offsets:d}],initialPage:1}:{};{if(!c||!u)return console.log("%c\u7F3A\u5C11\u6587\u4EF6size\u6216\u8005\u6587\u4EF6\u5750\u6807","color: red"),{};const h=Array.isArray(c)?c:JSON.parse(c);if(!h.length)return console.log("%c\u7F3A\u5C11\u6587\u4EF6size","color: red"),{};const m=Array.isArray(u)?u:JSON.parse(u);return!m.length||!l?(console.log("%c\u7F3A\u5C11\u6587\u4EF6\u5750\u6807\u6216\u8005\u6587\u4EF6\u9875\u6570","color: red"),{}):{annotations:m.map((g,v)=>({id:pa(),pageNumber:l[v],x:+(g[0][0]/h[0][0]).toFixed(4),y:+(g[0][1]/h[0][1]).toFixed(4),width:+((g[1][0]-g[0][0])/h[0][0]).toFixed(4),height:+((g[2][1]-g[0][1])/h[0][1]).toFixed(4),content:"",color:f==="image"?"#60f74f":"#4FC3F7"})),initialPage:l[0]}}},o=Gt(()=>{var a,s;if(console.log("content88888888888",e),e&&n){console.log("content999",e);const{annotations:l,initialPage:c}=r(e),u={...e,metadata:{source:((a=e==null?void 0:e.metadata)==null?void 0:a.source)||e.parse_url||e.url,page_size:(s=e==null?void 0:e.metadata)==null?void 0:s.page_size}},d=MS(NS(u));return{filePath:d,fileName:DS(u),fileType:ip(u,d),totalPages:u.pdfPages||0,token:n,annotations:l,initialPage:c,initialZoom:Az(598,u)}}else return{}},[e]),i=Gt(()=>o.filePath?(console.log("curData",o),ee(IF,{initialZoom:o.initialZoom||100,convertedFilePath:o.filePath,fileName:o.fileName,fileType:o.fileType,initialPage:o.initialPage,totalPages:o.totalPages,authorization:o.token,annotations:o.annotations,streamApiUrl:"/proxy/index/knowledgeBase/file/stream",eventsEmit:a=>{switch(a){case"viewer:close":t();break}},tools:{close:!0}})):ee(Ac,{}),[o]);return ee("div",{style:{fontFamily:"Source Han Sans CN",fontSize:"12px"},className:"h-full w-full",children:i})},$z=({curFileInfo:e,onClose:t,token:n})=>{const r=Gt(()=>{var i,a,s;if(e&&n){console.log("content999",e);const l={file_source:e.parse_url||e.parsedFilePath||e.url,file_type:e.file_type,metadata:{source:e.filePath||e.url||((i=e==null?void 0:e.metadata)==null?void 0:i.source)||"",page_size:(a=e==null?void 0:e.metadata)==null?void 0:a.page_size},pdfPages:e.pdfPages},c=MS(NS(l));return{filePath:c,fileName:DS(l),fileType:ip(l,c),totalPages:l.pdfPages||0,token:n,initialZoom:Az(((s=document.getElementById("pdfBox"))==null?void 0:s.clientWidth)||0,l)}}else return{}},[e]),o=Gt(()=>(console.log("curData",r),r.filePath?ee(IF,{initialZoom:r.initialZoom||100,convertedFilePath:r.filePath,fileName:r.fileName,fileType:r.fileType,initialPage:1,totalPages:r.totalPages,authorization:r.token,streamApiUrl:"/proxy/index/knowledgeBase/file/stream",eventsEmit:i=>{switch(i){case"viewer:close":t();break}},tools:{close:!0}}):ee(Ac,{})),[r]);return ee("div",{id:"pdfBox",className:"h-full overflow-y-auto",children:o})},oxe=({curFileInfo:e,token:t,onClose:n})=>{const[r,o]=nt(1),[i,a]=nt(10),[s,l]=nt([]),[c,u]=nt([]),[d,f]=nt(0);Et(()=>{var v;const g=((v=e==null?void 0:e.metadata)==null?void 0:v.fetchUrl)||(e==null?void 0:e.fetchUrl);g&&m(g)},[e,r,i]);const h=async({url:g,params:v})=>{var y;try{const b=await Mr.get(`${aC()}${g}?${new URLSearchParams(v).toString()}`,{headers:{Authorization:t}}),w=(y=b==null?void 0:b.data)==null?void 0:y.data;if(w){const{columns:x,dataList:E,totalData:k}=w;l(((x==null?void 0:x.slice(1))||[]).map(S=>({title:S.businessName,dataIndex:S.physicalName,key:S.physicalName}))),u(E||[]),f(k||[])}}catch(b){console.log("error",b)}},m=async g=>{h({url:`${g}`,params:{pageNo:r,pageSize:i}})},p=Gt(()=>{const{databaseName:g,businessTableName:v,tableName:y}=e;return`${g} - ${y||v}`},[e]);return ut("div",{children:[ee(Vg,{title:p,setOpen:n}),(s==null?void 0:s.length)>0?ut("div",{children:[ee("div",{className:"p-4 overflow-auto h-[calc(100vh-120px)]",children:ee(tH,{columns:s,dataSource:c,pagination:!1,scroll:{x:"max-content"},rowKey:"id"})}),ee("div",{className:"flex justify-end px-[18px]",children:ee(lH,{current:r,pageSize:i,responsive:!0,simple:!0,total:d,showSizeChanger:!0,showQuickJumper:!0,onChange:(g,v)=>{o(g),a(v||10)},onShowSizeChange:(g,v)=>{o(1),a(v)}})})]}):ee(Uz,{})]})},zT=({i:e,item:t,j:n,clickTag:r})=>(console.log("j in tag",n),console.log("i in tag",e),console.log("item in tag",t),ee("div",{style:{minWidth:"16px",height:"16px",backgroundColor:sxe[t.key],margin:"0 4px",color:lxe[t.key],display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"2px",fontSize:"12px",cursor:"pointer"},onClick:()=>r&&r(e,n,t),children:n.index},n.id)),ixe=()=>"/proxy",RE=e=>{if(!e||typeof e!="string")return"";const t=e.split("/"),n=t.length;return t[n-1]},axe=e=>{const t=(e||"").toLowerCase();return["png","jpg","jpeg","gif","bmp","webp","svg","ico"].includes(t)?"rag/pic":t==="pdf"?"rag/pdf":["doc","docx"].includes(t)?"rag/word":["xls","xlsx","xlsm","xlsb","xltx","xltm","xlt","xlam"].includes(t)?"rag/excel":["ppt","pptx"].includes(t)?"rag/ppt":t==="txt"||t==="md"?"rag/txt":t==="csv"?"rag/csv":["zip","rar","7z"].includes(t)?"rag/zip":["odt","ods","odp","odf"].includes(t)?"rag/odf":t==="json"?"rag/json":"rag/file"},Oz=e=>{if(e.loading)return ee(cH,{size:"small",style:{marginRight:"5px",width:"12px",fontSize:"12px"}});if(e.type==="dir")return ee(Kr,{type:"rag/folder",size:16});if(e.type==="file"&&e.fileType){const t=axe(e.fileType);return ee(Kr,{type:t,size:16})}return ee(Kr,{type:"rag/folder",size:16})},sxe={knowledgeList:"#EAF4FD",searchList:"#E8F7F0",databaseList:"#FFF4E5",graphList:"#E7F8FB"},lxe={knowledgeList:"#2072F0",searchList:"#39B83F",databaseList:"#F48C14",graphList:"#10BBD9"},HT=[{key:"knowledgeList",name:"\u77E5\u8BC6\u5E93\u6587\u6863"},{key:"searchList",name:"\u8054\u7F51\u641C\u7D22",hideBtns:!0},{key:"databaseList",name:"\u6570\u636E\u5E93",hideBtns:!0},{key:"graphList",name:"\u77E5\u8BC6\u56FE\u8C31",hideBtns:!0}],cxe=({type:e,data:t,token:n,eventsEmit:r,is_download:o})=>{const[i,a]=nt(HT),[s,l]=nt("mark"),[c,u]=nt(!1),[d,f]=nt({}),[h,m]=nt("knowledgeList"),[p,g]=nt({knowledgeList:[],searchList:[],databaseList:[],graphList:[]}),v=Gt(()=>{const E=4-i.length,k=Array(E).fill(null).map((O,A)=>({name:"",key:100+A})),S=[...i,...k];return console.log("rrrrrr",S),S},[i]),y=E=>isNaN(E)?"":(+E).toFixed(2),b=(E,k)=>{switch(E){case"knowledgeList":return Jbe(k);case"searchList":return xie;case"databaseList":return Eie;case"graphList":return bie}},w=(E,k)=>E==="graphList"?k.map(S=>({...S,name:S.graphName})).sort((S,O)=>(O.score||0)-(S.score||0)):E==="knowledgeList"?k.map(S=>({...S,file_type:txe(S.source)||S.file_type,name:nxe(S.source)||S.file_name,score:S.rrf_score})).sort((S,O)=>(O.score||0)-(S.score||0)):E==="searchList"?k.map(S=>({...S,name:S.file_name})).sort((S,O)=>(O.score||0)-(S.score||0)):E==="databaseList"?k.map(S=>{const O=S.tableName?`${S.databaseName||"\u6570\u636E\u5E93"} - ${S.tableName}`:S.databaseName||S.name||"\u6570\u636E\u5E93";return{...S,name:O,file_name:O,file_type:"database"}}).sort((S,O)=>(O.score||0)-(S.score||0)):k,x=(E,k,S)=>{var O;switch(S.key){case"knowledgeList":const{pdfPages:A,parsedFilePath:$,order_num:M,tags:N}=E||{},D=k.id||M||"Unknown ID",T=(N||[]).find(_=>_.id===D);if(E.type==="video")return console.log("sdgasdgag",{file:{...E,...T}}),r==null?void 0:r("retrive_tag:click",{file:{...E,...T}});if(console.log("click knowledge tag",E,k),!E||!T)return;const{metadata:P}=T,I=P.source.split("/"),R=I[I.length-1]||"",H=R.split("."),V=H.slice(0,-1).join(".")||"Unknown Label",L=H[H.length-1]||"Unknown Type";f({id:D,title:V,file_name:R,file_type:L,file_source:Qbe(L)?`${op}${P.source}`:$,metadata:P,pdfPages:A}),l("mark"),u(!0);break;case"searchList":console.log("click search tag",E,k);break;case"databaseList":console.log("click database tag",E,k),l("database"),f({...E,metadata:E.metadata||{},fetchUrl:E.fetchUrl||((O=E.metadata)==null?void 0:O.fetchUrl)||""}),u(!0);break;case"graphList":console.log("click graph tag",E,k),l("graphPreview"),f({...E,traceNode:((t==null?void 0:t.traceNode)||[]).find(_=>_.id===k.id)}),u(!0);break}};return Et(()=>{if(e!==Mz.REFERENCELIST||(console.log("data in reference drawer",t),!t))return;const{graphRefs:E,knowledgeRefs:k,webRefs:S,databaseRefs:O}=t;E!=null&&E.length&&(p.graphList=w("graphList",E)),k!=null&&k.length&&(p.knowledgeList=w("knowledgeList",k)),S!=null&&S.length&&(p.searchList=w("searchList",S)),O!=null&&O.length&&(p.databaseList=w("databaseList",O));const A=HT.filter($=>{var M;return(M=p[$.key])==null?void 0:M.length}).sort(($,M)=>{var N,D;return(((N=p[M.key])==null?void 0:N.length)||0)-(((D=p[$.key])==null?void 0:D.length)||0)});a(A),A!=null&&A.length&&m(A[0].key),g({...p})},[t]),ut(Ac,{children:[ut("div",{className:"listWrap w-full h-full",children:[ee(Vg,{title:"\u77E5\u8BC6\u6EAF\u6E90",setOpen:()=>{const E=new CustomEvent("aichat:right_set",{detail:{collapsed:!0}});window.dispatchEvent(E)}}),ut("div",{style:{height:"calc(100% - 60px)"},children:[ee("div",{className:"tabs",style:{display:"flex",justifyContent:"space-between",padding:"12px 20px"},children:v.map(E=>ee("div",{className:"tab-item",style:{padding:"5.5px 12px",backgroundColor:E.name?h===E.key?"#4E6EF2":"#F5F6F9":"transparent",cursor:"pointer",borderRadius:"4px",color:h===E.key?"#FFFFFF":"#4E5969",fontSize:"14px",minWidth:"80px",display:"flex",justifyContent:"center"},onClick:()=>{E.name&&m(E.key)},children:E.name},E.key))}),ee("div",{className:"listBox",style:{height:"calc(100% - 66px)",overflowY:"auto",display:"flex",flexDirection:"column",alignItems:"center",willChange:"scroll-position",transform:"translateZ(0)"},children:i.map(E=>{let k=p[E.key]||[];return h!==E.key?null:ee("div",{children:k.map(S=>{var O,A,$,M,N,D;return ut("div",{style:{width:"360px",padding:"4px 8px",borderRadius:"4px",margin:"6px 0",cursor:"pointer"},className:"listItemBox",onClick:()=>{E.key==="searchList"&&window.open(S.link,"_blank")},children:[ut("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut("div",{style:{width:E.hideBtns?"339px":"288px",fontSize:"14px",color:"#1D2129",fontWeight:"700",display:"flex",alignItems:"center"},children:[ee("img",{src:b(E.key,S.file_type),style:{width:"16px",height:"16px",marginRight:"2px"}}),ee(Ks,{placement:"topLeft",title:((O=S==null?void 0:S.name)==null?void 0:O.length)>17?S.name:"",children:ee("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:E.hideBtns?"322px":"258px"},onClick:()=>{var T;E.key==="knowledgeList"?r==null||r("knowledge_referenceFile_title:click",{data:{...S,file_type:S.file_type,file_name:S.file_name,metadata:S.metadata,parsedFilePath:S.parsedFilePath}}):E.key==="databaseList"&&(l("database"),f({...S,metadata:S.metadata||{},fetchUrl:S.fetchUrl||((T=S.metadata)==null?void 0:T.fetchUrl)||""}),u(!0))},children:S.name})})]}),ut("div",{style:{width:"52px",justifyContent:"space-between",alignItems:"center",marginRight:"8px",display:E.hideBtns||S.type==="video"?"none":"flex"},children:[ee("img",{src:vie,style:{width:"16px",height:"16px",cursor:"pointer"},onClick:()=>{r==null||r("referenceFile_filechat",{data:{...S,file_type:S.file_type,file_name:S.file_name,metadata:S.metadata,parsedFilePath:S.parsedFilePath}})}}),ee("div",{style:{borderRight:"1px solid #E5E6EB",height:"14px"}}),ee("img",{src:yie,style:{width:"16px",height:"16px",cursor:o?"pointer":"not-allowed"},onClick:()=>{var P,I,R;if(!((P=S==null?void 0:S.tags)!=null&&P.length)&&!((I=S==null?void 0:S.metadata)!=null&&I.source)||!o)return;const T=((R=((S==null?void 0:S.tags)||[])[0])==null?void 0:R.metadata)||(S==null?void 0:S.metadata);exe({filePath:`${op}${T.source}`,fileName:DS({metadata:T}),token:n})}})]})]}),!!(typeof S.score=="string"||typeof S.score=="number"||(A=S==null?void 0:S.tags)!=null&&A.length&&S.tags.length>0&&S.tags.length<=10)&&ut("div",{style:{display:"flex",justifyContent:"space-between",height:"18px",marginTop:"4px"},children:[(typeof S.score=="string"||typeof S.score=="number")&&ut("div",{style:{backgroundColor:"#F2F2FB",borderRadius:"4px",padding:"2px 3px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"12px"},children:[ee("span",{style:{color:"#4E5969",marginRight:"6px"},children:"\u5206\u6570:"}),ee("span",{style:{color:"#1D2129"},children:y(S.score)})]}),ee("div",{style:{flex:1,display:"flex",justifyContent:"flex-end"},children:(($=S==null?void 0:S.tags)!=null&&$.length&&S.tags.length>0&&S.tags.length<=10?S.tags:[]).map(T=>ee(zT,{i:S,item:E,j:T,clickTag:x},T.id))})]}),ee("div",{style:{flex:1,display:"flex",justifyContent:"flex-start",marginTop:"4px"},children:((M=S==null?void 0:S.tags)!=null&&M.length&&S.tags.length>10?S.tags:[]).map(T=>ee(zT,{i:S,item:E,j:T,clickTag:x},T.id))}),!!((N=S==null?void 0:S.main_source)!=null&&N.length)&&ut("div",{style:{flex:1,display:"flex",alignItems:"flex-start",marginTop:"4px"},children:[ee("div",{style:{fontSize:"12px",color:"#4E5969",width:"60px"},children:"\u5173\u8054\u6587\u6863:"}),ee(Ks,{placement:"topLeft",title:((D=RE(S.main_source[0]))==null?void 0:D.length)>22?RE(S.main_source[0]):"",children:ee("div",{style:{fontSize:"12px",color:"#4E5969",width:"289px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:RE(S.main_source[0])})})]})]},S.id)})},E.key)})})]})]}),ee(bd,{drawer:{styles:{body:{padding:0},header:{display:"none"}}},children:ut(BF,{autoFocus:!1,onClose:()=>u(!1),open:c,width:h==="graphList"?"100%":720,className:"overflow-x-hidden",destroyOnClose:!0,afterOpenChange:E=>{E||f(null)},children:[s==="graphPreview"&&ee(Xbe,{curFileInfo:d,onClose:u,token:n}),s==="mark"&&ee(rxe,{content:d,onClose:u,token:n}),s==="preview"&&ee($z,{curFileInfo:d,onClose:u,token:n}),s==="database"&&ee(oxe,{curFileInfo:d,onClose:u,token:n})]})})]})},uxe=({fileData:e,token:t})=>{const[n,r]=nt([]);Et(()=>{var l;const a=e==null?void 0:e.knowledgeBases;if(!(a!=null&&a.length))return;const s=((l=a[0])==null?void 0:l.treeData)||[];s!=null&&s.length&&r(s)},[e]);const o=et(new Map),i=async(a,s)=>{var l,c;if(!o.current.get(a==null?void 0:a.fetchUrl))try{const u=n[s];u.loading=!0;const d=[...n];r(d);const f=await Mr.get(`${ixe()}${a.fetchUrl}`,{headers:{Authorization:t}}),h=(c=(l=f==null?void 0:f.data)==null?void 0:l.data)==null?void 0:c.records;if(h){const m=n[s];m.loading=!1,m.children=h;const p=[...n];p[s]=m,r(p),o.current.set(a==null?void 0:a.fetchUrl,!0)}else{const m=n[s];m.loading=!1;const p=[...n];r(p)}}catch{const d=n[s];d.loading=!1;const f=[...n];r(f)}};return ut(Ac,{children:[ee(Vg,{title:"\u77E5\u8BC6\u5E93\u6587\u6863\u76EE\u5F55",setOpen:()=>{const a=new CustomEvent("aichat:right_set",{detail:{collapsed:!0}});window.dispatchEvent(a)}}),ee("div",{style:{height:"calc(100% - 60px)",overflowY:"auto",padding:"16px"},children:n.map((a,s)=>{var l;return a.type==="file"?ut("div",{className:"flex",style:{marginTop:"8px"},children:[Oz(a),ee(Ks,{placement:"top",title:((l=a.name)==null?void 0:l.length)>23?a.name:"",children:ee("div",{style:{paddingLeft:"6px",width:"346px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default",fontSize:"14px"},children:a.name})})]}):ee(dxe,{item:a,index:s,clickFileItem:i},s)})})]})},dxe=({item:e,index:t,clickFileItem:n})=>{var i;const[r,o]=nt(!1);return ut("div",{style:{marginTop:"8px"},children:[ut("div",{className:"flex cursor-pointer",onClick:()=>{o(!r),!r&&n(e,t)},children:[Oz(e),ee(Ks,{placement:"top",title:((i=e.name)==null?void 0:i.length)>23?e.name:"",children:ut("div",{style:{paddingLeft:"6px",width:"346px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"14px"},children:[e.name," (",e.fileCount||0,")"]})})]},t),ee("div",{style:{padding:"2px 0 2px 14px",margin:"8px 0 0 7px",borderLeft:"2px solid #E5E6EB",display:r?"block":"none"},children:(e.children||[]).map((a,s)=>{var l;return ut("div",{className:"flex items-center",children:[ee("div",{style:{width:"4px",height:"4px",borderRadius:"2px",background:"black"}}),ee(Ks,{placement:"top",title:((l=a.name)==null?void 0:l.length)>26?a.name:"",children:ee("div",{style:{paddingLeft:"6px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"12px",width:"336px"},children:a.fileName})})]},s)})})]})};var Mz=(e=>(e.REFERENCELIST="referencelist",e.ALLFILELIST="allFileList",e))(Mz||{});function VEe(e=Gre){return function({token:n,url:r="http://localhost:8888",styles:o,CSRFToken:i,eventsEmit:a,scrollOld:s,...l}){const c=Gt(()=>qz({theme:sC,mode:"light"},o),[o]),[u,d]=nt(!1),[f,h]=nt(!1),[m,p]=nt(null),[g,v]=nt(!1),[y,b]=nt("mark"),[w,x]=nt({url:"",parse_url:"",file_type:"",file_name:""}),[E,k]=nt([]),[S,O]=nt(1),[A]=nt(16),[$,M]=nt(0),[N,D]=nt(!1),[T,P]=nt([]),[I,R]=nt(void 0),[H,V]=nt([]),[L,_]=nt([]),[j,F]=nt(void 0),[B,z]=nt({display:"ready",sender:"ready",app:"initializing"});function G(J,Z){if(!Z)return J;const $e=Array.isArray(J)?[...J]:{...J};for(const Ae in Z)if(Z[Ae]!==void 0&&Z[Ae]!==null&&Object.prototype.hasOwnProperty.call(Z,Ae))if(Ae==="actions"&&Array.isArray(J[Ae])&&Array.isArray(Z[Ae])){const tt=new Map;J[Ae].forEach(vt=>{vt.name&&tt.set(vt.name,vt)}),Z[Ae].forEach(vt=>{vt.name&&tt.set(vt.name,vt)}),$e[Ae]=Array.from(tt.values())}else typeof J[Ae]=="object"&&J[Ae]!==null&&!Array.isArray(J[Ae])&&typeof Z[Ae]=="object"&&Z[Ae]!==null&&!Array.isArray(Z[Ae])?$e[Ae]=G(J[Ae],Z[Ae]):$e[Ae]=Z[Ae];return $e}const[W,q]=nt(()=>G(OA,l.senderConfig));Et(()=>{if(l.senderConfig){const J=G(OA,l.senderConfig);q(J)}},[l.senderConfig]);const{fileStatuses:U,setFileStatuses:X,pollFileStatus:ie,handleRemoveFromTemp:K,resetStopFlag:re,setStopFlag:oe,stoppedRef:ne,getTempFileList:ae,setFileManagerData:de,fileManagerData:ge}=oie({url:r,token:n,CSRFToken:i,activeSessionId:I}),[Se,ye]=we.useState(()=>{var Z;if(!L||L.length===0)return;const J=L.find($e=>$e.isDefault);return J?J.id:(Z=L[0])==null?void 0:Z.id});we.useEffect(()=>{if(!L||L.length===0)return;const J=L.some(Z=>Z.id===Se);if(!Se||!J){const Z=L.find($e=>$e.isDefault);ye(Z?Z.id:L[0].id)}},[L]);const[be,ce]=nt({}),he=et(void 0),Te=et(void 0),se=et(void 0),Pe=et(null),De=et(void 0),He=et([]),[ue,ve]=nt([]),[xe,fe]=nt({}),[pe,ke]=nt(!1),[Ve,Ee]=nt([]),[yt,Dt]=nt(!1),{api_startChat_re:Ft,addEmptyMessage:Ut,setLastEmptyMessage:Ge,stopStream:Xe,cancelStreamBySessionId:qe}=tie({baseUrl:r,CSRFToken:i,token:n,setChatData:P,activeSessionId:I,setAppStatus:z,setConversationList:k}),lt=Gt(()=>{const J={};return(L||[]).forEach(Z=>{J[Z.id]=Z}),J},[L]),je=Gt(()=>{const J=T.find($e=>$e.id===I)||{id:I,messages:[]},Z=J.configId?lt[J.configId]:null;return{...J,assistantInfo:Z}},[T,I,lt]),Rt=Gt(()=>{if(je.configId&&lt){const J=lt[je.configId];return J!=null&&J.configJson?JSON.parse(J.configJson).is_download:!1}else return!1},[je.configId,lt]);Gt(()=>{if((je.configId||j)&&lt){const J=lt[je.configId];if(J!=null&&J.configJson){const Z=JSON.parse(J.configJson);return console.log("is_enableThinking",je.configId,lt,j),!!Z.thinking}else if(j){const Z=lt[j];if(Z!=null&&Z.configJson)return!!JSON.parse(Z.configJson).thinking}}return!1},[je.configId,lt,j]),Et(()=>{if(he.current&&he.current!==I){const Z=he.current,$e=E.find(vt=>vt.sessionId===Z&&vt.isNew),Ae=T.find(vt=>vt.id===Z&&vt.isNew),tt=Ae&&Ae.messages&&Ae.messages.length>0;$e&&!tt&&(k(vt=>vt.filter(Ot=>Ot.sessionId!==Z)),P(vt=>vt.filter(Ot=>Ot.id!==Z)))}he.current=I;const J=je.messages&&je.messages.length>0?je.messages[je.messages.length-1].recommendQuestion:[];V(J)},[I,E,T,je.messages]);const zt=async J=>{var Z,$e,Ae,tt;if(!N){D(!0);try{const vt=await Mr.get(`${r}/qa/dialogue/list?pageNo=${J}&pageSize=${A}&sysType=INT_SESSION`,{headers:{Authorization:n}}),Ot=(($e=(Z=vt==null?void 0:vt.data)==null?void 0:Z.data)==null?void 0:$e.records)||[],wt=((tt=(Ae=vt==null?void 0:vt.data)==null?void 0:Ae.data)==null?void 0:tt.total)||0;M(wt),k(ot=>{const Mt=new Map;return[...ot,...Ot].forEach(Zt=>{Mt.set(Zt.sessionId,Zt)}),Array.from(Mt.values())}),O(J)}catch{}finally{D(!1)}}};Et(()=>{z(J=>({...J,app:"initializing"})),Mr.get(`${r}/qa/search/config/helper/list?pageNo=1&pageSize=3000`,{headers:{Authorization:n}}).then(J=>{_(J.data.data||[])}).catch(()=>{}),zt(1).then(()=>{I||Pt(),z(J=>({...J,app:"ready"}))}).catch(()=>{z(J=>({...J,app:"error"}))})},[]),Et(()=>{I&&(z(J=>({...J,display:"loading"})),ae(I),Mr.get(`${r}/qa/dialogue/getDialogBySessionId?sessionId=${I}`,{headers:{Authorization:n}}).then(J=>{var Cn;if(!J.data.data){z(bt=>({...bt,display:"ready"}));return}const Z=((Cn=J.data.data)==null?void 0:Cn.queryReplyPairList)||[],$e=Ioe(Z),{sessionId:Ae,searchConfigDTO:tt,filePath:vt,configId:Ot,reference:wt,webReference:ot,uploadedFiles:Mt,fileList:Zt,currentFiles:Ue}=J.data.data;if($e.length>0){const bt=$e.length-1-[...$e].reverse().findIndex(Wt=>Wt.istype==="ai");bt>=0&&bt<$e.length&&$e[bt].istype==="ai"&&(wt&&($e[bt].reference=wt),ot&&($e[bt].webReference=ot))}const Ye=Ue||Zt||Mt;if(Ye&&$e.length>0){const bt=[...$e].reverse().findIndex(Wt=>Wt.istype==="user");bt!==-1&&(console.log($e[$e.length-1-bt].currentFiles,"filesData"),$e[$e.length-1-bt].currentFiles=Ye)}E.find(bt=>bt.sessionId===Ae)&&k(bt=>bt.map(Wt=>Wt.sessionId===Ae?{...Wt,searchConfigDTO:tt,filePath:vt,configId:Ot}:Wt));const It={configId:J.data.data.configId,filePath:J.data.data.filePath,searchConfigDTO:J.data.data.searchConfigDTO||{},sessionId:J.data.data.sessionId,label:J.data.data.label,kbId:J.data.data.kbId};P(bt=>{const Wt=bt.filter(ft=>ft.id!==I);return[{id:I,messages:$e,...It},...Wt]}),z(bt=>({...bt,display:"ready"}))}).catch(J=>{console.error("\u83B7\u53D6\u804A\u5929\u6570\u636E\u5931\u8D25:",J),J.response&&J.response.status===404&&Pt(),z(Z=>({...Z,display:"error"}))}))},[I,r,n]),Et(()=>{const J=ge.uploadedFiles.length;q(Z=>{const $e=Array.isArray(Z.actions)?Z.actions:[];return{...Z,actions:$e.map(tt=>tt.name==="history"?{...tt,badgeCount:J}:tt)}})},[ge.uploadedFiles]),Et(()=>{Boe({url:r,token:n},J=>{Ee(J)})},[]),we.useEffect(()=>{U.length&&P(J=>{if(!J[0])return J;const{messages:Z}=J[0];for(let $e=Z.length-1;$e>=0;$e--)if(Z[$e].istype==="user"){const Ae=Z[$e].currentFiles||[];Z[$e].currentFiles=U.map(tt=>{var Ot,wt,ot;const vt=Ae.find(Mt=>Mt.uid===tt.uid);return{name:((Ot=tt.file)==null?void 0:Ot.name)||tt.name,size:((wt=tt.file)==null?void 0:wt.size)||tt.size,type:((ot=tt.file)==null?void 0:ot.type)||tt.type,status:tt.status,uid:tt.uid,url:tt.url||(vt==null?void 0:vt.url)||""}});break}return[...J]})},[U]);let dt=null,Ct=null;const jt=(J,Z,$e,Ae)=>{Ct=ie(J,{onStatusUpdate:Z,onComplete:$e,onFail:Ae})},Ie=(J,Z)=>{P($e=>{const Ae=[...$e];return Ae[0]&&(Ae[0]={...Ae[0],messages:Ae[0].messages.map(tt=>tt.queryId===J?{...tt,feedbackResult:Z}:tt)}),Ae})},Ne=async J=>{var Z,$e;if(J)try{const Ae=(je==null?void 0:je.configId)||((Z=lt==null?void 0:lt[(je==null?void 0:je.configId)||""])==null?void 0:Z.id)||"",tt=await Mr.get(`${r}/qa/ai/recommendQuestion?queryId=${J}&configId=${Ae||""}`.replace(/\?&/,"?"),{headers:{Authorization:n}});V((($e=tt.data)==null?void 0:$e.data)||[])}catch{V([])}};function Oe(J){const{content:Z,audioUrl:$e,filePaths:Ae,queryId:tt}=J;if(!I||!tt)return;const vt=(je==null?void 0:je.messages)||[],Ot=vt.findIndex(Ye=>(Ye==null?void 0:Ye.queryId)===tt&&((Ye==null?void 0:Ye.istype)==="ai"||(Ye==null?void 0:Ye.isUser)===!1));let wt;if(Ot>0)for(let Ye=Ot-1;Ye>=0;Ye-=1){const ct=vt[Ye];if((ct==null?void 0:ct.istype)==="user"||(ct==null?void 0:ct.isUser)===!0){wt=ct;break}}const ot=(wt==null?void 0:wt.content)??Z;if(!ot)return;const Mt=(wt==null?void 0:wt.filePaths)??Ae,Zt=(typeof Mt=="string"&&Mt?JSON.parse(Mt):Mt||[]).map(Ye=>Ye.uid),Ue=Date.now();Ge({now:Ue}),z(Ye=>({...Ye,display:"processing",sender:"processing"})),Ot>=0&&vt[Ot]&&P(Ye=>{if(!Ye[0])return Ye;const ct=Ye[0],It=ct.messages||[];if(Ot>=It.length)return Ye;const Cn=It.slice();return Cn[Ot]={...Cn[Ot],content:Cn[Ot].content,reference:"[]",webReference:"[]",graphReference:null,databaseReference:null,status:2,chain:void 0},[{...ct,messages:Cn},...Ye.slice(1)]}),J.clearFn&&J.clearFn(),k(Ye=>Ye.map(ct=>ct.sessionId===I?{...ct,gmtModified:Ue}:ct)),Ft({configId:je.configId,content:ot,fileUids:Zt,lastDate:Ue,name:je.label||"",queryId:tt,sessionId:String(I||""),type:(wt==null?void 0:wt.audioUrl)??$e?"audioUrl":"text",audioUrl:((wt==null?void 0:wt.audioUrl)??$e)||"",enableThinking:!!be.reasoning,enableWebsearch:!!be.netSearch,qaChannel:be.qaChannel,tempKnowledgeBaseCheck:ht.current},Ye=>{Ne(tt)})}async function _e(J,Z){if(!I)return;const $e=new CustomEvent("aichat:right_set",{detail:{collapsed:!0}});window.dispatchEvent($e);const Ae=E.find(tt=>tt.sessionId===I);if(Ae&&Ae.isNew){let tt=!1;const vt=j||Ae.configId,Ot=J&&J.content?J.content.slice(0,20):Ae.label||"\u672A\u547D\u540D\u4F1A\u8BDD";if(await new Promise((wt,ot)=>{joe({url:r,token:n,CSRFToken:i},{label:Ot,sessionId:Ae.sessionId,sysType:"INT_SESSION",configId:vt},Mt=>{Mt&&Mt.data&&Mt.data.sessionId?(k(Zt=>Zt.map(Ue=>Ue.sessionId===Ae.sessionId?{...Ue,isNew:!1,configId:vt,label:Ot}:Ue)),P(Zt=>Zt.map(Ue=>Ue.id===Ae.sessionId?{...Ue,isNew:!1,configId:vt,label:Ot}:Ue)),tt=!0,wt()):(gr.error("\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),ot())})}),!tt)return;mt(I,J,Z,vt);return}mt(I,J,Z)}function mt(J,Z,$e,Ae){const tt="query-"+pa(32),vt=E.find(Ye=>Ye.sessionId===J),Ot=Ae||(vt==null?void 0:vt.configId)||je.configId;console.log("\u52A9\u624B\u914D\u7F6E\u8BE6\u60C5",Ot);const wt=Z.content||Z.text||"",ot=typeof wt=="string"?wt:String(wt),Mt=ot?ot.slice(0,20):"\u672A\u547D\u540D\u4F1A\u8BDD";let Zt;if(Z.files&&Z.files.length>0&&(Zt=Z.files.map(Ye=>({name:Ye.file.name,size:Ye.file.size,type:Ye.file.type,filePath:Ye.filePath||"",convertedFilePath:Ye.convertedFilePath||"",uid:Ye.uid||""}))),console.log("\u672C\u5730\u6587\u4EF6\u4E0A\u4F20",Z.files),Ut({content:ot,queryId:tt,currentFiles:Zt,filePaths:Zt?JSON.stringify(Zt):void 0}),k(Ye=>Ye.map(ct=>ct.sessionId===J&&ct.label==="\u672A\u547D\u540D\u4F1A\u8BDD"&&ct.isNew?{...ct,label:Mt,gmtModified:Date.now(),isNew:!1}:ct)),P(Ye=>Ye.map(ct=>ct.id===J&&ct.label==="\u672A\u547D\u540D\u4F1A\u8BDD"&&ct.isNew?{...ct,label:Mt,isNew:!1}:ct)),Z.files&&Z.files.length>0){z(bt=>({...bt,sender:"uploading",display:"uploading"})),dt=new AbortController,re();const Ye=Z.files.map(()=>`rc-upload-${Date.now()}-${Math.random().toString(36).slice(2)}`),ct=Z.files.map((bt,Wt)=>({...bt,uid:Ye[Wt],status:"uploading"}));X(ct);const It=new FormData;Z.files.forEach(bt=>{It.append("files",bt.file)});const Cn=String(J||"");It.append("sessionId",Cn),It.append("uids",Ye.join(",")),Mr.post(`${r}/index/knowledgeBase/file/uploadFiles`,It,{headers:{Authorization:n,"Content-Type":"multipart/form-data"},signal:dt.signal}).then(bt=>{var Tt,Bn,zn,pr,oa,fi,Aa,hi,$a,Es;if(console.log("\u6587\u4EF6\u4E0A\u4F20\u7684\u6253\u5370\u7ED3\u679C",bt),console.log("\u6587\u4EF6\u4E0A\u4F20\u54CD\u5E94\u8BE6\u60C5:",{status:bt.status,success:(Tt=bt.data)==null?void 0:Tt.success,dataType:Array.isArray((Bn=bt.data)==null?void 0:Bn.data)?"array":typeof((zn=bt.data)==null?void 0:zn.data),dataLength:Array.isArray((pr=bt.data)==null?void 0:pr.data)?bt.data.data.length:"N/A",errorMsg:(oa=bt.data)==null?void 0:oa.errorMsg,errorCode:(fi=bt.data)==null?void 0:fi.errorCode,fullResponse:bt.data}),ne.current)return;const Wt=(Aa=bt.data)==null?void 0:Aa.data,Fn=((hi=bt.data)==null?void 0:hi.success)===!0,ft=Array.isArray(Wt)&&Wt.length>0;if(Fn&&ft){const eo=Wt,Di=eo.map(Zn=>Zn.uid);X(Zn=>Zn.map(Je=>{const Nt=Wt.find(Vt=>Vt.uid===Je.uid);return Nt?{...Je,...Nt}:Je})),z(Zn=>({...Zn,sender:"processing",display:"analyzing"})),X(Zn=>Zn.map(Je=>({...Je,status:"parsing"}))),jt(Di,Zn=>{if(!Zn||!Array.isArray(Zn)){console.warn("pollFileStatus \u56DE\u8C03\u8FD4\u56DE\u7684 serverStatuses \u65E0\u6548:",Zn);return}if(X(Nt=>Nt.map(Vt=>{const Hn=Zn.find(An=>An&&An.uid===Vt.uid);if(Hn)switch(Hn.fileParseStatus??Hn.status){case 3:return{...Vt,status:"done"};case 4:return{...Vt,status:"error"};case 1:case 2:default:return{...Vt,status:"parsing"}}return Vt})),Array.isArray(Zn)&&Zn.length>0&&Zn.every(Nt=>{if(!Nt)return!1;const Vt=Nt.fileParseStatus??Nt.status;return Vt===3||Vt===4})){X([]);const Nt=new Map;(Zn||[]).forEach(Vt=>{Nt.set(Vt.id,Vt)}),de(Vt=>({uploadedFiles:pie(Vt.uploadedFiles,eo).map(An=>{var Ti;return{...An,pdfPages:((Ti=Nt.get(An.id))==null?void 0:Ti.pdfPages)||0}})}))}},()=>{$e==null||$e(),z(Je=>({...Je,sender:"processing",display:"processing"})),X(Je=>Je.map(Nt=>{const Vt=eo.find(Hn=>Hn.uid===Nt.uid);return Vt?{...Nt,...Vt,url:Vt.filePath,filePath:Vt.filePath,name:Vt.fileName||Nt.name,convertedFilePath:Vt.convertedFilePath||Nt.convertedFilePath}:Nt})),P(Je=>{if(!Je[0])return Je;const{messages:Nt}=Je[0];for(let Vt=Nt.length-1;Vt>=0;Vt--)if(Nt[Vt].istype==="user"){const Hn=Nt[Vt].currentFiles||[];Nt[Vt].currentFiles=Hn.map(An=>{const Ti=eo.find(Kc=>Kc.uid===An.uid);return Ti?{...An,...Ti}:An});break}return[...Je]});const Zn=Date.now();Ft({configId:Ot,content:ot,fileUids:Di,lastDate:Zn,name:Mt,queryId:tt,sessionId:String(J||""),type:"text",audioUrl:"",enableThinking:!!be.reasoning,enableWebsearch:!!be.netSearch,qaChannel:be.qaChannel,tempKnowledgeBaseCheck:ht.current},Je=>{Ne(tt)})},Zn=>{z(Je=>({...Je,display:"ready",sender:"ready"})),X(Je=>Je.map(Nt=>({...Nt,status:"error",message:Zn})))})}else{let eo="\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25";($a=bt.data)!=null&&$a.errorMsg?eo=bt.data.errorMsg:Fn?ft||(Array.isArray(Wt)?Wt.length===0&&(eo="\u4E0A\u4F20\u5931\u8D25: \u8FD4\u56DE\u6570\u636E\u4E3A\u7A7A"):eo=`\u4E0A\u4F20\u5931\u8D25: \u8FD4\u56DE\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF0C\u671F\u671B\u6570\u7EC4\uFF0C\u5B9E\u9645\u4E3A ${typeof Wt}`):eo=`\u4E0A\u4F20\u5931\u8D25: success=${(Es=bt.data)==null?void 0:Es.success}`,console.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\u8BE6\u60C5:",{errorMsg:eo,response:bt.data,isSuccess:Fn,isValidData:ft}),gr.error(eo),z(Di=>({...Di,display:"error",sender:"ready"})),X(Di=>Di.map(Zn=>({...Zn,status:"error",message:eo})))}}).catch(bt=>{var Wt,Fn;((Wt=bt==null?void 0:bt.response)==null?void 0:Wt.status)===413?(Fn=bt==null?void 0:bt.response)!=null&&Fn.statusText.includes("Request Entity Too Large")&&gr.error("\u6587\u4EF6\u8D85\u8FC7\u6700\u5927\u53EF\u4E0A\u4F20\u9650\u5236"):gr.error("\u7F51\u7EDC\u9519\u8BEF"),z(ft=>({...ft,display:"error",sender:"ready"})),X(ft=>ft.map(Tt=>({...Tt,status:"error",message:"\u7F51\u7EDC\u9519\u8BEF"})))});return}z(Ye=>({...Ye,display:"processing",sender:"processing"}));const Ue=Date.now();k(Ye=>Ye.map(ct=>ct.sessionId===J?{...ct,gmtModified:Ue}:ct)),$e==null||$e(),Ft({configId:Ot,content:ot,fileUids:[],lastDate:Ue,name:Mt,queryId:tt,sessionId:String(J||""),type:"text",audioUrl:"",enableThinking:!!be.reasoning,enableWebsearch:!!be.netSearch,qaChannel:be.qaChannel,tempKnowledgeBaseCheck:ht.current},Ye=>{Ne(tt)})}function kt(J){J.restult==1?Im({url:r,token:n,CSRFToken:i},{queryId:J.queryId},()=>{Ie(J.queryId,null)}):WA({url:r,token:n,CSRFToken:i},{restult:1,queryId:J.queryId},()=>{Ie(J.queryId,1)})}function Pt(J){const Z=pa(32),$e={sessionId:Z,label:"\u672A\u547D\u540D\u4F1A\u8BDD",gmtModified:Date.now(),searchConfigDTO:{},filePath:"",configId:"",isNew:!0};k(Ae=>[{...$e,messages:[]},...Ae]),P(Ae=>[{id:Z,messages:[],...$e},...Ae]),R(Z)}function Xt(J){if(J!=null&&J.sessionId&&J.sessionId!==I){I&&qe(I),R(J.sessionId),z($e=>({...$e,sender:"ready"}));const Z=T.find($e=>$e.id===J.sessionId);if(Z&&Z.messages&&Z.messages.length>0){const $e=[...Z.messages].reverse().find(Ae=>Ae.istype==="ai");$e&&$e.recommendQuestion?V($e.recommendQuestion):V([])}else V([])}}const on=async J=>new Promise((Z,$e)=>{_oe({url:r,token:n,CSRFToken:i},{sessionId:J},Ae=>{Ae?(gr.success("\u5220\u9664\u6210\u529F!"),Z(Ae)):(gr.error("\u5220\u9664\u5931\u8D25!"),$e(Ae))})}),qt=async()=>{try{return k([]),M(0),await zt(1),[]}catch(J){throw gr.error("\u5237\u65B0\u4F1A\u8BDD\u5217\u8868\u5931\u8D25"),J}},wn=async(J,Z)=>new Promise(($e,Ae)=>{Roe({url:r,token:n,CSRFToken:i},{label:Z,sessionId:J},tt=>{if(tt){const vt=Date.now();k(Ot=>Ot.map(wt=>wt.sessionId===J?{...wt,label:Z,gmtModified:vt}:wt)),P(Ot=>Ot.map(wt=>wt.id===J?{...wt,label:Z}:wt)),gr.success("\u91CD\u547D\u540D\u6210\u529F!"),$e(tt)}else gr.error("\u91CD\u547D\u540D\u5931\u8D25"),Ae(tt)})}),vn=J=>{k(Z=>{const $e=Z.filter(Ae=>Ae.sessionId!==J);return I===J&&($e.length>0?R($e[0].sessionId):Pt()),$e})},Kt=(J,Z)=>{const $e=Date.now();k(Ae=>Ae.map(tt=>tt.sessionId===J?{...tt,label:Z,gmtModified:$e}:tt)),P(Ae=>Ae.map(tt=>tt.id===J?{...tt,label:Z}:tt))},$n=J=>{WA({url:r,token:n,CSRFToken:i},{...J,...xe,restult:0},()=>{Ie(xe.queryId,0)})},On=J=>{const Z=J.new_name,$e=m.data.label;Z&&Z!==$e?m.async_renameConversation(Z).then(()=>{m.fn_renameItemInList(Z),d(!1)}).catch(()=>{}):d(!1)},cr=J=>{m.async_deleteConversation().then(()=>{m.fn_removeItemFromList(),h(!1)}).catch(()=>{})},We=(J,Z)=>{switch(console.log(J,Z),J){case"close_remove":h(!1);break;case"close_rename":d(!1);break;case"ok_rename":On(Z);break;case"ok_remove":cr();break}},pt=async({url:J,params:Z,replacePredataFunction:$e})=>{var Ae,tt;try{const vt=await Mr.post(J,Z,{headers:{Authorization:n}}),Ot=(tt=(Ae=vt==null?void 0:vt.data)==null?void 0:Ae.data)==null?void 0:tt.data;Ot&&$e(Ot)}catch(vt){console.log("error",vt)}},Ke=async J=>{var Z;try{const $e=await Mr.get(`${aC()}/index/knowledgeBase/file/getFileStatusByUids?uids=${J.data.uids}`,{headers:{Authorization:n}});return console.log("resslkdjgalsg",$e),(Z=$e==null?void 0:$e.data)==null?void 0:Z.data}catch{}},rt=async J=>{var Z;if(Sz.includes(J.file_type)){const $e=(Z=J.metadata)!=null&&Z.source?`${op}${J.metadata.source}`:J.url||J.convertedFilePath||J.filePath;x({...J,parse_url:$e}),b("preview"),v(!0);return}try{const $e=await Ke({data:{uids:J.uid},config:{url:aC(),token:n,enableMock:!1}});if($e!=null&&$e.length){const Ae=$e[0];x({...J,parse_url:Ae.convertedFilePath}),b("preview"),v(!0)}}catch{}},ht=et(!1),an=(J,Z)=>{var $e,Ae,tt,vt,Ot,wt,ot;switch(console.log(`[Event] ${J}`,Z),J){case"TempKnowledgeBase":ht.current=Z;break;case"reference_file:click":if(Z.file_type==="image")return;if(!Z.parse_url){if(!Z.uid)return Z.references?void 0:gr.warning("\u6587\u4EF6\u8FD8\u672A\u89E3\u6790\u5B8C\u6210,\u8BF7\u7A0D\u540E\u9884\u89C8");rt(Z);return}x({...Z,file_type:Z.type,file_name:Z.file}),b("preview"),v(!0);break;case"conversations:load_more":{E.length<$&&!N&&zt(S+1);break}case"retrieve-sql-data:pagingation_click":const{page:Mt,pageSize:Zt,fetchUrl:Ue,source:Ye,replacePredataFunction:ct}=Z;pt({url:`${r}${Ue}`,replacePredataFunction:ct,params:{pageNo:Mt,pageSize:Zt,convertedFilePath:Ye,stream:!1}});break;case"web_referenceFile_title:click":if(!(($e=Z==null?void 0:Z.data)!=null&&$e.link))return console.error("\u6CA1\u6709\u7F51\u9875\u5730\u5740");window.open(Z.data.link,"_blank");break;case"conversation:item_click":Xt(Z);break;case"files:finished_animation_complete":X([]);break;case"conversation:create":Pt();break;case"conversation:new_assistant_change":F(Z.assistantId);break;case"conversations:rename_icon_clicked":p({data:Z,async_renameConversation:It=>wn(Z.sessionId,It),fn_renameItemInList:It=>Kt(Z.sessionId,It)}),d(!0);break;case"conversations:delete_icon_clicked":p({data:Z,async_deleteConversation:()=>on(Z.sessionId),async_refreshConversationList:qt,fn_removeItemFromList:()=>vn(Z.sessionId)}),h(!0);break;case"sender:send":_e(Z,Z.clearFn);break;case"sender:send_recommandQuestion":{const It=((Z==null?void 0:Z.content)??"").toString();if(!It)break;_e({content:It},()=>{});break}case"chatbox:follow_up_question_click":{const It=((Z==null?void 0:Z.question)??(Z==null?void 0:Z.content)??"").toString();if(!It)break;_e({content:It},()=>{});break}case"sender:stop":oe(),dt&&(dt.abort(),dt=null),Ct&&(Ct(),Ct=null),z(It=>({...It,display:"ready",sender:"ready"})),X([]),Xe==null||Xe();break;case"sender:clear":(Ae=Z.clearFn)==null||Ae.call(Z);break;case"sender:configChange":Z&&Z.all&&ce(Z.all);break;case"sender:action_upload":Pe.current&&Pe.current.click();break;case"sender:action_history":Dt(!0);break;case"uploaded_file:item_click":break;case"action_copy:click":Z&&Poe(Z.content,Z.event);break;case"chatbox:copy":{const It=(Z==null?void 0:Z.content)||"";if(!It)break;const Cn=async Wt=>{try{return await navigator.clipboard.writeText(Wt),gr.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F"),!0}catch{return!1}},bt=Wt=>{const Fn=document.createElement("textarea");Fn.value=Wt,Fn.style.position="fixed",Fn.style.opacity="0",document.body.appendChild(Fn),Fn.focus(),Fn.select();try{document.execCommand("copy"),gr.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F")}catch{gr.error("\u590D\u5236\u5931\u8D25")}document.body.removeChild(Fn)};Cn(It).then(Wt=>{Wt||bt(It)});break}case"chatbox:repeat":console.log(Z,"sdkflskdjflksdjfklsdjlfkjsdklfjsdklfjlks"),Oe(Z);break;case"action_thumbsup":kt(Z);break;case"chatbox:like":kt({queryId:Z==null?void 0:Z.queryId,restult:Z==null?void 0:Z.result});break;case"action_thumbsdown":Z.restult===0?Im({url:r,token:n,CSRFToken:i},{queryId:Z.queryId},()=>{Ie(Z.queryId,null)}):(fe(Z),ke(!0));break;case"chatbox:dislike":(Z==null?void 0:Z.result)===0?Im({url:r,token:n,CSRFToken:i},{queryId:Z.queryId},()=>{Ie(Z.queryId,null)}):(fe({queryId:Z==null?void 0:Z.queryId}),ke(!0));break;case"action_retrive_tag":a==null||a("action_retrive_tag",Z);break;case"referenceFile_view":a==null||a("referenceFile_view",Z);break;case"referenceFile_question":console.log(Z,"zhezhhzhzh"),rt(Z.data||Z),a==null||a("referenceFile_question",Z);break;case"referenceFile_download":a==null||a("referenceFile_download",Z);break;case"references:click":case"knowledge_base_view_all:click":{const It=()=>J==="references:click"?ee(cxe,{type:"referencelist",data:Z,token:n,eventsEmit:a,is_download:Rt}):ee(uxe,{fileData:Z,token:n}),Cn=new CustomEvent("aichat:right_set_content",{detail:{content:ee(It,{})}});window.dispatchEvent(Cn);const bt=new CustomEvent("aichat:right_set",{detail:{collapsed:!1}});window.dispatchEvent(bt);break}case"retrive_tag:click":a==null||a("retrive_tag:click",Z);break;case"fileManager:change":{typeof(Z==null?void 0:Z.setUploadedFiles)=="function"&&(Te.current=Z.setUploadedFiles,se.current=Z.removeFile,De.current=Z==null?void 0:Z.senderConfig,He.current=Array.isArray(Z==null?void 0:Z.uploadedFiles)?Z.uploadedFiles:[],Array.isArray(Z==null?void 0:Z.uploadedFiles)&&ve(Z.uploadedFiles),console.log("[DEBUG] fileManager:change \u4E8B\u4EF6\u89E6\u53D1\uFF0CsetUploadedFilesRef \u5DF2\u8BBE\u7F6E",{hasSetUploadedFiles:!!Te.current,uploadedFilesCount:((tt=Z==null?void 0:Z.uploadedFiles)==null?void 0:tt.length)||0,pendingFilesCount:((vt=Z==null?void 0:Z.uploadedFiles)==null?void 0:vt.length)||0,hasSenderConfig:!!(Z!=null&&Z.senderConfig),senderConfig:Z==null?void 0:Z.senderConfig,upload_number_limit:(Ot=Z==null?void 0:Z.senderConfig)==null?void 0:Ot.upload_number_limit,upload_size_limit:(wt=Z==null?void 0:Z.senderConfig)==null?void 0:wt.upload_size_limit}));break}case"uploaded_file:removeFromTemp":{console.log("[DEBUG] mergedEventsEmit uploaded_file:removeFromTemp \u4E8B\u4EF6",Z);const It=(ot=Z==null?void 0:Z.file)==null?void 0:ot.uid;if(!It){console.warn("[DEBUG] \u7F3A\u5C11uid\uFF0C\u65E0\u6CD5\u5220\u9664\u4E34\u65F6\u6587\u4EF6",Z);break}const Cn=[...(je==null?void 0:je.messages)||[]].reverse().find(Wt=>Wt.istype==="user"),bt=Cn==null?void 0:Cn.queryId;K(It,bt);break}case"uploaded_file:remove_batch":break;default:a==null||a(J,Z)}},dn=[{key:"conversations",type:"custom",label:"\u5BF9\u8BDD\u5386\u53F2",icon:ee(fH,{size:16}),enabled:!0,component:ee(Moe,{data:E,assistantList:L,activedItem:I||"",hasMore:E.length<$,loadingMore:N,sortRules:[{label:"\u5F53\u5929",dayPeriod:1},{label:"3\u5929",dayPeriod:3},{label:"7\u5929",dayPeriod:7},{label:"30\u5929",dayPeriod:30}],eventsEmit:an,styles:c.theme})}],Gn=we.useCallback(()=>ee(Uoe,{eventsEmit:an,assistantList:L,styles:c,selectedId:Se,onSelectAssistant:ye,productLogo:l==null?void 0:l.productLogo}),[an,L,c,Se,l==null?void 0:l.productLogo]),Nn={...we.useMemo(()=>({AiChatBox:(J,Z)=>{var Zt,Ue,Ye;const $e=Z===(((Zt=je==null?void 0:je.messages)==null?void 0:Zt.length)||0)-1;let Ae="ready";if($e)if(J.status!==void 0)switch(J.status){case 0:Ae="thinking";break;case 1:Ae="processing";break;case 2:Ae="ready";break;case 3:Ae="error";break;case 4:Ae="thinking";break;default:Ae=B.display}else Ae=B.display;let tt=[];if(Array.isArray(H))tt=H;else if(typeof H=="string")try{tt=JSON.parse(H)||[]}catch{tt=[]}const vt=(()=>{const ct=J==null?void 0:J.reference;if(!ct)return"[]";if(typeof ct=="string")try{return JSON.parse(ct),ct}catch{return"[]"}try{return JSON.stringify(ct)}catch{return"[]"}})(),Ot=(()=>{const ct=J==null?void 0:J.webReference;if(!ct)return"[]";if(typeof ct=="string")try{return JSON.parse(ct),ct}catch{return"[]"}try{return JSON.stringify(ct)}catch{return"[]"}})(),wt=(()=>{const ct=J==null?void 0:J.graphReference;if(!ct)return"[]";if(typeof ct=="string")try{return JSON.parse(ct),ct}catch{return"[]"}try{return JSON.stringify(ct)}catch{return"[]"}})(),ot=J==null?void 0:J.databaseReference,Mt=(()=>{var It,Cn,bt;if(J!=null&&J.chainRespTime||(It=J==null?void 0:J.reply)!=null&&It.chainRespTime)return(J==null?void 0:J.chainRespTime)??((Cn=J==null?void 0:J.reply)==null?void 0:Cn.chainRespTime);const ct=(J==null?void 0:J.chain)||((bt=J==null?void 0:J.reply)==null?void 0:bt.chain);if(Array.isArray(ct)&&ct.length>0){const Wt=ct.reduce((Fn,ft)=>{const Tt=(ft==null?void 0:ft.chainRespTime)??(ft==null?void 0:ft.respTime);return Tt!=null&&Tt>0?Fn+Tt:Fn},0);return Wt>0?Wt:void 0}})();return ee(_S,{...J,token:n,streamUrl:"/proxy/index/knowledgeBase/file/stream",referenceMode:"button",reference:vt,webReference:Ot,graphReference:wt,databaseReference:ot,contentType:"stream",displayStatus:Ae,eventsEmit:an,isLast:$e&&(J==null?void 0:J.istype)==="ai",followUpQuestions:$e&&(J==null?void 0:J.istype)==="ai"?tt:[],defaultAnswer:((Ue=je==null?void 0:je.searchConfigDTO)==null?void 0:Ue.defaultAnswer)||"\u4E0D\u77E5\u9053\u4EC0\u4E48\u539F\u56E0\u6211\u4EEC\u6CA1\u80FD\u67E5\u5230\u4F60\u8981\u7684\u95EE\u9898*-*",is_download:Rt,styles:c,enableThoughtChain:!0,chain:J==null?void 0:J.chain,thoughtChainStatus:J==null?void 0:J.status,enableCot:(J==null?void 0:J.enableCot)??((Ye=J==null?void 0:J.reply)==null?void 0:Ye.enableCot),chainRespTime:Mt},`${(J==null?void 0:J.queryId)||(J==null?void 0:J.id)||Z}-${(J==null?void 0:J.istype)||"unknown"}`)},LogoBox:J=>J&&J.LogoBox===null?null:J&&typeof J.LogoBox=="function"?ee(J.LogoBox,{}):ee("div",{className:"text-2xl w-full text-center font-bold",children:"\u5C0F\u9CB8\u667A\u80FD\u52A9\u624B"}),DisplayLoading:()=>ee(die,{}),DisplayError:()=>ee(hie,{}),AppError:()=>ee(fie,{msg:"\u5E94\u7528\u521D\u59CB\u5316\u5931\u8D25",subMsg:"\u65E0\u6CD5\u5B8C\u6210\u5E94\u7528\u521D\u59CB\u5316\uFF0C\u8FD9\u53EF\u80FD\u662F\u7531\u4E8E\u7F51\u7EDC\u8FDE\u63A5\u95EE\u9898\u6216\u670D\u52A1\u914D\u7F6E\u9519\u8BEF\u5BFC\u81F4\u7684\u3002\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u5E76\u91CD\u8BD5\u3002"}),AppLoading:()=>{var J,Z;return ee(uie,{title:(J=l==null?void 0:l.appLoadingConfig)==null?void 0:J.title,subtitle:((Z=l==null?void 0:l.appLoadingConfig)==null?void 0:Z.subtitle)||""})},UserChatBox:(J,Z)=>ee(_S,{token:n,streamUrl:"/proxy/index/knowledgeBase/file/stream",...J,referenceMode:"button",contentType:"plainText",isUser:!0,displayStatus:"ready",eventsEmit:an,styles:c,fileManagerData:ge,currentFiles:J==null?void 0:J.currentFiles},`${(J==null?void 0:J.queryId)||(J==null?void 0:J.id)||Z}-user`),WelcomeComponent:Gn}),[Gn,je,B.display,an,c,Rt,ge]),...l.CustomComponents||{}};Et(()=>{q(J=>{const Z=Array.isArray(J.switchs)?J.switchs.map($e=>$e.name==="reasoning"?{...$e,enabled:!0}:$e):[];return{...J,switchs:Z}})},[]);const Dn=Gt(()=>ge.uploadedFiles||[],[ge]),{FileDisplayTools:xr}=iie({fileManagerData:{uploadedFiles:Dn},styles:c,eventsEmit:an});return ut("div",{style:{height:"100%",minWidth:"1116px",overflow:"hidden"},children:[ee("input",{ref:Pe,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.txt,.md,.json,.csv,.zip,.rar,.7z",style:{display:"none"},onChange:J=>{const Z=J.target.files;if(Z&&Z.length>0){console.log("[DEBUG] handleFileSelect \u89E6\u53D1",{filesCount:Z.length,hasSetUploadedFilesRef:!!Te.current,hasSenderConfig:!!De.current,dynamicSenderConfig:W,dynamicSenderConfigKeys:W?Object.keys(W):[],senderConfigRef:De.current,senderConfigRefKeys:De.current?Object.keys(De.current):[]});const $e=Array.from(Z);let Ae=De.current;(!Ae||Ae.upload_size_limit===void 0&&Ae.upload_number_limit===void 0&&(!Ae.upload_file_type_limit||Ae.upload_file_type_limit.length===0))&&(Ae=W);const tt=He.current||[];console.log("[DEBUG] \u9A8C\u8BC1\u914D\u7F6E\u68C0\u67E5",{configSource:Ae,upload_number_limit:Ae==null?void 0:Ae.upload_number_limit,upload_size_limit:Ae==null?void 0:Ae.upload_size_limit,existingFilesCount:tt.length,newFilesCount:$e.length});const vt=Ae&&(Ae.upload_size_limit!==void 0||Ae.upload_number_limit!==void 0&&Ae.upload_number_limit>0||Ae.upload_file_type_limit&&Ae.upload_file_type_limit.length>0);if(console.log("[DEBUG] \u914D\u7F6E\u68C0\u67E5\u7ED3\u679C",{hasUploadLimitConfig:vt,upload_number_limit:Ae==null?void 0:Ae.upload_number_limit,upload_size_limit:Ae==null?void 0:Ae.upload_size_limit,upload_file_type_limit:Ae==null?void 0:Ae.upload_file_type_limit}),vt){const Ot={upload_size_limit:Ae.upload_size_limit,upload_number_limit:Ae.upload_number_limit,upload_file_type_limit:Ae.upload_file_type_limit,upload_limit_message:Ae.upload_limit_message};console.log("[DEBUG] \u6267\u884C\u6587\u4EF6\u9A8C\u8BC1",{uploadConfig:Ot,existingFilesCount:tt.length,newFilesCount:$e.length,totalCount:tt.length+$e.length});const wt=ow($e,tt,Ot);if(console.log("[DEBUG] \u9A8C\u8BC1\u7ED3\u679C",{valid:wt.valid,errors:wt.errors,rejectedFilesCount:wt.rejectedFiles.length}),!wt.valid){iw(wt);const ot=$e.filter(Mt=>!wt.rejectedFiles.includes(Mt));if(ot.length===0){Pe.current&&(Pe.current.value="");return}$e.splice(0,$e.length,...ot)}}if(Te.current){const Ot=$e.map(wt=>({file:wt,type:wt.type.startsWith("image/")?"image":"document",status:"pending",name:wt.name}));console.log("[DEBUG] \u901A\u8FC7 setUploadedFilesRef \u8BBE\u7F6E\u6587\u4EF6",Ot),Te.current(Ot)}else console.warn("[DEBUG] setUploadedFilesRef \u672A\u8BBE\u7F6E\uFF0C\u5EF6\u8FDF\u91CD\u8BD5"),setTimeout(()=>{if(Te.current){const Ot=$e.map(wt=>({file:wt,type:wt.type.startsWith("image/")?"image":"document",status:"pending",name:wt.name}));console.log("[DEBUG] \u5EF6\u8FDF\u540E\u901A\u8FC7 setUploadedFilesRef \u8BBE\u7F6E\u6587\u4EF6",Ot),Te.current(Ot)}else console.error("[DEBUG] \u5EF6\u8FDF\u540E setUploadedFilesRef \u4ECD\u672A\u8BBE\u7F6E")},100)}Pe.current&&(Pe.current.value="")}}),ee(e,{...l,status:B,chatData:je,sidebar:dn,recommandQuestions:[],eventsEmit:an,styles:c,senderConfig:W,fileUploadStatus:U,CustomComponents:Nn,activeSessionId:I,scrollOld:s,rightbarWidth:"400px",chatHeader:{title:(je==null?void 0:je.label)||"\u65B0\u5BF9\u8BDD",tools:xr}}),ee(lie,{open:pe,feedBackList:Ve,setOpen:ke,handleConfirm:$n}),ee(gie,{isModalOpen:u,handleOk:We,handleCancel:()=>We("close_rename"),data:(m==null?void 0:m.data)||{}}),ee(mie,{isModalOpen:f,handleOk:We,handleCancel:()=>We("close_remove"),data:(m==null?void 0:m.data)||{}}),ee(bd,{drawer:{styles:{body:{padding:0},header:{display:"none"}}},children:ee(BF,{autoFocus:!1,onClose:()=>v(!1),open:g,width:y==="graphPreview"?"100%":720,className:"overflow-x-hidden",destroyOnClose:!0,children:y==="preview"&&ee($z,{curFileInfo:w,onClose:v,token:n})})})]})}}var xh={exports:{}},Eh={exports:{}},fxe=Eh.exports,WT;function En(){return WT||(WT=1,(function(e,t){(function(n,r){e.exports=r()})(fxe,function(){var n=n||(function(r,o){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof Ug<"u"&&Ug.crypto&&(i=Ug.crypto),!i&&typeof aH=="function")try{i=sH}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function y(){}return function(b){var w;return y.prototype=b,w=new y,y.prototype=null,w}})(),l={},c=l.lib={},u=c.Base=(function(){return{extend:function(y){var b=s(this);return y&&b.mixIn(y),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var b in y)y.hasOwnProperty(b)&&(this[b]=y[b]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),d=c.WordArray=u.extend({init:function(y,b){y=this.words=y||[],b!=o?this.sigBytes=b:this.sigBytes=y.length*4},toString:function(y){return(y||h).stringify(this)},concat:function(y){var b=this.words,w=y.words,x=this.sigBytes,E=y.sigBytes;if(this.clamp(),x%4)for(var k=0;k<E;k++){var S=w[k>>>2]>>>24-k%4*8&255;b[x+k>>>2]|=S<<24-(x+k)%4*8}else for(var O=0;O<E;O+=4)b[x+O>>>2]=w[O>>>2];return this.sigBytes+=E,this},clamp:function(){var y=this.words,b=this.sigBytes;y[b>>>2]&=4294967295<<32-b%4*8,y.length=r.ceil(b/4)},clone:function(){var y=u.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var b=[],w=0;w<y;w+=4)b.push(a());return new d.init(b,y)}}),f=l.enc={},h=f.Hex={stringify:function(y){for(var b=y.words,w=y.sigBytes,x=[],E=0;E<w;E++){var k=b[E>>>2]>>>24-E%4*8&255;x.push((k>>>4).toString(16)),x.push((k&15).toString(16))}return x.join("")},parse:function(y){for(var b=y.length,w=[],x=0;x<b;x+=2)w[x>>>3]|=parseInt(y.substr(x,2),16)<<24-x%8*4;return new d.init(w,b/2)}},m=f.Latin1={stringify:function(y){for(var b=y.words,w=y.sigBytes,x=[],E=0;E<w;E++){var k=b[E>>>2]>>>24-E%4*8&255;x.push(String.fromCharCode(k))}return x.join("")},parse:function(y){for(var b=y.length,w=[],x=0;x<b;x++)w[x>>>2]|=(y.charCodeAt(x)&255)<<24-x%4*8;return new d.init(w,b)}},p=f.Utf8={stringify:function(y){try{return decodeURIComponent(escape(m.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return m.parse(unescape(encodeURIComponent(y)))}},g=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=p.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var b,w=this._data,x=w.words,E=w.sigBytes,k=this.blockSize,S=k*4,O=E/S;y?O=r.ceil(O):O=r.max((O|0)-this._minBufferSize,0);var A=O*k,$=r.min(A*4,E);if(A){for(var M=0;M<A;M+=k)this._doProcessBlock(x,M);b=x.splice(0,A),w.sigBytes-=$}return new d.init(b,$)},clone:function(){var y=u.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0});c.Hasher=g.extend({cfg:u.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(y){return function(b,w){return new y.init(w).finalize(b)}},_createHmacHelper:function(y){return function(b,w){return new v.HMAC.init(y,w).finalize(b)}}});var v=l.algo={};return l})(Math);return n})})(Eh)),Eh.exports}var wh={exports:{}},hxe=wh.exports,VT;function Gg(){return VT||(VT=1,(function(e,t){(function(n,r){e.exports=r(En())})(hxe,function(n){return(function(r){var o=n,i=o.lib,a=i.Base,s=i.WordArray,l=o.x64={};l.Word=a.extend({init:function(c,u){this.high=c,this.low=u}}),l.WordArray=a.extend({init:function(c,u){c=this.words=c||[],u!=r?this.sigBytes=u:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,u=c.length,d=[],f=0;f<u;f++){var h=c[f];d.push(h.high),d.push(h.low)}return s.create(d,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),u=c.words=this.words.slice(0),d=u.length,f=0;f<d;f++)u[f]=u[f].clone();return c}})})(),n})})(wh)),wh.exports}var Ch={exports:{}},pxe=Ch.exports,GT;function gxe(){return GT||(GT=1,(function(e,t){(function(n,r){e.exports=r(En())})(pxe,function(n){return(function(){if(typeof ArrayBuffer=="function"){var r=n,o=r.lib,i=o.WordArray,a=i.init,s=i.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,u=[],d=0;d<c;d++)u[d>>>2]|=l[d]<<24-d%4*8;a.call(this,u,c)}else a.apply(this,arguments)};s.prototype=i}})(),n.lib.WordArray})})(Ch)),Ch.exports}var kh={exports:{}},mxe=kh.exports,UT;function vxe(){return UT||(UT=1,(function(e,t){(function(n,r){e.exports=r(En())})(mxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(l){for(var c=l.words,u=l.sigBytes,d=[],f=0;f<u;f+=2){var h=c[f>>>2]>>>16-f%4*8&65535;d.push(String.fromCharCode(h))}return d.join("")},parse:function(l){for(var c=l.length,u=[],d=0;d<c;d++)u[d>>>1]|=l.charCodeAt(d)<<16-d%2*16;return i.create(u,c*2)}},a.Utf16LE={stringify:function(l){for(var c=l.words,u=l.sigBytes,d=[],f=0;f<u;f+=2){var h=s(c[f>>>2]>>>16-f%4*8&65535);d.push(String.fromCharCode(h))}return d.join("")},parse:function(l){for(var c=l.length,u=[],d=0;d<c;d++)u[d>>>1]|=s(l.charCodeAt(d)<<16-d%2*16);return i.create(u,c*2)}};function s(l){return l<<8&4278255360|l>>>8&16711935}})(),n.enc.Utf16})})(kh)),kh.exports}var Sh={exports:{}},yxe=Sh.exports,qT;function Sl(){return qT||(qT=1,(function(e,t){(function(n,r){e.exports=r(En())})(yxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64={stringify:function(l){var c=l.words,u=l.sigBytes,d=this._map;l.clamp();for(var f=[],h=0;h<u;h+=3)for(var m=c[h>>>2]>>>24-h%4*8&255,p=c[h+1>>>2]>>>24-(h+1)%4*8&255,g=c[h+2>>>2]>>>24-(h+2)%4*8&255,v=m<<16|p<<8|g,y=0;y<4&&h+y*.75<u;y++)f.push(d.charAt(v>>>6*(3-y)&63));var b=d.charAt(64);if(b)for(;f.length%4;)f.push(b);return f.join("")},parse:function(l){var c=l.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<u.length;f++)d[u.charCodeAt(f)]=f}var h=u.charAt(64);if(h){var m=l.indexOf(h);m!==-1&&(c=m)}return s(l,c,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function s(l,c,u){for(var d=[],f=0,h=0;h<c;h++)if(h%4){var m=u[l.charCodeAt(h-1)]<<h%4*2,p=u[l.charCodeAt(h)]>>>6-h%4*2,g=m|p;d[f>>>2]|=g<<24-f%4*8,f++}return i.create(d,f)}})(),n.enc.Base64})})(Sh)),Sh.exports}var Ah={exports:{}},bxe=Ah.exports,YT;function xxe(){return YT||(YT=1,(function(e,t){(function(n,r){e.exports=r(En())})(bxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64url={stringify:function(l,c){c===void 0&&(c=!0);var u=l.words,d=l.sigBytes,f=c?this._safe_map:this._map;l.clamp();for(var h=[],m=0;m<d;m+=3)for(var p=u[m>>>2]>>>24-m%4*8&255,g=u[m+1>>>2]>>>24-(m+1)%4*8&255,v=u[m+2>>>2]>>>24-(m+2)%4*8&255,y=p<<16|g<<8|v,b=0;b<4&&m+b*.75<d;b++)h.push(f.charAt(y>>>6*(3-b)&63));var w=f.charAt(64);if(w)for(;h.length%4;)h.push(w);return h.join("")},parse:function(l,c){c===void 0&&(c=!0);var u=l.length,d=c?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var h=0;h<d.length;h++)f[d.charCodeAt(h)]=h}var m=d.charAt(64);if(m){var p=l.indexOf(m);p!==-1&&(u=p)}return s(l,u,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function s(l,c,u){for(var d=[],f=0,h=0;h<c;h++)if(h%4){var m=u[l.charCodeAt(h-1)]<<h%4*2,p=u[l.charCodeAt(h)]>>>6-h%4*2,g=m|p;d[f>>>2]|=g<<24-f%4*8,f++}return i.create(d,f)}})(),n.enc.Base64url})})(Ah)),Ah.exports}var $h={exports:{}},Exe=$h.exports,XT;function Al(){return XT||(XT=1,(function(e,t){(function(n,r){e.exports=r(En())})(Exe,function(n){return(function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,l=o.algo,c=[];(function(){for(var p=0;p<64;p++)c[p]=r.abs(r.sin(p+1))*4294967296|0})();var u=l.MD5=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,g){for(var v=0;v<16;v++){var y=g+v,b=p[y];p[y]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}var w=this._hash.words,x=p[g+0],E=p[g+1],k=p[g+2],S=p[g+3],O=p[g+4],A=p[g+5],$=p[g+6],M=p[g+7],N=p[g+8],D=p[g+9],T=p[g+10],P=p[g+11],I=p[g+12],R=p[g+13],H=p[g+14],V=p[g+15],L=w[0],_=w[1],j=w[2],F=w[3];L=d(L,_,j,F,x,7,c[0]),F=d(F,L,_,j,E,12,c[1]),j=d(j,F,L,_,k,17,c[2]),_=d(_,j,F,L,S,22,c[3]),L=d(L,_,j,F,O,7,c[4]),F=d(F,L,_,j,A,12,c[5]),j=d(j,F,L,_,$,17,c[6]),_=d(_,j,F,L,M,22,c[7]),L=d(L,_,j,F,N,7,c[8]),F=d(F,L,_,j,D,12,c[9]),j=d(j,F,L,_,T,17,c[10]),_=d(_,j,F,L,P,22,c[11]),L=d(L,_,j,F,I,7,c[12]),F=d(F,L,_,j,R,12,c[13]),j=d(j,F,L,_,H,17,c[14]),_=d(_,j,F,L,V,22,c[15]),L=f(L,_,j,F,E,5,c[16]),F=f(F,L,_,j,$,9,c[17]),j=f(j,F,L,_,P,14,c[18]),_=f(_,j,F,L,x,20,c[19]),L=f(L,_,j,F,A,5,c[20]),F=f(F,L,_,j,T,9,c[21]),j=f(j,F,L,_,V,14,c[22]),_=f(_,j,F,L,O,20,c[23]),L=f(L,_,j,F,D,5,c[24]),F=f(F,L,_,j,H,9,c[25]),j=f(j,F,L,_,S,14,c[26]),_=f(_,j,F,L,N,20,c[27]),L=f(L,_,j,F,R,5,c[28]),F=f(F,L,_,j,k,9,c[29]),j=f(j,F,L,_,M,14,c[30]),_=f(_,j,F,L,I,20,c[31]),L=h(L,_,j,F,A,4,c[32]),F=h(F,L,_,j,N,11,c[33]),j=h(j,F,L,_,P,16,c[34]),_=h(_,j,F,L,H,23,c[35]),L=h(L,_,j,F,E,4,c[36]),F=h(F,L,_,j,O,11,c[37]),j=h(j,F,L,_,M,16,c[38]),_=h(_,j,F,L,T,23,c[39]),L=h(L,_,j,F,R,4,c[40]),F=h(F,L,_,j,x,11,c[41]),j=h(j,F,L,_,S,16,c[42]),_=h(_,j,F,L,$,23,c[43]),L=h(L,_,j,F,D,4,c[44]),F=h(F,L,_,j,I,11,c[45]),j=h(j,F,L,_,V,16,c[46]),_=h(_,j,F,L,k,23,c[47]),L=m(L,_,j,F,x,6,c[48]),F=m(F,L,_,j,M,10,c[49]),j=m(j,F,L,_,H,15,c[50]),_=m(_,j,F,L,A,21,c[51]),L=m(L,_,j,F,I,6,c[52]),F=m(F,L,_,j,S,10,c[53]),j=m(j,F,L,_,T,15,c[54]),_=m(_,j,F,L,E,21,c[55]),L=m(L,_,j,F,N,6,c[56]),F=m(F,L,_,j,V,10,c[57]),j=m(j,F,L,_,$,15,c[58]),_=m(_,j,F,L,R,21,c[59]),L=m(L,_,j,F,O,6,c[60]),F=m(F,L,_,j,P,10,c[61]),j=m(j,F,L,_,k,15,c[62]),_=m(_,j,F,L,D,21,c[63]),w[0]=w[0]+L|0,w[1]=w[1]+_|0,w[2]=w[2]+j|0,w[3]=w[3]+F|0},_doFinalize:function(){var p=this._data,g=p.words,v=this._nDataBytes*8,y=p.sigBytes*8;g[y>>>5]|=128<<24-y%32;var b=r.floor(v/4294967296),w=v;g[(y+64>>>9<<4)+15]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,g[(y+64>>>9<<4)+14]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,p.sigBytes=(g.length+1)*4,this._process();for(var x=this._hash,E=x.words,k=0;k<4;k++){var S=E[k];E[k]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360}return x},clone:function(){var p=s.clone.call(this);return p._hash=this._hash.clone(),p}});function d(p,g,v,y,b,w,x){var E=p+(g&v|~g&y)+b+x;return(E<<w|E>>>32-w)+g}function f(p,g,v,y,b,w,x){var E=p+(g&y|v&~y)+b+x;return(E<<w|E>>>32-w)+g}function h(p,g,v,y,b,w,x){var E=p+(g^v^y)+b+x;return(E<<w|E>>>32-w)+g}function m(p,g,v,y,b,w,x){var E=p+(v^(g|~y))+b+x;return(E<<w|E>>>32-w)+g}o.MD5=s._createHelper(u),o.HmacMD5=s._createHmacHelper(u)})(Math),n.MD5})})($h)),$h.exports}var Oh={exports:{}},wxe=Oh.exports,KT;function Nz(){return KT||(KT=1,(function(e,t){(function(n,r){e.exports=r(En())})(wxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=o.Hasher,s=r.algo,l=[],c=s.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,d){for(var f=this._hash.words,h=f[0],m=f[1],p=f[2],g=f[3],v=f[4],y=0;y<80;y++){if(y<16)l[y]=u[d+y]|0;else{var b=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=b<<1|b>>>31}var w=(h<<5|h>>>27)+v+l[y];y<20?w+=(m&p|~m&g)+1518500249:y<40?w+=(m^p^g)+1859775393:y<60?w+=(m&p|m&g|p&g)-1894007588:w+=(m^p^g)-899497514,v=g,g=p,p=m<<30|m>>>2,m=h,h=w}f[0]=f[0]+h|0,f[1]=f[1]+m|0,f[2]=f[2]+p|0,f[3]=f[3]+g|0,f[4]=f[4]+v|0},_doFinalize:function(){var u=this._data,d=u.words,f=this._nDataBytes*8,h=u.sigBytes*8;return d[h>>>5]|=128<<24-h%32,d[(h+64>>>9<<4)+14]=Math.floor(f/4294967296),d[(h+64>>>9<<4)+15]=f,u.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var u=a.clone.call(this);return u._hash=this._hash.clone(),u}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)})(),n.SHA1})})(Oh)),Oh.exports}var Mh={exports:{}},Cxe=Mh.exports,ZT;function TS(){return ZT||(ZT=1,(function(e,t){(function(n,r){e.exports=r(En())})(Cxe,function(n){return(function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,l=o.algo,c=[],u=[];(function(){function h(v){for(var y=r.sqrt(v),b=2;b<=y;b++)if(!(v%b))return!1;return!0}function m(v){return(v-(v|0))*4294967296|0}for(var p=2,g=0;g<64;)h(p)&&(g<8&&(c[g]=m(r.pow(p,1/2))),u[g]=m(r.pow(p,1/3)),g++),p++})();var d=[],f=l.SHA256=s.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(h,m){for(var p=this._hash.words,g=p[0],v=p[1],y=p[2],b=p[3],w=p[4],x=p[5],E=p[6],k=p[7],S=0;S<64;S++){if(S<16)d[S]=h[m+S]|0;else{var O=d[S-15],A=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,$=d[S-2],M=($<<15|$>>>17)^($<<13|$>>>19)^$>>>10;d[S]=A+d[S-7]+M+d[S-16]}var N=w&x^~w&E,D=g&v^g&y^v&y,T=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),P=(w<<26|w>>>6)^(w<<21|w>>>11)^(w<<7|w>>>25),I=k+P+N+u[S]+d[S],R=T+D;k=E,E=x,x=w,w=b+I|0,b=y,y=v,v=g,g=I+R|0}p[0]=p[0]+g|0,p[1]=p[1]+v|0,p[2]=p[2]+y|0,p[3]=p[3]+b|0,p[4]=p[4]+w|0,p[5]=p[5]+x|0,p[6]=p[6]+E|0,p[7]=p[7]+k|0},_doFinalize:function(){var h=this._data,m=h.words,p=this._nDataBytes*8,g=h.sigBytes*8;return m[g>>>5]|=128<<24-g%32,m[(g+64>>>9<<4)+14]=r.floor(p/4294967296),m[(g+64>>>9<<4)+15]=p,h.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var h=s.clone.call(this);return h._hash=this._hash.clone(),h}});o.SHA256=s._createHelper(f),o.HmacSHA256=s._createHmacHelper(f)})(Math),n.SHA256})})(Mh)),Mh.exports}var Nh={exports:{}},kxe=Nh.exports,QT;function Sxe(){return QT||(QT=1,(function(e,t){(function(n,r,o){e.exports=r(En(),TS())})(kxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.algo,s=a.SHA256,l=a.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=s._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=s._createHelper(l),r.HmacSHA224=s._createHmacHelper(l)})(),n.SHA224})})(Nh)),Nh.exports}var Dh={exports:{}},Axe=Dh.exports,JT;function Dz(){return JT||(JT=1,(function(e,t){(function(n,r,o){e.exports=r(En(),Gg())})(Axe,function(n){return(function(){var r=n,o=r.lib,i=o.Hasher,a=r.x64,s=a.Word,l=a.WordArray,c=r.algo;function u(){return s.create.apply(s,arguments)}var d=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],f=[];(function(){for(var m=0;m<80;m++)f[m]=u()})();var h=c.SHA512=i.extend({_doReset:function(){this._hash=new l.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(m,p){for(var g=this._hash.words,v=g[0],y=g[1],b=g[2],w=g[3],x=g[4],E=g[5],k=g[6],S=g[7],O=v.high,A=v.low,$=y.high,M=y.low,N=b.high,D=b.low,T=w.high,P=w.low,I=x.high,R=x.low,H=E.high,V=E.low,L=k.high,_=k.low,j=S.high,F=S.low,B=O,z=A,G=$,W=M,q=N,U=D,X=T,ie=P,K=I,re=R,oe=H,ne=V,ae=L,de=_,ge=j,Se=F,ye=0;ye<80;ye++){var be,ce,he=f[ye];if(ye<16)ce=he.high=m[p+ye*2]|0,be=he.low=m[p+ye*2+1]|0;else{var Te=f[ye-15],se=Te.high,Pe=Te.low,De=(se>>>1|Pe<<31)^(se>>>8|Pe<<24)^se>>>7,He=(Pe>>>1|se<<31)^(Pe>>>8|se<<24)^(Pe>>>7|se<<25),ue=f[ye-2],ve=ue.high,xe=ue.low,fe=(ve>>>19|xe<<13)^(ve<<3|xe>>>29)^ve>>>6,pe=(xe>>>19|ve<<13)^(xe<<3|ve>>>29)^(xe>>>6|ve<<26),ke=f[ye-7],Ve=ke.high,Ee=ke.low,yt=f[ye-16],Dt=yt.high,Ft=yt.low;be=He+Ee,ce=De+Ve+(be>>>0<He>>>0?1:0),be=be+pe,ce=ce+fe+(be>>>0<pe>>>0?1:0),be=be+Ft,ce=ce+Dt+(be>>>0<Ft>>>0?1:0),he.high=ce,he.low=be}var Ut=K&oe^~K&ae,Ge=re&ne^~re&de,Xe=B&G^B&q^G&q,qe=z&W^z&U^W&U,lt=(B>>>28|z<<4)^(B<<30|z>>>2)^(B<<25|z>>>7),je=(z>>>28|B<<4)^(z<<30|B>>>2)^(z<<25|B>>>7),Rt=(K>>>14|re<<18)^(K>>>18|re<<14)^(K<<23|re>>>9),zt=(re>>>14|K<<18)^(re>>>18|K<<14)^(re<<23|K>>>9),dt=d[ye],Ct=dt.high,jt=dt.low,Ie=Se+zt,Ne=ge+Rt+(Ie>>>0<Se>>>0?1:0),Ie=Ie+Ge,Ne=Ne+Ut+(Ie>>>0<Ge>>>0?1:0),Ie=Ie+jt,Ne=Ne+Ct+(Ie>>>0<jt>>>0?1:0),Ie=Ie+be,Ne=Ne+ce+(Ie>>>0<be>>>0?1:0),Oe=je+qe,_e=lt+Xe+(Oe>>>0<je>>>0?1:0);ge=ae,Se=de,ae=oe,de=ne,oe=K,ne=re,re=ie+Ie|0,K=X+Ne+(re>>>0<ie>>>0?1:0)|0,X=q,ie=U,q=G,U=W,G=B,W=z,z=Ie+Oe|0,B=Ne+_e+(z>>>0<Ie>>>0?1:0)|0}A=v.low=A+z,v.high=O+B+(A>>>0<z>>>0?1:0),M=y.low=M+W,y.high=$+G+(M>>>0<W>>>0?1:0),D=b.low=D+U,b.high=N+q+(D>>>0<U>>>0?1:0),P=w.low=P+ie,w.high=T+X+(P>>>0<ie>>>0?1:0),R=x.low=R+re,x.high=I+K+(R>>>0<re>>>0?1:0),V=E.low=V+ne,E.high=H+oe+(V>>>0<ne>>>0?1:0),_=k.low=_+de,k.high=L+ae+(_>>>0<de>>>0?1:0),F=S.low=F+Se,S.high=j+ge+(F>>>0<Se>>>0?1:0)},_doFinalize:function(){var m=this._data,p=m.words,g=this._nDataBytes*8,v=m.sigBytes*8;p[v>>>5]|=128<<24-v%32,p[(v+128>>>10<<5)+30]=Math.floor(g/4294967296),p[(v+128>>>10<<5)+31]=g,m.sigBytes=p.length*4,this._process();var y=this._hash.toX32();return y},clone:function(){var m=i.clone.call(this);return m._hash=this._hash.clone(),m},blockSize:1024/32});r.SHA512=i._createHelper(h),r.HmacSHA512=i._createHmacHelper(h)})(),n.SHA512})})(Dh)),Dh.exports}var Th={exports:{}},$xe=Th.exports,eF;function Oxe(){return eF||(eF=1,(function(e,t){(function(n,r,o){e.exports=r(En(),Gg(),Dz())})($xe,function(n){return(function(){var r=n,o=r.x64,i=o.Word,a=o.WordArray,s=r.algo,l=s.SHA512,c=s.SHA384=l.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var u=l._doFinalize.call(this);return u.sigBytes-=16,u}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)})(),n.SHA384})})(Th)),Th.exports}var Fh={exports:{}},Mxe=Fh.exports,tF;function Nxe(){return tF||(tF=1,(function(e,t){(function(n,r,o){e.exports=r(En(),Gg())})(Mxe,function(n){return(function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,l=o.x64,c=l.Word,u=o.algo,d=[],f=[],h=[];(function(){for(var g=1,v=0,y=0;y<24;y++){d[g+5*v]=(y+1)*(y+2)/2%64;var b=v%5,w=(2*g+3*v)%5;g=b,v=w}for(var g=0;g<5;g++)for(var v=0;v<5;v++)f[g+5*v]=v+(2*g+3*v)%5*5;for(var x=1,E=0;E<24;E++){for(var k=0,S=0,O=0;O<7;O++){if(x&1){var A=(1<<O)-1;A<32?S^=1<<A:k^=1<<A-32}x&128?x=x<<1^113:x<<=1}h[E]=c.create(k,S)}})();var m=[];(function(){for(var g=0;g<25;g++)m[g]=c.create()})();var p=u.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var g=this._state=[],v=0;v<25;v++)g[v]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(g,v){for(var y=this._state,b=this.blockSize/2,w=0;w<b;w++){var x=g[v+2*w],E=g[v+2*w+1];x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360;var k=y[w];k.high^=E,k.low^=x}for(var S=0;S<24;S++){for(var O=0;O<5;O++){for(var A=0,$=0,M=0;M<5;M++){var k=y[O+5*M];A^=k.high,$^=k.low}var N=m[O];N.high=A,N.low=$}for(var O=0;O<5;O++)for(var D=m[(O+4)%5],T=m[(O+1)%5],P=T.high,I=T.low,A=D.high^(P<<1|I>>>31),$=D.low^(I<<1|P>>>31),M=0;M<5;M++){var k=y[O+5*M];k.high^=A,k.low^=$}for(var R=1;R<25;R++){var A,$,k=y[R],H=k.high,V=k.low,L=d[R];L<32?(A=H<<L|V>>>32-L,$=V<<L|H>>>32-L):(A=V<<L-32|H>>>64-L,$=H<<L-32|V>>>64-L);var _=m[f[R]];_.high=A,_.low=$}var j=m[0],F=y[0];j.high=F.high,j.low=F.low;for(var O=0;O<5;O++)for(var M=0;M<5;M++){var R=O+5*M,k=y[R],B=m[R],z=m[(O+1)%5+5*M],G=m[(O+2)%5+5*M];k.high=B.high^~z.high&G.high,k.low=B.low^~z.low&G.low}var k=y[0],W=h[S];k.high^=W.high,k.low^=W.low}},_doFinalize:function(){var g=this._data,v=g.words;this._nDataBytes*8;var y=g.sigBytes*8,b=this.blockSize*32;v[y>>>5]|=1<<24-y%32,v[(r.ceil((y+1)/b)*b>>>5)-1]|=128,g.sigBytes=v.length*4,this._process();for(var w=this._state,x=this.cfg.outputLength/8,E=x/8,k=[],S=0;S<E;S++){var O=w[S],A=O.high,$=O.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,$=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360,k.push($),k.push(A)}return new a.init(k,x)},clone:function(){for(var g=s.clone.call(this),v=g._state=this._state.slice(0),y=0;y<25;y++)v[y]=v[y].clone();return g}});o.SHA3=s._createHelper(p),o.HmacSHA3=s._createHmacHelper(p)})(Math),n.SHA3})})(Fh)),Fh.exports}var Ph={exports:{}},Dxe=Ph.exports,nF;function Txe(){return nF||(nF=1,(function(e,t){(function(n,r){e.exports=r(En())})(Dxe,function(n){/** @preserve
793
+ `}}:!1,...d}),[t,n,o,i,a,s,l,c,d]);if(!p)return dh.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"\u6570\u636E\u8F6C\u6362\u5931\u8D25"});try{return console.log("\u5F00\u59CB\u6E32\u67D3 NodeGraph..."),dh.jsx(jbe,{data:p,behaviors:{dragCanvas:{direction:"both"},zoomCanvas:!0,dragElement:!0,optimizeViewportTransform:!0},plugins:v,layout:Gt(()=>{if(!u)return{animate:!1,animation:!1};const b={...u};return b.animate=!1,b.animation=!1,b!=null&&b.options&&typeof b.options=="object"&&(b.options={...b.options,animate:!1,animation:!1}),b},[u]),onReady:(b=>{m.current=b,console.log("KnowledgeGraphPreview ready:",b);const w=g;if(w){const x=()=>{var A,$,M;try{if(typeof b.fitView=="function"&&((A=b.fitView)==null||A.call(b,{padding:40})),typeof b.focusItem=="function")b.focusItem(w,!0);else if(typeof b.focusElement=="function")b.focusElement(w,!0);else if(typeof b.centerElement=="function")b.centerElement(w);else{const D=typeof b.getNode=="function"?b.getNode(w):typeof b.findById=="function"?b.findById(w):null,T=(($=D==null?void 0:D.getModel)==null?void 0:$.call(D))??((M=D==null?void 0:D.getData)==null?void 0:M.call(D)),P=T==null?void 0:T.x,I=T==null?void 0:T.y;P!=null&&I!=null&&(typeof b.panTo=="function"?b.panTo(P,I):typeof b.focusViewport=="function"&&b.focusViewport(P,I))}const N=b.getZoom?b.getZoom():1;typeof b.zoomTo=="function"&&N<.9&&b.zoomTo(.9)}catch(N){console.warn("\u5C45\u4E2D\u8282\u70B9\u5931\u8D25:",N)}};setTimeout(x,80);const E=A=>{try{const $=b;if(typeof $.once=="function")$.once(A,()=>setTimeout(x,30));else if(typeof $.on=="function"){const M=()=>{var N;setTimeout(x,30);try{(N=$.off)==null||N.call($,A,M)}catch{}};$.on(A,M)}}catch{}};E("afterlayout"),E("layoutEnd");let k=0;const S=1,O=setInterval(()=>{k+=1,x(),k>=S&&clearInterval(O)},150)}f&&f(b)}),onDestroy:h})}catch(b){return console.error("=== \u6E32\u67D3\u9519\u8BEF ==="),console.error("\u9519\u8BEF\u7C7B\u578B:",(y=b==null?void 0:b.constructor)==null?void 0:y.name),dh.jsxs("div",{style:{padding:"20px",textAlign:"center",color:"red"},children:["\u56FE\u8868\u6E32\u67D3\u5931\u8D25: ",b instanceof Error?b.message:"\u672A\u77E5\u9519\u8BEF"]})}}const Ybe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACqSURBVHgBzZFNDoQgDIX5uQ3hOMDam8gcxS2nmDkEbL0JDDViiJay9SVNatv3RZ+MvUbOud0Ys87u4MZau7dn0e02zrmnILCDm1pbm8nWxBi/WmteW6+UYiml38D8CSH4B4CCjMwgjr1qzcOXUtZax/HIPAT0kBOAmkFiBMg5F6y/S2LD/ptrQQ5osCjgHtjs70jK3OYURM7MM8gVohBiodIGwe7MZWGv0R+Uy3dwBYPzyQAAAABJRU5ErkJggg==",Vg=({title:e,setOpen:t})=>ut("div",{style:{width:"100%",height:"60px",borderBottom:"1px solid #EBEBEB",padding:"20px",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"16px",fontWeight:600},children:[ee("div",{children:e}),ee("img",{src:Ybe,style:{width:"16px",height:"16px",cursor:"pointer"},onClick:()=>t(!1)})]});Lbe();const Xbe=({curFileInfo:e,onClose:t,token:n})=>{var s;const r={title:"",subtitle:"",backgroundColor:"#f8f9fa",showGrid:!1,showLegend:!1,showTooltip:!1,showFullscreen:!1,showMinimap:!1},[o,i]=nt({nodeList:[],edgeList:[]});Et(()=>{console.log("curFileInfo",e)},[e]);const a=async l=>{if(!(!(l!=null&&l.id)||!(l!=null&&l.cyphers)||!(l!=null&&l.fetchUrl)))try{const{cyphers:c,fetchUrl:u,id:d}=l||{};console.log("getGraphData params",c,u,d);const f=await Mr.post(u,{cyphers:c,ontologyId:d},{headers:{Authorization:n}});console.log("getGraphData res",f),i((f==null?void 0:f.data)||{})}catch(c){console.log("error",c)}};return Et(()=>{a(e)},[e]),ut("div",{children:[ee(Vg,{title:e==null?void 0:e.graphName,setOpen:t}),ee("div",{style:{width:"100%",height:"calc(100vh - 60px)"},children:ee(qbe,{centerNode:{vid:(s=e==null?void 0:e.traceNode)==null?void 0:s.vid},data:o,layout:{type:"force",linkDistance:190},title:r.title,subtitle:r.subtitle,backgroundColor:r.backgroundColor,showGrid:r.showGrid,showLegend:r.showLegend,showTooltip:r.showTooltip,showFullscreen:r.showFullscreen,showMinimap:r.showMinimap,customPlugins:{},onReady:l=>{console.log("KnowledgeGraphPreview ready:",l)}})})]})},PE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAV9SURBVHgBvVZfb1VFEJ/ZPS2l9cpFQypSEEMhUmKiYjQBoxDjm8ZoQuKjTyZ+AV9MrOAH8MlHE99rRKOvPgCSoAkalbQx1mBLLV4vpX9u2t6es7vjzOyevZdg5Y2b7N09c3Zn5jfzm9kDcJ9/uN2LZy6c/RAMfoCASFlKcoKAREb8H0Us/G89RH2v9OHc9gYvnQusDPnHU1Ajaky9jAbjGsQhijPV+6IjaVYdcTuY7QzyaT4ouyijU5k8q5hEC1JaK2KFo/ti6Kg+GWrnoID/+yUDmM9TDUxDG50Ssf5jL+SEtQGq98E9ECZDd6IGjWVUlgxjTlKMxl1nkvG+FMhWejtQ+HgzVM1Vt0n/dNfwRneZ/u6u4HK1Dl1f8ZZwV75Xqk1YDyX8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cOTc/NWkpGI5pcLDzc31fnt7G9+Gsm/L1vGhOQQaK3qCGPtIJSc/EoNAqowC3tDjmEfyc7mu2W1PlacHCRZnKFOSoa5Qt7m5idNv2IF2H2Pdb0gCi16FspsyQM7gp1Q6VqZSjeOngrwKErQZgZBiPsb5qnXavvEBytbd4rnRdmtrK2kjv82leJ/Otrk17GyQc2/wZ59/AcalYkfFCITdAAAAAElFTkSuQmCC",MS=e=>e||"",Sz=["txt","pdf","jpeg","jpg","png"],Qbe=e=>[""].includes(e),op=`http://${location.hostname}:9000/`,jT={docx:_T,doc:_T,pdf:Zbe,xls:PE,xlsx:PE,csv:PE,ppt:IE,pptx:IE,pub:IE,txt:Kbe,png:BE,jpg:BE,jpge:BE},Jbe=e=>jT[e]||jT.txt,aC=()=>"/proxy",NS=e=>{var r;let t=e==null?void 0:e.file_type;const n=(r=e==null?void 0:e.metadata)==null?void 0:r.source;if(n)t=n.split(".").slice(-1)[0];else return(e==null?void 0:e.file_source)||"";return Sz.includes(t)?n.includes("http")?n:`${op}${n}`:(e==null?void 0:e.file_source)||""},DS=e=>{var r;if(!e)return"";const{file_name:t}=e;if(t)return t;const n=(r=e==null?void 0:e.metadata)==null?void 0:r.source;if(n){const o=n.split("/");return o.length?o[o.length-1]:""}else return""},ip=(e,t)=>{var r;if(!e)return"";const n=(r=e==null?void 0:e.metadata)==null?void 0:r.source;if(n){const o=n.split(".");if(!o.length)return"";const i=o[o.length-1],a=(t||"").split(".");if(!a.length)return"";const s=a[a.length-1];switch(i.toLocaleLowerCase()){case"ppt":case"pub":case"pptx":return"pdf_slides";case"xls":case"xlsx":case"csv":case"md":return s==="pdf"?"pdf":"markdown_table";case"png":case"jpg":case"jpeg":return"image";case"html":case"htm":return"html";case"txt":return"text";default:return s==="ppt"||s==="pub"||s==="pptx"?"pdf_slides":"pdf"}}else return""},exe=async({filePath:e,fileName:t,token:n})=>{if(e&&t)try{const r=await Mr.post("/proxy/index/knowledgeBase/file/stream",{convertedFilePath:e},{headers:{"Content-Type":"application/json",Authorization:n},responseType:"arraybuffer"});console.log("response",r);const o=new Blob([r.data]),i=window.URL.createObjectURL(o),a=document.createElement("a"),s=document.body;a.href=i,a.download=t,a.style.display="none",s.appendChild(a);const l=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});a.dispatchEvent(l),setTimeout(()=>{s.removeChild(a),window.URL.revokeObjectURL(i)},100)}catch(r){console.error("\u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25\uFF1A",r)}else console.error("\u7F3A\u5C11\u6587\u4EF6\u540D\u6216\u6587\u4EF6\u5730\u5740\uFF1A")},Az=(e,t)=>{var n,r,o,i,a,s;try{if((r=(n=t==null?void 0:t.metadata)==null?void 0:n.page_size)!=null&&r.length){let l=((i=t==null?void 0:t.metadata)==null?void 0:i.page_size)||[[0,0]];Array.isArray(l)||(l=JSON.parse(l));const c=((a=l[0])==null?void 0:a[0])||0;return(((s=l[0])==null?void 0:s[1])||0)>c||!e||!c||c<=e?1:+(e/c).toFixed(4)}else{const l=MS(NS(t)),c=ip(t,l);let u=c;const d=(t==null?void 0:t.file_name)||((o=t==null?void 0:t.metadata)==null?void 0:o.source);if(d){const f=d.split(".");u=f==null?void 0:f[f.length-1]}return LT(c)||LT(u)?.6:1}}catch(l){return console.log("error",l),1}},LT=e=>["ppt","pptx","pub"].includes(e.toLocaleLowerCase()),txe=e=>{if(!e)return"";const t=e.split("/"),n=t.length,r=t[n-3];if(!r)return"";const o=r.split(".");return o[o.length-1]},nxe=e=>{try{if(!e)return"";const t=e.split("/"),n=t.length;return t[n-3]||""}catch{return""}},rxe=({content:e,onClose:t,token:n})=>{const r=a=>{if(!(a!=null&&a.metadata))return;const s=ip(a,""),{page_number:l,page_size:c,position:u,offset:d,chunk_type:f}=a.metadata;if(s==="markdown_table")return d!=null&&d.length?{annotations:[{id:pa(),offsets:d}],initialPage:1}:{};{if(!c||!u)return console.log("%c\u7F3A\u5C11\u6587\u4EF6size\u6216\u8005\u6587\u4EF6\u5750\u6807","color: red"),{};const h=Array.isArray(c)?c:JSON.parse(c);if(!h.length)return console.log("%c\u7F3A\u5C11\u6587\u4EF6size","color: red"),{};const m=Array.isArray(u)?u:JSON.parse(u);return!m.length||!l?(console.log("%c\u7F3A\u5C11\u6587\u4EF6\u5750\u6807\u6216\u8005\u6587\u4EF6\u9875\u6570","color: red"),{}):{annotations:m.map((g,v)=>({id:pa(),pageNumber:l[v],x:+(g[0][0]/h[0][0]).toFixed(4),y:+(g[0][1]/h[0][1]).toFixed(4),width:+((g[1][0]-g[0][0])/h[0][0]).toFixed(4),height:+((g[2][1]-g[0][1])/h[0][1]).toFixed(4),content:"",color:f==="image"?"#60f74f":"#4FC3F7"})),initialPage:l[0]}}},o=Gt(()=>{var a,s;if(console.log("content88888888888",e),e&&n){console.log("content999",e);const{annotations:l,initialPage:c}=r(e),u={...e,metadata:{source:((a=e==null?void 0:e.metadata)==null?void 0:a.source)||e.parse_url||e.url,page_size:(s=e==null?void 0:e.metadata)==null?void 0:s.page_size}},d=MS(NS(u));return{filePath:d,fileName:DS(u),fileType:ip(u,d),totalPages:u.pdfPages||0,token:n,annotations:l,initialPage:c,initialZoom:Az(598,u)}}else return{}},[e]),i=Gt(()=>o.filePath?(console.log("curData",o),ee(IF,{initialZoom:o.initialZoom||100,convertedFilePath:o.filePath,fileName:o.fileName,fileType:o.fileType,initialPage:o.initialPage,totalPages:o.totalPages,authorization:o.token,annotations:o.annotations,streamApiUrl:"/proxy/index/knowledgeBase/file/stream",eventsEmit:a=>{switch(a){case"viewer:close":t();break}},tools:{close:!0}})):ee(Ac,{}),[o]);return ee("div",{style:{fontFamily:"Source Han Sans CN",fontSize:"12px"},className:"h-full w-full",children:i})},$z=({curFileInfo:e,onClose:t,token:n})=>{const r=Gt(()=>{var i,a,s;if(e&&n){console.log("content999",e);const l={file_source:e.parse_url||e.parsedFilePath||e.url,file_type:e.file_type,metadata:{source:e.filePath||e.url||((i=e==null?void 0:e.metadata)==null?void 0:i.source)||"",page_size:(a=e==null?void 0:e.metadata)==null?void 0:a.page_size},pdfPages:e.pdfPages},c=MS(NS(l));return{filePath:c,fileName:DS(l),fileType:ip(l,c),totalPages:l.pdfPages||0,token:n,initialZoom:Az(((s=document.getElementById("pdfBox"))==null?void 0:s.clientWidth)||0,l)}}else return{}},[e]),o=Gt(()=>(console.log("curData",r),r.filePath?ee(IF,{initialZoom:r.initialZoom||100,convertedFilePath:r.filePath,fileName:r.fileName,fileType:r.fileType,initialPage:1,totalPages:r.totalPages,authorization:r.token,streamApiUrl:"/proxy/index/knowledgeBase/file/stream",eventsEmit:i=>{switch(i){case"viewer:close":t();break}},tools:{close:!0}}):ee(Ac,{})),[r]);return ee("div",{id:"pdfBox",className:"h-full overflow-y-auto",children:o})},oxe=({curFileInfo:e,token:t,onClose:n})=>{const[r,o]=nt(1),[i,a]=nt(10),[s,l]=nt([]),[c,u]=nt([]),[d,f]=nt(0);Et(()=>{var v;const g=((v=e==null?void 0:e.metadata)==null?void 0:v.fetchUrl)||(e==null?void 0:e.fetchUrl);g&&m(g)},[e,r,i]);const h=async({url:g,params:v})=>{var y;try{const b=await Mr.get(`${aC()}${g}?${new URLSearchParams(v).toString()}`,{headers:{Authorization:t}}),w=(y=b==null?void 0:b.data)==null?void 0:y.data;if(w){const{columns:x,dataList:E,totalData:k}=w;l(((x==null?void 0:x.slice(1))||[]).map(S=>({title:S.businessName,dataIndex:S.physicalName,key:S.physicalName}))),u(E||[]),f(k||[])}}catch(b){console.log("error",b)}},m=async g=>{h({url:`${g}`,params:{pageNo:r,pageSize:i}})},p=Gt(()=>{const{databaseName:g,businessTableName:v,tableName:y}=e;return`${g} - ${y||v}`},[e]);return ut("div",{children:[ee(Vg,{title:p,setOpen:n}),(s==null?void 0:s.length)>0?ut("div",{children:[ee("div",{className:"p-4 overflow-auto h-[calc(100vh-120px)]",children:ee(tH,{columns:s,dataSource:c,pagination:!1,scroll:{x:"max-content"},rowKey:"id"})}),ee("div",{className:"flex justify-end px-[18px]",children:ee(lH,{current:r,pageSize:i,responsive:!0,simple:!0,total:d,showSizeChanger:!0,showQuickJumper:!0,onChange:(g,v)=>{o(g),a(v||10)},onShowSizeChange:(g,v)=>{o(1),a(v)}})})]}):ee(Uz,{})]})},zT=({i:e,item:t,j:n,clickTag:r})=>(console.log("j in tag",n),console.log("i in tag",e),console.log("item in tag",t),ee("div",{style:{minWidth:"16px",height:"16px",backgroundColor:sxe[t.key],margin:"0 4px",color:lxe[t.key],display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"2px",fontSize:"12px",cursor:"pointer"},onClick:()=>r&&r(e,n,t),children:n.index},n.id)),ixe=()=>"/proxy",RE=e=>{if(!e||typeof e!="string")return"";const t=e.split("/"),n=t.length;return t[n-1]},axe=e=>{const t=(e||"").toLowerCase();return["png","jpg","jpeg","gif","bmp","webp","svg","ico"].includes(t)?"rag/pic":t==="pdf"?"rag/pdf":["doc","docx"].includes(t)?"rag/word":["xls","xlsx","xlsm","xlsb","xltx","xltm","xlt","xlam"].includes(t)?"rag/excel":["ppt","pptx"].includes(t)?"rag/ppt":t==="txt"||t==="md"?"rag/txt":t==="csv"?"rag/csv":["zip","rar","7z"].includes(t)?"rag/zip":["odt","ods","odp","odf"].includes(t)?"rag/odf":t==="json"?"rag/json":"rag/file"},Oz=e=>{if(e.loading)return ee(cH,{size:"small",style:{marginRight:"5px",width:"12px",fontSize:"12px"}});if(e.type==="dir")return ee(Kr,{type:"rag/folder",size:16});if(e.type==="file"&&e.fileType){const t=axe(e.fileType);return ee(Kr,{type:t,size:16})}return ee(Kr,{type:"rag/folder",size:16})},sxe={knowledgeList:"#EAF4FD",searchList:"#E8F7F0",databaseList:"#FFF4E5",graphList:"#E7F8FB"},lxe={knowledgeList:"#2072F0",searchList:"#39B83F",databaseList:"#F48C14",graphList:"#10BBD9"},HT=[{key:"knowledgeList",name:"\u77E5\u8BC6\u5E93\u6587\u6863"},{key:"searchList",name:"\u8054\u7F51\u641C\u7D22",hideBtns:!0},{key:"databaseList",name:"\u6570\u636E\u5E93",hideBtns:!0},{key:"graphList",name:"\u77E5\u8BC6\u56FE\u8C31",hideBtns:!0}],cxe=({type:e,data:t,token:n,eventsEmit:r,is_download:o})=>{const[i,a]=nt(HT),[s,l]=nt("mark"),[c,u]=nt(!1),[d,f]=nt({}),[h,m]=nt("knowledgeList"),[p,g]=nt({knowledgeList:[],searchList:[],databaseList:[],graphList:[]}),v=Gt(()=>{const E=4-i.length,k=Array(E).fill(null).map((O,A)=>({name:"",key:100+A})),S=[...i,...k];return console.log("rrrrrr",S),S},[i]),y=E=>isNaN(E)?"":(+E).toFixed(2),b=(E,k)=>{switch(E){case"knowledgeList":return Jbe(k);case"searchList":return xie;case"databaseList":return Eie;case"graphList":return bie}},w=(E,k)=>E==="graphList"?k.map(S=>({...S,name:S.graphName})).sort((S,O)=>(O.score||0)-(S.score||0)):E==="knowledgeList"?k.map(S=>({...S,file_type:txe(S.source)||S.file_type,name:nxe(S.source)||S.file_name,score:S.rrf_score})).sort((S,O)=>(O.score||0)-(S.score||0)):E==="searchList"?k.map(S=>({...S,name:S.file_name})).sort((S,O)=>(O.score||0)-(S.score||0)):E==="databaseList"?k.map(S=>{const O=S.tableName?`${S.databaseName||"\u6570\u636E\u5E93"} - ${S.tableName}`:S.databaseName||S.name||"\u6570\u636E\u5E93";return{...S,name:O,file_name:O,file_type:"database"}}).sort((S,O)=>(O.score||0)-(S.score||0)):k,x=(E,k,S)=>{var O;switch(S.key){case"knowledgeList":const{pdfPages:A,parsedFilePath:$,order_num:M,tags:N}=E||{},D=k.id||M||"Unknown ID",T=(N||[]).find(_=>_.id===D);if(E.type==="video")return console.log("sdgasdgag",{file:{...E,...T}}),r==null?void 0:r("retrive_tag:click",{file:{...E,...T}});if(console.log("click knowledge tag",E,k),!E||!T)return;const{metadata:P}=T,I=P.source.split("/"),R=I[I.length-1]||"",H=R.split("."),V=H.slice(0,-1).join(".")||"Unknown Label",L=H[H.length-1]||"Unknown Type";f({id:D,title:V,file_name:R,file_type:L,file_source:Qbe(L)?`${op}${P.source}`:$,metadata:P,pdfPages:A}),l("mark"),u(!0);break;case"searchList":console.log("click search tag",E,k);break;case"databaseList":console.log("click database tag",E,k),l("database"),f({...E,metadata:E.metadata||{},fetchUrl:E.fetchUrl||((O=E.metadata)==null?void 0:O.fetchUrl)||""}),u(!0);break;case"graphList":console.log("click graph tag",E,k),l("graphPreview"),f({...E,traceNode:((t==null?void 0:t.traceNode)||[]).find(_=>_.id===k.id)}),u(!0);break}};return Et(()=>{if(e!==Mz.REFERENCELIST||(console.log("data in reference drawer",t),!t))return;const{graphRefs:E,knowledgeRefs:k,webRefs:S,databaseRefs:O}=t;E!=null&&E.length&&(p.graphList=w("graphList",E)),k!=null&&k.length&&(p.knowledgeList=w("knowledgeList",k)),S!=null&&S.length&&(p.searchList=w("searchList",S)),O!=null&&O.length&&(p.databaseList=w("databaseList",O));const A=HT.filter($=>{var M;return(M=p[$.key])==null?void 0:M.length}).sort(($,M)=>{var N,D;return(((N=p[M.key])==null?void 0:N.length)||0)-(((D=p[$.key])==null?void 0:D.length)||0)});a(A),A!=null&&A.length&&m(A[0].key),g({...p})},[t]),ut(Ac,{children:[ut("div",{className:"listWrap w-full h-full",children:[ee(Vg,{title:"\u77E5\u8BC6\u6EAF\u6E90",setOpen:()=>{const E=new CustomEvent("aichat:right_set",{detail:{collapsed:!0}});window.dispatchEvent(E)}}),ut("div",{style:{height:"calc(100% - 60px)"},children:[ee("div",{className:"tabs",style:{display:"flex",justifyContent:"space-between",padding:"12px 20px"},children:v.map(E=>ee("div",{className:"tab-item",style:{padding:"5.5px 12px",backgroundColor:E.name?h===E.key?"#4E6EF2":"#F5F6F9":"transparent",cursor:"pointer",borderRadius:"4px",color:h===E.key?"#FFFFFF":"#4E5969",fontSize:"14px",minWidth:"80px",display:"flex",justifyContent:"center"},onClick:()=>{E.name&&m(E.key)},children:E.name},E.key))}),ee("div",{className:"listBox",style:{height:"calc(100% - 66px)",overflowY:"auto",display:"flex",flexDirection:"column",alignItems:"center",willChange:"scroll-position",transform:"translateZ(0)"},children:i.map(E=>{let k=p[E.key]||[];return h!==E.key?null:ee("div",{children:k.map(S=>{var O,A,$,M,N,D;return ut("div",{style:{width:"360px",padding:"4px 8px",borderRadius:"4px",margin:"6px 0",cursor:"pointer"},className:"listItemBox",onClick:()=>{E.key==="searchList"&&window.open(S.link,"_blank")},children:[ut("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ut("div",{style:{width:E.hideBtns?"339px":"288px",fontSize:"14px",color:"#1D2129",fontWeight:"700",display:"flex",alignItems:"center"},children:[ee("img",{src:b(E.key,S.file_type),style:{width:"16px",height:"16px",marginRight:"2px"}}),ee(Ks,{placement:"topLeft",title:((O=S==null?void 0:S.name)==null?void 0:O.length)>17?S.name:"",children:ee("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:E.hideBtns?"322px":"258px"},onClick:()=>{var T;E.key==="knowledgeList"?r==null||r("knowledge_referenceFile_title:click",{data:{...S,file_type:S.file_type,file_name:S.file_name,metadata:S.metadata,parsedFilePath:S.parsedFilePath}}):E.key==="databaseList"&&(l("database"),f({...S,metadata:S.metadata||{},fetchUrl:S.fetchUrl||((T=S.metadata)==null?void 0:T.fetchUrl)||""}),u(!0))},children:S.name})})]}),ut("div",{style:{width:"52px",justifyContent:"space-between",alignItems:"center",marginRight:"8px",display:E.hideBtns||S.type==="video"?"none":"flex"},children:[ee("img",{src:vie,style:{width:"16px",height:"16px",cursor:"pointer"},onClick:()=>{r==null||r("referenceFile_filechat",{data:{...S,file_type:S.file_type,file_name:S.file_name,metadata:S.metadata,parsedFilePath:S.parsedFilePath}})}}),ee("div",{style:{borderRight:"1px solid #E5E6EB",height:"14px"}}),ee("img",{src:yie,style:{width:"16px",height:"16px",cursor:o?"pointer":"not-allowed"},onClick:()=>{var P,I,R;if(!((P=S==null?void 0:S.tags)!=null&&P.length)&&!((I=S==null?void 0:S.metadata)!=null&&I.source)||!o)return;const T=((R=((S==null?void 0:S.tags)||[])[0])==null?void 0:R.metadata)||(S==null?void 0:S.metadata);exe({filePath:`${op}${T.source}`,fileName:DS({metadata:T}),token:n})}})]})]}),!!(typeof S.score=="string"||typeof S.score=="number"||(A=S==null?void 0:S.tags)!=null&&A.length&&S.tags.length>0&&S.tags.length<=10)&&ut("div",{style:{display:"flex",justifyContent:"space-between",height:"18px",marginTop:"4px"},children:[(typeof S.score=="string"||typeof S.score=="number")&&ut("div",{style:{backgroundColor:"#F2F2FB",borderRadius:"4px",padding:"2px 3px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"12px"},children:[ee("span",{style:{color:"#4E5969",marginRight:"6px"},children:"\u5206\u6570:"}),ee("span",{style:{color:"#1D2129"},children:y(S.score)})]}),ee("div",{style:{flex:1,display:"flex",justifyContent:"flex-end"},children:(($=S==null?void 0:S.tags)!=null&&$.length&&S.tags.length>0&&S.tags.length<=10?S.tags:[]).map(T=>ee(zT,{i:S,item:E,j:T,clickTag:x},T.id))})]}),ee("div",{style:{flex:1,display:"flex",justifyContent:"flex-start",marginTop:"4px"},children:((M=S==null?void 0:S.tags)!=null&&M.length&&S.tags.length>10?S.tags:[]).map(T=>ee(zT,{i:S,item:E,j:T,clickTag:x},T.id))}),!!((N=S==null?void 0:S.main_source)!=null&&N.length)&&ut("div",{style:{flex:1,display:"flex",alignItems:"flex-start",marginTop:"4px"},children:[ee("div",{style:{fontSize:"12px",color:"#4E5969",width:"60px"},children:"\u5173\u8054\u6587\u6863:"}),ee(Ks,{placement:"topLeft",title:((D=RE(S.main_source[0]))==null?void 0:D.length)>22?RE(S.main_source[0]):"",children:ee("div",{style:{fontSize:"12px",color:"#4E5969",width:"289px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:RE(S.main_source[0])})})]})]},S.id)})},E.key)})})]})]}),ee(bd,{drawer:{styles:{body:{padding:0},header:{display:"none"}}},children:ut(BF,{autoFocus:!1,onClose:()=>u(!1),open:c,width:h==="graphList"?"100%":720,className:"overflow-x-hidden",destroyOnClose:!0,afterOpenChange:E=>{E||f(null)},children:[s==="graphPreview"&&ee(Xbe,{curFileInfo:d,onClose:u,token:n}),s==="mark"&&ee(rxe,{content:d,onClose:u,token:n}),s==="preview"&&ee($z,{curFileInfo:d,onClose:u,token:n}),s==="database"&&ee(oxe,{curFileInfo:d,onClose:u,token:n})]})})]})},uxe=({fileData:e,token:t})=>{const[n,r]=nt([]);Et(()=>{var l;const a=e==null?void 0:e.knowledgeBases;if(!(a!=null&&a.length))return;const s=((l=a[0])==null?void 0:l.treeData)||[];s!=null&&s.length&&r(s)},[e]);const o=et(new Map),i=async(a,s)=>{var l,c;if(!o.current.get(a==null?void 0:a.fetchUrl))try{const u=n[s];u.loading=!0;const d=[...n];r(d);const f=await Mr.get(`${ixe()}/${a.fetchUrl}`,{headers:{Authorization:t}}),h=(c=(l=f==null?void 0:f.data)==null?void 0:l.data)==null?void 0:c.records;if(h){const m=n[s];m.loading=!1,m.children=h;const p=[...n];p[s]=m,r(p),o.current.set(a==null?void 0:a.fetchUrl,!0)}else{const m=n[s];m.loading=!1;const p=[...n];r(p)}}catch{const d=n[s];d.loading=!1;const f=[...n];r(f)}};return ut(Ac,{children:[ee(Vg,{title:"\u77E5\u8BC6\u5E93\u6587\u6863\u76EE\u5F55",setOpen:()=>{const a=new CustomEvent("aichat:right_set",{detail:{collapsed:!0}});window.dispatchEvent(a)}}),ee("div",{style:{height:"calc(100% - 60px)",overflowY:"auto",padding:"16px"},children:n.map((a,s)=>{var l;return a.type==="file"?ut("div",{className:"flex",style:{marginTop:"8px"},children:[Oz(a),ee(Ks,{placement:"top",title:((l=a.name)==null?void 0:l.length)>23?a.name:"",children:ee("div",{style:{paddingLeft:"6px",width:"346px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"default",fontSize:"14px"},children:a.name})})]}):ee(dxe,{item:a,index:s,clickFileItem:i},s)})})]})},dxe=({item:e,index:t,clickFileItem:n})=>{var i;const[r,o]=nt(!1);return ut("div",{style:{marginTop:"8px"},children:[ut("div",{className:"flex cursor-pointer",onClick:()=>{o(!r),!r&&n(e,t)},children:[Oz(e),ee(Ks,{placement:"top",title:((i=e.name)==null?void 0:i.length)>23?e.name:"",children:ut("div",{style:{paddingLeft:"6px",width:"346px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"14px"},children:[e.name," (",e.fileCount||0,")"]})})]},t),ee("div",{style:{padding:"2px 0 2px 14px",margin:"8px 0 0 7px",borderLeft:"2px solid #E5E6EB",display:r?"block":"none"},children:(e.children||[]).map((a,s)=>{var l;return ut("div",{className:"flex items-center",children:[ee("div",{style:{width:"4px",height:"4px",borderRadius:"2px",background:"black"}}),ee(Ks,{placement:"top",title:((l=a.name)==null?void 0:l.length)>26?a.name:"",children:ee("div",{style:{paddingLeft:"6px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"12px",width:"336px"},children:a.fileName})})]},s)})})]})};var Mz=(e=>(e.REFERENCELIST="referencelist",e.ALLFILELIST="allFileList",e))(Mz||{});function VEe(e=Gre){return function({token:n,url:r="http://localhost:8888",styles:o,CSRFToken:i,eventsEmit:a,scrollOld:s,...l}){const c=Gt(()=>qz({theme:sC,mode:"light"},o),[o]),[u,d]=nt(!1),[f,h]=nt(!1),[m,p]=nt(null),[g,v]=nt(!1),[y,b]=nt("mark"),[w,x]=nt({url:"",parse_url:"",file_type:"",file_name:""}),[E,k]=nt([]),[S,O]=nt(1),[A]=nt(16),[$,M]=nt(0),[N,D]=nt(!1),[T,P]=nt([]),[I,R]=nt(void 0),[H,V]=nt([]),[L,_]=nt([]),[j,F]=nt(void 0),[B,z]=nt({display:"ready",sender:"ready",app:"initializing"});function G(J,Z){if(!Z)return J;const $e=Array.isArray(J)?[...J]:{...J};for(const Ae in Z)if(Z[Ae]!==void 0&&Z[Ae]!==null&&Object.prototype.hasOwnProperty.call(Z,Ae))if(Ae==="actions"&&Array.isArray(J[Ae])&&Array.isArray(Z[Ae])){const tt=new Map;J[Ae].forEach(vt=>{vt.name&&tt.set(vt.name,vt)}),Z[Ae].forEach(vt=>{vt.name&&tt.set(vt.name,vt)}),$e[Ae]=Array.from(tt.values())}else typeof J[Ae]=="object"&&J[Ae]!==null&&!Array.isArray(J[Ae])&&typeof Z[Ae]=="object"&&Z[Ae]!==null&&!Array.isArray(Z[Ae])?$e[Ae]=G(J[Ae],Z[Ae]):$e[Ae]=Z[Ae];return $e}const[W,q]=nt(()=>G(OA,l.senderConfig));Et(()=>{if(l.senderConfig){const J=G(OA,l.senderConfig);q(J)}},[l.senderConfig]);const{fileStatuses:U,setFileStatuses:X,pollFileStatus:ie,handleRemoveFromTemp:K,resetStopFlag:re,setStopFlag:oe,stoppedRef:ne,getTempFileList:ae,setFileManagerData:de,fileManagerData:ge}=oie({url:r,token:n,CSRFToken:i,activeSessionId:I}),[Se,ye]=we.useState(()=>{var Z;if(!L||L.length===0)return;const J=L.find($e=>$e.isDefault);return J?J.id:(Z=L[0])==null?void 0:Z.id});we.useEffect(()=>{if(!L||L.length===0)return;const J=L.some(Z=>Z.id===Se);if(!Se||!J){const Z=L.find($e=>$e.isDefault);ye(Z?Z.id:L[0].id)}},[L]);const[be,ce]=nt({}),he=et(void 0),Te=et(void 0),se=et(void 0),Pe=et(null),De=et(void 0),He=et([]),[ue,ve]=nt([]),[xe,fe]=nt({}),[pe,ke]=nt(!1),[Ve,Ee]=nt([]),[yt,Dt]=nt(!1),{api_startChat_re:Ft,addEmptyMessage:Ut,setLastEmptyMessage:Ge,stopStream:Xe,cancelStreamBySessionId:qe}=tie({baseUrl:r,CSRFToken:i,token:n,setChatData:P,activeSessionId:I,setAppStatus:z,setConversationList:k}),lt=Gt(()=>{const J={};return(L||[]).forEach(Z=>{J[Z.id]=Z}),J},[L]),je=Gt(()=>{const J=T.find($e=>$e.id===I)||{id:I,messages:[]},Z=J.configId?lt[J.configId]:null;return{...J,assistantInfo:Z}},[T,I,lt]),Rt=Gt(()=>{if(je.configId&&lt){const J=lt[je.configId];return J!=null&&J.configJson?JSON.parse(J.configJson).is_download:!1}else return!1},[je.configId,lt]);Gt(()=>{if((je.configId||j)&&lt){const J=lt[je.configId];if(J!=null&&J.configJson){const Z=JSON.parse(J.configJson);return console.log("is_enableThinking",je.configId,lt,j),!!Z.thinking}else if(j){const Z=lt[j];if(Z!=null&&Z.configJson)return!!JSON.parse(Z.configJson).thinking}}return!1},[je.configId,lt,j]),Et(()=>{if(he.current&&he.current!==I){const Z=he.current,$e=E.find(vt=>vt.sessionId===Z&&vt.isNew),Ae=T.find(vt=>vt.id===Z&&vt.isNew),tt=Ae&&Ae.messages&&Ae.messages.length>0;$e&&!tt&&(k(vt=>vt.filter(Ot=>Ot.sessionId!==Z)),P(vt=>vt.filter(Ot=>Ot.id!==Z)))}he.current=I;const J=je.messages&&je.messages.length>0?je.messages[je.messages.length-1].recommendQuestion:[];V(J)},[I,E,T,je.messages]);const zt=async J=>{var Z,$e,Ae,tt;if(!N){D(!0);try{const vt=await Mr.get(`${r}/qa/dialogue/list?pageNo=${J}&pageSize=${A}&sysType=INT_SESSION`,{headers:{Authorization:n}}),Ot=(($e=(Z=vt==null?void 0:vt.data)==null?void 0:Z.data)==null?void 0:$e.records)||[],wt=((tt=(Ae=vt==null?void 0:vt.data)==null?void 0:Ae.data)==null?void 0:tt.total)||0;M(wt),k(ot=>{const Mt=new Map;return[...ot,...Ot].forEach(Zt=>{Mt.set(Zt.sessionId,Zt)}),Array.from(Mt.values())}),O(J)}catch{}finally{D(!1)}}};Et(()=>{z(J=>({...J,app:"initializing"})),Mr.get(`${r}/qa/search/config/helper/list?pageNo=1&pageSize=3000`,{headers:{Authorization:n}}).then(J=>{_(J.data.data||[])}).catch(()=>{}),zt(1).then(()=>{I||Pt(),z(J=>({...J,app:"ready"}))}).catch(()=>{z(J=>({...J,app:"error"}))})},[]),Et(()=>{I&&(z(J=>({...J,display:"loading"})),ae(I),Mr.get(`${r}/qa/dialogue/getDialogBySessionId?sessionId=${I}`,{headers:{Authorization:n}}).then(J=>{var Cn;if(!J.data.data){z(bt=>({...bt,display:"ready"}));return}const Z=((Cn=J.data.data)==null?void 0:Cn.queryReplyPairList)||[],$e=Ioe(Z),{sessionId:Ae,searchConfigDTO:tt,filePath:vt,configId:Ot,reference:wt,webReference:ot,uploadedFiles:Mt,fileList:Zt,currentFiles:Ue}=J.data.data;if($e.length>0){const bt=$e.length-1-[...$e].reverse().findIndex(Wt=>Wt.istype==="ai");bt>=0&&bt<$e.length&&$e[bt].istype==="ai"&&(wt&&($e[bt].reference=wt),ot&&($e[bt].webReference=ot))}const Ye=Ue||Zt||Mt;if(Ye&&$e.length>0){const bt=[...$e].reverse().findIndex(Wt=>Wt.istype==="user");bt!==-1&&(console.log($e[$e.length-1-bt].currentFiles,"filesData"),$e[$e.length-1-bt].currentFiles=Ye)}E.find(bt=>bt.sessionId===Ae)&&k(bt=>bt.map(Wt=>Wt.sessionId===Ae?{...Wt,searchConfigDTO:tt,filePath:vt,configId:Ot}:Wt));const It={configId:J.data.data.configId,filePath:J.data.data.filePath,searchConfigDTO:J.data.data.searchConfigDTO||{},sessionId:J.data.data.sessionId,label:J.data.data.label,kbId:J.data.data.kbId};P(bt=>{const Wt=bt.filter(ft=>ft.id!==I);return[{id:I,messages:$e,...It},...Wt]}),z(bt=>({...bt,display:"ready"}))}).catch(J=>{console.error("\u83B7\u53D6\u804A\u5929\u6570\u636E\u5931\u8D25:",J),J.response&&J.response.status===404&&Pt(),z(Z=>({...Z,display:"error"}))}))},[I,r,n]),Et(()=>{const J=ge.uploadedFiles.length;q(Z=>{const $e=Array.isArray(Z.actions)?Z.actions:[];return{...Z,actions:$e.map(tt=>tt.name==="history"?{...tt,badgeCount:J}:tt)}})},[ge.uploadedFiles]),Et(()=>{Boe({url:r,token:n},J=>{Ee(J)})},[]),we.useEffect(()=>{U.length&&P(J=>{if(!J[0])return J;const{messages:Z}=J[0];for(let $e=Z.length-1;$e>=0;$e--)if(Z[$e].istype==="user"){const Ae=Z[$e].currentFiles||[];Z[$e].currentFiles=U.map(tt=>{var Ot,wt,ot;const vt=Ae.find(Mt=>Mt.uid===tt.uid);return{name:((Ot=tt.file)==null?void 0:Ot.name)||tt.name,size:((wt=tt.file)==null?void 0:wt.size)||tt.size,type:((ot=tt.file)==null?void 0:ot.type)||tt.type,status:tt.status,uid:tt.uid,url:tt.url||(vt==null?void 0:vt.url)||""}});break}return[...J]})},[U]);let dt=null,Ct=null;const jt=(J,Z,$e,Ae)=>{Ct=ie(J,{onStatusUpdate:Z,onComplete:$e,onFail:Ae})},Ie=(J,Z)=>{P($e=>{const Ae=[...$e];return Ae[0]&&(Ae[0]={...Ae[0],messages:Ae[0].messages.map(tt=>tt.queryId===J?{...tt,feedbackResult:Z}:tt)}),Ae})},Ne=async J=>{var Z,$e;if(J)try{const Ae=(je==null?void 0:je.configId)||((Z=lt==null?void 0:lt[(je==null?void 0:je.configId)||""])==null?void 0:Z.id)||"",tt=await Mr.get(`${r}/qa/ai/recommendQuestion?queryId=${J}&configId=${Ae||""}`.replace(/\?&/,"?"),{headers:{Authorization:n}});V((($e=tt.data)==null?void 0:$e.data)||[])}catch{V([])}};function Oe(J){const{content:Z,audioUrl:$e,filePaths:Ae,queryId:tt}=J;if(!I||!tt)return;const vt=(je==null?void 0:je.messages)||[],Ot=vt.findIndex(Ye=>(Ye==null?void 0:Ye.queryId)===tt&&((Ye==null?void 0:Ye.istype)==="ai"||(Ye==null?void 0:Ye.isUser)===!1));let wt;if(Ot>0)for(let Ye=Ot-1;Ye>=0;Ye-=1){const ct=vt[Ye];if((ct==null?void 0:ct.istype)==="user"||(ct==null?void 0:ct.isUser)===!0){wt=ct;break}}const ot=(wt==null?void 0:wt.content)??Z;if(!ot)return;const Mt=(wt==null?void 0:wt.filePaths)??Ae,Zt=(typeof Mt=="string"&&Mt?JSON.parse(Mt):Mt||[]).map(Ye=>Ye.uid),Ue=Date.now();Ge({now:Ue}),z(Ye=>({...Ye,display:"processing",sender:"processing"})),Ot>=0&&vt[Ot]&&P(Ye=>{if(!Ye[0])return Ye;const ct=Ye[0],It=ct.messages||[];if(Ot>=It.length)return Ye;const Cn=It.slice();return Cn[Ot]={...Cn[Ot],content:Cn[Ot].content,reference:"[]",webReference:"[]",graphReference:null,databaseReference:null,status:2,chain:void 0},[{...ct,messages:Cn},...Ye.slice(1)]}),J.clearFn&&J.clearFn(),k(Ye=>Ye.map(ct=>ct.sessionId===I?{...ct,gmtModified:Ue}:ct)),Ft({configId:je.configId,content:ot,fileUids:Zt,lastDate:Ue,name:je.label||"",queryId:tt,sessionId:String(I||""),type:(wt==null?void 0:wt.audioUrl)??$e?"audioUrl":"text",audioUrl:((wt==null?void 0:wt.audioUrl)??$e)||"",enableThinking:!!be.reasoning,enableWebsearch:!!be.netSearch,qaChannel:be.qaChannel,tempKnowledgeBaseCheck:ht.current},Ye=>{Ne(tt)})}async function _e(J,Z){if(!I)return;const $e=new CustomEvent("aichat:right_set",{detail:{collapsed:!0}});window.dispatchEvent($e);const Ae=E.find(tt=>tt.sessionId===I);if(Ae&&Ae.isNew){let tt=!1;const vt=j||Ae.configId,Ot=J&&J.content?J.content.slice(0,20):Ae.label||"\u672A\u547D\u540D\u4F1A\u8BDD";if(await new Promise((wt,ot)=>{joe({url:r,token:n,CSRFToken:i},{label:Ot,sessionId:Ae.sessionId,sysType:"INT_SESSION",configId:vt},Mt=>{Mt&&Mt.data&&Mt.data.sessionId?(k(Zt=>Zt.map(Ue=>Ue.sessionId===Ae.sessionId?{...Ue,isNew:!1,configId:vt,label:Ot}:Ue)),P(Zt=>Zt.map(Ue=>Ue.id===Ae.sessionId?{...Ue,isNew:!1,configId:vt,label:Ot}:Ue)),tt=!0,wt()):(gr.error("\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),ot())})}),!tt)return;mt(I,J,Z,vt);return}mt(I,J,Z)}function mt(J,Z,$e,Ae){const tt="query-"+pa(32),vt=E.find(Ye=>Ye.sessionId===J),Ot=Ae||(vt==null?void 0:vt.configId)||je.configId;console.log("\u52A9\u624B\u914D\u7F6E\u8BE6\u60C5",Ot);const wt=Z.content||Z.text||"",ot=typeof wt=="string"?wt:String(wt),Mt=ot?ot.slice(0,20):"\u672A\u547D\u540D\u4F1A\u8BDD";let Zt;if(Z.files&&Z.files.length>0&&(Zt=Z.files.map(Ye=>({name:Ye.file.name,size:Ye.file.size,type:Ye.file.type,filePath:Ye.filePath||"",convertedFilePath:Ye.convertedFilePath||"",uid:Ye.uid||""}))),console.log("\u672C\u5730\u6587\u4EF6\u4E0A\u4F20",Z.files),Ut({content:ot,queryId:tt,currentFiles:Zt,filePaths:Zt?JSON.stringify(Zt):void 0}),k(Ye=>Ye.map(ct=>ct.sessionId===J&&ct.label==="\u672A\u547D\u540D\u4F1A\u8BDD"&&ct.isNew?{...ct,label:Mt,gmtModified:Date.now(),isNew:!1}:ct)),P(Ye=>Ye.map(ct=>ct.id===J&&ct.label==="\u672A\u547D\u540D\u4F1A\u8BDD"&&ct.isNew?{...ct,label:Mt,isNew:!1}:ct)),Z.files&&Z.files.length>0){z(bt=>({...bt,sender:"uploading",display:"uploading"})),dt=new AbortController,re();const Ye=Z.files.map(()=>`rc-upload-${Date.now()}-${Math.random().toString(36).slice(2)}`),ct=Z.files.map((bt,Wt)=>({...bt,uid:Ye[Wt],status:"uploading"}));X(ct);const It=new FormData;Z.files.forEach(bt=>{It.append("files",bt.file)});const Cn=String(J||"");It.append("sessionId",Cn),It.append("uids",Ye.join(",")),Mr.post(`${r}/index/knowledgeBase/file/uploadFiles`,It,{headers:{Authorization:n,"Content-Type":"multipart/form-data"},signal:dt.signal}).then(bt=>{var Tt,Bn,zn,pr,oa,fi,Aa,hi,$a,Es;if(console.log("\u6587\u4EF6\u4E0A\u4F20\u7684\u6253\u5370\u7ED3\u679C",bt),console.log("\u6587\u4EF6\u4E0A\u4F20\u54CD\u5E94\u8BE6\u60C5:",{status:bt.status,success:(Tt=bt.data)==null?void 0:Tt.success,dataType:Array.isArray((Bn=bt.data)==null?void 0:Bn.data)?"array":typeof((zn=bt.data)==null?void 0:zn.data),dataLength:Array.isArray((pr=bt.data)==null?void 0:pr.data)?bt.data.data.length:"N/A",errorMsg:(oa=bt.data)==null?void 0:oa.errorMsg,errorCode:(fi=bt.data)==null?void 0:fi.errorCode,fullResponse:bt.data}),ne.current)return;const Wt=(Aa=bt.data)==null?void 0:Aa.data,Fn=((hi=bt.data)==null?void 0:hi.success)===!0,ft=Array.isArray(Wt)&&Wt.length>0;if(Fn&&ft){const eo=Wt,Di=eo.map(Zn=>Zn.uid);X(Zn=>Zn.map(Je=>{const Nt=Wt.find(Vt=>Vt.uid===Je.uid);return Nt?{...Je,...Nt}:Je})),z(Zn=>({...Zn,sender:"processing",display:"analyzing"})),X(Zn=>Zn.map(Je=>({...Je,status:"parsing"}))),jt(Di,Zn=>{if(!Zn||!Array.isArray(Zn)){console.warn("pollFileStatus \u56DE\u8C03\u8FD4\u56DE\u7684 serverStatuses \u65E0\u6548:",Zn);return}if(X(Nt=>Nt.map(Vt=>{const Hn=Zn.find(An=>An&&An.uid===Vt.uid);if(Hn)switch(Hn.fileParseStatus??Hn.status){case 3:return{...Vt,status:"done"};case 4:return{...Vt,status:"error"};case 1:case 2:default:return{...Vt,status:"parsing"}}return Vt})),Array.isArray(Zn)&&Zn.length>0&&Zn.every(Nt=>{if(!Nt)return!1;const Vt=Nt.fileParseStatus??Nt.status;return Vt===3||Vt===4})){X([]);const Nt=new Map;(Zn||[]).forEach(Vt=>{Nt.set(Vt.id,Vt)}),de(Vt=>({uploadedFiles:pie(Vt.uploadedFiles,eo).map(An=>{var Ti;return{...An,pdfPages:((Ti=Nt.get(An.id))==null?void 0:Ti.pdfPages)||0}})}))}},()=>{$e==null||$e(),z(Je=>({...Je,sender:"processing",display:"processing"})),X(Je=>Je.map(Nt=>{const Vt=eo.find(Hn=>Hn.uid===Nt.uid);return Vt?{...Nt,...Vt,url:Vt.filePath,filePath:Vt.filePath,name:Vt.fileName||Nt.name,convertedFilePath:Vt.convertedFilePath||Nt.convertedFilePath}:Nt})),P(Je=>{if(!Je[0])return Je;const{messages:Nt}=Je[0];for(let Vt=Nt.length-1;Vt>=0;Vt--)if(Nt[Vt].istype==="user"){const Hn=Nt[Vt].currentFiles||[];Nt[Vt].currentFiles=Hn.map(An=>{const Ti=eo.find(Kc=>Kc.uid===An.uid);return Ti?{...An,...Ti}:An});break}return[...Je]});const Zn=Date.now();Ft({configId:Ot,content:ot,fileUids:Di,lastDate:Zn,name:Mt,queryId:tt,sessionId:String(J||""),type:"text",audioUrl:"",enableThinking:!!be.reasoning,enableWebsearch:!!be.netSearch,qaChannel:be.qaChannel,tempKnowledgeBaseCheck:ht.current},Je=>{Ne(tt)})},Zn=>{z(Je=>({...Je,display:"ready",sender:"ready"})),X(Je=>Je.map(Nt=>({...Nt,status:"error",message:Zn})))})}else{let eo="\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25";($a=bt.data)!=null&&$a.errorMsg?eo=bt.data.errorMsg:Fn?ft||(Array.isArray(Wt)?Wt.length===0&&(eo="\u4E0A\u4F20\u5931\u8D25: \u8FD4\u56DE\u6570\u636E\u4E3A\u7A7A"):eo=`\u4E0A\u4F20\u5931\u8D25: \u8FD4\u56DE\u6570\u636E\u683C\u5F0F\u9519\u8BEF\uFF0C\u671F\u671B\u6570\u7EC4\uFF0C\u5B9E\u9645\u4E3A ${typeof Wt}`):eo=`\u4E0A\u4F20\u5931\u8D25: success=${(Es=bt.data)==null?void 0:Es.success}`,console.error("\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\u8BE6\u60C5:",{errorMsg:eo,response:bt.data,isSuccess:Fn,isValidData:ft}),gr.error(eo),z(Di=>({...Di,display:"error",sender:"ready"})),X(Di=>Di.map(Zn=>({...Zn,status:"error",message:eo})))}}).catch(bt=>{var Wt,Fn;((Wt=bt==null?void 0:bt.response)==null?void 0:Wt.status)===413?(Fn=bt==null?void 0:bt.response)!=null&&Fn.statusText.includes("Request Entity Too Large")&&gr.error("\u6587\u4EF6\u8D85\u8FC7\u6700\u5927\u53EF\u4E0A\u4F20\u9650\u5236"):gr.error("\u7F51\u7EDC\u9519\u8BEF"),z(ft=>({...ft,display:"error",sender:"ready"})),X(ft=>ft.map(Tt=>({...Tt,status:"error",message:"\u7F51\u7EDC\u9519\u8BEF"})))});return}z(Ye=>({...Ye,display:"processing",sender:"processing"}));const Ue=Date.now();k(Ye=>Ye.map(ct=>ct.sessionId===J?{...ct,gmtModified:Ue}:ct)),$e==null||$e(),Ft({configId:Ot,content:ot,fileUids:[],lastDate:Ue,name:Mt,queryId:tt,sessionId:String(J||""),type:"text",audioUrl:"",enableThinking:!!be.reasoning,enableWebsearch:!!be.netSearch,qaChannel:be.qaChannel,tempKnowledgeBaseCheck:ht.current},Ye=>{Ne(tt)})}function kt(J){J.restult==1?Im({url:r,token:n,CSRFToken:i},{queryId:J.queryId},()=>{Ie(J.queryId,null)}):WA({url:r,token:n,CSRFToken:i},{restult:1,queryId:J.queryId},()=>{Ie(J.queryId,1)})}function Pt(J){const Z=pa(32),$e={sessionId:Z,label:"\u672A\u547D\u540D\u4F1A\u8BDD",gmtModified:Date.now(),searchConfigDTO:{},filePath:"",configId:"",isNew:!0};k(Ae=>[{...$e,messages:[]},...Ae]),P(Ae=>[{id:Z,messages:[],...$e},...Ae]),R(Z)}function Xt(J){if(J!=null&&J.sessionId&&J.sessionId!==I){I&&qe(I),R(J.sessionId),z($e=>({...$e,sender:"ready"}));const Z=T.find($e=>$e.id===J.sessionId);if(Z&&Z.messages&&Z.messages.length>0){const $e=[...Z.messages].reverse().find(Ae=>Ae.istype==="ai");$e&&$e.recommendQuestion?V($e.recommendQuestion):V([])}else V([])}}const on=async J=>new Promise((Z,$e)=>{_oe({url:r,token:n,CSRFToken:i},{sessionId:J},Ae=>{Ae?(gr.success("\u5220\u9664\u6210\u529F!"),Z(Ae)):(gr.error("\u5220\u9664\u5931\u8D25!"),$e(Ae))})}),qt=async()=>{try{return k([]),M(0),await zt(1),[]}catch(J){throw gr.error("\u5237\u65B0\u4F1A\u8BDD\u5217\u8868\u5931\u8D25"),J}},wn=async(J,Z)=>new Promise(($e,Ae)=>{Roe({url:r,token:n,CSRFToken:i},{label:Z,sessionId:J},tt=>{if(tt){const vt=Date.now();k(Ot=>Ot.map(wt=>wt.sessionId===J?{...wt,label:Z,gmtModified:vt}:wt)),P(Ot=>Ot.map(wt=>wt.id===J?{...wt,label:Z}:wt)),gr.success("\u91CD\u547D\u540D\u6210\u529F!"),$e(tt)}else gr.error("\u91CD\u547D\u540D\u5931\u8D25"),Ae(tt)})}),vn=J=>{k(Z=>{const $e=Z.filter(Ae=>Ae.sessionId!==J);return I===J&&($e.length>0?R($e[0].sessionId):Pt()),$e})},Kt=(J,Z)=>{const $e=Date.now();k(Ae=>Ae.map(tt=>tt.sessionId===J?{...tt,label:Z,gmtModified:$e}:tt)),P(Ae=>Ae.map(tt=>tt.id===J?{...tt,label:Z}:tt))},$n=J=>{WA({url:r,token:n,CSRFToken:i},{...J,...xe,restult:0},()=>{Ie(xe.queryId,0)})},On=J=>{const Z=J.new_name,$e=m.data.label;Z&&Z!==$e?m.async_renameConversation(Z).then(()=>{m.fn_renameItemInList(Z),d(!1)}).catch(()=>{}):d(!1)},cr=J=>{m.async_deleteConversation().then(()=>{m.fn_removeItemFromList(),h(!1)}).catch(()=>{})},We=(J,Z)=>{switch(console.log(J,Z),J){case"close_remove":h(!1);break;case"close_rename":d(!1);break;case"ok_rename":On(Z);break;case"ok_remove":cr();break}},pt=async({url:J,params:Z,replacePredataFunction:$e})=>{var Ae,tt;try{const vt=await Mr.post(J,Z,{headers:{Authorization:n}}),Ot=(tt=(Ae=vt==null?void 0:vt.data)==null?void 0:Ae.data)==null?void 0:tt.data;Ot&&$e(Ot)}catch(vt){console.log("error",vt)}},Ke=async J=>{var Z;try{const $e=await Mr.get(`${aC()}/index/knowledgeBase/file/getFileStatusByUids?uids=${J.data.uids}`,{headers:{Authorization:n}});return console.log("resslkdjgalsg",$e),(Z=$e==null?void 0:$e.data)==null?void 0:Z.data}catch{}},rt=async J=>{var Z;if(Sz.includes(J.file_type)){const $e=(Z=J.metadata)!=null&&Z.source?`${op}${J.metadata.source}`:J.url||J.convertedFilePath||J.filePath;x({...J,parse_url:$e}),b("preview"),v(!0);return}try{const $e=await Ke({data:{uids:J.uid},config:{url:aC(),token:n,enableMock:!1}});if($e!=null&&$e.length){const Ae=$e[0];x({...J,parse_url:Ae.convertedFilePath}),b("preview"),v(!0)}}catch{}},ht=et(!1),an=(J,Z)=>{var $e,Ae,tt,vt,Ot,wt,ot;switch(console.log(`[Event] ${J}`,Z),J){case"TempKnowledgeBase":ht.current=Z;break;case"reference_file:click":if(Z.file_type==="image")return;if(!Z.parse_url){if(!Z.uid)return Z.references?void 0:gr.warning("\u6587\u4EF6\u8FD8\u672A\u89E3\u6790\u5B8C\u6210,\u8BF7\u7A0D\u540E\u9884\u89C8");rt(Z);return}x({...Z,file_type:Z.type,file_name:Z.file}),b("preview"),v(!0);break;case"conversations:load_more":{E.length<$&&!N&&zt(S+1);break}case"retrieve-sql-data:pagingation_click":const{page:Mt,pageSize:Zt,fetchUrl:Ue,source:Ye,replacePredataFunction:ct}=Z;pt({url:`${r}${Ue}`,replacePredataFunction:ct,params:{pageNo:Mt,pageSize:Zt,convertedFilePath:Ye,stream:!1}});break;case"web_referenceFile_title:click":if(!(($e=Z==null?void 0:Z.data)!=null&&$e.link))return console.error("\u6CA1\u6709\u7F51\u9875\u5730\u5740");window.open(Z.data.link,"_blank");break;case"conversation:item_click":Xt(Z);break;case"files:finished_animation_complete":X([]);break;case"conversation:create":Pt();break;case"conversation:new_assistant_change":F(Z.assistantId);break;case"conversations:rename_icon_clicked":p({data:Z,async_renameConversation:It=>wn(Z.sessionId,It),fn_renameItemInList:It=>Kt(Z.sessionId,It)}),d(!0);break;case"conversations:delete_icon_clicked":p({data:Z,async_deleteConversation:()=>on(Z.sessionId),async_refreshConversationList:qt,fn_removeItemFromList:()=>vn(Z.sessionId)}),h(!0);break;case"sender:send":_e(Z,Z.clearFn);break;case"sender:send_recommandQuestion":{const It=((Z==null?void 0:Z.content)??"").toString();if(!It)break;_e({content:It},()=>{});break}case"chatbox:follow_up_question_click":{const It=((Z==null?void 0:Z.question)??(Z==null?void 0:Z.content)??"").toString();if(!It)break;_e({content:It},()=>{});break}case"sender:stop":oe(),dt&&(dt.abort(),dt=null),Ct&&(Ct(),Ct=null),z(It=>({...It,display:"ready",sender:"ready"})),X([]),Xe==null||Xe();break;case"sender:clear":(Ae=Z.clearFn)==null||Ae.call(Z);break;case"sender:configChange":Z&&Z.all&&ce(Z.all);break;case"sender:action_upload":Pe.current&&Pe.current.click();break;case"sender:action_history":Dt(!0);break;case"uploaded_file:item_click":break;case"action_copy:click":Z&&Poe(Z.content,Z.event);break;case"chatbox:copy":{const It=(Z==null?void 0:Z.content)||"";if(!It)break;const Cn=async Wt=>{try{return await navigator.clipboard.writeText(Wt),gr.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F"),!0}catch{return!1}},bt=Wt=>{const Fn=document.createElement("textarea");Fn.value=Wt,Fn.style.position="fixed",Fn.style.opacity="0",document.body.appendChild(Fn),Fn.focus(),Fn.select();try{document.execCommand("copy"),gr.success("\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F")}catch{gr.error("\u590D\u5236\u5931\u8D25")}document.body.removeChild(Fn)};Cn(It).then(Wt=>{Wt||bt(It)});break}case"chatbox:repeat":console.log(Z,"sdkflskdjflksdjfklsdjlfkjsdklfjsdklfjlks"),Oe(Z);break;case"action_thumbsup":kt(Z);break;case"chatbox:like":kt({queryId:Z==null?void 0:Z.queryId,restult:Z==null?void 0:Z.result});break;case"action_thumbsdown":Z.restult===0?Im({url:r,token:n,CSRFToken:i},{queryId:Z.queryId},()=>{Ie(Z.queryId,null)}):(fe(Z),ke(!0));break;case"chatbox:dislike":(Z==null?void 0:Z.result)===0?Im({url:r,token:n,CSRFToken:i},{queryId:Z.queryId},()=>{Ie(Z.queryId,null)}):(fe({queryId:Z==null?void 0:Z.queryId}),ke(!0));break;case"action_retrive_tag":a==null||a("action_retrive_tag",Z);break;case"referenceFile_view":a==null||a("referenceFile_view",Z);break;case"referenceFile_question":console.log(Z,"zhezhhzhzh"),rt(Z.data||Z),a==null||a("referenceFile_question",Z);break;case"referenceFile_download":a==null||a("referenceFile_download",Z);break;case"references:click":case"knowledge_base_view_all:click":{const It=()=>J==="references:click"?ee(cxe,{type:"referencelist",data:Z,token:n,eventsEmit:a,is_download:Rt}):ee(uxe,{fileData:Z,token:n}),Cn=new CustomEvent("aichat:right_set_content",{detail:{content:ee(It,{})}});window.dispatchEvent(Cn);const bt=new CustomEvent("aichat:right_set",{detail:{collapsed:!1}});window.dispatchEvent(bt);break}case"retrive_tag:click":a==null||a("retrive_tag:click",Z);break;case"fileManager:change":{typeof(Z==null?void 0:Z.setUploadedFiles)=="function"&&(Te.current=Z.setUploadedFiles,se.current=Z.removeFile,De.current=Z==null?void 0:Z.senderConfig,He.current=Array.isArray(Z==null?void 0:Z.uploadedFiles)?Z.uploadedFiles:[],Array.isArray(Z==null?void 0:Z.uploadedFiles)&&ve(Z.uploadedFiles),console.log("[DEBUG] fileManager:change \u4E8B\u4EF6\u89E6\u53D1\uFF0CsetUploadedFilesRef \u5DF2\u8BBE\u7F6E",{hasSetUploadedFiles:!!Te.current,uploadedFilesCount:((tt=Z==null?void 0:Z.uploadedFiles)==null?void 0:tt.length)||0,pendingFilesCount:((vt=Z==null?void 0:Z.uploadedFiles)==null?void 0:vt.length)||0,hasSenderConfig:!!(Z!=null&&Z.senderConfig),senderConfig:Z==null?void 0:Z.senderConfig,upload_number_limit:(Ot=Z==null?void 0:Z.senderConfig)==null?void 0:Ot.upload_number_limit,upload_size_limit:(wt=Z==null?void 0:Z.senderConfig)==null?void 0:wt.upload_size_limit}));break}case"uploaded_file:removeFromTemp":{console.log("[DEBUG] mergedEventsEmit uploaded_file:removeFromTemp \u4E8B\u4EF6",Z);const It=(ot=Z==null?void 0:Z.file)==null?void 0:ot.uid;if(!It){console.warn("[DEBUG] \u7F3A\u5C11uid\uFF0C\u65E0\u6CD5\u5220\u9664\u4E34\u65F6\u6587\u4EF6",Z);break}const Cn=[...(je==null?void 0:je.messages)||[]].reverse().find(Wt=>Wt.istype==="user"),bt=Cn==null?void 0:Cn.queryId;K(It,bt);break}case"uploaded_file:remove_batch":break;default:a==null||a(J,Z)}},dn=[{key:"conversations",type:"custom",label:"\u5BF9\u8BDD\u5386\u53F2",icon:ee(fH,{size:16}),enabled:!0,component:ee(Moe,{data:E,assistantList:L,activedItem:I||"",hasMore:E.length<$,loadingMore:N,sortRules:[{label:"\u5F53\u5929",dayPeriod:1},{label:"3\u5929",dayPeriod:3},{label:"7\u5929",dayPeriod:7},{label:"30\u5929",dayPeriod:30}],eventsEmit:an,styles:c.theme})}],Gn=we.useCallback(()=>ee(Uoe,{eventsEmit:an,assistantList:L,styles:c,selectedId:Se,onSelectAssistant:ye,productLogo:l==null?void 0:l.productLogo}),[an,L,c,Se,l==null?void 0:l.productLogo]),Nn={...we.useMemo(()=>({AiChatBox:(J,Z)=>{var Zt,Ue,Ye;const $e=Z===(((Zt=je==null?void 0:je.messages)==null?void 0:Zt.length)||0)-1;let Ae="ready";if($e)if(J.status!==void 0)switch(J.status){case 0:Ae="thinking";break;case 1:Ae="processing";break;case 2:Ae="ready";break;case 3:Ae="error";break;case 4:Ae="thinking";break;default:Ae=B.display}else Ae=B.display;let tt=[];if(Array.isArray(H))tt=H;else if(typeof H=="string")try{tt=JSON.parse(H)||[]}catch{tt=[]}const vt=(()=>{const ct=J==null?void 0:J.reference;if(!ct)return"[]";if(typeof ct=="string")try{return JSON.parse(ct),ct}catch{return"[]"}try{return JSON.stringify(ct)}catch{return"[]"}})(),Ot=(()=>{const ct=J==null?void 0:J.webReference;if(!ct)return"[]";if(typeof ct=="string")try{return JSON.parse(ct),ct}catch{return"[]"}try{return JSON.stringify(ct)}catch{return"[]"}})(),wt=(()=>{const ct=J==null?void 0:J.graphReference;if(!ct)return"[]";if(typeof ct=="string")try{return JSON.parse(ct),ct}catch{return"[]"}try{return JSON.stringify(ct)}catch{return"[]"}})(),ot=J==null?void 0:J.databaseReference,Mt=(()=>{var It,Cn,bt;if(J!=null&&J.chainRespTime||(It=J==null?void 0:J.reply)!=null&&It.chainRespTime)return(J==null?void 0:J.chainRespTime)??((Cn=J==null?void 0:J.reply)==null?void 0:Cn.chainRespTime);const ct=(J==null?void 0:J.chain)||((bt=J==null?void 0:J.reply)==null?void 0:bt.chain);if(Array.isArray(ct)&&ct.length>0){const Wt=ct.reduce((Fn,ft)=>{const Tt=(ft==null?void 0:ft.chainRespTime)??(ft==null?void 0:ft.respTime);return Tt!=null&&Tt>0?Fn+Tt:Fn},0);return Wt>0?Wt:void 0}})();return ee(_S,{...J,token:n,streamUrl:"/proxy/index/knowledgeBase/file/stream",referenceMode:"button",reference:vt,webReference:Ot,graphReference:wt,databaseReference:ot,contentType:"stream",displayStatus:Ae,eventsEmit:an,isLast:$e&&(J==null?void 0:J.istype)==="ai",followUpQuestions:$e&&(J==null?void 0:J.istype)==="ai"?tt:[],defaultAnswer:((Ue=je==null?void 0:je.searchConfigDTO)==null?void 0:Ue.defaultAnswer)||"\u4E0D\u77E5\u9053\u4EC0\u4E48\u539F\u56E0\u6211\u4EEC\u6CA1\u80FD\u67E5\u5230\u4F60\u8981\u7684\u95EE\u9898*-*",is_download:Rt,styles:c,enableThoughtChain:!0,chain:J==null?void 0:J.chain,thoughtChainStatus:J==null?void 0:J.status,enableCot:(J==null?void 0:J.enableCot)??((Ye=J==null?void 0:J.reply)==null?void 0:Ye.enableCot),chainRespTime:Mt},`${(J==null?void 0:J.queryId)||(J==null?void 0:J.id)||Z}-${(J==null?void 0:J.istype)||"unknown"}`)},LogoBox:J=>J&&J.LogoBox===null?null:J&&typeof J.LogoBox=="function"?ee(J.LogoBox,{}):ee("div",{className:"text-2xl w-full text-center font-bold",children:"\u5C0F\u9CB8\u667A\u80FD\u52A9\u624B"}),DisplayLoading:()=>ee(die,{}),DisplayError:()=>ee(hie,{}),AppError:()=>ee(fie,{msg:"\u5E94\u7528\u521D\u59CB\u5316\u5931\u8D25",subMsg:"\u65E0\u6CD5\u5B8C\u6210\u5E94\u7528\u521D\u59CB\u5316\uFF0C\u8FD9\u53EF\u80FD\u662F\u7531\u4E8E\u7F51\u7EDC\u8FDE\u63A5\u95EE\u9898\u6216\u670D\u52A1\u914D\u7F6E\u9519\u8BEF\u5BFC\u81F4\u7684\u3002\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u8FDE\u63A5\u5E76\u91CD\u8BD5\u3002"}),AppLoading:()=>{var J,Z;return ee(uie,{title:(J=l==null?void 0:l.appLoadingConfig)==null?void 0:J.title,subtitle:((Z=l==null?void 0:l.appLoadingConfig)==null?void 0:Z.subtitle)||""})},UserChatBox:(J,Z)=>ee(_S,{token:n,streamUrl:"/proxy/index/knowledgeBase/file/stream",...J,referenceMode:"button",contentType:"plainText",isUser:!0,displayStatus:"ready",eventsEmit:an,styles:c,fileManagerData:ge,currentFiles:J==null?void 0:J.currentFiles},`${(J==null?void 0:J.queryId)||(J==null?void 0:J.id)||Z}-user`),WelcomeComponent:Gn}),[Gn,je,B.display,an,c,Rt,ge]),...l.CustomComponents||{}};Et(()=>{q(J=>{const Z=Array.isArray(J.switchs)?J.switchs.map($e=>$e.name==="reasoning"?{...$e,enabled:!0}:$e):[];return{...J,switchs:Z}})},[]);const Dn=Gt(()=>ge.uploadedFiles||[],[ge]),{FileDisplayTools:xr}=iie({fileManagerData:{uploadedFiles:Dn},styles:c,eventsEmit:an});return ut("div",{style:{height:"100%",minWidth:"1116px",overflow:"hidden"},children:[ee("input",{ref:Pe,type:"file",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.txt,.md,.json,.csv,.zip,.rar,.7z",style:{display:"none"},onChange:J=>{const Z=J.target.files;if(Z&&Z.length>0){console.log("[DEBUG] handleFileSelect \u89E6\u53D1",{filesCount:Z.length,hasSetUploadedFilesRef:!!Te.current,hasSenderConfig:!!De.current,dynamicSenderConfig:W,dynamicSenderConfigKeys:W?Object.keys(W):[],senderConfigRef:De.current,senderConfigRefKeys:De.current?Object.keys(De.current):[]});const $e=Array.from(Z);let Ae=De.current;(!Ae||Ae.upload_size_limit===void 0&&Ae.upload_number_limit===void 0&&(!Ae.upload_file_type_limit||Ae.upload_file_type_limit.length===0))&&(Ae=W);const tt=He.current||[];console.log("[DEBUG] \u9A8C\u8BC1\u914D\u7F6E\u68C0\u67E5",{configSource:Ae,upload_number_limit:Ae==null?void 0:Ae.upload_number_limit,upload_size_limit:Ae==null?void 0:Ae.upload_size_limit,existingFilesCount:tt.length,newFilesCount:$e.length});const vt=Ae&&(Ae.upload_size_limit!==void 0||Ae.upload_number_limit!==void 0&&Ae.upload_number_limit>0||Ae.upload_file_type_limit&&Ae.upload_file_type_limit.length>0);if(console.log("[DEBUG] \u914D\u7F6E\u68C0\u67E5\u7ED3\u679C",{hasUploadLimitConfig:vt,upload_number_limit:Ae==null?void 0:Ae.upload_number_limit,upload_size_limit:Ae==null?void 0:Ae.upload_size_limit,upload_file_type_limit:Ae==null?void 0:Ae.upload_file_type_limit}),vt){const Ot={upload_size_limit:Ae.upload_size_limit,upload_number_limit:Ae.upload_number_limit,upload_file_type_limit:Ae.upload_file_type_limit,upload_limit_message:Ae.upload_limit_message};console.log("[DEBUG] \u6267\u884C\u6587\u4EF6\u9A8C\u8BC1",{uploadConfig:Ot,existingFilesCount:tt.length,newFilesCount:$e.length,totalCount:tt.length+$e.length});const wt=ow($e,tt,Ot);if(console.log("[DEBUG] \u9A8C\u8BC1\u7ED3\u679C",{valid:wt.valid,errors:wt.errors,rejectedFilesCount:wt.rejectedFiles.length}),!wt.valid){iw(wt);const ot=$e.filter(Mt=>!wt.rejectedFiles.includes(Mt));if(ot.length===0){Pe.current&&(Pe.current.value="");return}$e.splice(0,$e.length,...ot)}}if(Te.current){const Ot=$e.map(wt=>({file:wt,type:wt.type.startsWith("image/")?"image":"document",status:"pending",name:wt.name}));console.log("[DEBUG] \u901A\u8FC7 setUploadedFilesRef \u8BBE\u7F6E\u6587\u4EF6",Ot),Te.current(Ot)}else console.warn("[DEBUG] setUploadedFilesRef \u672A\u8BBE\u7F6E\uFF0C\u5EF6\u8FDF\u91CD\u8BD5"),setTimeout(()=>{if(Te.current){const Ot=$e.map(wt=>({file:wt,type:wt.type.startsWith("image/")?"image":"document",status:"pending",name:wt.name}));console.log("[DEBUG] \u5EF6\u8FDF\u540E\u901A\u8FC7 setUploadedFilesRef \u8BBE\u7F6E\u6587\u4EF6",Ot),Te.current(Ot)}else console.error("[DEBUG] \u5EF6\u8FDF\u540E setUploadedFilesRef \u4ECD\u672A\u8BBE\u7F6E")},100)}Pe.current&&(Pe.current.value="")}}),ee(e,{...l,status:B,chatData:je,sidebar:dn,recommandQuestions:[],eventsEmit:an,styles:c,senderConfig:W,fileUploadStatus:U,CustomComponents:Nn,activeSessionId:I,scrollOld:s,rightbarWidth:"400px",chatHeader:{title:(je==null?void 0:je.label)||"\u65B0\u5BF9\u8BDD",tools:xr}}),ee(lie,{open:pe,feedBackList:Ve,setOpen:ke,handleConfirm:$n}),ee(gie,{isModalOpen:u,handleOk:We,handleCancel:()=>We("close_rename"),data:(m==null?void 0:m.data)||{}}),ee(mie,{isModalOpen:f,handleOk:We,handleCancel:()=>We("close_remove"),data:(m==null?void 0:m.data)||{}}),ee(bd,{drawer:{styles:{body:{padding:0},header:{display:"none"}}},children:ee(BF,{autoFocus:!1,onClose:()=>v(!1),open:g,width:y==="graphPreview"?"100%":720,className:"overflow-x-hidden",destroyOnClose:!0,children:y==="preview"&&ee($z,{curFileInfo:w,onClose:v,token:n})})})]})}}var xh={exports:{}},Eh={exports:{}},fxe=Eh.exports,WT;function En(){return WT||(WT=1,(function(e,t){(function(n,r){e.exports=r()})(fxe,function(){var n=n||(function(r,o){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof Ug<"u"&&Ug.crypto&&(i=Ug.crypto),!i&&typeof aH=="function")try{i=sH}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function y(){}return function(b){var w;return y.prototype=b,w=new y,y.prototype=null,w}})(),l={},c=l.lib={},u=c.Base=(function(){return{extend:function(y){var b=s(this);return y&&b.mixIn(y),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var b in y)y.hasOwnProperty(b)&&(this[b]=y[b]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),d=c.WordArray=u.extend({init:function(y,b){y=this.words=y||[],b!=o?this.sigBytes=b:this.sigBytes=y.length*4},toString:function(y){return(y||h).stringify(this)},concat:function(y){var b=this.words,w=y.words,x=this.sigBytes,E=y.sigBytes;if(this.clamp(),x%4)for(var k=0;k<E;k++){var S=w[k>>>2]>>>24-k%4*8&255;b[x+k>>>2]|=S<<24-(x+k)%4*8}else for(var O=0;O<E;O+=4)b[x+O>>>2]=w[O>>>2];return this.sigBytes+=E,this},clamp:function(){var y=this.words,b=this.sigBytes;y[b>>>2]&=4294967295<<32-b%4*8,y.length=r.ceil(b/4)},clone:function(){var y=u.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var b=[],w=0;w<y;w+=4)b.push(a());return new d.init(b,y)}}),f=l.enc={},h=f.Hex={stringify:function(y){for(var b=y.words,w=y.sigBytes,x=[],E=0;E<w;E++){var k=b[E>>>2]>>>24-E%4*8&255;x.push((k>>>4).toString(16)),x.push((k&15).toString(16))}return x.join("")},parse:function(y){for(var b=y.length,w=[],x=0;x<b;x+=2)w[x>>>3]|=parseInt(y.substr(x,2),16)<<24-x%8*4;return new d.init(w,b/2)}},m=f.Latin1={stringify:function(y){for(var b=y.words,w=y.sigBytes,x=[],E=0;E<w;E++){var k=b[E>>>2]>>>24-E%4*8&255;x.push(String.fromCharCode(k))}return x.join("")},parse:function(y){for(var b=y.length,w=[],x=0;x<b;x++)w[x>>>2]|=(y.charCodeAt(x)&255)<<24-x%4*8;return new d.init(w,b)}},p=f.Utf8={stringify:function(y){try{return decodeURIComponent(escape(m.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return m.parse(unescape(encodeURIComponent(y)))}},g=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=p.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var b,w=this._data,x=w.words,E=w.sigBytes,k=this.blockSize,S=k*4,O=E/S;y?O=r.ceil(O):O=r.max((O|0)-this._minBufferSize,0);var A=O*k,$=r.min(A*4,E);if(A){for(var M=0;M<A;M+=k)this._doProcessBlock(x,M);b=x.splice(0,A),w.sigBytes-=$}return new d.init(b,$)},clone:function(){var y=u.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0});c.Hasher=g.extend({cfg:u.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(y){return function(b,w){return new y.init(w).finalize(b)}},_createHmacHelper:function(y){return function(b,w){return new v.HMAC.init(y,w).finalize(b)}}});var v=l.algo={};return l})(Math);return n})})(Eh)),Eh.exports}var wh={exports:{}},hxe=wh.exports,VT;function Gg(){return VT||(VT=1,(function(e,t){(function(n,r){e.exports=r(En())})(hxe,function(n){return(function(r){var o=n,i=o.lib,a=i.Base,s=i.WordArray,l=o.x64={};l.Word=a.extend({init:function(c,u){this.high=c,this.low=u}}),l.WordArray=a.extend({init:function(c,u){c=this.words=c||[],u!=r?this.sigBytes=u:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,u=c.length,d=[],f=0;f<u;f++){var h=c[f];d.push(h.high),d.push(h.low)}return s.create(d,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),u=c.words=this.words.slice(0),d=u.length,f=0;f<d;f++)u[f]=u[f].clone();return c}})})(),n})})(wh)),wh.exports}var Ch={exports:{}},pxe=Ch.exports,GT;function gxe(){return GT||(GT=1,(function(e,t){(function(n,r){e.exports=r(En())})(pxe,function(n){return(function(){if(typeof ArrayBuffer=="function"){var r=n,o=r.lib,i=o.WordArray,a=i.init,s=i.init=function(l){if(l instanceof ArrayBuffer&&(l=new Uint8Array(l)),(l instanceof Int8Array||typeof Uint8ClampedArray<"u"&&l instanceof Uint8ClampedArray||l instanceof Int16Array||l instanceof Uint16Array||l instanceof Int32Array||l instanceof Uint32Array||l instanceof Float32Array||l instanceof Float64Array)&&(l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),l instanceof Uint8Array){for(var c=l.byteLength,u=[],d=0;d<c;d++)u[d>>>2]|=l[d]<<24-d%4*8;a.call(this,u,c)}else a.apply(this,arguments)};s.prototype=i}})(),n.lib.WordArray})})(Ch)),Ch.exports}var kh={exports:{}},mxe=kh.exports,UT;function vxe(){return UT||(UT=1,(function(e,t){(function(n,r){e.exports=r(En())})(mxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Utf16=a.Utf16BE={stringify:function(l){for(var c=l.words,u=l.sigBytes,d=[],f=0;f<u;f+=2){var h=c[f>>>2]>>>16-f%4*8&65535;d.push(String.fromCharCode(h))}return d.join("")},parse:function(l){for(var c=l.length,u=[],d=0;d<c;d++)u[d>>>1]|=l.charCodeAt(d)<<16-d%2*16;return i.create(u,c*2)}},a.Utf16LE={stringify:function(l){for(var c=l.words,u=l.sigBytes,d=[],f=0;f<u;f+=2){var h=s(c[f>>>2]>>>16-f%4*8&65535);d.push(String.fromCharCode(h))}return d.join("")},parse:function(l){for(var c=l.length,u=[],d=0;d<c;d++)u[d>>>1]|=s(l.charCodeAt(d)<<16-d%2*16);return i.create(u,c*2)}};function s(l){return l<<8&4278255360|l>>>8&16711935}})(),n.enc.Utf16})})(kh)),kh.exports}var Sh={exports:{}},yxe=Sh.exports,qT;function Sl(){return qT||(qT=1,(function(e,t){(function(n,r){e.exports=r(En())})(yxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64={stringify:function(l){var c=l.words,u=l.sigBytes,d=this._map;l.clamp();for(var f=[],h=0;h<u;h+=3)for(var m=c[h>>>2]>>>24-h%4*8&255,p=c[h+1>>>2]>>>24-(h+1)%4*8&255,g=c[h+2>>>2]>>>24-(h+2)%4*8&255,v=m<<16|p<<8|g,y=0;y<4&&h+y*.75<u;y++)f.push(d.charAt(v>>>6*(3-y)&63));var b=d.charAt(64);if(b)for(;f.length%4;)f.push(b);return f.join("")},parse:function(l){var c=l.length,u=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<u.length;f++)d[u.charCodeAt(f)]=f}var h=u.charAt(64);if(h){var m=l.indexOf(h);m!==-1&&(c=m)}return s(l,c,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function s(l,c,u){for(var d=[],f=0,h=0;h<c;h++)if(h%4){var m=u[l.charCodeAt(h-1)]<<h%4*2,p=u[l.charCodeAt(h)]>>>6-h%4*2,g=m|p;d[f>>>2]|=g<<24-f%4*8,f++}return i.create(d,f)}})(),n.enc.Base64})})(Sh)),Sh.exports}var Ah={exports:{}},bxe=Ah.exports,YT;function xxe(){return YT||(YT=1,(function(e,t){(function(n,r){e.exports=r(En())})(bxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.enc;a.Base64url={stringify:function(l,c){c===void 0&&(c=!0);var u=l.words,d=l.sigBytes,f=c?this._safe_map:this._map;l.clamp();for(var h=[],m=0;m<d;m+=3)for(var p=u[m>>>2]>>>24-m%4*8&255,g=u[m+1>>>2]>>>24-(m+1)%4*8&255,v=u[m+2>>>2]>>>24-(m+2)%4*8&255,y=p<<16|g<<8|v,b=0;b<4&&m+b*.75<d;b++)h.push(f.charAt(y>>>6*(3-b)&63));var w=f.charAt(64);if(w)for(;h.length%4;)h.push(w);return h.join("")},parse:function(l,c){c===void 0&&(c=!0);var u=l.length,d=c?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var h=0;h<d.length;h++)f[d.charCodeAt(h)]=h}var m=d.charAt(64);if(m){var p=l.indexOf(m);p!==-1&&(u=p)}return s(l,u,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function s(l,c,u){for(var d=[],f=0,h=0;h<c;h++)if(h%4){var m=u[l.charCodeAt(h-1)]<<h%4*2,p=u[l.charCodeAt(h)]>>>6-h%4*2,g=m|p;d[f>>>2]|=g<<24-f%4*8,f++}return i.create(d,f)}})(),n.enc.Base64url})})(Ah)),Ah.exports}var $h={exports:{}},Exe=$h.exports,XT;function Al(){return XT||(XT=1,(function(e,t){(function(n,r){e.exports=r(En())})(Exe,function(n){return(function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,l=o.algo,c=[];(function(){for(var p=0;p<64;p++)c[p]=r.abs(r.sin(p+1))*4294967296|0})();var u=l.MD5=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,g){for(var v=0;v<16;v++){var y=g+v,b=p[y];p[y]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}var w=this._hash.words,x=p[g+0],E=p[g+1],k=p[g+2],S=p[g+3],O=p[g+4],A=p[g+5],$=p[g+6],M=p[g+7],N=p[g+8],D=p[g+9],T=p[g+10],P=p[g+11],I=p[g+12],R=p[g+13],H=p[g+14],V=p[g+15],L=w[0],_=w[1],j=w[2],F=w[3];L=d(L,_,j,F,x,7,c[0]),F=d(F,L,_,j,E,12,c[1]),j=d(j,F,L,_,k,17,c[2]),_=d(_,j,F,L,S,22,c[3]),L=d(L,_,j,F,O,7,c[4]),F=d(F,L,_,j,A,12,c[5]),j=d(j,F,L,_,$,17,c[6]),_=d(_,j,F,L,M,22,c[7]),L=d(L,_,j,F,N,7,c[8]),F=d(F,L,_,j,D,12,c[9]),j=d(j,F,L,_,T,17,c[10]),_=d(_,j,F,L,P,22,c[11]),L=d(L,_,j,F,I,7,c[12]),F=d(F,L,_,j,R,12,c[13]),j=d(j,F,L,_,H,17,c[14]),_=d(_,j,F,L,V,22,c[15]),L=f(L,_,j,F,E,5,c[16]),F=f(F,L,_,j,$,9,c[17]),j=f(j,F,L,_,P,14,c[18]),_=f(_,j,F,L,x,20,c[19]),L=f(L,_,j,F,A,5,c[20]),F=f(F,L,_,j,T,9,c[21]),j=f(j,F,L,_,V,14,c[22]),_=f(_,j,F,L,O,20,c[23]),L=f(L,_,j,F,D,5,c[24]),F=f(F,L,_,j,H,9,c[25]),j=f(j,F,L,_,S,14,c[26]),_=f(_,j,F,L,N,20,c[27]),L=f(L,_,j,F,R,5,c[28]),F=f(F,L,_,j,k,9,c[29]),j=f(j,F,L,_,M,14,c[30]),_=f(_,j,F,L,I,20,c[31]),L=h(L,_,j,F,A,4,c[32]),F=h(F,L,_,j,N,11,c[33]),j=h(j,F,L,_,P,16,c[34]),_=h(_,j,F,L,H,23,c[35]),L=h(L,_,j,F,E,4,c[36]),F=h(F,L,_,j,O,11,c[37]),j=h(j,F,L,_,M,16,c[38]),_=h(_,j,F,L,T,23,c[39]),L=h(L,_,j,F,R,4,c[40]),F=h(F,L,_,j,x,11,c[41]),j=h(j,F,L,_,S,16,c[42]),_=h(_,j,F,L,$,23,c[43]),L=h(L,_,j,F,D,4,c[44]),F=h(F,L,_,j,I,11,c[45]),j=h(j,F,L,_,V,16,c[46]),_=h(_,j,F,L,k,23,c[47]),L=m(L,_,j,F,x,6,c[48]),F=m(F,L,_,j,M,10,c[49]),j=m(j,F,L,_,H,15,c[50]),_=m(_,j,F,L,A,21,c[51]),L=m(L,_,j,F,I,6,c[52]),F=m(F,L,_,j,S,10,c[53]),j=m(j,F,L,_,T,15,c[54]),_=m(_,j,F,L,E,21,c[55]),L=m(L,_,j,F,N,6,c[56]),F=m(F,L,_,j,V,10,c[57]),j=m(j,F,L,_,$,15,c[58]),_=m(_,j,F,L,R,21,c[59]),L=m(L,_,j,F,O,6,c[60]),F=m(F,L,_,j,P,10,c[61]),j=m(j,F,L,_,k,15,c[62]),_=m(_,j,F,L,D,21,c[63]),w[0]=w[0]+L|0,w[1]=w[1]+_|0,w[2]=w[2]+j|0,w[3]=w[3]+F|0},_doFinalize:function(){var p=this._data,g=p.words,v=this._nDataBytes*8,y=p.sigBytes*8;g[y>>>5]|=128<<24-y%32;var b=r.floor(v/4294967296),w=v;g[(y+64>>>9<<4)+15]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,g[(y+64>>>9<<4)+14]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,p.sigBytes=(g.length+1)*4,this._process();for(var x=this._hash,E=x.words,k=0;k<4;k++){var S=E[k];E[k]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360}return x},clone:function(){var p=s.clone.call(this);return p._hash=this._hash.clone(),p}});function d(p,g,v,y,b,w,x){var E=p+(g&v|~g&y)+b+x;return(E<<w|E>>>32-w)+g}function f(p,g,v,y,b,w,x){var E=p+(g&y|v&~y)+b+x;return(E<<w|E>>>32-w)+g}function h(p,g,v,y,b,w,x){var E=p+(g^v^y)+b+x;return(E<<w|E>>>32-w)+g}function m(p,g,v,y,b,w,x){var E=p+(v^(g|~y))+b+x;return(E<<w|E>>>32-w)+g}o.MD5=s._createHelper(u),o.HmacMD5=s._createHmacHelper(u)})(Math),n.MD5})})($h)),$h.exports}var Oh={exports:{}},wxe=Oh.exports,KT;function Nz(){return KT||(KT=1,(function(e,t){(function(n,r){e.exports=r(En())})(wxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=o.Hasher,s=r.algo,l=[],c=s.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,d){for(var f=this._hash.words,h=f[0],m=f[1],p=f[2],g=f[3],v=f[4],y=0;y<80;y++){if(y<16)l[y]=u[d+y]|0;else{var b=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=b<<1|b>>>31}var w=(h<<5|h>>>27)+v+l[y];y<20?w+=(m&p|~m&g)+1518500249:y<40?w+=(m^p^g)+1859775393:y<60?w+=(m&p|m&g|p&g)-1894007588:w+=(m^p^g)-899497514,v=g,g=p,p=m<<30|m>>>2,m=h,h=w}f[0]=f[0]+h|0,f[1]=f[1]+m|0,f[2]=f[2]+p|0,f[3]=f[3]+g|0,f[4]=f[4]+v|0},_doFinalize:function(){var u=this._data,d=u.words,f=this._nDataBytes*8,h=u.sigBytes*8;return d[h>>>5]|=128<<24-h%32,d[(h+64>>>9<<4)+14]=Math.floor(f/4294967296),d[(h+64>>>9<<4)+15]=f,u.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var u=a.clone.call(this);return u._hash=this._hash.clone(),u}});r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c)})(),n.SHA1})})(Oh)),Oh.exports}var Mh={exports:{}},Cxe=Mh.exports,ZT;function TS(){return ZT||(ZT=1,(function(e,t){(function(n,r){e.exports=r(En())})(Cxe,function(n){return(function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,l=o.algo,c=[],u=[];(function(){function h(v){for(var y=r.sqrt(v),b=2;b<=y;b++)if(!(v%b))return!1;return!0}function m(v){return(v-(v|0))*4294967296|0}for(var p=2,g=0;g<64;)h(p)&&(g<8&&(c[g]=m(r.pow(p,1/2))),u[g]=m(r.pow(p,1/3)),g++),p++})();var d=[],f=l.SHA256=s.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(h,m){for(var p=this._hash.words,g=p[0],v=p[1],y=p[2],b=p[3],w=p[4],x=p[5],E=p[6],k=p[7],S=0;S<64;S++){if(S<16)d[S]=h[m+S]|0;else{var O=d[S-15],A=(O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3,$=d[S-2],M=($<<15|$>>>17)^($<<13|$>>>19)^$>>>10;d[S]=A+d[S-7]+M+d[S-16]}var N=w&x^~w&E,D=g&v^g&y^v&y,T=(g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22),P=(w<<26|w>>>6)^(w<<21|w>>>11)^(w<<7|w>>>25),I=k+P+N+u[S]+d[S],R=T+D;k=E,E=x,x=w,w=b+I|0,b=y,y=v,v=g,g=I+R|0}p[0]=p[0]+g|0,p[1]=p[1]+v|0,p[2]=p[2]+y|0,p[3]=p[3]+b|0,p[4]=p[4]+w|0,p[5]=p[5]+x|0,p[6]=p[6]+E|0,p[7]=p[7]+k|0},_doFinalize:function(){var h=this._data,m=h.words,p=this._nDataBytes*8,g=h.sigBytes*8;return m[g>>>5]|=128<<24-g%32,m[(g+64>>>9<<4)+14]=r.floor(p/4294967296),m[(g+64>>>9<<4)+15]=p,h.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var h=s.clone.call(this);return h._hash=this._hash.clone(),h}});o.SHA256=s._createHelper(f),o.HmacSHA256=s._createHmacHelper(f)})(Math),n.SHA256})})(Mh)),Mh.exports}var Nh={exports:{}},kxe=Nh.exports,QT;function Sxe(){return QT||(QT=1,(function(e,t){(function(n,r,o){e.exports=r(En(),TS())})(kxe,function(n){return(function(){var r=n,o=r.lib,i=o.WordArray,a=r.algo,s=a.SHA256,l=a.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=s._doFinalize.call(this);return c.sigBytes-=4,c}});r.SHA224=s._createHelper(l),r.HmacSHA224=s._createHmacHelper(l)})(),n.SHA224})})(Nh)),Nh.exports}var Dh={exports:{}},Axe=Dh.exports,JT;function Dz(){return JT||(JT=1,(function(e,t){(function(n,r,o){e.exports=r(En(),Gg())})(Axe,function(n){return(function(){var r=n,o=r.lib,i=o.Hasher,a=r.x64,s=a.Word,l=a.WordArray,c=r.algo;function u(){return s.create.apply(s,arguments)}var d=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],f=[];(function(){for(var m=0;m<80;m++)f[m]=u()})();var h=c.SHA512=i.extend({_doReset:function(){this._hash=new l.init([new s.init(1779033703,4089235720),new s.init(3144134277,2227873595),new s.init(1013904242,4271175723),new s.init(2773480762,1595750129),new s.init(1359893119,2917565137),new s.init(2600822924,725511199),new s.init(528734635,4215389547),new s.init(1541459225,327033209)])},_doProcessBlock:function(m,p){for(var g=this._hash.words,v=g[0],y=g[1],b=g[2],w=g[3],x=g[4],E=g[5],k=g[6],S=g[7],O=v.high,A=v.low,$=y.high,M=y.low,N=b.high,D=b.low,T=w.high,P=w.low,I=x.high,R=x.low,H=E.high,V=E.low,L=k.high,_=k.low,j=S.high,F=S.low,B=O,z=A,G=$,W=M,q=N,U=D,X=T,ie=P,K=I,re=R,oe=H,ne=V,ae=L,de=_,ge=j,Se=F,ye=0;ye<80;ye++){var be,ce,he=f[ye];if(ye<16)ce=he.high=m[p+ye*2]|0,be=he.low=m[p+ye*2+1]|0;else{var Te=f[ye-15],se=Te.high,Pe=Te.low,De=(se>>>1|Pe<<31)^(se>>>8|Pe<<24)^se>>>7,He=(Pe>>>1|se<<31)^(Pe>>>8|se<<24)^(Pe>>>7|se<<25),ue=f[ye-2],ve=ue.high,xe=ue.low,fe=(ve>>>19|xe<<13)^(ve<<3|xe>>>29)^ve>>>6,pe=(xe>>>19|ve<<13)^(xe<<3|ve>>>29)^(xe>>>6|ve<<26),ke=f[ye-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,S.high=j+ge+(F>>>0<Se>>>0?1:0)},_doFinalize:function(){var m=this._data,p=m.words,g=this._nDataBytes*8,v=m.sigBytes*8;p[v>>>5]|=128<<24-v%32,p[(v+128>>>10<<5)+30]=Math.floor(g/4294967296),p[(v+128>>>10<<5)+31]=g,m.sigBytes=p.length*4,this._process();var y=this._hash.toX32();return y},clone:function(){var m=i.clone.call(this);return m._hash=this._hash.clone(),m},blockSize:1024/32});r.SHA512=i._createHelper(h),r.HmacSHA512=i._createHmacHelper(h)})(),n.SHA512})})(Dh)),Dh.exports}var Th={exports:{}},$xe=Th.exports,eF;function Oxe(){return eF||(eF=1,(function(e,t){(function(n,r,o){e.exports=r(En(),Gg(),Dz())})($xe,function(n){return(function(){var r=n,o=r.x64,i=o.Word,a=o.WordArray,s=r.algo,l=s.SHA512,c=s.SHA384=l.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var u=l._doFinalize.call(this);return u.sigBytes-=16,u}});r.SHA384=l._createHelper(c),r.HmacSHA384=l._createHmacHelper(c)})(),n.SHA384})})(Th)),Th.exports}var Fh={exports:{}},Mxe=Fh.exports,tF;function Nxe(){return tF||(tF=1,(function(e,t){(function(n,r,o){e.exports=r(En(),Gg())})(Mxe,function(n){return(function(r){var o=n,i=o.lib,a=i.WordArray,s=i.Hasher,l=o.x64,c=l.Word,u=o.algo,d=[],f=[],h=[];(function(){for(var g=1,v=0,y=0;y<24;y++){d[g+5*v]=(y+1)*(y+2)/2%64;var b=v%5,w=(2*g+3*v)%5;g=b,v=w}for(var g=0;g<5;g++)for(var v=0;v<5;v++)f[g+5*v]=v+(2*g+3*v)%5*5;for(var x=1,E=0;E<24;E++){for(var k=0,S=0,O=0;O<7;O++){if(x&1){var A=(1<<O)-1;A<32?S^=1<<A:k^=1<<A-32}x&128?x=x<<1^113:x<<=1}h[E]=c.create(k,S)}})();var m=[];(function(){for(var g=0;g<25;g++)m[g]=c.create()})();var p=u.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var g=this._state=[],v=0;v<25;v++)g[v]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(g,v){for(var y=this._state,b=this.blockSize/2,w=0;w<b;w++){var x=g[v+2*w],E=g[v+2*w+1];x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360;var k=y[w];k.high^=E,k.low^=x}for(var S=0;S<24;S++){for(var O=0;O<5;O++){for(var A=0,$=0,M=0;M<5;M++){var k=y[O+5*M];A^=k.high,$^=k.low}var N=m[O];N.high=A,N.low=$}for(var O=0;O<5;O++)for(var D=m[(O+4)%5],T=m[(O+1)%5],P=T.high,I=T.low,A=D.high^(P<<1|I>>>31),$=D.low^(I<<1|P>>>31),M=0;M<5;M++){var k=y[O+5*M];k.high^=A,k.low^=$}for(var R=1;R<25;R++){var A,$,k=y[R],H=k.high,V=k.low,L=d[R];L<32?(A=H<<L|V>>>32-L,$=V<<L|H>>>32-L):(A=V<<L-32|H>>>64-L,$=H<<L-32|V>>>64-L);var _=m[f[R]];_.high=A,_.low=$}var j=m[0],F=y[0];j.high=F.high,j.low=F.low;for(var O=0;O<5;O++)for(var M=0;M<5;M++){var R=O+5*M,k=y[R],B=m[R],z=m[(O+1)%5+5*M],G=m[(O+2)%5+5*M];k.high=B.high^~z.high&G.high,k.low=B.low^~z.low&G.low}var k=y[0],W=h[S];k.high^=W.high,k.low^=W.low}},_doFinalize:function(){var g=this._data,v=g.words;this._nDataBytes*8;var y=g.sigBytes*8,b=this.blockSize*32;v[y>>>5]|=1<<24-y%32,v[(r.ceil((y+1)/b)*b>>>5)-1]|=128,g.sigBytes=v.length*4,this._process();for(var w=this._state,x=this.cfg.outputLength/8,E=x/8,k=[],S=0;S<E;S++){var O=w[S],A=O.high,$=O.low;A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360,$=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360,k.push($),k.push(A)}return new a.init(k,x)},clone:function(){for(var g=s.clone.call(this),v=g._state=this._state.slice(0),y=0;y<25;y++)v[y]=v[y].clone();return g}});o.SHA3=s._createHelper(p),o.HmacSHA3=s._createHmacHelper(p)})(Math),n.SHA3})})(Fh)),Fh.exports}var Ph={exports:{}},Dxe=Ph.exports,nF;function Txe(){return nF||(nF=1,(function(e,t){(function(n,r){e.exports=r(En())})(Dxe,function(n){/** @preserve
794
794
  (c) 2012 by Cédric Mesnil. All rights reserved.
795
795
 
796
796
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: