bi-components-library 1.1.20 → 1.1.21
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/dist/index.es.js +155 -155
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +8 -8
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(le,w){typeof exports=="object"&&typeof module<"u"?w(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"],w):(le=typeof globalThis<"u"?globalThis:le||self,w(le.SealSeekBIComponents={},le.React,le.React,le.antd,le.AntdIcons,le.ReactDOM))})(this,function(le,w,c,oe,Te,Xe){"use strict";const ft=({variant:t="primary",loading:f=!1,children:i,...d})=>{const v=D=>{switch(D){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return w.jsx(oe.Button,{...d,type:v(t),loading:f,ghost:t==="ghost",children:i})};ft.__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 mt=({title:t,children:f,bordered:i=!0,hoverable:d=!1,size:v="default",...D})=>w.jsx(oe.Card,{...D,title:t,bordered:i,hoverable:d,size:v,children:f});mt.__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 yt=({showDefaultFooter:t=!0,...f})=>{const i=f.footer!==void 0?f.footer:t?(d,{OkBtn:v,CancelBtn:D})=>w.jsxs(w.Fragment,{children:[w.jsx(v,{}),w.jsx(D,{})]}):null;return w.jsx(oe.Modal,{...f,footer:i})};yt.__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 ht=({scrollX:t,showPagination:f=!0,defaultPageSize:i=10,...d})=>w.jsx(oe.Table,{...d,scroll:{x:t||"max-content",y:"50vh"},pagination:f?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:i,...d.pagination}:!1});ht.__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 Xt=Te.createFromIconfontCN({scriptUrl:["//at.alicdn.com/t/c/font_5037819_a72xy7yjoj.js"]}),gt=({name:t,size:f,color:i,style:d,...v})=>{const D={fontSize:f,color:i,...d};return w.jsx(Xt,{...v,type:t,style:D})};gt.__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 xt=({loading:t,description:f="暂无数据",className:i,emptyChildren:d,loadingText:v,emptyImage:D})=>t?w.jsxs(oe.Flex,{className:`pt-10 w-full ${i||""}`,align:"center",justify:"center",vertical:!0,children:[w.jsx(oe.Spin,{size:"large"}),v&&w.jsx("div",{className:"mt-4 text-gray-500",children:v})]}):w.jsx(oe.Flex,{className:`pt-10 w-full ${i||""}`,align:"center",justify:"center",children:w.jsx(oe.Empty,{image:D,description:f,imageStyle:{height:180},children:d})});xt.__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 bt=({onClick:t,showText:f=!1,className:i,size:d="small",type:v="default"})=>w.jsx(oe.Button,{size:d,type:v,icon:w.jsx(Te.LeftOutlined,{}),className:`cursor-pointer ${i||""}`,onClick:t,children:f&&"返回"});bt.__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 vt=({removePadding:t=!0,className:f,...i})=>{const d=t?`px-0 h-auto ${f||""}`:f;return w.jsx(oe.Button,{type:"link",...i,className:d,children:i.children})};vt.__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:Jt}=oe.Select,wt=({columns:t,request:f,searchFields:i=[],showSearch:d=!0,showRefresh:v=!0,defaultPageSize:D=10,pageSizeOptions:P=["10","20","50","100"],autoLoad:B=!0,externalParams:M={},...L})=>{const[q,j]=c.useState([]),[S,N]=c.useState(!1),[e,n]=c.useState({current:1,pageSize:D,total:0}),[s,u]=c.useState({}),[E,H]=c.useState({}),[F]=oe.Form.useForm(),T=c.useRef(e);T.current=e;const ne=c.useRef(M);ne.current=M;const K=c.useRef(!1),Q=c.useMemo(()=>t.map(y=>{const{sortable:x,render:b,...I}=y;return{...I,sorter:x?!0:void 0,render:b||(A=>A)}}),[t]),G=c.useCallback(async(y={})=>{if(f){N(!0);try{const x={page:T.current.current,pageSize:T.current.pageSize,sortField:E.field,sortOrder:E.order,searchParams:{...s,...ne.current},...y},b=await f(x);b.success&&(j(b.data),n(I=>({...I,total:b.total,current:x.page||I.current})))}catch(x){console.error("加载数据失败:",x)}finally{N(!1)}}},[f,E,s]),l=c.useCallback(y=>{u(y),n(x=>({...x,current:1}))},[]),_=c.useCallback(()=>{F.resetFields(),u({}),n(y=>({...y,current:1}))},[F]),U=c.useCallback(()=>{G()},[G]),V=c.useCallback((y,x,b)=>{const I={current:y.current||1,pageSize:y.pageSize||D,total:y.total||0},A={field:b?.field,order:b?.order};n(I),H(A)},[D]);return c.useEffect(()=>{const y=Object.keys(M).length>0;(B&&!K.current||y)&&(G(),K.current=!0)},[B,M,G]),w.jsxs("div",{children:[d&&i.length>0&&w.jsx(oe.Card,{size:"small",style:{marginBottom:16},children:w.jsxs(oe.Form,{form:F,layout:"inline",onFinish:l,initialValues:i.reduce((y,x)=>(x.defaultValue!==void 0&&(y[x.key]=x.defaultValue),y),{}),children:[i.map(y=>w.jsx(oe.Form.Item,{name:y.key,label:y.label,children:y.type==="input"?w.jsx(oe.Input,{placeholder:y.placeholder||`请输入${y.label}`,style:{width:200}}):w.jsx(oe.Select,{placeholder:y.placeholder||`请选择${y.label}`,style:{width:200},allowClear:!0,children:y.options?.map(x=>w.jsx(Jt,{value:x.value,children:x.label},x.value))})},y.key)),w.jsx(oe.Form.Item,{children:w.jsxs(oe.Space,{children:[w.jsx(oe.Button,{type:"primary",htmlType:"submit",icon:w.jsx(Te.SearchOutlined,{}),children:"查询"}),w.jsx(oe.Button,{onClick:_,children:"重置"}),v&&w.jsx(oe.Button,{icon:w.jsx(Te.ReloadOutlined,{}),onClick:U,children:"刷新"})]})})]})}),w.jsx(oe.Table,{...L,columns:Q,dataSource:q,loading:S,pagination:{...e,showSizeChanger:!0,showQuickJumper:!0,showTotal:(y,x)=>`第 ${x[0]}-${x[1]} 条/共 ${y} 条`,pageSizeOptions:P},onChange:V,scroll:{x:"max-content",y:"50vh"}})]})};wt.__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 Je(t,f,i){if(!t.current)return;const d=S=>{S.classList.contains("rte-richtext-host-expanded")&&(S.style.setProperty("display","flex","important"),S.style.setProperty("flex-direction","column","important"),S.style.setProperty("flex","1 1 auto","important"),S.style.setProperty("min-height","0","important"),S.style.setProperty("width","100%","important"),S.style.setProperty("align-self","stretch","important"))},v=new Set,D={};for(const S of f)S.exclusionGroup&&S.exclusionGroup!=="separator"&&(v.add(S.exclusionGroup),D[S.exclusionGroup]||(D[S.exclusionGroup]=[]),D[S.exclusionGroup].push({type:S.type,key:S.key,exclusionGroup:S.exclusionGroup}));const P={};for(const S of v){P[S]=!1;for(const N of D[S])if(N.type==="upload"&&N.key){if(i[N.key]!==null&&i[N.key]!==void 0){P[S]=!0;break}const e=f.find(n=>n.type==="upload"&&n.key===N.key);if(e&&typeof e.maxCount=="number")for(let n=0;n<e.maxCount;n++){const s=`${N.key}-${n}`;if(i[s]!==null&&i[s]!==void 0){P[S]=!0;break}}if(P[S])break}else if((N.type==="variable"||N.type==="multi-variable")&&N.key){const e=N.type==="multi-variable"?t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`):[t.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`)].filter(Boolean);for(const n of e)if(!n.classList.contains("show-placeholder")&&n.innerText.replace(/[\u200B\n]/g,"").trim().length>0){P[S]=!0;break}if(P[S])break}}const B=f.some(S=>S.exclusionGroup==="separator"),L=Object.keys(P).filter(S=>P[S]).length>0;let q=null;if(L&&B){for(const S of f)if(S.exclusionGroup&&S.exclusionGroup!=="separator"&&P[S.exclusionGroup]){q=S.exclusionGroup;break}}for(const S of v){const N=t.current.querySelectorAll(`[data-group="${S}"]`);B&&L&&q?S===q?N.forEach(e=>{if(!e.closest('[data-rte-force-hidden="1"]')){if(e.classList.contains("rte-richtext-host-expanded")){d(e);return}e.classList.contains("required-upload-group")?e.style.setProperty("display","inline-flex","important"):(e.classList.contains("exclusion-wrapper"),e.style.setProperty("display","inline-block","important"))}}):N.forEach(e=>{e.closest('[data-rte-force-hidden="1"]')||(e.style.display="none",e.style.setProperty("display","none","important"))}):N.forEach(e=>{if(!e.closest('[data-rte-force-hidden="1"]')){if(e.classList.contains("rte-richtext-host-expanded")){d(e);return}e.classList.contains("required-upload-group")?e.style.setProperty("display","inline-flex","important"):(e.classList.contains("exclusion-wrapper"),e.style.setProperty("display","inline-block","important"))}})}t.current.querySelectorAll('[data-group="separator"]').forEach(S=>{S.style.display=L?"none":"inline"})}function Qe(t,f,i,d){if(!t.current){d(!1);return}const v=e=>{const n=e.getAttribute("data-node-type")||"";if(n!=="report-module"&&n!=="markdown-module")return(e.textContent||"").replace(/[\u200B]/g,"").trim();const s=(e.textContent||"").replace(/[\u200B]/g,"").trim(),u=Array.from(e.querySelectorAll(":scope > div"));if(u.length===0)return s;let E=-1;for(let T=0;T<u.length;T++)if((u[T].textContent||"").replace(/[\u200B]/g,"").trim().length>0){E=T;break}return u.filter((T,ne)=>ne!==E).map(T=>(T.textContent||"").replace(/[\u200B]/g,"").trim()).join(`
|
|
2
|
-
`).trim()||s},D=e=>e?!!e.closest('[data-rte-force-hidden="1"]'):!1,P=[];for(let e=0;e<f.length;e++){const n=f[e];if((n.type==="variable"||n.type==="report-url"||n.type==="markdown"||n.type==="upload"||n.type==="multi-variable"||n.type==="select"||n.type==="textarea"||n.type==="richtext"||n.type==="report-module"||n.type==="markdown-module"||n.type==="datepicker"||n.type==="number-input")&&n.required&&n.key){P.push({exclusionGroup:n.exclusionGroup||"",key:n.key,type:n.type==="multi-variable"||n.type==="report-url"||n.type==="markdown"?"variable":n.type==="report-module"||n.type==="markdown-module"?"richtext":n.type,isMultiVariable:n.type==="multi-variable",minCount:n.type==="multi-variable"||n.type==="upload"&&typeof n.minCount=="number"?n.minCount:void 0,moduleIndex:n.type==="report-module"||n.type==="markdown-module"?n.moduleIndex:void 0,__index:e});continue}if(n.type==="text"&&n.className?.includes("rte-text-required"))if(n.exclusionGroup)for(let s=e+1;s<f.length;s++){const u=f[s];if(u.exclusionGroup===n.exclusionGroup&&(u.type==="variable"||u.type==="markdown"||u.type==="upload"||u.type==="select"||u.type==="textarea"||u.type==="richtext"||u.type==="datepicker"||u.type==="number-input")&&u.key){P.push({exclusionGroup:n.exclusionGroup,key:u.key,type:u.type==="markdown"?"variable":u.type,__index:s});break}}else for(let s=e+1;s<f.length;s++){const u=f[s];if((u.type==="variable"||u.type==="markdown"||u.type==="upload"||u.type==="select"||u.type==="textarea"||u.type==="richtext"||u.type==="datepicker"||u.type==="number-input")&&u.key){P.push({exclusionGroup:u.exclusionGroup||"",key:u.key,type:u.type==="markdown"?"variable":u.type,__index:s});break}}}const B=f.some(e=>e.exclusionGroup==="separator"),M=[];if(B&&P.length>1){const e=[];f.forEach((n,s)=>{n.exclusionGroup==="separator"&&e.push(s)});for(const n of e){const u=P.filter(F=>typeof F.__index=="number"&&F.__index<n).sort((F,T)=>(T.__index??0)-(F.__index??0))[0],H=P.filter(F=>typeof F.__index=="number"&&F.__index>n).sort((F,T)=>(F.__index??0)-(T.__index??0))[0];u&&H&&M.push([u,H])}}if(P.length===0){if(f.length===0){if(!t.current){d(!1);return}const e=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";d(e.length>0);return}d(!0);return}const L=P.filter(e=>{if(!t.current)return!1;if(e.exclusionGroup){const n=t.current.querySelectorAll(`[data-group="${e.exclusionGroup}"]`);if(n.length>0){const s=n[0];return D(s)?!0:s.style.display!=="none"}}if(e.type==="upload"&&e.key){const n=t.current.querySelector(`[data-type="upload"][data-key="${e.key}"]`)||t.current.querySelector(`[data-type="upload"][data-batch-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="variable"&&e.key)if(e.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${e.key}"]`);if(n.length>0){const s=n[0],u=s.closest("[data-group]")||s.parentElement;return D(u)?!0:u?u.style.display!=="none":!0}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="select"&&e.key){const n=t.current.querySelector(`[data-type="select"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="textarea"&&e.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="richtext"&&e.key){const n=typeof e.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"]`:`[data-type="richtext"][data-key="${e.key}"]`,s=t.current.querySelector(n);if(s){const u=s.closest("[data-group]")||s.parentElement;return D(u)?!0:u?u.style.display!=="none":!0}}else if(e.type==="datepicker"&&e.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="number-input"&&e.key){const n=t.current.querySelector(`[data-type="number-input"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}return!1});if(L.length===0){d(!0);return}const q=new Set;M.forEach(e=>{e.forEach(n=>{n.key&&q.add(n.key)})});const j=L.filter(e=>!e.key||!q.has(e.key));let S=(M.length===0,!0);for(const e of M){const n=e.filter(u=>{if(!t.current)return!1;if(u.exclusionGroup){const E=t.current.querySelectorAll(`[data-group="${u.exclusionGroup}"]`);if(E.length>0){const H=E[0];return D(H)?!0:H.style.display!=="none"}}return!0});if(n.length===0)continue;let s=!1;for(const u of n)if(u.type==="upload"&&u.key){if(u.minCount&&u.minCount>0){let E=0;const H=t.current.querySelectorAll(`[data-type="upload"][data-batch-key="${u.key}"]`);if(H.length===0)continue;for(let F=0;F<H.length;F++){const ne=H[F].dataset.key;ne&&i[ne]!=null&&(E+=1)}if(E>=u.minCount){s=!0;break}}else if(i[u.key]!==null&&i[u.key]!==void 0){s=!0;break}}else if(u.type==="variable"&&u.key)if(u.isMultiVariable){const E=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${u.key}"]`);let H=0;for(const T of Array.from(E)){if(T.classList.contains("show-placeholder"))continue;T.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(H+=1)}const F=u.minCount&&u.minCount>0?u.minCount:1;if(H>=F){s=!0;break}}else{const E=t.current.querySelector(`[data-type="variable"][data-key="${u.key}"]`);if(E){if(E.classList.contains("show-placeholder"))continue;if(E.innerText.replace(/[\u200B\n]/g,"").trim().length>0){s=!0;break}}}else if(u.type==="select"&&u.key){const E=t.current.querySelector(`[data-type="select"][data-key="${u.key}"]`);if(E&&(E.getAttribute("data-value")||"").trim().length>0){s=!0;break}}else if(u.type==="textarea"&&u.key){const E=t.current.querySelector(`[data-type="textarea"][data-key="${u.key}"]`);if(E&&(E.value||"").trim().length>0){s=!0;break}}else if(u.type==="richtext"&&u.key){const E=typeof u.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${u.key}"][data-module-index="${u.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${u.key}"][data-module-index="${u.moduleIndex}"]`:`[data-type="richtext"][data-key="${u.key}"]`,H=t.current.querySelector(E);if(H&&v(H).length>0){s=!0;break}}else if(u.type==="datepicker"&&u.key){const E=t.current.querySelector(`[data-type="datepicker"][data-key="${u.key}"]`);if(E&&(E.getAttribute("data-value")||"").trim().length>0){s=!0;break}}else if(u.type==="number-input"&&u.key){const E=t.current.querySelector(`[data-type="number-input"][data-key="${u.key}"]`);if(E&&(E.value||"").trim().length>0){s=!0;break}}if(!s){S=!1;break}}let N=!0;for(const e of j)if(e.type==="upload"&&e.key){if(e.minCount&&e.minCount>0){let n=0;const s=t.current.querySelectorAll(`[data-type="upload"][data-batch-key="${e.key}"]`);if(s.length===0){N=!1;break}for(let u=0;u<s.length;u++){const H=s[u].dataset.key;H&&i[H]!=null&&(n+=1)}if(n<e.minCount){N=!1;break}}else if(i[e.key]===null||i[e.key]===void 0){N=!1;break}}else if(e.type==="variable"&&e.key)if(e.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${e.key}"]`);let s=0;for(const E of Array.from(n)){if(E.classList.contains("show-placeholder"))continue;E.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(s+=1)}const u=e.minCount&&e.minCount>0?e.minCount:1;if(s<u){N=!1;break}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${e.key}"]`);if(!n){N=!1;break}if(n.classList.contains("show-placeholder")){N=!1;break}if(n.innerText.replace(/[\u200B\n]/g,"").trim().length===0){N=!1;break}}else if(e.type==="select"&&e.key){const n=t.current.querySelector(`[data-type="select"][data-key="${e.key}"]`);if(!n||(n.getAttribute("data-value")||"").trim().length===0){N=!1;break}}else if(e.type==="textarea"&&e.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${e.key}"]`);if(!n||(n.value||"").trim().length===0){N=!1;break}}else if(e.type==="richtext"&&e.key){const n=typeof e.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"]`:`[data-type="richtext"][data-key="${e.key}"]`,s=t.current.querySelector(n);if(!s||v(s).length===0){N=!1;break}}else if(e.type==="datepicker"&&e.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${e.key}"]`);if(!n||(n.getAttribute("data-value")||"").trim().length===0){N=!1;break}}else if(e.type==="number-input"&&e.key){const n=t.current.querySelector(`[data-type="number-input"][data-key="${e.key}"]`);if(!n||(n.value||"").trim().length===0){N=!1;break}}d(S&&N)}function Ze(t,f){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(d=>{const v=d.innerText;v.replace(/\u200B/g,"").trim().length===0?(v!==""&&(d.innerText=""),d.classList.add("show-placeholder")):d.classList.remove("show-placeholder")})}const Qt=({host:t,onChange:f})=>{const i=t.dataset.key,d=t.dataset.placeholder,v=t.dataset.options?decodeURIComponent(t.dataset.options):"[]",D=t.dataset.required==="true",P=t.dataset.value||"",B=c.useMemo(()=>{try{return JSON.parse(v)}catch{return[]}},[v]),[M,L]=c.useState(P||void 0),[q,j]=c.useState(64),S=c.useRef(null),N=s=>{L(s),t.setAttribute("data-value",s),f(i,s)};c.useEffect(()=>{L(P||void 0)},[P]);const e=c.useCallback(()=>{if(M!=null&&M!==""){const s=B.find(u=>String(u.value)===String(M));return s?typeof s.label=="string"?s.label:String(s.label??M):String(M)}return d||"请选择"},[M,B,d]),n=c.useCallback(()=>{const s=S.current;if(!s)return;const u=s.querySelector(".ant-select-selection-item"),E=s.querySelector(".ant-select-selection-placeholder"),H=u||E,F=(H?.textContent||"").trim()||e(),T=s.querySelector(".ant-select-selector"),ne=H||T||s,K=window.getComputedStyle(ne),Q=H?K.fontSize:"16px",G=K.fontFamily||"sans-serif",l=K.fontWeight||"400",U=`${K.fontStyle||"normal"} ${l} ${Q} ${G}`,y=document.createElement("canvas").getContext("2d"),x=y?Math.ceil((y.font=U,y.measureText(F).width||0)):0;let b=0;if(T){const ee=window.getComputedStyle(T);b=(Number.parseFloat(ee.paddingLeft)||0)+(Number.parseFloat(ee.paddingRight)||0)}const I=s.querySelector(".ant-select-arrow"),A=I?Math.ceil(I.getBoundingClientRect().width):12,X=s.querySelector(".ant-select-clear");let J=0;if(X){const ee=window.getComputedStyle(X);ee.display!=="none"&&ee.visibility!=="hidden"&&(J=Math.ceil(X.getBoundingClientRect().width))}const R=Math.max(36,x+b+A+J+6);j(ee=>ee===R?ee:R)},[e]);return c.useLayoutEffect(()=>{const s=window.requestAnimationFrame(()=>{n()}),u=window.setTimeout(()=>{n()},60);return()=>{window.cancelAnimationFrame(s),window.clearTimeout(u)}},[n]),c.useEffect(()=>{if(!("fonts"in document))return;let s=!1;const u=document.fonts;if(u?.ready)return u.ready.then(()=>{s||n()}),()=>{s=!0}},[n]),Xe.createPortal(w.jsx("div",{className:"rte-select-wrapper",contentEditable:!1,ref:S,style:{display:"inline-block",width:q},children:w.jsx(oe.Select,{value:M,onChange:N,placeholder:d||"请选择",style:{width:"100%"},options:B,allowClear:!D,size:"small",dropdownClassName:"rte-select-dropdown",getPopupContainer:()=>document.body,dropdownMatchSelectWidth:!1,suffixIcon:w.jsx("i",{className:"iconfont icon-qiehuan-xiayizhang",style:{fontSize:"10px",color:"#7C3AED"}})})}),t)},Zt=t=>{const[f,i]=c.useState([]);return c.useEffect(()=>{const d=t.current;if(!d)return;const v=()=>{const P=d.querySelectorAll(".rte-select-host"),B=[];P.forEach(M=>{const L=M.getAttribute("data-key");L&&B.push(w.jsx(Qt,{host:M,onChange:()=>{if(t.current){const q=new Event("input",{bubbles:!0});t.current.dispatchEvent(q)}}},`select-${L}`))}),i(B)};v();const D=new MutationObserver(P=>{let B=!1;for(const M of P)if(M.type==="childList"){let L=!1;if(M.addedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-select-host")||j.querySelector?.(".rte-select-host"))&&(L=!0)}}),M.removedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-select-host")||j.querySelector?.(".rte-select-host"))&&(L=!0)}}),L){B=!0;break}}B&&v()});return D.observe(d,{childList:!0,subtree:!0}),()=>D.disconnect()},[t]),f},ve=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");function Rt(t,f,i,d,v,D={},P,B){if(!t.current)return;const M=/[;;,,。.!!??::、]/,L=e=>{const n=(e??"").trim();return n.length===1&&M.test(n)},q=e=>{const n=e??"",s=n.match(new RegExp(`^\\s*(${M.source})`));if(!s)return null;const u=s[1],E=n.replace(new RegExp(`^\\s*${M.source}`),"");return{punct:u,rest:E}},j=e=>`<span data-type="text" class="rte-inline-punct" contenteditable="false">${e}</span>`,S=[];let N=0;for(;N<f.length;){const e=f[N],n=N+1<f.length?f[N+1]:null;let s=!1;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&n){const K=n.type==="upload"&&n.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===n.exclusionGroup,Q=n.type==="variable"&&n.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===n.exclusionGroup;if(K){const G=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",l=`<span ${G} class="exclusion-wrapper required-upload-group">`,_="</span>";let U="";e.className?U=`<span class="${e.className}">${e.text??""}</span>`:U=e.text??"";const V=n,y=i[V.key]!==null&&i[V.key]!==void 0,x=y?i[V.key]:null,b=y?i[V.key]?.name:V.text,I=y?"":"hidden",A=V.tooltip&&!y?"":"hidden",X=y?"has-file":"",J=y&&b?` data-file-name="${b.replace(/"/g,""")}"`:"";let R="";y&&x?x.type?.startsWith("image/")?R=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(x)}" alt="preview" />`:R="<i class='iconfont icon-exlwenjian'></i>":R="<i class='iconfont icon-shangchuan1'></i>";const ee=(V.text||"").trim(),ie=y&&ee.length>=12?`<span ${G} contenteditable="false" class="exclusion-wrapper upload-hint">${ee}</span>`:"",ue=`<span contenteditable="false" data-type="upload" data-key="${V.key}" class="upload-chip"><span class="upload-inner-wrapper ${X}"><span class="upload-icon">${R}</span><span class="upload-label"${J}>${b||V.text}</span>${V.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi upload-info-icon ${A}" data-upload-key="${V.key}" data-tooltip="${V.tooltip}"></i>`:""}<span class="file-remove-btn ${I}" title="移除文件">×</span></span></span>`;S.push(l+U+ue+_+ie),N+=2;continue}if(Q){const l=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,_="</span>";let U="";e.className?U=`<span class="${e.className}">${e.text??""}</span>`:U=e.text??"";const V=n,x=(V.key?v[V.key]:void 0)||V.text||"",b=!x,I=b?"":x,A=b?"show-placeholder":"",X=V.exclusionGroup?` data-group="${V.exclusionGroup}"`:"",J=V.tooltip?` data-tooltip="${V.tooltip.replace(/"/g,""")}" data-variable-key="${V.key||""}"`:"",R=V.tooltip&&b?"":"hidden",ee=`<span contenteditable="true" data-type="variable" data-key="${V.key}" data-placeholder="${V.placeholder||""}"${X}${J} class="variable-chip ${A}">${I}${V.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${R}" data-variable-key="${V.key}" data-tooltip="${V.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;S.push(l+U+ee+_),N+=2;continue}}const E=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",H=e.exclusionGroup?`<span ${E} class="exclusion-wrapper">`:"",F=e.exclusionGroup?"</span>":"";let T="";if(e.type==="tag"){const Q=d||P==="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>',G=d?' data-locked="true"':"",l=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-tag-key="${e.key||""}"`:"";T=`<span contenteditable="false" class="tag-node group"${G}${l}><span class="tag-label">${e.text}</span>${Q}</span>`}else if(e.type==="text"){const K=d?' data-locked="true" contenteditable="false"':' contenteditable="false"',G=(e.text??"").replace(/\n/g,"<br/>");e.className?T=`<span data-type="text" class="${e.className}"${K}>${G}</span>`:T=d?`<span data-type="text"${K}>${G}</span>`:`<span data-type="text" contenteditable="false">${G}</span>`}else if(e.type==="variable"&&e.key){const Q=v[e.key]||e.text||"",G=!Q,l=G?"":Q,_=G?"show-placeholder":"",U=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",V=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",y=e.tooltip&&G?"":"hidden",x=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${U}${V} class="variable-chip ${_}">${l}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${y}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;e.required?T=`<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>`:T=x}else if(e.type==="report-url"&&e.key){const K=`${e.key}__url`,G=Object.prototype.hasOwnProperty.call(v,K)?v[K]:void 0,l=v[e.key],_=G??l??e.text??"",U=!_,V=U?"":_,y=U?"show-placeholder":"",x=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",b=e.tooltip?` data-tooltip="${ve(e.tooltip)}" data-variable-key="${e.key||""}"`:"",I=e.tooltip&&U?"":"hidden",A=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-node-type="report-url" data-placeholder="${ve(e.placeholder||"")}"${x}${b} class="variable-chip rte-report-url ${y}">${V}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${I}" data-variable-key="${e.key}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}</span>`;e.required?T=`<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>${A}</span>`:T=A}else if(e.type==="markdown"&&e.key){const K=e.sourceTextKey||`${e.key}__sourceText`,G=Object.prototype.hasOwnProperty.call(v,K)?v[K]:void 0,l=v[e.key],_=G??l??e.text??"",U=!_,V=U?"":_,y=U?"show-placeholder":"",x=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",b=e.sourceTextKey?` data-source-text-key="${ve(e.sourceTextKey)}"`:"",I=e.tooltip?` data-tooltip="${ve(e.tooltip)}" data-variable-key="${e.key||""}"`:"",A=e.tooltip&&U?"":"hidden",X=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-node-type="markdown" data-placeholder="${ve(e.placeholder||"")}"${x}${b}${I} class="variable-chip rte-markdown-input ${y}">${V}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${A}" data-variable-key="${e.key}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}</span>`;e.required?T=`<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>`:T=X}else if(e.type==="upload"&&e.key){const K=!!n&&n.type==="text"&&!n.className&&!n.exclusionGroup&&L(n.text),Q=K?(n.text??"").trim():"",G=Q?j(Q):"";if(K&&(s=!0),typeof e.maxCount=="number"&&typeof e.minCount=="number"&&e.maxCount>1){const _=e.tooltip?` data-tooltip="${ve(e.tooltip)}"`:"",U=e.minCount||1,V=e.maxCount||3;let y=0;for(let I=0;I<V;I++){const A=`${e.key}-${I}`;i[A]!=null&&(y+=1)}const x=Math.min(V,Math.max(U,y+(y<V?1:0)));let b="";for(let I=0;I<x;I++){const A=`${e.key}-${I}`,X=i[A]!==null&&i[A]!==void 0,J=X?i[A]:null,R=X?i[A]?.name:e.text,ee=X?"":"hidden",se=e.tooltip&&!X?"":"hidden",ie=X?"has-file":"",ue=X&&R?` data-file-name="${R.replace(/"/g,""")}"`:"";let he="";X&&J?J.type?.startsWith("image/")?he=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(J)}" alt="preview" />`:he="<i class='iconfont icon-exlwenjian'></i>":he="<i class='iconfont icon-shangchuan1'></i>";const re=` data-batch-key="${e.key}"`,me=` data-batch-index="${I}"`,ge=`<span contenteditable="false" data-type="upload" data-key="${A}"${re}${me}${_} class="upload-chip upload-chip-batch"><span class="upload-inner-wrapper ${ie}"><span class="upload-icon">${he}</span><span class="upload-label"${ue}>${R||e.text}</span>${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi upload-info-icon ${se}" data-upload-key="${A}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}<span class="file-remove-btn ${ee}" title="移除文件">×</span></span></span>`;b+=ge}e.required?T=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group rte-required-upload-batch"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span><span class="rte-upload-batch-chips">${b}${G}</span></span>`:T=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-upload-batch-chips">${b}${G}</span>`}else{const _=e.tooltip?` data-tooltip="${ve(e.tooltip)}"`:"",U=i[e.key]!==null&&i[e.key]!==void 0,V=U?i[e.key]:null,y=U?i[e.key]?.name:e.text,x=U?"":"hidden",b=e.tooltip&&!U?"":"hidden",I=U?"has-file":"",A=U&&y?` data-file-name="${y.replace(/"/g,""")}"`:"";let X="";U&&V?V.type?.startsWith("image/")?X=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(V)}" alt="preview" />`:X="<i class='iconfont icon-exlwenjian'></i>":X="<i class='iconfont icon-shangchuan1'></i>";const J=(e.text||"").trim(),ee=U&&e.showHint===!0&&J.length>=12?`<span ${E} contenteditable="false" class="exclusion-wrapper upload-hint">${J}</span>`:"",se=`<span contenteditable="false" data-type="upload" data-key="${e.key}"${_} class="upload-chip"><span class="upload-inner-wrapper ${I}"><span class="upload-icon">${X}</span><span class="upload-label"${A}>${y||e.text}</span>${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi upload-info-icon ${b}" data-upload-key="${e.key}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}<span class="file-remove-btn ${x}" title="移除文件">×</span></span></span>`;e.required?T=`<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>${se}${G}</span>${ee}`:T=se+G+ee}}else if(e.type==="select"&&e.key){const K=v[e.key]||e.defaultValue||"",Q=encodeURIComponent(JSON.stringify(e.options||[])),G=e.placeholder?` data-placeholder="${e.placeholder}"`:"",l=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",_=e.required?' data-required="true"':"",U=`<div data-type="select" data-key="${e.key}" data-value="${K}" data-options="${Q}"${G}${l}${_} class="rte-select-host"></div>`;e.required?T=`<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>${U}</span>`:T=U}else if(e.type==="textarea"&&e.key){const K=v[e.key]||"",Q=typeof e.maxHeight=="number"?e.maxHeight:252,G=e.placeholder?` placeholder="${e.placeholder}"`:"",l=`<textarea data-type="textarea" data-key="${e.key}" class="rte-textarea" style="max-height:${Q}px;"${G}>${K}</textarea>`,_=`<div class="rte-textarea-wrapper" data-key="${e.key}">${l}</div>`;e.required?T=`<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>${_}</span>`:T=_}else if(e.type==="richtext"&&e.key){const K=v[e.key]||e.text||"",Q=typeof e.minHeight=="number"?e.minHeight:40,G=typeof e.maxHeight=="number"?e.maxHeight:160,l=Math.max(G,Q),_=e.placeholder?` data-placeholder="${e.placeholder}"`:"",U=e.expandable!==!1,V=K,y=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" class="rte-richtext"${_} style="min-height:${Q}px;max-height:${l}px;overflow:auto;">${V}</div>`,x=U?`<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>`:"",b=`<div class="rte-richtext-wrapper${U?" rte-richtext-toggleable":""}" data-key="${e.key}">${y}${x}</div>`,I=`<div class="rte-richtext-container" data-key="${e.key}">${b}</div>`;e.required?T=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-richtext-required">${I}</div>`:T=I}else if(e.type==="report-module"&&e.key){const K=typeof e.moduleIndex=="number"?e.moduleIndex:0,Q=`${e.key}__module_${K}`,l=Object.prototype.hasOwnProperty.call(v,Q)?v[Q]:e.text||"",_=typeof e.minHeight=="number"?e.minHeight:80,U=typeof e.maxHeight=="number"?e.maxHeight:240,V=Math.max(U,_),y=e.placeholder?` data-placeholder="${ve(e.placeholder)}"`:"",x=l,b=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" data-node-type="report-module" data-module-index="${K}" class="rte-richtext rte-report-module"${y} style="min-height:${_}px;max-height:${V}px;overflow:auto;">${x}</div>`,I=`<div class="rte-richtext-wrapper rte-report-module-wrapper" data-key="${e.key}">${b}</div>`,A=`<div class="rte-richtext-container rte-report-module-container" data-key="${e.key}">${I}</div>`;e.required?T=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-richtext-required">${A}</div>`:T=A}else if(e.type==="markdown-module"&&e.key){const K=typeof e.moduleIndex=="number"?e.moduleIndex:0,Q=`${e.key}__module_${K}`,l=Object.prototype.hasOwnProperty.call(v,Q)?v[Q]:e.text||"",_=typeof e.minHeight=="number"?e.minHeight:80,U=typeof e.maxHeight=="number"?e.maxHeight:240,V=Math.max(U,_),y=e.placeholder?` data-placeholder="${ve(e.placeholder)}"`:"",x=l,b=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" data-node-type="markdown-module" data-module-index="${K}" class="rte-richtext rte-markdown-module"${y} style="min-height:${_}px;max-height:${V}px;overflow:auto;">${x}</div>`,I=`<div class="rte-richtext-wrapper rte-markdown-module-wrapper" data-key="${e.key}">${b}</div>`,A=`<div class="rte-richtext-container rte-markdown-module-container" data-key="${e.key}">${I}</div>`;e.required?T=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-richtext-required">${A}</div>`:T=A}else if(e.type==="datepicker"&&e.key){const K=v[e.key]||"",Q=e.placeholder?` data-placeholder="${e.placeholder}"`:"",G=e.limitRange?` data-limit-range="${e.limitRange}"`:"",l=e.disableFuture?' data-disable-future="true"':"",_=`<div data-type="datepicker" data-key="${e.key}" data-value="${K}" class="rte-datepicker-host"${Q}${G}${l}></div>`;e.required?T=`<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>${_}</span>`:T=_}else if(e.type==="number-input"&&e.key){const K=v[e.key]||(typeof e.defaultNumber=="number"?String(e.defaultNumber):""),Q=typeof e.min=="number"?` min="${e.min}"`:"",G=typeof e.max=="number"?` max="${e.max}"`:"",l=e.placeholder?` placeholder="${e.placeholder}"`:"",_=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",U=' step="1"',V=K||e.placeholder||"";let y=0;for(let I=0;I<V.length;I++){const A=V.charCodeAt(I);A>19968||A>=65280&&A<=65519?y+=16:y+=8}const x=Math.max(44,Math.min(600,y+28)),b=`<input type="number" data-type="number-input" data-key="${e.key}" class="rte-number-input" value="${K}" style="width: ${x}px;"${Q}${G}${U}${l}${_} />`;e.required?T=`<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>${b}</span>`:T=b}else if(e.type==="multi-variable"&&e.key){const K=e.maxCount||9,Q=D[e.key]||1,G=Math.min(Q,K);if(e.required){const l=`<span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>`,_=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"";let U="";for(let V=0;V<G;V++){const y=`${e.key}_${V}`,x=v[y]||"",b=!x,I=b?"":x,A=b?"show-placeholder":"",X=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",J=e.tooltip&&b?"":"hidden",R=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",ee=`<span contenteditable="true" data-type="variable" data-key="${y}" data-multi-key="${e.key}" data-index="${V}" data-placeholder="${e.placeholder||""}"${R}${X} class="variable-chip ${A}">${I}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${J}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;V===0?U+=`<span ${_} class="exclusion-wrapper required-upload-group required-multi-first">${l}${ee}</span>`:U+=ee}T=U}else{let l="";for(let _=0;_<G;_++){const U=`${e.key}_${_}`,V=v[U]||"",y=!V,x=y?"":V,b=y?"show-placeholder":"",I=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",A=e.tooltip&&y?"":"hidden",X=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",J=`<span contenteditable="true" data-type="variable" data-key="${U}" data-multi-key="${e.key}" data-index="${_}" data-placeholder="${e.placeholder||""}"${X}${I} class="variable-chip ${b}">${x}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${A}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;l+=J}T=l}}const ne=H+T+F;if(e.type==="text"&&!e.className&&!e.exclusionGroup){if(L(e.text)&&S.length>0){const Q=S[S.length-1],G=(e.text??"").trim();S[S.length-1]=`<span class="rte-inline-group">${Q}${j(G)}</span>`,N++;continue}const K=q(e.text);if(K&&S.length>0){const Q=S[S.length-1];S[S.length-1]=`<span class="rte-inline-group">${Q}${j(K.punct)}</span>`;const G=K.rest;if(G){const l=G.replace(/\n/g,"<br/>");S.push(`<span data-type="text" contenteditable="false">${l}</span>`)}N++;continue}}S.push(ne),N+=s?2:1}t.current&&(t.current.innerHTML=S.join(""),setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(n=>{const s=n.innerText.replace(/\n/g,"");s.replace(/\u200B/g,"")?n.classList.remove("show-placeholder"):(s!==""&&(n.innerText=""),n.classList.add("show-placeholder"))})},0))}function en(t,f,i,d,v={},D,P,B,M){const L=c.useCallback(()=>{if(!t.current)return;if(f.length===0){t.current.innerHTML="";return}let q={};const S=t.current.__tempVariableValues;if(S?(q=S,setTimeout(()=>{if(t.current){const N=t.current;N.__tempVariableValues===S&&delete N.__tempVariableValues}},100)):(t.current.querySelectorAll('[data-type="variable"]').forEach(H=>{const F=H.dataset.key;if(F){const T=H.innerText.replace(/[\u200B\n]/g,"").trim();T&&(H.getAttribute("data-node-type")==="report-url"?q[`${F}__url`]=T:q[F]=T)}}),t.current.querySelectorAll('[data-type="select"]').forEach(H=>{const F=H.dataset.key;if(F){const T=(H.getAttribute("data-value")||"").trim();T&&(q[F]=T)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(H=>{const F=H.dataset.key;if(F){const T=H.value.replace(/[\u200B]/g,"").trim();T&&(q[F]=T)}}),t.current.querySelectorAll('[data-type="richtext"]').forEach(H=>{const F=H.dataset.key;if(F){const T=H.getAttribute("data-node-type")||"",ne=T==="report-module"?(H.innerHTML||"").replace(/[\u200B]/g,"").trim():(H.textContent||"").replace(/[\u200B]/g,"").trim();if(T==="report-module"){const K=Number.parseInt(H.getAttribute("data-module-index")||"0",10);q[`${F}__module_${Number.isFinite(K)?K:0}`]=ne}else ne&&(q[F]=ne)}}),t.current.querySelectorAll('[data-type="datepicker"]').forEach(H=>{const F=H.dataset.key;if(F){const T=(H.getAttribute("data-value")||"").trim();T&&(q[F]=T)}}),t.current.querySelectorAll('[data-type="number-input"]').forEach(H=>{const F=H.dataset.key;if(F){const T=(H.value||"").trim();T&&(q[F]=T)}})),Rt(t,f,i,d,q,v,B),D?.current){const{key:N,offset:e}=D.current;setTimeout(()=>{if(!t.current)return;const n=t.current.querySelector(`[data-type="variable"][data-key="${N}"]`);if(n){try{const s=document.createRange(),u=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);let E=0,H=null,F=0;for(;u.nextNode();){const T=u.currentNode,ne=T.textContent?.length||0;if(E+ne>=e){H=T,F=e-E;break}E+=ne}if(H){s.setStart(H,Math.min(F,H.textContent?.length||0)),s.collapse(!0);const T=window.getSelection();T&&(T.removeAllRanges(),T.addRange(s),n.focus())}else{s.selectNodeContents(n),s.collapse(!1);const T=window.getSelection();T&&(T.removeAllRanges(),T.addRange(s),n.focus())}}catch{const s=document.createRange();s.selectNodeContents(n),s.collapse(!1);const u=window.getSelection();u&&(u.removeAllRanges(),u.addRange(s),n.focus())}D.current=null}},0)}},[f,i,d,t,v,D,P,B,M]);c.useEffect(()=>{L()},[L])}function tn(t,f,i,d){c.useEffect(()=>{const v=t.current;if(!v)return;const D=M=>M.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(M.name||""),P=M=>{const L=M.target?.closest(".upload-info-icon");if(L&&L.classList.contains("upload-info-icon")){const j=L.dataset.uploadKey;if(j){const S=L.closest('[data-type="upload"]');d(S?{key:j,anchorEl:S,type:"upload"}:{key:j,anchorEl:L,type:"upload"})}return}const q=M.target?.closest('[data-type="upload"]');if(q){const j=q.dataset.key;if(j){const S=i[j];S&&D(S)&&d({key:j,anchorEl:q,type:"upload-preview"})}}},B=M=>{const L=M.target?.closest(".upload-info-icon"),q=M.relatedTarget;if(L&&L.classList.contains("upload-info-icon")){const S=L.closest('[data-type="upload"]');if(q&&S&&S.contains(q))return;if(!q||!v.contains(q))d(null);else{const N=q.closest('[data-type="upload"]');(!N||N!==S)&&d(null)}return}const j=M.target?.closest('[data-type="upload"]');if(j){const S=q;if(S&&j.contains(S))return;d(null)}};return v.addEventListener("mouseover",P,!0),v.addEventListener("mouseout",B,!0),()=>{v.removeEventListener("mouseover",P,!0),v.removeEventListener("mouseout",B,!0)}},[f,i,t,d])}function nn(t,f,i,d){c.useEffect(()=>{if(!t.current)return;const v=M=>{if(d==="hideTagClose")return;const L=M.currentTarget,q=L.dataset.tooltip,j=L.dataset.tagKey||"";q&&i({key:j,anchorEl:L,type:"tag"})},D=()=>{i(null)};let P;const B=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(L=>{L.addEventListener("mouseenter",v),L.addEventListener("mouseleave",D)})};return P=requestAnimationFrame(()=>{P=requestAnimationFrame(B)}),()=>{cancelAnimationFrame(P),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(L=>{L.removeEventListener("mouseenter",v),L.removeEventListener("mouseleave",D)})}},[f,t,i,d])}function rn(t,f,i){c.useEffect(()=>{const d=t.current;if(!d)return;const v=P=>{const B=P.target?.closest(".variable-info-icon");if(B&&B.classList.contains("variable-info-icon")){const L=B.dataset.variableKey;L&&i({key:L,anchorEl:B,type:"variable"});return}const M=P.target?.closest('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(M){const L=M.dataset.key;L&&i({key:L,anchorEl:M,type:"variable"})}},D=P=>{const B=P.target,M=P.relatedTarget,L=B?.closest?.(".variable-info-icon"),q=B?.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(L||q){if(!M||!d.contains(M)){i(null);return}const j=!!M.closest?.(".variable-info-icon"),S=!!M.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');!j&&!S&&i(null)}};return d.addEventListener("mouseover",v,!0),d.addEventListener("mouseout",D,!0),()=>{d.removeEventListener("mouseover",v,!0),d.removeEventListener("mouseout",D,!0)}},[f,t,i])}function an(t,f,i,d){c.useEffect(()=>{if(!t.current)return;const v=L=>L.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(L.name||""),D=L=>{const q=L.currentTarget,j=q.dataset.fileName,S=q.closest('[data-type="upload"]'),N=S?.dataset.key||"",e=N?i[N]:null;if(e&&v(e)){d({key:N,anchorEl:S||q,type:"upload-preview"});return}j&&d({key:N,anchorEl:S||q,type:"upload-label"})},P=()=>{d(null)};let B;const M=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(q=>{q.addEventListener("mouseenter",D),q.addEventListener("mouseleave",P)})};return B=requestAnimationFrame(()=>{B=requestAnimationFrame(M)}),()=>{cancelAnimationFrame(B),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(q=>{q.removeEventListener("mouseenter",D),q.removeEventListener("mouseleave",P)})}},[f,i,t,d])}function on(t,f,i,d){c.useEffect(()=>{const v=setTimeout(()=>{Je(t,f,i),Qe(t,f,i,d)},0);return()=>clearTimeout(v)},[i,f,t,d])}function sn(t,f){const i=c.useRef(0),d=c.useRef(0);c.useEffect(()=>{if(!t.current)return;let v=!1,D=0;const P=E=>E instanceof HTMLElement?!!(E.closest(".rte-datepicker-wrapper")||E.closest(".rte-datepicker-host")||E.closest(".ant-picker")||E.closest(".ant-picker-dropdown")):!1,B=E=>E instanceof HTMLElement?!!(E.closest(".rte-select-wrapper")||E.closest(".rte-select-host")||E.closest(".ant-select")||E.closest(".ant-select-dropdown")):!1,M=E=>{v=!0,P(E.target)&&(i.current=Date.now(),console.log("[SelectionCtrl] mousedown on datepicker target")),B(E.target)&&(d.current=Date.now(),console.log("[SelectionCtrl] mousedown on select target"))},L=()=>{v=!1,D=Date.now()};let q=!1,j=0;const S=()=>{q=!0},N=()=>{q=!1,j=Date.now()},e=()=>{j=Date.now()},n=E=>{P(E.target)&&(i.current=Date.now(),console.log("[SelectionCtrl] focusin datepicker target")),B(E.target)&&(d.current=Date.now(),console.log("[SelectionCtrl] focusin select target"))},s=()=>{if(Date.now()-i.current<800||Date.now()-d.current<800){console.log("[SelectionCtrl] skip selectionchange due to recent picker/select interaction");return}const E=document.activeElement;if(E&&(E.closest(".rte-datepicker-wrapper")||E.closest(".rte-datepicker-host")||E.closest(".ant-picker-dropdown")||E.tagName==="INPUT"&&E.closest(".ant-picker")||E.closest(".rte-select-wrapper")||E.closest(".rte-select-host")||E.closest(".ant-select")||E.closest(".ant-select-dropdown"))){console.log("[SelectionCtrl] activeElement is picker/select; skip");return}if(!t.current)return;const H=window.getSelection();if(!H||H.rangeCount===0||f.current||v||q||Date.now()-j<500)return;const F=H.getRangeAt(0);if(!F.collapsed)return t.current.contains(F.commonAncestorContainer),void 0;const T=H.anchorNode;if(!T||!t.current.contains(T))return;let ne=!1,K=!1;if(T.nodeType===Node.ELEMENT_NODE){const G=T;(G.closest('[data-type="datepicker"]')||G.closest(".rte-datepicker-wrapper")||G.closest(".rte-datepicker-host"))&&(ne=!0),(G.closest('[data-type="select"]')||G.closest(".rte-select-wrapper")||G.closest(".rte-select-host"))&&(K=!0)}else if(T.parentElement){const G=T.parentElement;(G.closest('[data-type="datepicker"]')||G.closest(".rte-datepicker-wrapper")||G.closest(".rte-datepicker-host"))&&(ne=!0),(G.closest('[data-type="select"]')||G.closest(".rte-select-wrapper")||G.closest(".rte-select-host"))&&(K=!0)}if(ne||K)return;let Q=null;if(T.nodeType===Node.ELEMENT_NODE?Q=T.closest('[data-type="variable"]'):T.nodeType===Node.TEXT_NODE&&T.parentElement&&(Q=T.parentElement.closest('[data-type="variable"]')),!Q){if(Date.now()-D>500)return;const G=t.current.querySelectorAll('[data-type="variable"]');if(G.length>0){let l=null;for(const _ of Array.from(G))if(_.style.display!=="none"){l=_;break}if(!l&&G.length>0&&(l=G[0]),l){const _=document.createRange();_.selectNodeContents(l),_.collapse(!1),H.removeAllRanges(),H.addRange(_),l.focus()}else H.removeAllRanges()}else H.removeAllRanges()}},u=t.current;return u&&(u.addEventListener("compositionstart",S),u.addEventListener("compositionend",N),u.addEventListener("input",e)),document.addEventListener("mousedown",M),document.addEventListener("mouseup",L),document.addEventListener("focusin",n),document.addEventListener("selectionchange",s),()=>{const E=t.current;E&&(E.removeEventListener("compositionstart",S),E.removeEventListener("compositionend",N),E.removeEventListener("input",e)),document.removeEventListener("mousedown",M),document.removeEventListener("mouseup",L),document.removeEventListener("focusin",n),document.removeEventListener("selectionchange",s)}},[t,f])}function ln(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fe={exports:{}},cn=Fe.exports,kt;function $t(){return kt||(kt=1,function(t,f){(function(i,d){t.exports=d()})(cn,function(){var i=1e3,d=6e4,v=36e5,D="millisecond",P="second",B="minute",M="hour",L="day",q="week",j="month",S="quarter",N="year",e="date",n="Invalid Date",s=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,u=/\[([^\]]+)]|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,E={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(y){var x=["th","st","nd","rd"],b=y%100;return"["+y+(x[(b-20)%10]||x[b]||x[0])+"]"}},H=function(y,x,b){var I=String(y);return!I||I.length>=x?y:""+Array(x+1-I.length).join(b)+y},F={s:H,z:function(y){var x=-y.utcOffset(),b=Math.abs(x),I=Math.floor(b/60),A=b%60;return(x<=0?"+":"-")+H(I,2,"0")+":"+H(A,2,"0")},m:function y(x,b){if(x.date()<b.date())return-y(b,x);var I=12*(b.year()-x.year())+(b.month()-x.month()),A=x.clone().add(I,j),X=b-A<0,J=x.clone().add(I+(X?-1:1),j);return+(-(I+(b-A)/(X?A-J:J-A))||0)},a:function(y){return y<0?Math.ceil(y)||0:Math.floor(y)},p:function(y){return{M:j,y:N,w:q,d:L,D:e,h:M,m:B,s:P,ms:D,Q:S}[y]||String(y||"").toLowerCase().replace(/s$/,"")},u:function(y){return y===void 0}},T="en",ne={};ne[T]=E;var K="$isDayjsObject",Q=function(y){return y instanceof U||!(!y||!y[K])},G=function y(x,b,I){var A;if(!x)return T;if(typeof x=="string"){var X=x.toLowerCase();ne[X]&&(A=X),b&&(ne[X]=b,A=X);var J=x.split("-");if(!A&&J.length>1)return y(J[0])}else{var R=x.name;ne[R]=x,A=R}return!I&&A&&(T=A),A||!I&&T},l=function(y,x){if(Q(y))return y.clone();var b=typeof x=="object"?x:{};return b.date=y,b.args=arguments,new U(b)},_=F;_.l=G,_.i=Q,_.w=function(y,x){return l(y,{locale:x.$L,utc:x.$u,x:x.$x,$offset:x.$offset})};var U=function(){function y(b){this.$L=G(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[K]=!0}var x=y.prototype;return x.parse=function(b){this.$d=function(I){var A=I.date,X=I.utc;if(A===null)return new Date(NaN);if(_.u(A))return new Date;if(A instanceof Date)return new Date(A);if(typeof A=="string"&&!/Z$/i.test(A)){var J=A.match(s);if(J){var R=J[2]-1||0,ee=(J[7]||"0").substring(0,3);return X?new Date(Date.UTC(J[1],R,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)):new Date(J[1],R,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)}}return new Date(A)}(b),this.init()},x.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()},x.$utils=function(){return _},x.isValid=function(){return this.$d.toString()!==n},x.isSame=function(b,I){var A=l(b);return this.startOf(I)<=A&&A<=this.endOf(I)},x.isAfter=function(b,I){return l(b)<this.startOf(I)},x.isBefore=function(b,I){return this.endOf(I)<l(b)},x.$g=function(b,I,A){return _.u(b)?this[I]:this.set(A,b)},x.unix=function(){return Math.floor(this.valueOf()/1e3)},x.valueOf=function(){return this.$d.getTime()},x.startOf=function(b,I){var A=this,X=!!_.u(I)||I,J=_.p(b),R=function(ge,xe){var ke=_.w(A.$u?Date.UTC(A.$y,xe,ge):new Date(A.$y,xe,ge),A);return X?ke:ke.endOf(L)},ee=function(ge,xe){return _.w(A.toDate()[ge].apply(A.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(xe)),A)},se=this.$W,ie=this.$M,ue=this.$D,he="set"+(this.$u?"UTC":"");switch(J){case N:return X?R(1,0):R(31,11);case j:return X?R(1,ie):R(0,ie+1);case q:var re=this.$locale().weekStart||0,me=(se<re?se+7:se)-re;return R(X?ue-me:ue+(6-me),ie);case L:case e:return ee(he+"Hours",0);case M:return ee(he+"Minutes",1);case B:return ee(he+"Seconds",2);case P:return ee(he+"Milliseconds",3);default:return this.clone()}},x.endOf=function(b){return this.startOf(b,!1)},x.$set=function(b,I){var A,X=_.p(b),J="set"+(this.$u?"UTC":""),R=(A={},A[L]=J+"Date",A[e]=J+"Date",A[j]=J+"Month",A[N]=J+"FullYear",A[M]=J+"Hours",A[B]=J+"Minutes",A[P]=J+"Seconds",A[D]=J+"Milliseconds",A)[X],ee=X===L?this.$D+(I-this.$W):I;if(X===j||X===N){var se=this.clone().set(e,1);se.$d[R](ee),se.init(),this.$d=se.set(e,Math.min(this.$D,se.daysInMonth())).$d}else R&&this.$d[R](ee);return this.init(),this},x.set=function(b,I){return this.clone().$set(b,I)},x.get=function(b){return this[_.p(b)]()},x.add=function(b,I){var A,X=this;b=Number(b);var J=_.p(I),R=function(ie){var ue=l(X);return _.w(ue.date(ue.date()+Math.round(ie*b)),X)};if(J===j)return this.set(j,this.$M+b);if(J===N)return this.set(N,this.$y+b);if(J===L)return R(1);if(J===q)return R(7);var ee=(A={},A[B]=d,A[M]=v,A[P]=i,A)[J]||1,se=this.$d.getTime()+b*ee;return _.w(se,this)},x.subtract=function(b,I){return this.add(-1*b,I)},x.format=function(b){var I=this,A=this.$locale();if(!this.isValid())return A.invalidDate||n;var X=b||"YYYY-MM-DDTHH:mm:ssZ",J=_.z(this),R=this.$H,ee=this.$m,se=this.$M,ie=A.weekdays,ue=A.months,he=A.meridiem,re=function(xe,ke,qe,Ie){return xe&&(xe[ke]||xe(I,X))||qe[ke].slice(0,Ie)},me=function(xe){return _.s(R%12||12,xe,"0")},ge=he||function(xe,ke,qe){var Ie=xe<12?"AM":"PM";return qe?Ie.toLowerCase():Ie};return X.replace(u,function(xe,ke){return ke||function(qe){switch(qe){case"YY":return String(I.$y).slice(-2);case"YYYY":return _.s(I.$y,4,"0");case"M":return se+1;case"MM":return _.s(se+1,2,"0");case"MMM":return re(A.monthsShort,se,ue,3);case"MMMM":return re(ue,se);case"D":return I.$D;case"DD":return _.s(I.$D,2,"0");case"d":return String(I.$W);case"dd":return re(A.weekdaysMin,I.$W,ie,2);case"ddd":return re(A.weekdaysShort,I.$W,ie,3);case"dddd":return ie[I.$W];case"H":return String(R);case"HH":return _.s(R,2,"0");case"h":return me(1);case"hh":return me(2);case"a":return ge(R,ee,!0);case"A":return ge(R,ee,!1);case"m":return String(ee);case"mm":return _.s(ee,2,"0");case"s":return String(I.$s);case"ss":return _.s(I.$s,2,"0");case"SSS":return _.s(I.$ms,3,"0");case"Z":return J}return null}(xe)||J.replace(":","")})},x.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},x.diff=function(b,I,A){var X,J=this,R=_.p(I),ee=l(b),se=(ee.utcOffset()-this.utcOffset())*d,ie=this-ee,ue=function(){return _.m(J,ee)};switch(R){case N:X=ue()/12;break;case j:X=ue();break;case S:X=ue()/3;break;case q:X=(ie-se)/6048e5;break;case L:X=(ie-se)/864e5;break;case M:X=ie/v;break;case B:X=ie/d;break;case P:X=ie/i;break;default:X=ie}return A?X:_.a(X)},x.daysInMonth=function(){return this.endOf(j).$D},x.$locale=function(){return ne[this.$L]},x.locale=function(b,I){if(!b)return this.$L;var A=this.clone(),X=G(b,I,!0);return X&&(A.$L=X),A},x.clone=function(){return _.w(this.$d,this)},x.toDate=function(){return new Date(this.valueOf())},x.toJSON=function(){return this.isValid()?this.toISOString():null},x.toISOString=function(){return this.$d.toISOString()},x.toString=function(){return this.$d.toUTCString()},y}(),V=U.prototype;return l.prototype=V,[["$ms",D],["$s",P],["$m",B],["$H",M],["$W",L],["$M",j],["$y",N],["$D",e]].forEach(function(y){V[y[1]]=function(x){return this.$g(x,y[0],y[1])}}),l.extend=function(y,x){return y.$i||(y(x,U,l),y.$i=!0),l},l.locale=G,l.isDayjs=Q,l.unix=function(y){return l(1e3*y)},l.en=ne[T],l.Ls=ne,l.p={},l})}(Fe)),Fe.exports}var un=$t();const Ge=ln(un);var ze={exports:{}},dn=ze.exports,Et;function pn(){return Et||(Et=1,function(t,f){(function(i,d){t.exports=d($t())})(dn,function(i){function d(P){return P&&typeof P=="object"&&"default"in P?P:{default:P}}var v=d(i),D={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(P,B){return B==="W"?P+"周":P+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(P,B){var M=100*P+B;return M<600?"凌晨":M<900?"早上":M<1100?"上午":M<1300?"中午":M<1800?"下午":"晚上"}};return v.default.locale(D,null,!0),D})}(ze)),ze.exports}pn();function Pe(t){"@babel/helpers - typeof";return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},Pe(t)}function fn(t,f){if(Pe(t)!="object"||!t)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var d=i.call(t,f);if(Pe(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(t)}function mn(t){var f=fn(t,"string");return Pe(f)=="symbol"?f:f+""}function yn(t,f,i){return(f=mn(f))in t?Object.defineProperty(t,f,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[f]=i,t}function Ct(t,f){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);f&&(d=d.filter(function(v){return Object.getOwnPropertyDescriptor(t,v).enumerable})),i.push.apply(i,d)}return i}function St(t){for(var f=1;f<arguments.length;f++){var i=arguments[f]!=null?arguments[f]:{};f%2?Ct(Object(i),!0).forEach(function(d){yn(t,d,i[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ct(Object(i)).forEach(function(d){Object.defineProperty(t,d,Object.getOwnPropertyDescriptor(i,d))})}return t}var hn={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},gn=St(St({},hn),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});const xn={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Tt={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},gn),timePickerLocale:Object.assign({},xn)};Tt.lang.ok="确定",Ge.locale("zh-cn");const{RangePicker:bn}=oe.DatePicker,vn=({host:t,onChange:f})=>{const i=t.dataset.key,d=t.dataset.value,v=t.dataset.placeholder,D=t.dataset.limitRange?parseInt(t.dataset.limitRange,10):void 0,P=t.dataset.disableFuture==="true",[B,M]=c.useState(()=>{if(!d)return null;const n=d.split(",");return n.length===2&&n[0]&&n[1]?[Ge(n[0]),Ge(n[1])]:null}),[L,q]=c.useState(null),j=n=>n?P&&n.isAfter(Ge(),"day")?!0:!D||!L||!L[0]?!1:Math.abs(n.diff(L[0],"days"))>D:!1,S=n=>{console.log("[DatePicker] onCalendarChange",n?.map(s=>s?.format("YYYY-MM-DD")||null)),q(n)},N=n=>{if(console.log("[DatePicker] onChange",n?.map(s=>s?.format("YYYY-MM-DD")||null)),M(n),q(null),n&&n[0]&&n[1]){const s=`${n[0].format("YYYY-MM-DD")},${n[1].format("YYYY-MM-DD")}`;t.setAttribute("data-value",s),f(i,s)}else t.setAttribute("data-value",""),f(i,"")},e=n=>{console.log("[DatePicker] onOpenChange",n),q(n?B:null)};return Xe.createPortal(w.jsx("div",{className:"rte-datepicker-wrapper",contentEditable:!1,style:{display:"inline-block",verticalAlign:"middle",width:"260px",marginLeft:"4px",marginRight:"4px",fontSize:"16px",height:"30px",lineHeight:"30px"},children:w.jsx(bn,{value:B,disabledDate:j,onCalendarChange:S,onChange:N,onOpenChange:e,placeholder:[v||"开始日期",v||"结束日期"],style:{width:"100%"},size:"small",allowClear:!0,locale:Tt,getPopupContainer:()=>document.body,popupClassName:"rte-datepicker-dropdown"})}),t)},wn=t=>{const[f,i]=c.useState([]);return c.useEffect(()=>{const d=t.current;if(!d)return;const v=()=>{const P=d.querySelectorAll(".rte-datepicker-host"),B=[];P.forEach(M=>{const L=M.getAttribute("data-key");L&&B.push(w.jsx(vn,{host:M,onChange:()=>{if(t.current){const q=new Event("input",{bubbles:!0});t.current.dispatchEvent(q)}}},`datepicker-${L}`))}),i(B)};v();const D=new MutationObserver(P=>{let B=!1;for(const M of P)if(M.type==="childList"){let L=!1;if(M.addedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-datepicker-host")||j.querySelector?.(".rte-datepicker-host"))&&(L=!0)}}),M.removedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-datepicker-host")||j.querySelector?.(".rte-datepicker-host"))&&(L=!0)}}),L){B=!0;break}}B&&v()});return D.observe(d,{childList:!0,subtree:!0}),()=>D.disconnect()},[t]),f},He=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),At=t=>`\`\`\`
|
|
1
|
+
(function(le,w){typeof exports=="object"&&typeof module<"u"?w(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"],w):(le=typeof globalThis<"u"?globalThis:le||self,w(le.SealSeekBIComponents={},le.React,le.React,le.antd,le.AntdIcons,le.ReactDOM))})(this,function(le,w,c,oe,Te,Xe){"use strict";const ft=({variant:t="primary",loading:f=!1,children:i,...d})=>{const v=D=>{switch(D){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return w.jsx(oe.Button,{...d,type:v(t),loading:f,ghost:t==="ghost",children:i})};ft.__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 mt=({title:t,children:f,bordered:i=!0,hoverable:d=!1,size:v="default",...D})=>w.jsx(oe.Card,{...D,title:t,bordered:i,hoverable:d,size:v,children:f});mt.__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 yt=({showDefaultFooter:t=!0,...f})=>{const i=f.footer!==void 0?f.footer:t?(d,{OkBtn:v,CancelBtn:D})=>w.jsxs(w.Fragment,{children:[w.jsx(v,{}),w.jsx(D,{})]}):null;return w.jsx(oe.Modal,{...f,footer:i})};yt.__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 ht=({scrollX:t,showPagination:f=!0,defaultPageSize:i=10,...d})=>w.jsx(oe.Table,{...d,scroll:{x:t||"max-content",y:"50vh"},pagination:f?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:i,...d.pagination}:!1});ht.__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 Xt=Te.createFromIconfontCN({scriptUrl:["//at.alicdn.com/t/c/font_5037819_a72xy7yjoj.js"]}),gt=({name:t,size:f,color:i,style:d,...v})=>{const D={fontSize:f,color:i,...d};return w.jsx(Xt,{...v,type:t,style:D})};gt.__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 bt=({loading:t,description:f="暂无数据",className:i,emptyChildren:d,loadingText:v,emptyImage:D})=>t?w.jsxs(oe.Flex,{className:`pt-10 w-full ${i||""}`,align:"center",justify:"center",vertical:!0,children:[w.jsx(oe.Spin,{size:"large"}),v&&w.jsx("div",{className:"mt-4 text-gray-500",children:v})]}):w.jsx(oe.Flex,{className:`pt-10 w-full ${i||""}`,align:"center",justify:"center",children:w.jsx(oe.Empty,{image:D,description:f,imageStyle:{height:180},children:d})});bt.__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 xt=({onClick:t,showText:f=!1,className:i,size:d="small",type:v="default"})=>w.jsx(oe.Button,{size:d,type:v,icon:w.jsx(Te.LeftOutlined,{}),className:`cursor-pointer ${i||""}`,onClick:t,children:f&&"返回"});xt.__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 vt=({removePadding:t=!0,className:f,...i})=>{const d=t?`px-0 h-auto ${f||""}`:f;return w.jsx(oe.Button,{type:"link",...i,className:d,children:i.children})};vt.__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:Jt}=oe.Select,wt=({columns:t,request:f,searchFields:i=[],showSearch:d=!0,showRefresh:v=!0,defaultPageSize:D=10,pageSizeOptions:P=["10","20","50","100"],autoLoad:B=!0,externalParams:M={},...L})=>{const[q,j]=c.useState([]),[S,N]=c.useState(!1),[e,n]=c.useState({current:1,pageSize:D,total:0}),[s,u]=c.useState({}),[E,H]=c.useState({}),[F]=oe.Form.useForm(),T=c.useRef(e);T.current=e;const ne=c.useRef(M);ne.current=M;const K=c.useRef(!1),R=c.useMemo(()=>t.map(y=>{const{sortable:b,render:x,...I}=y;return{...I,sorter:b?!0:void 0,render:x||(A=>A)}}),[t]),G=c.useCallback(async(y={})=>{if(f){N(!0);try{const b={page:T.current.current,pageSize:T.current.pageSize,sortField:E.field,sortOrder:E.order,searchParams:{...s,...ne.current},...y},x=await f(b);x.success&&(j(x.data),n(I=>({...I,total:x.total,current:b.page||I.current})))}catch(b){console.error("加载数据失败:",b)}finally{N(!1)}}},[f,E,s]),l=c.useCallback(y=>{u(y),n(b=>({...b,current:1}))},[]),_=c.useCallback(()=>{F.resetFields(),u({}),n(y=>({...y,current:1}))},[F]),U=c.useCallback(()=>{G()},[G]),V=c.useCallback((y,b,x)=>{const I={current:y.current||1,pageSize:y.pageSize||D,total:y.total||0},A={field:x?.field,order:x?.order};n(I),H(A)},[D]);return c.useEffect(()=>{const y=Object.keys(M).length>0;(B&&!K.current||y)&&(G(),K.current=!0)},[B,M,G]),w.jsxs("div",{children:[d&&i.length>0&&w.jsx(oe.Card,{size:"small",style:{marginBottom:16},children:w.jsxs(oe.Form,{form:F,layout:"inline",onFinish:l,initialValues:i.reduce((y,b)=>(b.defaultValue!==void 0&&(y[b.key]=b.defaultValue),y),{}),children:[i.map(y=>w.jsx(oe.Form.Item,{name:y.key,label:y.label,children:y.type==="input"?w.jsx(oe.Input,{placeholder:y.placeholder||`请输入${y.label}`,style:{width:200}}):w.jsx(oe.Select,{placeholder:y.placeholder||`请选择${y.label}`,style:{width:200},allowClear:!0,children:y.options?.map(b=>w.jsx(Jt,{value:b.value,children:b.label},b.value))})},y.key)),w.jsx(oe.Form.Item,{children:w.jsxs(oe.Space,{children:[w.jsx(oe.Button,{type:"primary",htmlType:"submit",icon:w.jsx(Te.SearchOutlined,{}),children:"查询"}),w.jsx(oe.Button,{onClick:_,children:"重置"}),v&&w.jsx(oe.Button,{icon:w.jsx(Te.ReloadOutlined,{}),onClick:U,children:"刷新"})]})})]})}),w.jsx(oe.Table,{...L,columns:R,dataSource:q,loading:S,pagination:{...e,showSizeChanger:!0,showQuickJumper:!0,showTotal:(y,b)=>`第 ${b[0]}-${b[1]} 条/共 ${y} 条`,pageSizeOptions:P},onChange:V,scroll:{x:"max-content",y:"50vh"}})]})};wt.__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 Je(t,f,i){if(!t.current)return;const d=S=>{S.classList.contains("rte-richtext-host-expanded")&&(S.style.setProperty("display","flex","important"),S.style.setProperty("flex-direction","column","important"),S.style.setProperty("flex","1 1 auto","important"),S.style.setProperty("min-height","0","important"),S.style.setProperty("width","100%","important"),S.style.setProperty("align-self","stretch","important"))},v=new Set,D={};for(const S of f)S.exclusionGroup&&S.exclusionGroup!=="separator"&&(v.add(S.exclusionGroup),D[S.exclusionGroup]||(D[S.exclusionGroup]=[]),D[S.exclusionGroup].push({type:S.type,key:S.key,exclusionGroup:S.exclusionGroup}));const P={};for(const S of v){P[S]=!1;for(const N of D[S])if(N.type==="upload"&&N.key){if(i[N.key]!==null&&i[N.key]!==void 0){P[S]=!0;break}const e=f.find(n=>n.type==="upload"&&n.key===N.key);if(e&&typeof e.maxCount=="number")for(let n=0;n<e.maxCount;n++){const s=`${N.key}-${n}`;if(i[s]!==null&&i[s]!==void 0){P[S]=!0;break}}if(P[S])break}else if((N.type==="variable"||N.type==="multi-variable")&&N.key){const e=N.type==="multi-variable"?t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${N.key}"]`):[t.current.querySelector(`[data-type="variable"][data-key="${N.key}"]`)].filter(Boolean);for(const n of e)if(!n.classList.contains("show-placeholder")&&n.innerText.replace(/[\u200B\n]/g,"").trim().length>0){P[S]=!0;break}if(P[S])break}}const B=f.some(S=>S.exclusionGroup==="separator"),L=Object.keys(P).filter(S=>P[S]).length>0;let q=null;if(L&&B){for(const S of f)if(S.exclusionGroup&&S.exclusionGroup!=="separator"&&P[S.exclusionGroup]){q=S.exclusionGroup;break}}for(const S of v){const N=t.current.querySelectorAll(`[data-group="${S}"]`);B&&L&&q?S===q?N.forEach(e=>{if(!e.closest('[data-rte-force-hidden="1"]')){if(e.classList.contains("rte-richtext-host-expanded")){d(e);return}e.classList.contains("required-upload-group")?e.style.setProperty("display","inline-flex","important"):(e.classList.contains("exclusion-wrapper"),e.style.setProperty("display","inline-block","important"))}}):N.forEach(e=>{e.closest('[data-rte-force-hidden="1"]')||(e.style.display="none",e.style.setProperty("display","none","important"))}):N.forEach(e=>{if(!e.closest('[data-rte-force-hidden="1"]')){if(e.classList.contains("rte-richtext-host-expanded")){d(e);return}e.classList.contains("required-upload-group")?e.style.setProperty("display","inline-flex","important"):(e.classList.contains("exclusion-wrapper"),e.style.setProperty("display","inline-block","important"))}})}t.current.querySelectorAll('[data-group="separator"]').forEach(S=>{S.style.display=L?"none":"inline"})}function Qe(t,f,i,d){if(!t.current){d(!1);return}const v=e=>{const n=e.getAttribute("data-node-type")||"";if(n!=="report-module"&&n!=="markdown-module")return(e.textContent||"").replace(/[\u200B]/g,"").trim();const s=(e.textContent||"").replace(/[\u200B]/g,"").trim(),u=Array.from(e.querySelectorAll(":scope > div"));if(u.length===0)return s;let E=-1;for(let T=0;T<u.length;T++)if((u[T].textContent||"").replace(/[\u200B]/g,"").trim().length>0){E=T;break}return u.filter((T,ne)=>ne!==E).map(T=>(T.textContent||"").replace(/[\u200B]/g,"").trim()).join(`
|
|
2
|
+
`).trim()||s},D=e=>e?!!e.closest('[data-rte-force-hidden="1"]'):!1,P=[];for(let e=0;e<f.length;e++){const n=f[e];if((n.type==="variable"||n.type==="report-url"||n.type==="markdown"||n.type==="upload"||n.type==="multi-variable"||n.type==="select"||n.type==="textarea"||n.type==="richtext"||n.type==="report-module"||n.type==="markdown-module"||n.type==="datepicker"||n.type==="number-input")&&n.required&&n.key){P.push({exclusionGroup:n.exclusionGroup||"",key:n.key,type:n.type==="multi-variable"||n.type==="report-url"||n.type==="markdown"?"variable":n.type==="report-module"||n.type==="markdown-module"?"richtext":n.type,isMultiVariable:n.type==="multi-variable",minCount:n.type==="multi-variable"||n.type==="upload"&&typeof n.minCount=="number"?n.minCount:void 0,moduleIndex:n.type==="report-module"||n.type==="markdown-module"?n.moduleIndex:void 0,__index:e});continue}if(n.type==="text"&&n.className?.includes("rte-text-required"))if(n.exclusionGroup)for(let s=e+1;s<f.length;s++){const u=f[s];if(u.exclusionGroup===n.exclusionGroup&&(u.type==="variable"||u.type==="markdown"||u.type==="upload"||u.type==="select"||u.type==="textarea"||u.type==="richtext"||u.type==="datepicker"||u.type==="number-input")&&u.key){P.push({exclusionGroup:n.exclusionGroup,key:u.key,type:u.type==="markdown"?"variable":u.type,__index:s});break}}else for(let s=e+1;s<f.length;s++){const u=f[s];if((u.type==="variable"||u.type==="markdown"||u.type==="upload"||u.type==="select"||u.type==="textarea"||u.type==="richtext"||u.type==="datepicker"||u.type==="number-input")&&u.key){P.push({exclusionGroup:u.exclusionGroup||"",key:u.key,type:u.type==="markdown"?"variable":u.type,__index:s});break}}}const B=f.some(e=>e.exclusionGroup==="separator"),M=[];if(B&&P.length>1){const e=[];f.forEach((n,s)=>{n.exclusionGroup==="separator"&&e.push(s)});for(const n of e){const u=P.filter(F=>typeof F.__index=="number"&&F.__index<n).sort((F,T)=>(T.__index??0)-(F.__index??0))[0],H=P.filter(F=>typeof F.__index=="number"&&F.__index>n).sort((F,T)=>(F.__index??0)-(T.__index??0))[0];u&&H&&M.push([u,H])}}if(P.length===0){if(f.length===0){if(!t.current){d(!1);return}const e=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";d(e.length>0);return}d(!0);return}const L=P.filter(e=>{if(!t.current)return!1;if(e.exclusionGroup){const n=t.current.querySelectorAll(`[data-group="${e.exclusionGroup}"]`);if(n.length>0){const s=n[0];return D(s)?!0:s.style.display!=="none"}}if(e.type==="upload"&&e.key){const n=t.current.querySelector(`[data-type="upload"][data-key="${e.key}"]`)||t.current.querySelector(`[data-type="upload"][data-batch-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="variable"&&e.key)if(e.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${e.key}"]`);if(n.length>0){const s=n[0],u=s.closest("[data-group]")||s.parentElement;return D(u)?!0:u?u.style.display!=="none":!0}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="select"&&e.key){const n=t.current.querySelector(`[data-type="select"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="textarea"&&e.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="richtext"&&e.key){const n=typeof e.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"]`:`[data-type="richtext"][data-key="${e.key}"]`,s=t.current.querySelector(n);if(s){const u=s.closest("[data-group]")||s.parentElement;return D(u)?!0:u?u.style.display!=="none":!0}}else if(e.type==="datepicker"&&e.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}else if(e.type==="number-input"&&e.key){const n=t.current.querySelector(`[data-type="number-input"][data-key="${e.key}"]`);if(n){const s=n.closest("[data-group]")||n.parentElement;return D(s)?!0:s?s.style.display!=="none":!0}}return!1});if(L.length===0){d(!0);return}const q=new Set;M.forEach(e=>{e.forEach(n=>{n.key&&q.add(n.key)})});const j=L.filter(e=>!e.key||!q.has(e.key));let S=(M.length===0,!0);for(const e of M){const n=e.filter(u=>{if(!t.current)return!1;if(u.exclusionGroup){const E=t.current.querySelectorAll(`[data-group="${u.exclusionGroup}"]`);if(E.length>0){const H=E[0];return D(H)?!0:H.style.display!=="none"}}return!0});if(n.length===0)continue;let s=!1;for(const u of n)if(u.type==="upload"&&u.key){if(u.minCount&&u.minCount>0){let E=0;const H=t.current.querySelectorAll(`[data-type="upload"][data-batch-key="${u.key}"]`);if(H.length===0)continue;for(let F=0;F<H.length;F++){const ne=H[F].dataset.key;ne&&i[ne]!=null&&(E+=1)}if(E>=u.minCount){s=!0;break}}else if(i[u.key]!==null&&i[u.key]!==void 0){s=!0;break}}else if(u.type==="variable"&&u.key)if(u.isMultiVariable){const E=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${u.key}"]`);let H=0;for(const T of Array.from(E)){if(T.classList.contains("show-placeholder"))continue;T.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(H+=1)}const F=u.minCount&&u.minCount>0?u.minCount:1;if(H>=F){s=!0;break}}else{const E=t.current.querySelector(`[data-type="variable"][data-key="${u.key}"]`);if(E){if(E.classList.contains("show-placeholder"))continue;if(E.innerText.replace(/[\u200B\n]/g,"").trim().length>0){s=!0;break}}}else if(u.type==="select"&&u.key){const E=t.current.querySelector(`[data-type="select"][data-key="${u.key}"]`);if(E&&(E.getAttribute("data-value")||"").trim().length>0){s=!0;break}}else if(u.type==="textarea"&&u.key){const E=t.current.querySelector(`[data-type="textarea"][data-key="${u.key}"]`);if(E&&(E.value||"").trim().length>0){s=!0;break}}else if(u.type==="richtext"&&u.key){const E=typeof u.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${u.key}"][data-module-index="${u.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${u.key}"][data-module-index="${u.moduleIndex}"]`:`[data-type="richtext"][data-key="${u.key}"]`,H=t.current.querySelector(E);if(H&&v(H).length>0){s=!0;break}}else if(u.type==="datepicker"&&u.key){const E=t.current.querySelector(`[data-type="datepicker"][data-key="${u.key}"]`);if(E&&(E.getAttribute("data-value")||"").trim().length>0){s=!0;break}}else if(u.type==="number-input"&&u.key){const E=t.current.querySelector(`[data-type="number-input"][data-key="${u.key}"]`);if(E&&(E.value||"").trim().length>0){s=!0;break}}if(!s){S=!1;break}}let N=!0;for(const e of j)if(e.type==="upload"&&e.key){if(e.minCount&&e.minCount>0){let n=0;const s=t.current.querySelectorAll(`[data-type="upload"][data-batch-key="${e.key}"]`);if(s.length===0){N=!1;break}for(let u=0;u<s.length;u++){const H=s[u].dataset.key;H&&i[H]!=null&&(n+=1)}if(n<e.minCount){N=!1;break}}else if(i[e.key]===null||i[e.key]===void 0){N=!1;break}}else if(e.type==="variable"&&e.key)if(e.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${e.key}"]`);let s=0;for(const E of Array.from(n)){if(E.classList.contains("show-placeholder"))continue;E.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(s+=1)}const u=e.minCount&&e.minCount>0?e.minCount:1;if(s<u){N=!1;break}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${e.key}"]`);if(!n){N=!1;break}if(n.classList.contains("show-placeholder")){N=!1;break}if(n.innerText.replace(/[\u200B\n]/g,"").trim().length===0){N=!1;break}}else if(e.type==="select"&&e.key){const n=t.current.querySelector(`[data-type="select"][data-key="${e.key}"]`);if(!n||(n.getAttribute("data-value")||"").trim().length===0){N=!1;break}}else if(e.type==="textarea"&&e.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${e.key}"]`);if(!n||(n.value||"").trim().length===0){N=!1;break}}else if(e.type==="richtext"&&e.key){const n=typeof e.moduleIndex=="number"?`[data-type="richtext"][data-node-type="report-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"], [data-type="richtext"][data-node-type="markdown-module"][data-key="${e.key}"][data-module-index="${e.moduleIndex}"]`:`[data-type="richtext"][data-key="${e.key}"]`,s=t.current.querySelector(n);if(!s||v(s).length===0){N=!1;break}}else if(e.type==="datepicker"&&e.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${e.key}"]`);if(!n||(n.getAttribute("data-value")||"").trim().length===0){N=!1;break}}else if(e.type==="number-input"&&e.key){const n=t.current.querySelector(`[data-type="number-input"][data-key="${e.key}"]`);if(!n||(n.value||"").trim().length===0){N=!1;break}}d(S&&N)}function Ze(t,f){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(d=>{const v=d.innerText;v.replace(/\u200B/g,"").trim().length===0?(v!==""&&(d.innerText=""),d.classList.add("show-placeholder")):d.classList.remove("show-placeholder")})}const Qt=({host:t,onChange:f})=>{const i=t.dataset.key,d=t.dataset.placeholder,v=t.dataset.options?decodeURIComponent(t.dataset.options):"[]",D=t.dataset.required==="true",P=t.dataset.value||"",B=c.useMemo(()=>{try{return JSON.parse(v)}catch{return[]}},[v]),[M,L]=c.useState(P||void 0),[q,j]=c.useState(64),S=c.useRef(null),N=s=>{L(s),t.setAttribute("data-value",s),f(i,s)};c.useEffect(()=>{L(P||void 0)},[P]);const e=c.useCallback(()=>{if(M!=null&&M!==""){const s=B.find(u=>String(u.value)===String(M));return s?typeof s.label=="string"?s.label:String(s.label??M):String(M)}return d||"请选择"},[M,B,d]),n=c.useCallback(()=>{const s=S.current;if(!s)return;const u=s.querySelector(".ant-select-selection-item"),E=s.querySelector(".ant-select-selection-placeholder"),H=u||E,F=(H?.textContent||"").trim()||e(),T=s.querySelector(".ant-select-selector"),ne=H||T||s,K=window.getComputedStyle(ne),R=H?K.fontSize:"16px",G=K.fontFamily||"sans-serif",l=K.fontWeight||"400",U=`${K.fontStyle||"normal"} ${l} ${R} ${G}`,y=document.createElement("canvas").getContext("2d"),b=y?Math.ceil((y.font=U,y.measureText(F).width||0)):0;let x=0;if(T){const ee=window.getComputedStyle(T);x=(Number.parseFloat(ee.paddingLeft)||0)+(Number.parseFloat(ee.paddingRight)||0)}const I=s.querySelector(".ant-select-arrow"),A=I?Math.ceil(I.getBoundingClientRect().width):12,X=s.querySelector(".ant-select-clear");let J=0;if(X){const ee=window.getComputedStyle(X);ee.display!=="none"&&ee.visibility!=="hidden"&&(J=Math.ceil(X.getBoundingClientRect().width))}const Z=Math.max(36,b+x+A+J+6);j(ee=>ee===Z?ee:Z)},[e]);return c.useLayoutEffect(()=>{const s=window.requestAnimationFrame(()=>{n()}),u=window.setTimeout(()=>{n()},60);return()=>{window.cancelAnimationFrame(s),window.clearTimeout(u)}},[n]),c.useEffect(()=>{if(!("fonts"in document))return;let s=!1;const u=document.fonts;if(u?.ready)return u.ready.then(()=>{s||n()}),()=>{s=!0}},[n]),Xe.createPortal(w.jsx("div",{className:"rte-select-wrapper",contentEditable:!1,ref:S,style:{display:"inline-block",width:q},children:w.jsx(oe.Select,{value:M,onChange:N,placeholder:d||"请选择",style:{width:"100%"},options:B,allowClear:!D,size:"small",dropdownClassName:"rte-select-dropdown",getPopupContainer:()=>document.body,dropdownMatchSelectWidth:!1,suffixIcon:w.jsx("i",{className:"iconfont icon-qiehuan-xiayizhang",style:{fontSize:"10px",color:"#7C3AED"}})})}),t)},Zt=t=>{const[f,i]=c.useState([]);return c.useEffect(()=>{const d=t.current;if(!d)return;const v=()=>{const P=d.querySelectorAll(".rte-select-host"),B=[];P.forEach(M=>{const L=M.getAttribute("data-key");L&&B.push(w.jsx(Qt,{host:M,onChange:()=>{if(t.current){const q=new Event("input",{bubbles:!0});t.current.dispatchEvent(q)}}},`select-${L}`))}),i(B)};v();const D=new MutationObserver(P=>{let B=!1;for(const M of P)if(M.type==="childList"){let L=!1;if(M.addedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-select-host")||j.querySelector?.(".rte-select-host"))&&(L=!0)}}),M.removedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-select-host")||j.querySelector?.(".rte-select-host"))&&(L=!0)}}),L){B=!0;break}}B&&v()});return D.observe(d,{childList:!0,subtree:!0}),()=>D.disconnect()},[t]),f},ve=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");function Rt(t,f,i,d,v,D={},P,B){if(!t.current)return;const M=/[;;,,。.!!??::、]/,L=e=>{const n=(e??"").trim();return n.length===1&&M.test(n)},q=e=>{const n=e??"",s=n.match(new RegExp(`^\\s*(${M.source})`));if(!s)return null;const u=s[1],E=n.replace(new RegExp(`^\\s*${M.source}`),"");return{punct:u,rest:E}},j=e=>`<span data-type="text" class="rte-inline-punct" contenteditable="false">${e}</span>`,S=[];let N=0;for(;N<f.length;){const e=f[N],n=N+1<f.length?f[N+1]:null;let s=!1;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&n){const K=n.type==="upload"&&n.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===n.exclusionGroup,R=n.type==="variable"&&n.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===n.exclusionGroup;if(K){const G=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",l=`<span ${G} class="exclusion-wrapper required-upload-group">`,_="</span>";let U="";e.className?U=`<span class="${e.className}">${e.text??""}</span>`:U=e.text??"";const V=n,y=i[V.key]!==null&&i[V.key]!==void 0,b=y?i[V.key]:null,x=y?i[V.key]?.name:V.text,I=y?"":"hidden",A=V.tooltip&&!y?"":"hidden",X=y?"has-file":"",J=y&&x?` data-file-name="${x.replace(/"/g,""")}"`:"";let Z="";y&&b?b.type?.startsWith("image/")?Z=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(b)}" alt="preview" />`:Z="<i class='iconfont icon-exlwenjian'></i>":Z="<i class='iconfont icon-shangchuan1'></i>";const ee=(V.text||"").trim(),ie=y&&ee.length>=12?`<span ${G} contenteditable="false" class="exclusion-wrapper upload-hint">${ee}</span>`:"",ue=`<span contenteditable="false" data-type="upload" data-key="${V.key}" class="upload-chip"><span class="upload-inner-wrapper ${X}"><span class="upload-icon">${Z}</span><span class="upload-label"${J}>${x||V.text}</span>${V.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi upload-info-icon ${A}" data-upload-key="${V.key}" data-tooltip="${V.tooltip}"></i>`:""}<span class="file-remove-btn ${I}" title="移除文件">×</span></span></span>`;S.push(l+U+ue+_+ie),N+=2;continue}if(R){const l=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,_="</span>";let U="";e.className?U=`<span class="${e.className}">${e.text??""}</span>`:U=e.text??"";const V=n,b=(V.key?v[V.key]:void 0)||V.text||"",x=!b,I=x?"":b,A=x?"show-placeholder":"",X=V.exclusionGroup?` data-group="${V.exclusionGroup}"`:"",J=V.tooltip?` data-tooltip="${V.tooltip.replace(/"/g,""")}" data-variable-key="${V.key||""}"`:"",Z=V.tooltip&&x?"":"hidden",ee=`<span contenteditable="true" data-type="variable" data-key="${V.key}" data-placeholder="${V.placeholder||""}"${X}${J} class="variable-chip ${A}">${I}${V.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${Z}" data-variable-key="${V.key}" data-tooltip="${V.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;S.push(l+U+ee+_),N+=2;continue}}const E=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",H=e.exclusionGroup?`<span ${E} class="exclusion-wrapper">`:"",F=e.exclusionGroup?"</span>":"";let T="";if(e.type==="tag"){const R=d||P==="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>',G=d?' data-locked="true"':"",l=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-tag-key="${e.key||""}"`:"";T=`<span contenteditable="false" class="tag-node group"${G}${l}><span class="tag-label">${e.text}</span>${R}</span>`}else if(e.type==="text"){const K=d?' data-locked="true" contenteditable="false"':' contenteditable="false"',G=(e.text??"").replace(/\n/g,"<br/>");e.className?T=`<span data-type="text" class="${e.className}"${K}>${G}</span>`:T=d?`<span data-type="text"${K}>${G}</span>`:`<span data-type="text" contenteditable="false">${G}</span>`}else if(e.type==="variable"&&e.key){const R=v[e.key]||e.text||"",G=!R,l=G?"":R,_=G?"show-placeholder":"",U=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",V=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",y=e.tooltip&&G?"":"hidden",b=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${U}${V} class="variable-chip ${_}">${l}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${y}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;e.required?T=`<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>${b}</span>`:T=b}else if(e.type==="report-url"&&e.key){const K=`${e.key}__url`,G=Object.prototype.hasOwnProperty.call(v,K)?v[K]:void 0,l=v[e.key],_=G??l??e.text??"",U=!_,V=U?"":_,y=U?"show-placeholder":"",b=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",x=e.tooltip?` data-tooltip="${ve(e.tooltip)}" data-variable-key="${e.key||""}"`:"",I=e.tooltip&&U?"":"hidden",A=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-node-type="report-url" data-placeholder="${ve(e.placeholder||"")}"${b}${x} class="variable-chip rte-report-url ${y}">${V}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${I}" data-variable-key="${e.key}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}</span>`;e.required?T=`<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>${A}</span>`:T=A}else if(e.type==="markdown"&&e.key){const K=e.sourceTextKey||`${e.key}__sourceText`,G=Object.prototype.hasOwnProperty.call(v,K)?v[K]:void 0,l=v[e.key],_=G??l??e.text??"",U=!_,V=U?"":_,y=U?"show-placeholder":"",b=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",x=e.sourceTextKey?` data-source-text-key="${ve(e.sourceTextKey)}"`:"",I=e.tooltip?` data-tooltip="${ve(e.tooltip)}" data-variable-key="${e.key||""}"`:"",A=e.tooltip&&U?"":"hidden",X=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-node-type="markdown" data-placeholder="${ve(e.placeholder||"")}"${b}${x}${I} class="variable-chip rte-markdown-input ${y}">${V}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${A}" data-variable-key="${e.key}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}</span>`;e.required?T=`<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>`:T=X}else if(e.type==="upload"&&e.key){const K=!!n&&n.type==="text"&&!n.className&&!n.exclusionGroup&&L(n.text),R=K?(n.text??"").trim():"",G=R?j(R):"";if(K&&(s=!0),typeof e.maxCount=="number"&&typeof e.minCount=="number"&&e.maxCount>1){const _=e.tooltip?` data-tooltip="${ve(e.tooltip)}"`:"",U=e.minCount||1,V=e.maxCount||3;let y=0;for(let I=0;I<V;I++){const A=`${e.key}-${I}`;i[A]!=null&&(y+=1)}const b=Math.min(V,Math.max(U,y+(y<V?1:0)));let x="";for(let I=0;I<b;I++){const A=`${e.key}-${I}`,X=i[A]!==null&&i[A]!==void 0,J=X?i[A]:null,Z=X?i[A]?.name:e.text,ee=X?"":"hidden",se=e.tooltip&&!X?"":"hidden",ie=X?"has-file":"",ue=X&&Z?` data-file-name="${Z.replace(/"/g,""")}"`:"";let he="";X&&J?J.type?.startsWith("image/")?he=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(J)}" alt="preview" />`:he="<i class='iconfont icon-exlwenjian'></i>":he="<i class='iconfont icon-shangchuan1'></i>";const re=` data-batch-key="${e.key}"`,me=` data-batch-index="${I}"`,ge=`<span contenteditable="false" data-type="upload" data-key="${A}"${re}${me}${_} class="upload-chip upload-chip-batch"><span class="upload-inner-wrapper ${ie}"><span class="upload-icon">${he}</span><span class="upload-label"${ue}>${Z||e.text}</span>${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi upload-info-icon ${se}" data-upload-key="${A}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}<span class="file-remove-btn ${ee}" title="移除文件">×</span></span></span>`;x+=ge}e.required?T=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group rte-required-upload-batch"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span><span class="rte-upload-batch-chips">${x}${G}</span></span>`:T=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-upload-batch-chips">${x}${G}</span>`}else{const _=e.tooltip?` data-tooltip="${ve(e.tooltip)}"`:"",U=i[e.key]!==null&&i[e.key]!==void 0,V=U?i[e.key]:null,y=U?i[e.key]?.name:e.text,b=U?"":"hidden",x=e.tooltip&&!U?"":"hidden",I=U?"has-file":"",A=U&&y?` data-file-name="${y.replace(/"/g,""")}"`:"";let X="";U&&V?V.type?.startsWith("image/")?X=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(V)}" alt="preview" />`:X="<i class='iconfont icon-exlwenjian'></i>":X="<i class='iconfont icon-shangchuan1'></i>";const J=(e.text||"").trim(),ee=U&&e.showHint===!0&&J.length>=12?`<span ${E} contenteditable="false" class="exclusion-wrapper upload-hint">${J}</span>`:"",se=`<span contenteditable="false" data-type="upload" data-key="${e.key}"${_} class="upload-chip"><span class="upload-inner-wrapper ${I}"><span class="upload-icon">${X}</span><span class="upload-label"${A}>${y||e.text}</span>${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi upload-info-icon ${x}" data-upload-key="${e.key}" data-tooltip="${ve(e.tooltip)}" ></i>`:""}<span class="file-remove-btn ${b}" title="移除文件">×</span></span></span>`;e.required?T=`<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>${se}${G}</span>${ee}`:T=se+G+ee}}else if(e.type==="select"&&e.key){const K=v[e.key]||e.defaultValue||"",R=encodeURIComponent(JSON.stringify(e.options||[])),G=e.placeholder?` data-placeholder="${e.placeholder}"`:"",l=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",_=e.required?' data-required="true"':"",U=`<div data-type="select" data-key="${e.key}" data-value="${K}" data-options="${R}"${G}${l}${_} class="rte-select-host"></div>`;e.required?T=`<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>${U}</span>`:T=U}else if(e.type==="textarea"&&e.key){const K=v[e.key]||"",R=typeof e.maxHeight=="number"?e.maxHeight:252,G=e.placeholder?` placeholder="${e.placeholder}"`:"",l=`<textarea data-type="textarea" data-key="${e.key}" class="rte-textarea" style="max-height:${R}px;"${G}>${K}</textarea>`,_=`<div class="rte-textarea-wrapper" data-key="${e.key}">${l}</div>`;e.required?T=`<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>${_}</span>`:T=_}else if(e.type==="richtext"&&e.key){const K=v[e.key]||e.text||"",R=typeof e.minHeight=="number"?e.minHeight:40,G=typeof e.maxHeight=="number"?e.maxHeight:160,l=Math.max(G,R),_=e.placeholder?` data-placeholder="${e.placeholder}"`:"",U=e.expandable!==!1,V=K,y=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" class="rte-richtext"${_} style="min-height:${R}px;max-height:${l}px;overflow:auto;">${V}</div>`,b=U?`<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>`:"",x=`<div class="rte-richtext-wrapper${U?" rte-richtext-toggleable":""}" data-key="${e.key}">${y}${b}</div>`,I=`<div class="rte-richtext-container" data-key="${e.key}">${x}</div>`;e.required?T=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-richtext-required">${I}</div>`:T=I}else if(e.type==="report-module"&&e.key){const K=typeof e.moduleIndex=="number"?e.moduleIndex:0,R=`${e.key}__module_${K}`,l=Object.prototype.hasOwnProperty.call(v,R)?v[R]:e.text||"",_=typeof e.minHeight=="number"?e.minHeight:80,U=typeof e.maxHeight=="number"?e.maxHeight:240,V=Math.max(U,_),y=e.placeholder?` data-placeholder="${ve(e.placeholder)}"`:"",b=l,x=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" data-node-type="report-module" data-module-index="${K}" class="rte-richtext rte-report-module"${y} style="min-height:${_}px;max-height:${V}px;overflow:auto;">${b}</div>`,I=`<div class="rte-richtext-wrapper rte-report-module-wrapper" data-key="${e.key}">${x}</div>`,A=`<div class="rte-richtext-container rte-report-module-container" data-key="${e.key}">${I}</div>`;e.required?T=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-richtext-required">${A}</div>`:T=A}else if(e.type==="markdown-module"&&e.key){const K=typeof e.moduleIndex=="number"?e.moduleIndex:0,R=`${e.key}__module_${K}`,l=Object.prototype.hasOwnProperty.call(v,R)?v[R]:e.text||"",_=typeof e.minHeight=="number"?e.minHeight:80,U=typeof e.maxHeight=="number"?e.maxHeight:240,V=Math.max(U,_),y=e.placeholder?` data-placeholder="${ve(e.placeholder)}"`:"",b=l,x=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" data-node-type="markdown-module" data-module-index="${K}" class="rte-richtext rte-markdown-module"${y} style="min-height:${_}px;max-height:${V}px;overflow:auto;">${b}</div>`,I=`<div class="rte-richtext-wrapper rte-markdown-module-wrapper" data-key="${e.key}">${x}</div>`,A=`<div class="rte-richtext-container rte-markdown-module-container" data-key="${e.key}">${I}</div>`;e.required?T=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper rte-richtext-required">${A}</div>`:T=A}else if(e.type==="datepicker"&&e.key){const K=v[e.key]||"",R=e.placeholder?` data-placeholder="${e.placeholder}"`:"",G=e.limitRange?` data-limit-range="${e.limitRange}"`:"",l=e.disableFuture?' data-disable-future="true"':"",_=`<div data-type="datepicker" data-key="${e.key}" data-value="${K}" class="rte-datepicker-host"${R}${G}${l}></div>`;e.required?T=`<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>${_}</span>`:T=_}else if(e.type==="number-input"&&e.key){const K=v[e.key]||(typeof e.defaultNumber=="number"?String(e.defaultNumber):""),R=typeof e.min=="number"?` min="${e.min}"`:"",G=typeof e.max=="number"?` max="${e.max}"`:"",l=e.placeholder?` placeholder="${e.placeholder}"`:"",_=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",U=' step="1"',V=K||e.placeholder||"";let y=0;for(let I=0;I<V.length;I++){const A=V.charCodeAt(I);A>19968||A>=65280&&A<=65519?y+=16:y+=8}const b=Math.max(44,Math.min(600,y+28)),x=`<input type="number" data-type="number-input" data-key="${e.key}" class="rte-number-input" value="${K}" style="width: ${b}px;"${R}${G}${U}${l}${_} />`;e.required?T=`<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>`:T=x}else if(e.type==="multi-variable"&&e.key){const K=e.maxCount||9,R=D[e.key]||1,G=Math.min(R,K);if(e.required){const l=`<span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>`,_=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"";let U="";for(let V=0;V<G;V++){const y=`${e.key}_${V}`,b=v[y]||"",x=!b,I=x?"":b,A=x?"show-placeholder":"",X=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",J=e.tooltip&&x?"":"hidden",Z=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",ee=`<span contenteditable="true" data-type="variable" data-key="${y}" data-multi-key="${e.key}" data-index="${V}" data-placeholder="${e.placeholder||""}"${Z}${X} class="variable-chip ${A}">${I}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${J}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;V===0?U+=`<span ${_} class="exclusion-wrapper required-upload-group required-multi-first">${l}${ee}</span>`:U+=ee}T=U}else{let l="";for(let _=0;_<G;_++){const U=`${e.key}_${_}`,V=v[U]||"",y=!V,b=y?"":V,x=y?"show-placeholder":"",I=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",A=e.tooltip&&y?"":"hidden",X=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",J=`<span contenteditable="true" data-type="variable" data-key="${U}" data-multi-key="${e.key}" data-index="${_}" data-placeholder="${e.placeholder||""}"${X}${I} class="variable-chip ${x}">${b}${e.tooltip?`<i contenteditable="false" style="font-weight: 100;" class="iconfont icon-tishi variable-info-icon ${A}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" ></i>`:""}</span>`;l+=J}T=l}}const ne=H+T+F;if(e.type==="text"&&!e.className&&!e.exclusionGroup){if(L(e.text)&&S.length>0){const R=S[S.length-1],G=(e.text??"").trim();S[S.length-1]=`<span class="rte-inline-group">${R}${j(G)}</span>`,N++;continue}const K=q(e.text);if(K&&S.length>0){const R=S[S.length-1];S[S.length-1]=`<span class="rte-inline-group">${R}${j(K.punct)}</span>`;const G=K.rest;if(G){const l=G.replace(/\n/g,"<br/>");S.push(`<span data-type="text" contenteditable="false">${l}</span>`)}N++;continue}}S.push(ne),N+=s?2:1}t.current&&(t.current.innerHTML=S.join(""),setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(n=>{const s=n.innerText.replace(/\n/g,"");s.replace(/\u200B/g,"")?n.classList.remove("show-placeholder"):(s!==""&&(n.innerText=""),n.classList.add("show-placeholder"))})},0))}function en(t,f,i,d,v={},D,P,B,M){const L=c.useCallback(()=>{if(!t.current)return;if(f.length===0){t.current.innerHTML="";return}let q={};const S=t.current.__tempVariableValues;if(S?(q=S,setTimeout(()=>{if(t.current){const N=t.current;N.__tempVariableValues===S&&delete N.__tempVariableValues}},100)):(t.current.querySelectorAll('[data-type="variable"]').forEach(H=>{const F=H.dataset.key;if(F){const T=H.innerText.replace(/[\u200B\n]/g,"").trim();T&&(H.getAttribute("data-node-type")==="report-url"?q[`${F}__url`]=T:q[F]=T)}}),t.current.querySelectorAll('[data-type="select"]').forEach(H=>{const F=H.dataset.key;if(F){const T=(H.getAttribute("data-value")||"").trim();T&&(q[F]=T)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(H=>{const F=H.dataset.key;if(F){const T=H.value.replace(/[\u200B]/g,"").trim();T&&(q[F]=T)}}),t.current.querySelectorAll('[data-type="richtext"]').forEach(H=>{const F=H.dataset.key;if(F){const T=H.getAttribute("data-node-type")||"",ne=T==="report-module"?(H.innerHTML||"").replace(/[\u200B]/g,"").trim():(H.textContent||"").replace(/[\u200B]/g,"").trim();if(T==="report-module"){const K=Number.parseInt(H.getAttribute("data-module-index")||"0",10);q[`${F}__module_${Number.isFinite(K)?K:0}`]=ne}else ne&&(q[F]=ne)}}),t.current.querySelectorAll('[data-type="datepicker"]').forEach(H=>{const F=H.dataset.key;if(F){const T=(H.getAttribute("data-value")||"").trim();T&&(q[F]=T)}}),t.current.querySelectorAll('[data-type="number-input"]').forEach(H=>{const F=H.dataset.key;if(F){const T=(H.value||"").trim();T&&(q[F]=T)}})),Rt(t,f,i,d,q,v,B),D?.current){const{key:N,offset:e}=D.current;setTimeout(()=>{if(!t.current)return;const n=t.current.querySelector(`[data-type="variable"][data-key="${N}"]`);if(n){try{const s=document.createRange(),u=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);let E=0,H=null,F=0;for(;u.nextNode();){const T=u.currentNode,ne=T.textContent?.length||0;if(E+ne>=e){H=T,F=e-E;break}E+=ne}if(H){s.setStart(H,Math.min(F,H.textContent?.length||0)),s.collapse(!0);const T=window.getSelection();T&&(T.removeAllRanges(),T.addRange(s),n.focus())}else{s.selectNodeContents(n),s.collapse(!1);const T=window.getSelection();T&&(T.removeAllRanges(),T.addRange(s),n.focus())}}catch{const s=document.createRange();s.selectNodeContents(n),s.collapse(!1);const u=window.getSelection();u&&(u.removeAllRanges(),u.addRange(s),n.focus())}D.current=null}},0)}},[f,i,d,t,v,D,P,B,M]);c.useEffect(()=>{L()},[L])}function tn(t,f,i,d){c.useEffect(()=>{const v=t.current;if(!v)return;const D=M=>M.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(M.name||""),P=M=>{const L=M.target?.closest(".upload-info-icon");if(L&&L.classList.contains("upload-info-icon")){const j=L.dataset.uploadKey;if(j){const S=L.closest('[data-type="upload"]');d(S?{key:j,anchorEl:S,type:"upload"}:{key:j,anchorEl:L,type:"upload"})}return}const q=M.target?.closest('[data-type="upload"]');if(q){const j=q.dataset.key;if(j){const S=i[j];S&&D(S)&&d({key:j,anchorEl:q,type:"upload-preview"})}}},B=M=>{const L=M.target?.closest(".upload-info-icon"),q=M.relatedTarget;if(L&&L.classList.contains("upload-info-icon")){const S=L.closest('[data-type="upload"]');if(q&&S&&S.contains(q))return;if(!q||!v.contains(q))d(null);else{const N=q.closest('[data-type="upload"]');(!N||N!==S)&&d(null)}return}const j=M.target?.closest('[data-type="upload"]');if(j){const S=q;if(S&&j.contains(S))return;d(null)}};return v.addEventListener("mouseover",P,!0),v.addEventListener("mouseout",B,!0),()=>{v.removeEventListener("mouseover",P,!0),v.removeEventListener("mouseout",B,!0)}},[f,i,t,d])}function nn(t,f,i,d){c.useEffect(()=>{if(!t.current)return;const v=M=>{if(d==="hideTagClose")return;const L=M.currentTarget,q=L.dataset.tooltip,j=L.dataset.tagKey||"";q&&i({key:j,anchorEl:L,type:"tag"})},D=()=>{i(null)};let P;const B=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(L=>{L.addEventListener("mouseenter",v),L.addEventListener("mouseleave",D)})};return P=requestAnimationFrame(()=>{P=requestAnimationFrame(B)}),()=>{cancelAnimationFrame(P),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(L=>{L.removeEventListener("mouseenter",v),L.removeEventListener("mouseleave",D)})}},[f,t,i,d])}function rn(t,f,i){c.useEffect(()=>{const d=t.current;if(!d)return;const v=P=>{const B=P.target?.closest(".variable-info-icon");if(B&&B.classList.contains("variable-info-icon")){const L=B.dataset.variableKey;L&&i({key:L,anchorEl:B,type:"variable"});return}const M=P.target?.closest('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(M){const L=M.dataset.key;L&&i({key:L,anchorEl:M,type:"variable"})}},D=P=>{const B=P.target,M=P.relatedTarget,L=B?.closest?.(".variable-info-icon"),q=B?.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');if(L||q){if(!M||!d.contains(M)){i(null);return}const j=!!M.closest?.(".variable-info-icon"),S=!!M.closest?.('[data-type="variable"][data-node-type="report-url"][data-tooltip]');!j&&!S&&i(null)}};return d.addEventListener("mouseover",v,!0),d.addEventListener("mouseout",D,!0),()=>{d.removeEventListener("mouseover",v,!0),d.removeEventListener("mouseout",D,!0)}},[f,t,i])}function an(t,f,i,d){c.useEffect(()=>{if(!t.current)return;const v=L=>L.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(L.name||""),D=L=>{const q=L.currentTarget,j=q.dataset.fileName,S=q.closest('[data-type="upload"]'),N=S?.dataset.key||"",e=N?i[N]:null;if(e&&v(e)){d({key:N,anchorEl:S||q,type:"upload-preview"});return}j&&d({key:N,anchorEl:S||q,type:"upload-label"})},P=()=>{d(null)};let B;const M=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(q=>{q.addEventListener("mouseenter",D),q.addEventListener("mouseleave",P)})};return B=requestAnimationFrame(()=>{B=requestAnimationFrame(M)}),()=>{cancelAnimationFrame(B),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(q=>{q.removeEventListener("mouseenter",D),q.removeEventListener("mouseleave",P)})}},[f,i,t,d])}function on(t,f,i,d){c.useEffect(()=>{const v=setTimeout(()=>{Je(t,f,i),Qe(t,f,i,d)},0);return()=>clearTimeout(v)},[i,f,t,d])}function sn(t,f){const i=c.useRef(0),d=c.useRef(0);c.useEffect(()=>{if(!t.current)return;let v=!1,D=0;const P=E=>E instanceof HTMLElement?!!(E.closest(".rte-datepicker-wrapper")||E.closest(".rte-datepicker-host")||E.closest(".ant-picker")||E.closest(".ant-picker-dropdown")):!1,B=E=>E instanceof HTMLElement?!!(E.closest(".rte-select-wrapper")||E.closest(".rte-select-host")||E.closest(".ant-select")||E.closest(".ant-select-dropdown")):!1,M=E=>{v=!0,P(E.target)&&(i.current=Date.now(),console.log("[SelectionCtrl] mousedown on datepicker target")),B(E.target)&&(d.current=Date.now(),console.log("[SelectionCtrl] mousedown on select target"))},L=()=>{v=!1,D=Date.now()};let q=!1,j=0;const S=()=>{q=!0},N=()=>{q=!1,j=Date.now()},e=()=>{j=Date.now()},n=E=>{P(E.target)&&(i.current=Date.now(),console.log("[SelectionCtrl] focusin datepicker target")),B(E.target)&&(d.current=Date.now(),console.log("[SelectionCtrl] focusin select target"))},s=()=>{if(Date.now()-i.current<800||Date.now()-d.current<800){console.log("[SelectionCtrl] skip selectionchange due to recent picker/select interaction");return}const E=document.activeElement;if(E&&(E.closest(".rte-datepicker-wrapper")||E.closest(".rte-datepicker-host")||E.closest(".ant-picker-dropdown")||E.tagName==="INPUT"&&E.closest(".ant-picker")||E.closest(".rte-select-wrapper")||E.closest(".rte-select-host")||E.closest(".ant-select")||E.closest(".ant-select-dropdown"))){console.log("[SelectionCtrl] activeElement is picker/select; skip");return}if(!t.current)return;const H=window.getSelection();if(!H||H.rangeCount===0||f.current||v||q||Date.now()-j<500)return;const F=H.getRangeAt(0);if(!F.collapsed)return t.current.contains(F.commonAncestorContainer),void 0;const T=H.anchorNode;if(!T||!t.current.contains(T))return;let ne=!1,K=!1;if(T.nodeType===Node.ELEMENT_NODE){const G=T;(G.closest('[data-type="datepicker"]')||G.closest(".rte-datepicker-wrapper")||G.closest(".rte-datepicker-host"))&&(ne=!0),(G.closest('[data-type="select"]')||G.closest(".rte-select-wrapper")||G.closest(".rte-select-host"))&&(K=!0)}else if(T.parentElement){const G=T.parentElement;(G.closest('[data-type="datepicker"]')||G.closest(".rte-datepicker-wrapper")||G.closest(".rte-datepicker-host"))&&(ne=!0),(G.closest('[data-type="select"]')||G.closest(".rte-select-wrapper")||G.closest(".rte-select-host"))&&(K=!0)}if(ne||K)return;let R=null;if(T.nodeType===Node.ELEMENT_NODE?R=T.closest('[data-type="variable"]'):T.nodeType===Node.TEXT_NODE&&T.parentElement&&(R=T.parentElement.closest('[data-type="variable"]')),!R){if(Date.now()-D>500)return;const G=t.current.querySelectorAll('[data-type="variable"]');if(G.length>0){let l=null;for(const _ of Array.from(G))if(_.style.display!=="none"){l=_;break}if(!l&&G.length>0&&(l=G[0]),l){const _=document.createRange();_.selectNodeContents(l),_.collapse(!1),H.removeAllRanges(),H.addRange(_),l.focus()}else H.removeAllRanges()}else H.removeAllRanges()}},u=t.current;return u&&(u.addEventListener("compositionstart",S),u.addEventListener("compositionend",N),u.addEventListener("input",e)),document.addEventListener("mousedown",M),document.addEventListener("mouseup",L),document.addEventListener("focusin",n),document.addEventListener("selectionchange",s),()=>{const E=t.current;E&&(E.removeEventListener("compositionstart",S),E.removeEventListener("compositionend",N),E.removeEventListener("input",e)),document.removeEventListener("mousedown",M),document.removeEventListener("mouseup",L),document.removeEventListener("focusin",n),document.removeEventListener("selectionchange",s)}},[t,f])}function ln(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fe={exports:{}},cn=Fe.exports,kt;function $t(){return kt||(kt=1,function(t,f){(function(i,d){t.exports=d()})(cn,function(){var i=1e3,d=6e4,v=36e5,D="millisecond",P="second",B="minute",M="hour",L="day",q="week",j="month",S="quarter",N="year",e="date",n="Invalid Date",s=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,u=/\[([^\]]+)]|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,E={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(y){var b=["th","st","nd","rd"],x=y%100;return"["+y+(b[(x-20)%10]||b[x]||b[0])+"]"}},H=function(y,b,x){var I=String(y);return!I||I.length>=b?y:""+Array(b+1-I.length).join(x)+y},F={s:H,z:function(y){var b=-y.utcOffset(),x=Math.abs(b),I=Math.floor(x/60),A=x%60;return(b<=0?"+":"-")+H(I,2,"0")+":"+H(A,2,"0")},m:function y(b,x){if(b.date()<x.date())return-y(x,b);var I=12*(x.year()-b.year())+(x.month()-b.month()),A=b.clone().add(I,j),X=x-A<0,J=b.clone().add(I+(X?-1:1),j);return+(-(I+(x-A)/(X?A-J:J-A))||0)},a:function(y){return y<0?Math.ceil(y)||0:Math.floor(y)},p:function(y){return{M:j,y:N,w:q,d:L,D:e,h:M,m:B,s:P,ms:D,Q:S}[y]||String(y||"").toLowerCase().replace(/s$/,"")},u:function(y){return y===void 0}},T="en",ne={};ne[T]=E;var K="$isDayjsObject",R=function(y){return y instanceof U||!(!y||!y[K])},G=function y(b,x,I){var A;if(!b)return T;if(typeof b=="string"){var X=b.toLowerCase();ne[X]&&(A=X),x&&(ne[X]=x,A=X);var J=b.split("-");if(!A&&J.length>1)return y(J[0])}else{var Z=b.name;ne[Z]=b,A=Z}return!I&&A&&(T=A),A||!I&&T},l=function(y,b){if(R(y))return y.clone();var x=typeof b=="object"?b:{};return x.date=y,x.args=arguments,new U(x)},_=F;_.l=G,_.i=R,_.w=function(y,b){return l(y,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var U=function(){function y(x){this.$L=G(x.locale,null,!0),this.parse(x),this.$x=this.$x||x.x||{},this[K]=!0}var b=y.prototype;return b.parse=function(x){this.$d=function(I){var A=I.date,X=I.utc;if(A===null)return new Date(NaN);if(_.u(A))return new Date;if(A instanceof Date)return new Date(A);if(typeof A=="string"&&!/Z$/i.test(A)){var J=A.match(s);if(J){var Z=J[2]-1||0,ee=(J[7]||"0").substring(0,3);return X?new Date(Date.UTC(J[1],Z,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)):new Date(J[1],Z,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)}}return new Date(A)}(x),this.init()},b.init=function(){var x=this.$d;this.$y=x.getFullYear(),this.$M=x.getMonth(),this.$D=x.getDate(),this.$W=x.getDay(),this.$H=x.getHours(),this.$m=x.getMinutes(),this.$s=x.getSeconds(),this.$ms=x.getMilliseconds()},b.$utils=function(){return _},b.isValid=function(){return this.$d.toString()!==n},b.isSame=function(x,I){var A=l(x);return this.startOf(I)<=A&&A<=this.endOf(I)},b.isAfter=function(x,I){return l(x)<this.startOf(I)},b.isBefore=function(x,I){return this.endOf(I)<l(x)},b.$g=function(x,I,A){return _.u(x)?this[I]:this.set(A,x)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(x,I){var A=this,X=!!_.u(I)||I,J=_.p(x),Z=function(ge,be){var ke=_.w(A.$u?Date.UTC(A.$y,be,ge):new Date(A.$y,be,ge),A);return X?ke:ke.endOf(L)},ee=function(ge,be){return _.w(A.toDate()[ge].apply(A.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(be)),A)},se=this.$W,ie=this.$M,ue=this.$D,he="set"+(this.$u?"UTC":"");switch(J){case N:return X?Z(1,0):Z(31,11);case j:return X?Z(1,ie):Z(0,ie+1);case q:var re=this.$locale().weekStart||0,me=(se<re?se+7:se)-re;return Z(X?ue-me:ue+(6-me),ie);case L:case e:return ee(he+"Hours",0);case M:return ee(he+"Minutes",1);case B:return ee(he+"Seconds",2);case P:return ee(he+"Milliseconds",3);default:return this.clone()}},b.endOf=function(x){return this.startOf(x,!1)},b.$set=function(x,I){var A,X=_.p(x),J="set"+(this.$u?"UTC":""),Z=(A={},A[L]=J+"Date",A[e]=J+"Date",A[j]=J+"Month",A[N]=J+"FullYear",A[M]=J+"Hours",A[B]=J+"Minutes",A[P]=J+"Seconds",A[D]=J+"Milliseconds",A)[X],ee=X===L?this.$D+(I-this.$W):I;if(X===j||X===N){var se=this.clone().set(e,1);se.$d[Z](ee),se.init(),this.$d=se.set(e,Math.min(this.$D,se.daysInMonth())).$d}else Z&&this.$d[Z](ee);return this.init(),this},b.set=function(x,I){return this.clone().$set(x,I)},b.get=function(x){return this[_.p(x)]()},b.add=function(x,I){var A,X=this;x=Number(x);var J=_.p(I),Z=function(ie){var ue=l(X);return _.w(ue.date(ue.date()+Math.round(ie*x)),X)};if(J===j)return this.set(j,this.$M+x);if(J===N)return this.set(N,this.$y+x);if(J===L)return Z(1);if(J===q)return Z(7);var ee=(A={},A[B]=d,A[M]=v,A[P]=i,A)[J]||1,se=this.$d.getTime()+x*ee;return _.w(se,this)},b.subtract=function(x,I){return this.add(-1*x,I)},b.format=function(x){var I=this,A=this.$locale();if(!this.isValid())return A.invalidDate||n;var X=x||"YYYY-MM-DDTHH:mm:ssZ",J=_.z(this),Z=this.$H,ee=this.$m,se=this.$M,ie=A.weekdays,ue=A.months,he=A.meridiem,re=function(be,ke,qe,Ie){return be&&(be[ke]||be(I,X))||qe[ke].slice(0,Ie)},me=function(be){return _.s(Z%12||12,be,"0")},ge=he||function(be,ke,qe){var Ie=be<12?"AM":"PM";return qe?Ie.toLowerCase():Ie};return X.replace(u,function(be,ke){return ke||function(qe){switch(qe){case"YY":return String(I.$y).slice(-2);case"YYYY":return _.s(I.$y,4,"0");case"M":return se+1;case"MM":return _.s(se+1,2,"0");case"MMM":return re(A.monthsShort,se,ue,3);case"MMMM":return re(ue,se);case"D":return I.$D;case"DD":return _.s(I.$D,2,"0");case"d":return String(I.$W);case"dd":return re(A.weekdaysMin,I.$W,ie,2);case"ddd":return re(A.weekdaysShort,I.$W,ie,3);case"dddd":return ie[I.$W];case"H":return String(Z);case"HH":return _.s(Z,2,"0");case"h":return me(1);case"hh":return me(2);case"a":return ge(Z,ee,!0);case"A":return ge(Z,ee,!1);case"m":return String(ee);case"mm":return _.s(ee,2,"0");case"s":return String(I.$s);case"ss":return _.s(I.$s,2,"0");case"SSS":return _.s(I.$ms,3,"0");case"Z":return J}return null}(be)||J.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(x,I,A){var X,J=this,Z=_.p(I),ee=l(x),se=(ee.utcOffset()-this.utcOffset())*d,ie=this-ee,ue=function(){return _.m(J,ee)};switch(Z){case N:X=ue()/12;break;case j:X=ue();break;case S:X=ue()/3;break;case q:X=(ie-se)/6048e5;break;case L:X=(ie-se)/864e5;break;case M:X=ie/v;break;case B:X=ie/d;break;case P:X=ie/i;break;default:X=ie}return A?X:_.a(X)},b.daysInMonth=function(){return this.endOf(j).$D},b.$locale=function(){return ne[this.$L]},b.locale=function(x,I){if(!x)return this.$L;var A=this.clone(),X=G(x,I,!0);return X&&(A.$L=X),A},b.clone=function(){return _.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},y}(),V=U.prototype;return l.prototype=V,[["$ms",D],["$s",P],["$m",B],["$H",M],["$W",L],["$M",j],["$y",N],["$D",e]].forEach(function(y){V[y[1]]=function(b){return this.$g(b,y[0],y[1])}}),l.extend=function(y,b){return y.$i||(y(b,U,l),y.$i=!0),l},l.locale=G,l.isDayjs=R,l.unix=function(y){return l(1e3*y)},l.en=ne[T],l.Ls=ne,l.p={},l})}(Fe)),Fe.exports}var un=$t();const Ge=ln(un);var ze={exports:{}},dn=ze.exports,Et;function pn(){return Et||(Et=1,function(t,f){(function(i,d){t.exports=d($t())})(dn,function(i){function d(P){return P&&typeof P=="object"&&"default"in P?P:{default:P}}var v=d(i),D={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(P,B){return B==="W"?P+"周":P+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(P,B){var M=100*P+B;return M<600?"凌晨":M<900?"早上":M<1100?"上午":M<1300?"中午":M<1800?"下午":"晚上"}};return v.default.locale(D,null,!0),D})}(ze)),ze.exports}pn();function Pe(t){"@babel/helpers - typeof";return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},Pe(t)}function fn(t,f){if(Pe(t)!="object"||!t)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var d=i.call(t,f);if(Pe(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(t)}function mn(t){var f=fn(t,"string");return Pe(f)=="symbol"?f:f+""}function yn(t,f,i){return(f=mn(f))in t?Object.defineProperty(t,f,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[f]=i,t}function Ct(t,f){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);f&&(d=d.filter(function(v){return Object.getOwnPropertyDescriptor(t,v).enumerable})),i.push.apply(i,d)}return i}function St(t){for(var f=1;f<arguments.length;f++){var i=arguments[f]!=null?arguments[f]:{};f%2?Ct(Object(i),!0).forEach(function(d){yn(t,d,i[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ct(Object(i)).forEach(function(d){Object.defineProperty(t,d,Object.getOwnPropertyDescriptor(i,d))})}return t}var hn={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},gn=St(St({},hn),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});const bn={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Tt={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},gn),timePickerLocale:Object.assign({},bn)};Tt.lang.ok="确定",Ge.locale("zh-cn");const{RangePicker:xn}=oe.DatePicker,vn=({host:t,onChange:f})=>{const i=t.dataset.key,d=t.dataset.value,v=t.dataset.placeholder,D=t.dataset.limitRange?parseInt(t.dataset.limitRange,10):void 0,P=t.dataset.disableFuture==="true",[B,M]=c.useState(()=>{if(!d)return null;const n=d.split(",");return n.length===2&&n[0]&&n[1]?[Ge(n[0]),Ge(n[1])]:null}),[L,q]=c.useState(null),j=n=>n?P&&n.isAfter(Ge(),"day")?!0:!D||!L||!L[0]?!1:Math.abs(n.diff(L[0],"days"))>D:!1,S=n=>{console.log("[DatePicker] onCalendarChange",n?.map(s=>s?.format("YYYY-MM-DD")||null)),q(n)},N=n=>{if(console.log("[DatePicker] onChange",n?.map(s=>s?.format("YYYY-MM-DD")||null)),M(n),q(null),n&&n[0]&&n[1]){const s=`${n[0].format("YYYY-MM-DD")},${n[1].format("YYYY-MM-DD")}`;t.setAttribute("data-value",s),f(i,s)}else t.setAttribute("data-value",""),f(i,"")},e=n=>{console.log("[DatePicker] onOpenChange",n),q(n?B:null)};return Xe.createPortal(w.jsx("div",{className:"rte-datepicker-wrapper",contentEditable:!1,style:{display:"inline-block",verticalAlign:"middle",width:"260px",marginLeft:"4px",marginRight:"4px",fontSize:"16px",height:"30px",lineHeight:"30px"},children:w.jsx(xn,{value:B,disabledDate:j,onCalendarChange:S,onChange:N,onOpenChange:e,placeholder:[v||"开始日期",v||"结束日期"],style:{width:"100%"},size:"small",allowClear:!0,locale:Tt,getPopupContainer:()=>document.body,popupClassName:"rte-datepicker-dropdown"})}),t)},wn=t=>{const[f,i]=c.useState([]);return c.useEffect(()=>{const d=t.current;if(!d)return;const v=()=>{const P=d.querySelectorAll(".rte-datepicker-host"),B=[];P.forEach(M=>{const L=M.getAttribute("data-key");L&&B.push(w.jsx(vn,{host:M,onChange:()=>{if(t.current){const q=new Event("input",{bubbles:!0});t.current.dispatchEvent(q)}}},`datepicker-${L}`))}),i(B)};v();const D=new MutationObserver(P=>{let B=!1;for(const M of P)if(M.type==="childList"){let L=!1;if(M.addedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-datepicker-host")||j.querySelector?.(".rte-datepicker-host"))&&(L=!0)}}),M.removedNodes.forEach(q=>{if(q.nodeType===Node.ELEMENT_NODE){const j=q;(j.classList?.contains("rte-datepicker-host")||j.querySelector?.(".rte-datepicker-host"))&&(L=!0)}}),L){B=!0;break}}B&&v()});return D.observe(d,{childList:!0,subtree:!0}),()=>D.disconnect()},[t]),f},He=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),At=t=>`\`\`\`
|
|
3
3
|
${(t||"").replace(/\r\n/g,`
|
|
4
4
|
`)}
|
|
5
5
|
\`\`\``,qt=t=>{const f=(t||"").replace(/\r\n/g,`
|
|
6
|
-
`).trim(),i=f.match(/^```[a-zA-Z0-9_-]*\n([\s\S]*?)\n```$/);return i?`<pre><code>${He(i[1]||"")}</code></pre>`:`<div style="white-space:pre-wrap;">${He(f)}</div>`},Nt=({config:t,onSend:f,isProcessing:i=!1,disabled:d=!1,width:v,lockStructure:D=!1,agentOptions:P=[],onAgentSelect:B,onAgentExit:M,loading:L=!1,placeholder:q,border:j,background:S="transparent",hideButtons:N,maxHeight:e,minHeight:n,collapsed:s=!1,reportAnalyze:u,markdownAnalyze:E,onCollapsedChange:H,collapseTransitionMs:F=260})=>{const[T,ne]=oe.message.useMessage(),K=c.useRef(null),
|
|
6
|
+
`).trim(),i=f.match(/^```[a-zA-Z0-9_-]*\n([\s\S]*?)\n```$/);return i?`<pre><code>${He(i[1]||"")}</code></pre>`:`<div style="white-space:pre-wrap;">${He(f)}</div>`},Nt=({config:t,onSend:f,isProcessing:i=!1,disabled:d=!1,width:v,lockStructure:D=!1,agentOptions:P=[],onAgentSelect:B,onAgentExit:M,loading:L=!1,placeholder:q,border:j,background:S="transparent",hideButtons:N,maxHeight:e,minHeight:n,collapsed:s=!1,reportAnalyze:u,markdownAnalyze:E,onCollapsedChange:H,collapseTransitionMs:F=260})=>{const[T,ne]=oe.message.useMessage(),K=c.useRef(null),R=c.useRef(null),G=c.useRef(null),l=c.useRef(null),_=c.useRef(null),U=c.useRef("");if(!U.current){const r=Math.random().toString(36).slice(2,8);U.current=`rte_${r}`}const[V,y]=c.useState({}),[b,x]=c.useState(null),[I,A]=c.useState(null),[X,J]=c.useState(null),[Z,ee]=c.useState(null),se=c.useRef(!1),ie=c.useRef(null),[ue,he]=c.useState(!1),re=c.useRef(null),[me,ge]=c.useState(!0),be=c.useRef(0),[ke,qe]=c.useState(58),[Ie,Ln]=c.useState(58),[In,tt]=c.useState(!1),[je,Ve]=c.useState({}),nt=c.useRef(()=>{}),[$e,Ee]=c.useState({}),We=c.useRef(()=>{}),Vt=c.useRef({}),rt=c.useRef($e);c.useEffect(()=>{rt.current=$e},[$e]);const[Ce,Ae]=c.useState(()=>{const r={};return t.forEach(a=>{a.type==="multi-variable"&&a.key&&(r[a.key]=1)}),r}),at=c.useRef({}),Ot=c.useRef({}),Ft=c.useRef({});c.useEffect(()=>{Ot.current=V},[V]),c.useEffect(()=>{Ft.current=Ce},[Ce]);const ot=c.useCallback(r=>r.find(o=>o.type==="tag")?.text||null,[]),Gt=c.useRef(t),Ne=c.useRef(null);c.useEffect(()=>{const r=ot(Gt.current),a=ot(t);if(r&&r!==a&&l.current){const o={};l.current.querySelectorAll('[data-type="variable"]').forEach(p=>{const O=p.dataset.key;if(O){const C=p.innerText.replace(/[\u200B\n]/g,"").trim();C&&(o[O]=C)}}),l.current.querySelectorAll('[data-type="select"]').forEach(p=>{const O=p.dataset.key;if(O){const C=(p.getAttribute("data-value")||"").trim();C&&(o[O]=C)}}),l.current.querySelectorAll('[data-type="textarea"]').forEach(p=>{const O=p.dataset.key;if(O){const C=p.value.replace(/[\u200B]/g,"").trim();C&&(o[O]=C)}}),at.current[r]={variableValues:o,files:{...Ot.current},multiVariableCounts:{...Ft.current}}}if(a&&at.current[a]){const o=at.current[a];Ne.current=o,y(o.files),Ae(o.multiVariableCounts)}else if(a){Ne.current=null;const o={};t.forEach(m=>{m.type==="multi-variable"&&m.key&&(o[m.key]=1)}),Ae(o),y({})}else Ne.current=null,Ae({}),y({});Gt.current=t},[t,ot]),c.useLayoutEffect(()=>{Ne.current&&l.current&&(l.current.__tempVariableValues=Ne.current.variableValues,setTimeout(()=>{Ne.current&&(Ne.current=null)},0))});const xe=c.useMemo(()=>{if(t.length===0)return t;const r=[];for(const a of t){if(a.type==="markdown"&&a.key==="tableData"||r.push(a),a.type==="report-url"&&a.key){const o=je[a.key],m=o?.status??"idle",h=o?.modules??[];m==="loading"&&r.push({type:"text",className:"rte-report-parsing",text:`解析中...
|
|
7
7
|
`}),m==="error"&&o?.error&&r.push({type:"text",className:"rte-report-error",text:`解析失败:${He(o.error)}
|
|
8
8
|
`}),h.length>0&&(h.forEach((k,p)=>{r.push({type:"report-module",key:a.key,moduleIndex:p,placeholder:"可编辑,内容不能为空",required:!0,minHeight:80,maxHeight:260,text:k.content})}),r.push({type:"text",text:`
|
|
9
9
|
`}))}if(a.type==="markdown"&&a.key){const o=$e[a.key],m=o?.status??"idle",h=o?.modules??[];a.key==="tableData"?m==="loading"?(r.push({type:"text",className:"rte-markdown-parsing",text:"解析中..."}),r.push({type:"text",text:`
|
|
@@ -13,7 +13,7 @@ ${(t||"").replace(/\r\n/g,`
|
|
|
13
13
|
`}):m==="error"&&o?.error&&r.push({type:"text",className:"rte-markdown-error",text:`解析失败:${He(o.error)}
|
|
14
14
|
`}),h.length>0&&m!=="loading"&&h.forEach((p,O)=>{r.push({type:"markdown-module",key:a.key,moduleIndex:O,placeholder:"可编辑,内容不能为空",required:!0,minHeight:80,maxHeight:260,text:p.content})}),m!=="loading"&&r.push({type:"text",text:`
|
|
15
15
|
`}))}}return r},[t,$e,je]),zt=c.useCallback(r=>{const a=r.trim();if(!a)return{url:""};let o=null;try{o=new URL(a)}catch{try{o=new URL(`https://${a}`)}catch{return{url:a}}}const m=o.pathname.split("/").filter(Boolean),h=m.findIndex(C=>C==="report"),k=h>=0?m[h+1]:void 0,p=m[0]&&m[0].length<=5?m[0]:void 0,O=o.searchParams.get("agentId")||void 0;return{url:a,reportId:k,agentId:O,lang:p}},[]),Oe=c.useCallback(()=>{const r={};if(!l.current)return r;const a=l.current;return a.querySelectorAll('[data-type="variable"]').forEach(o=>{const m=o.dataset.key;if(!m)return;const h=o.innerText.replace(/[\u200B\n]/g,"").trim();h&&(r[m]=h)}),a.querySelectorAll('[data-type="select"]').forEach(o=>{const m=o.dataset.key;if(!m)return;const h=(o.getAttribute("data-value")||"").trim();h&&(r[m]=h)}),a.querySelectorAll('[data-type="textarea"]').forEach(o=>{const m=o.dataset.key;if(!m)return;const h=o.value.replace(/[\u200B]/g,"").trim();h&&(r[m]=h)}),a.querySelectorAll('[data-type="richtext"]').forEach(o=>{const m=o.dataset.key;if(!m)return;const h=o.getAttribute("data-node-type")||"";if(h==="report-module"||h==="markdown-module"){const p=Number.parseInt(o.getAttribute("data-module-index")||"0",10),O=(o.innerHTML||"").replace(/[\u200B]/g,"").trim();r[`${m}__module_${Number.isFinite(p)?p:0}`]=O;return}const k=(o.textContent||"").replace(/[\u200B]/g,"").trim();k&&(r[m]=k)}),a.querySelectorAll('[data-type="datepicker"]').forEach(o=>{const m=o.dataset.key;if(!m)return;const h=(o.getAttribute("data-value")||"").trim();h&&(r[m]=h)}),a.querySelectorAll('[data-type="number-input"]').forEach(o=>{const m=o.dataset.key;if(!m)return;const h=(o.value||"").trim();h&&(r[m]=h)}),r},[]),jt=c.useCallback(r=>(r?.modules||[]).map((a,o)=>{const m=(a?.title||`模块${o+1}`).trim()||`模块${o+1}`,h=(a?.content||"").trim();return{title:m,content:h.length>0?h:`请补充:${m}`}}),[]),st=c.useCallback(r=>(r?.modules||[]).map((a,o)=>{const m=(a?.title||`模块${o+1}`).trim()||`模块${o+1}`,h=(a?.markdown||"").trim(),k=(a?.content||"").trim()||(h?qt(h):"");return{title:m,content:k.length>0?k:`请补充:${m}`,markdown:h}}),[]),Wt=c.useCallback((r,a)=>{const o=(a||"").trim();if(!r)return;if(!o){Ve(p=>({...p,[r]:{status:"idle",modules:[],lastParsedUrl:void 0,error:void 0}}));return}const m=je[r];if(m?.lastParsedUrl&&m.lastParsedUrl===o&&m.status==="loading")return;Ve(p=>({...p,[r]:{...p[r],status:"loading",error:void 0,lastParsedUrl:o}}));const h=zt(o);(u||(async p=>({modules:[{title:"第1张:人群+场景直击图",content:`视觉要求:养宠人在客厅场景中,宠物(猫/狗)自然趴在旁;画面聚焦“人+宠+整洁氛围”。
|
|
16
|
-
(reportId=${p.reportId||"unknown"}, agentId=${p.agentId||"1"})`},{title:"第2张:痛点放大对比图",content:"左侧:杂乱堆放、难清理;右侧:分区收纳、拿取方便。文案≤15字,绑定人群+场景+需求。"}]})))(h).then(p=>{const O=jt(p);if(l.current){const C=Oe();O.forEach(($,z)=>{C[`${r}__module_${z}`]=$.content}),l.current.__tempVariableValues=C}Ve(C=>({...C,[r]:{status:"success",error:void 0,lastParsedUrl:o,modules:O}}))}).catch(p=>{const O=p instanceof Error?p.message:String(p);Ve(C=>({...C,[r]:{...C[r]||{modules:[]},status:"error",error:O||"解析失败",lastParsedUrl:o,modules:[]}}))})},[Oe,jt,zt,u,je]),Yt=c.useCallback((r,a)=>{const o=(a||"").trim();if(!r)return;if(!o){Ee(C=>({...C,[r]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}));return}const m=$e[r];if(m?.lastParsedText&&m.lastParsedText===o&&m.status==="success")return;if(!E){const C=At(o),$=st({modules:[{title:"内容",content:qt(C),markdown:C}]});if(l.current){const z=Oe();$.forEach((g,Y)=>{z[`${r}__module_${Y}`]=g.content}),l.current.__tempVariableValues=z}Ee(z=>({...z,[r]:{status:"success",error:void 0,lastParsedText:o,modules:$}}));return}const h=rt.current[r]?.status==="loading";h||Ee(C=>({...C,[r]:{...C[r],status:"loading",error:void 0,lastParsedText:o}}));const k=500,p=Date.now();setTimeout(()=>{E({text:o}).then($=>{const z=st($),g=Date.now()-p,Y=Math.max(0,k-g);setTimeout(()=>{if(l.current){const
|
|
16
|
+
(reportId=${p.reportId||"unknown"}, agentId=${p.agentId||"1"})`},{title:"第2张:痛点放大对比图",content:"左侧:杂乱堆放、难清理;右侧:分区收纳、拿取方便。文案≤15字,绑定人群+场景+需求。"}]})))(h).then(p=>{const O=jt(p);if(l.current){const C=Oe();O.forEach(($,z)=>{C[`${r}__module_${z}`]=$.content}),l.current.__tempVariableValues=C}Ve(C=>({...C,[r]:{status:"success",error:void 0,lastParsedUrl:o,modules:O}}))}).catch(p=>{const O=p instanceof Error?p.message:String(p);Ve(C=>({...C,[r]:{...C[r]||{modules:[]},status:"error",error:O||"解析失败",lastParsedUrl:o,modules:[]}}))})},[Oe,jt,zt,u,je]),Yt=c.useCallback((r,a)=>{const o=(a||"").trim();if(!r)return;if(!o){Ee(C=>({...C,[r]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}));return}const m=$e[r];if(m?.lastParsedText&&m.lastParsedText===o&&m.status==="success")return;if(!E){const C=At(o),$=st({modules:[{title:"内容",content:qt(C),markdown:C}]});if(l.current){const z=Oe();$.forEach((g,Y)=>{z[`${r}__module_${Y}`]=g.content}),l.current.__tempVariableValues=z}Ee(z=>({...z,[r]:{status:"success",error:void 0,lastParsedText:o,modules:$}}));return}const h=rt.current[r]?.status==="loading";h||Ee(C=>({...C,[r]:{...C[r],status:"loading",error:void 0,lastParsedText:o}}));const k=500,p=Date.now();setTimeout(()=>{E({text:o}).then($=>{const z=st($),g=Date.now()-p,Y=Math.max(0,k-g);setTimeout(()=>{if(l.current){const Q=Oe();z.forEach((W,te)=>{Q[`${r}__module_${te}`]=W.content}),l.current.__tempVariableValues=Q}Ee(Q=>({...Q,[r]:{status:"success",error:void 0,lastParsedText:o,modules:z}}))},Y)}).catch($=>{const z=$ instanceof Error?$.message:String($);Ee(g=>({...g,[r]:{...g[r]||{modules:[]},status:"error",error:z,lastParsedText:o}}))})},h?0:50)},[Oe,E,$e,st]);c.useEffect(()=>{nt.current=Wt},[Wt]),c.useEffect(()=>{We.current=Yt},[Yt]),c.useLayoutEffect(()=>{if(!l.current)return;const r=new Map,a=window.setTimeout(()=>{if(!l.current)return;r.forEach((h,k)=>k.removeEventListener("blur",h,!1)),r.clear();const o=l.current.querySelectorAll('[data-type="variable"][data-node-type="report-url"], [data-type="variable"][data-node-type="markdown"]'),m=h=>{h.stopPropagation(),h.stopImmediatePropagation();const k=h.target?.closest('[data-type="variable"][data-node-type="report-url"], [data-type="variable"][data-node-type="markdown"]');if(!k||!l.current||!l.current.contains(k))return;const p=k.dataset.key;if(!p)return;const O=k.innerText.replace(/[\u200B\n]/g,"").trim(),C=k.getAttribute("data-node-type")||"";C==="report-url"?nt.current(p,O):C==="markdown"&&We.current(p,O)};o.forEach(h=>{h.addEventListener("blur",m,!1),r.set(h,m)})},0);return()=>{window.clearTimeout(a),r.forEach((o,m)=>m.removeEventListener("blur",o,!1)),r.clear()}},[xe]),c.useLayoutEffect(()=>{if(!l.current)return;const r=new Map,a=new Map,o=C=>{const $=C.value||C.placeholder||"",z=window.getComputedStyle(C),g=Number.parseFloat(z.paddingLeft)||0,Y=Number.parseFloat(z.paddingRight)||0,Q=document.createElement("span");Q.style.cssText=`
|
|
17
17
|
position: absolute;
|
|
18
18
|
visibility: hidden;
|
|
19
19
|
white-space: nowrap;
|
|
@@ -23,17 +23,17 @@ ${(t||"").replace(/\r\n/g,`
|
|
|
23
23
|
letter-spacing: ${z.letterSpacing||"normal"};
|
|
24
24
|
padding-left: ${g}px;
|
|
25
25
|
padding-right: ${Y}px;
|
|
26
|
-
`,Z.textContent=$||"0",document.body.appendChild(Z);const W=Math.max(44,Math.min(600,Z.offsetWidth+8));return document.body.removeChild(Z),W},m=C=>{const $=C.target;if(!$)return;let z=$.value;if(z=z.replace(/[^\d]/g,""),z!==""&&z!=="0"){const g=parseInt(z,10);if(Number.isNaN(g))$.value="";else{const Y=$.getAttribute("min"),Z=$.getAttribute("max"),W=Y!==null?parseInt(Y,10):0,te=Z!==null?parseInt(Z,10):1/0,ae=Math.min(Math.max(g,W),te);$.value=String(ae)}}else if(z==="0"){const g=$.getAttribute("min");0<(g!==null?parseInt(g,10):0)?$.value="":$.value="0"}$.style.width=`${o($)}px`},h=C=>{const $=C.key;($==="-"||$==="."||$===","||$==="e"||$==="E"||$==="+"||$==="="||$===" ")&&C.preventDefault()},k=()=>{if(!l.current)return;l.current.querySelectorAll('[data-type="number-input"]').forEach($=>{const z=$.style.width,g=`${o($)}px`;z!==g&&($.style.width=g),r.has($)||($.addEventListener("input",m,!1),$.addEventListener("keydown",h,!1),r.set($,m),a.set($,h))})},p=window.setTimeout(()=>{k()},0),O=new MutationObserver(C=>{let $=!1;C.forEach(z=>{z.type==="childList"&&z.addedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const Y=g;Y.matches&&(Y.matches('[data-type="number-input"]')||Y.querySelector('[data-type="number-input"]'))&&($=!0)}})}),$&&setTimeout(k,10)});return l.current&&O.observe(l.current,{childList:!0,subtree:!0}),()=>{window.clearTimeout(p),O.disconnect(),r.forEach((C,$)=>{$.removeEventListener("input",C,!1)}),r.clear(),a.forEach((C,$)=>{$.removeEventListener("keydown",C,!1)}),a.clear()}},[be]),en(l,be,V,D,Ce,re,void 0,N),tn(l,be,V,ee),nn(l,be,ee,N),an(l,be,V,ee),rn(l,be,ee),on(l,be,V,he),sn(l,se);const lt=Zt(l);c.useEffect(()=>{if(!l.current)return;l.current.querySelectorAll(".rte-richtext-toggle").forEach(a=>{const o=a.getAttribute("data-expanded")==="true";a.innerHTML=o?'<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>'})},[be,l]);const it=wn(l),ct=c.useCallback(()=>{const r=G.current;if(!r)return;const a=Math.max(0,Math.ceil(r.scrollHeight||0));!Number.isFinite(a)||a<=0||Ln(o=>o===a?o:a)},[]);c.useLayoutEffect(()=>{if(!s)return;const r=Q.current,a=l.current;if(!(!r||!a))try{const o=window.getComputedStyle(a),m=Number.parseFloat(o.paddingTop)||0,h=Number.parseFloat(o.lineHeight)||34,k=Math.max(0,Math.ceil(m+h)),p=a.getBoundingClientRect(),O=document.createRange();O.selectNodeContents(a);const C=Array.from(O.getClientRects());let $=k>0?k:58;if(C.length>0){const z=Math.min(...C.map(Z=>Z.top)),g=2;let Y=0;for(const Z of C)Math.abs(Z.top-z)<=g&&(Y=Math.max(Y,Z.bottom));if(Y>0){const Z=Math.max(0,Math.ceil(Y-p.top));$=k>0?Math.max(Z,k):Z}}else $=k>0?k:58;if(!Number.isFinite($)||$<=0)return;qe(z=>z===$?z:$)}catch{}},[s,be,V,Ce,lt.length,it.length]);const Ye=c.useRef({ts:0,contentScrollTop:0,bodyScrollTop:0,editorScrollTop:0});c.useEffect(()=>{if(s)return;const r=Q.current,a=G.current,o=l.current;if(!r)return;const m=()=>{Ye.current={ts:Date.now(),contentScrollTop:r.scrollTop||0,bodyScrollTop:a?.scrollTop||0,editorScrollTop:o?.scrollTop||0}};m();const h=()=>{m(),console.log(`[RTE collapse debug][${U.current}] (expanded) content scroll`,Ye.current)},k=()=>{m(),console.log(`[RTE collapse debug][${U.current}] (expanded) body scroll`,Ye.current)};return r.addEventListener("scroll",h,{passive:!0}),a?.addEventListener("scroll",k,{passive:!0}),()=>{r.removeEventListener("scroll",h),a?.removeEventListener("scroll",k)}},[s]),c.useEffect(()=>{if(typeof window>"u")return;const r=U.current,a=window;return a.__rteDebug=a.__rteDebug||{},a.__rteDebug[r]={contentEl:Q.current,contentBodyEl:G.current,editorEl:l.current},()=>{a.__rteDebug&&a.__rteDebug[r]&&delete a.__rteDebug[r]}},[]),c.useLayoutEffect(()=>{if(!s)return;const r=Q.current,a=G.current,o=l.current;if(!r)return;const m=()=>({content:{scrollTop:r.scrollTop,scrollLeft:r.scrollLeft,scrollHeight:r.scrollHeight,clientHeight:r.clientHeight},body:a?{scrollTop:a.scrollTop,scrollLeft:a.scrollLeft,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}:void 0,editor:o?{scrollTop:o.scrollTop,scrollLeft:o.scrollLeft,scrollHeight:o.scrollHeight,clientHeight:o.clientHeight}:void 0,style:(()=>{try{const W=window.getComputedStyle(r),te=a?window.getComputedStyle(a):void 0;return{contentOverflow:`${W.overflow}/${W.overflowY}`,bodyOverflow:te?`${te.overflow}/${te.overflowY}`:void 0,bodyMaxHeight:te?.maxHeight,bodyHeight:te?.height}}catch{return}})()}),h=()=>{r.scrollTop=0,r.scrollLeft=0,a&&(a.scrollTop=0,a.scrollLeft=0),o&&(o.scrollTop=0,o.scrollLeft=0)},p=(typeof F=="number"&&Number.isFinite(F)&&F>=0?F:260)+220;console.log(`[RTE collapse debug][${U.current}] pre-collapse lastScrollStateRef`,Ye.current),console.log(`[RTE collapse debug][${U.current}] lock start (before reset)`,m()),h(),console.log(`[RTE collapse debug][${U.current}] lock start (after reset)`,m()),window.requestAnimationFrame(()=>{console.log(`[RTE collapse debug][${U.current}] lock start (after rAF)`,m())});const O=W=>{W.preventDefault(),W.stopPropagation(),h(),console.log(`[RTE collapse debug][${U.current}] prevented scroll event`,{type:W.type},m())},C=()=>console.log(`[RTE collapse debug][${U.current}] content scroll event`,m()),$=()=>console.log(`[RTE collapse debug][${U.current}] body scroll event`,m());r.addEventListener("wheel",O,{passive:!1}),r.addEventListener("touchmove",O,{passive:!1}),r.addEventListener("scroll",C,{passive:!0}),a&&(a.addEventListener("wheel",O,{passive:!1}),a.addEventListener("touchmove",O,{passive:!1}),a.addEventListener("scroll",$,{passive:!0}));const z=performance.now();let g=0;const Y=W=>{h(),W-z<p&&(g=window.requestAnimationFrame(Y))};g=window.requestAnimationFrame(Y);const Z=window.setTimeout(()=>{h(),console.log(`[RTE collapse debug][${U.current}] lock end (after timeout)`,m())},p);return()=>{r.removeEventListener("wheel",O),r.removeEventListener("touchmove",O),r.removeEventListener("scroll",C),a&&(a.removeEventListener("wheel",O),a.removeEventListener("touchmove",O),a.removeEventListener("scroll",$)),window.cancelAnimationFrame(g),window.clearTimeout(Z),console.log(`[RTE collapse debug][${U.current}] lock cleanup`,m())}},[s,F]),c.useEffect(()=>{if(s)return;let r=0;return r=window.requestAnimationFrame(()=>{ct()}),()=>window.cancelAnimationFrame(r)},[s,be,V,Ce,lt.length,it.length,ct]),c.useEffect(()=>{const r=typeof F=="number"&&Number.isFinite(F)&&F>=0?F:260;if(r<=0){tt(!1);return}tt(!0);const a=window.setTimeout(()=>tt(!1),r);return()=>window.clearTimeout(a)},[s,F]),c.useEffect(()=>{if(t.length>0){ge(!1);return}const r=()=>{if(!l.current){ge(!0);return}const o=l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",m=l.current.querySelectorAll('[data-type="variable"]'),h=l.current.querySelectorAll('[data-type="upload"]');let k=!1;m.forEach(O=>{(O.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(k=!0)}),h.forEach(O=>{O.querySelector(".upload-inner-wrapper.has-file")&&(k=!0)});const p=!o&&!k;ge(p),t.length===0&&he(!p)};r();const a=new MutationObserver(r);return l.current&&a.observe(l.current,{childList:!0,subtree:!0,characterData:!0}),()=>{a.disconnect()}},[t]);const Mn=r=>{if(d){r.preventDefault();return}r.preventDefault();const a=r.clipboardData.getData("text/plain"),o=window.getSelection();if(o&&o.rangeCount>0){const p=o.anchorNode;if(p){let O=null;if(p.nodeType===Node.ELEMENT_NODE?O=p.closest('[data-type="variable"]'):p.nodeType===Node.TEXT_NODE&&p.parentElement&&(O=p.parentElement.closest('[data-type="variable"]')),O){const C=O.dataset.multiKey;if(C){const $=/[、,,\s\n\r\t]+/,z=a.split($).map(g=>g.trim()).filter(g=>g.length>0);if(z.length>1){const g=parseInt(O.dataset.index||"0",10),Y=t.find(ye=>ye.type==="multi-variable"&&ye.key===C)?.maxCount||9,Z=Ce[C]||1,W=Math.min(g+z.length,Y);W>Z&&Ae(pe=>({...pe,[C]:W}));const te=[];for(let pe=0;pe<Z;pe++){const ye=`${C}_${pe}`,Se=l.current.querySelector(`[data-type="variable"][data-key="${ye}"][data-multi-key="${C}"]`);if(Se){const Me=Se.innerText.replace(/[\u200B\n]/g,"").trim();te.push(Me)}}te.splice(g,1,...z.slice(0,Y-g));const ae=te.slice(0,Y);ae.length>0&&ae[ae.length-1]!==""&&ae.length<Y&&ae.push("");const ce=Math.max(ae.length,1),de={};ae.forEach((pe,ye)=>{pe&&(de[`${C}_${ye}`]=pe)}),l.current.querySelectorAll('[data-type="variable"]').forEach(pe=>{const ye=pe.dataset.key,Se=pe.dataset.multiKey;if(ye&&Se!==C){const Me=pe.innerText.replace(/[\u200B\n]/g,"").trim();Me&&(de[ye]=Me)}}),l.current.__tempVariableValues=de,Ae(pe=>({...pe,[C]:ce}));return}}}}}let m=!1,h="";const k=window.getSelection();if(k&&k.rangeCount>0){const p=k.anchorNode;if(p){let O=null;if(p.nodeType===Node.ELEMENT_NODE?O=p.closest('[data-type="variable"]'):p.nodeType===Node.TEXT_NODE&&p.parentElement&&(O=p.parentElement.closest('[data-type="variable"]')),O){const C=O.getAttribute("data-node-type")||"",$=O.dataset.key;if(C==="markdown"&&$&&/20\d{2}-\d{2}-\d{2}/.test(a))m=!0,h=$,Vt.current[$]=a,Ee(z=>({...z,[$]:{...z[$],status:"loading",error:void 0}}));else if(C==="report-url"&&$){document.execCommand("insertText",!1,a),ut(),setTimeout(()=>{const z=O.innerText.replace(/[\u200B\n]/g,"").trim();nt.current($,z)},0);return}}}}if(m&&h){setTimeout(()=>{We.current(h,a)},0);return}document.execCommand("insertText",!1,a),ut(),setTimeout(()=>{/20\d{2}-\d{2}-\d{2}/.test(a)&&rt.current.tableData?.status==="success"&&(Ee(O=>({...O,tableData:{status:"loading",modules:[],lastParsedText:a,error:void 0}})),setTimeout(()=>{Vt.current.tableData=a,We.current("tableData",a)},0))},0)},Dn=r=>{if(!r.target.files){r.target&&(r.target.value=""),b(null),A(null),J(null);return}const a=10*1024*1024,o=h=>h.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(h.name||""),m=h=>o(h)&&h.size>a;if(I&&r.target.files&&r.target.files.length>0){const h=I,k=t.find($=>$.type==="upload"&&$.key===h),p=Array.from(r.target.files),O=p.filter($=>!m($)),C=p.length-O.length;if(C>0&&T.error(`已自动过滤 ${C} 张超过 10MB 的图片,仅允许上传 10MB 以内图片`),k&&typeof k.maxCount=="number"&&typeof k.minCount=="number"){const $=k.maxCount,z=typeof X=="number"?X:0;y(g=>{const Y={...g};let Z=Math.min(Math.max(z,0),$-1);for(const W of O){for(;Z<$&&Y[`${h}-${Z}`]!=null;)Z+=1;if(Z>=$)break;Y[`${h}-${Z}`]=W,Z+=1}return Y})}}else if(x&&r.target.files[0]){const h=r.target.files[0],k=x;m(h)?T.error("图片大小不能超过 10MB(仅允许上传 10MB 以内图片)"):y(p=>({...p,[k]:h}))}r.target&&(r.target.value=""),b(null),A(null),J(null)},Ut=r=>{y(a=>{const o={...a};return delete o[r],o})},Pn=r=>{const a=r.target;if(a.closest(".rte-datepicker-wrapper")||a.closest(".rte-datepicker-host")||a.closest(".rte-select-wrapper")||a.closest(".rte-select-host")||a.closest(".ant-select-dropdown"))return;if(a.closest(".tag-close-btn")){if(r.preventDefault(),r.stopPropagation(),D)return;ee(null),M?M():l.current&&(l.current.innerHTML="",l.current.focus());return}if(D){const h=a.closest(".tag-node"),k=a.closest('[data-type="text"]');if(h||k){r.preventDefault(),r.stopPropagation();const p=window.getSelection();p&&p.removeAllRanges();return}}a.closest('[data-type="variable"]')||(ie.current={x:r.clientX,y:r.clientY},se.current=!1,a.closest(".file-remove-btn")&&(r.preventDefault(),r.stopPropagation()))},Hn=r=>{if(!r.target.closest('[data-type="variable"]')&&ie.current){const m=Math.abs(r.clientX-ie.current.x),h=Math.abs(r.clientY-ie.current.y);(m>3||h>3)&&(se.current=!0)}},Bn=r=>{if(r.target.closest('[data-type="variable"]')){ie.current=null,se.current=!1;return}ie.current=null,se.current=!1},Vn=r=>{if(d)return;s&&H?.(!1);const a=r.target;if(a.closest('[data-type="datepicker"]'))return;if(a.closest(".tag-close-btn")){r.preventDefault(),r.stopPropagation();return}if(t.length===0)return;const h=(g,Y)=>{if(!l.current)return;Array.from(l.current.children).forEach(W=>{if(W!==g)if(Y)W.dataset.prevDisplay===void 0&&(W.dataset.prevDisplay=W.style.display||""),W.dataset.rteForceHidden="1",W.style.setProperty("display","none","important");else{if(W.dataset.prevDisplay!==void 0){const te=W.dataset.prevDisplay;te?W.style.display=te:W.style.removeProperty("display"),delete W.dataset.prevDisplay}else W.style.removeProperty("display");delete W.dataset.rteForceHidden}})},k=a.closest(".rte-textarea-toggle");if(k){r.preventDefault(),r.stopPropagation();const g=k.closest(".rte-textarea-wrapper"),Y=g?.querySelector('[data-type="textarea"]'),W=!(k.getAttribute("data-expanded")==="true");k.setAttribute("data-expanded",String(W)),k.textContent=W?"收起":"展开",g&&g.classList.toggle("rte-textarea-expanded",W);const te=g?.closest(".rte-textarea-required");if(te?te.classList.toggle("rte-textarea-overlay",W):g&&g.classList.toggle("rte-textarea-overlay",W),Y)if(W)Y.classList.add("rte-textarea-expanded"),Y.style.maxHeight="none",Y.style.height="100%";else{Y.classList.remove("rte-textarea-expanded");const ae=Y.dataset.maxHeight||"252";Y.style.maxHeight=`${ae}px`,Y.style.height="auto"}l.current&&(W?l.current.classList.add("rte-overlay-active"):l.current.classList.remove("rte-overlay-active"));return}const p=a.closest(".rte-richtext-toggle");if(p){r.preventDefault(),r.stopPropagation();const g=p.closest(".rte-richtext-wrapper"),Y=g?.querySelector('[data-type="richtext"]'),W=!(p.getAttribute("data-expanded")==="true");((de,fe)=>{de.setAttribute("data-expanded",String(fe)),de.innerHTML=fe?'<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>'})(p,W);const ae=g?.closest(".rte-richtext-required");ae?ae.classList.toggle("rte-richtext-expanded",W):g&&g.classList.toggle("rte-richtext-expanded",W);const ce=g?.closest(".exclusion-wrapper")||g?.parentElement;if(Y&&(W?(Y.style.height="100%",Y.style.overflow="auto"):(Y.style.height="",Y.style.overflow="")),ce&&(ce.classList.toggle("rte-richtext-host-expanded",W),h(ce,W)),l.current){if(l.current.classList.toggle("rte-richtext-fullscreen-active",W),K.current?.classList.toggle("rte-richtext-container-expanded",W),K.current)if(W){const de=Math.ceil(K.current.getBoundingClientRect().height||0);de>0&&K.current.style.setProperty("--rte-richtext-fullscreen-height",`${de}px`)}else K.current.style.removeProperty("--rte-richtext-fullscreen-height");if(W)xe.current=l.current.scrollTop||0,setTimeout(()=>{l.current&&(l.current.scrollTop=0,l.current.scrollLeft=0)},0);else{const de=xe.current||0;setTimeout(()=>{l.current&&(l.current.scrollTop=de)},0)}}return}if(a.closest('[data-type="text"]')){r.preventDefault(),r.stopPropagation();const g=window.getSelection();g&&g.removeAllRanges();return}if(D&&a.closest(".tag-node")){r.preventDefault(),r.stopPropagation();const Y=window.getSelection();Y&&Y.removeAllRanges();return}if(a.closest('[data-type="variable"]')){if(se.current)return;setTimeout(()=>{const g=window.getSelection();g&&!g.isCollapsed||Ze(l)},10);return}const $=a.closest(".file-remove-btn");if($){r.preventDefault(),r.stopPropagation();const g=$.closest('[data-type="upload"]'),Y=g?.dataset.key,Z=g?.dataset.batchKey;if(Y)if(Z){const W=t.find(te=>te.type==="upload"&&te.key===Z);if(W&&typeof W.maxCount=="number"&&typeof W.minCount=="number"){const te=W.maxCount;y(ae=>{const ce={...ae},de=[];for(let fe=0;fe<te;fe++){const pe=`${Z}-${fe}`,ye=ce[pe];ye!=null&&pe!==Y&&de.push(ye)}for(let fe=0;fe<te;fe++)delete ce[`${Z}-${fe}`];return de.forEach((fe,pe)=>{ce[`${Z}-${pe}`]=fe}),ce})}else Ut(Y)}else Ut(Y);return}const z=a.closest('[data-type="upload"]');if(z){const g=z.dataset.key,Y=z.dataset.batchKey,Z=z.dataset.batchIndex;if(g){const W=Y||g,te=t.find(ae=>ae.type==="upload"&&ae.key===W);if(_.current&&(te?.accept?_.current.accept=te.accept:te?.acceptType==="image"?_.current.accept="image/*":te?.acceptType==="file"?_.current.accept=".csv,.xlsx,.xls,.txt,.pdf,.doc,.docx,.json":_.current.accept=""),Y){const ae=t.find(ce=>ce.type==="upload"&&ce.key===Y);if(ae&&typeof ae.maxCount=="number"&&typeof ae.minCount=="number"){const ce=ae.maxCount,de=V[g]!=null,fe=Z!=null?Number.parseInt(Z,10):NaN;if(de){_.current&&(_.current.multiple=!1),A(null),J(null),b(g),_.current?.click();return}let pe=0;for(let ye=0;ye<ce;ye++)V[`${Y}-${ye}`]!=null&&(pe+=1);pe<ce&&_.current?(_.current.multiple=!0,A(Y),J(Number.isFinite(fe)?fe:null),b(null),_.current.click()):(_.current&&(_.current.multiple=!1),A(null),J(null),b(g),_.current?.click())}else _.current&&(_.current.multiple=!1),A(null),J(null),b(g),_.current?.click()}else _.current&&(_.current.multiple=!1),A(null),J(null),b(g),_.current?.click()}return}},On=r=>{const o=r.target.closest('[data-type="variable"]');if(o){const m=window.getSelection();if(m){const h=document.createRange(),k=o.textContent||"";if(k.replace(/\u200B/g,"")){let O=0,C=k.length;k.startsWith("")&&(O=1),k.endsWith("")&&k.length>1&&(C=k.length-1);const $=o.firstChild;$&&$.nodeType===Node.TEXT_NODE?(h.setStart($,O),h.setEnd($,C)):h.selectNodeContents(o)}else h.selectNodeContents(o),h.collapse(!0);m.removeAllRanges(),m.addRange(h)}}},ut=()=>{if(t.length===0){if(l.current){const o=!(l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");ge(o),he(!o)}return}if(Ze(l),l.current&&l.current.querySelectorAll('[data-type="variable"][data-node-type="report-url"]').forEach(o=>{const m=o.dataset.key;if(!m)return;o.innerText.replace(/[\u200B\n]/g,"").trim()||Ve(k=>{const p=k[m];return!p||p.status==="idle"&&(!p.modules||p.modules.length===0)?k:{...k,[m]:{status:"idle",modules:[],lastParsedUrl:void 0,error:void 0}}})}),l.current&&l.current.querySelectorAll('[data-type="variable"][data-node-type="markdown"]').forEach(o=>{const m=o.dataset.key;if(!m)return;o.innerText.replace(/[\u200B\n]/g,"").trim()||Ee(k=>{const p=k[m];return!p||p.status==="idle"&&(!p.modules||p.modules.length===0)?k:{...k,[m]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}})}),l.current&&l.current.querySelectorAll('[data-type="richtext"][data-node-type="markdown-module"]').forEach(o=>{const m=o.dataset.key;if(!m)return;o.innerText.replace(/[\u200B\n]/g,"").trim()||Ee(k=>{const p=k[m];return!p||p.status==="idle"?k:{...k,[m]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}})}),l.current&&l.current.querySelectorAll('[data-type="variable"]').forEach(o=>{const m=o.querySelector(".variable-info-icon");if(m){let h=!1;const k=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,{acceptNode:p=>m.contains(p)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;k.nextNode();)if(k.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){h=!0;break}h?m.classList.add("hidden"):m.classList.remove("hidden")}}),s||window.requestAnimationFrame(()=>{ct()}),Je(l,be,V),Qe(l,be,V,he),!l.current)return;t.filter(a=>a.type==="multi-variable"&&a.key).forEach(a=>{if(!a.key)return;const o=a.maxCount||9,m=Ce[a.key]||1,h=[];for(let $=0;$<m;$++){const z=`${a.key}_${$}`,g=l.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${a.key}"]`);if(g){const Y=g.innerText.replace(/[\u200B\n]/g,"").trim();h.push(Y)}}const p=(h[h.length-1]||"")==="";let O=!1,C=-1;for(let $=0;$<h.length-1;$++)if(h[$]===""){O=!0,C=$;break}if(O&&C>=0){const $=window.getSelection();if($&&$.rangeCount>0){const W=$.getRangeAt(0),te=W.startContainer,ae=te.nodeType===Node.ELEMENT_NODE?te.closest('[data-type="variable"][data-multi-key]'):te.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ae){const ce=ae.dataset.key;if(ce){const de=document.createRange();de.setStartBefore(ae),de.setEnd(W.startContainer,W.startOffset);const fe=de.toString().length;re.current={key:ce,offset:fe}}}}const z=[...h];for(let W=C;W<z.length-1;W++)z[W]=z[W+1];z.pop();const g={};z.forEach((W,te)=>{W&&(g[`${a.key}_${te}`]=W)});const Y=Math.max(p?z.length:z.length+1,1);l.current.querySelectorAll('[data-type="variable"]').forEach(W=>{const te=W.dataset.key,ae=W.dataset.multiKey;if(te&&ae!==a.key){const ce=W.innerText.replace(/[\u200B\n]/g,"").trim();ce&&(g[te]=ce)}}),l.current.__tempVariableValues=g,Ae(W=>({...W,[a.key]:Y}));return}if(!p){const $=m-1,z=`${a.key}_${$}`,g=l.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${a.key}"]`);if(g&&g.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&m<o){const Z=window.getSelection();if(Z&&Z.rangeCount>0){const W=Z.getRangeAt(0),te=W.startContainer,ae=te.nodeType===Node.ELEMENT_NODE?te.closest('[data-type="variable"][data-multi-key]'):te.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ae){const ce=ae.dataset.key;if(ce){const de=document.createRange();de.setStartBefore(ae),de.setEnd(W.startContainer,W.startOffset);const fe=de.toString().length;re.current={key:ce,offset:fe}}}}Ae(W=>({...W,[a.key]:m+1}))}}})};c.useLayoutEffect(()=>{const r=l.current;if(!r)return;const a=new Map,o=k=>{const p=k.target,O=k.relatedTarget;!p||!l.current||!l.current.contains(p)||O&&l.current.contains(O)||setTimeout(()=>{if(l.current){if(t.length===0){const C=l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";he(C.length>0);return}Ze(l),Je(l,be,V),Qe(l,be,V,he)}},0)};r.addEventListener("blur",o,!0);const m=()=>{if(!l.current)return;a.forEach((O,C)=>{C.removeEventListener("blur",O,!1)}),a.clear();const k=l.current.querySelectorAll('[data-type="variable"][data-multi-key]'),p=O=>{O.stopPropagation(),O.stopImmediatePropagation();const C=O.target;if(!C||!l.current||!l.current.contains(C))return;const $=C.closest('[data-type="variable"][data-multi-key]');if(!$||!l.current.contains($))return;let z=!1;if(a.forEach((de,fe)=>{(fe===$||fe.contains(C))&&(z=!0)}),!z)return;const g=$.dataset.multiKey,Y=$.dataset.key,Z=$.dataset.index;if(!g||!Y||Z===void 0)return;const W=O.relatedTarget;if(!(!W||!l.current.contains(W)))return;const ae=$.innerText.replace(/[\u200B\n]/g,"").trim(),ce=/[、,,\s]+/;if(ce.test(ae)){const pe=ae.split(ce).map(ye=>ye.trim()).filter(ye=>ye.length>0).slice(0,9);if(pe.length>1){const ye=t.find(Se=>Se.type==="multi-variable"&&Se.key===g);if(ye){const Se=Ce[g]||1,Me=parseInt(Z,10),Kt=ye.maxCount||9,dt=[];for(let we=0;we<Se;we++){const De=`${g}_${we}`,Ue=l.current.querySelector(`[data-type="variable"][data-key="${De}"][data-multi-key="${g}"]`);if(Ue){const Ke=Ue.innerText.replace(/[\u200B\n]/g,"").trim();dt.push(Ke)}}dt.splice(Me,1,...pe);const _e=dt.slice(0,Kt);_e.length>0&&_e[_e.length-1]!==""&&_e.length<Kt&&_e.push("");const Un=Math.max(_e.length,1),pt={};_e.forEach((we,De)=>{we&&(pt[`${g}_${De}`]=we)}),l.current.querySelectorAll('[data-type="variable"]').forEach(we=>{const De=we.dataset.key,Ue=we.dataset.multiKey;if(De&&Ue!==g){const Ke=we.innerText.replace(/[\u200B\n]/g,"").trim();Ke&&(pt[De]=Ke)}}),l.current.__tempVariableValues=pt,Ae(we=>({...we,[g]:Un}))}}}};k.forEach(O=>{O.addEventListener("blur",p,!1),a.set(O,p)})},h=setTimeout(()=>{m()},0);return()=>{clearTimeout(h),r.removeEventListener("blur",o,!0),a.forEach((k,p)=>{p.removeEventListener("blur",k,!1)}),a.clear()}},[t,be,Ce,V]);const Fn=r=>{if(d){r.preventDefault();return}if(r.key==="Enter"){const o=r.target,m=!!o?.closest?.('[data-type="richtext"]'),h=o?.tagName==="TEXTAREA"||!!o?.closest?.('[data-type="textarea"]');if(!m&&!h){r.preventDefault();return}}const a=window.getSelection();if(a&&a.rangeCount>0){const o=a.anchorNode;let m=null;if(o&&(o.nodeType===Node.ELEMENT_NODE?m=o.closest('[data-type="text"]'):o.nodeType===Node.TEXT_NODE&&o.parentElement&&(m=o.parentElement.closest('[data-type="text"]'))),m){if(r.preventDefault(),r.stopPropagation(),l.current){const h=l.current.querySelector('[data-type="variable"], [data-type="upload"]');h&&h.focus()}return}}if(D&&a&&a.rangeCount>0){const o=a.anchorNode;let m=null;if(o&&(o.nodeType===Node.ELEMENT_NODE?m=o.closest(".tag-node"):o.nodeType===Node.TEXT_NODE&&o.parentElement&&(m=o.parentElement.closest(".tag-node"))),m){if(r.preventDefault(),r.stopPropagation(),l.current){const h=l.current.querySelector('[data-type="variable"], [data-type="upload"]');h&&h.focus()}return}}if(r.key==="Escape"&&l.current){if(D){r.preventDefault();return}l.current.innerHTML="",l.current.focus()}if(r.key==="Backspace"){const o=window.getSelection();if(o&&o.rangeCount>0){const m=o.getRangeAt(0),h=o.anchorNode;if(D){let p=null,O=null;if(h&&(h.nodeType===Node.ELEMENT_NODE?(p=h.closest(".tag-node"),O=h.closest('[data-type="text"]')):h.nodeType===Node.TEXT_NODE&&h.parentElement&&(p=h.parentElement.closest(".tag-node"),O=h.parentElement.closest('[data-type="text"]'))),(p||O)&&m.collapsed&&m.startOffset===0){r.preventDefault();return}}let k=null;if(h&&(h.nodeType===Node.ELEMENT_NODE?k=h.closest('[data-type="variable"]'):h.nodeType===Node.TEXT_NODE&&h.parentElement&&(k=h.parentElement.closest('[data-type="variable"]'))),k){if(!m.collapsed)return;const p=k.innerText;if(p===""||p===""){r.preventDefault();return}if(m.startOffset===0){r.preventDefault();return}if(p.startsWith("")&&m.startOffset===1){r.preventDefault();return}}}}},Gn=()=>{if(i||d||L||!ue||!l.current)return;if(t.length===0){const k=l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!k)return;if(f(k,k),l.current){l.current.textContent="";const p=new Event("input",{bubbles:!0});l.current.dispatchEvent(p)}return}const r=l.current;let a="";const o={},m=k=>{if(!(k.nodeType===Node.ELEMENT_NODE&&k.style.display==="none")){if(k.nodeType===Node.TEXT_NODE)a+=(k.textContent||"").replace(/\u200B/g,"");else if(k.nodeType===Node.ELEMENT_NODE){const p=k,O=p.dataset.type,C=p.dataset.key;if(O==="variable"&&C){let $="";const z=document.createTreeWalker(p,NodeFilter.SHOW_TEXT,{acceptNode:Y=>{const Z=p.querySelector(".variable-info-icon");return Z&&Z.contains(Y)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;z.nextNode();)$+=z.currentNode.textContent||"";const g=$.replace(/[\u200B\n]/g,"").trim();if(g){const Y=p.dataset.multiKey;if(Y){(!o[Y]||!Array.isArray(o[Y]))&&(o[Y]=[]);const Z=o[Y];Z.push(g),Z.length>1&&(a+=" "),a+=g}else o[C]=g,a+=g;if(p.dataset.nodeType==="report-url")if(o.url===void 0)o.url=g;else{const Z=o.url;Array.isArray(Z)?Z.push(g):o.url=[String(Z),g]}if(p.dataset.nodeType==="markdown"){const Z=p.dataset.sourceTextKey||`${C}__sourceText`;if(o[Z]===void 0)o[Z]=g;else{const te=o[Z];Array.isArray(te)?te.push(g):o[Z]=[String(te),g]}const W=`${C}__markdown`;o[W]===void 0&&(o[W]=[At(g)])}}}else if(O==="select"&&C){const $=(p.getAttribute("data-value")||"").trim();$&&(o[C]=$,a+=$)}else if(O==="textarea"&&C){const z=(p.value||"").replace(/\u200B/g,"").trim();z&&(o[C]=z,a+=z)}else if(O==="richtext"&&C){const $=p,z=$.dataset.nodeType,g=($.textContent||"").replace(/\u200B/g,"").trim();if(g)if(z==="report-module"||z==="markdown-module"){(!o[C]||!Array.isArray(o[C]))&&(o[C]=[]);const Y=o[C];Y.push(g),Y.length>1&&(a+=" "),a+=g}else o[C]=g,a+=g}else if(O==="datepicker"&&C){const z=(p.getAttribute("data-value")||"").trim();if(z)if(z.includes(",")){const g=z.split(",");g.length===2?(o[C]=g,a+=`[${g[0]}, ${g[1]}]`):(o[C]=z,a+=z)}else o[C]=z,a+=z}else if(O==="number-input"&&C){const z=(p.value||"").trim();z&&(o[C]=z,a+=z)}else if(O==="upload"&&C){const $=p.dataset.batchKey;if($){const z=t.find(g=>g.type==="upload"&&g.key===$);if(z&&typeof z.maxCount=="number"&&typeof z.minCount=="number"){const g=[];for(let Y=0;Y<z.maxCount;Y++){const Z=`${$}-${Y}`,W=V[Z];W&&g.push(W)}o[$]||(o[$]=g.length>0?g:null,g.length>0&&(a+=` [附带${g.length}个文件: ${g.map(Y=>Y.name).join(", ")}] `))}else o[C]=V[C]??null,V[C]&&(a+=` [附带文件: ${V[C]?.name}] `)}else o[C]=V[C]??null,V[C]&&(a+=` [附带文件: ${V[C]?.name}] `)}else{if(p.classList.contains("tag-close-btn")||p.classList.contains("file-remove-btn"))return;p.getAttribute("contenteditable")==="false"&&!O&&p.classList.contains("tag-node")?a+=p.innerText:p.childNodes.forEach(m)}}}};if(r.childNodes.forEach(m),a=a.trim(),!a)return;Object.keys($e).forEach(k=>{const p=$e[k];if(!p||!p.modules||p.modules.length===0)return;const O=p.modules.map(C=>(C?.markdown||"").trim()).filter(C=>C.length>0);O.length!==0&&(o[`${k}__markdown`]=O)});const h=new FormData;h.append("fullPrompt",a),Object.keys(o).forEach(k=>{const p=o[k];if(p!=null)if(p instanceof File)h.append(k,p);else if(Array.isArray(p)){const O=t.some(g=>g.type==="multi-variable"&&g.key===k),C=t.some(g=>g.type==="report-url"&&g.key===k),$=k.endsWith("__markdown");O||C||$||k==="url"?p.forEach(g=>{g!=null&&g!==""&&h.append(k,String(g))}):p.forEach((g,Y)=>{g!=null&&(g instanceof File?h.append(`${k}[${Y}]`,g):typeof g=="string"?h.append(`${k}[${Y}]`,g):h.append(`${k}[${Y}]`,String(g)))})}else typeof p=="string"?h.append(k,p):h.append(k,String(p))}),f(h,a)},zn={...v?{width:typeof v=="number"?`${v}px`:v}:{},...j?{border:j}:{},...S?{background:S}:{},...e?{maxHeight:typeof e=="number"?`${e}px`:e}:{},...n?{minHeight:typeof n=="number"?`${n}px`:n}:{},...e?{"--rte-richtext-fullscreen-height":typeof e=="number"?`${e}px`:e}:{}},jn=typeof F=="number"&&Number.isFinite(F)&&F>=0?F:260,Wn={overflow:"hidden"},Yn={maxHeight:s?`${ke}px`:`${Math.max(Ie,ke)}px`,overflow:s||In?"hidden":"auto",transition:`max-height ${jn}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height"};return w.jsxs("div",{className:"rich-text-editor",style:zn,"data-disabled":d,ref:K,children:[ne,w.jsx("div",{className:"rich-text-editor-content",ref:Q,style:Wn,children:w.jsxs("div",{ref:G,className:"rich-text-editor-content-body",style:Yn,children:[w.jsx("div",{ref:l,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${me&&q?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":q,onMouseDown:Pn,onMouseMove:Hn,onMouseUp:Bn,onClick:Vn,onDoubleClick:On,onInput:ut,onKeyDown:Fn,onPaste:Mn}),w.jsx("input",{type:"file",ref:_,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:Dn})]})}),w.jsxs("div",{className:"rich-text-editor-footer",children:[w.jsx("div",{className:"rich-text-editor-footer-left",children:w.jsxs("div",{className:"rich-text-editor-brand",children:[w.jsxs("div",{className:"rte-brand-badge",children:[w.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),w.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),N!=="hideAgent"&&w.jsx(oe.Dropdown,{placement:"topLeft",menu:{items:P.filter(r=>r.isShowNew!==1).map(r=>({key:r.key,label:w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.icon&&w.jsx("i",{className:r.icon}),w.jsx("span",{children:r.label})]}),onClick:()=>{B?.(r)}}))},trigger:["click"],disabled:d||i,overlayClassName:"rte-agent-dropdown",children:w.jsxs("div",{className:"rte-agent-badge",style:{cursor:P.length>0?"pointer":"default"},children:[w.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),w.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(()=>{const r=t.find(o=>o.type==="tag");if(!r||!r.text)return null;const a=P.find(o=>o.label===r.text);return!a||a.points===void 0||a.points===null?null:w.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[w.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),w.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(a.points)]}),a.labelValue===2&&w.jsx("div",{className:"rte-limited-free-badge",children:w.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})})(),w.jsx("button",{type:"button",onClick:Gn,disabled:i||d||L||!ue,className:"rich-text-editor-send-button",children:i||L?w.jsx("span",{className:"rte-send-spinner"}):w.jsx("i",{className:"iconfont icon-fasong"})})]})]}),R?.anchorEl&&(()=>{if(!document.body.contains(R.anchorEl))return null;let r="",a={background:"var(--neutral-800, #262626)"};if(R.type==="upload"){const m=R.anchorEl.dataset.tooltip;m?r=m:r=t.find(k=>k.type==="upload"&&k.key===R.key)?.tooltip||""}else if(R.type==="tag")r=R.anchorEl.dataset.tooltip||"";else if(R.type==="upload-label")r=R.anchorEl.querySelector(".upload-label[data-file-name]")?.dataset.fileName||R.anchorEl.dataset.fileName||"";else if(R.type==="variable")r=R.anchorEl.dataset.tooltip||"";else if(R.type==="upload-preview"){const m=V[R.key],h=!!m&&(m.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(m.name||""));if(m&&h){const k=URL.createObjectURL(m);r=w.jsx("div",{className:"rte-upload-preview",children:w.jsx("img",{className:"rte-upload-preview-img",src:k,alt:m.name})}),a={background:"#fff",padding:0,borderRadius:4,boxShadow:"0 2px 12px 0 rgba(153, 153, 153, 0.25)"},setTimeout(()=>URL.revokeObjectURL(k),1e3)}else r=""}if(!r)return null;const o=R.type==="upload-preview"?"#0A0A0A":"#fff";return Xe.createPortal(w.jsx(oe.Tooltip,{arrow:!1,title:R.type==="upload-preview"?r:w.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:o},children:r}),open:!0,placement:R.type==="upload-preview"?"topLeft":"top",getPopupContainer:()=>document.body,overlayInnerStyle:a,children:w.jsx("div",{style:{position:"fixed",left:`${R.anchorEl.getBoundingClientRect().left}px`,top:`${R.anchorEl.getBoundingClientRect().top-(R.type==="upload-label"?4:0)}px`,width:`${R.anchorEl.offsetWidth}px`,height:`${R.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})(),it,lt]})};Nt.__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 _t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",kn=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],$n=({autoLoading:t,batchSize:f,loadingProgress:i,loadIcon:d,onBatchSizeChange:v,onLoadNextPage:D,onStartAutoLoad:P,onStopLoad:B})=>t&&i?w.jsxs("div",{className:"auto_load_progress",children:[d||w.jsx("img",{src:_t,alt:"自动加载",width:14,height:14}),w.jsxs("span",{children:["正在加载第",i.currentPage,"/",i.totalPages,"页"]}),w.jsx(oe.Progress,{percent:i.percentage,type:"line",size:[160,8]}),w.jsx("span",{onClick:B,className:"auto_load_stop_btn",children:"停止加载"})]}):w.jsxs("div",{className:"auto_load_container",children:[w.jsx("div",{onClick:D,className:"auto_load_next_btn",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:"加载下一页"}),w.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:[w.jsxs("div",{className:"auto_load_btn",onClick:t?void 0:P,children:[d||w.jsx("img",{src:_t,alt:"自动加载",width:14,height:14}),w.jsx("span",{children:"自动加载"})]}),w.jsx(oe.Select,{value:f,onChange:v,options:kn,disabled:t,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),En=({current:t,loadIcon:f,pageSize:i,total:d,cachedPages:v,loadedCount:D,autoLoading:P=!1,loadingProgress:B,onChange:M,onLoadNextPage:L,onStartAutoLoad:q,onStopLoading:j})=>{const[S,N]=c.useState(5),e=Math.ceil(d/i),n=c.useMemo(()=>v.length>=e,[v,e]),s=()=>Array.from({length:e},(H,F)=>F+1).filter(H=>!v.includes(H)).slice(0,S),u=(E,H,F)=>{const T=v.includes(E);return H==="prev"||H==="next"||H==="jump-prev"||H==="jump-next"?w.jsx("div",{className:"pageBox",children:F}):w.jsxs("div",{className:"pageBox",style:{backgroundColor:t===E?"#2563EB":"#f5f5f5",color:t===E?"#fff":T?"#171717":"#a3a3a3"},children:[E,!T&&w.jsx("span",{className:"unload_spot"})]})};return w.jsxs("div",{className:"pagination_footer",children:[w.jsxs("div",{className:"pagination_leftWrap",children:[w.jsxs("span",{className:"pagination_total",children:[w.jsx(Te.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",D,"/",d,"条数据"]}),!n&&w.jsx($n,{loadIcon:f||void 0,autoLoading:P,batchSize:S,loadingProgress:B,disabled:!L||!q,onBatchSizeChange:N,onLoadNextPage:()=>L?.(),onStartAutoLoad:()=>{const E=s();q?.(E)},onStopLoad:()=>j?.()})]}),w.jsx(oe.Pagination,{current:t,pageSize:i,total:d,onChange:E=>M(E),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:u})]})},Lt=t=>{const{loading:f,autoLoading:i,loadingProgress:d,columns:v=[],dataSource:D=[],total:P,current:B,pageSize:M,cachedPages:L,onChangePage:q,onLoadNextPage:j,onStartAutoLoad:S,onStopLoading:N,...e}=t,n=c.useRef(null),s=c.useCallback(u=>{q(u),L.includes(u)&&n.current?.scrollTo({key:`${(u-1)*M+1}`})},[L,q,M]);return w.jsxs("div",{className:"flex flex-col",children:[w.jsx(oe.Table,{ref:n,...e,columns:v,dataSource:D,pagination:!1,virtual:!0}),w.jsx(En,{loading:f,autoLoading:i,loadingProgress:d,current:B,pageSize:M,total:P,loadedCount:D.length,cachedPages:L,onChange:s,onLoadNextPage:j,onStartAutoLoad:S,onStopLoading:N})]})};Lt.__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 It=({texts:t=[],placeholder:f="请输入内容",animationSpeed:i=100,autoPlay:d=!0,value:v,onChange:D,...P})=>{const[B,M]=c.useState(""),[L,q]=c.useState(0),[j,S]=c.useState(!1),[N,e]=c.useState(!1),[n,s]=c.useState(!1),u=c.useRef(void 0),E=c.useRef(void 0),H=c.useRef(t),F=c.useRef(L),T=c.useRef(N),ne=c.useRef(B);c.useEffect(()=>{H.current=t,F.current=L,T.current=N,ne.current=B});const K=c.useCallback((y,x)=>{let b=0;s(!0);const I=()=>{b<y.length?(M(y.slice(0,b+1)),b++,E.current=window.setTimeout(I,i)):(s(!1),x?.())};I()},[i]),Q=c.useCallback(y=>{let x=ne.current.length;const b=()=>{x>0?(M(ne.current.slice(0,x-1)),x--,E.current=window.setTimeout(b,i/2)):y?.()};b()},[i]),G=c.useCallback(()=>{if(H.current.length===0||T.current)return;S(!0);const y=H.current[F.current];ne.current?Q(()=>{K(y,()=>{u.current=window.setTimeout(()=>{q(x=>(x+1)%H.current.length),S(!1)},2e3)})}):K(y,()=>{u.current=window.setTimeout(()=>{q(x=>(x+1)%H.current.length),S(!1)},2e3)})},[Q,K]);c.useEffect(()=>(d&&t.length>0&&!N&&G(),()=>{u.current&&window.clearTimeout(u.current),E.current&&window.clearTimeout(E.current)}),[L,N,d,t.length,G]),c.useEffect(()=>{!j&&d&&t.length>0&&!N&&G()},[L,j,d,t.length,N,G]);const l=y=>{e(!0),u.current&&window.clearTimeout(u.current),E.current&&window.clearTimeout(E.current),S(!1),s(!1),P.onFocus?.(y)},_=y=>{e(!1),!v&&t.length>0&&(M(""),q(0)),P.onBlur?.(y)},U=y=>{D?.(y.target.value),P.onChange?.(y)},V=()=>N||v?f:B||f;return w.jsxs("div",{style:{position:"relative"},children:[w.jsx(oe.Input,{...P,value:v,onChange:U,onFocus:l,onBlur:_,placeholder:V(),style:{...P.style,position:"relative",zIndex:1}}),!N&&!v&&B&&w.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:[w.jsx("span",{children:B}),n&&w.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),w.jsx("style",{children:`
|
|
26
|
+
`,Q.textContent=$||"0",document.body.appendChild(Q);const W=Math.max(44,Math.min(600,Q.offsetWidth+8));return document.body.removeChild(Q),W},m=C=>{const $=C.target;if(!$)return;let z=$.value;if(z=z.replace(/[^\d]/g,""),z!==""&&z!=="0"){const g=parseInt(z,10);if(Number.isNaN(g))$.value="";else{const Y=$.getAttribute("min"),Q=$.getAttribute("max"),W=Y!==null?parseInt(Y,10):0,te=Q!==null?parseInt(Q,10):1/0,ae=Math.min(Math.max(g,W),te);$.value=String(ae)}}else if(z==="0"){const g=$.getAttribute("min");0<(g!==null?parseInt(g,10):0)?$.value="":$.value="0"}$.style.width=`${o($)}px`},h=C=>{const $=C.key;($==="-"||$==="."||$===","||$==="e"||$==="E"||$==="+"||$==="="||$===" ")&&C.preventDefault()},k=()=>{if(!l.current)return;l.current.querySelectorAll('[data-type="number-input"]').forEach($=>{const z=$.style.width,g=`${o($)}px`;z!==g&&($.style.width=g),r.has($)||($.addEventListener("input",m,!1),$.addEventListener("keydown",h,!1),r.set($,m),a.set($,h))})},p=window.setTimeout(()=>{k()},0),O=new MutationObserver(C=>{let $=!1;C.forEach(z=>{z.type==="childList"&&z.addedNodes.forEach(g=>{if(g.nodeType===Node.ELEMENT_NODE){const Y=g;Y.matches&&(Y.matches('[data-type="number-input"]')||Y.querySelector('[data-type="number-input"]'))&&($=!0)}})}),$&&setTimeout(k,10)});return l.current&&O.observe(l.current,{childList:!0,subtree:!0}),()=>{window.clearTimeout(p),O.disconnect(),r.forEach((C,$)=>{$.removeEventListener("input",C,!1)}),r.clear(),a.forEach((C,$)=>{$.removeEventListener("keydown",C,!1)}),a.clear()}},[xe]),en(l,xe,V,D,Ce,re,void 0,N),tn(l,xe,V,ee),nn(l,xe,ee,N),an(l,xe,V,ee),rn(l,xe,ee),on(l,xe,V,he),sn(l,se);const lt=Zt(l);c.useEffect(()=>{if(!l.current)return;l.current.querySelectorAll(".rte-richtext-toggle").forEach(a=>{const o=a.getAttribute("data-expanded")==="true";a.innerHTML=o?'<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>'})},[xe,l]);const it=wn(l),ct=c.useCallback(()=>{const r=G.current;if(!r)return;const a=Math.max(0,Math.ceil(r.scrollHeight||0));!Number.isFinite(a)||a<=0||Ln(o=>o===a?o:a)},[]);c.useLayoutEffect(()=>{if(!s)return;const r=R.current,a=l.current;if(!(!r||!a))try{const o=window.getComputedStyle(a),m=Number.parseFloat(o.paddingTop)||0,h=Number.parseFloat(o.lineHeight)||34,k=Math.max(0,Math.ceil(m+h)),p=a.getBoundingClientRect(),O=document.createRange();O.selectNodeContents(a);const C=Array.from(O.getClientRects());let $=k>0?k:58;if(C.length>0){const z=Math.min(...C.map(Q=>Q.top)),g=2;let Y=0;for(const Q of C)Math.abs(Q.top-z)<=g&&(Y=Math.max(Y,Q.bottom));if(Y>0){const Q=Math.max(0,Math.ceil(Y-p.top));$=k>0?Math.max(Q,k):Q}}else $=k>0?k:58;if(!Number.isFinite($)||$<=0)return;qe(z=>z===$?z:$)}catch{}},[s,xe,V,Ce,lt.length,it.length]);const Ye=c.useRef({ts:0,contentScrollTop:0,bodyScrollTop:0,editorScrollTop:0});c.useEffect(()=>{if(s)return;const r=R.current,a=G.current,o=l.current;if(!r)return;const m=()=>{Ye.current={ts:Date.now(),contentScrollTop:r.scrollTop||0,bodyScrollTop:a?.scrollTop||0,editorScrollTop:o?.scrollTop||0}};m();const h=()=>{m(),console.log(`[RTE collapse debug][${U.current}] (expanded) content scroll`,Ye.current)},k=()=>{m(),console.log(`[RTE collapse debug][${U.current}] (expanded) body scroll`,Ye.current)};return r.addEventListener("scroll",h,{passive:!0}),a?.addEventListener("scroll",k,{passive:!0}),()=>{r.removeEventListener("scroll",h),a?.removeEventListener("scroll",k)}},[s]),c.useEffect(()=>{if(typeof window>"u")return;const r=U.current,a=window;return a.__rteDebug=a.__rteDebug||{},a.__rteDebug[r]={contentEl:R.current,contentBodyEl:G.current,editorEl:l.current},()=>{a.__rteDebug&&a.__rteDebug[r]&&delete a.__rteDebug[r]}},[]),c.useLayoutEffect(()=>{if(!s)return;const r=R.current,a=G.current,o=l.current;if(!r)return;const m=()=>({content:{scrollTop:r.scrollTop,scrollLeft:r.scrollLeft,scrollHeight:r.scrollHeight,clientHeight:r.clientHeight},body:a?{scrollTop:a.scrollTop,scrollLeft:a.scrollLeft,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}:void 0,editor:o?{scrollTop:o.scrollTop,scrollLeft:o.scrollLeft,scrollHeight:o.scrollHeight,clientHeight:o.clientHeight}:void 0,style:(()=>{try{const W=window.getComputedStyle(r),te=a?window.getComputedStyle(a):void 0;return{contentOverflow:`${W.overflow}/${W.overflowY}`,bodyOverflow:te?`${te.overflow}/${te.overflowY}`:void 0,bodyMaxHeight:te?.maxHeight,bodyHeight:te?.height}}catch{return}})()}),h=()=>{r.scrollTop=0,r.scrollLeft=0,a&&(a.scrollTop=0,a.scrollLeft=0),o&&(o.scrollTop=0,o.scrollLeft=0)},p=(typeof F=="number"&&Number.isFinite(F)&&F>=0?F:260)+220;console.log(`[RTE collapse debug][${U.current}] pre-collapse lastScrollStateRef`,Ye.current),console.log(`[RTE collapse debug][${U.current}] lock start (before reset)`,m()),h(),console.log(`[RTE collapse debug][${U.current}] lock start (after reset)`,m()),window.requestAnimationFrame(()=>{console.log(`[RTE collapse debug][${U.current}] lock start (after rAF)`,m())});const O=W=>{W.preventDefault(),W.stopPropagation(),h(),console.log(`[RTE collapse debug][${U.current}] prevented scroll event`,{type:W.type},m())},C=()=>console.log(`[RTE collapse debug][${U.current}] content scroll event`,m()),$=()=>console.log(`[RTE collapse debug][${U.current}] body scroll event`,m());r.addEventListener("wheel",O,{passive:!1}),r.addEventListener("touchmove",O,{passive:!1}),r.addEventListener("scroll",C,{passive:!0}),a&&(a.addEventListener("wheel",O,{passive:!1}),a.addEventListener("touchmove",O,{passive:!1}),a.addEventListener("scroll",$,{passive:!0}));const z=performance.now();let g=0;const Y=W=>{h(),W-z<p&&(g=window.requestAnimationFrame(Y))};g=window.requestAnimationFrame(Y);const Q=window.setTimeout(()=>{h(),console.log(`[RTE collapse debug][${U.current}] lock end (after timeout)`,m())},p);return()=>{r.removeEventListener("wheel",O),r.removeEventListener("touchmove",O),r.removeEventListener("scroll",C),a&&(a.removeEventListener("wheel",O),a.removeEventListener("touchmove",O),a.removeEventListener("scroll",$)),window.cancelAnimationFrame(g),window.clearTimeout(Q),console.log(`[RTE collapse debug][${U.current}] lock cleanup`,m())}},[s,F]),c.useEffect(()=>{if(s)return;let r=0;return r=window.requestAnimationFrame(()=>{ct()}),()=>window.cancelAnimationFrame(r)},[s,xe,V,Ce,lt.length,it.length,ct]),c.useEffect(()=>{const r=typeof F=="number"&&Number.isFinite(F)&&F>=0?F:260;if(r<=0){tt(!1);return}tt(!0);const a=window.setTimeout(()=>tt(!1),r);return()=>window.clearTimeout(a)},[s,F]),c.useEffect(()=>{if(t.length>0){ge(!1);return}const r=()=>{if(!l.current){ge(!0);return}const o=l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",m=l.current.querySelectorAll('[data-type="variable"]'),h=l.current.querySelectorAll('[data-type="upload"]');let k=!1;m.forEach(O=>{(O.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(k=!0)}),h.forEach(O=>{O.querySelector(".upload-inner-wrapper.has-file")&&(k=!0)});const p=!o&&!k;ge(p),t.length===0&&he(!p)};r();const a=new MutationObserver(r);return l.current&&a.observe(l.current,{childList:!0,subtree:!0,characterData:!0}),()=>{a.disconnect()}},[t]);const Mn=r=>{if(d){r.preventDefault();return}r.preventDefault();const a=r.clipboardData.getData("text/plain"),o=window.getSelection();if(o&&o.rangeCount>0){const p=o.anchorNode;if(p){let O=null;if(p.nodeType===Node.ELEMENT_NODE?O=p.closest('[data-type="variable"]'):p.nodeType===Node.TEXT_NODE&&p.parentElement&&(O=p.parentElement.closest('[data-type="variable"]')),O){const C=O.dataset.multiKey;if(C){const $=/[、,,\s\n\r\t]+/,z=a.split($).map(g=>g.trim()).filter(g=>g.length>0);if(z.length>1){const g=parseInt(O.dataset.index||"0",10),Y=t.find(ye=>ye.type==="multi-variable"&&ye.key===C)?.maxCount||9,Q=Ce[C]||1,W=Math.min(g+z.length,Y);W>Q&&Ae(pe=>({...pe,[C]:W}));const te=[];for(let pe=0;pe<Q;pe++){const ye=`${C}_${pe}`,Se=l.current.querySelector(`[data-type="variable"][data-key="${ye}"][data-multi-key="${C}"]`);if(Se){const Me=Se.innerText.replace(/[\u200B\n]/g,"").trim();te.push(Me)}}te.splice(g,1,...z.slice(0,Y-g));const ae=te.slice(0,Y);ae.length>0&&ae[ae.length-1]!==""&&ae.length<Y&&ae.push("");const ce=Math.max(ae.length,1),de={};ae.forEach((pe,ye)=>{pe&&(de[`${C}_${ye}`]=pe)}),l.current.querySelectorAll('[data-type="variable"]').forEach(pe=>{const ye=pe.dataset.key,Se=pe.dataset.multiKey;if(ye&&Se!==C){const Me=pe.innerText.replace(/[\u200B\n]/g,"").trim();Me&&(de[ye]=Me)}}),l.current.__tempVariableValues=de,Ae(pe=>({...pe,[C]:ce}));return}}}}}let m=!1,h="";const k=window.getSelection();if(k&&k.rangeCount>0){const p=k.anchorNode;if(p){let O=null;if(p.nodeType===Node.ELEMENT_NODE?O=p.closest('[data-type="variable"]'):p.nodeType===Node.TEXT_NODE&&p.parentElement&&(O=p.parentElement.closest('[data-type="variable"]')),O){const C=O.getAttribute("data-node-type")||"",$=O.dataset.key;if(C==="markdown"&&$&&/20\d{2}-\d{2}-\d{2}/.test(a))m=!0,h=$,Vt.current[$]=a,Ee(z=>({...z,[$]:{...z[$],status:"loading",error:void 0}}));else if(C==="report-url"&&$){document.execCommand("insertText",!1,a),ut(),setTimeout(()=>{const z=O.innerText.replace(/[\u200B\n]/g,"").trim();nt.current($,z)},0);return}}}}if(m&&h){setTimeout(()=>{We.current(h,a)},0);return}document.execCommand("insertText",!1,a),ut(),setTimeout(()=>{/20\d{2}-\d{2}-\d{2}/.test(a)&&rt.current.tableData?.status==="success"&&(Ee(O=>({...O,tableData:{status:"loading",modules:[],lastParsedText:a,error:void 0}})),setTimeout(()=>{Vt.current.tableData=a,We.current("tableData",a)},0))},0)},Dn=r=>{if(!r.target.files){r.target&&(r.target.value=""),x(null),A(null),J(null);return}const a=10*1024*1024,o=h=>h.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(h.name||""),m=h=>o(h)&&h.size>a;if(I&&r.target.files&&r.target.files.length>0){const h=I,k=t.find($=>$.type==="upload"&&$.key===h),p=Array.from(r.target.files),O=p.filter($=>!m($)),C=p.length-O.length;if(C>0&&T.error(`已自动过滤 ${C} 张超过 10MB 的图片,仅允许上传 10MB 以内图片`),k&&typeof k.maxCount=="number"&&typeof k.minCount=="number"){const $=k.maxCount,z=typeof X=="number"?X:0;y(g=>{const Y={...g};let Q=Math.min(Math.max(z,0),$-1);for(const W of O){for(;Q<$&&Y[`${h}-${Q}`]!=null;)Q+=1;if(Q>=$)break;Y[`${h}-${Q}`]=W,Q+=1}return Y})}}else if(b&&r.target.files[0]){const h=r.target.files[0],k=b;m(h)?T.error("图片大小不能超过 10MB(仅允许上传 10MB 以内图片)"):y(p=>({...p,[k]:h}))}r.target&&(r.target.value=""),x(null),A(null),J(null)},Ut=r=>{y(a=>{const o={...a};return delete o[r],o})},Pn=r=>{const a=r.target;if(a.closest(".rte-datepicker-wrapper")||a.closest(".rte-datepicker-host")||a.closest(".rte-select-wrapper")||a.closest(".rte-select-host")||a.closest(".ant-select-dropdown"))return;if(a.closest(".tag-close-btn")){if(r.preventDefault(),r.stopPropagation(),D)return;ee(null),M?M():l.current&&(l.current.innerHTML="",l.current.focus());return}if(D){const h=a.closest(".tag-node"),k=a.closest('[data-type="text"]');if(h||k){r.preventDefault(),r.stopPropagation();const p=window.getSelection();p&&p.removeAllRanges();return}}a.closest('[data-type="variable"]')||(ie.current={x:r.clientX,y:r.clientY},se.current=!1,a.closest(".file-remove-btn")&&(r.preventDefault(),r.stopPropagation()))},Hn=r=>{if(!r.target.closest('[data-type="variable"]')&&ie.current){const m=Math.abs(r.clientX-ie.current.x),h=Math.abs(r.clientY-ie.current.y);(m>3||h>3)&&(se.current=!0)}},Bn=r=>{if(r.target.closest('[data-type="variable"]')){ie.current=null,se.current=!1;return}ie.current=null,se.current=!1},Vn=r=>{if(d)return;s&&H?.(!1);const a=r.target;if(a.closest('[data-type="datepicker"]'))return;if(a.closest(".tag-close-btn")){r.preventDefault(),r.stopPropagation();return}if(t.length===0)return;const h=(g,Y)=>{if(!l.current)return;Array.from(l.current.children).forEach(W=>{if(W!==g)if(Y)W.dataset.prevDisplay===void 0&&(W.dataset.prevDisplay=W.style.display||""),W.dataset.rteForceHidden="1",W.style.setProperty("display","none","important");else{if(W.dataset.prevDisplay!==void 0){const te=W.dataset.prevDisplay;te?W.style.display=te:W.style.removeProperty("display"),delete W.dataset.prevDisplay}else W.style.removeProperty("display");delete W.dataset.rteForceHidden}})},k=a.closest(".rte-textarea-toggle");if(k){r.preventDefault(),r.stopPropagation();const g=k.closest(".rte-textarea-wrapper"),Y=g?.querySelector('[data-type="textarea"]'),W=!(k.getAttribute("data-expanded")==="true");k.setAttribute("data-expanded",String(W)),k.textContent=W?"收起":"展开",g&&g.classList.toggle("rte-textarea-expanded",W);const te=g?.closest(".rte-textarea-required");if(te?te.classList.toggle("rte-textarea-overlay",W):g&&g.classList.toggle("rte-textarea-overlay",W),Y)if(W)Y.classList.add("rte-textarea-expanded"),Y.style.maxHeight="none",Y.style.height="100%";else{Y.classList.remove("rte-textarea-expanded");const ae=Y.dataset.maxHeight||"252";Y.style.maxHeight=`${ae}px`,Y.style.height="auto"}l.current&&(W?l.current.classList.add("rte-overlay-active"):l.current.classList.remove("rte-overlay-active"));return}const p=a.closest(".rte-richtext-toggle");if(p){r.preventDefault(),r.stopPropagation();const g=p.closest(".rte-richtext-wrapper"),Y=g?.querySelector('[data-type="richtext"]'),W=!(p.getAttribute("data-expanded")==="true");((de,fe)=>{de.setAttribute("data-expanded",String(fe)),de.innerHTML=fe?'<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>'})(p,W);const ae=g?.closest(".rte-richtext-required");ae?ae.classList.toggle("rte-richtext-expanded",W):g&&g.classList.toggle("rte-richtext-expanded",W);const ce=g?.closest(".exclusion-wrapper")||g?.parentElement;if(Y&&(W?(Y.style.height="100%",Y.style.overflow="auto"):(Y.style.height="",Y.style.overflow="")),ce&&(ce.classList.toggle("rte-richtext-host-expanded",W),h(ce,W)),l.current){if(l.current.classList.toggle("rte-richtext-fullscreen-active",W),K.current?.classList.toggle("rte-richtext-container-expanded",W),K.current)if(W){const de=Math.ceil(K.current.getBoundingClientRect().height||0);de>0&&K.current.style.setProperty("--rte-richtext-fullscreen-height",`${de}px`)}else K.current.style.removeProperty("--rte-richtext-fullscreen-height");if(W)be.current=l.current.scrollTop||0,setTimeout(()=>{l.current&&(l.current.scrollTop=0,l.current.scrollLeft=0)},0);else{const de=be.current||0;setTimeout(()=>{l.current&&(l.current.scrollTop=de)},0)}}return}if(a.closest('[data-type="text"]')){r.preventDefault(),r.stopPropagation();const g=window.getSelection();g&&g.removeAllRanges();return}if(D&&a.closest(".tag-node")){r.preventDefault(),r.stopPropagation();const Y=window.getSelection();Y&&Y.removeAllRanges();return}if(a.closest('[data-type="variable"]')){if(se.current)return;setTimeout(()=>{const g=window.getSelection();g&&!g.isCollapsed||Ze(l)},10);return}const $=a.closest(".file-remove-btn");if($){r.preventDefault(),r.stopPropagation();const g=$.closest('[data-type="upload"]'),Y=g?.dataset.key,Q=g?.dataset.batchKey;if(Y)if(Q){const W=t.find(te=>te.type==="upload"&&te.key===Q);if(W&&typeof W.maxCount=="number"&&typeof W.minCount=="number"){const te=W.maxCount;y(ae=>{const ce={...ae},de=[];for(let fe=0;fe<te;fe++){const pe=`${Q}-${fe}`,ye=ce[pe];ye!=null&&pe!==Y&&de.push(ye)}for(let fe=0;fe<te;fe++)delete ce[`${Q}-${fe}`];return de.forEach((fe,pe)=>{ce[`${Q}-${pe}`]=fe}),ce})}else Ut(Y)}else Ut(Y);return}const z=a.closest('[data-type="upload"]');if(z){const g=z.dataset.key,Y=z.dataset.batchKey,Q=z.dataset.batchIndex;if(g){const W=Y||g,te=t.find(ae=>ae.type==="upload"&&ae.key===W);if(_.current&&(te?.accept?_.current.accept=te.accept:te?.acceptType==="image"?_.current.accept="image/*":te?.acceptType==="file"?_.current.accept=".csv,.xlsx,.xls,.txt,.pdf,.doc,.docx,.json":_.current.accept=""),Y){const ae=t.find(ce=>ce.type==="upload"&&ce.key===Y);if(ae&&typeof ae.maxCount=="number"&&typeof ae.minCount=="number"){const ce=ae.maxCount,de=V[g]!=null,fe=Q!=null?Number.parseInt(Q,10):NaN;if(de){_.current&&(_.current.multiple=!1),A(null),J(null),x(g),_.current?.click();return}let pe=0;for(let ye=0;ye<ce;ye++)V[`${Y}-${ye}`]!=null&&(pe+=1);pe<ce&&_.current?(_.current.multiple=!0,A(Y),J(Number.isFinite(fe)?fe:null),x(null),_.current.click()):(_.current&&(_.current.multiple=!1),A(null),J(null),x(g),_.current?.click())}else _.current&&(_.current.multiple=!1),A(null),J(null),x(g),_.current?.click()}else _.current&&(_.current.multiple=!1),A(null),J(null),x(g),_.current?.click()}return}},On=r=>{const o=r.target.closest('[data-type="variable"]');if(o){const m=window.getSelection();if(m){const h=document.createRange(),k=o.textContent||"";if(k.replace(/\u200B/g,"")){let O=0,C=k.length;k.startsWith("")&&(O=1),k.endsWith("")&&k.length>1&&(C=k.length-1);const $=o.firstChild;$&&$.nodeType===Node.TEXT_NODE?(h.setStart($,O),h.setEnd($,C)):h.selectNodeContents(o)}else h.selectNodeContents(o),h.collapse(!0);m.removeAllRanges(),m.addRange(h)}}},ut=()=>{if(t.length===0){if(l.current){const o=!(l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");ge(o),he(!o)}return}if(Ze(l),l.current&&l.current.querySelectorAll('[data-type="variable"][data-node-type="report-url"]').forEach(o=>{const m=o.dataset.key;if(!m)return;o.innerText.replace(/[\u200B\n]/g,"").trim()||Ve(k=>{const p=k[m];return!p||p.status==="idle"&&(!p.modules||p.modules.length===0)?k:{...k,[m]:{status:"idle",modules:[],lastParsedUrl:void 0,error:void 0}}})}),l.current&&l.current.querySelectorAll('[data-type="variable"][data-node-type="markdown"]').forEach(o=>{const m=o.dataset.key;if(!m)return;o.innerText.replace(/[\u200B\n]/g,"").trim()||Ee(k=>{const p=k[m];return!p||p.status==="idle"&&(!p.modules||p.modules.length===0)?k:{...k,[m]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}})}),l.current&&l.current.querySelectorAll('[data-type="richtext"][data-node-type="markdown-module"]').forEach(o=>{const m=o.dataset.key;if(!m)return;o.innerText.replace(/[\u200B\n]/g,"").trim()||Ee(k=>{const p=k[m];return!p||p.status==="idle"?k:{...k,[m]:{status:"idle",modules:[],lastParsedText:void 0,error:void 0}}})}),l.current&&l.current.querySelectorAll('[data-type="variable"]').forEach(o=>{const m=o.querySelector(".variable-info-icon");if(m){let h=!1;const k=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,{acceptNode:p=>m.contains(p)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;k.nextNode();)if(k.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){h=!0;break}h?m.classList.add("hidden"):m.classList.remove("hidden")}}),s||window.requestAnimationFrame(()=>{ct()}),Je(l,xe,V),Qe(l,xe,V,he),!l.current)return;t.filter(a=>a.type==="multi-variable"&&a.key).forEach(a=>{if(!a.key)return;const o=a.maxCount||9,m=Ce[a.key]||1,h=[];for(let $=0;$<m;$++){const z=`${a.key}_${$}`,g=l.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${a.key}"]`);if(g){const Y=g.innerText.replace(/[\u200B\n]/g,"").trim();h.push(Y)}}const p=(h[h.length-1]||"")==="";let O=!1,C=-1;for(let $=0;$<h.length-1;$++)if(h[$]===""){O=!0,C=$;break}if(O&&C>=0){const $=window.getSelection();if($&&$.rangeCount>0){const W=$.getRangeAt(0),te=W.startContainer,ae=te.nodeType===Node.ELEMENT_NODE?te.closest('[data-type="variable"][data-multi-key]'):te.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ae){const ce=ae.dataset.key;if(ce){const de=document.createRange();de.setStartBefore(ae),de.setEnd(W.startContainer,W.startOffset);const fe=de.toString().length;re.current={key:ce,offset:fe}}}}const z=[...h];for(let W=C;W<z.length-1;W++)z[W]=z[W+1];z.pop();const g={};z.forEach((W,te)=>{W&&(g[`${a.key}_${te}`]=W)});const Y=Math.max(p?z.length:z.length+1,1);l.current.querySelectorAll('[data-type="variable"]').forEach(W=>{const te=W.dataset.key,ae=W.dataset.multiKey;if(te&&ae!==a.key){const ce=W.innerText.replace(/[\u200B\n]/g,"").trim();ce&&(g[te]=ce)}}),l.current.__tempVariableValues=g,Ae(W=>({...W,[a.key]:Y}));return}if(!p){const $=m-1,z=`${a.key}_${$}`,g=l.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${a.key}"]`);if(g&&g.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&m<o){const Q=window.getSelection();if(Q&&Q.rangeCount>0){const W=Q.getRangeAt(0),te=W.startContainer,ae=te.nodeType===Node.ELEMENT_NODE?te.closest('[data-type="variable"][data-multi-key]'):te.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ae){const ce=ae.dataset.key;if(ce){const de=document.createRange();de.setStartBefore(ae),de.setEnd(W.startContainer,W.startOffset);const fe=de.toString().length;re.current={key:ce,offset:fe}}}}Ae(W=>({...W,[a.key]:m+1}))}}})};c.useLayoutEffect(()=>{const r=l.current;if(!r)return;const a=new Map,o=k=>{const p=k.target,O=k.relatedTarget;!p||!l.current||!l.current.contains(p)||O&&l.current.contains(O)||setTimeout(()=>{if(l.current){if(t.length===0){const C=l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";he(C.length>0);return}Ze(l),Je(l,xe,V),Qe(l,xe,V,he)}},0)};r.addEventListener("blur",o,!0);const m=()=>{if(!l.current)return;a.forEach((O,C)=>{C.removeEventListener("blur",O,!1)}),a.clear();const k=l.current.querySelectorAll('[data-type="variable"][data-multi-key]'),p=O=>{O.stopPropagation(),O.stopImmediatePropagation();const C=O.target;if(!C||!l.current||!l.current.contains(C))return;const $=C.closest('[data-type="variable"][data-multi-key]');if(!$||!l.current.contains($))return;let z=!1;if(a.forEach((de,fe)=>{(fe===$||fe.contains(C))&&(z=!0)}),!z)return;const g=$.dataset.multiKey,Y=$.dataset.key,Q=$.dataset.index;if(!g||!Y||Q===void 0)return;const W=O.relatedTarget;if(!(!W||!l.current.contains(W)))return;const ae=$.innerText.replace(/[\u200B\n]/g,"").trim(),ce=/[、,,\s]+/;if(ce.test(ae)){const pe=ae.split(ce).map(ye=>ye.trim()).filter(ye=>ye.length>0).slice(0,9);if(pe.length>1){const ye=t.find(Se=>Se.type==="multi-variable"&&Se.key===g);if(ye){const Se=Ce[g]||1,Me=parseInt(Q,10),Kt=ye.maxCount||9,dt=[];for(let we=0;we<Se;we++){const De=`${g}_${we}`,Ue=l.current.querySelector(`[data-type="variable"][data-key="${De}"][data-multi-key="${g}"]`);if(Ue){const Ke=Ue.innerText.replace(/[\u200B\n]/g,"").trim();dt.push(Ke)}}dt.splice(Me,1,...pe);const _e=dt.slice(0,Kt);_e.length>0&&_e[_e.length-1]!==""&&_e.length<Kt&&_e.push("");const Un=Math.max(_e.length,1),pt={};_e.forEach((we,De)=>{we&&(pt[`${g}_${De}`]=we)}),l.current.querySelectorAll('[data-type="variable"]').forEach(we=>{const De=we.dataset.key,Ue=we.dataset.multiKey;if(De&&Ue!==g){const Ke=we.innerText.replace(/[\u200B\n]/g,"").trim();Ke&&(pt[De]=Ke)}}),l.current.__tempVariableValues=pt,Ae(we=>({...we,[g]:Un}))}}}};k.forEach(O=>{O.addEventListener("blur",p,!1),a.set(O,p)})},h=setTimeout(()=>{m()},0);return()=>{clearTimeout(h),r.removeEventListener("blur",o,!0),a.forEach((k,p)=>{p.removeEventListener("blur",k,!1)}),a.clear()}},[t,xe,Ce,V]);const Fn=r=>{if(d){r.preventDefault();return}if(r.key==="Enter"){const o=r.target,m=!!o?.closest?.('[data-type="richtext"]'),h=o?.tagName==="TEXTAREA"||!!o?.closest?.('[data-type="textarea"]');if(!m&&!h){r.preventDefault();return}}const a=window.getSelection();if(a&&a.rangeCount>0){const o=a.anchorNode;let m=null;if(o&&(o.nodeType===Node.ELEMENT_NODE?m=o.closest('[data-type="text"]'):o.nodeType===Node.TEXT_NODE&&o.parentElement&&(m=o.parentElement.closest('[data-type="text"]'))),m){if(r.preventDefault(),r.stopPropagation(),l.current){const h=l.current.querySelector('[data-type="variable"], [data-type="upload"]');h&&h.focus()}return}}if(D&&a&&a.rangeCount>0){const o=a.anchorNode;let m=null;if(o&&(o.nodeType===Node.ELEMENT_NODE?m=o.closest(".tag-node"):o.nodeType===Node.TEXT_NODE&&o.parentElement&&(m=o.parentElement.closest(".tag-node"))),m){if(r.preventDefault(),r.stopPropagation(),l.current){const h=l.current.querySelector('[data-type="variable"], [data-type="upload"]');h&&h.focus()}return}}if(r.key==="Escape"&&l.current){if(D){r.preventDefault();return}l.current.innerHTML="",l.current.focus()}if(r.key==="Backspace"){const o=window.getSelection();if(o&&o.rangeCount>0){const m=o.getRangeAt(0),h=o.anchorNode;if(D){let p=null,O=null;if(h&&(h.nodeType===Node.ELEMENT_NODE?(p=h.closest(".tag-node"),O=h.closest('[data-type="text"]')):h.nodeType===Node.TEXT_NODE&&h.parentElement&&(p=h.parentElement.closest(".tag-node"),O=h.parentElement.closest('[data-type="text"]'))),(p||O)&&m.collapsed&&m.startOffset===0){r.preventDefault();return}}let k=null;if(h&&(h.nodeType===Node.ELEMENT_NODE?k=h.closest('[data-type="variable"]'):h.nodeType===Node.TEXT_NODE&&h.parentElement&&(k=h.parentElement.closest('[data-type="variable"]'))),k){if(!m.collapsed)return;const p=k.innerText;if(p===""||p===""){r.preventDefault();return}if(m.startOffset===0){r.preventDefault();return}if(p.startsWith("")&&m.startOffset===1){r.preventDefault();return}}}}},Gn=()=>{if(i||d||L||!ue||!l.current)return;if(t.length===0){const k=l.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!k)return;if(f(k,k),l.current){l.current.textContent="";const p=new Event("input",{bubbles:!0});l.current.dispatchEvent(p)}return}const r=l.current;let a="";const o={},m=k=>{if(!(k.nodeType===Node.ELEMENT_NODE&&k.style.display==="none")){if(k.nodeType===Node.TEXT_NODE)a+=(k.textContent||"").replace(/\u200B/g,"");else if(k.nodeType===Node.ELEMENT_NODE){const p=k,O=p.dataset.type,C=p.dataset.key;if(O==="variable"&&C){let $="";const z=document.createTreeWalker(p,NodeFilter.SHOW_TEXT,{acceptNode:Y=>{const Q=p.querySelector(".variable-info-icon");return Q&&Q.contains(Y)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;z.nextNode();)$+=z.currentNode.textContent||"";const g=$.replace(/[\u200B\n]/g,"").trim();if(g){const Y=p.dataset.multiKey;if(Y){(!o[Y]||!Array.isArray(o[Y]))&&(o[Y]=[]);const Q=o[Y];Q.push(g),Q.length>1&&(a+=" "),a+=g}else o[C]=g,a+=g;if(p.dataset.nodeType==="report-url")if(o.url===void 0)o.url=g;else{const Q=o.url;Array.isArray(Q)?Q.push(g):o.url=[String(Q),g]}if(p.dataset.nodeType==="markdown"){const Q=p.dataset.sourceTextKey||`${C}__sourceText`;if(o[Q]===void 0)o[Q]=g;else{const te=o[Q];Array.isArray(te)?te.push(g):o[Q]=[String(te),g]}const W=`${C}__markdown`;o[W]===void 0&&(o[W]=[At(g)])}}}else if(O==="select"&&C){const $=(p.getAttribute("data-value")||"").trim();$&&(o[C]=$,a+=$)}else if(O==="textarea"&&C){const z=(p.value||"").replace(/\u200B/g,"").trim();z&&(o[C]=z,a+=z)}else if(O==="richtext"&&C){const $=p,z=$.dataset.nodeType,g=($.textContent||"").replace(/\u200B/g,"").trim();if(g)if(z==="report-module"||z==="markdown-module"){(!o[C]||!Array.isArray(o[C]))&&(o[C]=[]);const Y=o[C];Y.push(g),Y.length>1&&(a+=" "),a+=g}else o[C]=g,a+=g}else if(O==="datepicker"&&C){const z=(p.getAttribute("data-value")||"").trim();if(z)if(z.includes(",")){const g=z.split(",");g.length===2?(o[C]=g,a+=`[${g[0]}, ${g[1]}]`):(o[C]=z,a+=z)}else o[C]=z,a+=z}else if(O==="number-input"&&C){const z=(p.value||"").trim();z&&(o[C]=z,a+=z)}else if(O==="upload"&&C){const $=p.dataset.batchKey;if($){const z=t.find(g=>g.type==="upload"&&g.key===$);if(z&&typeof z.maxCount=="number"&&typeof z.minCount=="number"){const g=[];for(let Y=0;Y<z.maxCount;Y++){const Q=`${$}-${Y}`,W=V[Q];W&&g.push(W)}o[$]||(o[$]=g.length>0?g:null,g.length>0&&(a+=` [附带${g.length}个文件: ${g.map(Y=>Y.name).join(", ")}] `))}else o[C]=V[C]??null,V[C]&&(a+=` [附带文件: ${V[C]?.name}] `)}else o[C]=V[C]??null,V[C]&&(a+=` [附带文件: ${V[C]?.name}] `)}else{if(p.classList.contains("tag-close-btn")||p.classList.contains("file-remove-btn"))return;p.getAttribute("contenteditable")==="false"&&!O&&p.classList.contains("tag-node")?a+=p.innerText:p.childNodes.forEach(m)}}}};if(r.childNodes.forEach(m),a=a.trim(),!a)return;Object.keys($e).forEach(k=>{const p=$e[k];if(!p||!p.modules||p.modules.length===0)return;const O=p.modules.map(C=>(C?.markdown||"").trim()).filter(C=>C.length>0);O.length!==0&&(o[`${k}__markdown`]=O)});const h=new FormData;h.append("fullPrompt",a),Object.keys(o).forEach(k=>{const p=o[k];if(p!=null)if(p instanceof File)h.append(k,p);else if(Array.isArray(p)){const O=t.some(g=>g.type==="multi-variable"&&g.key===k),C=t.some(g=>g.type==="report-url"&&g.key===k),$=k.endsWith("__markdown");O||C||$||k==="url"?p.forEach(g=>{g!=null&&g!==""&&h.append(k,String(g))}):p.forEach((g,Y)=>{g!=null&&(g instanceof File?h.append(`${k}[${Y}]`,g):typeof g=="string"?h.append(`${k}[${Y}]`,g):h.append(`${k}[${Y}]`,String(g)))})}else typeof p=="string"?h.append(k,p):h.append(k,String(p))}),f(h,a)},zn={...v?{width:typeof v=="number"?`${v}px`:v}:{},...j?{border:j}:{},...S?{background:S}:{},...e?{maxHeight:typeof e=="number"?`${e}px`:e}:{},...n?{minHeight:typeof n=="number"?`${n}px`:n}:{},...e?{"--rte-richtext-fullscreen-height":typeof e=="number"?`${e}px`:e}:{}},jn=typeof F=="number"&&Number.isFinite(F)&&F>=0?F:260,Wn={overflow:"hidden"},Yn={maxHeight:s?`${ke}px`:`${Math.max(Ie,ke)}px`,overflow:s||In?"hidden":"auto",transition:`max-height ${jn}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height"};return w.jsxs("div",{className:"rich-text-editor",style:zn,"data-disabled":d,ref:K,children:[ne,w.jsx("div",{className:"rich-text-editor-content",ref:R,style:Wn,children:w.jsxs("div",{ref:G,className:"rich-text-editor-content-body",style:Yn,children:[w.jsx("div",{ref:l,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${me&&q?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":q,onMouseDown:Pn,onMouseMove:Hn,onMouseUp:Bn,onClick:Vn,onDoubleClick:On,onInput:ut,onKeyDown:Fn,onPaste:Mn}),w.jsx("input",{type:"file",ref:_,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:Dn})]})}),w.jsxs("div",{className:"rich-text-editor-footer",children:[w.jsx("div",{className:"rich-text-editor-footer-left",children:w.jsxs("div",{className:"rich-text-editor-brand",children:[w.jsxs("div",{className:"rte-brand-badge",children:[w.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),w.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),N!=="hideAgent"&&w.jsx(oe.Dropdown,{placement:"topLeft",menu:{items:P.filter(r=>r.isShowNew!==1).map(r=>({key:r.key,label:w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.icon&&w.jsx("i",{className:r.icon}),w.jsx("span",{children:r.label})]}),onClick:()=>{B?.(r)}}))},trigger:["click"],disabled:d||i,overlayClassName:"rte-agent-dropdown",children:w.jsxs("div",{className:"rte-agent-badge",style:{cursor:P.length>0?"pointer":"default"},children:[w.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),w.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(()=>{const r=t.find(o=>o.type==="tag");if(!r||!r.text)return null;const a=P.find(o=>o.label===r.text);return!a||a.points===void 0||a.points===null?null:w.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[w.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),w.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(a.points)]}),a.labelValue===2&&w.jsx("div",{className:"rte-limited-free-badge",children:w.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})})(),w.jsx("button",{type:"button",onClick:Gn,disabled:i||d||L||!ue,className:"rich-text-editor-send-button",children:i||L?w.jsx("span",{className:"rte-send-spinner"}):w.jsx("i",{className:"iconfont icon-fasong"})})]})]}),Z?.anchorEl&&(()=>{if(!document.body.contains(Z.anchorEl))return null;let r="",a={background:"var(--neutral-800, #262626)"};if(Z.type==="upload"){const m=Z.anchorEl.dataset.tooltip;m?r=m:r=t.find(k=>k.type==="upload"&&k.key===Z.key)?.tooltip||""}else if(Z.type==="tag")r=Z.anchorEl.dataset.tooltip||"";else if(Z.type==="upload-label")r=Z.anchorEl.querySelector(".upload-label[data-file-name]")?.dataset.fileName||Z.anchorEl.dataset.fileName||"";else if(Z.type==="variable")r=Z.anchorEl.dataset.tooltip||"";else if(Z.type==="upload-preview"){const m=V[Z.key],h=!!m&&(m.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(m.name||""));if(m&&h){const k=URL.createObjectURL(m);r=w.jsx("div",{className:"rte-upload-preview",children:w.jsx("img",{className:"rte-upload-preview-img",src:k,alt:m.name})}),a={background:"#fff",padding:0,borderRadius:4,boxShadow:"0 2px 12px 0 rgba(153, 153, 153, 0.25)"},setTimeout(()=>URL.revokeObjectURL(k),1e3)}else r=""}if(!r)return null;const o=Z.type==="upload-preview"?"#0A0A0A":"#fff";return Xe.createPortal(w.jsx(oe.Tooltip,{arrow:!1,title:Z.type==="upload-preview"?r:w.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:o},children:r}),open:!0,placement:Z.type==="upload-preview"?"topLeft":"top",getPopupContainer:()=>document.body,overlayInnerStyle:a,children:w.jsx("div",{style:{position:"fixed",left:`${Z.anchorEl.getBoundingClientRect().left}px`,top:`${Z.anchorEl.getBoundingClientRect().top-(Z.type==="upload-label"?4:0)}px`,width:`${Z.anchorEl.offsetWidth}px`,height:`${Z.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})(),it,lt]})};Nt.__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 _t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",kn=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],$n=({autoLoading:t,batchSize:f,loadingProgress:i,loadIcon:d,onBatchSizeChange:v,onLoadNextPage:D,onStartAutoLoad:P,onStopLoad:B})=>t&&i?w.jsxs("div",{className:"auto_load_progress",children:[d||w.jsx("img",{src:_t,alt:"自动加载",width:14,height:14}),w.jsxs("span",{children:["正在加载第",i.currentPage,"/",i.totalPages,"页"]}),w.jsx(oe.Progress,{percent:i.percentage,type:"line",size:[160,8]}),w.jsx("span",{onClick:B,className:"auto_load_stop_btn",children:"停止加载"})]}):w.jsxs("div",{className:"auto_load_container",children:[w.jsx("div",{onClick:D,className:"auto_load_next_btn",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:"加载下一页"}),w.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:[w.jsxs("div",{className:"auto_load_btn",onClick:t?void 0:P,children:[d||w.jsx("img",{src:_t,alt:"自动加载",width:14,height:14}),w.jsx("span",{children:"自动加载"})]}),w.jsx(oe.Select,{value:f,onChange:v,options:kn,disabled:t,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),En=({current:t,loadIcon:f,pageSize:i,total:d,cachedPages:v,loadedCount:D,autoLoading:P=!1,loadingProgress:B,onChange:M,onLoadNextPage:L,onStartAutoLoad:q,onStopLoading:j})=>{const[S,N]=c.useState(5),e=Math.ceil(d/i),n=c.useMemo(()=>v.length>=e,[v,e]),s=()=>Array.from({length:e},(H,F)=>F+1).filter(H=>!v.includes(H)).slice(0,S),u=(E,H,F)=>{const T=v.includes(E);return H==="prev"||H==="next"||H==="jump-prev"||H==="jump-next"?w.jsx("div",{className:"pageBox",children:F}):w.jsxs("div",{className:"pageBox",style:{backgroundColor:t===E?"#2563EB":"#f5f5f5",color:t===E?"#fff":T?"#171717":"#a3a3a3"},children:[E,!T&&w.jsx("span",{className:"unload_spot"})]})};return w.jsxs("div",{className:"pagination_footer",children:[w.jsxs("div",{className:"pagination_leftWrap",children:[w.jsxs("span",{className:"pagination_total",children:[w.jsx(Te.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",D,"/",d,"条数据"]}),!n&&w.jsx($n,{loadIcon:f||void 0,autoLoading:P,batchSize:S,loadingProgress:B,disabled:!L||!q,onBatchSizeChange:N,onLoadNextPage:()=>L?.(),onStartAutoLoad:()=>{const E=s();q?.(E)},onStopLoad:()=>j?.()})]}),w.jsx(oe.Pagination,{current:t,pageSize:i,total:d,onChange:E=>M(E),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:u})]})},Lt=t=>{const{loading:f,autoLoading:i,loadingProgress:d,columns:v=[],dataSource:D=[],total:P,current:B,pageSize:M,cachedPages:L,onChangePage:q,onLoadNextPage:j,onStartAutoLoad:S,onStopLoading:N,...e}=t,n=c.useRef(null),s=c.useCallback(u=>{q(u),L.includes(u)&&n.current?.scrollTo({key:`${(u-1)*M+1}`})},[L,q,M]);return w.jsxs("div",{className:"flex flex-col",children:[w.jsx(oe.Table,{ref:n,...e,columns:v,dataSource:D,pagination:!1,virtual:!0}),w.jsx(En,{loading:f,autoLoading:i,loadingProgress:d,current:B,pageSize:M,total:P,loadedCount:D.length,cachedPages:L,onChange:s,onLoadNextPage:j,onStartAutoLoad:S,onStopLoading:N})]})};Lt.__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 It=({texts:t=[],placeholder:f="请输入内容",animationSpeed:i=100,autoPlay:d=!0,value:v,onChange:D,...P})=>{const[B,M]=c.useState(""),[L,q]=c.useState(0),[j,S]=c.useState(!1),[N,e]=c.useState(!1),[n,s]=c.useState(!1),u=c.useRef(void 0),E=c.useRef(void 0),H=c.useRef(t),F=c.useRef(L),T=c.useRef(N),ne=c.useRef(B);c.useEffect(()=>{H.current=t,F.current=L,T.current=N,ne.current=B});const K=c.useCallback((y,b)=>{let x=0;s(!0);const I=()=>{x<y.length?(M(y.slice(0,x+1)),x++,E.current=window.setTimeout(I,i)):(s(!1),b?.())};I()},[i]),R=c.useCallback(y=>{let b=ne.current.length;const x=()=>{b>0?(M(ne.current.slice(0,b-1)),b--,E.current=window.setTimeout(x,i/2)):y?.()};x()},[i]),G=c.useCallback(()=>{if(H.current.length===0||T.current)return;S(!0);const y=H.current[F.current];ne.current?R(()=>{K(y,()=>{u.current=window.setTimeout(()=>{q(b=>(b+1)%H.current.length),S(!1)},2e3)})}):K(y,()=>{u.current=window.setTimeout(()=>{q(b=>(b+1)%H.current.length),S(!1)},2e3)})},[R,K]);c.useEffect(()=>(d&&t.length>0&&!N&&G(),()=>{u.current&&window.clearTimeout(u.current),E.current&&window.clearTimeout(E.current)}),[L,N,d,t.length,G]),c.useEffect(()=>{!j&&d&&t.length>0&&!N&&G()},[L,j,d,t.length,N,G]);const l=y=>{e(!0),u.current&&window.clearTimeout(u.current),E.current&&window.clearTimeout(E.current),S(!1),s(!1),P.onFocus?.(y)},_=y=>{e(!1),!v&&t.length>0&&(M(""),q(0)),P.onBlur?.(y)},U=y=>{D?.(y.target.value),P.onChange?.(y)},V=()=>N||v?f:B||f;return w.jsxs("div",{style:{position:"relative"},children:[w.jsx(oe.Input,{...P,value:v,onChange:U,onFocus:l,onBlur:_,placeholder:V(),style:{...P.style,position:"relative",zIndex:1}}),!N&&!v&&B&&w.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:[w.jsx("span",{children:B}),n&&w.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),w.jsx("style",{children:`
|
|
27
27
|
@keyframes blink {
|
|
28
28
|
0%, 50% { opacity: 1; }
|
|
29
29
|
51%, 100% { opacity: 0; }
|
|
30
30
|
}
|
|
31
|
-
`})]})};It.__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 Mt=({texts:t=[],placeholder:f="请输入内容",animationSpeed:i=100,autoPlay:d=!0,value:v="",onChange:D,onSubmit:P,maxLength:B=500,showCount:M=!0,submitText:L="发送",disabled:q=!1,rows:j=4,style:S,...N})=>{const[e,n]=c.useState(""),[s,u]=c.useState(0),[E,H]=c.useState(!1),[F,T]=c.useState(!1),[ne,K]=c.useState(!1),[
|
|
31
|
+
`})]})};It.__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 Mt=({texts:t=[],placeholder:f="请输入内容",animationSpeed:i=100,autoPlay:d=!0,value:v="",onChange:D,onSubmit:P,maxLength:B=500,showCount:M=!0,submitText:L="发送",disabled:q=!1,rows:j=4,style:S,...N})=>{const[e,n]=c.useState(""),[s,u]=c.useState(0),[E,H]=c.useState(!1),[F,T]=c.useState(!1),[ne,K]=c.useState(!1),[R,G]=c.useState(v||""),l=c.useRef(void 0),_=c.useRef(void 0),U=c.useRef(t),V=c.useRef(s),y=c.useRef(F),b=c.useRef(e),x=c.useRef(null);c.useEffect(()=>{U.current=t,V.current=s,y.current=F,b.current=e});const I=c.useCallback((re,me)=>{let ge=0;K(!0);const be=()=>{ge<re.length?(n(re.slice(0,ge+1)),ge++,_.current=window.setTimeout(be,i)):(K(!1),me?.())};be()},[i]),A=c.useCallback(re=>{let me=b.current.length;const ge=()=>{me>0?(n(b.current.slice(0,me-1)),me--,_.current=window.setTimeout(ge,i/2)):re?.()};ge()},[i]),X=c.useCallback(()=>{if(U.current.length===0||y.current)return;H(!0);const re=U.current[V.current];b.current?A(()=>{I(re,()=>{l.current=window.setTimeout(()=>{u(me=>(me+1)%U.current.length),H(!1)},2e3)})}):I(re,()=>{l.current=window.setTimeout(()=>{u(me=>(me+1)%U.current.length),H(!1)},2e3)})},[A,I]);c.useEffect(()=>(d&&t.length>0&&!F&&X(),()=>{l.current&&window.clearTimeout(l.current),_.current&&window.clearTimeout(_.current)}),[s,F,d,t.length,X]),c.useEffect(()=>{!E&&d&&t.length>0&&!F&&X()},[s,E,d,t.length,F,X]);const J=re=>{T(!0),l.current&&window.clearTimeout(l.current),_.current&&window.clearTimeout(_.current),H(!1),K(!1),N.onFocus?.(re)},Z=re=>{T(!1),!v&&t.length>0&&(n(""),u(0)),N.onBlur?.(re)},ee=re=>{const me=re.target.value;B&&me.length>B||(D?D(me):G(me),N.onChange?.(re))},se=()=>{const re=D?v:R;re.trim()&&!q&&(P?.(re),D||G(""))},ie=re=>{(re.ctrlKey||re.metaKey)&&re.key==="Enter"&&(re.preventDefault(),se()),N.onKeyDown?.(re)},ue=D?v:R,he=q||!ue.trim()||(B?ue.length>B:!1);return w.jsxs("div",{style:{position:"relative",...S},children:[w.jsxs("div",{style:{position:"relative"},children:[w.jsx("textarea",{ref:x,value:D?v:R,onChange:ee,onFocus:re=>{re.target.style.borderColor="#1890ff",re.target.style.boxShadow="0 0 0 2px rgba(24, 144, 255, 0.2)",J(re)},onBlur:re=>{re.target.style.borderColor="#d9d9d9",re.target.style.boxShadow="none",Z(re)},onKeyDown:ie,placeholder:F||ue?f:"",maxLength:B,rows:j,disabled:q,style:{width:"100%",minHeight:`${j*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",...N.style},...N}),!F&&!ue&&e&&w.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:[w.jsx("span",{children:e}),ne&&w.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),w.jsx("div",{style:{position:"absolute",bottom:8,right:8,zIndex:3},children:w.jsx(oe.Button,{type:"primary",size:"small",icon:w.jsx(Te.SendOutlined,{}),onClick:se,disabled:he,style:{borderRadius:6,minWidth:32,height:32,display:"flex",alignItems:"center",justifyContent:"center"},children:L})})]}),M&&w.jsxs("div",{style:{marginTop:4,textAlign:"right",fontSize:"12px",color:"#999"},children:[ue.length,"/",B]}),w.jsx("style",{children:`
|
|
32
32
|
@keyframes blink {
|
|
33
33
|
0%, 50% { opacity: 1; }
|
|
34
34
|
51%, 100% { opacity: 0; }
|
|
35
35
|
}
|
|
36
|
-
`})]})};Mt.__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 Re=({src:t,poster:f,width:i=300,height:d,videoWidth:v,videoHeight:D,showPlayButton:P=!0,autoPlayOnHover:B=!0,onClick:M,onVideoLoaded:L,onVideoPlay:q,onVideoPause:j,onVideoEnded:S,className:N,style:e,...n})=>{const s=c.useRef(null),[u,E]=c.useState(!1),[H,F]=c.useState(!1),[T,ne]=c.useState(!1),K=c.useCallback(()=>{s.current&&(s.current.play(),E(!0),q?.())},[q]),Q=c.useCallback(()=>{s.current&&(s.current.pause(),E(!1),j?.())},[j]),G=c.useCallback(I=>{I.stopPropagation(),u?Q():K()},[u,K,Q]),l=c.useCallback(()=>{F(!0),B&&!u&&K()},[B,u,K]),_=c.useCallback(()=>{F(!1),B&&u&&Q()},[B,u,Q]),U=c.useCallback(()=>{ne(!0),L?.()},[L]),V=c.useCallback(()=>{E(!0),q?.()},[q]),y=c.useCallback(()=>{E(!1),j?.()},[j]),x=c.useCallback(()=>{E(!1),S?.()},[S]),b=c.useCallback(I=>{M?.(I)},[M]);return w.jsx(oe.Card,{...n,className:`video-card ${N||""}`,style:{width:i,height:d,padding:0,overflow:"hidden",cursor:M?"pointer":"default",border:"none",borderRadius:0,...e},bordered:!1,onMouseEnter:l,onMouseLeave:_,onClick:b,children:w.jsxs("div",{className:"video-card-container",children:[w.jsx("video",{ref:s,src:t,poster:f,preload:"metadata",onLoadedData:U,onPlay:V,onPause:y,onEnded:x,muted:!0,loop:!0}),P&&w.jsx("div",{className:`video-play-button ${H?"hovered":""}`,onClick:G,children:u?w.jsx(Te.PauseCircleOutlined,{className:"play-icon"}):w.jsx(Te.PlayCircleOutlined,{className:"play-icon"})}),!T&&w.jsx("div",{className:"video-loading-mask",children:w.jsx("div",{className:"loading-spinner"})})]})})};Re.__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 Cn=t=>[".mp4",".webm",".ogg",".mov",".avi",".wmv",".flv",".mkv"].some(i=>t.toLowerCase().includes(i)),Sn=t=>t.type?t.type:Cn(t.url)?"video":"image",Dt=({items:t,columns:f,gap:i=0,responsive:d=!0,breakpoints:v={xs:1,sm:2,md:3,lg:4,xl:5,xxl:6},className:D,style:P,onClick:B})=>{const M=c.useRef(null),[L,q]=c.useState(f||v.md||3),j=c.useRef(new Map),S=c.useCallback(()=>{if(!d||f)return f||v.md||3;const s=window.innerWidth;return s<576?v.xs||1:s<768?v.sm||2:s<992?v.md||3:s<1200?v.lg||4:s<1600?v.xl||5:v.xxl||6},[d,f,v]),N=c.useCallback(()=>{if(!M.current)return;const s=L,u=M.current,H=(u.offsetWidth-i*(s-1))/s,F=new Array(s).fill(0);t.forEach((ne,K)=>{const Q=ne.id||K,G=j.current.get(Q);if(!G)return;const l=Math.min(...F),_=F.indexOf(l),U=_*(H+i),V=F[_];G.style.position="absolute",G.style.left=`${U}px`,G.style.top=`${V}px`,G.style.width=`${H}px`,F[_]+=G.offsetHeight+i});const T=Math.max(...F);u.style.height=`${T}px`},[t,L,i]);c.useEffect(()=>{const s=()=>{const u=S();u!==L&&q(u)};if(d)return window.addEventListener("resize",s),s(),()=>window.removeEventListener("resize",s)},[d,S,L]),c.useEffect(()=>{const s=setTimeout(()=>{N()},100);return()=>clearTimeout(s)},[t,L,N]);const e=c.useCallback(()=>{N()},[N]),n=c.useCallback(s=>{B&&B(s),s.onClick?.(s)},[B]);return w.jsx("div",{ref:M,className:`waterfall-container ${D||""}`,style:{position:"relative",width:"100%",...P},children:t.map((s,u)=>{const E=s.id||u,H=Sn(s);return w.jsx("div",{ref:F=>{F?j.current.set(E,F):j.current.delete(E)},className:"waterfall-item",children:H==="video"?w.jsx("div",{style:{width:"100%",position:"relative",paddingBottom:"56.25%",cursor:B||s.onClick?"pointer":"default"},children:w.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:w.jsx(Re,{src:s.url,poster:s.poster,width:"100%",height:"100%",onClick:()=>n(s),onVideoLoaded:e,autoPlayOnHover:!0,showPlayButton:!1})})}):w.jsx("div",{className:"waterfall-image-wrapper",onClick:()=>n(s),style:{cursor:B||s.onClick?"pointer":"default"},children:w.jsx("img",{src:s.url,alt:`瀑布流图片 ${u+1}`,className:"waterfall-image",onLoad:e,onError:e,style:{display:"block",width:"100%",height:"auto"}})})},E)})})};Dt.__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 Be=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Le={日期:"date",展现量:"impressions",点击量:"clicks","花费(元)":"cost",点击率:"clickRate","平均点击花费(元)":"avgClickCost","千次展现花费(元)":"cpm","总成交金额(元)":"totalTransactionAmount",总成交笔数:"totalTransactionCount",点击转化率:"clickConversionRate","直接成交金额(元)":"directTransactionAmount","间接成交金额(元)":"indirectTransactionAmount",直接成交笔数:"directTransactionCount",间接成交笔数:"indirectTransactionCount",投入产出比:"roi",含预售投产比:"roiWithPresale","总成交成本(元)":"totalTransactionCost","总预售成交金额(元)":"totalPresaleAmount",总预售成交笔数:"totalPresaleCount","直接预售成交金额(元)":"directPresaleAmount",直接预售成交笔数:"directPresaleCount","间接预售成交金额(元)":"indirectPresaleAmount",间接预售成交笔数:"indirectPresaleCount",拍下订单笔数:"orderCount","拍下订单金额(元)":"orderAmount",总购物车数:"totalCartCount",直接购物车数:"directCartCount",间接购物车数:"indirectCartCount",加购率:"addToCartRate","加购成本(元)":"addToCartCost",收藏宝贝数:"productCollectionCount",收藏店铺数:"shopCollectionCount",总收藏数:"totalCollectionCount",直接收藏宝贝数:"directProductCollectionCount",间接收藏宝贝数:"indirectProductCollectionCount",宝贝收藏率:"productCollectionRate","宝贝收藏成本(元)":"productCollectionCost","店铺收藏成本(元)":"shopCollectionCost",总收藏加购数:"totalCollectionAndCartCount","总收藏加购成本(元)":"totalCollectionAndCartCost",宝贝收藏加购数:"productCollectionAndCartCount","宝贝收藏加购成本(元)":"productCollectionAndCartCost",引导访问量:"guidedVisitCount",引导访问人数:"guidedVisitorCount",引导访问潜客数:"guidedPotentialCustomerCount",引导访问潜客占比:"guidedPotentialCustomerRate",引导访问率:"guidedVisitRate",深度访问量:"deepVisitCount",平均访问页面数:"avgPageViews",成交人数:"transactionCustomerCount",成交新客数:"newCustomerCount",成交新客占比:"newCustomerRate",人均成交笔数:"avgTransactionPerCustomer",人均成交金额:"avgAmountPerCustomer",优惠券领取量:"couponClaimCount",购物金充值笔数:"shoppingCreditRechargeCount","购物金充值金额(元)":"shoppingCreditRechargeAmount",旺旺咨询量:"wangwangConsultationCount",自然流量转化金额:"organicTrafficAmount",自然流量曝光量:"organicTrafficImpressions"},et=["日期","展现量","点击量","花费(元)","点击率","平均点击花费(元)","总成交金额(元)","总成交笔数","点击转化率","总购物车数","收藏宝贝数","收藏店铺数","总收藏数","宝贝收藏成本(元)","千次展现花费(元)","总预售成交金额(元)","总预售成交笔数","直接预售成交金额(元)","直接预售成交笔数","间接预售成交金额(元)","间接预售成交笔数","拍下订单笔数","拍下订单金额(元)","直接成交金额(元)","间接成交金额(元)","直接成交笔数","间接成交笔数","投入产出比","含预售投产比","总成交成本(元)","引导访问潜客数","成交人数","人均成交笔数","人均成交金额","直接购物车数","间接购物车数","加购率","店铺收藏成本(元)","总收藏加购数","总收藏加购成本(元)","宝贝收藏加购数","宝贝收藏加购成本(元)","宝贝收藏率","加购成本(元)","直接收藏宝贝数","间接收藏宝贝数","优惠券领取量","购物金充值笔数","购物金充值金额(元)","旺旺咨询量","引导访问量","引导访问人数","引导访问潜客占比","引导访问率","深度访问量","平均访问页面数","成交新客数","成交新客占比","自然流量转化金额","自然流量曝光量"],Tn=t=>{if(!t||t.trim()==="")return"";const f=t.trim();if(f.toLowerCase()==="nan")return"NaN";const i=f.match(/^(.+?)([+-]\d)/);return i?i[1].trim():f},An=t=>t.replace(/[\u00a0\u3000]/g," ").replace(/[–—]/g,"-").replace(/%(\d)/g,"% $1").replace(/NaN(\d)/gi,"NaN $1").replace(/(\.\d+)(\d,\d{3})/g,"$1 $2").replace(/(\.\d+)(\d+\.)/g,"$1 $2").replace(/(\.\d{2})(\d+[+-]\d+\.?\d*%)/g,"$1 $2").replace(/(,\d{3})(\d+[+-]\d+\.?\d*%)/g,"$1 $2").split(/\s+/).map(i=>i.trim()).filter(i=>i!==""),Pt=t=>{const f=(t||"").replace(/[\u00a0\u3000]/g," "),i=/20\d{2}-\d{2}-\d{2}/g,d=f.match(i)||[];if(d.length===0)return{markdown:"",jsonData:[]};const v=f.split(i).filter(N=>N.trim()!=="");let D=0;v.length>0&&v[0].includes("展现量")&&(D=1);const P=et.length-1,B=[];d.forEach((N,e)=>{const n=e+D;if(n>=v.length)return;const s=v[n];let u=s.split(/[\r\n]+/).map(H=>H.trim()).filter(H=>H!=="");u.length<P&&(u=An(s));const E={};E[Le.日期]=N,et.slice(1).forEach((H,F)=>{const T=F*2,ne=u[T]||"",K=Tn(ne),Q=Le[H];Q&&(E[Q]=K)}),B.push(E)});const M=et.filter(N=>{const e=Le[N];return B.some(n=>n[e])}),L=`| ${M.join(" | ")} |`,q=`| ${M.map(()=>"---").join(" | ")} |`,j=B.map(N=>`| ${M.map(n=>{const s=Le[n];return N[s]||"-"}).join(" | ")} |`);return{markdown:[L,q,...j].join(`
|
|
36
|
+
`})]})};Mt.__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 Re=({src:t,poster:f,width:i=300,height:d,videoWidth:v,videoHeight:D,showPlayButton:P=!0,autoPlayOnHover:B=!0,onClick:M,onVideoLoaded:L,onVideoPlay:q,onVideoPause:j,onVideoEnded:S,className:N,style:e,...n})=>{const s=c.useRef(null),[u,E]=c.useState(!1),[H,F]=c.useState(!1),[T,ne]=c.useState(!1),K=c.useCallback(()=>{s.current&&(s.current.play(),E(!0),q?.())},[q]),R=c.useCallback(()=>{s.current&&(s.current.pause(),E(!1),j?.())},[j]),G=c.useCallback(I=>{I.stopPropagation(),u?R():K()},[u,K,R]),l=c.useCallback(()=>{F(!0),B&&!u&&K()},[B,u,K]),_=c.useCallback(()=>{F(!1),B&&u&&R()},[B,u,R]),U=c.useCallback(()=>{ne(!0),L?.()},[L]),V=c.useCallback(()=>{E(!0),q?.()},[q]),y=c.useCallback(()=>{E(!1),j?.()},[j]),b=c.useCallback(()=>{E(!1),S?.()},[S]),x=c.useCallback(I=>{M?.(I)},[M]);return w.jsx(oe.Card,{...n,className:`video-card ${N||""}`,style:{width:i,height:d,padding:0,overflow:"hidden",cursor:M?"pointer":"default",border:"none",borderRadius:0,...e},bordered:!1,onMouseEnter:l,onMouseLeave:_,onClick:x,children:w.jsxs("div",{className:"video-card-container",children:[w.jsx("video",{ref:s,src:t,poster:f,preload:"metadata",onLoadedData:U,onPlay:V,onPause:y,onEnded:b,muted:!0,loop:!0}),P&&w.jsx("div",{className:`video-play-button ${H?"hovered":""}`,onClick:G,children:u?w.jsx(Te.PauseCircleOutlined,{className:"play-icon"}):w.jsx(Te.PlayCircleOutlined,{className:"play-icon"})}),!T&&w.jsx("div",{className:"video-loading-mask",children:w.jsx("div",{className:"loading-spinner"})})]})})};Re.__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 Cn=t=>[".mp4",".webm",".ogg",".mov",".avi",".wmv",".flv",".mkv"].some(i=>t.toLowerCase().includes(i)),Sn=t=>t.type?t.type:Cn(t.url)?"video":"image",Dt=({items:t,columns:f,gap:i=0,responsive:d=!0,breakpoints:v={xs:1,sm:2,md:3,lg:4,xl:5,xxl:6},className:D,style:P,onClick:B})=>{const M=c.useRef(null),[L,q]=c.useState(f||v.md||3),j=c.useRef(new Map),S=c.useCallback(()=>{if(!d||f)return f||v.md||3;const s=window.innerWidth;return s<576?v.xs||1:s<768?v.sm||2:s<992?v.md||3:s<1200?v.lg||4:s<1600?v.xl||5:v.xxl||6},[d,f,v]),N=c.useCallback(()=>{if(!M.current)return;const s=L,u=M.current,H=(u.offsetWidth-i*(s-1))/s,F=new Array(s).fill(0);t.forEach((ne,K)=>{const R=ne.id||K,G=j.current.get(R);if(!G)return;const l=Math.min(...F),_=F.indexOf(l),U=_*(H+i),V=F[_];G.style.position="absolute",G.style.left=`${U}px`,G.style.top=`${V}px`,G.style.width=`${H}px`,F[_]+=G.offsetHeight+i});const T=Math.max(...F);u.style.height=`${T}px`},[t,L,i]);c.useEffect(()=>{const s=()=>{const u=S();u!==L&&q(u)};if(d)return window.addEventListener("resize",s),s(),()=>window.removeEventListener("resize",s)},[d,S,L]),c.useEffect(()=>{const s=setTimeout(()=>{N()},100);return()=>clearTimeout(s)},[t,L,N]);const e=c.useCallback(()=>{N()},[N]),n=c.useCallback(s=>{B&&B(s),s.onClick?.(s)},[B]);return w.jsx("div",{ref:M,className:`waterfall-container ${D||""}`,style:{position:"relative",width:"100%",...P},children:t.map((s,u)=>{const E=s.id||u,H=Sn(s);return w.jsx("div",{ref:F=>{F?j.current.set(E,F):j.current.delete(E)},className:"waterfall-item",children:H==="video"?w.jsx("div",{style:{width:"100%",position:"relative",paddingBottom:"56.25%",cursor:B||s.onClick?"pointer":"default"},children:w.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:w.jsx(Re,{src:s.url,poster:s.poster,width:"100%",height:"100%",onClick:()=>n(s),onVideoLoaded:e,autoPlayOnHover:!0,showPlayButton:!1})})}):w.jsx("div",{className:"waterfall-image-wrapper",onClick:()=>n(s),style:{cursor:B||s.onClick?"pointer":"default"},children:w.jsx("img",{src:s.url,alt:`瀑布流图片 ${u+1}`,className:"waterfall-image",onLoad:e,onError:e,style:{display:"block",width:"100%",height:"auto"}})})},E)})})};Dt.__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 Be=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Le={日期:"date",展现量:"impressions",点击量:"clicks","花费(元)":"cost",点击率:"clickRate","平均点击花费(元)":"avgClickCost","千次展现花费(元)":"cpm","总成交金额(元)":"totalTransactionAmount",总成交笔数:"totalTransactionCount",点击转化率:"clickConversionRate","直接成交金额(元)":"directTransactionAmount","间接成交金额(元)":"indirectTransactionAmount",直接成交笔数:"directTransactionCount",间接成交笔数:"indirectTransactionCount",投入产出比:"roi",含预售投产比:"roiWithPresale","总成交成本(元)":"totalTransactionCost","总预售成交金额(元)":"totalPresaleAmount",总预售成交笔数:"totalPresaleCount","直接预售成交金额(元)":"directPresaleAmount",直接预售成交笔数:"directPresaleCount","间接预售成交金额(元)":"indirectPresaleAmount",间接预售成交笔数:"indirectPresaleCount",拍下订单笔数:"orderCount","拍下订单金额(元)":"orderAmount",总购物车数:"totalCartCount",直接购物车数:"directCartCount",间接购物车数:"indirectCartCount",加购率:"addToCartRate","加购成本(元)":"addToCartCost",收藏宝贝数:"productCollectionCount",收藏店铺数:"shopCollectionCount",总收藏数:"totalCollectionCount",直接收藏宝贝数:"directProductCollectionCount",间接收藏宝贝数:"indirectProductCollectionCount",宝贝收藏率:"productCollectionRate","宝贝收藏成本(元)":"productCollectionCost","店铺收藏成本(元)":"shopCollectionCost",总收藏加购数:"totalCollectionAndCartCount","总收藏加购成本(元)":"totalCollectionAndCartCost",宝贝收藏加购数:"productCollectionAndCartCount","宝贝收藏加购成本(元)":"productCollectionAndCartCost",引导访问量:"guidedVisitCount",引导访问人数:"guidedVisitorCount",引导访问潜客数:"guidedPotentialCustomerCount",引导访问潜客占比:"guidedPotentialCustomerRate",引导访问率:"guidedVisitRate",深度访问量:"deepVisitCount",平均访问页面数:"avgPageViews",成交人数:"transactionCustomerCount",成交新客数:"newCustomerCount",成交新客占比:"newCustomerRate",人均成交笔数:"avgTransactionPerCustomer",人均成交金额:"avgAmountPerCustomer",优惠券领取量:"couponClaimCount",购物金充值笔数:"shoppingCreditRechargeCount","购物金充值金额(元)":"shoppingCreditRechargeAmount",旺旺咨询量:"wangwangConsultationCount",自然流量转化金额:"organicTrafficAmount",自然流量曝光量:"organicTrafficImpressions"},et=["日期","展现量","点击量","花费(元)","点击率","平均点击花费(元)","总成交金额(元)","总成交笔数","点击转化率","总购物车数","收藏宝贝数","收藏店铺数","总收藏数","宝贝收藏成本(元)","千次展现花费(元)","总预售成交金额(元)","总预售成交笔数","直接预售成交金额(元)","直接预售成交笔数","间接预售成交金额(元)","间接预售成交笔数","拍下订单笔数","拍下订单金额(元)","直接成交金额(元)","间接成交金额(元)","直接成交笔数","间接成交笔数","投入产出比","含预售投产比","总成交成本(元)","引导访问潜客数","成交人数","人均成交笔数","人均成交金额","直接购物车数","间接购物车数","加购率","店铺收藏成本(元)","总收藏加购数","总收藏加购成本(元)","宝贝收藏加购数","宝贝收藏加购成本(元)","宝贝收藏率","加购成本(元)","直接收藏宝贝数","间接收藏宝贝数","优惠券领取量","购物金充值笔数","购物金充值金额(元)","旺旺咨询量","引导访问量","引导访问人数","引导访问潜客占比","引导访问率","深度访问量","平均访问页面数","成交新客数","成交新客占比","自然流量转化金额","自然流量曝光量"],Tn=t=>{if(!t||t.trim()==="")return"";const f=t.trim();if(f.toLowerCase()==="nan")return"NaN";const i=f.match(/^(.+?)([+-]\d)/);return i?i[1].trim():f},An=t=>t.replace(/[\u00a0\u3000]/g," ").replace(/[–—]/g,"-").replace(/%(\d)/g,"% $1").replace(/NaN(\d)/gi,"NaN $1").replace(/(\.\d+)(\d,\d{3})/g,"$1 $2").replace(/(\.\d+)(\d+\.)/g,"$1 $2").replace(/(\.\d{2})(\d+[+-]\d+\.?\d*%)/g,"$1 $2").replace(/(,\d{3})(\d+[+-]\d+\.?\d*%)/g,"$1 $2").split(/\s+/).map(i=>i.trim()).filter(i=>i!==""),Pt=t=>{const f=(t||"").replace(/[\u00a0\u3000]/g," "),i=/20\d{2}-\d{2}-\d{2}/g,d=f.match(i)||[];if(d.length===0)return{markdown:"",jsonData:[]};const v=f.split(i).filter(N=>N.trim()!=="");let D=0;v.length>0&&v[0].includes("展现量")&&(D=1);const P=et.length-1,B=[];d.forEach((N,e)=>{const n=e+D;if(n>=v.length)return;const s=v[n];let u=s.split(/[\r\n]+/).map(H=>H.trim()).filter(H=>H!=="");u.length<P&&(u=An(s));const E={};E[Le.日期]=N,et.slice(1).forEach((H,F)=>{const T=u[F]||"",ne=Tn(T),K=Le[H];K&&(E[K]=ne)}),B.push(E)});const M=et.filter(N=>{const e=Le[N];return B.some(n=>n[e])}),L=`| ${M.join(" | ")} |`,q=`| ${M.map(()=>"---").join(" | ")} |`,j=B.map(N=>`| ${M.map(n=>{const s=Le[n];return N[s]||"-"}).join(" | ")} |`);return{markdown:[L,q,...j].join(`
|
|
37
37
|
`),jsonData:B}},Ht=t=>{if(!t)return"";const f=t.trim().split(`
|
|
38
|
-
`);if(f.length<2)return Be(t);const i=f[1],v=/^\|[\s-|]+\|$/.test(i.trim());if(!i||!v)return Be(t);const P=f[0].split("|").map(j=>j.trim()).filter(j=>j!==""),B=f.slice(2).map(j=>j.split("|").map(S=>S.trim()).filter((S,N,e)=>N>0&&N<e.length)),M="border:1px solid #d9d9d9;padding:8px 12px;background-color:#fafafa;font-weight:600;text-align:left;white-space:nowrap;",L="border:1px solid #d9d9d9;padding:6px 12px;text-align:left;white-space:nowrap;";let q='<div style="overflow-x:auto;max-width:100%;">';return q+='<table style="border-collapse:collapse;width:100%;font-size:12px;margin:8px 0;">',q+="<thead><tr>",P.forEach(j=>{q+=`<th style="${M}">${Be(j)}</th>`}),q+="</tr></thead>",q+="<tbody>",B.forEach(j=>{q+="<tr>",P.forEach((S,N)=>{const e=j[N]||"-";q+=`<td style="${L}">${Be(e)}</td>`}),q+="</tr>"}),q+="</tbody></table></div>",q},Bt=t=>{const f=[],i=t.querySelector("thead tr");if(!i)return f;const d=[];return i.querySelectorAll("th").forEach(D=>{d.push(D.textContent?.trim()||"")}),t.querySelectorAll("tbody tr").forEach(D=>{const P={};D.querySelectorAll("td").forEach((M,L)=>{const q=d[L],j=Le[q];if(j){const S=M.textContent?.trim()||"";P[j]=S==="-"?"":S}}),Object.keys(P).length>0&&f.push(P)}),f},qn=t=>async f=>{const i=Pt(f.text);return t&&t(i.jsonData),{modules:[{title:"推广分析表格",content:Ht(i.markdown),markdown:i.markdown}]}},Nn=(t,f,i)=>{const d=parseFloat(String(t.get("grossProfitMargin")||"0"))||0,v=parseFloat(String(t.get("refundRate")||"0"))||0;let D=[];if(f){const P=Bt(f);P.length>0&&(D=P)}return D.length===0&&i&&i.length>0&&(D=i),{grossProfitMargin:d,refundRate:v,tableData:D}},_n={algorithm:oe.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"}}};le.AdvancedTable=wt,le.AppModal=yt,le.BackButton=
|
|
38
|
+
`);if(f.length<2)return Be(t);const i=f[1],v=/^\|[\s-|]+\|$/.test(i.trim());if(!i||!v)return Be(t);const P=f[0].split("|").map(j=>j.trim()).filter(j=>j!==""),B=f.slice(2).map(j=>j.split("|").map(S=>S.trim()).filter((S,N,e)=>N>0&&N<e.length)),M="border:1px solid #d9d9d9;padding:8px 12px;background-color:#fafafa;font-weight:600;text-align:left;white-space:nowrap;",L="border:1px solid #d9d9d9;padding:6px 12px;text-align:left;white-space:nowrap;";let q='<div style="overflow-x:auto;max-width:100%;">';return q+='<table style="border-collapse:collapse;width:100%;font-size:12px;margin:8px 0;">',q+="<thead><tr>",P.forEach(j=>{q+=`<th style="${M}">${Be(j)}</th>`}),q+="</tr></thead>",q+="<tbody>",B.forEach(j=>{q+="<tr>",P.forEach((S,N)=>{const e=j[N]||"-";q+=`<td style="${L}">${Be(e)}</td>`}),q+="</tr>"}),q+="</tbody></table></div>",q},Bt=t=>{const f=[],i=t.querySelector("thead tr");if(!i)return f;const d=[];return i.querySelectorAll("th").forEach(D=>{d.push(D.textContent?.trim()||"")}),t.querySelectorAll("tbody tr").forEach(D=>{const P={};D.querySelectorAll("td").forEach((M,L)=>{const q=d[L],j=Le[q];if(j){const S=M.textContent?.trim()||"";P[j]=S==="-"?"":S}}),Object.keys(P).length>0&&f.push(P)}),f},qn=t=>async f=>{const i=Pt(f.text);return t&&t(i.jsonData),{modules:[{title:"推广分析表格",content:Ht(i.markdown),markdown:i.markdown}]}},Nn=(t,f,i)=>{const d=parseFloat(String(t.get("grossProfitMargin")||"0"))||0,v=parseFloat(String(t.get("refundRate")||"0"))||0;let D=[];if(f){const P=Bt(f);P.length>0&&(D=P)}return D.length===0&&i&&i.length>0&&(D=i),{grossProfitMargin:d,refundRate:v,tableData:D}},_n={algorithm:oe.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"}}};le.AdvancedTable=wt,le.AppModal=yt,le.BackButton=xt,le.Button=ft,le.Card=mt,le.DynamicInput=It,le.DynamicTextArea=Mt,le.EmptyAndSpin=bt,le.HEADER_TO_FIELD=Le,le.LinkButton=vt,le.PageTable=ht,le.RichTextEditor=Nt,le.VideoCard=Re,le.VirtualTable=Lt,le.Waterfall=Dt,le.XcIcon=gt,le.buildPromotionSendPayload=Nn,le.createMarkdownAnalyze=qn,le.escapeHtml=Be,le.extractTableDataFromHtml=Bt,le.lightTheme=_n,le.parsePromotionTableMarkdown=Pt,le.renderMarkdownToHtml=Ht,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|
|
39
39
|
//# sourceMappingURL=index.umd.js.map
|