@gientech/modual 2.1.32 → 2.1.34

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.
@@ -1,4 +1,9 @@
1
- var zn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in m?zn(m,a,{enumerable:!0,configurable:!0,writable:!0,value:A}):m[a]=A;var ee=(m,a,A)=>Gn(m,typeof a!="symbol"?a+"":a,A),an=(m,a,A)=>a.has(m)||Sn("Cannot "+A);var R=(m,a,A)=>(an(m,a,"read from private field"),A?A.call(m):a.get(m)),Ot=(m,a,A)=>a.has(m)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(m):a.set(m,A),It=(m,a,A,f)=>(an(m,a,"write to private field"),f?f.call(m,A):a.set(m,A),A),Dt=(m,a,A)=>(an(m,a,"access private method"),A);var on=(m,a,A,f)=>({set _(_){It(m,a,_,A)},get _(){return R(m,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{c as createLucideIcon,a7 as getAugmentedNamespace,d as dt$1,b as axios}from"./index-Cso0btPH.js";import{O as O8,e as ea}from"./index-XNALx0u6.js";import{C as ChevronLeft}from"./chevron-left-CXXnV1hf.js";import{c as ChevronRight}from"./index-CFk_xPOV.js";import{X}from"./x-B-FuEh84.js";/**
1
+ var zn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in m?zn(m,a,{enumerable:!0,configurable:!0,writable:!0,value:A}):m[a]=A;var ee=(m,a,A)=>Gn(m,typeof a!="symbol"?a+"":a,A),an=(m,a,A)=>a.has(m)||Sn("Cannot "+A);var R=(m,a,A)=>(an(m,a,"read from private field"),A?A.call(m):a.get(m)),Ot=(m,a,A)=>a.has(m)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(m):a.set(m,A),It=(m,a,A,f)=>(an(m,a,"write to private field"),f?f.call(m,A):a.set(m,A),A),Dt=(m,a,A)=>(an(m,a,"access private method"),A);var on=(m,a,A,f)=>({set _(_){It(m,a,_,A)},get _(){return R(m,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{c as createLucideIcon,a7 as getAugmentedNamespace,d as dt$1,a as axios}from"./index-8h59dJlj.js";import{O as O8,e as ea}from"./index-WQa7_NYu.js";import{c as ChevronRight}from"./index-DD8xyayB.js";import{X}from"./x-CmbLQ9dc.js";/**
2
+ * @license lucide-react v0.456.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ChevronLeft=createLucideIcon("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
2
7
  * @license lucide-react v0.456.0 - ISC
3
8
  *
4
9
  * This source code is licensed under the ISC license.
@@ -441,4 +446,4 @@ var zn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in
441
446
  color: ${m=>m.$theme.colors.error};
442
447
  text-align: center;
443
448
  padding: 20px;
444
- `,DEFAULT_STREAM_API_URL="http://10.15.12.13:9005/proxy/index/knowledgeBase/file/stream",CACHE_EXPIRY_TIME=300*1e3,defaultTheme={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}},GientechStreamReader=({convertedFilePath:m,fileName:a,fileType:A,csrfToken:f,initialPage:_=1,initialZoom:V=1,totalPages:q,annotations:Y=[],pageSize:M=5,streamApiUrl:b=DEFAULT_STREAM_API_URL,authorization:w,eventsEmit:P=()=>{},tools:F,styles:S,customComponents:c,className:t,headerClass:s,contentClass:o})=>{const[v,g]=useState(!0),[l,n]=useState("\u6B63\u5728\u52A0\u8F7D\u6587\u6863..."),[r,e]=useState(null),[E,x]=useState(_),[L,O]=useState(q||0),[yt,St]=useState(V),[pt,K]=useState(0),[N,U]=useState(null),[G,bt]=useState(null),[wt,Mt]=useState(""),[H,h]=useState(null),[u,T]=useState(null),[I,$]=useState({}),W=useRef(!1),i=useRef(!1),d=useRef({}),C=useRef({}),y=useRef(null),k=useRef(null),j=useRef(_),D=useRef(0);D.current+=1,console.log("[GientechStreamReader] render count:",D.current),console.log("[GientechStreamReader] props snapshot (early):",{fileType:A,currentPage:E,totalPages:L,hasMarkdown:!!wt,hasImage:!!G,hasText:!!H,hasHtml:!!u,isLoading:v,error:r});const p=(S==null?void 0:S.theme)||defaultTheme;useEffect(()=>{W.current=!1,i.current=!1},[A,m]);const _t=useCallback(()=>{const Ct={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!1};let Tt;switch(A){case"pdf":case"pdf_slides":Tt={...Ct,annotation:!1,download:!1,navigation:!0,rotate:!1};break;case"image":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!0,zoom:!0};break;case"markdown":case"markdown_table":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;case"text":case"html":case"unknown":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;default:Tt=Ct}return F?{...Tt,...F}:Tt},[A,F])(),z=useCallback((Ct,Tt)=>{const $t=Math.floor((Ct-1)/Tt)*Tt+1;return`${$t}-${$t+Tt-1}`},[]),Q=useCallback(async Ct=>{var Qt;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7\u7F13\u5B58\u68C0\u67E5`),null;console.log(`\u68C0\u67E5\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D`);const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u5355\u4E2A\u9875\u9762\u7F13\u5B58: ${Ct}`),$t.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),$t.pdfDocument):null;const jt=z(Ct,M),Wt=C.current[jt];if(console.log(`\u68C0\u67E5chunk\u7F13\u5B58: ${jt}, \u5B58\u5728: ${!!Wt}, \u5305\u542B\u9875\u9762: ${((Qt=Wt==null?void 0:Wt.pages)==null?void 0:Qt.join(", "))||"\u65E0"}`),Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME){if(Wt.pages.includes(Ct))return console.log(`\u4F7F\u7528chunk\u7F13\u5B58: ${Ct} (chunk: ${jt})`),Wt.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),Wt.pdfDocument):null;console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728chunk ${jt} \u4E2D\uFF0Cchunk\u5305\u542B: ${Wt.pages.join(", ")}`)}return console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728\u4EFB\u4F55\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42`),null},[M,z,A]),At=useCallback(async Ct=>{var Tt;try{if(!(A==="pdf"||A==="pdf_slides"))throw console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u9700\u8981\u5206\u9875\u53C2\u6570\uFF0C\u83B7\u53D6\u5B8C\u6574\u5185\u5BB9`),new Error(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u5206\u9875\u52A0\u8F7D`);const jt=Math.floor((Ct-1)/M)*M+1,Wt=z(Ct,M);console.log(`\u8BF7\u6C42PDF chunk\u6570\u636E: ${jt} (\u5305\u542B\u9875\u9762 ${jt}-${jt+M-1})`);const Qt={"Content-Type":"application/json"};w&&(Qt.Authorization=w),f&&(Qt["X-CSRF-TOKEN-IN"]=f);const se={convertedFilePath:m,pageNo:jt,pageSize:M},Kt=await axios.post(b,se,{headers:Qt,responseType:"arraybuffer"}),ae=Kt.headers["x-csrf-token-out"]||Kt.headers["X-CSRF-TOKEN-OUT"];ae&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",ae),P("request_finish",ae));const te=Array.from({length:M},(ge,he)=>jt+he);return C.current[Wt]={data:Kt.data,pages:te,timestamp:Date.now(),totalPages:q},console.log(`\u7F13\u5B58PDF chunk\u6570\u636E: ${Wt}, \u5305\u542B\u9875\u9762: ${te.join(", ")}, \u8BF7\u6C42\u7684\u9875\u9762: ${Ct}`),console.log("\u5F53\u524D\u6240\u6709\u7F13\u5B58:",Object.keys(C.current)),Kt.data}catch($t){throw console.error("\u83B7\u53D6PDF stream\u6570\u636E\u5931\u8D25:",$t),new Error(`PDF\u8BF7\u6C42\u5931\u8D25: ${((Tt=$t.response)==null?void 0:Tt.status)||"\u7F51\u7EDC\u9519\u8BEF"}`)}},[b,m,M,w,z,q,L,A,P]),kt=useCallback(async(Ct,Tt=!1)=>{var jt;if(!Ct)return;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7PDF\u52A0\u8F7D\u903B\u8F91`),null;try{Tt?(g(!0),n("\u6B63\u5728\u52A0\u8F7DPDF\u6587\u6863...")):(g(!0),n(`\u6B63\u5728\u52A0\u8F7D\u7B2C ${Ct} \u9875...`)),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7DPDF\u9875\u9762: ${Ct}, \u521D\u59CB\u52A0\u8F7D: ${Tt}`);const Wt=await Q(Ct);if(Wt)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),U(Wt),g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210\uFF08\u4F7F\u7528\u7F13\u5B58\uFF09`),Wt;const Qt=await At(Ct),se=await Ft(Qt,{fileName:a||"Stream\u6587\u6863",fileType:"pdf",token:w});if(se.error)throw new Error(se.error);if(se.type!=="pdf"||!((jt=se.content)!=null&&jt.document))throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u6863");const Kt=se.content.document;console.log("\u8BBE\u7F6EPDF\u6587\u6863:",Kt),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof Kt),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Kt?Object.getOwnPropertyNames(Object.getPrototypeOf(Kt)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u9875\u6570:",Kt?Kt.numPages:"\u65E0\u9875\u6570"),console.log("\u5F53\u524D\u8BF7\u6C42\u7684\u9875\u9762:",Ct),console.log("PDF\u6587\u6863\u5305\u542B\u7684\u9875\u9762\u8303\u56F4:",Kt?`1-${Kt.numPages}`:"\u65E0\u9875\u6570"),U(Kt);const ae=z(Ct,M);if(C.current[ae]&&(C.current[ae].pdfDocument=Kt,console.log(`\u7F13\u5B58PDF\u6587\u6863\u5230chunk: ${ae}`)),q)console.log(`\u4F7F\u7528\u7528\u6237\u4F20\u5165\u7684\u603B\u9875\u6570: ${q}`),O(q);else if(Kt&&Kt.numPages){const te=Kt.numPages;console.log(`\u7528\u6237\u672A\u4F20\u5165\u603B\u9875\u6570\uFF0C\u4ECEPDF\u6587\u6863\u83B7\u53D6\u5B9E\u9645\u603B\u9875\u6570: ${te}`),O(te)}return g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210`),Kt}catch(Wt){throw console.error("PDF\u52A0\u8F7D\u5931\u8D25:",Wt),e(Wt.message||"PDF\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Wt}},[At,a,w,L,Q,z,M,A]),Rt=useCallback(Ct=>{if(!(A==="pdf"||A==="pdf_slides"))return!1;const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return!!$t.pdfDocument;const jt=z(Ct,M),Wt=C.current[jt];return Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME?Wt.pages.includes(Ct)&&!!Wt.pdfDocument:!1},[M,z,A]),xt=useCallback(()=>{console.log("\u68C0\u67E5markdown\u5185\u5BB9\u662F\u5426\u5728\u7F13\u5B58\u4E2D");const Ct=y.current;return Ct&&Date.now()-Ct.timestamp<CACHE_EXPIRY_TIME?(console.log("\u4F7F\u7528markdown\u5185\u5BB9\u7F13\u5B58"),Ct.data):(console.log("markdown\u5185\u5BB9\u4E0D\u5728\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42"),null)},[]),Ht=useCallback(async()=>{var Ct;try{console.log("\u8BF7\u6C42\u5B8C\u6574markdown\u6570\u636E");const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001markdown\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"text"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("markdown\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("markdown\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.length)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Ut=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7Dmarkdown\u6587\u6863..."),e(null),console.log("\u5F00\u59CB\u52A0\u8F7D\u5B8C\u6574markdown\u6587\u6863");const Ct=xt();if(Ct)return console.log("\u4F7F\u7528\u7F13\u5B58\u7684markdown\u5185\u5BB9"),Mt(Ct),g(!1),n(""),Ct;const Tt=await Ht();return y.current={data:Tt,timestamp:Date.now()},Mt(Tt),g(!1),n(""),console.log("\u5B8C\u6574markdown\u6587\u6863\u52A0\u8F7D\u5B8C\u6210"),Tt}catch(Ct){throw console.error("markdown\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"markdown\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[Ht,xt]),Nt=useCallback(async()=>{try{const Ct={"Content-Type":"application/json"};w&&(Ct.Authorization=w),f&&(Ct["X-CSRF-TOKEN-IN"]=f);const Tt={convertedFilePath:m},$t=await axios.post(b,Tt,{headers:Ct,responseType:"arraybuffer"}),jt=$t.headers["x-csrf-token-out"]||$t.headers["X-CSRF-TOKEN-OUT"];return jt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",jt),P("request_finish",jt)),$t.data}catch(Ct){throw console.error("\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25:",Ct),new Error(`\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25: ${Ct.message}`)}},[m,w,b,P]),Xt=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7D\u56FE\u7247..."),e(null);const Ct=await Nt(),Tt=await Ft(Ct,{fileName:a||"\u56FE\u7247",fileType:"image",token:w});if(Tt.error)throw new Error(Tt.error);if(Tt.type!=="image"||!Tt.content)throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684\u56FE\u7247");return bt(Tt.content),g(!1),n(""),Tt.content}catch(Ct){throw console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[w,a,Nt]),Gt=useCallback(async()=>{var Ct;try{console.log(`\u8BF7\u6C42\u901A\u7528\u6587\u4EF6\u6570\u636E\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001\u901A\u7528\u6587\u4EF6\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"arraybuffer"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.byteLength)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Zt=useCallback(async()=>{try{if(console.log("=== loadGenericDocument \u88AB\u8C03\u7528 ==="),console.log("\u8C03\u7528\u6808:",new Error().stack),console.log("\u5F53\u524D\u65F6\u95F4:",new Date().toISOString()),W.current){console.log(`\u901A\u7528\u6587\u6863\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}if(i.current){console.log(`\u901A\u7528\u6587\u6863\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}const Ct=`${A}_${m}`,Tt=I[Ct];if(console.log(`\u68C0\u67E5\u901A\u7528\u6587\u6863\u7F13\u5B58\uFF0Ckey: ${Ct}, \u7F13\u5B58\u5B58\u5728: ${!!Tt}, \u7F13\u5B58\u65F6\u95F4: ${Tt?Date.now()-Tt.timestamp:"N/A"}ms`),Tt&&Date.now()-Tt.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684\u901A\u7528\u6587\u6863\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),A==="text"&&Tt.content?h(Tt.content):A==="html"&&Tt.content&&T(Tt.content),x(1),O(q||1),g(!1),n(""),Tt.content;W.current=!0,g(!0),n(`\u6B63\u5728\u52A0\u8F7D${A}\u6587\u6863...`),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7D\u901A\u7528\u6587\u6863\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const $t=await Gt(),jt=await Ft($t,{fileName:a||`${A}\u6587\u6863`,fileType:A,token:w});if(jt.error)throw new Error(jt.error);let Wt=null;if(jt.type==="text"&&jt.content)h(jt.content),Wt=jt.content;else if(jt.type==="html"&&jt.content)T(jt.content),Wt=jt.content;else if(jt.type==="image"&&jt.content)bt(jt.content),Wt=jt.content;else{const se=new TextDecoder("utf-8").decode($t);h({type:"text",content:se}),Wt={type:"text",content:se}}if(Wt){const Qt=`${A}_${m}`,se={...I,[Qt]:{content:Wt,timestamp:Date.now()}};$(se),console.log(`\u901A\u7528\u6587\u6863\u5185\u5BB9\u5DF2\u7F13\u5B58\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}, \u7F13\u5B58\u952E: ${Qt}`),console.log("\u5F53\u524D\u7F13\u5B58\u72B6\u6001:",se)}return g(!1),n(""),W.current=!1,i.current=!0,console.log(`\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5B8C\u6210\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),jt}catch(Ct){throw console.error("\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),W.current=!1,i.current=!0,Ct}},[Gt,a,w]),zt=useCallback(async Ct=>{if(Ct===j.current)return;if(v){console.log("\u9875\u9762\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42");return}if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}console.log("PDF\u9875\u9762\u53D8\u5316:",Ct,"\u5F53\u524D\u9875:",j.current),console.log(`\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D:`,Rt(Ct)),j.current=Ct,x(Ct);try{await kt(Ct,!1),P("pageChange",{pageNumber:Ct,totalPages:q||L})}catch($t){console.error("PDF\u9875\u9762\u52A0\u8F7D\u5931\u8D25:",$t);const jt=j.current;x(jt)}},[kt,L,P,Rt,v,A]);useEffect(()=>{j.current=E,console.log("\u5F53\u524D\u9875\u72B6\u6001\u66F4\u65B0:",E)},[E]);const Vt=useCallback(Ct=>{St(Ct),P("zoomChange",{scale:Ct})},[P]),Yt=useCallback(()=>{P("viewer:close")},[P]),Jt=useCallback(()=>{const Ct=Math.min(3,yt+.1);Vt(Ct)},[yt,Vt]),oe=useCallback(()=>{const Ct=Math.max(.3,yt-.1);Vt(Ct)},[yt,Vt]),ce=useCallback(()=>{const Ct=(pt-90+360)%360;K(Ct),P("rotateChange",{rotation:Ct})},[pt,P]),de=useCallback(()=>{const Ct=(pt+90)%360;K(Ct),P("rotateChange",{rotation:Ct})},[pt,P]),Pt=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=j.current-1;Tt>=1&&zt(Tt)},[zt,A]),J=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=j.current+1,$t=q||L;$t&&Tt<=$t&&zt(Tt)},[L,zt,A]),Z=useCallback(()=>{const Ct=Date.now();Object.keys(d.current).forEach(Tt=>{const $t=d.current[parseInt(Tt)];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete d.current[parseInt(Tt)],console.log(`\u6E05\u7406\u8FC7\u671F\u9875\u9762\u7F13\u5B58: ${Tt}`))}),Object.keys(C.current).forEach(Tt=>{const $t=C.current[Tt];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete C.current[Tt],console.log(`\u6E05\u7406\u8FC7\u671Fchunk\u7F13\u5B58: ${Tt}`))}),y.current&&Ct-y.current.timestamp>CACHE_EXPIRY_TIME&&(y.current=null,console.log("\u6E05\u7406\u8FC7\u671Fmarkdown\u5185\u5BB9\u7F13\u5B58")),$(Tt=>{const $t={...Tt};return Object.keys($t).forEach(jt=>{Ct-$t[jt].timestamp>CACHE_EXPIRY_TIME&&(delete $t[jt],console.log(`\u6E05\u7406\u8FC7\u671F\u901A\u7528\u6587\u4EF6\u7F13\u5B58: ${jt}`))}),$t})},[]),Lt=useCallback(()=>{if(a)return a;try{const Ct=new URL(m);return decodeURIComponent(Ct.pathname.split("/").pop()||"")||"Stream\u6587\u6863"}catch{const Ct=m.split("/");return decodeURIComponent(Ct[Ct.length-1])||"Stream\u6587\u6863"}},[m,a]);useEffect(()=>{const Ct=setInterval(Z,CACHE_EXPIRY_TIME);return()=>clearInterval(Ct)},[Z]),useEffect(()=>()=>{d.current={},C.current={},y.current=null,$({}),console.log("\u7EC4\u4EF6\u5378\u8F7D\uFF0C\u6E05\u7406\u6240\u6709\u7F13\u5B58")},[]),useEffect(()=>{console.log("=== useEffect \u88AB\u89E6\u53D1 ==="),console.log("\u89E6\u53D1\u65F6\u95F4:",new Date().toISOString()),console.log("\u89E6\u53D1\u539F\u56E0:",{initialPage:_,fileType:A}),(async()=>{try{const Tt=A==="pdf"||A==="pdf_slides",$t=Tt&&_||1;console.log("\u5F00\u59CB\u521D\u59CB\u52A0\u8F7D\uFF0C\u6587\u4EF6\u7C7B\u578B:",A,"\u6709\u6548\u9875\u7801:",$t,"\u662F\u5426PDF:",Tt),A==="markdown"||A==="markdown_table"?(await Ut(),x(1),O(q||1),P("pageChange",{pageNumber:1,totalPages:q||1})):A==="image"?(await Xt(),x(1),O(q||1),K(0),P("pageChange",{pageNumber:1,totalPages:q||1})):Tt?(await kt($t,!0),x($t),setTimeout(()=>{P("pageChange",{pageNumber:$t,totalPages:q||L})},0)):(console.log("=== \u521D\u59CB\u52A0\u8F7D\uFF1A\u4F7F\u7528\u901A\u7528\u52A0\u8F7D\u51FD\u6570\u5904\u7406\u6587\u4EF6\u7C7B\u578B ===",A),await Zt(),x(1),O(q||1),P("pageChange",{pageNumber:1,totalPages:q||1}))}catch(Tt){console.error("\u521D\u59CB\u52A0\u8F7D\u5931\u8D25:",Tt),e((Tt==null?void 0:Tt.message)||"\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n("")}})()},[_,A,m]);const qt=useMemo(()=>Math.floor((E-1)/M)*M+1,[E,M]);return r?jsx(ReaderContainer,{$theme:p,className:t,children:c!=null&&c.ErrorComponent?jsx(c.ErrorComponent,{error:r,theme:p}):jsxs(ErrorContainer,{$theme:p,children:[jsx("div",{children:"\u52A0\u8F7D\u5931\u8D25"}),jsx("div",{style:{fontSize:"12px",marginTop:"8px"},children:r})]})}):v?jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:L,scale:yt,isAnnotating:!1,tools:_t,styles:S,onPrevPage:()=>{},onNextPage:()=>{},onZoomIn:()=>{},onZoomOut:()=>{},onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:s}),c!=null&&c.LoadingComponent?jsx(c.LoadingComponent,{status:l,theme:p}):jsx(DefaultLoadingComponent,{status:l,theme:p})]}):jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:L,scale:yt,isAnnotating:!1,tools:{..._t,navigation:A==="pdf"||A==="pdf_slides"?_t.navigation:!1,rotate:A==="image"},styles:S,onPrevPage:Pt,onNextPage:J,onZoomIn:Jt,onZoomOut:oe,onRotateLeft:A==="image"?ce:void 0,onRotateRight:A==="image"?de:void 0,onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:s}),A==="markdown"||A==="markdown_table"?jsxs("div",{ref:k,style:{flex:1,overflow:"auto",position:"relative"},className:o,children:[jsx(Xe,{data:{content:wt,...Lt()&&{fileName:Lt()},...A&&{fileType:A},...L&&{totalPages:L}},annotationData:Y,totalPage:L,currentPage:E,scale:yt,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),P(Ct==="md_annotation_add"?"md_annotation_add":Ct==="table_annotation_add"?"table_annotation_add":Ct,Tt)},styles:S,tools:_t,customComponents:c,contentClass:o}),(console.log("=== \u4F20\u9012\u7ED9Fviewer\u7684markdown\u5185\u5BB9 ==="),console.log("markdownContent:",wt),console.log("markdownContent\u957F\u5EA6:",wt.length),console.log("markdownContent\u524D100\u5B57\u7B26:",wt.substring(0,100)),console.log("markdownContent\u540E100\u5B57\u7B26:",wt.substring(wt.length-100)),null)]}):A==="image"?jsx(Xe,{data:{content:G,...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,rotation:pt,eventsEmit:P,styles:S,tools:{..._t,navigation:!1,rotate:!0},customComponents:c,contentClass:o}):A==="pdf"||A==="pdf_slides"?jsx(Xe,{data:{content:{document:N},...Lt()&&{fileName:Lt()},...A&&{fileType:A},...L&&{totalPages:L},pdfStartPage:qt},annotationData:Y,totalPage:L,currentPage:E,scale:yt,initialZoom:V,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),Ct==="scaleChange"&&console.log("\u6536\u5230\u7F29\u653E\u53D8\u5316\u4E8B\u4EF6:",Tt),P(Ct,Tt)},styles:S,tools:_t,customComponents:c,contentClass:o,setScale:St}):jsx(Xe,{data:{content:H||u||{type:"text",content:"\u6587\u4EF6\u5185\u5BB9\u52A0\u8F7D\u4E2D..."},...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,eventsEmit:P,styles:S,tools:{..._t,navigation:!1},customComponents:c,contentClass:o})]})};export{Bt as B,GientechStreamReader as G,commonjsRequire as c,require$$0 as r};
449
+ `,DEFAULT_STREAM_API_URL="http://10.15.12.13:9005/proxy/index/knowledgeBase/file/stream",CACHE_EXPIRY_TIME=300*1e3,defaultTheme={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}},GientechStreamReader=({convertedFilePath:m,fileName:a,fileType:A,csrfToken:f,initialPage:_=1,initialZoom:V=1,totalPages:q,annotations:Y=[],pageSize:M=5,streamApiUrl:b=DEFAULT_STREAM_API_URL,authorization:w,eventsEmit:P=()=>{},tools:F,styles:S,customComponents:c,className:t,headerClass:s,contentClass:o})=>{const[v,g]=useState(!0),[l,n]=useState("\u6B63\u5728\u52A0\u8F7D\u6587\u6863..."),[r,e]=useState(null),[E,x]=useState(_),[L,O]=useState(q||0),[yt,St]=useState(V),[pt,K]=useState(0),[N,U]=useState(null),[G,bt]=useState(null),[wt,Mt]=useState(""),[H,h]=useState(null),[u,T]=useState(null),[I,$]=useState({}),W=useRef(!1),i=useRef(!1),d=useRef({}),C=useRef({}),y=useRef(null),k=useRef(null),j=useRef(_),D=useRef(0);D.current+=1,console.log("[GientechStreamReader] render count:",D.current),console.log("[GientechStreamReader] props snapshot (early):",{fileType:A,currentPage:E,totalPages:L,hasMarkdown:!!wt,hasImage:!!G,hasText:!!H,hasHtml:!!u,isLoading:v,error:r});const p=(S==null?void 0:S.theme)||defaultTheme;useEffect(()=>{W.current=!1,i.current=!1},[A,m]);const _t=useCallback(()=>{const Ct={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!1};let Tt;switch(A){case"pdf":case"pdf_slides":Tt={...Ct,annotation:!1,download:!1,navigation:!0,rotate:!1};break;case"image":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!0,zoom:!0};break;case"markdown":case"markdown_table":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;case"text":case"html":case"unknown":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;default:Tt=Ct}return F?{...Tt,...F}:Tt},[A,F])(),z=useCallback((Ct,Tt)=>{const $t=Math.floor((Ct-1)/Tt)*Tt+1;return`${$t}-${$t+Tt-1}`},[]),Q=useCallback(async Ct=>{var Qt;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7\u7F13\u5B58\u68C0\u67E5`),null;console.log(`\u68C0\u67E5\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D`);const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u5355\u4E2A\u9875\u9762\u7F13\u5B58: ${Ct}`),$t.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),$t.pdfDocument):null;const jt=z(Ct,M),Wt=C.current[jt];if(console.log(`\u68C0\u67E5chunk\u7F13\u5B58: ${jt}, \u5B58\u5728: ${!!Wt}, \u5305\u542B\u9875\u9762: ${((Qt=Wt==null?void 0:Wt.pages)==null?void 0:Qt.join(", "))||"\u65E0"}`),Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME){if(Wt.pages.includes(Ct))return console.log(`\u4F7F\u7528chunk\u7F13\u5B58: ${Ct} (chunk: ${jt})`),Wt.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),Wt.pdfDocument):null;console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728chunk ${jt} \u4E2D\uFF0Cchunk\u5305\u542B: ${Wt.pages.join(", ")}`)}return console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728\u4EFB\u4F55\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42`),null},[M,z,A]),At=useCallback(async Ct=>{var Tt;try{if(!(A==="pdf"||A==="pdf_slides"))throw console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u9700\u8981\u5206\u9875\u53C2\u6570\uFF0C\u83B7\u53D6\u5B8C\u6574\u5185\u5BB9`),new Error(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u5206\u9875\u52A0\u8F7D`);const jt=Math.floor((Ct-1)/M)*M+1,Wt=z(Ct,M);console.log(`\u8BF7\u6C42PDF chunk\u6570\u636E: ${jt} (\u5305\u542B\u9875\u9762 ${jt}-${jt+M-1})`);const Qt={"Content-Type":"application/json"};w&&(Qt.Authorization=w),f&&(Qt["X-CSRF-TOKEN-IN"]=f);const se={convertedFilePath:m,pageNo:jt,pageSize:M},Kt=await axios.post(b,se,{headers:Qt,responseType:"arraybuffer"}),ae=Kt.headers["x-csrf-token-out"]||Kt.headers["X-CSRF-TOKEN-OUT"];ae&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",ae),P("request_finish",ae));const te=Array.from({length:M},(ge,he)=>jt+he);return C.current[Wt]={data:Kt.data,pages:te,timestamp:Date.now(),totalPages:q},console.log(`\u7F13\u5B58PDF chunk\u6570\u636E: ${Wt}, \u5305\u542B\u9875\u9762: ${te.join(", ")}, \u8BF7\u6C42\u7684\u9875\u9762: ${Ct}`),console.log("\u5F53\u524D\u6240\u6709\u7F13\u5B58:",Object.keys(C.current)),Kt.data}catch($t){throw console.error("\u83B7\u53D6PDF stream\u6570\u636E\u5931\u8D25:",$t),new Error(`PDF\u8BF7\u6C42\u5931\u8D25: ${((Tt=$t.response)==null?void 0:Tt.status)||"\u7F51\u7EDC\u9519\u8BEF"}`)}},[b,m,M,w,z,q,L,A,P]),kt=useCallback(async(Ct,Tt=!1)=>{var jt;if(!Ct)return;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7PDF\u52A0\u8F7D\u903B\u8F91`),null;try{Tt?(g(!0),n("\u6B63\u5728\u52A0\u8F7DPDF\u6587\u6863...")):(g(!0),n(`\u6B63\u5728\u52A0\u8F7D\u7B2C ${Ct} \u9875...`)),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7DPDF\u9875\u9762: ${Ct}, \u521D\u59CB\u52A0\u8F7D: ${Tt}`);const Wt=await Q(Ct);if(Wt)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),U(Wt),g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210\uFF08\u4F7F\u7528\u7F13\u5B58\uFF09`),Wt;const Qt=await At(Ct),se=await Ft(Qt,{fileName:a||"Stream\u6587\u6863",fileType:"pdf",token:w});if(se.error)throw new Error(se.error);if(se.type!=="pdf"||!((jt=se.content)!=null&&jt.document))throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u6863");const Kt=se.content.document;console.log("\u8BBE\u7F6EPDF\u6587\u6863:",Kt),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof Kt),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Kt?Object.getOwnPropertyNames(Object.getPrototypeOf(Kt)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u9875\u6570:",Kt?Kt.numPages:"\u65E0\u9875\u6570"),console.log("\u5F53\u524D\u8BF7\u6C42\u7684\u9875\u9762:",Ct),console.log("PDF\u6587\u6863\u5305\u542B\u7684\u9875\u9762\u8303\u56F4:",Kt?`1-${Kt.numPages}`:"\u65E0\u9875\u6570"),U(Kt);const ae=z(Ct,M);if(C.current[ae]&&(C.current[ae].pdfDocument=Kt,console.log(`\u7F13\u5B58PDF\u6587\u6863\u5230chunk: ${ae}`)),q)console.log(`\u4F7F\u7528\u7528\u6237\u4F20\u5165\u7684\u603B\u9875\u6570: ${q}`),O(q);else if(Kt&&Kt.numPages){const te=Kt.numPages;console.log(`\u7528\u6237\u672A\u4F20\u5165\u603B\u9875\u6570\uFF0C\u4ECEPDF\u6587\u6863\u83B7\u53D6\u5B9E\u9645\u603B\u9875\u6570: ${te}`),O(te)}return g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210`),Kt}catch(Wt){throw console.error("PDF\u52A0\u8F7D\u5931\u8D25:",Wt),e(Wt.message||"PDF\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Wt}},[At,a,w,L,Q,z,M,A]),Rt=useCallback(Ct=>{if(!(A==="pdf"||A==="pdf_slides"))return!1;const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return!!$t.pdfDocument;const jt=z(Ct,M),Wt=C.current[jt];return Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME?Wt.pages.includes(Ct)&&!!Wt.pdfDocument:!1},[M,z,A]),xt=useCallback(()=>{console.log("\u68C0\u67E5markdown\u5185\u5BB9\u662F\u5426\u5728\u7F13\u5B58\u4E2D");const Ct=y.current;return Ct&&Date.now()-Ct.timestamp<CACHE_EXPIRY_TIME?(console.log("\u4F7F\u7528markdown\u5185\u5BB9\u7F13\u5B58"),Ct.data):(console.log("markdown\u5185\u5BB9\u4E0D\u5728\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42"),null)},[]),Ht=useCallback(async()=>{var Ct;try{console.log("\u8BF7\u6C42\u5B8C\u6574markdown\u6570\u636E");const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001markdown\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"text"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("markdown\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("markdown\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.length)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Ut=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7Dmarkdown\u6587\u6863..."),e(null),console.log("\u5F00\u59CB\u52A0\u8F7D\u5B8C\u6574markdown\u6587\u6863");const Ct=xt();if(Ct)return console.log("\u4F7F\u7528\u7F13\u5B58\u7684markdown\u5185\u5BB9"),Mt(Ct),g(!1),n(""),Ct;const Tt=await Ht();return y.current={data:Tt,timestamp:Date.now()},Mt(Tt),g(!1),n(""),console.log("\u5B8C\u6574markdown\u6587\u6863\u52A0\u8F7D\u5B8C\u6210"),Tt}catch(Ct){throw console.error("markdown\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"markdown\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[Ht,xt]),Nt=useCallback(async()=>{try{const Ct={"Content-Type":"application/json"};w&&(Ct.Authorization=w),f&&(Ct["X-CSRF-TOKEN-IN"]=f);const Tt={convertedFilePath:m},$t=await axios.post(b,Tt,{headers:Ct,responseType:"arraybuffer"}),jt=$t.headers["x-csrf-token-out"]||$t.headers["X-CSRF-TOKEN-OUT"];return jt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",jt),P("request_finish",jt)),$t.data}catch(Ct){throw console.error("\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25:",Ct),new Error(`\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25: ${Ct.message}`)}},[m,w,b,P]),Xt=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7D\u56FE\u7247..."),e(null);const Ct=await Nt(),Tt=await Ft(Ct,{fileName:a||"\u56FE\u7247",fileType:"image",token:w});if(Tt.error)throw new Error(Tt.error);if(Tt.type!=="image"||!Tt.content)throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684\u56FE\u7247");return bt(Tt.content),g(!1),n(""),Tt.content}catch(Ct){throw console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[w,a,Nt]),Gt=useCallback(async()=>{var Ct;try{console.log(`\u8BF7\u6C42\u901A\u7528\u6587\u4EF6\u6570\u636E\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001\u901A\u7528\u6587\u4EF6\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"arraybuffer"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.byteLength)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Zt=useCallback(async()=>{try{if(console.log("=== loadGenericDocument \u88AB\u8C03\u7528 ==="),console.log("\u8C03\u7528\u6808:",new Error().stack),console.log("\u5F53\u524D\u65F6\u95F4:",new Date().toISOString()),W.current){console.log(`\u901A\u7528\u6587\u6863\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}if(i.current){console.log(`\u901A\u7528\u6587\u6863\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}const Ct=`${A}_${m}`,Tt=I[Ct];if(console.log(`\u68C0\u67E5\u901A\u7528\u6587\u6863\u7F13\u5B58\uFF0Ckey: ${Ct}, \u7F13\u5B58\u5B58\u5728: ${!!Tt}, \u7F13\u5B58\u65F6\u95F4: ${Tt?Date.now()-Tt.timestamp:"N/A"}ms`),Tt&&Date.now()-Tt.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684\u901A\u7528\u6587\u6863\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),A==="text"&&Tt.content?h(Tt.content):A==="html"&&Tt.content&&T(Tt.content),x(1),O(q||1),g(!1),n(""),Tt.content;W.current=!0,g(!0),n(`\u6B63\u5728\u52A0\u8F7D${A}\u6587\u6863...`),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7D\u901A\u7528\u6587\u6863\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const $t=await Gt(),jt=await Ft($t,{fileName:a||`${A}\u6587\u6863`,fileType:A,token:w});if(jt.error)throw new Error(jt.error);let Wt=null;if(jt.type==="text"&&jt.content)h(jt.content),Wt=jt.content;else if(jt.type==="html"&&jt.content)T(jt.content),Wt=jt.content;else if(jt.type==="image"&&jt.content)bt(jt.content),Wt=jt.content;else{const se=new TextDecoder("utf-8").decode($t);h({type:"text",content:se}),Wt={type:"text",content:se}}if(Wt){const Qt=`${A}_${m}`,se={...I,[Qt]:{content:Wt,timestamp:Date.now()}};$(se),console.log(`\u901A\u7528\u6587\u6863\u5185\u5BB9\u5DF2\u7F13\u5B58\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}, \u7F13\u5B58\u952E: ${Qt}`),console.log("\u5F53\u524D\u7F13\u5B58\u72B6\u6001:",se)}return g(!1),n(""),W.current=!1,i.current=!0,console.log(`\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5B8C\u6210\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),jt}catch(Ct){throw console.error("\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),W.current=!1,i.current=!0,Ct}},[Gt,a,w]),zt=useCallback(async Ct=>{if(Ct===j.current)return;if(v){console.log("\u9875\u9762\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42");return}if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}console.log("PDF\u9875\u9762\u53D8\u5316:",Ct,"\u5F53\u524D\u9875:",j.current),console.log(`\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D:`,Rt(Ct)),j.current=Ct,x(Ct);try{await kt(Ct,!1),P("pageChange",{pageNumber:Ct,totalPages:q||L})}catch($t){console.error("PDF\u9875\u9762\u52A0\u8F7D\u5931\u8D25:",$t);const jt=j.current;x(jt)}},[kt,L,P,Rt,v,A]);useEffect(()=>{j.current=E,console.log("\u5F53\u524D\u9875\u72B6\u6001\u66F4\u65B0:",E)},[E]);const Vt=useCallback(Ct=>{St(Ct),P("zoomChange",{scale:Ct})},[P]),Yt=useCallback(()=>{P("viewer:close")},[P]),Jt=useCallback(()=>{const Ct=Math.min(3,yt+.1);Vt(Ct)},[yt,Vt]),oe=useCallback(()=>{const Ct=Math.max(.3,yt-.1);Vt(Ct)},[yt,Vt]),ce=useCallback(()=>{const Ct=(pt-90+360)%360;K(Ct),P("rotateChange",{rotation:Ct})},[pt,P]),de=useCallback(()=>{const Ct=(pt+90)%360;K(Ct),P("rotateChange",{rotation:Ct})},[pt,P]),Pt=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=j.current-1;Tt>=1&&zt(Tt)},[zt,A]),J=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=j.current+1,$t=q||L;$t&&Tt<=$t&&zt(Tt)},[L,zt,A]),Z=useCallback(()=>{const Ct=Date.now();Object.keys(d.current).forEach(Tt=>{const $t=d.current[parseInt(Tt)];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete d.current[parseInt(Tt)],console.log(`\u6E05\u7406\u8FC7\u671F\u9875\u9762\u7F13\u5B58: ${Tt}`))}),Object.keys(C.current).forEach(Tt=>{const $t=C.current[Tt];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete C.current[Tt],console.log(`\u6E05\u7406\u8FC7\u671Fchunk\u7F13\u5B58: ${Tt}`))}),y.current&&Ct-y.current.timestamp>CACHE_EXPIRY_TIME&&(y.current=null,console.log("\u6E05\u7406\u8FC7\u671Fmarkdown\u5185\u5BB9\u7F13\u5B58")),$(Tt=>{const $t={...Tt};return Object.keys($t).forEach(jt=>{Ct-$t[jt].timestamp>CACHE_EXPIRY_TIME&&(delete $t[jt],console.log(`\u6E05\u7406\u8FC7\u671F\u901A\u7528\u6587\u4EF6\u7F13\u5B58: ${jt}`))}),$t})},[]),Lt=useCallback(()=>{if(a)return a;try{const Ct=new URL(m);return decodeURIComponent(Ct.pathname.split("/").pop()||"")||"Stream\u6587\u6863"}catch{const Ct=m.split("/");return decodeURIComponent(Ct[Ct.length-1])||"Stream\u6587\u6863"}},[m,a]);useEffect(()=>{const Ct=setInterval(Z,CACHE_EXPIRY_TIME);return()=>clearInterval(Ct)},[Z]),useEffect(()=>()=>{d.current={},C.current={},y.current=null,$({}),console.log("\u7EC4\u4EF6\u5378\u8F7D\uFF0C\u6E05\u7406\u6240\u6709\u7F13\u5B58")},[]),useEffect(()=>{console.log("=== useEffect \u88AB\u89E6\u53D1 ==="),console.log("\u89E6\u53D1\u65F6\u95F4:",new Date().toISOString()),console.log("\u89E6\u53D1\u539F\u56E0:",{initialPage:_,fileType:A}),(async()=>{try{const Tt=A==="pdf"||A==="pdf_slides",$t=Tt&&_||1;console.log("\u5F00\u59CB\u521D\u59CB\u52A0\u8F7D\uFF0C\u6587\u4EF6\u7C7B\u578B:",A,"\u6709\u6548\u9875\u7801:",$t,"\u662F\u5426PDF:",Tt),A==="markdown"||A==="markdown_table"?(await Ut(),x(1),O(q||1),P("pageChange",{pageNumber:1,totalPages:q||1})):A==="image"?(await Xt(),x(1),O(q||1),K(0),P("pageChange",{pageNumber:1,totalPages:q||1})):Tt?(await kt($t,!0),x($t),setTimeout(()=>{P("pageChange",{pageNumber:$t,totalPages:q||L})},0)):(console.log("=== \u521D\u59CB\u52A0\u8F7D\uFF1A\u4F7F\u7528\u901A\u7528\u52A0\u8F7D\u51FD\u6570\u5904\u7406\u6587\u4EF6\u7C7B\u578B ===",A),await Zt(),x(1),O(q||1),P("pageChange",{pageNumber:1,totalPages:q||1}))}catch(Tt){console.error("\u521D\u59CB\u52A0\u8F7D\u5931\u8D25:",Tt),e((Tt==null?void 0:Tt.message)||"\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n("")}})()},[_,A,m]);const qt=useMemo(()=>Math.floor((E-1)/M)*M+1,[E,M]);return r?jsx(ReaderContainer,{$theme:p,className:t,children:c!=null&&c.ErrorComponent?jsx(c.ErrorComponent,{error:r,theme:p}):jsxs(ErrorContainer,{$theme:p,children:[jsx("div",{children:"\u52A0\u8F7D\u5931\u8D25"}),jsx("div",{style:{fontSize:"12px",marginTop:"8px"},children:r})]})}):v?jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:L,scale:yt,isAnnotating:!1,tools:_t,styles:S,onPrevPage:()=>{},onNextPage:()=>{},onZoomIn:()=>{},onZoomOut:()=>{},onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:s}),c!=null&&c.LoadingComponent?jsx(c.LoadingComponent,{status:l,theme:p}):jsx(DefaultLoadingComponent,{status:l,theme:p})]}):jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:L,scale:yt,isAnnotating:!1,tools:{..._t,navigation:A==="pdf"||A==="pdf_slides"?_t.navigation:!1,rotate:A==="image"},styles:S,onPrevPage:Pt,onNextPage:J,onZoomIn:Jt,onZoomOut:oe,onRotateLeft:A==="image"?ce:void 0,onRotateRight:A==="image"?de:void 0,onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:s}),A==="markdown"||A==="markdown_table"?jsxs("div",{ref:k,style:{flex:1,overflow:"auto",position:"relative"},className:o,children:[jsx(Xe,{data:{content:wt,...Lt()&&{fileName:Lt()},...A&&{fileType:A},...L&&{totalPages:L}},annotationData:Y,totalPage:L,currentPage:E,scale:yt,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),P(Ct==="md_annotation_add"?"md_annotation_add":Ct==="table_annotation_add"?"table_annotation_add":Ct,Tt)},styles:S,tools:_t,customComponents:c,contentClass:o}),(console.log("=== \u4F20\u9012\u7ED9Fviewer\u7684markdown\u5185\u5BB9 ==="),console.log("markdownContent:",wt),console.log("markdownContent\u957F\u5EA6:",wt.length),console.log("markdownContent\u524D100\u5B57\u7B26:",wt.substring(0,100)),console.log("markdownContent\u540E100\u5B57\u7B26:",wt.substring(wt.length-100)),null)]}):A==="image"?jsx(Xe,{data:{content:G,...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,rotation:pt,eventsEmit:P,styles:S,tools:{..._t,navigation:!1,rotate:!0},customComponents:c,contentClass:o}):A==="pdf"||A==="pdf_slides"?jsx(Xe,{data:{content:{document:N},...Lt()&&{fileName:Lt()},...A&&{fileType:A},...L&&{totalPages:L},pdfStartPage:qt},annotationData:Y,totalPage:L,currentPage:E,scale:yt,initialZoom:V,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),Ct==="scaleChange"&&console.log("\u6536\u5230\u7F29\u653E\u53D8\u5316\u4E8B\u4EF6:",Tt),P(Ct,Tt)},styles:S,tools:_t,customComponents:c,contentClass:o,setScale:St}):jsx(Xe,{data:{content:H||u||{type:"text",content:"\u6587\u4EF6\u5185\u5BB9\u52A0\u8F7D\u4E2D..."},...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,eventsEmit:P,styles:S,tools:{..._t,navigation:!1},customComponents:c,contentClass:o})]})};export{Bt as B,ChevronLeft as C,GientechStreamReader as G,commonjsRequire as c,require$$0 as r};
@@ -282,4 +282,4 @@ html body {
282
282
  `,UP=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],il={},Rr;function GP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&il[r])return il[r];var n=window.getComputedStyle(e),o=n.getPropertyValue("box-sizing")||n.getPropertyValue("-moz-box-sizing")||n.getPropertyValue("-webkit-box-sizing"),a=parseFloat(n.getPropertyValue("padding-bottom"))+parseFloat(n.getPropertyValue("padding-top")),i=parseFloat(n.getPropertyValue("border-bottom-width"))+parseFloat(n.getPropertyValue("border-top-width")),s=UP.map(function(c){return"".concat(c,":").concat(n.getPropertyValue(c))}).join(";"),l={sizingStyle:s,paddingSize:a,borderSize:i,boxSizing:o};return t&&r&&(il[r]=l),l}function KP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;Rr||(Rr=document.createElement("textarea"),Rr.setAttribute("tab-index","-1"),Rr.setAttribute("aria-hidden","true"),Rr.setAttribute("name","hiddenTextarea"),document.body.appendChild(Rr)),e.getAttribute("wrap")?Rr.setAttribute("wrap",e.getAttribute("wrap")):Rr.removeAttribute("wrap");var o=GP(e,t),a=o.paddingSize,i=o.borderSize,s=o.boxSizing,l=o.sizingStyle;Rr.setAttribute("style","".concat(l,";").concat(qP)),Rr.value=e.value||e.placeholder||"";var c=void 0,d=void 0,f,v=Rr.scrollHeight;if(s==="border-box"?v+=i:s==="content-box"&&(v-=a),r!==null||n!==null){Rr.value=" ";var h=Rr.scrollHeight-a;r!==null&&(c=h*r,s==="border-box"&&(c=c+a+i),v=Math.max(c,v)),n!==null&&(d=h*n,s==="border-box"&&(d=d+a+i),f=v>d?"":"hidden",v=Math.min(d,v))}var g={height:v,overflowY:f,resize:"none"};return c&&(g.minHeight=c),d&&(g.maxHeight=d),g}var XP=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],sl=0,ll=1,cl=2,YP=u.forwardRef(function(e,t){var r=e,n=r.prefixCls,o=r.defaultValue,a=r.value,i=r.autoSize,s=r.onResize,l=r.className,c=r.style,d=r.disabled,f=r.onChange;r.onInternalAutoSize;var v=ft(r,XP),h=zr(o,{value:a,postState:function(q){return q??""}}),g=X(h,2),p=g[0],m=g[1],b=function(q){m(q.target.value),f==null||f(q)},y=u.useRef();u.useImperativeHandle(t,function(){return{textArea:y.current}});var S=u.useMemo(function(){return i&&Ue(i)==="object"?[i.minRows,i.maxRows]:[]},[i]),C=X(S,2),$=C[0],x=C[1],w=!!i,E=u.useState(cl),O=X(E,2),R=O[0],I=O[1],P=u.useState(),M=X(P,2),F=M[0],N=M[1],A=function(){I(sl)};Ct(function(){w&&A()},[a,$,x,w]),Ct(function(){if(R===sl)I(ll);else if(R===ll){var B=KP(y.current,!1,$,x);I(cl),N(B)}},[R]);var _=u.useRef(),D=function(){mt.cancel(_.current)},W=function(q){R===cl&&(s==null||s(q),i&&(D(),_.current=mt(function(){A()})))};u.useEffect(function(){return D},[]);var G=w?F:null,L=j(j({},c),G);return(R===sl||R===ll)&&(L.overflowY="hidden",L.overflowX="hidden"),u.createElement(In,{onResize:W,disabled:!(i||s)},u.createElement("textarea",Be({},v,{ref:y,style:L,className:oe(n,l,T({},"".concat(n,"-disabled"),d)),disabled:d,value:p,onChange:b})))}),QP=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],JP=ne.forwardRef(function(e,t){var r,n=e.defaultValue,o=e.value,a=e.onFocus,i=e.onBlur,s=e.onChange,l=e.allowClear,c=e.maxLength,d=e.onCompositionStart,f=e.onCompositionEnd,v=e.suffix,h=e.prefixCls,g=h===void 0?"rc-textarea":h,p=e.showCount,m=e.count,b=e.className,y=e.style,S=e.disabled,C=e.hidden,$=e.classNames,x=e.styles,w=e.onResize,E=e.onClear,O=e.onPressEnter,R=e.readOnly,I=e.autoSize,P=e.onKeyDown,M=ft(e,QP),F=zr(n,{value:o,defaultValue:n}),N=X(F,2),A=N[0],_=N[1],D=A==null?"":String(A),W=ne.useState(!1),G=X(W,2),L=G[0],B=G[1],q=ne.useRef(!1),H=ne.useState(null),z=X(H,2),V=z[0],Z=z[1],k=Fe(null),J=Fe(null),ae=function(){var Ce;return(Ce=J.current)===null||Ce===void 0?void 0:Ce.textArea},Y=function(){ae().focus()};Di(t,function(){var Oe;return{resizableTextArea:J.current,focus:Y,blur:function(){ae().blur()},nativeElement:((Oe=k.current)===null||Oe===void 0?void 0:Oe.nativeElement)||ae()}}),tr(function(){B(function(Oe){return!S&&Oe})},[S]);var U=ne.useState(null),re=X(U,2),se=re[0],K=re[1];ne.useEffect(function(){if(se){var Oe;(Oe=ae()).setSelectionRange.apply(Oe,ve(se))}},[se]);var ee=cp(m,p),fe=(r=ee.max)!==null&&r!==void 0?r:c,le=Number(fe)>0,de=ee.strategy(D),we=!!fe&&de>fe,be=function(Ce,Ve){var Ze=Ve;!q.current&&ee.exceedFormatter&&ee.max&&ee.strategy(Ve)>ee.max&&(Ze=ee.exceedFormatter(Ve,{max:ee.max}),Ve!==Ze&&K([ae().selectionStart||0,ae().selectionEnd||0])),_(Ze),Ai(Ce.currentTarget,Ce,s,Ze)},Se=function(Ce){q.current=!0,d==null||d(Ce)},me=function(Ce){q.current=!1,be(Ce,Ce.currentTarget.value),f==null||f(Ce)},te=function(Ce){be(Ce,Ce.target.value)},xe=function(Ce){Ce.key==="Enter"&&O&&O(Ce),P==null||P(Ce)},ze=function(Ce){B(!0),a==null||a(Ce)},Ae=function(Ce){B(!1),i==null||i(Ce)},Me=function(Ce){_(""),Y(),Ai(ae(),Ce,s)},Ee=v,He;ee.show&&(ee.showFormatter?He=ee.showFormatter({value:D,count:de,maxLength:fe}):He="".concat(de).concat(le?" / ".concat(fe):""),Ee=ne.createElement(ne.Fragment,null,Ee,ne.createElement("span",{className:oe("".concat(g,"-data-count"),$==null?void 0:$.count),style:x==null?void 0:x.count},He)));var Te=function(Ce){var Ve;w==null||w(Ce),(Ve=ae())!==null&&Ve!==void 0&&Ve.style.height&&Z(!0)},Le=!I&&!p&&!l;return ne.createElement(yu,{ref:k,value:D,allowClear:l,handleReset:Me,suffix:Ee,prefixCls:g,classNames:j(j({},$),{},{affixWrapper:oe($==null?void 0:$.affixWrapper,T(T({},"".concat(g,"-show-count"),p),"".concat(g,"-textarea-allow-clear"),l))}),disabled:S,focused:L,className:oe(b,we&&"".concat(g,"-out-of-range")),style:j(j({},y),V&&!Le?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof He=="string"?He:void 0}},hidden:C,readOnly:R,onClear:E},ne.createElement(YP,Be({},M,{autoSize:I,maxLength:c,onKeyDown:xe,onChange:te,onFocus:ze,onBlur:Ae,onCompositionStart:Se,onCompositionEnd:me,className:oe($==null?void 0:$.textarea),style:j(j({},x==null?void 0:x.textarea),{},{resize:y==null?void 0:y.resize}),disabled:S,prefixCls:g,onResize:Te,ref:J,readOnly:R})))});const ZP=e=>{const{componentCls:t,paddingLG:r}=e,n=`${t}-textarea`;return{[`textarea${t}`]:{maxWidth:"100%",height:"auto",minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:"bottom",transition:`all ${e.motionDurationSlow}`,resize:"vertical",[`&${t}-mouse-active`]:{transition:`all ${e.motionDurationSlow}, height 0s, width 0s`}},[`${t}-textarea-affix-wrapper-resize-dirty`]:{width:"auto"},[n]:{position:"relative","&-show-count":{[`${t}-data-count`]:{position:"absolute",bottom:e.calc(e.fontSize).mul(e.lineHeight).mul(-1).equal(),insetInlineEnd:0,color:e.colorTextDescription,whiteSpace:"nowrap",pointerEvents:"none"}},[`
283
283
  &-allow-clear > ${t},
284
284
  &-affix-wrapper${n}-has-feedback ${t}
285
- `]:{paddingInlineEnd:r},[`&-affix-wrapper${t}-affix-wrapper`]:{padding:0,[`> textarea${t}`]:{fontSize:"inherit",border:"none",outline:"none",background:"transparent",minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:"none !important"}},[`${t}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${t}-clear-icon`]:{position:"absolute",insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},[`${n}-suffix`]:{position:"absolute",top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}},[`&-affix-wrapper${t}-affix-wrapper-rtl`]:{[`${t}-suffix`]:{[`${t}-data-count`]:{direction:"ltr",insetInlineStart:0}}},[`&-affix-wrapper${t}-affix-wrapper-sm`]:{[`${t}-suffix`]:{[`${t}-clear-icon`]:{insetInlineEnd:e.paddingInlineSM}}}}}},eM=sr(["Input","TextArea"],e=>{const t=Et(e,_a(e));return ZP(t)},Aa,{resetFont:!1});var tM=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const rM=dn((e,t)=>{var r;const{prefixCls:n,bordered:o=!0,size:a,disabled:i,status:s,allowClear:l,classNames:c,rootClassName:d,className:f,style:v,styles:h,variant:g,showCount:p,onMouseDown:m,onResize:b}=e,y=tM(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant","showCount","onMouseDown","onResize"]),{getPrefixCls:S,direction:C,allowClear:$,autoComplete:x,className:w,style:E,classNames:O,styles:R}=Pn("textArea"),I=u.useContext(Mr),P=i??I,{status:M,hasFeedback:F,feedbackIcon:N}=u.useContext(pr),A=Na(M,s),_=u.useRef(null);u.useImperativeHandle(t,()=>{var ee;return{resizableTextArea:(ee=_.current)===null||ee===void 0?void 0:ee.resizableTextArea,focus:fe=>{var le,de;bu((de=(le=_.current)===null||le===void 0?void 0:le.resizableTextArea)===null||de===void 0?void 0:de.textArea,fe)},blur:()=>{var fe;return(fe=_.current)===null||fe===void 0?void 0:fe.blur()}}});const D=S("input",n),W=fn(D),[G,L,B]=ep(D,d),[q]=eM(D,W),{compactSize:H,compactItemClassnames:z}=zo(D,C),V=on(ee=>{var fe;return(fe=a??H)!==null&&fe!==void 0?fe:ee}),[Z,k]=vs("textArea",g,o),J=dp(l??$),[ae,Y]=u.useState(!1),[U,re]=u.useState(!1),se=ee=>{Y(!0),m==null||m(ee);const fe=()=>{Y(!1),document.removeEventListener("mouseup",fe)};document.addEventListener("mouseup",fe)},K=ee=>{var fe,le;if(b==null||b(ee),ae&&typeof getComputedStyle=="function"){const de=(le=(fe=_.current)===null||fe===void 0?void 0:fe.nativeElement)===null||le===void 0?void 0:le.querySelector("textarea");de&&getComputedStyle(de).resize==="both"&&re(!0)}};return G(q(u.createElement(JP,Object.assign({autoComplete:x},y,{style:Object.assign(Object.assign({},E),v),styles:Object.assign(Object.assign({},R),h),disabled:P,allowClear:J,className:oe(B,W,f,d,z,w,U&&`${D}-textarea-affix-wrapper-resize-dirty`),classNames:Object.assign(Object.assign(Object.assign({},c),O),{textarea:oe({[`${D}-sm`]:V==="small",[`${D}-lg`]:V==="large"},L,c==null?void 0:c.textarea,O.textarea,ae&&`${D}-mouse-active`),variant:oe({[`${D}-${Z}`]:k},No(D,A)),affixWrapper:oe(`${D}-textarea-affix-wrapper`,{[`${D}-affix-wrapper-rtl`]:C==="rtl",[`${D}-affix-wrapper-sm`]:V==="small",[`${D}-affix-wrapper-lg`]:V==="large",[`${D}-textarea-show-count`]:p||((r=e.count)===null||r===void 0?void 0:r.show)},L)}),prefixCls:D,suffix:F&&u.createElement("span",{className:`${D}-textarea-suffix`},N),showCount:p,ref:_,onResize:K,onMouseDown:se}))))}),ja=ps;ja.Group=IP;ja.Search=kP;ja.TextArea=rM;ja.Password=VP;ja.OTP=AP;var nM=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],yp=u.forwardRef(function(e,t){var r,n=e.prefixCls,o=n===void 0?"rc-switch":n,a=e.className,i=e.checked,s=e.defaultChecked,l=e.disabled,c=e.loadingIcon,d=e.checkedChildren,f=e.unCheckedChildren,v=e.onClick,h=e.onChange,g=e.onKeyDown,p=ft(e,nM),m=zr(!1,{value:i,defaultValue:s}),b=X(m,2),y=b[0],S=b[1];function C(E,O){var R=y;return l||(R=E,S(R),h==null||h(R,O)),R}function $(E){E.which===_e.LEFT?C(!1,E):E.which===_e.RIGHT&&C(!0,E),g==null||g(E)}function x(E){var O=C(!y,E);v==null||v(O,E)}var w=oe(o,a,(r={},T(r,"".concat(o,"-checked"),y),T(r,"".concat(o,"-disabled"),l),r));return u.createElement("button",Be({},p,{type:"button",role:"switch","aria-checked":y,disabled:l,className:w,ref:t,onKeyDown:$,onClick:x}),c,u.createElement("span",{className:"".concat(o,"-inner")},u.createElement("span",{className:"".concat(o,"-inner-checked")},d),u.createElement("span",{className:"".concat(o,"-inner-unchecked")},f)))});yp.displayName="Switch";const oM=e=>{const{componentCls:t,trackHeightSM:r,trackPadding:n,trackMinWidthSM:o,innerMinMarginSM:a,innerMaxMarginSM:i,handleSizeSM:s,calc:l}=e,c=`${t}-inner`,d=ie(l(s).add(l(n).mul(2)).equal()),f=ie(l(i).mul(2).equal());return{[t]:{[`&${t}-small`]:{minWidth:o,height:r,lineHeight:ie(r),[`${t}-inner`]:{paddingInlineStart:i,paddingInlineEnd:a,[`${c}-checked, ${c}-unchecked`]:{minHeight:r},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${f})`,marginInlineEnd:`calc(100% - ${d} + ${f})`},[`${c}-unchecked`]:{marginTop:l(r).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:s,height:s},[`${t}-loading-icon`]:{top:l(l(s).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:a,paddingInlineEnd:i,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${f})`,marginInlineEnd:`calc(-100% + ${d} - ${f})`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${ie(l(s).add(n).equal())})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:l(e.marginXXS).div(2).equal(),marginInlineEnd:l(e.marginXXS).mul(-1).div(2).equal()}},[`&${t}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:l(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:l(e.marginXXS).div(2).equal()}}}}}}},aM=e=>{const{componentCls:t,handleSize:r,calc:n}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:n(n(r).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},iM=e=>{const{componentCls:t,trackPadding:r,handleBg:n,handleShadow:o,handleSize:a,calc:i}=e,s=`${t}-handle`;return{[t]:{[s]:{position:"absolute",top:r,insetInlineStart:r,width:a,height:a,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:n,borderRadius:i(a).div(2).equal(),boxShadow:o,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${s}`]:{insetInlineStart:`calc(100% - ${ie(i(a).add(r).equal())})`},[`&:not(${t}-disabled):active`]:{[`${s}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${s}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},sM=e=>{const{componentCls:t,trackHeight:r,trackPadding:n,innerMinMargin:o,innerMaxMargin:a,handleSize:i,calc:s}=e,l=`${t}-inner`,c=ie(s(i).add(s(n).mul(2)).equal()),d=ie(s(a).mul(2).equal());return{[t]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:a,paddingInlineEnd:o,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${l}-checked, ${l}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:r},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${d})`,marginInlineEnd:`calc(100% - ${c} + ${d})`},[`${l}-unchecked`]:{marginTop:s(r).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${l}`]:{paddingInlineStart:o,paddingInlineEnd:a,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${d})`,marginInlineEnd:`calc(-100% + ${c} - ${d})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:s(n).mul(2).equal(),marginInlineEnd:s(n).mul(-1).mul(2).equal()}},[`&${t}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:s(n).mul(-1).mul(2).equal(),marginInlineEnd:s(n).mul(2).equal()}}}}}},lM=e=>{const{componentCls:t,trackHeight:r,trackMinWidth:n}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},ar(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:n,height:r,lineHeight:ie(r),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),ts(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},cM=e=>{const{fontSize:t,lineHeight:r,controlHeight:n,colorWhite:o}=e,a=t*r,i=n/2,s=2,l=a-s*2,c=i-s*2;return{trackHeight:a,trackHeightSM:i,trackMinWidth:l*2+s*4,trackMinWidthSM:c*2+s*2,trackPadding:s,handleBg:o,handleSize:l,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new bt("#00230b").setA(.2).toRgbString()}`,innerMinMargin:l/2,innerMaxMargin:l+s+s*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+s+s*2}},uM=sr("Switch",e=>{const t=Et(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[lM(t),sM(t),iM(t),aM(t),oM(t)]},cM);var dM=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const fM=u.forwardRef((e,t)=>{const{prefixCls:r,size:n,disabled:o,loading:a,className:i,rootClassName:s,style:l,checked:c,value:d,defaultChecked:f,defaultValue:v,onChange:h}=e,g=dM(e,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[p,m]=zr(!1,{value:c??d,defaultValue:f??v}),{getPrefixCls:b,direction:y,switch:S}=u.useContext(wt),C=u.useContext(Mr),$=(o??C)||a,x=b("switch",r),w=u.createElement("div",{className:`${x}-handle`},a&&u.createElement(rs,{className:`${x}-loading-icon`})),[E,O,R]=uM(x),I=on(n),P=oe(S==null?void 0:S.className,{[`${x}-small`]:I==="small",[`${x}-loading`]:a,[`${x}-rtl`]:y==="rtl"},i,s,O,R),M=Object.assign(Object.assign({},S==null?void 0:S.style),l),F=(...N)=>{m(N[0]),h==null||h.apply(void 0,N)};return E(u.createElement(Zc,{component:"Switch",disabled:$},u.createElement(yp,Object.assign({},g,{checked:p,onChange:F,prefixCls:x,className:P,style:M,disabled:$,ref:t,loadingIcon:w}))))}),mM=fM;mM.__ANT_SWITCH=!0;export{GM as $,Mn as A,sp as B,XM as C,on as D,Ud as E,Nn as F,tI as G,ba as H,ja as I,hR as J,_e as K,ru as L,ft as M,Do as N,Be as O,Xn as P,En as Q,kI as R,Fa as S,vu as T,or as U,X as V,j as W,T as X,Ct as Y,nu as Z,ve as _,LM as a,Wt as a$,UM as a0,ts as a1,Hr as a2,Ag as a3,To as a4,Fg as a5,mM as a6,jM as a7,zM as a8,ap as a9,YM as aA,xr as aB,Tn as aC,VM as aD,og as aE,JM as aF,E$ as aG,PE as aH,ME as aI,YC as aJ,Jn as aK,qM as aL,Tw as aM,$n as aN,TE as aO,w$ as aP,An as aQ,sa as aR,at as aS,rb as aT,zh as aU,AM as aV,yh as aW,mt as aX,ea as aY,Qc as aZ,In as a_,eT as aa,p2 as ab,br as ac,Ue as ad,_a as ae,dg as af,Aa as ag,gs as ah,Hh as ai,gu as aj,Jh as ak,mg as al,Vr as am,Oa as an,sC as ao,R1 as ap,Bt as aq,KM as ar,fn as as,rs as at,tw as au,Xc as av,K1 as aw,Uc as ax,Tg as ay,Po as az,Ut as b,Vt as b0,Ma as b1,pr as b2,Mr as b3,xI as b4,Zc as b5,wI as b6,Jc as b7,ou as b8,Yf as b9,DM as bA,vw as bB,$a as bC,Qn as bD,Xi as bE,Ri as bF,On as bG,Rn as bH,HM as bI,ox as bJ,Ra as bK,Jd as bL,fI as bM,EE as bN,cx as bO,RP as bP,Dr as bQ,Ac as bR,bv as bS,QM as bT,d$ as bU,xh as bV,Mh as bW,AI as bX,ps as bY,Th as bZ,kM as b_,wR as ba,SR as bb,bt as bc,Vh as bd,Xh as be,Uh as bf,kh as bg,fs as bh,of as bi,nf as bj,Vg as bk,kg as bl,Hg as bm,Wg as bn,Yl as bo,sI as bp,Yh as bq,kR as br,zo as bs,vs as bt,No as bu,Na as bv,yd as bw,NE as bx,ZM as by,sw as bz,cy as c,ry as d,Ww as e,oe as f,sr as g,BM as h,oy as i,qg as j,lI as k,iI as l,Et as m,Ah as n,wt as o,Fh as p,zr as q,ar as r,Bg as s,Gn as t,Pn as u,Mo as v,e1 as w,xt as x,ie as y,pI as z};
285
+ `]:{paddingInlineEnd:r},[`&-affix-wrapper${t}-affix-wrapper`]:{padding:0,[`> textarea${t}`]:{fontSize:"inherit",border:"none",outline:"none",background:"transparent",minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:"none !important"}},[`${t}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${t}-clear-icon`]:{position:"absolute",insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},[`${n}-suffix`]:{position:"absolute",top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}},[`&-affix-wrapper${t}-affix-wrapper-rtl`]:{[`${t}-suffix`]:{[`${t}-data-count`]:{direction:"ltr",insetInlineStart:0}}},[`&-affix-wrapper${t}-affix-wrapper-sm`]:{[`${t}-suffix`]:{[`${t}-clear-icon`]:{insetInlineEnd:e.paddingInlineSM}}}}}},eM=sr(["Input","TextArea"],e=>{const t=Et(e,_a(e));return ZP(t)},Aa,{resetFont:!1});var tM=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const rM=dn((e,t)=>{var r;const{prefixCls:n,bordered:o=!0,size:a,disabled:i,status:s,allowClear:l,classNames:c,rootClassName:d,className:f,style:v,styles:h,variant:g,showCount:p,onMouseDown:m,onResize:b}=e,y=tM(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant","showCount","onMouseDown","onResize"]),{getPrefixCls:S,direction:C,allowClear:$,autoComplete:x,className:w,style:E,classNames:O,styles:R}=Pn("textArea"),I=u.useContext(Mr),P=i??I,{status:M,hasFeedback:F,feedbackIcon:N}=u.useContext(pr),A=Na(M,s),_=u.useRef(null);u.useImperativeHandle(t,()=>{var ee;return{resizableTextArea:(ee=_.current)===null||ee===void 0?void 0:ee.resizableTextArea,focus:fe=>{var le,de;bu((de=(le=_.current)===null||le===void 0?void 0:le.resizableTextArea)===null||de===void 0?void 0:de.textArea,fe)},blur:()=>{var fe;return(fe=_.current)===null||fe===void 0?void 0:fe.blur()}}});const D=S("input",n),W=fn(D),[G,L,B]=ep(D,d),[q]=eM(D,W),{compactSize:H,compactItemClassnames:z}=zo(D,C),V=on(ee=>{var fe;return(fe=a??H)!==null&&fe!==void 0?fe:ee}),[Z,k]=vs("textArea",g,o),J=dp(l??$),[ae,Y]=u.useState(!1),[U,re]=u.useState(!1),se=ee=>{Y(!0),m==null||m(ee);const fe=()=>{Y(!1),document.removeEventListener("mouseup",fe)};document.addEventListener("mouseup",fe)},K=ee=>{var fe,le;if(b==null||b(ee),ae&&typeof getComputedStyle=="function"){const de=(le=(fe=_.current)===null||fe===void 0?void 0:fe.nativeElement)===null||le===void 0?void 0:le.querySelector("textarea");de&&getComputedStyle(de).resize==="both"&&re(!0)}};return G(q(u.createElement(JP,Object.assign({autoComplete:x},y,{style:Object.assign(Object.assign({},E),v),styles:Object.assign(Object.assign({},R),h),disabled:P,allowClear:J,className:oe(B,W,f,d,z,w,U&&`${D}-textarea-affix-wrapper-resize-dirty`),classNames:Object.assign(Object.assign(Object.assign({},c),O),{textarea:oe({[`${D}-sm`]:V==="small",[`${D}-lg`]:V==="large"},L,c==null?void 0:c.textarea,O.textarea,ae&&`${D}-mouse-active`),variant:oe({[`${D}-${Z}`]:k},No(D,A)),affixWrapper:oe(`${D}-textarea-affix-wrapper`,{[`${D}-affix-wrapper-rtl`]:C==="rtl",[`${D}-affix-wrapper-sm`]:V==="small",[`${D}-affix-wrapper-lg`]:V==="large",[`${D}-textarea-show-count`]:p||((r=e.count)===null||r===void 0?void 0:r.show)},L)}),prefixCls:D,suffix:F&&u.createElement("span",{className:`${D}-textarea-suffix`},N),showCount:p,ref:_,onResize:K,onMouseDown:se}))))}),ja=ps;ja.Group=IP;ja.Search=kP;ja.TextArea=rM;ja.Password=VP;ja.OTP=AP;var nM=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],yp=u.forwardRef(function(e,t){var r,n=e.prefixCls,o=n===void 0?"rc-switch":n,a=e.className,i=e.checked,s=e.defaultChecked,l=e.disabled,c=e.loadingIcon,d=e.checkedChildren,f=e.unCheckedChildren,v=e.onClick,h=e.onChange,g=e.onKeyDown,p=ft(e,nM),m=zr(!1,{value:i,defaultValue:s}),b=X(m,2),y=b[0],S=b[1];function C(E,O){var R=y;return l||(R=E,S(R),h==null||h(R,O)),R}function $(E){E.which===_e.LEFT?C(!1,E):E.which===_e.RIGHT&&C(!0,E),g==null||g(E)}function x(E){var O=C(!y,E);v==null||v(O,E)}var w=oe(o,a,(r={},T(r,"".concat(o,"-checked"),y),T(r,"".concat(o,"-disabled"),l),r));return u.createElement("button",Be({},p,{type:"button",role:"switch","aria-checked":y,disabled:l,className:w,ref:t,onKeyDown:$,onClick:x}),c,u.createElement("span",{className:"".concat(o,"-inner")},u.createElement("span",{className:"".concat(o,"-inner-checked")},d),u.createElement("span",{className:"".concat(o,"-inner-unchecked")},f)))});yp.displayName="Switch";const oM=e=>{const{componentCls:t,trackHeightSM:r,trackPadding:n,trackMinWidthSM:o,innerMinMarginSM:a,innerMaxMarginSM:i,handleSizeSM:s,calc:l}=e,c=`${t}-inner`,d=ie(l(s).add(l(n).mul(2)).equal()),f=ie(l(i).mul(2).equal());return{[t]:{[`&${t}-small`]:{minWidth:o,height:r,lineHeight:ie(r),[`${t}-inner`]:{paddingInlineStart:i,paddingInlineEnd:a,[`${c}-checked, ${c}-unchecked`]:{minHeight:r},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${f})`,marginInlineEnd:`calc(100% - ${d} + ${f})`},[`${c}-unchecked`]:{marginTop:l(r).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:s,height:s},[`${t}-loading-icon`]:{top:l(l(s).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:a,paddingInlineEnd:i,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${f})`,marginInlineEnd:`calc(-100% + ${d} - ${f})`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${ie(l(s).add(n).equal())})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:l(e.marginXXS).div(2).equal(),marginInlineEnd:l(e.marginXXS).mul(-1).div(2).equal()}},[`&${t}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:l(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:l(e.marginXXS).div(2).equal()}}}}}}},aM=e=>{const{componentCls:t,handleSize:r,calc:n}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:n(n(r).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},iM=e=>{const{componentCls:t,trackPadding:r,handleBg:n,handleShadow:o,handleSize:a,calc:i}=e,s=`${t}-handle`;return{[t]:{[s]:{position:"absolute",top:r,insetInlineStart:r,width:a,height:a,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:n,borderRadius:i(a).div(2).equal(),boxShadow:o,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${s}`]:{insetInlineStart:`calc(100% - ${ie(i(a).add(r).equal())})`},[`&:not(${t}-disabled):active`]:{[`${s}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${s}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},sM=e=>{const{componentCls:t,trackHeight:r,trackPadding:n,innerMinMargin:o,innerMaxMargin:a,handleSize:i,calc:s}=e,l=`${t}-inner`,c=ie(s(i).add(s(n).mul(2)).equal()),d=ie(s(a).mul(2).equal());return{[t]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:a,paddingInlineEnd:o,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${l}-checked, ${l}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:r},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${d})`,marginInlineEnd:`calc(100% - ${c} + ${d})`},[`${l}-unchecked`]:{marginTop:s(r).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${l}`]:{paddingInlineStart:o,paddingInlineEnd:a,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${d})`,marginInlineEnd:`calc(-100% + ${c} - ${d})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:s(n).mul(2).equal(),marginInlineEnd:s(n).mul(-1).mul(2).equal()}},[`&${t}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:s(n).mul(-1).mul(2).equal(),marginInlineEnd:s(n).mul(2).equal()}}}}}},lM=e=>{const{componentCls:t,trackHeight:r,trackMinWidth:n}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},ar(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:n,height:r,lineHeight:ie(r),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),ts(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},cM=e=>{const{fontSize:t,lineHeight:r,controlHeight:n,colorWhite:o}=e,a=t*r,i=n/2,s=2,l=a-s*2,c=i-s*2;return{trackHeight:a,trackHeightSM:i,trackMinWidth:l*2+s*4,trackMinWidthSM:c*2+s*2,trackPadding:s,handleBg:o,handleSize:l,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new bt("#00230b").setA(.2).toRgbString()}`,innerMinMargin:l/2,innerMaxMargin:l+s+s*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+s+s*2}},uM=sr("Switch",e=>{const t=Et(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[lM(t),sM(t),iM(t),aM(t),oM(t)]},cM);var dM=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};const fM=u.forwardRef((e,t)=>{const{prefixCls:r,size:n,disabled:o,loading:a,className:i,rootClassName:s,style:l,checked:c,value:d,defaultChecked:f,defaultValue:v,onChange:h}=e,g=dM(e,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[p,m]=zr(!1,{value:c??d,defaultValue:f??v}),{getPrefixCls:b,direction:y,switch:S}=u.useContext(wt),C=u.useContext(Mr),$=(o??C)||a,x=b("switch",r),w=u.createElement("div",{className:`${x}-handle`},a&&u.createElement(rs,{className:`${x}-loading-icon`})),[E,O,R]=uM(x),I=on(n),P=oe(S==null?void 0:S.className,{[`${x}-small`]:I==="small",[`${x}-loading`]:a,[`${x}-rtl`]:y==="rtl"},i,s,O,R),M=Object.assign(Object.assign({},S==null?void 0:S.style),l),F=(...N)=>{m(N[0]),h==null||h.apply(void 0,N)};return E(u.createElement(Zc,{component:"Switch",disabled:$},u.createElement(yp,Object.assign({},g,{checked:p,onChange:F,prefixCls:x,className:P,style:M,disabled:$,ref:t,loadingIcon:w}))))}),mM=fM;mM.__ANT_SWITCH=!0;export{GM as $,Mn as A,sp as B,XM as C,on as D,Ud as E,oy as F,tI as G,ba as H,ja as I,hR as J,_e as K,ru as L,ft as M,Do as N,Be as O,Xn as P,En as Q,kI as R,Fa as S,vu as T,or as U,X as V,j as W,T as X,Ct as Y,nu as Z,ve as _,Ut as a,Wt as a$,UM as a0,ts as a1,Hr as a2,Ag as a3,To as a4,Fg as a5,mM as a6,jM as a7,zM as a8,ap as a9,YM as aA,xr as aB,Tn as aC,VM as aD,og as aE,JM as aF,E$ as aG,PE as aH,ME as aI,YC as aJ,Jn as aK,qM as aL,Tw as aM,$n as aN,TE as aO,w$ as aP,An as aQ,sa as aR,at as aS,rb as aT,zh as aU,AM as aV,yh as aW,mt as aX,ea as aY,Qc as aZ,In as a_,eT as aa,p2 as ab,br as ac,Ue as ad,_a as ae,dg as af,Aa as ag,gs as ah,Hh as ai,gu as aj,Jh as ak,mg as al,Vr as am,Oa as an,sC as ao,R1 as ap,Bt as aq,KM as ar,fn as as,rs as at,tw as au,Xc as av,K1 as aw,Uc as ax,Tg as ay,Po as az,Nn as b,Vt as b0,Ma as b1,pr as b2,Mr as b3,xI as b4,Zc as b5,wI as b6,Jc as b7,ou as b8,Yf as b9,DM as bA,vw as bB,$a as bC,Qn as bD,Xi as bE,Ri as bF,On as bG,Rn as bH,HM as bI,ox as bJ,Ra as bK,Jd as bL,fI as bM,EE as bN,cx as bO,RP as bP,Dr as bQ,Ac as bR,bv as bS,QM as bT,d$ as bU,xh as bV,Mh as bW,AI as bX,ps as bY,Th as bZ,kM as b_,wR as ba,SR as bb,bt as bc,Vh as bd,Xh as be,Uh as bf,kh as bg,fs as bh,of as bi,nf as bj,Vg as bk,kg as bl,Hg as bm,Wg as bn,Yl as bo,sI as bp,Yh as bq,kR as br,zo as bs,vs as bt,No as bu,Na as bv,yd as bw,NE as bx,ZM as by,sw as bz,cy as c,ry as d,Ww as e,oe as f,LM as g,sr as h,qg as i,lI as j,iI as k,Ah as l,Et as m,wt as n,Fh as o,zr as p,Bg as q,ar as r,Mo as s,Gn as t,Pn as u,e1 as v,xt as w,BM as x,ie as y,pI as z};
@@ -1,4 +1,4 @@
1
- import{c as F,g as G,m as q,j as U,k as X,r as Y,P as Z,l as J,n as Q,o as ee,f as x,p as te,u as oe,q as ne,T as re,s as ae,v as se,K as le}from"./index-Cso0btPH.js";import*as s from"react";import{isValidElement as ie}from"react";import"react-dom";/**
1
+ import{c as F,h as G,m as q,i as U,j as X,r as Y,P as Z,k as J,l as Q,n as ee,f as x,o as te,u as oe,p as ne,T as re,q as ae,s as se,K as le}from"./index-8h59dJlj.js";import*as s from"react";import{isValidElement as ie}from"react";import"react-dom";/**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import*as n from"react";import{M as je,N as Ie,O as re,f as x,Q as ce,U as Me,V as de,A as me,W as j,X as fe,K as ie,Y as ve,Z as _e,u as Ce,$ as ze,a0 as ge,g as He,m as Ke,y as q,a1 as Le,a2 as We,a3 as Te,a4 as Ae,a5 as Be,s as he,o as Fe}from"./index-Cso0btPH.js";import{S as Ve,u as Ue}from"./index-Cj7zTmH9.js";var be=n.createContext(null),we=n.createContext({}),Xe=["prefixCls","className","containerRef"],Ye=function(t){var a=t.prefixCls,o=t.className,r=t.containerRef,l=je(t,Xe),i=n.useContext(we),s=i.panel,b=Ie(s,r);return n.createElement("div",re({className:x("".concat(a,"-content"),o),role:"dialog",ref:b},ce(t,{aria:!0}),{"aria-modal":"true"},l))};function ye(e){return typeof e=="string"&&String(Number(e))===e?(Me(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(e)):e}var pe={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function Ge(e,t){var a,o,r,l=e.prefixCls,i=e.open,s=e.placement,b=e.inline,C=e.push,O=e.forceRender,y=e.autoFocus,E=e.keyboard,f=e.classNames,d=e.rootClassName,u=e.rootStyle,v=e.zIndex,p=e.className,I=e.id,P=e.style,S=e.motion,D=e.width,N=e.height,g=e.children,w=e.mask,M=e.maskClosable,R=e.maskMotion,Q=e.maskClassName,K=e.maskStyle,z=e.afterOpenChange,$=e.onClose,W=e.onMouseEnter,J=e.onMouseOver,ee=e.onMouseLeave,X=e.onClick,te=e.onKeyDown,ne=e.onKeyUp,h=e.styles,T=e.drawerRender,_=n.useRef(),A=n.useRef(),B=n.useRef();n.useImperativeHandle(t,function(){return _.current});var ae=function(k){var Y=k.keyCode,G=k.shiftKey;switch(Y){case ie.TAB:{if(Y===ie.TAB){if(!G&&document.activeElement===B.current){var Z;(Z=A.current)===null||Z===void 0||Z.focus({preventScroll:!0})}else if(G&&document.activeElement===A.current){var le;(le=B.current)===null||le===void 0||le.focus({preventScroll:!0})}}break}case ie.ESC:{$&&E&&(k.stopPropagation(),$(k));break}}};n.useEffect(function(){if(i&&y){var c;(c=_.current)===null||c===void 0||c.focus({preventScroll:!0})}},[i]);var oe=n.useState(!1),F=de(oe,2),H=F[0],L=F[1],m=n.useContext(be),se;typeof C=="boolean"?se=C?{}:{distance:0}:se=C||{};var V=(a=(o=(r=se)===null||r===void 0?void 0:r.distance)!==null&&o!==void 0?o:m==null?void 0:m.pushDistance)!==null&&a!==void 0?a:180,Ne=n.useMemo(function(){return{pushDistance:V,push:function(){L(!0)},pull:function(){L(!1)}}},[V]);n.useEffect(function(){if(i){var c;m==null||(c=m.push)===null||c===void 0||c.call(m)}else{var k;m==null||(k=m.pull)===null||k===void 0||k.call(m)}},[i]),n.useEffect(function(){return function(){var c;m==null||(c=m.pull)===null||c===void 0||c.call(m)}},[]);var Ee=n.createElement(me,re({key:"mask"},R,{visible:w&&i}),function(c,k){var Y=c.className,G=c.style;return n.createElement("div",{className:x("".concat(l,"-mask"),Y,f==null?void 0:f.mask,Q),style:j(j(j({},G),K),h==null?void 0:h.mask),onClick:M&&i?$:void 0,ref:k})}),Pe=typeof S=="function"?S(s):S,U={};if(H&&V)switch(s){case"top":U.transform="translateY(".concat(V,"px)");break;case"bottom":U.transform="translateY(".concat(-V,"px)");break;case"left":U.transform="translateX(".concat(V,"px)");break;default:U.transform="translateX(".concat(-V,"px)");break}s==="left"||s==="right"?U.width=ye(D):U.height=ye(N);var De={onMouseEnter:W,onMouseOver:J,onMouseLeave:ee,onClick:X,onKeyDown:te,onKeyUp:ne},Re=n.createElement(me,re({key:"panel"},Pe,{visible:i,forceRender:O,onVisibleChanged:function(k){z==null||z(k)},removeOnLeave:!1,leavedClassName:"".concat(l,"-content-wrapper-hidden")}),function(c,k){var Y=c.className,G=c.style,Z=n.createElement(Ye,re({id:I,containerRef:k,prefixCls:l,className:x(p,f==null?void 0:f.content),style:j(j({},P),h==null?void 0:h.content)},ce(e,{aria:!0}),De),g);return n.createElement("div",re({className:x("".concat(l,"-content-wrapper"),f==null?void 0:f.wrapper,Y),style:j(j(j({},U),G),h==null?void 0:h.wrapper)},ce(e,{data:!0})),T?T(Z):Z)}),ue=j({},u);return v&&(ue.zIndex=v),n.createElement(be.Provider,{value:Ne},n.createElement("div",{className:x(l,"".concat(l,"-").concat(s),d,fe(fe({},"".concat(l,"-open"),i),"".concat(l,"-inline"),b)),style:ue,tabIndex:-1,ref:_,onKeyDown:ae},Ee,n.createElement("div",{tabIndex:0,ref:A,style:pe,"aria-hidden":"true","data-sentinel":"start"}),Re,n.createElement("div",{tabIndex:0,ref:B,style:pe,"aria-hidden":"true","data-sentinel":"end"})))}var Ze=n.forwardRef(Ge),qe=function(t){var a=t.open,o=a===void 0?!1:a,r=t.prefixCls,l=r===void 0?"rc-drawer":r,i=t.placement,s=i===void 0?"right":i,b=t.autoFocus,C=b===void 0?!0:b,O=t.keyboard,y=O===void 0?!0:O,E=t.width,f=E===void 0?378:E,d=t.mask,u=d===void 0?!0:d,v=t.maskClosable,p=v===void 0?!0:v,I=t.getContainer,P=t.forceRender,S=t.afterOpenChange,D=t.destroyOnClose,N=t.onMouseEnter,g=t.onMouseOver,w=t.onMouseLeave,M=t.onClick,R=t.onKeyDown,Q=t.onKeyUp,K=t.panelRef,z=n.useState(!1),$=de(z,2),W=$[0],J=$[1],ee=n.useState(!1),X=de(ee,2),te=X[0],ne=X[1];ve(function(){ne(!0)},[]);var h=te?o:!1,T=n.useRef(),_=n.useRef();ve(function(){h&&(_.current=document.activeElement)},[h]);var A=function(H){var L;if(J(H),S==null||S(H),!H&&_.current&&!((L=T.current)!==null&&L!==void 0&&L.contains(_.current))){var m;(m=_.current)===null||m===void 0||m.focus({preventScroll:!0})}},B=n.useMemo(function(){return{panel:K}},[K]);if(!P&&!W&&!h&&D)return null;var ae={onMouseEnter:N,onMouseOver:g,onMouseLeave:w,onClick:M,onKeyDown:R,onKeyUp:Q},oe=j(j({},t),{},{open:h,prefixCls:l,placement:s,autoFocus:C,keyboard:y,width:f,mask:u,maskClosable:p,inline:I===!1,afterOpenChange:A,ref:T},ae);return n.createElement(we.Provider,{value:B},n.createElement(_e,{open:h||P||W,autoDestroy:!1,getContainer:I,autoLock:u&&(h||W)},n.createElement(Ze,oe)))};const xe=e=>{var t,a;const{prefixCls:o,title:r,footer:l,extra:i,closable:s,loading:b,onClose:C,headerStyle:O,bodyStyle:y,footerStyle:E,children:f,classNames:d,styles:u}=e,v=Ce("drawer");let p;s===!1?p=void 0:s===void 0||s===!0?p="start":p=(s==null?void 0:s.placement)==="end"?"end":"start";const I=n.useCallback(g=>n.createElement("button",{type:"button",onClick:C,className:x(`${o}-close`,{[`${o}-close-${p}`]:p==="end"})},g),[C,o,p]),[P,S]=ze(ge(e),ge(v),{closable:!0,closeIconRender:I}),D=()=>{var g,w;return!r&&!P?null:n.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(g=v.styles)===null||g===void 0?void 0:g.header),O),u==null?void 0:u.header),className:x(`${o}-header`,{[`${o}-header-close-only`]:P&&!r&&!i},(w=v.classNames)===null||w===void 0?void 0:w.header,d==null?void 0:d.header)},n.createElement("div",{className:`${o}-header-title`},p==="start"&&S,r&&n.createElement("div",{className:`${o}-title`},r)),i&&n.createElement("div",{className:`${o}-extra`},i),p==="end"&&S)},N=()=>{var g,w;if(!l)return null;const M=`${o}-footer`;return n.createElement("div",{className:x(M,(g=v.classNames)===null||g===void 0?void 0:g.footer,d==null?void 0:d.footer),style:Object.assign(Object.assign(Object.assign({},(w=v.styles)===null||w===void 0?void 0:w.footer),E),u==null?void 0:u.footer)},l)};return n.createElement(n.Fragment,null,D(),n.createElement("div",{className:x(`${o}-body`,d==null?void 0:d.body,(t=v.classNames)===null||t===void 0?void 0:t.body),style:Object.assign(Object.assign(Object.assign({},(a=v.styles)===null||a===void 0?void 0:a.body),y),u==null?void 0:u.body)},b?n.createElement(Ve,{active:!0,title:!1,paragraph:{rows:5},className:`${o}-body-skeleton`}):f),N())},Qe=e=>{const t="100%";return{left:`translateX(-${t})`,right:`translateX(${t})`,top:`translateY(-${t})`,bottom:`translateY(${t})`}[e]},Se=(e,t)=>({"&-enter, &-appear":Object.assign(Object.assign({},e),{"&-active":t}),"&-leave":Object.assign(Object.assign({},t),{"&-active":e})}),ke=(e,t)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${t}`}}},Se({opacity:e},{opacity:1})),Je=(e,t)=>[ke(.7,t),Se({transform:Qe(e)},{transform:"none"})],et=e=>{const{componentCls:t,motionDurationSlow:a}=e;return{[t]:{[`${t}-mask-motion`]:ke(0,a),[`${t}-panel-motion`]:["left","right","top","bottom"].reduce((o,r)=>Object.assign(Object.assign({},o),{[`&-${r}`]:Je(r,a)}),{})}}},tt=e=>{const{borderRadiusSM:t,componentCls:a,zIndexPopup:o,colorBgMask:r,colorBgElevated:l,motionDurationSlow:i,motionDurationMid:s,paddingXS:b,padding:C,paddingLG:O,fontSizeLG:y,lineHeightLG:E,lineWidth:f,lineType:d,colorSplit:u,marginXS:v,colorIcon:p,colorIconHover:I,colorBgTextHover:P,colorBgTextActive:S,colorText:D,fontWeightStrong:N,footerPaddingBlock:g,footerPaddingInline:w,calc:M}=e,R=`${a}-content-wrapper`;return{[a]:{position:"fixed",inset:0,zIndex:o,pointerEvents:"none",color:D,"&-pure":{position:"relative",background:l,display:"flex",flexDirection:"column",[`&${a}-left`]:{boxShadow:e.boxShadowDrawerLeft},[`&${a}-right`]:{boxShadow:e.boxShadowDrawerRight},[`&${a}-top`]:{boxShadow:e.boxShadowDrawerUp},[`&${a}-bottom`]:{boxShadow:e.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${a}-mask`]:{position:"absolute",inset:0,zIndex:o,background:r,pointerEvents:"auto"},[R]:{position:"absolute",zIndex:o,maxWidth:"100vw",transition:`all ${i}`,"&-hidden":{display:"none"}},[`&-left > ${R}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowDrawerLeft},[`&-right > ${R}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:e.boxShadowDrawerRight},[`&-top > ${R}`]:{top:0,insetInline:0,boxShadow:e.boxShadowDrawerUp},[`&-bottom > ${R}`]:{bottom:0,insetInline:0,boxShadow:e.boxShadowDrawerDown},[`${a}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:l,pointerEvents:"auto"},[`${a}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${q(C)} ${q(O)}`,fontSize:y,lineHeight:E,borderBottom:`${q(f)} ${d} ${u}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${a}-extra`]:{flex:"none"},[`${a}-close`]:Object.assign({display:"inline-flex",width:M(y).add(b).equal(),height:M(y).add(b).equal(),borderRadius:t,justifyContent:"center",alignItems:"center",color:p,fontWeight:N,fontSize:y,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${s}`,textRendering:"auto",[`&${a}-close-end`]:{marginInlineStart:v},[`&:not(${a}-close-end)`]:{marginInlineEnd:v},"&:hover":{color:I,backgroundColor:P,textDecoration:"none"},"&:active":{backgroundColor:S}},Le(e)),[`${a}-title`]:{flex:1,margin:0,fontWeight:e.fontWeightStrong,fontSize:y,lineHeight:E},[`${a}-body`]:{flex:1,minWidth:0,minHeight:0,padding:O,overflow:"auto",[`${a}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},[`${a}-footer`]:{flexShrink:0,padding:`${q(g)} ${q(w)}`,borderTop:`${q(f)} ${d} ${u}`},"&-rtl":{direction:"rtl"}}}},nt=e=>({zIndexPopup:e.zIndexPopupBase,footerPaddingBlock:e.paddingXS,footerPaddingInline:e.padding}),Oe=He("Drawer",e=>{const t=Ke(e,{});return[tt(t),et(t)]},nt);var $e=function(e,t){var a={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(a[o[r]]=e[o[r]]);return a};const at={distance:180},ot=e=>{const{rootClassName:t,width:a,height:o,size:r="default",mask:l=!0,push:i=at,open:s,afterOpenChange:b,onClose:C,prefixCls:O,getContainer:y,panelRef:E=null,style:f,className:d,visible:u,afterVisibleChange:v,maskStyle:p,drawerStyle:I,contentWrapperStyle:P,destroyOnClose:S,destroyOnHidden:D}=e,N=$e(e,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","panelRef","style","className","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle","destroyOnClose","destroyOnHidden"]),{getPopupContainer:g,getPrefixCls:w,direction:M,className:R,style:Q,classNames:K,styles:z}=Ce("drawer"),$=w("drawer",O),[W,J,ee]=Oe($),X=y===void 0&&g?()=>g(document.body):y,te=x({"no-mask":!l,[`${$}-rtl`]:M==="rtl"},t,J,ee),ne=n.useMemo(()=>a??(r==="large"?736:378),[a,r]),h=n.useMemo(()=>o??(r==="large"?736:378),[o,r]),T={motionName:he($,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},_=L=>({motionName:he($,`panel-motion-${L}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),A=Ue(),B=We(E,A),[ae,oe]=Te("Drawer",N.zIndex),{classNames:F={},styles:H={}}=N;return W(n.createElement(Ae,{form:!0,space:!0},n.createElement(Be.Provider,{value:oe},n.createElement(qe,Object.assign({prefixCls:$,onClose:C,maskMotion:T,motion:_},N,{classNames:{mask:x(F.mask,K.mask),content:x(F.content,K.content),wrapper:x(F.wrapper,K.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},H.mask),p),z.mask),content:Object.assign(Object.assign(Object.assign({},H.content),I),z.content),wrapper:Object.assign(Object.assign(Object.assign({},H.wrapper),P),z.wrapper)},open:s??u,mask:l,push:i,width:ne,height:h,style:Object.assign(Object.assign({},Q),f),className:x(R,d),rootClassName:te,getContainer:X,afterOpenChange:b??v,panelRef:B,zIndex:ae,destroyOnClose:D??S}),n.createElement(xe,Object.assign({prefixCls:$},N,{onClose:C}))))))},rt=e=>{const{prefixCls:t,style:a,className:o,placement:r="right"}=e,l=$e(e,["prefixCls","style","className","placement"]),{getPrefixCls:i}=n.useContext(Fe),s=i("drawer",t),[b,C,O]=Oe(s),y=x(s,`${s}-pure`,`${s}-${r}`,C,O,o);return b(n.createElement("div",{className:y,style:a},n.createElement(xe,Object.assign({prefixCls:s},l))))};ot._InternalPanelDoNotUseOrYouWillBeFired=rt;export{ot as D};
1
+ import*as n from"react";import{M as je,N as Ie,O as re,f as x,Q as ce,U as Me,V as de,A as me,W as j,X as fe,K as ie,Y as ve,Z as _e,u as Ce,$ as ze,a0 as ge,h as He,m as Ke,y as Z,a1 as Le,a2 as We,a3 as Te,a4 as Ae,a5 as Be,q as he,n as Fe}from"./index-8h59dJlj.js";import{S as Ve,u as Ue}from"./index-DoUk2Ei_.js";var be=n.createContext(null),we=n.createContext({}),Xe=["prefixCls","className","containerRef"],Ye=function(t){var a=t.prefixCls,o=t.className,r=t.containerRef,l=je(t,Xe),i=n.useContext(we),s=i.panel,b=Ie(s,r);return n.createElement("div",re({className:x("".concat(a,"-content"),o),role:"dialog",ref:b},ce(t,{aria:!0}),{"aria-modal":"true"},l))};function ye(e){return typeof e=="string"&&String(Number(e))===e?(Me(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(e)):e}var pe={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function Ge(e,t){var a,o,r,l=e.prefixCls,i=e.open,s=e.placement,b=e.inline,C=e.push,O=e.forceRender,y=e.autoFocus,E=e.keyboard,f=e.classNames,d=e.rootClassName,u=e.rootStyle,v=e.zIndex,p=e.className,I=e.id,P=e.style,S=e.motion,D=e.width,N=e.height,g=e.children,w=e.mask,M=e.maskClosable,R=e.maskMotion,Q=e.maskClassName,K=e.maskStyle,z=e.afterOpenChange,$=e.onClose,W=e.onMouseEnter,J=e.onMouseOver,ee=e.onMouseLeave,X=e.onClick,te=e.onKeyDown,ne=e.onKeyUp,h=e.styles,T=e.drawerRender,_=n.useRef(),A=n.useRef(),B=n.useRef();n.useImperativeHandle(t,function(){return _.current});var ae=function(k){var Y=k.keyCode,G=k.shiftKey;switch(Y){case ie.TAB:{if(Y===ie.TAB){if(!G&&document.activeElement===B.current){var q;(q=A.current)===null||q===void 0||q.focus({preventScroll:!0})}else if(G&&document.activeElement===A.current){var le;(le=B.current)===null||le===void 0||le.focus({preventScroll:!0})}}break}case ie.ESC:{$&&E&&(k.stopPropagation(),$(k));break}}};n.useEffect(function(){if(i&&y){var c;(c=_.current)===null||c===void 0||c.focus({preventScroll:!0})}},[i]);var oe=n.useState(!1),F=de(oe,2),H=F[0],L=F[1],m=n.useContext(be),se;typeof C=="boolean"?se=C?{}:{distance:0}:se=C||{};var V=(a=(o=(r=se)===null||r===void 0?void 0:r.distance)!==null&&o!==void 0?o:m==null?void 0:m.pushDistance)!==null&&a!==void 0?a:180,Ne=n.useMemo(function(){return{pushDistance:V,push:function(){L(!0)},pull:function(){L(!1)}}},[V]);n.useEffect(function(){if(i){var c;m==null||(c=m.push)===null||c===void 0||c.call(m)}else{var k;m==null||(k=m.pull)===null||k===void 0||k.call(m)}},[i]),n.useEffect(function(){return function(){var c;m==null||(c=m.pull)===null||c===void 0||c.call(m)}},[]);var Ee=n.createElement(me,re({key:"mask"},R,{visible:w&&i}),function(c,k){var Y=c.className,G=c.style;return n.createElement("div",{className:x("".concat(l,"-mask"),Y,f==null?void 0:f.mask,Q),style:j(j(j({},G),K),h==null?void 0:h.mask),onClick:M&&i?$:void 0,ref:k})}),Pe=typeof S=="function"?S(s):S,U={};if(H&&V)switch(s){case"top":U.transform="translateY(".concat(V,"px)");break;case"bottom":U.transform="translateY(".concat(-V,"px)");break;case"left":U.transform="translateX(".concat(V,"px)");break;default:U.transform="translateX(".concat(-V,"px)");break}s==="left"||s==="right"?U.width=ye(D):U.height=ye(N);var De={onMouseEnter:W,onMouseOver:J,onMouseLeave:ee,onClick:X,onKeyDown:te,onKeyUp:ne},Re=n.createElement(me,re({key:"panel"},Pe,{visible:i,forceRender:O,onVisibleChanged:function(k){z==null||z(k)},removeOnLeave:!1,leavedClassName:"".concat(l,"-content-wrapper-hidden")}),function(c,k){var Y=c.className,G=c.style,q=n.createElement(Ye,re({id:I,containerRef:k,prefixCls:l,className:x(p,f==null?void 0:f.content),style:j(j({},P),h==null?void 0:h.content)},ce(e,{aria:!0}),De),g);return n.createElement("div",re({className:x("".concat(l,"-content-wrapper"),f==null?void 0:f.wrapper,Y),style:j(j(j({},U),G),h==null?void 0:h.wrapper)},ce(e,{data:!0})),T?T(q):q)}),ue=j({},u);return v&&(ue.zIndex=v),n.createElement(be.Provider,{value:Ne},n.createElement("div",{className:x(l,"".concat(l,"-").concat(s),d,fe(fe({},"".concat(l,"-open"),i),"".concat(l,"-inline"),b)),style:ue,tabIndex:-1,ref:_,onKeyDown:ae},Ee,n.createElement("div",{tabIndex:0,ref:A,style:pe,"aria-hidden":"true","data-sentinel":"start"}),Re,n.createElement("div",{tabIndex:0,ref:B,style:pe,"aria-hidden":"true","data-sentinel":"end"})))}var qe=n.forwardRef(Ge),Ze=function(t){var a=t.open,o=a===void 0?!1:a,r=t.prefixCls,l=r===void 0?"rc-drawer":r,i=t.placement,s=i===void 0?"right":i,b=t.autoFocus,C=b===void 0?!0:b,O=t.keyboard,y=O===void 0?!0:O,E=t.width,f=E===void 0?378:E,d=t.mask,u=d===void 0?!0:d,v=t.maskClosable,p=v===void 0?!0:v,I=t.getContainer,P=t.forceRender,S=t.afterOpenChange,D=t.destroyOnClose,N=t.onMouseEnter,g=t.onMouseOver,w=t.onMouseLeave,M=t.onClick,R=t.onKeyDown,Q=t.onKeyUp,K=t.panelRef,z=n.useState(!1),$=de(z,2),W=$[0],J=$[1],ee=n.useState(!1),X=de(ee,2),te=X[0],ne=X[1];ve(function(){ne(!0)},[]);var h=te?o:!1,T=n.useRef(),_=n.useRef();ve(function(){h&&(_.current=document.activeElement)},[h]);var A=function(H){var L;if(J(H),S==null||S(H),!H&&_.current&&!((L=T.current)!==null&&L!==void 0&&L.contains(_.current))){var m;(m=_.current)===null||m===void 0||m.focus({preventScroll:!0})}},B=n.useMemo(function(){return{panel:K}},[K]);if(!P&&!W&&!h&&D)return null;var ae={onMouseEnter:N,onMouseOver:g,onMouseLeave:w,onClick:M,onKeyDown:R,onKeyUp:Q},oe=j(j({},t),{},{open:h,prefixCls:l,placement:s,autoFocus:C,keyboard:y,width:f,mask:u,maskClosable:p,inline:I===!1,afterOpenChange:A,ref:T},ae);return n.createElement(we.Provider,{value:B},n.createElement(_e,{open:h||P||W,autoDestroy:!1,getContainer:I,autoLock:u&&(h||W)},n.createElement(qe,oe)))};const xe=e=>{var t,a;const{prefixCls:o,title:r,footer:l,extra:i,closable:s,loading:b,onClose:C,headerStyle:O,bodyStyle:y,footerStyle:E,children:f,classNames:d,styles:u}=e,v=Ce("drawer");let p;s===!1?p=void 0:s===void 0||s===!0?p="start":p=(s==null?void 0:s.placement)==="end"?"end":"start";const I=n.useCallback(g=>n.createElement("button",{type:"button",onClick:C,className:x(`${o}-close`,{[`${o}-close-${p}`]:p==="end"})},g),[C,o,p]),[P,S]=ze(ge(e),ge(v),{closable:!0,closeIconRender:I}),D=()=>{var g,w;return!r&&!P?null:n.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(g=v.styles)===null||g===void 0?void 0:g.header),O),u==null?void 0:u.header),className:x(`${o}-header`,{[`${o}-header-close-only`]:P&&!r&&!i},(w=v.classNames)===null||w===void 0?void 0:w.header,d==null?void 0:d.header)},n.createElement("div",{className:`${o}-header-title`},p==="start"&&S,r&&n.createElement("div",{className:`${o}-title`},r)),i&&n.createElement("div",{className:`${o}-extra`},i),p==="end"&&S)},N=()=>{var g,w;if(!l)return null;const M=`${o}-footer`;return n.createElement("div",{className:x(M,(g=v.classNames)===null||g===void 0?void 0:g.footer,d==null?void 0:d.footer),style:Object.assign(Object.assign(Object.assign({},(w=v.styles)===null||w===void 0?void 0:w.footer),E),u==null?void 0:u.footer)},l)};return n.createElement(n.Fragment,null,D(),n.createElement("div",{className:x(`${o}-body`,d==null?void 0:d.body,(t=v.classNames)===null||t===void 0?void 0:t.body),style:Object.assign(Object.assign(Object.assign({},(a=v.styles)===null||a===void 0?void 0:a.body),y),u==null?void 0:u.body)},b?n.createElement(Ve,{active:!0,title:!1,paragraph:{rows:5},className:`${o}-body-skeleton`}):f),N())},Qe=e=>{const t="100%";return{left:`translateX(-${t})`,right:`translateX(${t})`,top:`translateY(-${t})`,bottom:`translateY(${t})`}[e]},Se=(e,t)=>({"&-enter, &-appear":Object.assign(Object.assign({},e),{"&-active":t}),"&-leave":Object.assign(Object.assign({},t),{"&-active":e})}),ke=(e,t)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${t}`}}},Se({opacity:e},{opacity:1})),Je=(e,t)=>[ke(.7,t),Se({transform:Qe(e)},{transform:"none"})],et=e=>{const{componentCls:t,motionDurationSlow:a}=e;return{[t]:{[`${t}-mask-motion`]:ke(0,a),[`${t}-panel-motion`]:["left","right","top","bottom"].reduce((o,r)=>Object.assign(Object.assign({},o),{[`&-${r}`]:Je(r,a)}),{})}}},tt=e=>{const{borderRadiusSM:t,componentCls:a,zIndexPopup:o,colorBgMask:r,colorBgElevated:l,motionDurationSlow:i,motionDurationMid:s,paddingXS:b,padding:C,paddingLG:O,fontSizeLG:y,lineHeightLG:E,lineWidth:f,lineType:d,colorSplit:u,marginXS:v,colorIcon:p,colorIconHover:I,colorBgTextHover:P,colorBgTextActive:S,colorText:D,fontWeightStrong:N,footerPaddingBlock:g,footerPaddingInline:w,calc:M}=e,R=`${a}-content-wrapper`;return{[a]:{position:"fixed",inset:0,zIndex:o,pointerEvents:"none",color:D,"&-pure":{position:"relative",background:l,display:"flex",flexDirection:"column",[`&${a}-left`]:{boxShadow:e.boxShadowDrawerLeft},[`&${a}-right`]:{boxShadow:e.boxShadowDrawerRight},[`&${a}-top`]:{boxShadow:e.boxShadowDrawerUp},[`&${a}-bottom`]:{boxShadow:e.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${a}-mask`]:{position:"absolute",inset:0,zIndex:o,background:r,pointerEvents:"auto"},[R]:{position:"absolute",zIndex:o,maxWidth:"100vw",transition:`all ${i}`,"&-hidden":{display:"none"}},[`&-left > ${R}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowDrawerLeft},[`&-right > ${R}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:e.boxShadowDrawerRight},[`&-top > ${R}`]:{top:0,insetInline:0,boxShadow:e.boxShadowDrawerUp},[`&-bottom > ${R}`]:{bottom:0,insetInline:0,boxShadow:e.boxShadowDrawerDown},[`${a}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:l,pointerEvents:"auto"},[`${a}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${Z(C)} ${Z(O)}`,fontSize:y,lineHeight:E,borderBottom:`${Z(f)} ${d} ${u}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${a}-extra`]:{flex:"none"},[`${a}-close`]:Object.assign({display:"inline-flex",width:M(y).add(b).equal(),height:M(y).add(b).equal(),borderRadius:t,justifyContent:"center",alignItems:"center",color:p,fontWeight:N,fontSize:y,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${s}`,textRendering:"auto",[`&${a}-close-end`]:{marginInlineStart:v},[`&:not(${a}-close-end)`]:{marginInlineEnd:v},"&:hover":{color:I,backgroundColor:P,textDecoration:"none"},"&:active":{backgroundColor:S}},Le(e)),[`${a}-title`]:{flex:1,margin:0,fontWeight:e.fontWeightStrong,fontSize:y,lineHeight:E},[`${a}-body`]:{flex:1,minWidth:0,minHeight:0,padding:O,overflow:"auto",[`${a}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},[`${a}-footer`]:{flexShrink:0,padding:`${Z(g)} ${Z(w)}`,borderTop:`${Z(f)} ${d} ${u}`},"&-rtl":{direction:"rtl"}}}},nt=e=>({zIndexPopup:e.zIndexPopupBase,footerPaddingBlock:e.paddingXS,footerPaddingInline:e.padding}),Oe=He("Drawer",e=>{const t=Ke(e,{});return[tt(t),et(t)]},nt);var $e=function(e,t){var a={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(a[o[r]]=e[o[r]]);return a};const at={distance:180},ot=e=>{const{rootClassName:t,width:a,height:o,size:r="default",mask:l=!0,push:i=at,open:s,afterOpenChange:b,onClose:C,prefixCls:O,getContainer:y,panelRef:E=null,style:f,className:d,visible:u,afterVisibleChange:v,maskStyle:p,drawerStyle:I,contentWrapperStyle:P,destroyOnClose:S,destroyOnHidden:D}=e,N=$e(e,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","panelRef","style","className","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle","destroyOnClose","destroyOnHidden"]),{getPopupContainer:g,getPrefixCls:w,direction:M,className:R,style:Q,classNames:K,styles:z}=Ce("drawer"),$=w("drawer",O),[W,J,ee]=Oe($),X=y===void 0&&g?()=>g(document.body):y,te=x({"no-mask":!l,[`${$}-rtl`]:M==="rtl"},t,J,ee),ne=n.useMemo(()=>a??(r==="large"?736:378),[a,r]),h=n.useMemo(()=>o??(r==="large"?736:378),[o,r]),T={motionName:he($,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},_=L=>({motionName:he($,`panel-motion-${L}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),A=Ue(),B=We(E,A),[ae,oe]=Te("Drawer",N.zIndex),{classNames:F={},styles:H={}}=N;return W(n.createElement(Ae,{form:!0,space:!0},n.createElement(Be.Provider,{value:oe},n.createElement(Ze,Object.assign({prefixCls:$,onClose:C,maskMotion:T,motion:_},N,{classNames:{mask:x(F.mask,K.mask),content:x(F.content,K.content),wrapper:x(F.wrapper,K.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},H.mask),p),z.mask),content:Object.assign(Object.assign(Object.assign({},H.content),I),z.content),wrapper:Object.assign(Object.assign(Object.assign({},H.wrapper),P),z.wrapper)},open:s??u,mask:l,push:i,width:ne,height:h,style:Object.assign(Object.assign({},Q),f),className:x(R,d),rootClassName:te,getContainer:X,afterOpenChange:b??v,panelRef:B,zIndex:ae,destroyOnClose:D??S}),n.createElement(xe,Object.assign({prefixCls:$},N,{onClose:C}))))))},rt=e=>{const{prefixCls:t,style:a,className:o,placement:r="right"}=e,l=$e(e,["prefixCls","style","className","placement"]),{getPrefixCls:i}=n.useContext(Fe),s=i("drawer",t),[b,C,O]=Oe(s),y=x(s,`${s}-pure`,`${s}-${r}`,C,O,o);return b(n.createElement("div",{className:y,style:a},n.createElement(xe,Object.assign({prefixCls:s},l))))};ot._InternalPanelDoNotUseOrYouWillBeFired=rt;export{ot as D};
@@ -1,4 +1,4 @@
1
- import{jsxs as d,jsx as e,Fragment as Te}from"react/jsx-runtime";import Ze,{useState as v,forwardRef as Ue,useEffect as K,useMemo as he,useImperativeHandle as Xe,useRef as se}from"react";import{c as Ee,a8 as ke,b as Je,L as re,d as q,a as Ge,h as Ne,i as R,F as me,a9 as De,I as Fe,S as J,aa as Ye,ab as Qe,B as Q,R as te,a6 as de}from"./index-Cso0btPH.js";import{X as eu}from"./x-B-FuEh84.js";import{P as Ce}from"./plus-C0aV3pP-.js";import{M as Be,s as be}from"./index-Cj7zTmH9.js";import{S as uu}from"./index-CINq9yUm.js";/* empty css *//**
1
+ import{jsxs as d,jsx as e,Fragment as Te}from"react/jsx-runtime";import Ze,{useState as v,forwardRef as Ue,useEffect as K,useMemo as he,useImperativeHandle as Xe,useRef as se}from"react";import{c as Ee,a8 as ke,a as Je,L as re,d as q,g as Ge,x as Ne,F as R,b as me,a9 as De,I as Fe,S as J,aa as Ye,ab as Qe,B as Q,R as te,a6 as de}from"./index-8h59dJlj.js";import{X as eu}from"./x-CmbLQ9dc.js";import{P as Ce}from"./plus-CnVxGdOo.js";import{M as Be,s as be}from"./index-DoUk2Ei_.js";import{S as uu}from"./index-CVis9Agw.js";/* empty css *//**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -154,4 +154,4 @@ import{jsxs as d,jsx as e,Fragment as Te}from"react/jsx-runtime";import Ze,{useS
154
154
  font-size: 12px;
155
155
  font-weight: 500;
156
156
  margin-left: 8px;
157
- `;const fe=Ue(({dataSource:n,value:s=[],onConfirm:r,maxCount:t=0,searchPlaceholder:h="\u641C\u7D22...",title:f="",showSearch:b=!0,filterOption:p,renderItem:c,renderSelectedItem:B,className:O,style:S,styles:w,height:F,width:j},D)=>{const l=Ge(),u=Ne(Ne({theme:R,mode:"light"},l),w),[a,i]=v(s),[E,m]=v("");K(()=>{i(s)},[s]),he(()=>new Set(s.map(o=>o.key)),[s]);const N=he(()=>new Set(a.map(o=>o.key)),[a]);Xe(D,()=>({getSelectedItems:()=>a,confirm:()=>{r==null||r(a)}}),[a,r]);const T=p||((o,x)=>{var H;if(!o)return!0;const _=o.toLowerCase();return x.label.toLowerCase().includes(_)||((H=x.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(_)))||!1}),W=he(()=>(n||[]).filter(o=>T(E,o)),[n,E,T]),y=o=>{const x=N.has(o.key);let _;if(x)_=(a||[]).filter(H=>H.key!==o.key);else{if(t>0&&a.length>=t)return;_=[...a,o]}i(_)},C=(o,x)=>{i(_=>_.map(V=>V.key==o?{...V,tags:x}:V))},I=o=>{const x=(a||[]).filter(_=>_.key!==o.key);i(x)},A=o=>N.has(o);return t>0&&a.length>=t,d(hu,{$theme:u.theme||R,$width:j,$height:F,className:O,style:S,children:[d($e,{$theme:u.theme||R,style:{flex:1},children:[b&&e(fu,{$theme:u.theme||R,children:d("div",{style:{position:"relative"},children:[e(Fu,{children:e(nu,{size:16})}),e(gu,{$theme:u.theme||R,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(Ie,{children:W.length===0?e(Me,{$theme:u.theme||R,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):W.map(o=>{const x=A(o.key);return d(Le,{$theme:u.theme||R,$selected:x,children:[e(ze,{$theme:u.theme||R,children:c?c(o):o.label}),x&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),I(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!x&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),y(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),d($e,{$theme:u.theme||R,style:{flex:1},children:[d(mu,{$theme:u.theme||R,children:[t>0?`\u5DF2\u9009\uFF1A${a.length}/${t}\u4E2A${f}`:`\u5DF2\u9009\uFF1A${a.length}\u4E2A${f}`,e(pu,{$theme:u.theme||R,onClick:o=>{o.stopPropagation(),i([])},children:"\u6E05\u7A7A"})]}),e(Ie,{children:a.length===0?e(Me,{$theme:u.theme||R,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):a.map(o=>{var _,H,V;const x=ee=>C(o.key,ee);return d(Le,{$theme:u.theme||R,children:[e(ze,{$theme:u.theme||R,children:B?B(o,x):o.label}),e(Re,{size:14,color:((V=(H=(_=u.theme)==null?void 0:_.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ee=>{ee.stopPropagation(),I(o)}})]},o.key)})})]})]})});fe.displayName="SearchableSelector";const we="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%23FFCC3C'/%3e%3cpath%20d='M13.3263%2012.7917H7.53763C7.33426%2012.8116%207.17923%2012.9825%207.17923%2013.1867C7.17923%2013.3909%207.33426%2013.5618%207.53763%2013.5817H13.3277C13.3828%2013.5871%2013.4384%2013.5809%2013.4909%2013.5634C13.5435%2013.546%2013.5918%2013.5178%2013.6328%2013.4806C13.6738%2013.4434%2013.7066%2013.3981%2013.729%2013.3474C13.7514%2013.2968%2013.763%2013.2421%2013.763%2013.1867C13.763%2013.1313%2013.7514%2013.0766%2013.729%2013.026C13.7066%2012.9753%2013.6738%2012.93%2013.6328%2012.8928C13.5918%2012.8556%2013.5435%2012.8274%2013.4909%2012.8099C13.4384%2012.7925%2013.3828%2012.7863%2013.3277%2012.7917H13.3263ZM9.19742%207.60418L8.84232%208.55193H9.57339L9.19742%207.60418Z'%20fill='white'/%3e%3cpath%20d='M15.3211%2014.7707V6.9692H14.4704V14.3543H6.70511C6.06668%2014.3392%205.55704%2013.8173%205.55704%2013.1788C5.55704%2012.5402%206.06668%2012.0184%206.70511%2012.0033H13.352C13.4644%2012.0075%2013.5735%2011.9648%2013.653%2011.8852C13.6923%2011.8459%2013.7231%2011.7988%2013.7434%2011.747C13.7638%2011.6952%2013.7731%2011.6398%2013.771%2011.5842V5.20102C13.7736%205.14526%2013.7646%205.08958%2013.7445%205.03752C13.7244%204.98546%2013.6936%204.93816%2013.6542%204.89865C13.6148%204.85915%2013.5675%204.82832%2013.5155%204.80812C13.4634%204.78792%2013.4077%204.7788%2013.352%204.78134H6.70511C5.60281%204.80136%204.71609%205.69369%204.70291%206.79599V13.1759C4.71609%2014.283%205.61038%2015.1773%206.71756%2015.1905H14.8893C15.0042%2015.1994%2015.1173%2015.1585%2015.1999%2015.0782C15.2407%2015.0385%2015.2727%2014.9905%2015.2936%2014.9375C15.3145%2014.8845%2015.3239%2014.8276%2015.3211%2014.7707ZM8.98782%206.78585H9.44888L10.7213%209.92562H10.2475L9.9075%209.06759H8.51871L8.19742%209.92562H7.72354L8.98782%206.78585Z'%20fill='white'/%3e%3c/svg%3e",{Item:Eu}=me,Cu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,defaultAnswer:f,form:b})=>{const[p,c]=v([]),[B,O]=v([]),[S,w]=v(!1),[F,j]=v(!1),D=se(null),{fetchSensitiveLibrary:l}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{u()},[]),K(()=>{if(h&&(p==null?void 0:p.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],N=[];m.forEach(k=>{const T=(p||[]).find(W=>W.key===k);T&&N.push({key:T.key,label:T.label})}),O(N)}},[h,p]),K(()=>{f&&j(!0)},[f]);const u=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const N=((m==null?void 0:m.records)||[]).map(k=>({key:k.id+"",label:k.name}));c(N)}}catch(m){console.error(m)}},a=(m,N)=>{switch(m){case"removeItem":const k=B.filter(T=>T.key!==N.key);O([...k]),i(k);break}},i=m=>{const N=m.map(k=>(k==null?void 0:k.key)||"").filter(k=>k).join(",");t&&t("sensitive_selected",N)},E=()=>{var N;const m=((N=D.current)==null?void 0:N.getSelectedItems())||[];O(m),w(!1),i(m)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:we}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>w(!0),children:"\u6DFB\u52A0"})]}),e(De,{checked:F,onChange:m=>{j(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:lu}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),F&&e(Eu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(Fe.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(ye,{countText:(B==null?void 0:B.length)>0?`\u5DF2\u9009\uFF1A${B==null?void 0:B.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:a,data:B}),e(Be,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:S,onOk:E,onCancel:()=>w(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(fe,{ref:D,dataSource:p,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:m=>d("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m.label,children:m.label})]}),renderSelectedItem:(m,N)=>d("div",{className:"flex items-center",children:[e("img",{src:we,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:m.label})})]})})})]})},xe="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%2300B2F9'/%3e%3cpath%20d='M5.3125%2013.9672V13.975C5.32812%2014.6938%205.89922%2015.2734%206.61875%2015.2734H13.9062C14.3375%2015.2734%2014.6875%2014.9289%2014.6875%2014.4977V5.50703C14.6875%205.40447%2014.6673%205.30292%2014.628%205.20818C14.5887%205.11344%2014.5312%205.02736%2014.4586%204.95488C14.3861%204.8824%2014.2999%204.82492%2014.2052%204.78575C14.1104%204.74657%2014.0088%204.72646%2013.9062%204.72656H6.875C6.01172%204.72656%205.3125%205.42031%205.3125%206.28359V13.9672ZM7.5%209.24531V6.25C7.5%206.07813%207.64062%205.9375%207.8125%205.9375H9.6875C9.86016%205.9375%2010%206.07813%2010%206.25V9.24531C10%209.30716%209.98175%209.36762%209.94741%209.41906C9.91308%209.47049%209.86425%209.51058%209.80712%209.53426C9.74999%209.55793%209.68712%209.56412%209.62647%209.55204C9.56581%209.53996%209.51011%209.51016%209.46641%209.46641L8.97109%208.97109C8.94207%208.94204%208.90761%208.91899%208.86967%208.90326C8.83173%208.88754%208.79107%208.87944%208.75%208.87944C8.70893%208.87944%208.66827%208.88754%208.63033%208.90326C8.59239%208.91899%208.55793%208.94204%208.52891%208.97109L8.03359%209.46641C7.98989%209.51016%207.93418%209.53996%207.87353%209.55204C7.81288%209.56412%207.75001%209.55793%207.69288%209.53426C7.63575%209.51058%207.58692%209.47049%207.55259%209.41906C7.51825%209.36762%207.49995%209.30716%207.5%209.24531ZM6.54375%2014.2063C6.45208%2014.1156%206.40625%2014.0052%206.40625%2013.875C6.40625%2013.7458%206.45208%2013.6354%206.54375%2013.5438C6.6349%2013.4521%206.74531%2013.4062%206.875%2013.4062H13.5938V14.3438H6.875C6.74531%2014.3438%206.6349%2014.2979%206.54375%2014.2063Z'%20fill='white'/%3e%3c/svg%3e",Bu=({url:n,token:s,role:r,sectionData:t,createBy:h,eventsEmit:f})=>{const[b,p]=v(),[c,B]=v([]),[O,S]=v(!1),w=se(null),[F,j]=v(!1),[D,l]=v([]),u=se(new Map).current,{fetchKnowledgeBase:a,getBizLabelLabels:i}=pe({url:n,token:s,role:r,eventsEmit:f}),E=se(!1);K(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),K(()=>{if(t&&(b==null?void 0:b.length)>0){const y=t==null?void 0:t.knowledge_base_name_source,C=y&&(Array.isArray(y)?y:y.split(";"));let I=[];(C||[]).forEach(A=>{const o=((t==null?void 0:t.selectedKnowledgeBase)||[]).find(_=>_.name==A),x=(b||[]).find(_=>_.knowledge_base_name_source===A);if(x){const{key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee}=x;I.push({key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee,tags:o==null?void 0:o.labels})}}),B(I)}},[t,b]);const m=async y=>{try{const C=await a(y);if(C){const I=(C||[]).map(A=>({key:A.id,label:A.kbName,knowledge_base_name:A.primitiveName,knowledge_base_name_source:A.kbName}));p(I)}}catch(C){console.error(C)}},N=(y,C)=>{switch(y){case"removeItem":const I=c.filter(o=>o.key!==C.key);B([...I]),k(I);break;case"removeTag":const A=c.findIndex(o=>o.key==C.key);A!==-1&&(c[A]=C),B([...c]),k(c);break}},k=y=>{const C=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),I=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),A=(y||[]).filter(o=>{var x;return Array.isArray(o==null?void 0:o.tags)&&((x=o.tags)==null?void 0:x.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name,labels:o.tags}));f&&f("knowledge_selected",{knowledge_base_name:C,knowledge_base_name_source:I,selectedKnowledgeBase:A})},T=()=>{var C;const y=((C=w.current)==null?void 0:C.getSelectedItems())||[];B(y),S(!1),k(y)},W=async(y,C)=>{if(y){const I=u.get(C);if(I){l(I);return}if(!F)try{j(!0);const A=await i({kbNames:[C]});if(Array.isArray(A)){const o=A.length?A[0].label:"",x=o?(o||"").split(",").map(_=>({label:_,value:_})):[];u.set(C,x),l(x)}j(!1)}catch(A){console.error("Error fetching data:",A),j(!1)}}};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:xe}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:N,data:c}),e(Be,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:T,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:w,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:y=>d("div",{className:"flex ",children:[e("img",{src:xe,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.label,children:y.label})]}),renderSelectedItem:(y,C)=>d("div",{className:"flex ",children:[e("img",{src:xe,alt:"add"}),d("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:y.label}),e(J,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:y.tags||[],onChange:I=>{C(I)},style:{width:250},options:D,loading:F,onOpenChange:I=>{W(I,y.knowledge_base_name)}})]})]})})})]})},yu=Ze.memo(Bu),_e="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%23925BFF'/%3e%3cpath%20d='M11.9971%2011.265C15.249%2011.265%2017.8891%2010.443%2017.8891%209.423V7.95288C17.8891%206.93291%2015.2492%206.11084%2011.9971%206.11084C8.74513%206.11084%206.10504%206.93276%206.10504%207.95288V9.42285C6.10504%2010.437%208.73898%2011.265%2011.9971%2011.265Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2014.577C15.249%2014.577%2017.8891%2013.7551%2017.8891%2012.7349V10.527C17.8891%2011.5469%2015.2492%2012.369%2011.9971%2012.369C8.74513%2012.369%206.10504%2011.5471%206.10504%2010.527V12.7349C6.10504%2013.749%208.73898%2014.577%2011.9971%2014.577Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2015.681C8.7451%2015.681%206.11102%2014.859%206.11102%2013.839V16.0469C6.11102%2017.0609%208.74496%2017.889%2012.0031%2017.889C15.255%2017.889%2017.8951%2017.0671%2017.8951%2016.0469V13.8391C17.889%2014.859%2015.249%2015.681%2011.9971%2015.681Z'%20fill='white'/%3e%3c/svg%3e",Oe=10,bu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,disabled:f})=>{const[b,p]=v([]),[c,B]=v([]),[O,S]=v(!1),w=se(null),{fetchDatabases:F}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{j()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(b||[]).find(E=>E.key===a.key);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),B(u)}},[h,b]);const j=async()=>{try{const u=await F();if(u){const a=(u||[]).map(i=>({key:i.primitiveName,label:i.name}));p(a)}}catch(u){console.error(u)}},D=(u,a)=>{switch(u){case"removeItem":const i=c.filter(E=>E.key!==a.key);B([...i]),t&&t("database_selected",i);break}},l=()=>{var a;const u=((a=w.current)==null?void 0:a.getSelectedItems())||[];B(u),S(!1),t&&t("database_selected",u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:_e}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),disabled:c.length>=Oe||f,children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:D,data:c}),e(Be,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:l,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:w,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Oe,renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:_e,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:(u,a)=>d("div",{className:"flex items-center",children:[e("img",{src:_e,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},ve="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%2300C1B8'/%3e%3cpath%20d='M17.9887%2012.582C18.1207%2013.6621%2017.2267%2014.5801%2016.1526%2014.4901C15.3306%2014.4181%2014.6645%2013.7521%2014.6045%2012.924C14.5745%2012.558%2014.6645%2012.21%2014.8445%2011.9159C14.9285%2011.7779%2014.9045%2011.6039%2014.8025%2011.4899L14.3885%2011.0339C14.2805%2010.9139%2014.1005%2010.8839%2013.9565%2010.9559C13.6144%2011.1239%2013.2304%2011.2199%2012.8224%2011.2199C12.6244%2011.2199%2012.4324%2011.1959%2012.2464%2011.1539C12.0963%2011.1179%2011.9463%2011.1779%2011.8563%2011.3039L11.2803%2012.1259C11.1783%2012.276%2011.1963%2012.474%2011.3223%2012.606C11.8983%2013.188%2012.2464%2013.9921%2012.2284%2014.8741C12.1924%2016.4702%2010.9203%2017.7963%209.32417%2017.9043C7.45804%2018.0243%205.90994%2016.4942%206.00595%2014.6281C6.08995%2013.038%207.38604%2011.7599%208.97614%2011.6879C9.42017%2011.6699%209.8402%2011.7419%2010.2302%2011.8919C10.3922%2011.9519%2010.5722%2011.8979%2010.6743%2011.7599L11.1663%2011.0579C11.2743%2010.9019%2011.2503%2010.6919%2011.1123%2010.5658C10.5302%2010.0498%2010.1882%209.26976%2010.2662%208.4177C10.3742%207.18162%2011.3823%206.18556%2012.6244%206.09555C14.1245%205.98154%2015.3846%207.17562%2015.3846%208.65172C15.3846%209.20376%2015.2106%209.70779%2014.9105%2010.1278C14.8085%2010.2658%2014.8205%2010.4578%2014.9345%2010.5898L15.3786%2011.0819C15.4746%2011.1899%2015.6306%2011.2259%2015.7626%2011.1779C16.0086%2011.0939%2016.2786%2011.0639%2016.5606%2011.1119C17.3047%2011.2259%2017.8987%2011.8319%2017.9887%2012.582Z'%20fill='white'/%3e%3c/svg%3e",Au=({url:n,token:s,role:r,eventsEmit:t,sectionData:h})=>{const[f,b]=v([]),[p,c]=v([]),[B,O]=v(!1),S=se(null),{fetchGraphs:w}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{F()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(f||[]).find(E=>E.key===a.index_name);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),c(u)}},[h,f]);const F=async()=>{try{const u=await w();if(u!=null&&u.dataList){const a=((u==null?void 0:u.dataList)||[]).map(i=>({key:i.schemaId,label:i.name}));b(a)}}catch(u){console.error(u)}},j=(u,a)=>{switch(u){case"removeItem":const i=p.filter(E=>E.key!==a.key);c([...i]),D(i);break}},D=u=>{const a=(u||[]).map(i=>({graph_name:i.label,index_name:i.key}));t&&t("graph_selected",a)},l=()=>{var a;const u=((a=S.current)==null?void 0:a.getSelectedItems())||[];c(u),O(!1),D(u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:ve}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>O(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(ye,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:j,data:p}),e(Be,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:l,destroyOnHidden:!0,onCancel:()=>O(!1),children:e(fe,{ref:S,dataSource:f,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:ve,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:u=>d("div",{className:"flex items-center",children:[e("img",{src:ve,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},wu=({value:n,onChange:s,min:r,max:t,step:h,disabled:f,sliderStyle:b,inputStyle:p,inputWidth:c=90})=>{const B=S=>{const w=Array.isArray(S)?S[0]:S;s==null||s(w)},O=S=>{s==null||s(S)};return d(uu,{style:{width:"100%"},children:[e(Ye,{min:r,max:t,step:h,disabled:f,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(Qe,{min:r,max:t,step:h,disabled:f,controls:!1,value:n,onChange:O,style:{width:c,...p}})]})},{Item:xu}=me,ie=({label:n,name:s,configScale:r})=>{const t=he(()=>r[s],[r]),h=(f,b)=>({validator(p,c){return c==null?Promise.reject("\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57"):typeof+c!="number"||isNaN(+c)?Promise.reject("\u53EA\u80FD\u8F93\u5165\u6570\u5B57"):c<f||c>b?Promise.reject(`\u8BF7\u8F93\u5165${f}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(Q,{span:12,children:e(xu,{label:n,name:s,tooltip:t.tooltip,rules:[{required:!0,message:""},h(t.min,t.max)],children:e(wu,{min:t.min,max:t.max,step:t.step})})})},{Item:M}=me,Lu=({url:n,token:s,role:r,id:t,showDatabase:h,showGraph:f,isShare:b,disabled:p,eventsEmit:c,showGraphEnhanced:B,CustomComponents:O})=>{const{ContentLoading:S}=O,[w]=me.useForm(),[F,j]=v(),[D,l]=v(),[u,a]=v(),[i,E]=v(),[m,N]=v(),[k,T]=v(!0),[W,y]=v(!1),[C,I]=v(ne),A=se({}),{getConfigById:o,fetchModels:x,fetchConfigItemLimit:_,checkName:H,addConversationAssistant:V,updateConversationAssistant:ee}=pe({url:n,token:s,role:r,eventsEmit:c});K(()=>{je()},[t]),K(()=>{t?(Array.isArray(D)&&Array.isArray(u)&&w.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&w.validateFields(["multi_model_name"])):(Array.isArray(D)&&(D==null?void 0:D.length)==0&&w.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(u)&&(u==null?void 0:u.length)==0&&w.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&w.validateFields(["multi_model_name"]),Array.isArray(m)&&(m==null?void 0:m.length)==0&&w.validateFields(["embedding_model_name"]))},[u,D,i,m,t]);const je=async()=>{let g;if(t){k||T(!0);try{const $=await o(t);if($){const{configJson:L,...Z}=$,U=L&&JSON.parse(L),{knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z}=U;g={...Z,...U},A.current={knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z},j(g),w.setFieldsValue(g),T(!1)}}catch{}}else T(!1);await qe(g)},qe=async g=>{var $,L,Z,U;try{const[X,G,ue,Y,le]=await Promise.allSettled([x({pageNum:1,pageSize:9999,status:1,type:1}),x({pageNum:1,pageSize:9999,status:1,type:3}),x({pageNum:1,pageSize:9999,status:1,type:4}),_(),x({pageNum:1,pageSize:9999,status:1,type:2})]);if(X.status==="fulfilled"&&X.value){const P=((($=X.value)==null?void 0:$.records)||[]).map(ce=>({...ce,label:ce.modelName,value:ce.modelName}));l(P)}if(G.status==="fulfilled"&&G.value){const z=(((L=G.value)==null?void 0:L.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));a(z),z.length>0&&!(g!=null&&g.rerank_model_name)&&w.setFieldsValue({rerank_model_name:z[0].value})}if(ue.status==="fulfilled"&&ue.value){const z=(((Z=ue.value)==null?void 0:Z.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));E(z),z.length>0&&!(g!=null&&g.multi_model_name)&&w.setFieldsValue({multi_model_name:z[0].value})}if(le.status==="fulfilled"&&le.value){const z=(((U=le.value)==null?void 0:U.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));N(z),z.length>0&&!(g!=null&&g.embedding_model_name)&&w.setFieldsValue({embedding_model_name:z[0].value})}if(Y.status==="fulfilled"&&Y.value&&Y.value){const z=Y.value;Object.keys(ne).forEach(P=>{if(z.hasOwnProperty(P)){const{max:ce,min:We}=z[P];ne[P]={...ne[P],min:We,max:ce}}}),I(ne)}}catch(X){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",X)}},He=async(g,$)=>await H($,t)?(be.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),ae=(g,$)=>({validator(L,Z){return Z?Array.isArray(g)&&g.length===0||!g.find(U=>U.value==Z)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(g)&&g.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject($)}}),ge=(g,$)=>{switch(g){case"knowledge_selected":A.current={...A.current,...$};break;case"sensitive_selected":A.current={...A.current,sensitiveWordIds:$};break;case"database_selected":A.current={...A.current,database_name:$};break;case"graph_selected":A.current={...A.current,graph_nb_name:$};break}},Ve=async()=>{var $;let g={};try{y(!0);const L=await w.validateFields(),{knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,database_name:ue,graph_nb_name:Y}=A.current;L.thinking=(($=D.find(z=>z.modelName==L.model_name))==null?void 0:$.thinking)||!1,f&&(L.enabled_nb_graph=!0),g={configJson:JSON.stringify({...L,knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,...h?{database_name:ue}:{},...f?{graph_nb_name:Y}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:G},t?await ee(t,g)&&(be.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back")):await V(g)&&(be.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back"))}catch(L){console.error("submit error",L)}finally{y(!1)}},Ke=he(()=>{const g={};return Object.keys(ne).forEach($=>{var L;g[$]=(L=ne[$])==null?void 0:L.default}),{...ou,...g}},[]);return d("div",{style:{height:"100%",width:"100%"},children:[d("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[d("div",{className:"flex items-center",children:[e(tu,{color:"#2468F2",onClick:()=>c&&c("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:t?"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B":"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B"})]}),!k&&e(re,{type:"primary",onClick:()=>Ve(),loading:W,disabled:p,children:"\u786E\u5B9A"})]}),k?S&&e(S,{}):e(me,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:w,layout:"vertical",initialValues:Ke,disabled:p,colon:!1,children:d(te,{gutter:24,style:{height:"100%"},children:[d(Q,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(M,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:He}],children:e(Fe,{placeholder:"\u8BF7\u8F93\u5165"})}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})})]}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},ae(i,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:i,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},ae(u,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:u,notFoundContent:e(oe,{})})})})]}),e(te,{gutter:16,children:e(Q,{span:24,children:e(M,{label:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",name:"embedding_model_name",rules:[{required:!0,message:""},ae(m,"\u8BF7\u9009\u62E9\u5411\u91CF\u89E3\u6790\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:m,notFoundContent:e(oe,{})})})})}),e(M,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(Fe.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(M,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:su,children:e(Fe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${au}`})}),e(M,{name:"isDefault",valuePropName:"checked",normalize:g=>g===!0?1:0,children:e(De,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),d(Q,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[d(Ae,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(M,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})}),e(M,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(J,{options:iu,placeholder:"\u8BF7\u9009\u62E9"})}),d(te,{gutter:16,children:[e(ie,{label:"\u6E29\u5EA6",name:"temperature",configScale:C}),e(ie,{label:"\u591A\u6837\u6027",name:"top_p",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:C}),e(ie,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:C}),e(ie,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:C})]})]}),d(Ae,{title:"\u529F\u80FD\u5F00\u5173",children:[e(M,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),B&&e(M,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:ru,normalize:g=>g===!0?1:0,children:e(de,{})}),e(M,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{noStyle:!0,shouldUpdate:(g,$)=>g.need_trace_source!==$.need_trace_source,children:({getFieldValue:g})=>g("need_trace_source")?d(Te,{children:[e(M,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:cu})}),e(M,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(De,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),d(Ae,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(Cu,{url:n,token:s,role:r,sectionData:F==null?void 0:F.sensitiveWordIds,eventsEmit:ge,defaultAnswer:F==null?void 0:F.defaultAnswer,form:w}),e(yu,{url:n,token:s,role:r,sectionData:{knowledge_base_name:F==null?void 0:F.knowledge_base_name,knowledge_base_name_source:F==null?void 0:F.knowledge_base_name_source,selectedKnowledgeBase:F==null?void 0:F.selectedKnowledgeBase},createBy:b?F==null?void 0:F.createBy:void 0,eventsEmit:ge}),h&&e(bu,{url:n,token:s,role:r,disabled:p,sectionData:F==null?void 0:F.database_name,eventsEmit:ge}),f&&e(Au,{url:n,token:s,role:r,sectionData:F==null?void 0:F.graph_nb_name,eventsEmit:ge})]})]})]})})]})};export{Lu as C,nu as S};
157
+ `;const fe=Ue(({dataSource:n,value:s=[],onConfirm:r,maxCount:t=0,searchPlaceholder:h="\u641C\u7D22...",title:f="",showSearch:b=!0,filterOption:p,renderItem:c,renderSelectedItem:B,className:O,style:S,styles:x,height:F,width:j},D)=>{const l=Ge(),u=Ne(Ne({theme:R,mode:"light"},l),x),[a,i]=v(s),[E,m]=v("");K(()=>{i(s)},[s]),he(()=>new Set(s.map(o=>o.key)),[s]);const N=he(()=>new Set(a.map(o=>o.key)),[a]);Xe(D,()=>({getSelectedItems:()=>a,confirm:()=>{r==null||r(a)}}),[a,r]);const T=p||((o,w)=>{var H;if(!o)return!0;const _=o.toLowerCase();return w.label.toLowerCase().includes(_)||((H=w.tags)==null?void 0:H.some(V=>V.toLowerCase().includes(_)))||!1}),W=he(()=>(n||[]).filter(o=>T(E,o)),[n,E,T]),y=o=>{const w=N.has(o.key);let _;if(w)_=(a||[]).filter(H=>H.key!==o.key);else{if(t>0&&a.length>=t)return;_=[...a,o]}i(_)},C=(o,w)=>{i(_=>_.map(V=>V.key==o?{...V,tags:w}:V))},I=o=>{const w=(a||[]).filter(_=>_.key!==o.key);i(w)},A=o=>N.has(o);return t>0&&a.length>=t,d(hu,{$theme:u.theme||R,$width:j,$height:F,className:O,style:S,children:[d($e,{$theme:u.theme||R,style:{flex:1},children:[b&&e(fu,{$theme:u.theme||R,children:d("div",{style:{position:"relative"},children:[e(Fu,{children:e(nu,{size:16})}),e(gu,{$theme:u.theme||R,type:"text",placeholder:h,value:E,onChange:o=>m(o.target.value)})]})}),e(Ie,{children:W.length===0?e(Me,{$theme:u.theme||R,children:E?"\u672A\u627E\u5230\u5339\u914D\u9879":"\u6682\u65E0\u6570\u636E"}):W.map(o=>{const w=A(o.key);return d(Le,{$theme:u.theme||R,$selected:w,children:[e(ze,{$theme:u.theme||R,children:c?c(o):o.label}),w&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),I(o)},disabled:!0,children:"\u5DF2\u6DFB\u52A0"}),!w&&e(Pe,{$theme:u.theme||R,onClick:_=>{_.stopPropagation(),y(o)},children:"\u6DFB\u52A0"})]},o.key)})})]}),d($e,{$theme:u.theme||R,style:{flex:1},children:[d(mu,{$theme:u.theme||R,children:[t>0?`\u5DF2\u9009\uFF1A${a.length}/${t}\u4E2A${f}`:`\u5DF2\u9009\uFF1A${a.length}\u4E2A${f}`,e(pu,{$theme:u.theme||R,onClick:o=>{o.stopPropagation(),i([])},children:"\u6E05\u7A7A"})]}),e(Ie,{children:a.length===0?e(Me,{$theme:u.theme||R,children:"\u6682\u65E0\u5DF2\u9009\u9879"}):a.map(o=>{var _,H,V;const w=ee=>C(o.key,ee);return d(Le,{$theme:u.theme||R,children:[e(ze,{$theme:u.theme||R,children:B?B(o,w):o.label}),e(Re,{size:14,color:((V=(H=(_=u.theme)==null?void 0:_.colors)==null?void 0:H.text)==null?void 0:V.secondary)||"#86909C",style:{cursor:"pointer"},onClick:ee=>{ee.stopPropagation(),I(o)}})]},o.key)})})]})]})});fe.displayName="SearchableSelector";const xe="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%23FFCC3C'/%3e%3cpath%20d='M13.3263%2012.7917H7.53763C7.33426%2012.8116%207.17923%2012.9825%207.17923%2013.1867C7.17923%2013.3909%207.33426%2013.5618%207.53763%2013.5817H13.3277C13.3828%2013.5871%2013.4384%2013.5809%2013.4909%2013.5634C13.5435%2013.546%2013.5918%2013.5178%2013.6328%2013.4806C13.6738%2013.4434%2013.7066%2013.3981%2013.729%2013.3474C13.7514%2013.2968%2013.763%2013.2421%2013.763%2013.1867C13.763%2013.1313%2013.7514%2013.0766%2013.729%2013.026C13.7066%2012.9753%2013.6738%2012.93%2013.6328%2012.8928C13.5918%2012.8556%2013.5435%2012.8274%2013.4909%2012.8099C13.4384%2012.7925%2013.3828%2012.7863%2013.3277%2012.7917H13.3263ZM9.19742%207.60418L8.84232%208.55193H9.57339L9.19742%207.60418Z'%20fill='white'/%3e%3cpath%20d='M15.3211%2014.7707V6.9692H14.4704V14.3543H6.70511C6.06668%2014.3392%205.55704%2013.8173%205.55704%2013.1788C5.55704%2012.5402%206.06668%2012.0184%206.70511%2012.0033H13.352C13.4644%2012.0075%2013.5735%2011.9648%2013.653%2011.8852C13.6923%2011.8459%2013.7231%2011.7988%2013.7434%2011.747C13.7638%2011.6952%2013.7731%2011.6398%2013.771%2011.5842V5.20102C13.7736%205.14526%2013.7646%205.08958%2013.7445%205.03752C13.7244%204.98546%2013.6936%204.93816%2013.6542%204.89865C13.6148%204.85915%2013.5675%204.82832%2013.5155%204.80812C13.4634%204.78792%2013.4077%204.7788%2013.352%204.78134H6.70511C5.60281%204.80136%204.71609%205.69369%204.70291%206.79599V13.1759C4.71609%2014.283%205.61038%2015.1773%206.71756%2015.1905H14.8893C15.0042%2015.1994%2015.1173%2015.1585%2015.1999%2015.0782C15.2407%2015.0385%2015.2727%2014.9905%2015.2936%2014.9375C15.3145%2014.8845%2015.3239%2014.8276%2015.3211%2014.7707ZM8.98782%206.78585H9.44888L10.7213%209.92562H10.2475L9.9075%209.06759H8.51871L8.19742%209.92562H7.72354L8.98782%206.78585Z'%20fill='white'/%3e%3c/svg%3e",{Item:Eu}=me,Cu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,defaultAnswer:f,form:b})=>{const[p,c]=v([]),[B,O]=v([]),[S,x]=v(!1),[F,j]=v(!1),D=se(null),{fetchSensitiveLibrary:l}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{u()},[]),K(()=>{if(h&&(p==null?void 0:p.length)>0){let m=h?Array.isArray(h)?h:h.split(","):[],N=[];m.forEach(k=>{const T=(p||[]).find(W=>W.key===k);T&&N.push({key:T.key,label:T.label})}),O(N)}},[h,p]),K(()=>{f&&j(!0)},[f]);const u=async()=>{try{const m=await l({pageNo:1,pageSize:9999});if(m!=null&&m.records){const N=((m==null?void 0:m.records)||[]).map(k=>({key:k.id+"",label:k.name}));c(N)}}catch(m){console.error(m)}},a=(m,N)=>{switch(m){case"removeItem":const k=B.filter(T=>T.key!==N.key);O([...k]),i(k);break}},i=m=>{const N=m.map(k=>(k==null?void 0:k.key)||"").filter(k=>k).join(",");t&&t("sensitive_selected",N)},E=()=>{var N;const m=((N=D.current)==null?void 0:N.getSelectedItems())||[];O(m),x(!1),i(m)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:xe}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u654F\u611F\u8BCD"})]}),e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>x(!0),children:"\u6DFB\u52A0"})]}),e(De,{checked:F,onChange:m=>{j(m.target.checked),m.target.checked?b.setFieldsValue({defaultAnswer:lu}):b.setFieldsValue({defaultAnswer:""})},style:{marginBottom:8,marginTop:8},children:"\u81EA\u5B9A\u4E49\u56DE\u590D"}),F&&e(Eu,{label:"\u81EA\u5B9A\u4E49\u56DE\u590D\u5185\u5BB9",name:"defaultAnswer",layout:"vertical",children:e(Fe.TextArea,{style:{height:"55px",resize:"none"}})}),(B==null?void 0:B.length)>0&&e(ye,{countText:(B==null?void 0:B.length)>0?`\u5DF2\u9009\uFF1A${B==null?void 0:B.length}\u4E2A\u654F\u611F\u8BCD\u5E93`:void 0,eventsEmit:a,data:B}),e(Be,{width:740,title:"\u9009\u62E9\u654F\u611F\u8BCD",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:S,onOk:E,onCancel:()=>x(!1),destroyOnHidden:!0,className:"assistant-config-resource-bind-modal",children:e(fe,{ref:D,dataSource:p,value:B,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u654F\u611F\u8BCD\u5E93",renderItem:m=>d("div",{className:"flex ",children:[e("img",{src:xe,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m.label,children:m.label})]}),renderSelectedItem:(m,N)=>d("div",{className:"flex items-center",children:[e("img",{src:xe,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:m.label})})]})})})]})},we="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='20'%20height='20'%20rx='2.22222'%20fill='%2300B2F9'/%3e%3cpath%20d='M5.3125%2013.9672V13.975C5.32812%2014.6938%205.89922%2015.2734%206.61875%2015.2734H13.9062C14.3375%2015.2734%2014.6875%2014.9289%2014.6875%2014.4977V5.50703C14.6875%205.40447%2014.6673%205.30292%2014.628%205.20818C14.5887%205.11344%2014.5312%205.02736%2014.4586%204.95488C14.3861%204.8824%2014.2999%204.82492%2014.2052%204.78575C14.1104%204.74657%2014.0088%204.72646%2013.9062%204.72656H6.875C6.01172%204.72656%205.3125%205.42031%205.3125%206.28359V13.9672ZM7.5%209.24531V6.25C7.5%206.07813%207.64062%205.9375%207.8125%205.9375H9.6875C9.86016%205.9375%2010%206.07813%2010%206.25V9.24531C10%209.30716%209.98175%209.36762%209.94741%209.41906C9.91308%209.47049%209.86425%209.51058%209.80712%209.53426C9.74999%209.55793%209.68712%209.56412%209.62647%209.55204C9.56581%209.53996%209.51011%209.51016%209.46641%209.46641L8.97109%208.97109C8.94207%208.94204%208.90761%208.91899%208.86967%208.90326C8.83173%208.88754%208.79107%208.87944%208.75%208.87944C8.70893%208.87944%208.66827%208.88754%208.63033%208.90326C8.59239%208.91899%208.55793%208.94204%208.52891%208.97109L8.03359%209.46641C7.98989%209.51016%207.93418%209.53996%207.87353%209.55204C7.81288%209.56412%207.75001%209.55793%207.69288%209.53426C7.63575%209.51058%207.58692%209.47049%207.55259%209.41906C7.51825%209.36762%207.49995%209.30716%207.5%209.24531ZM6.54375%2014.2063C6.45208%2014.1156%206.40625%2014.0052%206.40625%2013.875C6.40625%2013.7458%206.45208%2013.6354%206.54375%2013.5438C6.6349%2013.4521%206.74531%2013.4062%206.875%2013.4062H13.5938V14.3438H6.875C6.74531%2014.3438%206.6349%2014.2979%206.54375%2014.2063Z'%20fill='white'/%3e%3c/svg%3e",Bu=({url:n,token:s,role:r,sectionData:t,createBy:h,eventsEmit:f})=>{const[b,p]=v(),[c,B]=v([]),[O,S]=v(!1),x=se(null),[F,j]=v(!1),[D,l]=v([]),u=se(new Map).current,{fetchKnowledgeBase:a,getBizLabelLabels:i}=pe({url:n,token:s,role:r,eventsEmit:f}),E=se(!1);K(()=>{E.current||(h?(m(h),E.current=!0):(m(),E.current=!0))},[h]),K(()=>{if(t&&(b==null?void 0:b.length)>0){const y=t==null?void 0:t.knowledge_base_name_source,C=y&&(Array.isArray(y)?y:y.split(";"));let I=[];(C||[]).forEach(A=>{const o=((t==null?void 0:t.selectedKnowledgeBase)||[]).find(_=>_.name==A),w=(b||[]).find(_=>_.knowledge_base_name_source===A);if(w){const{key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee}=w;I.push({key:_,label:H,knowledge_base_name:V,knowledge_base_name_source:ee,tags:o==null?void 0:o.labels})}}),B(I)}},[t,b]);const m=async y=>{try{const C=await a(y);if(C){const I=(C||[]).map(A=>({key:A.id,label:A.kbName,knowledge_base_name:A.primitiveName,knowledge_base_name_source:A.kbName}));p(I)}}catch(C){console.error(C)}},N=(y,C)=>{switch(y){case"removeItem":const I=c.filter(o=>o.key!==C.key);B([...I]),k(I);break;case"removeTag":const A=c.findIndex(o=>o.key==C.key);A!==-1&&(c[A]=C),B([...c]),k(c);break}},k=y=>{const C=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name)||"").filter(o=>o).join(";"),I=(y||[]).map(o=>(o==null?void 0:o.knowledge_base_name_source)||"").filter(o=>o).join(";"),A=(y||[]).filter(o=>{var w;return Array.isArray(o==null?void 0:o.tags)&&((w=o.tags)==null?void 0:w.length)>0}).map(o=>({id:o.key,name:o.label,knowledge_base_name_source:o.knowledge_base_name,labels:o.tags}));f&&f("knowledge_selected",{knowledge_base_name:C,knowledge_base_name_source:I,selectedKnowledgeBase:A})},T=()=>{var C;const y=((C=x.current)==null?void 0:C.getSelectedItems())||[];B(y),S(!1),k(y)},W=async(y,C)=>{if(y){const I=u.get(C);if(I){l(I);return}if(!F)try{j(!0);const A=await i({kbNames:[C]});if(Array.isArray(A)){const o=A.length?A[0].label:"",w=o?(o||"").split(",").map(_=>({label:_,value:_})):[];u.set(C,w),l(w)}j(!1)}catch(A){console.error("Error fetching data:",A),j(!1)}}};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:we}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u77E5\u8BC6\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u77E5\u8BC6\u5E93`:void 0,eventsEmit:N,data:c}),e(Be,{width:740,className:"assistant-config-resource-bind-modal",title:"\u9009\u62E9\u77E5\u8BC6\u5E93",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:T,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:x,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u77E5\u8BC6\u5E93",renderItem:y=>d("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:y.label,children:y.label})]}),renderSelectedItem:(y,C)=>d("div",{className:"flex ",children:[e("img",{src:we,alt:"add"}),d("div",{style:{marginLeft:"12px"},children:[e("div",{style:{marginBottom:"8px",fontWeight:500},children:y.label}),e(J,{mode:"tags",placeholder:"\u9009\u62E9\u6807\u7B7E...",maxTagCount:1,value:y.tags||[],onChange:I=>{C(I)},style:{width:250},options:D,loading:F,onOpenChange:I=>{W(I,y.knowledge_base_name)}})]})]})})})]})},yu=Ze.memo(Bu),_e="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%23925BFF'/%3e%3cpath%20d='M11.9971%2011.265C15.249%2011.265%2017.8891%2010.443%2017.8891%209.423V7.95288C17.8891%206.93291%2015.2492%206.11084%2011.9971%206.11084C8.74513%206.11084%206.10504%206.93276%206.10504%207.95288V9.42285C6.10504%2010.437%208.73898%2011.265%2011.9971%2011.265Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2014.577C15.249%2014.577%2017.8891%2013.7551%2017.8891%2012.7349V10.527C17.8891%2011.5469%2015.2492%2012.369%2011.9971%2012.369C8.74513%2012.369%206.10504%2011.5471%206.10504%2010.527V12.7349C6.10504%2013.749%208.73898%2014.577%2011.9971%2014.577Z'%20fill='white'/%3e%3cpath%20d='M11.9971%2015.681C8.7451%2015.681%206.11102%2014.859%206.11102%2013.839V16.0469C6.11102%2017.0609%208.74496%2017.889%2012.0031%2017.889C15.255%2017.889%2017.8951%2017.0671%2017.8951%2016.0469V13.8391C17.889%2014.859%2015.249%2015.681%2011.9971%2015.681Z'%20fill='white'/%3e%3c/svg%3e",Oe=10,bu=({url:n,token:s,role:r,eventsEmit:t,sectionData:h,disabled:f})=>{const[b,p]=v([]),[c,B]=v([]),[O,S]=v(!1),x=se(null),{fetchDatabases:F}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{j()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(b||[]).find(E=>E.key===a.key);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),B(u)}},[h,b]);const j=async()=>{try{const u=await F();if(u){const a=(u||[]).map(i=>({key:i.primitiveName,label:i.name}));p(a)}}catch(u){console.error(u)}},D=(u,a)=>{switch(u){case"removeItem":const i=c.filter(E=>E.key!==a.key);B([...i]),t&&t("database_selected",i);break}},l=()=>{var a;const u=((a=x.current)==null?void 0:a.getSelectedItems())||[];B(u),S(!1),t&&t("database_selected",u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:_e}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u6570\u636E\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>S(!0),disabled:c.length>=Oe||f,children:"\u6DFB\u52A0"})})]}),(c==null?void 0:c.length)>0&&e(ye,{countText:(c==null?void 0:c.length)>0?`\u5DF2\u9009\uFF1A${c==null?void 0:c.length}\u4E2A\u6570\u636E\u5E93`:void 0,eventsEmit:D,data:c}),e(Be,{width:740,title:"\u9009\u62E9\u6570\u636E\u5E93",className:"assistant-config-resource-bind-modal",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",open:O,onOk:l,onCancel:()=>S(!1),destroyOnHidden:!0,children:e(fe,{ref:x,dataSource:b,value:c,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u6570\u636E\u5E93",maxCount:Oe,renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:_e,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:(u,a)=>d("div",{className:"flex items-center",children:[e("img",{src:_e,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},ve="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='24'%20height='24'%20rx='3.55556'%20fill='%2300C1B8'/%3e%3cpath%20d='M17.9887%2012.582C18.1207%2013.6621%2017.2267%2014.5801%2016.1526%2014.4901C15.3306%2014.4181%2014.6645%2013.7521%2014.6045%2012.924C14.5745%2012.558%2014.6645%2012.21%2014.8445%2011.9159C14.9285%2011.7779%2014.9045%2011.6039%2014.8025%2011.4899L14.3885%2011.0339C14.2805%2010.9139%2014.1005%2010.8839%2013.9565%2010.9559C13.6144%2011.1239%2013.2304%2011.2199%2012.8224%2011.2199C12.6244%2011.2199%2012.4324%2011.1959%2012.2464%2011.1539C12.0963%2011.1179%2011.9463%2011.1779%2011.8563%2011.3039L11.2803%2012.1259C11.1783%2012.276%2011.1963%2012.474%2011.3223%2012.606C11.8983%2013.188%2012.2464%2013.9921%2012.2284%2014.8741C12.1924%2016.4702%2010.9203%2017.7963%209.32417%2017.9043C7.45804%2018.0243%205.90994%2016.4942%206.00595%2014.6281C6.08995%2013.038%207.38604%2011.7599%208.97614%2011.6879C9.42017%2011.6699%209.8402%2011.7419%2010.2302%2011.8919C10.3922%2011.9519%2010.5722%2011.8979%2010.6743%2011.7599L11.1663%2011.0579C11.2743%2010.9019%2011.2503%2010.6919%2011.1123%2010.5658C10.5302%2010.0498%2010.1882%209.26976%2010.2662%208.4177C10.3742%207.18162%2011.3823%206.18556%2012.6244%206.09555C14.1245%205.98154%2015.3846%207.17562%2015.3846%208.65172C15.3846%209.20376%2015.2106%209.70779%2014.9105%2010.1278C14.8085%2010.2658%2014.8205%2010.4578%2014.9345%2010.5898L15.3786%2011.0819C15.4746%2011.1899%2015.6306%2011.2259%2015.7626%2011.1779C16.0086%2011.0939%2016.2786%2011.0639%2016.5606%2011.1119C17.3047%2011.2259%2017.8987%2011.8319%2017.9887%2012.582Z'%20fill='white'/%3e%3c/svg%3e",Au=({url:n,token:s,role:r,eventsEmit:t,sectionData:h})=>{const[f,b]=v([]),[p,c]=v([]),[B,O]=v(!1),S=se(null),{fetchGraphs:x}=pe({url:n,token:s,role:r,eventsEmit:t});K(()=>{F()},[]),K(()=>{if(h){let u=[];(h||[]).map(a=>{const i=(f||[]).find(E=>E.key===a.index_name);if(i){const{key:E,label:m}=i;u.push({key:E,label:m})}}),c(u)}},[h,f]);const F=async()=>{try{const u=await x();if(u!=null&&u.dataList){const a=((u==null?void 0:u.dataList)||[]).map(i=>({key:i.schemaId,label:i.name}));b(a)}}catch(u){console.error(u)}},j=(u,a)=>{switch(u){case"removeItem":const i=p.filter(E=>E.key!==a.key);c([...i]),D(i);break}},D=u=>{const a=(u||[]).map(i=>({graph_name:i.label,index_name:i.key}));t&&t("graph_selected",a)},l=()=>{var a;const u=((a=S.current)==null?void 0:a.getSelectedItems())||[];c(u),O(!1),D(u)};return d("div",{style:{borderBottom:"1px solid #E5E6EB",padding:"12px 0 "},children:[d("div",{className:"flex items-center justify-between",children:[d("div",{className:"flex items-center",children:[e("img",{src:ve}),e("span",{className:"font-medium ",style:{marginLeft:"10px"},children:"\u56FE\u8C31\u5E93"})]}),e("div",{className:"flex items-center gap-2",children:e(re,{color:"primary",variant:"outlined",size:"small",icon:e(Ce,{size:14}),onClick:()=>O(!0),children:"\u6DFB\u52A0"})})]}),(p==null?void 0:p.length)>0&&e(ye,{countText:(p==null?void 0:p.length)>0?`\u5DF2\u9009\uFF1A${p==null?void 0:p.length}\u4E2A\u56FE\u8C31`:void 0,eventsEmit:j,data:p}),e(Be,{width:740,title:"\u9009\u62E9\u56FE\u8C31",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",className:"assistant-config-resource-bind-modal",open:B,onOk:l,destroyOnHidden:!0,onCancel:()=>O(!1),children:e(fe,{ref:S,dataSource:f,value:p,searchPlaceholder:"\u641C\u7D22\u540D\u79F0...",width:"700px",height:"500px",title:"\u56FE\u8C31",renderItem:u=>d("div",{className:"flex ",children:[e("img",{src:ve,alt:"add"}),e("span",{style:{marginLeft:8,marginRight:8,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u.label,children:u.label})]}),renderSelectedItem:u=>d("div",{className:"flex items-center",children:[e("img",{src:ve,alt:"add"}),e("div",{style:{marginLeft:"12px"},children:e("div",{style:{fontWeight:500},children:u.label})})]})})})]})},xu=({value:n,onChange:s,min:r,max:t,step:h,disabled:f,sliderStyle:b,inputStyle:p,inputWidth:c=90})=>{const B=S=>{const x=Array.isArray(S)?S[0]:S;s==null||s(x)},O=S=>{s==null||s(S)};return d(uu,{style:{width:"100%"},children:[e(Ye,{min:r,max:t,step:h,disabled:f,value:n,onChange:B,style:{width:"200px",flex:1,...b}}),e(Qe,{min:r,max:t,step:h,disabled:f,controls:!1,value:n,onChange:O,style:{width:c,...p}})]})},{Item:wu}=me,ie=({label:n,name:s,configScale:r})=>{const t=he(()=>r[s],[r]),h=(f,b)=>({validator(p,c){return c==null?Promise.reject("\u8BF7\u8F93\u5165\u6709\u6548\u6570\u5B57"):typeof+c!="number"||isNaN(+c)?Promise.reject("\u53EA\u80FD\u8F93\u5165\u6570\u5B57"):c<f||c>b?Promise.reject(`\u8BF7\u8F93\u5165${f}\u5230${b}\u4E4B\u95F4\u7684\u6570\u5B57`):Promise.resolve()}});return e(Q,{span:12,children:e(wu,{label:n,name:s,tooltip:t.tooltip,rules:[{required:!0,message:""},h(t.min,t.max)],children:e(xu,{min:t.min,max:t.max,step:t.step})})})},{Item:M}=me,Lu=({url:n,token:s,role:r,id:t,showDatabase:h,showGraph:f,isShare:b,disabled:p,eventsEmit:c,showGraphEnhanced:B,CustomComponents:O})=>{const{ContentLoading:S}=O,[x]=me.useForm(),[F,j]=v(),[D,l]=v(),[u,a]=v(),[i,E]=v(),[m,N]=v(),[k,T]=v(!0),[W,y]=v(!1),[C,I]=v(ne),A=se({}),{getConfigById:o,fetchModels:w,fetchConfigItemLimit:_,checkName:H,addConversationAssistant:V,updateConversationAssistant:ee}=pe({url:n,token:s,role:r,eventsEmit:c});K(()=>{je()},[t]),K(()=>{t?(Array.isArray(D)&&Array.isArray(u)&&x.validateFields(["model_name","plan_model_name","recommend_model_name","rerank_model_name","multi_model_name","embedding_model_name"]),Array.isArray(i)&&x.validateFields(["multi_model_name"])):(Array.isArray(D)&&(D==null?void 0:D.length)==0&&x.validateFields(["model_name","plan_model_name","recommend_model_name","embedding_model_name"]),Array.isArray(u)&&(u==null?void 0:u.length)==0&&x.validateFields(["rerank_model_name"]),Array.isArray(i)&&(i==null?void 0:i.length)==0&&x.validateFields(["multi_model_name"]),Array.isArray(m)&&(m==null?void 0:m.length)==0&&x.validateFields(["embedding_model_name"]))},[u,D,i,m,t]);const je=async()=>{let g;if(t){k||T(!0);try{const $=await o(t);if($){const{configJson:L,...Z}=$,U=L&&JSON.parse(L),{knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z}=U;g={...Z,...U},A.current={knowledge_base_name:X,knowledge_base_name_source:G,selectedKnowledgeBase:ue,sensitiveWordIds:Y,database_name:le,graph_nb_name:z},j(g),x.setFieldsValue(g),T(!1)}}catch{}}else T(!1);await qe(g)},qe=async g=>{var $,L,Z,U;try{const[X,G,ue,Y,le]=await Promise.allSettled([w({pageNum:1,pageSize:9999,status:1,type:1}),w({pageNum:1,pageSize:9999,status:1,type:3}),w({pageNum:1,pageSize:9999,status:1,type:4}),_(),w({pageNum:1,pageSize:9999,status:1,type:2})]);if(X.status==="fulfilled"&&X.value){const P=((($=X.value)==null?void 0:$.records)||[]).map(ce=>({...ce,label:ce.modelName,value:ce.modelName}));l(P)}if(G.status==="fulfilled"&&G.value){const z=(((L=G.value)==null?void 0:L.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));a(z),z.length>0&&!(g!=null&&g.rerank_model_name)&&x.setFieldsValue({rerank_model_name:z[0].value})}if(ue.status==="fulfilled"&&ue.value){const z=(((Z=ue.value)==null?void 0:Z.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));E(z),z.length>0&&!(g!=null&&g.multi_model_name)&&x.setFieldsValue({multi_model_name:z[0].value})}if(le.status==="fulfilled"&&le.value){const z=(((U=le.value)==null?void 0:U.records)||[]).map(P=>({label:P.modelName||P.name,value:P.modelName||P.name}));N(z),z.length>0&&!(g!=null&&g.embedding_model_name)&&x.setFieldsValue({embedding_model_name:z[0].value})}if(Y.status==="fulfilled"&&Y.value&&Y.value){const z=Y.value;Object.keys(ne).forEach(P=>{if(z.hasOwnProperty(P)){const{max:ce,min:We}=z[P];ne[P]={...ne[P],min:We,max:ce}}}),I(ne)}}catch(X){console.error("\u83B7\u53D6\u5217\u8868\u5931\u8D25:",X)}},He=async(g,$)=>await H($,t)?(be.warning("\u540D\u79F0\u91CD\u590D\uFF01",2),Promise.reject("\u540D\u79F0\u91CD\u590D")):Promise.resolve(),ae=(g,$)=>({validator(L,Z){return Z?Array.isArray(g)&&g.length===0||!g.find(U=>U.value==Z)?Promise.reject("\u6A21\u578B\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.resolve():Array.isArray(g)&&g.length===0?Promise.reject("\u6682\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"):Promise.reject($)}}),ge=(g,$)=>{switch(g){case"knowledge_selected":A.current={...A.current,...$};break;case"sensitive_selected":A.current={...A.current,sensitiveWordIds:$};break;case"database_selected":A.current={...A.current,database_name:$};break;case"graph_selected":A.current={...A.current,graph_nb_name:$};break}},Ve=async()=>{var $;let g={};try{y(!0);const L=await x.validateFields(),{knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,database_name:ue,graph_nb_name:Y}=A.current;L.thinking=(($=D.find(z=>z.modelName==L.model_name))==null?void 0:$.thinking)||!1,f&&(L.enabled_nb_graph=!0),g={configJson:JSON.stringify({...L,knowledge_base_name:Z,knowledge_base_name_source:U,selectedKnowledgeBase:X,sensitiveWordIds:G,...h?{database_name:ue}:{},...f?{graph_nb_name:Y}:{}}),name:L.config_name,isDefault:L.isDefault,defaultAnswer:L.defaultAnswer,dependOnKb:L.dependOnKb,sensitiveWordIds:G},t?await ee(t,g)&&(be.success("\u66F4\u65B0\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back")):await V(g)&&(be.success("\u65B0\u589E\u52A9\u624B\u914D\u7F6E\u6210\u529F"),c&&c("go_back"))}catch(L){console.error("submit error",L)}finally{y(!1)}},Ke=he(()=>{const g={};return Object.keys(ne).forEach($=>{var L;g[$]=(L=ne[$])==null?void 0:L.default}),{...ou,...g}},[]);return d("div",{style:{height:"100%",width:"100%"},children:[d("div",{className:"flex items-center justify-between",style:{width:"100%",padding:"4px 10px 16px 10px"},children:[d("div",{className:"flex items-center",children:[e(tu,{color:"#2468F2",onClick:()=>c&&c("go_back")}),e("div",{className:"text-[16px] text-[#1D2129] bold",style:{marginLeft:20},children:t?"\u7F16\u8F91\u4F1A\u8BDD\u52A9\u624B":"\u65B0\u5EFA\u4F1A\u8BDD\u52A9\u624B"})]}),!k&&e(re,{type:"primary",onClick:()=>Ve(),loading:W,disabled:p,children:"\u786E\u5B9A"})]}),k?S&&e(S,{}):e(me,{style:{padding:20,height:"calc(100vh - 150px)",backgroundColor:"#fff"},form:x,layout:"vertical",initialValues:Ke,disabled:p,colon:!1,children:d(te,{gutter:24,style:{height:"100%"},children:[d(Q,{span:12,style:{borderRight:"1px solid #E5E6EB",padding:"10px 32px",height:"100%",overflowY:"auto"},children:[e(M,{label:"\u52A9\u624B\u540D\u79F0",name:"config_name",validateTrigger:"onBlur",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u52A9\u624B\u540D\u79F0"},{validator:He}],children:e(Fe,{placeholder:"\u8BF7\u8F93\u5165"})}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u95EE\u7B54\u6A21\u578B",name:"model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u7B54\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"\u89C4\u5212\u6A21\u578B",name:"plan_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u89C4\u5212\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})})})]}),d(te,{gutter:16,children:[e(Q,{span:12,children:e(M,{label:"\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B",name:"multi_model_name",rules:[{required:!0,message:""},ae(i,"\u8BF7\u9009\u62E9\u4E0A\u4F20\u6587\u6863\u95EE\u7B54\u591A\u6A21\u6001\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:i,notFoundContent:e(oe,{})})})}),e(Q,{span:12,children:e(M,{label:"Rerank\u6A21\u578B",name:"rerank_model_name",rules:[{required:!0,message:""},ae(u,"\u8BF7\u9009\u62E9Rerank\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:u,notFoundContent:e(oe,{})})})})]}),e(te,{gutter:16,children:e(Q,{span:24,children:e(M,{label:"\u5411\u91CF\u89E3\u6790\u6A21\u578B",name:"embedding_model_name",rules:[{required:!0,message:""},ae(m,"\u8BF7\u9009\u62E9\u5411\u91CF\u89E3\u6790\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:m,notFoundContent:e(oe,{})})})})}),e(M,{label:"\u5F00\u573A\u767D",name:"prologue",children:e(Fe.TextArea,{maxLength:50,showCount:!0,placeholder:"\u8BF7\u8F93\u5165\u5F00\u573A\u767D",autoSize:{minRows:2}})}),e(M,{label:"\u63D0\u793A\u8BCD",name:"system_prompt",tooltip:su,children:e(Fe.TextArea,{showCount:!0,rows:8,maxLength:3e3,autoSize:{minRows:10},placeholder:`\u4F8B\u5982\uFF1A${au}`})}),e(M,{name:"isDefault",valuePropName:"checked",normalize:g=>g===!0?1:0,children:e(De,{children:"\u9009\u62E9\u4E3A\u9ED8\u8BA4\u52A9\u624B"})})]}),d(Q,{span:12,style:{height:"100%",padding:"10px 32px",overflowY:"auto"},children:[d(Ae,{title:"\u68C0\u7D22\u4E0E\u751F\u6210\u53C2\u6570",children:[e(M,{label:"\u95EE\u9898\u63A8\u8350\u6A21\u578B",name:"recommend_model_name",rules:[{required:!0,message:""},ae(D,"\u8BF7\u9009\u62E9\u95EE\u9898\u63A8\u8350\u6A21\u578B")],children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:D,notFoundContent:e(oe,{})})}),e(M,{label:"\u68C0\u7D22\u7B56\u7565",name:"search_policy",children:e(J,{options:iu,placeholder:"\u8BF7\u9009\u62E9"})}),d(te,{gutter:16,children:[e(ie,{label:"\u6E29\u5EA6",name:"temperature",configScale:C}),e(ie,{label:"\u591A\u6837\u6027",name:"top_p",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u53EC\u56DE\u6570",name:"top_k",configScale:C}),e(ie,{label:"\u76F8\u4F3C\u5EA6\u9608\u503C",name:"score_threshold",configScale:C})]}),d(te,{gutter:16,children:[e(ie,{label:"\u6700\u5927\u4EE4\u724C\u6570",name:"max_tokens",configScale:C}),e(ie,{label:"\u4E0A\u4E0B\u6587\u6700\u5927\u8F6E\u6570",name:"max_round",configScale:C})]})]}),d(Ae,{title:"\u529F\u80FD\u5F00\u5173",children:[e(M,{label:"\u5F00\u542FFAQ\u4F18\u5148",name:"enabled_faq",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),B&&e(M,{label:"\u542F\u7528\u56FE\u8C31\u589E\u5F3A",name:"enabled_graph",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u5F3A\u4F01\u4E1A\u77E5\u8BC6\u4F9D\u8D56",name:"dependOnKb",valuePropName:"checked",layout:"horizontal",tooltip:ru,normalize:g=>g===!0?1:0,children:e(de,{})}),e(M,{label:"\u5F00\u542F\u95EE\u9898\u6539\u5199",name:"enabled_question_rewrite",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{label:"\u5F00\u542F\u6EAF\u6E90",name:"need_trace_source",valuePropName:"checked",layout:"horizontal",children:e(de,{})}),e(M,{noStyle:!0,shouldUpdate:(g,$)=>g.need_trace_source!==$.need_trace_source,children:({getFieldValue:g})=>g("need_trace_source")?d(Te,{children:[e(M,{label:"\u6EAF\u6E90\u7B56\u7565",name:"trace_by_llm",layout:"horizontal",children:e(J,{placeholder:"\u8BF7\u9009\u62E9",options:cu})}),e(M,{name:"is_download",valuePropName:"checked",layout:"horizontal",children:e(De,{children:"\u5141\u8BB8\u4E0B\u8F7D\u6EAF\u6E90\u6587\u4EF6"})})]}):null})]}),d(Ae,{title:"\u8D44\u6E90\u7ED1\u5B9A",children:[e(Cu,{url:n,token:s,role:r,sectionData:F==null?void 0:F.sensitiveWordIds,eventsEmit:ge,defaultAnswer:F==null?void 0:F.defaultAnswer,form:x}),e(yu,{url:n,token:s,role:r,sectionData:{knowledge_base_name:F==null?void 0:F.knowledge_base_name,knowledge_base_name_source:F==null?void 0:F.knowledge_base_name_source,selectedKnowledgeBase:F==null?void 0:F.selectedKnowledgeBase},createBy:b?F==null?void 0:F.createBy:void 0,eventsEmit:ge}),h&&e(bu,{url:n,token:s,role:r,disabled:p,sectionData:F==null?void 0:F.database_name,eventsEmit:ge}),f&&e(Au,{url:n,token:s,role:r,sectionData:F==null?void 0:F.graph_nb_name,eventsEmit:ge})]})]})]})})]})};export{Lu as C,nu as S};
@@ -1 +1 @@
1
- import*as c from"react";import{useMemo as rt,useRef as U}from"react";import{g as it,m as Nt,w as at,r as lt,x as z,y as j,o as Y,z as ct,f as w,v as dt,A as xt}from"./index-Cso0btPH.js";const Ot=new z("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),wt=new z("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),jt=new z("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),Et=new z("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),Pt=new z("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),It=new z("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),zt=t=>{const{componentCls:e,iconCls:i,antCls:n,badgeShadowSize:o,textFontSize:d,textFontSizeSM:a,statusSize:$,dotSize:v,textFontWeight:C,indicatorHeight:l,indicatorHeightSM:r,marginXS:m,calc:g}=t,u=`${n}-scroll-number`,h=at(t,(f,{darkColor:y})=>({[`&${e} ${e}-color-${f}`]:{background:y,[`&:not(${e}-count)`]:{color:y},"a:hover &":{background:y}}}));return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},lt(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${e}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:l,height:l,color:t.badgeTextColor,fontWeight:C,fontSize:d,lineHeight:j(l),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:g(l).div(2).equal(),boxShadow:`0 0 0 ${j(o)} ${t.badgeShadowColor}`,transition:`background ${t.motionDurationMid}`,a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},[`${e}-count-sm`]:{minWidth:r,height:r,fontSize:a,lineHeight:j(r),borderRadius:g(r).div(2).equal()},[`${e}-multiple-words`]:{padding:`0 ${j(t.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${e}-dot`]:{zIndex:t.indicatorZIndex,width:v,minWidth:v,height:v,background:t.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${j(o)} ${t.badgeShadowColor}`},[`${e}-count, ${e}-dot, ${u}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${i}-spin`]:{animationName:It,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${e}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${e}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:$,height:$,verticalAlign:"middle",borderRadius:"50%"},[`${e}-status-success`]:{backgroundColor:t.colorSuccess},[`${e}-status-processing`]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:o,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:Ot,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${e}-status-default`]:{backgroundColor:t.colorTextPlaceholder},[`${e}-status-error`]:{backgroundColor:t.colorError},[`${e}-status-warning`]:{backgroundColor:t.colorWarning},[`${e}-status-text`]:{marginInlineStart:m,color:t.colorText,fontSize:t.fontSize}}}),h),{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:wt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`${e}-zoom-leave`]:{animationName:jt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`&${e}-not-a-wrapper`]:{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:Et,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`${e}-zoom-leave`]:{animationName:Pt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`&:not(${e}-status)`]:{verticalAlign:"middle"},[`${u}-custom-component, ${e}-count`]:{transform:"none"},[`${u}-custom-component, ${u}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[u]:{overflow:"hidden",transition:`all ${t.motionDurationMid} ${t.motionEaseOutBack}`,[`${u}-only`]:{position:"relative",display:"inline-block",height:l,transition:`all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${u}-only-unit`]:{height:l,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${u}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${e}-count, ${e}-dot, ${u}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},ut=t=>{const{fontHeight:e,lineWidth:i,marginXS:n,colorBorderBg:o}=t,d=e,a=i,$=t.colorTextLightSolid,v=t.colorError,C=t.colorErrorHover;return Nt(t,{badgeFontHeight:d,badgeShadowSize:a,badgeTextColor:$,badgeColor:v,badgeColorHover:C,badgeShadowColor:o,badgeProcessingDuration:"1.2s",badgeRibbonOffset:n,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},mt=t=>{const{fontSize:e,lineHeight:i,fontSizeSM:n,lineWidth:o}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*i)-2*o,indicatorHeightSM:e,dotSize:n/2,textFontSize:n,textFontSizeSM:n,textFontWeight:"normal",statusSize:n/2}},Tt=it("Badge",t=>{const e=ut(t);return zt(e)},mt),Bt=t=>{const{antCls:e,badgeFontHeight:i,marginXS:n,badgeRibbonOffset:o,calc:d}=t,a=`${e}-ribbon`,$=`${e}-ribbon-wrapper`,v=at(t,(C,{darkColor:l})=>({[`&${a}-color-${C}`]:{background:l,color:l}}));return{[$]:{position:"relative"},[a]:Object.assign(Object.assign(Object.assign(Object.assign({},lt(t)),{position:"absolute",top:n,padding:`0 ${j(t.paddingXS)}`,color:t.colorPrimary,lineHeight:j(i),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,[`${a}-text`]:{color:t.badgeTextColor},[`${a}-corner`]:{position:"absolute",top:"100%",width:o,height:o,color:"currentcolor",border:`${j(d(o).div(2).equal())} solid`,transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),v),{[`&${a}-placement-end`]:{insetInlineEnd:d(o).mul(-1).equal(),borderEndEndRadius:0,[`${a}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${a}-placement-start`]:{insetInlineStart:d(o).mul(-1).equal(),borderEndStartRadius:0,[`${a}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},Rt=it(["Badge","Ribbon"],t=>{const e=ut(t);return Bt(e)},mt),Dt=t=>{const{className:e,prefixCls:i,style:n,color:o,children:d,text:a,placement:$="end",rootClassName:v}=t,{getPrefixCls:C,direction:l}=c.useContext(Y),r=C("ribbon",i),m=`${r}-wrapper`,[g,u,h]=Rt(r,m),f=ct(o,!1),y=w(r,`${r}-placement-${$}`,{[`${r}-rtl`]:l==="rtl",[`${r}-color-${o}`]:f},e),b={},N={};return o&&!f&&(b.background=o,N.color=o),g(c.createElement("div",{className:w(m,v,u,h)},d,c.createElement("div",{className:w(y,u),style:Object.assign(Object.assign({},b),n)},c.createElement("span",{className:`${r}-text`},a),c.createElement("div",{className:`${r}-corner`,style:N}))))},st=t=>{const{prefixCls:e,value:i,current:n,offset:o=0}=t;let d;return o&&(d={position:"absolute",top:`${o}00%`,left:0}),c.createElement("span",{style:d,className:w(`${e}-only-unit`,{current:n})},i)};function Wt(t,e,i){let n=t,o=0;for(;(n+10)%10!==e;)n+=i,o+=i;return o}const Ft=t=>{const{prefixCls:e,count:i,value:n}=t,o=Number(n),d=Math.abs(i),[a,$]=c.useState(o),[v,C]=c.useState(d),l=()=>{$(o),C(d)};c.useEffect(()=>{const g=setTimeout(l,1e3);return()=>clearTimeout(g)},[o]);let r,m;if(a===o||Number.isNaN(o)||Number.isNaN(a))r=[c.createElement(st,Object.assign({},t,{key:o,current:!0}))],m={transition:"none"};else{r=[];const g=o+10,u=[];for(let b=o;b<=g;b+=1)u.push(b);const h=v<d?1:-1,f=u.findIndex(b=>b%10===a);r=(h<0?u.slice(0,f+1):u.slice(f)).map((b,N)=>{const H=b%10;return c.createElement(st,Object.assign({},t,{key:b,value:H,offset:h<0?N-f:N,current:N===f}))}),m={transform:`translateY(${-Wt(a,o,h)}00%)`}}return c.createElement("span",{className:`${e}-only`,style:m,onTransitionEnd:l},r)};var Ht=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};const Mt=c.forwardRef((t,e)=>{const{prefixCls:i,count:n,className:o,motionClassName:d,style:a,title:$,show:v,component:C="sup",children:l}=t,r=Ht(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:m}=c.useContext(Y),g=m("scroll-number",i),u=Object.assign(Object.assign({},r),{"data-show":v,style:a,className:w(g,o,d),title:$});let h=n;if(n&&Number(n)%1===0){const f=String(n).split("");h=c.createElement("bdi",null,f.map((y,b)=>c.createElement(Ft,{prefixCls:g,count:Number(n),value:y,key:f.length-b})))}return a!=null&&a.borderColor&&(u.style=Object.assign(Object.assign({},a),{boxShadow:`0 0 0 1px ${a.borderColor} inset`})),l?dt(l,f=>({className:w(`${g}-custom-component`,f==null?void 0:f.className,d)})):c.createElement(C,Object.assign({},u,{ref:e}),h)});var Zt=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};const _t=c.forwardRef((t,e)=>{var i,n,o,d,a;const{prefixCls:$,scrollNumberPrefixCls:v,children:C,status:l,text:r,color:m,count:g=null,overflowCount:u=99,dot:h=!1,size:f="default",title:y,offset:b,style:N,className:H,rootClassName:bt,classNames:O,styles:S,showZero:R=!1}=t,K=Zt(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:G,direction:M,badge:s}=c.useContext(Y),p=G("badge",$),[J,gt,ft]=Tt(p),Z=g>u?`${u}+`:g,T=Z==="0"||Z===0||r==="0"||r===0,Q=g===null||T&&!R,_=(l!=null||m!=null)&&Q,pt=l!=null||!T,B=h&&!T,E=B?"":Z,P=rt(()=>((E==null||E==="")&&(r==null||r==="")||T&&!R)&&!B,[E,T,R,B,r]),k=U(g);P||(k.current=g);const I=k.current,tt=U(E);P||(tt.current=E);const V=tt.current,et=U(B);P||(et.current=B);const D=rt(()=>{if(!b)return Object.assign(Object.assign({},s==null?void 0:s.style),N);const x={marginTop:b[1]};return M==="rtl"?x.left=Number.parseInt(b[0],10):x.right=-Number.parseInt(b[0],10),Object.assign(Object.assign(Object.assign({},x),s==null?void 0:s.style),N)},[M,b,N,s==null?void 0:s.style]),vt=y??(typeof I=="string"||typeof I=="number"?I:void 0),ot=!P&&(r===0?R:!!r&&r!==!0),Ct=ot?c.createElement("span",{className:`${p}-status-text`},r):null,$t=!I||typeof I!="object"?void 0:dt(I,x=>({style:Object.assign(Object.assign({},D),x.style)})),W=ct(m,!1),ht=w(O==null?void 0:O.indicator,(i=s==null?void 0:s.classNames)===null||i===void 0?void 0:i.indicator,{[`${p}-status-dot`]:_,[`${p}-status-${l}`]:!!l,[`${p}-color-${m}`]:W}),A={};m&&!W&&(A.color=m,A.background=m);const nt=w(p,{[`${p}-status`]:_,[`${p}-not-a-wrapper`]:!C,[`${p}-rtl`]:M==="rtl"},H,bt,s==null?void 0:s.className,(n=s==null?void 0:s.classNames)===null||n===void 0?void 0:n.root,O==null?void 0:O.root,gt,ft);if(!C&&_&&(r||pt||!Q)){const x=D.color;return J(c.createElement("span",Object.assign({},K,{className:nt,style:Object.assign(Object.assign(Object.assign({},S==null?void 0:S.root),(o=s==null?void 0:s.styles)===null||o===void 0?void 0:o.root),D)}),c.createElement("span",{className:ht,style:Object.assign(Object.assign(Object.assign({},S==null?void 0:S.indicator),(d=s==null?void 0:s.styles)===null||d===void 0?void 0:d.indicator),A)}),ot&&c.createElement("span",{style:{color:x},className:`${p}-status-text`},r)))}return J(c.createElement("span",Object.assign({ref:e},K,{className:nt,style:Object.assign(Object.assign({},(a=s==null?void 0:s.styles)===null||a===void 0?void 0:a.root),S==null?void 0:S.root)}),C,c.createElement(xt,{visible:!P,motionName:`${p}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:x})=>{var L,q;const yt=G("scroll-number",v),X=et.current,St=w(O==null?void 0:O.indicator,(L=s==null?void 0:s.classNames)===null||L===void 0?void 0:L.indicator,{[`${p}-dot`]:X,[`${p}-count`]:!X,[`${p}-count-sm`]:f==="small",[`${p}-multiple-words`]:!X&&V&&V.toString().length>1,[`${p}-status-${l}`]:!!l,[`${p}-color-${m}`]:W});let F=Object.assign(Object.assign(Object.assign({},S==null?void 0:S.indicator),(q=s==null?void 0:s.styles)===null||q===void 0?void 0:q.indicator),D);return m&&!W&&(F=F||{},F.background=m),c.createElement(Mt,{prefixCls:yt,show:!P,motionClassName:x,className:St,count:V,title:vt,style:F,key:"scrollNumber"},$t)}),Ct))}),Vt=_t;Vt.Ribbon=Dt;export{Vt as B};
1
+ import*as c from"react";import{useMemo as rt,useRef as U}from"react";import{h as it,m as Nt,v as at,r as lt,w as z,y as j,n as Y,z as ct,f as w,s as dt,A as xt}from"./index-8h59dJlj.js";const Ot=new z("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),wt=new z("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),jt=new z("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),Et=new z("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),Pt=new z("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),It=new z("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),zt=t=>{const{componentCls:e,iconCls:i,antCls:n,badgeShadowSize:o,textFontSize:d,textFontSizeSM:a,statusSize:h,dotSize:v,textFontWeight:C,indicatorHeight:l,indicatorHeightSM:r,marginXS:m,calc:g}=t,u=`${n}-scroll-number`,$=at(t,(f,{darkColor:y})=>({[`&${e} ${e}-color-${f}`]:{background:y,[`&:not(${e}-count)`]:{color:y},"a:hover &":{background:y}}}));return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},lt(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${e}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:l,height:l,color:t.badgeTextColor,fontWeight:C,fontSize:d,lineHeight:j(l),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:g(l).div(2).equal(),boxShadow:`0 0 0 ${j(o)} ${t.badgeShadowColor}`,transition:`background ${t.motionDurationMid}`,a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},[`${e}-count-sm`]:{minWidth:r,height:r,fontSize:a,lineHeight:j(r),borderRadius:g(r).div(2).equal()},[`${e}-multiple-words`]:{padding:`0 ${j(t.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${e}-dot`]:{zIndex:t.indicatorZIndex,width:v,minWidth:v,height:v,background:t.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${j(o)} ${t.badgeShadowColor}`},[`${e}-count, ${e}-dot, ${u}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${i}-spin`]:{animationName:It,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${e}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${e}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:h,height:h,verticalAlign:"middle",borderRadius:"50%"},[`${e}-status-success`]:{backgroundColor:t.colorSuccess},[`${e}-status-processing`]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:o,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:Ot,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${e}-status-default`]:{backgroundColor:t.colorTextPlaceholder},[`${e}-status-error`]:{backgroundColor:t.colorError},[`${e}-status-warning`]:{backgroundColor:t.colorWarning},[`${e}-status-text`]:{marginInlineStart:m,color:t.colorText,fontSize:t.fontSize}}}),$),{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:wt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`${e}-zoom-leave`]:{animationName:jt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`&${e}-not-a-wrapper`]:{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:Et,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`${e}-zoom-leave`]:{animationName:Pt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`&:not(${e}-status)`]:{verticalAlign:"middle"},[`${u}-custom-component, ${e}-count`]:{transform:"none"},[`${u}-custom-component, ${u}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[u]:{overflow:"hidden",transition:`all ${t.motionDurationMid} ${t.motionEaseOutBack}`,[`${u}-only`]:{position:"relative",display:"inline-block",height:l,transition:`all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${u}-only-unit`]:{height:l,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${u}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${e}-count, ${e}-dot, ${u}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},ut=t=>{const{fontHeight:e,lineWidth:i,marginXS:n,colorBorderBg:o}=t,d=e,a=i,h=t.colorTextLightSolid,v=t.colorError,C=t.colorErrorHover;return Nt(t,{badgeFontHeight:d,badgeShadowSize:a,badgeTextColor:h,badgeColor:v,badgeColorHover:C,badgeShadowColor:o,badgeProcessingDuration:"1.2s",badgeRibbonOffset:n,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},mt=t=>{const{fontSize:e,lineHeight:i,fontSizeSM:n,lineWidth:o}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*i)-2*o,indicatorHeightSM:e,dotSize:n/2,textFontSize:n,textFontSizeSM:n,textFontWeight:"normal",statusSize:n/2}},Tt=it("Badge",t=>{const e=ut(t);return zt(e)},mt),Bt=t=>{const{antCls:e,badgeFontHeight:i,marginXS:n,badgeRibbonOffset:o,calc:d}=t,a=`${e}-ribbon`,h=`${e}-ribbon-wrapper`,v=at(t,(C,{darkColor:l})=>({[`&${a}-color-${C}`]:{background:l,color:l}}));return{[h]:{position:"relative"},[a]:Object.assign(Object.assign(Object.assign(Object.assign({},lt(t)),{position:"absolute",top:n,padding:`0 ${j(t.paddingXS)}`,color:t.colorPrimary,lineHeight:j(i),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,[`${a}-text`]:{color:t.badgeTextColor},[`${a}-corner`]:{position:"absolute",top:"100%",width:o,height:o,color:"currentcolor",border:`${j(d(o).div(2).equal())} solid`,transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),v),{[`&${a}-placement-end`]:{insetInlineEnd:d(o).mul(-1).equal(),borderEndEndRadius:0,[`${a}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${a}-placement-start`]:{insetInlineStart:d(o).mul(-1).equal(),borderEndStartRadius:0,[`${a}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},Rt=it(["Badge","Ribbon"],t=>{const e=ut(t);return Bt(e)},mt),Dt=t=>{const{className:e,prefixCls:i,style:n,color:o,children:d,text:a,placement:h="end",rootClassName:v}=t,{getPrefixCls:C,direction:l}=c.useContext(Y),r=C("ribbon",i),m=`${r}-wrapper`,[g,u,$]=Rt(r,m),f=ct(o,!1),y=w(r,`${r}-placement-${h}`,{[`${r}-rtl`]:l==="rtl",[`${r}-color-${o}`]:f},e),b={},N={};return o&&!f&&(b.background=o,N.color=o),g(c.createElement("div",{className:w(m,v,u,$)},d,c.createElement("div",{className:w(y,u),style:Object.assign(Object.assign({},b),n)},c.createElement("span",{className:`${r}-text`},a),c.createElement("div",{className:`${r}-corner`,style:N}))))},st=t=>{const{prefixCls:e,value:i,current:n,offset:o=0}=t;let d;return o&&(d={position:"absolute",top:`${o}00%`,left:0}),c.createElement("span",{style:d,className:w(`${e}-only-unit`,{current:n})},i)};function Wt(t,e,i){let n=t,o=0;for(;(n+10)%10!==e;)n+=i,o+=i;return o}const Ft=t=>{const{prefixCls:e,count:i,value:n}=t,o=Number(n),d=Math.abs(i),[a,h]=c.useState(o),[v,C]=c.useState(d),l=()=>{h(o),C(d)};c.useEffect(()=>{const g=setTimeout(l,1e3);return()=>clearTimeout(g)},[o]);let r,m;if(a===o||Number.isNaN(o)||Number.isNaN(a))r=[c.createElement(st,Object.assign({},t,{key:o,current:!0}))],m={transition:"none"};else{r=[];const g=o+10,u=[];for(let b=o;b<=g;b+=1)u.push(b);const $=v<d?1:-1,f=u.findIndex(b=>b%10===a);r=($<0?u.slice(0,f+1):u.slice(f)).map((b,N)=>{const H=b%10;return c.createElement(st,Object.assign({},t,{key:b,value:H,offset:$<0?N-f:N,current:N===f}))}),m={transform:`translateY(${-Wt(a,o,$)}00%)`}}return c.createElement("span",{className:`${e}-only`,style:m,onTransitionEnd:l},r)};var Ht=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};const Mt=c.forwardRef((t,e)=>{const{prefixCls:i,count:n,className:o,motionClassName:d,style:a,title:h,show:v,component:C="sup",children:l}=t,r=Ht(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:m}=c.useContext(Y),g=m("scroll-number",i),u=Object.assign(Object.assign({},r),{"data-show":v,style:a,className:w(g,o,d),title:h});let $=n;if(n&&Number(n)%1===0){const f=String(n).split("");$=c.createElement("bdi",null,f.map((y,b)=>c.createElement(Ft,{prefixCls:g,count:Number(n),value:y,key:f.length-b})))}return a!=null&&a.borderColor&&(u.style=Object.assign(Object.assign({},a),{boxShadow:`0 0 0 1px ${a.borderColor} inset`})),l?dt(l,f=>({className:w(`${g}-custom-component`,f==null?void 0:f.className,d)})):c.createElement(C,Object.assign({},u,{ref:e}),$)});var Zt=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i};const _t=c.forwardRef((t,e)=>{var i,n,o,d,a;const{prefixCls:h,scrollNumberPrefixCls:v,children:C,status:l,text:r,color:m,count:g=null,overflowCount:u=99,dot:$=!1,size:f="default",title:y,offset:b,style:N,className:H,rootClassName:bt,classNames:O,styles:S,showZero:R=!1}=t,K=Zt(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:G,direction:M,badge:s}=c.useContext(Y),p=G("badge",h),[J,gt,ft]=Tt(p),Z=g>u?`${u}+`:g,T=Z==="0"||Z===0||r==="0"||r===0,Q=g===null||T&&!R,_=(l!=null||m!=null)&&Q,pt=l!=null||!T,B=$&&!T,E=B?"":Z,P=rt(()=>((E==null||E==="")&&(r==null||r==="")||T&&!R)&&!B,[E,T,R,B,r]),k=U(g);P||(k.current=g);const I=k.current,tt=U(E);P||(tt.current=E);const V=tt.current,et=U(B);P||(et.current=B);const D=rt(()=>{if(!b)return Object.assign(Object.assign({},s==null?void 0:s.style),N);const x={marginTop:b[1]};return M==="rtl"?x.left=Number.parseInt(b[0],10):x.right=-Number.parseInt(b[0],10),Object.assign(Object.assign(Object.assign({},x),s==null?void 0:s.style),N)},[M,b,N,s==null?void 0:s.style]),vt=y??(typeof I=="string"||typeof I=="number"?I:void 0),ot=!P&&(r===0?R:!!r&&r!==!0),Ct=ot?c.createElement("span",{className:`${p}-status-text`},r):null,ht=!I||typeof I!="object"?void 0:dt(I,x=>({style:Object.assign(Object.assign({},D),x.style)})),W=ct(m,!1),$t=w(O==null?void 0:O.indicator,(i=s==null?void 0:s.classNames)===null||i===void 0?void 0:i.indicator,{[`${p}-status-dot`]:_,[`${p}-status-${l}`]:!!l,[`${p}-color-${m}`]:W}),A={};m&&!W&&(A.color=m,A.background=m);const nt=w(p,{[`${p}-status`]:_,[`${p}-not-a-wrapper`]:!C,[`${p}-rtl`]:M==="rtl"},H,bt,s==null?void 0:s.className,(n=s==null?void 0:s.classNames)===null||n===void 0?void 0:n.root,O==null?void 0:O.root,gt,ft);if(!C&&_&&(r||pt||!Q)){const x=D.color;return J(c.createElement("span",Object.assign({},K,{className:nt,style:Object.assign(Object.assign(Object.assign({},S==null?void 0:S.root),(o=s==null?void 0:s.styles)===null||o===void 0?void 0:o.root),D)}),c.createElement("span",{className:$t,style:Object.assign(Object.assign(Object.assign({},S==null?void 0:S.indicator),(d=s==null?void 0:s.styles)===null||d===void 0?void 0:d.indicator),A)}),ot&&c.createElement("span",{style:{color:x},className:`${p}-status-text`},r)))}return J(c.createElement("span",Object.assign({ref:e},K,{className:nt,style:Object.assign(Object.assign({},(a=s==null?void 0:s.styles)===null||a===void 0?void 0:a.root),S==null?void 0:S.root)}),C,c.createElement(xt,{visible:!P,motionName:`${p}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:x})=>{var L,q;const yt=G("scroll-number",v),X=et.current,St=w(O==null?void 0:O.indicator,(L=s==null?void 0:s.classNames)===null||L===void 0?void 0:L.indicator,{[`${p}-dot`]:X,[`${p}-count`]:!X,[`${p}-count-sm`]:f==="small",[`${p}-multiple-words`]:!X&&V&&V.toString().length>1,[`${p}-status-${l}`]:!!l,[`${p}-color-${m}`]:W});let F=Object.assign(Object.assign(Object.assign({},S==null?void 0:S.indicator),(q=s==null?void 0:s.styles)===null||q===void 0?void 0:q.indicator),D);return m&&!W&&(F=F||{},F.background=m),c.createElement(Mt,{prefixCls:yt,show:!P,motionClassName:x,className:St,count:V,title:vt,style:F,key:"scrollNumber"},ht)}),Ct))}),Vt=_t;Vt.Ribbon=Dt;export{Vt as B};