bi-components-library 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -9
- package/dist/bi-components-library.css +1 -1
- package/dist/index.es.js +1966 -1589
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(X,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","antd","@ant-design/icons","react-dom"],l):(X=typeof globalThis<"u"?globalThis:X||self,l(X.SealSeekBIComponents={},X.React,X.React,X.antd,X.AntdIcons,X.ReactDOM))})(this,function(X,l,c,W,de,Qe){"use strict";const Ie=({variant:t="primary",loading:g=!1,children:p,...u})=>{const d=w=>{switch(w){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return l.jsx(W.Button,{...u,type:d(t),loading:g,ghost:t==="ghost",children:p})};Ie.__docgenInfo={displayName:"Button",description:"基础按钮,用于触发操作",props:{variant:{name:"variant",required:!1,description:"视觉风格",type:{name:"ButtonVariant",raw:'"primary" | "ghost" | "dashed" | "link" | "text"'},defaultValue:{value:'"primary"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: MouseEvent) => void"}}}};const Be=({title:t,children:g,bordered:p=!0,hoverable:u=!1,size:d="default",...w})=>l.jsx(W.Card,{...w,title:t,bordered:p,hoverable:u,size:d,children:g});Be.__docgenInfo={displayName:"Card",description:"卡片容器,用于分组内容",props:{title:{name:"title",required:!1,description:"标题",type:{name:"ReactNode",raw:"React.ReactNode"}},children:{name:"children",required:!1,description:"内容区域",type:{name:"ReactNode",raw:"React.ReactNode"}},bordered:{name:"bordered",required:!1,description:"是否显示边框",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},hoverable:{name:"hoverable",required:!1,description:"是否可悬停",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},size:{name:"size",required:!1,description:"卡片大小",type:{name:"CardSize",raw:'"default" | "small"'},defaultValue:{value:'"default"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},actions:{name:"actions",required:!1,description:"卡片操作组",type:{name:"ReactNode[]",raw:"React.ReactNode[]"}}}};const Ve=({showDefaultFooter:t=!0,...g})=>{const p=g.footer!==void 0?g.footer:t?(u,{OkBtn:d,CancelBtn:w})=>l.jsxs(l.Fragment,{children:[l.jsx(d,{}),l.jsx(w,{})]}):null;return l.jsx(W.Modal,{...g,footer:p})};Ve.__docgenInfo={displayName:"AppModal",description:"应用级模态框组件,基于 Ant Design Modal 封装",props:{showDefaultFooter:{name:"showDefaultFooter",required:!1,description:"是否显示默认的确定和取消按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},title:{name:"title",required:!1,description:"模态框标题",type:{name:"ReactNode",raw:"React.ReactNode"}},open:{name:"open",required:!1,description:"是否显示模态框",type:{name:"boolean",raw:"boolean"}},onCancel:{name:"onCancel",required:!1,description:"取消按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},onOk:{name:"onOk",required:!1,description:"确定按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},children:{name:"children",required:!1,description:"模态框内容",type:{name:"ReactNode",raw:"React.ReactNode"}},width:{name:"width",required:!1,description:"模态框宽度",type:{name:"string | number",raw:"string | number"}},centered:{name:"centered",required:!1,description:"是否居中显示",type:{name:"boolean",raw:"boolean"}},maskClosable:{name:"maskClosable",required:!1,description:"点击蒙层是否允许关闭",type:{name:"boolean",raw:"boolean"}}}};const _e=({scrollX:t,showPagination:g=!0,defaultPageSize:p=10,...u})=>l.jsx(W.Table,{...u,scroll:{x:t||"max-content",y:"50vh"},pagination:g?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:p,...u.pagination}:!1});_e.__docgenInfo={displayName:"PageTable",description:"页面级表格组件,高度铺满容器,自动滚动",props:{scrollX:{name:"scrollX",required:!1,description:"水平滚动宽度",type:{name:"number",raw:"number"}},showPagination:{name:"showPagination",required:!1,description:"是否显示分页器",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},columns:{name:"columns",required:!1,description:"表格列配置",type:{name:"ColumnType[]",raw:"ColumnType<any>[]"}},dataSource:{name:"dataSource",required:!1,description:"数据源",type:{name:"any[]",raw:"any[]"}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},rowKey:{name:"rowKey",required:!1,description:"行数据的 Key",type:{name:"string | function",raw:"string | ((record: any) => string)"}}}};const Ye=de.createFromIconfontCN({scriptUrl:["https://at.alicdn.com/t/c/font_4968458_eh91gfr4j9e.js"]}),Ge=({name:t,size:g,color:p,style:u,...d})=>{const w={fontSize:g,color:p,...u};return l.jsx(Ye,{...d,type:t,style:w})};Ge.__docgenInfo={displayName:"XcIcon",description:"自定义图标组件,基于 iconfont",props:{name:{name:"name",required:!0,description:"图标名称",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"图标大小",type:{name:"number | string",raw:"number | string"}},color:{name:"color",required:!1,description:"图标颜色",type:{name:"string",raw:"string"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const De=({loading:t,description:g="暂无数据",className:p,emptyChildren:u,loadingText:d,emptyImage:w})=>t?l.jsxs(W.Flex,{className:`pt-10 w-full ${p||""}`,align:"center",justify:"center",vertical:!0,children:[l.jsx(W.Spin,{size:"large"}),d&&l.jsx("div",{className:"mt-4 text-gray-500",children:d})]}):l.jsx(W.Flex,{className:`pt-10 w-full ${p||""}`,align:"center",justify:"center",children:l.jsx(W.Empty,{image:w,description:g,imageStyle:{height:180},children:u})});De.__docgenInfo={displayName:"EmptyAndSpin",description:"空状态和加载状态组合组件",props:{loading:{name:"loading",required:!0,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},description:{name:"description",required:!1,description:"空状态描述",type:{name:"ReactNode",raw:"React.ReactNode"},defaultValue:{value:'"暂无数据"'}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},emptyChildren:{name:"emptyChildren",required:!1,description:"空状态额外内容",type:{name:"ReactNode",raw:"React.ReactNode"}},loadingText:{name:"loadingText",required:!1,description:"加载中提示文字",type:{name:"string",raw:"string"}},emptyImage:{name:"emptyImage",required:!1,description:"空状态图片",type:{name:"string",raw:"string"}}}};const Pe=({onClick:t,showText:g=!1,className:p,size:u="small",type:d="default"})=>l.jsx(W.Button,{size:u,type:d,icon:l.jsx(de.LeftOutlined,{}),className:`cursor-pointer ${p||""}`,onClick:t,children:g&&"返回"});Pe.__docgenInfo={displayName:"BackButton",description:"返回按钮组件",props:{onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"() => void"}},showText:{name:"showText",required:!1,description:"是否显示文字",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'},defaultValue:{value:'"small"'}},type:{name:"type",required:!1,description:"按钮类型",type:{name:"ButtonType",raw:'"primary" | "default" | "dashed" | "link" | "text"'},defaultValue:{value:'"default"'}}}};const Me=({removePadding:t=!0,className:g,...p})=>{const u=t?`px-0 h-auto ${g||""}`:g;return l.jsx(W.Button,{type:"link",...p,className:u,children:p.children})};Me.__docgenInfo={displayName:"LinkButton",description:"链接样式按钮组件,适用于表格操作列",props:{removePadding:{name:"removePadding",required:!1,description:"是否去除默认内边距",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLButtonElement>) => void"}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}}}};const{Option:Ze}=W.Select,He=({columns:t,request:g,searchFields:p=[],showSearch:u=!0,showRefresh:d=!0,defaultPageSize:w=10,pageSizeOptions:I=["10","20","50","100"],autoLoad:C=!0,externalParams:T={},...e})=>{const[L,h]=c.useState([]),[i,n]=c.useState(!1),[a,o]=c.useState({current:1,pageSize:w,total:0}),[r,s]=c.useState({}),[f,v]=c.useState({}),[x]=W.Form.useForm(),D=c.useRef(a);D.current=a;const S=c.useRef(T);S.current=T;const G=c.useRef(!1),F=c.useMemo(()=>t.map(N=>{const{sortable:H,render:te,...ae}=N;return{...ae,sorter:H?!0:void 0,render:te||(se=>se)}}),[t]),M=c.useCallback(async(N={})=>{if(g){n(!0);try{const H={page:D.current.current,pageSize:D.current.pageSize,sortField:f.field,sortOrder:f.order,searchParams:{...r,...S.current},...N},te=await g(H);te.success&&(h(te.data),o(ae=>({...ae,total:te.total,current:H.page||ae.current})))}catch(H){console.error("加载数据失败:",H)}finally{n(!1)}}},[g,f,r]),U=c.useCallback(N=>{s(N),o(H=>({...H,current:1}))},[]),J=c.useCallback(()=>{x.resetFields(),s({}),o(N=>({...N,current:1}))},[x]),Q=c.useCallback(()=>{M()},[M]),Z=c.useCallback((N,H,te)=>{const ae={current:N.current||1,pageSize:N.pageSize||w,total:N.total||0},se={field:te?.field,order:te?.order};o(ae),v(se)},[w]);return c.useEffect(()=>{const N=Object.keys(T).length>0;(C&&!G.current||N)&&(M(),G.current=!0)},[C,T,M]),l.jsxs("div",{children:[u&&p.length>0&&l.jsx(W.Card,{size:"small",style:{marginBottom:16},children:l.jsxs(W.Form,{form:x,layout:"inline",onFinish:U,initialValues:p.reduce((N,H)=>(H.defaultValue!==void 0&&(N[H.key]=H.defaultValue),N),{}),children:[p.map(N=>l.jsx(W.Form.Item,{name:N.key,label:N.label,children:N.type==="input"?l.jsx(W.Input,{placeholder:N.placeholder||`请输入${N.label}`,style:{width:200}}):l.jsx(W.Select,{placeholder:N.placeholder||`请选择${N.label}`,style:{width:200},allowClear:!0,children:N.options?.map(H=>l.jsx(Ze,{value:H.value,children:H.label},H.value))})},N.key)),l.jsx(W.Form.Item,{children:l.jsxs(W.Space,{children:[l.jsx(W.Button,{type:"primary",htmlType:"submit",icon:l.jsx(de.SearchOutlined,{}),children:"查询"}),l.jsx(W.Button,{onClick:J,children:"重置"}),d&&l.jsx(W.Button,{icon:l.jsx(de.ReloadOutlined,{}),onClick:Q,children:"刷新"})]})})]})}),l.jsx(W.Table,{...e,columns:F,dataSource:L,loading:i,pagination:{...a,showSizeChanger:!0,showQuickJumper:!0,showTotal:(N,H)=>`第 ${H[0]}-${H[1]} 条/共 ${N} 条`,pageSizeOptions:I},onChange:Z,scroll:{x:"max-content",y:"50vh"}})]})};He.__docgenInfo={displayName:"AdvancedTable",description:"高阶表格组件,支持异步请求、搜索、排序等功能",props:{columns:{name:"columns",required:!0,description:"列配置",type:{name:"AdvancedColumnType[]",raw:"AdvancedColumnType<any>[]"}},request:{name:"request",required:!1,description:"异步请求函数",type:{name:"function",raw:"(params: RequestParams) => Promise<RequestResponse>"}},searchFields:{name:"searchFields",required:!1,description:"搜索字段配置",type:{name:"SearchFieldConfig[]",raw:"SearchFieldConfig[]"},defaultValue:{value:"[]"}},showSearch:{name:"showSearch",required:!1,description:"是否显示搜索区域",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},showRefresh:{name:"showRefresh",required:!1,description:"是否显示刷新按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},pageSizeOptions:{name:"pageSizeOptions",required:!1,description:"页面大小选项",type:{name:"string[]",raw:"string[]"},defaultValue:{value:'["10", "20", "50", "100"]'}},autoLoad:{name:"autoLoad",required:!1,description:"是否自动加载",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},externalParams:{name:"externalParams",required:!1,description:"外部请求参数",type:{name:"Record<string, any>",raw:"Record<string, any>"},defaultValue:{value:"{}"}}}};function he(t,g,p){if(!t.current)return;const u=new Set,d={};for(const h of g)h.exclusionGroup&&h.exclusionGroup!=="separator"&&(u.add(h.exclusionGroup),d[h.exclusionGroup]||(d[h.exclusionGroup]=[]),d[h.exclusionGroup].push({type:h.type,key:h.key,exclusionGroup:h.exclusionGroup}));const w={};for(const h of u){w[h]=!1;for(const i of d[h])if(i.type==="upload"&&i.key){if(p[i.key]!==null&&p[i.key]!==void 0){w[h]=!0;break}}else if(i.type==="variable"&&i.key){const n=t.current.querySelector(`[data-type="variable"][data-key="${i.key}"]`);if(n&&n.innerText.replace(/[\u200B\n]/g,"").trim().length>0){w[h]=!0;break}}}const I=g.some(h=>h.exclusionGroup==="separator"),T=Object.keys(w).filter(h=>w[h]).length>0;let e=null;if(T&&I){for(const h of g)if(h.exclusionGroup&&h.exclusionGroup!=="separator"&&w[h.exclusionGroup]){e=h.exclusionGroup;break}}for(const h of u){const i=t.current.querySelectorAll(`[data-group="${h}"]`);I&&T&&e?h===e?i.forEach(n=>{n.classList.contains("required-upload-group")?n.style.setProperty("display","inline-flex","important"):(n.classList.contains("exclusion-wrapper"),n.style.setProperty("display","inline-block","important"))}):i.forEach(n=>{n.style.display="none",n.style.setProperty("display","none","important")}):i.forEach(n=>{n.classList.contains("required-upload-group")?n.style.setProperty("display","inline-flex","important"):(n.classList.contains("exclusion-wrapper"),n.style.setProperty("display","inline-block","important"))})}t.current.querySelectorAll('[data-group="separator"]').forEach(h=>{h.style.display=T?"none":"inline"})}function ve(t,g,p,u){if(!t.current){u(!1);return}const d=[];for(let i=0;i<g.length;i++){const n=g[i];if((n.type==="variable"||n.type==="upload"||n.type==="multi-variable"||n.type==="select"||n.type==="textarea"||n.type==="richtext"||n.type==="datepicker")&&n.required&&n.key){d.push({exclusionGroup:n.exclusionGroup||"",key:n.key,type:n.type==="multi-variable"?"variable":n.type,isMultiVariable:n.type==="multi-variable",minCount:n.type==="multi-variable"?n.minCount:void 0});continue}if(n.type==="text"&&n.className?.includes("rte-text-required"))if(n.exclusionGroup)for(let a=i+1;a<g.length;a++){const o=g[a];if(o.exclusionGroup===n.exclusionGroup&&(o.type==="variable"||o.type==="upload"||o.type==="select"||o.type==="textarea"||o.type==="richtext"||o.type==="datepicker")&&o.key){d.push({exclusionGroup:n.exclusionGroup,key:o.key,type:o.type});break}}else for(let a=i+1;a<g.length;a++){const o=g[a];if((o.type==="variable"||o.type==="upload"||o.type==="select"||o.type==="textarea"||o.type==="richtext"||o.type==="datepicker")&&o.key){d.push({exclusionGroup:o.exclusionGroup||"",key:o.key,type:o.type});break}}}const w=g.some(i=>i.exclusionGroup==="separator"),I=[];if(w&&d.length>1){const i=[];g.forEach((n,a)=>{n.exclusionGroup==="separator"&&i.push(a)});for(const n of i){let a=null;for(let r=n-1;r>=0;r--){const s=g[r];if((s.type==="variable"||s.type==="upload"||s.type==="select"||s.type==="textarea"||s.type==="richtext"||s.type==="datepicker")&&s.key){const f=d.find(v=>v.key===s.key);if(f){a=f;break}}}let o=null;for(let r=n+1;r<g.length;r++){const s=g[r];if((s.type==="variable"||s.type==="upload"||s.type==="select"||s.type==="textarea"||s.type==="richtext"||s.type==="datepicker")&&s.key){const f=d.find(v=>v.key===s.key);if(f){o=f;break}}}a&&o&&I.push([a,o])}}if(d.length===0){if(g.length===0){if(!t.current){u(!1);return}const i=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";u(i.length>0);return}u(!0);return}const C=d.filter(i=>{if(!t.current)return!1;if(i.exclusionGroup){const n=t.current.querySelectorAll(`[data-group="${i.exclusionGroup}"]`);if(n.length>0)return n[0].style.display!=="none"}if(i.type==="upload"&&i.key){const n=t.current.querySelector(`[data-type="upload"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="variable"&&i.key)if(i.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${i.key}"]`);if(n.length>0){const a=n[0],o=a.closest("[data-group]")||a.parentElement;return o?o.style.display!=="none":!0}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="select"&&i.key){const n=t.current.querySelector(`[data-type="select"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="textarea"&&i.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="richtext"&&i.key){const n=t.current.querySelector(`[data-type="richtext"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="datepicker"&&i.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}return!1});if(C.length===0){u(!0);return}const T=new Set;I.forEach(i=>{i.forEach(n=>{n.key&&T.add(n.key)})});const e=C.filter(i=>!i.key||!T.has(i.key));let L=(I.length===0,!0);for(const i of I){const n=i.filter(o=>{if(!t.current)return!1;if(o.exclusionGroup){const r=t.current.querySelectorAll(`[data-group="${o.exclusionGroup}"]`);if(r.length>0)return r[0].style.display!=="none"}return!0});if(n.length===0)continue;let a=!1;for(const o of n)if(o.type==="upload"&&o.key){if(p[o.key]!==null&&p[o.key]!==void 0){a=!0;break}}else if(o.type==="variable"&&o.key)if(o.isMultiVariable){const r=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${o.key}"]`);let s=0;for(const v of Array.from(r))v.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(s+=1);const f=o.minCount&&o.minCount>0?o.minCount:1;if(s>=f){a=!0;break}}else{const r=t.current.querySelector(`[data-type="variable"][data-key="${o.key}"]`);if(r&&r.innerText.replace(/[\u200B\n]/g,"").trim().length>0){a=!0;break}}else if(o.type==="select"&&o.key){const r=t.current.querySelector(`[data-type="select"][data-key="${o.key}"]`);if(r&&(r.value||"").trim().length>0){a=!0;break}}else if(o.type==="textarea"&&o.key){const r=t.current.querySelector(`[data-type="textarea"][data-key="${o.key}"]`);if(r&&(r.value||"").trim().length>0){a=!0;break}}else if(o.type==="richtext"&&o.key){const r=t.current.querySelector(`[data-type="richtext"][data-key="${o.key}"]`);if(r&&(r.textContent||"").replace(/[\u200B]/g,"").trim().length>0){a=!0;break}}else if(o.type==="datepicker"&&o.key){const r=t.current.querySelector(`[data-type="datepicker"][data-key="${o.key}"]`);if(r&&(r.getAttribute("data-value")||"").trim().length>0){a=!0;break}}if(!a){L=!1;break}}let h=!0;for(const i of e)if(i.type==="upload"&&i.key){if(p[i.key]===null||p[i.key]===void 0){h=!1;break}}else if(i.type==="variable"&&i.key)if(i.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${i.key}"]`);let a=0;for(const r of Array.from(n))r.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(a+=1);const o=i.minCount&&i.minCount>0?i.minCount:1;if(a<o){h=!1;break}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${i.key}"]`);if(!n){h=!1;break}if(n.innerText.replace(/[\u200B\n]/g,"").trim().length===0){h=!1;break}}else if(i.type==="select"&&i.key){const n=t.current.querySelector(`[data-type="select"][data-key="${i.key}"]`);if(!n||(n.value||"").trim().length===0){h=!1;break}}else if(i.type==="textarea"&&i.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${i.key}"]`);if(!n||(n.value||"").trim().length===0){h=!1;break}}else if(i.type==="richtext"&&i.key){const n=t.current.querySelector(`[data-type="richtext"][data-key="${i.key}"]`);if(!n||(n.textContent||"").replace(/[\u200B]/g,"").trim().length===0){h=!1;break}}else if(i.type==="datepicker"&&i.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${i.key}"]`);if(!n||(n.getAttribute("data-value")||"").trim().length===0){h=!1;break}}u(L&&h)}function qe(t,g){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(u=>{const d=u.innerText.replace(/\n/g,"");d.replace(/\u200B/g,"")?u.classList.remove("show-placeholder"):(d!==""&&(u.innerText=""),u.classList.add("show-placeholder"))})}function Re(t,g,p,u,d,w={},I){if(!t.current)return;let C="",T=0;for(;T<g.length;){const e=g[T],L=T+1<g.length?g[T+1]:null;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&L){const r=L.type==="upload"&&L.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===L.exclusionGroup,s=L.type==="variable"&&L.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===L.exclusionGroup;if(r){const v=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,x="</span>";let D="";e.className?D=`<span class="${e.className}">${e.text??""}</span>`:D=e.text??"";const S=L,G=p[S.key]!==null&&p[S.key]!==void 0,F=G?p[S.key]:null,M=G?p[S.key]?.name:S.text,U=G?"":"hidden",J=S.tooltip&&!G?"":"hidden",Q=G?"has-file":"",Z=G&&M?` data-file-name="${M.replace(/"/g,""")}"`:"";let N="";G&&F&&(F.type?.startsWith("image/")?N=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(F)}" alt="preview" />`:N="<i class='iconfont icon-exlwenjian'></i>");const H=`<span contenteditable="false" data-type="upload" data-key="${S.key}" class="upload-chip"><span class="upload-inner-wrapper ${Q}"><span class="upload-icon">${N}</span><span class="upload-label"${Z}>${M||S.text}</span>${S.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${J}" data-upload-key="${S.key}" data-tooltip="${S.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${U}" title="移除文件">×</span></span></span>`;C+=v+D+H+x,T+=2;continue}if(s){const v=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,x="</span>";let D="";e.className?D=`<span class="${e.className}">${e.text??""}</span>`:D=e.text??"";const S=L,F=(S.key?d[S.key]:void 0)||S.text||"",M=!F,U=M?"":F,J=M?"show-placeholder":"",Q=S.exclusionGroup?` data-group="${S.exclusionGroup}"`:"",Z=S.tooltip?` data-tooltip="${S.tooltip.replace(/"/g,""")}" data-variable-key="${S.key||""}"`:"",N=S.tooltip&&M?"":"hidden",H=`<span contenteditable="true" data-type="variable" data-key="${S.key}" data-placeholder="${S.placeholder||""}"${Q}${Z} class="variable-chip ${J}">${U}${S.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${N}" data-variable-key="${S.key}" data-tooltip="${S.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;C+=v+D+H+x,T+=2;continue}}const i=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",n=e.exclusionGroup?`<span ${i} class="exclusion-wrapper">`:"",a=e.exclusionGroup?"</span>":"";let o="";if(e.type==="tag"){const s=u||I==="hideTagClose"?"":'<span class="tag-close-btn" title="Clear (ESC)"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg></span>',f=u?' data-locked="true"':"",v=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-tag-key="${e.key||""}"`:"";o=`<span contenteditable="false" class="tag-node group"${f}${v}><span class="tag-label">${e.text}</span>${s}</span>`}else if(e.type==="text"){const r=u?' data-locked="true" contenteditable="false"':' contenteditable="false"',f=(e.text??"").replace(/\n/g,"<br/>");e.className?o=`<span class="${e.className}"${r}>${f}</span>`:o=u?`<span${r}>${f}</span>`:`<span contenteditable="false">${f}</span>`}else if(e.type==="variable"&&e.key){const s=d[e.key]||e.text||"",f=!s,v=f?"":s,x=f?"show-placeholder":"",D=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",S=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",G=e.tooltip&&f?"":"hidden",F=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${D}${S} class="variable-chip ${x}">${v}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${G}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</span>`:o=F}else if(e.type==="upload"&&e.key){const r=p[e.key]!==null&&p[e.key]!==void 0,s=r?p[e.key]:null,f=r?p[e.key]?.name:e.text,v=r?"":"hidden",x=e.tooltip&&!r?"":"hidden",D=r?"has-file":"",S=r&&f?` data-file-name="${f.replace(/"/g,""")}"`:"";let G="";r&&s&&(s.type?.startsWith("image/")?G=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(s)}" alt="preview" />`:G="<i class='iconfont icon-exlwenjian'></i>");const F=`<span contenteditable="false" data-type="upload" data-key="${e.key}" class="upload-chip"><span class="upload-inner-wrapper ${D}"><span class="upload-icon">${G}</span><span class="upload-label"${S}>${f||e.text}</span>${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${x}" data-upload-key="${e.key}" data-tooltip="${e.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${v}" title="移除文件">×</span></span></span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</span>`:o=F}else if(e.type==="select"&&e.key){const r=d[e.key]??e.text??"",s=(e.options||[]).map(S=>{const G=r===S.value?"selected":"";return`<option value="${S.value}" ${G}>${S.label}</option>`}).join(""),f=e.placeholder?`<option value="" ${r?"":"selected"} disabled hidden>${e.placeholder}</option>`:"",D=`<span class="rte-select-wrapper">${`<select data-type="select" data-key="${e.key}" class="rte-select rte-select-has-icon">${f}${s}</select>`}<i class="iconfont icon-qiehuan-xiayizhang rte-select-icon"></i></span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${D}</span>`:o=D}else if(e.type==="textarea"&&e.key){const r=d[e.key]||"",s=e.maxHeight||252,f=e.expandable!==!1,v=e.placeholder?` placeholder="${e.placeholder}"`:"",x=`<textarea data-type="textarea" data-key="${e.key}" class="rte-textarea" data-max-height="${s}" style="max-height:${s}px;"${v}>${r}</textarea>`,D=f?`<button type="button" class="rte-textarea-toggle" data-key="${e.key}" data-expanded="false">展开</button>`:"",S=`<div class="rte-textarea-wrapper" data-key="${e.key}">${x}${D}</div>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${S}</span>`:o=S}else if(e.type==="richtext"&&e.key){const r=d[e.key]||e.text||"",s=e.minHeight||140,f=e.placeholder?` data-placeholder="${e.placeholder}"`:"",v=e.expandable!==!1,x=r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),D=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" class="rte-richtext"${f} style="min-height:${s}px;">${x}</div>`,S=v?`<button type="button" class="rte-richtext-toggle" data-key="${e.key}" data-expanded="false"><i class="iconfont icon-zhankai2"></i><span class="rte-richtext-toggle-label">展开</span></button>`:"",G=`<div class="rte-richtext-wrapper" data-key="${e.key}">${D}${S}</div>`,F=`<div class="rte-richtext-container" data-key="${e.key}">${G}</div>`;e.required?o=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group rte-richtext-required"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</div>`:o=F}else if(e.type==="datepicker"&&e.key){const r=d[e.key]||"",s=e.placeholder?` data-placeholder="${e.placeholder}"`:"",f=`<div data-type="datepicker" data-key="${e.key}" data-value="${r}" class="rte-datepicker-host"${s}></div>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${f}</span>`:o=f}else if(e.type==="multi-variable"&&e.key){const r=e.maxCount||9,s=w[e.key]||1,f=Math.min(s,r);if(e.required){const v=`<span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>`,x=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"";let D="";for(let S=0;S<f;S++){const G=`${e.key}_${S}`,F=d[G]||"",M=!F,U=M?"":F,J=M?"show-placeholder":"",Q=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",Z=e.tooltip&&M?"":"hidden",N=`<span contenteditable="true" data-type="variable" data-key="${G}" data-multi-key="${e.key}" data-index="${S}" data-placeholder="${e.placeholder||""}"${Q} class="variable-chip ${J}">${U}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${Z}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;S===0?D+=`<span ${x} class="exclusion-wrapper required-upload-group required-multi-first">${v}${N}</span>`:D+=N}o=D}else{let v="";for(let x=0;x<f;x++){const D=`${e.key}_${x}`,S=d[D]||"",G=!S,F=G?"":S,M=G?"show-placeholder":"",U=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",J=e.tooltip&&G?"":"hidden",Q=`<span contenteditable="true" data-type="variable" data-key="${D}" data-multi-key="${e.key}" data-index="${x}" data-placeholder="${e.placeholder||""}"${U} class="variable-chip ${M}">${F}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${J}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;v+=Q}o=v}}C+=n+o+a,T++}t.current&&(t.current.innerHTML=C,setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(L=>{const h=L.innerText.replace(/\n/g,"");h.replace(/\u200B/g,"")?L.classList.remove("show-placeholder"):(h!==""&&(L.innerText=""),L.classList.add("show-placeholder"))})},0))}function et(t,g,p,u,d={},w,I,C){const T=c.useCallback(()=>{if(!t.current)return;if(g.length===0){t.current.innerHTML="";return}let e={};const h=t.current.__tempVariableValues;if(h?(e=h,setTimeout(()=>{if(t.current){const i=t.current;i.__tempVariableValues===h&&delete i.__tempVariableValues}},100)):(t.current.querySelectorAll('[data-type="variable"]').forEach(s=>{const f=s.dataset.key;if(f){const v=s.innerText.replace(/[\u200B\n]/g,"").trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="select"]').forEach(s=>{const f=s.dataset.key;if(f){const v=s.value.trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(s=>{const f=s.dataset.key;if(f){const v=s.value.replace(/[\u200B]/g,"").trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="richtext"]').forEach(s=>{const f=s.dataset.key;if(f){const v=(s.textContent||"").replace(/[\u200B]/g,"").trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="datepicker"]').forEach(s=>{const f=s.dataset.key;if(f){const v=(s.getAttribute("data-value")||"").trim();v&&(e[f]=v)}})),Re(t,g,p,u,e,d,C),w?.current){const{key:i,offset:n}=w.current;setTimeout(()=>{if(!t.current)return;const a=t.current.querySelector(`[data-type="variable"][data-key="${i}"]`);if(a){try{const o=document.createRange(),r=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null);let s=0,f=null,v=0;for(;r.nextNode();){const x=r.currentNode,D=x.textContent?.length||0;if(s+D>=n){f=x,v=n-s;break}s+=D}if(f){o.setStart(f,Math.min(v,f.textContent?.length||0)),o.collapse(!0);const x=window.getSelection();x&&(x.removeAllRanges(),x.addRange(o),a.focus())}else{o.selectNodeContents(a),o.collapse(!1);const x=window.getSelection();x&&(x.removeAllRanges(),x.addRange(o),a.focus())}}catch{const o=document.createRange();o.selectNodeContents(a),o.collapse(!1);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(o),a.focus())}w.current=null}},0)}},[g,p,u,t,d,w,I,C]);c.useEffect(()=>{T()},[T])}function tt(t,g,p,u){c.useEffect(()=>{const d=t.current;if(!d)return;const w=C=>{const T=C.target?.closest(".upload-info-icon");if(T&&T.classList.contains("upload-info-icon")){const L=T.dataset.uploadKey;L&&u({key:L,anchorEl:T,type:"upload"});return}const e=C.target?.closest('[data-type="upload"]');if(e){const L=e.dataset.key;if(L){const h=p[L];h&&h.type&&h.type.startsWith("image/")&&u({key:L,anchorEl:e,type:"upload-preview"})}}},I=C=>{const T=C.target?.closest(".upload-info-icon"),e=C.relatedTarget;if(T&&T.classList.contains("upload-info-icon")){!e||!d.contains(e)?u(null):e.closest(".upload-info-icon")||u(null);return}const L=C.target?.closest('[data-type="upload"]');if(L){const h=e;if(h&&L.contains(h))return;u(null)}};return d.addEventListener("mouseover",w,!0),d.addEventListener("mouseout",I,!0),()=>{d.removeEventListener("mouseover",w,!0),d.removeEventListener("mouseout",I,!0)}},[g,p,t,u])}function at(t,g,p,u){c.useEffect(()=>{if(!t.current)return;const d=T=>{if(u==="hideTagClose")return;const e=T.currentTarget,L=e.dataset.tooltip,h=e.dataset.tagKey||"";L&&p({key:h,anchorEl:e,type:"tag"})},w=()=>{p(null)};let I;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.addEventListener("mouseenter",d),e.addEventListener("mouseleave",w)})};return I=requestAnimationFrame(()=>{I=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(I),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.removeEventListener("mouseenter",d),e.removeEventListener("mouseleave",w)})}},[g,t,p,u])}function nt(t,g,p){c.useEffect(()=>{const u=t.current;if(!u)return;const d=I=>{const C=I.target?.closest(".variable-info-icon");if(C&&C.classList.contains("variable-info-icon")){const T=C.dataset.variableKey;T&&p({key:T,anchorEl:C,type:"variable"})}},w=I=>{const C=I.target?.closest(".variable-info-icon"),T=I.relatedTarget;C&&C.classList.contains("variable-info-icon")&&(!T||!u.contains(T)?p(null):T.closest(".variable-info-icon")||p(null))};return u.addEventListener("mouseover",d,!0),u.addEventListener("mouseout",w,!0),()=>{u.removeEventListener("mouseover",d,!0),u.removeEventListener("mouseout",w,!0)}},[g,t,p])}function rt(t,g,p,u){c.useEffect(()=>{if(!t.current)return;const d=T=>{const e=T.currentTarget;e.dataset.fileName&&u({key:"",anchorEl:e,type:"upload-label"})},w=()=>{u(null)};let I;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.addEventListener("mouseenter",d),e.addEventListener("mouseleave",w)})};return I=requestAnimationFrame(()=>{I=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(I),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.removeEventListener("mouseenter",d),e.removeEventListener("mouseleave",w)})}},[g,p,t,u])}function ot(t,g,p,u){c.useEffect(()=>{const d=setTimeout(()=>{he(t,g,p),ve(t,g,p,u)},0);return()=>clearTimeout(d)},[p,g,t,u]),c.useEffect(()=>{const d=t.current;if(!d)return;const w=I=>{const C=I.target;C&&C.matches('[data-type="select"]')&&(he(t,g,p),ve(t,g,p,u))};return d.addEventListener("change",w,!0),()=>{d.removeEventListener("change",w,!0)}},[g,p,t,u])}function lt(t,g){c.useEffect(()=>{if(!t.current)return;let p=!1,u=0;const d=()=>{p=!0},w=()=>{p=!1,u=Date.now()};let I=!1,C=0;const T=()=>{I=!0},e=()=>{I=!1,C=Date.now()},L=()=>{C=Date.now()},h=()=>{if(!t.current)return;const n=window.getSelection();if(!n||n.rangeCount===0||g.current||p||I||Date.now()-C<500)return;const a=n.getRangeAt(0);if(!a.collapsed)return t.current.contains(a.commonAncestorContainer),void 0;const o=n.anchorNode;if(!o||!t.current.contains(o))return;let r=null;if(o.nodeType===Node.ELEMENT_NODE?r=o.closest('[data-type="variable"]'):o.nodeType===Node.TEXT_NODE&&o.parentElement&&(r=o.parentElement.closest('[data-type="variable"]')),!r){if(Date.now()-u>500)return;const s=t.current.querySelectorAll('[data-type="variable"]');if(s.length>0){let f=null;for(const v of Array.from(s))if(v.style.display!=="none"){f=v;break}if(!f&&s.length>0&&(f=s[0]),f){const v=document.createRange();v.selectNodeContents(f),v.collapse(!1),n.removeAllRanges(),n.addRange(v),f.focus()}else n.removeAllRanges()}else n.removeAllRanges()}},i=t.current;return i&&(i.addEventListener("compositionstart",T),i.addEventListener("compositionend",e),i.addEventListener("input",L)),document.addEventListener("mousedown",d),document.addEventListener("mouseup",w),document.addEventListener("selectionchange",h),()=>{const n=t.current;n&&(n.removeEventListener("compositionstart",T),n.removeEventListener("compositionend",e),n.removeEventListener("input",L)),document.removeEventListener("mousedown",d),document.removeEventListener("mouseup",w),document.removeEventListener("selectionchange",h)}},[t,g])}const Oe=({config:t,onSend:g,isProcessing:p=!1,disabled:u=!1,width:d,lockStructure:w=!1,agentOptions:I=[],onAgentSelect:C,onAgentExit:T,loading:e=!1,placeholder:L,border:h,background:i="transparent",hideButtons:n})=>{const a=c.useRef(null),o=c.useRef(null),[r,s]=c.useState({}),[f,v]=c.useState(null),[x,D]=c.useState(null),S=c.useRef(!1),G=c.useRef(null),[F,M]=c.useState(!1),U=c.useRef(null),[J,Q]=c.useState(!0),[Z,N]=c.useState(()=>{const y={};return t.forEach(m=>{m.type==="multi-variable"&&m.key&&(y[m.key]=1)}),y}),H=c.useRef({}),te=c.useRef({}),ae=c.useRef({});c.useEffect(()=>{te.current=r},[r]),c.useEffect(()=>{ae.current=Z},[Z]);const se=c.useCallback(y=>y.find(b=>b.type==="tag")?.text||null,[]),fe=c.useRef(t),ie=c.useRef(null);c.useEffect(()=>{const y=se(fe.current),m=se(t);if(y&&y!==m&&a.current){const b={};a.current.querySelectorAll('[data-type="variable"]').forEach(E=>{const _=E.dataset.key;if(_){const $=E.innerText.replace(/[\u200B\n]/g,"").trim();$&&(b[_]=$)}}),a.current.querySelectorAll('[data-type="select"]').forEach(E=>{const _=E.dataset.key;if(_){const $=E.value.trim();$&&(b[_]=$)}}),a.current.querySelectorAll('[data-type="textarea"]').forEach(E=>{const _=E.dataset.key;if(_){const $=E.value.replace(/[\u200B]/g,"").trim();$&&(b[_]=$)}}),H.current[y]={variableValues:b,files:{...te.current},multiVariableCounts:{...ae.current}}}if(m&&H.current[m]){const b=H.current[m];ie.current=b,s(b.files),N(b.multiVariableCounts)}else if(m){ie.current=null;const b={};t.forEach(A=>{A.type==="multi-variable"&&A.key&&(b[A.key]=1)}),N(b),s({})}else ie.current=null,N({}),s({});fe.current=t},[t,se]),c.useLayoutEffect(()=>{ie.current&&a.current&&(a.current.__tempVariableValues=ie.current.variableValues,setTimeout(()=>{ie.current&&(ie.current=null)},0))}),et(a,t,r,w,Z,U,void 0,n),tt(a,t,r,D),at(a,t,D,n),rt(a,t,r,D),nt(a,t,D),ot(a,t,r,M),lt(a,S),c.useEffect(()=>{if(t.length>0){Q(!1);return}const y=()=>{if(!a.current){Q(!0);return}const b=a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",A=a.current.querySelectorAll('[data-type="variable"]'),k=a.current.querySelectorAll('[data-type="upload"]');let q=!1;A.forEach(_=>{(_.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(q=!0)}),k.forEach(_=>{_.querySelector(".upload-inner-wrapper.has-file")&&(q=!0)});const E=!b&&!q;Q(E),t.length===0&&M(!E)};y();const m=new MutationObserver(y);return a.current&&m.observe(a.current,{childList:!0,subtree:!0,characterData:!0}),()=>{m.disconnect()}},[t]);const Se=y=>{if(u){y.preventDefault();return}y.preventDefault();const m=y.clipboardData.getData("text/plain"),b=window.getSelection();if(b&&b.rangeCount>0){const A=b.anchorNode;if(A){let k=null;if(A.nodeType===Node.ELEMENT_NODE?k=A.closest('[data-type="variable"]'):A.nodeType===Node.TEXT_NODE&&A.parentElement&&(k=A.parentElement.closest('[data-type="variable"]')),k){const q=k.dataset.multiKey;if(q){const E=/[、,,\s\n\r\t]+/,_=m.split(E).map($=>$.trim()).filter($=>$.length>0);if(console.log("[Paste Event] 粘贴的内容:",m),console.log("[Paste Event] 拆分后的值:",_),_.length>1){const $=parseInt(k.dataset.index||"0",10),P=t.find(ee=>ee.type==="multi-variable"&&ee.key===q)?.maxCount||9,z=Z[q]||1,B=Math.min($+_.length,P);B>z&&N(K=>({...K,[q]:B}));const O=[];for(let K=0;K<z;K++){const ee=`${q}_${K}`,oe=a.current.querySelector(`[data-type="variable"][data-key="${ee}"][data-multi-key="${q}"]`);if(oe){const ue=oe.innerText.replace(/[\u200B\n]/g,"").trim();O.push(ue)}}O.splice($,1,..._.slice(0,P-$));const Y=O.slice(0,P);Y.length>0&&Y[Y.length-1]!==""&&Y.length<P&&Y.push("");const V=Math.max(Y.length,1),R={};Y.forEach((K,ee)=>{K&&(R[`${q}_${ee}`]=K)}),a.current.querySelectorAll('[data-type="variable"]').forEach(K=>{const ee=K.dataset.key,oe=K.dataset.multiKey;if(ee&&oe!==q){const ue=K.innerText.replace(/[\u200B\n]/g,"").trim();ue&&(R[ee]=ue)}}),a.current.__tempVariableValues=R,N(K=>({...K,[q]:V})),console.log("[Paste Event] 粘贴完成,已填充到多个输入框,值:",Y);return}else _.length===1&&console.log("[Paste Event] 粘贴单个值,将在失去焦点时检查是否需要拆分")}}}}document.execCommand("insertText",!1,m),ce(),setTimeout(()=>{const A=window.getSelection();if(A&&A.rangeCount>0){const k=A.anchorNode;if(k){let q=null;if(k.nodeType===Node.ELEMENT_NODE?q=k.closest('[data-type="variable"][data-multi-key]'):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(q=k.parentElement.closest('[data-type="variable"][data-multi-key]')),q){const E=q.innerText.replace(/[\u200B\n]/g,"").trim();/[、,,\s]+/.test(E)&&(console.log("[Paste Event] 粘贴后检测到分隔符,内容:",E),console.log("[Paste Event] 提示:失去焦点后将自动拆分"))}}}},0)},$e=y=>{if(y.target.files&&y.target.files[0]&&f){const m=y.target.files[0],b=f;s(A=>({...A,[b]:m}))}y.target&&(y.target.value=""),v(null)},be=y=>{s(m=>{const b={...m};return delete b[y],b})},Ne=y=>{const m=y.target;if(m.closest(".tag-close-btn")){if(y.preventDefault(),y.stopPropagation(),w)return;D(null),T?T():a.current&&(a.current.innerHTML="",a.current.focus());return}if(w){const k=m.closest(".tag-node"),q=m.closest('[data-type="text"]');if(k||q){y.preventDefault(),y.stopPropagation();const E=window.getSelection();E&&E.removeAllRanges();return}}m.closest('[data-type="variable"]')||(G.current={x:y.clientX,y:y.clientY},S.current=!1,m.closest(".file-remove-btn")&&(y.preventDefault(),y.stopPropagation()))},ye=y=>{if(!y.target.closest('[data-type="variable"]')&&G.current){const A=Math.abs(y.clientX-G.current.x),k=Math.abs(y.clientY-G.current.y);(A>3||k>3)&&(S.current=!0)}},Ae=y=>{if(y.target.closest('[data-type="variable"]')){G.current=null,S.current=!1;return}G.current=null,S.current=!1},j=y=>{if(u)return;const m=y.target;if(m.closest('[data-type="datepicker"]'))return;if(m.closest(".tag-close-btn")){y.preventDefault(),y.stopPropagation();return}if(t.length===0)return;const k=(B,O)=>{if(!a.current)return;Array.from(a.current.children).forEach(V=>{if(V!==B)if(O)V.dataset.prevDisplay===void 0&&(V.dataset.prevDisplay=V.style.display||""),V.style.setProperty("display","none","important");else if(V.dataset.prevDisplay!==void 0){const R=V.dataset.prevDisplay;R?V.style.display=R:V.style.removeProperty("display"),delete V.dataset.prevDisplay}else V.style.removeProperty("display")})},q=m.closest(".rte-textarea-toggle");if(q){y.preventDefault(),y.stopPropagation();const B=q.closest(".rte-textarea-wrapper"),O=B?.querySelector('[data-type="textarea"]'),V=!(q.getAttribute("data-expanded")==="true");q.setAttribute("data-expanded",String(V)),q.textContent=V?"收起":"展开",B&&B.classList.toggle("rte-textarea-expanded",V);const R=B?.closest(".rte-textarea-required");if(R?R.classList.toggle("rte-textarea-overlay",V):B&&B.classList.toggle("rte-textarea-overlay",V),O)if(V)O.classList.add("rte-textarea-expanded"),O.style.maxHeight="none",O.style.height="100%";else{O.classList.remove("rte-textarea-expanded");const ne=O.dataset.maxHeight||"252";O.style.maxHeight=`${ne}px`,O.style.height="auto"}a.current&&(V?a.current.classList.add("rte-overlay-active"):a.current.classList.remove("rte-overlay-active"));return}const E=m.closest(".rte-richtext-toggle");if(E){y.preventDefault(),y.stopPropagation();const B=E.closest(".rte-richtext-wrapper"),O=B?.querySelector('[data-type="richtext"]'),V=!(E.getAttribute("data-expanded")==="true");((ee,oe)=>{ee.setAttribute("data-expanded",String(oe)),ee.innerHTML=oe?'<i class="iconfont icon-shouqi1"></i><span class="rte-richtext-toggle-label">收起</span>':'<i class="iconfont icon-zhankai2"></i><span class="rte-richtext-toggle-label">展开</span>'})(E,V);const ne=B?.closest(".rte-richtext-required");ne?ne.classList.toggle("rte-richtext-expanded",V):B&&B.classList.toggle("rte-richtext-expanded",V);const K=B?.closest(".exclusion-wrapper")||B?.parentElement;O&&(V?(O.style.height="100%",O.style.overflow="auto"):(O.style.height="",O.style.overflow="")),K&&(K.classList.toggle("rte-richtext-host-expanded",V),k(K,V)),a.current&&a.current.classList.toggle("rte-richtext-fullscreen-active",V);return}if(m.closest('[data-type="text"]')){y.preventDefault(),y.stopPropagation();const B=window.getSelection();B&&B.removeAllRanges();return}if(w&&m.closest(".tag-node")){y.preventDefault(),y.stopPropagation();const O=window.getSelection();O&&O.removeAllRanges();return}if(m.closest('[data-type="variable"]')){if(S.current)return;setTimeout(()=>{const B=window.getSelection();B&&!B.isCollapsed||qe(a)},10);return}const P=m.closest(".file-remove-btn");if(P){y.preventDefault(),y.stopPropagation();const O=P.closest('[data-type="upload"]')?.dataset.key;O&&be(O);return}const z=m.closest('[data-type="upload"]');if(z){const B=z.dataset.key;B&&(v(B),o.current?.click());return}},re=y=>{const b=y.target.closest('[data-type="variable"]');if(b){const A=window.getSelection();if(A){const k=document.createRange(),q=b.textContent||"";if(q.replace(/\u200B/g,"")){let _=0,$=q.length;q.startsWith("")&&(_=1),q.endsWith("")&&q.length>1&&($=q.length-1);const P=b.firstChild;P&&P.nodeType===Node.TEXT_NODE?(k.setStart(P,_),k.setEnd(P,$)):k.selectNodeContents(b)}else k.selectNodeContents(b),k.collapse(!0);A.removeAllRanges(),A.addRange(k)}}},ce=()=>{if(t.length===0){if(a.current){const b=!(a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");Q(b),M(!b)}return}if(qe(a),a.current&&a.current.querySelectorAll('[data-type="variable"]').forEach(b=>{const A=b.querySelector(".variable-info-icon");if(A){let k=!1;const q=document.createTreeWalker(b,NodeFilter.SHOW_TEXT,{acceptNode:E=>A.contains(E)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;q.nextNode();)if(q.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){k=!0;break}k?A.classList.add("hidden"):A.classList.remove("hidden")}}),he(a,t,r),ve(a,t,r,M),!a.current)return;t.filter(m=>m.type==="multi-variable"&&m.key).forEach(m=>{if(!m.key)return;const b=m.maxCount||9,A=Z[m.key]||1,k=[];for(let P=0;P<A;P++){const z=`${m.key}_${P}`,B=a.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${m.key}"]`);if(B){const O=B.innerText.replace(/[\u200B\n]/g,"").trim();k.push(O)}}const E=(k[k.length-1]||"")==="";let _=!1,$=-1;for(let P=0;P<k.length-1;P++)if(k[P]===""){_=!0,$=P;break}if(_&&$>=0){const P=window.getSelection();if(P&&P.rangeCount>0){const V=P.getRangeAt(0),R=V.startContainer,ne=R.nodeType===Node.ELEMENT_NODE?R.closest('[data-type="variable"][data-multi-key]'):R.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ne){const K=ne.dataset.key;if(K){const ee=document.createRange();ee.setStartBefore(ne),ee.setEnd(V.startContainer,V.startOffset);const oe=ee.toString().length;U.current={key:K,offset:oe}}}}const z=[...k];for(let V=$;V<z.length-1;V++)z[V]=z[V+1];z.pop();const B={};z.forEach((V,R)=>{V&&(B[`${m.key}_${R}`]=V)});const O=Math.max(E?z.length:z.length+1,1);a.current.querySelectorAll('[data-type="variable"]').forEach(V=>{const R=V.dataset.key,ne=V.dataset.multiKey;if(R&&ne!==m.key){const K=V.innerText.replace(/[\u200B\n]/g,"").trim();K&&(B[R]=K)}}),a.current.__tempVariableValues=B,N(V=>({...V,[m.key]:O}));return}if(!E){const P=A-1,z=`${m.key}_${P}`,B=a.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${m.key}"]`);if(B&&B.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&A<b){const Y=window.getSelection();if(Y&&Y.rangeCount>0){const V=Y.getRangeAt(0),R=V.startContainer,ne=R.nodeType===Node.ELEMENT_NODE?R.closest('[data-type="variable"][data-multi-key]'):R.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ne){const K=ne.dataset.key;if(K){const ee=document.createRange();ee.setStartBefore(ne),ee.setEnd(V.startContainer,V.startOffset);const oe=ee.toString().length;U.current={key:K,offset:oe}}}}N(V=>({...V,[m.key]:A+1}))}}})};c.useLayoutEffect(()=>{const y=a.current;if(!y)return;const m=new Map,b=q=>{const E=q.target,_=q.relatedTarget;!E||!a.current||!a.current.contains(E)||_&&a.current.contains(_)||setTimeout(()=>{if(a.current){if(t.length===0){const $=a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";M($.length>0);return}qe(a),he(a,t,r),ve(a,t,r,M)}},0)};y.addEventListener("blur",b,!0);const A=()=>{if(!a.current)return;m.forEach((_,$)=>{$.removeEventListener("blur",_,!1)}),m.clear();const q=a.current.querySelectorAll('[data-type="variable"][data-multi-key]'),E=_=>{_.stopPropagation(),_.stopImmediatePropagation();const $=_.target;if(!$||!a.current||!a.current.contains($))return;const P=$.closest('[data-type="variable"][data-multi-key]');if(!P||!a.current.contains(P))return;let z=!1;if(m.forEach((ee,oe)=>{(oe===P||oe.contains($))&&(z=!0)}),!z)return;const B=P.dataset.multiKey,O=P.dataset.key,Y=P.dataset.index;if(!B||!O||Y===void 0)return;const V=_.relatedTarget;if(!(!V||!a.current.contains(V)))return;const ne=P.innerText.replace(/[\u200B\n]/g,"").trim();console.log("[Blur Event] 失去焦点的 multi-variable 输入框:",{multiKey:B,currentKey:O,index:Y,content:ne});const K=/[、,,\s]+/;if(K.test(ne)){const ee=ne.split(K).map(me=>me.trim()).filter(me=>me.length>0);console.log("[Blur Event] 拆分前的内容:",ne),console.log("[Blur Event] 拆分后的部分:",ee);const ue=ee.slice(0,9);if(console.log("[Blur Event] 有效的部分(最多9个):",ue),ue.length>1){const me=t.find(ke=>ke.type==="multi-variable"&&ke.key===B);if(me){const ke=Z[B]||1,Xe=parseInt(Y,10),Je=me.maxCount||9,we=[];for(let le=0;le<ke;le++){const ge=`${B}_${le}`,Ee=a.current.querySelector(`[data-type="variable"][data-key="${ge}"][data-multi-key="${B}"]`);if(Ee){const Ce=Ee.innerText.replace(/[\u200B\n]/g,"").trim();we.push(Ce)}}console.log("[Blur Event] 拆分前的所有值:",we),console.log("[Blur Event] 当前索引:",Xe),console.log("[Blur Event] 要插入的值:",ue),we.splice(Xe,1,...ue);const pe=we.slice(0,Je);console.log("[Blur Event] 拆分后的所有值:",pe),pe.length>0&&pe[pe.length-1]!==""&&pe.length<Je&&pe.push("");const yt=Math.max(pe.length,1),Le={};pe.forEach((le,ge)=>{le&&(Le[`${B}_${ge}`]=le)}),a.current.querySelectorAll('[data-type="variable"]').forEach(le=>{const ge=le.dataset.key,Ee=le.dataset.multiKey;if(ge&&Ee!==B){const Ce=le.innerText.replace(/[\u200B\n]/g,"").trim();Ce&&(Le[ge]=Ce)}}),a.current.__tempVariableValues=Le,N(le=>({...le,[B]:yt}))}}}};q.forEach(_=>{_.addEventListener("blur",E,!1),m.set(_,E)})},k=setTimeout(()=>{A()},0);return()=>{clearTimeout(k),y.removeEventListener("blur",b,!0),m.forEach((q,E)=>{E.removeEventListener("blur",q,!1)}),m.clear()}},[t,Z,r]);const xe=y=>{if(u){y.preventDefault();return}const m=window.getSelection();if(m&&m.rangeCount>0){const b=m.anchorNode;let A=null;if(b&&(b.nodeType===Node.ELEMENT_NODE?A=b.closest('[data-type="text"]'):b.nodeType===Node.TEXT_NODE&&b.parentElement&&(A=b.parentElement.closest('[data-type="text"]'))),A){if(y.preventDefault(),y.stopPropagation(),a.current){const k=a.current.querySelector('[data-type="variable"], [data-type="upload"]');k&&k.focus()}return}}if(w&&m&&m.rangeCount>0){const b=m.anchorNode;let A=null;if(b&&(b.nodeType===Node.ELEMENT_NODE?A=b.closest(".tag-node"):b.nodeType===Node.TEXT_NODE&&b.parentElement&&(A=b.parentElement.closest(".tag-node"))),A){if(y.preventDefault(),y.stopPropagation(),a.current){const k=a.current.querySelector('[data-type="variable"], [data-type="upload"]');k&&k.focus()}return}}if(y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),Ue()),y.key==="Escape"&&a.current){if(w){y.preventDefault();return}a.current.innerHTML="",a.current.focus()}if(y.key==="Backspace"){const b=window.getSelection();if(b&&b.rangeCount>0){const A=b.getRangeAt(0),k=b.anchorNode;if(w){let E=null,_=null;if(k&&(k.nodeType===Node.ELEMENT_NODE?(E=k.closest(".tag-node"),_=k.closest('[data-type="text"]')):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(E=k.parentElement.closest(".tag-node"),_=k.parentElement.closest('[data-type="text"]'))),(E||_)&&A.collapsed&&A.startOffset===0){y.preventDefault();return}}let q=null;if(k&&(k.nodeType===Node.ELEMENT_NODE?q=k.closest('[data-type="variable"]'):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(q=k.parentElement.closest('[data-type="variable"]'))),q){if(!A.collapsed)return;const E=q.innerText;if(E===""||E===""){y.preventDefault();return}if(A.startOffset===0){y.preventDefault();return}if(E.startsWith("")&&A.startOffset===1){y.preventDefault();return}}}}},Ue=()=>{if(p||u||e||!F||!a.current)return;if(t.length===0){const q=a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!q)return;g(q,q);return}const y=a.current;let m="";const b={},A=q=>{if(!(q.nodeType===Node.ELEMENT_NODE&&q.style.display==="none")){if(q.nodeType===Node.TEXT_NODE)m+=(q.textContent||"").replace(/\u200B/g,"");else if(q.nodeType===Node.ELEMENT_NODE){const E=q,_=E.dataset.type,$=E.dataset.key;if(_==="variable"&&$){let P="";const z=document.createTreeWalker(E,NodeFilter.SHOW_TEXT,{acceptNode:O=>{const Y=E.querySelector(".variable-info-icon");return Y&&Y.contains(O)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;z.nextNode();)P+=z.currentNode.textContent||"";const B=P.replace(/[\u200B\n]/g,"").trim();if(B){const O=E.dataset.multiKey;if(O){(!b[O]||!Array.isArray(b[O]))&&(b[O]=[]);const Y=b[O];Y.push(B),Y.length>1&&(m+=" "),m+=B}else b[$]=B,m+=B}}else if(_==="select"&&$){const P=E,z=(P.value||"").trim();if(z){b[$]=z;const B=P.selectedOptions?.[0];m+=B?.textContent||z}}else if(_==="textarea"&&$){const z=(E.value||"").replace(/\u200B/g,"").trim();z&&(b[$]=z,m+=z)}else if(_==="richtext"&&$){const z=(E.textContent||"").replace(/\u200B/g,"").trim();z&&(b[$]=z,m+=z)}else if(_==="datepicker"&&$){const z=(E.getAttribute("data-value")||"").trim();z&&(b[$]=z,m+=z)}else if(_==="upload"&&$)b[$]=r[$]??null,r[$]&&(m+=` [附带文件: ${r[$]?.name}] `);else{if(E.classList.contains("tag-close-btn")||E.classList.contains("file-remove-btn"))return;E.getAttribute("contenteditable")==="false"&&!_&&E.classList.contains("tag-node")?m+=E.innerText:E.childNodes.forEach(A)}}}};if(y.childNodes.forEach(A),m=m.trim(),!m)return;const k=new FormData;k.append("fullPrompt",m),Object.keys(b).forEach(q=>{const E=b[q];E!=null&&(E instanceof File?k.append(q,E):Array.isArray(E)?t.some($=>$.type==="multi-variable"&&$.key===q)?E.forEach($=>{$!=null&&$!==""&&k.append(q,String($))}):E.forEach(($,P)=>{$!=null&&($ instanceof File?k.append(`${q}[${P}]`,$):typeof $=="string"?k.append(`${q}[${P}]`,$):k.append(`${q}[${P}]`,String($)))}):typeof E=="string"?k.append(q,E):k.append(q,String(E)))}),g(k,m)},ft={...d?{width:typeof d=="number"?`${d}px`:d}:{},...h?{border:h}:{},...i?{background:i}:{}};return l.jsxs("div",{className:"rich-text-editor",style:ft,"data-disabled":u,children:[l.jsx("div",{ref:a,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${J&&L?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":L,onMouseDown:Ne,onMouseMove:ye,onMouseUp:Ae,onClick:j,onDoubleClick:re,onInput:ce,onKeyDown:xe,onPaste:Se}),l.jsx("input",{type:"file",ref:o,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:$e}),l.jsxs("div",{className:"rich-text-editor-footer",children:[l.jsx("div",{className:"rich-text-editor-footer-left",children:l.jsxs("div",{className:"rich-text-editor-brand",children:[l.jsxs("div",{className:"rte-brand-badge",children:[l.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),l.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),n!=="hideAgent"&&l.jsx(W.Dropdown,{placement:"top",menu:{items:I.map(y=>({key:y.key,label:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.icon&&l.jsx("i",{className:y.icon}),l.jsx("span",{children:y.label})]}),onClick:()=>{C?.(y)}}))},trigger:["click"],disabled:u||p,children:l.jsxs("div",{className:"rte-agent-badge",style:{cursor:I.length>0?"pointer":"default"},children:[l.jsx("i",{className:"iconfont icon-zhinengti"}),l.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(()=>{const y=t.find(b=>b.type==="tag");if(!y||!y.text)return null;const m=I.find(b=>b.label===y.text);return!m||m.points===void 0||m.points===null?null:l.jsxs("div",{className:"rte-points-badge",children:[l.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px"}}),l.jsxs("span",{style:{fontSize:"16px"},children:["-",String(m.points)]})]})})(),l.jsx("button",{type:"button",onClick:Ue,disabled:p||u||e||!F,className:"rich-text-editor-send-button",children:p||e?l.jsx("span",{className:"rte-send-spinner"}):l.jsx("i",{className:"iconfont icon-fasong"})})]})]}),x?.anchorEl&&(()=>{if(!document.body.contains(x.anchorEl))return null;let y="",m={background:"var(--neutral-800, #262626)"};if(x.type==="upload")y=t.find(k=>k.type==="upload"&&k.key===x.key)?.tooltip||"";else if(x.type==="tag")y=x.anchorEl.dataset.tooltip||"";else if(x.type==="upload-label")y=x.anchorEl.dataset.fileName||"";else if(x.type==="variable")y=x.anchorEl.dataset.tooltip||"";else if(x.type==="upload-preview"){const A=r[x.key];if(A&&A.type&&A.type.startsWith("image/")){const k=URL.createObjectURL(A);y=l.jsx("div",{style:{width:120,height:120,display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("img",{src:k,style:{maxWidth:120,maxHeight:120,objectFit:"contain"}})}),m={background:"#fff",padding:4},setTimeout(()=>URL.revokeObjectURL(k),1e3)}else y=""}if(!y)return null;const b=x.type==="upload-preview"?"#0A0A0A":"#fff";return Qe.createPortal(l.jsx(W.Tooltip,{arrow:!1,title:l.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:b},children:y}),open:!0,placement:"top",getPopupContainer:()=>document.body,overlayInnerStyle:m,children:l.jsx("div",{style:{position:"fixed",left:`${x.anchorEl.getBoundingClientRect().left}px`,top:`${x.anchorEl.getBoundingClientRect().top}px`,width:`${x.anchorEl.offsetWidth}px`,height:`${x.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})()]})};Oe.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const Fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",st=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],it=({autoLoading:t,batchSize:g,loadingProgress:p,loadIcon:u,onBatchSizeChange:d,onLoadNextPage:w,onStartAutoLoad:I,onStopLoad:C})=>t&&p?l.jsxs("div",{className:"auto_load_progress",children:[u||l.jsx("img",{src:Fe,alt:"自动加载",width:14,height:14}),l.jsxs("span",{children:["正在加载第",p.currentPage,"/",p.totalPages,"页"]}),l.jsx(W.Progress,{percent:p.percentage,type:"line",size:[160,8]}),l.jsx("span",{onClick:C,className:"auto_load_stop_btn",children:"停止加载"})]}):l.jsxs("div",{className:"auto_load_container",children:[l.jsx("div",{onClick:w,className:"auto_load_next_btn",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:"加载下一页"}),l.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:[l.jsxs("div",{className:"auto_load_btn",onClick:t?void 0:I,children:[u||l.jsx("img",{src:Fe,alt:"自动加载",width:14,height:14}),l.jsx("span",{children:"自动加载"})]}),l.jsx(W.Select,{value:g,onChange:d,options:st,disabled:t,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),ct=({current:t,loadIcon:g,pageSize:p,total:u,cachedPages:d,loadedCount:w,autoLoading:I=!1,loadingProgress:C,onChange:T,onLoadNextPage:e,onStartAutoLoad:L,onStopLoading:h})=>{const[i,n]=c.useState(5),a=Math.ceil(u/p),o=c.useMemo(()=>d.length>=a,[d,a]),r=()=>Array.from({length:a},(v,x)=>x+1).filter(v=>!d.includes(v)).slice(0,i),s=(f,v,x)=>{const D=d.includes(f);return v==="prev"||v==="next"||v==="jump-prev"||v==="jump-next"?l.jsx("div",{className:"pageBox",children:x}):l.jsxs("div",{className:"pageBox",style:{backgroundColor:t===f?"#2563EB":"#f5f5f5",color:t===f?"#fff":D?"#171717":"#a3a3a3"},children:[f,!D&&l.jsx("span",{className:"unload_spot"})]})};return l.jsxs("div",{className:"pagination_footer",children:[l.jsxs("div",{className:"pagination_leftWrap",children:[l.jsxs("span",{className:"pagination_total",children:[l.jsx(de.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",w,"/",u,"条数据"]}),!o&&l.jsx(it,{loadIcon:g||void 0,autoLoading:I,batchSize:i,loadingProgress:C,disabled:!e||!L,onBatchSizeChange:n,onLoadNextPage:()=>e?.(),onStartAutoLoad:()=>{const f=r();L?.(f)},onStopLoad:()=>h?.()})]}),l.jsx(W.Pagination,{current:t,pageSize:p,total:u,onChange:f=>T(f),showSizeChanger:!1,showQuickJumper:!1,showTotal:(f,v)=>"",itemRender:s})]})},ze=t=>{const{loading:g,autoLoading:p,loadingProgress:u,columns:d=[],dataSource:w=[],total:I,current:C,pageSize:T,cachedPages:e,onChangePage:L,onLoadNextPage:h,onStartAutoLoad:i,onStopLoading:n,...a}=t,o=c.useRef(null),r=c.useCallback(s=>{L(s),e.includes(s)&&o.current?.scrollTo({key:`${(s-1)*T+1}`})},[C]);return l.jsxs("div",{className:"flex flex-col",children:[l.jsx(W.Table,{ref:o,...a,columns:d,dataSource:w,pagination:!1,virtual:!0}),l.jsx(ct,{loading:g,autoLoading:p,loadingProgress:u,current:C,pageSize:T,total:I,loadedCount:w.length,cachedPages:e,onChange:r,onLoadNextPage:h,onStartAutoLoad:i,onStopLoading:n})]})};ze.__docgenInfo={displayName:"VirtualTable",description:"虚拟滚动表格组件,支持分页、数据缓存和自动加载功能。",props:{loading:{description:"加载状态",name:"loading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},total:{description:"总数据条数",name:"total",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"0"}},current:{description:"当前页码",name:"current",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"1"}},pageSize:{description:"每页数据条数",name:"pageSize",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"10"}},cachedPages:{description:"已缓存的页码数组",name:"cachedPages",required:!0,type:{name:"number[]",raw:"number[]"},defaultValue:{value:"[]"}},dataSource:{description:"数据源",name:"dataSource",required:!0,type:{name:"Array<T>",raw:"Array<T>"},defaultValue:{value:"[]"}},onChangePage:{description:"页码变更回调函数",name:"onChangePage",required:!0,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},autoLoading:{description:"是否正在自动加载",name:"autoLoading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},loadingProgress:{description:"加载进度信息",name:"loadingProgress",required:!0,type:{name:"object",raw:"{percentage: 0, currentPage: 1, totalPages: 5}"},defaultValue:{value:"-"}},onLoadNextPage:{description:"加载下一页回调函数",name:"onLoadNextPage",required:!1,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},onStartAutoLoad:{description:"开始自动加载回调函数",name:"onStartAutoLoad",required:!1,type:{name:"function",raw:"function(loadNextPages: number[]): void"},defaultValue:{value:"-"}},onStopLoading:{description:"停止加载回调函数",name:"onStopLoading",required:!1,type:{name:"function",raw:"function(): void"},defaultValue:{value:"-"}},columns:{description:"表格列配置",name:"columns",required:!0,type:{name:"Array<object>",raw:"Array<object>"},defaultValue:{value:"[]"}}}};const We=({texts:t=[],placeholder:g="请输入内容",animationSpeed:p=100,autoPlay:u=!0,value:d,onChange:w,...I})=>{const[C,T]=c.useState(""),[e,L]=c.useState(0),[h,i]=c.useState(!1),[n,a]=c.useState(!1),[o,r]=c.useState(!1),s=c.useRef(void 0),f=c.useRef(void 0),v=c.useRef(t),x=c.useRef(e),D=c.useRef(n),S=c.useRef(C);c.useEffect(()=>{v.current=t,x.current=e,D.current=n,S.current=C});const G=c.useCallback((N,H)=>{let te=0;r(!0);const ae=()=>{te<N.length?(T(N.slice(0,te+1)),te++,f.current=window.setTimeout(ae,p)):(r(!1),H?.())};ae()},[p]),F=c.useCallback(N=>{let H=S.current.length;const te=()=>{H>0?(T(S.current.slice(0,H-1)),H--,f.current=window.setTimeout(te,p/2)):N?.()};te()},[p]),M=c.useCallback(()=>{if(v.current.length===0||D.current)return;i(!0);const N=v.current[x.current];S.current?F(()=>{G(N,()=>{s.current=window.setTimeout(()=>{L(H=>(H+1)%v.current.length),i(!1)},2e3)})}):G(N,()=>{s.current=window.setTimeout(()=>{L(H=>(H+1)%v.current.length),i(!1)},2e3)})},[F,G]);c.useEffect(()=>(u&&t.length>0&&!n&&M(),()=>{s.current&&window.clearTimeout(s.current),f.current&&window.clearTimeout(f.current)}),[e,n,u,t.length,M]),c.useEffect(()=>{!h&&u&&t.length>0&&!n&&M()},[e,h,u,t.length,n,M]);const U=N=>{a(!0),s.current&&window.clearTimeout(s.current),f.current&&window.clearTimeout(f.current),i(!1),r(!1),I.onFocus?.(N)},J=N=>{a(!1),!d&&t.length>0&&(T(""),L(0)),I.onBlur?.(N)},Q=N=>{w?.(N.target.value),I.onChange?.(N)},Z=()=>n||d?g:C||g;return l.jsxs("div",{style:{position:"relative"},children:[l.jsx(W.Input,{...I,value:d,onChange:Q,onFocus:U,onBlur:J,placeholder:Z(),style:{...I.style,position:"relative",zIndex:1}}),!n&&!d&&C&&l.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[l.jsx("span",{children:C}),o&&l.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),l.jsx("style",{children:`
|
|
1
|
+
(function(ae,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","antd","@ant-design/icons","react-dom"],s):(ae=typeof globalThis<"u"?globalThis:ae||self,s(ae.SealSeekBIComponents={},ae.React,ae.React,ae.antd,ae.AntdIcons,ae.ReactDOM))})(this,function(ae,s,c,R,xe,_e){"use strict";const Pe=({variant:t="primary",loading:k=!1,children:y,...i})=>{const m=T=>{switch(T){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return s.jsx(R.Button,{...i,type:m(t),loading:k,ghost:t==="ghost",children:y})};Pe.__docgenInfo={displayName:"Button",description:"基础按钮,用于触发操作",props:{variant:{name:"variant",required:!1,description:"视觉风格",type:{name:"ButtonVariant",raw:'"primary" | "ghost" | "dashed" | "link" | "text"'},defaultValue:{value:'"primary"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: MouseEvent) => void"}}}};const Oe=({title:t,children:k,bordered:y=!0,hoverable:i=!1,size:m="default",...T})=>s.jsx(R.Card,{...T,title:t,bordered:y,hoverable:i,size:m,children:k});Oe.__docgenInfo={displayName:"Card",description:"卡片容器,用于分组内容",props:{title:{name:"title",required:!1,description:"标题",type:{name:"ReactNode",raw:"React.ReactNode"}},children:{name:"children",required:!1,description:"内容区域",type:{name:"ReactNode",raw:"React.ReactNode"}},bordered:{name:"bordered",required:!1,description:"是否显示边框",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},hoverable:{name:"hoverable",required:!1,description:"是否可悬停",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},size:{name:"size",required:!1,description:"卡片大小",type:{name:"CardSize",raw:'"default" | "small"'},defaultValue:{value:'"default"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},actions:{name:"actions",required:!1,description:"卡片操作组",type:{name:"ReactNode[]",raw:"React.ReactNode[]"}}}};const Ge=({showDefaultFooter:t=!0,...k})=>{const y=k.footer!==void 0?k.footer:t?(i,{OkBtn:m,CancelBtn:T})=>s.jsxs(s.Fragment,{children:[s.jsx(m,{}),s.jsx(T,{})]}):null;return s.jsx(R.Modal,{...k,footer:y})};Ge.__docgenInfo={displayName:"AppModal",description:"应用级模态框组件,基于 Ant Design Modal 封装",props:{showDefaultFooter:{name:"showDefaultFooter",required:!1,description:"是否显示默认的确定和取消按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},title:{name:"title",required:!1,description:"模态框标题",type:{name:"ReactNode",raw:"React.ReactNode"}},open:{name:"open",required:!1,description:"是否显示模态框",type:{name:"boolean",raw:"boolean"}},onCancel:{name:"onCancel",required:!1,description:"取消按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},onOk:{name:"onOk",required:!1,description:"确定按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},children:{name:"children",required:!1,description:"模态框内容",type:{name:"ReactNode",raw:"React.ReactNode"}},width:{name:"width",required:!1,description:"模态框宽度",type:{name:"string | number",raw:"string | number"}},centered:{name:"centered",required:!1,description:"是否居中显示",type:{name:"boolean",raw:"boolean"}},maskClosable:{name:"maskClosable",required:!1,description:"点击蒙层是否允许关闭",type:{name:"boolean",raw:"boolean"}}}};const He=({scrollX:t,showPagination:k=!0,defaultPageSize:y=10,...i})=>s.jsx(R.Table,{...i,scroll:{x:t||"max-content",y:"50vh"},pagination:k?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:y,...i.pagination}:!1});He.__docgenInfo={displayName:"PageTable",description:"页面级表格组件,高度铺满容器,自动滚动",props:{scrollX:{name:"scrollX",required:!1,description:"水平滚动宽度",type:{name:"number",raw:"number"}},showPagination:{name:"showPagination",required:!1,description:"是否显示分页器",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},columns:{name:"columns",required:!1,description:"表格列配置",type:{name:"ColumnType[]",raw:"ColumnType<any>[]"}},dataSource:{name:"dataSource",required:!1,description:"数据源",type:{name:"any[]",raw:"any[]"}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},rowKey:{name:"rowKey",required:!1,description:"行数据的 Key",type:{name:"string | function",raw:"string | ((record: any) => string)"}}}};const nt=xe.createFromIconfontCN({scriptUrl:["https://at.alicdn.com/t/c/font_4968458_eh91gfr4j9e.js"]}),Fe=({name:t,size:k,color:y,style:i,...m})=>{const T={fontSize:k,color:y,...i};return s.jsx(nt,{...m,type:t,style:T})};Fe.__docgenInfo={displayName:"XcIcon",description:"自定义图标组件,基于 iconfont",props:{name:{name:"name",required:!0,description:"图标名称",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"图标大小",type:{name:"number | string",raw:"number | string"}},color:{name:"color",required:!1,description:"图标颜色",type:{name:"string",raw:"string"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const ze=({loading:t,description:k="暂无数据",className:y,emptyChildren:i,loadingText:m,emptyImage:T})=>t?s.jsxs(R.Flex,{className:`pt-10 w-full ${y||""}`,align:"center",justify:"center",vertical:!0,children:[s.jsx(R.Spin,{size:"large"}),m&&s.jsx("div",{className:"mt-4 text-gray-500",children:m})]}):s.jsx(R.Flex,{className:`pt-10 w-full ${y||""}`,align:"center",justify:"center",children:s.jsx(R.Empty,{image:T,description:k,imageStyle:{height:180},children:i})});ze.__docgenInfo={displayName:"EmptyAndSpin",description:"空状态和加载状态组合组件",props:{loading:{name:"loading",required:!0,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},description:{name:"description",required:!1,description:"空状态描述",type:{name:"ReactNode",raw:"React.ReactNode"},defaultValue:{value:'"暂无数据"'}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},emptyChildren:{name:"emptyChildren",required:!1,description:"空状态额外内容",type:{name:"ReactNode",raw:"React.ReactNode"}},loadingText:{name:"loadingText",required:!1,description:"加载中提示文字",type:{name:"string",raw:"string"}},emptyImage:{name:"emptyImage",required:!1,description:"空状态图片",type:{name:"string",raw:"string"}}}};const We=({onClick:t,showText:k=!1,className:y,size:i="small",type:m="default"})=>s.jsx(R.Button,{size:i,type:m,icon:s.jsx(xe.LeftOutlined,{}),className:`cursor-pointer ${y||""}`,onClick:t,children:k&&"返回"});We.__docgenInfo={displayName:"BackButton",description:"返回按钮组件",props:{onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"() => void"}},showText:{name:"showText",required:!1,description:"是否显示文字",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'},defaultValue:{value:'"small"'}},type:{name:"type",required:!1,description:"按钮类型",type:{name:"ButtonType",raw:'"primary" | "default" | "dashed" | "link" | "text"'},defaultValue:{value:'"default"'}}}};const je=({removePadding:t=!0,className:k,...y})=>{const i=t?`px-0 h-auto ${k||""}`:k;return s.jsx(R.Button,{type:"link",...y,className:i,children:y.children})};je.__docgenInfo={displayName:"LinkButton",description:"链接样式按钮组件,适用于表格操作列",props:{removePadding:{name:"removePadding",required:!1,description:"是否去除默认内边距",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLButtonElement>) => void"}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}}}};const{Option:at}=R.Select,Ue=({columns:t,request:k,searchFields:y=[],showSearch:i=!0,showRefresh:m=!0,defaultPageSize:T=10,pageSizeOptions:V=["10","20","50","100"],autoLoad:C=!0,externalParams:$={},...e})=>{const[q,h]=c.useState([]),[l,r]=c.useState(!1),[n,o]=c.useState({current:1,pageSize:T,total:0}),[a,d]=c.useState({}),[f,w]=c.useState({}),[x]=R.Form.useForm(),_=c.useRef(n);_.current=n;const E=c.useRef($);E.current=$;const O=c.useRef(!1),z=c.useMemo(()=>t.map(u=>{const{sortable:p,render:b,...I}=u;return{...I,sorter:p?!0:void 0,render:b||(N=>N)}}),[t]),W=c.useCallback(async(u={})=>{if(k){r(!0);try{const p={page:_.current.current,pageSize:_.current.pageSize,sortField:f.field,sortOrder:f.order,searchParams:{...a,...E.current},...u},b=await k(p);b.success&&(h(b.data),o(I=>({...I,total:b.total,current:p.page||I.current})))}catch(p){console.error("加载数据失败:",p)}finally{r(!1)}}},[k,f,a]),Y=c.useCallback(u=>{d(u),o(p=>({...p,current:1}))},[]),H=c.useCallback(()=>{x.resetFields(),d({}),o(u=>({...u,current:1}))},[x]),Z=c.useCallback(()=>{W()},[W]),ne=c.useCallback((u,p,b)=>{const I={current:u.current||1,pageSize:u.pageSize||T,total:u.total||0},N={field:b?.field,order:b?.order};o(I),w(N)},[T]);return c.useEffect(()=>{const u=Object.keys($).length>0;(C&&!O.current||u)&&(W(),O.current=!0)},[C,$,W]),s.jsxs("div",{children:[i&&y.length>0&&s.jsx(R.Card,{size:"small",style:{marginBottom:16},children:s.jsxs(R.Form,{form:x,layout:"inline",onFinish:Y,initialValues:y.reduce((u,p)=>(p.defaultValue!==void 0&&(u[p.key]=p.defaultValue),u),{}),children:[y.map(u=>s.jsx(R.Form.Item,{name:u.key,label:u.label,children:u.type==="input"?s.jsx(R.Input,{placeholder:u.placeholder||`请输入${u.label}`,style:{width:200}}):s.jsx(R.Select,{placeholder:u.placeholder||`请选择${u.label}`,style:{width:200},allowClear:!0,children:u.options?.map(p=>s.jsx(at,{value:p.value,children:p.label},p.value))})},u.key)),s.jsx(R.Form.Item,{children:s.jsxs(R.Space,{children:[s.jsx(R.Button,{type:"primary",htmlType:"submit",icon:s.jsx(xe.SearchOutlined,{}),children:"查询"}),s.jsx(R.Button,{onClick:H,children:"重置"}),m&&s.jsx(R.Button,{icon:s.jsx(xe.ReloadOutlined,{}),onClick:Z,children:"刷新"})]})})]})}),s.jsx(R.Table,{...e,columns:z,dataSource:q,loading:l,pagination:{...n,showSizeChanger:!0,showQuickJumper:!0,showTotal:(u,p)=>`第 ${p[0]}-${p[1]} 条/共 ${u} 条`,pageSizeOptions:V},onChange:ne,scroll:{x:"max-content",y:"50vh"}})]})};Ue.__docgenInfo={displayName:"AdvancedTable",description:"高阶表格组件,支持异步请求、搜索、排序等功能",props:{columns:{name:"columns",required:!0,description:"列配置",type:{name:"AdvancedColumnType[]",raw:"AdvancedColumnType<any>[]"}},request:{name:"request",required:!1,description:"异步请求函数",type:{name:"function",raw:"(params: RequestParams) => Promise<RequestResponse>"}},searchFields:{name:"searchFields",required:!1,description:"搜索字段配置",type:{name:"SearchFieldConfig[]",raw:"SearchFieldConfig[]"},defaultValue:{value:"[]"}},showSearch:{name:"showSearch",required:!1,description:"是否显示搜索区域",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},showRefresh:{name:"showRefresh",required:!1,description:"是否显示刷新按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},pageSizeOptions:{name:"pageSizeOptions",required:!1,description:"页面大小选项",type:{name:"string[]",raw:"string[]"},defaultValue:{value:'["10", "20", "50", "100"]'}},autoLoad:{name:"autoLoad",required:!1,description:"是否自动加载",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},externalParams:{name:"externalParams",required:!1,description:"外部请求参数",type:{name:"Record<string, any>",raw:"Record<string, any>"},defaultValue:{value:"{}"}}}};function Le(t,k,y){if(!t.current)return;const i=new Set,m={};for(const h of k)h.exclusionGroup&&h.exclusionGroup!=="separator"&&(i.add(h.exclusionGroup),m[h.exclusionGroup]||(m[h.exclusionGroup]=[]),m[h.exclusionGroup].push({type:h.type,key:h.key,exclusionGroup:h.exclusionGroup}));const T={};for(const h of i){T[h]=!1;for(const l of m[h])if(l.type==="upload"&&l.key){if(y[l.key]!==null&&y[l.key]!==void 0){T[h]=!0;break}}else if(l.type==="variable"&&l.key){const r=t.current.querySelector(`[data-type="variable"][data-key="${l.key}"]`);if(r&&r.innerText.replace(/[\u200B\n]/g,"").trim().length>0){T[h]=!0;break}}}const V=k.some(h=>h.exclusionGroup==="separator"),$=Object.keys(T).filter(h=>T[h]).length>0;let e=null;if($&&V){for(const h of k)if(h.exclusionGroup&&h.exclusionGroup!=="separator"&&T[h.exclusionGroup]){e=h.exclusionGroup;break}}for(const h of i){const l=t.current.querySelectorAll(`[data-group="${h}"]`);V&&$&&e?h===e?l.forEach(r=>{r.classList.contains("required-upload-group")?r.style.setProperty("display","inline-flex","important"):(r.classList.contains("exclusion-wrapper"),r.style.setProperty("display","inline-block","important"))}):l.forEach(r=>{r.style.display="none",r.style.setProperty("display","none","important")}):l.forEach(r=>{r.classList.contains("required-upload-group")?r.style.setProperty("display","inline-flex","important"):(r.classList.contains("exclusion-wrapper"),r.style.setProperty("display","inline-block","important"))})}t.current.querySelectorAll('[data-group="separator"]').forEach(h=>{h.style.display=$?"none":"inline"})}function Ie(t,k,y,i){if(!t.current){i(!1);return}const m=[];for(let l=0;l<k.length;l++){const r=k[l];if((r.type==="variable"||r.type==="upload"||r.type==="multi-variable"||r.type==="select"||r.type==="textarea"||r.type==="richtext"||r.type==="datepicker")&&r.required&&r.key){m.push({exclusionGroup:r.exclusionGroup||"",key:r.key,type:r.type==="multi-variable"?"variable":r.type,isMultiVariable:r.type==="multi-variable",minCount:r.type==="multi-variable"?r.minCount:void 0});continue}if(r.type==="text"&&r.className?.includes("rte-text-required"))if(r.exclusionGroup)for(let n=l+1;n<k.length;n++){const o=k[n];if(o.exclusionGroup===r.exclusionGroup&&(o.type==="variable"||o.type==="upload"||o.type==="select"||o.type==="textarea"||o.type==="richtext"||o.type==="datepicker")&&o.key){m.push({exclusionGroup:r.exclusionGroup,key:o.key,type:o.type});break}}else for(let n=l+1;n<k.length;n++){const o=k[n];if((o.type==="variable"||o.type==="upload"||o.type==="select"||o.type==="textarea"||o.type==="richtext"||o.type==="datepicker")&&o.key){m.push({exclusionGroup:o.exclusionGroup||"",key:o.key,type:o.type});break}}}const T=k.some(l=>l.exclusionGroup==="separator"),V=[];if(T&&m.length>1){const l=[];k.forEach((r,n)=>{r.exclusionGroup==="separator"&&l.push(n)});for(const r of l){const n=m.filter(a=>{const d=k.findIndex(f=>(f.type==="variable"||f.type==="upload"||f.type==="select"||f.type==="textarea"||f.type==="richtext"||f.type==="datepicker")&&f.key===a.key);return d>=0&&d<r}),o=m.filter(a=>{const d=k.findIndex(f=>(f.type==="variable"||f.type==="upload"||f.type==="select"||f.type==="textarea"||f.type==="richtext"||f.type==="datepicker")&&f.key===a.key);return d>=0&&d>r});n.length>0&&o.length>0&&V.push([...n,...o])}}if(m.length===0){if(k.length===0){if(!t.current){i(!1);return}const l=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";i(l.length>0);return}i(!0);return}const C=m.filter(l=>{if(!t.current)return!1;if(l.exclusionGroup){const r=t.current.querySelectorAll(`[data-group="${l.exclusionGroup}"]`);if(r.length>0)return r[0].style.display!=="none"}if(l.type==="upload"&&l.key){const r=t.current.querySelector(`[data-type="upload"][data-key="${l.key}"]`);if(r){const n=r.closest("[data-group]")||r.parentElement;return n?n.style.display!=="none":!0}}else if(l.type==="variable"&&l.key)if(l.isMultiVariable){const r=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${l.key}"]`);if(r.length>0){const n=r[0],o=n.closest("[data-group]")||n.parentElement;return o?o.style.display!=="none":!0}}else{const r=t.current.querySelector(`[data-type="variable"][data-key="${l.key}"]`);if(r){const n=r.closest("[data-group]")||r.parentElement;return n?n.style.display!=="none":!0}}else if(l.type==="select"&&l.key){const r=t.current.querySelector(`[data-type="select"][data-key="${l.key}"]`);if(r){const n=r.closest("[data-group]")||r.parentElement;return n?n.style.display!=="none":!0}}else if(l.type==="textarea"&&l.key){const r=t.current.querySelector(`[data-type="textarea"][data-key="${l.key}"]`);if(r){const n=r.closest("[data-group]")||r.parentElement;return n?n.style.display!=="none":!0}}else if(l.type==="richtext"&&l.key){const r=t.current.querySelector(`[data-type="richtext"][data-key="${l.key}"]`);if(r){const n=r.closest("[data-group]")||r.parentElement;return n?n.style.display!=="none":!0}}else if(l.type==="datepicker"&&l.key){const r=t.current.querySelector(`[data-type="datepicker"][data-key="${l.key}"]`);if(r){const n=r.closest("[data-group]")||r.parentElement;return n?n.style.display!=="none":!0}}return!1});if(C.length===0){i(!0);return}const $=new Set;V.forEach(l=>{l.forEach(r=>{r.key&&$.add(r.key)})});const e=C.filter(l=>!l.key||!$.has(l.key));let q=(V.length===0,!0);for(const l of V){const r=l.filter(o=>{if(!t.current)return!1;if(o.exclusionGroup){const a=t.current.querySelectorAll(`[data-group="${o.exclusionGroup}"]`);if(a.length>0)return a[0].style.display!=="none"}return!0});if(r.length===0)continue;let n=!1;for(const o of r)if(o.type==="upload"&&o.key){if(y[o.key]!==null&&y[o.key]!==void 0){n=!0;break}}else if(o.type==="variable"&&o.key)if(o.isMultiVariable){const a=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${o.key}"]`);let d=0;for(const w of Array.from(a))w.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(d+=1);const f=o.minCount&&o.minCount>0?o.minCount:1;if(d>=f){n=!0;break}}else{const a=t.current.querySelector(`[data-type="variable"][data-key="${o.key}"]`);if(a&&a.innerText.replace(/[\u200B\n]/g,"").trim().length>0){n=!0;break}}else if(o.type==="select"&&o.key){const a=t.current.querySelector(`[data-type="select"][data-key="${o.key}"]`);if(a&&(a.value||"").trim().length>0){n=!0;break}}else if(o.type==="textarea"&&o.key){const a=t.current.querySelector(`[data-type="textarea"][data-key="${o.key}"]`);if(a&&(a.value||"").trim().length>0){n=!0;break}}else if(o.type==="richtext"&&o.key){const a=t.current.querySelector(`[data-type="richtext"][data-key="${o.key}"]`);if(a&&(a.textContent||"").replace(/[\u200B]/g,"").trim().length>0){n=!0;break}}else if(o.type==="datepicker"&&o.key){const a=t.current.querySelector(`[data-type="datepicker"][data-key="${o.key}"]`);if(a&&(a.getAttribute("data-value")||"").trim().length>0){n=!0;break}}if(!n){q=!1;break}}let h=!0;for(const l of e)if(l.type==="upload"&&l.key){if(y[l.key]===null||y[l.key]===void 0){h=!1;break}}else if(l.type==="variable"&&l.key)if(l.isMultiVariable){const r=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${l.key}"]`);let n=0;for(const a of Array.from(r))a.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(n+=1);const o=l.minCount&&l.minCount>0?l.minCount:1;if(n<o){h=!1;break}}else{const r=t.current.querySelector(`[data-type="variable"][data-key="${l.key}"]`);if(!r){h=!1;break}if(r.innerText.replace(/[\u200B\n]/g,"").trim().length===0){h=!1;break}}else if(l.type==="select"&&l.key){const r=t.current.querySelector(`[data-type="select"][data-key="${l.key}"]`);if(!r||(r.value||"").trim().length===0){h=!1;break}}else if(l.type==="textarea"&&l.key){const r=t.current.querySelector(`[data-type="textarea"][data-key="${l.key}"]`);if(!r||(r.value||"").trim().length===0){h=!1;break}}else if(l.type==="richtext"&&l.key){const r=t.current.querySelector(`[data-type="richtext"][data-key="${l.key}"]`);if(!r||(r.textContent||"").replace(/[\u200B]/g,"").trim().length===0){h=!1;break}}else if(l.type==="datepicker"&&l.key){const r=t.current.querySelector(`[data-type="datepicker"][data-key="${l.key}"]`);if(!r||(r.getAttribute("data-value")||"").trim().length===0){h=!1;break}}i(q&&h)}function De(t,k){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(i=>{const m=i.innerText.replace(/\n/g,"");m.replace(/\u200B/g,"")?i.classList.remove("show-placeholder"):(m!==""&&(i.innerText=""),i.classList.add("show-placeholder"))})}function rt(t,k,y,i,m,T={},V){if(!t.current)return;let C="",$=0;for(;$<k.length;){const e=k[$],q=$+1<k.length?k[$+1]:null;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&q){const a=q.type==="upload"&&q.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===q.exclusionGroup,d=q.type==="variable"&&q.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===q.exclusionGroup;if(a){const w=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,x="</span>";let _="";e.className?_=`<span class="${e.className}">${e.text??""}</span>`:_=e.text??"";const E=q,O=y[E.key]!==null&&y[E.key]!==void 0,z=O?y[E.key]:null,W=O?y[E.key]?.name:E.text,Y=O?"":"hidden",H=E.tooltip&&!O?"":"hidden",Z=O?"has-file":"",ne=O&&W?` data-file-name="${W.replace(/"/g,""")}"`:"";let u="";O&&z&&(z.type?.startsWith("image/")?u=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(z)}" alt="preview" />`:u="<i class='iconfont icon-exlwenjian'></i>");const p=`<span contenteditable="false" data-type="upload" data-key="${E.key}" class="upload-chip"><span class="upload-inner-wrapper ${Z}"><span class="upload-icon">${u}</span><span class="upload-label"${ne}>${W||E.text}</span>${E.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${H}" data-upload-key="${E.key}" data-tooltip="${E.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${Y}" title="移除文件">×</span></span></span>`;C+=w+_+p+x,$+=2;continue}if(d){const w=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,x="</span>";let _="";e.className?_=`<span class="${e.className}">${e.text??""}</span>`:_=e.text??"";const E=q,z=(E.key?m[E.key]:void 0)||E.text||"",W=!z,Y=W?"":z,H=W?"show-placeholder":"",Z=E.exclusionGroup?` data-group="${E.exclusionGroup}"`:"",ne=E.tooltip?` data-tooltip="${E.tooltip.replace(/"/g,""")}" data-variable-key="${E.key||""}"`:"",u=E.tooltip&&W?"":"hidden",p=`<span contenteditable="true" data-type="variable" data-key="${E.key}" data-placeholder="${E.placeholder||""}"${Z}${ne} class="variable-chip ${H}">${Y}${E.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${u}" data-variable-key="${E.key}" data-tooltip="${E.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;C+=w+_+p+x,$+=2;continue}}const l=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",r=e.exclusionGroup?`<span ${l} class="exclusion-wrapper">`:"",n=e.exclusionGroup?"</span>":"";let o="";if(e.type==="tag"){const d=i||V==="hideTagClose"?"":'<span class="tag-close-btn" title="Clear (ESC)"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg></span>',f=i?' data-locked="true"':"",w=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-tag-key="${e.key||""}"`:"";o=`<span contenteditable="false" class="tag-node group"${f}${w}><span class="tag-label">${e.text}</span>${d}</span>`}else if(e.type==="text"){const a=i?' data-locked="true" contenteditable="false"':' contenteditable="false"',f=(e.text??"").replace(/\n/g,"<br/>");e.className?o=`<span class="${e.className}"${a}>${f}</span>`:o=i?`<span${a}>${f}</span>`:`<span contenteditable="false">${f}</span>`}else if(e.type==="variable"&&e.key){const d=m[e.key]||e.text||"",f=!d,w=f?"":d,x=f?"show-placeholder":"",_=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",E=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",O=e.tooltip&&f?"":"hidden",z=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${_}${E} class="variable-chip ${x}">${w}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${O}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${z}</span>`:o=z}else if(e.type==="upload"&&e.key){const a=y[e.key]!==null&&y[e.key]!==void 0,d=a?y[e.key]:null,f=a?y[e.key]?.name:e.text,w=a?"":"hidden",x=e.tooltip&&!a?"":"hidden",_=a?"has-file":"",E=a&&f?` data-file-name="${f.replace(/"/g,""")}"`:"";let O="";a&&d&&(d.type?.startsWith("image/")?O=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(d)}" alt="preview" />`:O="<i class='iconfont icon-exlwenjian'></i>");const z=`<span contenteditable="false" data-type="upload" data-key="${e.key}" class="upload-chip"><span class="upload-inner-wrapper ${_}"><span class="upload-icon">${O}</span><span class="upload-label"${E}>${f||e.text}</span>${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${x}" data-upload-key="${e.key}" data-tooltip="${e.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${w}" title="移除文件">×</span></span></span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${z}</span>`:o=z}else if(e.type==="select"&&e.key){const a=m[e.key]||"",d=(e.options||[]).map(x=>{const _=a===x.value?"selected":"";return`<option value="${x.value}" ${_}>${x.label}</option>`}).join(""),f=e.placeholder?`<option value="" ${a?"":"selected"} disabled hidden>${e.placeholder}</option>`:"",w=`<select data-type="select" data-key="${e.key}" class="rte-select">${f}${d}</select>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${w}</span>`:o=w}else if(e.type==="textarea"&&e.key){const a=m[e.key]||"",d=e.maxHeight||252,f=e.expandable!==!1,w=e.placeholder?` placeholder="${e.placeholder}"`:"",x=`<textarea data-type="textarea" data-key="${e.key}" class="rte-textarea" data-max-height="${d}" style="max-height:${d}px;"${w}>${a}</textarea>`,_=f?`<button type="button" class="rte-textarea-toggle" data-key="${e.key}" data-expanded="false">展开</button>`:"",E=`<div class="rte-textarea-wrapper" data-key="${e.key}">${x}${_}</div>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${E}</span>`:o=E}else if(e.type==="richtext"&&e.key){const a=m[e.key]||e.text||"",d=e.minHeight||140,f=e.placeholder?` data-placeholder="${e.placeholder}"`:"",w=e.expandable!==!1,x=a,_=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" class="rte-richtext"${f} style="min-height:${d}px;">${x}</div>`,E=w?`<button type="button" class="rte-richtext-toggle" data-key="${e.key}" data-expanded="false">展开</button>`:"",O=`<div class="rte-richtext-wrapper" data-key="${e.key}">${_}${E}</div>`,z=`<div class="rte-richtext-container" data-key="${e.key}">${O}</div>`;e.required?o=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group rte-richtext-required"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${z}</div>`:o=z}else if(e.type==="datepicker"&&e.key){const a=m[e.key]||"",d=e.placeholder?` data-placeholder="${e.placeholder}"`:"",f=e.limitRange?` data-limit-range="${e.limitRange}"`:"",w=e.disableFuture?' data-disable-future="true"':"",x=`<div data-type="datepicker" data-key="${e.key}" data-value="${a}" class="rte-datepicker-host"${d}${f}${w}></div>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${x}</span>`:o=x}else if(e.type==="multi-variable"&&e.key){const a=e.maxCount||9,d=T[e.key]||1,f=Math.min(d,a);if(e.required){const w=`<span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>`,x=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"";let _="";for(let E=0;E<f;E++){const O=`${e.key}_${E}`,z=m[O]||"",W=!z,Y=W?"":z,H=W?"show-placeholder":"",Z=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",ne=e.tooltip&&W?"":"hidden",u=`<span contenteditable="true" data-type="variable" data-key="${O}" data-multi-key="${e.key}" data-index="${E}" data-placeholder="${e.placeholder||""}"${Z} class="variable-chip ${H}">${Y}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${ne}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;E===0?_+=`<span ${x} class="exclusion-wrapper required-upload-group required-multi-first">${w}${u}</span>`:_+=u}o=_}else{let w="";for(let x=0;x<f;x++){const _=`${e.key}_${x}`,E=m[_]||"",O=!E,z=O?"":E,W=O?"show-placeholder":"",Y=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",H=e.tooltip&&O?"":"hidden",Z=`<span contenteditable="true" data-type="variable" data-key="${_}" data-multi-key="${e.key}" data-index="${x}" data-placeholder="${e.placeholder||""}"${Y} class="variable-chip ${W}">${z}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${H}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;w+=Z}o=w}}C+=r+o+n,$++}t.current&&(t.current.innerHTML=C,setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(q=>{const h=q.innerText.replace(/\n/g,"");h.replace(/\u200B/g,"")?q.classList.remove("show-placeholder"):(h!==""&&(q.innerText=""),q.classList.add("show-placeholder"))})},0))}function ot(t,k,y,i,m={},T,V,C){const $=c.useCallback(()=>{if(!t.current)return;if(k.length===0){t.current.innerHTML="";return}let e={};const h=t.current.__tempVariableValues;if(h?(e=h,setTimeout(()=>{if(t.current){const l=t.current;l.__tempVariableValues===h&&delete l.__tempVariableValues}},100)):(t.current.querySelectorAll('[data-type="variable"]').forEach(d=>{const f=d.dataset.key;if(f){const w=d.innerText.replace(/[\u200B\n]/g,"").trim();w&&(e[f]=w)}}),t.current.querySelectorAll('[data-type="select"]').forEach(d=>{const f=d.dataset.key;if(f){const w=d.value.trim();w&&(e[f]=w)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(d=>{const f=d.dataset.key;if(f){const w=d.value.replace(/[\u200B]/g,"").trim();w&&(e[f]=w)}}),t.current.querySelectorAll('[data-type="richtext"]').forEach(d=>{const f=d.dataset.key;if(f){const w=(d.textContent||"").replace(/[\u200B]/g,"").trim();w&&(e[f]=w)}}),t.current.querySelectorAll('[data-type="datepicker"]').forEach(d=>{const f=d.dataset.key;if(f){const w=(d.getAttribute("data-value")||"").trim();w&&(e[f]=w)}})),rt(t,k,y,i,e,m,C),T?.current){const{key:l,offset:r}=T.current;setTimeout(()=>{if(!t.current)return;const n=t.current.querySelector(`[data-type="variable"][data-key="${l}"]`);if(n){try{const o=document.createRange(),a=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);let d=0,f=null,w=0;for(;a.nextNode();){const x=a.currentNode,_=x.textContent?.length||0;if(d+_>=r){f=x,w=r-d;break}d+=_}if(f){o.setStart(f,Math.min(w,f.textContent?.length||0)),o.collapse(!0);const x=window.getSelection();x&&(x.removeAllRanges(),x.addRange(o),n.focus())}else{o.selectNodeContents(n),o.collapse(!1);const x=window.getSelection();x&&(x.removeAllRanges(),x.addRange(o),n.focus())}}catch{const o=document.createRange();o.selectNodeContents(n),o.collapse(!1);const a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(o),n.focus())}T.current=null}},0)}},[k,y,i,t,m,T,V,C]);c.useEffect(()=>{$()},[$])}function st(t,k,y,i){c.useEffect(()=>{const m=t.current;if(!m)return;const T=C=>{const $=C.target?.closest(".upload-info-icon");if($&&$.classList.contains("upload-info-icon")){const q=$.dataset.uploadKey;q&&i({key:q,anchorEl:$,type:"upload"});return}const e=C.target?.closest('[data-type="upload"]');if(e){const q=e.dataset.key;if(q){const h=y[q];h&&h.type&&h.type.startsWith("image/")&&i({key:q,anchorEl:e,type:"upload-preview"})}}},V=C=>{const $=C.target?.closest(".upload-info-icon"),e=C.relatedTarget;if($&&$.classList.contains("upload-info-icon")){!e||!m.contains(e)?i(null):e.closest(".upload-info-icon")||i(null);return}const q=C.target?.closest('[data-type="upload"]');if(q){const h=e;if(h&&q.contains(h))return;i(null)}};return m.addEventListener("mouseover",T,!0),m.addEventListener("mouseout",V,!0),()=>{m.removeEventListener("mouseover",T,!0),m.removeEventListener("mouseout",V,!0)}},[k,y,t,i])}function lt(t,k,y,i){c.useEffect(()=>{if(!t.current)return;const m=$=>{if(i==="hideTagClose")return;const e=$.currentTarget,q=e.dataset.tooltip,h=e.dataset.tagKey||"";q&&y({key:h,anchorEl:e,type:"tag"})},T=()=>{y(null)};let V;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.addEventListener("mouseenter",m),e.addEventListener("mouseleave",T)})};return V=requestAnimationFrame(()=>{V=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(V),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.removeEventListener("mouseenter",m),e.removeEventListener("mouseleave",T)})}},[k,t,y,i])}function it(t,k,y){c.useEffect(()=>{const i=t.current;if(!i)return;const m=V=>{const C=V.target?.closest(".variable-info-icon");if(C&&C.classList.contains("variable-info-icon")){const $=C.dataset.variableKey;$&&y({key:$,anchorEl:C,type:"variable"})}},T=V=>{const C=V.target?.closest(".variable-info-icon"),$=V.relatedTarget;C&&C.classList.contains("variable-info-icon")&&(!$||!i.contains($)?y(null):$.closest(".variable-info-icon")||y(null))};return i.addEventListener("mouseover",m,!0),i.addEventListener("mouseout",T,!0),()=>{i.removeEventListener("mouseover",m,!0),i.removeEventListener("mouseout",T,!0)}},[k,t,y])}function ct(t,k,y,i){c.useEffect(()=>{if(!t.current)return;const m=$=>{const e=$.currentTarget;e.dataset.fileName&&i({key:"",anchorEl:e,type:"upload-label"})},T=()=>{i(null)};let V;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.addEventListener("mouseenter",m),e.addEventListener("mouseleave",T)})};return V=requestAnimationFrame(()=>{V=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(V),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.removeEventListener("mouseenter",m),e.removeEventListener("mouseleave",T)})}},[k,y,t,i])}function ut(t,k,y,i){c.useEffect(()=>{Le(t,k,y),Ie(t,k,y,i)},[y,k,t,i])}function dt(t,k){const y=c.useRef(0);c.useEffect(()=>{if(!t.current)return;let i=!1,m=0;const T=a=>a instanceof HTMLElement?!!(a.closest(".rte-datepicker-wrapper")||a.closest(".rte-datepicker-host")||a.closest(".ant-picker")||a.closest(".ant-picker-dropdown")):!1,V=a=>{i=!0,T(a.target)&&(y.current=Date.now(),console.log("[SelectionCtrl] mousedown on datepicker target"))},C=()=>{i=!1,m=Date.now()};let $=!1,e=0;const q=()=>{$=!0},h=()=>{$=!1,e=Date.now()},l=()=>{e=Date.now()},r=a=>{T(a.target)&&(y.current=Date.now(),console.log("[SelectionCtrl] focusin datepicker target"))},n=()=>{if(Date.now()-y.current<800){console.log("[SelectionCtrl] skip selectionchange due to recent datepicker interaction");return}const a=document.activeElement;if(a&&(a.closest(".rte-datepicker-wrapper")||a.closest(".rte-datepicker-host")||a.closest(".ant-picker-dropdown")||a.tagName==="INPUT"&&a.closest(".ant-picker"))){console.log("[SelectionCtrl] activeElement is datepicker; skip");return}if(!t.current)return;const d=window.getSelection();if(!d||d.rangeCount===0||k.current||i||$||Date.now()-e<500)return;const f=d.getRangeAt(0);if(!f.collapsed)return t.current.contains(f.commonAncestorContainer),void 0;const w=d.anchorNode;if(!w||!t.current.contains(w))return;let x=!1;if(w.nodeType===Node.ELEMENT_NODE){const E=w;(E.closest('[data-type="datepicker"]')||E.closest(".rte-datepicker-wrapper")||E.closest(".rte-datepicker-host"))&&(x=!0)}else if(w.parentElement){const E=w.parentElement;(E.closest('[data-type="datepicker"]')||E.closest(".rte-datepicker-wrapper")||E.closest(".rte-datepicker-host"))&&(x=!0)}if(x)return;let _=null;if(w.nodeType===Node.ELEMENT_NODE?_=w.closest('[data-type="variable"]'):w.nodeType===Node.TEXT_NODE&&w.parentElement&&(_=w.parentElement.closest('[data-type="variable"]')),!_){if(Date.now()-m>500)return;const E=t.current.querySelectorAll('[data-type="variable"]');if(E.length>0){let O=null;for(const z of Array.from(E))if(z.style.display!=="none"){O=z;break}if(!O&&E.length>0&&(O=E[0]),O){const z=document.createRange();z.selectNodeContents(O),z.collapse(!1),d.removeAllRanges(),d.addRange(z),O.focus()}else d.removeAllRanges()}else d.removeAllRanges()}},o=t.current;return o&&(o.addEventListener("compositionstart",q),o.addEventListener("compositionend",h),o.addEventListener("input",l)),document.addEventListener("mousedown",V),document.addEventListener("mouseup",C),document.addEventListener("focusin",r),document.addEventListener("selectionchange",n),()=>{const a=t.current;a&&(a.removeEventListener("compositionstart",q),a.removeEventListener("compositionend",h),a.removeEventListener("input",l)),document.removeEventListener("mousedown",V),document.removeEventListener("mouseup",C),document.removeEventListener("focusin",r),document.removeEventListener("selectionchange",n)}},[t,k])}function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Se={exports:{}},ft=Se.exports,Ye;function yt(){return Ye||(Ye=1,function(t,k){(function(y,i){t.exports=i()})(ft,function(){var y=1e3,i=6e4,m=36e5,T="millisecond",V="second",C="minute",$="hour",e="day",q="week",h="month",l="quarter",r="year",n="date",o="Invalid Date",a=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(u){var p=["th","st","nd","rd"],b=u%100;return"["+u+(p[(b-20)%10]||p[b]||p[0])+"]"}},w=function(u,p,b){var I=String(u);return!I||I.length>=p?u:""+Array(p+1-I.length).join(b)+u},x={s:w,z:function(u){var p=-u.utcOffset(),b=Math.abs(p),I=Math.floor(b/60),N=b%60;return(p<=0?"+":"-")+w(I,2,"0")+":"+w(N,2,"0")},m:function u(p,b){if(p.date()<b.date())return-u(b,p);var I=12*(b.year()-p.year())+(b.month()-p.month()),N=p.clone().add(I,h),U=b-N<0,j=p.clone().add(I+(U?-1:1),h);return+(-(I+(b-N)/(U?N-j:j-N))||0)},a:function(u){return u<0?Math.ceil(u)||0:Math.floor(u)},p:function(u){return{M:h,y:r,w:q,d:e,D:n,h:$,m:C,s:V,ms:T,Q:l}[u]||String(u||"").toLowerCase().replace(/s$/,"")},u:function(u){return u===void 0}},_="en",E={};E[_]=f;var O="$isDayjsObject",z=function(u){return u instanceof Z||!(!u||!u[O])},W=function u(p,b,I){var N;if(!p)return _;if(typeof p=="string"){var U=p.toLowerCase();E[U]&&(N=U),b&&(E[U]=b,N=U);var j=p.split("-");if(!N&&j.length>1)return u(j[0])}else{var te=p.name;E[te]=p,N=te}return!I&&N&&(_=N),N||!I&&_},Y=function(u,p){if(z(u))return u.clone();var b=typeof p=="object"?p:{};return b.date=u,b.args=arguments,new Z(b)},H=x;H.l=W,H.i=z,H.w=function(u,p){return Y(u,{locale:p.$L,utc:p.$u,x:p.$x,$offset:p.$offset})};var Z=function(){function u(b){this.$L=W(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[O]=!0}var p=u.prototype;return p.parse=function(b){this.$d=function(I){var N=I.date,U=I.utc;if(N===null)return new Date(NaN);if(H.u(N))return new Date;if(N instanceof Date)return new Date(N);if(typeof N=="string"&&!/Z$/i.test(N)){var j=N.match(a);if(j){var te=j[2]-1||0,oe=(j[7]||"0").substring(0,3);return U?new Date(Date.UTC(j[1],te,j[3]||1,j[4]||0,j[5]||0,j[6]||0,oe)):new Date(j[1],te,j[3]||1,j[4]||0,j[5]||0,j[6]||0,oe)}}return new Date(N)}(b),this.init()},p.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},p.$utils=function(){return H},p.isValid=function(){return this.$d.toString()!==o},p.isSame=function(b,I){var N=Y(b);return this.startOf(I)<=N&&N<=this.endOf(I)},p.isAfter=function(b,I){return Y(b)<this.startOf(I)},p.isBefore=function(b,I){return this.endOf(I)<Y(b)},p.$g=function(b,I,N){return H.u(b)?this[I]:this.set(N,b)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(b,I){var N=this,U=!!H.u(I)||I,j=H.p(b),te=function(ye,pe){var ve=H.w(N.$u?Date.UTC(N.$y,pe,ye):new Date(N.$y,pe,ye),N);return U?ve:ve.endOf(e)},oe=function(ye,pe){return H.w(N.toDate()[ye].apply(N.toDate("s"),(U?[0,0,0,0]:[23,59,59,999]).slice(pe)),N)},ie=this.$W,ue=this.$M,de=this.$D,ge="set"+(this.$u?"UTC":"");switch(j){case r:return U?te(1,0):te(31,11);case h:return U?te(1,ue):te(0,ue+1);case q:var Q=this.$locale().weekStart||0,ce=(ie<Q?ie+7:ie)-Q;return te(U?de-ce:de+(6-ce),ue);case e:case n:return oe(ge+"Hours",0);case $:return oe(ge+"Minutes",1);case C:return oe(ge+"Seconds",2);case V:return oe(ge+"Milliseconds",3);default:return this.clone()}},p.endOf=function(b){return this.startOf(b,!1)},p.$set=function(b,I){var N,U=H.p(b),j="set"+(this.$u?"UTC":""),te=(N={},N[e]=j+"Date",N[n]=j+"Date",N[h]=j+"Month",N[r]=j+"FullYear",N[$]=j+"Hours",N[C]=j+"Minutes",N[V]=j+"Seconds",N[T]=j+"Milliseconds",N)[U],oe=U===e?this.$D+(I-this.$W):I;if(U===h||U===r){var ie=this.clone().set(n,1);ie.$d[te](oe),ie.init(),this.$d=ie.set(n,Math.min(this.$D,ie.daysInMonth())).$d}else te&&this.$d[te](oe);return this.init(),this},p.set=function(b,I){return this.clone().$set(b,I)},p.get=function(b){return this[H.p(b)]()},p.add=function(b,I){var N,U=this;b=Number(b);var j=H.p(I),te=function(ue){var de=Y(U);return H.w(de.date(de.date()+Math.round(ue*b)),U)};if(j===h)return this.set(h,this.$M+b);if(j===r)return this.set(r,this.$y+b);if(j===e)return te(1);if(j===q)return te(7);var oe=(N={},N[C]=i,N[$]=m,N[V]=y,N)[j]||1,ie=this.$d.getTime()+b*oe;return H.w(ie,this)},p.subtract=function(b,I){return this.add(-1*b,I)},p.format=function(b){var I=this,N=this.$locale();if(!this.isValid())return N.invalidDate||o;var U=b||"YYYY-MM-DDTHH:mm:ssZ",j=H.z(this),te=this.$H,oe=this.$m,ie=this.$M,ue=N.weekdays,de=N.months,ge=N.meridiem,Q=function(pe,ve,ke,Ee){return pe&&(pe[ve]||pe(I,U))||ke[ve].slice(0,Ee)},ce=function(pe){return H.s(te%12||12,pe,"0")},ye=ge||function(pe,ve,ke){var Ee=pe<12?"AM":"PM";return ke?Ee.toLowerCase():Ee};return U.replace(d,function(pe,ve){return ve||function(ke){switch(ke){case"YY":return String(I.$y).slice(-2);case"YYYY":return H.s(I.$y,4,"0");case"M":return ie+1;case"MM":return H.s(ie+1,2,"0");case"MMM":return Q(N.monthsShort,ie,de,3);case"MMMM":return Q(de,ie);case"D":return I.$D;case"DD":return H.s(I.$D,2,"0");case"d":return String(I.$W);case"dd":return Q(N.weekdaysMin,I.$W,ue,2);case"ddd":return Q(N.weekdaysShort,I.$W,ue,3);case"dddd":return ue[I.$W];case"H":return String(te);case"HH":return H.s(te,2,"0");case"h":return ce(1);case"hh":return ce(2);case"a":return ye(te,oe,!0);case"A":return ye(te,oe,!1);case"m":return String(oe);case"mm":return H.s(oe,2,"0");case"s":return String(I.$s);case"ss":return H.s(I.$s,2,"0");case"SSS":return H.s(I.$ms,3,"0");case"Z":return j}return null}(pe)||j.replace(":","")})},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(b,I,N){var U,j=this,te=H.p(I),oe=Y(b),ie=(oe.utcOffset()-this.utcOffset())*i,ue=this-oe,de=function(){return H.m(j,oe)};switch(te){case r:U=de()/12;break;case h:U=de();break;case l:U=de()/3;break;case q:U=(ue-ie)/6048e5;break;case e:U=(ue-ie)/864e5;break;case $:U=ue/m;break;case C:U=ue/i;break;case V:U=ue/y;break;default:U=ue}return N?U:H.a(U)},p.daysInMonth=function(){return this.endOf(h).$D},p.$locale=function(){return E[this.$L]},p.locale=function(b,I){if(!b)return this.$L;var N=this.clone(),U=W(b,I,!0);return U&&(N.$L=U),N},p.clone=function(){return H.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},u}(),ne=Z.prototype;return Y.prototype=ne,[["$ms",T],["$s",V],["$m",C],["$H",$],["$W",e],["$M",h],["$y",r],["$D",n]].forEach(function(u){ne[u[1]]=function(p){return this.$g(p,u[0],u[1])}}),Y.extend=function(u,p){return u.$i||(u(p,Z,Y),u.$i=!0),Y},Y.locale=W,Y.isDayjs=z,Y.unix=function(u){return Y(1e3*u)},Y.en=E[_],Y.Ls=E,Y.p={},Y})}(Se)),Se.exports}var mt=yt();const Me=pt(mt),{RangePicker:ht}=R.DatePicker,gt=({host:t,onChange:k})=>{const y=t.dataset.key,i=t.dataset.value,m=t.dataset.placeholder,T=t.dataset.limitRange?parseInt(t.dataset.limitRange,10):void 0,V=t.dataset.disableFuture==="true",[C,$]=c.useState(()=>{if(!i)return null;const o=i.split(",");return o.length===2&&o[0]&&o[1]?[Me(o[0]),Me(o[1])]:null}),[e,q]=c.useState(null),h=o=>o?V&&o.isAfter(Me(),"day")?!0:!T||!e||!e[0]?!1:Math.abs(o.diff(e[0],"days"))>T:!1,l=o=>{console.log("[DatePicker] onCalendarChange",o?.map(a=>a?.format("YYYY-MM-DD")||null)),q(o)},r=o=>{if(console.log("[DatePicker] onChange",o?.map(a=>a?.format("YYYY-MM-DD")||null)),$(o),q(null),o&&o[0]&&o[1]){const a=`${o[0].format("YYYY-MM-DD")},${o[1].format("YYYY-MM-DD")}`;t.setAttribute("data-value",a),k(y,a)}else t.setAttribute("data-value",""),k(y,"")},n=o=>{console.log("[DatePicker] onOpenChange",o),q(o?C:null)};return _e.createPortal(s.jsx("div",{className:"rte-datepicker-wrapper",contentEditable:!1,style:{display:"inline-block",verticalAlign:"middle",width:"240px"},children:s.jsx(ht,{value:C,disabledDate:h,onCalendarChange:l,onChange:r,onOpenChange:n,placeholder:[m||"开始日期",m||"结束日期"],style:{width:"100%"},size:"small",allowClear:!0,getPopupContainer:()=>document.body,popupClassName:"rte-datepicker-dropdown"})}),t)},vt=t=>{const[k,y]=c.useState([]);return c.useEffect(()=>{const i=t.current;if(!i)return;const m=()=>{const V=i.querySelectorAll(".rte-datepicker-host"),C=[];V.forEach($=>{const e=$.getAttribute("data-key");e&&C.push(s.jsx(gt,{host:$,onChange:(q,h)=>{if(t.current){const l=new Event("input",{bubbles:!0});t.current.dispatchEvent(l)}}},`datepicker-${e}`))}),y(C)};m();const T=new MutationObserver(V=>{let C=!1;for(const $ of V)if($.type==="childList"){let e=!1;if($.addedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const h=q;(h.classList?.contains("rte-datepicker-host")||h.querySelector?.(".rte-datepicker-host"))&&(e=!0)}}),$.removedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const h=q;(h.classList?.contains("rte-datepicker-host")||h.querySelector?.(".rte-datepicker-host"))&&(e=!0)}}),e){C=!0;break}}C&&m()});return T.observe(i,{childList:!0,subtree:!0}),()=>T.disconnect()},[t]),k},Ke=({config:t,onSend:k,isProcessing:y=!1,disabled:i=!1,width:m,lockStructure:T=!1,agentOptions:V=[],onAgentSelect:C,onAgentExit:$,loading:e=!1,placeholder:q,border:h,background:l="transparent",hideButtons:r})=>{const n=c.useRef(null),o=c.useRef(null),[a,d]=c.useState({}),[f,w]=c.useState(null),[x,_]=c.useState(null),E=c.useRef(!1),O=c.useRef(null),[z,W]=c.useState(!1),Y=c.useRef(null),[H,Z]=c.useState(!0),[ne,u]=c.useState(()=>{const v={};return t.forEach(g=>{g.type==="multi-variable"&&g.key&&(v[g.key]=1)}),v}),p=c.useRef({}),b=c.useRef({}),I=c.useRef({});c.useEffect(()=>{b.current=a},[a]),c.useEffect(()=>{I.current=ne},[ne]);const N=c.useCallback(v=>v.find(S=>S.type==="tag")?.text||null,[]),U=c.useRef(t),j=c.useRef(null);c.useEffect(()=>{const v=N(U.current),g=N(t);if(v&&v!==g&&n.current){const S={};n.current.querySelectorAll('[data-type="variable"]').forEach(L=>{const F=L.dataset.key;if(F){const M=L.innerText.replace(/[\u200B\n]/g,"").trim();M&&(S[F]=M)}}),n.current.querySelectorAll('[data-type="select"]').forEach(L=>{const F=L.dataset.key;if(F){const M=L.value.trim();M&&(S[F]=M)}}),n.current.querySelectorAll('[data-type="textarea"]').forEach(L=>{const F=L.dataset.key;if(F){const M=L.value.replace(/[\u200B]/g,"").trim();M&&(S[F]=M)}}),p.current[v]={variableValues:S,files:{...b.current},multiVariableCounts:{...I.current}}}if(g&&p.current[g]){const S=p.current[g];j.current=S,d(S.files),u(S.multiVariableCounts)}else if(g){j.current=null;const S={};t.forEach(B=>{B.type==="multi-variable"&&B.key&&(S[B.key]=1)}),u(S),d({})}else j.current=null,u({}),d({});U.current=t},[t,N]),c.useLayoutEffect(()=>{j.current&&n.current&&(n.current.__tempVariableValues=j.current.variableValues,setTimeout(()=>{j.current&&(j.current=null)},0))}),ot(n,t,a,T,ne,Y,void 0,r),st(n,t,a,_),lt(n,t,_,r),ct(n,t,a,_),it(n,t,_),ut(n,t,a,W),dt(n,E);const te=vt(n);c.useEffect(()=>{if(t.length>0){Z(!1);return}const v=()=>{if(!n.current){Z(!0);return}const S=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",B=n.current.querySelectorAll('[data-type="variable"]'),A=n.current.querySelectorAll('[data-type="upload"]');let D=!1;B.forEach(F=>{(F.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(D=!0)}),A.forEach(F=>{F.querySelector(".upload-inner-wrapper.has-file")&&(D=!0)});const L=!S&&!D;Z(L),t.length===0&&W(!L)};v();const g=new MutationObserver(v);return n.current&&g.observe(n.current,{childList:!0,subtree:!0,characterData:!0}),()=>{g.disconnect()}},[t]);const oe=v=>{if(i){v.preventDefault();return}v.preventDefault();const g=v.clipboardData.getData("text/plain"),S=window.getSelection();if(S&&S.rangeCount>0){const B=S.anchorNode;if(B){let A=null;if(B.nodeType===Node.ELEMENT_NODE?A=B.closest('[data-type="variable"]'):B.nodeType===Node.TEXT_NODE&&B.parentElement&&(A=B.parentElement.closest('[data-type="variable"]')),A){const D=A.dataset.multiKey;if(D){const L=/[、,,\s\n\r\t]+/,F=g.split(L).map(M=>M.trim()).filter(M=>M.length>0);if(console.log("[Paste Event] 粘贴的内容:",g),console.log("[Paste Event] 拆分后的值:",F),F.length>1){const M=parseInt(A.dataset.index||"0",10),K=t.find(le=>le.type==="multi-variable"&&le.key===D)?.maxCount||9,X=ne[D]||1,P=Math.min(M+F.length,K);P>X&&u(ee=>({...ee,[D]:P}));const J=[];for(let ee=0;ee<X;ee++){const le=`${D}_${ee}`,me=n.current.querySelector(`[data-type="variable"][data-key="${le}"][data-multi-key="${D}"]`);if(me){const be=me.innerText.replace(/[\u200B\n]/g,"").trim();J.push(be)}}J.splice(M,1,...F.slice(0,K-M));const re=J.slice(0,K);re.length>0&&re[re.length-1]!==""&&re.length<K&&re.push("");const G=Math.max(re.length,1),se={};re.forEach((ee,le)=>{ee&&(se[`${D}_${le}`]=ee)}),n.current.querySelectorAll('[data-type="variable"]').forEach(ee=>{const le=ee.dataset.key,me=ee.dataset.multiKey;if(le&&me!==D){const be=ee.innerText.replace(/[\u200B\n]/g,"").trim();be&&(se[le]=be)}}),n.current.__tempVariableValues=se,u(ee=>({...ee,[D]:G})),console.log("[Paste Event] 粘贴完成,已填充到多个输入框,值:",re);return}else F.length===1&&console.log("[Paste Event] 粘贴单个值,将在失去焦点时检查是否需要拆分")}}}}document.execCommand("insertText",!1,g),pe(),setTimeout(()=>{const B=window.getSelection();if(B&&B.rangeCount>0){const A=B.anchorNode;if(A){let D=null;if(A.nodeType===Node.ELEMENT_NODE?D=A.closest('[data-type="variable"][data-multi-key]'):A.nodeType===Node.TEXT_NODE&&A.parentElement&&(D=A.parentElement.closest('[data-type="variable"][data-multi-key]')),D){const L=D.innerText.replace(/[\u200B\n]/g,"").trim();/[、,,\s]+/.test(L)&&(console.log("[Paste Event] 粘贴后检测到分隔符,内容:",L),console.log("[Paste Event] 提示:失去焦点后将自动拆分"))}}}},0)},ie=v=>{if(v.target.files&&v.target.files[0]&&f){const g=v.target.files[0],S=f;d(B=>({...B,[S]:g}))}v.target&&(v.target.value=""),w(null)},ue=v=>{d(g=>{const S={...g};return delete S[v],S})},de=v=>{const g=v.target;if(g.closest(".rte-datepicker-wrapper")||g.closest(".rte-datepicker-host"))return;if(g.closest(".tag-close-btn")){if(v.preventDefault(),v.stopPropagation(),T)return;_(null),$?$():n.current&&(n.current.innerHTML="",n.current.focus());return}if(T){const A=g.closest(".tag-node"),D=g.closest('[data-type="text"]');if(A||D){v.preventDefault(),v.stopPropagation();const L=window.getSelection();L&&L.removeAllRanges();return}}g.closest('[data-type="variable"]')||(O.current={x:v.clientX,y:v.clientY},E.current=!1,g.closest(".file-remove-btn")&&(v.preventDefault(),v.stopPropagation()))},ge=v=>{if(!v.target.closest('[data-type="variable"]')&&O.current){const B=Math.abs(v.clientX-O.current.x),A=Math.abs(v.clientY-O.current.y);(B>3||A>3)&&(E.current=!0)}},Q=v=>{if(v.target.closest('[data-type="variable"]')){O.current=null,E.current=!1;return}O.current=null,E.current=!1},ce=v=>{if(i)return;const g=v.target;if(g.closest('[data-type="datepicker"]'))return;if(g.closest(".tag-close-btn")){v.preventDefault(),v.stopPropagation();return}if(t.length===0)return;const A=(P,J)=>{if(!n.current)return;Array.from(n.current.children).forEach(G=>{if(G!==P)if(J)G.dataset.prevDisplay===void 0&&(G.dataset.prevDisplay=G.style.display||""),G.style.setProperty("display","none","important");else if(G.dataset.prevDisplay!==void 0){const se=G.dataset.prevDisplay;se?G.style.display=se:G.style.removeProperty("display"),delete G.dataset.prevDisplay}else G.style.removeProperty("display")})},D=g.closest(".rte-textarea-toggle");if(D){v.preventDefault(),v.stopPropagation();const P=D.closest(".rte-textarea-wrapper"),J=P?.querySelector('[data-type="textarea"]'),G=!(D.getAttribute("data-expanded")==="true");D.setAttribute("data-expanded",String(G)),D.textContent=G?"收起":"展开",P&&P.classList.toggle("rte-textarea-expanded",G);const se=P?.closest(".rte-textarea-required");if(se?se.classList.toggle("rte-textarea-overlay",G):P&&P.classList.toggle("rte-textarea-overlay",G),J)if(G)J.classList.add("rte-textarea-expanded"),J.style.maxHeight="none",J.style.height="100%";else{J.classList.remove("rte-textarea-expanded");const fe=J.dataset.maxHeight||"252";J.style.maxHeight=`${fe}px`,J.style.height="auto"}n.current&&(G?n.current.classList.add("rte-overlay-active"):n.current.classList.remove("rte-overlay-active"));return}const L=g.closest(".rte-richtext-toggle");if(L){v.preventDefault(),v.stopPropagation();const P=L.closest(".rte-richtext-wrapper"),J=P?.querySelector('[data-type="richtext"]'),G=!(L.getAttribute("data-expanded")==="true");((le,me)=>{le.setAttribute("data-expanded",String(me)),le.innerHTML=me?'<i class="iconfont icon-shouqi1"></i><span class="rte-richtext-toggle-label">收起</span>':'<i class="iconfont icon-zhankai2"></i><span class="rte-richtext-toggle-label">展开</span>'})(L,G);const fe=P?.closest(".rte-richtext-required");fe?fe.classList.toggle("rte-richtext-expanded",G):P&&P.classList.toggle("rte-richtext-expanded",G);const ee=P?.closest(".exclusion-wrapper")||P?.parentElement;J&&(G?(J.style.height="100%",J.style.overflow="auto"):(J.style.height="",J.style.overflow="")),ee&&(ee.classList.toggle("rte-richtext-host-expanded",G),A(ee,G)),n.current&&n.current.classList.toggle("rte-richtext-fullscreen-active",G);return}if(g.closest('[data-type="text"]')){v.preventDefault(),v.stopPropagation();const P=window.getSelection();P&&P.removeAllRanges();return}if(T&&g.closest(".tag-node")){v.preventDefault(),v.stopPropagation();const J=window.getSelection();J&&J.removeAllRanges();return}if(g.closest('[data-type="variable"]')){if(E.current)return;setTimeout(()=>{const P=window.getSelection();P&&!P.isCollapsed||De(n)},10);return}const K=g.closest(".file-remove-btn");if(K){v.preventDefault(),v.stopPropagation();const J=K.closest('[data-type="upload"]')?.dataset.key;J&&ue(J);return}const X=g.closest('[data-type="upload"]');if(X){const P=X.dataset.key;P&&(w(P),o.current?.click());return}},ye=v=>{const S=v.target.closest('[data-type="variable"]');if(S){const B=window.getSelection();if(B){const A=document.createRange(),D=S.textContent||"";if(D.replace(/\u200B/g,"")){let F=0,M=D.length;D.startsWith("")&&(F=1),D.endsWith("")&&D.length>1&&(M=D.length-1);const K=S.firstChild;K&&K.nodeType===Node.TEXT_NODE?(A.setStart(K,F),A.setEnd(K,M)):A.selectNodeContents(S)}else A.selectNodeContents(S),A.collapse(!0);B.removeAllRanges(),B.addRange(A)}}},pe=()=>{if(t.length===0){if(n.current){const S=!(n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");Z(S),W(!S)}return}if(De(n),n.current&&n.current.querySelectorAll('[data-type="variable"]').forEach(S=>{const B=S.querySelector(".variable-info-icon");if(B){let A=!1;const D=document.createTreeWalker(S,NodeFilter.SHOW_TEXT,{acceptNode:L=>B.contains(L)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;D.nextNode();)if(D.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){A=!0;break}A?B.classList.add("hidden"):B.classList.remove("hidden")}}),Le(n,t,a),Ie(n,t,a,W),!n.current)return;t.filter(g=>g.type==="multi-variable"&&g.key).forEach(g=>{if(!g.key)return;const S=g.maxCount||9,B=ne[g.key]||1,A=[];for(let K=0;K<B;K++){const X=`${g.key}_${K}`,P=n.current.querySelector(`[data-type="variable"][data-key="${X}"][data-multi-key="${g.key}"]`);if(P){const J=P.innerText.replace(/[\u200B\n]/g,"").trim();A.push(J)}}const L=(A[A.length-1]||"")==="";let F=!1,M=-1;for(let K=0;K<A.length-1;K++)if(A[K]===""){F=!0,M=K;break}if(F&&M>=0){const K=window.getSelection();if(K&&K.rangeCount>0){const G=K.getRangeAt(0),se=G.startContainer,fe=se.nodeType===Node.ELEMENT_NODE?se.closest('[data-type="variable"][data-multi-key]'):se.parentElement?.closest('[data-type="variable"][data-multi-key]');if(fe){const ee=fe.dataset.key;if(ee){const le=document.createRange();le.setStartBefore(fe),le.setEnd(G.startContainer,G.startOffset);const me=le.toString().length;Y.current={key:ee,offset:me}}}}const X=[...A];for(let G=M;G<X.length-1;G++)X[G]=X[G+1];X.pop();const P={};X.forEach((G,se)=>{G&&(P[`${g.key}_${se}`]=G)});const J=Math.max(L?X.length:X.length+1,1);n.current.querySelectorAll('[data-type="variable"]').forEach(G=>{const se=G.dataset.key,fe=G.dataset.multiKey;if(se&&fe!==g.key){const ee=G.innerText.replace(/[\u200B\n]/g,"").trim();ee&&(P[se]=ee)}}),n.current.__tempVariableValues=P,u(G=>({...G,[g.key]:J}));return}if(!L){const K=B-1,X=`${g.key}_${K}`,P=n.current.querySelector(`[data-type="variable"][data-key="${X}"][data-multi-key="${g.key}"]`);if(P&&P.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&B<S){const re=window.getSelection();if(re&&re.rangeCount>0){const G=re.getRangeAt(0),se=G.startContainer,fe=se.nodeType===Node.ELEMENT_NODE?se.closest('[data-type="variable"][data-multi-key]'):se.parentElement?.closest('[data-type="variable"][data-multi-key]');if(fe){const ee=fe.dataset.key;if(ee){const le=document.createRange();le.setStartBefore(fe),le.setEnd(G.startContainer,G.startOffset);const me=le.toString().length;Y.current={key:ee,offset:me}}}}u(G=>({...G,[g.key]:B+1}))}}})};c.useLayoutEffect(()=>{const v=n.current;if(!v)return;const g=new Map,S=D=>{const L=D.target,F=D.relatedTarget;!L||!n.current||!n.current.contains(L)||F&&n.current.contains(F)||setTimeout(()=>{if(n.current){if(t.length===0){const M=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";W(M.length>0);return}De(n),Le(n,t,a),Ie(n,t,a,W)}},0)};v.addEventListener("blur",S,!0);const B=()=>{if(!n.current)return;g.forEach((F,M)=>{M.removeEventListener("blur",F,!1)}),g.clear();const D=n.current.querySelectorAll('[data-type="variable"][data-multi-key]'),L=F=>{F.stopPropagation(),F.stopImmediatePropagation();const M=F.target;if(!M||!n.current||!n.current.contains(M))return;const K=M.closest('[data-type="variable"][data-multi-key]');if(!K||!n.current.contains(K))return;let X=!1;if(g.forEach((le,me)=>{(me===K||me.contains(M))&&(X=!0)}),!X)return;const P=K.dataset.multiKey,J=K.dataset.key,re=K.dataset.index;if(!P||!J||re===void 0)return;const G=F.relatedTarget;if(!(!G||!n.current.contains(G)))return;const fe=K.innerText.replace(/[\u200B\n]/g,"").trim();console.log("[Blur Event] 失去焦点的 multi-variable 输入框:",{multiKey:P,currentKey:J,index:re,content:fe});const ee=/[、,,\s]+/;if(ee.test(fe)){const le=fe.split(ee).map($e=>$e.trim()).filter($e=>$e.length>0);console.log("[Blur Event] 拆分前的内容:",fe),console.log("[Blur Event] 拆分后的部分:",le);const be=le.slice(0,9);if(console.log("[Blur Event] 有效的部分(最多9个):",be),be.length>1){const $e=t.find(Te=>Te.type==="multi-variable"&&Te.key===P);if($e){const Te=ne[P]||1,et=parseInt(re,10),tt=$e.maxCount||9,qe=[];for(let he=0;he<Te;he++){const Ce=`${P}_${he}`,Ne=n.current.querySelector(`[data-type="variable"][data-key="${Ce}"][data-multi-key="${P}"]`);if(Ne){const Ae=Ne.innerText.replace(/[\u200B\n]/g,"").trim();qe.push(Ae)}}console.log("[Blur Event] 拆分前的所有值:",qe),console.log("[Blur Event] 当前索引:",et),console.log("[Blur Event] 要插入的值:",be),qe.splice(et,1,...be);const we=qe.slice(0,tt);console.log("[Blur Event] 拆分后的所有值:",we),we.length>0&&we[we.length-1]!==""&&we.length<tt&&we.push("");const Ct=Math.max(we.length,1),Be={};we.forEach((he,Ce)=>{he&&(Be[`${P}_${Ce}`]=he)}),n.current.querySelectorAll('[data-type="variable"]').forEach(he=>{const Ce=he.dataset.key,Ne=he.dataset.multiKey;if(Ce&&Ne!==P){const Ae=he.innerText.replace(/[\u200B\n]/g,"").trim();Ae&&(Be[Ce]=Ae)}}),n.current.__tempVariableValues=Be,u(he=>({...he,[P]:Ct}))}}}};D.forEach(F=>{F.addEventListener("blur",L,!1),g.set(F,L)})},A=setTimeout(()=>{B()},0);return()=>{clearTimeout(A),v.removeEventListener("blur",S,!0),g.forEach((D,L)=>{L.removeEventListener("blur",D,!1)}),g.clear()}},[t,ne,a]);const ve=v=>{if(i){v.preventDefault();return}const g=window.getSelection();if(g&&g.rangeCount>0){const S=g.anchorNode;let B=null;if(S&&(S.nodeType===Node.ELEMENT_NODE?B=S.closest('[data-type="text"]'):S.nodeType===Node.TEXT_NODE&&S.parentElement&&(B=S.parentElement.closest('[data-type="text"]'))),B){if(v.preventDefault(),v.stopPropagation(),n.current){const A=n.current.querySelector('[data-type="variable"], [data-type="upload"]');A&&A.focus()}return}}if(T&&g&&g.rangeCount>0){const S=g.anchorNode;let B=null;if(S&&(S.nodeType===Node.ELEMENT_NODE?B=S.closest(".tag-node"):S.nodeType===Node.TEXT_NODE&&S.parentElement&&(B=S.parentElement.closest(".tag-node"))),B){if(v.preventDefault(),v.stopPropagation(),n.current){const A=n.current.querySelector('[data-type="variable"], [data-type="upload"]');A&&A.focus()}return}}if(v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),ke()),v.key==="Escape"&&n.current){if(T){v.preventDefault();return}n.current.innerHTML="",n.current.focus()}if(v.key==="Backspace"){const S=window.getSelection();if(S&&S.rangeCount>0){const B=S.getRangeAt(0),A=S.anchorNode;if(T){let L=null,F=null;if(A&&(A.nodeType===Node.ELEMENT_NODE?(L=A.closest(".tag-node"),F=A.closest('[data-type="text"]')):A.nodeType===Node.TEXT_NODE&&A.parentElement&&(L=A.parentElement.closest(".tag-node"),F=A.parentElement.closest('[data-type="text"]'))),(L||F)&&B.collapsed&&B.startOffset===0){v.preventDefault();return}}let D=null;if(A&&(A.nodeType===Node.ELEMENT_NODE?D=A.closest('[data-type="variable"]'):A.nodeType===Node.TEXT_NODE&&A.parentElement&&(D=A.parentElement.closest('[data-type="variable"]'))),D){if(!B.collapsed)return;const L=D.innerText;if(L===""||L===""){v.preventDefault();return}if(B.startOffset===0){v.preventDefault();return}if(L.startsWith("")&&B.startOffset===1){v.preventDefault();return}}}}},ke=()=>{if(y||i||e||!z||!n.current)return;if(t.length===0){const D=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!D)return;k(D,D);return}const v=n.current;let g="";const S={},B=D=>{if(!(D.nodeType===Node.ELEMENT_NODE&&D.style.display==="none")){if(D.nodeType===Node.TEXT_NODE)g+=(D.textContent||"").replace(/\u200B/g,"");else if(D.nodeType===Node.ELEMENT_NODE){const L=D,F=L.dataset.type,M=L.dataset.key;if(F==="variable"&&M){let K="";const X=document.createTreeWalker(L,NodeFilter.SHOW_TEXT,{acceptNode:J=>{const re=L.querySelector(".variable-info-icon");return re&&re.contains(J)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;X.nextNode();)K+=X.currentNode.textContent||"";const P=K.replace(/[\u200B\n]/g,"").trim();if(P){const J=L.dataset.multiKey;if(J){(!S[J]||!Array.isArray(S[J]))&&(S[J]=[]);const re=S[J];re.push(P),re.length>1&&(g+=" "),g+=P}else S[M]=P,g+=P}}else if(F==="select"&&M){const K=L,X=(K.value||"").trim();if(X){S[M]=X;const P=K.selectedOptions?.[0];g+=P?.textContent||X}}else if(F==="textarea"&&M){const X=(L.value||"").replace(/\u200B/g,"").trim();X&&(S[M]=X,g+=X)}else if(F==="richtext"&&M){const X=(L.textContent||"").replace(/\u200B/g,"").trim();X&&(S[M]=X,g+=X)}else if(F==="datepicker"&&M){const X=(L.getAttribute("data-value")||"").trim();if(X)if(X.includes(",")){const P=X.split(",");P.length===2?(S[M]=P,g+=`[${P[0]}, ${P[1]}]`):(S[M]=X,g+=X)}else S[M]=X,g+=X}else if(F==="upload"&&M)S[M]=a[M]??null,a[M]&&(g+=` [附带文件: ${a[M]?.name}] `);else{if(L.classList.contains("tag-close-btn")||L.classList.contains("file-remove-btn"))return;L.getAttribute("contenteditable")==="false"&&!F&&L.classList.contains("tag-node")?g+=L.innerText:L.childNodes.forEach(B)}}}};if(v.childNodes.forEach(B),g=g.trim(),!g)return;const A=new FormData;A.append("fullPrompt",g),Object.keys(S).forEach(D=>{const L=S[D];L!=null&&(L instanceof File?A.append(D,L):Array.isArray(L)?t.some(M=>M.type==="multi-variable"&&M.key===D)?L.forEach(M=>{M!=null&&M!==""&&A.append(D,String(M))}):L.forEach((M,K)=>{M!=null&&(M instanceof File?A.append(`${D}[${K}]`,M):typeof M=="string"?A.append(`${D}[${K}]`,M):A.append(`${D}[${K}]`,String(M)))}):typeof L=="string"?A.append(D,L):A.append(D,String(L)))}),k(A,g)},Ee={...m?{width:typeof m=="number"?`${m}px`:m}:{},...h?{border:h}:{},...l?{background:l}:{}};return s.jsxs("div",{className:"rich-text-editor",style:Ee,"data-disabled":i,children:[s.jsx("div",{ref:n,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${H&&q?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":q,onMouseDown:de,onMouseMove:ge,onMouseUp:Q,onClick:ce,onDoubleClick:ye,onInput:pe,onKeyDown:ve,onPaste:oe}),s.jsx("input",{type:"file",ref:o,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:ie}),s.jsxs("div",{className:"rich-text-editor-footer",children:[s.jsx("div",{className:"rich-text-editor-footer-left",children:s.jsxs("div",{className:"rich-text-editor-brand",children:[s.jsxs("div",{className:"rte-brand-badge",children:[s.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),s.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),r!=="hideAgent"&&s.jsx(R.Dropdown,{placement:"top",menu:{items:V.map(v=>({key:v.key,label:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[v.icon&&s.jsx("i",{className:v.icon}),s.jsx("span",{children:v.label})]}),onClick:()=>{C?.(v)}}))},trigger:["click"],disabled:i||y,children:s.jsxs("div",{className:"rte-agent-badge",style:{cursor:V.length>0?"pointer":"default"},children:[s.jsx("i",{className:"iconfont icon-zhinengti"}),s.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(()=>{const v=t.find(S=>S.type==="tag");if(!v||!v.text)return null;const g=V.find(S=>S.label===v.text);return!g||g.points===void 0||g.points===null?null:s.jsxs("div",{className:"rte-points-badge",children:[s.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px"}}),s.jsxs("span",{style:{fontSize:"16px"},children:["-",String(g.points)]})]})})(),s.jsx("button",{type:"button",onClick:ke,disabled:y||i||e||!z,className:"rich-text-editor-send-button",children:y||e?s.jsx("span",{className:"rte-send-spinner"}):s.jsx("i",{className:"iconfont icon-fasong"})})]})]}),x?.anchorEl&&(()=>{if(!document.body.contains(x.anchorEl))return null;let v="",g={background:"var(--neutral-800, #262626)"};if(x.type==="upload")v=t.find(A=>A.type==="upload"&&A.key===x.key)?.tooltip||"";else if(x.type==="tag")v=x.anchorEl.dataset.tooltip||"";else if(x.type==="upload-label")v=x.anchorEl.dataset.fileName||"";else if(x.type==="variable")v=x.anchorEl.dataset.tooltip||"";else if(x.type==="upload-preview"){const B=a[x.key];if(B&&B.type&&B.type.startsWith("image/")){const A=URL.createObjectURL(B);v=s.jsx("div",{style:{width:120,height:120,display:"flex",alignItems:"center",justifyContent:"center"},children:s.jsx("img",{src:A,style:{maxWidth:120,maxHeight:120,objectFit:"contain"}})}),g={background:"#fff",padding:4},setTimeout(()=>URL.revokeObjectURL(A),1e3)}else v=""}if(!v)return null;const S=x.type==="upload-preview"?"#0A0A0A":"#fff";return _e.createPortal(s.jsx(R.Tooltip,{arrow:!1,title:s.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:S},children:v}),open:!0,placement:"top",getPopupContainer:()=>document.body,overlayInnerStyle:g,children:s.jsx("div",{style:{position:"fixed",left:`${x.anchorEl.getBoundingClientRect().left}px`,top:`${x.anchorEl.getBoundingClientRect().top}px`,width:`${x.anchorEl.offsetWidth}px`,height:`${x.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})(),te]})};Ke.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const Xe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",bt=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],xt=({autoLoading:t,batchSize:k,loadingProgress:y,loadIcon:i,onBatchSizeChange:m,onLoadNextPage:T,onStartAutoLoad:V,onStopLoad:C})=>t&&y?s.jsxs("div",{className:"auto_load_progress",children:[i||s.jsx("img",{src:Xe,alt:"自动加载",width:14,height:14}),s.jsxs("span",{children:["正在加载第",y.currentPage,"/",y.totalPages,"页"]}),s.jsx(R.Progress,{percent:y.percentage,type:"line",size:[160,8]}),s.jsx("span",{onClick:C,className:"auto_load_stop_btn",children:"停止加载"})]}):s.jsxs("div",{className:"auto_load_container",children:[s.jsx("div",{onClick:T,className:"auto_load_next_btn",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:"加载下一页"}),s.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:[s.jsxs("div",{className:"auto_load_btn",onClick:t?void 0:V,children:[i||s.jsx("img",{src:Xe,alt:"自动加载",width:14,height:14}),s.jsx("span",{children:"自动加载"})]}),s.jsx(R.Select,{value:k,onChange:m,options:bt,disabled:t,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),kt=({current:t,loadIcon:k,pageSize:y,total:i,cachedPages:m,loadedCount:T,autoLoading:V=!1,loadingProgress:C,onChange:$,onLoadNextPage:e,onStartAutoLoad:q,onStopLoading:h})=>{const[l,r]=c.useState(5),n=Math.ceil(i/y),o=c.useMemo(()=>m.length>=n,[m,n]),a=()=>Array.from({length:n},(w,x)=>x+1).filter(w=>!m.includes(w)).slice(0,l),d=(f,w,x)=>{const _=m.includes(f);return w==="prev"||w==="next"||w==="jump-prev"||w==="jump-next"?s.jsx("div",{className:"pageBox",children:x}):s.jsxs("div",{className:"pageBox",style:{backgroundColor:t===f?"#2563EB":"#f5f5f5",color:t===f?"#fff":_?"#171717":"#a3a3a3"},children:[f,!_&&s.jsx("span",{className:"unload_spot"})]})};return s.jsxs("div",{className:"pagination_footer",children:[s.jsxs("div",{className:"pagination_leftWrap",children:[s.jsxs("span",{className:"pagination_total",children:[s.jsx(xe.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",T,"/",i,"条数据"]}),!o&&s.jsx(xt,{loadIcon:k||void 0,autoLoading:V,batchSize:l,loadingProgress:C,disabled:!e||!q,onBatchSizeChange:r,onLoadNextPage:()=>e?.(),onStartAutoLoad:()=>{const f=a();q?.(f)},onStopLoad:()=>h?.()})]}),s.jsx(R.Pagination,{current:t,pageSize:y,total:i,onChange:f=>$(f),showSizeChanger:!1,showQuickJumper:!1,showTotal:(f,w)=>"",itemRender:d})]})},Je=t=>{const{loading:k,autoLoading:y,loadingProgress:i,columns:m=[],dataSource:T=[],total:V,current:C,pageSize:$,cachedPages:e,onChangePage:q,onLoadNextPage:h,onStartAutoLoad:l,onStopLoading:r,...n}=t,o=c.useRef(null),a=c.useCallback(d=>{q(d),e.includes(d)&&o.current?.scrollTo({key:`${(d-1)*$+1}`})},[C]);return s.jsxs("div",{className:"flex flex-col",children:[s.jsx(R.Table,{ref:o,...n,columns:m,dataSource:T,pagination:!1,virtual:!0}),s.jsx(kt,{loading:k,autoLoading:y,loadingProgress:i,current:C,pageSize:$,total:V,loadedCount:T.length,cachedPages:e,onChange:a,onLoadNextPage:h,onStartAutoLoad:l,onStopLoading:r})]})};Je.__docgenInfo={displayName:"VirtualTable",description:"虚拟滚动表格组件,支持分页、数据缓存和自动加载功能。",props:{loading:{description:"加载状态",name:"loading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},total:{description:"总数据条数",name:"total",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"0"}},current:{description:"当前页码",name:"current",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"1"}},pageSize:{description:"每页数据条数",name:"pageSize",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"10"}},cachedPages:{description:"已缓存的页码数组",name:"cachedPages",required:!0,type:{name:"number[]",raw:"number[]"},defaultValue:{value:"[]"}},dataSource:{description:"数据源",name:"dataSource",required:!0,type:{name:"Array<T>",raw:"Array<T>"},defaultValue:{value:"[]"}},onChangePage:{description:"页码变更回调函数",name:"onChangePage",required:!0,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},autoLoading:{description:"是否正在自动加载",name:"autoLoading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},loadingProgress:{description:"加载进度信息",name:"loadingProgress",required:!0,type:{name:"object",raw:"{percentage: 0, currentPage: 1, totalPages: 5}"},defaultValue:{value:"-"}},onLoadNextPage:{description:"加载下一页回调函数",name:"onLoadNextPage",required:!1,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},onStartAutoLoad:{description:"开始自动加载回调函数",name:"onStartAutoLoad",required:!1,type:{name:"function",raw:"function(loadNextPages: number[]): void"},defaultValue:{value:"-"}},onStopLoading:{description:"停止加载回调函数",name:"onStopLoading",required:!1,type:{name:"function",raw:"function(): void"},defaultValue:{value:"-"}},columns:{description:"表格列配置",name:"columns",required:!0,type:{name:"Array<object>",raw:"Array<object>"},defaultValue:{value:"[]"}}}};const Qe=({texts:t=[],placeholder:k="请输入内容",animationSpeed:y=100,autoPlay:i=!0,value:m,onChange:T,...V})=>{const[C,$]=c.useState(""),[e,q]=c.useState(0),[h,l]=c.useState(!1),[r,n]=c.useState(!1),[o,a]=c.useState(!1),d=c.useRef(void 0),f=c.useRef(void 0),w=c.useRef(t),x=c.useRef(e),_=c.useRef(r),E=c.useRef(C);c.useEffect(()=>{w.current=t,x.current=e,_.current=r,E.current=C});const O=c.useCallback((u,p)=>{let b=0;a(!0);const I=()=>{b<u.length?($(u.slice(0,b+1)),b++,f.current=window.setTimeout(I,y)):(a(!1),p?.())};I()},[y]),z=c.useCallback(u=>{let p=E.current.length;const b=()=>{p>0?($(E.current.slice(0,p-1)),p--,f.current=window.setTimeout(b,y/2)):u?.()};b()},[y]),W=c.useCallback(()=>{if(w.current.length===0||_.current)return;l(!0);const u=w.current[x.current];E.current?z(()=>{O(u,()=>{d.current=window.setTimeout(()=>{q(p=>(p+1)%w.current.length),l(!1)},2e3)})}):O(u,()=>{d.current=window.setTimeout(()=>{q(p=>(p+1)%w.current.length),l(!1)},2e3)})},[z,O]);c.useEffect(()=>(i&&t.length>0&&!r&&W(),()=>{d.current&&window.clearTimeout(d.current),f.current&&window.clearTimeout(f.current)}),[e,r,i,t.length,W]),c.useEffect(()=>{!h&&i&&t.length>0&&!r&&W()},[e,h,i,t.length,r,W]);const Y=u=>{n(!0),d.current&&window.clearTimeout(d.current),f.current&&window.clearTimeout(f.current),l(!1),a(!1),V.onFocus?.(u)},H=u=>{n(!1),!m&&t.length>0&&($(""),q(0)),V.onBlur?.(u)},Z=u=>{T?.(u.target.value),V.onChange?.(u)},ne=()=>r||m?k:C||k;return s.jsxs("div",{style:{position:"relative"},children:[s.jsx(R.Input,{...V,value:m,onChange:Z,onFocus:Y,onBlur:H,placeholder:ne(),style:{...V.style,position:"relative",zIndex:1}}),!r&&!m&&C&&s.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[s.jsx("span",{children:C}),o&&s.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),s.jsx("style",{children:`
|
|
2
2
|
@keyframes blink {
|
|
3
3
|
0%, 50% { opacity: 1; }
|
|
4
4
|
51%, 100% { opacity: 0; }
|
|
5
5
|
}
|
|
6
|
-
`})]})};
|
|
6
|
+
`})]})};Qe.__docgenInfo={displayName:"DynamicInput",description:"动态文案输入框组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}}}};const Re=({texts:t=[],placeholder:k="请输入内容",animationSpeed:y=100,autoPlay:i=!0,value:m="",onChange:T,onSubmit:V,maxLength:C=500,showCount:$=!0,submitText:e="发送",disabled:q=!1,rows:h=4,style:l,...r})=>{const[n,o]=c.useState(""),[a,d]=c.useState(0),[f,w]=c.useState(!1),[x,_]=c.useState(!1),[E,O]=c.useState(!1),[z,W]=c.useState(m||""),Y=c.useRef(void 0),H=c.useRef(void 0),Z=c.useRef(t),ne=c.useRef(a),u=c.useRef(x),p=c.useRef(n),b=c.useRef(null);c.useEffect(()=>{Z.current=t,ne.current=a,u.current=x,p.current=n});const I=c.useCallback((Q,ce)=>{let ye=0;O(!0);const pe=()=>{ye<Q.length?(o(Q.slice(0,ye+1)),ye++,H.current=window.setTimeout(pe,y)):(O(!1),ce?.())};pe()},[y]),N=c.useCallback(Q=>{let ce=p.current.length;const ye=()=>{ce>0?(o(p.current.slice(0,ce-1)),ce--,H.current=window.setTimeout(ye,y/2)):Q?.()};ye()},[y]),U=c.useCallback(()=>{if(Z.current.length===0||u.current)return;w(!0);const Q=Z.current[ne.current];p.current?N(()=>{I(Q,()=>{Y.current=window.setTimeout(()=>{d(ce=>(ce+1)%Z.current.length),w(!1)},2e3)})}):I(Q,()=>{Y.current=window.setTimeout(()=>{d(ce=>(ce+1)%Z.current.length),w(!1)},2e3)})},[N,I]);c.useEffect(()=>(i&&t.length>0&&!x&&U(),()=>{Y.current&&window.clearTimeout(Y.current),H.current&&window.clearTimeout(H.current)}),[a,x,i,t.length,U]),c.useEffect(()=>{!f&&i&&t.length>0&&!x&&U()},[a,f,i,t.length,x,U]);const j=Q=>{_(!0),Y.current&&window.clearTimeout(Y.current),H.current&&window.clearTimeout(H.current),w(!1),O(!1),r.onFocus?.(Q)},te=Q=>{_(!1),!m&&t.length>0&&(o(""),d(0)),r.onBlur?.(Q)},oe=Q=>{const ce=Q.target.value;C&&ce.length>C||(T?T(ce):W(ce),r.onChange?.(Q))},ie=()=>{const Q=T?m:z;Q.trim()&&!q&&(V?.(Q),T||W(""))},ue=Q=>{(Q.ctrlKey||Q.metaKey)&&Q.key==="Enter"&&(Q.preventDefault(),ie()),r.onKeyDown?.(Q)},de=T?m:z,ge=q||!de.trim()||(C?de.length>C:!1);return s.jsxs("div",{style:{position:"relative",...l},children:[s.jsxs("div",{style:{position:"relative"},children:[s.jsx("textarea",{ref:b,value:T?m:z,onChange:oe,onFocus:Q=>{Q.target.style.borderColor="#1890ff",Q.target.style.boxShadow="0 0 0 2px rgba(24, 144, 255, 0.2)",j(Q)},onBlur:Q=>{Q.target.style.borderColor="#d9d9d9",Q.target.style.boxShadow="none",te(Q)},onKeyDown:ue,placeholder:x||de?k:"",maxLength:C,rows:h,disabled:q,style:{width:"100%",minHeight:`${h*24+16}px`,padding:"8px 60px 8px 12px",border:"1px solid #d9d9d9",borderRadius:"6px",fontSize:"14px",lineHeight:"1.5",fontFamily:"inherit",resize:"vertical",outline:"none",transition:"border-color 0.3s, box-shadow 0.3s",backgroundColor:"#fff",...r.style},...r}),!x&&!de&&n&&s.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"flex-start",paddingTop:8,paddingLeft:12,paddingRight:12,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit",lineHeight:"1.5"},children:[s.jsx("span",{children:n}),E&&s.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),s.jsx("div",{style:{position:"absolute",bottom:8,right:8,zIndex:3},children:s.jsx(R.Button,{type:"primary",size:"small",icon:s.jsx(xe.SendOutlined,{}),onClick:ie,disabled:ge,style:{borderRadius:6,minWidth:32,height:32,display:"flex",alignItems:"center",justifyContent:"center"},children:e})})]}),$&&s.jsxs("div",{style:{marginTop:4,textAlign:"right",fontSize:"12px",color:"#999"},children:[de.length,"/",C]}),s.jsx("style",{children:`
|
|
7
7
|
@keyframes blink {
|
|
8
8
|
0%, 50% { opacity: 1; }
|
|
9
9
|
51%, 100% { opacity: 0; }
|
|
10
10
|
}
|
|
11
|
-
`})]})};
|
|
11
|
+
`})]})};Re.__docgenInfo={displayName:"DynamicTextArea",description:"动态文案文本域组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}},onSubmit:{name:"onSubmit",required:!1,description:"提交回调",type:{name:"function",raw:"(value: string) => void"}},maxLength:{name:"maxLength",required:!1,description:"最大输入字数",type:{name:"number",raw:"number"},defaultValue:{value:"500"}},showCount:{name:"showCount",required:!1,description:"是否显示字数统计",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},submitText:{name:"submitText",required:!1,description:"提交按钮文本",type:{name:"string",raw:"string"},defaultValue:{value:'"发送"'}},disabled:{name:"disabled",required:!1,description:"是否禁用提交按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},rows:{name:"rows",required:!1,description:"文本域行数",type:{name:"number",raw:"number"},defaultValue:{value:"4"}}}};const Ve=({src:t,poster:k,width:y=300,height:i,videoWidth:m,videoHeight:T,showPlayButton:V=!0,autoPlayOnHover:C=!0,onClick:$,onVideoLoaded:e,onVideoPlay:q,onVideoPause:h,onVideoEnded:l,className:r,style:n,...o})=>{const a=c.useRef(null),[d,f]=c.useState(!1),[w,x]=c.useState(!1),[_,E]=c.useState(!1),O=c.useCallback(()=>{a.current&&(a.current.play(),f(!0),q?.())},[q]),z=c.useCallback(()=>{a.current&&(a.current.pause(),f(!1),h?.())},[h]),W=c.useCallback(I=>{I.stopPropagation(),d?z():O()},[d,O,z]),Y=c.useCallback(()=>{x(!0),C&&!d&&O()},[C,d,O]),H=c.useCallback(()=>{x(!1),C&&d&&z()},[C,d,z]),Z=c.useCallback(()=>{E(!0),e?.()},[e]),ne=c.useCallback(()=>{f(!0),q?.()},[q]),u=c.useCallback(()=>{f(!1),h?.()},[h]),p=c.useCallback(()=>{f(!1),l?.()},[l]),b=c.useCallback(I=>{$?.(I)},[$]);return s.jsx(R.Card,{...o,className:`video-card ${r||""}`,style:{width:y,height:i,padding:0,overflow:"hidden",cursor:$?"pointer":"default",border:"none",borderRadius:0,...n},bordered:!1,onMouseEnter:Y,onMouseLeave:H,onClick:b,children:s.jsxs("div",{className:"video-card-container",children:[s.jsx("video",{ref:a,src:t,poster:k,preload:"metadata",onLoadedData:Z,onPlay:ne,onPause:u,onEnded:p,muted:!0,loop:!0}),V&&s.jsx("div",{className:`video-play-button ${w?"hovered":""}`,onClick:W,children:d?s.jsx(xe.PauseCircleOutlined,{className:"play-icon"}):s.jsx(xe.PlayCircleOutlined,{className:"play-icon"})}),!_&&s.jsx("div",{className:"video-loading-mask",children:s.jsx("div",{className:"loading-spinner"})})]})})};Ve.__docgenInfo={displayName:"VideoCard",description:"视频卡片组件,支持鼠标悬浮播放控制",props:{src:{name:"src",required:!0,description:"视频源地址",type:{name:"string",raw:"string"}},poster:{name:"poster",required:!1,description:"视频海报图片",type:{name:"string",raw:"string"}},width:{name:"width",required:!1,description:"卡片宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:"300"}},height:{name:"height",required:!1,description:"卡片高度",type:{name:"number | string",raw:"number | string"}},videoWidth:{name:"videoWidth",required:!1,description:"视频宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},videoHeight:{name:"videoHeight",required:!1,description:"视频高度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},showPlayButton:{name:"showPlayButton",required:!1,description:"是否显示播放按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},autoPlayOnHover:{name:"autoPlayOnHover",required:!1,description:"是否自动播放(鼠标悬浮时)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLDivElement>) => void"}},onVideoLoaded:{name:"onVideoLoaded",required:!1,description:"视频加载完成事件",type:{name:"function",raw:"() => void"}},onVideoPlay:{name:"onVideoPlay",required:!1,description:"视频播放事件",type:{name:"function",raw:"() => void"}},onVideoPause:{name:"onVideoPause",required:!1,description:"视频暂停事件",type:{name:"function",raw:"() => void"}},onVideoEnded:{name:"onVideoEnded",required:!1,description:"视频结束事件",type:{name:"function",raw:"() => void"}},className:{name:"className",required:!1,description:"自定义样式类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const wt=t=>[".mp4",".webm",".ogg",".mov",".avi",".wmv",".flv",".mkv"].some(y=>t.toLowerCase().includes(y)),Et=t=>t.type?t.type:wt(t.url)?"video":"image",Ze=({items:t,columns:k,gap:y=0,responsive:i=!0,breakpoints:m={xs:1,sm:2,md:3,lg:4,xl:5,xxl:6},className:T,style:V,onClick:C})=>{const $=c.useRef(null),[e,q]=c.useState(k||m.md||3),h=c.useRef(new Map),l=c.useCallback(()=>{if(!i||k)return k||m.md||3;const a=window.innerWidth;return a<576?m.xs||1:a<768?m.sm||2:a<992?m.md||3:a<1200?m.lg||4:a<1600?m.xl||5:m.xxl||6},[i,k,m]),r=c.useCallback(()=>{if(!$.current)return;const a=e,d=$.current,w=(d.offsetWidth-y*(a-1))/a,x=new Array(a).fill(0);t.forEach((E,O)=>{const z=E.id||O,W=h.current.get(z);if(!W)return;const Y=Math.min(...x),H=x.indexOf(Y),Z=H*(w+y),ne=x[H];W.style.position="absolute",W.style.left=`${Z}px`,W.style.top=`${ne}px`,W.style.width=`${w}px`,x[H]+=W.offsetHeight+y});const _=Math.max(...x);d.style.height=`${_}px`},[t,e,y]);c.useEffect(()=>{const a=()=>{const d=l();d!==e&&q(d)};if(i)return window.addEventListener("resize",a),a(),()=>window.removeEventListener("resize",a)},[i,l,e]),c.useEffect(()=>{const a=setTimeout(()=>{r()},100);return()=>clearTimeout(a)},[t,e,r]);const n=c.useCallback(()=>{r()},[r]),o=c.useCallback(a=>{C&&C(a),a.onClick?.(a)},[C]);return s.jsx("div",{ref:$,className:`waterfall-container ${T||""}`,style:{position:"relative",width:"100%",...V},children:t.map((a,d)=>{const f=a.id||d,w=Et(a);return s.jsx("div",{ref:x=>{x?h.current.set(f,x):h.current.delete(f)},className:"waterfall-item",children:w==="video"?s.jsx("div",{style:{width:"100%",position:"relative",paddingBottom:"56.25%",cursor:C||a.onClick?"pointer":"default"},children:s.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:s.jsx(Ve,{src:a.url,poster:a.poster,width:"100%",height:"100%",onClick:()=>o(a),onVideoLoaded:n,autoPlayOnHover:!0,showPlayButton:!1})})}):s.jsx("div",{className:"waterfall-image-wrapper",onClick:()=>o(a),style:{cursor:C||a.onClick?"pointer":"default"},children:s.jsx("img",{src:a.url,alt:`瀑布流图片 ${d+1}`,className:"waterfall-image",onLoad:n,onError:n,style:{display:"block",width:"100%",height:"auto"}})})},f)})})};Ze.__docgenInfo={displayName:"Waterfall",description:"瀑布流布局组件,支持图片和视频混合展示",props:{items:{name:"items",required:!0,description:"媒体资源数组",type:{name:"WaterfallItem[]",raw:"WaterfallItem[]"}},columns:{name:"columns",required:!1,description:"列数(默认会根据屏幕宽度自动响应)",type:{name:"number",raw:"number"}},gap:{name:"gap",required:!1,description:"间隔大小",type:{name:"number",raw:"number"},defaultValue:{value:"0"}},responsive:{name:"responsive",required:!1,description:"是否启用响应式布局",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},breakpoints:{name:"breakpoints",required:!1,description:"响应式断点配置",type:{name:"object",raw:"{ xs?: number; sm?: number; md?: number; lg?: number; xl?: number; xxl?: number; }"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}},onClick:{name:"onClick",required:!1,description:"点击回调",type:{name:"function",raw:"(item: any) => void"}}}};const $t={algorithm:R.theme.defaultAlgorithm,token:{colorPrimary:"#3b82f6",colorSuccess:"#10b981",colorWarning:"#f59e0b",colorError:"#ef4444",colorInfo:"#3b82f6",colorBgBase:"#ffffff",colorBgContainer:"#ffffff",colorBgElevated:"#ffffff",colorBgLayout:"#f8fafc",colorTextBase:"#1e293b",colorText:"#1e293b",colorTextSecondary:"#64748b",colorTextTertiary:"#94a3b8",colorTextQuaternary:"#cbd5e1",colorBorder:"#e2e8f0",colorBorderSecondary:"#f1f5f9",boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",boxShadowSecondary:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",borderRadius:8,borderRadiusLG:12,borderRadiusSM:6,fontFamily:"Inter, system-ui, Arial, sans-serif",fontSize:14,fontSizeLG:16,fontSizeSM:12,padding:16,paddingLG:24,paddingSM:12,paddingXS:8,controlHeight:32,controlHeightLG:40,controlHeightSM:24},components:{Button:{borderRadius:8,controlHeight:32,fontWeight:500},Card:{borderRadiusLG:12,boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"},Input:{borderRadius:8,controlHeight:32},Table:{borderRadiusLG:8,headerBg:"#f8fafc",headerColor:"#374151"}}};ae.AdvancedTable=Ue,ae.AppModal=Ge,ae.BackButton=We,ae.Button=Pe,ae.Card=Oe,ae.DynamicInput=Qe,ae.DynamicTextArea=Re,ae.EmptyAndSpin=ze,ae.LinkButton=je,ae.PageTable=He,ae.RichTextEditor=Ke,ae.VideoCard=Ve,ae.VirtualTable=Je,ae.Waterfall=Ze,ae.XcIcon=Fe,ae.lightTheme=$t,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})});
|
|
12
12
|
//# sourceMappingURL=index.umd.js.map
|